[libav-devel] [PATCH 2/3] swscale: Add GRAY10

James Almer jamrial at gmail.com
Tue Nov 6 06:15:03 CET 2018


From: Carl Eugen Hoyos <cehoyos at ag.or.at>

Based on ab839054 by Luca Barbato.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libswscale/input.c                     | 2 ++
 libswscale/swscale_internal.h          | 2 ++
 libswscale/swscale_unscaled.c          | 1 +
 libswscale/utils.c                     | 2 ++
 libswscale/version.h                   | 2 +-
 tests/ref/fate/filter-pixdesc-gray10be | 1 +
 tests/ref/fate/filter-pixdesc-gray10le | 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, 18 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/fate/filter-pixdesc-gray10be
 create mode 100644 tests/ref/fate/filter-pixdesc-gray10le

diff --git a/libswscale/input.c b/libswscale/input.c
index 761776c1c..3bc475dc6 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -1136,6 +1136,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_GRAY10LE:
     case AV_PIX_FMT_GRAY12LE:
     case AV_PIX_FMT_GRAY16LE:
         c->lumToYV12 = bswap16Y_c;
@@ -1165,6 +1166,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_GRAY10BE:
     case AV_PIX_FMT_GRAY12BE:
     case AV_PIX_FMT_GRAY16BE:
         c->lumToYV12 = bswap16Y_c;
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index adfe1708e..7232921b9 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -600,6 +600,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_GRAY10BE    ||  \
+     (x) == AV_PIX_FMT_GRAY10LE    ||  \
      (x) == AV_PIX_FMT_GRAY12BE    ||  \
      (x) == AV_PIX_FMT_GRAY12LE    ||  \
      (x) == AV_PIX_FMT_GRAY16BE    ||  \
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index f130ac58c..06ad3a6ca 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_GRAY10) ||
         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)   ||
diff --git a/libswscale/utils.c b/libswscale/utils.c
index d94be5a50..f391bdad1 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -108,6 +108,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_GRAY10BE]    = { 1, 1 },
+    [AV_PIX_FMT_GRAY10LE]    = { 1, 1 },
     [AV_PIX_FMT_GRAY12BE]    = { 1, 1 },
     [AV_PIX_FMT_GRAY12LE]    = { 1, 1 },
     [AV_PIX_FMT_GRAY16BE]    = { 1, 1 },
diff --git a/libswscale/version.h b/libswscale/version.h
index 5badd3d32..e21758eb4 100644
--- a/libswscale/version.h
+++ b/libswscale/version.h
@@ -28,7 +28,7 @@
 
 #define LIBSWSCALE_VERSION_MAJOR 5
 #define LIBSWSCALE_VERSION_MINOR 0
-#define LIBSWSCALE_VERSION_MICRO 0
+#define LIBSWSCALE_VERSION_MICRO 1
 
 #define LIBSWSCALE_VERSION_INT  AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
                                                LIBSWSCALE_VERSION_MINOR, \
diff --git a/tests/ref/fate/filter-pixdesc-gray10be b/tests/ref/fate/filter-pixdesc-gray10be
new file mode 100644
index 000000000..74bf8c69a
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-gray10be
@@ -0,0 +1 @@
+pixdesc-gray10be    64bfd85801ed894c86337d2c7a7efaff
diff --git a/tests/ref/fate/filter-pixdesc-gray10le b/tests/ref/fate/filter-pixdesc-gray10le
new file mode 100644
index 000000000..d32cf96f9
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-gray10le
@@ -0,0 +1 @@
+pixdesc-gray10le    c1aa37491db157f32d589e66f020adee
diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy
index c23187c59..baaf86cc0 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -25,6 +25,8 @@ gbrp12le            654861b1837d312569395f598da1a2a1
 gbrp9be             cbe1bf8ead497a92362a749bd4b0a57e
 gbrp9le             f88c68df5d699a4a7f1b0152df9f25fe
 gray                8c941e9bbf6da5336384c57f15a4a454
+gray10be            69c8af356c3861792f9695fdff966629
+gray10le            a97b97107bf03f27136abbaca074aa88
 gray12be            aecffce8ea67ab93527dc74c1a523454
 gray12le            eac4b15c8686f04ea73751294f40b8e0
 gray16be            43bda75c197b0d59a9b87ee941553644
diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null
index c23187c59..baaf86cc0 100644
--- a/tests/ref/fate/filter-pixfmts-null
+++ b/tests/ref/fate/filter-pixfmts-null
@@ -25,6 +25,8 @@ gbrp12le            654861b1837d312569395f598da1a2a1
 gbrp9be             cbe1bf8ead497a92362a749bd4b0a57e
 gbrp9le             f88c68df5d699a4a7f1b0152df9f25fe
 gray                8c941e9bbf6da5336384c57f15a4a454
+gray10be            69c8af356c3861792f9695fdff966629
+gray10le            a97b97107bf03f27136abbaca074aa88
 gray12be            aecffce8ea67ab93527dc74c1a523454
 gray12le            eac4b15c8686f04ea73751294f40b8e0
 gray16be            43bda75c197b0d59a9b87ee941553644
diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale
index 0c73ec827..1744e0c37 100644
--- a/tests/ref/fate/filter-pixfmts-scale
+++ b/tests/ref/fate/filter-pixfmts-scale
@@ -25,6 +25,8 @@ gbrp12le            735061c07442657580577d1cede3a636
 gbrp9be             01c837e1def99abec205b80d21b68bf0
 gbrp9le             dd982d59c3d71c3b201f2d9363d8952c
 gray                4c571fb634a75f177b64cee168fbf3a1
+gray10be            6131685ecaf830d08d2e0dee7f9c9d41
+gray10le            6d398a3189f6b029a098393576af989c
 gray12be            d237d56e08482038ebc5f3943d6ec8d5
 gray12le            dcd15a0ed89bd019cc367b552fc9b1c0
 gray16be            9b57ff7d2090b47e4427bee79dba0d9e
diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip
index 184793000..b1c5f8946 100644
--- a/tests/ref/fate/filter-pixfmts-vflip
+++ b/tests/ref/fate/filter-pixfmts-vflip
@@ -25,6 +25,8 @@ gbrp12le            b7b27715bc9054a93ba81f110cf42ee5
 gbrp9be             2ae8f0d3b079d6550a2b1d4a7c4a6e4b
 gbrp9le             c62df0f386c957cc9cacb3c8014542eb
 gray                684ba667effbbf5983f46a9bea4afaae
+gray10be            394b31c05242c3a381f444a84bb327a1
+gray10le            21e14d72eb5b5d1adb2375e0a7417252
 gray12be            e33397832d19ec628f3e887e0a16ccc7
 gray12le            c8a8d7267e2595a0c4ce5d582bea23a1
 gray16be            112077b2f1c85cbd44907ed271901b28
-- 
2.19.1



More information about the libav-devel mailing list