diff options
author | Marco Gerards <mgerards@xs4all.nl> | 2007-04-10 08:18:04 +0000 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2007-04-10 08:18:04 +0000 |
commit | e457023a95e449ac2c80a49256f0611d5a8fffff (patch) | |
tree | 91bdee5a9fb596c2962d5b4f25bcfa36b9600349 | |
parent | 44942d52b60ebe5e7331737ca608e0969055692e (diff) | |
download | ffmpeg-e457023a95e449ac2c80a49256f0611d5a8fffff.tar.gz |
Fix an underflow/overflow that was causing some crackles when playing
certain THP files.
patch by Marco Gerards, mgerards xs4all nl
Originally committed as revision 8703 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/adpcm.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index d02ccfb9f2..57281d137a 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -1359,8 +1359,10 @@ static int adpcm_decode_frame(AVCodecContext *avctx, if(n&1) sampledat= *src++ <<28; else sampledat= (*src&0xF0)<<24; - *samples = ((prev[ch][0]*factor1 + sampledat = ((prev[ch][0]*factor1 + prev[ch][1]*factor2) >> 11) + (sampledat>>exp); + CLAMP_TO_SHORT(sampledat); + *samples = sampledat; prev[ch][1] = prev[ch][0]; prev[ch][0] = *samples++; |