[FFmpeg-devel] [PATCH] pixdesc: put components always in the same order.

Stefano Sabatini stefasab at gmail.com
Sun Mar 18 15:28:36 CET 2012


On date Sunday 2012-03-18 10:15:36 +0100, Nicolas George encoded:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavutil/pixdesc.c |   94 +++++++++++++++++++++++++-------------------------
>  libavutil/pixdesc.h |    9 +++--
>  2 files changed, 53 insertions(+), 50 deletions(-)
> 
> 
> It does not seem to have any advert effect (on FATE anyway; I can run more
> tests if necessary) and it makes the table much more useful.

It looks a good idea to me, and no from what I know current code never
assumes the order of component colors so there should be no
regression, but wait a comment from Michael.

I just note that originally pixdesc was designed to be colorspace
independent, now with the RGB flag things are getting a bit different
(for example what about YUV/YUVJ? - this would almost allow to kill
lavc/imgconvert).

Also a pixdesc -> component ranges function would be useful in various
places.

[...]
> diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
> index 0730f5b..f1a2dde 100644
> --- a/libavutil/pixdesc.h
> +++ b/libavutil/pixdesc.h
> @@ -76,9 +76,12 @@ typedef struct AVPixFmtDescriptor{
>      uint8_t flags;
>  
>      /**
> -     * Parameters that describe how pixels are packed. If the format
> -     * has chroma components, they must be stored in comp[1] and
> -     * comp[2].
> +     * Parameters that describe how pixels are packed.
> +     * If the format has 2 or 4 components, then alpha is last.
> +     * If the format has 1 or 2 components, then luma is 0.
> +     * If the format has 3 or 4 components,
> +     * if the RGB flag is set then 0 is red, 1 is green and 2 is blue;
> +     * otherwise 0 is luma, 1 is chroma-U and 2 is chroma-V.
>       */
>      AVComponentDescriptor comp[4];
>  }AVPixFmtDescriptor;

This is changing the definition, so you need to bump micro or minor
version.
-- 
FFmpeg = Fancy and Faithful Multipurpose Powerful Extroverse Ghost


More information about the ffmpeg-devel mailing list