Mercurial > libavcodec.hg
comparison alac.c @ 6624:2dc587201e38 libavcodec
Change k limiting code, i think the code was buggy.
If you have ALAC files TEST them! Mine produce the same md5 but the new
code is not identical if limiting does happen.
author | michael |
---|---|
date | Thu, 17 Apr 2008 03:00:08 +0000 |
parents | 2d007f504886 |
children | 1f4a86db7835 |
comparison
equal
deleted
inserted
replaced
6623:2d007f504886 | 6624:2dc587201e38 |
---|---|
224 int k; | 224 int k; |
225 int extrabits; | 225 int extrabits; |
226 | 226 |
227 k = count_leading_zeros(history) + ((history + 16) >> 6 /* / 64 */) - 24; | 227 k = count_leading_zeros(history) + ((history + 16) >> 6 /* / 64 */) - 24; |
228 | 228 |
229 if (k >= rice_kmodifier) | |
230 k = rice_kmodifier; | |
231 | |
232 x = (x << k) - x; | |
233 | |
229 extrabits = show_bits(&alac->gb, k); | 234 extrabits = show_bits(&alac->gb, k); |
230 | 235 |
231 block_size = (((1 << k) - 1) & rice_kmodifier_mask) * x | |
232 + extrabits - 1; | |
233 | |
234 if (extrabits < 2) { | 236 if (extrabits < 2) { |
235 x = 1 - extrabits; | |
236 block_size += x; | |
237 skip_bits(&alac->gb, k - 1); | 237 skip_bits(&alac->gb, k - 1); |
238 } else { | 238 } else { |
239 x += extrabits - 1; | |
239 skip_bits(&alac->gb, k); | 240 skip_bits(&alac->gb, k); |
240 } | 241 } |
242 block_size = x; | |
241 } | 243 } |
242 | 244 |
243 if (block_size > 0) { | 245 if (block_size > 0) { |
244 memset(&output_buffer[output_count+1], 0, block_size * 4); | 246 memset(&output_buffer[output_count+1], 0, block_size * 4); |
245 output_count += block_size; | 247 output_count += block_size; |