diff mbox series

[FFmpeg-devel,v2,4/5] checkasm: add a test for 10-bit data

Message ID 20230320164925.299207-4-jdarnley@obe.tv
State New
Headers show
Series [FFmpeg-devel,v2,1/5] avfilter/bwdif: move filter_line init to a dedicated function | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed

Commit Message

James Darnley March 20, 2023, 4:49 p.m. UTC
Also deduplicate to share with the 8-bit test.
---
Should I squash this into the commit adding the checkasm test?

 tests/checkasm/vf_bwdif.c | 73 +++++++++++++++++++++++----------------
 1 file changed, 44 insertions(+), 29 deletions(-)

Comments

Thomas Mundt March 21, 2023, 4:32 p.m. UTC | #1
Am Mo., 20. März 2023 um 17:52 Uhr schrieb James Darnley <jdarnley@obe.tv>:

> Also deduplicate to share with the 8-bit test.
> ---
> Should I squash this into the commit adding the checkasm test?
>

Yes, that might be clearer.
Please also add the fate reference files to the fate filter test.
Otherwise the patch set LGTM now.

Thanks,
Thomas
James Darnley March 23, 2023, 4:54 p.m. UTC | #2
On 3/21/23 17:32, Thomas Mundt wrote:
> Am Mo., 20. März 2023 um 17:52 Uhr schrieb James Darnley <jdarnley@obe.tv>:
> 
>> Also deduplicate to share with the 8-bit test.
>> ---
>> Should I squash this into the commit adding the checkasm test?
>>
> 
> Yes, that might be clearer.

Will do.

> Please also add the fate reference files to the fate filter test.
> Otherwise the patch set LGTM now.

Thanks I completely forgot.  You run it with GEN=1 then forget about it 
when it keeps working.
diff mbox series

Patch

diff --git a/tests/checkasm/vf_bwdif.c b/tests/checkasm/vf_bwdif.c
index 5c2e16cffc..46224bb575 100644
--- a/tests/checkasm/vf_bwdif.c
+++ b/tests/checkasm/vf_bwdif.c
@@ -27,6 +27,44 @@ 
     for (size_t i = 0; i < count; i++) \
         buf0[i] = buf1[i] = rnd() & mask
 
+#define BODY(type, depth)                                                      \
+    do {                                                                       \
+        type prev0[9*WIDTH], prev1[9*WIDTH];                                   \
+        type next0[9*WIDTH], next1[9*WIDTH];                                   \
+        type cur0[9*WIDTH], cur1[9*WIDTH];                                     \
+        type dst0[WIDTH], dst1[WIDTH];                                         \
+        const int stride = WIDTH;                                              \
+        const int mask = (1<<depth)-1;                                         \
+                                                                               \
+        declare_func(void, void *dst, void *prev, void *cur, void *next,       \
+                        int w, int prefs, int mrefs, int prefs2, int mrefs2,   \
+                        int prefs3, int mrefs3, int prefs4, int mrefs4,        \
+                        int parity, int clip_max);                             \
+                                                                               \
+        randomize_buffers(prev0, prev1, mask, 9*WIDTH);                        \
+        randomize_buffers(next0, next1, mask, 9*WIDTH);                        \
+        randomize_buffers( cur0,  cur1, mask, 9*WIDTH);                        \
+                                                                               \
+        call_ref(dst0, prev0 + 4*WIDTH, cur0 + 4*WIDTH, next0 + 4*WIDTH,       \
+                WIDTH, stride, -stride, 2*stride, -2*stride,                   \
+                3*stride, -3*stride, 4*stride, -4*stride,                      \
+                0, mask);                                                      \
+        call_new(dst1, prev1 + 4*WIDTH, cur1 + 4*WIDTH, next1 + 4*WIDTH,       \
+                WIDTH, stride, -stride, 2*stride, -2*stride,                   \
+                3*stride, -3*stride, 4*stride, -4*stride,                      \
+                0, mask);                                                      \
+                                                                               \
+        if (memcmp(dst0, dst1, sizeof dst0)                                    \
+                || memcmp(prev0, prev1, sizeof prev0)                          \
+                || memcmp(next0, next1, sizeof next0)                          \
+                || memcmp( cur0,  cur1, sizeof cur0))                          \
+            fail();                                                            \
+        bench_new(dst1, prev1 + 4*WIDTH, cur1 + 4*WIDTH, next1 + 4*WIDTH,      \
+                WIDTH, stride, -stride, 2*stride, -2*stride,                   \
+                3*stride, -3*stride, 4*stride, -4*stride,                      \
+                0, mask);                                                      \
+    } while (0)
+
 void checkasm_check_vf_bwdif(void)
 {
     BWDIFContext ctx_8, ctx_10;
@@ -35,35 +73,12 @@  void checkasm_check_vf_bwdif(void)
     ff_bwdif_init_filter_line(&ctx_10, 10);
 
     if (check_func(ctx_8.filter_line, "bwdif8")) {
-        uint8_t prev0[9*WIDTH], prev1[9*WIDTH];
-        uint8_t next0[9*WIDTH], next1[9*WIDTH];
-        uint8_t cur0[9*WIDTH], cur1[9*WIDTH];
-        uint8_t dst0[WIDTH], dst1[WIDTH];
-
-        declare_func(void, void *dst, void *prev, void *cur, void *next,
-                        int w, int prefs, int mrefs, int prefs2, int mrefs2,
-                        int prefs3, int mrefs3, int prefs4, int mrefs4,
-                        int parity, int clip_max);
-
-        randomize_buffers(prev0, prev1, 0xff, 9*WIDTH);
-        randomize_buffers(next0, next1, 0xff, 9*WIDTH);
-        randomize_buffers(cur0, cur1, 0xff, 9*WIDTH);
-
-        call_ref(dst0, prev0 + 4*WIDTH, cur0 + 4*WIDTH, next0 + 4*WIDTH, WIDTH,
-                WIDTH, -WIDTH, 2*WIDTH, -2*WIDTH, 3*WIDTH, -3*WIDTH, 4*WIDTH, -4*WIDTH,
-                0, 0xff);
-        call_new(dst1, prev1 + 4*WIDTH, cur1 + 4*WIDTH, next1 + 4*WIDTH, WIDTH,
-                WIDTH, -WIDTH, 2*WIDTH, -2*WIDTH, 3*WIDTH, -3*WIDTH, 4*WIDTH, -4*WIDTH,
-                0, 0xff);
+        BODY(uint8_t, 8);
+        report("bwdif8");
+    }
 
-        if (memcmp(dst0, dst1, WIDTH)
-                || memcmp(prev0, prev1, sizeof prev0)
-                || memcmp(next0, next1, sizeof next0)
-                || memcmp(cur0, cur1, sizeof cur0))
-            fail();
-        bench_new(dst1, prev1 + 4*WIDTH, cur1 + 4*WIDTH, next1 + 4*WIDTH, WIDTH,
-                WIDTH, -WIDTH, 2*WIDTH, -2*WIDTH, 3*WIDTH, -3*WIDTH, 4*WIDTH, -4*WIDTH,
-                0, 0xff);
+    if (check_func(ctx_10.filter_line, "bwdif10")) {
+        BODY(uint16_t, 10);
+        report("bwdif10");
     }
-    report("bwdif8");
 }