summaryrefslogtreecommitdiffstats
path: root/libavcodec/alac.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-04-17 03:00:08 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-04-17 03:00:08 +0000
commitc49c5e23dc3fb273b46440656f74d416bcc9ab41 (patch)
tree5c8c032c1172879b966f520f6d85821e1b255d76 /libavcodec/alac.c
parent59b377ac86589e3c11a613e9a520a7ca76935ea4 (diff)
downloadffmpeg-streaming-c49c5e23dc3fb273b46440656f74d416bcc9ab41.zip
ffmpeg-streaming-c49c5e23dc3fb273b46440656f74d416bcc9ab41.tar.gz
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
Diffstat (limited to 'libavcodec/alac.c')
-rw-r--r--libavcodec/alac.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index b143d3a..e99b12b 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -226,18 +226,20 @@ static void bastardized_rice_decompress(ALACContext *alac,
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) {
OpenPOWER on IntegriCloud