Chromium Code Reviews| Index: webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/simulation.py |
| diff --git a/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/simulation.py b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/simulation.py |
| index ac20edc9d763ba67cc371cc8116dc978394c66c4..b93034a13699e916f40d7be159267b7cf614f844 100644 |
| --- a/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/simulation.py |
| +++ b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/simulation.py |
| @@ -12,18 +12,29 @@ import os |
| from . import audioproc_wrapper |
| from . import data_access |
| from . import eval_scores |
| +from . import eval_scores_factory |
| from . import evaluation |
| from . import noise_generation |
| +from . import noise_gen_factory |
| class ApmModuleSimulator(object): |
| _NOISE_GENERATOR_CLASSES = noise_generation.NoiseGenerator.REGISTERED_CLASSES |
| _EVAL_SCORE_WORKER_CLASSES = eval_scores.EvaluationScore.REGISTERED_CLASSES |
| - def __init__(self): |
| + def __init__(self, aechen_ir_database_path, polqa_tool_path): |
| + # Init. |
| self._audioproc_wrapper = audioproc_wrapper.AudioProcWrapper() |
| self._evaluator = evaluation.ApmModuleEvaluator() |
| + # Instance factory objects. |
| + self._noise_generator_factory = noise_gen_factory.NoiseGeneratorFactory( |
| + aechen_ir_database_path=aechen_ir_database_path) |
| + self._evaluation_score_factory = ( |
| + eval_scores_factory.EvaluationScoreWorkerFactory( |
| + polqa_tool_path=polqa_tool_path)) |
|
AleBzk
2017/03/06 11:29:53
I added factory classes with which evaluation scor
|
| + |
| + # Properties for each run. |
| self._base_output_path = None |
| self._noise_generators = None |
| self._evaluation_score_workers = None |
| @@ -38,12 +49,15 @@ class ApmModuleSimulator(object): |
| self._base_output_path = os.path.abspath(output_dir) |
| # Instance noise generators. |
| - self._noise_generators = [ |
| - self._NOISE_GENERATOR_CLASSES[name]() for name in noise_generator_names] |
| + self._noise_generators = [self._noise_generator_factory.GetInstance( |
| + noise_generator_class=self._NOISE_GENERATOR_CLASSES[name]) for name in ( |
| + noise_generator_names)] |
|
AleBzk
2017/03/06 11:29:53
Now getting an instance through the factory object
|
| # Instance evaluation score workers. |
| self._evaluation_score_workers = [ |
| - self._EVAL_SCORE_WORKER_CLASSES[name]() for name in eval_score_names] |
| + self._evaluation_score_factory.GetInstance( |
| + evaluation_score_class=self._EVAL_SCORE_WORKER_CLASSES[name]) for ( |
| + name) in eval_score_names] |
|
AleBzk
2017/03/06 11:29:53
Now getting an instance through the factory object
|
| # Set APM configuration file paths. |
| self._config_filepaths = self._get_paths_collection(config_filepaths) |