Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "arm_math.h"
00025
00051 void arm_cmplx_mag_squared_q15(
00052 q15_t * pSrc,
00053 q15_t * pDst,
00054 uint32_t numSamples)
00055 {
00056 q31_t in1, in2, in3, in4;
00057 q31_t acc1, acc2, acc3, acc4;
00058 q15_t out1, out2, out3, out4;
00059 uint32_t blkCnt;
00060
00061
00062 blkCnt = numSamples >> 2u;
00063
00064
00065
00066 while(blkCnt > 0u)
00067 {
00068
00069 in1 = _SIMD32_OFFSET(pSrc);
00070 in2 = _SIMD32_OFFSET(pSrc + 2);
00071 in3 = _SIMD32_OFFSET(pSrc + 4);
00072 in4 = _SIMD32_OFFSET(pSrc + 6);
00073
00074
00075 acc1 = __SMUAD(in1, in1);
00076 acc2 = __SMUAD(in2, in2);
00077 acc3 = __SMUAD(in3, in3);
00078 acc4 = __SMUAD(in4, in4);
00079
00080
00081 out1 = (q15_t)(acc1 >> 17);
00082 out2 = (q15_t)(acc2 >> 17);
00083 out3 = (q15_t)(acc3 >> 17);
00084 out4 = (q15_t)(acc4 >> 17);
00085
00086
00087 #ifndef ARM_MATH_BIG_ENDIAN
00088
00089 acc1 = __PKHBT(out1, out2, 16);
00090 acc2 = __PKHBT(out3, out4, 16);
00091
00092 #else
00093
00094 acc1 = __PKHBT(out2, out1, 16);
00095 acc2 = __PKHBT(out4, out3, 16);
00096
00097 #endif // #ifndef ARM_MATH_BIG_ENDIAN
00098
00099
00100 _SIMD32_OFFSET(pDst) = acc1;
00101 _SIMD32_OFFSET(pDst + 2) = acc2;
00102
00103
00104 pSrc += 8u;
00105
00106 pDst += 4u;
00107
00108
00109 blkCnt--;
00110 }
00111
00112
00113
00114 blkCnt = numSamples % 0x4u;
00115
00116 while(blkCnt > 0u)
00117 {
00118
00119 in1 = *__SIMD32(pSrc)++;
00120 acc1 = __SMUAD(in1, in1);
00121
00122 out1 = (q15_t)(acc1 >> 17);
00123
00124
00125 *pDst++ = out1;
00126
00127
00128 blkCnt--;
00129 }
00130 }
00131