OLD | NEW |
1 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 1 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license | 3 # Use of this source code is governed by a BSD-style license |
4 # that can be found in the LICENSE file in the root of the source | 4 # that can be found in the LICENSE file in the root of the source |
5 # tree. An additional intellectual property rights grant can be found | 5 # tree. An additional intellectual property rights grant can be found |
6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may |
7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. |
8 | 8 |
9 """Evaluator of the APM module. | 9 """Evaluator of the APM module. |
10 """ | 10 """ |
11 | 11 |
12 import logging | 12 import logging |
13 | 13 |
14 | 14 |
15 class ApmModuleEvaluator(object): | 15 class ApmModuleEvaluator(object): |
| 16 """APM evaluator class. |
| 17 """ |
16 | 18 |
17 def __init__(self): | 19 def __init__(self): |
18 pass | 20 pass |
19 | 21 |
20 @classmethod | 22 @classmethod |
21 def run(cls, evaluation_score_workers, apm_output_filepath, | 23 def Run(cls, evaluation_score_workers, apm_output_filepath, |
22 reference_input_filepath, output_path): | 24 reference_input_filepath, output_path): |
23 """Runs the evaluation. | 25 """Runs the evaluation. |
24 | 26 |
25 Iterates over the given evaluation score workers. | 27 Iterates over the given evaluation score workers. |
| 28 |
| 29 Args: |
| 30 evaluation_score_workers: list of EvaluationScore instances. |
| 31 apm_output_filepath: path to the audio track file with the APM output. |
| 32 reference_input_filepath: path to the reference audio track file. |
| 33 output_path: output path. |
| 34 |
| 35 Returns: |
| 36 A dict of evaluation score name and score pairs. |
26 """ | 37 """ |
27 # Init. | 38 # Init. |
28 scores = {} | 39 scores = {} |
29 | 40 |
30 for evaluation_score_worker in evaluation_score_workers: | 41 for evaluation_score_worker in evaluation_score_workers: |
31 logging.info(' computing <%s> score', evaluation_score_worker.NAME) | 42 logging.info(' computing <%s> score', evaluation_score_worker.NAME) |
32 evaluation_score_worker.set_reference_signal_filepath( | 43 evaluation_score_worker.SetReferenceSignalFilepath( |
33 reference_input_filepath) | 44 reference_input_filepath) |
34 evaluation_score_worker.set_tested_signal_filepath( | 45 evaluation_score_worker.SetTestedSignalFilepath( |
35 apm_output_filepath) | 46 apm_output_filepath) |
36 | 47 |
37 evaluation_score_worker.run(output_path) | 48 evaluation_score_worker.Run(output_path) |
38 scores[evaluation_score_worker.NAME] = evaluation_score_worker.score | 49 scores[evaluation_score_worker.NAME] = evaluation_score_worker.score |
39 | 50 |
40 return scores | 51 return scores |
OLD | NEW |