diff options
-rw-r--r-- | src/arm/looprestoration_init_tmpl.c | 2 | ||||
-rw-r--r-- | src/decode.c | 2 | ||||
-rw-r--r-- | src/looprestoration.h | 4 | ||||
-rw-r--r-- | src/looprestoration_tmpl.c | 4 | ||||
-rw-r--r-- | tests/checkasm/looprestoration.c | 45 |
5 files changed, 29 insertions, 28 deletions
diff --git a/src/arm/looprestoration_init_tmpl.c b/src/arm/looprestoration_init_tmpl.c index ec0ea22..d701a61 100644 --- a/src/arm/looprestoration_init_tmpl.c +++ b/src/arm/looprestoration_init_tmpl.c @@ -270,7 +270,7 @@ static void sgr_filter_neon(pixel *const dst, const ptrdiff_t dst_stride, } #endif // BITDEPTH == 8 -COLD void bitfn(dav1d_loop_restoration_dsp_init_arm)(Dav1dLoopRestorationDSPContext *const c) { +COLD void bitfn(dav1d_loop_restoration_dsp_init_arm)(Dav1dLoopRestorationDSPContext *const c, int bpc) { const unsigned flags = dav1d_get_cpu_flags(); if (!(flags & DAV1D_ARM_CPU_FLAG_NEON)) return; diff --git a/src/decode.c b/src/decode.c index fbab656..2833524 100644 --- a/src/decode.c +++ b/src/decode.c @@ -3242,7 +3242,7 @@ int dav1d_submit_frame(Dav1dContext *const c) { dav1d_intra_pred_dsp_init_##bd##bpc(&dsp->ipred); \ dav1d_itx_dsp_init_##bd##bpc(&dsp->itx); \ dav1d_loop_filter_dsp_init_##bd##bpc(&dsp->lf); \ - dav1d_loop_restoration_dsp_init_##bd##bpc(&dsp->lr); \ + dav1d_loop_restoration_dsp_init_##bd##bpc(&dsp->lr, bpc); \ dav1d_mc_dsp_init_##bd##bpc(&dsp->mc); \ dav1d_film_grain_dsp_init_##bd##bpc(&dsp->fg); \ break diff --git a/src/looprestoration.h b/src/looprestoration.h index 2d16df8..539a76b 100644 --- a/src/looprestoration.h +++ b/src/looprestoration.h @@ -72,8 +72,8 @@ typedef struct Dav1dLoopRestorationDSPContext { selfguided_fn selfguided; } Dav1dLoopRestorationDSPContext; -bitfn_decls(void dav1d_loop_restoration_dsp_init, Dav1dLoopRestorationDSPContext *c); -bitfn_decls(void dav1d_loop_restoration_dsp_init_arm, Dav1dLoopRestorationDSPContext *c); +bitfn_decls(void dav1d_loop_restoration_dsp_init, Dav1dLoopRestorationDSPContext *c, int bpc); +bitfn_decls(void dav1d_loop_restoration_dsp_init_arm, Dav1dLoopRestorationDSPContext *c, int bpc); bitfn_decls(void dav1d_loop_restoration_dsp_init_x86, Dav1dLoopRestorationDSPContext *c); bitfn_decls(void dav1d_loop_restoration_dsp_init_ppc, Dav1dLoopRestorationDSPContext *c); diff --git a/src/looprestoration_tmpl.c b/src/looprestoration_tmpl.c index 82694ef..a8a2472 100644 --- a/src/looprestoration_tmpl.c +++ b/src/looprestoration_tmpl.c @@ -573,13 +573,13 @@ static void selfguided_c(pixel *p, const ptrdiff_t p_stride, } } -COLD void bitfn(dav1d_loop_restoration_dsp_init)(Dav1dLoopRestorationDSPContext *const c) { +COLD void bitfn(dav1d_loop_restoration_dsp_init)(Dav1dLoopRestorationDSPContext *const c, int bpc) { c->wiener = wiener_c; c->selfguided = selfguided_c; #if HAVE_ASM #if ARCH_AARCH64 || ARCH_ARM - bitfn(dav1d_loop_restoration_dsp_init_arm)(c); + bitfn(dav1d_loop_restoration_dsp_init_arm)(c, bpc); #elif ARCH_PPC64LE bitfn(dav1d_loop_restoration_dsp_init_ppc)(c); #elif ARCH_X86 diff --git a/tests/checkasm/looprestoration.c b/tests/checkasm/looprestoration.c index 9e8eba9..c76b020 100644 --- a/tests/checkasm/looprestoration.c +++ b/tests/checkasm/looprestoration.c @@ -43,7 +43,7 @@ static void init_tmp(pixel *buf, const ptrdiff_t stride, } } -static void check_wiener(Dav1dLoopRestorationDSPContext *const c) { +static void check_wiener(Dav1dLoopRestorationDSPContext *const c, const int bpc) { ALIGN_STK_64(pixel, c_dst, 448 * 64,); ALIGN_STK_64(pixel, a_dst, 448 * 64,); ALIGN_STK_64(pixel, h_edge, 448 * 8,); @@ -58,7 +58,7 @@ static void check_wiener(Dav1dLoopRestorationDSPContext *const c) { for (int pl = 0; pl < 2; pl++) { if (check_func(c->wiener, "wiener_%s_%dbpc", - pl ? "chroma" : "luma", BITDEPTH)) + pl ? "chroma" : "luma", bpc)) { int16_t filter[2][3], filter_v[7], filter_h[7]; @@ -81,11 +81,7 @@ static void check_wiener(Dav1dLoopRestorationDSPContext *const c) { const int base_w = 1 + (rnd() % 384); const int base_h = 1 + (rnd() & 63); -#if BITDEPTH == 16 - const int bitdepth_max = rnd() & 1 ? 0x3ff : 0xfff; -#else - const int bitdepth_max = 0xff; -#endif + const int bitdepth_max = (1 << bpc) - 1; init_tmp(c_dst, 448 * sizeof(pixel), 448, 64, bitdepth_max); init_tmp(h_edge, 448 * sizeof(pixel), 448, 8, bitdepth_max); @@ -112,10 +108,9 @@ static void check_wiener(Dav1dLoopRestorationDSPContext *const c) { 256, 64, filter_h, filter_v, 0xf HIGHBD_TAIL_SUFFIX); } } - report("wiener"); } -static void check_sgr(Dav1dLoopRestorationDSPContext *const c) { +static void check_sgr(Dav1dLoopRestorationDSPContext *const c, const int bpc) { ALIGN_STK_64(pixel, c_dst, 448 * 64,); ALIGN_STK_64(pixel, a_dst, 448 * 64,); ALIGN_STK_64(pixel, h_edge, 448 * 8,); @@ -130,7 +125,7 @@ static void check_sgr(Dav1dLoopRestorationDSPContext *const c) { for (int sgr_idx = 14; sgr_idx >= 6; sgr_idx -= 4) { if (check_func(c->selfguided, "selfguided_%s_%dbpc", - sgr_idx == 6 ? "mix" : sgr_idx == 10 ? "3x3" : "5x5", BITDEPTH)) + sgr_idx == 6 ? "mix" : sgr_idx == 10 ? "3x3" : "5x5", bpc)) { int16_t sgr_wt[2]; @@ -140,11 +135,7 @@ static void check_sgr(Dav1dLoopRestorationDSPContext *const c) { const int base_w = 1 + (rnd() % 384); const int base_h = 1 + (rnd() & 63); -#if BITDEPTH == 16 - const int bitdepth_max = rnd() & 1 ? 0x3ff : 0xfff; -#else - const int bitdepth_max = 0xff; -#endif + const int bitdepth_max = (1 << bpc) - 1; init_tmp(c_dst, 448 * sizeof(pixel), 448, 64, bitdepth_max); init_tmp(h_edge, 448 * sizeof(pixel), 448, 8, bitdepth_max); @@ -171,14 +162,24 @@ static void check_sgr(Dav1dLoopRestorationDSPContext *const c) { 256, 64, sgr_idx, sgr_wt, 0xf HIGHBD_TAIL_SUFFIX); } } - report("sgr"); } void bitfn(checkasm_check_looprestoration)(void) { - Dav1dLoopRestorationDSPContext c; - - bitfn(dav1d_loop_restoration_dsp_init)(&c); - - check_wiener(&c); - check_sgr(&c); +#if BITDEPTH == 16 + const int bpc_min = 10, bpc_max = 12; +#else + const int bpc_min = 8, bpc_max = 8; +#endif + for (int bpc = bpc_min; bpc <= bpc_max; bpc += 2) { + Dav1dLoopRestorationDSPContext c; + bitfn(dav1d_loop_restoration_dsp_init)(&c, bpc); + check_wiener(&c, bpc); + } + report("wiener"); + for (int bpc = bpc_min; bpc <= bpc_max; bpc += 2) { + Dav1dLoopRestorationDSPContext c; + bitfn(dav1d_loop_restoration_dsp_init)(&c, bpc); + check_sgr(&c, bpc); + } + report("sgr"); } |