OLD | NEW |
---|---|
1 #!/usr/bin/env python3 | 1 #!/usr/bin/env python3 |
2 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
3 # | 3 # |
4 # Use of this source code is governed by a BSD-style license | 4 # Use of this source code is governed by a BSD-style license |
5 # that can be found in the LICENSE file in the root of the source | 5 # that can be found in the LICENSE file in the root of the source |
6 # tree. An additional intellectual property rights grant can be found | 6 # tree. An additional intellectual property rights grant can be found |
7 # in the file PATENTS. All contributing project authors may | 7 # in the file PATENTS. All contributing project authors may |
8 # be found in the AUTHORS file in the root of the source tree. | 8 # be found in the AUTHORS file in the root of the source tree. |
9 | |
10 """Generate .json files with which the APM module can be tested using the | |
11 apm_quality_assessment.py script. | |
12 """ | |
13 | |
14 import logging | |
15 import os | |
16 | |
17 import quality_assessment.data_access as data_access | |
18 | |
19 OUTPUT_PATH = os.path.abspath('apm_configs') | |
20 | |
21 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.
| |
22 """ | |
23 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.
| |
24 src/webrtc/modules/audio_processing/test/audioproc_float.cc (search for | |
25 "if (FLAGS_all_default) {"). | |
26 settings.use_aec = rtc::Optional<bool>(true); | |
27 settings.use_aecm = rtc::Optional<bool>(false); | |
28 settings.use_agc = rtc::Optional<bool>(true); | |
29 settings.use_bf = rtc::Optional<bool>(false); | |
30 settings.use_ed = rtc::Optional<bool>(false); | |
31 settings.use_hpf = rtc::Optional<bool>(true); | |
32 settings.use_ie = rtc::Optional<bool>(false); | |
33 settings.use_le = rtc::Optional<bool>(true); | |
34 settings.use_ns = rtc::Optional<bool>(true); | |
35 settings.use_ts = rtc::Optional<bool>(true); | |
36 settings.use_vad = rtc::Optional<bool>(true); | |
37 """ | |
38 | |
39 for config_filename in CONFIG_OVERRIDE: | |
40 config = CONFIG_OVERRIDE[config_filename] | |
41 config['-all_default'] = None | |
42 | |
43 config_filepath = os.path.join(OUTPUT_PATH, 'default-{}.json'.format( | |
44 config_filename)) | |
45 logging.debug('config file <%s> | %s', config_filepath, config) | |
46 | |
47 data_access.AudioProcConfigFile.save(config_filepath, config) | |
48 logging.info('config file created: <%s>', config_filepath) | |
49 | |
50 | |
51 def generate_all_default_but_one(): | |
52 """ | |
53 Generate configuratoins in which all the default flags are used but one (one | |
54 flag at a time is excluded). | |
55 """ | |
56 CONFIG_SETS = { | |
57 'no_AEC': {'-aec': 0,}, | |
58 'no_AGC': {'-agc': 0,}, | |
59 'no_HP_filter': {'-hpf': 0,}, | |
60 'no_level_estimator': {'-le': 0,}, | |
61 'no_noise_suppressor': {'-ns': 0,}, | |
62 'no_transient_suppressor': {'-ts': 0,}, | |
63 'no_vad': {'-vad': 0,}, | |
64 } | |
65 | |
66 return _generate_default_overridden(CONFIG_SETS) | |
67 | |
68 | |
69 def generate_all_default_plus_one(): | |
70 """ | |
71 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.
| |
72 unused flag is added one at a time. | |
73 """ | |
74 CONFIG_SETS = { | |
75 'with_AECM': {'-aec': 0, '-aecm': 1,}, # AEC and AECM are exclusive. | |
76 'with_AGC_limiter': {'-agc_limiter': 1,}, | |
77 # 'with_beam_forming': { # Two microphones, multi-channel input stream. | |
78 # '-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
| |
79 'with_AEC_delay_agnostic': {'-delay_agnostic': 1,}, | |
80 'with_drift_compensation': {'-drift_compensation': 1,}, | |
81 'with_residual_echo_detector': {'-ed': 1,}, | |
82 'with_AEC_extended_filter': {'-extended_filter': 1,}, | |
83 'with_intelligibility_enhancer': {'-ie': 1,}, | |
84 'with_LC': {'-lc': 1,}, | |
85 'with_refined_adaptive_filter': {'-refined_adaptive_filter': 1,}, | |
86 } | |
87 | |
88 return _generate_default_overridden(CONFIG_SETS) | |
89 | |
90 | |
91 def main(): | |
92 logging.basicConfig(level=logging.INFO) | |
93 generate_all_default_plus_one() | |
94 generate_all_default_but_one() | |
95 | |
96 | |
97 if __name__ == '__main__': | |
98 main() | |
OLD | NEW |