1 import ( "mrfaustlib/fft.lib" ) ;
2 import ( "mrfaustlib/complex.lib" ) ;
6 //fft2d(x,y) = vectorize(x) : vectorize(y) <: picks(n) : real2complex(n) : fft(n) : stops(n/2), pcplx_moduls(n/2) : modules_vector(n/2);
7 //fft2d(x,y) = vectorize(x) : vectorize(y) : fft(x) : fftc(y) : pcplx_moduls(y) : modules_vector(y);
8 //fft2d(x,y) = vectorize(x) : fft(x) : fftc(y) : pcplx_moduls(y) : modules_vector(y);
10 matricize(x, y) = vectorize(y) : vectorize(x);
12 ffts(n, m) = par(i, n, (fft(m) : nconcat(m)));
14 fftcs(n, m) = par(i, n, (fftc(m) : nconcat(m)));
16 lines_fft(n, m) = _ <: picks(n) : ffts(n, m) : nconcat(n);
18 lines_fftc(n, m) = _ <: picks(n) : fftcs(n, m) : nconcat(n);
20 take_column(n, m) = par(i, n, [m]) : nconcat(n);
22 matrix_transpose(n, m) = _ <: picks(n) <: par(i, m, take_column(n, i)) : nconcat(m);
24 matrix_pcplx2modul(n, m) = _ <: picks(n) : par(i, n, ( _ <: picks(m) : pcplx_moduls(m) : nconcat(m))) : nconcat(n);
26 matrix_real2pcplx(n, m) = _ <: picks(n) : par(i, n, ( _ <: picks(m) : real2pcplx(m) : nconcat(m))) : nconcat(n);
28 //normalize(n) = _ , n : /;
29 normalize(n, m) = _, (m : vectorize(n)) : /;
31 unnormalize(n) = par(i, n, ( _ , GREY_MAX : *));
33 norm_out(n, m) = _ <: picks(n) : par(i, n, ( _ <: picks(m) : unnormalize(m) : nconcat(m))) : nconcat(n) : serialize;
35 output(n, m) = serialize;
37 //fft2d(x, y) = matricize(x, y) : lines_fft(x, y) : matrix_transpose(x, y) : lines_fftc(y, x) : matrix_transpose(y, x) : output(x, y);
38 //fft2d(x, y) = normalize(GREY_MAX) : matricize(x, y) : lines_fft(x, y) : matrix_transpose(x, y) : lines_fftc(y, x) : matrix_transpose(y, x) : norm_out(x, y);
39 //fft2d(x, y) = matricize(x, y) : matrix_real2pcplx(x, y) : matrix_pcplx2modul(x, y) : output(x, y);
40 //fft2d(x, y) = matricize(x, y) : output(x, y);
41 fft2d(x, y) = normalize(GREY_MAX) : matricize(x, y) : lines_fft(x, y) : matrix_transpose(x, y) : lines_fftc(y, x) : matrix_transpose(y, x) : norm_out(x, y);
43 new_fft2d(x, y) = normalize(y, GREY_MAX) : vectorize(x) : lines_fft(x, y) : matrix_transpose(x, y) : lines_fftc(y, x) : matrix_transpose(y, x) : norm_out(x, y);
45 //safer with x=y because tests and zero padding are still to implement
46 //process = fft2d(32,32);
48 //process = new_fft2d(32,32);