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

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

Issue 3005433002: Fix places that trigger no-unused-lambda-capture (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 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 constexpr float kScale = 1.0f / kFftLengthBy2; 510 const float kScale = 1.0f / kFftLengthBy2;
nisse-webrtc 2017/08/23 09:42:02 Could add a comment here too, on why constexpr doe
eladalon 2017/08/23 11:42:53 IMHO, it would be overkill to fill the code with t
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 [kScale](float& a) { a *= kScale; });
kwiberg-webrtc 2017/08/23 11:35:59 Does it work if you change the capture list to [&]
eladalon 2017/08/23 11:42:53 You can't capture a constexpr by reference, can yo
kwiberg-webrtc 2017/08/23 11:56:40 Yes, you can. Unlike preprocessor constants and en
eladalon 2017/08/23 12:17:30 Surprising, but OK. Nevertheless, I am not sure th
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') | webrtc/pc/channel_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698