diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-06-20 00:41:12 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-06-20 00:53:56 +0200 |
commit | 75651cd63f2d7b99fe92fa96eccdd18b7f9c37fe (patch) | |
tree | f53b2589da98098bcab4611b58f84530c5d02ced /libavcodec | |
parent | 7e2bdea764a565ad213f7676e558e5ce305bedef (diff) | |
download | ffmpeg-75651cd63f2d7b99fe92fa96eccdd18b7f9c37fe.tar.gz |
avcodec/jpeg2000dwt: Fix order of operations in integer decomposition wavelets
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/jpeg2000dwt.c | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/libavcodec/jpeg2000dwt.c b/libavcodec/jpeg2000dwt.c index ae150fb433..381764f3ad 100644 --- a/libavcodec/jpeg2000dwt.c +++ b/libavcodec/jpeg2000dwt.c @@ -111,22 +111,6 @@ static void dwt_encode53(DWTContext *s, int *t) int *l; av_assert1(!mh && !mv); - // HOR_SD - l = line + mh; - for (lp = 0; lp < lv; lp++){ - int i, j = 0; - - for (i = 0; i < lh; i++) - l[i] = t[w*lp + i]; - - sd_1d53(line, mh, mh + lh); - - // copy back and deinterleave - for (i = mh; i < lh; i+=2, j++) - t[w*lp + j] = l[i]; - for (i = 1-mh; i < lh; i+=2, j++) - t[w*lp + j] = l[i]; - } // VER_SD l = line + mv; @@ -144,6 +128,23 @@ static void dwt_encode53(DWTContext *s, int *t) for (i = 1-mv; i < lv; i+=2, j++) t[w*j + lp] = l[i]; } + + // HOR_SD + l = line + mh; + for (lp = 0; lp < lv; lp++){ + int i, j = 0; + + for (i = 0; i < lh; i++) + l[i] = t[w*lp + i]; + + sd_1d53(line, mh, mh + lh); + + // copy back and deinterleave + for (i = mh; i < lh; i+=2, j++) + t[w*lp + j] = l[i]; + for (i = 1-mh; i < lh; i+=2, j++) + t[w*lp + j] = l[i]; + } } } static void sd_1d97_float(float *p, int i0, int i1) @@ -265,6 +266,23 @@ static void dwt_encode97_int(DWTContext *s, int *t) av_assert1(!mh && !mv); + // VER_SD + l = line + mv; + for (lp = 0; lp < lh; lp++) { + int i, j = 0; + + for (i = 0; i < lv; i++) + l[i] = t[w*i + lp]; + + sd_1d97_int(line, mv, mv + lv); + + // copy back and deinterleave + for (i = mv; i < lv; i+=2, j++) + t[w*j + lp] = ((l[i] * I_LFTG_X) + (1 << 16)) >> 17; + for (i = 1-mv; i < lv; i+=2, j++) + t[w*j + lp] = ((l[i] * I_LFTG_K) + (1 << 16)) >> 17; + } + // HOR_SD l = line + mh; for (lp = 0; lp < lv; lp++){ @@ -282,22 +300,6 @@ static void dwt_encode97_int(DWTContext *s, int *t) t[w*lp + j] = ((l[i] * I_LFTG_K) + (1 << 16)) >> 17; } - // VER_SD - l = line + mv; - for (lp = 0; lp < lh; lp++) { - int i, j = 0; - - for (i = 0; i < lv; i++) - l[i] = t[w*i + lp]; - - sd_1d97_int(line, mv, mv + lv); - - // copy back and deinterleave - for (i = mv; i < lv; i+=2, j++) - t[w*j + lp] = ((l[i] * I_LFTG_X) + (1 << 16)) >> 17; - for (i = 1-mv; i < lv; i+=2, j++) - t[w*j + lp] = ((l[i] * I_LFTG_K) + (1 << 16)) >> 17; - } } } |