From: hackbard Date: Thu, 7 Oct 2004 19:04:24 +0000 (+0000) Subject: bugfix - still not 100% ok X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e73e99a5415a252a15883b7f3594411781d2e9e;p=my-code%2Fapi.git bugfix - still not 100% ok --- diff --git a/fourier/fourier.c b/fourier/fourier.c index 4f395f5..9f810ec 100644 --- a/fourier/fourier.c +++ b/fourier/fourier.c @@ -183,25 +183,23 @@ int fourier_dft_2d(t_fourier *fourier) { if(fourier->type&BWD) return F_NOT_SUPPORTED; /* stupid way */ - - // for(v=0;voutfd,"[fourier] (u=%d,v=%d)\n",u,v); - // fourier->ftdata[off_f+u].r=0; - // fourier->ftdata[off_f+u].i=0; - // for(y=0;yftdata[off_f+u].r+=(cos(arg)*fourier->data[off_r+x].r-sin(arg)*fourier->data[off_r+x].i); - // fourier->ftdata[off_f+u].i+=(sin(arg)*fourier->data[off_r+x].r+cos(arg)*fourier->data[off_r+x].i); - // } - // } - // fourier->ftdata[off_f+u].r/=(X*Y); - // fourier->ftdata[off_f+u].i/=(X*Y); - // } - // } + /* + for(v=0;vftdata[off_f+u].r+=(cos(arg)*fourier->data[off_r+x].r-sin(arg)*fourier->data[off_r+x].i); + fourier->ftdata[off_f+u].i+=(sin(arg)*fourier->data[off_r+x].r+cos(arg)*fourier->data[off_r+x].i); + } + } + fourier->ftdata[off_f+u].r/=(X*Y); + fourier->ftdata[off_f+u].i/=(X*Y); + } + } + */ /* the more clever way ... */ // dft on index 1 @@ -221,20 +219,21 @@ int fourier_dft_2d(t_fourier *fourier) { off_f+=X; } // dft on index 2 of 'index 1 transformed data' - off_f=0; for(x=0;xoutfd,"[fourier] (u=%d,v=%d)\n",v,x); + off_r=0; for(y=0;yftdata[off_f+v].r+=(cos(arg)*data[off_r].r-sin(arg)*data[off_r].i); - fourier->ftdata[off_f+v].r+=(sin(arg)*data[off_r].r+cos(arg)*data[off_r].i); + fourier->ftdata[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); + off_r+=X; } - fourier->ftdata[off_f+v].r/=Y; - fourier->ftdata[off_f+v].i/=Y; + fourier->ftdata[off_f+x].r/=Y; + fourier->ftdata[off_f+x].i/=Y; + off_f+=X; } - off_f+=Y; } free(data);