do UPDATE_CACHE only when needed (which should be VERY rare)
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 31 Mar 2006 17:43:28 +0000 (17:43 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 31 Mar 2006 17:43:28 +0000 (17:43 +0000)
Originally committed as revision 5254 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/mjpeg.c

index 8c90022..2fc870a 100644 (file)
@@ -1286,8 +1286,9 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
         } else {
             i += ((unsigned)code) >> 4;
             code &= 0xf;
-
-            UPDATE_CACHE(re, &s->gb)
+            if(code > MIN_CACHE_BITS - 16){
+                UPDATE_CACHE(re, &s->gb)
+            }
             {
                 int cache=GET_CACHE(re,gb);
                 int sign=(~cache)>>31;