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 17 matching lines...) Expand all Loading... |
28 // audio streams and modifies the render stream with a set of gains per | 28 // audio streams and modifies the render stream with a set of gains per |
29 // frequency bin to enhance speech against the noise background. | 29 // frequency bin to enhance speech against the noise background. |
30 // Details of the model and algorithm can be found in the original paper: | 30 // Details of the model and algorithm can be found in the original paper: |
31 // http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=6882788 | 31 // http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=6882788 |
32 class IntelligibilityEnhancer : public LappedTransform::Callback { | 32 class IntelligibilityEnhancer : public LappedTransform::Callback { |
33 public: | 33 public: |
34 IntelligibilityEnhancer(int sample_rate_hz, | 34 IntelligibilityEnhancer(int sample_rate_hz, |
35 size_t num_render_channels, | 35 size_t num_render_channels, |
36 size_t num_noise_bins); | 36 size_t num_noise_bins); |
37 | 37 |
| 38 ~IntelligibilityEnhancer(); |
| 39 |
38 // Sets the capture noise magnitude spectrum estimate. | 40 // Sets the capture noise magnitude spectrum estimate. |
39 void SetCaptureNoiseEstimate(std::vector<float> noise, float gain); | 41 void SetCaptureNoiseEstimate(std::vector<float> noise, float gain); |
40 | 42 |
41 // Reads chunk of speech in time domain and updates with modified signal. | 43 // Reads chunk of speech in time domain and updates with modified signal. |
42 void ProcessRenderAudio(float* const* audio, | 44 void ProcessRenderAudio(float* const* audio, |
43 int sample_rate_hz, | 45 int sample_rate_hz, |
44 size_t num_channels); | 46 size_t num_channels); |
45 bool active() const; | 47 bool active() const; |
46 | 48 |
47 protected: | 49 protected: |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 107 |
106 std::unique_ptr<LappedTransform> render_mangler_; | 108 std::unique_ptr<LappedTransform> render_mangler_; |
107 | 109 |
108 VoiceActivityDetector vad_; | 110 VoiceActivityDetector vad_; |
109 std::vector<int16_t> audio_s16_; | 111 std::vector<int16_t> audio_s16_; |
110 size_t chunks_since_voice_; | 112 size_t chunks_since_voice_; |
111 bool is_speech_; | 113 bool is_speech_; |
112 float snr_; | 114 float snr_; |
113 bool is_active_; | 115 bool is_active_; |
114 | 116 |
115 size_t num_chunks_; | 117 unsigned long int num_chunks_; |
| 118 unsigned long int num_active_chunks_; |
116 | 119 |
117 std::vector<float> noise_estimation_buffer_; | 120 std::vector<float> noise_estimation_buffer_; |
118 SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>> | 121 SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>> |
119 noise_estimation_queue_; | 122 noise_estimation_queue_; |
120 }; | 123 }; |
121 | 124 |
122 } // namespace webrtc | 125 } // namespace webrtc |
123 | 126 |
124 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INTELLIGIBILITY_INTELLIGIBILITY_ENHAN
CER_H_ | 127 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INTELLIGIBILITY_INTELLIGIBILITY_ENHAN
CER_H_ |
OLD | NEW |