[FFmpeg-devel] [PATCH 02/20] avutil/pixfmt: add AYUV pixel format
James Almer
jamrial at gmail.com
Mon Oct 7 15:29:37 EEST 2024
This maps to the 4444AYpCbCr8 pixel format as defined by Apple, which is ordered
A Y’ Cb Cr.
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 1c0bcf2232..588a5845c9 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_AYUV] = {
+ .name = "ayuv",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 4, 1, 0, 8 }, /* Y */
+ { 0, 4, 2, 0, 8 }, /* U */
+ { 0, 4, 3, 0, 8 }, /* V */
+ { 0, 4, 0, 0, 8 }, /* A */
+ },
+ .flags = AV_PIX_FMT_FLAG_ALPHA,
+ },
[AV_PIX_FMT_AYUV64LE] = {
.name = "ayuv64le",
.nb_components = 4,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index a7f50e1690..e305bba78c 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -439,6 +439,8 @@ enum AVPixelFormat {
*/
AV_PIX_FMT_D3D12,
+ AV_PIX_FMT_AYUV, ///< packed AYUV 4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), AYUVAYUV...
+
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 d71b3cc2e8..24e55c4f23 100644
--- a/libavutil/tests/pixfmt_best.c
+++ b/libavutil/tests/pixfmt_best.c
@@ -135,6 +135,7 @@ int main(void)
TEST(AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUV422P);
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_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 fb2ed6d158..da764b38e5 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -269,6 +269,7 @@ p412be planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288
p412le planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 0 0, plane_offsets: 6144 0 0, total_size: 18432
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
image_fill_black tests
yuv420p total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af
@@ -485,3 +486,4 @@ p412be total_size: 18432, black_unknown_crc: 0x26991800, black_tv_cr
p412le total_size: 18432, black_unknown_crc: 0x4028ac30, black_tv_crc: 0x4028ac30, black_pc_crc: 0xab7c7698
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
diff --git a/tests/ref/fate/pixfmt_best b/tests/ref/fate/pixfmt_best
index 1bdc0e83f0..591fa5c912 100644
--- a/tests/ref/fate/pixfmt_best
+++ b/tests/ref/fate/pixfmt_best
@@ -1 +1 @@
-106 tests passed, 0 tests failed.
+107 tests passed, 0 tests failed.
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index fff93bbf0e..f12f0cbf42 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -218,6 +218,7 @@ isBE:
yuva444p9be
isYUV:
+ ayuv
ayuv64be
ayuv64le
nv12
@@ -702,6 +703,7 @@ AnyRGB:
x2rgb10le
ALPHA:
+ ayuv
ayuv64be
ayuv64le
bgr32
@@ -761,6 +763,7 @@ ALPHA:
Packed:
0bgr
0rgb
+ ayuv
ayuv64be
ayuv64le
bayer_bggr16be
--
2.46.2
More information about the ffmpeg-devel
mailing list