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

Unified Diff: webrtc/modules/audio_processing/test/py_quality_assessment/apm_quality_assessment-gencfgs.py

Issue 2719853006: APM configuration files generator. (Closed)
Patch Set: Comments from Alex addressed Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..dd1f747a8582dd9c5410638b92a342e3fd480718 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,96 @@
# 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):
+ """
+ For each item in config_override, it overrides the default configuration and
+ writes a new APM configuration file.
+
+ The default settings are loaded via "-all_default".
+ Check "src/webrtc/modules/audio_processing/test/audioproc_float.cc" and search
+ for "if (FLAGS_all_default) {".
+
+ For instance, in 55eb6d621489730084927868fed195d3645a9ec9 the default is this:
+ 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 configurations 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 17:00:01 Still configuratoins. But you fixed the other one
+ 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_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()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698