Skip to content

Commit b63c3a3

Browse files
johnylin76lgirdwood
authored andcommitted
tools: testbench: Support channels specification
Support channel specification by argument "-c" on testbench Signed-off-by: Pin-chih Lin <johnylin@google.com>
1 parent d38d589 commit b63c3a3

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

tools/testbench/testbench.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ static void print_usage(char *executable)
120120
{
121121
printf("Usage: %s -i <input_file> ", executable);
122122
printf("-o <output_file1,output_file2,...> ");
123-
printf("-t <tplg_file> -b <input_format> ");
123+
printf("-t <tplg_file> -b <input_format> -c <channels>");
124124
printf("-a <comp1=comp1_library,comp2=comp2_library>\n");
125125
printf("input_format should be S16_LE, S32_LE, S24_LE or FLOAT_LE\n");
126126
printf("Example Usage:\n");
127127
printf("%s -i in.txt -o out.txt -t test.tplg ", executable);
128-
printf("-r 48000 -R 96000");
128+
printf("-r 48000 -R 96000 -c 2");
129129
printf("-b S16_LE -a vol=libsof_volume.so\n");
130130
}
131131

@@ -164,7 +164,7 @@ static void parse_input_args(int argc, char **argv, struct testbench_prm *tp)
164164
int option = 0;
165165
int ret = 0;
166166

167-
while ((option = getopt(argc, argv, "hdi:o:t:b:a:r:R:")) != -1) {
167+
while ((option = getopt(argc, argv, "hdi:o:t:b:a:r:R:c:")) != -1) {
168168
switch (option) {
169169
/* input sample file */
170170
case 'i':
@@ -202,6 +202,11 @@ static void parse_input_args(int argc, char **argv, struct testbench_prm *tp)
202202
tp->fs_out = atoi(optarg);
203203
break;
204204

205+
/* input/output channels */
206+
case 'c':
207+
tp->channels = atoi(optarg);
208+
break;
209+
205210
/* enable debug prints */
206211
case 'd':
207212
debug = 1;
@@ -341,7 +346,7 @@ int main(int argc, char **argv)
341346
n_in = frcd->fs.n;
342347
n_out = fwcd->fs.n;
343348
t_exec = (double)(toc - tic) / CLOCKS_PER_SEC;
344-
c_realtime = (double)n_out / TESTBENCH_NCH / tp.fs_out / t_exec;
349+
c_realtime = (double)n_out / tp.channels / tp.fs_out / t_exec;
345350

346351
/* free all components/buffers in pipeline */
347352
free_comps();

0 commit comments

Comments
 (0)