src/fftlib.js
function fft2d(re, im) {
    var tre = [],
        tim = [],
        i = 0;
    // x-axis
    for (var y = 0; y < _n; y++) {
        i = y * _n;
        for (var x1 = 0; x1 < _n; x1++) {
            tre[x1] = re[x1 + i];
            tim[x1] = im[x1 + i];
        }
        fft1d(tre, tim);
        for (var x2 = 0; x2 < _n; x2++) {
            re[x2 + i] = tre[x2];
            im[x2 + i] = tim[x2];
        }
    }
    // y-axis
    for (var x = 0; x < _n; x++) {
        for (var y1 = 0; y1 < _n; y1++) {
            i = x + y1 * _n;
            tre[y1] = re[i];
            tim[y1] = im[i];
        }
        fft1d(tre, tim);
        for (var y2 = 0; y2 < _n; y2++) {
            i = x + y2 * _n;
            re[i] = tre[y2];
            im[i] = tim[y2];
        }
    }
}
function fft2d(re, im) {
    var tre = [],
        tim = [],
        i = 0;
    // x-axis
    for (var y = 0; y < _n; y++) {
        i = y * _n;
        for (var x1 = 0; x1 < _n; x1++) {
            tre[x1] = re[x1 + i];
            tim[x1] = im[x1 + i];
        }
        fft1d(tre, tim);
        for (var x2 = 0; x2 < _n; x2++) {
            re[x2 + i] = tre[x2];
            im[x2 + i] = tim[x2];
        }
    }
    // y-axis
    for (var x = 0; x < _n; x++) {
        for (var y1 = 0; y1 < _n; y1++) {
            i = x + y1 * _n;
            tre[y1] = re[i];
            tim[y1] = im[i];
        }
        fft1d(tre, tim);
        for (var y2 = 0; y2 < _n; y2++) {
            i = x + y2 * _n;
            re[i] = tre[y2];
            im[i] = tim[y2];
        }
    }
}
function fft2d ( re , im ) { var tre = [ ] , tim = [ ] , i = 0 ; // x-axis for ( var y = 0 ; y < _n ; y ++ ) { i = y * _n ; for ( var x1 = 0 ; x1 < _n ; x1 ++ ) { tre [ x1 ] = re [ x1 + i ] ; tim [ x1 ] = im [ x1 + i ] ; } fft1d ( tre , tim ) ; for ( var x2 = 0 ; x2 < _n ; x2 ++ ) { re [ x2 + i ] = tre [ x2 ] ; im [ x2 + i ] = tim [ x2 ] ; } } // y-axis for ( var x = 0 ; x < _n ; x ++ ) { for ( var y1 = 0 ; y1 < _n ; y1 ++ ) { i = x + y1 * _n ; tre [ y1 ] = re [ i ] ; tim [ y1 ] = im [ i ] ; } fft1d ( tre , tim ) ; for ( var y2 = 0 ; y2 < _n ; y2 ++ ) { i = x + y2 * _n ; re [ i ] = tre [ y2 ] ; im [ i ] = tim [ y2 ] ; } } }
2D-FFT Not very useful if the number of rows have to be equal to cols
2D - FFT Not very useful if the number of rows have to be equal to cols