1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-10-03 17:29:30 +02:00

avoid hard to predict branch (idea by arpi)

Originally committed as revision 5252 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2006-03-31 16:50:43 +00:00
parent 9296d45d29
commit ac2549b583

View File

@ -1288,11 +1288,10 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
code &= 0xf; code &= 0xf;
UPDATE_CACHE(re, &s->gb) UPDATE_CACHE(re, &s->gb)
{
if ((int32_t)GET_CACHE(re,&s->gb)<0) { //MSB=1 int cache=GET_CACHE(re,gb);
level = NEG_USR32( GET_CACHE(re,&s->gb),code); int sign=(~cache)>>31;
} else { level = (NEG_USR32(sign ^ cache,code) ^ sign) + (sign&1) ;
level = - NEG_USR32(~GET_CACHE(re,&s->gb),code);
} }
LAST_SKIP_BITS(re, &s->gb, code) LAST_SKIP_BITS(re, &s->gb, code)