diff mpegaudiodec.c @ 192:1e5f64be86fc libavcodec

another bitstream reader code (faster on intel cpus) - patch by Michael Niedermayer <michaelni@gmx.at>
author uid46427
date Thu, 10 Jan 2002 00:56:05 +0000
parents 35e3ced6cfd9
children a0124152c89d
line wrap: on
line diff
--- a/mpegaudiodec.c	Thu Jan 10 00:53:21 2002 +0000
+++ b/mpegaudiodec.c	Thu Jan 10 00:56:05 2002 +0000
@@ -1371,7 +1371,11 @@
     UINT8 *ptr;
 
     /* compute current position in stream */
+#ifdef ALT_BITSTREAM_READER
+    ptr = s->gb.buffer + (s->gb.index>>3);
+#else
     ptr = s->gb.buf_ptr - (s->gb.bit_cnt >> 3);
+#endif    
     /* copy old data before current one */
     ptr -= backstep;
     memcpy(ptr, s->inbuf1[s->inbuf_index ^ 1] + 
@@ -1528,15 +1532,25 @@
                 /* some encoders generate an incorrect size for this
                    part. We must go back into the data */
                 s_index -= 4;
+#ifdef ALT_BITSTREAM_READER
+                s->gb.buffer = last_buf_ptr;
+                s->gb.index = last_bit_cnt;
+#else
                 s->gb.buf_ptr = last_buf_ptr;
                 s->gb.bit_buf = last_bit_buf;
                 s->gb.bit_cnt = last_bit_cnt;
+#endif            
             }
             break;
         }
+#ifdef ALT_BITSTREAM_READER
+        last_buf_ptr = s->gb.buffer;
+        last_bit_cnt = s->gb.index;
+#else
         last_buf_ptr = s->gb.buf_ptr;
         last_bit_buf = s->gb.bit_buf;
         last_bit_cnt = s->gb.bit_cnt;
+#endif
         
         code = get_vlc(&s->gb, vlc);
         dprintf("t=%d code=%d\n", g->count1table_select, code);