summaryrefslogtreecommitdiff
path: root/apps/codecs/libwma/bitstream.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libwma/bitstream.c')
-rw-r--r--apps/codecs/libwma/bitstream.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/apps/codecs/libwma/bitstream.c b/apps/codecs/libwma/bitstream.c
index bce7ee2ae6..78b078adc7 100644
--- a/apps/codecs/libwma/bitstream.c
+++ b/apps/codecs/libwma/bitstream.c
@@ -119,8 +119,7 @@ static int build_table(VLC *vlc, int table_nb_bits,
119 const void *codes, int codes_wrap, int codes_size, 119 const void *codes, int codes_wrap, int codes_size,
120 uint32_t code_prefix, int n_prefix) 120 uint32_t code_prefix, int n_prefix)
121{ 121{
122 int i, j, k, n, table_size, table_index, nb, n1, index; 122 int i, j, k, n, table_size, table_index, nb, n1, index, code_prefix2;
123 uint32_t code_prefix2;
124 uint32_t code; 123 uint32_t code;
125 int flags = 0; 124 int flags = 0;
126 VLC_TYPE (*table)[2]; 125 VLC_TYPE (*table)[2];
@@ -153,10 +152,10 @@ static int build_table(VLC *vlc, int table_nb_bits,
153 /* if code matches the prefix, it is in the table */ 152 /* if code matches the prefix, it is in the table */
154 n -= n_prefix; 153 n -= n_prefix;
155 if(flags & INIT_VLC_LE) 154 if(flags & INIT_VLC_LE)
156 code_prefix2= code & (n_prefix>=32 ? 0xffffffff : (uint32_t)( (1 << n_prefix)-1)); 155 code_prefix2= code & (n_prefix>=32 ? 0xffffffff : (uint32_t)(1 << n_prefix)-1);
157 else 156 else
158 code_prefix2= code >> n; 157 code_prefix2= code >> n;
159 if (n > 0 && code_prefix2 == code_prefix) { 158 if (n > 0 && (int)code_prefix2 == code_prefix) {
160 if (n <= table_nb_bits) { 159 if (n <= table_nb_bits) {
161 /* no need to add another table */ 160 /* no need to add another table */
162 j = (code << (table_nb_bits - n)) & (table_size - 1); 161 j = (code << (table_nb_bits - n)) & (table_size - 1);
@@ -165,11 +164,10 @@ static int build_table(VLC *vlc, int table_nb_bits,
165 if(flags & INIT_VLC_LE) 164 if(flags & INIT_VLC_LE)
166 j = (code >> n_prefix) + (k<<n); 165 j = (code >> n_prefix) + (k<<n);
167#ifdef DEBUG_VLC 166#ifdef DEBUG_VLC
168 av_log(NULL, AV_LOG_DEBUG, "%4x: code=%d n=%d\n", 167 av_log(NULL, 0, "%4x: code=%d n=%d\n",
169 j, i, n); 168 j, i, n);
170#endif 169#endif
171 if (table[j][1] /*bits*/ != 0) { 170 if (table[j][1] /*bits*/ != 0) {
172 // av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
173 return -1; 171 return -1;
174 } 172 }
175 table[j][1] = n; //bits 173 table[j][1] = n; //bits
@@ -180,7 +178,7 @@ static int build_table(VLC *vlc, int table_nb_bits,
180 n -= table_nb_bits; 178 n -= table_nb_bits;
181 j = (code >> ((flags & INIT_VLC_LE) ? n_prefix : n)) & ((1 << table_nb_bits) - 1); 179 j = (code >> ((flags & INIT_VLC_LE) ? n_prefix : n)) & ((1 << table_nb_bits) - 1);
182#ifdef DEBUG_VLC 180#ifdef DEBUG_VLC
183 printf("%4x: n=%d (subtable)\n", 181 av_log(NULL, 0,"%4x: n=%d (subtable)\n",
184 j, n); 182 j, n);
185#endif 183#endif
186 /* compute table size */ 184 /* compute table size */
@@ -267,9 +265,4 @@ int init_vlc(VLC *vlc, int nb_bits, int nb_codes,
267 return flags; 265 return flags;
268} 266}
269 267
270/* 268
271void free_vlc(VLC *vlc)
272{
273 av_free(vlc->table);
274}
275*/