Peter
Peter

Reputation: 11920

Simple fft example from libffmpeg

I currently have my own FFT code The prototype is

void doFFT(short* data, int nSamples);

Parameter datais 2*nSamples in size. The output is returned back in the same variable.

I would like to replace my FFT code with the one from libffmpeg. I have looked at the test sample for FFT at https://ffmpeg.org/doxygen/trunk/fft-test_8c-source.html. However, it is not clear to me on how to use it properly. I am wondering if someone can share some pseudo-code or point me in the right direction.

Upvotes: 1

Views: 1979

Answers (1)

Ronald S. Bultje
Ronald S. Bultje

Reputation: 11184

See for example this code in FFmpeg's on2avc decoder, you call permute/calc in a loop (and init/end once each). Each FFT iteration is on 2^nbits samples, where nbits is the size of the FFT. If you want to do a FFT on n_samples where n_samples is much larger than nbits, you typically do iterations of FFT on 2^nbits samples each until you've done the FFT on all samples. Overlap etc. is up to you, probably depending on what your original code did.

Upvotes: 1

Related Questions