From 8701ec32545ff3d74e2e1b22b715373ec8e0676f Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Wed, 7 Nov 2007 17:33:28 +0100 Subject: [PATCH] removed old test-fft.c, moved mfft to new fft --- tests/src/Makefile.am | 1 - tests/src/test-fft.c | 69 +++++++++++++------------------------------ tests/src/test-mfft.c | 28 ------------------ 3 files changed, 20 insertions(+), 78 deletions(-) delete mode 100644 tests/src/test-mfft.c diff --git a/tests/src/Makefile.am b/tests/src/Makefile.am index 6855040b..b2bbf8a6 100644 --- a/tests/src/Makefile.am +++ b/tests/src/Makefile.am @@ -6,7 +6,6 @@ test_phasevoc_jack_LDADD = $(AM_LDFLAGS) -laubioext -L$(top_builddir)/ext @JACK bin_PROGRAMS = \ test-fft \ - test-mfft \ test-hist \ test-scale \ test-cvec \ diff --git a/tests/src/test-fft.c b/tests/src/test-fft.c index 8fe781fd..20d666fb 100644 --- a/tests/src/test-fft.c +++ b/tests/src/test-fft.c @@ -1,57 +1,28 @@ -#include -#include -#include -#include - -#define NEW_ARRAY(_t,_n) (_t*)malloc((_n)*sizeof(_t)) +#include int main(){ - uint_t i,j; - uint_t win_s = 1024; // window size - uint_t channels = 1; // number of channel - fvec_t * in = new_fvec (win_s, channels); // input buffer - cvec_t * fftgrain = new_cvec (win_s, channels); // fft norm and phase - fvec_t * out = new_fvec (win_s, channels); // output buffer - - // allocate fft and other memory space - aubio_fft_t * fft = new_aubio_fft(win_s); // fft interface - smpl_t * w = NEW_ARRAY(smpl_t,win_s); // window - // complex spectral data - fft_data_t ** spec = NEW_ARRAY(fft_data_t*,channels); - for (i=0; i < channels; i++) - spec[i] = NEW_ARRAY(fft_data_t,win_s); - // initialize the window (see mathutils.c) - aubio_window(w,win_s,aubio_win_hanningz); - - // fill input with some data - in->data[0][win_s/2] = 1; - - // execute stft - for (i=0; i < channels; i++) { - aubio_fft_do (fft,in->data[i],spec[i],win_s); - // put norm and phase into fftgrain - aubio_fft_getnorm(fftgrain->norm[i], spec[i], win_s/2+1); - aubio_fft_getphas(fftgrain->phas[i], spec[i], win_s/2+1); - } - - // execute inverse fourier transform - for (i=0; i < channels; i++) { - for (j=0; jphas[i][j])); - spec[i][j] *= fftgrain->norm[i][j]; - } - aubio_fft_rdo(fft,spec[i],out->data[i],win_s); - } - + /* allocate some memory */ + uint_t win_s = 4096; /* window size */ + uint_t channels = 100; /* number of channels */ + fvec_t * in = new_fvec (win_s, channels); /* input buffer */ + cvec_t * fftgrain = new_cvec (win_s, channels); /* fft norm and phase */ + fvec_t * out = new_fvec (win_s, channels); /* output buffer */ + /* allocate fft and other memory space */ + aubio_fft_t * fft = new_aubio_fft(win_s,channels); + /* fill input with some data */ + //printf("initialised\n"); + /* execute stft */ + aubio_fft_do (fft,in,fftgrain); + //printf("computed forward\n"); + /* execute inverse fourier transform */ + aubio_fft_rdo(fft,fftgrain,out); + //printf("computed backard\n"); + del_aubio_fft(fft); del_fvec(in); - del_fvec(out); del_cvec(fftgrain); - free(w); - del_aubio_fft(fft); - for (i=0; i < channels; i++) - free(spec[i]); - free(spec); + del_fvec(out); + //printf("memory freed\n"); aubio_cleanup(); return 0; } diff --git a/tests/src/test-mfft.c b/tests/src/test-mfft.c deleted file mode 100644 index c2ec9f7e..00000000 --- a/tests/src/test-mfft.c +++ /dev/null @@ -1,28 +0,0 @@ - -#include - -int main(){ - /* allocate some memory */ - uint_t win_s = 4096; /* window size */ - uint_t channels = 100; /* number of channels */ - fvec_t * in = new_fvec (win_s, channels); /* input buffer */ - cvec_t * fftgrain = new_cvec (win_s, channels); /* fft norm and phase */ - fvec_t * out = new_fvec (win_s, channels); /* output buffer */ - /* allocate fft and other memory space */ - aubio_mfft_t * fft = new_aubio_mfft(win_s,channels); - /* fill input with some data */ - //printf("initialised\n"); - /* execute stft */ - aubio_mfft_do (fft,in,fftgrain); - //printf("computed forward\n"); - /* execute inverse fourier transform */ - aubio_mfft_rdo(fft,fftgrain,out); - //printf("computed backard\n"); - del_aubio_mfft(fft); - del_fvec(in); - del_cvec(fftgrain); - del_fvec(out); - //printf("memory freed\n"); - aubio_cleanup(); - return 0; -} -- 2.26.2