arm_cfft_init_f64.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: arm_cfft_init_f64.c
  4. * Description: Initialization function for cfft f64 instance
  5. *
  6. * $Date: 23 April 2021
  7. * $Revision: V1.9.0
  8. *
  9. * Target Processor: Cortex-M and Cortex-A cores
  10. * -------------------------------------------------------------------- */
  11. /*
  12. * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
  13. *
  14. * SPDX-License-Identifier: Apache-2.0
  15. *
  16. * Licensed under the Apache License, Version 2.0 (the License); you may
  17. * not use this file except in compliance with the License.
  18. * You may obtain a copy of the License at
  19. *
  20. * www.apache.org/licenses/LICENSE-2.0
  21. *
  22. * Unless required by applicable law or agreed to in writing, software
  23. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  24. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  25. * See the License for the specific language governing permissions and
  26. * limitations under the License.
  27. */
  28. #define FFTINIT(EXT,SIZE) \
  29. S->bitRevLength = arm_cfft_sR_##EXT##_len##SIZE.bitRevLength; \
  30. S->pBitRevTable = arm_cfft_sR_##EXT##_len##SIZE.pBitRevTable; \
  31. S->pTwiddle = arm_cfft_sR_##EXT##_len##SIZE.pTwiddle;
  32. /**
  33. * @defgroup ComplexFFTF64 Complex FFT F64
  34. */
  35. /**
  36. @ingroup groupTransforms
  37. */
  38. /**
  39. @addtogroup ComplexFFT
  40. @{
  41. */
  42. /**
  43. @addtogroup ComplexFFTF64
  44. @{
  45. */
  46. #include "dsp/transform_functions.h"
  47. #include "arm_common_tables.h"
  48. #include "arm_const_structs.h"
  49. #define CFFTINIT_F64(LEN) \
  50. arm_status arm_cfft_init_##LEN##_f64(arm_cfft_instance_f64 * S)\
  51. { \
  52. /* Initialise the default arm status */ \
  53. arm_status status = ARM_MATH_SUCCESS; \
  54. \
  55. /* Initialise the FFT length */ \
  56. S->fftLen = LEN; \
  57. \
  58. /* Initialise the Twiddle coefficient pointer */ \
  59. S->pTwiddle = NULL; \
  60. \
  61. FFTINIT(f64,LEN); \
  62. \
  63. return (status); \
  64. }
  65. /**
  66. @brief Initialization function for the cfft f64 function with 4096 samples
  67. @param[in,out] S points to an instance of the floating-point CFFT structure
  68. @return execution status
  69. - \ref ARM_MATH_SUCCESS : Operation successful
  70. - \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
  71. @par Use of this function is mandatory only for the MVE version of the FFT.
  72. Other versions can still initialize directly the data structure using
  73. variables declared in arm_const_structs.h
  74. */
  75. CFFTINIT_F64(4096)
  76. /**
  77. @brief Initialization function for the cfft f64 function with 2048 samples
  78. @param[in,out] S points to an instance of the floating-point CFFT structure
  79. @return execution status
  80. - \ref ARM_MATH_SUCCESS : Operation successful
  81. - \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
  82. @par Use of this function is mandatory only for the MVE version of the FFT.
  83. Other versions can still initialize directly the data structure using
  84. variables declared in arm_const_structs.h
  85. */
  86. CFFTINIT_F64(2048)
  87. /**
  88. @brief Initialization function for the cfft f64 function with 1024 samples
  89. @param[in,out] S points to an instance of the floating-point CFFT structure
  90. @return execution status
  91. - \ref ARM_MATH_SUCCESS : Operation successful
  92. - \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
  93. @par Use of this function is mandatory only for the MVE version of the FFT.
  94. Other versions can still initialize directly the data structure using
  95. variables declared in arm_const_structs.h
  96. */
  97. CFFTINIT_F64(1024)
  98. /**
  99. @brief Initialization function for the cfft f64 function with 512 samples
  100. @param[in,out] S points to an instance of the floating-point CFFT structure
  101. @return execution status
  102. - \ref ARM_MATH_SUCCESS : Operation successful
  103. - \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
  104. @par Use of this function is mandatory only for the MVE version of the FFT.
  105. Other versions can still initialize directly the data structure using
  106. variables declared in arm_const_structs.h
  107. */
  108. CFFTINIT_F64(512)
  109. /**
  110. @brief Initialization function for the cfft f64 function with 256 samples
  111. @param[in,out] S points to an instance of the floating-point CFFT structure
  112. @return execution status
  113. - \ref ARM_MATH_SUCCESS : Operation successful
  114. - \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
  115. @par Use of this function is mandatory only for the MVE version of the FFT.
  116. Other versions can still initialize directly the data structure using
  117. variables declared in arm_const_structs.h
  118. */
  119. CFFTINIT_F64(256)
  120. /**
  121. @brief Initialization function for the cfft f64 function with 128 samples
  122. @param[in,out] S points to an instance of the floating-point CFFT structure
  123. @return execution status
  124. - \ref ARM_MATH_SUCCESS : Operation successful
  125. - \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
  126. @par Use of this function is mandatory only for the MVE version of the FFT.
  127. Other versions can still initialize directly the data structure using
  128. variables declared in arm_const_structs.h
  129. */
  130. CFFTINIT_F64(128)
  131. /**
  132. @brief Initialization function for the cfft f64 function with 64 samples
  133. @param[in,out] S points to an instance of the floating-point CFFT structure
  134. @return execution status
  135. - \ref ARM_MATH_SUCCESS : Operation successful
  136. - \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
  137. @par Use of this function is mandatory only for the MVE version of the FFT.
  138. Other versions can still initialize directly the data structure using
  139. variables declared in arm_const_structs.h
  140. */
  141. CFFTINIT_F64(64)
  142. /**
  143. @brief Initialization function for the cfft f64 function with 32 samples
  144. @param[in,out] S points to an instance of the floating-point CFFT structure
  145. @return execution status
  146. - \ref ARM_MATH_SUCCESS : Operation successful
  147. - \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
  148. @par Use of this function is mandatory only for the MVE version of the FFT.
  149. Other versions can still initialize directly the data structure using
  150. variables declared in arm_const_structs.h
  151. */
  152. CFFTINIT_F64(32)
  153. /**
  154. @brief Initialization function for the cfft f64 function with 16 samples
  155. @param[in,out] S points to an instance of the floating-point CFFT structure
  156. @return execution status
  157. - \ref ARM_MATH_SUCCESS : Operation successful
  158. - \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
  159. @par Use of this function is mandatory only for the MVE version of the FFT.
  160. Other versions can still initialize directly the data structure using
  161. variables declared in arm_const_structs.h
  162. */
  163. CFFTINIT_F64(16)
  164. /**
  165. @brief Generic initialization function for the cfft f64 function
  166. @param[in,out] S points to an instance of the floating-point CFFT structure
  167. @param[in] fftLen fft length (number of complex samples)
  168. @return execution status
  169. - \ref ARM_MATH_SUCCESS : Operation successful
  170. - \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
  171. @par Use of this function is mandatory only for the MVE version of the FFT.
  172. Other versions can still initialize directly the data structure using
  173. variables declared in arm_const_structs.h
  174. @par This function should be used only if you don't know the FFT sizes that
  175. you'll need at build time. The use of this function will prevent the
  176. linker from removing the FFT tables that are not needed and the library
  177. code size will be bigger than needed.
  178. @par If you use CMSIS-DSP as a static library, and if you know the FFT sizes
  179. that you need at build time, then it is better to use the initialization
  180. functions defined for each FFT size.
  181. */
  182. arm_status arm_cfft_init_f64(
  183. arm_cfft_instance_f64 * S,
  184. uint16_t fftLen)
  185. {
  186. /* Initialise the default arm status */
  187. arm_status status = ARM_MATH_SUCCESS;
  188. /* Initializations of Instance structure depending on the FFT length */
  189. switch (fftLen) {
  190. /* Initializations of structure parameters for 4096 point FFT */
  191. case 4096U:
  192. /* Initialise the bit reversal table modifier */
  193. status = arm_cfft_init_4096_f64(S);
  194. break;
  195. /* Initializations of structure parameters for 2048 point FFT */
  196. case 2048U:
  197. /* Initialise the bit reversal table modifier */
  198. status = arm_cfft_init_2048_f64(S);
  199. break;
  200. /* Initializations of structure parameters for 1024 point FFT */
  201. case 1024U:
  202. /* Initialise the bit reversal table modifier */
  203. status = arm_cfft_init_1024_f64(S);
  204. break;
  205. /* Initializations of structure parameters for 512 point FFT */
  206. case 512U:
  207. /* Initialise the bit reversal table modifier */
  208. status = arm_cfft_init_512_f64(S);
  209. break;
  210. case 256U:
  211. status = arm_cfft_init_256_f64(S);
  212. break;
  213. case 128U:
  214. status = arm_cfft_init_128_f64(S);
  215. break;
  216. case 64U:
  217. status = arm_cfft_init_64_f64(S);
  218. break;
  219. case 32U:
  220. status = arm_cfft_init_32_f64(S);
  221. break;
  222. case 16U:
  223. /* Initializations of structure parameters for 16 point FFT */
  224. status = arm_cfft_init_16_f64(S);
  225. break;
  226. default:
  227. /* Reporting argument error if fftSize is not valid value */
  228. status = ARM_MATH_ARGUMENT_ERROR;
  229. break;
  230. }
  231. return (status);
  232. }
  233. /**
  234. @} end of ComplexFFTF64 group
  235. */
  236. /**
  237. @} end of ComplexFFT group
  238. */