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 #include "arm_math.h"
00025
00055 void arm_scale_q15(
00056 q15_t * pSrc,
00057 q15_t scaleFract,
00058 int8_t shift,
00059 q15_t * pDst,
00060 uint32_t blockSize)
00061 {
00062 int8_t kShift = 15 - shift;
00063 uint32_t blkCnt;
00064 q15_t in1, in2, in3, in4;
00065 q31_t inA1, inA2;
00066 q31_t out1, out2, out3, out4;
00067
00068
00069
00070 blkCnt = blockSize >> 2u;
00071
00072
00073
00074 while(blkCnt > 0u)
00075 {
00076
00077 inA1 = *__SIMD32(pSrc)++;
00078 inA2 = *__SIMD32(pSrc)++;
00079
00080
00081
00082
00083 out1 = (q31_t)((q15_t)(inA1 >> 16) * scaleFract);
00084 out2 = (q31_t)((q15_t)inA1 * scaleFract);
00085 out3 = (q31_t)((q15_t)(inA2 >> 16) * scaleFract);
00086 out4 = (q31_t)((q15_t)inA2 * scaleFract);
00087
00088
00089 out1 = out1 >> kShift;
00090 out2 = out2 >> kShift;
00091 out3 = out3 >> kShift;
00092 out4 = out4 >> kShift;
00093
00094
00095 #ifdef CCS
00096
00097 in1 = (q15_t)(__SSATA(out1, 0, 16));
00098 in2 = (q15_t)(__SSATA(out2, 0, 16));
00099 in3 = (q15_t)(__SSATA(out3, 0, 16));
00100 in4 = (q15_t)(__SSATA(out4, 0, 16));
00101
00102 #else
00103
00104 in1 = (q15_t)(__SSAT(out1, 16));
00105 in2 = (q15_t)(__SSAT(out2, 16));
00106 in3 = (q15_t)(__SSAT(out3, 16));
00107 in4 = (q15_t)(__SSAT(out4, 16));
00108
00109 #endif
00110
00111
00112 *__SIMD32(pDst)++ = __PKHBT(in2, in1,16);
00113 *__SIMD32(pDst)++ = __PKHBT(in4, in3,16);
00114
00115
00116 blkCnt--;
00117 }
00118
00119
00120
00121 blkCnt = blockSize % 0x4u;
00122
00123 while(blkCnt > 0u)
00124 {
00125
00126
00127 #ifdef CCS
00128 *pDst++ = (q15_t) (__SSATA(((*pSrc++) * scaleFract) >> kShift, 0, 16));
00129 #else
00130 *pDst++ = (q15_t) (__SSAT(((*pSrc++) * scaleFract) >> kShift, 16));
00131 #endif
00132
00133 blkCnt--;
00134 }
00135 }
00136