From: hackbard Date: Fri, 8 Oct 2004 10:06:09 +0000 (+0000) Subject: improved "clever way" method - seems to work now .. strange it didnt before! X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca7f1b4863603c483550030dcbadcb748a7b2702;p=my-code%2Fapi.git improved "clever way" method - seems to work now .. strange it didnt before! --- diff --git a/fourier/fourier.c b/fourier/fourier.c index 9f810ec..89f42c2 100644 --- a/fourier/fourier.c +++ b/fourier/fourier.c @@ -220,22 +220,22 @@ int fourier_dft_2d(t_fourier *fourier) { } // dft on index 2 of 'index 1 transformed data' for(x=0;xoutfd,"[fourier] (u=%d,v=%d)\n",v,x); - off_r=0; + off_r=x; for(y=0;yftdata[off_f+x].r+=(cos(arg)*data[off_r+x].r-sin(arg)*data[off_r+x].i); - fourier->ftdata[off_f+x].r+=(sin(arg)*data[off_r+x].r+cos(arg)*data[off_r+x].i); + fourier->ftdata[off_f].r+=(cos(arg)*data[off_r].r-sin(arg)*data[off_r].i); + fourier->ftdata[off_f].r+=(sin(arg)*data[off_r].r+cos(arg)*data[off_r].i); off_r+=X; } - fourier->ftdata[off_f+x].r/=Y; - fourier->ftdata[off_f+x].i/=Y; + fourier->ftdata[off_f].r/=Y; + fourier->ftdata[off_f].i/=Y; off_f+=X; } } - + free(data); return F_SUCCESS;