changeset 535:7f1b09bb34c6 libavcodec

dont trash table in GET_VLC
author michaelni
date Thu, 11 Jul 2002 12:42:20 +0000
parents 56784e066e09
children 6fac683d9997
files common.c common.h
diffstat 2 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/common.c	Wed Jul 10 22:06:04 2002 +0000
+++ b/common.c	Thu Jul 11 12:42:20 2002 +0000
@@ -286,7 +286,7 @@
                 return -1;
             /* note: realloc has been done, so reload tables */
             table = &vlc->table[table_index];
-            table[i][0] = index - table_index; //code
+            table[i][0] = index; //code
         }
     }
     return table_index;
--- a/common.h	Wed Jul 10 22:06:04 2002 +0000
+++ b/common.h	Thu Jul 11 12:42:20 2002 +0000
@@ -724,7 +724,6 @@
              const void *codes, int codes_wrap, int codes_size);
 void free_vlc(VLC *vlc);
 
-//note table will be trashed (pointer increased)
 #define GET_VLC(code, name, gb, table, bits, max_depth)\
 {\
     int n, index, nb_bits;\
@@ -738,9 +737,8 @@
         UPDATE_CACHE(name, gb)\
 \
         nb_bits = -n;\
-        table += code;\
 \
-        index= SHOW_UBITS(name, gb, nb_bits);\
+        index= SHOW_UBITS(name, gb, nb_bits) + code;\
         code = table[index][0];\
         n    = table[index][1];\
         if(max_depth > 2 && n < 0){\
@@ -748,9 +746,8 @@
             UPDATE_CACHE(name, gb)\
 \
             nb_bits = -n;\
-            table += code;\
 \
-            index= SHOW_UBITS(name, gb, nb_bits);\
+            index= SHOW_UBITS(name, gb, nb_bits) + code;\
             code = table[index][0];\
             n    = table[index][1];\
         }\