changeset 5526:9c37f7a3ff48 libavcodec

one more simplification
author aurel
date Sat, 11 Aug 2007 23:23:20 +0000
parents bc4791868c52
children 8b6ffd245ee2
files adpcm.c
diffstat 1 files changed, 2 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/adpcm.c	Sat Aug 11 23:17:03 2007 +0000
+++ b/adpcm.c	Sat Aug 11 23:23:20 2007 +0000
@@ -692,7 +692,6 @@
 
 static inline short adpcm_ct_expand_nibble(ADPCMChannelStatus *c, char nibble)
 {
-    int predictor;
     int sign, delta, diff;
     int new_step;
 
@@ -702,12 +701,9 @@
      * the reference ADPCM implementation since modern CPUs can do the mults
      * quickly enough */
     diff = ((2 * delta + 1) * c->step) >> 3;
-    predictor = c->predictor;
     /* predictor update is not so trivial: predictor is multiplied on 254/256 before updating */
-    if(sign)
-        predictor = ((predictor * 254) >> 8) - diff;
-    else
-            predictor = ((predictor * 254) >> 8) + diff;
+    c->predictor = ((c->predictor * 254) >> 8) + (sign ? -diff : diff);
+    c->predictor = av_clip_int16(c->predictor);
     /* calculate new step and clamp it to range 511..32767 */
     new_step = (ct_adpcm_table[nibble & 7] * c->step) >> 8;
     c->step = new_step;
@@ -716,7 +712,6 @@
     if(c->step > 32767)
         c->step = 32767;
 
-    c->predictor = av_clip_int16(predictor);
     return (short)c->predictor;
 }