From 087faf8cac51e5e20a5f41b36b8d4c2705a10039 Mon Sep 17 00:00:00 2001 From: James Darnley Date: Mon, 20 Feb 2023 20:55:08 +0100 Subject: [PATCH] checkasm: add test for bwdif --- tests/checkasm/Makefile | 1 + tests/checkasm/checkasm.c | 3 ++ tests/checkasm/checkasm.h | 1 + tests/checkasm/vf_bwdif.c | 84 +++++++++++++++++++++++++++++++++++++++ tests/fate/checkasm.mak | 1 + 5 files changed, 90 insertions(+) create mode 100644 tests/checkasm/vf_bwdif.c diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index a6f06c7007..b6a43f181f 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -40,6 +40,7 @@ CHECKASMOBJS-$(CONFIG_AVCODEC) += $(AVCODECOBJS-yes) # libavfilter tests AVFILTEROBJS-$(CONFIG_AFIR_FILTER) += af_afir.o AVFILTEROBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o +AVFILTEROBJS-$(CONFIG_BWDIF_FILTER) += vf_bwdif.o AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o AVFILTEROBJS-$(CONFIG_EQ_FILTER) += vf_eq.o AVFILTEROBJS-$(CONFIG_GBLUR_FILTER) += vf_gblur.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index e96d84a7da..5e729cf0e0 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -179,6 +179,9 @@ static const struct { #if CONFIG_BLEND_FILTER { "vf_blend", checkasm_check_blend }, #endif + #if CONFIG_BWDIF_FILTER + { "vf_bwdif", checkasm_check_vf_bwdif }, + #endif #if CONFIG_COLORSPACE_FILTER { "vf_colorspace", checkasm_check_colorspace }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 8744a81218..e9e73c6fa0 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -82,6 +82,7 @@ void checkasm_check_utvideodsp(void); void checkasm_check_v210dec(void); void checkasm_check_v210enc(void); void checkasm_check_vc1dsp(void); +void checkasm_check_vf_bwdif(void); void checkasm_check_vf_eq(void); void checkasm_check_vf_gblur(void); void checkasm_check_vf_hflip(void); diff --git a/tests/checkasm/vf_bwdif.c b/tests/checkasm/vf_bwdif.c new file mode 100644 index 0000000000..46224bb575 --- /dev/null +++ b/tests/checkasm/vf_bwdif.c @@ -0,0 +1,84 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include "checkasm.h" +#include "libavcodec/internal.h" +#include "libavfilter/bwdif.h" + +#define WIDTH 256 + +#define randomize_buffers(buf0, buf1, mask, count) \ + 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<