OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_COMMON_AUDIO_REAL_FOURIER_H_ | 11 #ifndef WEBRTC_COMMON_AUDIO_REAL_FOURIER_H_ |
12 #define WEBRTC_COMMON_AUDIO_REAL_FOURIER_H_ | 12 #define WEBRTC_COMMON_AUDIO_REAL_FOURIER_H_ |
13 | 13 |
14 #include <complex> | 14 #include <complex> |
| 15 #include <memory> |
15 | 16 |
16 #include "webrtc/base/scoped_ptr.h" | |
17 #include "webrtc/system_wrappers/include/aligned_malloc.h" | 17 #include "webrtc/system_wrappers/include/aligned_malloc.h" |
18 | 18 |
19 // Uniform interface class for the real DFT and its inverse, for power-of-2 | 19 // Uniform interface class for the real DFT and its inverse, for power-of-2 |
20 // input lengths. Also contains helper functions for buffer allocation, taking | 20 // input lengths. Also contains helper functions for buffer allocation, taking |
21 // care of any memory alignment requirements the underlying library might have. | 21 // care of any memory alignment requirements the underlying library might have. |
22 | 22 |
23 namespace webrtc { | 23 namespace webrtc { |
24 | 24 |
25 class RealFourier { | 25 class RealFourier { |
26 public: | 26 public: |
27 // Shorthand typenames for the scopers used by the buffer allocation helpers. | 27 // Shorthand typenames for the scopers used by the buffer allocation helpers. |
28 typedef rtc::scoped_ptr<float[], AlignedFreeDeleter> fft_real_scoper; | 28 typedef std::unique_ptr<float[], AlignedFreeDeleter> fft_real_scoper; |
29 typedef rtc::scoped_ptr<std::complex<float>[], AlignedFreeDeleter> | 29 typedef std::unique_ptr<std::complex<float>[], AlignedFreeDeleter> |
30 fft_cplx_scoper; | 30 fft_cplx_scoper; |
31 | 31 |
32 // The alignment required for all input and output buffers, in bytes. | 32 // The alignment required for all input and output buffers, in bytes. |
33 static const size_t kFftBufferAlignment; | 33 static const size_t kFftBufferAlignment; |
34 | 34 |
35 // Construct a wrapper instance for the given input order, which must be | 35 // Construct a wrapper instance for the given input order, which must be |
36 // between 1 and kMaxFftOrder, inclusively. | 36 // between 1 and kMaxFftOrder, inclusively. |
37 static rtc::scoped_ptr<RealFourier> Create(int fft_order); | 37 static std::unique_ptr<RealFourier> Create(int fft_order); |
38 virtual ~RealFourier() {}; | 38 virtual ~RealFourier() {}; |
39 | 39 |
40 // Helper to compute the smallest FFT order (a power of 2) which will contain | 40 // Helper to compute the smallest FFT order (a power of 2) which will contain |
41 // the given input length. | 41 // the given input length. |
42 static int FftOrder(size_t length); | 42 static int FftOrder(size_t length); |
43 | 43 |
44 // Helper to compute the input length from the FFT order. | 44 // Helper to compute the input length from the FFT order. |
45 static size_t FftLength(int order); | 45 static size_t FftLength(int order); |
46 | 46 |
47 // Helper to compute the exact length, in complex floats, of the transform | 47 // Helper to compute the exact length, in complex floats, of the transform |
(...skipping 18 matching lines...) Expand all Loading... |
66 // not needed. | 66 // not needed. |
67 virtual void Inverse(const std::complex<float>* src, float* dest) const = 0; | 67 virtual void Inverse(const std::complex<float>* src, float* dest) const = 0; |
68 | 68 |
69 virtual int order() const = 0; | 69 virtual int order() const = 0; |
70 }; | 70 }; |
71 | 71 |
72 } // namespace webrtc | 72 } // namespace webrtc |
73 | 73 |
74 #endif // WEBRTC_COMMON_AUDIO_REAL_FOURIER_H_ | 74 #endif // WEBRTC_COMMON_AUDIO_REAL_FOURIER_H_ |
75 | 75 |
OLD | NEW |