| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } else { | 130 } else { |
| 131 float old_sum = conj_sum_[i]; | 131 float old_sum = conj_sum_[i]; |
| 132 complex<float> old_mean = running_mean_[i]; | 132 complex<float> old_mean = running_mean_[i]; |
| 133 running_mean_[i] = | 133 running_mean_[i] = |
| 134 old_mean + (sample - old_mean) / static_cast<float>(count_); | 134 old_mean + (sample - old_mean) / static_cast<float>(count_); |
| 135 conj_sum_[i] = | 135 conj_sum_[i] = |
| 136 (old_sum + std::conj(sample - old_mean) * (sample - running_mean_[i])) | 136 (old_sum + std::conj(sample - old_mean) * (sample - running_mean_[i])) |
| 137 .real(); | 137 .real(); |
| 138 variance_[i] = | 138 variance_[i] = |
| 139 conj_sum_[i] / (count_ - 1); // + fudge[fudge_index].real(); | 139 conj_sum_[i] / (count_ - 1); // + fudge[fudge_index].real(); |
| 140 if (skip_fudge && false) { | 140 // if (skip_fudge) { |
| 141 // variance_[i] -= fudge[fudge_index].real(); | 141 // variance_[i] -= fudge[fudge_index].real(); |
| 142 } | 142 // } |
| 143 } | 143 } |
| 144 array_mean_ += (variance_[i] - array_mean_) / (i + 1); | 144 array_mean_ += (variance_[i] - array_mean_) / (i + 1); |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 // Compute the variance from the beginning, with exponential decaying of the | 148 // Compute the variance from the beginning, with exponential decaying of the |
| 149 // series data. | 149 // series data. |
| 150 void VarianceArray::DecayStep(const complex<float>* data, bool /*dummy*/) { | 150 void VarianceArray::DecayStep(const complex<float>* data, bool /*dummy*/) { |
| 151 array_mean_ = 0.0f; | 151 array_mean_ = 0.0f; |
| 152 ++count_; | 152 ++count_; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 factor = 1.0f; | 325 factor = 1.0f; |
| 326 } | 326 } |
| 327 out_block[i] = factor * in_block[i]; | 327 out_block[i] = factor * in_block[i]; |
| 328 current_[i] = UpdateFactor(target_[i], current_[i], change_limit_); | 328 current_[i] = UpdateFactor(target_[i], current_[i], change_limit_); |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| 332 } // namespace intelligibility | 332 } // namespace intelligibility |
| 333 | 333 |
| 334 } // namespace webrtc | 334 } // namespace webrtc |
| OLD | NEW |