[Speex-dev] question about spx_fft

Jean-Marc Valin jean-marc.valin at usherbrooke.ca
Sun Apr 15 01:41:49 PDT 2007


> Is the spx_fft function in fftwrap.c a standard fft function?
> void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out)
> 
> When I say standard, I mean the input "in" is 128 point short data for
> example and
> the output "out" is 128 short complex value which is stored in 256
> short array with real and
> image part.  Looks like the function did some manipulation on the
> output from the kiss_fft. I am
> still reading the codes and am not completely understand the code yet.
> I am trying to replace
> the fft module with some hardware logic. I would greatly appreciate it
> if you could clarify my
> doubts.

spx_fft() computes a real-data FFT. For a size N, it takes N real values
as input and outputs N/2+1 real values and N/2-1 imaginary values.
The packing format it uses is:
RRIRIRIRIRI...RIR

(note that it starts with two real values and ends with one).
Also, unlike some floating-point conventions, the forward FFT normalises
by 1/N (to avoid overflows), while the inverse FFT doesn't do
normalisation at all (because the output is assumed to have proper scaling.

As for the mangling in fftwrap.c, that was just to change the ordering
of kiss-fft to fit the one Speex wants. I removed it recently because I
directly modified kiss_fft to give me the results with the right ordering.

	Jean-Marc


More information about the Speex-dev mailing list