OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 #include "webrtc/modules/audio_processing/aec3/render_buffer.h" | 11 #include "webrtc/modules/audio_processing/aec3/render_buffer.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 | 14 |
15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
16 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" | 16 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 | 19 |
20 RenderBuffer::RenderBuffer(Aec3Optimization optimization, | 20 RenderBuffer::RenderBuffer(Aec3Optimization optimization, |
21 size_t num_bands, | 21 size_t num_bands, |
22 size_t num_partitions, | 22 size_t num_partitions, |
23 const std::vector<size_t> num_ffts_for_spectral_sums) | 23 const std::vector<size_t> num_ffts_for_spectral_sums) |
24 : optimization_(optimization), | 24 : optimization_(optimization), |
25 fft_buffer_(num_partitions), | 25 fft_buffer_(num_partitions), |
26 spectrum_buffer_(num_partitions, std::array<float, kFftLengthBy2Plus1>()), | 26 spectrum_buffer_(num_partitions, std::array<float, kFftLengthBy2Plus1>()), |
27 spectral_sums_(num_ffts_for_spectral_sums.size(), | 27 spectral_sums_(num_ffts_for_spectral_sums.size(), |
28 std::array<float, kFftLengthBy2Plus1>()), | 28 std::array<float, kFftLengthBy2Plus1>()), |
29 last_block_(num_bands, std::vector<float>(kBlockSize, 0.f)) { | 29 last_block_(num_bands, std::vector<float>(kBlockSize, 0.f)), |
| 30 fft_() { |
30 // Current implementation only allows a maximum of one spectral sum lengths. | 31 // Current implementation only allows a maximum of one spectral sum lengths. |
31 RTC_DCHECK_EQ(1, num_ffts_for_spectral_sums.size()); | 32 RTC_DCHECK_EQ(1, num_ffts_for_spectral_sums.size()); |
32 spectral_sums_length_ = num_ffts_for_spectral_sums[0]; | 33 spectral_sums_length_ = num_ffts_for_spectral_sums[0]; |
33 RTC_DCHECK_GE(fft_buffer_.size(), spectral_sums_length_); | 34 RTC_DCHECK_GE(fft_buffer_.size(), spectral_sums_length_); |
34 | 35 |
35 Clear(); | 36 Clear(); |
36 } | 37 } |
37 | 38 |
38 RenderBuffer::~RenderBuffer() = default; | 39 RenderBuffer::~RenderBuffer() = default; |
39 | 40 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 86 |
86 for (size_t k = 0; k < spectral_sums_[0].size(); ++k) { | 87 for (size_t k = 0; k < spectral_sums_[0].size(); ++k) { |
87 spectral_sums_[0][k] += spectrum[k]; | 88 spectral_sums_[0][k] += spectrum[k]; |
88 } | 89 } |
89 | 90 |
90 position = position < (fft_buffer_.size() - 1) ? position + 1 : 0; | 91 position = position < (fft_buffer_.size() - 1) ? position + 1 : 0; |
91 } | 92 } |
92 } | 93 } |
93 | 94 |
94 } // namespace webrtc | 95 } // namespace webrtc |
OLD | NEW |