Commit 4e11b155 authored by Michael Niedermayer's avatar Michael Niedermayer Committed by Luca Barbato
Browse files

jpeg2000: Calculate code-block coord in ff_jpeg2000_init_component()


Signed-off-by: default avatarLuca Barbato <lu_zero@gentoo.org>
Signed-off-by: default avatarNicolas Bertrand <nicoinattendu@gmail.com>
Signed-off-by: default avatarLuca Barbato <lu_zero@gentoo.org>
parent 4cbd5ed1
......@@ -443,6 +443,20 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
/* Compute Cy1 */
cblk->coord[1][1] = FFMIN(Cy0 + (1 << band->log2_cblk_height),
prec->coord[1][1]);
/* Update code-blocks coordinates according sub-band position */
if ((bandno + !!reslevelno) & 1) {
cblk->coord[0][0] += comp->reslevel[reslevelno-1].coord[0][1] -
comp->reslevel[reslevelno-1].coord[0][0];
cblk->coord[0][1] += comp->reslevel[reslevelno-1].coord[0][1] -
comp->reslevel[reslevelno-1].coord[0][0];
}
if ((bandno + !!reslevelno) & 2) {
cblk->coord[1][0] += comp->reslevel[reslevelno-1].coord[1][1] -
comp->reslevel[reslevelno-1].coord[1][0];
cblk->coord[1][1] += comp->reslevel[reslevelno-1].coord[1][1] -
comp->reslevel[reslevelno-1].coord[1][0];
}
cblk->zero = 0;
cblk->lblock = 3;
cblk->length = 0;
......
......@@ -1119,17 +1119,8 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
cblk->coord[1][1] - cblk->coord[1][0],
bandpos);
/* Manage band offsets */
x = cblk->coord[0][0];
y = cblk->coord[1][0];
if ((reslevelno > 0) && ((bandno + 1) & 1)) {
Jpeg2000ResLevel *pres = comp->reslevel + (reslevelno - 1);
x += pres->coord[0][1] - pres->coord[0][0];
}
if ((reslevelno > 0) && ((bandno + 1) & 2)) {
Jpeg2000ResLevel *pres = comp->reslevel + (reslevelno - 1);
y += pres->coord[1][1] - pres->coord[1][0];
}
if (s->avctx->flags & CODEC_FLAG_BITEXACT)
dequantization_int(x, y, cblk, comp, &t1, band);
......
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