From 0618cbc98994ac850c47b926ff6ff73456f9f793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85hgren?= Date: Thu, 13 Feb 2020 21:08:54 +0100 Subject: [PATCH] AEC3: Avoid heap-allocations in sums of the values in nested vectors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Commit-Queue: Per Ã…hgren Cr-Commit-Position: refs/heads/master@{#30520} --- modules/audio_processing/aec3/suppression_gain.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/audio_processing/aec3/suppression_gain.cc b/modules/audio_processing/aec3/suppression_gain.cc index ea7af505e0..c1f12b7748 100644 --- a/modules/audio_processing/aec3/suppression_gain.cc +++ b/modules/audio_processing/aec3/suppression_gain.cc @@ -390,8 +390,8 @@ bool SuppressionGain::LowNoiseRenderDetector::Detect( const std::vector>>& 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);