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

Side by Side Diff: webrtc/modules/audio_processing/test/py_quality_assessment/apm_quality_assessment.py

Issue 2811953002: APM QA unit tests, fake POLQA binary and minor fixes (Closed)
Patch Set: comments addressed Created 3 years, 8 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 #!/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
11 more audioproc_f configuration files and one or more test data generators. 11 more audioproc_f configuration files and one or more test data generators.
12 12
13 Usage: apm_quality_assessment.py -i audio1.wav [audio2.wav ...] 13 Usage: apm_quality_assessment.py -i audio1.wav [audio2.wav ...]
14 -c cfg1.json [cfg2.json ...] 14 -c cfg1.json [cfg2.json ...]
15 -n white [echo ...] 15 -n white [echo ...]
16 -e audio_level [polqa ...] 16 -e audio_level [polqa ...]
17 -o /path/to/output 17 -o /path/to/output
18 """ 18 """
19 19
20 import argparse 20 import argparse
21 import logging 21 import logging
22 import os
22 import sys 23 import sys
23 24
25 import quality_assessment.audioproc_wrapper as audioproc_wrapper
24 import quality_assessment.eval_scores as eval_scores 26 import quality_assessment.eval_scores as eval_scores
27 import quality_assessment.evaluation as evaluation
25 import quality_assessment.test_data_generation as test_data_generation 28 import quality_assessment.test_data_generation as test_data_generation
26 import quality_assessment.simulation as simulation 29 import quality_assessment.simulation as simulation
27 30
28 _TEST_DATA_GENERATOR_CLASSES = ( 31 _TEST_DATA_GENERATOR_CLASSES = (
29 test_data_generation.TestDataGenerator.REGISTERED_CLASSES) 32 test_data_generation.TestDataGenerator.REGISTERED_CLASSES)
30 _TEST_DATA_GENERATORS_NAMES = _TEST_DATA_GENERATOR_CLASSES.keys() 33 _TEST_DATA_GENERATORS_NAMES = _TEST_DATA_GENERATOR_CLASSES.keys()
31 _EVAL_SCORE_WORKER_CLASSES = eval_scores.EvaluationScore.REGISTERED_CLASSES 34 _EVAL_SCORE_WORKER_CLASSES = eval_scores.EvaluationScore.REGISTERED_CLASSES
32 _EVAL_SCORE_WORKER_NAMES = _EVAL_SCORE_WORKER_CLASSES.keys() 35 _EVAL_SCORE_WORKER_NAMES = _EVAL_SCORE_WORKER_CLASSES.keys()
33 36
34 _DEFAULT_CONFIG_FILE = 'apm_configs/default.json' 37 _DEFAULT_CONFIG_FILE = 'apm_configs/default.json'
35 38
39 _POLQA_BIN_NAME = 'PolqaOem64'
40
36 41
37 def _InstanceArgumentsParser(): 42 def _InstanceArgumentsParser():
38 """Arguments parser factory. 43 """Arguments parser factory.
39 """ 44 """
40 parser = argparse.ArgumentParser(description=( 45 parser = argparse.ArgumentParser(description=(
41 'Perform APM module quality assessment on one or more input files using ' 46 'Perform APM module quality assessment on one or more input files using '
42 'one or more audioproc_f configuration files and one or more ' 47 'one or more audioproc_f configuration files and one or more '
43 'test data generators.')) 48 'test data generators.'))
44 49
45 parser.add_argument('-c', '--config_files', nargs='+', required=False, 50 parser.add_argument('-c', '--config_files', nargs='+', required=False,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 83
79 def main(): 84 def main():
80 # TODO(alessiob): level = logging.INFO once debugged. 85 # TODO(alessiob): level = logging.INFO once debugged.
81 logging.basicConfig(level=logging.DEBUG) 86 logging.basicConfig(level=logging.DEBUG)
82 87
83 parser = _InstanceArgumentsParser() 88 parser = _InstanceArgumentsParser()
84 args = parser.parse_args() 89 args = parser.parse_args()
85 90
86 simulator = simulation.ApmModuleSimulator( 91 simulator = simulation.ApmModuleSimulator(
87 aechen_ir_database_path=args.air_db_path, 92 aechen_ir_database_path=args.air_db_path,
88 polqa_tool_path=args.polqa_path) 93 polqa_tool_bin_path=os.path.join(args.polqa_path, _POLQA_BIN_NAME),
94 ap_wrapper=audioproc_wrapper.AudioProcWrapper(),
95 evaluator=evaluation.ApmModuleEvaluator())
89 simulator.Run( 96 simulator.Run(
90 config_filepaths=args.config_files, 97 config_filepaths=args.config_files,
91 input_filepaths=args.input_files, 98 input_filepaths=args.input_files,
92 test_data_generator_names=args.test_data_generators, 99 test_data_generator_names=args.test_data_generators,
93 eval_score_names=args.eval_scores, 100 eval_score_names=args.eval_scores,
94 output_dir=args.output_dir) 101 output_dir=args.output_dir)
95 102
96 sys.exit(0) 103 sys.exit(0)
97 104
98 105
99 if __name__ == '__main__': 106 if __name__ == '__main__':
100 main() 107 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698