SSE2 and NEON kill switches for AGC2

Bug: webrtc:7494
Change-Id: I221b717b5cf3c41b7b637e9234d1e339a0e6c7e5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/199967
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32918}
This commit is contained in:
Alessio Bazzica 2021-01-05 10:28:24 +01:00 committed by Commit Bot
parent b8f32c4a86
commit 524f682184
2 changed files with 13 additions and 4 deletions

View file

@ -33,12 +33,19 @@ constexpr int kGainApplierAdjacentSpeechFramesThreshold = 1;
constexpr float kMaxGainChangePerSecondDb = 3.f;
constexpr float kMaxOutputNoiseLevelDbfs = -50.f;
// Detects the available CPU features and applies a kill-switch to AVX2.
AvailableCpuFeatures GetAllowedCpuFeatures(bool avx2_allowed) {
// Detects the available CPU features and applies any kill-switches.
AvailableCpuFeatures GetAllowedCpuFeatures(
const AudioProcessing::Config::GainController2::AdaptiveDigital& config) {
AvailableCpuFeatures features = GetAvailableCpuFeatures();
if (!avx2_allowed) {
if (!config.sse2_allowed) {
features.sse2 = false;
}
if (!config.avx2_allowed) {
features.avx2 = false;
}
if (!config.neon_allowed) {
features.neon = false;
}
return features;
}
@ -65,7 +72,7 @@ AdaptiveAgc::AdaptiveAgc(ApmDataDumper* apm_data_dumper,
config.adaptive_digital.initial_saturation_margin_db,
config.adaptive_digital.extra_saturation_margin_db),
vad_(config.adaptive_digital.vad_probability_attack,
GetAllowedCpuFeatures(config.adaptive_digital.avx2_allowed)),
GetAllowedCpuFeatures(config.adaptive_digital)),
gain_applier_(
apm_data_dumper,
config.adaptive_digital.gain_applier_adjacent_speech_frames_threshold,

View file

@ -365,7 +365,9 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface {
int gain_applier_adjacent_speech_frames_threshold = 1;
float max_gain_change_db_per_second = 3.f;
float max_output_noise_level_dbfs = -50.f;
bool sse2_allowed = true;
bool avx2_allowed = true;
bool neon_allowed = true;
} adaptive_digital;
} gain_controller2;