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
00049 void arm_cmplx_mag_squared_q31(
00050 q31_t * pSrc,
00051 q31_t * pDst,
00052 uint32_t numSamples)
00053 {
00054 uint32_t blkCnt;
00055 q31_t real1, real2, imag1, imag2;
00056 q31_t real3, real4, imag3, imag4;
00057 q31_t out1, out2;
00058
00059
00060 blkCnt = numSamples >> 2u;
00061
00062
00063
00064 while(blkCnt > 0u)
00065 {
00066
00067 real1 = pSrc[0];
00068 imag1 = pSrc[1];
00069 real2 = pSrc[2];
00070 imag2 = pSrc[3];
00071
00072
00073 real1 = (q31_t)(((q63_t) real1 * real1) >> 32);
00074 imag1 = (q31_t)(((q63_t) imag1 * imag1) >> 32);
00075 real2 = (q31_t)(((q63_t) real2 * real2) >> 32);
00076 imag2 = (q31_t)(((q63_t) imag2 * imag2) >> 32);
00077
00078
00079 real3 = pSrc[4];
00080 imag3 = pSrc[5];
00081 real4 = pSrc[6];
00082 imag4 = pSrc[7];
00083
00084
00085 real3 = (q31_t)(((q63_t) real3 * real3) >> 32);
00086 imag3 = (q31_t)(((q63_t) imag3 * imag3) >> 32);
00087 real4 = (q31_t)(((q63_t) real4 * real4) >> 32);
00088 imag4 = (q31_t)(((q63_t) imag4 * imag4) >> 32);
00089
00090
00091 real1 = (real1 >> 1);
00092 imag1 = (imag1 >> 1);
00093 real2 = (real2 >> 1);
00094 imag2 = (imag2 >> 1);
00095
00096
00097 out1 = real1 + imag1;
00098 out2 = real2 + imag2;
00099
00100
00101
00102 real3 = (real3 >> 1);
00103 imag3 = (imag3 >> 1);
00104 real4 = (real4 >> 1);
00105
00106
00107 pDst[0] = out1;
00108
00109
00110 imag4 = (imag4 >> 1);
00111
00112
00113 pDst[1] = out2;
00114
00115
00116 out1 = real3 + imag3;
00117 out2 = real4 + imag4;
00118
00119
00120 pDst[2] = out1;
00121
00122
00123 pSrc += 8u;
00124
00125
00126 pDst[3] = out2;
00127
00128
00129 pDst += 4u;
00130
00131
00132 blkCnt--;
00133 }
00134
00135
00136
00137 blkCnt = numSamples % 0x4u;
00138
00139 while(blkCnt > 0u)
00140 {
00141
00142 real1 = *pSrc++;
00143 imag1 = *pSrc++;
00144 real1 = (q31_t) (((q63_t) real1 * real1) >> 33);
00145 imag1 = (q31_t) (((q63_t) imag1 * imag1) >> 33);
00146
00147 *pDst++ = real1 + imag1;
00148
00149
00150 blkCnt--;
00151 }
00152 }
00153