From 4b92af786e96d38f1586b3caa1ebeadc7cc26452 Mon Sep 17 00:00:00 2001 From: cschuldt Date: Thu, 16 Dec 2021 09:01:54 +0100 Subject: [PATCH] Optimize the three band filter bank. Reducing pointer following. This will allow the compiler to optimize more efficiently with the "-fno-strict-aliasing" flag. Bug: None Change-Id: I8e2d841fa543b28c59eb08c654a2b0515ab39d69 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/241780 Reviewed-by: Sam Zackrisson Commit-Queue: Christian Schuldt Cr-Commit-Position: refs/heads/main@{#35548} --- modules/audio_processing/three_band_filter_bank.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/audio_processing/three_band_filter_bank.cc b/modules/audio_processing/three_band_filter_bank.cc index fc665efcc1..bd1c50477a 100644 --- a/modules/audio_processing/three_band_filter_bank.cc +++ b/modules/audio_processing/three_band_filter_bank.cc @@ -211,8 +211,9 @@ void ThreeBandFilterBank::Analysis( // Band and modulate the output. for (int band = 0; band < ThreeBandFilterBank::kNumBands; ++band) { + float* out_band = out[band].data(); for (int n = 0; n < kSplitBandSize; ++n) { - out[band][n] += dct_modulation[band] * out_subsampled[n]; + out_band[n] += dct_modulation[band] * out_subsampled[n]; } } } @@ -254,8 +255,9 @@ void ThreeBandFilterBank::Synthesis( std::fill(in_subsampled.begin(), in_subsampled.end(), 0.f); for (int band = 0; band < ThreeBandFilterBank::kNumBands; ++band) { RTC_DCHECK_EQ(in[band].size(), kSplitBandSize); + const float* in_band = in[band].data(); for (int n = 0; n < kSplitBandSize; ++n) { - in_subsampled[n] += dct_modulation[band] * in[band][n]; + in_subsampled[n] += dct_modulation[band] * in_band[n]; } }