Commit f0a2c828 authored by Michael Niedermayer's avatar Michael Niedermayer

j2kdec: Try to fix 8bps output case

Ive no test samples for which this makes a difference but it
matches the 16bit implementation.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent ced0307e
...@@ -933,12 +933,10 @@ static int decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile) ...@@ -933,12 +933,10 @@ static int decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
dst = line + x * s->ncomponents + compno; dst = line + x * s->ncomponents + compno;
for (; x < tile->comp[compno].coord[0][1] - s->image_offset_x; x += s->cdx[compno]) { for (; x < tile->comp[compno].coord[0][1] - s->image_offset_x; x += s->cdx[compno]) {
*src[compno] += 1 << (s->cbps[compno]-1); int val = *src[compno]++ << (8 - s->cbps[compno]);
if (*src[compno] < 0) val += 1 << 7;
*src[compno] = 0; val = av_clip(val, 0, (1 << 8) - 1);
else if (*src[compno] >= (1 << s->cbps[compno])) *dst = val;
*src[compno] = (1 << s->cbps[compno]) - 1;
*dst = *src[compno]++;
dst += s->ncomponents; dst += s->ncomponents;
} }
line += s->picture->linesize[0]; line += s->picture->linesize[0];
......
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