[FFmpeg-cvslog] checkasm: hevc_pel: Use checkasm_check for printing failing output

Martin Storsjö git at videolan.org
Thu Mar 14 14:52:49 EET 2024


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Mar 12 15:12:29 2024 +0200| [8ff4a4a4f4f73c5e276fa0cbe6cd5a148ebdd4ae] | committer: J. Dekker

checkasm: hevc_pel: Use checkasm_check for printing failing output

This simplifies the code for checking the output, and can print
the failing output (including a map of matching/mismatching
elements) if checkasm is run with the -v/--verbose option.

Signed-off-by: J. Dekker <jdek at itanimul.li>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8ff4a4a4f4f73c5e276fa0cbe6cd5a148ebdd4ae
---

 tests/checkasm/hevc_pel.c | 71 +++++++++++++++++++++++++++--------------------
 1 file changed, 41 insertions(+), 30 deletions(-)

diff --git a/tests/checkasm/hevc_pel.c b/tests/checkasm/hevc_pel.c
index 73a4619978..ed22ec4f9d 100644
--- a/tests/checkasm/hevc_pel.c
+++ b/tests/checkasm/hevc_pel.c
@@ -36,6 +36,15 @@ static const int offsets[] = {0, 255, -1 };
 #define SIZEOF_PIXEL ((bit_depth + 7) / 8)
 #define BUF_SIZE (2 * MAX_PB_SIZE * (2 * 4 + MAX_PB_SIZE))
 
+#define checkasm_check_pixel(buf1, stride1, buf2, stride2, ...) \
+    ((bit_depth > 8) ?                                          \
+     checkasm_check(uint16_t, (const uint16_t*)buf1, stride1,   \
+                              (const uint16_t*)buf2, stride2,   \
+                              __VA_ARGS__) :                    \
+     checkasm_check(uint8_t,  (const uint8_t*) buf1, stride1,   \
+                              (const uint8_t*) buf2, stride2,   \
+                              __VA_ARGS__))
+
 #define randomize_buffers()                          \
     do {                                             \
         uint32_t mask = pixel_mask[bit_depth - 8];   \
@@ -78,7 +87,7 @@ static void checkasm_check_hevc_qpel(void)
     LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
 
     HEVCDSPContext h;
-    int size, bit_depth, i, j, row;
+    int size, bit_depth, i, j;
     declare_func(void, int16_t *dst, uint8_t *src, ptrdiff_t srcstride,
                  int height, intptr_t mx, intptr_t my, int width);
 
@@ -102,12 +111,9 @@ static void checkasm_check_hevc_qpel(void)
                         randomize_buffers();
                         call_ref(dstw0, src0, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
                         call_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
-                        for (row = 0; row < size[sizes]; row++) {
-                            if (memcmp(dstw0 + row * MAX_PB_SIZE,
-                                       dstw1 + row * MAX_PB_SIZE,
-                                       sizes[size] * sizeof(int16_t)))
-                                fail();
-                        }
+                        checkasm_check(int16_t, dstw0, MAX_PB_SIZE * sizeof(int16_t),
+                                                dstw1, MAX_PB_SIZE * sizeof(int16_t),
+                                                size[sizes], size[sizes], "dst");
                         bench_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
                     }
                 }
@@ -152,8 +158,9 @@ static void checkasm_check_hevc_qpel_uni(void)
                         call_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                  src1, sizes[size] * SIZEOF_PIXEL,
                                  sizes[size], i, j, sizes[size]);
-                        if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))
-                            fail();
+                        checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
+                                             dst1, sizes[size] * SIZEOF_PIXEL,
+                                             size[sizes], size[sizes], "dst");
                         bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                   src1, sizes[size] * SIZEOF_PIXEL,
                                   sizes[size], i, j, sizes[size]);
@@ -204,8 +211,9 @@ static void checkasm_check_hevc_qpel_uni_w(void)
                                     call_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                              src1, sizes[size] * SIZEOF_PIXEL,
                                              sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
-                                    if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))
-                                        fail();
+                                    checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
+                                                         dst1, sizes[size] * SIZEOF_PIXEL,
+                                                         size[sizes], size[sizes], "dst");
                                     bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                               src1, sizes[size] * SIZEOF_PIXEL,
                                               sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
@@ -258,8 +266,9 @@ static void checkasm_check_hevc_qpel_bi(void)
                         call_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                  src1, sizes[size] * SIZEOF_PIXEL,
                                  ref1, sizes[size], i, j, sizes[size]);
-                        if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))
-                            fail();
+                        checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
+                                             dst1, sizes[size] * SIZEOF_PIXEL,
+                                             size[sizes], size[sizes], "dst");
                         bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                   src1, sizes[size] * SIZEOF_PIXEL,
                                   ref1, sizes[size], i, j, sizes[size]);
@@ -314,8 +323,9 @@ static void checkasm_check_hevc_qpel_bi_w(void)
                                     call_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                              src1, sizes[size] * SIZEOF_PIXEL,
                                              ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
-                                    if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))
-                                        fail();
+                                    checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
+                                                         dst1, sizes[size] * SIZEOF_PIXEL,
+                                                         size[sizes], size[sizes], "dst");
                                     bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                               src1, sizes[size] * SIZEOF_PIXEL,
                                               ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
@@ -341,7 +351,7 @@ static void checkasm_check_hevc_epel(void)
     LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
 
     HEVCDSPContext h;
-    int size, bit_depth, i, j, row;
+    int size, bit_depth, i, j;
     declare_func(void, int16_t *dst, uint8_t *src, ptrdiff_t srcstride,
                  int height, intptr_t mx, intptr_t my, int width);
 
@@ -365,12 +375,9 @@ static void checkasm_check_hevc_epel(void)
                         randomize_buffers();
                         call_ref(dstw0, src0, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
                         call_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
-                        for (row = 0; row < size[sizes]; row++) {
-                            if (memcmp(dstw0 + row * MAX_PB_SIZE,
-                                       dstw1 + row * MAX_PB_SIZE,
-                                       sizes[size] * sizeof(int16_t)))
-                                fail();
-                        }
+                        checkasm_check(int16_t, dstw0, MAX_PB_SIZE * sizeof(int16_t),
+                                                dstw1, MAX_PB_SIZE * sizeof(int16_t),
+                                                size[sizes], size[sizes], "dst");
                         bench_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
                     }
                 }
@@ -415,8 +422,9 @@ static void checkasm_check_hevc_epel_uni(void)
                         call_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                  src1, sizes[size] * SIZEOF_PIXEL,
                                  sizes[size], i, j, sizes[size]);
-                        if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))
-                            fail();
+                        checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
+                                             dst1, sizes[size] * SIZEOF_PIXEL,
+                                             size[sizes], size[sizes], "dst");
                         bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                   src1, sizes[size] * SIZEOF_PIXEL,
                                   sizes[size], i, j, sizes[size]);
@@ -467,8 +475,9 @@ static void checkasm_check_hevc_epel_uni_w(void)
                                     call_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                              src1, sizes[size] * SIZEOF_PIXEL,
                                              sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
-                                    if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))
-                                        fail();
+                                    checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
+                                                         dst1, sizes[size] * SIZEOF_PIXEL,
+                                                         size[sizes], size[sizes], "dst");
                                     bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                               src1, sizes[size] * SIZEOF_PIXEL,
                                               sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
@@ -521,8 +530,9 @@ static void checkasm_check_hevc_epel_bi(void)
                         call_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                  src1, sizes[size] * SIZEOF_PIXEL,
                                  ref1, sizes[size], i, j, sizes[size]);
-                        if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))
-                            fail();
+                        checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
+                                             dst1, sizes[size] * SIZEOF_PIXEL,
+                                             size[sizes], size[sizes], "dst");
                         bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                   src1, sizes[size] * SIZEOF_PIXEL,
                                   ref1, sizes[size], i, j, sizes[size]);
@@ -577,8 +587,9 @@ static void checkasm_check_hevc_epel_bi_w(void)
                                     call_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                              src1, sizes[size] * SIZEOF_PIXEL,
                                              ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
-                                    if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))
-                                        fail();
+                                    checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
+                                                         dst1, sizes[size] * SIZEOF_PIXEL,
+                                                         size[sizes], size[sizes], "dst");
                                     bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
                                               src1, sizes[size] * SIZEOF_PIXEL,
                                               ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);



More information about the ffmpeg-cvslog mailing list