[FFmpeg-cvslog] checkasm/blockdsp: add fill_block test

sunyuechi git at videolan.org
Fri May 3 17:57:17 EEST 2024


ffmpeg | branch: master | sunyuechi <sunyuechi at iscas.ac.cn> | Mon Apr 29 14:18:23 2024 +0800| [b369c4d569a1612e3a2a4f2ef2b3a112d741a7b0] | committer: Rémi Denis-Courmont

checkasm/blockdsp: add fill_block test

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 tests/checkasm/blockdsp.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/tests/checkasm/blockdsp.c b/tests/checkasm/blockdsp.c
index 22a2f79455..19d69b8687 100644
--- a/tests/checkasm/blockdsp.c
+++ b/tests/checkasm/blockdsp.c
@@ -29,6 +29,11 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mem_internal.h"
 
+typedef struct {
+    const char *name;
+    int size;
+} test;
+
 #define randomize_buffers(size)             \
     do {                                    \
         int i;                              \
@@ -52,6 +57,30 @@ do {                                                                \
     }                                                               \
 } while (0)
 
+static void check_fill(BlockDSPContext *h){
+    const test tests[] = {
+        {"fill_block_tab[0]", 16},
+        {"fill_block_tab[1]", 8},
+    };
+    LOCAL_ALIGNED_32(uint8_t, buf0, [16 * 16]);
+    LOCAL_ALIGNED_32(uint8_t, buf1, [16 * 16]);
+
+    for (size_t t = 0; t < FF_ARRAY_ELEMS(tests); ++t) {
+        int n = tests[t].size;
+        declare_func(void, uint8_t *block, uint8_t value,
+                     ptrdiff_t line_size, int h);
+        if (check_func(h->fill_block_tab[t], "blockdsp.%s", tests[t].name)) {
+            uint8_t value = rnd();
+            randomize_buffers(tests[t].size);
+            call_ref(buf0, value, n, n);
+            call_new(buf1, value, n, n);
+            if (memcmp(buf0, buf1, sizeof(*buf0) * n * n))
+                fail();
+            bench_new(buf0, value, n, n);
+        }
+    }
+}
+
 void checkasm_check_blockdsp(void)
 {
     LOCAL_ALIGNED_32(uint16_t, buf0, [6 * 8 * 8]);
@@ -64,5 +93,7 @@ void checkasm_check_blockdsp(void)
     check_clear(clear_block,  8 * 8);
     check_clear(clear_blocks, 8 * 8 * 6);
 
+    check_fill(&h);
+
     report("blockdsp");
 }



More information about the ffmpeg-cvslog mailing list