arm_cfft_init_f64.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. @addtogroup ComplexFFT
  34. @{
  35. */
  36. /**
  37. @brief Initialization function for the cfft f64 function
  38. @param[in,out] S points to an instance of the floating-point CFFT structure
  39. @param[in] fftLen fft length (number of complex samples)
  40. @return execution status
  41. - \ref ARM_MATH_SUCCESS : Operation successful
  42. - \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
  43. @par Use of this function is mandatory only for the MVE version of the FFT.
  44. Other versions can still initialize directly the data structure using
  45. variables declared in arm_const_structs.h
  46. */
  47. #include "dsp/transform_functions.h"
  48. #include "arm_common_tables.h"
  49. #include "arm_const_structs.h"
  50. arm_status arm_cfft_init_f64(
  51. arm_cfft_instance_f64 * S,
  52. uint16_t fftLen)
  53. {
  54. /* Initialise the default arm status */
  55. arm_status status = ARM_MATH_SUCCESS;
  56. /* Initialise the FFT length */
  57. S->fftLen = fftLen;
  58. /* Initialise the Twiddle coefficient pointer */
  59. S->pTwiddle = NULL;
  60. /* Initializations of Instance structure depending on the FFT length */
  61. switch (S->fftLen) {
  62. #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F64_4096) && defined(ARM_TABLE_BITREVIDX_FLT_4096))
  63. /* Initializations of structure parameters for 4096 point FFT */
  64. case 4096U:
  65. /* Initialise the bit reversal table modifier */
  66. FFTINIT(f64,4096);
  67. break;
  68. #endif
  69. #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F64_2048) && defined(ARM_TABLE_BITREVIDX_FLT_2048))
  70. /* Initializations of structure parameters for 2048 point FFT */
  71. case 2048U:
  72. /* Initialise the bit reversal table modifier */
  73. FFTINIT(f64,2048);
  74. break;
  75. #endif
  76. #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F64_1024) && defined(ARM_TABLE_BITREVIDX_FLT_1024))
  77. /* Initializations of structure parameters for 1024 point FFT */
  78. case 1024U:
  79. /* Initialise the bit reversal table modifier */
  80. FFTINIT(f64,1024);
  81. break;
  82. #endif
  83. #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F64_512) && defined(ARM_TABLE_BITREVIDX_FLT_512))
  84. /* Initializations of structure parameters for 512 point FFT */
  85. case 512U:
  86. /* Initialise the bit reversal table modifier */
  87. FFTINIT(f64,512);
  88. break;
  89. #endif
  90. #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F64_256) && defined(ARM_TABLE_BITREVIDX_FLT_256))
  91. case 256U:
  92. FFTINIT(f64,256);
  93. break;
  94. #endif
  95. #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F64_128) && defined(ARM_TABLE_BITREVIDX_FLT_128))
  96. case 128U:
  97. FFTINIT(f64,128);
  98. break;
  99. #endif
  100. #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F64_64) && defined(ARM_TABLE_BITREVIDX_FLT_64))
  101. case 64U:
  102. FFTINIT(f64,64);
  103. break;
  104. #endif
  105. #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F64_32) && defined(ARM_TABLE_BITREVIDX_FLT_32))
  106. case 32U:
  107. FFTINIT(f64,32);
  108. break;
  109. #endif
  110. #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F64_16) && defined(ARM_TABLE_BITREVIDX_FLT_16))
  111. case 16U:
  112. /* Initializations of structure parameters for 16 point FFT */
  113. FFTINIT(f64,16);
  114. break;
  115. #endif
  116. default:
  117. /* Reporting argument error if fftSize is not valid value */
  118. status = ARM_MATH_ARGUMENT_ERROR;
  119. break;
  120. }
  121. return (status);
  122. }
  123. /**
  124. @} end of ComplexFFT group
  125. */