]> git.gag.com Git - fw/stlink/blob - exampleF4/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_q31.c
Added all the F4 libraries to the project
[fw/stlink] / exampleF4 / CMSIS / DSP_Lib / Source / SupportFunctions / arm_q7_to_q31.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_q31.c   
9 *   
10 * Description:  Converts the elements of the Q7 vector to Q31 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  * @brief Converts the elements of the Q7 vector to Q31 vector.   
43  * @param[in]       *pSrc points to the Q7 input vector   
44  * @param[out]      *pDst points to the Q31 output vector  
45  * @param[in]       blockSize length of the input vector   
46  * @return none.   
47  *   
48  * \par Description:   
49  *   
50  * The equation used for the conversion process is:   
51  *  
52  * <pre>   
53  *      pDst[n] = (q31_t) pSrc[n] << 24;   0 <= n < blockSize.  
54  * </pre>    
55  *  
56  */
57
58
59 void arm_q7_to_q31(
60   q7_t * pSrc,
61   q31_t * pDst,
62   uint32_t blockSize)
63 {
64   q7_t *pIn = pSrc;                              /* Src pointer */
65   uint32_t blkCnt;                               /* loop counter */
66
67 #ifndef ARM_MATH_CM0
68
69   /* Run the below code for Cortex-M4 and Cortex-M3 */
70
71   /*loop Unrolling */
72   blkCnt = blockSize >> 2u;
73
74   /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.   
75    ** a second loop below computes the remaining 1 to 3 samples. */
76   while(blkCnt > 0u)
77   {
78     /* C = (q31_t) A << 24 */
79     /* convert from q7 to q31 and then store the results in the destination buffer */
80     *pDst++ = (q31_t) * pIn++ << 24;
81     *pDst++ = (q31_t) * pIn++ << 24;
82     *pDst++ = (q31_t) * pIn++ << 24;
83     *pDst++ = (q31_t) * pIn++ << 24;
84
85     /* Decrement the loop counter */
86     blkCnt--;
87   }
88
89   /* If the blockSize is not a multiple of 4, compute any remaining output samples here.   
90    ** No loop unrolling is used. */
91   blkCnt = blockSize % 0x4u;
92
93 #else
94
95   /* Run the below code for Cortex-M0 */
96
97   /* Loop over blockSize number of values */
98   blkCnt = blockSize;
99
100 #endif /* #ifndef ARM_MATH_CM0 */
101
102   while(blkCnt > 0u)
103   {
104     /* C = (q31_t) A << 24 */
105     /* convert from q7 to q31 and then store the results in the destination buffer */
106     *pDst++ = (q31_t) * pIn++ << 24;
107
108     /* Decrement the loop counter */
109     blkCnt--;
110   }
111
112 }
113
114 /**   
115  * @} end of q7_to_x group   
116  */