basic_math_functions_f16.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /******************************************************************************
  2. * @file basic_math_functions_f16.h
  3. * @brief Public header file for CMSIS DSP Library
  4. * @version V1.10.0
  5. * @date 08 July 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 _BASIC_MATH_FUNCTIONS_F16_H_
  26. #define _BASIC_MATH_FUNCTIONS_F16_H_
  27. #ifdef __cplusplus
  28. extern "C"
  29. {
  30. #endif
  31. #include "arm_math_types_f16.h"
  32. #include "arm_math_memory.h"
  33. #include "dsp/none.h"
  34. #include "dsp/utils.h"
  35. #if defined(ARM_FLOAT16_SUPPORTED)
  36. /**
  37. * @brief Floating-point vector addition.
  38. * @param[in] pSrcA points to the first input vector
  39. * @param[in] pSrcB points to the second input vector
  40. * @param[out] pDst points to the output vector
  41. * @param[in] blockSize number of samples in each vector
  42. */
  43. void arm_add_f16(
  44. const float16_t * pSrcA,
  45. const float16_t * pSrcB,
  46. float16_t * pDst,
  47. uint32_t blockSize);
  48. /**
  49. * @brief Floating-point vector subtraction.
  50. * @param[in] pSrcA points to the first input vector
  51. * @param[in] pSrcB points to the second input vector
  52. * @param[out] pDst points to the output vector
  53. * @param[in] blockSize number of samples in each vector
  54. */
  55. void arm_sub_f16(
  56. const float16_t * pSrcA,
  57. const float16_t * pSrcB,
  58. float16_t * pDst,
  59. uint32_t blockSize);
  60. /**
  61. * @brief Multiplies a floating-point vector by a scalar.
  62. * @param[in] pSrc points to the input vector
  63. * @param[in] scale scale factor to be applied
  64. * @param[out] pDst points to the output vector
  65. * @param[in] blockSize number of samples in the vector
  66. */
  67. void arm_scale_f16(
  68. const float16_t * pSrc,
  69. float16_t scale,
  70. float16_t * pDst,
  71. uint32_t blockSize);
  72. /**
  73. * @brief Floating-point vector absolute value.
  74. * @param[in] pSrc points to the input buffer
  75. * @param[out] pDst points to the output buffer
  76. * @param[in] blockSize number of samples in each vector
  77. */
  78. void arm_abs_f16(
  79. const float16_t * pSrc,
  80. float16_t * pDst,
  81. uint32_t blockSize);
  82. /**
  83. * @brief Adds a constant offset to a floating-point vector.
  84. * @param[in] pSrc points to the input vector
  85. * @param[in] offset is the offset to be added
  86. * @param[out] pDst points to the output vector
  87. * @param[in] blockSize number of samples in the vector
  88. */
  89. void arm_offset_f16(
  90. const float16_t * pSrc,
  91. float16_t offset,
  92. float16_t * pDst,
  93. uint32_t blockSize);
  94. /**
  95. * @brief Dot product of floating-point vectors.
  96. * @param[in] pSrcA points to the first input vector
  97. * @param[in] pSrcB points to the second input vector
  98. * @param[in] blockSize number of samples in each vector
  99. * @param[out] result output result returned here
  100. */
  101. void arm_dot_prod_f16(
  102. const float16_t * pSrcA,
  103. const float16_t * pSrcB,
  104. uint32_t blockSize,
  105. float16_t * result);
  106. /**
  107. * @brief Floating-point vector multiplication.
  108. * @param[in] pSrcA points to the first input vector
  109. * @param[in] pSrcB points to the second input vector
  110. * @param[out] pDst points to the output vector
  111. * @param[in] blockSize number of samples in each vector
  112. */
  113. void arm_mult_f16(
  114. const float16_t * pSrcA,
  115. const float16_t * pSrcB,
  116. float16_t * pDst,
  117. uint32_t blockSize);
  118. /**
  119. * @brief Negates the elements of a floating-point vector.
  120. * @param[in] pSrc points to the input vector
  121. * @param[out] pDst points to the output vector
  122. * @param[in] blockSize number of samples in the vector
  123. */
  124. void arm_negate_f16(
  125. const float16_t * pSrc,
  126. float16_t * pDst,
  127. uint32_t blockSize);
  128. /**
  129. @brief Elementwise floating-point clipping
  130. @param[in] pSrc points to input values
  131. @param[out] pDst points to output clipped values
  132. @param[in] low lower bound
  133. @param[in] high higher bound
  134. @param[in] numSamples number of samples to clip
  135. @return none
  136. */
  137. void arm_clip_f16(const float16_t * pSrc,
  138. float16_t * pDst,
  139. float16_t low,
  140. float16_t high,
  141. uint32_t numSamples);
  142. #endif /* defined(ARM_FLOAT16_SUPPORTED)*/
  143. #ifdef __cplusplus
  144. }
  145. #endif
  146. #endif /* ifndef _BASIC_MATH_FUNCTIONS_F16_H_ */