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
00052 void arm_cmplx_mag_q15(
00053 q15_t * pSrc,
00054 q15_t * pDst,
00055 uint32_t numSamples)
00056 {
00057 q15_t real, imag;
00058 q31_t in1, in2, in3, in4;
00059 q31_t acc1, acc2, acc3, acc4;
00060 q15_t out1, out2, out3, out4;
00061 uint32_t blkCnt;
00062
00063
00064
00065 blkCnt = numSamples >> 2u;
00066
00067
00068
00069 while(blkCnt > 0u)
00070 {
00071
00072 in1 = _SIMD32_OFFSET(pSrc);
00073 in2 = _SIMD32_OFFSET(pSrc + 2);
00074 in3 = _SIMD32_OFFSET(pSrc + 4);
00075 in4 = _SIMD32_OFFSET(pSrc + 6);
00076
00077
00078 acc1 = __SMUAD(in1, in1);
00079 acc2 = __SMUAD(in2, in2);
00080 acc3 = __SMUAD(in3, in3);
00081 acc4 = __SMUAD(in4, in4);
00082
00083
00084 out1 = (q15_t)(acc1 >> 17);
00085 out2 = (q15_t)(acc2 >> 17);
00086 out3 = (q15_t)(acc3 >> 17);
00087 out4 = (q15_t)(acc4 >> 17);
00088
00089
00090 arm_sqrt_q15(out1, &pDst[0]);
00091 arm_sqrt_q15(out2, &pDst[1]);
00092 arm_sqrt_q15(out3, &pDst[2]);
00093 arm_sqrt_q15(out4, &pDst[3]);
00094
00095
00096 pSrc += 8u;
00097 pDst += 4u;
00098
00099
00100 blkCnt--;
00101 }
00102
00103
00104
00105 blkCnt = numSamples % 0x4u;
00106
00107 while(blkCnt > 0u)
00108 {
00109
00110 real = *pSrc++;
00111 imag = *pSrc++;
00112 acc1 = __SMUAD(real, real);
00113 acc2 = __SMUAD(imag, imag);
00114
00115 arm_sqrt_q15((q15_t) (((q63_t) acc1 + acc2) >> 17), pDst++);
00116
00117
00118 blkCnt--;
00119 }
00120 }
00121