[FFmpeg-devel] [PATCH] Add colorspace properties to pixdesc

Michael Niedermayer michaelni
Thu Apr 30 03:34:13 CEST 2009

On Thu, Apr 30, 2009 at 01:49:20AM +0200, Stefano Sabatini wrote:
> Hi,
> this seems required for colorutils.c, just a preliminary patch though.
> In order to convert a color from one pixfmt to another one I need to
> know the colorspace, then I should be able to apply the correct macro
> from libavcodec/colorspace.h.
> Then I'll need to eventually scale each component value, and finally
> assign it to the correct component (for this I need the AVComponent
> color).
> I'm not sure this is the rigth approach, so before to fill the
> pixdesc.c table I'd like to hear your opinion.

this patch wins the most broken patch award of the year

let me explain (it should be obvious but it seems not)

One of the key goals of the pixfmt structure was 

Why would we want that?
again should be obvious but is obviously not :(
These are 2 semmantically seperate things, we will not duplicate the list
of all yuv formats 12 times because there are 6 yuv types and 2 (jpeg vs mpeg)
style ranges.

So repeating the forgotten discussions ...
a colorspace enum should be added to AVCodecContext

> +enum AVColorspace {
> +    AV_COLORSPACE_RGB,      /**< RGB color space */
> +    AV_COLORSPACE_YUV,      /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
> +    AV_COLORSPACE_YUV_JPEG, /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
> +};

see ff_yuv2rgb_coeffs, the mpeg4 and h264 specs
there are many yuv types ...
and refering to <= 255 for something that can be 65535 is not good
the mpeg* specs and probably h264 have a better definition, though maybe
theirs is overkill and can be simplified ...

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090430/0e23379a/attachment.pgp>

More information about the ffmpeg-devel mailing list