From e02a3b40a5eef7b5441602c1e5ec6ffa562eec7d Mon Sep 17 00:00:00 2001 From: James Almer Date: Wed, 23 Oct 2024 12:38:13 -0300 Subject: [PATCH] avutil/pixfmt: add XV48 pixel format Much like XV30 and XV36 in d75c4693fef51e8f0a1b88798530f4c5147ea906, XV48 is added to support 16bit 4:4:4 as defined by Microsoft. Signed-off-by: James Almer --- doc/APIchanges | 3 +++ libavutil/pixdesc.c | 25 +++++++++++++++++++++++++ libavutil/pixfmt.h | 4 ++++ libavutil/tests/pixfmt_best.c | 2 ++ libavutil/version.h | 2 +- tests/ref/fate/imgutils | 4 ++++ tests/ref/fate/pixfmt_best | 2 +- tests/ref/fate/sws-pixdesc-query | 7 +++++++ 8 files changed, 47 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index eeb859b873..6f21a952dd 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 API changes, most recent first: +2024-10-26 - xxxxxxxxxx - lavu 59.46.100 - pixfmt.h + Add AV_PIX_FMT_XV48. + 2024-10-23 - xxxxxxxxxx - lsws 8.9.100 - swscale.h Add sws_is_noop(). diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index ba96803e5b..e595c76232 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2771,6 +2771,31 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = AV_PIX_FMT_FLAG_BE, }, + [AV_PIX_FMT_XV48LE] = { + .name = "xv48le", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 8, 2, 0, 16 }, /* Y */ + { 0, 8, 0, 0, 16 }, /* U */ + { 0, 8, 4, 0, 16 }, /* V */ + { 0, 8, 6, 0, 16 }, /* X */ + }, + }, + [AV_PIX_FMT_XV48BE] = { + .name = "xv48be", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 8, 2, 0, 16 }, /* Y */ + { 0, 8, 0, 0, 16 }, /* U */ + { 0, 8, 4, 0, 16 }, /* V */ + { 0, 8, 6, 0, 16 }, /* X */ + }, + .flags = AV_PIX_FMT_FLAG_BE, + }, [AV_PIX_FMT_V30XLE] = { .name = "v30xle", .nb_components = 3, diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 0b6b69fdeb..3215266091 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -460,6 +460,9 @@ enum AVPixelFormat { AV_PIX_FMT_Y216BE, ///< packed YUV 4:2:2 like YUYV422, 32bpp, big-endian AV_PIX_FMT_Y216LE, ///< packed YUV 4:2:2 like YUYV422, 32bpp, little-endian + AV_PIX_FMT_XV48BE, ///< packed XVYU 4:4:4, 64bpp, big-endian, variant of Y416 where alpha channel is left undefined + AV_PIX_FMT_XV48LE, ///< packed XVYU 4:4:4, 64bpp, little-endian, variant of Y416 where alpha channel is left undefined + 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 }; @@ -555,6 +558,7 @@ enum AVPixelFormat { #define AV_PIX_FMT_Y216 AV_PIX_FMT_NE(Y216BE, Y216LE) #define AV_PIX_FMT_XV30 AV_PIX_FMT_NE(XV30BE, XV30LE) #define AV_PIX_FMT_XV36 AV_PIX_FMT_NE(XV36BE, XV36LE) +#define AV_PIX_FMT_XV48 AV_PIX_FMT_NE(XV48BE, XV48LE) #define AV_PIX_FMT_V30X AV_PIX_FMT_NE(V30XBE, V30XLE) #define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE) #define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE) diff --git a/libavutil/tests/pixfmt_best.c b/libavutil/tests/pixfmt_best.c index c853be0e34..fb16fe6f2f 100644 --- a/libavutil/tests/pixfmt_best.c +++ b/libavutil/tests/pixfmt_best.c @@ -47,6 +47,7 @@ static const enum AVPixelFormat semiplanar_list[] = { }; static const enum AVPixelFormat packed_list[] = { + AV_PIX_FMT_XV48, AV_PIX_FMT_XV36, AV_PIX_FMT_XV30, AV_PIX_FMT_VUYX, @@ -208,6 +209,7 @@ int main(void) TEST_PACKED(AV_PIX_FMT_YUV444P, AV_PIX_FMT_VUYX); TEST_PACKED(AV_PIX_FMT_YUV444P10, AV_PIX_FMT_XV30); TEST_PACKED(AV_PIX_FMT_YUV444P12, AV_PIX_FMT_XV36); + TEST_PACKED(AV_PIX_FMT_YUV444P16, AV_PIX_FMT_XV48); TEST_PACKED(AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUYV422); TEST_PACKED(AV_PIX_FMT_YUV422P10, AV_PIX_FMT_Y210); TEST_PACKED(AV_PIX_FMT_YUV422P12, AV_PIX_FMT_Y212); diff --git a/libavutil/version.h b/libavutil/version.h index b4268a14a7..84a7cb1c02 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 59 -#define LIBAVUTIL_VERSION_MINOR 45 +#define LIBAVUTIL_VERSION_MINOR 46 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils index 7fbb1fd902..b03e6c5824 100644 --- a/tests/ref/fate/imgutils +++ b/tests/ref/fate/imgutils @@ -282,6 +282,8 @@ rgb96be planes: 1, linesizes: 768 0 0 0, plane_sizes: 36864 0 rgb96le planes: 1, linesizes: 768 0 0 0, plane_sizes: 36864 0 0 0, plane_offsets: 0 0 0, total_size: 36864 y216be planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 y216le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +xv48be planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 +xv48le planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 image_fill_black tests yuv420p total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af @@ -511,3 +513,5 @@ rgb96be total_size: 36864, black_unknown_crc: 0x00000000, black_tv_cr rgb96le total_size: 36864, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 y216be total_size: 12288, black_unknown_crc: 0x5483d935, black_tv_crc: 0x5483d935, black_pc_crc: 0x06397bf3 y216le total_size: 12288, black_unknown_crc: 0x5d8e1cf6, black_tv_crc: 0x5d8e1cf6, black_pc_crc: 0x8fceec45 +xv48be total_size: 24576, black_unknown_crc: 0x6ba828bd, black_tv_crc: 0x6ba828bd, black_pc_crc: 0x5f450f41 +xv48le total_size: 24576, black_unknown_crc: 0xc3794950, black_tv_crc: 0xc3794950, black_pc_crc: 0x40874939 diff --git a/tests/ref/fate/pixfmt_best b/tests/ref/fate/pixfmt_best index 72560f5df9..90ced69245 100644 --- a/tests/ref/fate/pixfmt_best +++ b/tests/ref/fate/pixfmt_best @@ -1 +1 @@ -111 tests passed, 0 tests failed. +113 tests passed, 0 tests failed. diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index a4bbc8bfcb..bc6a07959d 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -25,6 +25,8 @@ is16BPS: rgbaf16le rgbf16be rgbf16le + xv48be + xv48le y216be y216le ya16be @@ -194,6 +196,7 @@ isBE: x2rgb10be xv30be xv36be + xv48be xyz12be y210be y212be @@ -269,6 +272,8 @@ isYUV: xv30le xv36be xv36le + xv48be + xv48le xyz12be xyz12le y210be @@ -875,6 +880,8 @@ Packed: xv30le xv36be xv36le + xv48be + xv48le xyz12be xyz12le y210be