Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22940
Modified Files:
Tag: devel_0_37
d_fft.c
Log Message:
bug fixed, that could create / remove the nyquist frequency in the rfft/rifft objects (fftw)
Index: d_fft.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_fft.c,v
retrieving revision 1.1.1.1.16.2
retrieving revision 1.1.1.1.16.3
diff -C2 -d -r1.1.1.1.16.2 -r1.1.1.1.16.3
*** d_fft.c 5 Mar 2004 21:19:37 -0000 1.1.1.1.16.2
--- d_fft.c 8 Apr 2004 16:53:08 -0000 1.1.1.1.16.3
***************
*** 296,300 ****
x->plan = fftwf_plan_guru_split_dft(1, &(x->dim), 0, NULL, x->inreal,
x->inimag, x->outreal, x->outimag,
! FFTW_MEASURE);
return (x);
}
--- 296,300 ----
x->plan = fftwf_plan_guru_split_dft(1, &(x->dim), 0, NULL, x->inreal,
x->inimag, x->outreal, x->outimag,
! FFTW_ESTIMATE);
return (x);
}
***************
*** 319,323 ****
x->plan = fftwf_plan_guru_split_dft(1, &(x->dim), 0, NULL, x->inimag,
x->inreal, x->outimag, x->outreal,
! FFTW_MEASURE);
return (x);
}
--- 319,323 ----
x->plan = fftwf_plan_guru_split_dft(1, &(x->dim), 0, NULL, x->inimag,
x->inreal, x->outimag, x->outreal,
! FFTW_ESTIMATE);
return (x);
}
***************
*** 370,374 ****
x->plan = fftwf_plan_guru_split_dft(1, &(x->dim), 0, NULL, x->inreal,
x->inimag, x->outreal, x->outimag,
! FFTW_MEASURE);
}
--- 370,374 ----
x->plan = fftwf_plan_guru_split_dft(1, &(x->dim), 0, NULL, x->inreal,
x->inimag, x->outreal, x->outimag,
! FFTW_ESTIMATE);
}
***************
*** 412,416 ****
x->plan = fftwf_plan_guru_split_dft(1, &(x->dim), 0, NULL, x->inimag,
x->inreal, x->outimag, x->outreal,
! FFTW_MEASURE);
}
--- 412,416 ----
x->plan = fftwf_plan_guru_split_dft(1, &(x->dim), 0, NULL, x->inimag,
x->inreal, x->outimag, x->outreal,
! FFTW_ESTIMATE);
}
***************
*** 493,498 ****
x->bins=64;
x->infft = fftwf_malloc(sizeof(t_sample) * x->bins);
! x->outreal = fftwf_malloc(sizeof(t_sample) * (x->bins)/2);
! x->outimag = fftwf_malloc(sizeof(t_sample) * (x->bins)/2);
x->dim.n=64;
x->dim.is=1;
--- 493,498 ----
x->bins=64;
x->infft = fftwf_malloc(sizeof(t_sample) * x->bins);
! x->outreal = fftwf_malloc(sizeof(t_sample) * ((x->bins)/2+1));
! x->outimag = fftwf_malloc(sizeof(t_sample) * ((x->bins)/2+1));
x->dim.n=64;
x->dim.is=1;
***************
*** 500,504 ****
x->plan = fftwf_plan_guru_split_dft_r2c(1, &(x->dim), 0, NULL, x->infft,
x->outreal, x->outimag,
! FFTW_MEASURE);
return (x);
}
--- 500,504 ----
x->plan = fftwf_plan_guru_split_dft_r2c(1, &(x->dim), 0, NULL, x->infft,
x->outreal, x->outimag,
! FFTW_ESTIMATE);
return (x);
}
***************
*** 541,546 ****
fftwf_free(x->outimag);
x->infft = fftwf_malloc(sizeof(t_sample) * x->bins);
! x->outreal = fftwf_malloc(sizeof(t_sample) * (x->bins)/2);
! x->outimag = fftwf_malloc(sizeof(t_sample) * (x->bins)/2);
//set plan, this might take a few seconds
--- 541,546 ----
fftwf_free(x->outimag);
x->infft = fftwf_malloc(sizeof(t_sample) * x->bins);
! x->outreal = fftwf_malloc(sizeof(t_sample) * ((x->bins)/2+1));
! x->outimag = fftwf_malloc(sizeof(t_sample) * ((x->bins)/2+1));
//set plan, this might take a few seconds
***************
*** 549,553 ****
x->plan = fftwf_plan_guru_split_dft_r2c(1, &(x->dim), 0, NULL,
x->infft, x->outreal,
! x->outimag, FFTW_MEASURE);
}
--- 549,553 ----
x->plan = fftwf_plan_guru_split_dft_r2c(1, &(x->dim), 0, NULL,
x->infft, x->outreal,
! x->outimag, FFTW_ESTIMATE);
}
***************
*** 555,561 ****
memcpy(x->infft,in1,n*sizeof(t_sample));
fftwf_execute(x->plan);
! memcpy(out1,x->outreal,n/2*(sizeof(t_sample)));
sigrfftw_invert(x->outimag,n/2);
! memcpy(out2,x->outimag,n/2*(sizeof(t_sample)));
return (w+6);
--- 555,561 ----
memcpy(x->infft,in1,n*sizeof(t_sample));
fftwf_execute(x->plan);
! memcpy(out1,x->outreal,(n/2+1)*(sizeof(t_sample)));
sigrfftw_invert(x->outimag,n/2);
! memcpy(out2,x->outimag,(n/2+1)*(sizeof(t_sample)));
return (w+6);
***************
*** 620,626 ****
//get ready for the default blocksize
x->bins=64;
! x->inreal = fftwf_malloc(sizeof(t_sample) * (x->bins)/2);
! x->inimag = fftwf_malloc(sizeof(t_sample) * (x->bins)/2);
x->outfft = fftwf_malloc(sizeof(t_sample) * x->bins);
x->dim.n=64;
x->dim.is=1;
--- 620,627 ----
//get ready for the default blocksize
x->bins=64;
! x->inreal = fftwf_malloc(sizeof(t_sample) * (x->bins)/2+1);
! x->inimag = fftwf_malloc(sizeof(t_sample) * (x->bins)/2+1);
x->outfft = fftwf_malloc(sizeof(t_sample) * x->bins);
+
x->dim.n=64;
x->dim.is=1;
***************
*** 628,632 ****
x->plan = fftwf_plan_guru_split_dft_c2r(1, &(x->dim), 0, NULL, x->inreal,
x->inimag, x->outfft,
! FFTW_MEASURE);
return (x);
}
--- 629,633 ----
x->plan = fftwf_plan_guru_split_dft_c2r(1, &(x->dim), 0, NULL, x->inreal,
x->inimag, x->outfft,
! FFTW_ESTIMATE);
return (x);
}
***************
*** 658,665 ****
fftwf_free(x->inimag);
fftwf_free(x->outfft);
! x->inreal = fftwf_malloc(sizeof(t_sample) * (x->bins)/2);
! x->inimag = fftwf_malloc(sizeof(t_sample) * (x->bins)/2);
x->outfft = fftwf_malloc(sizeof(t_sample) * x->bins);
!
//set plan, this might take a few seconds
//but you don't have to do that on the fly...
--- 659,666 ----
fftwf_free(x->inimag);
fftwf_free(x->outfft);
! x->inreal = fftwf_malloc(sizeof(t_sample) * (x->bins)/2+1);
! x->inimag = fftwf_malloc(sizeof(t_sample) * (x->bins)/2+1);
x->outfft = fftwf_malloc(sizeof(t_sample) * x->bins);
!
//set plan, this might take a few seconds
//but you don't have to do that on the fly...
***************
*** 667,676 ****
x->plan = fftwf_plan_guru_split_dft_c2r(1, &(x->dim), 0, NULL,
x->inreal, x->inimag,
! x->outfft, FFTW_MEASURE);
}
//prepare, execute and output results
! memcpy(x->inreal,in1,n/2*sizeof(t_sample));
! memcpy(x->inimag,in2,n/2*sizeof(t_sample));
sigrfftw_invert(x->inimag,n/2);
fftwf_execute(x->plan);
--- 668,677 ----
x->plan = fftwf_plan_guru_split_dft_c2r(1, &(x->dim), 0, NULL,
x->inreal, x->inimag,
! x->outfft, FFTW_ESTIMATE);
}
//prepare, execute and output results
! memcpy(x->inreal,in1,(n/2+1)*sizeof(t_sample));
! memcpy(x->inimag,in2,(n/2+1)*sizeof(t_sample));
sigrfftw_invert(x->inimag,n/2);
fftwf_execute(x->plan);