avcodec/jpeg2000dec: Omit mqc reinit after the last pass
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 15 Jun 2015 18:29:32 +0000 (20:29 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 15 Jun 2015 18:49:04 +0000 (20:49 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/jpeg2000dec.c

index 61e4dfd..a2862bd 100644 (file)
@@ -1388,8 +1388,8 @@ static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,
         if (codsty->cblk_style & JPEG2000_CBLK_RESET) // XXX no testcase for just this
             ff_mqc_init_contexts(&t1->mqc);
 
-        if ((coder_type = needs_termination(codsty->cblk_style, pass_cnt))) {
-            if (term_cnt >= cblk->nb_terminations) {
+        if (passno && (coder_type = needs_termination(codsty->cblk_style, pass_cnt))) {
+            if (term_cnt > cblk->nb_terminations) {
                 av_log(s->avctx, AV_LOG_ERROR, "Missing needed termination \n");
                 return AVERROR_INVALIDDATA;
             }