changeset 3612:9283f094680e libavcodec

dont copy the whole GetBitContext around
author michael
date Thu, 24 Aug 2006 06:57:32 +0000
parents a20d179c79c3
children 5cb45b2211a0
files mpegaudiodec.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mpegaudiodec.c	Thu Aug 24 01:12:26 2006 +0000
+++ b/mpegaudiodec.c	Thu Aug 24 06:57:32 2006 +0000
@@ -1671,7 +1671,7 @@
 {
     int s_index;
     int linbits, code, x, y, l, v, i, j, k, pos;
-    GetBitContext last_gb;
+    int last_pos;
     VLC *vlc;
 
     /* low frequencies (called big values) */
@@ -1735,19 +1735,20 @@
 
     /* high frequencies */
     vlc = &huff_quad_vlc[g->count1table_select];
-    last_gb.buffer = NULL;
+    last_pos=0;
     while (s_index <= 572) {
         pos = get_bits_count(&s->gb);
         if (pos >= end_pos) {
-            if (pos > end_pos && last_gb.buffer != NULL) {
+            if (pos > end_pos && last_pos){
                 /* some encoders generate an incorrect size for this
                    part. We must go back into the data */
                 s_index -= 4;
-                s->gb = last_gb;
+                init_get_bits(&s->gb, s->gb.buffer + (last_pos>>3), s->gb.size_in_bits - (last_pos&(~7)));
+                skip_bits(&s->gb, last_pos&7);
             }
             break;
         }
-        last_gb= s->gb;
+        last_pos= pos;
 
         code = get_vlc2(&s->gb, vlc->table, vlc->bits, 1);
         dprintf("t=%d code=%d\n", g->count1table_select, code);