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

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

Issue 2720203003: Single simulation runner (Closed)
Patch Set: rebase 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
« no previous file with comments | « webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/audioproc_wrapper.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 """APM module simulator. 9 """APM module simulator.
10 """ 10 """
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 self._simulate(noise_generator, input_filepath, 113 self._simulate(noise_generator, input_filepath,
114 input_noise_cache_path, output_path, config_filepath) 114 input_noise_cache_path, output_path, config_filepath)
115 115
116 def _simulate(self, noise_generator, input_filepath, input_noise_cache_path, 116 def _simulate(self, noise_generator, input_filepath, input_noise_cache_path,
117 output_path, config_filepath): 117 output_path, config_filepath):
118 """ 118 """
119 Simulates a given combination of APM configurations, probing signals, and 119 Simulates a given combination of APM configurations, probing signals, and
120 noise generators. It iterates over the noise generator internal 120 noise generators. It iterates over the noise generator internal
121 configurations. 121 configurations.
122 """ 122 """
123 # TODO(alessio): implement. 123 # Generate pairs of noisy input and reference signal files.
124 pass 124 noise_generator.generate(
125 input_signal_filepath=input_filepath,
126 input_noise_cache_path=input_noise_cache_path,
127 base_output_path=output_path)
128
129 # For each input-reference pair, simulate a call and evaluate.
130 for noise_generator_config_name in noise_generator.config_names:
131 logging.info(' - noise config: <%s>', noise_generator_config_name)
132
133 # APM input and output signal paths.
134 noisy_signal_filepath = noise_generator.noisy_signal_filepaths[
135 noise_generator_config_name]
136 evaluation_output_path = noise_generator.output_paths[
137 noise_generator_config_name]
138
139 # Simulate a call using the audio processing module.
140 self._audioproc_wrapper.run(
141 config_filepath=config_filepath,
142 input_filepath=noisy_signal_filepath,
143 output_path=evaluation_output_path)
144
145 # Reference signal path for the evaluation step.
146 reference_signal_filepath = noise_generator.reference_signal_filepaths[
147 noise_generator_config_name]
148
149 # Evaluate.
150 self._evaluator.run(
151 evaluation_score_workers=self._evaluation_score_workers,
152 apm_output_filepath=self._audioproc_wrapper.output_filepath,
153 reference_input_filepath=reference_signal_filepath,
154 output_path=evaluation_output_path)
125 155
126 @classmethod 156 @classmethod
127 def _get_paths_collection(cls, filepaths): 157 def _get_paths_collection(cls, filepaths):
128 """ 158 """
129 Given a list of file paths, makes a collection with one pair for each item 159 Given a list of file paths, makes a collection with one pair for each item
130 in the list where the key is the file name without extension and the value 160 in the list where the key is the file name without extension and the value
131 is the path. 161 is the path.
132 """ 162 """
133 filepaths_collection = {} 163 filepaths_collection = {}
134 for filepath in filepaths: 164 for filepath in filepaths:
135 name = os.path.splitext(os.path.split(filepath)[1])[0] 165 name = os.path.splitext(os.path.split(filepath)[1])[0]
136 filepaths_collection[name] = os.path.abspath(filepath) 166 filepaths_collection[name] = os.path.abspath(filepath)
137 return filepaths_collection 167 return filepaths_collection
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/audioproc_wrapper.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698