Mercurial > libavcodec.hg
comparison bitstream.c @ 5013:c7904664624c libavcodec
printf --> av_log, patch by Denis Fortin, fortin nerim net
author | diego |
---|---|
date | Wed, 16 May 2007 12:57:27 +0000 |
parents | beeb03aad909 |
children | 0d503c12092b |
comparison
equal
deleted
inserted
replaced
5012:3769553b95a2 | 5013:c7904664624c |
---|---|
111 VLC_TYPE (*table)[2]; | 111 VLC_TYPE (*table)[2]; |
112 | 112 |
113 table_size = 1 << table_nb_bits; | 113 table_size = 1 << table_nb_bits; |
114 table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_STATIC); | 114 table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_STATIC); |
115 #ifdef DEBUG_VLC | 115 #ifdef DEBUG_VLC |
116 printf("new table index=%d size=%d code_prefix=%x n=%d\n", | 116 av_log(NULL,AV_LOG_DEBUG,"new table index=%d size=%d code_prefix=%x n=%d\n", |
117 table_index, table_size, code_prefix, n_prefix); | 117 table_index, table_size, code_prefix, n_prefix); |
118 #endif | 118 #endif |
119 if (table_index < 0) | 119 if (table_index < 0) |
120 return -1; | 120 return -1; |
121 table = &vlc->table[table_index]; | 121 table = &vlc->table[table_index]; |
131 GET_DATA(code, codes, i, codes_wrap, codes_size); | 131 GET_DATA(code, codes, i, codes_wrap, codes_size); |
132 /* we accept tables with holes */ | 132 /* we accept tables with holes */ |
133 if (n <= 0) | 133 if (n <= 0) |
134 continue; | 134 continue; |
135 #if defined(DEBUG_VLC) && 0 | 135 #if defined(DEBUG_VLC) && 0 |
136 printf("i=%d n=%d code=0x%x\n", i, n, code); | 136 av_log(NULL,AV_LOG_DEBUG,"i=%d n=%d code=0x%x\n", i, n, code); |
137 #endif | 137 #endif |
138 /* if code matches the prefix, it is in the table */ | 138 /* if code matches the prefix, it is in the table */ |
139 n -= n_prefix; | 139 n -= n_prefix; |
140 if(flags & INIT_VLC_LE) | 140 if(flags & INIT_VLC_LE) |
141 code_prefix2= code & (n_prefix>=32 ? 0xffffffff : (1 << n_prefix)-1); | 141 code_prefix2= code & (n_prefix>=32 ? 0xffffffff : (1 << n_prefix)-1); |
163 } | 163 } |
164 } else { | 164 } else { |
165 n -= table_nb_bits; | 165 n -= table_nb_bits; |
166 j = (code >> ((flags & INIT_VLC_LE) ? n_prefix : n)) & ((1 << table_nb_bits) - 1); | 166 j = (code >> ((flags & INIT_VLC_LE) ? n_prefix : n)) & ((1 << table_nb_bits) - 1); |
167 #ifdef DEBUG_VLC | 167 #ifdef DEBUG_VLC |
168 printf("%4x: n=%d (subtable)\n", | 168 av_log(NULL,AV_LOG_DEBUG,"%4x: n=%d (subtable)\n", |
169 j, n); | 169 j, n); |
170 #endif | 170 #endif |
171 /* compute table size */ | 171 /* compute table size */ |
172 n1 = -table[j][1]; //bits | 172 n1 = -table[j][1]; //bits |
173 if (n > n1) | 173 if (n > n1) |
242 if(vlc->table) | 242 if(vlc->table) |
243 return 0; | 243 return 0; |
244 } | 244 } |
245 | 245 |
246 #ifdef DEBUG_VLC | 246 #ifdef DEBUG_VLC |
247 printf("build table nb_codes=%d\n", nb_codes); | 247 av_log(NULL,AV_LOG_DEBUG,"build table nb_codes=%d\n", nb_codes); |
248 #endif | 248 #endif |
249 | 249 |
250 if (build_table(vlc, nb_bits, nb_codes, | 250 if (build_table(vlc, nb_bits, nb_codes, |
251 bits, bits_wrap, bits_size, | 251 bits, bits_wrap, bits_size, |
252 codes, codes_wrap, codes_size, | 252 codes, codes_wrap, codes_size, |