changeset 7925:9dc65bb3bd3f libavcodec

Do instead of divising a float by a constant, multiply by its inverse
author vitor
date Thu, 25 Sep 2008 20:03:57 +0000
parents 926c3a5dcdd3
children 224dea3d9ac8
files ra288.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ra288.c	Thu Sep 25 19:25:28 2008 +0000
+++ b/ra288.c	Thu Sep 25 20:03:57 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 * 4096);
+    sumsum = exp(sum * 0.1151292546497) * gain * (1.0/(1<<23));
 
     for (i=0; i < 5; i++)
         buffer[i] = codetable[cb_coef][i] * sumsum;
 
-    sum = (4096 * 4096) * scalar_product_float(buffer, buffer, 5) / 5;
+    sum = scalar_product_float(buffer, buffer, 5) * ((1<<24)/5.);
 
     sum = FFMAX(sum, 1);