]> git.gag.com Git - fw/stlink/blob - exampleF4/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_q15.c
Added all the F4 libraries to the project
[fw/stlink] / exampleF4 / CMSIS / DSP_Lib / Source / SupportFunctions / arm_q7_to_q15.c
1 /* ----------------------------------------------------------------------------   
2 * Copyright (C) 2010 ARM Limited. All rights reserved.   
3 *   
4 * $Date:        15. July 2011  
5 * $Revision:    V1.0.10  
6 *   
7 * Project:          CMSIS DSP Library   
8 * Title:                arm_q7_to_q15.c   
9 *   
10 * Description:  Converts the elements of the Q7 vector to Q15 vector.   
11 *   
12 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
13 *  
14 * Version 1.0.10 2011/7/15 
15 *    Big Endian support added and Merged M0 and M3/M4 Source code.  
16 *   
17 * Version 1.0.3 2010/11/29  
18 *    Re-organized the CMSIS folders and updated documentation.   
19 *    
20 * Version 1.0.2 2010/11/11   
21 *    Documentation updated.    
22 *   
23 * Version 1.0.1 2010/10/05    
24 *    Production release and review comments incorporated.   
25 *   
26 * Version 1.0.0 2010/09/20    
27 *    Production release and review comments incorporated.   
28 * ---------------------------------------------------------------------------- */
29
30 #include "arm_math.h"
31
32 /**   
33  * @ingroup groupSupport   
34  */
35
36 /**   
37  * @addtogroup q7_to_x   
38  * @{   
39  */
40
41
42
43
44 /**   
45  * @brief Converts the elements of the Q7 vector to Q15 vector.   
46  * @param[in]       *pSrc points to the Q7 input vector   
47  * @param[out]      *pDst points to the Q15 output vector  
48  * @param[in]       blockSize length of the input vector   
49  * @return none.   
50  *   
51  * \par Description:   
52  *   
53  * The equation used for the conversion process is:   
54  *  
55  * <pre>   
56  *      pDst[n] = (q15_t) pSrc[n] << 8;   0 <= n < blockSize.   
57  * </pre>   
58  *  
59  */
60
61
62 void arm_q7_to_q15(
63   q7_t * pSrc,
64   q15_t * pDst,
65   uint32_t blockSize)
66 {
67   q7_t *pIn = pSrc;                              /* Src pointer */
68   uint32_t blkCnt;                               /* loop counter */
69
70 #ifndef ARM_MATH_CM0
71
72   /* Run the below code for Cortex-M4 and Cortex-M3 */
73
74   /*loop Unrolling */
75   blkCnt = blockSize >> 2u;
76
77   /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.   
78    ** a second loop below computes the remaining 1 to 3 samples. */
79   while(blkCnt > 0u)
80   {
81     /* C = (q15_t) A << 8 */
82     /* convert from q7 to q15 and then store the results in the destination buffer */
83     *pDst++ = (q15_t) * pIn++ << 8;
84     *pDst++ = (q15_t) * pIn++ << 8;
85     *pDst++ = (q15_t) * pIn++ << 8;
86     *pDst++ = (q15_t) * pIn++ << 8;
87
88     /* Decrement the loop counter */
89     blkCnt--;
90   }
91
92   /* If the blockSize is not a multiple of 4, compute any remaining output samples here.   
93    ** No loop unrolling is used. */
94   blkCnt = blockSize % 0x4u;
95
96 #else
97
98   /* Run the below code for Cortex-M0 */
99
100   /* Loop over blockSize number of values */
101   blkCnt = blockSize;
102
103 #endif /* #ifndef ARM_MATH_CM0 */
104
105   while(blkCnt > 0u)
106   {
107     /* C = (q15_t) A << 8 */
108     /* convert from q7 to q15 and then store the results in the destination buffer */
109     *pDst++ = (q15_t) * pIn++ << 8;
110
111     /* Decrement the loop counter */
112     blkCnt--;
113   }
114
115 }
116
117 /**   
118  * @} end of q7_to_x group   
119  */