Mercurial > libavcodec.hg
comparison celp_math.h @ 8505:c8743c33eeef libavcodec
Remove duplicated dot product code. Use dsputil's
scalarproduct instead. Patch by Aurelien Jacobs.
author | reynaldo |
---|---|
date | Mon, 29 Dec 2008 17:14:30 +0000 |
parents | cf4d575b1982 |
children | fdafbcef52f5 |
comparison
equal
deleted
inserted
replaced
8504:3bfb7a2ea222 | 8505:c8743c33eeef |
---|---|
49 * @return value of (1<<15) * log2(value) | 49 * @return value of (1<<15) * log2(value) |
50 */ | 50 */ |
51 int ff_log2(uint32_t value); | 51 int ff_log2(uint32_t value); |
52 | 52 |
53 /** | 53 /** |
54 * returns the dot product. | |
55 * @param a input data array | |
56 * @param b input data array | |
57 * @param length number of elements | |
58 * @param shift right shift by this value will be done after multiplication | |
59 * | |
60 * @return dot product = sum of elementwise products | |
61 */ | |
62 static int dot_product(const int16_t* a, const int16_t* b, int length, int shift) | |
63 { | |
64 int sum = 0; | |
65 int i; | |
66 | |
67 for(i=0; i<length; i++) | |
68 sum += (a[i] * b[i]) >> shift; | |
69 | |
70 return sum; | |
71 } | |
72 | |
73 /** | |
74 * Shift value left or right depending on sign of offset parameter. | 54 * Shift value left or right depending on sign of offset parameter. |
75 * @param value value to shift | 55 * @param value value to shift |
76 * @param offset shift offset | 56 * @param offset shift offset |
77 * | 57 * |
78 * @return value << offset, if offset>=0; value >> -offset - otherwise | 58 * @return value << offset, if offset>=0; value >> -offset - otherwise |