1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Implement missing case for decoding samples with large pivot value in APE

decoder.
This fixes issue 1555

Originally committed as revision 20560 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Kostya Shishkov 2009-11-20 07:49:53 +00:00
parent e4de5b0fb5
commit 76267e4e90

View File

@ -408,8 +408,24 @@ static inline int ape_decode_value(APEContext * ctx, APERice *rice)
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;
}