[FFmpeg-cvslog] lavu/pixfmt: add AV_PIX_FMT_RGBA128

Lynne git at videolan.org
Tue Oct 15 18:47:53 EEST 2024


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Thu Oct 10 06:50:06 2024 +0200| [281bba1d26a4e98ea7848a402588d9c2e9934bf6] | committer: Lynne

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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=281bba1d26a4e98ea7848a402588d9c2e9934bf6
---

 libavutil/pixdesc.c              | 27 +++++++++++++++++++++++++++
 libavutil/pixfmt.h               |  5 +++++
 tests/ref/fate/imgutils          |  4 ++++
 tests/ref/fate/sws-pixdesc-query | 11 +++++++++++
 4 files changed, 47 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index e73600f208..7b63d1d7b0 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -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 |
                  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 21564b97ff..901afbaed3 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -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_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
 };
 
@@ -562,6 +565,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.
diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index 4c91358f5a..248704beb7 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -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
 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
+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
 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
 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
+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
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index ae206ce905..83bf3d31a1 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -180,6 +180,7 @@ isBE:
   rgb48be
   rgb555be
   rgb565be
+  rgba128be
   rgba64be
   rgbaf16be
   rgbaf32be
@@ -541,6 +542,8 @@ isRGB:
   rgb565be
   rgb565le
   rgb8
+  rgba128be
+  rgba128le
   rgba64be
   rgba64le
   rgbaf16be
@@ -701,6 +704,8 @@ AnyRGB:
   rgb565be
   rgb565le
   rgb8
+  rgba128be
+  rgba128le
   rgba64be
   rgba64le
   rgbaf16be
@@ -738,6 +743,8 @@ ALPHA:
   pal8
   rgb32
   rgb32_1
+  rgba128be
+  rgba128le
   rgba64be
   rgba64le
   rgbaf16be
@@ -828,6 +835,8 @@ Packed:
   rgb565be
   rgb565le
   rgb8
+  rgba128be
+  rgba128le
   rgba64be
   rgba64le
   rgbaf16be
@@ -1034,6 +1043,8 @@ PackedRGB:
   rgb565be
   rgb565le
   rgb8
+  rgba128be
+  rgba128le
   rgba64be
   rgba64le
   rgbaf16be



More information about the ffmpeg-cvslog mailing list