|
7 | 7 | RAW_INPUT_S16=in_s16.raw |
8 | 8 | RAW_INPUT_S24=in_s24.raw |
9 | 9 | RAW_INPUT_S32=in_s32.raw |
10 | | -RAW_OUTPUT_S16=mfcc_s16.raw |
11 | | -RAW_OUTPUT_S24=mfcc_s24.raw |
12 | | -RAW_OUTPUT_S32=mfcc_s32.raw |
13 | 10 |
|
14 | 11 | VALGRIND="valgrind --leak-check=full" |
| 12 | +#VALGRIND="" |
15 | 13 | TESTBENCH=$SOF_WORKSPACE/sof/tools/testbench/build_testbench/install/bin/sof-testbench4 |
16 | | -TOPOLOGY_S16=$SOF_WORKSPACE/sof/tools/build_tools/topology/topology2/development/sof-hda-benchmark-mfcc16.tplg |
17 | | -TOPOLOGY_S24=$SOF_WORKSPACE/sof/tools/build_tools/topology/topology2/development/sof-hda-benchmark-mfcc24.tplg |
18 | | -TOPOLOGY_S32=$SOF_WORKSPACE/sof/tools/build_tools/topology/topology2/development/sof-hda-benchmark-mfcc32.tplg |
19 | | -OPT_S16="-r 16000 -c 2 -b S16_LE -p 3,4 -t $TOPOLOGY_S16" |
20 | | -OPT_S24="-r 16000 -c 2 -b S24_LE -p 3,4 -t $TOPOLOGY_S24" |
21 | | -OPT_S32="-r 16000 -c 2 -b S32_LE -p 3,4 -t $TOPOLOGY_S32" |
22 | | - |
23 | | -# Convert input audio file raw 16 kHz 2 channel 16 bit |
24 | | -sox -R --encoding signed-integer "$1" -L -r 16000 -c 2 -b 16 "$RAW_INPUT_S16" |
25 | | -sox -R --no-dither --encoding signed-integer -L -r 16000 -c 2 -b 16 "$RAW_INPUT_S16" -b 32 "$RAW_INPUT_S32" |
26 | | -sox -R --no-dither --encoding signed-integer -L -r 16000 -c 2 -b 16 "$RAW_INPUT_S16" -b 32 "$RAW_INPUT_S24" vol 0.003906250000 |
27 | | - |
28 | | -# Run testbench |
29 | | -$VALGRIND $TESTBENCH $OPT_S16 -i "$RAW_INPUT_S16" -o "$RAW_OUTPUT_S16" |
30 | | -$VALGRIND $TESTBENCH $OPT_S24 -i "$RAW_INPUT_S24" -o "$RAW_OUTPUT_S24" |
31 | | -$VALGRIND $TESTBENCH $OPT_S32 -i "$RAW_INPUT_S32" -o "$RAW_OUTPUT_S32" |
32 | | - |
33 | | -echo ---------------------------------------------------------------------------------- |
34 | | -echo The MFCC data was output to file $RAW_OUTPUT_S16, $RAW_OUTPUT_S24, $RAW_OUTPUT_S32 |
35 | | -echo ---------------------------------------------------------------------------------- |
36 | | - |
37 | | -RAW_OUTPUT_S16=mel_s16.raw |
38 | | -RAW_OUTPUT_S24=mel_s24.raw |
39 | | -RAW_OUTPUT_S32=mel_s32.raw |
40 | | - |
41 | | -TESTBENCH=$SOF_WORKSPACE/sof/tools/testbench/build_testbench/install/bin/sof-testbench4 |
42 | | -TOPOLOGY_S16=$SOF_WORKSPACE/sof/tools/build_tools/topology/topology2/development/sof-hda-benchmark-mfccmel16.tplg |
43 | | -TOPOLOGY_S24=$SOF_WORKSPACE/sof/tools/build_tools/topology/topology2/development/sof-hda-benchmark-mfccmel24.tplg |
44 | | -TOPOLOGY_S32=$SOF_WORKSPACE/sof/tools/build_tools/topology/topology2/development/sof-hda-benchmark-mfccmel32.tplg |
45 | | -OPT_S16="-r 16000 -c 2 -b S16_LE -p 3,4 -t $TOPOLOGY_S16" |
46 | | -OPT_S24="-r 16000 -c 2 -b S24_LE -p 3,4 -t $TOPOLOGY_S24" |
47 | | -OPT_S32="-r 16000 -c 2 -b S32_LE -p 3,4 -t $TOPOLOGY_S32" |
48 | | - |
49 | | -# Run testbench |
50 | | -$VALGRIND $TESTBENCH $OPT_S16 -i "$RAW_INPUT_S16" -o "$RAW_OUTPUT_S16" |
51 | | -$VALGRIND $TESTBENCH $OPT_S24 -i "$RAW_INPUT_S24" -o "$RAW_OUTPUT_S24" |
52 | | -$VALGRIND $TESTBENCH $OPT_S32 -i "$RAW_INPUT_S32" -o "$RAW_OUTPUT_S32" |
53 | | - |
54 | | -echo ---------------------------------------------------------------------------------- |
55 | | -echo The MFCC Mel data was output to file $RAW_OUTPUT_S16, $RAW_OUTPUT_S24, $RAW_OUTPUT_S32 |
56 | | -echo ---------------------------------------------------------------------------------- |
| 14 | +TESTBENCH_RUN="$VALGRIND $TESTBENCH" |
| 15 | + |
| 16 | +convert_input() { |
| 17 | + sox -R --encoding signed-integer "$1" -L -r 16000 -c 2 -b 16 "$RAW_INPUT_S16" |
| 18 | + sox -R --no-dither --encoding signed-integer -L -r 16000 -c 2 -b 16 \ |
| 19 | + "$RAW_INPUT_S16" -b 32 "$RAW_INPUT_S32" |
| 20 | + sox -R --no-dither --encoding signed-integer -L -r 16000 -c 2 -b 16 \ |
| 21 | + "$RAW_INPUT_S16" -b 32 "$RAW_INPUT_S24" vol 0.003906250000 |
| 22 | +} |
| 23 | + |
| 24 | +run_testbench() { |
| 25 | + local tplg_base="$1" |
| 26 | + local out_s16="$2" |
| 27 | + local out_s24="$3" |
| 28 | + local out_s32="$4" |
| 29 | + local label="$5" |
| 30 | + local tplg_s16="${SOF_WORKSPACE}/sof/tools/build_tools/topology/topology2/development/${tplg_base}16.tplg" |
| 31 | + local tplg_s24="${SOF_WORKSPACE}/sof/tools/build_tools/topology/topology2/development/${tplg_base}24.tplg" |
| 32 | + local tplg_s32="${SOF_WORKSPACE}/sof/tools/build_tools/topology/topology2/development/${tplg_base}32.tplg" |
| 33 | + |
| 34 | + $TESTBENCH_RUN -r 16000 -c 2 -b S16_LE -p 3,4 -t "$tplg_s16" -i "$RAW_INPUT_S16" -o "$out_s16" |
| 35 | + $TESTBENCH_RUN -r 16000 -c 2 -b S24_LE -p 3,4 -t "$tplg_s24" -i "$RAW_INPUT_S24" -o "$out_s24" |
| 36 | + $TESTBENCH_RUN -r 16000 -c 2 -b S32_LE -p 3,4 -t "$tplg_s32" -i "$RAW_INPUT_S32" -o "$out_s32" |
| 37 | + |
| 38 | + echo ---------------------------------------------------------------------------------- |
| 39 | + echo "The ${label} data was output to file ${out_s16}, ${out_s24}, ${out_s32}" |
| 40 | + echo ---------------------------------------------------------------------------------- |
| 41 | +} |
| 42 | + |
| 43 | +main() { |
| 44 | + convert_input "$1" |
| 45 | + run_testbench "sof-hda-benchmark-mfcc" mfcc_s16.raw mfcc_s24.raw mfcc_s32.raw "MFCC" |
| 46 | + run_testbench "sof-hda-benchmark-mfccmel" mel_s16.raw mel_s24.raw mel_s32.raw "MFCC Mel" |
| 47 | + |
| 48 | + if [ -n "$XTENSA_PATH" ]; then |
| 49 | + TESTBENCH_RUN="$XTENSA_PATH/xt-run $SOF_WORKSPACE/sof/tools/testbench/build_xt_testbench/sof-testbench4" |
| 50 | + run_testbench "sof-hda-benchmark-mfcc" xt_mfcc_s16.raw xt_mfcc_s24.raw xt_mfcc_s32.raw "Xtensa MFCC" |
| 51 | + run_testbench "sof-hda-benchmark-mfccmel" xt_mel_s16.raw xt_mel_s24.raw xt_mel_s32.raw "Xtensa MFCC Mel" |
| 52 | + fi |
| 53 | +} |
| 54 | + |
| 55 | +main "$@" |
0 commit comments