[FFmpeg-cvslog] r12872 - trunk/libavcodec/alac.c

michael subversion
Thu Apr 17 05:00:08 CEST 2008


Author: michael
Date: Thu Apr 17 05:00:08 2008
New Revision: 12872

Log:
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.


Modified:
   trunk/libavcodec/alac.c

Modified: trunk/libavcodec/alac.c
==============================================================================
--- trunk/libavcodec/alac.c	(original)
+++ trunk/libavcodec/alac.c	Thu Apr 17 05:00:08 2008
@@ -226,18 +226,20 @@ static void bastardized_rice_decompress(
 
                 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) {




More information about the ffmpeg-cvslog mailing list