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 #include "arm_math.h"
00026
00050 void arm_mult_q31(
00051 q31_t * pSrcA,
00052 q31_t * pSrcB,
00053 q31_t * pDst,
00054 uint32_t blockSize)
00055 {
00056 uint32_t blkCnt;
00057 q31_t inA1, inA2, inA3, inA4;
00058 q31_t inB1, inB2, inB3, inB4;
00059 q31_t out1, out2, out3, out4;
00060
00061
00062 blkCnt = blockSize >> 2u;
00063
00064
00065
00066 while(blkCnt > 0u)
00067 {
00068
00069 inA1 = *pSrcA;
00070
00071 inB1 = *pSrcB;
00072
00073 inA2 = *(pSrcA + 1);
00074
00075 inB2 = *(pSrcB + 1);
00076
00077
00078 inA1 = ((q63_t) inA1 * inB1) >> 32;
00079
00080
00081 inA3 = *(pSrcA + 2);
00082
00083
00084 inA2 = ((q63_t) inA2 * inB2) >> 32;
00085
00086
00087 inB3 = *(pSrcB + 2);
00088
00089 inA4 = *(pSrcA + 3);
00090
00091
00092 inA3 = ((q63_t) inA3 * inB3) >> 32;
00093
00094
00095 inB4 = *(pSrcB + 3);
00096
00097
00098 inA4 = ((q63_t) inA4 * inB4) >> 32;
00099
00100
00101
00102 #ifdef CCS
00103 out1 = __SSATA(inA1, 0, 31);
00104 out2 = __SSATA(inA2, 0, 31);
00105 out3 = __SSATA(inA3, 0, 31);
00106 out4 = __SSATA(inA4, 0, 31);
00107 #else
00108 out1 = __SSAT(inA1, 31);
00109 out2 = __SSAT(inA2, 31);
00110 out3 = __SSAT(inA3, 31);
00111 out4 = __SSAT(inA4, 31);
00112 #endif // #ifdef CCS
00113
00114
00115 out1 = out1 << 1u;
00116 out2 = out2 << 1u;
00117
00118
00119 *pDst = out1;
00120
00121
00122 out3 = out3 << 1u;
00123
00124
00125 *(pDst + 1) = out2;
00126
00127
00128 out4 = out4 << 1u;
00129
00130
00131 *(pDst + 2) = out3;
00132
00133
00134 pSrcA += 4u;
00135
00136
00137 *(pDst + 3) = out4;
00138
00139
00140 pSrcB += 4u;
00141
00142 pDst += 4u;
00143
00144
00145 blkCnt--;
00146 }
00147
00148
00149
00150 blkCnt = blockSize % 0x4u;
00151
00152 while(blkCnt > 0u)
00153 {
00154
00155
00156 *pDst++ = (q31_t) clip_q63_to_q31(((q63_t) (*pSrcA++) * (*pSrcB++)) >> 31);
00157
00158
00159 blkCnt--;
00160 }
00161 }
00162