[FFmpeg-cvslog] r20560 - trunk/libavcodec/apedec.c
kostya
subversion
Fri Nov 20 08:49:53 CET 2009
Author: kostya
Date: Fri Nov 20 08:49:53 2009
New Revision: 20560
Log:
Implement missing case for decoding samples with large pivot value in APE
decoder.
This fixes issue 1555
Modified:
trunk/libavcodec/apedec.c
Modified: trunk/libavcodec/apedec.c
==============================================================================
--- trunk/libavcodec/apedec.c Fri Nov 20 08:26:17 2009 (r20559)
+++ trunk/libavcodec/apedec.c Fri Nov 20 08:49:53 2009 (r20560)
@@ -408,8 +408,24 @@ static inline int ape_decode_value(APECo
overflow |= range_decode_bits(ctx, 16);
}
- base = range_decode_culfreq(ctx, pivot);
- range_decode_update(ctx, 1, base);
+ if (pivot < 0x10000) {
+ base = range_decode_culfreq(ctx, pivot);
+ range_decode_update(ctx, 1, base);
+ } else {
+ int base_hi = pivot, base_lo;
+ int bbits = 0;
+
+ while (base_hi & ~0xFFFF) {
+ base_hi >>= 1;
+ bbits++;
+ }
+ base_hi = range_decode_culfreq(ctx, base_hi + 1);
+ range_decode_update(ctx, 1, base_hi);
+ base_lo = range_decode_culfreq(ctx, 1 << bbits);
+ range_decode_update(ctx, 1, base_lo);
+
+ base = (base_hi << bbits) + base_lo;
+ }
x = base + overflow * pivot;
}
More information about the ffmpeg-cvslog
mailing list