diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-06-21 13:01:17 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-06-21 13:43:02 +0200 |
commit | 3bd46914fbf2c476d437b6312d1f714f35ae5299 (patch) | |
tree | 30d9ef12555dff4be743ff21a73734fa891494c7 | |
parent | a49154e9d79ae44204072dc1cad74742a8dd63d0 (diff) | |
download | ffmpeg-3bd46914fbf2c476d437b6312d1f714f35ae5299.tar.gz |
avcodec/jpeg2000dwt: Allow testing with a maximum allowed difference
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/jpeg2000dwt.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/jpeg2000dwt.c b/libavcodec/jpeg2000dwt.c index e8b3e12387..c0483c383f 100644 --- a/libavcodec/jpeg2000dwt.c +++ b/libavcodec/jpeg2000dwt.c @@ -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; } |