]> granicus.if.org Git - openjpeg/commitdiff
Fix POC in multi-tile scenarios: avoid almost endless loop when a tile has no POC...
authorEven Rouault <even.rouault@spatialys.com>
Wed, 24 Apr 2019 23:27:02 +0000 (01:27 +0200)
committerEven Rouault <even.rouault@spatialys.com>
Thu, 25 Apr 2019 12:40:56 +0000 (14:40 +0200)
src/lib/openjp2/j2k.c

index fcf62653eb77f19ecfea6343bc2e6732a3b5f151..a40ea05ac61a962f5495caf08ce4206e53d5b6d1 100644 (file)
@@ -1669,7 +1669,6 @@ static OPJ_BOOL opj_j2k_check_poc_val(const opj_poc_t *p_pocs,
 
             index += step_r;
         }
-
         ++p_pocs;
     }
 
@@ -7179,7 +7178,6 @@ OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k,
 
         if (parameters->numpocs) {
             /* initialisation of POC */
-            tcp->POC = 1;
             for (i = 0; i < parameters->numpocs; i++) {
                 if (tileno + 1 == parameters->POC[i].tile)  {
                     opj_poc_t *tcp_poc = &tcp->pocs[numpocs_tile];
@@ -7196,7 +7194,10 @@ OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k,
                 }
             }
 
-            tcp->numpocs = numpocs_tile - 1 ;
+            if (numpocs_tile) {
+                tcp->POC = 1;
+                tcp->numpocs = numpocs_tile - 1 ;
+            }
         } else {
             tcp->numpocs = 0;
         }