| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 "This application loads the signal from the in_file_name with a specific\n" | 64 "This application loads the signal from the in_file_name with a specific\n" |
| 65 "num_channels and sample_rate_hz, the detection signal from the\n" | 65 "num_channels and sample_rate_hz, the detection signal from the\n" |
| 66 "detection_file_name with a specific detection_rate_hz, and the reference\n" | 66 "detection_file_name with a specific detection_rate_hz, and the reference\n" |
| 67 "signal from the reference_file_name with sample_rate_hz, divides them\n" | 67 "signal from the reference_file_name with sample_rate_hz, divides them\n" |
| 68 "into chunk_size_ms blocks, computes its voice value and depending on the\n" | 68 "into chunk_size_ms blocks, computes its voice value and depending on the\n" |
| 69 "voice_threshold does the respective restoration. You can always get the\n" | 69 "voice_threshold does the respective restoration. You can always get the\n" |
| 70 "all-voiced or all-unvoiced cases by setting the voice_threshold to 0 or\n" | 70 "all-voiced or all-unvoiced cases by setting the voice_threshold to 0 or\n" |
| 71 "1 respectively.\n\n"; | 71 "1 respectively.\n\n"; |
| 72 | 72 |
| 73 // Read next buffers from the test files (signed 16-bit host-endian PCM | 73 // Read next buffers from the test files (signed 16-bit host-endian PCM |
| 74 // format). audio_buffer has int16 samples, detection_buffer has float samples | 74 // format). audio_buffer has int16_t samples, detection_buffer has float samples |
| 75 // with range [-32768,32767], and reference_buffer has float samples with range | 75 // with range [-32768,32767], and reference_buffer has float samples with range |
| 76 // [-1,1]. Return true iff all the buffers were filled completely. | 76 // [-1,1]. Return true iff all the buffers were filled completely. |
| 77 bool ReadBuffers(FILE* in_file, | 77 bool ReadBuffers(FILE* in_file, |
| 78 size_t audio_buffer_size, | 78 size_t audio_buffer_size, |
| 79 int num_channels, | 79 int num_channels, |
| 80 int16_t* audio_buffer, | 80 int16_t* audio_buffer, |
| 81 FILE* detection_file, | 81 FILE* detection_file, |
| 82 size_t detection_buffer_size, | 82 size_t detection_buffer_size, |
| 83 float* detection_buffer, | 83 float* detection_buffer, |
| 84 FILE* reference_file, | 84 FILE* reference_file, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 TransientSuppressor suppressor; | 175 TransientSuppressor suppressor; |
| 176 suppressor.Initialize( | 176 suppressor.Initialize( |
| 177 FLAGS_sample_rate_hz, detection_rate_hz, FLAGS_num_channels); | 177 FLAGS_sample_rate_hz, detection_rate_hz, FLAGS_num_channels); |
| 178 | 178 |
| 179 const size_t audio_buffer_size = | 179 const size_t audio_buffer_size = |
| 180 FLAGS_chunk_size_ms * FLAGS_sample_rate_hz / 1000; | 180 FLAGS_chunk_size_ms * FLAGS_sample_rate_hz / 1000; |
| 181 const size_t detection_buffer_size = | 181 const size_t detection_buffer_size = |
| 182 FLAGS_chunk_size_ms * detection_rate_hz / 1000; | 182 FLAGS_chunk_size_ms * detection_rate_hz / 1000; |
| 183 | 183 |
| 184 // int16 and float variants of the same data. | 184 // int16_t and float variants of the same data. |
| 185 rtc::scoped_ptr<int16_t[]> audio_buffer_i( | 185 rtc::scoped_ptr<int16_t[]> audio_buffer_i( |
| 186 new int16_t[FLAGS_num_channels * audio_buffer_size]); | 186 new int16_t[FLAGS_num_channels * audio_buffer_size]); |
| 187 rtc::scoped_ptr<float[]> audio_buffer_f( | 187 rtc::scoped_ptr<float[]> audio_buffer_f( |
| 188 new float[FLAGS_num_channels * audio_buffer_size]); | 188 new float[FLAGS_num_channels * audio_buffer_size]); |
| 189 | 189 |
| 190 rtc::scoped_ptr<float[]> detection_buffer, reference_buffer; | 190 rtc::scoped_ptr<float[]> detection_buffer, reference_buffer; |
| 191 | 191 |
| 192 if (detection_file) | 192 if (detection_file) |
| 193 detection_buffer.reset(new float[detection_buffer_size]); | 193 detection_buffer.reset(new float[detection_buffer_size]); |
| 194 if (reference_file) | 194 if (reference_file) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace webrtc | 243 } // namespace webrtc |
| 244 | 244 |
| 245 int main(int argc, char* argv[]) { | 245 int main(int argc, char* argv[]) { |
| 246 google::SetUsageMessage(webrtc::kUsage); | 246 google::SetUsageMessage(webrtc::kUsage); |
| 247 google::ParseCommandLineFlags(&argc, &argv, true); | 247 google::ParseCommandLineFlags(&argc, &argv, true); |
| 248 webrtc::void_main(); | 248 webrtc::void_main(); |
| 249 return 0; | 249 return 0; |
| 250 } | 250 } |
| OLD | NEW |