[FFmpeg-devel] [RFC] RGB32 pixfmts cleanup

Stefano Sabatini stefano.sabatini-lala
Sun Mar 22 16:20:38 CET 2009


On date Thursday 2009-03-19 01:25:19 +0100, Michael Niedermayer encoded:
> On Thu, Mar 19, 2009 at 01:12:46AM +0100, Stefano Sabatini wrote:
[...]
> [..]
> > @@ -91,8 +89,10 @@
> >      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 RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in CPU endianness
> > +    PIX_FMT_RGBA,      ///< packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in CPU endianness
> > +    PIX_FMT_ABGR,      ///< packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in CPU endianness
> > +    PIX_FMT_BGRA,      ///< packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in CPU endianness
> >  
> >      PIX_FMT_GRAY16BE,  ///<        Y        , 16bpp, big-endian
> >      PIX_FMT_GRAY16LE,  ///<        Y        , 16bpp, little-endian
> 
> the description is wrong, these are not in cpu endianness

Hi,

checking again the patch, the define change will broke regression,
since "rgb32", "rgb32_1" and friends have different meanings according
to the endianess of the system.

So we have:

name      |   BE   |  LE
----------+--------+------
"rgb32"   |  ARGB  | BGRA     
"rgb32_1" |  RGBA  | ABGR
"bgr32"   |  ABGR  | RGBA
"bgr32_1" |  BGRA  | ARGB

That is a test for the format "rgba" will work differently in LE and
BE systems.

A possible solution would be to extend the avcodec_get_pix_fmt() so
that it will recognize also the "rgb32", "rgb32_1", etc. names, and
will return the right pixel format according to the previous table.

A cleaner solution may be to extend the PixFmtInfo/AVPixFmtDecriptor
to support also one or more aliases for each pixel format name.
Then we could define the various alias for "rgba", "bgra", etc
according to the system endianess.

Regards.
-- 
FFmpeg = Faboulous and Faithful Most Porno Emblematic God
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pixfmt-info-alias.patch
Type: text/x-diff
Size: 894 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090322/4bce4dac/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clean-rgba-pixfmts.patch
Type: text/x-diff
Size: 5636 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090322/4bce4dac/attachment-0001.patch>



More information about the ffmpeg-devel mailing list