Per Ã…hgren | 0cbb58e | 2019-10-29 22:59:44 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2019 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef MODULES_AUDIO_PROCESSING_NS_NS_FFT_H_ |
| 12 | #define MODULES_AUDIO_PROCESSING_NS_NS_FFT_H_ |
| 13 | |
| 14 | #include <vector> |
| 15 | |
| 16 | #include "api/array_view.h" |
| 17 | #include "modules/audio_processing/ns/ns_common.h" |
| 18 | |
| 19 | namespace webrtc { |
| 20 | |
| 21 | // Wrapper class providing 256 point FFT functionality. |
| 22 | class NrFft { |
| 23 | public: |
| 24 | NrFft(); |
| 25 | NrFft(const NrFft&) = delete; |
| 26 | NrFft& operator=(const NrFft&) = delete; |
| 27 | |
| 28 | // Transforms the signal from time to frequency domain. |
| 29 | void Fft(rtc::ArrayView<float, kFftSize> time_data, |
| 30 | rtc::ArrayView<float, kFftSize> real, |
| 31 | rtc::ArrayView<float, kFftSize> imag); |
| 32 | |
| 33 | // Transforms the signal from frequency to time domain. |
| 34 | void Ifft(rtc::ArrayView<const float> real, |
| 35 | rtc::ArrayView<const float> imag, |
| 36 | rtc::ArrayView<float> time_data); |
| 37 | |
| 38 | private: |
| 39 | std::vector<size_t> bit_reversal_state_; |
| 40 | std::vector<float> tables_; |
| 41 | }; |
| 42 | |
| 43 | } // namespace webrtc |
| 44 | |
| 45 | #endif // MODULES_AUDIO_PROCESSING_NS_NS_FFT_H_ |