aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-27 14:30:42 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-05-27 15:13:18 +0200
commit14652c080dc3b7f3abc801d575acb52122be0137 (patch)
treebf7fcae2aa102813115bd7d7a2b90afdb1103992 /libavcodec
parent5161c62595d694ecaa451f4f016c2cac4de98bec (diff)
downloadffmpeg-14652c080dc3b7f3abc801d575acb52122be0137.tar.gz
j2k/jpeg2000: restructure cblk coord
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/j2k.c10
-rw-r--r--libavcodec/jpeg2000.c10
-rw-r--r--libavcodec/jpeg2000dec.c8
3 files changed, 20 insertions, 8 deletions
diff --git a/libavcodec/j2k.c b/libavcodec/j2k.c
index c34a7d1fa3..ba7a8e542b 100644
--- a/libavcodec/j2k.c
+++ b/libavcodec/j2k.c
@@ -428,6 +428,16 @@ int ff_j2k_init_component(Jpeg2000Component *comp,
/* Compute Cy1 */
cblk->coord[1][1] = FFMIN(Cy0 + (1 << band->log2_cblk_height),
prec->coord[1][1]);
+
+ 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;
diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 3ba3ca5589..0acc200a9d 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -426,6 +426,16 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
/* Compute Cy1 */
cblk->coord[1][1] = FFMIN(Cy0 + (1 << band->log2_cblk_height),
prec->coord[1][1]);
+
+ 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;
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 99b6643763..07e6652a6e 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1063,14 +1063,6 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
/* 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);