Commit c733fe66 authored by michaelni's avatar michaelni

dont trash table in GET_VLC


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@741 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 304c8cbb
...@@ -286,7 +286,7 @@ static int build_table(VLC *vlc, int table_nb_bits, ...@@ -286,7 +286,7 @@ static int build_table(VLC *vlc, int table_nb_bits,
return -1; return -1;
/* note: realloc has been done, so reload tables */ /* note: realloc has been done, so reload tables */
table = &vlc->table[table_index]; table = &vlc->table[table_index];
table[i][0] = index - table_index; //code table[i][0] = index; //code
} }
} }
return table_index; return table_index;
......
...@@ -724,7 +724,6 @@ int init_vlc(VLC *vlc, int nb_bits, int nb_codes, ...@@ -724,7 +724,6 @@ int init_vlc(VLC *vlc, int nb_bits, int nb_codes,
const void *codes, int codes_wrap, int codes_size); const void *codes, int codes_wrap, int codes_size);
void free_vlc(VLC *vlc); void free_vlc(VLC *vlc);
//note table will be trashed (pointer increased)
#define GET_VLC(code, name, gb, table, bits, max_depth)\ #define GET_VLC(code, name, gb, table, bits, max_depth)\
{\ {\
int n, index, nb_bits;\ int n, index, nb_bits;\
...@@ -738,9 +737,8 @@ void free_vlc(VLC *vlc); ...@@ -738,9 +737,8 @@ void free_vlc(VLC *vlc);
UPDATE_CACHE(name, gb)\ UPDATE_CACHE(name, gb)\
\ \
nb_bits = -n;\ nb_bits = -n;\
table += code;\
\ \
index= SHOW_UBITS(name, gb, nb_bits);\ index= SHOW_UBITS(name, gb, nb_bits) + code;\
code = table[index][0];\ code = table[index][0];\
n = table[index][1];\ n = table[index][1];\
if(max_depth > 2 && n < 0){\ if(max_depth > 2 && n < 0){\
...@@ -748,9 +746,8 @@ void free_vlc(VLC *vlc); ...@@ -748,9 +746,8 @@ void free_vlc(VLC *vlc);
UPDATE_CACHE(name, gb)\ UPDATE_CACHE(name, gb)\
\ \
nb_bits = -n;\ nb_bits = -n;\
table += code;\
\ \
index= SHOW_UBITS(name, gb, nb_bits);\ index= SHOW_UBITS(name, gb, nb_bits) + code;\
code = table[index][0];\ code = table[index][0];\
n = table[index][1];\ n = table[index][1];\
}\ }\
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment