OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 # Copyright (c) 2017 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 """Perform APM module quality assessment on one or more input files using one or | 10 """Perform APM module quality assessment on one or more input files using one or |
(...skipping 14 matching lines...) Expand all Loading... |
25 import quality_assessment.noise_generation as noise_generation | 25 import quality_assessment.noise_generation as noise_generation |
26 import quality_assessment.simulation as simulation | 26 import quality_assessment.simulation as simulation |
27 | 27 |
28 _NOISE_GENERATOR_CLASSES = noise_generation.NoiseGenerator.REGISTERED_CLASSES | 28 _NOISE_GENERATOR_CLASSES = noise_generation.NoiseGenerator.REGISTERED_CLASSES |
29 _NOISE_GENERATORS_NAMES = _NOISE_GENERATOR_CLASSES.keys() | 29 _NOISE_GENERATORS_NAMES = _NOISE_GENERATOR_CLASSES.keys() |
30 _EVAL_SCORE_WORKER_CLASSES = eval_scores.EvaluationScore.REGISTERED_CLASSES | 30 _EVAL_SCORE_WORKER_CLASSES = eval_scores.EvaluationScore.REGISTERED_CLASSES |
31 _EVAL_SCORE_WORKER_NAMES = _EVAL_SCORE_WORKER_CLASSES.keys() | 31 _EVAL_SCORE_WORKER_NAMES = _EVAL_SCORE_WORKER_CLASSES.keys() |
32 | 32 |
33 _DEFAULT_CONFIG_FILE = 'apm_configs/default.json' | 33 _DEFAULT_CONFIG_FILE = 'apm_configs/default.json' |
34 | 34 |
35 def _instance_arguments_parser(): | 35 |
| 36 def _InstanceArgumentsParser(): |
| 37 """Arguments parser factory. |
| 38 """ |
36 parser = argparse.ArgumentParser(description=( | 39 parser = argparse.ArgumentParser(description=( |
37 'Perform APM module quality assessment on one or more input files using ' | 40 'Perform APM module quality assessment on one or more input files using ' |
38 'one or more audioproc_f configuration files and one or more noise ' | 41 'one or more audioproc_f configuration files and one or more noise ' |
39 'generators.')) | 42 'generators.')) |
40 | 43 |
41 parser.add_argument('-c', '--config_files', nargs='+', required=False, | 44 parser.add_argument('-c', '--config_files', nargs='+', required=False, |
42 help=('path to the configuration files defining the ' | 45 help=('path to the configuration files defining the ' |
43 'arguments with which the audioproc_f tool is ' | 46 'arguments with which the audioproc_f tool is ' |
44 'called'), | 47 'called'), |
45 default=[_DEFAULT_CONFIG_FILE]) | 48 default=[_DEFAULT_CONFIG_FILE]) |
(...skipping 23 matching lines...) Expand all Loading... |
69 parser.add_argument('--air_db_path', required=True, | 72 parser.add_argument('--air_db_path', required=True, |
70 help='path to the Aechen IR database') | 73 help='path to the Aechen IR database') |
71 | 74 |
72 return parser | 75 return parser |
73 | 76 |
74 | 77 |
75 def main(): | 78 def main(): |
76 # TODO(alessiob): level = logging.INFO once debugged. | 79 # TODO(alessiob): level = logging.INFO once debugged. |
77 logging.basicConfig(level=logging.DEBUG) | 80 logging.basicConfig(level=logging.DEBUG) |
78 | 81 |
79 parser = _instance_arguments_parser() | 82 parser = _InstanceArgumentsParser() |
80 args = parser.parse_args() | 83 args = parser.parse_args() |
81 | 84 |
82 simulator = simulation.ApmModuleSimulator( | 85 simulator = simulation.ApmModuleSimulator( |
83 aechen_ir_database_path=args.air_db_path, | 86 aechen_ir_database_path=args.air_db_path, |
84 polqa_tool_path=args.polqa_path) | 87 polqa_tool_path=args.polqa_path) |
85 simulator.run( | 88 simulator.Run( |
86 config_filepaths=args.config_files, | 89 config_filepaths=args.config_files, |
87 input_filepaths=args.input_files, | 90 input_filepaths=args.input_files, |
88 noise_generator_names=args.noise_generators, | 91 noise_generator_names=args.noise_generators, |
89 eval_score_names=args.eval_scores, | 92 eval_score_names=args.eval_scores, |
90 output_dir=args.output_dir) | 93 output_dir=args.output_dir) |
91 | 94 |
92 sys.exit(0) | 95 sys.exit(0) |
93 | 96 |
94 | 97 |
95 if __name__ == '__main__': | 98 if __name__ == '__main__': |
96 main() | 99 main() |
OLD | NEW |