avutil/pixfmt: add AYUV pixel format

This maps to the 4444AYpCbCr8 pixel format as defined by Apple, which is ordered
A Y’ Cb Cr.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2024-10-06 14:37:54 -03:00
parent 2e79690a70
commit 263108a504
6 changed files with 22 additions and 1 deletions

View File

@ -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,

View File

@ -439,6 +439,8 @@ enum AVPixelFormat {
*/
AV_PIX_FMT_D3D12,
AV_PIX_FMT_AYUV, ///< packed AYUV 4: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
};

View File

@ -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);

View File

@ -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

View File

@ -1 +1 @@
106 tests passed, 0 tests failed.
107 tests passed, 0 tests failed.

View File

@ -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