Mercurial > libavcodec.hg
changeset 3244:b9a0ca749833 libavcodec
get_xbits() optimization
author | michael |
---|---|
date | Fri, 31 Mar 2006 20:40:22 +0000 |
parents | 498543867d57 |
children | c2c29be6282e |
files | bitstream.h |
diffstat | 1 files changed, 3 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/bitstream.h Fri Mar 31 18:22:35 2006 +0000 +++ b/bitstream.h Fri Mar 31 20:40:22 2006 +0000 @@ -574,21 +574,15 @@ * @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){