mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-27 17:53:13 +00:00
jpeg2000dec: Support non subsampled 8bit planar pixel formats
Fixes file2.jp2 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
99de97cabf
commit
fc6de70c44
@ -1245,14 +1245,21 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
|||||||
int32_t *i_datap = comp->i_data;
|
int32_t *i_datap = comp->i_data;
|
||||||
int cbps = s->cbps[compno];
|
int cbps = s->cbps[compno];
|
||||||
int w = tile->comp[compno].coord[0][1] - s->image_offset_x;
|
int w = tile->comp[compno].coord[0][1] - s->image_offset_x;
|
||||||
|
int planar = !!picture->data[2];
|
||||||
|
int pixelsize = planar ? 1 : s->ncomponents;
|
||||||
|
int plane = 0;
|
||||||
|
|
||||||
|
if (planar)
|
||||||
|
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;
|
||||||
line = picture->data[0] + y * picture->linesize[0];
|
line = picture->data[plane] + y * picture->linesize[plane];
|
||||||
for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) {
|
for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) {
|
||||||
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;
|
||||||
dst = line + x * s->ncomponents + compno;
|
dst = line + x * pixelsize + compno*!planar;
|
||||||
|
|
||||||
if (codsty->transform == FF_DWT97) {
|
if (codsty->transform == FF_DWT97) {
|
||||||
for (; x < w; x += s->cdx[compno]) {
|
for (; x < w; x += s->cdx[compno]) {
|
||||||
@ -1261,7 +1268,7 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
|||||||
val = av_clip(val, 0, (1 << cbps) - 1);
|
val = av_clip(val, 0, (1 << cbps) - 1);
|
||||||
*dst = val << (8 - cbps);
|
*dst = val << (8 - cbps);
|
||||||
datap++;
|
datap++;
|
||||||
dst += s->ncomponents;
|
dst += pixelsize;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (; x < w; x += s->cdx[compno]) {
|
for (; x < w; x += s->cdx[compno]) {
|
||||||
@ -1270,10 +1277,10 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
|||||||
val = av_clip(val, 0, (1 << cbps) - 1);
|
val = av_clip(val, 0, (1 << cbps) - 1);
|
||||||
*dst = val << (8 - cbps);
|
*dst = val << (8 - cbps);
|
||||||
i_datap++;
|
i_datap++;
|
||||||
dst += s->ncomponents;
|
dst += pixelsize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
line += picture->linesize[0];
|
line += picture->linesize[plane];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user