C API reference¶
Include the main C API with:
#include <bfft/bfft.h>
Types¶
Type |
Description |
|---|---|
|
Opaque reusable real FFT plan. |
|
Opaque aligned scratch workspace. |
|
Double-precision complex value with |
|
Single-precision complex value with |
|
Return status enum. |
|
Descriptive layout enum. |
Version and diagnostics¶
bfft_version_string()returns the library version string.bfft_backend_name()returns the selected SIMD backend name.bfft_status_string(status)returns a readable status string.
Plan lifecycle¶
bfft_plan_create(n, &plan)creates a real FFT plan for power-of-twon >= 4.bfft_plan_destroy(plan)destroys a plan. PassingNULLis allowed.
Plan queries¶
bfft_plan_size(plan)returnsN.bfft_plan_bins(plan)returnsN / 2 + 1.bfft_plan_work_size(plan)returns double work buffer length.bfft_plan_work_size_f32(plan)returns float work buffer length.bfft_plan_native_scratch_size(plan)returns standard transform scratch size.bfft_plan_standard_policy(plan)returns the standard-output packing policy.
Forward transforms¶
bfft_forwardcomputes standard FFT-order double-precision output.bfft_forward_nativecomputes native-order double-precision output.bfft_forward_native_workspacecomputes native-order output with workspace storage.bfft_forward_f32computes standard FFT-order single-precision output.bfft_forward_native_f32computes native-order single-precision output.
Magnitude transforms¶
bfft_forward_magnitudewrites standard-order double magnitudes.bfft_forward_magnitude_f32writes standard-order float magnitudes.
Inverse transforms¶
bfft_inverseinverts standard FFT-order double-precision input.bfft_inverse_f32inverts standard FFT-order single-precision input.bfft_inverse_nativeinverts native-order double-precision input.bfft_inverse_native_f32inverts native-order single-precision input.
Layout conversion¶
bfft_native_to_standardconverts double native output to standard output.bfft_standard_to_nativeconverts double standard input to native input.bfft_native_to_standard_f32converts float native output to standard output.bfft_standard_to_native_f32converts float standard input to native input.
Residue transforms and filters¶
bfft_forward_residuestransforms real input to residue coordinates.bfft_inverse_residuestransforms residue coordinates back in place.bfft_filter_sizereturns the residue filter length.bfft_residue_filter_from_standardconverts a complex response to a residue filter.bfft_residue_filter_from_realconverts a real zero-phase response to a residue filter.bfft_apply_residue_filterapplies a residue filter in place.bfft_filter_signaltransforms, filters, and inverts a signal.
All valid BFFT real FFT plans are power-of-two plans, so residue transforms and residue filters are available for every valid plan.
STFT C ABI¶
<bfft/stft.h> exposes bfft_stft_plan, a reusable short-time transform plan.
Create it with bfft_stft_plan_create, run bfft_stft_forward, and run
bfft_stft_inverse for streaming overlap-add inversion. The inverse overlap
buffer is owned by the plan; call bfft_stft_reset_buffer before a fresh stream.
Spectrograms are row-major as output[bin * segments + segment]. Pass NULL as
the window pointer to use the default Hann window, or pass n_fft finite doubles.