Expand description
Fixed-point Fast Fourier Transform
This crate is intended for use with cores without an FPU and thus can perform a fixed point FFT more quickly. The FFT code uses a signed 16 bit number format, which is interpreted as a Q15 format (i.e. one sign bit, 15 fractional bits).
The code was written under the assumption that a Count Leading Zeros (CLZ) instruction is available on the target architecture.
§Examples
§FFT with complex input data
use fixed_fft::{Direction, fft_radix2_q15};
use num_complex::Complex;
let mut samples = [Complex::new(1000, 0); 4];
fft_radix2_q15(&mut samples, Direction::Forward).unwrap();
assert_eq!(samples[0], Complex::new(4000, 0));
assert_eq!(samples[1], Complex::new(0, 0));
assert_eq!(samples[2], Complex::new(0, 0));
assert_eq!(samples[3], Complex::new(0, 0));
§FFT with real input data
Note that the length of the output data is N / 2 + 1, where N is the FFT length.
use fixed_fft::fft_radix2_real_q15;
use num_complex::Complex;
let mut samples = [1000; 4];
let mut result = [Complex::new(0, 0); 3];
fft_radix2_real_q15(&mut samples, &mut result, false).unwrap();
assert_eq!(result[0], Complex::new(4000, 0));
assert_eq!(result[1], Complex::new(0, 0));
assert_eq!(result[2], Complex::new(0, 0));
Enums§
Functions§
- fft_
radix2_ q15 - Radix-2 in-place FFT
- fft_
radix2_ real_ q15 - Real value FFT using a complex valued FFT