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 30 matching lines...) Expand all Loading... |
41 const float decay_; | 41 const float decay_; |
42 }; | 42 }; |
43 | 43 |
44 // Helper class for smoothing gain changes. On each application step, the | 44 // Helper class for smoothing gain changes. On each application step, the |
45 // currently used gains are changed towards a set of settable target gains, | 45 // currently used gains are changed towards a set of settable target gains, |
46 // constrained by a limit on the relative changes. | 46 // constrained by a limit on the relative changes. |
47 class GainApplier { | 47 class GainApplier { |
48 public: | 48 public: |
49 GainApplier(size_t freqs, float relative_change_limit); | 49 GainApplier(size_t freqs, float relative_change_limit); |
50 | 50 |
| 51 ~GainApplier(); |
| 52 |
51 // Copy |in_block| to |out_block|, multiplied by the current set of gains, | 53 // Copy |in_block| to |out_block|, multiplied by the current set of gains, |
52 // and step the current set of gains towards the target set. | 54 // and step the current set of gains towards the target set. |
53 void Apply(const std::complex<float>* in_block, | 55 void Apply(const std::complex<float>* in_block, |
54 std::complex<float>* out_block); | 56 std::complex<float>* out_block); |
55 | 57 |
56 // Return the current target gain set. Modify this array to set the targets. | 58 // Return the current target gain set. Modify this array to set the targets. |
57 float* target() { return target_.data(); } | 59 float* target() { return target_.data(); } |
58 | 60 |
59 private: | 61 private: |
60 const size_t num_freqs_; | 62 const size_t num_freqs_; |
61 const float relative_change_limit_; | 63 const float relative_change_limit_; |
62 std::vector<float> target_; | 64 std::vector<float> target_; |
63 std::vector<float> current_; | 65 std::vector<float> current_; |
64 }; | 66 }; |
65 | 67 |
66 } // namespace intelligibility | 68 } // namespace intelligibility |
67 | 69 |
68 } // namespace webrtc | 70 } // namespace webrtc |
69 | 71 |
70 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INTELLIGIBILITY_INTELLIGIBILITY_UTILS
_H_ | 72 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INTELLIGIBILITY_INTELLIGIBILITY_UTILS
_H_ |
OLD | NEW |