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

Side by Side Diff: webrtc/modules/audio_processing/test/audioproc_float.cc

Issue 1228913003: Remove empty-string comparisons. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 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
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 "\n" 57 "\n"
58 "All components are disabled by default. If any bi-directional components\n" 58 "All components are disabled by default. If any bi-directional components\n"
59 "are enabled, only debug dump files are permitted."; 59 "are enabled, only debug dump files are permitted.";
60 60
61 } // namespace 61 } // namespace
62 62
63 int main(int argc, char* argv[]) { 63 int main(int argc, char* argv[]) {
64 google::SetUsageMessage(kUsage); 64 google::SetUsageMessage(kUsage);
65 google::ParseCommandLineFlags(&argc, &argv, true); 65 google::ParseCommandLineFlags(&argc, &argv, true);
66 66
67 if (!((FLAGS_i == "") ^ (FLAGS_dump == ""))) { 67 if (!((FLAGS_i.empty()) ^ (FLAGS_dump.empty()))) {
68 fprintf(stderr, 68 fprintf(stderr,
69 "An input file must be specified with either -i or -dump.\n"); 69 "An input file must be specified with either -i or -dump.\n");
70 return 1; 70 return 1;
71 } 71 }
72 if (FLAGS_dump != "") { 72 if (!FLAGS_dump.empty()) {
73 fprintf(stderr, "FIXME: the -dump option is not yet implemented.\n"); 73 fprintf(stderr, "FIXME: the -dump option is not yet implemented.\n");
74 return 1; 74 return 1;
75 } 75 }
76 76
77 test::TraceToStderr trace_to_stderr(true); 77 test::TraceToStderr trace_to_stderr(true);
78 WavReader in_file(FLAGS_i); 78 WavReader in_file(FLAGS_i);
79 // If the output format is uninitialized, use the input format. 79 // If the output format is uninitialized, use the input format.
80 const int out_channels = 80 const int out_channels =
81 FLAGS_out_channels ? FLAGS_out_channels : in_file.num_channels(); 81 FLAGS_out_channels ? FLAGS_out_channels : in_file.num_channels();
82 const int out_sample_rate = 82 const int out_sample_rate =
83 FLAGS_out_sample_rate ? FLAGS_out_sample_rate : in_file.sample_rate(); 83 FLAGS_out_sample_rate ? FLAGS_out_sample_rate : in_file.sample_rate();
84 WavWriter out_file(FLAGS_o, out_sample_rate, out_channels); 84 WavWriter out_file(FLAGS_o, out_sample_rate, out_channels);
85 85
86 Config config; 86 Config config;
87 config.Set<ExperimentalNs>(new ExperimentalNs(FLAGS_ts || FLAGS_all)); 87 config.Set<ExperimentalNs>(new ExperimentalNs(FLAGS_ts || FLAGS_all));
88 88
89 if (FLAGS_bf || FLAGS_all) { 89 if (FLAGS_bf || FLAGS_all) {
90 const size_t num_mics = in_file.num_channels(); 90 const size_t num_mics = in_file.num_channels();
91 const std::vector<Point> array_geometry = 91 const std::vector<Point> array_geometry =
92 ParseArrayGeometry(FLAGS_mic_positions, num_mics); 92 ParseArrayGeometry(FLAGS_mic_positions, num_mics);
93 CHECK_EQ(array_geometry.size(), num_mics); 93 CHECK_EQ(array_geometry.size(), num_mics);
94 94
95 config.Set<Beamforming>(new Beamforming(true, array_geometry)); 95 config.Set<Beamforming>(new Beamforming(true, array_geometry));
96 } 96 }
97 97
98 rtc::scoped_ptr<AudioProcessing> ap(AudioProcessing::Create(config)); 98 rtc::scoped_ptr<AudioProcessing> ap(AudioProcessing::Create(config));
99 if (FLAGS_dump != "") { 99 if (!FLAGS_dump.empty()) {
100 CHECK_EQ(kNoErr, ap->echo_cancellation()->Enable(FLAGS_aec || FLAGS_all)); 100 CHECK_EQ(kNoErr, ap->echo_cancellation()->Enable(FLAGS_aec || FLAGS_all));
101 } else if (FLAGS_aec) { 101 } else if (FLAGS_aec) {
102 fprintf(stderr, "-aec requires a -dump file.\n"); 102 fprintf(stderr, "-aec requires a -dump file.\n");
103 return -1; 103 return -1;
104 } 104 }
105 CHECK_EQ(kNoErr, ap->gain_control()->Enable(FLAGS_agc || FLAGS_all)); 105 CHECK_EQ(kNoErr, ap->gain_control()->Enable(FLAGS_agc || FLAGS_all));
106 CHECK_EQ(kNoErr, ap->gain_control()->set_mode(GainControl::kFixedDigital)); 106 CHECK_EQ(kNoErr, ap->gain_control()->set_mode(GainControl::kFixedDigital));
107 CHECK_EQ(kNoErr, ap->high_pass_filter()->Enable(FLAGS_hpf || FLAGS_all)); 107 CHECK_EQ(kNoErr, ap->high_pass_filter()->Enable(FLAGS_hpf || FLAGS_all));
108 CHECK_EQ(kNoErr, ap->noise_suppression()->Enable(FLAGS_ns || FLAGS_all)); 108 CHECK_EQ(kNoErr, ap->noise_suppression()->Enable(FLAGS_ns || FLAGS_all));
109 if (FLAGS_ns_level != -1) 109 if (FLAGS_ns_level != -1)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 execution_time_ms * 1.f / num_chunks); 166 execution_time_ms * 1.f / num_chunks);
167 } 167 }
168 return 0; 168 return 0;
169 } 169 }
170 170
171 } // namespace webrtc 171 } // namespace webrtc
172 172
173 int main(int argc, char* argv[]) { 173 int main(int argc, char* argv[]) {
174 return webrtc::main(argc, argv); 174 return webrtc::main(argc, argv);
175 } 175 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698