mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
get_xbits() optimization
Originally committed as revision 5257 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
ad8812be8f
commit
6b250e4725
@ -574,21 +574,15 @@ static inline int get_bits_count(GetBitContext *s){
|
|||||||
* @author BERO
|
* @author BERO
|
||||||
*/
|
*/
|
||||||
static inline int get_xbits(GetBitContext *s, int n){
|
static inline int get_xbits(GetBitContext *s, int n){
|
||||||
register int tmp;
|
register int sign;
|
||||||
register int32_t cache;
|
register int32_t cache;
|
||||||
OPEN_READER(re, s)
|
OPEN_READER(re, s)
|
||||||
UPDATE_CACHE(re, s)
|
UPDATE_CACHE(re, s)
|
||||||
cache = GET_CACHE(re,s);
|
cache = GET_CACHE(re,s);
|
||||||
if ((int32_t)cache<0) { //MSB=1
|
sign=(~cache)>>31;
|
||||||
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);
|
|
||||||
}
|
|
||||||
LAST_SKIP_BITS(re, s, n)
|
LAST_SKIP_BITS(re, s, n)
|
||||||
CLOSE_READER(re, s)
|
CLOSE_READER(re, s)
|
||||||
return tmp;
|
return (NEG_USR32(sign ^ cache, n) ^ sign) - sign;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int get_sbits(GetBitContext *s, int n){
|
static inline int get_sbits(GetBitContext *s, int n){
|
||||||
|
Loading…
Reference in New Issue
Block a user