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
00058 void arm_q15_to_q7(
00059 q15_t * pSrc,
00060 q7_t * pDst,
00061 uint32_t blockSize)
00062 {
00063 q15_t *pIn = pSrc;
00064 uint32_t blkCnt;
00065 q31_t in1, in2, in3, in4;
00066 q31_t out1, out2, out3, out4;
00067
00068
00069
00070 blkCnt = blockSize >> 3u;
00071
00072
00073
00074 while(blkCnt > 0u)
00075 {
00076
00077
00078
00079 in1 = _SIMD32_OFFSET(pIn);
00080 in2 = _SIMD32_OFFSET(pIn + 2);
00081 in3 = _SIMD32_OFFSET(pIn + 4);
00082 in4 = _SIMD32_OFFSET(pIn + 6);
00083
00084
00085 #ifndef ARM_MATH_BIG_ENDIAN
00086
00087 out1 = __PKHTB(in2, in1, 16);
00088 out2 = __PKHBT(in2, in1, 16);
00089 out3 = __PKHTB(in4, in3, 16);
00090 out4 = __PKHBT(in4, in3, 16);
00091
00092 #else
00093
00094 out1 = __PKHTB(in1, in2, 16);
00095 out2 = __PKHBT(in1, in2, 16);
00096 out3 = __PKHTB(in3, in4, 16);
00097 out4 = __PKHBT(in3, in4, 16);
00098
00099 #endif // #ifndef ARM_MATH_BIG_ENDIAN
00100
00101
00102 out2 = ((uint32_t)out2 << 8) | ((uint32_t)out2 >> 24);
00103
00104
00105 out1 = out1 & 0xFF00FF00;
00106
00107 out2 = out2 & 0x00FF00FF;
00108
00109
00110 out4 = ((uint32_t)out4 << 8) | ((uint32_t)out4 >> 24);
00111
00112
00113 out3 = out3 & 0xFF00FF00;
00114
00115 out4 = out4 & 0x00FF00FF;
00116
00117
00118 out2 = out1 | out2;
00119 out4 = out3 | out4;
00120
00121
00122 _SIMD32_OFFSET(pDst) = out2;
00123
00124 pIn += 8u;
00125
00126 _SIMD32_OFFSET(pDst + 4) = out4;
00127
00128 pDst += 8u;
00129
00130
00131 blkCnt--;
00132 }
00133
00134
00135
00136 blkCnt = blockSize % 0x8u;
00137
00138 while(blkCnt > 0u)
00139 {
00140
00141
00142 *pDst++ = (q7_t) (*pIn++ >> 8);
00143
00144
00145 blkCnt--;
00146 }
00147
00148 }
00149