Chromium Code Reviews| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 for (int i = 0; i < freqs_; ++i) { | 322 for (int i = 0; i < freqs_; ++i) { |
| 323 float factor = sqrtf(fabsf(current_[i])); | 323 float factor = sqrtf(fabsf(current_[i])); |
| 324 if (!std::isnormal(factor)) { | 324 if (!std::isnormal(factor)) { |
| 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 void GainApplier::Clear() { | |
| 333 for (int i = 0; i < freqs_; i++) { | |
|
aluebs-webrtc
2015/07/20 19:33:43
++i
Also, maybe use num_freqs_? It is clearer.
ekm
2015/07/21 01:02:44
Done.
| |
| 334 target_[i] = 1.0f; | |
|
aluebs-webrtc
2015/07/20 19:33:43
1.f
ekm
2015/07/21 01:02:44
Done.
| |
| 335 } | |
| 336 } | |
| 337 | |
| 338 // TODO(ekmeyerson): Can reduce from O(|freqs_|) to O(1) if necessary. | |
| 339 bool GainApplier::IsIdentity() { | |
| 340 for (int i = 0; i < freqs_; i++) { | |
|
aluebs-webrtc
2015/07/20 19:33:43
++i
ekm
2015/07/21 01:02:44
Done.
| |
| 341 if (current_[i] != 1.0f || target_[i] != 1.0f) { | |
|
aluebs-webrtc
2015/07/20 19:33:43
1.f both times.
ekm
2015/07/21 01:02:44
Done.
| |
| 342 return false; | |
| 343 } | |
| 344 } | |
| 345 return true; | |
| 346 } | |
| 347 | |
| 332 } // namespace intelligibility | 348 } // namespace intelligibility |
| 333 | 349 |
| 334 } // namespace webrtc | 350 } // namespace webrtc |
| OLD | NEW |