From a900eb3184c9e490a09ac7467732461829bba202 Mon Sep 17 00:00:00 2001 From: Henrik Gramner Date: Wed, 11 Aug 2021 13:35:25 +0200 Subject: checkasm: Fix error reporting in itx tests --- tests/checkasm/itx.c | 105 +++++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 50 deletions(-) (limited to 'tests') diff --git a/tests/checkasm/itx.c b/tests/checkasm/itx.c index 518a01a..6565e37 100644 --- a/tests/checkasm/itx.c +++ b/tests/checkasm/itx.c @@ -239,18 +239,64 @@ static int ftx(coef *const buf, const enum RectTxfmSize tx, return copy_subcoefs(buf, tx, txtp, sw, sh, subsh); } -void bitfn(checkasm_check_itx)(void) { +static void check_itxfm_add(Dav1dInvTxfmDSPContext *const c, + const enum RectTxfmSize tx) +{ + ALIGN_STK_64(coef, coeff, 2, [32 * 32]); + ALIGN_STK_64(pixel, c_dst, 64 * 64,); + ALIGN_STK_64(pixel, a_dst, 64 * 64,); + + static const uint8_t subsh_iters[5] = { 2, 2, 3, 5, 5 }; + + const int w = dav1d_txfm_dimensions[tx].w * 4; + const int h = dav1d_txfm_dimensions[tx].h * 4; + const int subsh_max = subsh_iters[imax(dav1d_txfm_dimensions[tx].lw, + dav1d_txfm_dimensions[tx].lh)]; #if BITDEPTH == 16 const int bpc_min = 10, bpc_max = 12; #else const int bpc_min = 8, bpc_max = 8; #endif - ALIGN_STK_64(coef, coeff, 2, [32 * 32]); - ALIGN_STK_64(pixel, c_dst, 64 * 64,); - ALIGN_STK_64(pixel, a_dst, 64 * 64,); - Dav1dInvTxfmDSPContext c = { { { 0 } } }; /* Zero unused function pointer elements. */ + declare_func(void, pixel *dst, ptrdiff_t dst_stride, coef *coeff, + int eob HIGHBD_DECL_SUFFIX); + + for (int bpc = bpc_min; bpc <= bpc_max; bpc += 2) { + bitfn(dav1d_itx_dsp_init)(c, bpc); + for (enum TxfmType txtp = 0; txtp < N_TX_TYPES_PLUS_LL; txtp++) + for (int subsh = 0; subsh < subsh_max; subsh++) + if (check_func(c->itxfm_add[tx][txtp], + "inv_txfm_add_%dx%d_%s_%s_%d_%dbpc", + w, h, itx_1d_names[itx_1d_types[txtp][0]], + itx_1d_names[itx_1d_types[txtp][1]], subsh, + bpc)) + { + const int bitdepth_max = (1 << bpc) - 1; + const int eob = ftx(coeff[0], tx, txtp, w, h, subsh, bitdepth_max); + memcpy(coeff[1], coeff[0], sizeof(*coeff)); + + for (int j = 0; j < w * h; j++) + c_dst[j] = a_dst[j] = rnd() & bitdepth_max; + + call_ref(c_dst, w * sizeof(*c_dst), coeff[0], eob + HIGHBD_TAIL_SUFFIX); + call_new(a_dst, w * sizeof(*c_dst), coeff[1], eob + HIGHBD_TAIL_SUFFIX); + + checkasm_check_pixel(c_dst, w * sizeof(*c_dst), + a_dst, w * sizeof(*a_dst), + w, h, "dst"); + if (memcmp(coeff[0], coeff[1], sizeof(*coeff))) + fail(); + + bench_new(a_dst, w * sizeof(*c_dst), coeff[0], eob + HIGHBD_TAIL_SUFFIX); + } + } + report("add_%dx%d", w, h); +} +void bitfn(checkasm_check_itx)(void) { static const uint8_t txfm_size_order[N_RECT_TX_SIZES] = { TX_4X4, RTX_4X8, RTX_4X16, RTX_8X4, TX_8X8, RTX_8X16, RTX_8X32, @@ -259,50 +305,9 @@ void bitfn(checkasm_check_itx)(void) { RTX_64X16, RTX_64X32, TX_64X64 }; - static const uint8_t subsh_iters[5] = { 2, 2, 3, 5, 5 }; + /* Zero unused function pointer elements. */ + Dav1dInvTxfmDSPContext c = { { { 0 } } }; - declare_func(void, pixel *dst, ptrdiff_t dst_stride, coef *coeff, int eob - HIGHBD_DECL_SUFFIX); - - for (int i = 0; i < N_RECT_TX_SIZES; i++) { - const enum RectTxfmSize tx = txfm_size_order[i]; - const int w = dav1d_txfm_dimensions[tx].w * 4; - const int h = dav1d_txfm_dimensions[tx].h * 4; - const int subsh_max = subsh_iters[imax(dav1d_txfm_dimensions[tx].lw, - dav1d_txfm_dimensions[tx].lh)]; - - for (int bpc = bpc_min; bpc <= bpc_max; bpc += 2) { - bitfn(dav1d_itx_dsp_init)(&c, bpc); - for (enum TxfmType txtp = 0; txtp < N_TX_TYPES_PLUS_LL; txtp++) - for (int subsh = 0; subsh < subsh_max; subsh++) - if (check_func(c.itxfm_add[tx][txtp], - "inv_txfm_add_%dx%d_%s_%s_%d_%dbpc", - w, h, itx_1d_names[itx_1d_types[txtp][0]], - itx_1d_names[itx_1d_types[txtp][1]], subsh, - bpc)) - { - const int bitdepth_max = (1 << bpc) - 1; - const int eob = ftx(coeff[0], tx, txtp, w, h, subsh, bitdepth_max); - memcpy(coeff[1], coeff[0], sizeof(*coeff)); - - for (int j = 0; j < w * h; j++) - c_dst[j] = a_dst[j] = rnd() & bitdepth_max; - - call_ref(c_dst, w * sizeof(*c_dst), coeff[0], eob - HIGHBD_TAIL_SUFFIX); - call_new(a_dst, w * sizeof(*c_dst), coeff[1], eob - HIGHBD_TAIL_SUFFIX); - - checkasm_check_pixel(c_dst, w * sizeof(*c_dst), - a_dst, w * sizeof(*a_dst), - w, h, "dst"); - if (memcmp(coeff[0], coeff[1], sizeof(*coeff))) - fail(); - - bench_new(a_dst, w * sizeof(*c_dst), coeff[0], eob - HIGHBD_TAIL_SUFFIX); - } - } - report("add_%dx%d", w, h); - } + for (int i = 0; i < N_RECT_TX_SIZES; i++) + check_itxfm_add(&c, txfm_size_order[i]); } -- cgit v1.2.3