[FFmpeg-cvslog] avcodec/jpeg2000dec: iterate over positions with the special cases from jpeg2000

Michael Niedermayer git at videolan.org
Fri Jun 26 12:25:31 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jun 26 04:26:05 2015 +0200| [50b77e364f0a8c94de523e1d5afcd2be0a9a0384] | committer: Michael Niedermayer

avcodec/jpeg2000dec: iterate over positions with the special cases from jpeg2000

The order in j2k is not the simple and logic one

Fixes Ticket4670

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=50b77e364f0a8c94de523e1d5afcd2be0a9a0384
---

 libavcodec/jpeg2000dec.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 7e1fc5e..4ba8bcf 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1163,9 +1163,8 @@ static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile
         step_x = 1<<step_x;
         step_y = 1<<step_y;
 
-        //FIXME we could iterate over less than the whole image
-        for (y = 0; y < s->height; y += step_y) {
-            for (x = 0; x < s->width; x += step_x) {
+        for (y = tile->coord[1][0]; y < tile->coord[1][1]; y = (y/step_y + 1)*step_y) {
+            for (x = tile->coord[0][0]; x < tile->coord[0][1]; x = (x/step_x + 1)*step_x) {
                 for (compno = 0; compno < s->ncomponents; compno++) {
                     Jpeg2000Component *comp     = tile->comp + compno;
                     Jpeg2000CodingStyle *codsty = tile->codsty + compno;
@@ -1178,10 +1177,10 @@ static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile
                         uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; //  ==> N_L - r
                         Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno;
 
-                        if (yc % (1 << (rlevel->log2_prec_height + reducedresno)))
+                        if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) //FIXME this is a subset of the check
                             continue;
 
-                        if (xc % (1 << (rlevel->log2_prec_width + reducedresno)))
+                        if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) //FIXME this is a subset of the check
                             continue;
 
                         // check if a precinct exists



More information about the ffmpeg-cvslog mailing list