1 /******************************************************************************
2  * @file     support_functions_f16.h
3  * @brief    Public header file for CMSIS DSP Library
4  * @version  V1.9.0
5  * @date     23 April 2021
6  * Target Processor: Cortex-M and Cortex-A cores
7  ******************************************************************************/
8 /*
9  * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved.
10  *
11  * SPDX-License-Identifier: Apache-2.0
12  *
13  * Licensed under the Apache License, Version 2.0 (the License); you may
14  * not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  * www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
21  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  */
25 
26 
27 #ifndef _SUPPORT_FUNCTIONS_F16_H_
28 #define _SUPPORT_FUNCTIONS_F16_H_
29 
30 #include "arm_math_types_f16.h"
31 #include "arm_math_memory.h"
32 
33 #include "dsp/none.h"
34 #include "dsp/utils.h"
35 
36 #ifdef   __cplusplus
37 extern "C"
38 {
39 #endif
40 
41 #if defined(ARM_FLOAT16_SUPPORTED)
42 
43   /**
44    * @brief  Copies the elements of a floating-point vector.
45    * @param[in]  pSrc       input pointer
46    * @param[out] pDst       output pointer
47    * @param[in]  blockSize  number of samples to process
48    */
49 void arm_copy_f16(const float16_t * pSrc, float16_t * pDst, uint32_t blockSize);
50 
51   /**
52    * @brief  Fills a constant value into a floating-point vector.
53    * @param[in]  value      input value to be filled
54    * @param[out] pDst       output pointer
55    * @param[in]  blockSize  number of samples to process
56    */
57 void arm_fill_f16(float16_t value, float16_t * pDst, uint32_t blockSize);
58 
59 /**
60    * @brief Converts the elements of the floating-point vector to Q31 vector.
61    * @param[in]  pSrc       points to the f16 input vector
62    * @param[out] pDst       points to the q15 output vector
63    * @param[in]  blockSize  length of the input vector
64    */
65 void arm_f16_to_q15(const float16_t * pSrc, q15_t * pDst, uint32_t blockSize);
66 
67 /**
68    * @brief Converts the elements of the floating-point vector to Q31 vector.
69    * @param[in]  pSrc       points to the q15 input vector
70    * @param[out] pDst       points to the f16 output vector
71    * @param[in]  blockSize  length of the input vector
72    */
73 void arm_q15_to_f16(const q15_t * pSrc, float16_t * pDst, uint32_t blockSize);
74 
75 
76 /**
77    * @brief Converts the elements of the floating-point vector to Q31 vector.
78    * @param[in]  pSrc       points to the f32 input vector
79    * @param[out] pDst       points to the f16 output vector
80    * @param[in]  blockSize  length of the input vector
81    */
82 void arm_float_to_f16(const float32_t * pSrc, float16_t * pDst, uint32_t blockSize);
83 
84 /**
85    * @brief Converts the elements of the floating-point vector to Q31 vector.
86    * @param[in]  pSrc       points to the f16 input vector
87    * @param[out] pDst       points to the f32 output vector
88    * @param[in]  blockSize  length of the input vector
89    */
90 void arm_f16_to_float(const float16_t * pSrc, float32_t * pDst, uint32_t blockSize);
91 
92 /**
93  * @brief Weighted sum
94  *
95  *
96  * @param[in]    *in           Array of input values.
97  * @param[in]    *weigths      Weights
98  * @param[in]    blockSize     Number of samples in the input array.
99  * @return Weighted sum
100  *
101  */
102 float16_t arm_weighted_sum_f16(const float16_t *in
103   , const float16_t *weigths
104   , uint32_t blockSize);
105 
106 /**
107  * @brief Barycenter
108  *
109  *
110  * @param[in]    in         List of vectors
111  * @param[in]    weights    Weights of the vectors
112  * @param[out]   out        Barycenter
113  * @param[in]    nbVectors  Number of vectors
114  * @param[in]    vecDim     Dimension of space (vector dimension)
115  * @return       None
116  *
117  */
118 void arm_barycenter_f16(const float16_t *in
119   , const float16_t *weights
120   , float16_t *out
121   , uint32_t nbVectors
122   , uint32_t vecDim);
123 
124 #endif /*defined(ARM_FLOAT16_SUPPORTED)*/
125 #ifdef   __cplusplus
126 }
127 #endif
128 
129 #endif /* ifndef _SUPPORT_FUNCTIONS_F16_H_ */
130