Mercurial > libavcodec.hg
diff common.h @ 1257:6defe392d5d2 libavcodec
libmpeg2 style bitstream reader fixes
author | michaelni |
---|---|
date | Wed, 14 May 2003 10:55:59 +0000 |
parents | 604661d34c68 |
children | 362947395f5c |
line wrap: on
line diff
--- a/common.h Wed May 14 10:54:25 2003 +0000 +++ b/common.h Wed May 14 10:55:59 2003 +0000 @@ -543,8 +543,8 @@ # define UPDATE_CACHE(name, gb)\ if(name##_bit_count >= 0){\ - name##_cache+= (int)be2me_16(*(uint16_t*)name##_buffer_ptr++) << name##_bit_count;\ - name##_buffer_ptr+=2;\ + name##_cache+= (int)be2me_16(*(uint16_t*)name##_buffer_ptr) << name##_bit_count;\ + ((uint16_t*)name##_buffer_ptr)++;\ name##_bit_count-= 16;\ }\ @@ -654,9 +654,12 @@ #endif -/* add BERO - if MSB not set it is negative -*/ +/** + * read mpeg1 dc style vlc (sign bit + mantisse with no MSB). + * if MSB not set it is negative + * @param n length in bits + * @author BERO + */ static inline int get_xbits(GetBitContext *s, int n){ register int tmp; register int32_t cache; @@ -685,6 +688,10 @@ return tmp; } +/** + * reads 0-17 bits. + * Note, the alt bitstream reader can read upto 25 bits, but the libmpeg2 reader cant + */ static inline unsigned int get_bits(GetBitContext *s, int n){ register int tmp; OPEN_READER(re, s) @@ -695,6 +702,12 @@ return tmp; } +unsigned int get_bits_long(GetBitContext *s, int n); + +/** + * shows 0-17 bits. + * Note, the alt bitstream reader can read upto 25 bits, but the libmpeg2 reader cant + */ static inline unsigned int show_bits(GetBitContext *s, int n){ register int tmp; OPEN_READER(re, s) @@ -704,6 +717,8 @@ return tmp; } +unsigned int show_bits_long(GetBitContext *s, int n); + static inline void skip_bits(GetBitContext *s, int n){ //Note gcc seems to optimize this to s->index+=n for the ALT_READER :)) OPEN_READER(re, s)