-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2D FFT #23
Comments
Certainly not the most efficient way, but you do know that 2D FFT is just a FFT over all the rows and of this intermediate result all the cols? (or the other way around, doesn't matter)? So in that case make an Array of Arrays, perform a 1D FFT and then rearrange the contents so the array goes over cols/rows and perform the FFT another time. If you want a more performant solution I suggest altering the library with variants with an offset and a step paramter to the core functions. Which this you can have a data array of the size rows*cols. Then call it row times with increasing i*rowlength offset, then call it another time of col times with i offset and i*rowlength as step parameter into the data. As far I remember this is how KISS did it. (It didn't need an offset parameter tough, due to C pointer arithmetic). PS: Which brings me to, @maintainer, have you tried to use typed arrays? like Float64Array? IMO this could possible improve perfmance, @Bobingstern I think this would a way to get good perfomance without changing the library, instead of having it constructing the ComplexArrays itself, just hand it TypedArrays of Float64Array, I think it shouldn't notice, and with these basing on a Buffer you can modify offset and spread aka stepwith.. I doubt you get better performance than that. |
FYI: I experimented a little with typed arrays. fft.js gets ~25% slower simply from using them as dropin replacement for plain Arrays. (node v18.14.0). I don't understand why, has to do with some nifty js optimizations I guess. |
What is the most efficient way to perform a 2D FFT using this library?
The text was updated successfully, but these errors were encountered: