diff options
author | Arpi <arpi@thot.banki.hu> | 2001-08-04 00:46:50 +0000 |
---|---|---|
committer | Arpi <arpi@thot.banki.hu> | 2001-08-04 00:46:50 +0000 |
commit | 612476ef9b9a008e1f8703cd592d40377f6b1ebf (patch) | |
tree | b5901b5c45b9806f05767e7d8fd4663518091e99 /libavcodec/common.h | |
parent | 2931ecb90f5518361460805a6b7fbc9690d364cc (diff) | |
download | ffmpeg-612476ef9b9a008e1f8703cd592d40377f6b1ebf.tar.gz |
get_bits() specialization, gives 4\speedup
Originally committed as revision 32 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/common.h')
-rw-r--r-- | libavcodec/common.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/libavcodec/common.h b/libavcodec/common.h index 90af1e3df9..75908245c0 100644 --- a/libavcodec/common.h +++ b/libavcodec/common.h @@ -80,6 +80,47 @@ static inline unsigned int get_bits(GetBitContext *s, int n){ return get_bits_long(s,n); } +static inline unsigned int get_bits1(GetBitContext *s){ + if(s->bit_cnt>0){ + /* most common case here */ + unsigned int val = s->bit_buf >> 31; + s->bit_buf <<= 1; + s->bit_cnt--; +#ifdef STATS + st_bit_counts[st_current_index]++; +#endif + return val; + } + return get_bits_long(s,1); +} + +static inline void skip_bits(GetBitContext *s, int n){ + if(s->bit_cnt>=n){ + /* most common case here */ + s->bit_buf <<= n; + s->bit_cnt -= n; +#ifdef STATS + st_bit_counts[st_current_index] += n; +#endif + } else { + get_bits_long(s,n); + } +} + +static inline void skip_bits1(GetBitContext *s){ + if(s->bit_cnt>0){ + /* most common case here */ + s->bit_buf <<= 1; + s->bit_cnt--; +#ifdef STATS + st_bit_counts[st_current_index]++; +#endif + } else { + get_bits_long(s,1); + } +} + + void align_get_bits(GetBitContext *s); int init_vlc(VLC *vlc, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, |