diff mbox series

[FFmpeg-devel,1/6] avutil/pixfmt: add Y216 pixel format

Message ID 20241022124847.14314-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/6] avutil/pixfmt: add Y216 pixel format | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

James Almer Oct. 22, 2024, 12:48 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavutil/pixdesc.c              | 23 +++++++++++++++++++++++
 libavutil/pixfmt.h               |  4 ++++
 libavutil/tests/pixfmt_best.c    |  2 ++
 tests/ref/fate/imgutils          |  4 ++++
 tests/ref/fate/pixfmt_best       |  2 +-
 tests/ref/fate/sws-pixdesc-query |  7 +++++++
 6 files changed, 41 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index e15105e9f4..ba96803e5b 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2948,6 +2948,29 @@  static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         },
         .flags = AV_PIX_FMT_FLAG_PLANAR,
     },
+    [AV_PIX_FMT_Y216LE] = {
+        .name = "y216le",
+        .nb_components = 3,
+        .log2_chroma_w = 1,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 4, 0, 0, 16 },        /* Y */
+            { 0, 8, 2, 0, 16 },        /* U */
+            { 0, 8, 6, 0, 16 },        /* V */
+        },
+    },
+    [AV_PIX_FMT_Y216BE] = {
+        .name = "y216be",
+        .nb_components = 3,
+        .log2_chroma_w = 1,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 4, 0, 0, 16 },        /* Y */
+            { 0, 8, 2, 0, 16 },        /* U */
+            { 0, 8, 6, 0, 16 },        /* V */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE,
+    },
 };
 
 static const char * const color_range_names[] = {
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 0dc4abc972..0b6b69fdeb 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -457,6 +457,9 @@  enum AVPixelFormat {
     AV_PIX_FMT_RGB96BE,     ///< packed RGBA 32:32:32, 96bpp, RGBRGB..., big-endian
     AV_PIX_FMT_RGB96LE,     ///< packed RGBA 32:32:32, 96bpp, RGBRGB..., little-endian
 
+    AV_PIX_FMT_Y216BE,      ///< packed YUV 4:2:2 like YUYV422, 32bpp, big-endian
+    AV_PIX_FMT_Y216LE,      ///< packed YUV 4:2:2 like YUYV422, 32bpp, 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
 };
 
@@ -549,6 +552,7 @@  enum AVPixelFormat {
 
 #define AV_PIX_FMT_Y210       AV_PIX_FMT_NE(Y210BE,  Y210LE)
 #define AV_PIX_FMT_Y212       AV_PIX_FMT_NE(Y212BE,  Y212LE)
+#define AV_PIX_FMT_Y216       AV_PIX_FMT_NE(Y216BE,  Y216LE)
 #define AV_PIX_FMT_XV30       AV_PIX_FMT_NE(XV30BE,  XV30LE)
 #define AV_PIX_FMT_XV36       AV_PIX_FMT_NE(XV36BE,  XV36LE)
 #define AV_PIX_FMT_V30X       AV_PIX_FMT_NE(V30XBE,  V30XLE)
diff --git a/libavutil/tests/pixfmt_best.c b/libavutil/tests/pixfmt_best.c
index fe04e26689..c853be0e34 100644
--- a/libavutil/tests/pixfmt_best.c
+++ b/libavutil/tests/pixfmt_best.c
@@ -50,6 +50,7 @@  static const enum AVPixelFormat packed_list[] = {
     AV_PIX_FMT_XV36,
     AV_PIX_FMT_XV30,
     AV_PIX_FMT_VUYX,
+    AV_PIX_FMT_Y216,
     AV_PIX_FMT_Y212,
     AV_PIX_FMT_Y210,
     AV_PIX_FMT_YUYV422,
@@ -210,6 +211,7 @@  int main(void)
     TEST_PACKED(AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUYV422);
     TEST_PACKED(AV_PIX_FMT_YUV422P10, AV_PIX_FMT_Y210);
     TEST_PACKED(AV_PIX_FMT_YUV422P12, AV_PIX_FMT_Y212);
+    TEST_PACKED(AV_PIX_FMT_YUV422P16, AV_PIX_FMT_Y216);
 
 #define TEST_SUBSAMPLED(input, expected) \
     test(input, expected, &pass, &fail, find_best_subsampled)
diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index 8639baa550..7fbb1fd902 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -280,6 +280,8 @@  rgba128be       planes: 1, linesizes: 1024   0   0   0, plane_sizes: 49152     0
 rgba128le       planes: 1, linesizes: 1024   0   0   0, plane_sizes: 49152     0     0     0, plane_offsets:     0     0     0, total_size: 49152
 rgb96be         planes: 1, linesizes: 768   0   0   0, plane_sizes: 36864     0     0     0, plane_offsets:     0     0     0, total_size: 36864
 rgb96le         planes: 1, linesizes: 768   0   0   0, plane_sizes: 36864     0     0     0, plane_offsets:     0     0     0, total_size: 36864
+y216be          planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0     0     0, plane_offsets:     0     0     0, total_size: 12288
+y216le          planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0     0     0, plane_offsets:     0     0     0, total_size: 12288
 
 image_fill_black tests
 yuv420p         total_size:   4608,  black_unknown_crc: 0xd00f6cc6,  black_tv_crc: 0xd00f6cc6,  black_pc_crc: 0x234969af
@@ -507,3 +509,5 @@  rgba128be       total_size:  49152,  black_unknown_crc: 0x59ef499b,  black_tv_cr
 rgba128le       total_size:  49152,  black_unknown_crc: 0x59ef499b,  black_tv_crc: 0x59ef499b,  black_pc_crc: 0x59ef499b
 rgb96be         total_size:  36864,  black_unknown_crc: 0x00000000,  black_tv_crc: 0x00000000,  black_pc_crc: 0x00000000
 rgb96le         total_size:  36864,  black_unknown_crc: 0x00000000,  black_tv_crc: 0x00000000,  black_pc_crc: 0x00000000
+y216be          total_size:  12288,  black_unknown_crc: 0x5483d935,  black_tv_crc: 0x5483d935,  black_pc_crc: 0x06397bf3
+y216le          total_size:  12288,  black_unknown_crc: 0x5d8e1cf6,  black_tv_crc: 0x5d8e1cf6,  black_pc_crc: 0x8fceec45
diff --git a/tests/ref/fate/pixfmt_best b/tests/ref/fate/pixfmt_best
index 72486587c6..72560f5df9 100644
--- a/tests/ref/fate/pixfmt_best
+++ b/tests/ref/fate/pixfmt_best
@@ -1 +1 @@ 
-109 tests passed, 0 tests failed.
+111 tests passed, 0 tests failed.
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index aa2edcfcb0..a4bbc8bfcb 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -25,6 +25,8 @@  is16BPS:
   rgbaf16le
   rgbf16be
   rgbf16le
+  y216be
+  y216le
   ya16be
   ya16le
   yuv420p16be
@@ -195,6 +197,7 @@  isBE:
   xyz12be
   y210be
   y212be
+  y216be
   ya16be
   yuv420p10be
   yuv420p12be
@@ -272,6 +275,8 @@  isYUV:
   y210le
   y212be
   y212le
+  y216be
+  y216le
   ya16be
   ya16le
   ya8
@@ -876,6 +881,8 @@  Packed:
   y210le
   y212be
   y212le
+  y216be
+  y216le
   ya16be
   ya16le
   ya8