comparison get_bits.h @ 11240:74f7086f532a libavcodec

get/show_bits() can read up to MIN_CACHE_BITS bits The limit for get/show_bits_long() to use get/show_bits() directly should be MIN_CACHE_BITS, not 17.
author mru
date Sun, 21 Feb 2010 23:28:24 +0000
parents 5401fc245167
children 7dd2a45249a9
comparison
equal deleted inserted replaced
11239:af94d2ee8831 11240:74f7086f532a
420 420
421 /** 421 /**
422 * reads 0-32 bits. 422 * reads 0-32 bits.
423 */ 423 */
424 static inline unsigned int get_bits_long(GetBitContext *s, int n){ 424 static inline unsigned int get_bits_long(GetBitContext *s, int n){
425 if(n<=17) return get_bits(s, n); 425 if(n<=MIN_CACHE_BITS) return get_bits(s, n);
426 else{ 426 else{
427 #ifdef ALT_BITSTREAM_READER_LE 427 #ifdef ALT_BITSTREAM_READER_LE
428 int ret= get_bits(s, 16); 428 int ret= get_bits(s, 16);
429 return ret | (get_bits(s, n-16) << 16); 429 return ret | (get_bits(s, n-16) << 16);
430 #else 430 #else
443 443
444 /** 444 /**
445 * shows 0-32 bits. 445 * shows 0-32 bits.
446 */ 446 */
447 static inline unsigned int show_bits_long(GetBitContext *s, int n){ 447 static inline unsigned int show_bits_long(GetBitContext *s, int n){
448 if(n<=17) return show_bits(s, n); 448 if(n<=MIN_CACHE_BITS) return show_bits(s, n);
449 else{ 449 else{
450 GetBitContext gb= *s; 450 GetBitContext gb= *s;
451 return get_bits_long(&gb, n); 451 return get_bits_long(&gb, n);
452 } 452 }
453 } 453 }