ref: 152391b28de5d6d5cc257492596b5cfcac746971
parent: a0678eac0ee1a67ff871247b551e42fa448591b7
author: Martin Storsjö <[email protected]>
date: Mon May 11 19:27:50 EDT 2020
checkasm: filmgrain: Fix benchmarking in 16 bpc mode When benchmarking, the functions are called with a fixed width of 64x32 or 32x16, while the test itself is run with a random size in the range up to 128x32. In 16 bpc mode, the source pixels must be within the valid range, because they otherwise cause accesses out of bounds in the scaling array.
--- a/tests/checkasm/filmgrain.c
+++ b/tests/checkasm/filmgrain.c
@@ -181,8 +181,8 @@
const int w = 1 + (rnd() & 127);
const int h = 1 + (rnd() & 31);
- for (int y = 0; y < h; y++)
- for (int x = 0; x < w; x++)
+ for (int y = 0; y < 32; y++)
+ for (int x = 0; x < 128; x++)
src[y * PXSTRIDE(stride) + x] = rnd() & bitdepth_max;
const int row_num = rnd() & 1 ? rnd() & 0x7ff : 0;
@@ -260,13 +260,12 @@
const int w = 1 + (rnd() & (127 >> ss_x));
const int h = 1 + (rnd() & (31 >> ss_y));
- const int lw = w << ss_x, lh = h << ss_y;
- for (int y = 0; y < h; y++)
- for (int x = 0; x < w; x++)
+ for (int y = 0; y < 32; y++)
+ for (int x = 0; x < 128; x++)
src[y * PXSTRIDE(stride) + x] = rnd() & bitdepth_max;
- for (int y = 0; y < lh; y++)
- for (int x = 0; x < lw; x++)
+ for (int y = 0; y < 32; y++)
+ for (int x = 0; x < 128; x++)
luma_src[y * PXSTRIDE(lstride) + x] = rnd() & bitdepth_max;
const int row_num = rnd() & 1 ? rnd() & 0x7ff : 0;