diff options
author | Henrik Gramner <gramner@twoorioles.com> | 2021-02-10 03:51:37 +0300 |
---|---|---|
committer | Henrik Gramner <gramner@twoorioles.com> | 2021-02-11 17:40:14 +0300 |
commit | c290c02e803771a1ed49d3251d08401d86101962 (patch) | |
tree | 1d9c4d9747701580bf62a3db80da4c0958c4a89b /tests | |
parent | c36b191a9aa7119a78e887e8145cc07414bd81f9 (diff) |
Add minor SGR optimizations
Split the 5x5, 3x3, and mix cases into separate functions.
Shrink some tables.
Move some scalar calculations out of the DSP function.
Make Wiener and SGR share the same function prototype to
eliminate a branch in lr_stripe().
Diffstat (limited to 'tests')
-rw-r--r-- | tests/checkasm/looprestoration.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/tests/checkasm/looprestoration.c b/tests/checkasm/looprestoration.c index 97ef4af..4bab5cd 100644 --- a/tests/checkasm/looprestoration.c +++ b/tests/checkasm/looprestoration.c @@ -57,13 +57,14 @@ static void check_wiener(Dav1dLoopRestorationDSPContext *const c, const int bpc) ALIGN_STK_64(pixel, c_src, 448 * 64,), *const c_dst = c_src + 32; ALIGN_STK_64(pixel, a_src, 448 * 64,), *const a_dst = a_src + 32; ALIGN_STK_64(pixel, edge_buf, 448 * 8,), *const h_edge = edge_buf + 32; - ALIGN_STK_16(int16_t, filter, 2, [8]); pixel left[64][4]; + LooprestorationParams params; + int16_t (*const filter)[8] = params.filter; declare_func(void, pixel *dst, ptrdiff_t dst_stride, const pixel (*const left)[4], const pixel *lpf, ptrdiff_t lpf_stride, - int w, int h, const int16_t filter[2][8], + int w, int h, const LooprestorationParams *params, enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX); for (int t = 0; t < 2; t++) { @@ -97,10 +98,10 @@ static void check_wiener(Dav1dLoopRestorationDSPContext *const c, const int bpc) call_ref(c_dst, 448 * sizeof(pixel), left, h_edge, 448 * sizeof(pixel), - w, h, filter, edges HIGHBD_TAIL_SUFFIX); + w, h, ¶ms, edges HIGHBD_TAIL_SUFFIX); call_new(a_dst, 448 * sizeof(pixel), left, h_edge, 448 * sizeof(pixel), - w, h, filter, edges HIGHBD_TAIL_SUFFIX); + w, h, ¶ms, edges HIGHBD_TAIL_SUFFIX); if (checkasm_check_pixel(c_dst, 448 * sizeof(pixel), a_dst, 448 * sizeof(pixel), w, h, "dst")) @@ -112,7 +113,7 @@ static void check_wiener(Dav1dLoopRestorationDSPContext *const c, const int bpc) } bench_new(a_dst, 448 * sizeof(pixel), left, h_edge, 448 * sizeof(pixel), - 256, 64, filter, 0xf HIGHBD_TAIL_SUFFIX); + 256, 64, ¶ms, 0xf HIGHBD_TAIL_SUFFIX); } } } @@ -122,23 +123,27 @@ static void check_sgr(Dav1dLoopRestorationDSPContext *const c, const int bpc) { ALIGN_STK_64(pixel, a_src, 448 * 64,), *const a_dst = a_src + 32; ALIGN_STK_64(pixel, edge_buf, 448 * 8,), *const h_edge = edge_buf + 32; pixel left[64][4]; + LooprestorationParams params; declare_func(void, pixel *dst, ptrdiff_t dst_stride, const pixel (*const left)[4], const pixel *lpf, ptrdiff_t lpf_stride, - int w, int h, int sgr_idx, - const int16_t sgr_wt[7], enum LrEdgeFlags edges - HIGHBD_DECL_SUFFIX); + int w, int h, const LooprestorationParams *params, + enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX); - 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", bpc)) - { - int16_t sgr_wt[2]; + static const struct { char name[4]; uint8_t idx; } sgr_data[3] = { + { "5x5", 14 }, + { "3x3", 10 }, + { "mix", 0 }, + }; - sgr_wt[0] = dav1d_sgr_params[sgr_idx][0] ? (rnd() & 127) - 96 : 0; - sgr_wt[1] = dav1d_sgr_params[sgr_idx][1] ? (rnd() & 127) - 32 : - iclip(128 - sgr_wt[0], -32, 95); + for (int i = 0; i < 3; i++) { + if (check_func(c->sgr[i], "sgr_%s_%dbpc", sgr_data[i].name, bpc)) { + const uint16_t *const sgr_params = dav1d_sgr_params[sgr_data[i].idx]; + params.sgr.s0 = sgr_params[0]; + params.sgr.s1 = sgr_params[1]; + params.sgr.w0 = sgr_params[0] ? (rnd() & 127) - 96 : 0; + params.sgr.w1 = (sgr_params[1] ? 160 - (rnd() & 127) : 33) - params.sgr.w0; const int base_w = 1 + (rnd() % 384); const int base_h = 1 + (rnd() & 63); @@ -156,10 +161,10 @@ static void check_sgr(Dav1dLoopRestorationDSPContext *const c, const int bpc) { call_ref(c_dst, 448 * sizeof(pixel), left, h_edge, 448 * sizeof(pixel), - w, h, sgr_idx, sgr_wt, edges HIGHBD_TAIL_SUFFIX); + w, h, ¶ms, edges HIGHBD_TAIL_SUFFIX); call_new(a_dst, 448 * sizeof(pixel), left, h_edge, 448 * sizeof(pixel), - w, h, sgr_idx, sgr_wt, edges HIGHBD_TAIL_SUFFIX); + w, h, ¶ms, edges HIGHBD_TAIL_SUFFIX); if (checkasm_check_pixel(c_dst, 448 * sizeof(pixel), a_dst, 448 * sizeof(pixel), w, h, "dst")) @@ -171,7 +176,7 @@ static void check_sgr(Dav1dLoopRestorationDSPContext *const c, const int bpc) { } bench_new(a_dst, 448 * sizeof(pixel), left, h_edge, 448 * sizeof(pixel), - 256, 64, sgr_idx, sgr_wt, 0xf HIGHBD_TAIL_SUFFIX); + 256, 64, ¶ms, 0xf HIGHBD_TAIL_SUFFIX); } } } |