Open SergiusPaulus opened 8 years ago
True that ffts lacks documentation, but 2d and higher ranks use common practice; rows are transformed using 1d transform followed by transpose and transform of cols using 1d transform followed by final transpose. The real data is stored as a row-major array of size n0 × n1 and the complex data is stored as a row-major array of size n0 × (n1/2 + 1). Row-major order is the standard C array storage order. You may find this helpful.
But clearly we need to add proper examples and tests how-to use ffts for various problems.
linkotec, Thank you very much for answering. I'm a rookie, so I'm unaware of know common practice. What you said is indeed helpful but I am now puzzled about the size of input and output buffers bc in issue #46 in January of this year. (https://github.com/anthonix/ffts/issues/46) you said to csolorio:
If your input data is image or other two dimensional array of values, you should use ffts_init_2d_real. Width bw and height bh of array must be powers of 2, and you should allocate buffer which size is 2 * bw * bh * sizeof(float)
and earlier in that same issue you wrote:
Real transform of N elements is implemented using N/2 complex transform.
Forward transform input is N real values and output is (N/2)+1 complex values
input_buffer = _mm_malloc(N * sizeof(float)); output_buffer = _mm_malloc(2 * ((N/2)+1) * sizeof(float));
I am using input data that is 2d and have done it in row major order, and so I am using ffts_init_2d_real(). My width and height are 512 (a power of 2). But it seems there are several ways to calculate size of buffers including:
1) 2 * bw * bh * sizeof(float) -- it was not stated if this is for input or output or complex or real 2) n0 x n1 -- you said use this for the row-major real data (I assume input buffer) 3) n0 x (n1/2 + 1) -- you said use this for row-major complex data (I assume input buffer) 4) 2 * ((N/2)+1) * sizeof(float) -- you specified output_buffer 5) N * sizeof(float) -- you specified input_buffer 6) 64 * 64 * sizeof(float) -- this is this is from issue #5 closed by anthonix in 2013 7) 64 * (64 / 2 + 1) * 2 * sizeof(float) -- this is from same issue #5
It's clear that some are just different ways of doing the same thing. However, sometimes 2 * is used, sometimes not. 2 * is used in #1, #4 and #7. I don't know when to use 2 * and when not to use it.
Hey, trying hard to use this great fft library. Is there a short example of how to use ffts_init_2d_real() with ffts_execute? Only example is a 1d. And what I can glean from a couple of bug reports on use of ffts_init_2d_real() leaves me confused. Or should I use Stack Overflow?