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_scale_q7(
00055 q7_t * pSrc,
00056 q7_t scaleFract,
00057 int8_t shift,
00058 q7_t * pDst,
00059 uint32_t blockSize)
00060 {
00061 int8_t kShift = 7 - shift;
00062 uint32_t blkCnt;
00063 q7_t in1, in2, in3, in4, in5, in6;
00064 q15_t out1, out2, out3, out4;
00065
00066
00067 blkCnt = blockSize >> 3u;
00068
00069
00070
00071 while(blkCnt > 0u)
00072 {
00073
00074
00075 in1 = pSrc[0];
00076 in2 = pSrc[1];
00077
00078
00079 out1 = (q15_t)((q7_t) (in1) * (scaleFract));
00080
00081
00082 in3 = pSrc[2];
00083
00084
00085 out2 = (q15_t)((q7_t) (in2) * (scaleFract));
00086
00087
00088 in4 = pSrc[3];
00089
00090
00091 out3 = (q15_t)((q7_t) (in3) * (scaleFract));
00092 out4 = (q15_t)((q7_t) (in4) * (scaleFract));
00093
00094
00095 out1 = out1 >> kShift;
00096 out2 = out2 >> kShift;
00097
00098
00099 in1 = pSrc[4];
00100
00101
00102 out3 = out3 >> kShift;
00103 out4 = out4 >> kShift;
00104
00105
00106 #ifdef CCS
00107
00108 in3 = (q7_t) __SSATA(out1, 0, 8);
00109 in4 = (q7_t) __SSATA(out2, 0, 8);
00110 in5 = (q7_t) __SSATA(out3, 0, 8);
00111 in6 = (q7_t) __SSATA(out4, 0, 8);
00112
00113 #else
00114
00115 in3 = (q7_t) __SSAT(out1, 8);
00116 in4 = (q7_t) __SSAT(out2, 8);
00117 in5 = (q7_t) __SSAT(out3, 8);
00118 in6 = (q7_t) __SSAT(out4, 8);
00119
00120 #endif
00121
00122
00123 *__SIMD32(pDst)++ = __PACKq7(in3, in4, in5, in6);
00124
00125
00126 in2 = pSrc[5];
00127
00128
00129 out1 = (q15_t)((q7_t) (in1) * (scaleFract));
00130
00131
00132 in3 = pSrc[6];
00133
00134
00135 out2 = (q15_t)((q7_t) (in2) * (scaleFract));
00136
00137
00138 in4 = pSrc[7];
00139
00140
00141 out3 = (q15_t)((q7_t) (in3) * (scaleFract));
00142 out4 = (q15_t)((q7_t) (in4) * (scaleFract));
00143
00144
00145 out1 = out1 >> kShift;
00146 out2 = out2 >> kShift;
00147 out3 = out3 >> kShift;
00148 out4 = out4 >> kShift;
00149
00150
00151 #ifdef CCS
00152
00153 in1 = (q7_t) __SSATA(out1, 0, 8);
00154 in2 = (q7_t) __SSATA(out2, 0, 8);
00155 in3 = (q7_t) __SSATA(out3, 0, 8);
00156 in4 = (q7_t) __SSATA(out4, 0, 8);
00157
00158 #else
00159
00160 in1 = (q7_t) __SSAT(out1, 8);
00161 in2 = (q7_t) __SSAT(out2, 8);
00162 in3 = (q7_t) __SSAT(out3, 8);
00163 in4 = (q7_t) __SSAT(out4, 8);
00164
00165 #endif
00166
00167
00168 *__SIMD32(pDst)++ = __PACKq7(in1, in2, in3, in4);
00169
00170
00171 pSrc += 8u;
00172
00173
00174 blkCnt--;
00175 }
00176
00177
00178
00179 blkCnt = blockSize % 0x8u;
00180
00181 while(blkCnt > 0u)
00182 {
00183
00184
00185 #ifdef CCS
00186 *pDst++ = (q7_t) (__SSATA(((*pSrc++) * scaleFract) >> kShift, 0, 8));
00187 #else
00188 *pDst++ = (q7_t) (__SSAT(((*pSrc++) * scaleFract) >> kShift, 8));
00189 #endif
00190
00191 blkCnt--;
00192 }
00193 }
00194