Index: webrtc/modules/audio_processing/echo_detector/echo_detector.h |
diff --git a/webrtc/modules/audio_processing/echo_detector/echo_detector.h b/webrtc/modules/audio_processing/echo_detector/echo_detector.h |
index d9c8bd5d18799c23d277c3883126759a3566f20d..24d1362015ef489091344fae5cd6593a91d45434 100644 |
--- a/webrtc/modules/audio_processing/echo_detector/echo_detector.h |
+++ b/webrtc/modules/audio_processing/echo_detector/echo_detector.h |
@@ -11,21 +11,54 @@ |
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_ECHO_DETECTOR_H_ |
#define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_ECHO_DETECTOR_H_ |
-#include <stddef.h> |
+#include <vector> |
+ |
#include "webrtc/base/array_view.h" |
+#include "webrtc/modules/audio_processing/echo_detector/circular_buffer.h" |
+#include "webrtc/modules/audio_processing/echo_detector/mean_variance_estimator.h" |
+#include "webrtc/modules/audio_processing/echo_detector/normalized_covariance_estimator.h" |
namespace webrtc { |
class EchoDetector { |
public: |
- EchoDetector() {} |
- ~EchoDetector() {} |
+ EchoDetector(); |
+ ~EchoDetector(); |
- void BufferFarend(const rtc::ArrayView<const float>& farend); |
+ void BufferRender(const rtc::ArrayView<const float>& render); |
hlundin-webrtc
2016/10/17 18:49:41
Pass ArrayView by value, not by reference.
ivoc
2016/10/18 15:20:19
Oh, oops, I thought I changed that but it seems to
hlundin-webrtc
2016/10/18 20:52:21
When the gittings get hasty, the hasty get gitting
|
void Process(const rtc::ArrayView<const float>& nearend); |
hlundin-webrtc
2016/10/17 18:49:40
Same here.
ivoc
2016/10/18 15:20:19
Done.
|
- void Initialize(int sample_rate_hz); |
+ void Initialize(); |
+ |
+ float echo_likelihood() const { return echo_likelihood_; } |
+ |
+ private: |
+ static constexpr size_t kLookbackFrames = 650; |
+ // TODO(ivoc): Verify the size of this buffer. |
+ static constexpr size_t kRenderBufferSize = 30; |
+ |
+ // Buffer for storing the power of incoming farend buffers. This is needed for |
+ // cases where calls to BufferFarend and Process are jittery. |
+ CircularBuffer render_buffer_ = CircularBuffer(kRenderBufferSize); |
+ |
+ // Circular buffers containing delayed versions of the power, mean and sigma, |
hlundin-webrtc
2016/10/17 18:49:41
sigma -> standard deviation
ivoc
2016/10/18 15:20:19
Done.
|
+ // for calculating the delayed covariance values. |
+ std::vector<float> render_power_ = std::vector<float>(kLookbackFrames); |
+ std::vector<float> render_power_mean_ = std::vector<float>(kLookbackFrames); |
+ std::vector<float> render_power_std_dev_ = |
+ std::vector<float>(kLookbackFrames); |
+ // Covariance estimates for different delay values. |
+ std::vector<NormalizedCovarianceEstimator> covariance_ = |
+ std::vector<NormalizedCovarianceEstimator>(kLookbackFrames); |
+ // Index where next element should be inserted in all of the above circular |
+ // buffers. |
+ size_t next_insertion_index_ = 0; |
+ |
+ MeanVarianceEstimator render_variance_; |
+ MeanVarianceEstimator capture_variance_; |
+ // Current echo likelihood. |
+ float echo_likelihood_ = 0.f; |
}; |
} // namespace webrtc |