Commit 3bd46914 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/jpeg2000dwt: Allow testing with a maximum allowed difference

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent a49154e9
......@@ -614,7 +614,7 @@ void ff_dwt_destroy(DWTContext *s)
#define MAX_W 256
static int test_dwt(int *array, int *ref, uint16_t border[2][2], int decomp_levels, int type) {
static int test_dwt(int *array, int *ref, uint16_t border[2][2], int decomp_levels, int type, int max_diff) {
int ret, j;
DWTContext s1={{{0}}}, *s= &s1;
......@@ -633,12 +633,14 @@ static int test_dwt(int *array, int *ref, uint16_t border[2][2], int decomp_leve
fprintf(stderr, "ff_dwt_encode failed\n");
return 1;
}
for (j = 0; j<MAX_W * MAX_W; j++)
if (array[j] != ref[j]) {
for (j = 0; j<MAX_W * MAX_W; j++) {
if (FFABS(array[j] - ref[j]) > max_diff) {
fprintf(stderr, "missmatch at %d (%d != %d) decomp:%d border %d %d %d %d\n",
j, array[j], ref[j],decomp_levels, border[0][0], border[0][1], border[1][0], border[1][1]);
return 2;
}
array[j] = ref[j];
}
ff_dwt_destroy(s);
return 0;
......@@ -664,7 +666,7 @@ int main(void) {
continue;
decomp_levels = av_lfg_get(&prng) % FF_DWT_MAX_DECLVLS;
ret = test_dwt(array, ref, border, decomp_levels, FF_DWT53);
ret = test_dwt(array, ref, border, decomp_levels, FF_DWT53, 0);
if (ret)
return ret;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment