[FFmpeg-devel] [PATCH 1/4] lavu/pixfmt: add AV_PIX_FMT_RGBA128

Lynne dev at lynne.ee
Mon Oct 14 18:11:03 EEST 2024


On 12/10/2024 01:01, Lynne wrote:
> This format is useful for doing certain lossless transforms on images,
> RCT in particular, which require you to escalate the size from 16 to
> 32 bits to avoid overflows.
> 
> APIchanges will be done alongside when comitting.
> ---
>   libavutil/pixdesc.c | 27 +++++++++++++++++++++++++++
>   libavutil/pixfmt.h  |  5 +++++
>   2 files changed, 32 insertions(+)
> 
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> index 43b9c08e14..8736e4f47d 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -2803,6 +2803,33 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
>           .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT |
>                    AV_PIX_FMT_FLAG_ALPHA,
>       },
> +    [AV_PIX_FMT_RGBA128BE] = {
> +        .name = "rgba128be",
> +        .nb_components = 4,
> +        .log2_chroma_w = 0,
> +        .log2_chroma_h = 0,
> +        .comp = {
> +            { 0, 16,  0, 0, 32 },      /* R */
> +            { 0, 16,  4, 0, 32 },      /* G */
> +            { 0, 16,  8, 0, 32 },      /* B */
> +            { 0, 16, 12, 0, 32 },      /* A */
> +        },
> +        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB |
> +                 AV_PIX_FMT_FLAG_ALPHA,
> +    },
> +    [AV_PIX_FMT_RGBA128LE] = {
> +        .name = "rgba128le",
> +        .nb_components = 4,
> +        .log2_chroma_w = 0,
> +        .log2_chroma_h = 0,
> +        .comp = {
> +            { 0, 16,  0, 0, 32 },      /* R */
> +            { 0, 16,  4, 0, 32 },      /* G */
> +            { 0, 16,  8, 0, 32 },      /* B */
> +            { 0, 16, 12, 0, 32 },      /* A */
> +        },
> +        .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
> +    },
>       [AV_PIX_FMT_P212BE] = {
>           .name = "p212be",
>           .nb_components = 3,
> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> index 3caa183ba0..f03e4d701d 100644
> --- a/libavutil/pixfmt.h
> +++ b/libavutil/pixfmt.h
> @@ -448,6 +448,9 @@ enum AVPixelFormat {
>       AV_PIX_FMT_V30XBE,      ///< packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), big-endian
>       AV_PIX_FMT_V30XLE,      ///< packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), little-endian
>   
> +    AV_PIX_FMT_RGBA128BE,   ///< packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., big-endian
> +    AV_PIX_FMT_RGBA128LE,   ///< packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., little-endian
> +
>       AV_PIX_FMT_NB         ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
>   };
>   
> @@ -558,6 +561,8 @@ enum AVPixelFormat {
>   #define AV_PIX_FMT_RGBF32     AV_PIX_FMT_NE(RGBF32BE, RGBF32LE)
>   #define AV_PIX_FMT_RGBAF32    AV_PIX_FMT_NE(RGBAF32BE, RGBAF32LE)
>   
> +#define AV_PIX_FMT_RGBA128    AV_PIX_FMT_NE(RGBA128BE, RGBA128LE)
> +
>   /**
>     * Chromaticity coordinates of the source primaries.
>     * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273.

Planning to push this patchset tomorrow unless there are comments.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xA2FEA5F03F034464.asc
Type: application/pgp-keys
Size: 624 bytes
Desc: OpenPGP public key
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241014/88498a0c/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241014/88498a0c/attachment.sig>


More information about the ffmpeg-devel mailing list