diff options
Diffstat (limited to 'xbmc/utils/rfft.h')
| -rw-r--r-- | xbmc/utils/rfft.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/xbmc/utils/rfft.h b/xbmc/utils/rfft.h new file mode 100644 index 0000000..0ec151d --- /dev/null +++ b/xbmc/utils/rfft.h | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2015-2018 Team Kodi | ||
| 3 | * This file is part of Kodi - https://kodi.tv | ||
| 4 | * | ||
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later | ||
| 6 | * See LICENSES/README.md for more information. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #pragma once | ||
| 10 | |||
| 11 | #include "contrib/kissfft/kiss_fftr.h" | ||
| 12 | |||
| 13 | #include <vector> | ||
| 14 | |||
| 15 | //! \brief Class performing a RFFT of interleaved stereo data. | ||
| 16 | class RFFT | ||
| 17 | { | ||
| 18 | public: | ||
| 19 | //! \brief The constructor creates a RFFT plan. | ||
| 20 | //! \brief size Length of time data for a single channel. | ||
| 21 | //! \brief windowed Whether or not to apply a Hann window to data. | ||
| 22 | RFFT(int size, bool windowed=false); | ||
| 23 | |||
| 24 | //! \brief Free the RFFT plan | ||
| 25 | ~RFFT(); | ||
| 26 | |||
| 27 | //! \brief Calculate FFTs | ||
| 28 | //! \param input Input data of size 2*m_size | ||
| 29 | //! \param output Output data of size m_size. | ||
| 30 | void calc(const float* input, float* output); | ||
| 31 | protected: | ||
| 32 | //! \brief Apply a Hann window to a buffer. | ||
| 33 | //! \param data Vector with data to apply window to. | ||
| 34 | static void hann(std::vector<kiss_fft_scalar>& data); | ||
| 35 | |||
| 36 | size_t m_size; //!< Size for a single channel. | ||
| 37 | bool m_windowed; //!< Whether or not a Hann window is applied. | ||
| 38 | kiss_fftr_cfg m_cfg; //!< FFT plan | ||
| 39 | }; | ||
