diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-06-09 02:01:40 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-06-09 02:17:53 +0200 |
commit | 7c9fcdfabd4c8d37d8e588b39e7786cf55ed5989 (patch) | |
tree | e5fb1220c28e001c298172e66c4ff8f4e8fdf4cb | |
parent | ecefce41d9f9fd10a8f564b011cd565cff2eb3ef (diff) | |
download | ffmpeg-7c9fcdfabd4c8d37d8e588b39e7786cf55ed5989.tar.gz |
avcodec/jpeg2000dec: Fix some 5/3 bitexactness issues
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/jpeg2000dec.c | 18 | ||||
-rw-r--r-- | tests/ref/vsynth/vsynth1-jpeg2000 | 4 | ||||
-rw-r--r-- | tests/ref/vsynth/vsynth2-jpeg2000 | 4 | ||||
-rw-r--r-- | tests/ref/vsynth/vsynth3-jpeg2000 | 4 | ||||
-rw-r--r-- | tests/ref/vsynth/vsynth_lena-jpeg2000 | 4 |
5 files changed, 25 insertions, 9 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 537f6e2a4e..ba0d259778 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -1145,7 +1145,21 @@ static void dequantization_int(int x, int y, Jpeg2000Cblk *cblk, int32_t *datap = &comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x]; int *src = t1->data[j]; for (i = 0; i < w; ++i) - datap[i] = (src[i] * band->i_stepsize + (1 << 14)) >> 15; + datap[i] = (src[i] * band->i_stepsize) / 32768; + } +} + +static void dequantization_int_97(int x, int y, Jpeg2000Cblk *cblk, + Jpeg2000Component *comp, + Jpeg2000T1Context *t1, Jpeg2000Band *band) +{ + int i, j; + int w = cblk->coord[0][1] - cblk->coord[0][0]; + for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) { + int32_t *datap = &comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x]; + int *src = t1->data[j]; + for (i = 0; i < w; ++i) + datap[i] = (src[i] * band->i_stepsize + (1<<14)) >> 15; } } @@ -1228,6 +1242,8 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, if (codsty->transform == FF_DWT97) dequantization_float(x, y, cblk, comp, &t1, band); + else if (codsty->transform == FF_DWT97_INT) + dequantization_int_97(x, y, cblk, comp, &t1, band); else dequantization_int(x, y, cblk, comp, &t1, band); } /* end cblk */ diff --git a/tests/ref/vsynth/vsynth1-jpeg2000 b/tests/ref/vsynth/vsynth1-jpeg2000 index d169cf668a..fb110b2b26 100644 --- a/tests/ref/vsynth/vsynth1-jpeg2000 +++ b/tests/ref/vsynth/vsynth1-jpeg2000 @@ -1,4 +1,4 @@ ed9c45dc090a03c2eb9c35cf76e4d914 *tests/data/fate/vsynth1-jpeg2000.avi 2306906 tests/data/fate/vsynth1-jpeg2000.avi -1774b621bd92a53a24712cb77e9f0b28 *tests/data/fate/vsynth1-jpeg2000.out.rawvideo -stddev: 5.37 PSNR: 33.52 MAXDIFF: 63 bytes: 7603200/ 7603200 +64166a8fbb730a7a132c50ee89592672 *tests/data/fate/vsynth1-jpeg2000.out.rawvideo +stddev: 5.41 PSNR: 33.46 MAXDIFF: 63 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-jpeg2000 b/tests/ref/vsynth/vsynth2-jpeg2000 index 04c5a2a472..2100042a29 100644 --- a/tests/ref/vsynth/vsynth2-jpeg2000 +++ b/tests/ref/vsynth/vsynth2-jpeg2000 @@ -1,4 +1,4 @@ b918de21dec4310f87af3788ed458462 *tests/data/fate/vsynth2-jpeg2000.avi 1513144 tests/data/fate/vsynth2-jpeg2000.avi -1d33de510f21eaad6c3cecfcf29798ba *tests/data/fate/vsynth2-jpeg2000.out.rawvideo -stddev: 4.99 PSNR: 34.17 MAXDIFF: 70 bytes: 7603200/ 7603200 +d30f637670a60de6cc8d177047f32a59 *tests/data/fate/vsynth2-jpeg2000.out.rawvideo +stddev: 5.04 PSNR: 34.07 MAXDIFF: 71 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth3-jpeg2000 b/tests/ref/vsynth/vsynth3-jpeg2000 index d4015d25ee..0d086cf538 100644 --- a/tests/ref/vsynth/vsynth3-jpeg2000 +++ b/tests/ref/vsynth/vsynth3-jpeg2000 @@ -1,4 +1,4 @@ 7ea4e3901817f06a3de59ee70836f5d9 *tests/data/fate/vsynth3-jpeg2000.avi 63772 tests/data/fate/vsynth3-jpeg2000.avi -11b954cc1b0091399fa4342a6bb432b2 *tests/data/fate/vsynth3-jpeg2000.out.rawvideo -stddev: 5.50 PSNR: 33.31 MAXDIFF: 48 bytes: 86700/ 86700 +ddfc0e8e033aeecf334c1450148dab44 *tests/data/fate/vsynth3-jpeg2000.out.rawvideo +stddev: 5.52 PSNR: 33.28 MAXDIFF: 48 bytes: 86700/ 86700 diff --git a/tests/ref/vsynth/vsynth_lena-jpeg2000 b/tests/ref/vsynth/vsynth_lena-jpeg2000 index d4d8cf35b5..6605f625ba 100644 --- a/tests/ref/vsynth/vsynth_lena-jpeg2000 +++ b/tests/ref/vsynth/vsynth_lena-jpeg2000 @@ -1,4 +1,4 @@ 9283c83bc8dc830bd48ad66f71ae42e8 *tests/data/fate/vsynth_lena-jpeg2000.avi 1151148 tests/data/fate/vsynth_lena-jpeg2000.avi -e7d79c9e11d0fe97f03e38be66c34e4f *tests/data/fate/vsynth_lena-jpeg2000.out.rawvideo -stddev: 4.41 PSNR: 35.23 MAXDIFF: 63 bytes: 7603200/ 7603200 +71a9ee7ad7c3dad60aa6641712c1f9e4 *tests/data/fate/vsynth_lena-jpeg2000.out.rawvideo +stddev: 4.44 PSNR: 35.17 MAXDIFF: 61 bytes: 7603200/ 7603200 |