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 #include "arm_math.h"
00028
00051 void arm_cmplx_mag_q31(
00052 q31_t * pSrc,
00053 q31_t * pDst,
00054 uint32_t numSamples)
00055 {
00056 q31_t real, imag;
00057 q31_t acc0, acc1;
00058 uint32_t blkCnt;
00059
00060
00061
00062 blkCnt = numSamples >> 2u;
00063
00064
00065
00066 while(blkCnt > 0u)
00067 {
00068
00069
00070 real = *pSrc++;
00071 imag = *pSrc++;
00072 acc0 = (q31_t) (((q63_t) real * real) >> 33);
00073 acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
00074
00075 arm_sqrt_q31(acc0 + acc1, pDst++);
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
00099 blkCnt--;
00100 }
00101
00102
00103
00104 blkCnt = numSamples % 0x4u;
00105
00106 while(blkCnt > 0u)
00107 {
00108
00109 real = *pSrc++;
00110 imag = *pSrc++;
00111 acc0 = (q31_t) (((q63_t) real * real) >> 33);
00112 acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
00113
00114 arm_sqrt_q31(acc0 + acc1, pDst++);
00115
00116
00117 blkCnt--;
00118 }
00119 }
00120