From 85406e7a8d5ad12db15ef9d713d0bc3d870fafee Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 24 Sep 2016 22:48:48 +0200 Subject: [PATCH 1/4] pixfmt: Add yuv420p12 pixel format --- libavutil/pixdesc.c | 25 +++++++++++++++++++++++ libavutil/pixfmt.h | 4 ++++ libswscale/input.c | 4 ++++ libswscale/output.c | 9 +++++++- libswscale/swscale_unscaled.c | 4 +++- libswscale/utils.c | 2 ++ tests/ref/fate/filter-pixdesc-yuv420p12be | 1 + tests/ref/fate/filter-pixdesc-yuv420p12le | 1 + tests/ref/fate/filter-pixfmts-copy | 2 ++ tests/ref/fate/filter-pixfmts-null | 2 ++ tests/ref/fate/filter-pixfmts-scale | 2 ++ tests/ref/fate/filter-pixfmts-vflip | 2 ++ 12 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 tests/ref/fate/filter-pixdesc-yuv420p12be create mode 100644 tests/ref/fate/filter-pixdesc-yuv420p12le diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index cf2ea9ca40..8f116fc638 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -1174,6 +1174,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, }, + [AV_PIX_FMT_YUV420P12LE] = { + .name = "yuv420p12le", + .nb_components = 3, + .log2_chroma_w = 1, + .log2_chroma_h = 1, + .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 */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR, + }, + [AV_PIX_FMT_YUV420P12BE] = { + .name = "yuv420p12be", + .nb_components = 3, + .log2_chroma_w = 1, + .log2_chroma_h = 1, + .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 */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, + }, [AV_PIX_FMT_YUV420P16LE] = { .name = "yuv420p16le", .nb_components = 3, @@ -1842,6 +1866,7 @@ enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt) PIX_FMT_SWAP_ENDIANNESS(YUV420P10); PIX_FMT_SWAP_ENDIANNESS(YUV422P10); PIX_FMT_SWAP_ENDIANNESS(YUV444P10); + PIX_FMT_SWAP_ENDIANNESS(YUV420P12); PIX_FMT_SWAP_ENDIANNESS(YUV420P16); PIX_FMT_SWAP_ENDIANNESS(YUV422P16); PIX_FMT_SWAP_ENDIANNESS(YUV444P16); diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 8a8d624a37..658d5bf55b 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -230,6 +230,9 @@ enum AVPixelFormat { AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian + AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0, 18bpp, (1 Cr & Cb sample per 2x2 Y), big-endian + AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0, 18bpp, (1 Cr & Cb sample per 2x2 Y), 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 }; @@ -263,6 +266,7 @@ enum AVPixelFormat { #define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE) #define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE) #define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE) +#define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE) #define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE) #define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE) #define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE) diff --git a/libswscale/input.c b/libswscale/input.c index 69c6729666..9c0a32c4c6 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -815,6 +815,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUV420P10LE: case AV_PIX_FMT_YUV422P10LE: case AV_PIX_FMT_YUV444P10LE: + case AV_PIX_FMT_YUV420P12LE: case AV_PIX_FMT_YUV420P16LE: case AV_PIX_FMT_YUV422P16LE: case AV_PIX_FMT_YUV444P16LE: @@ -836,6 +837,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUV420P10BE: case AV_PIX_FMT_YUV422P10BE: case AV_PIX_FMT_YUV444P10BE: + case AV_PIX_FMT_YUV420P12BE: case AV_PIX_FMT_YUV420P16BE: case AV_PIX_FMT_YUV422P16BE: case AV_PIX_FMT_YUV444P16BE: @@ -1033,6 +1035,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUV420P10LE: case AV_PIX_FMT_YUV422P10LE: case AV_PIX_FMT_YUV444P10LE: + case AV_PIX_FMT_YUV420P12LE: case AV_PIX_FMT_YUV420P16LE: case AV_PIX_FMT_YUV422P16LE: case AV_PIX_FMT_YUV444P16LE: @@ -1058,6 +1061,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUV420P10BE: case AV_PIX_FMT_YUV422P10BE: case AV_PIX_FMT_YUV444P10BE: + case AV_PIX_FMT_YUV420P12BE: case AV_PIX_FMT_YUV420P16BE: case AV_PIX_FMT_YUV422P16BE: case AV_PIX_FMT_YUV444P16BE: diff --git a/libswscale/output.c b/libswscale/output.c index 6a51bb9bdf..78ebbc6b4f 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -231,6 +231,8 @@ yuv2NBPS( 9, BE, 1, 10, int16_t) yuv2NBPS( 9, LE, 0, 10, int16_t) yuv2NBPS(10, BE, 1, 10, int16_t) yuv2NBPS(10, LE, 0, 10, int16_t) +yuv2NBPS(12, BE, 1, 10, int16_t) +yuv2NBPS(12, LE, 0, 10, int16_t) yuv2NBPS(16, BE, 1, 16, int32_t) yuv2NBPS(16, LE, 0, 16, int32_t) @@ -1368,9 +1370,14 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, if (desc->comp[0].depth == 9) { *yuv2planeX = isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c; *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c; - } else { + } else if (desc->comp[0].depth == 10) { *yuv2planeX = isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c; *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c; + } else if (desc->comp[0].depth == 12) { + *yuv2planeX = isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c; + *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c; + } else { + assert(0); } } else { *yuv2plane1 = yuv2plane1_8_c; diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index fbdc2affe1..87331ae818 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -1157,8 +1157,10 @@ void ff_get_unscaled_swscale(SwsContext *c) c->chrDstVSubSample == c->chrSrcVSubSample && dstFormat != AV_PIX_FMT_NV12 && dstFormat != AV_PIX_FMT_NV21 && dstFormat != AV_PIX_FMT_P010LE && dstFormat != AV_PIX_FMT_P010BE && + dstFormat != AV_PIX_FMT_YUV420P12LE && dstFormat != AV_PIX_FMT_YUV420P12BE && srcFormat != AV_PIX_FMT_NV12 && srcFormat != AV_PIX_FMT_NV21 && - srcFormat != AV_PIX_FMT_P010LE && srcFormat != AV_PIX_FMT_P010BE)) + srcFormat != AV_PIX_FMT_P010LE && srcFormat != AV_PIX_FMT_P010BE && + srcFormat != AV_PIX_FMT_YUV420P12LE && srcFormat != AV_PIX_FMT_YUV420P12BE)) { if (isPacked(c->srcFormat)) c->swscale = packedCopyWrapper; diff --git a/libswscale/utils.c b/libswscale/utils.c index c4fb7451eb..06b9c1c28b 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -165,6 +165,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_YUV420P9LE] = { 1, 1 }, [AV_PIX_FMT_YUV420P10BE] = { 1, 1 }, [AV_PIX_FMT_YUV420P10LE] = { 1, 1 }, + [AV_PIX_FMT_YUV420P12BE] = { 1, 1 }, + [AV_PIX_FMT_YUV420P12LE] = { 1, 1 }, [AV_PIX_FMT_YUV422P9BE] = { 1, 1 }, [AV_PIX_FMT_YUV422P9LE] = { 1, 1 }, [AV_PIX_FMT_YUV422P10BE] = { 1, 1 }, diff --git a/tests/ref/fate/filter-pixdesc-yuv420p12be b/tests/ref/fate/filter-pixdesc-yuv420p12be new file mode 100644 index 0000000000..77cc341d9b --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-yuv420p12be @@ -0,0 +1 @@ +pixdesc-yuv420p12be 6d665168703a982178ac395de9be422f diff --git a/tests/ref/fate/filter-pixdesc-yuv420p12le b/tests/ref/fate/filter-pixdesc-yuv420p12le new file mode 100644 index 0000000000..8ef325a97d --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-yuv420p12le @@ -0,0 +1 @@ +pixdesc-yuv420p12le 0898b89cc0e0aec143fea7d3ecec991b diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy index 2f6a71e8e1..cc1e595df7 100644 --- a/tests/ref/fate/filter-pixfmts-copy +++ b/tests/ref/fate/filter-pixfmts-copy @@ -43,6 +43,8 @@ yuv411p fc2f303b20ae610dce86dae4a6671881 yuv420p a2117c3c5d4533dca311dc94a3d157bc yuv420p10be 7756ef359f79d63ef6f983caeaba5c51 yuv420p10le aa8abcc05010b4b0df7d924fd5887291 +yuv420p12be f93fea0e8e10e9f2d006e8f8be5b8938 +yuv420p12le 5d2810e2112328dd88ffddfb486df060 yuv420p16be 7a708532d8ac26d598ac7332e38dd2de yuv420p16le 6b868d3b0c44c6b04f39415890d6ee0b yuv420p9be 11ffb289661f4f55347d60e99dcef632 diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null index 2f6a71e8e1..cc1e595df7 100644 --- a/tests/ref/fate/filter-pixfmts-null +++ b/tests/ref/fate/filter-pixfmts-null @@ -43,6 +43,8 @@ yuv411p fc2f303b20ae610dce86dae4a6671881 yuv420p a2117c3c5d4533dca311dc94a3d157bc yuv420p10be 7756ef359f79d63ef6f983caeaba5c51 yuv420p10le aa8abcc05010b4b0df7d924fd5887291 +yuv420p12be f93fea0e8e10e9f2d006e8f8be5b8938 +yuv420p12le 5d2810e2112328dd88ffddfb486df060 yuv420p16be 7a708532d8ac26d598ac7332e38dd2de yuv420p16le 6b868d3b0c44c6b04f39415890d6ee0b yuv420p9be 11ffb289661f4f55347d60e99dcef632 diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale index fbbc1c9f47..aa546752a7 100644 --- a/tests/ref/fate/filter-pixfmts-scale +++ b/tests/ref/fate/filter-pixfmts-scale @@ -43,6 +43,8 @@ yuv411p 091777fdfffa2dccbfd75769d1a402c7 yuv420p 4f0105b3f2008bff284de251fe61ce06 yuv420p10be caaee5d071cccf50cc51c70f7a233024 yuv420p10le 06c47286459599c62b25466e2ee3c91d +yuv420p12be b549289c041b852f0fec07d2cca5fb16 +yuv420p12le df151f2b0a8bb7062d35b515cdffca3b yuv420p16be 10ba255f3901b5d47d3ac803fb787bcf yuv420p16le 38c42f658cad8546bfc465b72f6312ab yuv420p9be 17cd0ca2d12fd972045271e06a14b711 diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip index da13b160f9..29689db5e6 100644 --- a/tests/ref/fate/filter-pixfmts-vflip +++ b/tests/ref/fate/filter-pixfmts-vflip @@ -43,6 +43,8 @@ yuv411p a97d81c8a515965209127cfdc718f899 yuv420p daed3fd5e1980ccc4d4409320f16fbf6 yuv420p10be f434af8526dcda2988f15a08cdc4bf98 yuv420p10le 9dcbdb0206713a90fd03b313d99e9ff9 +yuv420p12be 5c3b2cbbb97c38b763f3da61ba5152d2 +yuv420p12le 88e20b45556294e7ca64b323cf115ceb yuv420p16be b8f1a0e4ef98903e2ef8dbce7bc812e2 yuv420p16le 3be4223322a9d904caa2ad7d4ccf3c6a yuv420p9be 34346f74216be11c38cdaeffaba250cc From 0aebbbd024762d3c9c13f4bf0607710feee5e73a Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 24 Sep 2016 20:22:56 +0200 Subject: [PATCH 2/4] pixfmt: Add yuv422p12 pixel format --- libavutil/pixdesc.c | 25 +++++++++++++++++++++++ libavutil/pixfmt.h | 4 ++++ libswscale/input.c | 4 ++++ libswscale/swscale_unscaled.c | 4 +++- libswscale/utils.c | 2 ++ tests/ref/fate/filter-pixdesc-yuv422p12be | 1 + tests/ref/fate/filter-pixdesc-yuv422p12le | 1 + tests/ref/fate/filter-pixfmts-copy | 2 ++ tests/ref/fate/filter-pixfmts-null | 2 ++ tests/ref/fate/filter-pixfmts-scale | 2 ++ tests/ref/fate/filter-pixfmts-vflip | 2 ++ 11 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 tests/ref/fate/filter-pixdesc-yuv422p12be create mode 100644 tests/ref/fate/filter-pixdesc-yuv422p12le diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 8f116fc638..e0c7851abe 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -1270,6 +1270,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, }, + [AV_PIX_FMT_YUV422P12LE] = { + .name = "yuv422p12le", + .nb_components = 3, + .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 */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR, + }, + [AV_PIX_FMT_YUV422P12BE] = { + .name = "yuv422p12be", + .nb_components = 3, + .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 */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, + }, [AV_PIX_FMT_YUV422P16LE] = { .name = "yuv422p16le", .nb_components = 3, @@ -1867,6 +1891,7 @@ enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt) PIX_FMT_SWAP_ENDIANNESS(YUV422P10); PIX_FMT_SWAP_ENDIANNESS(YUV444P10); PIX_FMT_SWAP_ENDIANNESS(YUV420P12); + PIX_FMT_SWAP_ENDIANNESS(YUV422P12); PIX_FMT_SWAP_ENDIANNESS(YUV420P16); PIX_FMT_SWAP_ENDIANNESS(YUV422P16); PIX_FMT_SWAP_ENDIANNESS(YUV444P16); diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 658d5bf55b..3e356afa6b 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -233,6 +233,9 @@ enum AVPixelFormat { AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0, 18bpp, (1 Cr & Cb sample per 2x2 Y), big-endian AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0, 18bpp, (1 Cr & Cb sample per 2x2 Y), little-endian + AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2, 24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2, 24bpp, (1 Cr & Cb sample per 2x1 Y samples), 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 }; @@ -267,6 +270,7 @@ enum AVPixelFormat { #define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE) #define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE) #define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE) +#define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE) #define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE) #define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE) #define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE) diff --git a/libswscale/input.c b/libswscale/input.c index 9c0a32c4c6..76a4700122 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -816,6 +816,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUV422P10LE: case AV_PIX_FMT_YUV444P10LE: case AV_PIX_FMT_YUV420P12LE: + case AV_PIX_FMT_YUV422P12LE: case AV_PIX_FMT_YUV420P16LE: case AV_PIX_FMT_YUV422P16LE: case AV_PIX_FMT_YUV444P16LE: @@ -838,6 +839,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUV422P10BE: case AV_PIX_FMT_YUV444P10BE: case AV_PIX_FMT_YUV420P12BE: + case AV_PIX_FMT_YUV422P12BE: case AV_PIX_FMT_YUV420P16BE: case AV_PIX_FMT_YUV422P16BE: case AV_PIX_FMT_YUV444P16BE: @@ -1036,6 +1038,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUV422P10LE: case AV_PIX_FMT_YUV444P10LE: case AV_PIX_FMT_YUV420P12LE: + case AV_PIX_FMT_YUV422P12LE: case AV_PIX_FMT_YUV420P16LE: case AV_PIX_FMT_YUV422P16LE: case AV_PIX_FMT_YUV444P16LE: @@ -1062,6 +1065,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUV422P10BE: case AV_PIX_FMT_YUV444P10BE: case AV_PIX_FMT_YUV420P12BE: + case AV_PIX_FMT_YUV422P12BE: case AV_PIX_FMT_YUV420P16BE: case AV_PIX_FMT_YUV422P16BE: case AV_PIX_FMT_YUV444P16BE: diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 87331ae818..31706ca4c2 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -1158,9 +1158,11 @@ void ff_get_unscaled_swscale(SwsContext *c) dstFormat != AV_PIX_FMT_NV12 && dstFormat != AV_PIX_FMT_NV21 && dstFormat != AV_PIX_FMT_P010LE && dstFormat != AV_PIX_FMT_P010BE && dstFormat != AV_PIX_FMT_YUV420P12LE && dstFormat != AV_PIX_FMT_YUV420P12BE && + dstFormat != AV_PIX_FMT_YUV422P12LE && dstFormat != AV_PIX_FMT_YUV422P12BE && srcFormat != AV_PIX_FMT_NV12 && srcFormat != AV_PIX_FMT_NV21 && srcFormat != AV_PIX_FMT_P010LE && srcFormat != AV_PIX_FMT_P010BE && - srcFormat != AV_PIX_FMT_YUV420P12LE && srcFormat != AV_PIX_FMT_YUV420P12BE)) + srcFormat != AV_PIX_FMT_YUV420P12LE && srcFormat != AV_PIX_FMT_YUV420P12BE && + srcFormat != AV_PIX_FMT_YUV422P12LE && srcFormat != AV_PIX_FMT_YUV422P12BE)) { if (isPacked(c->srcFormat)) c->swscale = packedCopyWrapper; diff --git a/libswscale/utils.c b/libswscale/utils.c index 06b9c1c28b..dc442929b9 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -171,6 +171,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_YUV422P9LE] = { 1, 1 }, [AV_PIX_FMT_YUV422P10BE] = { 1, 1 }, [AV_PIX_FMT_YUV422P10LE] = { 1, 1 }, + [AV_PIX_FMT_YUV422P12BE] = { 1, 1 }, + [AV_PIX_FMT_YUV422P12LE] = { 1, 1 }, [AV_PIX_FMT_YUV444P9BE] = { 1, 1 }, [AV_PIX_FMT_YUV444P9LE] = { 1, 1 }, [AV_PIX_FMT_YUV444P10BE] = { 1, 1 }, diff --git a/tests/ref/fate/filter-pixdesc-yuv422p12be b/tests/ref/fate/filter-pixdesc-yuv422p12be new file mode 100644 index 0000000000..8cfd917731 --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-yuv422p12be @@ -0,0 +1 @@ +pixdesc-yuv422p12be 470f5361088e1af7f6ae70945d411a25 diff --git a/tests/ref/fate/filter-pixdesc-yuv422p12le b/tests/ref/fate/filter-pixdesc-yuv422p12le new file mode 100644 index 0000000000..e457288969 --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-yuv422p12le @@ -0,0 +1 @@ +pixdesc-yuv422p12le dd79803aff3bf939c818304884341c17 diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy index cc1e595df7..6ffeed0544 100644 --- a/tests/ref/fate/filter-pixfmts-copy +++ b/tests/ref/fate/filter-pixfmts-copy @@ -52,6 +52,8 @@ yuv420p9le a0c9608b2be3ca6d4e8cf625714a3833 yuv422p b082344038849f5fd444ccf2a30e3f4f yuv422p10be 43a6293e138d0ecfd3385df3dcf9b713 yuv422p10le 74da030a4efb5a20986fcead50018f4d +yuv422p12be d60480c872d6723e587199ee4ecfe86d +yuv422p12le 2cbf87d44e9c897ec6460225d47efbda yuv422p16be f7a0fb9e82805660317d07209e726100 yuv422p16le 12eeb2f95bb0d655d52e8eed1cfbf771 yuv422p9be 60daf1a7e61434b244c5a43f4449b617 diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null index cc1e595df7..6ffeed0544 100644 --- a/tests/ref/fate/filter-pixfmts-null +++ b/tests/ref/fate/filter-pixfmts-null @@ -52,6 +52,8 @@ yuv420p9le a0c9608b2be3ca6d4e8cf625714a3833 yuv422p b082344038849f5fd444ccf2a30e3f4f yuv422p10be 43a6293e138d0ecfd3385df3dcf9b713 yuv422p10le 74da030a4efb5a20986fcead50018f4d +yuv422p12be d60480c872d6723e587199ee4ecfe86d +yuv422p12le 2cbf87d44e9c897ec6460225d47efbda yuv422p16be f7a0fb9e82805660317d07209e726100 yuv422p16le 12eeb2f95bb0d655d52e8eed1cfbf771 yuv422p9be 60daf1a7e61434b244c5a43f4449b617 diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale index aa546752a7..a56d5c776b 100644 --- a/tests/ref/fate/filter-pixfmts-scale +++ b/tests/ref/fate/filter-pixfmts-scale @@ -52,6 +52,8 @@ yuv420p9le 38289963713431c8b4a2e7c08b8564b6 yuv422p 66f47bfad422275bd07b2881760d09a2 yuv422p10be 00504b09c67e203fc29cac3ae2aa91db yuv422p10le b8b38a8d1f1eec3915b628c873bf756a +yuv422p12be 0ab7660a9a52abe41edf8d6b3f75942a +yuv422p12le bde450e4b79a13aaaba8233df3c51f4d yuv422p16be 2f12b4fb816afcaa77e7359b95f25532 yuv422p16le 3913bbbd4b0aa8038e8565c7312e25be yuv422p9be f86744d026c3a65d54c737a93e80093f diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip index 29689db5e6..9e7a916faf 100644 --- a/tests/ref/fate/filter-pixfmts-vflip +++ b/tests/ref/fate/filter-pixfmts-vflip @@ -52,6 +52,8 @@ yuv420p9le 8248d1c10aa86ef8e4b212a2d9fca937 yuv422p 5a58e1fe687b71e28f52aeb11b999e46 yuv422p10be adaf99408661a1dc3c667cad992c08d7 yuv422p10le bc071b965f5a1b3c7349b71bd2b4247c +yuv422p12be e1ab3898be486cd95e6332fa81570f63 +yuv422p12le 343a7281c6d30c09ed7b8be86bd6d42f yuv422p16be 1ec214fba454c456d83de5220c867ede yuv422p16le 9f9316d40597c9fb917d921bfbcd8421 yuv422p9be 98e7cefa912845b488f85508a7be7e04 From 9bd6ea5695660529b2887292874a7b9e61fc301e Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 24 Sep 2016 23:09:43 +0200 Subject: [PATCH 3/4] pixfmt: Add yuv444p12 pixel format --- libavutil/pixdesc.c | 25 +++++++++++++++++++++++ libavutil/pixfmt.h | 4 ++++ libswscale/swscale_unscaled.c | 4 +++- libswscale/utils.c | 2 ++ tests/ref/fate/filter-pixdesc-yuv444p12be | 1 + tests/ref/fate/filter-pixdesc-yuv444p12le | 1 + tests/ref/fate/filter-pixfmts-copy | 2 ++ tests/ref/fate/filter-pixfmts-null | 2 ++ tests/ref/fate/filter-pixfmts-scale | 2 ++ tests/ref/fate/filter-pixfmts-vflip | 2 ++ 10 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 tests/ref/fate/filter-pixdesc-yuv444p12be create mode 100644 tests/ref/fate/filter-pixdesc-yuv444p12le diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index e0c7851abe..78fbdbc01b 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -1342,6 +1342,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, }, + [AV_PIX_FMT_YUV444P12LE] = { + .name = "yuv444p12le", + .nb_components = 3, + .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 */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR, + }, + [AV_PIX_FMT_YUV444P12BE] = { + .name = "yuv444p12be", + .nb_components = 3, + .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 */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, + }, [AV_PIX_FMT_YUV444P10LE] = { .name = "yuv444p10le", .nb_components = 3, @@ -1892,6 +1916,7 @@ enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt) PIX_FMT_SWAP_ENDIANNESS(YUV444P10); PIX_FMT_SWAP_ENDIANNESS(YUV420P12); PIX_FMT_SWAP_ENDIANNESS(YUV422P12); + PIX_FMT_SWAP_ENDIANNESS(YUV444P12); PIX_FMT_SWAP_ENDIANNESS(YUV420P16); PIX_FMT_SWAP_ENDIANNESS(YUV422P16); PIX_FMT_SWAP_ENDIANNESS(YUV444P16); diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 3e356afa6b..908b0fe7a5 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -236,6 +236,9 @@ enum AVPixelFormat { AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2, 24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2, 24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4, 36bpp, (1 Cr & Cb sample per 1x1 Y), big-endian + AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4, 36bpp, (1 Cr & Cb sample per 1x1 Y), 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 }; @@ -271,6 +274,7 @@ enum AVPixelFormat { #define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE) #define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE) #define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE) +#define AV_PIX_FMT_YUV444P12 AV_PIX_FMT_NE(YUV444P12BE, YUV444P12LE) #define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE) #define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE) #define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 31706ca4c2..ad87bbcb46 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -1159,10 +1159,12 @@ void ff_get_unscaled_swscale(SwsContext *c) dstFormat != AV_PIX_FMT_P010LE && dstFormat != AV_PIX_FMT_P010BE && dstFormat != AV_PIX_FMT_YUV420P12LE && dstFormat != AV_PIX_FMT_YUV420P12BE && dstFormat != AV_PIX_FMT_YUV422P12LE && dstFormat != AV_PIX_FMT_YUV422P12BE && + dstFormat != AV_PIX_FMT_YUV444P12LE && dstFormat != AV_PIX_FMT_YUV444P12BE && srcFormat != AV_PIX_FMT_NV12 && srcFormat != AV_PIX_FMT_NV21 && srcFormat != AV_PIX_FMT_P010LE && srcFormat != AV_PIX_FMT_P010BE && srcFormat != AV_PIX_FMT_YUV420P12LE && srcFormat != AV_PIX_FMT_YUV420P12BE && - srcFormat != AV_PIX_FMT_YUV422P12LE && srcFormat != AV_PIX_FMT_YUV422P12BE)) + srcFormat != AV_PIX_FMT_YUV422P12LE && srcFormat != AV_PIX_FMT_YUV422P12BE && + srcFormat != AV_PIX_FMT_YUV444P12LE && srcFormat != AV_PIX_FMT_YUV444P12BE)) { if (isPacked(c->srcFormat)) c->swscale = packedCopyWrapper; diff --git a/libswscale/utils.c b/libswscale/utils.c index dc442929b9..b7b534dceb 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -177,6 +177,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_YUV444P9LE] = { 1, 1 }, [AV_PIX_FMT_YUV444P10BE] = { 1, 1 }, [AV_PIX_FMT_YUV444P10LE] = { 1, 1 }, + [AV_PIX_FMT_YUV444P12BE] = { 1, 1 }, + [AV_PIX_FMT_YUV444P12LE] = { 1, 1 }, [AV_PIX_FMT_GBRP] = { 1, 1 }, [AV_PIX_FMT_GBRP9LE] = { 1, 1 }, [AV_PIX_FMT_GBRP9BE] = { 1, 1 }, diff --git a/tests/ref/fate/filter-pixdesc-yuv444p12be b/tests/ref/fate/filter-pixdesc-yuv444p12be new file mode 100644 index 0000000000..e8c1201985 --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-yuv444p12be @@ -0,0 +1 @@ +pixdesc-yuv444p12be f20564006d137df0fc6bb7466fd0fc64 diff --git a/tests/ref/fate/filter-pixdesc-yuv444p12le b/tests/ref/fate/filter-pixdesc-yuv444p12le new file mode 100644 index 0000000000..9807ff074a --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-yuv444p12le @@ -0,0 +1 @@ +pixdesc-yuv444p12le 9d5db1a9354b62181e09aa93c1ffa19a diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy index 6ffeed0544..c712f78148 100644 --- a/tests/ref/fate/filter-pixfmts-copy +++ b/tests/ref/fate/filter-pixfmts-copy @@ -62,6 +62,8 @@ yuv440p 12000ce709b38aac3f7b7f59b07847ef yuv444p 628c9d1e10c22e0e512b27c0e03b46e6 yuv444p10be b60d77db54a592ed088ebf7964e2dd5e yuv444p10le 1752a238eb27fb7c746e349536f60686 +yuv444p12be be54f88f9b9034b5b9bc466132bfba10 +yuv444p12le 714c3c5789897b56cb9ae6a45688e395 yuv444p16be 8e1e2f04cb2e97f80fdfecbb2c5679a0 yuv444p16le 5677b2caa63e0c075eac6937b03cf2a6 yuv444p9be 5ab55576b180b2966e9ed5a1ea55508a diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null index 6ffeed0544..c712f78148 100644 --- a/tests/ref/fate/filter-pixfmts-null +++ b/tests/ref/fate/filter-pixfmts-null @@ -62,6 +62,8 @@ yuv440p 12000ce709b38aac3f7b7f59b07847ef yuv444p 628c9d1e10c22e0e512b27c0e03b46e6 yuv444p10be b60d77db54a592ed088ebf7964e2dd5e yuv444p10le 1752a238eb27fb7c746e349536f60686 +yuv444p12be be54f88f9b9034b5b9bc466132bfba10 +yuv444p12le 714c3c5789897b56cb9ae6a45688e395 yuv444p16be 8e1e2f04cb2e97f80fdfecbb2c5679a0 yuv444p16le 5677b2caa63e0c075eac6937b03cf2a6 yuv444p9be 5ab55576b180b2966e9ed5a1ea55508a diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale index a56d5c776b..0a3f3f18c6 100644 --- a/tests/ref/fate/filter-pixfmts-scale +++ b/tests/ref/fate/filter-pixfmts-scale @@ -62,6 +62,8 @@ yuv440p 4713a7b7ce80dd06923626d13589c098 yuv444p fd733672651ad5bbffb046fd67151fee yuv444p10be 34b38d54167df70044bdc08518d91009 yuv444p10le 0812e3371c9589c6621408812f9e7a27 +yuv444p12be 936147950ba1b511570da85a0922abf3 +yuv444p12le 4a9ec677190371ef5e342ffac1ace735 yuv444p16be e89fe5a4624ed06603580b4a74af9170 yuv444p16le 6944d11048ff4013c5e60359faf1bd2d yuv444p9be 04a950e843d099eb9ade2ddcea494fb3 diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip index 9e7a916faf..b8718c7375 100644 --- a/tests/ref/fate/filter-pixfmts-vflip +++ b/tests/ref/fate/filter-pixfmts-vflip @@ -62,6 +62,8 @@ yuv440p fade395d957e1e3b117ac11c09404964 yuv444p a3c2a074c3609226bf1a0bc4de5c0e51 yuv444p10be b02fac8bc5a564a755567a86dc3ceae0 yuv444p10le 88860297f729c90526b157b6bf1e2fcf +yuv444p12be d8af56e4b09130e14a9449c84a03cab0 +yuv444p12le 0ccfbd671b8000c0f950b9dfae8ea879 yuv444p16be 26fbffad3c28aa1a6c47f2be6d146173 yuv444p16le 3d13dcea82caec9eb563a1d7a2e4b339 yuv444p9be df39c0778e5b13f306e9928c5b0ddbb2 From 0e8d1fc1f013eb805a7b66656d9452bcbca36d22 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Mon, 26 Sep 2016 18:16:39 +0200 Subject: [PATCH 4/4] lavu: Bump version for the 12bit Planar YUV support --- doc/APIchanges | 3 +++ libavutil/version.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 43e32623f7..6859081b0e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2015-08-28 API changes, most recent first: +2016-xx-xx - xxxxxxx - lavu 55.22.0 - pixfmt.h + Add AV_PIX_FMT_YUV(420,422,444)P12. + 2016-xx-xx - xxxxxxx - lavc 59.27.0 - avcodec.h Add FF_PROFILE_HEVC_REXT, the extended pixel format profile for HEVC. diff --git a/libavutil/version.h b/libavutil/version.h index f63dfa5d3f..f05e72ce13 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -54,7 +54,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 55 -#define LIBAVUTIL_VERSION_MINOR 21 +#define LIBAVUTIL_VERSION_MINOR 22 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \