| 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 |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 previous_masker_.fill(0.f); | 318 previous_masker_.fill(0.f); |
| 319 } | 319 } |
| 320 | 320 |
| 321 void SuppressionGain::GetGain( | 321 void SuppressionGain::GetGain( |
| 322 const std::array<float, kFftLengthBy2Plus1>& nearend_power, | 322 const std::array<float, kFftLengthBy2Plus1>& nearend_power, |
| 323 const std::array<float, kFftLengthBy2Plus1>& residual_echo_power, | 323 const std::array<float, kFftLengthBy2Plus1>& residual_echo_power, |
| 324 const std::array<float, kFftLengthBy2Plus1>& comfort_noise_power, | 324 const std::array<float, kFftLengthBy2Plus1>& comfort_noise_power, |
| 325 bool saturated_echo, | 325 bool saturated_echo, |
| 326 const std::vector<std::vector<float>>& render, | 326 const std::vector<std::vector<float>>& render, |
| 327 size_t num_capture_bands, | 327 size_t num_capture_bands, |
| 328 bool force_zero_gain, |
| 328 float* high_bands_gain, | 329 float* high_bands_gain, |
| 329 std::array<float, kFftLengthBy2Plus1>* low_band_gain) { | 330 std::array<float, kFftLengthBy2Plus1>* low_band_gain) { |
| 330 RTC_DCHECK(high_bands_gain); | 331 RTC_DCHECK(high_bands_gain); |
| 331 RTC_DCHECK(low_band_gain); | 332 RTC_DCHECK(low_band_gain); |
| 332 | 333 |
| 334 if (force_zero_gain) { |
| 335 previous_gain_squared_.fill(0.f); |
| 336 std::copy(comfort_noise_power.begin() + 1, comfort_noise_power.end() - 1, |
| 337 previous_masker_.begin()); |
| 338 low_band_gain->fill(0.f); |
| 339 *high_bands_gain = 0.f; |
| 340 return; |
| 341 } |
| 342 |
| 333 // Choose margin to use. | 343 // Choose margin to use. |
| 334 const float margin = saturated_echo ? 0.001f : 0.01f; | 344 const float margin = saturated_echo ? 0.001f : 0.01f; |
| 335 switch (optimization_) { | 345 switch (optimization_) { |
| 336 #if defined(WEBRTC_ARCH_X86_FAMILY) | 346 #if defined(WEBRTC_ARCH_X86_FAMILY) |
| 337 case Aec3Optimization::kSse2: | 347 case Aec3Optimization::kSse2: |
| 338 aec3::ComputeGains_SSE2( | 348 aec3::ComputeGains_SSE2( |
| 339 nearend_power, residual_echo_power, comfort_noise_power, margin, | 349 nearend_power, residual_echo_power, comfort_noise_power, margin, |
| 340 &previous_gain_squared_, &previous_masker_, low_band_gain); | 350 &previous_gain_squared_, &previous_masker_, low_band_gain); |
| 341 break; | 351 break; |
| 342 #endif | 352 #endif |
| (...skipping 11 matching lines...) Expand all Loading... |
| 354 *std::min_element(low_band_gain->begin() + 32, low_band_gain->end()); | 364 *std::min_element(low_band_gain->begin() + 32, low_band_gain->end()); |
| 355 | 365 |
| 356 *high_bands_gain = std::min(*high_bands_gain, min_high_band_gain); | 366 *high_bands_gain = std::min(*high_bands_gain, min_high_band_gain); |
| 357 | 367 |
| 358 } else { | 368 } else { |
| 359 *high_bands_gain = 1.f; | 369 *high_bands_gain = 1.f; |
| 360 } | 370 } |
| 361 } | 371 } |
| 362 | 372 |
| 363 } // namespace webrtc | 373 } // namespace webrtc |
| OLD | NEW |