| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 if (num_of_deltas_ > 10*30) { | 139 if (num_of_deltas_ > 10*30) { |
| 140 alpha = 0.002; | 140 alpha = 0.002; |
| 141 } | 141 } |
| 142 // Only update the noise estimate if we're not over-using. |beta| is a | 142 // Only update the noise estimate if we're not over-using. |beta| is a |
| 143 // function of alpha and the time delta since the previous update. | 143 // function of alpha and the time delta since the previous update. |
| 144 const double beta = pow(1 - alpha, ts_delta * 30.0 / 1000.0); | 144 const double beta = pow(1 - alpha, ts_delta * 30.0 / 1000.0); |
| 145 avg_noise_ = beta * avg_noise_ | 145 avg_noise_ = beta * avg_noise_ |
| 146 + (1 - beta) * residual; | 146 + (1 - beta) * residual; |
| 147 var_noise_ = beta * var_noise_ | 147 var_noise_ = beta * var_noise_ |
| 148 + (1 - beta) * (avg_noise_ - residual) * (avg_noise_ - residual); | 148 + (1 - beta) * (avg_noise_ - residual) * (avg_noise_ - residual); |
| 149 if (var_noise_ < 1e-7) { | 149 if (var_noise_ < 1) { |
| 150 var_noise_ = 1e-7; | 150 var_noise_ = 1; |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 } // namespace webrtc | 153 } // namespace webrtc |
| OLD | NEW |