Fix CLPF test to avoid looking outside the frame

Change-Id: Iee9bc41a19d754e234a083f4416b938950f719a5
This commit is contained in:
Jean-Marc Valin 2017-03-23 20:17:47 -04:00
Родитель e575977311
Коммит 1f89d0f880
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 5E5DD9A36F9189C8
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -109,7 +109,7 @@ void test_clpf(int w, int h, int depth, int iterations,
// Test every combination of:
// * Input with up to <depth> bits of noise
// * Noise level around every value from 0 to (1<<depth)-1
// * Blocks anywhere in the frame (along all egdes and also fully inside)
// * Blocks anywhere in the frame (but not on the edge)
// * All strengths
// If clpf and ref_clpf are the same, we're just testing speed
for (count = 0; count < iterations; count++) {
@ -119,8 +119,8 @@ void test_clpf(int w, int h, int depth, int iterations,
s[i] = clamp((rnd.Rand16() & ((1 << bits) - 1)) + level, 0,
(1 << depth) - 1);
for (ypos = 0; ypos < size && !error; ypos += h * !error) {
for (xpos = 0; xpos < size && !error; xpos += w * !error) {
for (ypos = 2; ypos < size - h - 2 && !error; ypos += h * !error) {
for (xpos = 2; xpos < size - w - 2 && !error; xpos += w * !error) {
for (strength = depth - 8; strength < depth - 5 && !error;
strength += !error) {
ref_clpf(s, ref_d, size, size, xpos, ypos, w, h, 1 << strength,