From ab839054e662d3227e1f795ba1dfd01fe1cf305c Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Thu, 3 Nov 2016 16:10:03 +0100 Subject: [PATCH] swscale: Add GRAY12 --- libswscale/input.c | 2 ++ libswscale/swscale_internal.h | 2 ++ libswscale/swscale_unscaled.c | 1 + libswscale/utils.c | 2 ++ tests/ref/fate/filter-pixdesc-gray12be | 1 + tests/ref/fate/filter-pixdesc-gray12le | 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, 17 insertions(+) create mode 100644 tests/ref/fate/filter-pixdesc-gray12be create mode 100644 tests/ref/fate/filter-pixdesc-gray12le diff --git a/libswscale/input.c b/libswscale/input.c index 9f2ef72894..d8560a1f2b 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -1120,6 +1120,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUV420P16LE: case AV_PIX_FMT_YUV422P16LE: case AV_PIX_FMT_YUV444P16LE: + case AV_PIX_FMT_GRAY12LE: case AV_PIX_FMT_GRAY16LE: c->lumToYV12 = bswap16Y_c; break; @@ -1148,6 +1149,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUV420P16BE: case AV_PIX_FMT_YUV422P16BE: case AV_PIX_FMT_YUV444P16BE: + case AV_PIX_FMT_GRAY12BE: case AV_PIX_FMT_GRAY16BE: c->lumToYV12 = bswap16Y_c; break; diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index abcdb9f41b..e7a6eedd22 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -603,6 +603,8 @@ static av_always_inline int isRGB(enum AVPixelFormat pix_fmt) #define isGray(x) \ ((x) == AV_PIX_FMT_GRAY8 || \ (x) == AV_PIX_FMT_YA8 || \ + (x) == AV_PIX_FMT_GRAY12BE || \ + (x) == AV_PIX_FMT_GRAY12LE || \ (x) == AV_PIX_FMT_GRAY16BE || \ (x) == AV_PIX_FMT_GRAY16LE || \ (x) == AV_PIX_FMT_YA16BE || \ diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 24c65ccd22..d3863bba10 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -1097,6 +1097,7 @@ void ff_get_unscaled_swscale(SwsContext *c) IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR555) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR565) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGRA64) || + IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY12) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY16) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YA16) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP12)|| diff --git a/libswscale/utils.c b/libswscale/utils.c index 1c3bbb3305..6034b70465 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -107,6 +107,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_RGBA] = { 1, 1 }, [AV_PIX_FMT_ABGR] = { 1, 1 }, [AV_PIX_FMT_BGRA] = { 1, 1 }, + [AV_PIX_FMT_GRAY12BE] = { 1, 1 }, + [AV_PIX_FMT_GRAY12LE] = { 1, 1 }, [AV_PIX_FMT_GRAY16BE] = { 1, 1 }, [AV_PIX_FMT_GRAY16LE] = { 1, 1 }, [AV_PIX_FMT_YUV440P] = { 1, 1 }, diff --git a/tests/ref/fate/filter-pixdesc-gray12be b/tests/ref/fate/filter-pixdesc-gray12be new file mode 100644 index 0000000000..de997347d5 --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-gray12be @@ -0,0 +1 @@ +pixdesc-gray12be bff4fa5910e99725b275fb70270b0cf9 diff --git a/tests/ref/fate/filter-pixdesc-gray12le b/tests/ref/fate/filter-pixdesc-gray12le new file mode 100644 index 0000000000..c2c5f68684 --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-gray12le @@ -0,0 +1 @@ +pixdesc-gray12le d0900fab4e757ef17fff8c1ffd0b3816 diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy index d9a5166e11..bd16f11075 100644 --- a/tests/ref/fate/filter-pixfmts-copy +++ b/tests/ref/fate/filter-pixfmts-copy @@ -23,6 +23,8 @@ gbrp12le 654861b1837d312569395f598da1a2a1 gbrp9be cbe1bf8ead497a92362a749bd4b0a57e gbrp9le f88c68df5d699a4a7f1b0152df9f25fe gray 8c941e9bbf6da5336384c57f15a4a454 +gray12be aecffce8ea67ab93527dc74c1a523454 +gray12le eac4b15c8686f04ea73751294f40b8e0 gray16be 43bda75c197b0d59a9b87ee941553644 gray16le a4ea1369ef1efff0e1341a1dc42dbfdf monob e13b2cbfb93d3ed6fdc1f256662ea959 diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null index d9a5166e11..bd16f11075 100644 --- a/tests/ref/fate/filter-pixfmts-null +++ b/tests/ref/fate/filter-pixfmts-null @@ -23,6 +23,8 @@ gbrp12le 654861b1837d312569395f598da1a2a1 gbrp9be cbe1bf8ead497a92362a749bd4b0a57e gbrp9le f88c68df5d699a4a7f1b0152df9f25fe gray 8c941e9bbf6da5336384c57f15a4a454 +gray12be aecffce8ea67ab93527dc74c1a523454 +gray12le eac4b15c8686f04ea73751294f40b8e0 gray16be 43bda75c197b0d59a9b87ee941553644 gray16le a4ea1369ef1efff0e1341a1dc42dbfdf monob e13b2cbfb93d3ed6fdc1f256662ea959 diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale index 2a60f72f8b..e1737f0b20 100644 --- a/tests/ref/fate/filter-pixfmts-scale +++ b/tests/ref/fate/filter-pixfmts-scale @@ -23,6 +23,8 @@ gbrp12le 735061c07442657580577d1cede3a636 gbrp9be 01c837e1def99abec205b80d21b68bf0 gbrp9le dd982d59c3d71c3b201f2d9363d8952c gray 4c571fb634a75f177b64cee168fbf3a1 +gray12be d237d56e08482038ebc5f3943d6ec8d5 +gray12le dcd15a0ed89bd019cc367b552fc9b1c0 gray16be 9b57ff7d2090b47e4427bee79dba0d9e gray16le 17d2c00c6ffe346dfb632d927ebbf30a monob e28955319a03f1850c467f8fe65b2a22 diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip index 93a292d6bc..11a48c7c71 100644 --- a/tests/ref/fate/filter-pixfmts-vflip +++ b/tests/ref/fate/filter-pixfmts-vflip @@ -23,6 +23,8 @@ gbrp12le b7b27715bc9054a93ba81f110cf42ee5 gbrp9be 2ae8f0d3b079d6550a2b1d4a7c4a6e4b gbrp9le c62df0f386c957cc9cacb3c8014542eb gray 684ba667effbbf5983f46a9bea4afaae +gray12be e33397832d19ec628f3e887e0a16ccc7 +gray12le c8a8d7267e2595a0c4ce5d582bea23a1 gray16be 112077b2f1c85cbd44907ed271901b28 gray16le 1d7be18af19f4ff847ff4bc7c610c8cc monob 0e4946183903fea3ef246c16385e236c