On date Wednesday 2011-07-13 01:14:44 +0800, Fredrik Mellbin encoded:
> Adding colorspace flags to AVPixFmtDescriptor will allow many similar
> collections of attributes spread around the codebase to be removed.
> 
> ---
>  libavutil/pixdesc.c |   55 +++++++++++++++++++++++++++++++++-----------------
>  libavutil/pixdesc.h |    9 ++++++++
>  2 files changed, 45 insertions(+), 19 deletions(-)
[...]
> diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
> index 979a235..a1195ea 100644
> --- a/libavutil/pixdesc.h
> +++ b/libavutil/pixdesc.h
> @@ -87,6 +87,15 @@ typedef struct AVPixFmtDescriptor{
>  #define PIX_FMT_PAL       2 ///< Pixel format has a palette in
> data[1], values are indexes in this palette.
>  #define PIX_FMT_BITSTREAM 4 ///< All values of a component are
> bit-wise packed end to end.
>  #define PIX_FMT_HWACCEL   8 ///< Pixel format is an HW accelerated format.
> +#define PIX_FMT_ALPHA       0x10 ///< Pixel format has an alpha channel.
> +
> +#define PIX_FMT_YUV         0x00
> +#define PIX_FMT_GRAY        0x20
> +#define PIX_FMT_RGB         0x40
> +#define PIX_FMT_BGR         0x60
> +
> +#define PIX_FMT_RGB_BIT     0x40 ///< Bit mask to check for RGB.
> +#define PIX_FMT_CS_BITS     0x60 ///< Bit mask for the colorspace 
> information.

pixdesc is not-related to colorspace by design, it only speaks about
the layout of the pixel components.

Colorspace information does not belong there, a possible solution
would require the use of an external struct which contains information
about the colorspace per each component in a pixdesc.

Adding colorspace information in pixdesc is IMO just wrong and
underkill.

A proper solution on the other hand is not simple, since currently the
colorspace information is contained implicitely in the pixfmt
definition. A temporary solution may consists into storing the
colorspace information into a (possibly internal) array, like it is
done in libavcodec/imgconvert.c.
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to