Revision: 10204 http://pure-data.svn.sourceforge.net/pure-data/?rev=10204&view=rev Author: zmoelnig Date: 2008-07-22 14:07:12 +0000 (Tue, 22 Jul 2008)
Log Message: ----------- fixing bugs...
Modified Paths: -------------- trunk/externals/iem/iemmatrix/src/mtx_rfft.c trunk/externals/iem/iemmatrix/src/mtx_rifft.c
Modified: trunk/externals/iem/iemmatrix/src/mtx_rfft.c =================================================================== --- trunk/externals/iem/iemmatrix/src/mtx_rfft.c 2008-07-22 13:39:32 UTC (rev 10203) +++ trunk/externals/iem/iemmatrix/src/mtx_rfft.c 2008-07-22 14:07:12 UTC (rev 10204) @@ -15,13 +15,13 @@ #include "iemmatrix.h" #include <stdlib.h>
-#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H #include <fftw3.h> #endif
static t_class *mtx_rfft_class;
-#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H enum ComplexPart { REALPART=0, IMAGPART=1}; #endif
@@ -31,7 +31,7 @@ t_object x_obj; int size; int size2; -#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H int fftn; int rows; fftw_plan *fftplan; @@ -51,7 +51,7 @@
static void deleteMTXRfft (MTXRfft *x) { -#if DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H int n; if (x->fftplan) { for (n=0; n<x->rows; n++) @@ -80,7 +80,7 @@ x->list_re_out = outlet_new (&x->x_obj, gensym("matrix")); x->list_im_out = outlet_new (&x->x_obj, gensym("matrix")); x->size=x->size2=0; -#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H x->fftn=0; x->rows=0; x->f_in=0; @@ -136,7 +136,7 @@ *f++ = atom_getfloat (l++); }
-#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H static void writeFFTWComplexPartIntoList (int n, t_atom *l, fftw_complex *f, enum ComplexPart p) { for (;n--;f++, l++) @@ -161,7 +161,7 @@ int fft_count; t_atom *list_re = x->list_re; t_atom *list_im = x->list_im; -#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H fftw_complex *f_out = x->f_out; double *f_in = x->f_in; #else @@ -181,7 +181,7 @@ /* ok, do the FFT! */
/* memory things */ -#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H if ((x->rows!=rows)||(columns!=x->fftn)){ f_out=(fftw_complex*)realloc(f_out, sizeof(fftw_complex)*(size2-2)); f_in=(double*)realloc(f_in, sizeof(double)*size); @@ -190,7 +190,7 @@ for (fft_count=0; fft_count<x->rows; fft_count++) { fftw_destroy_plan(x->fftplan[fft_count]); } - x->fftplan = (fftw_plan*)realloc(x->fftplan, sizeof(fftplan)*rows); + x->fftplan = (fftw_plan*)realloc(x->fftplan, sizeof(fftw_plan)*rows); for (fft_count=0; fft_count<rows; fft_count++, f_in+=columns, f_out+=columns_re) { x->fftplan[fft_count] = fftw_plan_dft_r2c_1d (columns,f_in,f_out,FFTW_ESTIMATE); } @@ -214,7 +214,7 @@ x->list_re = list_re;
/* main part */ -#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H readDoubleFromList (size, argv, f_in); #else readFloatFromList (size, argv, f_re); @@ -223,7 +223,7 @@ list_re += 2; list_im += 2; for (fft_count=0;fft_count<rows;fft_count++){ -#if DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H fftw_execute(x->fftplan[fft_count]); writeFFTWComplexPartIntoList(columns_re,list_re,f_out,REALPART); writeFFTWComplexPartIntoList(columns_re,list_im,f_out,IMAGPART);
Modified: trunk/externals/iem/iemmatrix/src/mtx_rifft.c =================================================================== --- trunk/externals/iem/iemmatrix/src/mtx_rifft.c 2008-07-22 13:39:32 UTC (rev 10203) +++ trunk/externals/iem/iemmatrix/src/mtx_rifft.c 2008-07-22 14:07:12 UTC (rev 10204) @@ -15,13 +15,13 @@ #include "iemmatrix.h" #include <stdlib.h>
-#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H #include <fftw3.h> #endif
static t_class *mtx_rifft_class;
-#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H enum ComplexPart { REALPART=0, IMAGPART=1}; #endif
@@ -33,7 +33,7 @@ int columns_re; int size; int size2; -#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H fftw_plan *fftplan; fftw_complex *f_in; double *f_out; @@ -91,7 +91,7 @@ *++re = -*--im; }
-#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H static void readFFTWComplexPartFromList (int n, t_atom *l, fftw_complex *f, enum ComplexPart p) { for (;n--;f++, l++) @@ -114,9 +114,9 @@
static void mTXRifftMatrixCold (MTXRifft *x, t_symbol *s, - int argc, t_atom *argv) + int argc, t_atom *argv) { - int rows = atom_getint (argv++); + int rows = atom_getint (argv++); int columns_re = atom_getint (argv++); int in_size = argc-2; int columns = (columns_re-1)<<1; @@ -124,7 +124,7 @@ int size = rows * columns; int ifft_count; t_atom *list_re = x->list_re; -#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H fftw_complex *f_in = x->f_in; double *f_out = x->f_out; #else @@ -144,24 +144,24 @@ else if (columns == (1 << ilog2(columns))) {
/* memory things */ -#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H if ((x->rows!=rows)||(columns!=x->columns)){ - for (ifft_count=0;ifft_count<rows;ifft_count++) { - fftw_destroy_plan(x->fftplan[ifft_count]); - } - x->fftplan=(fftw_plan*)realloc(x->fftplan,sizeof(fftw_plan)*rows); - f_in=(fftw_complex*)realloc(f_in,sizeof(fftw_complex)*size2); - f_out=(double*)realloc(f_out,sizeof(double)*size); - x->f_out = f_out; - x->f_in = f_in; - for (ifft_count=0;ifft_count<rows;ifft_count++) { - x->fftplan[ifft_count]=fftw_plan_dft_c2r_1d(columns,f_in,f_out,FFTW_ESTIMATE); - f_out+=columns; - f_in+=columns_re; - } - f_in=x->f_in; - f_out=x->f_out; - } + for (ifft_count=0;ifft_count<x->rows;ifft_count++) { + fftw_destroy_plan(x->fftplan[ifft_count]); + } + x->fftplan=(fftw_plan*)realloc(x->fftplan,sizeof(fftw_plan)*rows); + f_in=(fftw_complex*)realloc(f_in,sizeof(fftw_complex)*size2); + f_out=(double*)realloc(f_out,sizeof(double)*size); + x->f_out = f_out; + x->f_in = f_in; + for (ifft_count=0;ifft_count<rows;ifft_count++) { + x->fftplan[ifft_count]=fftw_plan_dft_c2r_1d(columns,f_in,f_out,FFTW_ESTIMATE); + f_out+=columns; + f_in+=columns_re; + } + f_in=x->f_in; + f_out=x->f_out; + } #else f_re=(t_float*)realloc(f_re, sizeof(t_float)*size); f_im=(t_float*)realloc(f_im, sizeof(t_float)*size); @@ -179,11 +179,11 @@
/* main part: reading imaginary part */ ifft_count = rows; -#ifndef DHAVE_FFTW3 +#ifndef HAVE_FFTW3_H x->renorm_fac = 1.0f / columns; #endif while (ifft_count--) { -#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H readFFTWComplexPartFromList(columns_re, argv, f_in, IMAGPART); f_in += columns_re; #else @@ -199,7 +199,7 @@ }
static void mTXRifftMatrixHot (MTXRifft *x, t_symbol *s, - int argc, t_atom *argv) + int argc, t_atom *argv) { int rows = atom_getint (argv++); int columns_re = atom_getint (argv++); @@ -208,7 +208,7 @@ int in_size = argc-2; int size2 = x->size2; int ifft_count; -#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H fftw_complex *f_in = x->f_in; double *f_out = x->f_out; #else @@ -227,9 +227,9 @@ post("mtx_rifft: invalid right side matrix"); else { /* main part */ for (ifft_count=0;ifft_count<rows;ifft_count++){ -#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H readFFTWComplexPartFromList(columns_re,argv,f_in,REALPART); - fftw_execute(x->fftw_execute[ifft_count]); + fftw_execute(x->fftplan[ifft_count]); f_in+=columns_re; #else readFloatFromList (columns_re, argv, f_re); @@ -241,18 +241,17 @@ #endif argv += columns_re; } -#ifndef DHAVE_FFTW3 +#ifndef HAVE_FFTW3_H f_re = x->f_re; #endif size2 = x->size2;
- SETSYMBOL(x->list_re, gensym("matrix")); SETFLOAT(x->list_re, rows); SETFLOAT(x->list_re+1, x->columns); -#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H writeDoubleIntoList (size, x->list_re+2, f_out); #else - writeFloatIntoList (size, x->list_re+2, f_re); + writeFloatIntoList (size, x->list_re+2, f_re); #endif outlet_anything(x->list_re_out, gensym("matrix"), size+2, x->list_re); } @@ -262,33 +261,33 @@ { if (x->list_re) outlet_anything(x->list_re_out, gensym("matrix"), - x->size+2, x->list_re); + x->size+2, x->list_re); }
static void deleteMTXRifft (MTXRifft *x) { -#ifdef DHAVE_FFTW3 +#ifdef HAVE_FFTW3_H int n; if (x->fftplan) { - for (n=0; n<x->rows; n++) - fftw_destroy_plan(x->fftplan[n]); - free(x->fftplan); + for (n=0; n<x->rows; n++) + fftw_destroy_plan(x->fftplan[n]); + free(x->fftplan); } if (x->f_out) - free(x->f_out); + free(x->f_out); if (x->f_in) - free(x->f_in); + free(x->f_in); #else if (x->f_re) - free(x->f_re); + free(x->f_re); if (x->f_im) - free(x->f_im); + free(x->f_im); #endif if (x->list_re) - free(x->list_re); + free(x->list_re); if (x->list_im) - free(x->list_im); + free(x->list_im); }
static void mtx_rifft_setup (void)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.