changeset 6838:7d4031cba765 libavcodec

Simplify irms()
author vitor
date Wed, 21 May 2008 16:43:33 +0000
parents 1acb9df14634
children d17cae06e958
files ra144.c
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ra144.c	Wed May 21 16:43:05 2008 +0000
+++ b/ra144.c	Wed May 21 16:43:33 2008 +0000
@@ -112,12 +112,10 @@
 /* inverse root mean square */
 static int irms(const short *data, int factor)
 {
-    const short *p1, *p2;
-    unsigned int sum;
+    unsigned int i, sum = 0;
 
-    p2 = (p1 = data) + BLOCKSIZE;
-    for (sum=0; p2 > p1; p1++)
-        sum += (*p1) * (*p1);
+    for (i=0; i < BLOCKSIZE; i++)
+        sum += data[i] * data[i];
 
     if (sum == 0)
         return 0; /* OOPS - division by zero */