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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 void ProcessAudioBlock(const std::complex<float>* const* in_block, | 50 void ProcessAudioBlock(const std::complex<float>* const* in_block, |
51 size_t in_channels, | 51 size_t in_channels, |
52 size_t frames, | 52 size_t frames, |
53 size_t out_channels, | 53 size_t out_channels, |
54 std::complex<float>* const* out_block) override; | 54 std::complex<float>* const* out_block) override; |
55 | 55 |
56 private: | 56 private: |
57 FRIEND_TEST_ALL_PREFIXES(IntelligibilityEnhancerTest, TestErbCreation); | 57 FRIEND_TEST_ALL_PREFIXES(IntelligibilityEnhancerTest, TestErbCreation); |
58 FRIEND_TEST_ALL_PREFIXES(IntelligibilityEnhancerTest, TestSolveForGains); | 58 FRIEND_TEST_ALL_PREFIXES(IntelligibilityEnhancerTest, TestSolveForGains); |
59 | 59 |
| 60 // Updates the SNR estimation and enables or disables this component using a |
| 61 // hysteresis. |
| 62 void UpdateActivity(); |
| 63 |
60 // Bisection search for optimal |lambda|. | 64 // Bisection search for optimal |lambda|. |
61 void SolveForLambda(float power_target); | 65 void SolveForLambda(float power_target); |
62 | 66 |
63 // Transforms freq gains to ERB gains. | 67 // Transforms freq gains to ERB gains. |
64 void UpdateErbGains(); | 68 void UpdateErbGains(); |
65 | 69 |
66 // Returns number of ERB filters. | 70 // Returns number of ERB filters. |
67 static size_t GetBankSize(int sample_rate, size_t erb_resolution); | 71 static size_t GetBankSize(int sample_rate, size_t erb_resolution); |
68 | 72 |
69 // Initializes ERB filterbank. | 73 // Initializes ERB filterbank. |
(...skipping 26 matching lines...) Expand all Loading... |
96 | 100 |
97 std::vector<float> gains_eq_; // Pre-filter modified gains. | 101 std::vector<float> gains_eq_; // Pre-filter modified gains. |
98 intelligibility::GainApplier gain_applier_; | 102 intelligibility::GainApplier gain_applier_; |
99 | 103 |
100 std::unique_ptr<LappedTransform> render_mangler_; | 104 std::unique_ptr<LappedTransform> render_mangler_; |
101 | 105 |
102 VoiceActivityDetector vad_; | 106 VoiceActivityDetector vad_; |
103 std::vector<int16_t> audio_s16_; | 107 std::vector<int16_t> audio_s16_; |
104 size_t chunks_since_voice_; | 108 size_t chunks_since_voice_; |
105 bool is_speech_; | 109 bool is_speech_; |
| 110 float snr_; |
| 111 bool is_active_; |
106 | 112 |
107 std::vector<float> noise_estimation_buffer_; | 113 std::vector<float> noise_estimation_buffer_; |
108 SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>> | 114 SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>> |
109 noise_estimation_queue_; | 115 noise_estimation_queue_; |
110 }; | 116 }; |
111 | 117 |
112 } // namespace webrtc | 118 } // namespace webrtc |
113 | 119 |
114 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INTELLIGIBILITY_INTELLIGIBILITY_ENHAN
CER_H_ | 120 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INTELLIGIBILITY_INTELLIGIBILITY_ENHAN
CER_H_ |
OLD | NEW |