diff dsp/mfcc/MFCC.cpp @ 289:befe5aa6b450

* Refactor FFT a little bit so as to separate construction and processing rather than have a single static method -- will make it easier to use a different implementation * pull in KissFFT implementation (not hooked up yet)
author Chris Cannam <c.cannam@qmul.ac.uk>
date Wed, 13 May 2009 09:19:12 +0000
parents 330c2e11f8a9
children d5014ab8b0e5
line wrap: on
line diff
--- a/dsp/mfcc/MFCC.cpp	Tue May 12 21:04:25 2009 +0000
+++ b/dsp/mfcc/MFCC.cpp	Wed May 13 09:19:12 2009 +0000
@@ -31,6 +31,7 @@
   
     /* FFT and analysis window sizes */
     fftSize           = config.fftsize;
+    fft               = new FFTReal(fftSize);
 
     totalFilters      = linearFilters + logFilters;
     logPower          = config.logpower;
@@ -145,7 +146,6 @@
     window      = new Window<double>(config.window, fftSize);
 
     /* Allocate memory for the FFT */
-    imagIn      = (double*)calloc(fftSize, sizeof(double));
     realOut     = (double*)calloc(fftSize, sizeof(double));
     imagOut     = (double*)calloc(fftSize, sizeof(double));
 
@@ -185,9 +185,10 @@
     free(fftMag);
     
     /* Free the FFT */
-    free(imagIn);
     free(realOut);
     free(imagOut);
+
+    delete fft;
 }
 
 
@@ -204,7 +205,7 @@
     window->cut(inputData);
   
     /* Calculate the fft on the input frame */
-    FFT::process(fftSize, 0, inputData, imagIn, realOut, imagOut);
+    fft->process(0, inputData, realOut, imagOut);
 
     free(inputData);