Another use of scalar_product_float()
authorVitor Sessak <vitor1001@gmail.com>
Sun, 6 Jul 2008 10:32:29 +0000 (10:32 +0000)
committerVitor Sessak <vitor1001@gmail.com>
Sun, 6 Jul 2008 10:32:29 +0000 (10:32 +0000)
Originally committed as revision 14088 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/ra288.c

index 5fb41bf..7702a3c 100644 (file)
@@ -69,13 +69,12 @@ static void decode(Real288_internal *glob, float gain, int cb_coef)
 
     sumsum = exp(sum * 0.1151292546497) * gain;    /* pow(10.0,sum/20)*f */
 
-    sum = 0;
     for (x=0; x < 5; x++) {
         buffer[x] = codetable[cb_coef][x] * sumsum;
-        sum += buffer[x] * buffer[x];
     }
 
-    sum /= 5;
+    sum = scalar_product_float(buffer, buffer, 5) / 5;
+
     if (sum < 1)
         sum = 1;