Skip to content
Enrique Condes edited this page Nov 21, 2024 · 5 revisions

Optimizations

Existing optimziations are focused on improving the algorithm performance by improving speed and most of them are not mutually exclusive (Several can be used simultaneously). The only exception is FFT_SQRT_APPROXIMATION and sqrt_internal

FFT_SPEED_OVER_PRECISION

Replaces most divisions in the code, instead using a multiplication by a reciprocal value. This is faster but prone to precision errors caused by the binary representation of decimal values.

Usage

When including the library, add #define FFT_SPEED_OVER_PRECISION before #include <arduinoFFT.h>

sqrt_internal (Since v2.0.1)

Allows specifying which function to use for the square root operations.

Usage

When including the library, add #define sqrt_internal sqrt or #define sqrt_internal sqrtf before #include <arduinoFFT.h>. If nothing is specified, sqrt is selected by default.

FFT_SQRT_APPROXIMATION

This definition supersedes the sqrt_internal definition. Uses a square root approximation based on the "Quake 3 fast inverse square root" instead of calling the sqrt() function. More information here

Usage

When including the library, add #define FFT_SQRT_APPROXIMATION before #include <arduinoFFT.h>

USE_AVR_PROGMEM

Stores factors for the FFT computation along with the program instead of computing them as required. Only has effect on AVR architecture devices.

Usage

When including the library, add #define USE_AVR_PROGMEM before #include <arduinoFFT.h>

COMPLEX_INPUT (Since v2.0.4)

Does bit reversal on both the real and imaginary parts of the input data. Without this definition, the default behaviour is to assumed that the imaginary part of the input data is irrelevant, which reduces processing time. Add this definition to override that.

Usage

When including the library, add #define COMPLEX_INPUT before #include <arduinoFFT.h>