[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec mjpeg.c,1.122,1.123

Arpi arpi
Fri Mar 31 18:26:24 CEST 2006


Hi,

> optimizations by arpi

> +
> +            if ((int32_t)GET_CACHE(re,&s->gb)<0) { //MSB=1
> +                level =   NEG_USR32( GET_CACHE(re,&s->gb),code);
> +            } else {
> +                level = - NEG_USR32(~GET_CACHE(re,&s->gb),code);
> +            }
> +

i've found this ~10% faster:

	int cache=GET_CACHE(re,gb);
	int sign=(~cache)>>31;
	level = (NEG_USR32(sign ^ cache,code) ^ sign) + (sign&1) ;

it does the same thing but avoids if().
(test decoding time reduced from 24ms to 21ms by this change)

A'rpi




More information about the ffmpeg-cvslog mailing list