Skip to content

Commit

Permalink
AEC3: Avoid heap-allocations in sums of the values in nested vectors
Browse files Browse the repository at this point in the history
This CL avoids the head-allocations done in a sum of the squared values
in a nested vector.

Bug: webrtc:11361, chromium:1052086
Change-Id: I698b855bdd54df2147ef3b6d5e3d401401228d76
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168543
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30520}
  • Loading branch information
Per Åhgren authored and Commit Bot committed Feb 13, 2020
1 parent cddfc46 commit 0618cbc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/audio_processing/aec3/suppression_gain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ bool SuppressionGain::LowNoiseRenderDetector::Detect(
const std::vector<std::vector<std::vector<float>>>& render) {
float x2_sum = 0.f;
float x2_max = 0.f;
for (auto x_ch : render[0]) {
for (auto x_k : x_ch) {
for (const auto& x_ch : render[0]) {
for (const auto& x_k : x_ch) {
const float x2 = x_k * x_k;
x2_sum += x2;
x2_max = std::max(x2_max, x2);
Expand Down

0 comments on commit 0618cbc

Please sign in to comment.