OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 dct_modulation_.resize(kNumBands * kSparsity); | 124 dct_modulation_.resize(kNumBands * kSparsity); |
125 for (size_t i = 0; i < dct_modulation_.size(); ++i) { | 125 for (size_t i = 0; i < dct_modulation_.size(); ++i) { |
126 dct_modulation_[i].resize(kNumBands); | 126 dct_modulation_[i].resize(kNumBands); |
127 for (size_t j = 0; j < kNumBands; ++j) { | 127 for (size_t j = 0; j < kNumBands; ++j) { |
128 dct_modulation_[i][j] = | 128 dct_modulation_[i][j] = |
129 2.f * cos(2.f * M_PI * i * (2.f * j + 1.f) / dct_modulation_.size()); | 129 2.f * cos(2.f * M_PI * i * (2.f * j + 1.f) / dct_modulation_.size()); |
130 } | 130 } |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
| 134 ThreeBandFilterBank::~ThreeBandFilterBank() = default; |
| 135 |
134 // The analysis can be separated in these steps: | 136 // The analysis can be separated in these steps: |
135 // 1. Serial to parallel downsampling by a factor of |kNumBands|. | 137 // 1. Serial to parallel downsampling by a factor of |kNumBands|. |
136 // 2. Filtering of |kSparsity| different delayed signals with polyphase | 138 // 2. Filtering of |kSparsity| different delayed signals with polyphase |
137 // decomposition of the low-pass prototype filter and upsampled by a factor | 139 // decomposition of the low-pass prototype filter and upsampled by a factor |
138 // of |kSparsity|. | 140 // of |kSparsity|. |
139 // 3. Modulating with cosines and accumulating to get the desired band. | 141 // 3. Modulating with cosines and accumulating to get the desired band. |
140 void ThreeBandFilterBank::Analysis(const float* in, | 142 void ThreeBandFilterBank::Analysis(const float* in, |
141 size_t length, | 143 size_t length, |
142 float* const* out) { | 144 float* const* out) { |
143 RTC_CHECK_EQ(in_buffer_.size(), rtc::CheckedDivExact(length, kNumBands)); | 145 RTC_CHECK_EQ(in_buffer_.size(), rtc::CheckedDivExact(length, kNumBands)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 float* out) { | 207 float* out) { |
206 memset(out, 0, split_length * sizeof(*out)); | 208 memset(out, 0, split_length * sizeof(*out)); |
207 for (size_t i = 0; i < kNumBands; ++i) { | 209 for (size_t i = 0; i < kNumBands; ++i) { |
208 for (size_t j = 0; j < split_length; ++j) { | 210 for (size_t j = 0; j < split_length; ++j) { |
209 out[j] += dct_modulation_[offset][i] * in[i][j]; | 211 out[j] += dct_modulation_[offset][i] * in[i][j]; |
210 } | 212 } |
211 } | 213 } |
212 } | 214 } |
213 | 215 |
214 } // namespace webrtc | 216 } // namespace webrtc |
OLD | NEW |