/thirdparty/liblastfm2/src/fingerprint/fplib/OptFFT.h

http://github.com/tomahawk-player/tomahawk · C Header · 63 lines · 28 code · 16 blank · 19 comment · 0 complexity · 5a4fc0e9926a77a18490d4786979e650 MD5 · raw file

  1. /*
  2. Copyright 2005-2009 Last.fm Ltd. <mir@last.fm>
  3. This file is part of liblastfm.
  4. liblastfm is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. liblastfm is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with liblastfm. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #ifndef __OPT_FFT_H
  16. #define __OPT_FFT_H
  17. #include <fftw3.h>
  18. #include <vector>
  19. namespace fingerprint
  20. {
  21. class OptFFT
  22. {
  23. public:
  24. OptFFT(const size_t maxDataSize);
  25. ~OptFFT();
  26. int
  27. process(float* pInData, const size_t dataSize);
  28. float**
  29. getFrames() { return m_pFrames; }
  30. private:
  31. void applyHann(float* pInData, const size_t dataSize);
  32. fftwf_plan m_p;
  33. fftwf_complex * m_pOut;
  34. float* m_pIn;
  35. //float m_base;
  36. int m_numSamples;
  37. int m_numOutSamples;
  38. float** m_pFrames;
  39. int m_maxFrames;
  40. std::vector<int> m_powTable;
  41. };
  42. } // end of namespace
  43. #endif // OPT_FFT