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

Side by Side 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, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <iostream> 11 #include <iostream>
12 #include <memory> 12 #include <memory>
13 13
14 #include <string.h> 14 #include <string.h>
15 15
16 #include "gflags/gflags.h"
17 #include "webrtc/modules/audio_processing/include/audio_processing.h" 16 #include "webrtc/modules/audio_processing/include/audio_processing.h"
18 #include "webrtc/modules/audio_processing/test/aec_dump_based_simulator.h" 17 #include "webrtc/modules/audio_processing/test/aec_dump_based_simulator.h"
19 #include "webrtc/modules/audio_processing/test/audio_processing_simulator.h" 18 #include "webrtc/modules/audio_processing/test/audio_processing_simulator.h"
20 #include "webrtc/modules/audio_processing/test/wav_based_simulator.h" 19 #include "webrtc/modules/audio_processing/test/wav_based_simulator.h"
20 #include "webrtc/rtc_base/flags.h"
21 21
22 namespace webrtc { 22 namespace webrtc {
23 namespace test { 23 namespace test {
24 namespace { 24 namespace {
25 25
26 const int kParameterNotSpecifiedValue = -10000; 26 const int kParameterNotSpecifiedValue = -10000;
27 27
28 const char kUsageDescription[] = 28 const char kUsageDescription[] =
29 "Usage: audioproc_f [options] -i <input.wav>\n" 29 "Usage: audioproc_f [options] -i <input.wav>\n"
30 " or\n" 30 " or\n"
31 " audioproc_f [options] -dump_input <aec_dump>\n" 31 " audioproc_f [options] -dump_input <aec_dump>\n"
32 "\n\n" 32 "\n\n"
33 "Command-line tool to simulate a call using the audio " 33 "Command-line tool to simulate a call using the audio "
34 "processing module, either based on wav files or " 34 "processing module, either based on wav files or "
35 "protobuf debug dump recordings."; 35 "protobuf debug dump recordings.\n";
36 36
37 DEFINE_string(dump_input, "", "Aec dump input filename"); 37 DEFINE_string(dump_input, "", "Aec dump input filename");
38 DEFINE_string(dump_output, "", "Aec dump output filename"); 38 DEFINE_string(dump_output, "", "Aec dump output filename");
39 DEFINE_string(i, "", "Forward stream input wav filename"); 39 DEFINE_string(i, "", "Forward stream input wav filename");
40 DEFINE_string(o, "", "Forward stream output wav filename"); 40 DEFINE_string(o, "", "Forward stream output wav filename");
41 DEFINE_string(ri, "", "Reverse stream input wav filename"); 41 DEFINE_string(ri, "", "Reverse stream input wav filename");
42 DEFINE_string(ro, "", "Reverse stream output wav filename"); 42 DEFINE_string(ro, "", "Reverse stream output wav filename");
43 DEFINE_string(artificial_nearend, "", "Artificial nearend wav filename"); 43 DEFINE_string(artificial_nearend, "", "Artificial nearend wav filename");
44 DEFINE_int32(output_num_channels, 44 DEFINE_int(output_num_channels,
45 kParameterNotSpecifiedValue, 45 kParameterNotSpecifiedValue,
46 "Number of forward stream output channels"); 46 "Number of forward stream output channels");
47 DEFINE_int32(reverse_output_num_channels, 47 DEFINE_int(reverse_output_num_channels,
48 kParameterNotSpecifiedValue, 48 kParameterNotSpecifiedValue,
49 "Number of Reverse stream output channels"); 49 "Number of Reverse stream output channels");
50 DEFINE_int32(output_sample_rate_hz, 50 DEFINE_int(output_sample_rate_hz,
51 kParameterNotSpecifiedValue, 51 kParameterNotSpecifiedValue,
52 "Forward stream output sample rate in Hz"); 52 "Forward stream output sample rate in Hz");
53 DEFINE_int32(reverse_output_sample_rate_hz, 53 DEFINE_int(reverse_output_sample_rate_hz,
54 kParameterNotSpecifiedValue, 54 kParameterNotSpecifiedValue,
55 "Reverse stream output sample rate in Hz"); 55 "Reverse stream output sample rate in Hz");
56 DEFINE_string(mic_positions, 56 DEFINE_string(mic_positions,
57 "", 57 "",
58 "Space delimited cartesian coordinates of microphones in " 58 "Space delimited cartesian coordinates of microphones in "
59 "meters. The coordinates of each point are contiguous. For a " 59 "meters. The coordinates of each point are contiguous. For a "
60 "two element array: \"x1 y1 z1 x2 y2 z2\""); 60 "two element array: \"x1 y1 z1 x2 y2 z2\"");
61 DEFINE_int32(target_angle_degrees, 61 DEFINE_int(target_angle_degrees,
62 90, 62 90,
63 "The azimuth of the target in degrees (0-359). Only applies to " 63 "The azimuth of the target in degrees (0-359). Only applies to "
64 "beamforming."); 64 "beamforming.");
65 DEFINE_bool(fixed_interface, 65 DEFINE_bool(fixed_interface,
66 false, 66 false,
67 "Use the fixed interface when operating on wav files"); 67 "Use the fixed interface when operating on wav files");
68 DEFINE_int32(aec, 68 DEFINE_int(aec,
69 kParameterNotSpecifiedValue, 69 kParameterNotSpecifiedValue,
70 "Activate (1) or deactivate(0) the echo canceller"); 70 "Activate (1) or deactivate(0) the echo canceller");
71 DEFINE_int32(aecm, 71 DEFINE_int(aecm,
72 kParameterNotSpecifiedValue, 72 kParameterNotSpecifiedValue,
73 "Activate (1) or deactivate(0) the mobile echo controller"); 73 "Activate (1) or deactivate(0) the mobile echo controller");
74 DEFINE_int32(ed, 74 DEFINE_int(ed,
75 kParameterNotSpecifiedValue, 75 kParameterNotSpecifiedValue,
76 "Activate (1) or deactivate (0) the residual echo detector"); 76 "Activate (1) or deactivate (0) the residual echo detector");
77 DEFINE_string(ed_graph, "", "Output filename for graph of echo likelihood"); 77 DEFINE_string(ed_graph, "", "Output filename for graph of echo likelihood");
78 DEFINE_int32(agc, 78 DEFINE_int(agc,
79 kParameterNotSpecifiedValue, 79 kParameterNotSpecifiedValue,
80 "Activate (1) or deactivate(0) the AGC"); 80 "Activate (1) or deactivate(0) the AGC");
81 DEFINE_int32(agc2, 81 DEFINE_int(agc2,
82 kParameterNotSpecifiedValue, 82 kParameterNotSpecifiedValue,
83 "Activate (1) or deactivate(0) the AGC2"); 83 "Activate (1) or deactivate(0) the AGC2");
84 DEFINE_int32(hpf, 84 DEFINE_int(hpf,
85 kParameterNotSpecifiedValue, 85 kParameterNotSpecifiedValue,
86 "Activate (1) or deactivate(0) the high-pass filter"); 86 "Activate (1) or deactivate(0) the high-pass filter");
87 DEFINE_int32(ns, 87 DEFINE_int(ns,
88 kParameterNotSpecifiedValue, 88 kParameterNotSpecifiedValue,
89 "Activate (1) or deactivate(0) the noise suppressor"); 89 "Activate (1) or deactivate(0) the noise suppressor");
90 DEFINE_int32(ts, 90 DEFINE_int(ts,
91 kParameterNotSpecifiedValue, 91 kParameterNotSpecifiedValue,
92 "Activate (1) or deactivate(0) the transient suppressor"); 92 "Activate (1) or deactivate(0) the transient suppressor");
93 DEFINE_int32(bf, 93 DEFINE_int(bf,
94 kParameterNotSpecifiedValue, 94 kParameterNotSpecifiedValue,
95 "Activate (1) or deactivate(0) the beamformer"); 95 "Activate (1) or deactivate(0) the beamformer");
96 DEFINE_int32(ie, 96 DEFINE_int(ie,
97 kParameterNotSpecifiedValue, 97 kParameterNotSpecifiedValue,
98 "Activate (1) or deactivate(0) the intelligibility enhancer"); 98 "Activate (1) or deactivate(0) the intelligibility enhancer");
99 DEFINE_int32(vad, 99 DEFINE_int(vad,
100 kParameterNotSpecifiedValue, 100 kParameterNotSpecifiedValue,
101 "Activate (1) or deactivate(0) the voice activity detector"); 101 "Activate (1) or deactivate(0) the voice activity detector");
102 DEFINE_int32(le, 102 DEFINE_int(le,
103 kParameterNotSpecifiedValue, 103 kParameterNotSpecifiedValue,
104 "Activate (1) or deactivate(0) the level estimator"); 104 "Activate (1) or deactivate(0) the level estimator");
105 DEFINE_bool(all_default, 105 DEFINE_bool(all_default,
106 false, 106 false,
107 "Activate all of the default components (will be overridden by any " 107 "Activate all of the default components (will be overridden by any "
108 "other settings)"); 108 "other settings)");
109 DEFINE_int32(aec_suppression_level, 109 DEFINE_int(aec_suppression_level,
110 kParameterNotSpecifiedValue, 110 kParameterNotSpecifiedValue,
111 "Set the aec suppression level (0-2)"); 111 "Set the aec suppression level (0-2)");
112 DEFINE_int32(delay_agnostic, 112 DEFINE_int(delay_agnostic,
113 kParameterNotSpecifiedValue, 113 kParameterNotSpecifiedValue,
114 "Activate (1) or deactivate(0) the AEC delay agnostic mode"); 114 "Activate (1) or deactivate(0) the AEC delay agnostic mode");
115 DEFINE_int32(extended_filter, 115 DEFINE_int(extended_filter,
116 kParameterNotSpecifiedValue, 116 kParameterNotSpecifiedValue,
117 "Activate (1) or deactivate(0) the AEC extended filter mode"); 117 "Activate (1) or deactivate(0) the AEC extended filter mode");
118 DEFINE_int32(drift_compensation, 118 DEFINE_int(drift_compensation,
119 kParameterNotSpecifiedValue, 119 kParameterNotSpecifiedValue,
120 "Activate (1) or deactivate(0) the drift compensation"); 120 "Activate (1) or deactivate(0) the drift compensation");
121 DEFINE_int32(aec3, 121 DEFINE_int(aec3,
122 kParameterNotSpecifiedValue, 122 kParameterNotSpecifiedValue,
123 "Activate (1) or deactivate(0) the experimental AEC mode AEC3"); 123 "Activate (1) or deactivate(0) the experimental AEC mode AEC3");
124 DEFINE_int32(lc, 124 DEFINE_int(lc,
125 kParameterNotSpecifiedValue, 125 kParameterNotSpecifiedValue,
126 "Activate (1) or deactivate(0) the level control"); 126 "Activate (1) or deactivate(0) the level control");
127 DEFINE_int32(experimental_agc, 127 DEFINE_int(experimental_agc,
128 kParameterNotSpecifiedValue, 128 kParameterNotSpecifiedValue,
129 "Activate (1) or deactivate(0) the experimental AGC"); 129 "Activate (1) or deactivate(0) the experimental AGC");
130 DEFINE_int32( 130 DEFINE_int(
131 refined_adaptive_filter, 131 refined_adaptive_filter,
132 kParameterNotSpecifiedValue, 132 kParameterNotSpecifiedValue,
133 "Activate (1) or deactivate(0) the refined adaptive filter functionality"); 133 "Activate (1) or deactivate(0) the refined adaptive filter functionality");
134 DEFINE_int32(aecm_routing_mode, 134 DEFINE_int(aecm_routing_mode,
135 kParameterNotSpecifiedValue, 135 kParameterNotSpecifiedValue,
136 "Specify the AECM routing mode (0-4)"); 136 "Specify the AECM routing mode (0-4)");
137 DEFINE_int32(aecm_comfort_noise, 137 DEFINE_int(aecm_comfort_noise,
138 kParameterNotSpecifiedValue, 138 kParameterNotSpecifiedValue,
139 "Activate (1) or deactivate(0) the AECM comfort noise"); 139 "Activate (1) or deactivate(0) the AECM comfort noise");
140 DEFINE_int32(agc_mode, 140 DEFINE_int(agc_mode,
141 kParameterNotSpecifiedValue, 141 kParameterNotSpecifiedValue,
142 "Specify the AGC mode (0-2)"); 142 "Specify the AGC mode (0-2)");
143 DEFINE_int32(agc_target_level, 143 DEFINE_int(agc_target_level,
144 kParameterNotSpecifiedValue, 144 kParameterNotSpecifiedValue,
145 "Specify the AGC target level (0-31)"); 145 "Specify the AGC target level (0-31)");
146 DEFINE_int32(agc_limiter, 146 DEFINE_int(agc_limiter,
147 kParameterNotSpecifiedValue, 147 kParameterNotSpecifiedValue,
148 "Activate (1) or deactivate(0) the level estimator"); 148 "Activate (1) or deactivate(0) the level estimator");
149 DEFINE_int32(agc_compression_gain, 149 DEFINE_int(agc_compression_gain,
150 kParameterNotSpecifiedValue, 150 kParameterNotSpecifiedValue,
151 "Specify the AGC compression gain (0-90)"); 151 "Specify the AGC compression gain (0-90)");
152 DEFINE_int32(vad_likelihood, 152 DEFINE_int(vad_likelihood,
153 kParameterNotSpecifiedValue, 153 kParameterNotSpecifiedValue,
154 "Specify the VAD likelihood (0-3)"); 154 "Specify the VAD likelihood (0-3)");
155 DEFINE_int32(ns_level, 155 DEFINE_int(ns_level,
156 kParameterNotSpecifiedValue, 156 kParameterNotSpecifiedValue,
157 "Specify the NS level (0-3)"); 157 "Specify the NS level (0-3)");
158 DEFINE_int32(stream_delay, 158 DEFINE_int(stream_delay,
159 kParameterNotSpecifiedValue, 159 kParameterNotSpecifiedValue,
160 "Specify the stream delay in ms to use"); 160 "Specify the stream delay in ms to use");
161 DEFINE_int32(stream_drift_samples, 161 DEFINE_int(stream_drift_samples,
162 kParameterNotSpecifiedValue, 162 kParameterNotSpecifiedValue,
163 "Specify the number of stream drift samples to use"); 163 "Specify the number of stream drift samples to use");
164 DEFINE_bool(performance_report, false, "Report the APM performance "); 164 DEFINE_bool(performance_report, false, "Report the APM performance ");
165 DEFINE_bool(verbose, false, "Produce verbose output"); 165 DEFINE_bool(verbose, false, "Produce verbose output");
166 DEFINE_bool(bitexactness_report, 166 DEFINE_bool(bitexactness_report,
167 false, 167 false,
168 "Report bitexactness for aec dump result reproduction"); 168 "Report bitexactness for aec dump result reproduction");
169 DEFINE_bool(discard_settings_in_aecdump, 169 DEFINE_bool(discard_settings_in_aecdump,
170 false, 170 false,
171 "Discard any config settings specified in the aec dump"); 171 "Discard any config settings specified in the aec dump");
172 DEFINE_bool(store_intermediate_output, 172 DEFINE_bool(store_intermediate_output,
173 false, 173 false,
174 "Creates new output files after each init"); 174 "Creates new output files after each init");
175 DEFINE_string(custom_call_order_file, "", "Custom process API call order file"); 175 DEFINE_string(custom_call_order_file, "", "Custom process API call order file");
176 DEFINE_bool(help, false, "Print this message");
176 177
177 void SetSettingIfSpecified(const std::string value, 178 void SetSettingIfSpecified(const std::string value,
178 rtc::Optional<std::string>* parameter) { 179 rtc::Optional<std::string>* parameter) {
179 if (value.compare("") != 0) { 180 if (value.compare("") != 0) {
180 *parameter = rtc::Optional<std::string>(value); 181 *parameter = rtc::Optional<std::string>(value);
181 } 182 }
182 } 183 }
183 184
184 void SetSettingIfSpecified(int value, rtc::Optional<int>* parameter) { 185 void SetSettingIfSpecified(int value, rtc::Optional<int>* parameter) {
185 if (value != kParameterNotSpecifiedValue) { 186 if (value != kParameterNotSpecifiedValue) {
186 *parameter = rtc::Optional<int>(value); 187 *parameter = rtc::Optional<int>(value);
187 } 188 }
188 } 189 }
189 190
190 void SetSettingIfFlagSet(int32_t flag, rtc::Optional<bool>* parameter) { 191 void SetSettingIfFlagSet(int32_t flag, rtc::Optional<bool>* parameter) {
191 if (flag == 0) { 192 if (flag == 0) {
192 *parameter = rtc::Optional<bool>(false); 193 *parameter = rtc::Optional<bool>(false);
193 } else if (flag == 1) { 194 } else if (flag == 1) {
194 *parameter = rtc::Optional<bool>(true); 195 *parameter = rtc::Optional<bool>(true);
195 } 196 }
196 } 197 }
197 198
198 SimulationSettings CreateSettings() { 199 SimulationSettings CreateSettings() {
199 SimulationSettings settings; 200 SimulationSettings settings;
200 if (FLAGS_all_default) { 201 if (FLAG_all_default) {
201 settings.use_le = rtc::Optional<bool>(true); 202 settings.use_le = rtc::Optional<bool>(true);
202 settings.use_vad = rtc::Optional<bool>(true); 203 settings.use_vad = rtc::Optional<bool>(true);
203 settings.use_ie = rtc::Optional<bool>(false); 204 settings.use_ie = rtc::Optional<bool>(false);
204 settings.use_bf = rtc::Optional<bool>(false); 205 settings.use_bf = rtc::Optional<bool>(false);
205 settings.use_ts = rtc::Optional<bool>(true); 206 settings.use_ts = rtc::Optional<bool>(true);
206 settings.use_ns = rtc::Optional<bool>(true); 207 settings.use_ns = rtc::Optional<bool>(true);
207 settings.use_hpf = rtc::Optional<bool>(true); 208 settings.use_hpf = rtc::Optional<bool>(true);
208 settings.use_agc = rtc::Optional<bool>(true); 209 settings.use_agc = rtc::Optional<bool>(true);
209 settings.use_aec = rtc::Optional<bool>(true); 210 settings.use_aec = rtc::Optional<bool>(true);
210 settings.use_aecm = rtc::Optional<bool>(false); 211 settings.use_aecm = rtc::Optional<bool>(false);
211 settings.use_ed = rtc::Optional<bool>(false); 212 settings.use_ed = rtc::Optional<bool>(false);
212 } 213 }
213 SetSettingIfSpecified(FLAGS_dump_input, &settings.aec_dump_input_filename); 214 SetSettingIfSpecified(FLAG_dump_input, &settings.aec_dump_input_filename);
214 SetSettingIfSpecified(FLAGS_dump_output, &settings.aec_dump_output_filename); 215 SetSettingIfSpecified(FLAG_dump_output, &settings.aec_dump_output_filename);
215 SetSettingIfSpecified(FLAGS_i, &settings.input_filename); 216 SetSettingIfSpecified(FLAG_i, &settings.input_filename);
216 SetSettingIfSpecified(FLAGS_o, &settings.output_filename); 217 SetSettingIfSpecified(FLAG_o, &settings.output_filename);
217 SetSettingIfSpecified(FLAGS_ri, &settings.reverse_input_filename); 218 SetSettingIfSpecified(FLAG_ri, &settings.reverse_input_filename);
218 SetSettingIfSpecified(FLAGS_ro, &settings.reverse_output_filename); 219 SetSettingIfSpecified(FLAG_ro, &settings.reverse_output_filename);
219 SetSettingIfSpecified(FLAGS_artificial_nearend, 220 SetSettingIfSpecified(FLAG_artificial_nearend,
220 &settings.artificial_nearend_filename); 221 &settings.artificial_nearend_filename);
221 SetSettingIfSpecified(FLAGS_output_num_channels, 222 SetSettingIfSpecified(FLAG_output_num_channels,
222 &settings.output_num_channels); 223 &settings.output_num_channels);
223 SetSettingIfSpecified(FLAGS_reverse_output_num_channels, 224 SetSettingIfSpecified(FLAG_reverse_output_num_channels,
224 &settings.reverse_output_num_channels); 225 &settings.reverse_output_num_channels);
225 SetSettingIfSpecified(FLAGS_output_sample_rate_hz, 226 SetSettingIfSpecified(FLAG_output_sample_rate_hz,
226 &settings.output_sample_rate_hz); 227 &settings.output_sample_rate_hz);
227 SetSettingIfSpecified(FLAGS_reverse_output_sample_rate_hz, 228 SetSettingIfSpecified(FLAG_reverse_output_sample_rate_hz,
228 &settings.reverse_output_sample_rate_hz); 229 &settings.reverse_output_sample_rate_hz);
229 SetSettingIfSpecified(FLAGS_mic_positions, &settings.microphone_positions); 230 SetSettingIfSpecified(FLAG_mic_positions, &settings.microphone_positions);
230 settings.target_angle_degrees = FLAGS_target_angle_degrees; 231 settings.target_angle_degrees = FLAG_target_angle_degrees;
231 SetSettingIfFlagSet(FLAGS_aec, &settings.use_aec); 232 SetSettingIfFlagSet(FLAG_aec, &settings.use_aec);
232 SetSettingIfFlagSet(FLAGS_aecm, &settings.use_aecm); 233 SetSettingIfFlagSet(FLAG_aecm, &settings.use_aecm);
233 SetSettingIfFlagSet(FLAGS_ed, &settings.use_ed); 234 SetSettingIfFlagSet(FLAG_ed, &settings.use_ed);
234 SetSettingIfSpecified(FLAGS_ed_graph, &settings.ed_graph_output_filename); 235 SetSettingIfSpecified(FLAG_ed_graph, &settings.ed_graph_output_filename);
235 SetSettingIfFlagSet(FLAGS_agc, &settings.use_agc); 236 SetSettingIfFlagSet(FLAG_agc, &settings.use_agc);
236 SetSettingIfFlagSet(FLAGS_agc2, &settings.use_agc2); 237 SetSettingIfFlagSet(FLAG_agc2, &settings.use_agc2);
237 SetSettingIfFlagSet(FLAGS_hpf, &settings.use_hpf); 238 SetSettingIfFlagSet(FLAG_hpf, &settings.use_hpf);
238 SetSettingIfFlagSet(FLAGS_ns, &settings.use_ns); 239 SetSettingIfFlagSet(FLAG_ns, &settings.use_ns);
239 SetSettingIfFlagSet(FLAGS_ts, &settings.use_ts); 240 SetSettingIfFlagSet(FLAG_ts, &settings.use_ts);
240 SetSettingIfFlagSet(FLAGS_bf, &settings.use_bf); 241 SetSettingIfFlagSet(FLAG_bf, &settings.use_bf);
241 SetSettingIfFlagSet(FLAGS_ie, &settings.use_ie); 242 SetSettingIfFlagSet(FLAG_ie, &settings.use_ie);
242 SetSettingIfFlagSet(FLAGS_vad, &settings.use_vad); 243 SetSettingIfFlagSet(FLAG_vad, &settings.use_vad);
243 SetSettingIfFlagSet(FLAGS_le, &settings.use_le); 244 SetSettingIfFlagSet(FLAG_le, &settings.use_le);
244 SetSettingIfSpecified(FLAGS_aec_suppression_level, 245 SetSettingIfSpecified(FLAG_aec_suppression_level,
245 &settings.aec_suppression_level); 246 &settings.aec_suppression_level);
246 SetSettingIfFlagSet(FLAGS_delay_agnostic, &settings.use_delay_agnostic); 247 SetSettingIfFlagSet(FLAG_delay_agnostic, &settings.use_delay_agnostic);
247 SetSettingIfFlagSet(FLAGS_extended_filter, &settings.use_extended_filter); 248 SetSettingIfFlagSet(FLAG_extended_filter, &settings.use_extended_filter);
248 SetSettingIfFlagSet(FLAGS_drift_compensation, 249 SetSettingIfFlagSet(FLAG_drift_compensation,
249 &settings.use_drift_compensation); 250 &settings.use_drift_compensation);
250 SetSettingIfFlagSet(FLAGS_refined_adaptive_filter, 251 SetSettingIfFlagSet(FLAG_refined_adaptive_filter,
251 &settings.use_refined_adaptive_filter); 252 &settings.use_refined_adaptive_filter);
252 253
253 SetSettingIfFlagSet(FLAGS_aec3, &settings.use_aec3); 254 SetSettingIfFlagSet(FLAG_aec3, &settings.use_aec3);
254 SetSettingIfFlagSet(FLAGS_lc, &settings.use_lc); 255 SetSettingIfFlagSet(FLAG_lc, &settings.use_lc);
255 SetSettingIfFlagSet(FLAGS_experimental_agc, &settings.use_experimental_agc); 256 SetSettingIfFlagSet(FLAG_experimental_agc, &settings.use_experimental_agc);
256 SetSettingIfSpecified(FLAGS_aecm_routing_mode, &settings.aecm_routing_mode); 257 SetSettingIfSpecified(FLAG_aecm_routing_mode, &settings.aecm_routing_mode);
257 SetSettingIfFlagSet(FLAGS_aecm_comfort_noise, 258 SetSettingIfFlagSet(FLAG_aecm_comfort_noise,
258 &settings.use_aecm_comfort_noise); 259 &settings.use_aecm_comfort_noise);
259 SetSettingIfSpecified(FLAGS_agc_mode, &settings.agc_mode); 260 SetSettingIfSpecified(FLAG_agc_mode, &settings.agc_mode);
260 SetSettingIfSpecified(FLAGS_agc_target_level, &settings.agc_target_level); 261 SetSettingIfSpecified(FLAG_agc_target_level, &settings.agc_target_level);
261 SetSettingIfFlagSet(FLAGS_agc_limiter, &settings.use_agc_limiter); 262 SetSettingIfFlagSet(FLAG_agc_limiter, &settings.use_agc_limiter);
262 SetSettingIfSpecified(FLAGS_agc_compression_gain, 263 SetSettingIfSpecified(FLAG_agc_compression_gain,
263 &settings.agc_compression_gain); 264 &settings.agc_compression_gain);
264 SetSettingIfSpecified(FLAGS_vad_likelihood, &settings.vad_likelihood); 265 SetSettingIfSpecified(FLAG_vad_likelihood, &settings.vad_likelihood);
265 SetSettingIfSpecified(FLAGS_ns_level, &settings.ns_level); 266 SetSettingIfSpecified(FLAG_ns_level, &settings.ns_level);
266 SetSettingIfSpecified(FLAGS_stream_delay, &settings.stream_delay); 267 SetSettingIfSpecified(FLAG_stream_delay, &settings.stream_delay);
267 SetSettingIfSpecified(FLAGS_stream_drift_samples, 268 SetSettingIfSpecified(FLAG_stream_drift_samples,
268 &settings.stream_drift_samples); 269 &settings.stream_drift_samples);
269 SetSettingIfSpecified(FLAGS_custom_call_order_file, 270 SetSettingIfSpecified(FLAG_custom_call_order_file,
270 &settings.custom_call_order_filename); 271 &settings.custom_call_order_filename);
271 settings.report_performance = FLAGS_performance_report; 272 settings.report_performance = FLAG_performance_report;
272 settings.use_verbose_logging = FLAGS_verbose; 273 settings.use_verbose_logging = FLAG_verbose;
273 settings.report_bitexactness = FLAGS_bitexactness_report; 274 settings.report_bitexactness = FLAG_bitexactness_report;
274 settings.discard_all_settings_in_aecdump = FLAGS_discard_settings_in_aecdump; 275 settings.discard_all_settings_in_aecdump = FLAG_discard_settings_in_aecdump;
275 settings.fixed_interface = FLAGS_fixed_interface; 276 settings.fixed_interface = FLAG_fixed_interface;
276 settings.store_intermediate_output = FLAGS_store_intermediate_output; 277 settings.store_intermediate_output = FLAG_store_intermediate_output;
277 278
278 return settings; 279 return settings;
279 } 280 }
280 281
281 void ReportConditionalErrorAndExit(bool condition, std::string message) { 282 void ReportConditionalErrorAndExit(bool condition, std::string message) {
282 if (condition) { 283 if (condition) {
283 std::cerr << message << std::endl; 284 std::cerr << message << std::endl;
284 exit(1); 285 exit(1);
285 } 286 }
286 } 287 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 416
416 ReportConditionalErrorAndExit( 417 ReportConditionalErrorAndExit(
417 settings.artificial_nearend_filename && 418 settings.artificial_nearend_filename &&
418 !valid_wav_name(*settings.artificial_nearend_filename), 419 !valid_wav_name(*settings.artificial_nearend_filename),
419 "Error: --artifical_nearend must be a valid .wav file name.\n"); 420 "Error: --artifical_nearend must be a valid .wav file name.\n");
420 } 421 }
421 422
422 } // namespace 423 } // namespace
423 424
424 int main(int argc, char* argv[]) { 425 int main(int argc, char* argv[]) {
425 google::SetUsageMessage(kUsageDescription); 426 if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) ||
426 google::ParseCommandLineFlags(&argc, &argv, true); 427 FLAG_help || argc != 1) {
428 printf("%s", kUsageDescription);
429 if (FLAG_help) {
430 rtc::FlagList::Print(nullptr, false);
431 return 0;
432 }
433 return 1;
434 }
427 435
428 SimulationSettings settings = CreateSettings(); 436 SimulationSettings settings = CreateSettings();
429 PerformBasicParameterSanityChecks(settings); 437 PerformBasicParameterSanityChecks(settings);
430 std::unique_ptr<AudioProcessingSimulator> processor; 438 std::unique_ptr<AudioProcessingSimulator> processor;
431 439
432 if (settings.aec_dump_input_filename) { 440 if (settings.aec_dump_input_filename) {
433 processor.reset(new AecDumpBasedSimulator(settings)); 441 processor.reset(new AecDumpBasedSimulator(settings));
434 } else { 442 } else {
435 processor.reset(new WavBasedSimulator(settings)); 443 processor.reset(new WavBasedSimulator(settings));
436 } 444 }
(...skipping 25 matching lines...) Expand all
462 470
463 return 0; 471 return 0;
464 } 472 }
465 473
466 } // namespace test 474 } // namespace test
467 } // namespace webrtc 475 } // namespace webrtc
468 476
469 int main(int argc, char* argv[]) { 477 int main(int argc, char* argv[]) {
470 return webrtc::test::main(argc, argv); 478 return webrtc::test::main(argc, argv);
471 } 479 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698