diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 2673e1d098..3e40aba2c3 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -34,6 +34,7 @@ AVCODECOBJS-$(CONFIG_OPUS_DECODER) += opusdsp.o AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_add_res.o hevc_deblock.o hevc_idct.o hevc_sao.o hevc_pel.o AVCODECOBJS-$(CONFIG_RV34DSP) += rv34dsp.o +AVCODECOBJS-$(CONFIG_RV40_DECODER) += rv40dsp.o AVCODECOBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o AVCODECOBJS-$(CONFIG_TAK_DECODER) += takdsp.o AVCODECOBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodsp.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 8be6cb0f55..9be32fc16e 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -167,6 +167,9 @@ static const struct { #if CONFIG_RV34DSP { "rv34dsp", checkasm_check_rv34dsp }, #endif + #if CONFIG_RV40_DECODER + { "rv40dsp", checkasm_check_rv40dsp }, + #endif #if CONFIG_SVQ1_ENCODER { "svq1enc", checkasm_check_svq1enc }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index f90920dee7..173360af60 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -112,6 +112,7 @@ void checkasm_check_opusdsp(void); void checkasm_check_pixblockdsp(void); void checkasm_check_sbrdsp(void); void checkasm_check_rv34dsp(void); +void checkasm_check_rv40dsp(void); void checkasm_check_svq1enc(void); void checkasm_check_synth_filter(void); void checkasm_check_sw_gbrp(void); diff --git a/tests/checkasm/rv40dsp.c b/tests/checkasm/rv40dsp.c new file mode 100644 index 0000000000..a1a873d430 --- /dev/null +++ b/tests/checkasm/rv40dsp.c @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS). + * + * 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 +#include "checkasm.h" +#include "libavcodec/rv40dsp.c" +#include "libavutil/mem_internal.h" + +#define randomize_buffers() \ + do { \ + for (int i = 0; i < 16*18*2; i++) \ + src[i] = rnd() & 0x3; \ + } while (0) + +static void check_chroma_mc(void) +{ + RV34DSPContext h; + LOCAL_ALIGNED_32(uint8_t, src, [16 * 18 * 2]); + LOCAL_ALIGNED_32(uint8_t, dst0, [16 * 18 * 2]); + LOCAL_ALIGNED_32(uint8_t, dst1, [16 * 18 * 2]); + + declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, const uint8_t *src, + ptrdiff_t stride, int h, int x, int y); + + ff_rv40dsp_init(&h); + randomize_buffers(); + for (int size = 0; size < 2; size++) { + +#define CHECK_CHROMA_MC(name) \ + do { \ + if (check_func(h.name## _pixels_tab[size], #name "_mc%d", 1 << (3 - size))) { \ + for (int x = 0; x < 2; x++) { \ + for (int y = 0; y < 2; y++) { \ + memcpy(dst0, src, 16 * 18); \ + memcpy(dst1, src, 16 * 18); \ + call_ref(dst0, src, 16, 16, x, y); \ + call_new(dst1, src, 16, 16, x, y); \ + if (memcmp(dst0, dst1, 16 * 16)) { \ + fprintf(stderr, #name ": x:%i, y:%i\n", x, y); \ + fail(); \ + } \ + bench_new(dst1, src, 16, 16, x, y); \ + } \ + } \ + } \ + } while (0) + + CHECK_CHROMA_MC(put_chroma); + CHECK_CHROMA_MC(avg_chroma); + } +} + +void checkasm_check_rv40dsp(void) +{ + check_chroma_mc(); + report("chroma_mc"); +} diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak index 3b5b867a97..4a8e312da9 100644 --- a/tests/fate/checkasm.mak +++ b/tests/fate/checkasm.mak @@ -34,6 +34,7 @@ FATE_CHECKASM = fate-checkasm-aacencdsp \ fate-checkasm-pixblockdsp \ fate-checkasm-sbrdsp \ fate-checkasm-rv34dsp \ + fate-checkasm-rv40dsp \ fate-checkasm-svq1enc \ fate-checkasm-synth_filter \ fate-checkasm-sw_gbrp \