changeset 7917:518c86ed8008 libavcodec

Move constant multiplication out of the loop
author vitor
date Wed, 24 Sep 2008 20:31:24 +0000
parents 2a4c42e6aecb
children 84b37de61d98
files ra288.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ra288.c	Wed Sep 24 20:05:22 2008 +0000
+++ b/ra288.c	Wed Sep 24 20:31:24 2008 +0000
@@ -96,12 +96,12 @@
 
     /* block 48 of G.728 spec */
     /* exp(sum * 0.1151292546497) == pow(10.0,sum/20) */
-    sumsum = exp(sum * 0.1151292546497) * gain / 2048.;
+    sumsum = exp(sum * 0.1151292546497) * gain / (2048 * 4096);
 
     for (i=0; i < 5; i++)
         buffer[i] = codetable[cb_coef][i] * sumsum;
 
-    sum = scalar_product_float(buffer, buffer, 5) / 5;
+    sum = (4096 * 4096) * scalar_product_float(buffer, buffer, 5) / 5;
 
     sum = FFMAX(sum, 1);
 
@@ -118,7 +118,7 @@
 
     /* output */
     for (i=0; i < 5; i++)
-        block[i] = av_clipf(block[i], -4095, 4095);
+        block[i] = av_clipf(block[i], -4095./4096., 4095./4096.);
 }
 
 /**
@@ -210,7 +210,7 @@
         decode(ractx, gain, cb_coef);
 
         for (j=0; j < 5; j++)
-            *(out++) = (1/4096.) * ractx->sp_hist[70 + 36 + j];
+            *(out++) = ractx->sp_hist[70 + 36 + j];
 
         if ((i & 7) == 3)
             backward_filter(ractx);