mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Allowing reduced computations in the noise suppressor when the output is not used
This CL adds functionality in the noise suppressor that allows the computational complexity to be reduced when the output of APM is not used. Bug: b/177830919 Change-Id: I849351ba9559fae770e4667d78e38abde5230eed Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211342 Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org> Commit-Queue: Per Åhgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33477}
This commit is contained in:
parent
8ee1ec82e4
commit
15179a9986
3 changed files with 19 additions and 0 deletions
|
@ -679,6 +679,10 @@ void AudioProcessingImpl::HandleCaptureOutputUsedSetting(
|
||||||
submodules_.echo_controller->SetCaptureOutputUsage(
|
submodules_.echo_controller->SetCaptureOutputUsage(
|
||||||
capture_.capture_output_used);
|
capture_.capture_output_used);
|
||||||
}
|
}
|
||||||
|
if (submodules_.noise_suppressor) {
|
||||||
|
submodules_.noise_suppressor->SetCaptureOutputUsage(
|
||||||
|
capture_.capture_output_used);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioProcessingImpl::SetRuntimeSetting(RuntimeSetting setting) {
|
void AudioProcessingImpl::SetRuntimeSetting(RuntimeSetting setting) {
|
||||||
|
|
|
@ -448,6 +448,12 @@ void NoiseSuppressor::Process(AudioBuffer* audio) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only do the below processing if the output of the audio processing module
|
||||||
|
// is used.
|
||||||
|
if (!capture_output_used_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Aggregate the Wiener filters for all channels.
|
// Aggregate the Wiener filters for all channels.
|
||||||
std::array<float, kFftSizeBy2Plus1> filter_data;
|
std::array<float, kFftSizeBy2Plus1> filter_data;
|
||||||
rtc::ArrayView<const float, kFftSizeBy2Plus1> filter = filter_data;
|
rtc::ArrayView<const float, kFftSizeBy2Plus1> filter = filter_data;
|
||||||
|
|
|
@ -41,12 +41,21 @@ class NoiseSuppressor {
|
||||||
// Applies noise suppression.
|
// Applies noise suppression.
|
||||||
void Process(AudioBuffer* audio);
|
void Process(AudioBuffer* audio);
|
||||||
|
|
||||||
|
// Specifies whether the capture output will be used. The purpose of this is
|
||||||
|
// to allow the noise suppressor to deactivate some of the processing when the
|
||||||
|
// resulting output is anyway not used, for instance when the endpoint is
|
||||||
|
// muted.
|
||||||
|
void SetCaptureOutputUsage(bool capture_output_used) {
|
||||||
|
capture_output_used_ = capture_output_used;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const size_t num_bands_;
|
const size_t num_bands_;
|
||||||
const size_t num_channels_;
|
const size_t num_channels_;
|
||||||
const SuppressionParams suppression_params_;
|
const SuppressionParams suppression_params_;
|
||||||
int32_t num_analyzed_frames_ = -1;
|
int32_t num_analyzed_frames_ = -1;
|
||||||
NrFft fft_;
|
NrFft fft_;
|
||||||
|
bool capture_output_used_ = true;
|
||||||
|
|
||||||
struct ChannelState {
|
struct ChannelState {
|
||||||
ChannelState(const SuppressionParams& suppression_params, size_t num_bands);
|
ChannelState(const SuppressionParams& suppression_params, size_t num_bands);
|
||||||
|
|
Loading…
Reference in a new issue