Search code examples
signal-processingfftcorrelationkissfft

kissfft scaling


I am looking to compute a fast correlation using FFTs and the kissfft library, and scaling needs to be precise. What scaling is necessary (forward and backwards) and what value do I use to scale my data?


Solution

  • The 3 most common FFT scaling factors are:

    • 1.0 forward FFT, 1.0/N inverse FFT

    • 1.0/N forward FFT, 1.0 inverse FFT

    • 1.0/sqrt(N) in both directions, FFT & IFFT

    Given any possible ambiguity in the documentation, and for whatever scaling the user expects to be "correct" for their purposes, best to just feed a pure sine wave of known (1.0 float or 255 integer) amplitude and exactly periodic in the FFT length to the FFT (and/or IFFT) in question, and see if the scaling matches one of the above, is maybe different from one of the above by 2X or sqrt(2), or the desired scaling is something completely different.

    e.g. Write a unit test for kissfft in your environment for your data types.