[FFmpeg-cvslog] avcodec/imc: only check remaining bits in case bits will be read

Michael Niedermayer git at videolan.org
Thu Dec 4 18:25:23 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Dec  4 18:17:17 2014 +0100| [cbf09545f250a4bd12c50c3a96fe481098ab2d49] | committer: Michael Niedermayer

avcodec/imc: only check remaining bits in case bits will be read

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

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

 libavcodec/imc.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index 0d7c97b..b367ccb 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -803,14 +803,15 @@ static void imc_get_coeffs(AVCodecContext *avctx,
                 cw_len = chctx->CWlengthT[j];
                 cw = 0;
 
-                if (get_bits_count(&q->gb) + cw_len > 512) {
-                    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])) {
+                    if (get_bits_count(&q->gb) + cw_len > 512) {
+                        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]))
                     cw = get_bits(&q->gb, cw_len);
+                }
 
                 chctx->codewords[j] = cw;
             }



More information about the ffmpeg-cvslog mailing list