support_functions_f16.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. #ifndef _SUPPORT_FUNCTIONS_F16_H_
  26. #define _SUPPORT_FUNCTIONS_F16_H_
  27. #include "arm_math_types_f16.h"
  28. #include "arm_math_memory.h"
  29. #include "dsp/none.h"
  30. #include "dsp/utils.h"
  31. #ifdef __cplusplus
  32. extern "C"
  33. {
  34. #endif
  35. #if defined(ARM_FLOAT16_SUPPORTED)
  36. /**
  37. * @brief Copies the elements of a floating-point vector.
  38. * @param[in] pSrc input pointer
  39. * @param[out] pDst output pointer
  40. * @param[in] blockSize number of samples to process
  41. */
  42. void arm_copy_f16(const float16_t * pSrc, float16_t * pDst, uint32_t blockSize);
  43. /**
  44. * @brief Fills a constant value into a floating-point vector.
  45. * @param[in] value input value to be filled
  46. * @param[out] pDst output pointer
  47. * @param[in] blockSize number of samples to process
  48. */
  49. void arm_fill_f16(float16_t value, float16_t * pDst, uint32_t blockSize);
  50. /**
  51. * @brief Converts the elements of the floating-point vector to Q31 vector.
  52. * @param[in] pSrc points to the f16 input vector
  53. * @param[out] pDst points to the q15 output vector
  54. * @param[in] blockSize length of the input vector
  55. */
  56. void arm_f16_to_q15(const float16_t * pSrc, q15_t * pDst, uint32_t blockSize);
  57. /**
  58. * @brief Converts the elements of the floating-point vector to Q31 vector.
  59. * @param[in] pSrc points to the q15 input vector
  60. * @param[out] pDst points to the f16 output vector
  61. * @param[in] blockSize length of the input vector
  62. */
  63. void arm_q15_to_f16(const q15_t * pSrc, float16_t * pDst, uint32_t blockSize);
  64. /**
  65. * @brief Converts the elements of the floating-point vector to Q31 vector.
  66. * @param[in] pSrc points to the f32 input vector
  67. * @param[out] pDst points to the f16 output vector
  68. * @param[in] blockSize length of the input vector
  69. */
  70. void arm_float_to_f16(const float32_t * pSrc, float16_t * pDst, uint32_t blockSize);
  71. /**
  72. * @brief Converts the elements of the floating-point vector to Q31 vector.
  73. * @param[in] pSrc points to the f16 input vector
  74. * @param[out] pDst points to the f32 output vector
  75. * @param[in] blockSize length of the input vector
  76. */
  77. void arm_f16_to_float(const float16_t * pSrc, float32_t * pDst, uint32_t blockSize);
  78. /**
  79. * @brief Weighted sum
  80. *
  81. *
  82. * @param[in] *in Array of input values.
  83. * @param[in] *weigths Weights
  84. * @param[in] blockSize Number of samples in the input array.
  85. * @return Weighted sum
  86. *
  87. */
  88. float16_t arm_weighted_sum_f16(const float16_t *in
  89. , const float16_t *weigths
  90. , uint32_t blockSize);
  91. /**
  92. * @brief Barycenter
  93. *
  94. *
  95. * @param[in] in List of vectors
  96. * @param[in] weights Weights of the vectors
  97. * @param[out] out Barycenter
  98. * @param[in] nbVectors Number of vectors
  99. * @param[in] vecDim Dimension of space (vector dimension)
  100. * @return None
  101. *
  102. */
  103. void arm_barycenter_f16(const float16_t *in
  104. , const float16_t *weights
  105. , float16_t *out
  106. , uint32_t nbVectors
  107. , uint32_t vecDim);
  108. #endif /*defined(ARM_FLOAT16_SUPPORTED)*/
  109. #ifdef __cplusplus
  110. }
  111. #endif
  112. #endif /* ifndef _SUPPORT_FUNCTIONS_F16_H_ */