diff mbox series

[FFmpeg-devel,v2,05/15] tests/checkasm: Add test for vf_bwdif filter_intra

Message ID 20230702123242.232484-6-jc@kynesim.co.uk
State New
Headers show
Series avfilter/vf_bwdif: Add aarch64 neon functions | expand

Checks

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

Commit Message

John Cox July 2, 2023, 12:32 p.m. UTC
Signed-off-by: John Cox <jc@kynesim.co.uk>
---
 tests/checkasm/vf_bwdif.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

Comments

Martin Storsjö July 2, 2023, 9:14 p.m. UTC | #1
On Sun, 2 Jul 2023, John Cox wrote:

> Signed-off-by: John Cox <jc@kynesim.co.uk>
> ---
> tests/checkasm/vf_bwdif.c | 37 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
>
> diff --git a/tests/checkasm/vf_bwdif.c b/tests/checkasm/vf_bwdif.c
> index 46224bb575..034bbabb4c 100644
> --- a/tests/checkasm/vf_bwdif.c
> +++ b/tests/checkasm/vf_bwdif.c
> @@ -20,6 +20,7 @@
> #include "checkasm.h"
> #include "libavcodec/internal.h"
> #include "libavfilter/bwdif.h"
> +#include "libavutil/mem_internal.h"
>
> #define WIDTH 256
>
> @@ -81,4 +82,40 @@ void checkasm_check_vf_bwdif(void)
>         BODY(uint16_t, 10);
>         report("bwdif10");
>     }
> +
> +    if (check_func(ctx_8.filter_intra, "bwdif8.intra")) {
> +        LOCAL_ALIGNED_16(uint8_t, cur0,  [11*WIDTH]);
> +        LOCAL_ALIGNED_16(uint8_t, cur1,  [11*WIDTH]);
> +        LOCAL_ALIGNED_16(uint8_t, dst0,  [WIDTH*3]);
> +        LOCAL_ALIGNED_16(uint8_t, dst1,  [WIDTH*3]);
> +        const int stride = WIDTH;
> +        const int mask = (1<<8)-1;
> +
> +        declare_func(void, void *dst1, void *cur1, int w, int prefs, int mrefs,
> +                     int prefs3, int mrefs3, int parity, int clip_max);
> +
> +        randomize_buffers( cur0,  cur1, mask, 11*WIDTH);
> +        memset(dst0, 0xba, WIDTH * 3);
> +        memset(dst1, 0xba, WIDTH * 3);
> +
> +        call_ref(dst0 + stride,
> +                 cur0 + stride * 4, WIDTH,
> +                 stride, -stride, stride * 3, -stride * 3,
> +                 0, mask);
> +        call_new(dst1 + stride,
> +                 cur0 + stride * 4, WIDTH,
> +                 stride, -stride, stride * 3, -stride * 3,
> +                 0, mask);
> +
> +        if (memcmp(dst0, dst1, WIDTH*3)
> +                || memcmp( cur0,  cur1, WIDTH*11))
> +            fail();
> +
> +        bench_new(dst1 + stride,
> +                  cur0 + stride * 4, WIDTH,
> +                  stride, -stride, stride * 3, -stride * 3,
> +                  0, mask);
> +
> +        report("bwdif8.intra");
> +    }

It's a bit of a shame that this only tests things for 8 bit, not 10, but I 
guess that's better than nothing. The way the current code is set up to 
template both variants of the tests isn't very neat either...

// Martin
John Cox July 4, 2023, 10:18 a.m. UTC | #2
On Mon, 3 Jul 2023 00:14:16 +0300 (EEST), you wrote:

>[snip]
>It's a bit of a shame that this only tests things for 8 bit, not 10, but I 
>guess that's better than nothing. The way the current code is set up to 
>template both variants of the tests isn't very neat either...

Is there actually >8-bit interlaced content out in the wild? I've never
seen a single clip. If so where does it come from?

Just curious

JC

>// Martin
Kieran Kunhya July 4, 2023, 10:25 a.m. UTC | #3
On Tue, 4 Jul 2023, 11:18 John Cox, <jc@kynesim.co.uk> wrote:

> On Mon, 3 Jul 2023 00:14:16 +0300 (EEST), you wrote:
>
> >[snip]
> >It's a bit of a shame that this only tests things for 8 bit, not 10, but
> I
> >guess that's better than nothing. The way the current code is set up to
> >template both variants of the tests isn't very neat either...
>
> Is there actually >8-bit interlaced content out in the wild? I've never
> seen a single clip. If so where does it come from?
>
> Just curious
>
> JC
>
> >// Martin
>

Yes, just not in the consumer domain. In capture/production there is 10-bit
content.

Kieran
diff mbox series

Patch

diff --git a/tests/checkasm/vf_bwdif.c b/tests/checkasm/vf_bwdif.c
index 46224bb575..034bbabb4c 100644
--- a/tests/checkasm/vf_bwdif.c
+++ b/tests/checkasm/vf_bwdif.c
@@ -20,6 +20,7 @@ 
 #include "checkasm.h"
 #include "libavcodec/internal.h"
 #include "libavfilter/bwdif.h"
+#include "libavutil/mem_internal.h"
 
 #define WIDTH 256
 
@@ -81,4 +82,40 @@  void checkasm_check_vf_bwdif(void)
         BODY(uint16_t, 10);
         report("bwdif10");
     }
+
+    if (check_func(ctx_8.filter_intra, "bwdif8.intra")) {
+        LOCAL_ALIGNED_16(uint8_t, cur0,  [11*WIDTH]);
+        LOCAL_ALIGNED_16(uint8_t, cur1,  [11*WIDTH]);
+        LOCAL_ALIGNED_16(uint8_t, dst0,  [WIDTH*3]);
+        LOCAL_ALIGNED_16(uint8_t, dst1,  [WIDTH*3]);
+        const int stride = WIDTH;
+        const int mask = (1<<8)-1;
+
+        declare_func(void, void *dst1, void *cur1, int w, int prefs, int mrefs,
+                     int prefs3, int mrefs3, int parity, int clip_max);
+
+        randomize_buffers( cur0,  cur1, mask, 11*WIDTH);
+        memset(dst0, 0xba, WIDTH * 3);
+        memset(dst1, 0xba, WIDTH * 3);
+
+        call_ref(dst0 + stride,
+                 cur0 + stride * 4, WIDTH,
+                 stride, -stride, stride * 3, -stride * 3,
+                 0, mask);
+        call_new(dst1 + stride,
+                 cur0 + stride * 4, WIDTH,
+                 stride, -stride, stride * 3, -stride * 3,
+                 0, mask);
+
+        if (memcmp(dst0, dst1, WIDTH*3)
+                || memcmp( cur0,  cur1, WIDTH*11))
+            fail();
+
+        bench_new(dst1 + stride,
+                  cur0 + stride * 4, WIDTH,
+                  stride, -stride, stride * 3, -stride * 3,
+                  0, mask);
+
+        report("bwdif8.intra");
+    }
 }