History

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.

Lynne committed 2 years ago

Commit 281bba11 parent 9ce63e64 files · +47 −0Browse files

Unified · Split

4 files
  1. libavutil/pixdesc.c +27 −0
  2. libavutil/pixfmt.h +5 −0
  3. tests/ref/fate/imgutils +4 −0
  4. tests/ref/fate/sws-pixdesc-query +11 −0
libavutil/pixdesc.c+27−0
@@ -2828,6 +2828,33 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 2827 unmodified lines
28282828 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT |
28292829 AV_PIX_FMT_FLAG_ALPHA,
28302830 },
2831+ [AV_PIX_FMT_RGBA128BE] = {
2832+ .name = "rgba128be",
2833+ .nb_components = 4,
2834+ .log2_chroma_w = 0,
2835+ .log2_chroma_h = 0,
2836+ .comp = {
2837+ { 0, 16, 0, 0, 32 }, /* R */
2838+ { 0, 16, 4, 0, 32 }, /* G */
2839+ { 0, 16, 8, 0, 32 }, /* B */
2840+ { 0, 16, 12, 0, 32 }, /* A */
2841+ },
2842+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB |
2843+ AV_PIX_FMT_FLAG_ALPHA,
2844+ },
2845+ [AV_PIX_FMT_RGBA128LE] = {
2846+ .name = "rgba128le",
2847+ .nb_components = 4,
2848+ .log2_chroma_w = 0,
2849+ .log2_chroma_h = 0,
2850+ .comp = {
2851+ { 0, 16, 0, 0, 32 }, /* R */
2852+ { 0, 16, 4, 0, 32 }, /* G */
2853+ { 0, 16, 8, 0, 32 }, /* B */
2854+ { 0, 16, 12, 0, 32 }, /* A */
2855+ },
2856+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2857+ },
28312858 [AV_PIX_FMT_P212BE] = {
28322859 .name = "p212be",
28332860 .nb_components = 3,
libavutil/pixfmt.h+5−0
@@ -451,6 +451,9 @@ enum AVPixelFormat { · 450 unmodified lines
451451 AV_PIX_FMT_RGBF16BE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., big-endian
452452 AV_PIX_FMT_RGBF16LE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., little-endian
453453
454+ AV_PIX_FMT_RGBA128BE, ///< packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., big-endian
455+ AV_PIX_FMT_RGBA128LE, ///< packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., little-endian
456+
454457 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
455458 };
456459
@@ -562,6 +565,8 @@ enum AVPixelFormat { · 105 unmodified lines
562565 #define AV_PIX_FMT_RGBF32 AV_PIX_FMT_NE(RGBF32BE, RGBF32LE)
563566 #define AV_PIX_FMT_RGBAF32 AV_PIX_FMT_NE(RGBAF32BE, RGBAF32LE)
564567
568+#define AV_PIX_FMT_RGBA128 AV_PIX_FMT_NE(RGBA128BE, RGBA128LE)
569+
565570 /**
566571 * Chromaticity coordinates of the source primaries.
567572 * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273.
tests/ref/fate/imgutils+4−0
@@ -276,6 +276,8 @@ v30xbe planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 · 275 unmodified lines
276276 v30xle planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288
277277 rgbf16be planes: 1, linesizes: 384 0 0 0, plane_sizes: 18432 0 0 0, plane_offsets: 0 0 0, total_size: 18432
278278 rgbf16le planes: 1, linesizes: 384 0 0 0, plane_sizes: 18432 0 0 0, plane_offsets: 0 0 0, total_size: 18432
279+rgba128be planes: 1, linesizes: 1024 0 0 0, plane_sizes: 49152 0 0 0, plane_offsets: 0 0 0, total_size: 49152
280+rgba128le planes: 1, linesizes: 1024 0 0 0, plane_sizes: 49152 0 0 0, plane_offsets: 0 0 0, total_size: 49152
279281
280282 image_fill_black tests
281283 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 · 217 unmodified lines
499501 v30xle total_size: 12288, black_unknown_crc: 0xf5b3c795, black_tv_crc: 0xf5b3c795, black_pc_crc: 0x0b56173c
500502 rgbf16be total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000
501503 rgbf16le total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000
504+rgba128be total_size: 49152, black_unknown_crc: 0x59ef499b, black_tv_crc: 0x59ef499b, black_pc_crc: 0x59ef499b
505+rgba128le total_size: 49152, black_unknown_crc: 0x59ef499b, black_tv_crc: 0x59ef499b, black_pc_crc: 0x59ef499b
tests/ref/fate/sws-pixdesc-query+11−0
@@ -180,6 +180,7 @@ isBE: · 179 unmodified lines
180180 rgb48be
181181 rgb555be
182182 rgb565be
183+ rgba128be
183184 rgba64be
184185 rgbaf16be
185186 rgbaf32be
@@ -541,6 +542,8 @@ isRGB: · 355 unmodified lines
541542 rgb565be
542543 rgb565le
543544 rgb8
545+ rgba128be
546+ rgba128le
544547 rgba64be
545548 rgba64le
546549 rgbaf16be
@@ -701,6 +704,8 @@ AnyRGB: · 154 unmodified lines
701704 rgb565be
702705 rgb565le
703706 rgb8
707+ rgba128be
708+ rgba128le
704709 rgba64be
705710 rgba64le
706711 rgbaf16be
@@ -738,6 +743,8 @@ ALPHA: · 31 unmodified lines
738743 pal8
739744 rgb32
740745 rgb32_1
746+ rgba128be
747+ rgba128le
741748 rgba64be
742749 rgba64le
743750 rgbaf16be
@@ -828,6 +835,8 @@ Packed: · 84 unmodified lines
828835 rgb565be
829836 rgb565le
830837 rgb8
838+ rgba128be
839+ rgba128le
831840 rgba64be
832841 rgba64le
833842 rgbaf16be
@@ -1034,6 +1043,8 @@ PackedRGB: · 200 unmodified lines
10341043 rgb565be
10351044 rgb565le
10361045 rgb8
1046+ rgba128be
1047+ rgba128le
10371048 rgba64be
10381049 rgba64le
10391050 rgbaf16be

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t