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

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

Issue 3003723002: Fix places that trigger no-unused-lambda-capture - change to using static-constexpr (Closed)
Patch Set: Rebased Created 3 years, 4 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
« no previous file with comments | « no previous file | webrtc/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 aec3::UpdateErlEstimator(H2_, &erl_); 500 aec3::UpdateErlEstimator(H2_, &erl_);
501 } 501 }
502 } 502 }
503 503
504 // Constrains the a partiton of the frequency domain filter to be limited in 504 // Constrains the a partiton of the frequency domain filter to be limited in
505 // time via setting the relevant time-domain coefficients to zero. 505 // time via setting the relevant time-domain coefficients to zero.
506 void AdaptiveFirFilter::Constrain() { 506 void AdaptiveFirFilter::Constrain() {
507 std::array<float, kFftLength> h; 507 std::array<float, kFftLength> h;
508 fft_.Ifft(H_[partition_to_constrain_], &h); 508 fft_.Ifft(H_[partition_to_constrain_], &h);
509 509
510 const float kScale = 1.0f / kFftLengthBy2; 510 static constexpr float kScale = 1.0f / kFftLengthBy2;
511 std::for_each(h.begin(), h.begin() + kFftLengthBy2, 511 std::for_each(h.begin(), h.begin() + kFftLengthBy2,
512 [kScale](float& a) { a *= kScale; }); 512 [](float& a) { a *= kScale; });
513 std::fill(h.begin() + kFftLengthBy2, h.end(), 0.f); 513 std::fill(h.begin() + kFftLengthBy2, h.end(), 0.f);
514 514
515 std::copy(h.begin(), h.begin() + kFftLengthBy2, 515 std::copy(h.begin(), h.begin() + kFftLengthBy2,
516 h_.begin() + partition_to_constrain_ * kFftLengthBy2); 516 h_.begin() + partition_to_constrain_ * kFftLengthBy2);
517 517
518 fft_.Fft(&h, &H_[partition_to_constrain_]); 518 fft_.Fft(&h, &H_[partition_to_constrain_]);
519 519
520 partition_to_constrain_ = partition_to_constrain_ < (H_.size() - 1) 520 partition_to_constrain_ = partition_to_constrain_ < (H_.size() - 1)
521 ? partition_to_constrain_ + 1 521 ? partition_to_constrain_ + 1
522 : 0; 522 : 0;
523 } 523 }
524 524
525 } // namespace webrtc 525 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698