Check that AltiVec is enabled before using it
[openal-soft.git] / common / alcomplex.h
blob9f12cef32cd2e61a2dd86c004303ac80e7db3121
1 #ifndef ALCOMPLEX_H
2 #define ALCOMPLEX_H
4 #include <complex>
6 #include "alspan.h"
8 /**
9 * Iterative implementation of 2-radix FFT (In-place algorithm). Sign = -1 is
10 * FFT and 1 is inverse FFT. Applies the Discrete Fourier Transform (DFT) to
11 * the data supplied in the buffer, which MUST BE power of two.
13 void complex_fft(const al::span<std::complex<double>> buffer, const double sign);
15 /**
16 * Calculate the frequency-domain response of the time-domain signal in the
17 * provided buffer, which MUST BE power of two.
19 inline void forward_fft(const al::span<std::complex<double>> buffer)
20 { complex_fft(buffer, -1.0); }
22 /**
23 * Calculate the time-domain signal of the frequency-domain response in the
24 * provided buffer, which MUST BE power of two.
26 inline void inverse_fft(const al::span<std::complex<double>> buffer)
27 { complex_fft(buffer, +1.0); }
29 /**
30 * Calculate the complex helical sequence (discrete-time analytical signal) of
31 * the given input using the discrete Hilbert transform (In-place algorithm).
32 * Fills the buffer with the discrete-time analytical signal stored in the
33 * buffer. The buffer is an array of complex numbers and MUST BE power of two,
34 * and the imaginary components should be cleared to 0.
36 void complex_hilbert(const al::span<std::complex<double>> buffer);
38 #endif /* ALCOMPLEX_H */