[FFmpeg-devel] [PATCH 21/26] avutil/pixfmt: add V30X pixel format

James Almer jamrial at gmail.com
Tue Oct 8 05:53:59 EEST 2024


This maps to the 444YpCbCr10 pixel format as defined by Apple.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavutil/pixdesc.c              | 23 +++++++++++++++++++++++
 libavutil/pixfmt.h               |  4 ++++
 tests/ref/fate/imgutils          |  4 ++++
 tests/ref/fate/sws-pixdesc-query |  7 +++++++
 4 files changed, 38 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index deff74d8a6..f8d6055084 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2727,6 +2727,29 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         },
         .flags = AV_PIX_FMT_FLAG_BE,
     },
+    [AV_PIX_FMT_V30XLE] = {
+        .name = "v30xle",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 4, 1, 4, 10 },       /* Y */
+            { 0, 4, 0, 2, 10 },       /* U */
+            { 0, 4, 2, 6, 10 },       /* V */
+        },
+    },
+    [AV_PIX_FMT_V30XBE] = {
+        .name = "v30xbe",
+        .nb_components= 3,
+        .log2_chroma_w= 0,
+        .log2_chroma_h= 0,
+        .comp = {
+            { 0, 32, 12, 0, 10 },     /* Y */
+            { 0, 32,  2, 0, 10 },     /* U */
+            { 0, 32, 22, 0, 10 },     /* V */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_BITSTREAM,
+    },
     [AV_PIX_FMT_RGBF32BE] = {
         .name = "rgbf32be",
         .nb_components = 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index cbdab31df4..55bdf196fa 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -445,6 +445,9 @@ enum AVPixelFormat {
 
     AV_PIX_FMT_VYU444,      ///< packed VYU 4:4:4, 24bpp (1 Cr & Cb sample per 1x1 Y), VYUVYU...
 
+    AV_PIX_FMT_V30XBE,      ///< packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), big-endian
+    AV_PIX_FMT_V30XLE,      ///< packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), 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
 };
 
@@ -539,6 +542,7 @@ enum AVPixelFormat {
 #define AV_PIX_FMT_Y212       AV_PIX_FMT_NE(Y212BE,  Y212LE)
 #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)
 #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/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index 4197005a3f..fd5a510530 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -272,6 +272,8 @@ gbrap14le       planes: 4, linesizes: 128 128 128 128, plane_sizes:  6144  6144
 ayuv            planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0     0     0, plane_offsets:     0     0     0, total_size: 12288
 uyva            planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0     0     0, plane_offsets:     0     0     0, total_size: 12288
 vyu444          planes: 1, linesizes: 192   0   0   0, plane_sizes:  9216     0     0     0, plane_offsets:     0     0     0, total_size: 9216
+v30xbe          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
 
 image_fill_black tests
 yuv420p         total_size:   4608,  black_unknown_crc: 0xd00f6cc6,  black_tv_crc: 0xd00f6cc6,  black_pc_crc: 0x234969af
@@ -491,3 +493,5 @@ gbrap14le       total_size:  24576,  black_unknown_crc: 0x13bde353,  black_tv_cr
 ayuv            total_size:  12288,  black_unknown_crc: 0xcc44368b,  black_tv_crc: 0xcc44368b,  black_pc_crc: 0x1e04c638
 uyva            total_size:  12288,  black_unknown_crc: 0xdd657297,  black_tv_crc: 0xdd657297,  black_pc_crc: 0x0f258224
 vyu444          total_size:   9216,  black_unknown_crc: 0x575e6fb1,  black_tv_crc: 0x575e6fb1,  black_pc_crc: 0x16564599
+v30xbe          total_size:  12288,  black_unknown_crc: 0x7108457c,  black_tv_crc: 0x7108457c,  black_pc_crc: 0xdefcbbe0
+v30xle          total_size:  12288,  black_unknown_crc: 0xf5b3c795,  black_tv_crc: 0xf5b3c795,  black_pc_crc: 0x0b56173c
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index e1b2ac999a..f153ed3169 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -75,6 +75,8 @@ isNBPS:
   p410le
   p412be
   p412le
+  v30xbe
+  v30xle
   x2bgr10be
   x2bgr10le
   x2rgb10be
@@ -180,6 +182,7 @@ isBE:
   rgbaf16be
   rgbaf32be
   rgbf32be
+  v30xbe
   x2bgr10be
   x2rgb10be
   xv30be
@@ -249,6 +252,8 @@ isYUV:
   uyva
   uyvy422
   uyyvyy411
+  v30xbe
+  v30xle
   vuya
   vuyx
   vyu444
@@ -827,6 +832,8 @@ Packed:
   uyva
   uyvy422
   uyyvyy411
+  v30xbe
+  v30xle
   vuya
   vuyx
   vyu444
-- 
2.46.2



More information about the ffmpeg-devel mailing list