OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_NORMALIZED_COVARIANCE_ESTI
MATOR_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_NORMALIZED_COVARIANCE_ESTI
MATOR_H_ |
| 13 |
| 14 namespace webrtc { |
| 15 |
| 16 // This class iteratively estimates the normalized covariance between two |
| 17 // signals. |
| 18 class NormalizedCovarianceEstimator { |
| 19 public: |
| 20 void Update(float x, |
| 21 float x_mean, |
| 22 float x_var, |
| 23 float y, |
| 24 float y_mean, |
| 25 float y_var); |
| 26 // This function returns an estimate of the Pearson product-moment correlation |
| 27 // coefficient of the two signals. |
| 28 float normalized_cross_correlation() const { |
| 29 return normalized_cross_correlation_; |
| 30 } |
| 31 // This function resets the estimated values to zero. |
| 32 void Clear(); |
| 33 |
| 34 private: |
| 35 float normalized_cross_correlation_ = 0.f; |
| 36 // Estimate of the covariance value. |
| 37 float covariance_ = 0.f; |
| 38 }; |
| 39 |
| 40 } // namespace webrtc |
| 41 |
| 42 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_NORMALIZED_COVARIANCE_E
STIMATOR_H_ |
OLD | NEW |