Commit 74c5ce21 authored by michael's avatar michael

get_xbits() optimization


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@5257 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent d942f053
......@@ -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){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment