Mercurial > hg > batch-feature-extraction-tool
comparison Source/.svn/text-base/FFT.h.svn-base @ 0:25bf17994ef1
First commit. VS2013, Codeblocks and Mac OSX configuration
author | Geogaddi\David <d.m.ronan@qmul.ac.uk> |
---|---|
date | Thu, 09 Jul 2015 01:12:16 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:25bf17994ef1 |
---|---|
1 /* | |
2 ============================================================================== | |
3 | |
4 FFT.h | |
5 Created: 11 Aug 2014 11:18:53am | |
6 Author: mickael.legoff | |
7 | |
8 ============================================================================== | |
9 */ | |
10 | |
11 #ifndef FFT_H_INCLUDED | |
12 #define FFT_H_INCLUDED | |
13 | |
14 #include "FFTW.h" | |
15 | |
16 | |
17 template < typename FFTImpl > | |
18 class FastFourierTransform | |
19 { | |
20 | |
21 public: | |
22 FastFourierTransform(); | |
23 FastFourierTransform( unsigned fftLength ) | |
24 : m_fft_impl( fftLength ) | |
25 { | |
26 | |
27 m_realPart = new float[fftLength]; | |
28 m_imagPart = new float[fftLength]; | |
29 | |
30 memset(m_realPart, 0, (fftLength)*sizeof(float)); | |
31 memset(m_imagPart, 0, (fftLength)*sizeof(float)); | |
32 } | |
33 | |
34 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
35 | |
36 ~FastFourierTransform() | |
37 { | |
38 if(m_realPart != NULL) | |
39 { | |
40 delete[] m_realPart; | |
41 m_realPart = nullptr; | |
42 } | |
43 | |
44 if(m_imagPart != NULL) | |
45 { | |
46 delete[] m_imagPart; | |
47 m_imagPart = nullptr; | |
48 } | |
49 } | |
50 | |
51 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
52 | |
53 void process( const float* input ) { m_fft_impl.process( input , m_realPart , m_imagPart ); } | |
54 | |
55 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
56 | |
57 const float * realPart() { return m_realPart; } | |
58 const float * imagPart() { return m_imagPart; } | |
59 | |
60 private: | |
61 | |
62 float* m_realPart; | |
63 float* m_imagPart; | |
64 | |
65 FFTImpl m_fft_impl; | |
66 | |
67 }; | |
68 | |
69 | |
70 typedef FastFourierTransform<FFTW> FFT; | |
71 | |
72 | |
73 #endif // FFT_H_INCLUDED |