| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 const size_t read_index = | 97 const size_t read_index = |
| 98 (kLookbackFrames + next_insertion_index_ - delay) % kLookbackFrames; | 98 (kLookbackFrames + next_insertion_index_ - delay) % kLookbackFrames; |
| 99 RTC_DCHECK_LT(read_index, render_power_.size()); | 99 RTC_DCHECK_LT(read_index, render_power_.size()); |
| 100 covariances_[delay].Update(capture_power, capture_mean, | 100 covariances_[delay].Update(capture_power, capture_mean, |
| 101 capture_std_deviation, render_power_[read_index], | 101 capture_std_deviation, render_power_[read_index], |
| 102 render_power_mean_[read_index], | 102 render_power_mean_[read_index], |
| 103 render_power_std_dev_[read_index]); | 103 render_power_std_dev_[read_index]); |
| 104 echo_likelihood_ = std::max( | 104 echo_likelihood_ = std::max( |
| 105 echo_likelihood_, covariances_[delay].normalized_cross_correlation()); | 105 echo_likelihood_, covariances_[delay].normalized_cross_correlation()); |
| 106 } | 106 } |
| 107 RTC_DCHECK_LT(echo_likelihood_, 1.1f); |
| 107 reliability_ = (1.0f - kAlpha) * reliability_ + kAlpha * 1.0f; | 108 reliability_ = (1.0f - kAlpha) * reliability_ + kAlpha * 1.0f; |
| 108 echo_likelihood_ *= reliability_; | 109 echo_likelihood_ *= reliability_; |
| 109 // This is a temporary fix to prevent echo likelihood values > 1.0. | 110 // This is a temporary fix to prevent echo likelihood values > 1.0. |
| 110 // TODO(ivoc): Find the root cause of this issue and fix it. | 111 // TODO(ivoc): Find the root cause of this issue and fix it. |
| 111 echo_likelihood_ = std::min(echo_likelihood_, 1.0f); | 112 echo_likelihood_ = std::min(echo_likelihood_, 1.0f); |
| 112 int echo_percentage = static_cast<int>(echo_likelihood_ * 100); | 113 int echo_percentage = static_cast<int>(echo_likelihood_ * 100); |
| 113 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.ResidualEchoDetector.EchoLikelihood", | 114 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.ResidualEchoDetector.EchoLikelihood", |
| 114 echo_percentage, 0, 100, 100 /* number of bins */); | 115 echo_percentage, 0, 100, 100 /* number of bins */); |
| 115 | 116 |
| 116 // Update the buffer of recent likelihood values. | 117 // Update the buffer of recent likelihood values. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 143 RTC_DCHECK_GE(160, audio->num_frames_per_band()); | 144 RTC_DCHECK_GE(160, audio->num_frames_per_band()); |
| 144 | 145 |
| 145 packed_buffer->clear(); | 146 packed_buffer->clear(); |
| 146 packed_buffer->insert(packed_buffer->end(), | 147 packed_buffer->insert(packed_buffer->end(), |
| 147 audio->split_bands_const_f(0)[kBand0To8kHz], | 148 audio->split_bands_const_f(0)[kBand0To8kHz], |
| 148 (audio->split_bands_const_f(0)[kBand0To8kHz] + | 149 (audio->split_bands_const_f(0)[kBand0To8kHz] + |
| 149 audio->num_frames_per_band())); | 150 audio->num_frames_per_band())); |
| 150 } | 151 } |
| 151 | 152 |
| 152 } // namespace webrtc | 153 } // namespace webrtc |
| OLD | NEW |