| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } else { | 141 } else { |
| 142 float old_sum = conj_sum_[i]; | 142 float old_sum = conj_sum_[i]; |
| 143 complex<float> old_mean = running_mean_[i]; | 143 complex<float> old_mean = running_mean_[i]; |
| 144 running_mean_[i] = | 144 running_mean_[i] = |
| 145 old_mean + (sample - old_mean) / static_cast<float>(count_); | 145 old_mean + (sample - old_mean) / static_cast<float>(count_); |
| 146 conj_sum_[i] = | 146 conj_sum_[i] = |
| 147 (old_sum + std::conj(sample - old_mean) * (sample - running_mean_[i])) | 147 (old_sum + std::conj(sample - old_mean) * (sample - running_mean_[i])) |
| 148 .real(); | 148 .real(); |
| 149 variance_[i] = | 149 variance_[i] = |
| 150 conj_sum_[i] / (count_ - 1); // + fudge[fudge_index].real(); | 150 conj_sum_[i] / (count_ - 1); // + fudge[fudge_index].real(); |
| 151 if (skip_fudge && false) { | 151 // if (skip_fudge) { |
| 152 // variance_[i] -= fudge[fudge_index].real(); | 152 // variance_[i] -= fudge[fudge_index].real(); |
| 153 } | 153 // } |
| 154 } | 154 } |
| 155 array_mean_ += (variance_[i] - array_mean_) / (i + 1); | 155 array_mean_ += (variance_[i] - array_mean_) / (i + 1); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 // Compute the variance from the beginning, with exponential decaying of the | 159 // Compute the variance from the beginning, with exponential decaying of the |
| 160 // series data. | 160 // series data. |
| 161 void VarianceArray::DecayStep(const complex<float>* data, bool /*dummy*/) { | 161 void VarianceArray::DecayStep(const complex<float>* data, bool /*dummy*/) { |
| 162 array_mean_ = 0.0f; | 162 array_mean_ = 0.0f; |
| 163 ++count_; | 163 ++count_; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 factor = 1.0f; | 291 factor = 1.0f; |
| 292 } | 292 } |
| 293 out_block[i] = factor * in_block[i]; | 293 out_block[i] = factor * in_block[i]; |
| 294 current_[i] = UpdateFactor(target_[i], current_[i], change_limit_); | 294 current_[i] = UpdateFactor(target_[i], current_[i], change_limit_); |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 } // namespace intelligibility | 298 } // namespace intelligibility |
| 299 | 299 |
| 300 } // namespace webrtc | 300 } // namespace webrtc |
| OLD | NEW |