ns_fft.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #ifndef MODULES_AUDIO_PROCESSING_NS_NS_FFT_H_
  11. #define MODULES_AUDIO_PROCESSING_NS_NS_FFT_H_
  12. #include <vector>
  13. #include "api/array_view.h"
  14. #include "modules/audio_processing/ns/ns_common.h"
  15. namespace webrtc {
  16. // Wrapper class providing 256 point FFT functionality.
  17. class NrFft {
  18. public:
  19. NrFft();
  20. NrFft(const NrFft&) = delete;
  21. NrFft& operator=(const NrFft&) = delete;
  22. // Transforms the signal from time to frequency domain.
  23. void Fft(rtc::ArrayView<float, kFftSize> time_data,
  24. rtc::ArrayView<float, kFftSize> real,
  25. rtc::ArrayView<float, kFftSize> imag);
  26. // Transforms the signal from frequency to time domain.
  27. void Ifft(rtc::ArrayView<const float> real,
  28. rtc::ArrayView<const float> imag,
  29. rtc::ArrayView<float> time_data);
  30. private:
  31. std::vector<size_t> bit_reversal_state_;
  32. std::vector<float> tables_;
  33. };
  34. } // namespace webrtc
  35. #endif // MODULES_AUDIO_PROCESSING_NS_NS_FFT_H_