fft_core.h 790 B

12345678910111213141516171819202122232425262728
  1. #pragma once
  2. #include <stddef.h>
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. // Generate twiddle factors cos/sin for size N (N must be power of 2)
  7. // Wc and Ws must have length at least N/2 (float32)
  8. void luat_fft_generate_twiddles(int N, float* Wc, float* Ws);
  9. // In-place iterative radix-2 FFT
  10. // If Wc/Ws are NULL, twiddles are computed on the fly
  11. void luat_fft_run_inplace(float* real, float* imag, int N,
  12. const float* Wc, const float* Ws);
  13. // In-place IFFT with 1/N normalization
  14. void luat_ifft_run_inplace(float* real, float* imag, int N,
  15. const float* Wc, const float* Ws);
  16. // Frequency-domain integral: X(ω) -> X(ω)/(jω)
  17. // n is FFT size, df is frequency resolution fs/n
  18. void luat_fft_integral_inplace(float* xr, float* xi, int n, float df);
  19. #ifdef __cplusplus
  20. }
  21. #endif