From e8f8f6037ca2b7f9c2f48cb65bb9e8b245acbddb Mon Sep 17 00:00:00 2001 From: aluebs Date: Wed, 8 Jun 2016 09:53:18 -0700 Subject: [PATCH] Only update Intelligibility Enhancer gains every 10 chunks This reduces its complexity by a factor of 2.7x total. The mean error introduced by this is in the 6 different noise scenarios and 6 different speech signals tested is below -52dB. Review-Url: https://codereview.webrtc.org/2035213002 Cr-Commit-Position: refs/heads/master@{#13072} --- .../intelligibility/intelligibility_enhancer.cc | 4 +++- .../intelligibility/intelligibility_enhancer.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc index ae7f911921..a10d10a75e 100644 --- a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc +++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc @@ -40,6 +40,7 @@ const float kRho = 0.0004f; // Default production and interpretation SNR. const float kPowerNormalizationFactor = 1.f / (1 << 30); const float kMaxActiveSNR = 128.f; // 21dB const float kMinInactiveSNR = 32.f; // 15dB +const size_t kGainUpdatePeriod = 10u; // Returns dot product of vectors |a| and |b| with size |length|. float DotProduct(const float* a, const float* b, size_t length) { @@ -88,6 +89,7 @@ IntelligibilityEnhancer::IntelligibilityEnhancer(int sample_rate_hz, is_speech_(false), snr_(kMaxActiveSNR), is_active_(false), + num_chunks_(0u), noise_estimation_buffer_(num_noise_bins), noise_estimation_queue_(kMaxNumNoiseEstimatesToBuffer, std::vector(num_noise_bins), @@ -144,7 +146,7 @@ void IntelligibilityEnhancer::ProcessAudioBlock( clear_power_estimator_.Step(in_block[0]); } SnrBasedEffectActivation(); - if (is_active_) { + if (is_active_ && num_chunks_++ % kGainUpdatePeriod == 0) { MapToErbBands(clear_power_estimator_.power().data(), render_filter_bank_, filtered_clear_pow_.data()); MapToErbBands(noise_power_estimator_.power().data(), capture_filter_bank_, diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h index 63ae80e2c4..389f6ae567 100644 --- a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h +++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h @@ -112,6 +112,8 @@ class IntelligibilityEnhancer : public LappedTransform::Callback { float snr_; bool is_active_; + size_t num_chunks_; + std::vector noise_estimation_buffer_; SwapQueue, RenderQueueItemVerifier> noise_estimation_queue_;