lavu/pixfmt: add AV_PIX_FMT_RGBA128

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.
This commit is contained in:
Lynne 2024-10-10 06:50:06 +02:00
parent 9ce63e65d6
commit 281bba1d26
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
4 changed files with 47 additions and 0 deletions

View File

@ -2828,6 +2828,33 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
.flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT | .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT |
AV_PIX_FMT_FLAG_ALPHA, 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] = { [AV_PIX_FMT_P212BE] = {
.name = "p212be", .name = "p212be",
.nb_components = 3, .nb_components = 3,

View File

@ -451,6 +451,9 @@ enum AVPixelFormat {
AV_PIX_FMT_RGBF16BE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., big-endian AV_PIX_FMT_RGBF16BE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., big-endian
AV_PIX_FMT_RGBF16LE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., little-endian AV_PIX_FMT_RGBF16LE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., 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 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
}; };
@ -562,6 +565,8 @@ enum AVPixelFormat {
#define AV_PIX_FMT_RGBF32 AV_PIX_FMT_NE(RGBF32BE, RGBF32LE) #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_RGBAF32 AV_PIX_FMT_NE(RGBAF32BE, RGBAF32LE)
#define AV_PIX_FMT_RGBA128 AV_PIX_FMT_NE(RGBA128BE, RGBA128LE)
/** /**
* Chromaticity coordinates of the source primaries. * 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. * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273.

View File

@ -276,6 +276,8 @@ v30xbe planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0
v30xle planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 v30xle planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288
rgbf16be planes: 1, linesizes: 384 0 0 0, plane_sizes: 18432 0 0 0, plane_offsets: 0 0 0, total_size: 18432 rgbf16be planes: 1, linesizes: 384 0 0 0, plane_sizes: 18432 0 0 0, plane_offsets: 0 0 0, total_size: 18432
rgbf16le planes: 1, linesizes: 384 0 0 0, plane_sizes: 18432 0 0 0, plane_offsets: 0 0 0, total_size: 18432 rgbf16le planes: 1, linesizes: 384 0 0 0, plane_sizes: 18432 0 0 0, plane_offsets: 0 0 0, total_size: 18432
rgba128be planes: 1, linesizes: 1024 0 0 0, plane_sizes: 49152 0 0 0, plane_offsets: 0 0 0, total_size: 49152
rgba128le planes: 1, linesizes: 1024 0 0 0, plane_sizes: 49152 0 0 0, plane_offsets: 0 0 0, total_size: 49152
image_fill_black tests image_fill_black tests
yuv420p total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af yuv420p total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af
@ -499,3 +501,5 @@ v30xbe total_size: 12288, black_unknown_crc: 0x7108457c, black_tv_cr
v30xle total_size: 12288, black_unknown_crc: 0xf5b3c795, black_tv_crc: 0xf5b3c795, black_pc_crc: 0x0b56173c v30xle total_size: 12288, black_unknown_crc: 0xf5b3c795, black_tv_crc: 0xf5b3c795, black_pc_crc: 0x0b56173c
rgbf16be total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 rgbf16be total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000
rgbf16le total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 rgbf16le total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000
rgba128be total_size: 49152, black_unknown_crc: 0x59ef499b, black_tv_crc: 0x59ef499b, black_pc_crc: 0x59ef499b
rgba128le total_size: 49152, black_unknown_crc: 0x59ef499b, black_tv_crc: 0x59ef499b, black_pc_crc: 0x59ef499b

View File

@ -180,6 +180,7 @@ isBE:
rgb48be rgb48be
rgb555be rgb555be
rgb565be rgb565be
rgba128be
rgba64be rgba64be
rgbaf16be rgbaf16be
rgbaf32be rgbaf32be
@ -541,6 +542,8 @@ isRGB:
rgb565be rgb565be
rgb565le rgb565le
rgb8 rgb8
rgba128be
rgba128le
rgba64be rgba64be
rgba64le rgba64le
rgbaf16be rgbaf16be
@ -701,6 +704,8 @@ AnyRGB:
rgb565be rgb565be
rgb565le rgb565le
rgb8 rgb8
rgba128be
rgba128le
rgba64be rgba64be
rgba64le rgba64le
rgbaf16be rgbaf16be
@ -738,6 +743,8 @@ ALPHA:
pal8 pal8
rgb32 rgb32
rgb32_1 rgb32_1
rgba128be
rgba128le
rgba64be rgba64be
rgba64le rgba64le
rgbaf16be rgbaf16be
@ -828,6 +835,8 @@ Packed:
rgb565be rgb565be
rgb565le rgb565le
rgb8 rgb8
rgba128be
rgba128le
rgba64be rgba64be
rgba64le rgba64le
rgbaf16be rgbaf16be
@ -1034,6 +1043,8 @@ PackedRGB:
rgb565be rgb565be
rgb565le rgb565le
rgb8 rgb8
rgba128be
rgba128le
rgba64be rgba64be
rgba64le rgba64le
rgbaf16be rgbaf16be