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..215932ed6667ed6f5b4eaff7d3e2fcf6faeadbe8 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 BufferRender(rtc::ArrayView<const float> render); |
+ |
+ void Process(rtc::ArrayView<const float> nearend); |
+ |
+ 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; |
- void BufferFarend(const rtc::ArrayView<const float>& farend); |
+ // 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); |
- void Process(const rtc::ArrayView<const float>& nearend); |
+ // Circular buffers containing delayed versions of the power, mean and |
+ // standard deviation, for calculating the delayed covariance values. |
+ std::vector<float> render_power_ = std::vector<float>(kLookbackFrames); |
peah-webrtc
2016/10/19 14:45:25
Can't you just write std::vector<float> render_pow
ivoc
2016/10/20 14:04:35
Ok, I'll do that in the initializer list.
|
+ 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; |
- void Initialize(int sample_rate_hz); |
+ MeanVarianceEstimator render_variance_; |
+ MeanVarianceEstimator capture_variance_; |
peah-webrtc
2016/10/19 14:45:25
Since you use render_variance_ and capture_varianc
ivoc
2016/10/20 14:04:35
Done.
|
+ // Current echo likelihood. |
+ float echo_likelihood_ = 0.f; |
}; |
} // namespace webrtc |