Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1371)

Unified Diff: webrtc/modules/audio_processing/test/audioproc_float.cc

Issue 3005483002: Replace remaining gflags usages with rtc_base/flags (Closed)
Patch Set: Rebase Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/test/audioproc_float.cc
diff --git a/webrtc/modules/audio_processing/test/audioproc_float.cc b/webrtc/modules/audio_processing/test/audioproc_float.cc
index a11f41c855183c371c454ecc1b0d24d343b7e595..bdf49d7afa8d3dcb6dfe28bc302045c0dfa07838 100644
--- a/webrtc/modules/audio_processing/test/audioproc_float.cc
+++ b/webrtc/modules/audio_processing/test/audioproc_float.cc
@@ -13,11 +13,11 @@
#include <string.h>
-#include "gflags/gflags.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_processing/test/aec_dump_based_simulator.h"
#include "webrtc/modules/audio_processing/test/audio_processing_simulator.h"
#include "webrtc/modules/audio_processing/test/wav_based_simulator.h"
+#include "webrtc/rtc_base/flags.h"
namespace webrtc {
namespace test {
@@ -32,7 +32,7 @@ const char kUsageDescription[] =
"\n\n"
"Command-line tool to simulate a call using the audio "
"processing module, either based on wav files or "
- "protobuf debug dump recordings.";
+ "protobuf debug dump recordings.\n";
DEFINE_string(dump_input, "", "Aec dump input filename");
DEFINE_string(dump_output, "", "Aec dump output filename");
@@ -41,126 +41,126 @@ DEFINE_string(o, "", "Forward stream output wav filename");
DEFINE_string(ri, "", "Reverse stream input wav filename");
DEFINE_string(ro, "", "Reverse stream output wav filename");
DEFINE_string(artificial_nearend, "", "Artificial nearend wav filename");
-DEFINE_int32(output_num_channels,
- kParameterNotSpecifiedValue,
- "Number of forward stream output channels");
-DEFINE_int32(reverse_output_num_channels,
- kParameterNotSpecifiedValue,
- "Number of Reverse stream output channels");
-DEFINE_int32(output_sample_rate_hz,
- kParameterNotSpecifiedValue,
- "Forward stream output sample rate in Hz");
-DEFINE_int32(reverse_output_sample_rate_hz,
- kParameterNotSpecifiedValue,
- "Reverse stream output sample rate in Hz");
+DEFINE_int(output_num_channels,
+ kParameterNotSpecifiedValue,
+ "Number of forward stream output channels");
+DEFINE_int(reverse_output_num_channels,
+ kParameterNotSpecifiedValue,
+ "Number of Reverse stream output channels");
+DEFINE_int(output_sample_rate_hz,
+ kParameterNotSpecifiedValue,
+ "Forward stream output sample rate in 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_int32(target_angle_degrees,
- 90,
- "The azimuth of the target in degrees (0-359). Only applies to "
- "beamforming.");
+DEFINE_int(target_angle_degrees,
+ 90,
+ "The azimuth of the target in degrees (0-359). Only applies to "
+ "beamforming.");
DEFINE_bool(fixed_interface,
false,
"Use the fixed interface when operating on wav files");
-DEFINE_int32(aec,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the echo canceller");
-DEFINE_int32(aecm,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the mobile echo controller");
-DEFINE_int32(ed,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate (0) the residual echo detector");
+DEFINE_int(aec,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the echo canceller");
+DEFINE_int(aecm,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the mobile echo controller");
+DEFINE_int(ed,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate (0) the residual echo detector");
DEFINE_string(ed_graph, "", "Output filename for graph of echo likelihood");
-DEFINE_int32(agc,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the AGC");
-DEFINE_int32(agc2,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the AGC2");
-DEFINE_int32(hpf,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the high-pass filter");
-DEFINE_int32(ns,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the noise suppressor");
-DEFINE_int32(ts,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the transient suppressor");
-DEFINE_int32(bf,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the beamformer");
-DEFINE_int32(ie,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the intelligibility enhancer");
-DEFINE_int32(vad,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the voice activity detector");
-DEFINE_int32(le,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the level estimator");
+DEFINE_int(agc,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the AGC");
+DEFINE_int(agc2,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the AGC2");
+DEFINE_int(hpf,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the high-pass filter");
+DEFINE_int(ns,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the noise suppressor");
+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");
+DEFINE_int(vad,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the voice activity detector");
+DEFINE_int(le,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the level estimator");
DEFINE_bool(all_default,
false,
"Activate all of the default components (will be overridden by any "
"other settings)");
-DEFINE_int32(aec_suppression_level,
- kParameterNotSpecifiedValue,
- "Set the aec suppression level (0-2)");
-DEFINE_int32(delay_agnostic,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the AEC delay agnostic mode");
-DEFINE_int32(extended_filter,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the AEC extended filter mode");
-DEFINE_int32(drift_compensation,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the drift compensation");
-DEFINE_int32(aec3,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the experimental AEC mode AEC3");
-DEFINE_int32(lc,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the level control");
-DEFINE_int32(experimental_agc,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the experimental AGC");
-DEFINE_int32(
+DEFINE_int(aec_suppression_level,
+ kParameterNotSpecifiedValue,
+ "Set the aec suppression level (0-2)");
+DEFINE_int(delay_agnostic,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the AEC delay agnostic mode");
+DEFINE_int(extended_filter,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the AEC extended filter mode");
+DEFINE_int(drift_compensation,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the drift compensation");
+DEFINE_int(aec3,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the experimental AEC mode AEC3");
+DEFINE_int(lc,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the level control");
+DEFINE_int(experimental_agc,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the experimental AGC");
+DEFINE_int(
refined_adaptive_filter,
kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the refined adaptive filter functionality");
-DEFINE_int32(aecm_routing_mode,
- kParameterNotSpecifiedValue,
- "Specify the AECM routing mode (0-4)");
-DEFINE_int32(aecm_comfort_noise,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the AECM comfort noise");
-DEFINE_int32(agc_mode,
- kParameterNotSpecifiedValue,
- "Specify the AGC mode (0-2)");
-DEFINE_int32(agc_target_level,
- kParameterNotSpecifiedValue,
- "Specify the AGC target level (0-31)");
-DEFINE_int32(agc_limiter,
- kParameterNotSpecifiedValue,
- "Activate (1) or deactivate(0) the level estimator");
-DEFINE_int32(agc_compression_gain,
- kParameterNotSpecifiedValue,
- "Specify the AGC compression gain (0-90)");
-DEFINE_int32(vad_likelihood,
- kParameterNotSpecifiedValue,
- "Specify the VAD likelihood (0-3)");
-DEFINE_int32(ns_level,
- kParameterNotSpecifiedValue,
- "Specify the NS level (0-3)");
-DEFINE_int32(stream_delay,
- kParameterNotSpecifiedValue,
- "Specify the stream delay in ms to use");
-DEFINE_int32(stream_drift_samples,
- kParameterNotSpecifiedValue,
- "Specify the number of stream drift samples to use");
+DEFINE_int(aecm_routing_mode,
+ kParameterNotSpecifiedValue,
+ "Specify the AECM routing mode (0-4)");
+DEFINE_int(aecm_comfort_noise,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the AECM comfort noise");
+DEFINE_int(agc_mode,
+ kParameterNotSpecifiedValue,
+ "Specify the AGC mode (0-2)");
+DEFINE_int(agc_target_level,
+ kParameterNotSpecifiedValue,
+ "Specify the AGC target level (0-31)");
+DEFINE_int(agc_limiter,
+ kParameterNotSpecifiedValue,
+ "Activate (1) or deactivate(0) the level estimator");
+DEFINE_int(agc_compression_gain,
+ kParameterNotSpecifiedValue,
+ "Specify the AGC compression gain (0-90)");
+DEFINE_int(vad_likelihood,
+ kParameterNotSpecifiedValue,
+ "Specify the VAD likelihood (0-3)");
+DEFINE_int(ns_level,
+ kParameterNotSpecifiedValue,
+ "Specify the NS level (0-3)");
+DEFINE_int(stream_delay,
+ kParameterNotSpecifiedValue,
+ "Specify the stream delay in ms to use");
+DEFINE_int(stream_drift_samples,
+ kParameterNotSpecifiedValue,
+ "Specify the number of stream drift samples to use");
DEFINE_bool(performance_report, false, "Report the APM performance ");
DEFINE_bool(verbose, false, "Produce verbose output");
DEFINE_bool(bitexactness_report,
@@ -173,6 +173,7 @@ DEFINE_bool(store_intermediate_output,
false,
"Creates new output files after each init");
DEFINE_string(custom_call_order_file, "", "Custom process API call order file");
+DEFINE_bool(help, false, "Print this message");
void SetSettingIfSpecified(const std::string value,
rtc::Optional<std::string>* parameter) {
@@ -197,7 +198,7 @@ void SetSettingIfFlagSet(int32_t flag, rtc::Optional<bool>* parameter) {
SimulationSettings CreateSettings() {
SimulationSettings settings;
- if (FLAGS_all_default) {
+ if (FLAG_all_default) {
settings.use_le = rtc::Optional<bool>(true);
settings.use_vad = rtc::Optional<bool>(true);
settings.use_ie = rtc::Optional<bool>(false);
@@ -210,70 +211,70 @@ SimulationSettings CreateSettings() {
settings.use_aecm = rtc::Optional<bool>(false);
settings.use_ed = rtc::Optional<bool>(false);
}
- SetSettingIfSpecified(FLAGS_dump_input, &settings.aec_dump_input_filename);
- SetSettingIfSpecified(FLAGS_dump_output, &settings.aec_dump_output_filename);
- SetSettingIfSpecified(FLAGS_i, &settings.input_filename);
- SetSettingIfSpecified(FLAGS_o, &settings.output_filename);
- SetSettingIfSpecified(FLAGS_ri, &settings.reverse_input_filename);
- SetSettingIfSpecified(FLAGS_ro, &settings.reverse_output_filename);
- SetSettingIfSpecified(FLAGS_artificial_nearend,
+ SetSettingIfSpecified(FLAG_dump_input, &settings.aec_dump_input_filename);
+ SetSettingIfSpecified(FLAG_dump_output, &settings.aec_dump_output_filename);
+ SetSettingIfSpecified(FLAG_i, &settings.input_filename);
+ SetSettingIfSpecified(FLAG_o, &settings.output_filename);
+ SetSettingIfSpecified(FLAG_ri, &settings.reverse_input_filename);
+ SetSettingIfSpecified(FLAG_ro, &settings.reverse_output_filename);
+ SetSettingIfSpecified(FLAG_artificial_nearend,
&settings.artificial_nearend_filename);
- SetSettingIfSpecified(FLAGS_output_num_channels,
+ SetSettingIfSpecified(FLAG_output_num_channels,
&settings.output_num_channels);
- SetSettingIfSpecified(FLAGS_reverse_output_num_channels,
+ SetSettingIfSpecified(FLAG_reverse_output_num_channels,
&settings.reverse_output_num_channels);
- SetSettingIfSpecified(FLAGS_output_sample_rate_hz,
+ SetSettingIfSpecified(FLAG_output_sample_rate_hz,
&settings.output_sample_rate_hz);
- SetSettingIfSpecified(FLAGS_reverse_output_sample_rate_hz,
+ SetSettingIfSpecified(FLAG_reverse_output_sample_rate_hz,
&settings.reverse_output_sample_rate_hz);
- SetSettingIfSpecified(FLAGS_mic_positions, &settings.microphone_positions);
- settings.target_angle_degrees = FLAGS_target_angle_degrees;
- SetSettingIfFlagSet(FLAGS_aec, &settings.use_aec);
- SetSettingIfFlagSet(FLAGS_aecm, &settings.use_aecm);
- SetSettingIfFlagSet(FLAGS_ed, &settings.use_ed);
- SetSettingIfSpecified(FLAGS_ed_graph, &settings.ed_graph_output_filename);
- SetSettingIfFlagSet(FLAGS_agc, &settings.use_agc);
- SetSettingIfFlagSet(FLAGS_agc2, &settings.use_agc2);
- SetSettingIfFlagSet(FLAGS_hpf, &settings.use_hpf);
- SetSettingIfFlagSet(FLAGS_ns, &settings.use_ns);
- SetSettingIfFlagSet(FLAGS_ts, &settings.use_ts);
- SetSettingIfFlagSet(FLAGS_bf, &settings.use_bf);
- SetSettingIfFlagSet(FLAGS_ie, &settings.use_ie);
- SetSettingIfFlagSet(FLAGS_vad, &settings.use_vad);
- SetSettingIfFlagSet(FLAGS_le, &settings.use_le);
- SetSettingIfSpecified(FLAGS_aec_suppression_level,
+ 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);
+ SetSettingIfSpecified(FLAG_ed_graph, &settings.ed_graph_output_filename);
+ SetSettingIfFlagSet(FLAG_agc, &settings.use_agc);
+ SetSettingIfFlagSet(FLAG_agc2, &settings.use_agc2);
+ 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);
+ SetSettingIfSpecified(FLAG_aec_suppression_level,
&settings.aec_suppression_level);
- SetSettingIfFlagSet(FLAGS_delay_agnostic, &settings.use_delay_agnostic);
- SetSettingIfFlagSet(FLAGS_extended_filter, &settings.use_extended_filter);
- SetSettingIfFlagSet(FLAGS_drift_compensation,
+ SetSettingIfFlagSet(FLAG_delay_agnostic, &settings.use_delay_agnostic);
+ SetSettingIfFlagSet(FLAG_extended_filter, &settings.use_extended_filter);
+ SetSettingIfFlagSet(FLAG_drift_compensation,
&settings.use_drift_compensation);
- SetSettingIfFlagSet(FLAGS_refined_adaptive_filter,
+ SetSettingIfFlagSet(FLAG_refined_adaptive_filter,
&settings.use_refined_adaptive_filter);
- SetSettingIfFlagSet(FLAGS_aec3, &settings.use_aec3);
- SetSettingIfFlagSet(FLAGS_lc, &settings.use_lc);
- SetSettingIfFlagSet(FLAGS_experimental_agc, &settings.use_experimental_agc);
- SetSettingIfSpecified(FLAGS_aecm_routing_mode, &settings.aecm_routing_mode);
- SetSettingIfFlagSet(FLAGS_aecm_comfort_noise,
+ SetSettingIfFlagSet(FLAG_aec3, &settings.use_aec3);
+ SetSettingIfFlagSet(FLAG_lc, &settings.use_lc);
+ SetSettingIfFlagSet(FLAG_experimental_agc, &settings.use_experimental_agc);
+ SetSettingIfSpecified(FLAG_aecm_routing_mode, &settings.aecm_routing_mode);
+ SetSettingIfFlagSet(FLAG_aecm_comfort_noise,
&settings.use_aecm_comfort_noise);
- SetSettingIfSpecified(FLAGS_agc_mode, &settings.agc_mode);
- SetSettingIfSpecified(FLAGS_agc_target_level, &settings.agc_target_level);
- SetSettingIfFlagSet(FLAGS_agc_limiter, &settings.use_agc_limiter);
- SetSettingIfSpecified(FLAGS_agc_compression_gain,
+ SetSettingIfSpecified(FLAG_agc_mode, &settings.agc_mode);
+ SetSettingIfSpecified(FLAG_agc_target_level, &settings.agc_target_level);
+ SetSettingIfFlagSet(FLAG_agc_limiter, &settings.use_agc_limiter);
+ SetSettingIfSpecified(FLAG_agc_compression_gain,
&settings.agc_compression_gain);
- SetSettingIfSpecified(FLAGS_vad_likelihood, &settings.vad_likelihood);
- SetSettingIfSpecified(FLAGS_ns_level, &settings.ns_level);
- SetSettingIfSpecified(FLAGS_stream_delay, &settings.stream_delay);
- SetSettingIfSpecified(FLAGS_stream_drift_samples,
+ SetSettingIfSpecified(FLAG_vad_likelihood, &settings.vad_likelihood);
+ SetSettingIfSpecified(FLAG_ns_level, &settings.ns_level);
+ SetSettingIfSpecified(FLAG_stream_delay, &settings.stream_delay);
+ SetSettingIfSpecified(FLAG_stream_drift_samples,
&settings.stream_drift_samples);
- SetSettingIfSpecified(FLAGS_custom_call_order_file,
+ SetSettingIfSpecified(FLAG_custom_call_order_file,
&settings.custom_call_order_filename);
- settings.report_performance = FLAGS_performance_report;
- settings.use_verbose_logging = FLAGS_verbose;
- settings.report_bitexactness = FLAGS_bitexactness_report;
- settings.discard_all_settings_in_aecdump = FLAGS_discard_settings_in_aecdump;
- settings.fixed_interface = FLAGS_fixed_interface;
- settings.store_intermediate_output = FLAGS_store_intermediate_output;
+ settings.report_performance = FLAG_performance_report;
+ settings.use_verbose_logging = FLAG_verbose;
+ settings.report_bitexactness = FLAG_bitexactness_report;
+ settings.discard_all_settings_in_aecdump = FLAG_discard_settings_in_aecdump;
+ settings.fixed_interface = FLAG_fixed_interface;
+ settings.store_intermediate_output = FLAG_store_intermediate_output;
return settings;
}
@@ -422,8 +423,15 @@ void PerformBasicParameterSanityChecks(const SimulationSettings& settings) {
} // namespace
int main(int argc, char* argv[]) {
- google::SetUsageMessage(kUsageDescription);
- google::ParseCommandLineFlags(&argc, &argv, true);
+ if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) ||
+ FLAG_help || argc != 1) {
+ printf("%s", kUsageDescription);
+ if (FLAG_help) {
+ rtc::FlagList::Print(nullptr, false);
+ return 0;
+ }
+ return 1;
+ }
SimulationSettings settings = CreateSettings();
PerformBasicParameterSanityChecks(settings);

Powered by Google App Engine
This is Rietveld 408576698