| /****************************************************************************** | |
| * @file support_functions.h | |
| * @brief Public header file for CMSIS DSP Library | |
| * @version V1.10.0 | |
| * @date 08 July 2021 | |
| * Target Processor: Cortex-M and Cortex-A cores | |
| ******************************************************************************/ | |
| /* | |
| * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved. | |
| * | |
| * SPDX-License-Identifier: Apache-2.0 | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the License); you may | |
| * not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software | |
| * distributed under the License is distributed on an AS IS BASIS, WITHOUT | |
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| * See the License for the specific language governing permissions and | |
| * limitations under the License. | |
| */ | |
| extern "C" | |
| { | |
| /** | |
| * @defgroup groupSupport Support Functions | |
| */ | |
| /** | |
| * @brief Converts the elements of the floating-point vector to Q31 vector. | |
| * @param[in] pSrc points to the floating-point input vector | |
| * @param[out] pDst points to the Q31 output vector | |
| * @param[in] blockSize length of the input vector | |
| */ | |
| void arm_float_to_q31( | |
| const float32_t * pSrc, | |
| q31_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Converts the elements of the floating-point vector to Q15 vector. | |
| * @param[in] pSrc points to the floating-point input vector | |
| * @param[out] pDst points to the Q15 output vector | |
| * @param[in] blockSize length of the input vector | |
| */ | |
| void arm_float_to_q15( | |
| const float32_t * pSrc, | |
| q15_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Converts the elements of the floating-point vector to Q7 vector. | |
| * @param[in] pSrc points to the floating-point input vector | |
| * @param[out] pDst points to the Q7 output vector | |
| * @param[in] blockSize length of the input vector | |
| */ | |
| void arm_float_to_q7( | |
| const float32_t * pSrc, | |
| q7_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Converts the elements of the Q31 vector to floating-point vector. | |
| * @param[in] pSrc is input pointer | |
| * @param[out] pDst is output pointer | |
| * @param[in] blockSize is the number of samples to process | |
| */ | |
| void arm_q31_to_float( | |
| const q31_t * pSrc, | |
| float32_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Converts the elements of the Q31 vector to Q15 vector. | |
| * @param[in] pSrc is input pointer | |
| * @param[out] pDst is output pointer | |
| * @param[in] blockSize is the number of samples to process | |
| */ | |
| void arm_q31_to_q15( | |
| const q31_t * pSrc, | |
| q15_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Converts the elements of the Q31 vector to Q7 vector. | |
| * @param[in] pSrc is input pointer | |
| * @param[out] pDst is output pointer | |
| * @param[in] blockSize is the number of samples to process | |
| */ | |
| void arm_q31_to_q7( | |
| const q31_t * pSrc, | |
| q7_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Converts the elements of the Q15 vector to floating-point vector. | |
| * @param[in] pSrc is input pointer | |
| * @param[out] pDst is output pointer | |
| * @param[in] blockSize is the number of samples to process | |
| */ | |
| void arm_q15_to_float( | |
| const q15_t * pSrc, | |
| float32_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Converts the elements of the Q15 vector to Q31 vector. | |
| * @param[in] pSrc is input pointer | |
| * @param[out] pDst is output pointer | |
| * @param[in] blockSize is the number of samples to process | |
| */ | |
| void arm_q15_to_q31( | |
| const q15_t * pSrc, | |
| q31_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Converts the elements of the Q15 vector to Q7 vector. | |
| * @param[in] pSrc is input pointer | |
| * @param[out] pDst is output pointer | |
| * @param[in] blockSize is the number of samples to process | |
| */ | |
| void arm_q15_to_q7( | |
| const q15_t * pSrc, | |
| q7_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Converts the elements of the Q7 vector to floating-point vector. | |
| * @param[in] pSrc is input pointer | |
| * @param[out] pDst is output pointer | |
| * @param[in] blockSize is the number of samples to process | |
| */ | |
| void arm_q7_to_float( | |
| const q7_t * pSrc, | |
| float32_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Converts the elements of the Q7 vector to Q31 vector. | |
| * @param[in] pSrc input pointer | |
| * @param[out] pDst output pointer | |
| * @param[in] blockSize number of samples to process | |
| */ | |
| void arm_q7_to_q31( | |
| const q7_t * pSrc, | |
| q31_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Converts the elements of the Q7 vector to Q15 vector. | |
| * @param[in] pSrc input pointer | |
| * @param[out] pDst output pointer | |
| * @param[in] blockSize number of samples to process | |
| */ | |
| void arm_q7_to_q15( | |
| const q7_t * pSrc, | |
| q15_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Struct for specifying sorting algorithm | |
| */ | |
| typedef enum | |
| { | |
| ARM_SORT_BITONIC = 0, | |
| /**< Bitonic sort */ | |
| ARM_SORT_BUBBLE = 1, | |
| /**< Bubble sort */ | |
| ARM_SORT_HEAP = 2, | |
| /**< Heap sort */ | |
| ARM_SORT_INSERTION = 3, | |
| /**< Insertion sort */ | |
| ARM_SORT_QUICK = 4, | |
| /**< Quick sort */ | |
| ARM_SORT_SELECTION = 5 | |
| /**< Selection sort */ | |
| } arm_sort_alg; | |
| /** | |
| * @brief Struct for specifying sorting algorithm | |
| */ | |
| typedef enum | |
| { | |
| ARM_SORT_DESCENDING = 0, | |
| /**< Descending order (9 to 0) */ | |
| ARM_SORT_ASCENDING = 1 | |
| /**< Ascending order (0 to 9) */ | |
| } arm_sort_dir; | |
| /** | |
| * @brief Instance structure for the sorting algorithms. | |
| */ | |
| typedef struct | |
| { | |
| arm_sort_alg alg; /**< Sorting algorithm selected */ | |
| arm_sort_dir dir; /**< Sorting order (direction) */ | |
| } arm_sort_instance_f32; | |
| /** | |
| * @param[in] S points to an instance of the sorting structure. | |
| * @param[in] pSrc points to the block of input data. | |
| * @param[out] pDst points to the block of output data. | |
| * @param[in] blockSize number of samples to process. | |
| */ | |
| void arm_sort_f32( | |
| const arm_sort_instance_f32 * S, | |
| float32_t * pSrc, | |
| float32_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @param[in,out] S points to an instance of the sorting structure. | |
| * @param[in] alg Selected algorithm. | |
| * @param[in] dir Sorting order. | |
| */ | |
| void arm_sort_init_f32( | |
| arm_sort_instance_f32 * S, | |
| arm_sort_alg alg, | |
| arm_sort_dir dir); | |
| /** | |
| * @brief Instance structure for the sorting algorithms. | |
| */ | |
| typedef struct | |
| { | |
| arm_sort_dir dir; /**< Sorting order (direction) */ | |
| float32_t * buffer; /**< Working buffer */ | |
| } arm_merge_sort_instance_f32; | |
| /** | |
| * @param[in] S points to an instance of the sorting structure. | |
| * @param[in,out] pSrc points to the block of input data. | |
| * @param[out] pDst points to the block of output data | |
| * @param[in] blockSize number of samples to process. | |
| */ | |
| void arm_merge_sort_f32( | |
| const arm_merge_sort_instance_f32 * S, | |
| float32_t *pSrc, | |
| float32_t *pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @param[in,out] S points to an instance of the sorting structure. | |
| * @param[in] dir Sorting order. | |
| * @param[in] buffer Working buffer. | |
| */ | |
| void arm_merge_sort_init_f32( | |
| arm_merge_sort_instance_f32 * S, | |
| arm_sort_dir dir, | |
| float32_t * buffer); | |
| /** | |
| * @brief Copies the elements of a floating-point vector. | |
| * @param[in] pSrc input pointer | |
| * @param[out] pDst output pointer | |
| * @param[in] blockSize number of samples to process | |
| */ | |
| void arm_copy_f32( | |
| const float32_t * pSrc, | |
| float32_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Copies the elements of a floating-point vector. | |
| * @param[in] pSrc input pointer | |
| * @param[out] pDst output pointer | |
| * @param[in] blockSize number of samples to process | |
| */ | |
| void arm_copy_f64( | |
| const float64_t * pSrc, | |
| float64_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Copies the elements of a Q7 vector. | |
| * @param[in] pSrc input pointer | |
| * @param[out] pDst output pointer | |
| * @param[in] blockSize number of samples to process | |
| */ | |
| void arm_copy_q7( | |
| const q7_t * pSrc, | |
| q7_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Copies the elements of a Q15 vector. | |
| * @param[in] pSrc input pointer | |
| * @param[out] pDst output pointer | |
| * @param[in] blockSize number of samples to process | |
| */ | |
| void arm_copy_q15( | |
| const q15_t * pSrc, | |
| q15_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Copies the elements of a Q31 vector. | |
| * @param[in] pSrc input pointer | |
| * @param[out] pDst output pointer | |
| * @param[in] blockSize number of samples to process | |
| */ | |
| void arm_copy_q31( | |
| const q31_t * pSrc, | |
| q31_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Fills a constant value into a floating-point vector. | |
| * @param[in] value input value to be filled | |
| * @param[out] pDst output pointer | |
| * @param[in] blockSize number of samples to process | |
| */ | |
| void arm_fill_f32( | |
| float32_t value, | |
| float32_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Fills a constant value into a floating-point vector. | |
| * @param[in] value input value to be filled | |
| * @param[out] pDst output pointer | |
| * @param[in] blockSize number of samples to process | |
| */ | |
| void arm_fill_f64( | |
| float64_t value, | |
| float64_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Fills a constant value into a Q7 vector. | |
| * @param[in] value input value to be filled | |
| * @param[out] pDst output pointer | |
| * @param[in] blockSize number of samples to process | |
| */ | |
| void arm_fill_q7( | |
| q7_t value, | |
| q7_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Fills a constant value into a Q15 vector. | |
| * @param[in] value input value to be filled | |
| * @param[out] pDst output pointer | |
| * @param[in] blockSize number of samples to process | |
| */ | |
| void arm_fill_q15( | |
| q15_t value, | |
| q15_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Fills a constant value into a Q31 vector. | |
| * @param[in] value input value to be filled | |
| * @param[out] pDst output pointer | |
| * @param[in] blockSize number of samples to process | |
| */ | |
| void arm_fill_q31( | |
| q31_t value, | |
| q31_t * pDst, | |
| uint32_t blockSize); | |
| /** | |
| * @brief Weighted sum | |
| * | |
| * | |
| * @param[in] *in Array of input values. | |
| * @param[in] *weigths Weights | |
| * @param[in] blockSize Number of samples in the input array. | |
| * @return Weighted sum | |
| * | |
| */ | |
| float32_t arm_weighted_sum_f32(const float32_t *in | |
| , const float32_t *weigths | |
| , uint32_t blockSize); | |
| /** | |
| * @brief Barycenter | |
| * | |
| * | |
| * @param[in] in List of vectors | |
| * @param[in] weights Weights of the vectors | |
| * @param[out] out Barycenter | |
| * @param[in] nbVectors Number of vectors | |
| * @param[in] vecDim Dimension of space (vector dimension) | |
| * @return None | |
| * | |
| */ | |
| void arm_barycenter_f32(const float32_t *in | |
| , const float32_t *weights | |
| , float32_t *out | |
| , uint32_t nbVectors | |
| , uint32_t vecDim); | |
| } | |