ns_fft.h (1350B)
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 <cstddef> 15 #include <vector> 16 17 #include "api/array_view.h" 18 #include "modules/audio_processing/ns/ns_common.h" 19 20 namespace webrtc { 21 22 // Wrapper class providing 256 point FFT functionality. 23 class NrFft { 24 public: 25 NrFft(); 26 NrFft(const NrFft&) = delete; 27 NrFft& operator=(const NrFft&) = delete; 28 29 // Transforms the signal from time to frequency domain. 30 void Fft(ArrayView<float, kFftSize> time_data, 31 ArrayView<float, kFftSize> real, 32 ArrayView<float, kFftSize> imag); 33 34 // Transforms the signal from frequency to time domain. 35 void Ifft(ArrayView<const float> real, 36 ArrayView<const float> imag, 37 ArrayView<float> time_data); 38 39 private: 40 std::vector<size_t> bit_reversal_state_; 41 std::vector<float> tables_; 42 }; 43 44 } // namespace webrtc 45 46 #endif // MODULES_AUDIO_PROCESSING_NS_NS_FFT_H_