comparison bitstream.c @ 4685:2c8f88e7397a libavcodec

fix init_vlc() with nonzero flags
author mru
date Sun, 18 Mar 2007 22:32:39 +0000
parents aab60ff3d468
children beeb03aad909
comparison
equal deleted inserted replaced
4684:6ec0afffc572 4685:2c8f88e7397a
225 with av_free_static(), 0 if free_vlc() will be used. 225 with av_free_static(), 0 if free_vlc() will be used.
226 */ 226 */
227 int init_vlc(VLC *vlc, int nb_bits, int nb_codes, 227 int init_vlc(VLC *vlc, int nb_bits, int nb_codes,
228 const void *bits, int bits_wrap, int bits_size, 228 const void *bits, int bits_wrap, int bits_size,
229 const void *codes, int codes_wrap, int codes_size, 229 const void *codes, int codes_wrap, int codes_size,
230 int use_static) 230 int flags)
231 { 231 {
232 vlc->bits = nb_bits; 232 vlc->bits = nb_bits;
233 if(!use_static) { 233 if(!(flags & INIT_VLC_USE_STATIC)) {
234 vlc->table = NULL; 234 vlc->table = NULL;
235 vlc->table_allocated = 0; 235 vlc->table_allocated = 0;
236 vlc->table_size = 0; 236 vlc->table_size = 0;
237 } else { 237 } else {
238 /* Static tables are initially always NULL, return 238 /* Static tables are initially always NULL, return
246 #endif 246 #endif
247 247
248 if (build_table(vlc, nb_bits, nb_codes, 248 if (build_table(vlc, nb_bits, nb_codes,
249 bits, bits_wrap, bits_size, 249 bits, bits_wrap, bits_size,
250 codes, codes_wrap, codes_size, 250 codes, codes_wrap, codes_size,
251 0, 0, use_static) < 0) { 251 0, 0, flags) < 0) {
252 av_free(vlc->table); 252 av_free(vlc->table);
253 return -1; 253 return -1;
254 } 254 }
255 return 0; 255 return 0;
256 } 256 }