Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Unified Diff: webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc

Issue 2035213002: Only update Intelligibility Enhancer gains every 10 chunks (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc
diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc
index ae7f9119213d91e104e692b47af175eed1854f0b..a10d10a75e582267c6547b72a1b9866382bbba4e 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<float>(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_,
« no previous file with comments | « webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698