diff options
author | Niklas Haas <[email protected]> | 2025-09-15 18:10:43 +0200 |
---|---|---|
committer | Niklas Haas <[email protected]> | 2025-09-21 11:02:41 +0000 |
commit | 00e05bcd681a21637b1eed4cd13ff3797d9df97a (patch) | |
tree | 36677d95ebd20c67b47158f75250eb3232eeaac5 | |
parent | 326abf359f72c0daf74c332bc05c65d7b3a5da0b (diff) |
tests/checkasm: add vf_idet checkasm
-rw-r--r-- | tests/checkasm/Makefile | 1 | ||||
-rw-r--r-- | tests/checkasm/checkasm.c | 3 | ||||
-rw-r--r-- | tests/checkasm/checkasm.h | 1 | ||||
-rw-r--r-- | tests/checkasm/vf_idet.c | 65 |
4 files changed, 70 insertions, 0 deletions
diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 9f1dd57fa6..0a54adc96a 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -62,6 +62,7 @@ AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o AVFILTEROBJS-$(CONFIG_EQ_FILTER) += vf_eq.o AVFILTEROBJS-$(CONFIG_GBLUR_FILTER) += vf_gblur.o AVFILTEROBJS-$(CONFIG_HFLIP_FILTER) += vf_hflip.o +AVFILTEROBJS-$(CONFIG_IDET_FILTER) += vf_idet.o AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER) += vf_threshold.o AVFILTEROBJS-$(CONFIG_NLMEANS_FILTER) += vf_nlmeans.o AVFILTEROBJS-$(CONFIG_SOBEL_FILTER) += vf_convolution.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 5312d02909..ad4d9b53b6 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -290,6 +290,9 @@ static const struct { #if CONFIG_HFLIP_FILTER { "vf_hflip", checkasm_check_vf_hflip }, #endif + #if CONFIG_IDET_FILTER + { "vf_idet", checkasm_check_idet }, + #endif #if CONFIG_NLMEANS_FILTER { "vf_nlmeans", checkasm_check_nlmeans }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index bb6b413aba..1684c427d6 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -112,6 +112,7 @@ void checkasm_check_hevc_pel(void); void checkasm_check_hevc_sao(void); void checkasm_check_huffyuvdsp(void); void checkasm_check_idctdsp(void); +void checkasm_check_idet(void); void checkasm_check_jpeg2000dsp(void); void checkasm_check_llauddsp(void); void checkasm_check_lls(void); diff --git a/tests/checkasm/vf_idet.c b/tests/checkasm/vf_idet.c new file mode 100644 index 0000000000..4bc0f5c846 --- /dev/null +++ b/tests/checkasm/vf_idet.c @@ -0,0 +1,65 @@ +/* + * 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 "checkasm.h" + +#include "libavfilter/vf_idetdsp.h" +#include "libavutil/mem_internal.h" + +#define WIDTH 512 + +static void check_idet(int depth) +{ + IDETDSPContext dsp; + + LOCAL_ALIGNED_32(uint8_t, in0, [WIDTH]); + LOCAL_ALIGNED_32(uint8_t, in1, [WIDTH]); + LOCAL_ALIGNED_32(uint8_t, in2, [WIDTH]); + + declare_func(int, const uint8_t *a, const uint8_t *b, + const uint8_t *c, int w); + + ff_idet_dsp_init(&dsp, depth > 8); + + for (int x = 0; x < WIDTH; x++) { + in0[x] = rnd() & 0xFF; + in1[x] = rnd() & 0xFF; + in2[x] = rnd() & 0xFF; + } + + if (check_func(dsp.filter_line, "idet%d", depth)) { + /* Ensure odd tail is handled correctly */ + int res_ref = call_ref(in0, in1, in2, WIDTH - 8); + int res_new = call_new(in0, in1, in2, WIDTH - 8); + if (res_ref != res_new) { + fprintf(stderr, "idet%d: result mismatch: %u != %u\n", + depth, res_ref, res_new); + fail(); + } + bench_new(in0, in1, in2, WIDTH); + } +} + +void checkasm_check_idet(void) +{ + check_idet(8); + report("idet8"); + + check_idet(16); + report("idet16"); +} |