changeset 8090:1c07635d7334 libavcodec

Add ff_dot_productf() to celp_math.{c,h} Part of the QCELP patch by Kenan Gillet, kenan.gillet gmail com
author vitor
date Thu, 30 Oct 2008 21:04:17 +0000
parents 103e41d62781
children 4c95f44c4c23
files celp_math.c celp_math.h
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/celp_math.c	Thu Oct 30 21:00:01 2008 +0000
+++ b/celp_math.c	Thu Oct 30 21:04:17 2008 +0000
@@ -195,3 +195,14 @@
 
     return (power_int << 15) + value;
 }
+
+float ff_dot_productf(const float* a, const float* b, int length)
+{
+    float sum = 0;
+    int i;
+
+    for(i=0; i<length; i++)
+        sum += a[i] * b[i];
+
+    return sum;
+}
--- a/celp_math.h	Thu Oct 30 21:00:01 2008 +0000
+++ b/celp_math.h	Thu Oct 30 21:04:17 2008 +0000
@@ -83,4 +83,14 @@
     else           return value <<  offset;
 }
 
+/**
+ * returns the dot product.
+ * @param a input data array
+ * @param b input data array
+ * @param length number of elements
+ *
+ * @return dot product = sum of elementwise products
+ */
+extern float ff_dot_productf(const float* a, const float* b, int length);
+
 #endif /* AVCODEC_CELP_MATH_H */