diff mbox series

[FFmpeg-devel,04/20] avutil/pixfmt: add VYU444 pixel format

Message ID 20241007122955.309-4-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,01/20] swscale/output: add missing yuv2packed1 and yuv2packed2 support for VUY{X, A} | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 fail Make failed

Commit Message

James Almer Oct. 7, 2024, 12:29 p.m. UTC
This maps to the 444YpCbCr8 pixel format as defined by Apple, which is ordered
Cr Y' Cb.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavutil/pixdesc.c              | 11 +++++++++++
 libavutil/pixfmt.h               |  2 ++
 libavutil/tests/pixfmt_best.c    |  1 +
 tests/ref/fate/imgutils          |  2 ++
 tests/ref/fate/pixfmt_best       |  2 +-
 tests/ref/fate/sws-pixdesc-query |  3 +++
 6 files changed, 20 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Oct. 8, 2024, 8:04 p.m. UTC | #1
On Mon, Oct 07, 2024 at 09:29:39AM -0300, James Almer wrote:
> This maps to the 444YpCbCr8 pixel format as defined by Apple, which is ordered
> Cr Y' Cb.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavutil/pixdesc.c              | 11 +++++++++++
>  libavutil/pixfmt.h               |  2 ++
>  libavutil/tests/pixfmt_best.c    |  1 +
>  tests/ref/fate/imgutils          |  2 ++
>  tests/ref/fate/pixfmt_best       |  2 +-
>  tests/ref/fate/sws-pixdesc-query |  3 +++
>  6 files changed, 20 insertions(+), 1 deletion(-)

should be ok

thx

[...]
diff mbox series

Patch

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index ab336433da..deff74d8a6 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2119,6 +2119,17 @@  static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         .name = "cuda",
         .flags = AV_PIX_FMT_FLAG_HWACCEL,
     },
+    [AV_PIX_FMT_VYU444] = {
+        .name = "vyu444",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 3, 1, 0, 8 },        /* Y */
+            { 0, 3, 2, 0, 8 },        /* U */
+            { 0, 3, 0, 0, 8 },        /* V */
+        },
+    },
     [AV_PIX_FMT_UYVA] = {
         .name = "uyva",
         .nb_components = 4,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 6d624108ef..cbdab31df4 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -443,6 +443,8 @@  enum AVPixelFormat {
 
     AV_PIX_FMT_UYVA,        ///< packed UYVA 4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), UYVAUYVA...
 
+    AV_PIX_FMT_VYU444,      ///< packed VYU 4:4:4, 24bpp (1 Cr & Cb sample per 1x1 Y), VYUVYU...
+
     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
 };
 
diff --git a/libavutil/tests/pixfmt_best.c b/libavutil/tests/pixfmt_best.c
index 94666740d9..fe04e26689 100644
--- a/libavutil/tests/pixfmt_best.c
+++ b/libavutil/tests/pixfmt_best.c
@@ -121,6 +121,7 @@  int main(void)
     TEST(AV_PIX_FMT_NV24,      AV_PIX_FMT_YUV444P);
     TEST(AV_PIX_FMT_YUYV422,   AV_PIX_FMT_YUV422P);
     TEST(AV_PIX_FMT_UYVY422,   AV_PIX_FMT_YUV422P);
+    TEST(AV_PIX_FMT_VYU444,    AV_PIX_FMT_YUV444P);
     TEST(AV_PIX_FMT_BGR565,    AV_PIX_FMT_RGB565);
     TEST(AV_PIX_FMT_BGR24,     AV_PIX_FMT_RGB24);
     TEST(AV_PIX_FMT_GBRP,      AV_PIX_FMT_RGB24);
diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index 03121e45fe..4197005a3f 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -271,6 +271,7 @@  gbrap14be       planes: 4, linesizes: 128 128 128 128, plane_sizes:  6144  6144
 gbrap14le       planes: 4, linesizes: 128 128 128 128, plane_sizes:  6144  6144  6144  6144, plane_offsets:  6144  6144  6144, total_size: 24576
 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
 
 image_fill_black tests
 yuv420p         total_size:   4608,  black_unknown_crc: 0xd00f6cc6,  black_tv_crc: 0xd00f6cc6,  black_pc_crc: 0x234969af
@@ -489,3 +490,4 @@  gbrap14be       total_size:  24576,  black_unknown_crc: 0x4ec0d987,  black_tv_cr
 gbrap14le       total_size:  24576,  black_unknown_crc: 0x13bde353,  black_tv_crc: 0x13bde353,  black_pc_crc: 0x13bde353
 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
diff --git a/tests/ref/fate/pixfmt_best b/tests/ref/fate/pixfmt_best
index 3a2ba35238..72486587c6 100644
--- a/tests/ref/fate/pixfmt_best
+++ b/tests/ref/fate/pixfmt_best
@@ -1 +1 @@ 
-108 tests passed, 0 tests failed.
+109 tests passed, 0 tests failed.
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index 8b7f7875f4..e1b2ac999a 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -251,6 +251,7 @@  isYUV:
   uyyvyy411
   vuya
   vuyx
+  vyu444
   xv30be
   xv30le
   xv36be
@@ -828,6 +829,7 @@  Packed:
   uyyvyy411
   vuya
   vuyx
+  vyu444
   x2bgr10be
   x2bgr10le
   x2rgb10be
@@ -1090,5 +1092,6 @@  SwappedChroma:
   nv42
   vuya
   vuyx
+  vyu444
   yvyu422