ffmpeg | branch: master | Timo Rothenpieler <t...@rothenpieler.org> | Sat Jul  
5 00:17:19 2025 +0200| [e93de9948d89df19187fcd9b94609eb22c3eccc7] | committer: 
Timo Rothenpieler

avutils/pixfmt: add YUV444/GBRP 10 and 12 bit MSB formats

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

 libavutil/pixdesc.c              | 96 ++++++++++++++++++++++++++++++++++++++++
 libavutil/pixfmt.h               | 15 +++++++
 tests/ref/fate/imgutils          | 16 +++++++
 tests/ref/fate/sws-pixdesc-query | 48 ++++++++++++++++++++
 4 files changed, 175 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 53adde5aba..8eb04d1f12 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1701,6 +1701,30 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         },
         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
     },
+    [AV_PIX_FMT_YUV444P10MSBLE] = {
+        .name = "yuv444p10msble",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 2, 0, 6, 10 },        /* Y */
+            { 1, 2, 0, 6, 10 },        /* U */
+            { 2, 2, 0, 6, 10 },        /* V */
+        },
+        .flags = AV_PIX_FMT_FLAG_PLANAR,
+    },
+    [AV_PIX_FMT_YUV444P10MSBBE] = {
+        .name = "yuv444p10msbbe",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 2, 0, 6, 10 },        /* Y */
+            { 1, 2, 0, 6, 10 },        /* U */
+            { 2, 2, 0, 6, 10 },        /* V */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
+    },
     [AV_PIX_FMT_YUV444P9LE] = {
         .name = "yuv444p9le",
         .nb_components = 3,
@@ -1749,6 +1773,30 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         },
         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
     },
+    [AV_PIX_FMT_YUV444P12MSBLE] = {
+        .name = "yuv444p12msble",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 2, 0, 4, 12 },        /* Y */
+            { 1, 2, 0, 4, 12 },        /* U */
+            { 2, 2, 0, 4, 12 },        /* V */
+        },
+        .flags = AV_PIX_FMT_FLAG_PLANAR,
+    },
+    [AV_PIX_FMT_YUV444P12MSBBE] = {
+        .name = "yuv444p12msbbe",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 2, 0, 4, 12 },        /* Y */
+            { 1, 2, 0, 4, 12 },        /* U */
+            { 2, 2, 0, 4, 12 },        /* V */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
+    },
     [AV_PIX_FMT_YUV444P14LE] = {
         .name = "yuv444p14le",
         .nb_components = 3,
@@ -1877,6 +1925,30 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         },
         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | 
AV_PIX_FMT_FLAG_RGB,
     },
+    [AV_PIX_FMT_GBRP10MSBLE] = {
+        .name = "gbrp10msble",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 2, 2, 0, 6, 10 },        /* R */
+            { 0, 2, 0, 6, 10 },        /* G */
+            { 1, 2, 0, 6, 10 },        /* B */
+        },
+        .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
+    },
+    [AV_PIX_FMT_GBRP10MSBBE] = {
+        .name = "gbrp10msbbe",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 2, 2, 0, 6, 10 },        /* R */
+            { 0, 2, 0, 6, 10 },        /* G */
+            { 1, 2, 0, 6, 10 },        /* B */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | 
AV_PIX_FMT_FLAG_RGB,
+    },
     [AV_PIX_FMT_GBRP12LE] = {
         .name = "gbrp12le",
         .nb_components = 3,
@@ -1901,6 +1973,30 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         },
         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | 
AV_PIX_FMT_FLAG_RGB,
     },
+    [AV_PIX_FMT_GBRP12MSBLE] = {
+        .name = "gbrp12msble",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 2, 2, 0, 4, 12 },        /* R */
+            { 0, 2, 0, 4, 12 },        /* G */
+            { 1, 2, 0, 4, 12 },        /* B */
+        },
+        .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
+    },
+    [AV_PIX_FMT_GBRP12MSBBE] = {
+        .name = "gbrp12msbbe",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 2, 2, 0, 4, 12 },        /* R */
+            { 0, 2, 0, 4, 12 },        /* G */
+            { 1, 2, 0, 4, 12 },        /* B */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | 
AV_PIX_FMT_FLAG_RGB,
+    },
     [AV_PIX_FMT_GBRP14LE] = {
         .name = "gbrp14le",
         .nb_components = 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index bf1b8ed008..9024850207 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -488,6 +488,15 @@ enum AVPixelFormat {
     AV_PIX_FMT_GBRAP32BE,   ///< planar GBRA 4:4:4:4 128bpp, big-endian
     AV_PIX_FMT_GBRAP32LE,   ///< planar GBRA 4:4:4:4 128bpp, little-endian
 
+    AV_PIX_FMT_YUV444P10MSBBE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample 
per 1x1 Y samples), lowest bits zero, big-endian
+    AV_PIX_FMT_YUV444P10MSBLE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample 
per 1x1 Y samples), lowest bits zero, little-endian
+    AV_PIX_FMT_YUV444P12MSBBE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample 
per 1x1 Y samples), lowest bits zero, big-endian
+    AV_PIX_FMT_YUV444P12MSBLE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample 
per 1x1 Y samples), lowest bits zero, little-endian
+    AV_PIX_FMT_GBRP10MSBBE,    ///< planar GBR 4:4:4 30bpp, lowest bits zero, 
big-endian
+    AV_PIX_FMT_GBRP10MSBLE,    ///< planar GBR 4:4:4 30bpp, lowest bits zero, 
little-endian
+    AV_PIX_FMT_GBRP12MSBBE,    ///< planar GBR 4:4:4 36bpp, lowest bits zero, 
big-endian
+    AV_PIX_FMT_GBRP12MSBLE,    ///< planar GBR 4:4:4 36bpp, lowest bits zero, 
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
 };
 
@@ -540,6 +549,9 @@ enum AVPixelFormat {
 #define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
 #define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
 
+#define AV_PIX_FMT_YUV444P10MSB AV_PIX_FMT_NE(YUV444P10MSBBE, YUV444P10MSBLE)
+#define AV_PIX_FMT_YUV444P12MSB AV_PIX_FMT_NE(YUV444P12MSBBE, YUV444P12MSBLE)
+
 #define AV_PIX_FMT_GBRP9     AV_PIX_FMT_NE(GBRP9BE ,    GBRP9LE)
 #define AV_PIX_FMT_GBRP10    AV_PIX_FMT_NE(GBRP10BE,    GBRP10LE)
 #define AV_PIX_FMT_GBRP12    AV_PIX_FMT_NE(GBRP12BE,    GBRP12LE)
@@ -551,6 +563,9 @@ enum AVPixelFormat {
 #define AV_PIX_FMT_GBRAP16   AV_PIX_FMT_NE(GBRAP16BE,   GBRAP16LE)
 #define AV_PIX_FMT_GBRAP32   AV_PIX_FMT_NE(GBRAP32BE,   GBRAP32LE)
 
+#define AV_PIX_FMT_GBRP10MSB AV_PIX_FMT_NE(GBRP10MSBBE, GBRP10MSBLE)
+#define AV_PIX_FMT_GBRP12MSB AV_PIX_FMT_NE(GBRP12MSBBE, GBRP12MSBLE)
+
 #define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE,    
BAYER_BGGR16LE)
 #define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE,    
BAYER_RGGB16LE)
 #define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE,    
BAYER_GBRG16LE)
diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index c67ac35f44..ccd1522ef2 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -298,6 +298,14 @@ yaf16be         planes: 1, linesizes: 256   0   0   0, 
plane_sizes: 12288     0
 yaf16le         planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     
0     0     0, plane_offsets:     0     0     0, total_size: 12288
 gbrap32be       planes: 4, linesizes: 256 256 256 256, plane_sizes: 12288 
12288 12288 12288, plane_offsets: 12288 12288 12288, total_size: 49152
 gbrap32le       planes: 4, linesizes: 256 256 256 256, plane_sizes: 12288 
12288 12288 12288, plane_offsets: 12288 12288 12288, total_size: 49152
+yuv444p10msbbe  planes: 3, linesizes: 128 128 128   0, plane_sizes:  6144  
6144  6144     0, plane_offsets:  6144  6144     0, total_size: 18432
+yuv444p10msble  planes: 3, linesizes: 128 128 128   0, plane_sizes:  6144  
6144  6144     0, plane_offsets:  6144  6144     0, total_size: 18432
+yuv444p12msbbe  planes: 3, linesizes: 128 128 128   0, plane_sizes:  6144  
6144  6144     0, plane_offsets:  6144  6144     0, total_size: 18432
+yuv444p12msble  planes: 3, linesizes: 128 128 128   0, plane_sizes:  6144  
6144  6144     0, plane_offsets:  6144  6144     0, total_size: 18432
+gbrp10msbbe     planes: 3, linesizes: 128 128 128   0, plane_sizes:  6144  
6144  6144     0, plane_offsets:  6144  6144     0, total_size: 18432
+gbrp10msble     planes: 3, linesizes: 128 128 128   0, plane_sizes:  6144  
6144  6144     0, plane_offsets:  6144  6144     0, total_size: 18432
+gbrp12msbbe     planes: 3, linesizes: 128 128 128   0, plane_sizes:  6144  
6144  6144     0, plane_offsets:  6144  6144     0, total_size: 18432
+gbrp12msble     planes: 3, linesizes: 128 128 128   0, plane_sizes:  6144  
6144  6144     0, plane_offsets:  6144  6144     0, total_size: 18432
 
 image_fill_black tests
 yuv420p         total_size:   4608,  black_unknown_crc: 0xd00f6cc6,  
black_tv_crc: 0xd00f6cc6,  black_pc_crc: 0x234969af
@@ -543,3 +551,11 @@ yaf16be         total_size:  12288,  black_unknown_crc: 
0x7afe9aae,  black_tv_cr
 yaf16le         total_size:  12288,  black_unknown_crc: 0x94c0068b,  
black_tv_crc: 0x94c0068b,  black_pc_crc: 0xc05ce449
 gbrap32be       total_size:  49152,  black_unknown_crc: 0x7bd30c95,  
black_tv_crc: 0x7bd30c95,  black_pc_crc: 0x7bd30c95
 gbrap32le       total_size:  49152,  black_unknown_crc: 0x7bd30c95,  
black_tv_crc: 0x7bd30c95,  black_pc_crc: 0x7bd30c95
+yuv444p10msbbe  total_size:  18432,  black_unknown_crc: 0x26991800,  
black_tv_crc: 0x26991800,  black_pc_crc: 0xfe7f6700
+yuv444p10msble  total_size:  18432,  black_unknown_crc: 0x4028ac30,  
black_tv_crc: 0x4028ac30,  black_pc_crc: 0xab7c7698
+yuv444p12msbbe  total_size:  18432,  black_unknown_crc: 0x26991800,  
black_tv_crc: 0x26991800,  black_pc_crc: 0xfe7f6700
+yuv444p12msble  total_size:  18432,  black_unknown_crc: 0x4028ac30,  
black_tv_crc: 0x4028ac30,  black_pc_crc: 0xab7c7698
+gbrp10msbbe     total_size:  18432,  black_unknown_crc: 0x00000000,  
black_tv_crc: 0x00000000,  black_pc_crc: 0x00000000
+gbrp10msble     total_size:  18432,  black_unknown_crc: 0x00000000,  
black_tv_crc: 0x00000000,  black_pc_crc: 0x00000000
+gbrp12msbbe     total_size:  18432,  black_unknown_crc: 0x00000000,  
black_tv_crc: 0x00000000,  black_pc_crc: 0x00000000
+gbrp12msble     total_size:  18432,  black_unknown_crc: 0x00000000,  
black_tv_crc: 0x00000000,  black_pc_crc: 0x00000000
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index 6b1a97ec00..a062088d54 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -61,8 +61,12 @@ isNBPS:
   gbrap14le
   gbrp10be
   gbrp10le
+  gbrp10msbbe
+  gbrp10msble
   gbrp12be
   gbrp12le
+  gbrp12msbbe
+  gbrp12msble
   gbrp14be
   gbrp14le
   gbrp9be
@@ -127,8 +131,12 @@ isNBPS:
   yuv440p12le
   yuv444p10be
   yuv444p10le
+  yuv444p10msbbe
+  yuv444p10msble
   yuv444p12be
   yuv444p12le
+  yuv444p12msbbe
+  yuv444p12msble
   yuv444p14be
   yuv444p14le
   yuv444p9be
@@ -169,7 +177,9 @@ isBE:
   gbrapf16be
   gbrapf32be
   gbrp10be
+  gbrp10msbbe
   gbrp12be
+  gbrp12msbbe
   gbrp14be
   gbrp16be
   gbrp9be
@@ -230,7 +240,9 @@ isBE:
   yuv440p10be
   yuv440p12be
   yuv444p10be
+  yuv444p10msbbe
   yuv444p12be
+  yuv444p12msbbe
   yuv444p14be
   yuv444p16be
   yuv444p9be
@@ -336,8 +348,12 @@ isYUV:
   yuv444p
   yuv444p10be
   yuv444p10le
+  yuv444p10msbbe
+  yuv444p10msble
   yuv444p12be
   yuv444p12le
+  yuv444p12msbbe
+  yuv444p12msble
   yuv444p14be
   yuv444p14le
   yuv444p16be
@@ -435,8 +451,12 @@ isPlanarYUV:
   yuv444p
   yuv444p10be
   yuv444p10le
+  yuv444p10msbbe
+  yuv444p10msble
   yuv444p12be
   yuv444p12le
+  yuv444p12msbbe
+  yuv444p12msble
   yuv444p14be
   yuv444p14le
   yuv444p16be
@@ -551,8 +571,12 @@ isRGB:
   gbrp
   gbrp10be
   gbrp10le
+  gbrp10msbbe
+  gbrp10msble
   gbrp12be
   gbrp12le
+  gbrp12msbbe
+  gbrp12msble
   gbrp14be
   gbrp14le
   gbrp16be
@@ -727,8 +751,12 @@ AnyRGB:
   gbrp
   gbrp10be
   gbrp10le
+  gbrp10msbbe
+  gbrp10msble
   gbrp12be
   gbrp12le
+  gbrp12msbbe
+  gbrp12msble
   gbrp14be
   gbrp14le
   gbrp16be
@@ -966,8 +994,12 @@ Planar:
   gbrp
   gbrp10be
   gbrp10le
+  gbrp10msbbe
+  gbrp10msble
   gbrp12be
   gbrp12le
+  gbrp12msbbe
+  gbrp12msble
   gbrp14be
   gbrp14le
   gbrp16be
@@ -1035,8 +1067,12 @@ Planar:
   yuv444p
   yuv444p10be
   yuv444p10le
+  yuv444p10msbbe
+  yuv444p10msble
   yuv444p12be
   yuv444p12le
+  yuv444p12msbbe
+  yuv444p12msble
   yuv444p14be
   yuv444p14le
   yuv444p16be
@@ -1159,8 +1195,12 @@ PlanarRGB:
   gbrp
   gbrp10be
   gbrp10le
+  gbrp10msbbe
+  gbrp10msble
   gbrp12be
   gbrp12le
+  gbrp12msbbe
+  gbrp12msble
   gbrp14be
   gbrp14le
   gbrp16be
@@ -1181,6 +1221,10 @@ usePal:
   rgb8
 
 DataInHighBits:
+  gbrp10msbbe
+  gbrp10msble
+  gbrp12msbbe
+  gbrp12msble
   p010be
   p010le
   p012be
@@ -1201,6 +1245,10 @@ DataInHighBits:
   y210le
   y212be
   y212le
+  yuv444p10msbbe
+  yuv444p10msble
+  yuv444p12msbbe
+  yuv444p12msble
 
 SwappedChroma:
   nv21

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to