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

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: Renamed tests + minor changes Created 5 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
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..b71e5006002f3a5a8a4b7c07ba63cc9fb956dd8d 100644
--- a/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h
+++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h
@@ -23,6 +23,31 @@ 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,
hlundin-webrtc 2015/06/30 14:00:54 align
ekm 2015/07/01 23:48:26 Done.
+ int count);
+
+void AddToMean(std::complex<float> data, int count,
hlundin-webrtc 2015/06/30 14:00:53 Function description missing.
ekm 2015/07/01 23:48:26 Done.
+ std::complex<float>* mean);
hlundin-webrtc 2015/06/30 14:00:53 align
ekm 2015/07/01 23:48:26 Done.
+
+
// 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 +68,8 @@ class VarianceArray {
kStepInfinite = 0,
kStepDecaying,
kStepWindowed,
- kStepBlocked
+ kStepBlocked,
+ kStepBlockBasedMovingAverage
};
// Construct an instance for the given input array length (|freqs|) and
@@ -77,6 +103,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 +132,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