Remove non-API beamformer references
This removes beamformer references from audioproc_f, some non-beamformer tests, and a few other bits and bobs. The beamformer is, after this, very decoupled from the remaining APM code. Bug: webrtc:9402 Change-Id: Iaafc95517013d7a17723ef2329f17b5e09069bc9 Reviewed-on: https://webrtc-review.googlesource.com/83983 Reviewed-by: Minyue Li <minyue@webrtc.org> Commit-Queue: Sam Zackrisson <saza@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23649}
This commit is contained in:
committed by
Commit Bot
parent
024eeff421
commit
af998e2fdc
@ -244,8 +244,6 @@ class AudioProcessingImpl : public AudioProcessing {
|
||||
// acquired.
|
||||
void InitializeTransient()
|
||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
|
||||
void InitializeBeamformer()
|
||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
|
||||
void InitializeIntelligibility()
|
||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
|
||||
int InitializeLocked(const ProcessingConfig& config)
|
||||
|
||||
@ -49,7 +49,6 @@ enum class ProcessorType { kRender, kCapture };
|
||||
enum class SettingsType {
|
||||
kDefaultApmDesktop,
|
||||
kDefaultApmMobile,
|
||||
kDefaultApmDesktopAndBeamformer,
|
||||
kDefaultApmDesktopAndIntelligibilityEnhancer,
|
||||
kAllSubmodulesTurnedOff,
|
||||
kDefaultApmDesktopWithoutDelayAgnostic,
|
||||
@ -114,17 +113,6 @@ struct SimulationConfig {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
const SettingsType beamformer_settings[] = {
|
||||
SettingsType::kDefaultApmDesktopAndBeamformer};
|
||||
|
||||
const int beamformer_sample_rates[] = {8000, 16000, 32000, 48000};
|
||||
|
||||
for (auto sample_rate : beamformer_sample_rates) {
|
||||
for (auto settings : beamformer_settings) {
|
||||
simulation_configs.push_back(SimulationConfig(sample_rate, settings));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
const SettingsType mobile_settings[] = {SettingsType::kDefaultApmMobile};
|
||||
@ -149,9 +137,6 @@ struct SimulationConfig {
|
||||
case SettingsType::kDefaultApmDesktop:
|
||||
description = "DefaultApmDesktop";
|
||||
break;
|
||||
case SettingsType::kDefaultApmDesktopAndBeamformer:
|
||||
description = "DefaultApmDesktopAndBeamformer";
|
||||
break;
|
||||
case SettingsType::kDefaultApmDesktopAndIntelligibilityEnhancer:
|
||||
description = "DefaultApmDesktopAndIntelligibilityEnhancer";
|
||||
break;
|
||||
@ -543,18 +528,6 @@ class CallSimulator : public ::testing::TestWithParam<SimulationConfig> {
|
||||
config->Set<DelayAgnostic>(new DelayAgnostic(true));
|
||||
};
|
||||
|
||||
// Lambda function for adding beamformer settings to a config.
|
||||
auto add_beamformer_config = [](Config* config) {
|
||||
const size_t num_mics = 2;
|
||||
const std::vector<Point> array_geometry =
|
||||
ParseArrayGeometry("0 0 0 0.05 0 0", num_mics);
|
||||
RTC_CHECK_EQ(array_geometry.size(), num_mics);
|
||||
|
||||
config->Set<Beamforming>(
|
||||
new Beamforming(true, array_geometry,
|
||||
SphericalPointf(DegreesToRadians(90), 0.f, 1.f)));
|
||||
};
|
||||
|
||||
int num_capture_channels = 1;
|
||||
switch (simulation_config_.simulation_settings) {
|
||||
case SettingsType::kDefaultApmMobile: {
|
||||
@ -572,17 +545,6 @@ class CallSimulator : public ::testing::TestWithParam<SimulationConfig> {
|
||||
apm_->SetExtraOptions(config);
|
||||
break;
|
||||
}
|
||||
case SettingsType::kDefaultApmDesktopAndBeamformer: {
|
||||
Config config;
|
||||
add_beamformer_config(&config);
|
||||
add_default_desktop_config(&config);
|
||||
apm_.reset(AudioProcessingBuilder().Create(config));
|
||||
ASSERT_TRUE(!!apm_);
|
||||
set_default_desktop_apm_runtime_settings(apm_.get());
|
||||
apm_->SetExtraOptions(config);
|
||||
num_capture_channels = 2;
|
||||
break;
|
||||
}
|
||||
case SettingsType::kDefaultApmDesktopAndIntelligibilityEnhancer: {
|
||||
Config config;
|
||||
config.Set<Intelligibility>(new Intelligibility(true));
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
#include "common_audio/signal_processing/include/signal_processing_library.h"
|
||||
#include "modules/audio_processing/aec_dump/aec_dump_factory.h"
|
||||
#include "modules/audio_processing/audio_processing_impl.h"
|
||||
#include "modules/audio_processing/beamformer/mock_nonlinear_beamformer.h"
|
||||
#include "modules/audio_processing/common.h"
|
||||
#include "modules/audio_processing/include/audio_processing.h"
|
||||
#include "modules/audio_processing/include/mock_audio_processing.h"
|
||||
|
||||
@ -37,6 +37,29 @@ const char kUsage[] =
|
||||
"in as a single band, unlike the audio processing interface which splits\n"
|
||||
"signals into multiple bands.\n";
|
||||
|
||||
std::vector<Point> ParseArrayGeometry(const std::string& mic_positions) {
|
||||
const std::vector<float> values = ParseList<float>(mic_positions);
|
||||
const size_t num_mics =
|
||||
rtc::CheckedDivExact(values.size(), static_cast<size_t>(3));
|
||||
RTC_CHECK_GT(num_mics, 0) << "mic_positions is not large enough.";
|
||||
|
||||
std::vector<Point> result;
|
||||
result.reserve(num_mics);
|
||||
for (size_t i = 0; i < values.size(); i += 3) {
|
||||
result.push_back(Point(values[i + 0], values[i + 1], values[i + 2]));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<Point> ParseArrayGeometry(const std::string& mic_positions,
|
||||
size_t num_mics) {
|
||||
std::vector<Point> result = ParseArrayGeometry(mic_positions);
|
||||
RTC_CHECK_EQ(result.size(), num_mics)
|
||||
<< "Could not parse mic_positions or incorrect number of points.";
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
||||
@ -579,12 +579,6 @@ void AudioProcessingSimulator::CreateAudioProcessor() {
|
||||
Config config;
|
||||
AudioProcessing::Config apm_config;
|
||||
std::unique_ptr<EchoControlFactory> echo_control_factory;
|
||||
if (settings_.use_bf && *settings_.use_bf) {
|
||||
config.Set<Beamforming>(new Beamforming(
|
||||
true, ParseArrayGeometry(*settings_.microphone_positions),
|
||||
SphericalPointf(DegreesToRadians(settings_.target_angle_degrees), 0.f,
|
||||
1.f)));
|
||||
}
|
||||
if (settings_.use_ts) {
|
||||
config.Set<ExperimentalNs>(new ExperimentalNs(*settings_.use_ts));
|
||||
}
|
||||
|
||||
@ -41,8 +41,6 @@ struct SimulationSettings {
|
||||
rtc::Optional<int> output_num_channels;
|
||||
rtc::Optional<int> reverse_output_sample_rate_hz;
|
||||
rtc::Optional<int> reverse_output_num_channels;
|
||||
rtc::Optional<std::string> microphone_positions;
|
||||
float target_angle_degrees = 90.f;
|
||||
rtc::Optional<std::string> output_filename;
|
||||
rtc::Optional<std::string> reverse_output_filename;
|
||||
rtc::Optional<std::string> input_filename;
|
||||
|
||||
@ -56,15 +56,6 @@ DEFINE_int(output_sample_rate_hz,
|
||||
DEFINE_int(reverse_output_sample_rate_hz,
|
||||
kParameterNotSpecifiedValue,
|
||||
"Reverse stream output sample rate in Hz");
|
||||
DEFINE_string(mic_positions,
|
||||
"",
|
||||
"Space delimited cartesian coordinates of microphones in "
|
||||
"meters. The coordinates of each point are contiguous. For a "
|
||||
"two element array: \"x1 y1 z1 x2 y2 z2\"");
|
||||
DEFINE_float(target_angle_degrees,
|
||||
90.f,
|
||||
"The azimuth of the target in degrees (0-360). Only applies to "
|
||||
"beamforming.");
|
||||
DEFINE_bool(fixed_interface,
|
||||
false,
|
||||
"Use the fixed interface when operating on wav files");
|
||||
@ -96,9 +87,6 @@ DEFINE_int(ns,
|
||||
DEFINE_int(ts,
|
||||
kParameterNotSpecifiedValue,
|
||||
"Activate (1) or deactivate(0) the transient suppressor");
|
||||
DEFINE_int(bf,
|
||||
kParameterNotSpecifiedValue,
|
||||
"Activate (1) or deactivate(0) the beamformer");
|
||||
DEFINE_int(ie,
|
||||
kParameterNotSpecifiedValue,
|
||||
"Activate (1) or deactivate(0) the intelligibility enhancer");
|
||||
@ -222,7 +210,6 @@ SimulationSettings CreateSettings() {
|
||||
settings.use_le = true;
|
||||
settings.use_vad = true;
|
||||
settings.use_ie = false;
|
||||
settings.use_bf = false;
|
||||
settings.use_ts = true;
|
||||
settings.use_ns = true;
|
||||
settings.use_hpf = true;
|
||||
@ -249,8 +236,6 @@ SimulationSettings CreateSettings() {
|
||||
&settings.output_sample_rate_hz);
|
||||
SetSettingIfSpecified(FLAG_reverse_output_sample_rate_hz,
|
||||
&settings.reverse_output_sample_rate_hz);
|
||||
SetSettingIfSpecified(FLAG_mic_positions, &settings.microphone_positions);
|
||||
settings.target_angle_degrees = FLAG_target_angle_degrees;
|
||||
SetSettingIfFlagSet(FLAG_aec, &settings.use_aec);
|
||||
SetSettingIfFlagSet(FLAG_aecm, &settings.use_aecm);
|
||||
SetSettingIfFlagSet(FLAG_ed, &settings.use_ed);
|
||||
@ -261,7 +246,6 @@ SimulationSettings CreateSettings() {
|
||||
SetSettingIfFlagSet(FLAG_hpf, &settings.use_hpf);
|
||||
SetSettingIfFlagSet(FLAG_ns, &settings.use_ns);
|
||||
SetSettingIfFlagSet(FLAG_ts, &settings.use_ts);
|
||||
SetSettingIfFlagSet(FLAG_bf, &settings.use_bf);
|
||||
SetSettingIfFlagSet(FLAG_ie, &settings.use_ie);
|
||||
SetSettingIfFlagSet(FLAG_vad, &settings.use_vad);
|
||||
SetSettingIfFlagSet(FLAG_le, &settings.use_le);
|
||||
@ -364,16 +348,6 @@ void PerformBasicParameterSanityChecks(const SimulationSettings& settings) {
|
||||
*settings.reverse_output_num_channels <= 0,
|
||||
"Error: --reverse_output_num_channels must be positive!\n");
|
||||
|
||||
ReportConditionalErrorAndExit(
|
||||
settings.use_bf && *settings.use_bf && !settings.microphone_positions,
|
||||
"Error: --mic_positions must be specified when the beamformer is "
|
||||
"activated.\n");
|
||||
|
||||
ReportConditionalErrorAndExit(
|
||||
settings.target_angle_degrees < 0.f ||
|
||||
settings.target_angle_degrees >= 360.f,
|
||||
"Error: -target_angle_degrees must be specified between 0 and 360.\n");
|
||||
|
||||
ReportConditionalErrorAndExit(
|
||||
settings.aec_suppression_level &&
|
||||
((*settings.aec_suppression_level) < 0 ||
|
||||
|
||||
@ -132,27 +132,4 @@ AudioProcessing::ChannelLayout LayoutFromChannels(size_t num_channels) {
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<Point> ParseArrayGeometry(const std::string& mic_positions) {
|
||||
const std::vector<float> values = ParseList<float>(mic_positions);
|
||||
const size_t num_mics =
|
||||
rtc::CheckedDivExact(values.size(), static_cast<size_t>(3));
|
||||
RTC_CHECK_GT(num_mics, 0) << "mic_positions is not large enough.";
|
||||
|
||||
std::vector<Point> result;
|
||||
result.reserve(num_mics);
|
||||
for (size_t i = 0; i < values.size(); i += 3) {
|
||||
result.push_back(Point(values[i + 0], values[i + 1], values[i + 2]));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<Point> ParseArrayGeometry(const std::string& mic_positions,
|
||||
size_t num_mics) {
|
||||
std::vector<Point> result = ParseArrayGeometry(mic_positions);
|
||||
RTC_CHECK_EQ(result.size(), num_mics)
|
||||
<< "Could not parse mic_positions or incorrect number of points.";
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -143,16 +143,6 @@ std::vector<T> ParseList(const std::string& to_parse) {
|
||||
return values;
|
||||
}
|
||||
|
||||
// Parses the array geometry from the command line.
|
||||
//
|
||||
// If a vector with size != num_mics is returned, an error has occurred and an
|
||||
// appropriate error message has been printed to stdout.
|
||||
std::vector<Point> ParseArrayGeometry(const std::string& mic_positions,
|
||||
size_t num_mics);
|
||||
|
||||
// Same as above, but without the num_mics check for when it isn't available.
|
||||
std::vector<Point> ParseArrayGeometry(const std::string& mic_positions);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // MODULES_AUDIO_PROCESSING_TEST_TEST_UTILS_H_
|
||||
|
||||
Reference in New Issue
Block a user