From a2abdf2fbea1320ac8ad94a81b40dfe6f36100d3 Mon Sep 17 00:00:00 2001 From: aluebs Date: Wed, 2 Mar 2016 18:36:49 -0800 Subject: [PATCH] Remove usage of fmaf in IntelligibilityEnhancer This produces bit-exact output and doesn't have the performance sensitivity to vectorisation, giving a complexity decrease of the IntelligibilityEnhancer of about 30x in my local machine. This performance issue was put in evidence by this CL: https://codereview.webrtc.org/1693823004/ BUG=590998 Review URL: https://codereview.webrtc.org/1755943002 Cr-Commit-Position: refs/heads/master@{#11851} --- .../intelligibility/intelligibility_enhancer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc index d8f95edcf6..dc2dcdd261 100644 --- a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc +++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc @@ -42,7 +42,7 @@ const float kRho = 0.0004f; // Default production and interpretation SNR. float DotProduct(const float* a, const float* b, size_t length) { float ret = 0.f; for (size_t i = 0; i < length; ++i) { - ret = fmaf(a[i], b[i], ret); + ret += a[i] * b[i]; } return ret; } @@ -180,7 +180,7 @@ void IntelligibilityEnhancer::UpdateErbGains() { for (size_t i = 0; i < freqs_; ++i) { gains[i] = 0.f; for (size_t j = 0; j < bank_size_; ++j) { - gains[i] = fmaf(render_filter_bank_[j][i], gains_eq_[j], gains[i]); + gains[i] += render_filter_bank_[j][i] * gains_eq_[j]; } } }