checkasm/rv40dsp: add chroma_mc test

This is similar to h264.

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
sunyuechi 2024-04-30 12:43:57 +08:00 committed by Paul B Mahol
parent d9910caa91
commit 1b502bf795
5 changed files with 81 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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);

75
tests/checkasm/rv40dsp.c Normal file
View File

@ -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 <string.h>
#include <stdint.h>
#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");
}

View File

@ -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 \