[FFmpeg-devel] [PATCH v1 9/9] FATE/pixfmt_best: add more test case

Fei Wang fei.w.wang at intel.com
Fri Jun 19 04:52:48 EEST 2020


The new test case can cover the issue mentioned in commit 97ba9c1a

Signed-off-by: Fei Wang <fei.w.wang at intel.com>
---
 libavutil/tests/pixfmt_best.c | 18 ++++++++++++++++++
 tests/ref/fate/pixfmt_best    |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/libavutil/tests/pixfmt_best.c b/libavutil/tests/pixfmt_best.c
index 01387c7c98..30a41b1fa6 100644
--- a/libavutil/tests/pixfmt_best.c
+++ b/libavutil/tests/pixfmt_best.c
@@ -66,6 +66,21 @@ int main(void)
             ++pass;                                             \
     } while (0)
 
+#define TEST_SPECIFIC(src, dst1, dst2, expected) do {           \
+        output = av_find_best_pix_fmt_of_2(dst1, dst2,          \
+                                           src, 0, NULL);       \
+        if (output != expected) {                               \
+            printf("Matching %s with %s and %s: got %s, expected %s\n", \
+                   av_get_pix_fmt_name(src),                    \
+                   av_get_pix_fmt_name(dst1),                   \
+                   av_get_pix_fmt_name(dst2),                   \
+                   av_get_pix_fmt_name(output),                 \
+                   av_get_pix_fmt_name(expected));              \
+            ++fail;                                             \
+        } else                                                  \
+            ++pass;                                             \
+    } while (0)
+
     // Same formats.
     for (i = 0; i < FF_ARRAY_ELEMS(pixfmt_list); i++)
         TEST(pixfmt_list[i], pixfmt_list[i]);
@@ -135,6 +150,9 @@ int main(void)
     // Opaque formats are least unlike each other.
     TEST(AV_PIX_FMT_DXVA2_VLD, AV_PIX_FMT_VAAPI);
 
+    // Specific test list
+    TEST_SPECIFIC(AV_PIX_FMT_YUV420P10LE, AV_PIX_FMT_P012LE, AV_PIX_FMT_P010LE, AV_PIX_FMT_P010LE);
+
     printf("%d tests passed, %d tests failed.\n", pass, fail);
     return !!fail;
 }
diff --git a/tests/ref/fate/pixfmt_best b/tests/ref/fate/pixfmt_best
index 5f51e2d845..1da1846275 100644
--- a/tests/ref/fate/pixfmt_best
+++ b/tests/ref/fate/pixfmt_best
@@ -1 +1 @@
-73 tests passed, 0 tests failed.
+74 tests passed, 0 tests failed.
-- 
2.17.1



More information about the ffmpeg-devel mailing list