avcodec/jpeg2000dec: Improve end check
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 16 Jun 2015 16:34:20 +0000 (18:34 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 16 Jun 2015 16:34:20 +0000 (18:34 +0200)
Fixes spurious end mismatch warnings

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/jpeg2000dec.c

index 6c86cb3..8eba2a3 100644 (file)
@@ -1404,8 +1404,9 @@ static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,
         pass_cnt ++;
     }
 
-    if (cblk->data + cblk->length != t1->mqc.bp) {
-        av_log(s->avctx, AV_LOG_WARNING, "End mismatch %"PTRDIFF_SPECIFIER"\n", cblk->data + cblk->length - t1->mqc.bp);
+    if (cblk->data + cblk->length - 2*(term_cnt < cblk->nb_terminations) != t1->mqc.bp) {
+        av_log(s->avctx, AV_LOG_WARNING, "End mismatch %"PTRDIFF_SPECIFIER"\n",
+               cblk->data + cblk->length - 2*(term_cnt < cblk->nb_terminations) - t1->mqc.bp);
     }
 
     return 0;