OLD | NEW |
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 WavReader noise_file(FLAGS_noise_file); | 105 WavReader noise_file(FLAGS_noise_file); |
106 std::vector<float> noise_fpcm(samples); | 106 std::vector<float> noise_fpcm(samples); |
107 noise_file.ReadSamples(samples, &noise_fpcm[0]); | 107 noise_file.ReadSamples(samples, &noise_fpcm[0]); |
108 | 108 |
109 // Run intelligibility enhancement. | 109 // Run intelligibility enhancement. |
110 IntelligibilityEnhancer::Config config; | 110 IntelligibilityEnhancer::Config config; |
111 config.sample_rate_hz = FLAGS_sample_rate; | 111 config.sample_rate_hz = FLAGS_sample_rate; |
112 config.var_type = static_cast<VarianceArray::StepType>(FLAGS_clear_type); | 112 config.var_type = static_cast<VarianceArray::StepType>(FLAGS_clear_type); |
113 config.var_decay_rate = static_cast<float>(FLAGS_clear_alpha); | 113 config.var_decay_rate = static_cast<float>(FLAGS_clear_alpha); |
114 config.var_window_size = FLAGS_clear_window; | 114 config.var_window_size = static_cast<size_t>(FLAGS_clear_window); |
115 config.analysis_rate = FLAGS_ana_rate; | 115 config.analysis_rate = FLAGS_ana_rate; |
116 config.gain_change_limit = FLAGS_gain_limit; | 116 config.gain_change_limit = FLAGS_gain_limit; |
117 IntelligibilityEnhancer enh(config); | 117 IntelligibilityEnhancer enh(config); |
118 | 118 |
119 // Slice the input into smaller chunks, as the APM would do, and feed them | 119 // Slice the input into smaller chunks, as the APM would do, and feed them |
120 // through the enhancer. | 120 // through the enhancer. |
121 float* clear_cursor = &in_fpcm[0]; | 121 float* clear_cursor = &in_fpcm[0]; |
122 float* noise_cursor = &noise_fpcm[0]; | 122 float* noise_cursor = &noise_fpcm[0]; |
123 | 123 |
124 for (size_t i = 0; i < samples; i += fragment_size) { | 124 for (size_t i = 0; i < samples; i += fragment_size) { |
(...skipping 18 matching lines...) Expand all Loading... |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 } // namespace | 146 } // namespace |
147 } // namespace webrtc | 147 } // namespace webrtc |
148 | 148 |
149 int main(int argc, char* argv[]) { | 149 int main(int argc, char* argv[]) { |
150 webrtc::void_main(argc, argv); | 150 webrtc::void_main(argc, argv); |
151 return 0; | 151 return 0; |
152 } | 152 } |
OLD | NEW |