xref: /aosp_15_r20/external/webrtc/common_audio/real_fourier_ooura.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2015 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 COMMON_AUDIO_REAL_FOURIER_OOURA_H_
12 #define COMMON_AUDIO_REAL_FOURIER_OOURA_H_
13 
14 #include <stddef.h>
15 
16 #include <complex>
17 #include <memory>
18 
19 #include "common_audio/real_fourier.h"
20 
21 namespace webrtc {
22 
23 class RealFourierOoura : public RealFourier {
24  public:
25   explicit RealFourierOoura(int fft_order);
26   ~RealFourierOoura() override;
27 
28   void Forward(const float* src, std::complex<float>* dest) const override;
29   void Inverse(const std::complex<float>* src, float* dest) const override;
30 
31   int order() const override;
32 
33  private:
34   const int order_;
35   const size_t length_;
36   const size_t complex_length_;
37   // These are work arrays for Ooura. The names are based on the comments in
38   // common_audio/third_party/ooura/fft_size_256/fft4g.cc.
39   const std::unique_ptr<size_t[]> work_ip_;
40   const std::unique_ptr<float[]> work_w_;
41 };
42 
43 }  // namespace webrtc
44 
45 #endif  // COMMON_AUDIO_REAL_FOURIER_OOURA_H_
46