15
15
parser .add_argument ('outputdir' , type = str , help = 'Output folder' )
16
16
parser .add_argument ('bitrate' , type = int , help = 'bitrate to test' )
17
17
parser .add_argument ('--reference_opus_demo' , type = str , default = './opus_demo' , help = 'reference opus_demo binary for generating bitstreams and reference output' )
18
+ parser .add_argument ('--encoder_options' , type = str , default = "" , help = 'encoder options (e.g. -complexity 5)' )
18
19
parser .add_argument ('--test_opus_demo' , type = str , default = './opus_demo' , help = 'opus_demo binary under test' )
19
20
parser .add_argument ('--test_opus_demo_options' , type = str , default = '-dec_complexity 7' , help = 'options for test opus_demo (e.g. "-dec_complexity 7")' )
20
21
parser .add_argument ('--verbose' , type = int , default = 0 , help = 'verbosity level: 0 for quiet (default), 1 for reporting individual test results, 2 for reporting per-item scores in failed tests' )
@@ -94,7 +95,7 @@ def sox(*call_args):
94
95
except :
95
96
return 1
96
97
97
- def process_clip_factory (ref_opus_demo , test_opus_demo , test_options ):
98
+ def process_clip_factory (ref_opus_demo , test_opus_demo , enc_options , test_options ):
98
99
def process_clip (clip_path , processdir , bitrate ):
99
100
# derive paths
100
101
clipname = os .path .splitext (os .path .split (clip_path )[1 ])[0 ]
@@ -107,7 +108,7 @@ def process_clip(clip_path, processdir, bitrate):
107
108
sox (clip_path , pcm_path )
108
109
109
110
# run encoder
110
- run_opus_encoder (ref_opus_demo , pcm_path , bitstream_path , "voip" , 16000 , 1 , bitrate )
111
+ run_opus_encoder (ref_opus_demo , pcm_path , bitstream_path , "voip" , 16000 , 1 , bitrate , enc_options )
111
112
112
113
# run decoder
113
114
run_opus_decoder (ref_opus_demo , bitstream_path , ref_path , 16000 , 1 )
@@ -121,16 +122,17 @@ def process_clip(clip_path, processdir, bitrate):
121
122
122
123
return process_clip
123
124
124
- def main (inputdir , outputdir , bitrate , reference_opus_demo , test_opus_demo , test_option_string , verbose ):
125
+ def main (inputdir , outputdir , bitrate , reference_opus_demo , test_opus_demo , enc_option_string , test_option_string , verbose ):
125
126
126
127
# load clips list
127
128
with open (os .path .join (inputdir , 'clips.yml' ), "r" ) as f :
128
129
clips = yaml .safe_load (f )
129
130
130
131
# parse test options
132
+ enc_options = enc_option_string .split ()
131
133
test_options = test_option_string .split ()
132
134
133
- process_clip = process_clip_factory (reference_opus_demo , test_opus_demo , test_options )
135
+ process_clip = process_clip_factory (reference_opus_demo , test_opus_demo , enc_options , test_options )
134
136
135
137
os .makedirs (outputdir , exist_ok = True )
136
138
processdir = os .path .join (outputdir , 'process' )
@@ -189,5 +191,6 @@ def main(inputdir, outputdir, bitrate, reference_opus_demo, test_opus_demo, test
189
191
args .bitrate ,
190
192
args .reference_opus_demo ,
191
193
args .test_opus_demo ,
194
+ args .encoder_options ,
192
195
args .test_opus_demo_options ,
193
196
args .verbose )
0 commit comments