Until a noticeably distorted output or crash is reported, it's better
ignoring the "error", as this results in better output on the affected
samples. (ticket #3886)

On the other hand, I have a hard time understanding the purpose of
that check. I would have expected maybe "get_bits_count(&q->gb) <
cw_len", but the next parsing step, inverse_quant_coeff, does not even
check what's left.

-- 
Christophe
From 90b5642bd53b24f66f1c36c070b4c490dd72a6cf Mon Sep 17 00:00:00 2001
From: Christophe Gisquet <christophe.gisq...@gmail.com>
Date: Wed, 3 Dec 2014 23:52:52 +0100
Subject: [PATCH] imc: make issue non-fatal

The "faulty" samples actually sound fine when ignoring this issue.

For ticket #3886, more samples are decoded.
---
 libavcodec/imc.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index 6c9ffd7..0d7c97b 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -790,7 +790,8 @@ static int inverse_quant_coeff(IMCContext *q, IMCChannel *chctx,
 }
 
 
-static int imc_get_coeffs(IMCContext *q, IMCChannel *chctx)
+static void imc_get_coeffs(AVCodecContext *avctx,
+                           IMCContext *q, IMCChannel *chctx)
 {
     int i, j, cw_len, cw;
 
@@ -803,8 +804,9 @@ static int imc_get_coeffs(IMCContext *q, IMCChannel *chctx)
                 cw = 0;
 
                 if (get_bits_count(&q->gb) + cw_len > 512) {
-                    av_dlog(NULL, "Band %i coeff %i cw_len %i\n", i, j, cw_len);
-                    return AVERROR_INVALIDDATA;
+                    av_log(avctx, AV_LOG_WARNING,
+                           "Potential problem on band %i, coefficient %i"
+                           ": cw_len=%i\n", i, j, cw_len);
                 }
 
                 if (cw_len && (!chctx->bandFlagsBuf[i] || !chctx->skipFlags[j]))
@@ -814,7 +816,6 @@ static int imc_get_coeffs(IMCContext *q, IMCChannel *chctx)
             }
         }
     }
-    return 0;
 }
 
 static void imc_refine_bit_allocation(IMCContext *q, IMCChannel *chctx)
@@ -995,11 +996,7 @@ static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch)
 
     memset(chctx->codewords, 0, sizeof(chctx->codewords));
 
-    if (imc_get_coeffs(q, chctx) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "Read coefficients failed\n");
-        chctx->decoder_reset = 1;
-        return AVERROR_INVALIDDATA;
-    }
+    imc_get_coeffs(avctx, q, chctx);
 
     if (inverse_quant_coeff(q, chctx, stream_format_code) < 0) {
         av_log(avctx, AV_LOG_ERROR, "Inverse quantization of coefficients failed\n");
-- 
1.9.2.msysgit.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to