| 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 15 matching lines...) Expand all Loading... |
| 26 #include "webrtc/common_audio/real_fourier.h" | 26 #include "webrtc/common_audio/real_fourier.h" |
| 27 #include "webrtc/common_audio/wav_file.h" | 27 #include "webrtc/common_audio/wav_file.h" |
| 28 #include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhanc
er.h" | 28 #include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhanc
er.h" |
| 29 #include "webrtc/modules/audio_processing/intelligibility/intelligibility_utils.
h" | 29 #include "webrtc/modules/audio_processing/intelligibility/intelligibility_utils.
h" |
| 30 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" | 30 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" |
| 31 #include "webrtc/test/testsupport/fileutils.h" | 31 #include "webrtc/test/testsupport/fileutils.h" |
| 32 | 32 |
| 33 using std::complex; | 33 using std::complex; |
| 34 | 34 |
| 35 namespace webrtc { | 35 namespace webrtc { |
| 36 namespace { |
| 36 | 37 |
| 37 using webrtc::RealFourier; | 38 bool ValidateClearWindow(const char* flagname, int32_t value) { |
| 38 using webrtc::IntelligibilityEnhancer; | 39 return value > 0; |
| 40 } |
| 39 | 41 |
| 40 DEFINE_int32(clear_type, | 42 DEFINE_int32(clear_type, |
| 41 webrtc::intelligibility::VarianceArray::kStepInfinite, | 43 webrtc::intelligibility::VarianceArray::kStepInfinite, |
| 42 "Variance algorithm for clear data."); | 44 "Variance algorithm for clear data."); |
| 43 DEFINE_double(clear_alpha, 0.9, "Variance decay factor for clear data."); | 45 DEFINE_double(clear_alpha, 0.9, "Variance decay factor for clear data."); |
| 44 DEFINE_int32(clear_window, | 46 DEFINE_int32(clear_window, |
| 45 475, | 47 475, |
| 46 "Window size for windowed variance for clear data."); | 48 "Window size for windowed variance for clear data."); |
| 49 const bool clear_window_dummy = |
| 50 google::RegisterFlagValidator(&FLAGS_clear_window, &ValidateClearWindow); |
| 47 DEFINE_int32(sample_rate, | 51 DEFINE_int32(sample_rate, |
| 48 16000, | 52 16000, |
| 49 "Audio sample rate used in the input and output files."); | 53 "Audio sample rate used in the input and output files."); |
| 50 DEFINE_int32(ana_rate, | 54 DEFINE_int32(ana_rate, |
| 51 800, | 55 800, |
| 52 "Analysis rate; gains recalculated every N blocks."); | 56 "Analysis rate; gains recalculated every N blocks."); |
| 53 DEFINE_int32( | 57 DEFINE_int32( |
| 54 var_rate, | 58 var_rate, |
| 55 2, | 59 2, |
| 56 "Variance clear rate; history is forgotten every N gain recalculations."); | 60 "Variance clear rate; history is forgotten every N gain recalculations."); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 out_file.WriteSamples(&in_fpcm[0], samples); | 134 out_file.WriteSamples(&in_fpcm[0], samples); |
| 131 } | 135 } |
| 132 system(("aplay " + temp_out_filename).c_str()); | 136 system(("aplay " + temp_out_filename).c_str()); |
| 133 system(("rm " + temp_out_filename).c_str()); | 137 system(("rm " + temp_out_filename).c_str()); |
| 134 } else { | 138 } else { |
| 135 WavWriter out_file(FLAGS_out_file, FLAGS_sample_rate, kNumChannels); | 139 WavWriter out_file(FLAGS_out_file, FLAGS_sample_rate, kNumChannels); |
| 136 out_file.WriteSamples(&in_fpcm[0], samples); | 140 out_file.WriteSamples(&in_fpcm[0], samples); |
| 137 } | 141 } |
| 138 } | 142 } |
| 139 | 143 |
| 144 } // namespace |
| 140 } // namespace webrtc | 145 } // namespace webrtc |
| 141 | 146 |
| 142 int main(int argc, char* argv[]) { | 147 int main(int argc, char* argv[]) { |
| 143 webrtc::void_main(argc, argv); | 148 webrtc::void_main(argc, argv); |
| 144 return 0; | 149 return 0; |
| 145 } | 150 } |
| OLD | NEW |