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

Unified Diff: webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h

Issue 1207353002: Add new variance update option and unittests for intelligibility (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merge Created 5 years, 5 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_utils.h
diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h b/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h
index 075b8ad46bea1823fb78a9376001c3bb06bd20bf..9908ac0456f1974f263a42e33a5124f5a3f9c33a 100644
--- a/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h
+++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h
@@ -23,6 +23,30 @@ namespace webrtc {
namespace intelligibility {
+// Return |current| changed towards |target|, with the change being at most
+// |limit|.
+float UpdateFactor(float target, float current, float limit);
+
+// std::isfinite for complex numbers.
+bool cplxfinite(std::complex<float> c);
+
+// std::isnormal for complex numbers.
+bool cplxnormal(std::complex<float> c);
+
+// Apply a small fudge to degenerate complex values. The numbers in the array
+// were chosen randomly, so that even a series of all zeroes has some small
+// variability.
+std::complex<float> zerofudge(std::complex<float> c);
+
+// Incremental mean computation. Return the mean of the series with the
+// mean |mean| with added |data|.
+std::complex<float> NewMean(std::complex<float> mean,
+ std::complex<float> data,
+ int count);
+
+// Updates |mean| with added |data|;
+void AddToMean(std::complex<float> data, int count, std::complex<float>* mean);
+
// Internal helper for computing the variances of a stream of arrays.
// The result is an array of variances per position: the i-th variance
// is the variance of the stream of data on the i-th positions in the
@@ -43,7 +67,8 @@ class VarianceArray {
kStepInfinite = 0,
kStepDecaying,
kStepWindowed,
- kStepBlocked
+ kStepBlocked,
+ kStepBlockBasedMovingAverage
};
// Construct an instance for the given input array length (|freqs|) and
@@ -77,6 +102,7 @@ class VarianceArray {
void DecayStep(const std::complex<float>* data, bool dummy);
void WindowedStep(const std::complex<float>* data, bool dummy);
void BlockedStep(const std::complex<float>* data, bool dummy);
+ void BlockBasedMovingAverage(const std::complex<float>* data, bool dummy);
// TODO(ekmeyerson): Switch the following running means
// and histories from rtc::scoped_ptr to std::vector.
@@ -105,6 +131,7 @@ class VarianceArray {
int history_cursor_;
int count_;
float array_mean_;
+ bool buffer_full_;
void (VarianceArray::*step_func_)(const std::complex<float>*, bool);
};

Powered by Google App Engine
This is Rietveld 408576698