Make the high-pass filter operate in full-band
This CL moves the high-pass filter to run in the full-band domain instead of the split-band domain. Bug: webrtc:11193 Change-Id: Ie61f4a80afda11236ecbb1ad544bbd0350c7bbfd Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161453 Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org> Commit-Queue: Per Åhgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30112}
This commit is contained in:
@ -75,6 +75,11 @@ bool DetectLegacyNsEnforcement() {
|
||||
return field_trial::IsEnabled("WebRTC-NewNoiseSuppressionKillSwitch");
|
||||
}
|
||||
|
||||
// Checks whether the high-pass filter should be done in the full-band.
|
||||
bool EnforceSplitBandHpf() {
|
||||
return field_trial::IsEnabled("WebRTC-FullBandHpfKillSwitch");
|
||||
}
|
||||
|
||||
// Checks whether AEC3 should be allowed to decide what the default
|
||||
// configuration should be based on the render and capture channel configuration
|
||||
// at hand.
|
||||
@ -343,7 +348,8 @@ AudioProcessingImpl::AudioProcessingImpl(
|
||||
!field_trial::IsEnabled(
|
||||
"WebRTC-ApmExperimentalMultiChannelRenderKillSwitch"),
|
||||
!field_trial::IsEnabled(
|
||||
"WebRTC-ApmExperimentalMultiChannelCaptureKillSwitch")),
|
||||
"WebRTC-ApmExperimentalMultiChannelCaptureKillSwitch"),
|
||||
EnforceSplitBandHpf()),
|
||||
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
|
||||
capture_(false),
|
||||
#else
|
||||
@ -629,7 +635,9 @@ void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) {
|
||||
config_.pipeline.multi_channel_render !=
|
||||
config.pipeline.multi_channel_render ||
|
||||
config_.pipeline.multi_channel_capture !=
|
||||
config.pipeline.multi_channel_capture;
|
||||
config.pipeline.multi_channel_capture ||
|
||||
config_.pipeline.maximum_internal_processing_rate !=
|
||||
config.pipeline.maximum_internal_processing_rate;
|
||||
|
||||
const bool aec_config_changed =
|
||||
config_.echo_canceller.enabled != config.echo_canceller.enabled ||
|
||||
@ -1199,6 +1207,13 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() {
|
||||
|
||||
AudioBuffer* capture_buffer = capture_.capture_audio.get(); // For brevity.
|
||||
|
||||
if (submodules_.high_pass_filter &&
|
||||
config_.high_pass_filter.apply_in_full_band &&
|
||||
!constants_.enforce_split_band_hpf) {
|
||||
submodules_.high_pass_filter->Process(capture_buffer,
|
||||
/*use_split_band_data=*/false);
|
||||
}
|
||||
|
||||
if (submodules_.pre_amplifier) {
|
||||
submodules_.pre_amplifier->ApplyGain(AudioFrameView<float>(
|
||||
capture_buffer->channels(), capture_buffer->num_channels(),
|
||||
@ -1267,8 +1282,11 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() {
|
||||
capture_buffer->set_num_channels(1);
|
||||
}
|
||||
|
||||
if (submodules_.high_pass_filter) {
|
||||
submodules_.high_pass_filter->Process(capture_buffer);
|
||||
if (submodules_.high_pass_filter &&
|
||||
(!config_.high_pass_filter.apply_in_full_band ||
|
||||
constants_.enforce_split_band_hpf)) {
|
||||
submodules_.high_pass_filter->Process(capture_buffer,
|
||||
/*use_split_band_data=*/true);
|
||||
}
|
||||
|
||||
RETURN_ON_ERR(submodules_.gain_control->AnalyzeCaptureAudio(*capture_buffer));
|
||||
@ -1760,7 +1778,14 @@ void AudioProcessingImpl::InitializeHighPassFilter() {
|
||||
!config_.echo_canceller.mobile_mode;
|
||||
if (submodule_states_.HighPassFilteringRequired() ||
|
||||
high_pass_filter_needed_by_aec) {
|
||||
submodules_.high_pass_filter.reset(new HighPassFilter(num_proc_channels()));
|
||||
bool use_full_band = config_.high_pass_filter.apply_in_full_band &&
|
||||
!constants_.enforce_split_band_hpf;
|
||||
int rate = use_full_band ? proc_fullband_sample_rate_hz()
|
||||
: proc_split_sample_rate_hz();
|
||||
size_t num_channels =
|
||||
use_full_band ? num_output_channels() : num_proc_channels();
|
||||
|
||||
submodules_.high_pass_filter.reset(new HighPassFilter(rate, num_channels));
|
||||
} else {
|
||||
submodules_.high_pass_filter.reset();
|
||||
}
|
||||
|
Reference in New Issue
Block a user