erikd/sndfile-tools — pull request #10 by martinwguy (2012-08-16 19:21:16+00:00)
Title: improve calculation of FFT size for fftw speed

sndfile-spectrogram uses fftw_plan_r2r_1d() whose documentation says:
"FFTW is generally best at handling sizes of the form
2^a 3^b 5^c 7^d 11^e 13^f
where e+f is either 0 or 1, and the other exponents are arbitrary."

Before, it just added 1-32 to the size to make it a multiple of 32,
which is both wrong for speed and always gives you a bigger FFT
than the one you asked for, even if the dimension is already perfect.

This gives the same or the closest valu that is also >= the graph's height.

The resulting speedup is, for 8192 height, a factor of two (62s -> 33s)