diff mbox series

[FFmpeg-devel,1/7] avutil/pixfmt: add XV48 pixel format

Message ID 20241023193648.57491-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/7] avutil/pixfmt: add XV48 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. 23, 2024, 7:36 p.m. UTC
Much like XV30 and XV36 in d75c4693fef51e8f0a1b88798530f4c5147ea906,
XV48 is added to support 16bit 4:4:4 as defined by Microsoft.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavutil/pixdesc.c              | 25 +++++++++++++++++++++++++
 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, 43 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index ba96803e5b..e595c76232 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2771,6 +2771,31 @@  static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         },
         .flags = AV_PIX_FMT_FLAG_BE,
     },
+    [AV_PIX_FMT_XV48LE] = {
+        .name = "xv48le",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 8, 2, 0, 16 },        /* Y */
+            { 0, 8, 0, 0, 16 },        /* U */
+            { 0, 8, 4, 0, 16 },        /* V */
+            { 0, 8, 6, 0, 16 },        /* X */
+        },
+    },
+    [AV_PIX_FMT_XV48BE] = {
+        .name = "xv48be",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 8, 2, 0, 16 },        /* Y */
+            { 0, 8, 0, 0, 16 },        /* U */
+            { 0, 8, 4, 0, 16 },        /* V */
+            { 0, 8, 6, 0, 16 },        /* X */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE,
+    },
     [AV_PIX_FMT_V30XLE] = {
         .name = "v30xle",
         .nb_components = 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 0b6b69fdeb..3215266091 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -460,6 +460,9 @@  enum AVPixelFormat {
     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_XV48BE,      ///< packed XVYU 4:4:4, 64bpp, big-endian, variant of Y416 where alpha channel is left undefined
+    AV_PIX_FMT_XV48LE,      ///< packed XVYU 4:4:4, 64bpp, little-endian, variant of Y416 where alpha channel is left undefined
+
     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
 };
 
@@ -555,6 +558,7 @@  enum AVPixelFormat {
 #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_XV48       AV_PIX_FMT_NE(XV48BE,  XV48LE)
 #define AV_PIX_FMT_V30X       AV_PIX_FMT_NE(V30XBE,  V30XLE)
 #define AV_PIX_FMT_X2RGB10    AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE)
 #define AV_PIX_FMT_X2BGR10    AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE)
diff --git a/libavutil/tests/pixfmt_best.c b/libavutil/tests/pixfmt_best.c
index c853be0e34..fb16fe6f2f 100644
--- a/libavutil/tests/pixfmt_best.c
+++ b/libavutil/tests/pixfmt_best.c
@@ -47,6 +47,7 @@  static const enum AVPixelFormat semiplanar_list[] = {
 };
 
 static const enum AVPixelFormat packed_list[] = {
+    AV_PIX_FMT_XV48,
     AV_PIX_FMT_XV36,
     AV_PIX_FMT_XV30,
     AV_PIX_FMT_VUYX,
@@ -208,6 +209,7 @@  int main(void)
     TEST_PACKED(AV_PIX_FMT_YUV444P, AV_PIX_FMT_VUYX);
     TEST_PACKED(AV_PIX_FMT_YUV444P10, AV_PIX_FMT_XV30);
     TEST_PACKED(AV_PIX_FMT_YUV444P12, AV_PIX_FMT_XV36);
+    TEST_PACKED(AV_PIX_FMT_YUV444P16, AV_PIX_FMT_XV48);
     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);
diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index 7fbb1fd902..b03e6c5824 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -282,6 +282,8 @@  rgb96be         planes: 1, linesizes: 768   0   0   0, plane_sizes: 36864     0
 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
+xv48be          planes: 1, linesizes: 512   0   0   0, plane_sizes: 24576     0     0     0, plane_offsets:     0     0     0, total_size: 24576
+xv48le          planes: 1, linesizes: 512   0   0   0, plane_sizes: 24576     0     0     0, plane_offsets:     0     0     0, total_size: 24576
 
 image_fill_black tests
 yuv420p         total_size:   4608,  black_unknown_crc: 0xd00f6cc6,  black_tv_crc: 0xd00f6cc6,  black_pc_crc: 0x234969af
@@ -511,3 +513,5 @@  rgb96be         total_size:  36864,  black_unknown_crc: 0x00000000,  black_tv_cr
 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
+xv48be          total_size:  24576,  black_unknown_crc: 0x6ba828bd,  black_tv_crc: 0x6ba828bd,  black_pc_crc: 0x5f450f41
+xv48le          total_size:  24576,  black_unknown_crc: 0xc3794950,  black_tv_crc: 0xc3794950,  black_pc_crc: 0x40874939
diff --git a/tests/ref/fate/pixfmt_best b/tests/ref/fate/pixfmt_best
index 72560f5df9..90ced69245 100644
--- a/tests/ref/fate/pixfmt_best
+++ b/tests/ref/fate/pixfmt_best
@@ -1 +1 @@ 
-111 tests passed, 0 tests failed.
+113 tests passed, 0 tests failed.
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index a4bbc8bfcb..bc6a07959d 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -25,6 +25,8 @@  is16BPS:
   rgbaf16le
   rgbf16be
   rgbf16le
+  xv48be
+  xv48le
   y216be
   y216le
   ya16be
@@ -194,6 +196,7 @@  isBE:
   x2rgb10be
   xv30be
   xv36be
+  xv48be
   xyz12be
   y210be
   y212be
@@ -269,6 +272,8 @@  isYUV:
   xv30le
   xv36be
   xv36le
+  xv48be
+  xv48le
   xyz12be
   xyz12le
   y210be
@@ -875,6 +880,8 @@  Packed:
   xv30le
   xv36be
   xv36le
+  xv48be
+  xv48le
   xyz12be
   xyz12le
   y210be