From 1206819d988277a63489d5c2221d7599d9c0e818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 26 Mar 2021 11:45:56 +0200 Subject: checkasm: Implement printing of grain lut entries --- tests/checkasm/checkasm.c | 1 + tests/checkasm/checkasm.h | 1 + tests/checkasm/filmgrain.c | 23 ++++++++++++++--------- 3 files changed, 16 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index ab93a32..689830e 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -852,6 +852,7 @@ int checkasm_check_##type(const char *const file, const int line, \ return err; \ } +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") diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index ae51d61..0871130 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -325,6 +325,7 @@ int checkasm_check_##type(const char *const file, const int line, \ const int align_w, const int align_h, \ 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); diff --git a/tests/checkasm/filmgrain.c b/tests/checkasm/filmgrain.c index a74d09b..eadf2ad 100644 --- a/tests/checkasm/filmgrain.c +++ b/tests/checkasm/filmgrain.c @@ -34,6 +34,12 @@ #define UNIT_TEST 1 #include "src/fg_apply_tmpl.c" +#if BITDEPTH == 8 +#define checkasm_check_entry(...) checkasm_check(int8_t, __VA_ARGS__) +#else +#define checkasm_check_entry(...) checkasm_check(int16_t, __VA_ARGS__) +#endif + static const char ss_name[][4] = { [DAV1D_PIXEL_LAYOUT_I420 - 1] = "420", [DAV1D_PIXEL_LAYOUT_I422 - 1] = "422", @@ -65,11 +71,9 @@ static void check_gen_grny(const Dav1dFilmGrainDSPContext *const dsp) { call_ref(grain_lut_c, fg_data HIGHBD_TAIL_SUFFIX); call_new(grain_lut_a, fg_data HIGHBD_TAIL_SUFFIX); - if (memcmp(grain_lut_c, grain_lut_a, - GRAIN_WIDTH * GRAIN_HEIGHT * sizeof(entry))) - { - fail(); - } + checkasm_check_entry(grain_lut_c[0], sizeof(entry) * GRAIN_WIDTH, + grain_lut_a[0], sizeof(entry) * GRAIN_WIDTH, + GRAIN_WIDTH, GRAIN_HEIGHT, "grain_lut"); bench_new(grain_lut_a, fg_data HIGHBD_TAIL_SUFFIX); } @@ -123,10 +127,11 @@ static void check_gen_grnuv(const Dav1dFilmGrainDSPContext *const dsp) { memset(grain_lut_a, 0xff, sizeof(grain_lut_a)); call_ref(grain_lut_c, grain_lut_y, fg_data, uv HIGHBD_TAIL_SUFFIX); call_new(grain_lut_a, grain_lut_y, fg_data, uv HIGHBD_TAIL_SUFFIX); - int diff = 0, w = ss_x ? 44 : GRAIN_WIDTH; - for (int y = 0; y < (ss_y ? 38 : GRAIN_HEIGHT); y++) - diff |= memcmp(grain_lut_a[y], grain_lut_c[y], w * sizeof(entry)); - if (diff) fail(); + int w = ss_x ? 44 : GRAIN_WIDTH; + int h = ss_y ? 38 : GRAIN_HEIGHT; + checkasm_check_entry(grain_lut_c[0], sizeof(entry) * GRAIN_WIDTH, + grain_lut_a[0], sizeof(entry) * GRAIN_WIDTH, + w, h, "grain_lut"); bench_new(grain_lut_a, grain_lut_y, fg_data, uv HIGHBD_TAIL_SUFFIX); } -- cgit v1.2.3