Commit d554715f authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/jpeg2000dec: Fix decoding of subsampled multi tile images

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 9f4f5787
...@@ -1702,13 +1702,13 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, ...@@ -1702,13 +1702,13 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1); plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1);
y = tile->comp[compno].coord[1][0] - s->image_offset_y; y = tile->comp[compno].coord[1][0] - s->image_offset_y / s->cdy[compno];
line = picture->data[plane] + y / s->cdy[compno] * picture->linesize[plane]; line = picture->data[plane] + y * picture->linesize[plane];
for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y ++) { for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y ++) {
uint8_t *dst; uint8_t *dst;
x = tile->comp[compno].coord[0][0] - s->image_offset_x; x = tile->comp[compno].coord[0][0] - s->image_offset_x / s->cdx[compno];
dst = line + x / s->cdx[compno] * pixelsize + compno*!planar; dst = line + x * pixelsize + compno*!planar;
if (codsty->transform == FF_DWT97) { if (codsty->transform == FF_DWT97) {
for (; x < w; x ++) { for (; x < w; x ++) {
...@@ -1751,13 +1751,13 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, ...@@ -1751,13 +1751,13 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
if (planar) if (planar)
plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1); plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1);
y = tile->comp[compno].coord[1][0] - s->image_offset_y; y = tile->comp[compno].coord[1][0] - s->image_offset_y / s->cdy[compno];
linel = (uint16_t *)picture->data[plane] + y / s->cdy[compno] * (picture->linesize[plane] >> 1); linel = (uint16_t *)picture->data[plane] + y * (picture->linesize[plane] >> 1);
for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y ++) { for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y ++) {
uint16_t *dst; uint16_t *dst;
x = tile->comp[compno].coord[0][0] - s->image_offset_x; x = tile->comp[compno].coord[0][0] - s->image_offset_x / s->cdx[compno];
dst = linel + (x / s->cdx[compno] * pixelsize + compno*!planar); dst = linel + (x * pixelsize + compno*!planar);
if (codsty->transform == FF_DWT97) { if (codsty->transform == FF_DWT97) {
for (; x < w; x ++) { for (; x < w; x ++) {
int val = lrintf(*datap) + (1 << (cbps - 1)); int val = lrintf(*datap) + (1 << (cbps - 1));
......
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