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