Index: webrtc/modules/audio_processing/test/py_quality_assessment/apm_quality_assessment-gencfgs.py |
diff --git a/webrtc/modules/audio_processing/test/py_quality_assessment/apm_quality_assessment-gencfgs.py b/webrtc/modules/audio_processing/test/py_quality_assessment/apm_quality_assessment-gencfgs.py |
index 1b526c1b054918518b39370902d82a1fd53aff29..c845f28e36faf5c453ae519b7c454c314bfd4388 100755 |
--- a/webrtc/modules/audio_processing/test/py_quality_assessment/apm_quality_assessment-gencfgs.py |
+++ b/webrtc/modules/audio_processing/test/py_quality_assessment/apm_quality_assessment-gencfgs.py |
@@ -6,3 +6,93 @@ |
# tree. An additional intellectual property rights grant can be found |
# in the file PATENTS. All contributing project authors may |
# be found in the AUTHORS file in the root of the source tree. |
+ |
+"""Generate .json files with which the APM module can be tested using the |
+ apm_quality_assessment.py script. |
+""" |
+ |
+import logging |
+import os |
+ |
+import quality_assessment.data_access as data_access |
+ |
+OUTPUT_PATH = os.path.abspath('apm_configs') |
+ |
+def _generate_default_overridden(CONFIG_OVERRIDE): |
aleloi2
2017/03/02 01:29:51
Does whichever py style doc we use say something a
AleBzk
2017/03/02 09:08:58
Right, I'll make it lowercase.
|
+ """ |
+ Default settings from |
aleloi2
2017/03/02 01:29:51
Please update the docstring to explain the params
AleBzk
2017/03/02 09:08:58
Acknowledged.
|
+ src/webrtc/modules/audio_processing/test/audioproc_float.cc (search for |
+ "if (FLAGS_all_default) {"). |
+ settings.use_aec = rtc::Optional<bool>(true); |
+ settings.use_aecm = rtc::Optional<bool>(false); |
+ settings.use_agc = rtc::Optional<bool>(true); |
+ settings.use_bf = rtc::Optional<bool>(false); |
+ settings.use_ed = rtc::Optional<bool>(false); |
+ settings.use_hpf = rtc::Optional<bool>(true); |
+ settings.use_ie = rtc::Optional<bool>(false); |
+ settings.use_le = rtc::Optional<bool>(true); |
+ settings.use_ns = rtc::Optional<bool>(true); |
+ settings.use_ts = rtc::Optional<bool>(true); |
+ settings.use_vad = rtc::Optional<bool>(true); |
+ """ |
+ |
+ for config_filename in CONFIG_OVERRIDE: |
+ config = CONFIG_OVERRIDE[config_filename] |
+ config['-all_default'] = None |
+ |
+ config_filepath = os.path.join(OUTPUT_PATH, 'default-{}.json'.format( |
+ config_filename)) |
+ logging.debug('config file <%s> | %s', config_filepath, config) |
+ |
+ data_access.AudioProcConfigFile.save(config_filepath, config) |
+ logging.info('config file created: <%s>', config_filepath) |
+ |
+ |
+def generate_all_default_but_one(): |
+ """ |
+ Generate configuratoins in which all the default flags are used but one (one |
+ flag at a time is excluded). |
+ """ |
+ CONFIG_SETS = { |
+ 'no_AEC': {'-aec': 0,}, |
+ 'no_AGC': {'-agc': 0,}, |
+ 'no_HP_filter': {'-hpf': 0,}, |
+ 'no_level_estimator': {'-le': 0,}, |
+ 'no_noise_suppressor': {'-ns': 0,}, |
+ 'no_transient_suppressor': {'-ts': 0,}, |
+ 'no_vad': {'-vad': 0,}, |
+ } |
+ |
+ return _generate_default_overridden(CONFIG_SETS) |
+ |
+ |
+def generate_all_default_plus_one(): |
+ """ |
+ Generate configuratoins in which all the default flags are used and each |
aleloi2
2017/03/02 01:29:51
configuratoins
AleBzk
2017/03/02 09:08:58
Acknowledged.
|
+ unused flag is added one at a time. |
+ """ |
+ CONFIG_SETS = { |
+ 'with_AECM': {'-aec': 0, '-aecm': 1,}, # AEC and AECM are exclusive. |
+ 'with_AGC_limiter': {'-agc_limiter': 1,}, |
+ # 'with_beam_forming': { # Two microphones, multi-channel input stream. |
+ # '-bf': 1, '-mic_positions': '-0.15 0.3 0.3 0.15 0.3 0.3'}, |
aleloi2
2017/03/02 01:29:51
Why comment?
AleBzk
2017/03/02 09:08:58
Let me remove this for the time being.
Beam formin
|
+ 'with_AEC_delay_agnostic': {'-delay_agnostic': 1,}, |
+ 'with_drift_compensation': {'-drift_compensation': 1,}, |
+ 'with_residual_echo_detector': {'-ed': 1,}, |
+ 'with_AEC_extended_filter': {'-extended_filter': 1,}, |
+ 'with_intelligibility_enhancer': {'-ie': 1,}, |
+ 'with_LC': {'-lc': 1,}, |
+ 'with_refined_adaptive_filter': {'-refined_adaptive_filter': 1,}, |
+ } |
+ |
+ return _generate_default_overridden(CONFIG_SETS) |
+ |
+ |
+def main(): |
+ logging.basicConfig(level=logging.INFO) |
+ generate_all_default_plus_one() |
+ generate_all_default_but_one() |
+ |
+ |
+if __name__ == '__main__': |
+ main() |