From 2f17a594805615a93f3f475246d61d61cc0aa43b Mon Sep 17 00:00:00 2001 From: sunyuechi <sunyue...@iscas.ac.cn> Date: Wed, 20 Dec 2023 16:21:38 +0800 Subject: [PATCH 2/3] checkasm/dnxhdenc: add get_pixels_8x4_sym test
--- tests/checkasm/Makefile | 1 + tests/checkasm/checkasm.c | 3 ++ tests/checkasm/checkasm.h | 1 + tests/checkasm/dnxhdenc.c | 73 +++++++++++++++++++++++++++++++++++++++ tests/fate/checkasm.mak | 1 + 5 files changed, 79 insertions(+) create mode 100644 tests/checkasm/dnxhdenc.c diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index e6d732d8de..47328b59b9 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -26,6 +26,7 @@ AVCODECOBJS-$(CONFIG_AAC_DECODER) += aacpsdsp.o \ AVCODECOBJS-$(CONFIG_AAC_ENCODER) += aacencdsp.o AVCODECOBJS-$(CONFIG_ALAC_DECODER) += alacdsp.o AVCODECOBJS-$(CONFIG_DCA_DECODER) += synth_filter.o +AVCODECOBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o AVCODECOBJS-$(CONFIG_EXR_DECODER) += exrdsp.o AVCODECOBJS-$(CONFIG_FLAC_DECODER) += flacdsp.o AVCODECOBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuvdsp.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 51a8cdf3a0..e4606a15ca 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -98,6 +98,9 @@ static const struct { #if CONFIG_DCA_DECODER { "synth_filter", checkasm_check_synth_filter }, #endif + #if CONFIG_DNXHD_ENCODER + { "dnxhdenc", checkasm_check_dnxhdenc }, + #endif #if CONFIG_EXR_DECODER { "exrdsp", checkasm_check_exrdsp }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index cb57eeeddf..6dd001aeee 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -54,6 +54,7 @@ void checkasm_check_blend(void); void checkasm_check_blockdsp(void); void checkasm_check_bswapdsp(void); void checkasm_check_colorspace(void); +void checkasm_check_dnxhdenc(void); void checkasm_check_exrdsp(void); void checkasm_check_fixed_dsp(void); void checkasm_check_flacdsp(void); diff --git a/tests/checkasm/dnxhdenc.c b/tests/checkasm/dnxhdenc.c new file mode 100644 index 0000000000..c88ae3113d --- /dev/null +++ b/tests/checkasm/dnxhdenc.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2023 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 "libavutil/mem.h" +#include "libavutil/mem_internal.h" + +#include "libavcodec/dnxhdenc.h" +#include "libavcodec/dnxhdenc.c" + +#include "checkasm.h" + +#define randomize(buf, len) \ + do { \ + for (int i = 0; i < len; i++) \ + buf[i] = rnd(); \ + } while (0) + +static void test_get_pixels_8x4_sym(void) { +#define BUF_SIZE 64*2 + declare_func(void, int16_t *block, const uint8_t *pixels, ptrdiff_t line_size); + + const CIDEntry cid_array[] = { + {.bit_depth = 8}, + }; + DNXHDEncContext s = {.cid_table = cid_array}; + + s.get_pixels_8x4_sym = dnxhd_8bit_get_pixels_8x4_sym; + + ff_dnxhdenc_init(&s); + + if (check_func(s.get_pixels_8x4_sym, "get_pixels_8x4_sym")) { + LOCAL_ALIGNED_32(int16_t, block1, [BUF_SIZE]); + LOCAL_ALIGNED_32(int16_t, block2, [BUF_SIZE]); + LOCAL_ALIGNED_32(uint8_t, pixels, [BUF_SIZE]); + + randomize(pixels, BUF_SIZE); + + call_ref(block1, pixels, BUF_SIZE); + call_new(block2, pixels, BUF_SIZE); + + if (memcmp(block1, block2, BUF_SIZE) != 0) { + fail(); + } + + bench_new(block1, pixels, BUF_SIZE); + } + + report("get_pixels_8x4_sym"); +} + +void checkasm_check_dnxhdenc(void) +{ + test_get_pixels_8x4_sym(); +} diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak index 34e1a0a048..9e04b1b3cb 100644 --- a/tests/fate/checkasm.mak +++ b/tests/fate/checkasm.mak @@ -7,6 +7,7 @@ FATE_CHECKASM = fate-checkasm-aacencdsp \ fate-checkasm-av_tx \ fate-checkasm-blockdsp \ fate-checkasm-bswapdsp \ + fate-checkasm-dnxhdenc \ fate-checkasm-exrdsp \ fate-checkasm-fixed_dsp \ fate-checkasm-flacdsp \ -- 2.43.0
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".