diff common.c @ 20:907b67420d84 libavcodec

inlineing common case of get_bits() -> gives 2speedup. more optim coming soon...
author arpi_esp
date Fri, 03 Aug 2001 23:09:15 +0000
parents 1b4461b5a7fb
children 08265a63313e
line wrap: on
line diff
--- a/common.c	Fri Aug 03 18:33:03 2001 +0000
+++ b/common.c	Fri Aug 03 23:09:15 2001 +0000
@@ -199,26 +199,26 @@
 }
 
 /* n must be >= 1 and <= 32 */
-unsigned int get_bits(GetBitContext *s, int n)
+/* also true: n > s->bit_cnt */
+unsigned int get_bits_long(GetBitContext *s, int n)
 {
     unsigned int val;
     int bit_cnt;
     unsigned int bit_buf;
-    UINT8 *buf_ptr;
 
 #ifdef STATS
     st_bit_counts[st_current_index] += n;
 #endif
 
-    bit_cnt = s->bit_cnt;
     bit_buf = s->bit_buf;
+    bit_cnt = s->bit_cnt - n;
     
-    bit_cnt -= n;
-    if (bit_cnt >= 0) {
-        /* most common case here */
-        val = bit_buf >> (32 - n);
-        bit_buf <<= n; 
-    } else {
+//    if (bit_cnt >= 0) {
+//        val = bit_buf >> (32 - n);
+//        bit_buf <<= n; 
+//    } else 
+    {
+	UINT8 *buf_ptr;
         val = bit_buf >> (32 - n);
         buf_ptr = s->buf_ptr;
         buf_ptr += 4;