summaryrefslogtreecommitdiff
path: root/libavcodec/jpeg2000.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-07-01 10:01:18 +0200
committerLuca Barbato <lu_zero@gentoo.org>2013-07-02 20:05:45 +0200
commit4e11b155345101bac6185b48180e6f36c4850c8b (patch)
tree88e8e90d80b11a97ba5e3ea91c2d1d175f0d1121 /libavcodec/jpeg2000.c
parent4cbd5ed11b0161a6a192174934b241e0cc0599a9 (diff)
downloadffmpeg-4e11b155345101bac6185b48180e6f36c4850c8b.tar.gz
jpeg2000: Calculate code-block coord in ff_jpeg2000_init_component()
Signed-off-by: Luca Barbato <lu_zero@gentoo.org> Signed-off-by: Nicolas Bertrand <nicoinattendu@gmail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec/jpeg2000.c')
-rw-r--r--libavcodec/jpeg2000.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index b1236993ac..b3182d63b0 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -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;