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
00054 void arm_cmplx_mult_real_q15(
00055 q15_t * pSrcCmplx,
00056 q15_t * pSrcReal,
00057 q15_t * pCmplxDst,
00058 uint32_t numSamples)
00059 {
00060 q15_t in;
00061 uint32_t blkCnt;
00062 q31_t inA1, inA2;
00063 q31_t inB1;
00064 q15_t out1, out2, out3, out4;
00065 q31_t mul1, mul2, mul3, mul4;
00066
00067
00068 blkCnt = numSamples >> 2u;
00069
00070
00071
00072 while(blkCnt > 0u)
00073 {
00074
00075
00076
00077 inA1 = _SIMD32_OFFSET(pSrcCmplx);
00078
00079 inB1 = _SIMD32_OFFSET(pSrcReal);
00080
00081 inA2 = _SIMD32_OFFSET(pSrcCmplx + 2);
00082
00083
00084 #ifndef ARM_MATH_BIG_ENDIAN
00085
00086 mul1 = (q31_t)((q15_t)(inA1)* (q15_t)(inB1));
00087 mul2 = (q31_t)((q15_t)(inA1 >> 16) * (q15_t)(inB1));
00088 mul3 = (q31_t)((q15_t)(inA2)* (q15_t)(inB1 >> 16));
00089 mul4 = (q31_t)((q15_t)(inA2 >> 16) * (q15_t)(inB1 >> 16));
00090
00091 #else
00092
00093 mul2 = (q31_t)((q15_t)(inA1 >> 16)* (q15_t)(inB1>> 16));
00094 mul1 = (q31_t)((q15_t)inA1 * (q15_t)(inB1>> 16));
00095 mul4 = (q31_t)((q15_t)(inA2 >> 16)* (q15_t)inB1);
00096 mul3 = (q31_t)((q15_t)inA2 * (q15_t)inB1);
00097
00098 #endif // #ifndef ARM_MATH_BIG_ENDIAN
00099
00100
00101 #ifdef CCS
00102
00103 out1 = (q15_t) __SSATA(mul1, 15u, 16);
00104 out2 = (q15_t) __SSATA(mul2, 15u, 16);
00105 out3 = (q15_t) __SSATA(mul3, 15u, 16);
00106 out4 = (q15_t) __SSATA(mul4, 15u, 16);
00107
00108 #else
00109
00110 out1 = (q15_t) __SSAT(mul1 >> 15u, 16);
00111 out2 = (q15_t) __SSAT(mul2 >> 15u, 16);
00112 out3 = (q15_t) __SSAT(mul3 >> 15u, 16);
00113 out4 = (q15_t) __SSAT(mul4 >> 15u, 16);
00114
00115 #endif // #ifdef CCS
00116
00117
00118
00119 _SIMD32_OFFSET(pCmplxDst) = __PKHBT(out1, out2, 16);
00120 _SIMD32_OFFSET(pCmplxDst + 2) = __PKHBT(out3, out4, 16);
00121
00122 inA1 = _SIMD32_OFFSET(pSrcCmplx + 4);
00123 inB1 = _SIMD32_OFFSET(pSrcReal + 2);
00124 inA2 = _SIMD32_OFFSET(pSrcCmplx + 6);
00125
00126 #ifndef ARM_MATH_BIG_ENDIAN
00127
00128 mul1 = (q31_t)((q15_t)(inA1)* (q15_t)(inB1));
00129 mul2 = (q31_t)((q15_t)(inA1 >> 16) * (q15_t)(inB1));
00130 mul3 = (q31_t)((q15_t)(inA2) * (q15_t)(inB1 >> 16));
00131 mul4 = (q31_t)((q15_t)(inA2 >> 16) * (q15_t)(inB1 >> 16));
00132
00133 #else
00134
00135 mul2 = (q31_t)((q15_t)(inA1 >> 16)* (q15_t)(inB1>> 16));
00136 mul1 = (q31_t)((q15_t)inA1 * (q15_t)(inB1>> 16));
00137 mul4 = (q31_t)((q15_t)(inA2 >> 16)* (q15_t)inB1);
00138 mul3 = (q31_t)((q15_t)inA2 * (q15_t)inB1);
00139
00140 #endif // #ifndef ARM_MATH_BIG_ENDIAN
00141
00142 #ifdef CCS
00143
00144 out1 = (q15_t) __SSATA(mul1, 15u, 16);
00145 out2 = (q15_t) __SSATA(mul2, 15u, 16);
00146 out3 = (q15_t) __SSATA(mul3, 15u, 16);
00147 out4 = (q15_t) __SSATA(mul4, 15u, 16);
00148
00149 #else
00150
00151 out1 = (q15_t) __SSAT(mul1 >> 15u, 16);
00152 out2 = (q15_t) __SSAT(mul2 >> 15u, 16);
00153 out3 = (q15_t) __SSAT(mul3 >> 15u, 16);
00154 out4 = (q15_t) __SSAT(mul4 >> 15u, 16);
00155
00156 #endif // #ifdef CCS
00157
00158
00159 _SIMD32_OFFSET(pCmplxDst + 4) = __PKHBT(out1, out2, 16);
00160 _SIMD32_OFFSET(pCmplxDst + 6) = __PKHBT(out3, out4, 16);
00161
00162
00163 pSrcCmplx += 8u;
00164 pSrcReal += 4u;
00165 pCmplxDst += 8u;
00166
00167
00168 blkCnt--;
00169 }
00170
00171
00172
00173 blkCnt = numSamples % 0x4u;
00174
00175 while(blkCnt > 0u)
00176 {
00177
00178
00179 in = *pSrcReal++;
00180
00181 #ifdef CCS
00182 *pCmplxDst++ = (q15_t) __SSATA(((q31_t) (*pSrcCmplx++) * (in)), 15, 16);
00183 *pCmplxDst++ = (q15_t) __SSATA(((q31_t) (*pSrcCmplx++) * (in)), 15, 16);
00184 #else
00185 *pCmplxDst++ = (q15_t) __SSAT((((q31_t) (*pSrcCmplx++) * (in)) >> 15), 16);
00186 *pCmplxDst++ = (q15_t) __SSAT((((q31_t) (*pSrcCmplx++) * (in)) >> 15), 16);
00187 #endif
00188
00189
00190 blkCnt--;
00191 }
00192 }
00193