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_LAPPED_TRANSFORM_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_UTILITY_LAPPED_TRANSFORM_H_ |
12 #define WEBRTC_COMMON_AUDIO_LAPPED_TRANSFORM_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_UTILITY_LAPPED_TRANSFORM_H_ |
13 | 13 |
14 #include <complex> | 14 #include <complex> |
15 #include <memory> | 15 #include <memory> |
16 | 16 |
17 #include "webrtc/common_audio/blocker.h" | |
18 #include "webrtc/common_audio/real_fourier.h" | 17 #include "webrtc/common_audio/real_fourier.h" |
| 18 #include "webrtc/modules/audio_processing/utility/blocker.h" |
19 #include "webrtc/system_wrappers/include/aligned_array.h" | 19 #include "webrtc/system_wrappers/include/aligned_array.h" |
20 | 20 |
21 namespace webrtc { | 21 namespace webrtc { |
22 | 22 |
23 // Helper class for audio processing modules which operate on frequency domain | 23 // Helper class for audio processing modules which operate on frequency domain |
24 // input derived from the windowed time domain audio stream. | 24 // input derived from the windowed time domain audio stream. |
25 // | 25 // |
26 // The input audio chunk is sliced into possibly overlapping blocks, multiplied | 26 // The input audio chunk is sliced into possibly overlapping blocks, multiplied |
27 // by a window and transformed with an FFT implementation. The transformed data | 27 // by a window and transformed with an FFT implementation. The transformed data |
28 // is supplied to the given callback for processing. The processed output is | 28 // is supplied to the given callback for processing. The processed output is |
29 // then inverse transformed into the time domain and spliced back into a chunk | 29 // then inverse transformed into the time domain and spliced back into a chunk |
30 // which constitutes the final output of this processing module. | 30 // which constitutes the final output of this processing module. |
31 class LappedTransform { | 31 class LappedTransform { |
32 public: | 32 public: |
33 class Callback { | 33 class Callback { |
34 public: | 34 public: |
35 virtual ~Callback() {} | 35 virtual ~Callback() {} |
36 | 36 |
37 virtual void ProcessAudioBlock(const std::complex<float>* const* in_block, | 37 virtual void ProcessAudioBlock(const std::complex<float>* const* in_block, |
38 size_t num_in_channels, size_t frames, | 38 size_t num_in_channels, |
| 39 size_t frames, |
39 size_t num_out_channels, | 40 size_t num_out_channels, |
40 std::complex<float>* const* out_block) = 0; | 41 std::complex<float>* const* out_block) = 0; |
41 }; | 42 }; |
42 | 43 |
43 // Construct a transform instance. |chunk_length| is the number of samples in | 44 // Construct a transform instance. |chunk_length| is the number of samples in |
44 // each channel. |window| defines the window, owned by the caller (a copy is | 45 // each channel. |window| defines the window, owned by the caller (a copy is |
45 // made internally); |window| should have length equal to |block_length|. | 46 // made internally); |window| should have length equal to |block_length|. |
46 // |block_length| defines the length of a block, in samples. | 47 // |block_length| defines the length of a block, in samples. |
47 // |shift_amount| is in samples. |callback| is the caller-owned audio | 48 // |shift_amount| is in samples. |callback| is the caller-owned audio |
48 // processing function called for each block of the input chunk. | 49 // processing function called for each block of the input chunk. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 115 |
115 std::unique_ptr<RealFourier> fft_; | 116 std::unique_ptr<RealFourier> fft_; |
116 const size_t cplx_length_; | 117 const size_t cplx_length_; |
117 AlignedArray<float> real_buf_; | 118 AlignedArray<float> real_buf_; |
118 AlignedArray<std::complex<float> > cplx_pre_; | 119 AlignedArray<std::complex<float> > cplx_pre_; |
119 AlignedArray<std::complex<float> > cplx_post_; | 120 AlignedArray<std::complex<float> > cplx_post_; |
120 }; | 121 }; |
121 | 122 |
122 } // namespace webrtc | 123 } // namespace webrtc |
123 | 124 |
124 #endif // WEBRTC_COMMON_AUDIO_LAPPED_TRANSFORM_H_ | 125 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_UTILITY_LAPPED_TRANSFORM_H_ |
125 | |
OLD | NEW |