diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-06-29 09:10:46 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-06-29 09:10:46 +0000 |
commit | 9f941c8a00541ffe418f95267438ccb5458db173 (patch) | |
tree | 80ae0ab46005d8dd7784d43f2ecd877965de0bb5 /libmpcodecs/ad_imaadpcm.c | |
parent | 8532066166f35c5017c0748e9cb67053d4e25f52 (diff) | |
download | mpv-9f941c8a00541ffe418f95267438ccb5458db173.tar.bz2 mpv-9f941c8a00541ffe418f95267438ccb5458db173.tar.xz |
Simplify predictor updates
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27152 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/ad_imaadpcm.c')
-rw-r--r-- | libmpcodecs/ad_imaadpcm.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/libmpcodecs/ad_imaadpcm.c b/libmpcodecs/ad_imaadpcm.c index f1e03b59a7..7a8e89dc41 100644 --- a/libmpcodecs/ad_imaadpcm.c +++ b/libmpcodecs/ad_imaadpcm.c @@ -150,16 +150,10 @@ static void decode_nibbles(unsigned short *output, sign = delta & 8; delta = delta & 7; + delta = 2 * delta + 1; + if (sign) delta = -delta; - diff = step[channel_number] >> 3; - if (delta & 4) diff += step[channel_number]; - if (delta & 2) diff += step[channel_number] >> 1; - if (delta & 1) diff += step[channel_number] >> 2; - - if (sign) - predictor[channel_number] -= diff; - else - predictor[channel_number] += diff; + predictor[channel_number] += (delta * step[channel_number]) >> 3; CLAMP_S16(predictor[channel_number]); output[i] = predictor[channel_number]; |