Browse Source

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.

Originally committed as revision 12872 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/v0.5
Michael Niedermayer 17 years ago
parent
commit
c49c5e23dc
1 changed files with 7 additions and 5 deletions
  1. +7
    -5
      libavcodec/alac.c

+ 7
- 5
libavcodec/alac.c View File

@@ -226,18 +226,20 @@ static void bastardized_rice_decompress(ALACContext *alac,


k = count_leading_zeros(history) + ((history + 16) >> 6 /* / 64 */) - 24; 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) { if (extrabits < 2) {
x = 1 - extrabits;
block_size += x;
skip_bits(&alac->gb, k - 1); skip_bits(&alac->gb, k - 1);
} else { } else {
x += extrabits - 1;
skip_bits(&alac->gb, k); skip_bits(&alac->gb, k);
} }
block_size = x;
} }


if (block_size > 0) { if (block_size > 0) {


Loading…
Cancel
Save