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