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

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

Issue 3003723002: Fix places that trigger no-unused-lambda-capture - change to using static-constexpr (Closed)
Patch Set: Rebased Created 3 years, 3 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 14 matching lines...) Expand all
25 size_t max_delay, 25 size_t max_delay,
26 std::array<float, kFftLengthBy2Plus1>* X2) { 26 std::array<float, kFftLengthBy2Plus1>* X2) {
27 X2->fill(0.f); 27 X2->fill(0.f);
28 for (size_t k = min_delay; k <= max_delay; ++k) { 28 for (size_t k = min_delay; k <= max_delay; ++k) {
29 std::transform(X2->begin(), X2->end(), render_buffer.Spectrum(k).begin(), 29 std::transform(X2->begin(), X2->end(), render_buffer.Spectrum(k).begin(),
30 X2->begin(), 30 X2->begin(),
31 [](float a, float b) { return std::max(a, b); }); 31 [](float a, float b) { return std::max(a, b); });
32 } 32 }
33 33
34 // Apply soft noise gate of -78 dBFS. 34 // Apply soft noise gate of -78 dBFS.
35 const float kNoiseGatePower = 27509.42f; 35 static constexpr float kNoiseGatePower = 27509.42f;
36 std::for_each(X2->begin(), X2->end(), [kNoiseGatePower](float& a) { 36 std::for_each(X2->begin(), X2->end(), [](float& a) {
37 if (kNoiseGatePower > a) { 37 if (kNoiseGatePower > a) {
38 a = std::max(0.f, a - 0.3f * (kNoiseGatePower - a)); 38 a = std::max(0.f, a - 0.3f * (kNoiseGatePower - a));
39 } 39 }
40 }); 40 });
41 } 41 }
42 42
43 constexpr int kNoiseFloorCounterMax = 50; 43 constexpr int kNoiseFloorCounterMax = 50;
44 constexpr float kNoiseFloorMin = 10.f * 10.f * 128.f * 128.f; 44 constexpr float kNoiseFloorMin = 10.f * 10.f * 128.f * 128.f;
45 45
46 // Updates estimate for the power of the stationary noise component in the 46 // Updates estimate for the power of the stationary noise component in the
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 } else { 252 } else {
253 std::copy(S2.begin(), S2.end(), S2_old_[S2_old_index_].begin()); 253 std::copy(S2.begin(), S2.end(), S2_old_[S2_old_index_].begin());
254 } 254 }
255 255
256 // Add the power of the echo reverb to the residual echo power. 256 // Add the power of the echo reverb to the residual echo power.
257 std::transform(R2->begin(), R2->end(), R2_reverb_.begin(), R2->begin(), 257 std::transform(R2->begin(), R2->end(), R2_reverb_.begin(), R2->begin(),
258 std::plus<float>()); 258 std::plus<float>());
259 } 259 }
260 260
261 } // namespace webrtc 261 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc ('k') | webrtc/pc/channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698