diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2006-03-31 20:40:22 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2006-03-31 20:40:22 +0000 |
commit | 6b250e4725be795c5a4e282c5661b71b19cb3116 (patch) | |
tree | 9f18ad399a8946a799303e40e986cf4ecaaec50d /libavcodec | |
parent | ad8812be8fb790c1c29fa847b467dbb6c458e000 (diff) | |
download | ffmpeg-6b250e4725be795c5a4e282c5661b71b19cb3116.tar.gz |
get_xbits() optimization
Originally committed as revision 5257 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/bitstream.h | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/libavcodec/bitstream.h b/libavcodec/bitstream.h index 4a3d55d19b..b425049900 100644 --- a/libavcodec/bitstream.h +++ b/libavcodec/bitstream.h @@ -574,21 +574,15 @@ static inline int get_bits_count(GetBitContext *s){ * @author BERO */ static inline int get_xbits(GetBitContext *s, int n){ - register int tmp; + register int sign; register int32_t cache; OPEN_READER(re, s) UPDATE_CACHE(re, s) cache = GET_CACHE(re,s); - if ((int32_t)cache<0) { //MSB=1 - tmp = NEG_USR32(cache,n); - } else { - // tmp = (-1<<n) | NEG_USR32(cache,n) + 1; mpeg12.c algo - // tmp = - (NEG_USR32(cache,n) ^ ((1 << n) - 1)); h263.c algo - tmp = - NEG_USR32(~cache,n); - } + sign=(~cache)>>31; LAST_SKIP_BITS(re, s, n) CLOSE_READER(re, s) - return tmp; + return (NEG_USR32(sign ^ cache, n) ^ sign) - sign; } static inline int get_sbits(GetBitContext *s, int n){ |