summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-09 02:01:40 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-09 02:17:53 +0200
commit7c9fcdfabd4c8d37d8e588b39e7786cf55ed5989 (patch)
treee5fb1220c28e001c298172e66c4ff8f4e8fdf4cb /libavcodec
parentecefce41d9f9fd10a8f564b011cd565cff2eb3ef (diff)
avcodec/jpeg2000dec: Fix some 5/3 bitexactness issues
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/jpeg2000dec.c18
1 files changed, 17 insertions, 1 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 */