Make the pixel formats which were defined as macros:

PIX_FMT_ARGB
PIX_FMT_RGBA
PIX_FMT_ABGR
PIX_FMT_BGRA

defined as enum PixelFormat values, and viceversa make:
PIX_FMT_RGB32
PIX_FMT_RGB32_1
PIX_FMT_BGR32
PIX_FMT_BGR32_1

defined as macros, also resort accordingly the enum PixelFormat
list.
Also make avcodec_get_pix_fmt() recognize the "rgb32" and "bgr32"
aliases, in order to make ffmpeg pass regressions test.

This change breaks ABI backward compatibility.

Originally committed as revision 18163 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Stefano Sabatini 2009-03-22 22:50:19 +00:00
parent e7e6b06802
commit 6e08ca9c51
4 changed files with 37 additions and 31 deletions

View File

@ -31,7 +31,7 @@
#define LIBAVCODEC_VERSION_MAJOR 52
#define LIBAVCODEC_VERSION_MINOR 22
#define LIBAVCODEC_VERSION_MICRO 2
#define LIBAVCODEC_VERSION_MICRO 3
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \

View File

@ -192,8 +192,8 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
.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,
@ -335,8 +335,8 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
.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,
@ -440,16 +440,16 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
.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,
@ -507,8 +507,14 @@ static enum PixelFormat avcodec_get_pix_fmt_internal(const char *name)
enum PixelFormat avcodec_get_pix_fmt(const char *name)
{
enum PixelFormat pix_fmt = avcodec_get_pix_fmt_internal(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, X_NE("be", "le"));
@ -624,10 +630,10 @@ int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int 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:
@ -716,10 +722,10 @@ int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt,
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:

View File

@ -35,7 +35,7 @@
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 50
#define LIBAVUTIL_VERSION_MINOR 1
#define LIBAVUTIL_VERSION_MINOR 2
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

View File

@ -63,7 +63,6 @@ enum PixelFormat {
PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
PIX_FMT_RGB32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in CPU endianness
PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
PIX_FMT_GRAY8, ///< Y , 8bpp
@ -77,7 +76,6 @@ enum PixelFormat {
PIX_FMT_XVMC_MPEG2_IDCT,
PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
PIX_FMT_BGR32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in CPU endianness
PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
PIX_FMT_BGR4, ///< packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb)
PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
@ -87,8 +85,10 @@ enum PixelFormat {
PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV
PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
PIX_FMT_RGB32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in CPU endianness
PIX_FMT_BGR32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in CPU endianness
PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
@ -126,15 +126,15 @@ enum PixelFormat {
#endif
#ifdef WORDS_BIGENDIAN
#define PIX_FMT_RGBA PIX_FMT_RGB32_1
#define PIX_FMT_BGRA PIX_FMT_BGR32_1
#define PIX_FMT_ARGB PIX_FMT_RGB32
#define PIX_FMT_ABGR PIX_FMT_BGR32
#define PIX_FMT_RGB32 PIX_FMT_ARGB
#define PIX_FMT_RGB32_1 PIX_FMT_RGBA
#define PIX_FMT_BGR32 PIX_FMT_ABGR
#define PIX_FMT_BGR32_1 PIX_FMT_BGRA
#else
#define PIX_FMT_RGBA PIX_FMT_BGR32
#define PIX_FMT_BGRA PIX_FMT_RGB32
#define PIX_FMT_ARGB PIX_FMT_BGR32_1
#define PIX_FMT_ABGR PIX_FMT_RGB32_1
#define PIX_FMT_RGB32 PIX_FMT_BGRA
#define PIX_FMT_RGB32_1 PIX_FMT_ABGR
#define PIX_FMT_BGR32 PIX_FMT_RGBA
#define PIX_FMT_BGR32_1 PIX_FMT_ARGB
#endif
#define PIX_FMT_GRAY16 PIX_FMT_NE(GRAY16)