[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec bitstream.h,1.159,1.160

Michael Niedermayer CVS michael
Fri Mar 31 22:40:24 CEST 2006


Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv29973

Modified Files:
	bitstream.h 
Log Message:
get_xbits() optimization


Index: bitstream.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/bitstream.h,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- bitstream.h	8 Jan 2006 21:19:39 -0000	1.159
+++ bitstream.h	31 Mar 2006 20:40:22 -0000	1.160
@@ -574,21 +574,15 @@
  * @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){





More information about the ffmpeg-cvslog mailing list