summaryrefslogtreecommitdiff
path: root/tests/checkasm
diff options
context:
space:
mode:
authorsunyuechi <sunyuechi@iscas.ac.cn>2023-12-18 22:39:13 +0800
committerRémi Denis-Courmont <remi@remlab.net>2023-12-21 22:42:34 +0200
commit3bdb0fe511bfad24a8a8987ade083186b55d9c20 (patch)
tree8b9d467ca02d5ae7b7cf81fb7ec483a8d94ff718 /tests/checkasm
parentcdd38a2ffe9a6a092b5aee34cc5fe7fe20b72148 (diff)
checkasm/takdsp: add decorrelate_ls test
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
Diffstat (limited to 'tests/checkasm')
-rw-r--r--tests/checkasm/Makefile1
-rw-r--r--tests/checkasm/checkasm.c3
-rw-r--r--tests/checkasm/checkasm.h1
-rw-r--r--tests/checkasm/takdsp.c68
4 files changed, 73 insertions, 0 deletions
diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index a46c32926b..e6d732d8de 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -33,6 +33,7 @@ AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o
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_TAK_DECODER) += takdsp.o
AVCODECOBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodsp.o
AVCODECOBJS-$(CONFIG_V210_DECODER) += v210dec.o
AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index daa5438f88..09c961f0c7 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -159,6 +159,9 @@ static const struct {
#if CONFIG_PIXBLOCKDSP
{ "pixblockdsp", checkasm_check_pixblockdsp },
#endif
+ #if CONFIG_TAK_DECODER
+ { "takdsp", checkasm_check_takdsp },
+ #endif
#if CONFIG_UTVIDEO_DECODER
{ "utvideodsp", checkasm_check_utvideodsp },
#endif
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index f2b63ef8c8..11f0487731 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -85,6 +85,7 @@ void checkasm_check_synth_filter(void);
void checkasm_check_sw_gbrp(void);
void checkasm_check_sw_rgb(void);
void checkasm_check_sw_scale(void);
+void checkasm_check_takdsp(void);
void checkasm_check_utvideodsp(void);
void checkasm_check_v210dec(void);
void checkasm_check_v210enc(void);
diff --git a/tests/checkasm/takdsp.c b/tests/checkasm/takdsp.c
new file mode 100644
index 0000000000..4c7442f922
--- /dev/null
+++ b/tests/checkasm/takdsp.c
@@ -0,0 +1,68 @@
+/*
+ * 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/takdsp.h"
+
+#include "checkasm.h"
+
+#define randomize(buf, len) \
+ do { \
+ for (int i = 0; i < len; i++) \
+ buf[i] = rnd(); \
+ } while (0)
+
+static void test_decorrelate_ls(TAKDSPContext *s) {
+#define BUF_SIZE 1024
+ declare_func(void, int32_t *, int32_t *, int);
+
+ if (check_func(s->decorrelate_ls, "decorrelate_ls")) {
+ LOCAL_ALIGNED_32(int32_t, p1, [BUF_SIZE]);
+ LOCAL_ALIGNED_32(int32_t, p2, [BUF_SIZE]);
+ LOCAL_ALIGNED_32(int32_t, p2_2, [BUF_SIZE]);
+
+ randomize(p1, BUF_SIZE);
+ randomize(p2, BUF_SIZE);
+ memcpy(p2_2, p2, BUF_SIZE);
+
+ call_ref(p1, p2, BUF_SIZE);
+ call_new(p1, p2_2, BUF_SIZE);
+
+ if (memcmp(p2, p2_2, BUF_SIZE) != 0){
+ fail();
+ }
+
+ bench_new(p1, p2, BUF_SIZE);
+ }
+
+ report("decorrelate_ls");
+}
+
+void checkasm_check_takdsp(void)
+{
+ TAKDSPContext s = { 0 };
+ ff_takdsp_init(&s);
+
+ test_decorrelate_ls(&s);
+}