Mercurial > libavcodec.hg
diff adpcm.c @ 4835:ae2f8c9bc25d libavcodec
Fix an underflow/overflow that was causing some crackles when playing
certain THP files.
patch by Marco Gerards, mgerards xs4all nl
author | diego |
---|---|
date | Tue, 10 Apr 2007 08:18:04 +0000 |
parents | 42eef6c711ac |
children | a743c46500d4 |
line wrap: on
line diff
--- a/adpcm.c Tue Apr 10 05:31:22 2007 +0000 +++ b/adpcm.c Tue Apr 10 08:18:04 2007 +0000 @@ -1359,8 +1359,10 @@ 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++;