/* this table gives more information about formats */
static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
/* YUV formats */
- [PIX_FMT_YUV420P] = {
- .name = "yuv420p",
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- .x_chroma_shift = 1,.y_chroma_shift = 1,
+ /* [PIX_FMT_YUV420P] = */ {
+ /* .name = */ "yuv420p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 1,
+ /* .y_chroma_shift = */ 1,
+ /* .depth = */ 8,
},
- [PIX_FMT_YUV422P] = {
- .name = "yuv422p",
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- .x_chroma_shift = 1,.y_chroma_shift = 0,
+ /* [PIX_FMT_YUV422P] = */ {
+ /* .name = */ "yuv422p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 1,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 8,
},
- [PIX_FMT_YUV444P] = {
- .name = "yuv444p",
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- .x_chroma_shift = 0,.y_chroma_shift = 0,
+ /* [PIX_FMT_YUV444P] = */ {
+ /* .name = */ "yuv444p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 0,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 8,
},
- [PIX_FMT_YUV422] = {
- .name = "yuv422",
- .nb_channels = 1,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- .x_chroma_shift = 1,.y_chroma_shift = 0,
+ /* [PIX_FMT_YUV422] = */ {
+ /* .name = */ "yuv422",
+ /* .nb_channels = */ 1,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 1,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 8,
},
- [PIX_FMT_YUV410P] = {
- .name = "yuv410p",
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- .x_chroma_shift = 2,.y_chroma_shift = 2,
+ /* [PIX_FMT_YUV410P] = */ {
+ /* .name = */ "yuv410p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 2,
+ /* .y_chroma_shift = */ 2,
+ /* .depth = */ 8,
},
- [PIX_FMT_YUV411P] = {
- .name = "yuv411p",
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- .x_chroma_shift = 2,.y_chroma_shift = 0,
+ /* [PIX_FMT_YUV411P] = */ {
+ /* .name = */ "yuv411p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 2,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 8,
},
/* JPEG YUV */
- [PIX_FMT_YUVJ420P] = {
- .name = "yuvj420p",
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV_JPEG,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- .x_chroma_shift = 1,.y_chroma_shift = 1,
+ /* [PIX_FMT_YUVJ420P] = */ {
+ /* .name = */ "yuvj420p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV_JPEG,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 1,
+ /* .y_chroma_shift = */ 1,
+ /* .depth = */ 8,
},
- [PIX_FMT_YUVJ422P] = {
- .name = "yuvj422p",
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV_JPEG,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- .x_chroma_shift = 1,.y_chroma_shift = 0,
+ /* [PIX_FMT_YUVJ422P] = */ {
+ /* .name = */ "yuvj422p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV_JPEG,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 1,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 8,
},
- [PIX_FMT_YUVJ444P] = {
- .name = "yuvj444p",
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV_JPEG,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- .x_chroma_shift = 0,.y_chroma_shift = 0,
+ /* [PIX_FMT_YUVJ444P] = */ {
+ /* .name = */ "yuvj444p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV_JPEG,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 0,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 8,
},
/* RGB formats */
- [PIX_FMT_RGB24] = {
- .name = "rgb24",
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- .x_chroma_shift = 0,.y_chroma_shift = 0,
+ /* [PIX_FMT_RGB24] = */ {
+ /* .name = */ "rgb24",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_RGB,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 0,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 8,
},
- [PIX_FMT_BGR24] = {
- .name = "bgr24",
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- .x_chroma_shift = 0,.y_chroma_shift = 0,
+ /* [PIX_FMT_BGR24] = */ {
+ /* .name = */ "bgr24",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_RGB,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 0,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 8,
},
- [PIX_FMT_RGBA32] = {
- .name = "rgba32",
- .nb_channels = 4,.is_alpha = 1,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- .x_chroma_shift = 0,.y_chroma_shift = 0,
+ /* [PIX_FMT_RGBA32] = */ {
+ /* .name = */ "rgba32",
+ /* .nb_channels = */ 4,
+ /* .color_type = */ FF_COLOR_RGB,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 1,
+ /* .x_chroma_shift = */ 0,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 8,
},
- [PIX_FMT_RGB565] = {
- .name = "rgb565",
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 5,
- .x_chroma_shift = 0,.y_chroma_shift = 0,
+ /* [PIX_FMT_RGB565] = */ {
+ /* .name = */ "rgb565",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_RGB,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 0,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 5,
},
- [PIX_FMT_RGB555] = {
- .name = "rgb555",
- .nb_channels = 4,.is_alpha = 1,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 5,
- .x_chroma_shift = 0,.y_chroma_shift = 0,
+ /* [PIX_FMT_RGB555] = */ {
+ /* .name = */ "rgb555",
+ /* .nb_channels = */ 4,
+ /* .color_type = */ FF_COLOR_RGB,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 1,
+ /* .x_chroma_shift = */ 0,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 5,
},
/* gray / mono formats */
- [PIX_FMT_GRAY8] = {
- .name = "gray",
- .nb_channels = 1,
- .color_type = FF_COLOR_GRAY,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
+ /* [PIX_FMT_GRAY8] = */ {
+ /* .name = */ "gray",
+ /* .nb_channels = */ 1,
+ /* .color_type = */ FF_COLOR_GRAY,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 0,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 8,
},
- [PIX_FMT_MONOWHITE] = {
- .name = "monow",
- .nb_channels = 1,
- .color_type = FF_COLOR_GRAY,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 1,
+ /* [PIX_FMT_MONOWHITE] = */ {
+ /* .name = */ "monow",
+ /* .nb_channels = */ 1,
+ /* .color_type = */ FF_COLOR_GRAY,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 0,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 1,
},
- [PIX_FMT_MONOBLACK] = {
- .name = "monob",
- .nb_channels = 1,
- .color_type = FF_COLOR_GRAY,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 1,
+ /* [PIX_FMT_MONOBLACK] = */ {
+ /* .name = */ "monob",
+ /* .nb_channels = */ 1,
+ /* .color_type = */ FF_COLOR_GRAY,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
+ /* .x_chroma_shift = */ 0,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 1,
},
/* paletted formats */
- [PIX_FMT_PAL8] = {
- .name = "pal8",
- .nb_channels = 4,.is_alpha = 1,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PALETTE,
- .depth = 8,
+ /* [PIX_FMT_PAL8] = */ {
+ /* .name = */ "pal8",
+ /* .nb_channels = */ 4,
+ /* .color_type = */ FF_COLOR_RGB,
+ /* .pixel_type = */ FF_PIXEL_PALETTE,
+ /* .is_alpha = */ 1,
+ /* .x_chroma_shift = */ 0,
+ /* .y_chroma_shift = */ 0,
+ /* .depth = */ 8,
},
};
for (r = 0; r < 6; r++) {
for (g = 0; g < 6; g++) {
for (b = 0; b < 6; b++) {
- pal[i++] = (0xff << 24) | (pal_value[r] << 16) |
+ pal[i++] = (0xffU << 24) | (pal_value[r] << 16) |
(pal_value[g] << 8) | pal_value[b];
}
}
gray_to_mono (dst, src, width, height, 0x00);
}
+typedef void (*convert_func) (AVPicture * dst, const AVPicture * src, int width,
+ int height);
+
typedef struct ConvertEntry
{
- void (*convert) (AVPicture * dst,
- const AVPicture * src, int width, int height);
+ int from;
+ int to;
+ convert_func convert;
}
ConvertEntry;
The other conversion functions are just optimisations for common cases.
*/
-static ConvertEntry convert_table[PIX_FMT_NB][PIX_FMT_NB] = {
- [PIX_FMT_YUV420P] = {
- [PIX_FMT_RGB555] = {
- .convert = yuv420p_to_rgb555},
- [PIX_FMT_RGB565] = {
- .convert = yuv420p_to_rgb565},
- [PIX_FMT_BGR24] = {
- .convert = yuv420p_to_bgr24},
- [PIX_FMT_RGB24] = {
- .convert = yuv420p_to_rgb24},
- [PIX_FMT_RGBA32] = {
- .convert = yuv420p_to_rgba32},
- },
- [PIX_FMT_YUV422P] = {
- [PIX_FMT_YUV422] = {
- .convert = yuv422p_to_yuv422,
- },
- },
- [PIX_FMT_YUV444P] = {
- [PIX_FMT_RGB24] = {
- .convert = yuv444p_to_rgb24},
- },
- [PIX_FMT_YUVJ420P] = {
- [PIX_FMT_RGB555] = {
- .convert = yuvj420p_to_rgb555},
- [PIX_FMT_RGB565] = {
- .convert = yuvj420p_to_rgb565},
- [PIX_FMT_BGR24] = {
- .convert = yuvj420p_to_bgr24},
- [PIX_FMT_RGB24] = {
- .convert = yuvj420p_to_rgb24},
- [PIX_FMT_RGBA32] = {
- .convert = yuvj420p_to_rgba32},
- },
- [PIX_FMT_YUVJ444P] = {
- [PIX_FMT_RGB24] = {
- .convert = yuvj444p_to_rgb24},
- },
- [PIX_FMT_YUV422] = {
- [PIX_FMT_YUV420P] = {
- .convert = yuv422_to_yuv420p,
- },
- [PIX_FMT_YUV422P] = {
- .convert = yuv422_to_yuv422p,
- },
- },
-
- [PIX_FMT_RGB24] = {
- [PIX_FMT_YUV420P] = {
- .convert = rgb24_to_yuv420p},
- [PIX_FMT_RGB565] = {
- .convert = rgb24_to_rgb565},
- [PIX_FMT_RGB555] = {
- .convert = rgb24_to_rgb555},
- [PIX_FMT_RGBA32] = {
- .convert = rgb24_to_rgba32},
- [PIX_FMT_BGR24] = {
- .convert = rgb24_to_bgr24},
- [PIX_FMT_GRAY8] = {
- .convert = rgb24_to_gray},
- [PIX_FMT_PAL8] = {
- .convert = rgb24_to_pal8},
- [PIX_FMT_YUV444P] = {
- .convert = rgb24_to_yuv444p},
- [PIX_FMT_YUVJ420P] = {
- .convert = rgb24_to_yuvj420p},
- [PIX_FMT_YUVJ444P] = {
- .convert = rgb24_to_yuvj444p},
- },
- [PIX_FMT_RGBA32] = {
- [PIX_FMT_RGB24] = {
- .convert = rgba32_to_rgb24},
- [PIX_FMT_RGB555] = {
- .convert = rgba32_to_rgb555},
- [PIX_FMT_PAL8] = {
- .convert = rgba32_to_pal8},
- [PIX_FMT_YUV420P] = {
- .convert = rgba32_to_yuv420p},
- [PIX_FMT_GRAY8] = {
- .convert = rgba32_to_gray},
- },
- [PIX_FMT_BGR24] = {
- [PIX_FMT_RGB24] = {
- .convert = bgr24_to_rgb24},
- [PIX_FMT_YUV420P] = {
- .convert = bgr24_to_yuv420p},
- [PIX_FMT_GRAY8] = {
- .convert = bgr24_to_gray},
- },
- [PIX_FMT_RGB555] = {
- [PIX_FMT_RGB24] = {
- .convert = rgb555_to_rgb24},
- [PIX_FMT_RGBA32] = {
- .convert = rgb555_to_rgba32},
- [PIX_FMT_YUV420P] = {
- .convert = rgb555_to_yuv420p},
- [PIX_FMT_GRAY8] = {
- .convert = rgb555_to_gray},
- },
- [PIX_FMT_RGB565] = {
- [PIX_FMT_RGB24] = {
- .convert = rgb565_to_rgb24},
- [PIX_FMT_YUV420P] = {
- .convert = rgb565_to_yuv420p},
- [PIX_FMT_GRAY8] = {
- .convert = rgb565_to_gray},
- },
- [PIX_FMT_GRAY8] = {
- [PIX_FMT_RGB555] = {
- .convert = gray_to_rgb555},
- [PIX_FMT_RGB565] = {
- .convert = gray_to_rgb565},
- [PIX_FMT_RGB24] = {
- .convert = gray_to_rgb24},
- [PIX_FMT_BGR24] = {
- .convert = gray_to_bgr24},
- [PIX_FMT_RGBA32] = {
- .convert = gray_to_rgba32},
- [PIX_FMT_MONOWHITE] = {
- .convert = gray_to_monowhite},
- [PIX_FMT_MONOBLACK] = {
- .convert = gray_to_monoblack},
- },
- [PIX_FMT_MONOWHITE] = {
- [PIX_FMT_GRAY8] = {
- .convert = monowhite_to_gray},
- },
- [PIX_FMT_MONOBLACK] = {
- [PIX_FMT_GRAY8] = {
- .convert = monoblack_to_gray},
- },
- [PIX_FMT_PAL8] = {
- [PIX_FMT_RGB555] = {
- .convert = pal8_to_rgb555},
- [PIX_FMT_RGB565] = {
- .convert = pal8_to_rgb565},
- [PIX_FMT_BGR24] = {
- .convert = pal8_to_bgr24},
- [PIX_FMT_RGB24] = {
- .convert = pal8_to_rgb24},
- [PIX_FMT_RGBA32] = {
- .convert = pal8_to_rgba32},
- },
+static ConvertEntry convert_table[] = {
+ {PIX_FMT_YUV420P, PIX_FMT_RGB24, yuv420p_to_rgb24},
+ {PIX_FMT_YUV420P, PIX_FMT_BGR24, yuv420p_to_bgr24},
+ {PIX_FMT_YUV420P, PIX_FMT_RGBA32, yuv420p_to_rgba32},
+ {PIX_FMT_YUV420P, PIX_FMT_RGB565, yuv420p_to_rgb565},
+ {PIX_FMT_YUV420P, PIX_FMT_RGB555, yuv420p_to_rgb555},
+
+ {PIX_FMT_YUV422P, PIX_FMT_YUV422, yuv422p_to_yuv422},
+ {PIX_FMT_YUV444P, PIX_FMT_RGB24, yuv444p_to_rgb24},
+ {PIX_FMT_YUV422, PIX_FMT_YUV420P, yuv422_to_yuv420p},
+ {PIX_FMT_YUV422, PIX_FMT_YUV422P, yuv422_to_yuv422p},
+
+ {PIX_FMT_YUVJ420P, PIX_FMT_RGB555, yuvj420p_to_rgb555},
+ {PIX_FMT_YUVJ420P, PIX_FMT_RGB565, yuvj420p_to_rgb565},
+ {PIX_FMT_YUVJ420P, PIX_FMT_BGR24, yuvj420p_to_bgr24},
+ {PIX_FMT_YUVJ420P, PIX_FMT_RGB24, yuvj420p_to_rgb24},
+ {PIX_FMT_YUVJ420P, PIX_FMT_RGBA32, yuvj420p_to_rgba32},
+ {PIX_FMT_YUVJ444P, PIX_FMT_RGB24, yuvj444p_to_rgb24},
+
+ {PIX_FMT_RGB24, PIX_FMT_YUV420P, rgb24_to_yuv420p},
+ {PIX_FMT_RGB24, PIX_FMT_RGB565, rgb24_to_rgb565},
+ {PIX_FMT_RGB24, PIX_FMT_RGB555, rgb24_to_rgb555},
+ {PIX_FMT_RGB24, PIX_FMT_RGBA32, rgb24_to_rgba32},
+ {PIX_FMT_RGB24, PIX_FMT_BGR24, rgb24_to_bgr24},
+ {PIX_FMT_RGB24, PIX_FMT_GRAY8, rgb24_to_gray},
+ {PIX_FMT_RGB24, PIX_FMT_PAL8, rgb24_to_pal8},
+ {PIX_FMT_RGB24, PIX_FMT_YUV444P, rgb24_to_yuv444p},
+ {PIX_FMT_RGB24, PIX_FMT_YUVJ420P, rgb24_to_yuvj420p},
+ {PIX_FMT_RGB24, PIX_FMT_YUVJ444P, rgb24_to_yuvj444p},
+
+ {PIX_FMT_RGBA32, PIX_FMT_RGB24, rgba32_to_rgb24},
+ {PIX_FMT_RGBA32, PIX_FMT_RGB555, rgba32_to_rgb555},
+ {PIX_FMT_RGBA32, PIX_FMT_PAL8, rgba32_to_pal8},
+ {PIX_FMT_RGBA32, PIX_FMT_YUV420P, rgba32_to_yuv420p},
+ {PIX_FMT_RGBA32, PIX_FMT_GRAY8, rgba32_to_gray},
+
+ {PIX_FMT_BGR24, PIX_FMT_RGB24, bgr24_to_rgb24},
+ {PIX_FMT_BGR24, PIX_FMT_YUV420P, bgr24_to_yuv420p},
+ {PIX_FMT_BGR24, PIX_FMT_GRAY8, bgr24_to_gray},
+
+ {PIX_FMT_RGB555, PIX_FMT_RGB24, rgb555_to_rgb24},
+ {PIX_FMT_RGB555, PIX_FMT_RGBA32, rgb555_to_rgba32},
+ {PIX_FMT_RGB555, PIX_FMT_YUV420P, rgb555_to_yuv420p},
+ {PIX_FMT_RGB555, PIX_FMT_GRAY8, rgb555_to_gray},
+
+ {PIX_FMT_RGB565, PIX_FMT_RGB24, rgb565_to_rgb24},
+ {PIX_FMT_RGB565, PIX_FMT_YUV420P, rgb565_to_yuv420p},
+ {PIX_FMT_RGB565, PIX_FMT_GRAY8, rgb565_to_gray},
+
+ {PIX_FMT_GRAY8, PIX_FMT_RGB555, gray_to_rgb555},
+ {PIX_FMT_GRAY8, PIX_FMT_RGB565, gray_to_rgb565},
+ {PIX_FMT_GRAY8, PIX_FMT_RGB24, gray_to_rgb24},
+ {PIX_FMT_GRAY8, PIX_FMT_BGR24, gray_to_bgr24},
+ {PIX_FMT_GRAY8, PIX_FMT_RGBA32, gray_to_rgba32},
+ {PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, gray_to_monowhite},
+ {PIX_FMT_GRAY8, PIX_FMT_MONOBLACK, gray_to_monoblack},
+
+ {PIX_FMT_MONOWHITE, PIX_FMT_GRAY8, monowhite_to_gray},
+
+ {PIX_FMT_MONOBLACK, PIX_FMT_GRAY8, monoblack_to_gray},
+
+ {PIX_FMT_PAL8, PIX_FMT_RGB555, pal8_to_rgb555},
+ {PIX_FMT_PAL8, PIX_FMT_RGB565, pal8_to_rgb565},
+ {PIX_FMT_PAL8, PIX_FMT_BGR24, pal8_to_bgr24},
+ {PIX_FMT_PAL8, PIX_FMT_RGB24, pal8_to_rgb24},
+ {PIX_FMT_PAL8, PIX_FMT_RGBA32, pal8_to_rgba32},
};
+static convert_func
+convert_table_lookup (int src_pix_fmt, int dst_pix_fmt)
+{
+ int i;
+
+ for (i = 0; i < sizeof (convert_table) / sizeof (convert_table[0]); i++) {
+ if (convert_table[i].from == src_pix_fmt &&
+ convert_table[i].to == dst_pix_fmt) {
+ return convert_table[i].convert;
+ }
+ }
+ return NULL;
+}
+
int
avpicture_alloc (AVPicture * picture, int pix_fmt, int width, int height)
{
return 0;
}
- ce = &convert_table[src_pix_fmt][dst_pix_fmt];
+ ce = convert_table_lookup (src_pix_fmt, dst_pix_fmt);
if (ce->convert) {
/* specific convertion routine */
ce->convert (dst, src, dst_width, dst_height);