Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Darnley <jdarnley@obe.tv>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH v2 4/5] checkasm: add a test for 10-bit data
Date: Mon, 20 Mar 2023 17:49:24 +0100
Message-ID: <20230320164925.299207-4-jdarnley@obe.tv> (raw)
In-Reply-To: <20230320164925.299207-1-jdarnley@obe.tv>

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(-)

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");
 }
-- 
2.39.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2023-03-20 16:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 16:49 [FFmpeg-devel] [PATCH v2 1/5] avfilter/bwdif: move filter_line init to a dedicated function James Darnley
2023-03-20 16:49 ` [FFmpeg-devel] [PATCH v2 2/5] checkasm: add test for bwdif James Darnley
2023-03-20 16:49 ` [FFmpeg-devel] [PATCH v2 3/5] tests: add bwdif to fate filter tests James Darnley
2023-03-20 16:49 ` James Darnley [this message]
2023-03-21 16:32   ` [FFmpeg-devel] [PATCH v2 4/5] checkasm: add a test for 10-bit data Thomas Mundt
2023-03-23 16:54     ` James Darnley
2023-03-20 16:49 ` [FFmpeg-devel] [PATCH v2 5/5] avfilter/bwdif: add avx2 filter_line function James Darnley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230320164925.299207-4-jdarnley@obe.tv \
    --to=jdarnley@obe.tv \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git