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
00025
00026
00027
00028
00029
00030 #include "arm_math.h"
00031
00054 void arm_cmplx_mag_q31(
00055 q31_t * pSrc,
00056 q31_t * pDst,
00057 uint32_t numSamples)
00058 {
00059 q31_t real, imag;
00060 q31_t acc0, acc1;
00061
00062 #ifndef ARM_MATH_CM0
00063
00064
00065 uint32_t blkCnt;
00066
00067
00068
00069 blkCnt = numSamples >> 2u;
00070
00071
00072
00073 while(blkCnt > 0u)
00074 {
00075
00076
00077 real = *pSrc++;
00078 imag = *pSrc++;
00079 acc0 = (q31_t) (((q63_t) real * real) >> 33);
00080 acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
00081
00082 arm_sqrt_q31(acc0 + acc1, pDst++);
00083
00084 real = *pSrc++;
00085 imag = *pSrc++;
00086 acc0 = (q31_t) (((q63_t) real * real) >> 33);
00087 acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
00088
00089 arm_sqrt_q31(acc0 + acc1, pDst++);
00090
00091 real = *pSrc++;
00092 imag = *pSrc++;
00093 acc0 = (q31_t) (((q63_t) real * real) >> 33);
00094 acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
00095
00096 arm_sqrt_q31(acc0 + acc1, pDst++);
00097
00098 real = *pSrc++;
00099 imag = *pSrc++;
00100 acc0 = (q31_t) (((q63_t) real * real) >> 33);
00101 acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
00102
00103 arm_sqrt_q31(acc0 + acc1, pDst++);
00104
00105
00106 blkCnt--;
00107 }
00108
00109
00110
00111 blkCnt = numSamples % 0x4u;
00112
00113 while(blkCnt > 0u)
00114 {
00115
00116 real = *pSrc++;
00117 imag = *pSrc++;
00118 acc0 = (q31_t) (((q63_t) real * real) >> 33);
00119 acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
00120
00121 arm_sqrt_q31(acc0 + acc1, pDst++);
00122
00123
00124 blkCnt--;
00125 }
00126
00127 #else
00128
00129
00130
00131 while(numSamples > 0u)
00132 {
00133
00134 real = *pSrc++;
00135 imag = *pSrc++;
00136 acc0 = (q31_t) (((q63_t) real * real) >> 33);
00137 acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
00138
00139 arm_sqrt_q31(acc0 + acc1, pDst++);
00140
00141
00142 numSamples--;
00143 }
00144
00145 #endif
00146
00147 }
00148