[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec mjpeg.c,1.127,1.128
Michael Niedermayer CVS
michael
Fri Mar 31 18:50:46 CEST 2006
Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv14050
Modified Files:
mjpeg.c
Log Message:
avoid hard to predict branch (idea by arpi)
Index: mjpeg.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/mjpeg.c,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- mjpeg.c 29 Mar 2006 21:11:57 -0000 1.127
+++ mjpeg.c 31 Mar 2006 16:50:43 -0000 1.128
@@ -1288,11 +1288,10 @@
code &= 0xf;
UPDATE_CACHE(re, &s->gb)
-
- 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);
+ {
+ int cache=GET_CACHE(re,gb);
+ int sign=(~cache)>>31;
+ level = (NEG_USR32(sign ^ cache,code) ^ sign) + (sign&1) ;
}
LAST_SKIP_BITS(re, &s->gb, code)
More information about the ffmpeg-cvslog
mailing list