.depth = 8,
.x_chroma_shift = 0, .y_chroma_shift = 1,
},
+ [PIX_FMT_YUV420PLE] = {
+ .name = "yuv420ple",
+ .nb_channels = 3,
+ .color_type = FF_COLOR_YUV,
+ .pixel_type = FF_PIXEL_PLANAR,
+ .depth = 16,
+ .x_chroma_shift = 1, .y_chroma_shift = 1,
+ },
+ [PIX_FMT_YUV422PLE] = {
+ .name = "yuv422ple",
+ .nb_channels = 3,
+ .color_type = FF_COLOR_YUV,
+ .pixel_type = FF_PIXEL_PLANAR,
+ .depth = 16,
+ .x_chroma_shift = 1, .y_chroma_shift = 0,
+ },
+ [PIX_FMT_YUV444PLE] = {
+ .name = "yuv444ple",
+ .nb_channels = 3,
+ .color_type = FF_COLOR_YUV,
+ .pixel_type = FF_PIXEL_PLANAR,
+ .depth = 16,
+ .x_chroma_shift = 0, .y_chroma_shift = 0,
+ },
+ [PIX_FMT_YUV420PBE] = {
+ .name = "yuv420pbe",
+ .nb_channels = 3,
+ .color_type = FF_COLOR_YUV,
+ .pixel_type = FF_PIXEL_PLANAR,
+ .depth = 16,
+ .x_chroma_shift = 1, .y_chroma_shift = 1,
+ },
+ [PIX_FMT_YUV422PBE] = {
+ .name = "yuv422pbe",
+ .nb_channels = 3,
+ .color_type = FF_COLOR_YUV,
+ .pixel_type = FF_PIXEL_PLANAR,
+ .depth = 16,
+ .x_chroma_shift = 1, .y_chroma_shift = 0,
+ },
+ [PIX_FMT_YUV444PBE] = {
+ .name = "yuv444pbe",
+ .nb_channels = 3,
+ .color_type = FF_COLOR_YUV,
+ .pixel_type = FF_PIXEL_PLANAR,
+ .depth = 16,
+ .x_chroma_shift = 0, .y_chroma_shift = 0,
+ },
+
/* YUV formats with alpha plane */
[PIX_FMT_YUVA420P] = {
.depth = 8,
.x_chroma_shift = 0, .y_chroma_shift = 0,
},
- [PIX_FMT_RGB32] = {
- .name = "rgb32",
+ [PIX_FMT_ARGB] = {
+ .name = "argb",
.nb_channels = 4, .is_alpha = 1,
.color_type = FF_COLOR_RGB,
.pixel_type = FF_PIXEL_PACKED,
.depth = 16,
.x_chroma_shift = 0, .y_chroma_shift = 0,
},
- [PIX_FMT_RGB565] = {
- .name = "rgb565",
+ [PIX_FMT_RGB565BE] = {
+ .name = "rgb565be",
+ .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_RGB565LE] = {
+ .name = "rgb565le",
+ .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_RGB555BE] = {
+ .name = "rgb555be",
.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_RGB555] = {
- .name = "rgb555",
+ [PIX_FMT_RGB555LE] = {
+ .name = "rgb555le",
.nb_channels = 3,
.color_type = FF_COLOR_RGB,
.pixel_type = FF_PIXEL_PACKED,
.depth = 8,
.x_chroma_shift = 2, .y_chroma_shift = 0,
},
- [PIX_FMT_BGR32] = {
- .name = "bgr32",
+ [PIX_FMT_ABGR] = {
+ .name = "abgr",
.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_BGR565] = {
- .name = "bgr565",
+ [PIX_FMT_BGR565BE] = {
+ .name = "bgr565be",
+ .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_BGR565LE] = {
+ .name = "bgr565le",
.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_BGR555] = {
- .name = "bgr555",
+ [PIX_FMT_BGR555BE] = {
+ .name = "bgr555be",
+ .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_BGR555LE] = {
+ .name = "bgr555le",
.nb_channels = 3,
.color_type = FF_COLOR_RGB,
.pixel_type = FF_PIXEL_PACKED,
.x_chroma_shift = 1, .y_chroma_shift = 1,
},
- [PIX_FMT_BGR32_1] = {
- .name = "bgr32_1",
+ [PIX_FMT_BGRA] = {
+ .name = "bgra",
.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_RGB32_1] = {
- .name = "rgb32_1",
+ [PIX_FMT_RGBA] = {
+ .name = "rgba",
.nb_channels = 4, .is_alpha = 1,
.color_type = FF_COLOR_RGB,
.pixel_type = FF_PIXEL_PACKED,
int i;
for (i=0; i < PIX_FMT_NB; i++)
- if (!strcmp(pix_fmt_info[i].name, name))
- return i;
+ if (pix_fmt_info[i].name && !strcmp(pix_fmt_info[i].name, name))
+ return i;
return PIX_FMT_NONE;
}
-enum PixelFormat avcodec_get_pix_fmt(const char *name)
-{
#ifdef WORDS_BIGENDIAN
-# define NE "be"
+# define X_NE(be, le) be
#else
-# define NE "le"
+# define X_NE(be, le) le
#endif
- enum PixelFormat pix_fmt = avcodec_get_pix_fmt_internal(name);
+enum PixelFormat avcodec_get_pix_fmt(const char *name)
+{
+ enum PixelFormat pix_fmt;
+
+ if (!strcmp(name, "rgb32"))
+ name = X_NE("argb", "bgra");
+ else if (!strcmp(name, "bgr32"))
+ name = X_NE("abgr", "rgba");
+
+ pix_fmt = avcodec_get_pix_fmt_internal(name);
if (pix_fmt == PIX_FMT_NONE) {
char name2[32];
- snprintf(name2, sizeof(name2), "%s%s", name, NE);
+ snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
pix_fmt = avcodec_get_pix_fmt_internal(name2);
}
return pix_fmt;
-#undef NE
}
void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt)
picture->linesize[1] = w2;
picture->linesize[2] = w2;
break;
+ case PIX_FMT_YUV420PLE:
+ case PIX_FMT_YUV422PLE:
+ case PIX_FMT_YUV444PLE:
+ case PIX_FMT_YUV420PBE:
+ case PIX_FMT_YUV422PBE:
+ case PIX_FMT_YUV444PBE:
+ w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift;
+ picture->linesize[0] = 2*width;
+ picture->linesize[1] = 2*w2;
+ picture->linesize[2] = 2*w2;
+ break;
case PIX_FMT_YUVA420P:
w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift;
picture->linesize[0] = width;
case PIX_FMT_BGR24:
picture->linesize[0] = width * 3;
break;
- case PIX_FMT_RGB32:
- case PIX_FMT_BGR32:
- case PIX_FMT_RGB32_1:
- case PIX_FMT_BGR32_1:
+ case PIX_FMT_ARGB:
+ case PIX_FMT_ABGR:
+ case PIX_FMT_RGBA:
+ case PIX_FMT_BGRA:
picture->linesize[0] = width * 4;
break;
case PIX_FMT_RGB48BE:
case PIX_FMT_YUVJ422P:
case PIX_FMT_YUVJ444P:
case PIX_FMT_YUVJ440P:
+ case PIX_FMT_YUV420PLE:
+ case PIX_FMT_YUV422PLE:
+ case PIX_FMT_YUV444PLE:
+ case PIX_FMT_YUV420PBE:
+ case PIX_FMT_YUV422PBE:
+ case PIX_FMT_YUV444PBE:
h2 = (height + (1 << pinfo->y_chroma_shift) - 1) >> pinfo->y_chroma_shift;
size2 = picture->linesize[1] * h2;
picture->data[0] = ptr;
return size + 2 * size2;
case PIX_FMT_RGB24:
case PIX_FMT_BGR24:
- case PIX_FMT_RGB32:
- case PIX_FMT_BGR32:
- case PIX_FMT_RGB32_1:
- case PIX_FMT_BGR32_1:
+ case PIX_FMT_ARGB:
+ case PIX_FMT_ABGR:
+ case PIX_FMT_RGBA:
+ case PIX_FMT_BGRA:
case PIX_FMT_RGB48BE:
case PIX_FMT_RGB48LE:
case PIX_FMT_GRAY16BE:
int loss;
ps = &pix_fmt_info[src_pix_fmt];
- pf = &pix_fmt_info[dst_pix_fmt];
/* compute loss */
loss = 0;
int i;
const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
- pf = &pix_fmt_info[pix_fmt];
switch(pf->pixel_type) {
case FF_PIXEL_PACKED:
case FF_PIXEL_PLANAR:
const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
int ret;
- pf = &pix_fmt_info[pix_fmt];
/* no alpha can be represented in format */
if (!pf->is_alpha)
return 0;