]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Fix get_ur_golomb_jpegls() with A32_BITSTREAM_READER
authormru <mru@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Tue, 24 Feb 2009 01:41:44 +0000 (01:41 +0000)
committermru <mru@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Tue, 24 Feb 2009 01:41:44 +0000 (01:41 +0000)
If k==0, log==0 can indicate that the coded value uses more than
MIN_CACHE_BITS bits.  With MIN_CACHE_BITS==32, the fast branch is
incorrectly taken in this case unless explicitly forbidden.

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@17550 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/golomb.h

index 989a87a88e596b63dd6835e15c3e44afe78532f6..59b4f9eca072b65f95cf463738d69ec76b49d9f8 100644 (file)
@@ -273,7 +273,7 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int
 
     log= av_log2(buf);
 
-    if(log - k >= 32-MIN_CACHE_BITS && 32-log < limit){
+    if(log - k >= 32-MIN_CACHE_BITS+(MIN_CACHE_BITS==32) && 32-log < limit){
         buf >>= log - k;
         buf += (30-log)<<k;
         LAST_SKIP_BITS(re, gb, 32 + k - log);