Le 24/06/2013 17:14, Luca Barbato a écrit :
From: Michael Niedermayer <michae...@gmx.at>

Signed-off-by: Luca Barbato <lu_z...@gentoo.org>
---
  libavcodec/jpeg2k.c    | 10 ++++++++++
  libavcodec/jpeg2kdec.c |  8 --------
  2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/libavcodec/jpeg2k.c b/libavcodec/jpeg2k.c
index 1af58f4..c82a09e 100644
--- a/libavcodec/jpeg2k.c
+++ b/libavcodec/jpeg2k.c
@@ -443,6 +443,16 @@ int ff_jpeg2k_init_component(Jpeg2KComponent *comp,
                      /* Compute Cy1 */
                      cblk->coord[1][1] = FFMIN(Cy0 + (1 << 
band->log2_cblk_height),
                                                prec->coord[1][1]);

Just comment to add: /* Upfate 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;
diff --git a/libavcodec/jpeg2kdec.c b/libavcodec/jpeg2kdec.c
index 162614f..36777f9 100644
--- a/libavcodec/jpeg2kdec.c
+++ b/libavcodec/jpeg2kdec.c
@@ -1117,14 +1117,6 @@ static int jpeg2k_decode_tile(Jpeg2KDecoderContext *s, 
Jpeg2KTile *tile,
                          /* Manage band offsets */
Remove this comment
                          x = cblk->coord[0][0];
                          y = cblk->coord[1][0];
-                        if ((reslevelno > 0) && ((bandno + 1) & 1)) {
-                            Jpeg2KResLevel *pres = comp->reslevel + 
(reslevelno - 1);
-                            x += pres->coord[0][1] - pres->coord[0][0];
-                        }
-                        if ((reslevelno > 0) && ((bandno + 1) & 2)) {
-                            Jpeg2KResLevel *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);


I know, I know I will send a patch for that. I'll do that when all this stuff is done.

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to