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

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

Issue 1913603002: Compensate for the compression gain in the IntelligibilityEnhancer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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
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 33de5c1f954a99d0753d1f825b2e2cc91b72b961..c4c450f7768a86752c4d9a71e9ddddc5c0ae88bc 100644
--- a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc
+++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc
@@ -109,8 +109,12 @@ IntelligibilityEnhancer::IntelligibilityEnhancer(int sample_rate_hz,
}
void IntelligibilityEnhancer::SetCaptureNoiseEstimate(
- std::vector<float> noise) {
+ std::vector<float> noise, int gain_db) {
RTC_DCHECK_EQ(noise.size(), num_noise_bins_);
+ float gain = std::pow(10.f, gain_db / 20.f);
turaj 2016/04/25 13:51:13 suggestion: const float
aluebs-webrtc 2016/04/27 22:52:58 Totally!
+ for (size_t i = 0; i < noise.size(); ++i) {
peah-webrtc 2016/04/25 07:23:20 Suggestion: You could use a foreach loop here.
aluebs-webrtc 2016/04/27 22:52:58 Done.
+ noise[i] *= gain;
+ }
// Disregarding return value since buffer overflow is acceptable, because it
// is not critical to get each noise estimate.
if (noise_estimation_queue_.Insert(&noise)) {

Powered by Google App Engine
This is Rietveld 408576698