From 80b0624099da8f758928676aa848473182fd4b8c Mon Sep 17 00:00:00 2001 From: Martin Vignali Date: Sat, 24 Nov 2018 16:12:00 +0100 Subject: [PATCH] avutil : add YUVA444P12 and YUVA422P12 --- libavutil/pixdesc.c | 52 ++++++++++++++++++++++++++++++++ libavutil/pixfmt.h | 7 +++++ libavutil/version.h | 2 +- tests/ref/fate/sws-pixdesc-query | 22 ++++++++++++++ 4 files changed, 82 insertions(+), 1 deletion(-) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 1c36577289..fe38344d73 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2268,6 +2268,58 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { .flags = AV_PIX_FMT_FLAG_FLOAT, .alias = "yf32le", }, + [AV_PIX_FMT_YUVA422P12BE] = { + .name = "yuva422p12be", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */ + { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */ + { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */ + { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, + }, + [AV_PIX_FMT_YUVA422P12LE] = { + .name = "yuva422p12le", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */ + { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */ + { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */ + { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, + }, + [AV_PIX_FMT_YUVA444P12BE] = { + .name = "yuva444p12be", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */ + { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */ + { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */ + { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, + }, + [AV_PIX_FMT_YUVA444P12LE] = { + .name = "yuva444p12le", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */ + { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */ + { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */ + { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, + }, }; #if FF_API_PLUS1_MINUS1 FF_ENABLE_DEPRECATION_WARNINGS diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 6815f8dc7b..24d1b7e415 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -340,6 +340,11 @@ enum AVPixelFormat { AV_PIX_FMT_GRAYF32BE, ///< IEEE-754 single precision Y, 32bpp, big-endian AV_PIX_FMT_GRAYF32LE, ///< IEEE-754 single precision Y, 32bpp, little-endian + AV_PIX_FMT_YUVA422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian + AV_PIX_FMT_YUVA422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian + AV_PIX_FMT_YUVA444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian + AV_PIX_FMT_YUVA444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian + 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 }; @@ -416,6 +421,8 @@ enum AVPixelFormat { #define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE) #define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE) #define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE) +#define AV_PIX_FMT_YUVA422P12 AV_PIX_FMT_NE(YUVA422P12BE, YUVA422P12LE) +#define AV_PIX_FMT_YUVA444P12 AV_PIX_FMT_NE(YUVA444P12BE, YUVA444P12LE) #define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE) #define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE) #define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE) diff --git a/libavutil/version.h b/libavutil/version.h index adbf59639c..62112a6049 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 23 +#define LIBAVUTIL_VERSION_MINOR 24 #define LIBAVUTIL_VERSION_MICRO 101 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index 451c7d83b9..6c41a86e1e 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -93,10 +93,14 @@ isNBPS: yuva420p9le yuva422p10be yuva422p10le + yuva422p12be + yuva422p12le yuva422p9be yuva422p9le yuva444p10be yuva444p10le + yuva444p12be + yuva444p12le yuva444p9be yuva444p9le @@ -158,9 +162,11 @@ isBE: yuva420p16be yuva420p9be yuva422p10be + yuva422p12be yuva422p16be yuva422p9be yuva444p10be + yuva444p12be yuva444p16be yuva444p9be @@ -233,6 +239,8 @@ isYUV: yuva422p yuva422p10be yuva422p10le + yuva422p12be + yuva422p12le yuva422p16be yuva422p16le yuva422p9be @@ -240,6 +248,8 @@ isYUV: yuva444p yuva444p10be yuva444p10le + yuva444p12be + yuva444p12le yuva444p16be yuva444p16le yuva444p9be @@ -312,6 +322,8 @@ isPlanarYUV: yuva422p yuva422p10be yuva422p10le + yuva422p12be + yuva422p12le yuva422p16be yuva422p16le yuva422p9be @@ -319,6 +331,8 @@ isPlanarYUV: yuva444p yuva444p10be yuva444p10le + yuva444p12be + yuva444p12le yuva444p16be yuva444p16le yuva444p9be @@ -581,6 +595,8 @@ ALPHA: yuva422p yuva422p10be yuva422p10le + yuva422p12be + yuva422p12le yuva422p16be yuva422p16le yuva422p9be @@ -588,6 +604,8 @@ ALPHA: yuva444p yuva444p10be yuva444p10le + yuva444p12be + yuva444p12le yuva444p16be yuva444p16le yuva444p9be @@ -739,6 +757,8 @@ Planar: yuva422p yuva422p10be yuva422p10le + yuva422p12be + yuva422p12le yuva422p16be yuva422p16le yuva422p9be @@ -746,6 +766,8 @@ Planar: yuva444p yuva444p10be yuva444p10le + yuva444p12be + yuva444p12le yuva444p16be yuva444p16le yuva444p9be