Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/2] checkasm/rv40dsp: add chroma_mc test
@ 2024-04-30 15:00 flow gg
  0 siblings, 0 replies; only message in thread
From: flow gg @ 2024-04-30 15:00 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0001-checkasm-rv40dsp-add-chroma_mc-test.patch --]
[-- Type: text/x-patch, Size: 6690 bytes --]

From 07c0b8a26b76e31c46ecabddb251f317c48c73a3 Mon Sep 17 00:00:00 2001
From: sunyuechi <sunyuechi@iscas.ac.cn>
Date: Tue, 30 Apr 2024 12:43:57 +0800
Subject: [PATCH 1/2] checkasm/rv40dsp: add chroma_mc test

This is similar to h264.
---
 tests/checkasm/Makefile   |  1 +
 tests/checkasm/checkasm.c |  3 ++
 tests/checkasm/checkasm.h |  1 +
 tests/checkasm/rv40dsp.c  | 75 +++++++++++++++++++++++++++++++++++++++
 tests/fate/checkasm.mak   |  1 +
 5 files changed, 81 insertions(+)
 create mode 100644 tests/checkasm/rv40dsp.c

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index d846a48585..559d88cba4 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -35,6 +35,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 ffc04f0623..e007cd59a5 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -170,6 +170,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 1f31591ac0..3dadbb00ad 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -113,6 +113,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 <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");
+}
diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak
index bcf07456b0..1016ef26a1 100644
--- a/tests/fate/checkasm.mak
+++ b/tests/fate/checkasm.mak
@@ -35,6 +35,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                                   \
-- 
2.44.0


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-30 15:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-30 15:00 [FFmpeg-devel] [PATCH 1/2] checkasm/rv40dsp: add chroma_mc test flow gg

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git