Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristophe Gisquet <christophe.gisquet@gmail.com>2021-08-18 21:02:28 +0300
committerHenrik Gramner <henrik@gramner.com>2021-08-20 00:38:35 +0300
commita1358e43d2081f8ef65ff5d1d6a5228197f724a0 (patch)
treee1c3782e6d49ebcbd2115639b3412659607fc3a0 /tests
parente3dbc3de9751e2e946b96ebfad06132b222c4252 (diff)
checkasm: Add refmvs splat_mv test
Diffstat (limited to 'tests')
-rw-r--r--tests/checkasm/checkasm.c6
-rw-r--r--tests/checkasm/checkasm.h7
-rw-r--r--tests/checkasm/refmvs.c78
-rw-r--r--tests/meson.build1
4 files changed, 87 insertions, 5 deletions
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 97322a2..9496638 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -70,6 +70,7 @@ static const struct {
void (*func)(void);
} tests[] = {
{ "msac", checkasm_check_msac },
+ { "refmvs", checkasm_check_refmvs },
#if CONFIG_8BPC
{ "cdef_8bpc", checkasm_check_cdef_8bpc },
{ "filmgrain_8bpc", checkasm_check_filmgrain_8bpc },
@@ -858,10 +859,11 @@ int checkasm_check_##type(const char *const file, const int line, \
}
DEF_CHECKASM_CHECK_FUNC(int8_t, "%4d")
-DEF_CHECKASM_CHECK_FUNC(uint8_t, "%02x")
-DEF_CHECKASM_CHECK_FUNC(uint16_t, "%04x")
DEF_CHECKASM_CHECK_FUNC(int16_t, "%6d")
DEF_CHECKASM_CHECK_FUNC(int32_t, "%9d")
+DEF_CHECKASM_CHECK_FUNC(uint8_t, "%02x")
+DEF_CHECKASM_CHECK_FUNC(uint16_t, "%04x")
+DEF_CHECKASM_CHECK_FUNC(uint32_t, "%08x")
#if ARCH_X86_64
void checkasm_simd_warmup(void)
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 5faa769..eac9f81 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -59,6 +59,7 @@ name##_8bpc(void); \
name##_16bpc(void)
void checkasm_check_msac(void);
+void checkasm_check_refmvs(void);
decl_check_bitfns(void checkasm_check_cdef);
decl_check_bitfns(void checkasm_check_filmgrain);
decl_check_bitfns(void checkasm_check_ipred);
@@ -328,11 +329,11 @@ int checkasm_check_##type(const char *const file, const int line, \
const int padding)
DECL_CHECKASM_CHECK_FUNC(int8_t);
-DECL_CHECKASM_CHECK_FUNC(uint8_t);
-DECL_CHECKASM_CHECK_FUNC(uint16_t);
DECL_CHECKASM_CHECK_FUNC(int16_t);
DECL_CHECKASM_CHECK_FUNC(int32_t);
-
+DECL_CHECKASM_CHECK_FUNC(uint8_t);
+DECL_CHECKASM_CHECK_FUNC(uint16_t);
+DECL_CHECKASM_CHECK_FUNC(uint32_t);
#define CONCAT(a,b) a ## b
diff --git a/tests/checkasm/refmvs.c b/tests/checkasm/refmvs.c
new file mode 100644
index 0000000..a73bf4d
--- /dev/null
+++ b/tests/checkasm/refmvs.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright © 2021, VideoLAN and dav1d authors
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests/checkasm/checkasm.h"
+#include "src/refmvs.h"
+
+static void check_splat_mv(const Dav1dRefmvsDSPContext *const c) {
+ ALIGN_STK_64(refmvs_block, c_buf, 32 * 32,);
+ ALIGN_STK_64(refmvs_block, a_buf, 32 * 32,);
+ refmvs_block *c_dst[32];
+ refmvs_block *a_dst[32];
+ const size_t stride = 32 * sizeof(refmvs_block);
+
+ for (int i = 0; i < 32; i++) {
+ c_dst[i] = c_buf + 32 * i;
+ a_dst[i] = a_buf + 32 * i;
+ }
+
+ declare_func(void, refmvs_block **rr, const refmvs_block *rmv,
+ int bx4, int bw4, int bh4);
+
+ for (int w = 1; w <= 32; w *= 2) {
+ if (check_func(c->splat_mv, "splat_mv_w%d", w)) {
+ const int h_min = imax(w / 4, 1);
+ const int h_max = imin(w * 4, 32);
+ const int w_uint32 = w * sizeof(refmvs_block) / sizeof(uint32_t);
+ for (int h = h_min; h <= h_max; h *= 2) {
+ const int offset = (w * rnd()) & 31;
+ union {
+ refmvs_block rmv;
+ uint32_t u32[3];
+ } ALIGN(tmp, 16);
+ tmp.u32[0] = rnd();
+ tmp.u32[1] = rnd();
+ tmp.u32[2] = rnd();
+
+ call_ref(c_dst, &tmp.rmv, offset, w, h);
+ call_new(a_dst, &tmp.rmv, offset, w, h);
+ checkasm_check(uint32_t, (uint32_t*)(c_buf + offset), stride,
+ (uint32_t*)(a_buf + offset), stride,
+ w_uint32, h, "dst");
+
+ bench_new(a_dst, &tmp.rmv, 0, w, h);
+ }
+ }
+ }
+ report("splat_mv");
+}
+
+void checkasm_check_refmvs(void) {
+ Dav1dRefmvsDSPContext c;
+ dav1d_refmvs_dsp_init(&c);
+
+ check_splat_mv(&c);
+}
diff --git a/tests/meson.build b/tests/meson.build
index 32925e5..ac9559d 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -35,6 +35,7 @@ if is_asm_enabled
checkasm_sources = files(
'checkasm/checkasm.c',
'checkasm/msac.c',
+ 'checkasm/refmvs.c',
)
checkasm_tmpl_sources = files(