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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 sols[n] = | 383 sols[n] = |
384 (-beta0 - sqrtf(beta0 * beta0 - 4 * alpha0 * gamma0)) / (2 * alpha0); | 384 (-beta0 - sqrtf(beta0 * beta0 - 4 * alpha0 * gamma0)) / (2 * alpha0); |
385 } else { | 385 } else { |
386 sols[n] = -gamma0 / beta0; | 386 sols[n] = -gamma0 / beta0; |
387 } | 387 } |
388 sols[n] = fmax(0, sols[n]); | 388 sols[n] = fmax(0, sols[n]); |
389 } | 389 } |
390 } | 390 } |
391 | 391 |
392 void IntelligibilityEnhancer::FilterVariance(const float* var, float* result) { | 392 void IntelligibilityEnhancer::FilterVariance(const float* var, float* result) { |
| 393 DCHECK_GT(freqs_, 0); |
393 for (int i = 0; i < bank_size_; ++i) { | 394 for (int i = 0; i < bank_size_; ++i) { |
394 result[i] = DotProduct(filter_bank_[i].data(), var, freqs_); | 395 result[i] = DotProduct(&filter_bank_[i][0], var, freqs_); |
395 } | 396 } |
396 } | 397 } |
397 | 398 |
398 float IntelligibilityEnhancer::DotProduct(const float* a, | 399 float IntelligibilityEnhancer::DotProduct(const float* a, |
399 const float* b, | 400 const float* b, |
400 int length) { | 401 int length) { |
401 float ret = 0.0f; | 402 float ret = 0.0f; |
402 | 403 |
403 for (int i = 0; i < length; ++i) { | 404 for (int i = 0; i < length; ++i) { |
404 ret = fmaf(a[i], b[i], ret); | 405 ret = fmaf(a[i], b[i], ret); |
405 } | 406 } |
406 return ret; | 407 return ret; |
407 } | 408 } |
408 | 409 |
409 } // namespace webrtc | 410 } // namespace webrtc |
OLD | NEW |