From 960f70964521e1dc94647d70e2631351c0bb51bb Mon Sep 17 00:00:00 2001
From: sunyuechi <sunyue...@iscas.ac.cn>
Date: Mon, 18 Dec 2023 22:39:13 +0800
Subject: [PATCH 1/6] checkasm/takdsp: add decorrelate_ls test

---
 tests/checkasm/Makefile   |  1 +
 tests/checkasm/checkasm.c |  3 ++
 tests/checkasm/checkasm.h |  1 +
 tests/checkasm/takdsp.c   | 68 +++++++++++++++++++++++++++++++++++++++
 tests/fate/checkasm.mak   |  1 +
 5 files changed, 74 insertions(+)
 create mode 100644 tests/checkasm/takdsp.c

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 6318d9296b..51a8cdf3a0 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 e3c19510fa..cb57eeeddf 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);
+}
diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak
index 65bace892b..34e1a0a048 100644
--- a/tests/fate/checkasm.mak
+++ b/tests/fate/checkasm.mak
@@ -37,6 +37,7 @@ FATE_CHECKASM = fate-checkasm-aacencdsp                                 \
                 fate-checkasm-sw_gbrp                                   \
                 fate-checkasm-sw_rgb                                    \
                 fate-checkasm-sw_scale                                  \
+                fate-checkasm-takdsp                                    \
                 fate-checkasm-utvideodsp                                \
                 fate-checkasm-v210dec                                   \
                 fate-checkasm-v210enc                                   \
-- 
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".

Reply via email to