zsiciarz / aquila

Aquila is a digital signal processing library for C++11.
http://aquila-dsp.org
MIT License
460 stars 112 forks source link

Segment fault with Aquila::OouraFft::ifft() #27

Closed sqbing closed 10 years ago

sqbing commented 10 years ago

I wrote a demo following examples/fft_filter.cpp. Instead of using sine generator, i read a wav file as data source. When size is big enough, say 44100, aquila cores with ifft().

Here is my gdb output: (gdb) bt

0 0x0000000100012e14 in cftmdl ()

1 0x000000010000e950 in cftfsub ()

2 0x000000010000e006 in cdft ()

3 0x000000010000bc15 in Aquila::OouraFft::ifft ()

4 0x0000000100001ce9 in main (argc=2, argv=0x7fff5fbffad0) at filter_wav.cpp:32

Code is here: https://gist.github.com/sqbing/8516543

Thank you.

sqbing commented 10 years ago

const char* const VERSION_STRING = "3.0.0-dev"

zsiciarz commented 10 years ago

It is a known issue, unfortunately underdocumented at the moment. Basically, the *fft() methods assume that input length is a power of 2 and it's the caller's responsibility to zero-pad the signal so its length is a next possible power of 2 (so in your example the value of SIZE = 65536 doesn't cause a segfault, although the TextPlot output is rather useless in that case).

To sum up, this is still a design decision whether FFT methods in Aquila's public API should zero-pad the input themselves or leave that responsibility to the caller. Anyway, there are some FFT routines in Ooura's code that work with non-power-of-2 input lengths and it may be reasonable to call these specialized functions in such cases.

Thanks for bringing my attention to this topic. For now I'm going to close this issue, but I will keep it in mind before final 3.0 release.

ghost commented 9 years ago

Hi! I've got the same error using code from example http://aquila-dsp.org/articles/updated-frequency-domain-filtering-example/ and my version of Aquila is 3.0.0. So this error haven't been fixed before this release?