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. | 16 """APM evaluator class. |
17 """ | 17 """ |
18 | 18 |
19 def __init__(self): | 19 def __init__(self): |
20 pass | 20 pass |
21 | 21 |
22 @classmethod | 22 @classmethod |
23 def Run(cls, evaluation_score_workers, apm_output_filepath, | 23 def Run(cls, evaluation_score_workers, apm_input_metadata, |
24 reference_input_filepath, output_path): | 24 apm_output_filepath, reference_input_filepath, output_path): |
25 """Runs the evaluation. | 25 """Runs the evaluation. |
26 | 26 |
27 Iterates over the given evaluation score workers. | 27 Iterates over the given evaluation score workers. |
28 | 28 |
29 Args: | 29 Args: |
30 evaluation_score_workers: list of EvaluationScore instances. | 30 evaluation_score_workers: list of EvaluationScore instances. |
| 31 apm_input_metadata: dictionary with metadata of the APM input. |
31 apm_output_filepath: path to the audio track file with the APM output. | 32 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 reference_input_filepath: path to the reference audio track file. |
33 output_path: output path. | 34 output_path: output path. |
34 | 35 |
35 Returns: | 36 Returns: |
36 A dict of evaluation score name and score pairs. | 37 A dict of evaluation score name and score pairs. |
37 """ | 38 """ |
38 # Init. | 39 # Init. |
39 scores = {} | 40 scores = {} |
40 | 41 |
41 for evaluation_score_worker in evaluation_score_workers: | 42 for evaluation_score_worker in evaluation_score_workers: |
42 logging.info(' computing <%s> score', evaluation_score_worker.NAME) | 43 logging.info(' computing <%s> score', evaluation_score_worker.NAME) |
| 44 evaluation_score_worker.SetInputSignalMetadata(apm_input_metadata) |
43 evaluation_score_worker.SetReferenceSignalFilepath( | 45 evaluation_score_worker.SetReferenceSignalFilepath( |
44 reference_input_filepath) | 46 reference_input_filepath) |
45 evaluation_score_worker.SetTestedSignalFilepath( | 47 evaluation_score_worker.SetTestedSignalFilepath( |
46 apm_output_filepath) | 48 apm_output_filepath) |
47 | 49 |
48 evaluation_score_worker.Run(output_path) | 50 evaluation_score_worker.Run(output_path) |
49 scores[evaluation_score_worker.NAME] = evaluation_score_worker.score | 51 scores[evaluation_score_worker.NAME] = evaluation_score_worker.score |
50 | 52 |
51 return scores | 53 return scores |
OLD | NEW |