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

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

Issue 1800413002: Add IntelligibilityEnhancer support to audioproc_float (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@reverse
Patch Set: Rebasing Created 4 years, 8 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
« no previous file with comments | « webrtc/modules/audio_processing/test/audio_file_processor.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 24 matching lines...) Expand all
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 38
39 DEFINE_string(dump, "", "Name of the aecdump debug file to read from."); 39 DEFINE_string(dump, "", "Name of the aecdump debug file to read from.");
40 DEFINE_string(i, "", "Name of the capture input stream file to read from."); 40 DEFINE_string(i, "", "Name of the capture input stream file to read from.");
41 DEFINE_string( 41 DEFINE_string(
42 o, 42 o,
43 "out.wav", 43 "out.wav",
44 "Name of the output file to write the processed capture stream to."); 44 "Name of the output file to write the processed capture stream to.");
45 DEFINE_string(ri, "", "Name of the render input stream file to read from.");
46 DEFINE_string(
47 ro,
48 "out_reverse.wav",
49 "Name of the output file to write the processed render stream to.");
45 DEFINE_int32(out_channels, 1, "Number of output channels."); 50 DEFINE_int32(out_channels, 1, "Number of output channels.");
46 const bool out_channels_dummy = 51 const bool out_channels_dummy =
47 google::RegisterFlagValidator(&FLAGS_out_channels, &ValidateOutChannels); 52 google::RegisterFlagValidator(&FLAGS_out_channels, &ValidateOutChannels);
53 DEFINE_int32(rev_out_channels, 1, "Number of reverse output channels.");
54 const bool rev_out_channels_dummy =
55 google::RegisterFlagValidator(&FLAGS_rev_out_channels,
56 &ValidateOutChannels);
48 DEFINE_int32(out_sample_rate, 48000, "Output sample rate in Hz."); 57 DEFINE_int32(out_sample_rate, 48000, "Output sample rate in Hz.");
58 DEFINE_int32(rev_out_sample_rate, 48000, "Reverse output sample rate in Hz.");
49 DEFINE_string(mic_positions, "", 59 DEFINE_string(mic_positions, "",
50 "Space delimited cartesian coordinates of microphones in meters. " 60 "Space delimited cartesian coordinates of microphones in meters. "
51 "The coordinates of each point are contiguous. " 61 "The coordinates of each point are contiguous. "
52 "For a two element array: \"x1 y1 z1 x2 y2 z2\""); 62 "For a two element array: \"x1 y1 z1 x2 y2 z2\"");
53 DEFINE_double( 63 DEFINE_double(
54 target_angle_degrees, 64 target_angle_degrees,
55 90, 65 90,
56 "The azimuth of the target in degrees. Only applies to beamforming."); 66 "The azimuth of the target in degrees. Only applies to beamforming.");
57 67
58 DEFINE_bool(aec, false, "Enable echo cancellation."); 68 DEFINE_bool(aec, false, "Enable echo cancellation.");
(...skipping 11 matching lines...) Expand all
70 80
71 namespace webrtc { 81 namespace webrtc {
72 namespace { 82 namespace {
73 83
74 const int kChunksPerSecond = 100; 84 const int kChunksPerSecond = 100;
75 const char kUsage[] = 85 const char kUsage[] =
76 "Command-line tool to run audio processing on WAV files. Accepts either\n" 86 "Command-line tool to run audio processing on WAV files. Accepts either\n"
77 "an input capture WAV file or protobuf debug dump and writes to an output\n" 87 "an input capture WAV file or protobuf debug dump and writes to an output\n"
78 "WAV file.\n" 88 "WAV file.\n"
79 "\n" 89 "\n"
80 "All components are disabled by default. If any bi-directional components\n" 90 "All components are disabled by default.";
81 "are enabled, only debug dump files are permitted.";
82 91
83 } // namespace 92 } // namespace
84 93
85 int main(int argc, char* argv[]) { 94 int main(int argc, char* argv[]) {
86 google::SetUsageMessage(kUsage); 95 google::SetUsageMessage(kUsage);
87 google::ParseCommandLineFlags(&argc, &argv, true); 96 google::ParseCommandLineFlags(&argc, &argv, true);
88 97
89 if (!((FLAGS_i.empty()) ^ (FLAGS_dump.empty()))) { 98 if (!((FLAGS_i.empty()) ^ (FLAGS_dump.empty()))) {
90 fprintf(stderr, 99 fprintf(stderr,
91 "An input file must be specified with either -i or -dump.\n"); 100 "An input file must be specified with either -i or -dump.\n");
92 return 1; 101 return 1;
93 } 102 }
94 if (FLAGS_dump.empty() && (FLAGS_aec || FLAGS_ie)) {
95 fprintf(stderr, "-aec and -ie require a -dump file.\n");
96 return 1;
97 }
98 if (FLAGS_ie) {
99 fprintf(stderr,
100 "FIXME(ajm): The intelligibility enhancer output is not dumped.\n");
101 return 1;
102 }
103 103
104 test::TraceToStderr trace_to_stderr(true); 104 test::TraceToStderr trace_to_stderr(true);
105 Config config; 105 Config config;
106 if (FLAGS_bf || FLAGS_all) { 106 if (FLAGS_bf || FLAGS_all) {
107 if (FLAGS_mic_positions.empty()) { 107 if (FLAGS_mic_positions.empty()) {
108 fprintf(stderr, "-mic_positions must be specified when -bf is used.\n"); 108 fprintf(stderr, "-mic_positions must be specified when -bf is used.\n");
109 return 1; 109 return 1;
110 } 110 }
111 config.Set<Beamforming>(new Beamforming( 111 config.Set<Beamforming>(new Beamforming(
112 true, ParseArrayGeometry(FLAGS_mic_positions), 112 true, ParseArrayGeometry(FLAGS_mic_positions),
(...skipping 15 matching lines...) Expand all
128 } 128 }
129 ap->set_stream_key_pressed(FLAGS_ts); 129 ap->set_stream_key_pressed(FLAGS_ts);
130 130
131 std::unique_ptr<AudioFileProcessor> processor; 131 std::unique_ptr<AudioFileProcessor> processor;
132 auto out_file = std::unique_ptr<WavWriter>(new WavWriter( 132 auto out_file = std::unique_ptr<WavWriter>(new WavWriter(
133 FLAGS_o, FLAGS_out_sample_rate, static_cast<size_t>(FLAGS_out_channels))); 133 FLAGS_o, FLAGS_out_sample_rate, static_cast<size_t>(FLAGS_out_channels)));
134 std::cout << FLAGS_o << ": " << out_file->FormatAsString() << std::endl; 134 std::cout << FLAGS_o << ": " << out_file->FormatAsString() << std::endl;
135 if (FLAGS_dump.empty()) { 135 if (FLAGS_dump.empty()) {
136 auto in_file = std::unique_ptr<WavReader>(new WavReader(FLAGS_i)); 136 auto in_file = std::unique_ptr<WavReader>(new WavReader(FLAGS_i));
137 std::cout << FLAGS_i << ": " << in_file->FormatAsString() << std::endl; 137 std::cout << FLAGS_i << ": " << in_file->FormatAsString() << std::endl;
138 processor.reset(new WavFileProcessor(std::move(ap), std::move(in_file), 138 std::unique_ptr<WavReader> reverse_in_file;
139 std::move(out_file))); 139 std::unique_ptr<WavWriter> reverse_out_file;
140 if (!FLAGS_ri.empty()) {
141 reverse_in_file.reset(new WavReader(FLAGS_ri));
142 reverse_out_file.reset(new WavWriter(
143 FLAGS_ro,
144 FLAGS_rev_out_sample_rate,
145 static_cast<size_t>(FLAGS_rev_out_channels)));
146 std::cout << FLAGS_ri << ": "
147 << reverse_in_file->FormatAsString() << std::endl;
148 std::cout << FLAGS_ro << ": "
149 << reverse_out_file->FormatAsString() << std::endl;
150 }
151 processor.reset(new WavFileProcessor(std::move(ap),
152 std::move(in_file),
153 std::move(out_file),
154 std::move(reverse_in_file),
155 std::move(reverse_out_file)));
140 156
141 } else { 157 } else {
142 processor.reset(new AecDumpFileProcessor( 158 processor.reset(new AecDumpFileProcessor(
143 std::move(ap), fopen(FLAGS_dump.c_str(), "rb"), std::move(out_file))); 159 std::move(ap), fopen(FLAGS_dump.c_str(), "rb"), std::move(out_file)));
144 } 160 }
145 161
146 int num_chunks = 0; 162 int num_chunks = 0;
147 while (processor->ProcessChunk()) { 163 while (processor->ProcessChunk()) {
148 trace_to_stderr.SetTimeSeconds(num_chunks * 1.f / kChunksPerSecond); 164 trace_to_stderr.SetTimeSeconds(num_chunks * 1.f / kChunksPerSecond);
149 ++num_chunks; 165 ++num_chunks;
(...skipping 11 matching lines...) Expand all
161 } 177 }
162 178
163 return 0; 179 return 0;
164 } 180 }
165 181
166 } // namespace webrtc 182 } // namespace webrtc
167 183
168 int main(int argc, char* argv[]) { 184 int main(int argc, char* argv[]) {
169 return webrtc::main(argc, argv); 185 return webrtc::main(argc, argv);
170 } 186 }
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/test/audio_file_processor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698