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

Side by Side Diff: webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_test.cc

Issue 1316523002: Convert channel counts to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Fix compile Created 4 years, 11 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 <vector> 11 #include <vector>
12 12
13 #include "gflags/gflags.h" 13 #include "gflags/gflags.h"
14 #include "webrtc/base/checks.h" 14 #include "webrtc/base/checks.h"
15 #include "webrtc/base/format_macros.h"
15 #include "webrtc/common_audio/channel_buffer.h" 16 #include "webrtc/common_audio/channel_buffer.h"
16 #include "webrtc/common_audio/wav_file.h" 17 #include "webrtc/common_audio/wav_file.h"
17 #include "webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h" 18 #include "webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h"
18 #include "webrtc/modules/audio_processing/test/test_utils.h" 19 #include "webrtc/modules/audio_processing/test/test_utils.h"
19 20
20 DEFINE_string(i, "", "The name of the input file to read from."); 21 DEFINE_string(i, "", "The name of the input file to read from.");
21 DEFINE_string(o, "out.wav", "Name of the output file to write to."); 22 DEFINE_string(o, "out.wav", "Name of the output file to write to.");
22 DEFINE_string(mic_positions, "", 23 DEFINE_string(mic_positions, "",
23 "Space delimited cartesian coordinates of microphones in meters. " 24 "Space delimited cartesian coordinates of microphones in meters. "
24 "The coordinates of each point are contiguous. " 25 "The coordinates of each point are contiguous. "
(...skipping 20 matching lines...) Expand all
45 WavWriter out_file(FLAGS_o, in_file.sample_rate(), 1); 46 WavWriter out_file(FLAGS_o, in_file.sample_rate(), 1);
46 47
47 const size_t num_mics = in_file.num_channels(); 48 const size_t num_mics = in_file.num_channels();
48 const std::vector<Point> array_geometry = 49 const std::vector<Point> array_geometry =
49 ParseArrayGeometry(FLAGS_mic_positions, num_mics); 50 ParseArrayGeometry(FLAGS_mic_positions, num_mics);
50 RTC_CHECK_EQ(array_geometry.size(), num_mics); 51 RTC_CHECK_EQ(array_geometry.size(), num_mics);
51 52
52 NonlinearBeamformer bf(array_geometry); 53 NonlinearBeamformer bf(array_geometry);
53 bf.Initialize(kChunkSizeMs, in_file.sample_rate()); 54 bf.Initialize(kChunkSizeMs, in_file.sample_rate());
54 55
55 printf("Input file: %s\nChannels: %d, Sample rate: %d Hz\n\n", 56 printf("Input file: %s\nChannels: %" PRIuS ", Sample rate: %d Hz\n\n",
56 FLAGS_i.c_str(), in_file.num_channels(), in_file.sample_rate()); 57 FLAGS_i.c_str(), in_file.num_channels(), in_file.sample_rate());
57 printf("Output file: %s\nChannels: %d, Sample rate: %d Hz\n\n", 58 printf("Output file: %s\nChannels: %" PRIuS ", Sample rate: %d Hz\n\n",
58 FLAGS_o.c_str(), out_file.num_channels(), out_file.sample_rate()); 59 FLAGS_o.c_str(), out_file.num_channels(), out_file.sample_rate());
59 60
60 ChannelBuffer<float> in_buf( 61 ChannelBuffer<float> in_buf(
61 rtc::CheckedDivExact(in_file.sample_rate(), kChunksPerSecond), 62 rtc::CheckedDivExact(in_file.sample_rate(), kChunksPerSecond),
62 in_file.num_channels()); 63 in_file.num_channels());
63 ChannelBuffer<float> out_buf( 64 ChannelBuffer<float> out_buf(
64 rtc::CheckedDivExact(out_file.sample_rate(), kChunksPerSecond), 65 rtc::CheckedDivExact(out_file.sample_rate(), kChunksPerSecond),
65 out_file.num_channels()); 66 out_file.num_channels());
66 67
67 std::vector<float> interleaved(in_buf.size()); 68 std::vector<float> interleaved(in_buf.size());
(...skipping 12 matching lines...) Expand all
80 } 81 }
81 82
82 return 0; 83 return 0;
83 } 84 }
84 85
85 } // namespace webrtc 86 } // namespace webrtc
86 87
87 int main(int argc, char* argv[]) { 88 int main(int argc, char* argv[]) {
88 return webrtc::main(argc, argv); 89 return webrtc::main(argc, argv);
89 } 90 }
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc ('k') | webrtc/modules/audio_processing/common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698