diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2016-09-24 22:48:48 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2016-09-27 18:48:30 +0200 |
commit | 85406e7a8d5ad12db15ef9d713d0bc3d870fafee (patch) | |
tree | ceeda1e60bb19383668f30fa0c5a978f1a8aa933 | |
parent | 2b5b1e1e9b89063d352e2efed014f9d761b85032 (diff) | |
download | ffmpeg-85406e7a8d5ad12db15ef9d713d0bc3d870fafee.tar.gz |
pixfmt: Add yuv420p12 pixel format
-rw-r--r-- | libavutil/pixdesc.c | 25 | ||||
-rw-r--r-- | libavutil/pixfmt.h | 4 | ||||
-rw-r--r-- | libswscale/input.c | 4 | ||||
-rw-r--r-- | libswscale/output.c | 9 | ||||
-rw-r--r-- | libswscale/swscale_unscaled.c | 4 | ||||
-rw-r--r-- | libswscale/utils.c | 2 | ||||
-rw-r--r-- | tests/ref/fate/filter-pixdesc-yuv420p12be | 1 | ||||
-rw-r--r-- | tests/ref/fate/filter-pixdesc-yuv420p12le | 1 | ||||
-rw-r--r-- | tests/ref/fate/filter-pixfmts-copy | 2 | ||||
-rw-r--r-- | tests/ref/fate/filter-pixfmts-null | 2 | ||||
-rw-r--r-- | tests/ref/fate/filter-pixfmts-scale | 2 | ||||
-rw-r--r-- | tests/ref/fate/filter-pixfmts-vflip | 2 |
12 files changed, 56 insertions, 2 deletions
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 |