Commit 0bc484ad authored by Kenan Gillet's avatar Kenan Gillet Committed by Vitor Sessak

Add ff_dot_productf() to celp_math.{c,h}

Part of the QCELP patch by Kenan Gillet, kenan.gillet gmail com

Originally committed as revision 15753 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 8c31f18b
...@@ -195,3 +195,14 @@ int ff_log2(uint32_t value) ...@@ -195,3 +195,14 @@ int ff_log2(uint32_t value)
return (power_int << 15) + value; 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;
}
...@@ -83,4 +83,14 @@ static inline int bidir_sal(int value, int offset) ...@@ -83,4 +83,14 @@ static inline int bidir_sal(int value, int offset)
else return value << offset; 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 */ #endif /* AVCODEC_CELP_MATH_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment