# HG changeset patch # User michael # Date 1208401208 0 # Node ID 2dc587201e38e738735aded6206f4d45a4c3bfcf # Parent 2d007f504886cf02a8f53093bc1bdaa4e124b42c 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. diff -r 2d007f504886 -r 2dc587201e38 alac.c --- a/alac.c Thu Apr 17 02:40:50 2008 +0000 +++ b/alac.c Thu Apr 17 03:00:08 2008 +0000 @@ -226,18 +226,20 @@ k = count_leading_zeros(history) + ((history + 16) >> 6 /* / 64 */) - 24; - extrabits = show_bits(&alac->gb, k); + if (k >= rice_kmodifier) + k = rice_kmodifier; - block_size = (((1 << k) - 1) & rice_kmodifier_mask) * x - + extrabits - 1; + x = (x << k) - x; + + extrabits = show_bits(&alac->gb, k); if (extrabits < 2) { - x = 1 - extrabits; - block_size += x; skip_bits(&alac->gb, k - 1); } else { + x += extrabits - 1; skip_bits(&alac->gb, k); } + block_size = x; } if (block_size > 0) {