diff options
author | Kenan Gillet <kenan.gillet@gmail.com> | 2008-10-30 21:04:17 +0000 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2008-10-30 21:04:17 +0000 |
commit | 0bc484ad51f5c85a3c1298a718355724905cdd6b (patch) | |
tree | 902c33fa75833a7c450cd542a1668217c728be2e /libavcodec | |
parent | 8c31f18bf9958d032486270a225849ba69b66365 (diff) | |
download | ffmpeg-0bc484ad51f5c85a3c1298a718355724905cdd6b.tar.gz |
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
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/celp_math.c | 11 | ||||
-rw-r--r-- | libavcodec/celp_math.h | 10 |
2 files changed, 21 insertions, 0 deletions
diff --git a/libavcodec/celp_math.c b/libavcodec/celp_math.c index 9fa7dfc70d..df05917d20 100644 --- a/libavcodec/celp_math.c +++ b/libavcodec/celp_math.c @@ -195,3 +195,14 @@ int ff_log2(uint32_t 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; +} diff --git a/libavcodec/celp_math.h b/libavcodec/celp_math.h index 029b5310af..ce0726fba1 100644 --- a/libavcodec/celp_math.h +++ b/libavcodec/celp_math.h @@ -83,4 +83,14 @@ static inline int bidir_sal(int value, int 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 */ |