changeset 7915:2d530c3d155e libavcodec

Simplify: move division by constant off the loop
author vitor
date Wed, 24 Sep 2008 20:03:58 +0000
parents c15b1e83d27d
children 2a4c42e6aecb
files ra288.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ra288.c	Wed Sep 24 12:45:28 2008 +0000
+++ b/ra288.c	Wed Sep 24 20:03:58 2008 +0000
@@ -88,10 +88,11 @@
     sum = av_clipf(sum, 0, 60);
 
     /* block 48 of G.728 spec */
-    sumsum = exp(sum * 0.1151292546497) * gain; /* pow(10.0,sum/20)*gain */
+    /* exp(sum * 0.1151292546497) == pow(10.0,sum/20) */
+    sumsum = exp(sum * 0.1151292546497) * gain / 2048.;
 
     for (i=0; i < 5; i++)
-        buffer[i] = codetable[cb_coef][i] * sumsum * (1./2048.);
+        buffer[i] = codetable[cb_coef][i] * sumsum;
 
     sum = scalar_product_float(buffer, buffer, 5) / 5;