Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: webrtc/modules/audio_processing/aec3/comfort_noise_generator.cc

Issue 2782423003: Major updates to the echo removal functionality in AEC3 (Closed)
Patch Set: Added initialization of uninitialized vector Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 N2_initial_.reset(); 181 N2_initial_.reset();
182 } else { 182 } else {
183 // Compute the N2_initial from N2. 183 // Compute the N2_initial from N2.
184 std::transform( 184 std::transform(
185 N2_.begin(), N2_.end(), N2_initial_->begin(), N2_initial_->begin(), 185 N2_.begin(), N2_.end(), N2_initial_->begin(), N2_initial_->begin(),
186 [](float a, float b) { return a > b ? b + 0.001f * (a - b) : a; }); 186 [](float a, float b) { return a > b ? b + 0.001f * (a - b) : a; });
187 } 187 }
188 } 188 }
189 } 189 }
190 190
191 // Limit the noise to a floor of -96 dBFS.
192 constexpr float kNoiseFloor = 440.f;
193 for (auto& n : N2_) {
194 n = std::max(n, kNoiseFloor);
195 }
196 if (N2_initial_) {
197 for (auto& n : *N2_initial_) {
198 n = std::max(n, kNoiseFloor);
199 }
200 }
201
191 // Choose N2 estimate to use. 202 // Choose N2 estimate to use.
192 const std::array<float, kFftLengthBy2Plus1>& N2 = 203 const std::array<float, kFftLengthBy2Plus1>& N2 =
193 N2_initial_ ? *N2_initial_ : N2_; 204 N2_initial_ ? *N2_initial_ : N2_;
194 205
195 switch (optimization_) { 206 switch (optimization_) {
196 #if defined(WEBRTC_ARCH_X86_FAMILY) 207 #if defined(WEBRTC_ARCH_X86_FAMILY)
197 case Aec3Optimization::kSse2: 208 case Aec3Optimization::kSse2:
198 aec3::EstimateComfortNoise_SSE2(N2, &seed_, lower_band_noise, 209 aec3::EstimateComfortNoise_SSE2(N2, &seed_, lower_band_noise,
199 upper_band_noise); 210 upper_band_noise);
200 break; 211 break;
201 #endif 212 #endif
202 default: 213 default:
203 aec3::EstimateComfortNoise(N2, &seed_, lower_band_noise, 214 aec3::EstimateComfortNoise(N2, &seed_, lower_band_noise,
204 upper_band_noise); 215 upper_band_noise);
205 } 216 }
206 } 217 }
207 218
208 } // namespace webrtc 219 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/aec3/aec_state_unittest.cc ('k') | webrtc/modules/audio_processing/aec3/echo_remover.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698