| Index: webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h
|
| diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h
|
| index 3af1190cf0c167f0ab53e16e157f6df5ae916fbc..64b46cd002db319e7801beb68aa50d1de6093534 100644
|
| --- a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h
|
| +++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h
|
| @@ -16,8 +16,10 @@
|
| #include <vector>
|
|
|
| #include "webrtc/base/swap_queue.h"
|
| -#include "webrtc/common_audio/lapped_transform.h"
|
| +#include "webrtc/common_audio/audio_ring_buffer.h"
|
| #include "webrtc/common_audio/channel_buffer.h"
|
| +#include "webrtc/common_audio/lapped_transform.h"
|
| +#include "webrtc/modules/audio_processing/audio_buffer.h"
|
| #include "webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h"
|
| #include "webrtc/modules/audio_processing/render_queue_item_verifier.h"
|
| #include "webrtc/modules/audio_processing/vad/voice_activity_detector.h"
|
| @@ -33,6 +35,7 @@ class IntelligibilityEnhancer : public LappedTransform::Callback {
|
| public:
|
| IntelligibilityEnhancer(int sample_rate_hz,
|
| size_t num_render_channels,
|
| + size_t num_bands,
|
| size_t num_noise_bins);
|
|
|
| ~IntelligibilityEnhancer() override;
|
| @@ -41,9 +44,7 @@ class IntelligibilityEnhancer : public LappedTransform::Callback {
|
| void SetCaptureNoiseEstimate(std::vector<float> noise, float gain);
|
|
|
| // Reads chunk of speech in time domain and updates with modified signal.
|
| - void ProcessRenderAudio(float* const* audio,
|
| - int sample_rate_hz,
|
| - size_t num_channels);
|
| + void ProcessRenderAudio(AudioBuffer* audio);
|
| bool active() const;
|
|
|
| protected:
|
| @@ -56,10 +57,13 @@ class IntelligibilityEnhancer : public LappedTransform::Callback {
|
| std::complex<float>* const* out_block) override;
|
|
|
| private:
|
| + FRIEND_TEST_ALL_PREFIXES(IntelligibilityEnhancerTest, TestRenderUpdate);
|
| FRIEND_TEST_ALL_PREFIXES(IntelligibilityEnhancerTest, TestErbCreation);
|
| FRIEND_TEST_ALL_PREFIXES(IntelligibilityEnhancerTest, TestSolveForGains);
|
| FRIEND_TEST_ALL_PREFIXES(IntelligibilityEnhancerTest,
|
| TestNoiseGainHasExpectedResult);
|
| + FRIEND_TEST_ALL_PREFIXES(IntelligibilityEnhancerTest,
|
| + TestAllBandsHaveSameDelay);
|
|
|
| // Updates the SNR estimation and enables or disables this component using a
|
| // hysteresis.
|
| @@ -84,6 +88,10 @@ class IntelligibilityEnhancer : public LappedTransform::Callback {
|
| // Returns true if the audio is speech.
|
| bool IsSpeech(const float* audio);
|
|
|
| + // Delays the high bands to compensate for the processing delay in the low
|
| + // band.
|
| + void DelayHighBands(AudioBuffer* audio);
|
| +
|
| static const size_t kMaxNumNoiseEstimatesToBuffer = 5;
|
|
|
| const size_t freqs_; // Num frequencies in frequency domain.
|
| @@ -120,6 +128,8 @@ class IntelligibilityEnhancer : public LappedTransform::Callback {
|
| std::vector<float> noise_estimation_buffer_;
|
| SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>
|
| noise_estimation_queue_;
|
| +
|
| + std::vector<std::unique_ptr<AudioRingBuffer>> high_bands_buffers_;
|
| };
|
|
|
| } // namespace webrtc
|
|
|