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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 template class PowerEstimator<float>; | 50 template class PowerEstimator<float>; |
51 template class PowerEstimator<std::complex<float>>; | 51 template class PowerEstimator<std::complex<float>>; |
52 | 52 |
53 GainApplier::GainApplier(size_t freqs, float relative_change_limit) | 53 GainApplier::GainApplier(size_t freqs, float relative_change_limit) |
54 : num_freqs_(freqs), | 54 : num_freqs_(freqs), |
55 relative_change_limit_(relative_change_limit), | 55 relative_change_limit_(relative_change_limit), |
56 target_(freqs, 1.f), | 56 target_(freqs, 1.f), |
57 current_(freqs, 1.f) {} | 57 current_(freqs, 1.f) {} |
58 | 58 |
| 59 GainApplier::~GainApplier() {} |
| 60 |
59 void GainApplier::Apply(const std::complex<float>* in_block, | 61 void GainApplier::Apply(const std::complex<float>* in_block, |
60 std::complex<float>* out_block) { | 62 std::complex<float>* out_block) { |
61 for (size_t i = 0; i < num_freqs_; ++i) { | 63 for (size_t i = 0; i < num_freqs_; ++i) { |
62 current_[i] = UpdateFactor(target_[i], current_[i], relative_change_limit_); | 64 current_[i] = UpdateFactor(target_[i], current_[i], relative_change_limit_); |
63 out_block[i] = sqrtf(fabsf(current_[i])) * in_block[i]; | 65 out_block[i] = sqrtf(fabsf(current_[i])) * in_block[i]; |
64 } | 66 } |
65 } | 67 } |
66 | 68 |
67 } // namespace intelligibility | 69 } // namespace intelligibility |
68 | 70 |
69 } // namespace webrtc | 71 } // namespace webrtc |
OLD | NEW |