| Index: webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_test.cc
|
| diff --git a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_test.cc b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_test.cc
|
| index 3ac68d4435cdfc322a6116fd0a1ed91785d27330..11b172ab28f6f322592955e97acaa9f2c774fa70 100644
|
| --- a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_test.cc
|
| +++ b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_test.cc
|
| @@ -10,12 +10,12 @@
|
|
|
| #include <vector>
|
|
|
| -#include "gflags/gflags.h"
|
| #include "webrtc/common_audio/channel_buffer.h"
|
| #include "webrtc/common_audio/wav_file.h"
|
| #include "webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h"
|
| #include "webrtc/modules/audio_processing/test/test_utils.h"
|
| #include "webrtc/rtc_base/checks.h"
|
| +#include "webrtc/rtc_base/flags.h"
|
| #include "webrtc/rtc_base/format_macros.h"
|
|
|
| DEFINE_string(i, "", "The name of the input file to read from.");
|
| @@ -24,6 +24,7 @@ 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_bool(help, false, "Prints this message.");
|
|
|
| namespace webrtc {
|
| namespace {
|
| @@ -34,29 +35,36 @@ const int kChunkSizeMs = 1000 / kChunksPerSecond;
|
| const char kUsage[] =
|
| "Command-line tool to run beamforming on WAV files. The signal is passed\n"
|
| "in as a single band, unlike the audio processing interface which splits\n"
|
| - "signals into multiple bands.";
|
| + "signals into multiple bands.\n";
|
|
|
| } // namespace
|
|
|
| int main(int argc, char* argv[]) {
|
| - google::SetUsageMessage(kUsage);
|
| - google::ParseCommandLineFlags(&argc, &argv, true);
|
| + if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) ||
|
| + FLAG_help || argc != 1) {
|
| + printf("%s", kUsage);
|
| + if (FLAG_help) {
|
| + rtc::FlagList::Print(nullptr, false);
|
| + return 0;
|
| + }
|
| + return 1;
|
| + }
|
|
|
| - WavReader in_file(FLAGS_i);
|
| - WavWriter out_file(FLAGS_o, in_file.sample_rate(), in_file.num_channels());
|
| + WavReader in_file(FLAG_i);
|
| + WavWriter out_file(FLAG_o, in_file.sample_rate(), in_file.num_channels());
|
|
|
| const size_t num_mics = in_file.num_channels();
|
| const std::vector<Point> array_geometry =
|
| - ParseArrayGeometry(FLAGS_mic_positions, num_mics);
|
| + ParseArrayGeometry(FLAG_mic_positions, num_mics);
|
| RTC_CHECK_EQ(array_geometry.size(), num_mics);
|
|
|
| NonlinearBeamformer bf(array_geometry, array_geometry.size());
|
| bf.Initialize(kChunkSizeMs, in_file.sample_rate());
|
|
|
| printf("Input file: %s\nChannels: %" PRIuS ", Sample rate: %d Hz\n\n",
|
| - FLAGS_i.c_str(), in_file.num_channels(), in_file.sample_rate());
|
| + FLAG_i, in_file.num_channels(), in_file.sample_rate());
|
| printf("Output file: %s\nChannels: %" PRIuS ", Sample rate: %d Hz\n\n",
|
| - FLAGS_o.c_str(), out_file.num_channels(), out_file.sample_rate());
|
| + FLAG_o, out_file.num_channels(), out_file.sample_rate());
|
|
|
| ChannelBuffer<float> buf(
|
| rtc::CheckedDivExact(in_file.sample_rate(), kChunksPerSecond),
|
|
|