[FFmpeg-soc] [soc]: r4730 - jpeg2000/j2kdec.c
jai_menon
subversion at mplayerhq.hu
Sun Jul 19 12:25:48 CEST 2009
Author: jai_menon
Date: Sun Jul 19 12:25:47 2009
New Revision: 4730
Log:
Rework tile decoding code to copy pixels on a per
component basis.
Modified:
jpeg2000/j2kdec.c
Modified: jpeg2000/j2kdec.c
==============================================================================
--- jpeg2000/j2kdec.c Sun Jul 19 12:10:00 2009 (r4729)
+++ jpeg2000/j2kdec.c Sun Jul 19 12:25:47 2009 (r4730)
@@ -790,47 +790,50 @@ static int decode_tile(J2kDecoderContext
if (tile->codsty[0].mct)
mct_decode(s, tile);
- y = tile->comp[0].coord[1][0] - s->image_offset_y;
-
- line = s->picture.data[0] + y * s->picture.linesize[0];
if (s->avctx->pix_fmt == PIX_FMT_BGRA) // RGBA -> BGRA
FFSWAP(int *, src[0], src[2]);
if (s->precision <= 8) {
+ for (compno = 0; compno < s->ncomponents; compno++){
+ y = tile->comp[0].coord[1][0] - s->image_offset_y;
+ line = s->picture.data[0] + y * s->picture.linesize[0];
for (; y < tile->comp[0].coord[1][1] - s->image_offset_y; y++){
uint8_t *dst;
x = tile->comp[0].coord[0][0] - s->image_offset_x;
- dst = line + x * s->ncomponents;
+ dst = line + x * s->ncomponents + compno;
for (; x < tile->comp[0].coord[0][1] - s->image_offset_x; x++) {
- for (compno = 0; compno < s->ncomponents; compno++){
*src[compno] += 1 << (s->cbps[compno]-1);
if (*src[compno] < 0)
*src[compno] = 0;
else if (*src[compno] >= (1 << s->cbps[compno]))
*src[compno] = (1 << s->cbps[compno]) - 1;
- *dst++ = *src[compno]++;
- }
+ *dst = *src[compno]++;
+ dst += s->ncomponents;
}
line += s->picture.linesize[0];
}
+ }
} else {
+ for (compno = 0; compno < s->ncomponents; compno++) {
+ y = tile->comp[0].coord[1][0] - s->image_offset_y;
+ line = s->picture.data[0] + y * s->picture.linesize[0];
for (; y < tile->comp[0].coord[1][1] - s->image_offset_y; y++) {
uint16_t *dst;
x = tile->comp[0].coord[0][0] - s->image_offset_x;
- dst = line + x * s->ncomponents * 2;
+ dst = line + (x * s->ncomponents + compno) * 2;
for (; x < tile->comp[0].coord[0][1] - s->image_offset_x; x++) {
- for (compno = 0; compno < s->ncomponents; compno++) {
int32_t val;
val = *src[compno]++ << (16 - s->cbps[compno]);
val += 1 << 15;
val = av_clip(val, 0, (1 << 16) - 1);
- *dst++ = val;
- }
+ *dst = val;
+ dst += s->ncomponents;
}
line += s->picture.linesize[0];
}
+ }
}
return 0;
}
More information about the FFmpeg-soc
mailing list