changeset 27120:ea18c012330a

Simplify predictor updates
author reimar
date Sun, 29 Jun 2008 09:10:46 +0000
parents 7c07e13eeae3
children 237e683b7480
files libmpcodecs/ad_imaadpcm.c
diffstat 1 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_imaadpcm.c	Sun Jun 29 08:47:56 2008 +0000
+++ b/libmpcodecs/ad_imaadpcm.c	Sun Jun 29 09:10:46 2008 +0000
@@ -150,16 +150,10 @@
 
     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];