[FFmpeg-devel] [PATCH 03/20] avutil/pixfmt: add UYVA pixel format
James Almer
jamrial at gmail.com
Mon Oct 7 15:29:38 EEST 2024
This maps to the 4444YpCbCrA8 pixel format as defined by Apple, which is ordered
Cb Y' Cr A.
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavutil/pixdesc.c | 13 +++++++++++++
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, 22 insertions(+), 1 deletion(-)
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 588a5845c9..ab336433da 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2119,6 +2119,19 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
.name = "cuda",
.flags = AV_PIX_FMT_FLAG_HWACCEL,
},
+ [AV_PIX_FMT_UYVA] = {
+ .name = "uyva",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 4, 1, 0, 8 }, /* Y */
+ { 0, 4, 0, 0, 8 }, /* U */
+ { 0, 4, 2, 0, 8 }, /* V */
+ { 0, 4, 3, 0, 8 }, /* A */
+ },
+ .flags = AV_PIX_FMT_FLAG_ALPHA,
+ },
[AV_PIX_FMT_AYUV] = {
.name = "ayuv",
.nb_components = 4,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index e305bba78c..6d624108ef 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -441,6 +441,8 @@ enum AVPixelFormat {
AV_PIX_FMT_AYUV, ///< packed AYUV 4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), AYUVAYUV...
+ AV_PIX_FMT_UYVA, ///< packed UYVA 4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), UYVAUYVA...
+
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 24e55c4f23..94666740d9 100644
--- a/libavutil/tests/pixfmt_best.c
+++ b/libavutil/tests/pixfmt_best.c
@@ -136,6 +136,7 @@ int main(void)
TEST(AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUV444P);
TEST(AV_PIX_FMT_VUYA, AV_PIX_FMT_YUV444P);
TEST(AV_PIX_FMT_AYUV, AV_PIX_FMT_YUV444P);
+ TEST(AV_PIX_FMT_UYVA, AV_PIX_FMT_YUV444P);
TEST(AV_PIX_FMT_AYUV64, AV_PIX_FMT_YUV444P16);
TEST(AV_PIX_FMT_RGBA, AV_PIX_FMT_RGB24);
TEST(AV_PIX_FMT_ABGR, AV_PIX_FMT_RGB24);
diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index da764b38e5..03121e45fe 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -270,6 +270,7 @@ p412le planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288
gbrap14be planes: 4, linesizes: 128 128 128 128, plane_sizes: 6144 6144 6144 6144, plane_offsets: 6144 6144 6144, total_size: 24576
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
image_fill_black tests
yuv420p total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af
@@ -487,3 +488,4 @@ p412le total_size: 18432, black_unknown_crc: 0x4028ac30, black_tv_cr
gbrap14be total_size: 24576, black_unknown_crc: 0x4ec0d987, black_tv_crc: 0x4ec0d987, black_pc_crc: 0x4ec0d987
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
diff --git a/tests/ref/fate/pixfmt_best b/tests/ref/fate/pixfmt_best
index 591fa5c912..3a2ba35238 100644
--- a/tests/ref/fate/pixfmt_best
+++ b/tests/ref/fate/pixfmt_best
@@ -1 +1 @@
-107 tests passed, 0 tests failed.
+108 tests passed, 0 tests failed.
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index f12f0cbf42..8b7f7875f4 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -246,6 +246,7 @@ isYUV:
p412le
p416be
p416le
+ uyva
uyvy422
uyyvyy411
vuya
@@ -730,6 +731,7 @@ ALPHA:
rgbaf16le
rgbaf32be
rgbaf32le
+ uyva
vuya
ya16be
ya16le
@@ -821,6 +823,7 @@ Packed:
rgbaf32le
rgbf32be
rgbf32le
+ uyva
uyvy422
uyyvyy411
vuya
--
2.46.2
More information about the ffmpeg-devel
mailing list