Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | mjames | 1 | #include "ref.h" |
| 2 | |||
| 3 | void ref_power_f32( |
||
| 4 | float32_t * pSrc, |
||
| 5 | uint32_t blockSize, |
||
| 6 | float32_t * pResult) |
||
| 7 | { |
||
| 8 | uint32_t i; |
||
| 9 | float32_t sumsq=0; |
||
| 10 | |||
| 11 | for(i=0;i<blockSize;i++) |
||
| 12 | { |
||
| 13 | sumsq += pSrc[i] * pSrc[i]; |
||
| 14 | } |
||
| 15 | *pResult = sumsq; |
||
| 16 | } |
||
| 17 | |||
| 18 | void ref_power_q31( |
||
| 19 | q31_t * pSrc, |
||
| 20 | uint32_t blockSize, |
||
| 21 | q63_t * pResult) |
||
| 22 | { |
||
| 23 | uint32_t i; |
||
| 24 | q63_t sumsq=0; |
||
| 25 | |||
| 26 | for(i=0;i<blockSize;i++) |
||
| 27 | { |
||
| 28 | sumsq += ((q63_t)pSrc[i] * pSrc[i]) >> 14; |
||
| 29 | } |
||
| 30 | *pResult = sumsq; |
||
| 31 | } |
||
| 32 | |||
| 33 | void ref_power_q15( |
||
| 34 | q15_t * pSrc, |
||
| 35 | uint32_t blockSize, |
||
| 36 | q63_t * pResult) |
||
| 37 | { |
||
| 38 | uint32_t i; |
||
| 39 | q63_t sumsq=0; |
||
| 40 | |||
| 41 | for(i=0;i<blockSize;i++) |
||
| 42 | { |
||
| 43 | sumsq += (q63_t)pSrc[i] * pSrc[i]; |
||
| 44 | } |
||
| 45 | *pResult = sumsq; |
||
| 46 | } |
||
| 47 | |||
| 48 | void ref_power_q7( |
||
| 49 | q7_t * pSrc, |
||
| 50 | uint32_t blockSize, |
||
| 51 | q31_t * pResult) |
||
| 52 | { |
||
| 53 | uint32_t i; |
||
| 54 | q31_t sumsq=0; |
||
| 55 | |||
| 56 | for(i=0;i<blockSize;i++) |
||
| 57 | { |
||
| 58 | sumsq += (q31_t)pSrc[i] * pSrc[i]; |
||
| 59 | } |
||
| 60 | *pResult = sumsq; |
||
| 61 | } |