From e0d6c029b86b0db16ac600fbbf7004a093a873f4 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Mon, 27 Apr 2026 13:12:36 +0300 Subject: [PATCH 1/5] Tools: Testbench: Fix capture topology prepare failure in file component For capture topologies the file write component acts as the host (sink endpoint). Its ipc_config.type was left as SOF_COMP_MODULE_ADAPTER, which caused module_adapter_prepare() to fail with 'no sink present on period size calculation' because the capture host has no downstream sinks in its bsink_list. As the fix set ipc_config.type to SOF_COMP_HOST for the capture host file component (FILE_WRITE with capture direction) so the sink check in module_adapter_prepare() is properly skipped, matching the behavior of SOF_COMP_DAI set for the DAI-side file components. Signed-off-by: Seppo Ingalsuo --- tools/testbench/file.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testbench/file.c b/tools/testbench/file.c index 282dc509cce0..18fb96481564 100644 --- a/tools/testbench/file.c +++ b/tools/testbench/file.c @@ -27,7 +27,6 @@ #include "testbench/file_ipc4.h" #include "../../src/audio/copier/copier.h" - SOF_DEFINE_REG_UUID(file); DECLARE_TR_CTX(file_tr, SOF_UUID(file_uuid), LOG_LEVEL_INFO); LOG_MODULE_REGISTER(file, CONFIG_SOF_LOG_LEVEL); @@ -669,7 +668,8 @@ static int file_init(struct processing_module *mod) } /* Change to DAI type is needed to avoid uninitialized hw params in - * pipeline_params, A file host can be left as SOF_COMP_MODULE_ADAPTER + * pipeline_params. For capture the file write is the host so set + * SOF_COMP_HOST to skip sink check in module_adapter_prepare(). */ if (dev->direction == SOF_IPC_STREAM_PLAYBACK) { dev->ipc_config.type = SOF_COMP_DAI; @@ -678,6 +678,8 @@ static int file_init(struct processing_module *mod) fprintf(stderr, "error: failed set dai data.\n"); goto error; } + } else { + dev->ipc_config.type = SOF_COMP_HOST; } break; From c6220a8cb5b468127985c5e85326e576505b42ce Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Mon, 27 Apr 2026 15:41:26 +0300 Subject: [PATCH 2/5] Tools: Topology: Delete unused test topology .conf The files host_io_gateway_pipelines_s16/24/32.conf are obsolete and are not used for current test topologies. Signed-off-by: Seppo Ingalsuo --- .../bench/host_io_gateway_pipelines_s16.conf | 126 ------------------ .../bench/host_io_gateway_pipelines_s24.conf | 126 ------------------ .../bench/host_io_gateway_pipelines_s32.conf | 126 ------------------ 3 files changed, 378 deletions(-) delete mode 100644 tools/topology/topology2/include/bench/host_io_gateway_pipelines_s16.conf delete mode 100644 tools/topology/topology2/include/bench/host_io_gateway_pipelines_s24.conf delete mode 100644 tools/topology/topology2/include/bench/host_io_gateway_pipelines_s32.conf diff --git a/tools/topology/topology2/include/bench/host_io_gateway_pipelines_s16.conf b/tools/topology/topology2/include/bench/host_io_gateway_pipelines_s16.conf deleted file mode 100644 index b6ecea830367..000000000000 --- a/tools/topology/topology2/include/bench/host_io_gateway_pipelines_s16.conf +++ /dev/null @@ -1,126 +0,0 @@ - Object.Pipeline { - host-gateway-playback [ - { - index 1 - - Object.Widget.host-copier.1 { - stream_name $ANALOG_PLAYBACK_PCM - pcm_id 0 - num_input_audio_formats 3 - num_output_audio_formats 1 - Object.Base.input_audio_format [ - { - in_bit_depth 16 - in_valid_bit_depth 16 - } - { - in_bit_depth 32 - in_valid_bit_depth 24 - } - { - in_bit_depth 32 - in_valid_bit_depth 32 - } - ] - Object.Base.output_audio_format [ - { - out_bit_depth 16 - out_valid_bit_depth 16 - } - ] - } - } - ] - - io-gateway [ - { - index 2 - direction playback - - Object.Widget.dai-copier.1 { - node_type $HDA_LINK_OUTPUT_CLASS - stream_name $HDA_ANALOG_DAI_NAME - dai_type "HDA" - copier_type "HDA" - num_input_pins 1 - num_input_audio_formats 1 - num_output_audio_formats 1 - Object.Base.input_audio_format [ - { - in_bit_depth 16 - in_valid_bit_depth 16 - } - ] - Object.Base.output_audio_format [ - { - out_bit_depth 32 - out_valid_bit_depth 32 - } - ] - } - } - ] - - host-gateway-capture [ - { - index 3 - Object.Widget.host-copier.1 { - stream_name $ANALOG_CAPTURE_PCM - pcm_id 0 - num_input_audio_formats 1 - num_output_audio_formats 3 - Object.Base.input_audio_format [ - { - in_bit_depth 16 - in_valid_bit_depth 16 - } - ] - Object.Base.output_audio_format [ - { - out_bit_depth 16 - out_valid_bit_depth 16 - } - { - out_bit_depth 32 - out_valid_bit_depth 24 - } - { - out_bit_depth 32 - out_valid_bit_depth 32 - } - ] - } - } - ] - - io-gateway-capture [ - { - index 4 - direction capture - - Object.Widget.dai-copier."1" { - dai_type "HDA" - type "dai_out" - copier_type "HDA" - stream_name $HDA_ANALOG_DAI_NAME - node_type $HDA_LINK_INPUT_CLASS - num_output_pins 1 - num_input_audio_formats 1 - num_output_audio_formats 1 - Object.Base.input_audio_format [ - { - in_bit_depth 32 - in_valid_bit_depth 32 - } - ] - Object.Base.output_audio_format [ - { - out_bit_depth 16 - out_valid_bit_depth 16 - } - ] - } - } - ] - } - diff --git a/tools/topology/topology2/include/bench/host_io_gateway_pipelines_s24.conf b/tools/topology/topology2/include/bench/host_io_gateway_pipelines_s24.conf deleted file mode 100644 index 4cac2acd2b8b..000000000000 --- a/tools/topology/topology2/include/bench/host_io_gateway_pipelines_s24.conf +++ /dev/null @@ -1,126 +0,0 @@ - Object.Pipeline { - host-gateway-playback [ - { - index 1 - - Object.Widget.host-copier.1 { - stream_name $ANALOG_PLAYBACK_PCM - pcm_id 0 - num_input_audio_formats 3 - num_output_audio_formats 1 - Object.Base.input_audio_format [ - { - in_bit_depth 16 - in_valid_bit_depth 16 - } - { - in_bit_depth 32 - in_valid_bit_depth 24 - } - { - in_bit_depth 32 - in_valid_bit_depth 32 - } - ] - Object.Base.output_audio_format [ - { - out_bit_depth 32 - out_valid_bit_depth 24 - } - ] - } - } - ] - - io-gateway [ - { - index 2 - direction playback - - Object.Widget.dai-copier.1 { - node_type $HDA_LINK_OUTPUT_CLASS - stream_name $HDA_ANALOG_DAI_NAME - dai_type "HDA" - copier_type "HDA" - num_input_pins 1 - num_input_audio_formats 1 - num_output_audio_formats 1 - Object.Base.input_audio_format [ - { - in_bit_depth 32 - in_valid_bit_depth 24 - } - ] - Object.Base.output_audio_format [ - { - out_bit_depth 32 - out_valid_bit_depth 32 - } - ] - } - } - ] - - host-gateway-capture [ - { - index 3 - Object.Widget.host-copier.1 { - stream_name $ANALOG_CAPTURE_PCM - pcm_id 0 - num_input_audio_formats 1 - num_output_audio_formats 3 - Object.Base.input_audio_format [ - { - in_bit_depth 32 - in_valid_bit_depth 24 - } - ] - Object.Base.output_audio_format [ - { - out_bit_depth 16 - out_valid_bit_depth 16 - } - { - out_bit_depth 32 - out_valid_bit_depth 24 - } - { - out_bit_depth 32 - out_valid_bit_depth 32 - } - ] - } - } - ] - - io-gateway-capture [ - { - index 4 - direction capture - - Object.Widget.dai-copier."1" { - dai_type "HDA" - type "dai_out" - copier_type "HDA" - stream_name $HDA_ANALOG_DAI_NAME - node_type $HDA_LINK_INPUT_CLASS - num_output_pins 1 - num_input_audio_formats 1 - num_output_audio_formats 1 - Object.Base.input_audio_format [ - { - in_bit_depth 32 - in_valid_bit_depth 32 - } - ] - Object.Base.output_audio_format [ - { - out_bit_depth 32 - out_valid_bit_depth 24 - } - ] - } - } - ] - } - diff --git a/tools/topology/topology2/include/bench/host_io_gateway_pipelines_s32.conf b/tools/topology/topology2/include/bench/host_io_gateway_pipelines_s32.conf deleted file mode 100644 index c598efcd3e06..000000000000 --- a/tools/topology/topology2/include/bench/host_io_gateway_pipelines_s32.conf +++ /dev/null @@ -1,126 +0,0 @@ - Object.Pipeline { - host-gateway-playback [ - { - index 1 - - Object.Widget.host-copier.1 { - stream_name $ANALOG_PLAYBACK_PCM - pcm_id 0 - num_input_audio_formats 3 - num_output_audio_formats 1 - Object.Base.input_audio_format [ - { - in_bit_depth 16 - in_valid_bit_depth 16 - } - { - in_bit_depth 32 - in_valid_bit_depth 24 - } - { - in_bit_depth 32 - in_valid_bit_depth 32 - } - ] - Object.Base.output_audio_format [ - { - out_bit_depth 32 - out_valid_bit_depth 32 - } - ] - } - } - ] - - io-gateway [ - { - index 2 - direction playback - - Object.Widget.dai-copier.1 { - node_type $HDA_LINK_OUTPUT_CLASS - stream_name $HDA_ANALOG_DAI_NAME - dai_type "HDA" - copier_type "HDA" - num_input_pins 1 - num_input_audio_formats 1 - num_output_audio_formats 1 - Object.Base.input_audio_format [ - { - in_bit_depth 32 - in_valid_bit_depth 32 - } - ] - Object.Base.output_audio_format [ - { - out_bit_depth 32 - out_valid_bit_depth 32 - } - ] - } - } - ] - - host-gateway-capture [ - { - index 3 - Object.Widget.host-copier.1 { - stream_name $ANALOG_CAPTURE_PCM - pcm_id 0 - num_input_audio_formats 1 - num_output_audio_formats 3 - Object.Base.input_audio_format [ - { - in_bit_depth 32 - in_valid_bit_depth 32 - } - ] - Object.Base.output_audio_format [ - { - out_bit_depth 16 - out_valid_bit_depth 16 - } - { - out_bit_depth 32 - out_valid_bit_depth 24 - } - { - out_bit_depth 32 - out_valid_bit_depth 32 - } - ] - } - } - ] - - io-gateway-capture [ - { - index 4 - direction capture - - Object.Widget.dai-copier."1" { - dai_type "HDA" - type "dai_out" - copier_type "HDA" - stream_name $HDA_ANALOG_DAI_NAME - node_type $HDA_LINK_INPUT_CLASS - num_output_pins 1 - num_input_audio_formats 1 - num_output_audio_formats 1 - Object.Base.input_audio_format [ - { - in_bit_depth 32 - in_valid_bit_depth 32 - } - ] - Object.Base.output_audio_format [ - { - out_bit_depth 32 - out_valid_bit_depth 32 - } - ] - } - } - ] - } - From 306fbeb2c5ad03eabecd0fdfac16a9cee0b13a01 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Mon, 27 Apr 2026 15:39:47 +0300 Subject: [PATCH 3/5] Tools: Topology: Add test topologies for MFCC There was earlier only topology1 for MFCC. This patch adds topologies sof-hda-benchmark-mfcc16/24/32.tplg to be able to test the component in testbench environment. Note: Due to the set 16 kHz DAI rate these can't be used in real devices. It will need a capture pipeline with 48 kHz to 16 kHz SRC. Signed-off-by: Seppo Ingalsuo --- .../topology2/cavs-benchmark-hda.conf | 17 +++++ .../topology2/cavs-benchmark-sdw.conf | 7 ++ .../development/tplg-targets-bench.cmake | 2 + .../bench/host_gateway_pipelines_s16_16k.conf | 74 +++++++++++++++++++ .../bench/host_gateway_pipelines_s24_16k.conf | 74 +++++++++++++++++++ .../bench/host_gateway_pipelines_s32_16k.conf | 74 +++++++++++++++++++ .../include/bench/mfcc_controls_capture.conf | 17 +++++ .../include/bench/mfcc_controls_playback.conf | 17 +++++ .../topology2/include/bench/mfcc_route.conf | 19 +++++ .../topology2/include/bench/mfcc_s16.conf | 13 ++++ .../topology2/include/bench/mfcc_s24.conf | 13 ++++ .../topology2/include/bench/mfcc_s32.conf | 13 ++++ .../one_input_output_format_s16_16k.conf | 19 +++++ .../one_input_output_format_s24_16k.conf | 19 +++++ .../one_input_output_format_s32_16k.conf | 19 +++++ 15 files changed, 397 insertions(+) create mode 100644 tools/topology/topology2/include/bench/host_gateway_pipelines_s16_16k.conf create mode 100644 tools/topology/topology2/include/bench/host_gateway_pipelines_s24_16k.conf create mode 100644 tools/topology/topology2/include/bench/host_gateway_pipelines_s32_16k.conf create mode 100644 tools/topology/topology2/include/bench/mfcc_controls_capture.conf create mode 100644 tools/topology/topology2/include/bench/mfcc_controls_playback.conf create mode 100644 tools/topology/topology2/include/bench/mfcc_route.conf create mode 100644 tools/topology/topology2/include/bench/mfcc_s16.conf create mode 100644 tools/topology/topology2/include/bench/mfcc_s24.conf create mode 100644 tools/topology/topology2/include/bench/mfcc_s32.conf create mode 100644 tools/topology/topology2/include/bench/one_input_output_format_s16_16k.conf create mode 100644 tools/topology/topology2/include/bench/one_input_output_format_s24_16k.conf create mode 100644 tools/topology/topology2/include/bench/one_input_output_format_s32_16k.conf diff --git a/tools/topology/topology2/cavs-benchmark-hda.conf b/tools/topology/topology2/cavs-benchmark-hda.conf index 6ee4b3e11882..62c0ad4f4fbc 100644 --- a/tools/topology/topology2/cavs-benchmark-hda.conf +++ b/tools/topology/topology2/cavs-benchmark-hda.conf @@ -40,6 +40,7 @@ + @@ -817,6 +818,22 @@ IncludeByKey.BENCH_CONFIG { } + # + # MFCC component + # + + "mfcc16" { + + } + + "mfcc24" { + + } + + "mfcc32" { + + } + # # Micsel component # diff --git a/tools/topology/topology2/cavs-benchmark-sdw.conf b/tools/topology/topology2/cavs-benchmark-sdw.conf index 98f08c7e13da..1705facb4cc0 100644 --- a/tools/topology/topology2/cavs-benchmark-sdw.conf +++ b/tools/topology/topology2/cavs-benchmark-sdw.conf @@ -39,6 +39,7 @@ + @@ -440,6 +441,12 @@ IncludeByKey.BENCH_CONFIG { } + # MFCC benchmark configs are intentionally not enabled in the SDW + # benchmark topology because the SDW ALH DAI/coprocessor side is + # constrained to $JACK_RATE while MFCC bench configs operate in a + # different rate domain. Re-enable only after adding a matching rate + # override or explicit sample-rate conversion. + # # Micsel component # diff --git a/tools/topology/topology2/development/tplg-targets-bench.cmake b/tools/topology/topology2/development/tplg-targets-bench.cmake index 0336fa9d4107..eff707d49aa9 100644 --- a/tools/topology/topology2/development/tplg-targets-bench.cmake +++ b/tools/topology/topology2/development/tplg-targets-bench.cmake @@ -18,6 +18,7 @@ set(components "gain" "igo_nr" "level_multiplier" + "mfcc" "micsel" "rtnr" "sound_dose" @@ -43,6 +44,7 @@ set(component_parameters "BENCH_GAIN_PARAMS=default" "BENCH_IGO_NR_PARAMS=default" "BENCH_LEVEL_MULTIPLIER_PARAMS=default" + "BENCH_MFCC_PARAMS=default" "BENCH_MICSEL_PARAMS=passthrough" "BENCH_RTNR_PARAMS=default" "BENCH_SOUND_DOSE_PARAMS=default" diff --git a/tools/topology/topology2/include/bench/host_gateway_pipelines_s16_16k.conf b/tools/topology/topology2/include/bench/host_gateway_pipelines_s16_16k.conf new file mode 100644 index 000000000000..483a087a885f --- /dev/null +++ b/tools/topology/topology2/include/bench/host_gateway_pipelines_s16_16k.conf @@ -0,0 +1,74 @@ + Object.Pipeline { + host-gateway-playback [ + { + index $BENCH_PLAYBACK_HOST_PIPELINE + Object.Widget.host-copier.1 { + stream_name $ANALOG_PLAYBACK_PCM + pcm_id 0 + num_input_audio_formats 3 + num_output_audio_formats 1 + Object.Base.input_audio_format [ + { + in_bit_depth 16 + in_valid_bit_depth 16 + in_rate 16000 + } + { + in_bit_depth 32 + in_valid_bit_depth 24 + in_rate 16000 + } + { + in_bit_depth 32 + in_valid_bit_depth 32 + in_rate 16000 + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 16 + out_valid_bit_depth 16 + out_rate 16000 + } + ] + } + } + ] + + host-gateway-capture [ + { + index $BENCH_CAPTURE_HOST_PIPELINE + Object.Widget.host-copier.1 { + stream_name $ANALOG_CAPTURE_PCM + pcm_id 0 + num_input_audio_formats 1 + num_output_audio_formats 3 + Object.Base.input_audio_format [ + { + in_bit_depth 16 + in_valid_bit_depth 16 + in_rate 16000 + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 16 + out_valid_bit_depth 16 + out_rate 16000 + } + { + out_bit_depth 32 + out_valid_bit_depth 24 + out_rate 16000 + } + { + out_bit_depth 32 + out_valid_bit_depth 32 + out_rate 16000 + } + ] + } + } + ] + } + diff --git a/tools/topology/topology2/include/bench/host_gateway_pipelines_s24_16k.conf b/tools/topology/topology2/include/bench/host_gateway_pipelines_s24_16k.conf new file mode 100644 index 000000000000..4fc5b1eaf715 --- /dev/null +++ b/tools/topology/topology2/include/bench/host_gateway_pipelines_s24_16k.conf @@ -0,0 +1,74 @@ + Object.Pipeline { + host-gateway-playback [ + { + index $BENCH_PLAYBACK_HOST_PIPELINE + Object.Widget.host-copier.1 { + stream_name $ANALOG_PLAYBACK_PCM + pcm_id 0 + num_input_audio_formats 3 + num_output_audio_formats 1 + Object.Base.input_audio_format [ + { + in_bit_depth 16 + in_valid_bit_depth 16 + in_rate 16000 + } + { + in_bit_depth 32 + in_valid_bit_depth 24 + in_rate 16000 + } + { + in_bit_depth 32 + in_valid_bit_depth 32 + in_rate 16000 + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 32 + out_valid_bit_depth 24 + out_rate 16000 + } + ] + } + } + ] + + host-gateway-capture [ + { + index $BENCH_CAPTURE_HOST_PIPELINE + Object.Widget.host-copier.1 { + stream_name $ANALOG_CAPTURE_PCM + pcm_id 0 + num_input_audio_formats 1 + num_output_audio_formats 3 + Object.Base.input_audio_format [ + { + in_bit_depth 32 + in_valid_bit_depth 24 + in_rate 16000 + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 16 + out_valid_bit_depth 16 + out_rate 16000 + } + { + out_bit_depth 32 + out_valid_bit_depth 24 + out_rate 16000 + } + { + out_bit_depth 32 + out_valid_bit_depth 32 + out_rate 16000 + } + ] + } + } + ] + } + diff --git a/tools/topology/topology2/include/bench/host_gateway_pipelines_s32_16k.conf b/tools/topology/topology2/include/bench/host_gateway_pipelines_s32_16k.conf new file mode 100644 index 000000000000..229e686feeba --- /dev/null +++ b/tools/topology/topology2/include/bench/host_gateway_pipelines_s32_16k.conf @@ -0,0 +1,74 @@ + Object.Pipeline { + host-gateway-playback [ + { + index $BENCH_PLAYBACK_HOST_PIPELINE + Object.Widget.host-copier.1 { + stream_name $ANALOG_PLAYBACK_PCM + pcm_id 0 + num_input_audio_formats 3 + num_output_audio_formats 1 + Object.Base.input_audio_format [ + { + in_bit_depth 16 + in_valid_bit_depth 16 + in_rate 16000 + } + { + in_bit_depth 32 + in_valid_bit_depth 24 + in_rate 16000 + } + { + in_bit_depth 32 + in_valid_bit_depth 32 + in_rate 16000 + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 32 + out_valid_bit_depth 32 + out_rate 16000 + } + ] + } + } + ] + + host-gateway-capture [ + { + index $BENCH_CAPTURE_HOST_PIPELINE + Object.Widget.host-copier.1 { + stream_name $ANALOG_CAPTURE_PCM + pcm_id 0 + num_input_audio_formats 1 + num_output_audio_formats 3 + Object.Base.input_audio_format [ + { + in_bit_depth 32 + in_valid_bit_depth 32 + in_rate 16000 + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 16 + out_valid_bit_depth 16 + out_rate 16000 + } + { + out_bit_depth 32 + out_valid_bit_depth 24 + out_rate 16000 + } + { + out_bit_depth 32 + out_valid_bit_depth 32 + out_rate 16000 + } + ] + } + } + ] + } + diff --git a/tools/topology/topology2/include/bench/mfcc_controls_capture.conf b/tools/topology/topology2/include/bench/mfcc_controls_capture.conf new file mode 100644 index 000000000000..56a731b86687 --- /dev/null +++ b/tools/topology/topology2/include/bench/mfcc_controls_capture.conf @@ -0,0 +1,17 @@ + # Created initially with script "./bench_comp_generate.sh mfcc" + # may need edits to modify controls + Object.Control { + # Un-comment the supported controls in MFCC + bytes."1" { + name '$ANALOG_CAPTURE_PCM MFCC bytes' + IncludeByKey.BENCH_MFCC_PARAMS { + "default" "include/components/mfcc/default.conf" + } + } + #mixer."1" { + # name '$ANALOG_CAPTURE_PCM MFCC switch or volume' + #} + #enum."1" { + # name '$ANALOG_CAPTURE_PCM MFCC enum' + #} + } diff --git a/tools/topology/topology2/include/bench/mfcc_controls_playback.conf b/tools/topology/topology2/include/bench/mfcc_controls_playback.conf new file mode 100644 index 000000000000..7649678c8468 --- /dev/null +++ b/tools/topology/topology2/include/bench/mfcc_controls_playback.conf @@ -0,0 +1,17 @@ + # Created initially with script "./bench_comp_generate.sh mfcc" + # may need edits to modify controls + Object.Control { + # Un-comment the supported controls in MFCC + bytes."1" { + name '$ANALOG_PLAYBACK_PCM MFCC bytes' + IncludeByKey.BENCH_MFCC_PARAMS { + "default" "include/components/mfcc/default.conf" + } + } + #mixer."1" { + # name '$ANALOG_PLAYBACK_PCM MFCC switch or volume' + #} + #enum."1" { + # name '$ANALOG_PLAYBACK_PCM MFCC enum' + #} + } diff --git a/tools/topology/topology2/include/bench/mfcc_route.conf b/tools/topology/topology2/include/bench/mfcc_route.conf new file mode 100644 index 000000000000..d4ce9af5f85d --- /dev/null +++ b/tools/topology/topology2/include/bench/mfcc_route.conf @@ -0,0 +1,19 @@ + # Created with script "./bench_comp_generate.sh mfcc" + Object.Base.route [ + { + sink '$BENCH_PLAYBACK_DAI_COPIER' + source 'mfcc.$BENCH_PLAYBACK_HOST_PIPELINE.1' + } + { + sink 'mfcc.$BENCH_PLAYBACK_HOST_PIPELINE.1' + source 'host-copier.0.playback' + } + { + source '$BENCH_CAPTURE_DAI_COPIER' + sink 'mfcc.$BENCH_CAPTURE_HOST_PIPELINE.2' + } + { + source 'mfcc.$BENCH_CAPTURE_HOST_PIPELINE.2' + sink 'host-copier.0.capture' + } + ] diff --git a/tools/topology/topology2/include/bench/mfcc_s16.conf b/tools/topology/topology2/include/bench/mfcc_s16.conf new file mode 100644 index 000000000000..ec89bffb90a1 --- /dev/null +++ b/tools/topology/topology2/include/bench/mfcc_s16.conf @@ -0,0 +1,13 @@ + # Created with script "./bench_comp_generate.sh mfcc" + Object.Widget.mfcc.1 { + index $BENCH_PLAYBACK_HOST_PIPELINE + + + } + Object.Widget.mfcc.2 { + index $BENCH_CAPTURE_HOST_PIPELINE + + + } + + diff --git a/tools/topology/topology2/include/bench/mfcc_s24.conf b/tools/topology/topology2/include/bench/mfcc_s24.conf new file mode 100644 index 000000000000..73571fabe5f2 --- /dev/null +++ b/tools/topology/topology2/include/bench/mfcc_s24.conf @@ -0,0 +1,13 @@ + # Created with script "./bench_comp_generate.sh mfcc" + Object.Widget.mfcc.1 { + index $BENCH_PLAYBACK_HOST_PIPELINE + + + } + Object.Widget.mfcc.2 { + index $BENCH_CAPTURE_HOST_PIPELINE + + + } + + diff --git a/tools/topology/topology2/include/bench/mfcc_s32.conf b/tools/topology/topology2/include/bench/mfcc_s32.conf new file mode 100644 index 000000000000..75c01eaf4a43 --- /dev/null +++ b/tools/topology/topology2/include/bench/mfcc_s32.conf @@ -0,0 +1,13 @@ + # Created with script "./bench_comp_generate.sh mfcc" + Object.Widget.mfcc.1 { + index $BENCH_PLAYBACK_HOST_PIPELINE + + + } + Object.Widget.mfcc.2 { + index $BENCH_CAPTURE_HOST_PIPELINE + + + } + + diff --git a/tools/topology/topology2/include/bench/one_input_output_format_s16_16k.conf b/tools/topology/topology2/include/bench/one_input_output_format_s16_16k.conf new file mode 100644 index 000000000000..eca8c45d8bc9 --- /dev/null +++ b/tools/topology/topology2/include/bench/one_input_output_format_s16_16k.conf @@ -0,0 +1,19 @@ + num_input_audio_formats 1 + num_output_audio_formats 1 + + # 16-bit 16kHz + Object.Base.input_audio_format [ + { + in_bit_depth 16 + in_valid_bit_depth 16 + in_rate 16000 + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 16 + out_valid_bit_depth 16 + out_rate 16000 + } + ] + diff --git a/tools/topology/topology2/include/bench/one_input_output_format_s24_16k.conf b/tools/topology/topology2/include/bench/one_input_output_format_s24_16k.conf new file mode 100644 index 000000000000..742151e6948d --- /dev/null +++ b/tools/topology/topology2/include/bench/one_input_output_format_s24_16k.conf @@ -0,0 +1,19 @@ + num_input_audio_formats 1 + num_output_audio_formats 1 + + # 24-bit 16kHz + Object.Base.input_audio_format [ + { + in_bit_depth 32 + in_valid_bit_depth 24 + in_rate 16000 + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 32 + out_valid_bit_depth 24 + out_rate 16000 + } + ] + diff --git a/tools/topology/topology2/include/bench/one_input_output_format_s32_16k.conf b/tools/topology/topology2/include/bench/one_input_output_format_s32_16k.conf new file mode 100644 index 000000000000..ae4608b5ab76 --- /dev/null +++ b/tools/topology/topology2/include/bench/one_input_output_format_s32_16k.conf @@ -0,0 +1,19 @@ + num_input_audio_formats 1 + num_output_audio_formats 1 + + # 32-bit 16kHz + Object.Base.input_audio_format [ + { + in_bit_depth 32 + in_valid_bit_depth 32 + in_rate 16000 + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 32 + out_valid_bit_depth 32 + out_rate 16000 + } + ] + From e3107ec4668f1c702de28fb3122514a4338a920e Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Mon, 27 Apr 2026 15:44:09 +0300 Subject: [PATCH 4/5] Audio: MFCC: Use sof-testbench4 and topology2 to run the module This patch updates the run script run_mfcc.sh to use topology2 and the current sof-testbech4. Signed-off-by: Seppo Ingalsuo --- tools/tune/mfcc/run_mfcc.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/tune/mfcc/run_mfcc.sh b/tools/tune/mfcc/run_mfcc.sh index 8a48c97b9def..d531e4519755 100755 --- a/tools/tune/mfcc/run_mfcc.sh +++ b/tools/tune/mfcc/run_mfcc.sh @@ -1,16 +1,15 @@ #!/bin/sh # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2022 Intel Corporation. All rights reserved. +# Copyright(c) 2022-2026 Intel Corporation. All rights reserved. set -e RAW_INPUT=in.raw RAW_OUTPUT=mfcc.raw -export LD_LIBRARY_PATH=../../testbench/build_testbench/sof_ep/install/lib:../../testbench/build_testbench/sof_parser/install/lib - -TESTBENCH=../../testbench/build_testbench/install/bin/testbench -OPT="-q -r 16000 -R 16000 -c 1 -n 1 -b S16_LE -t ../../build_tools/test/topology/test-playback-ssp5-mclk-0-I2S-mfcc-s16le-s16le-48k-24576k-codec.tplg" +TESTBENCH=$SOF_WORKSPACE/sof/tools/testbench/build_testbench/install/bin/sof-testbench4 +TOPOLOGY=$SOF_WORKSPACE/sof/tools/build_tools/topology/topology2/development/sof-hda-benchmark-mfcc16.tplg +OPT="-r 16000 -c 2 -b S16_LE -p 3,4 -t $TOPOLOGY -i $RAW_INPUT -o $RAW_OUTPUT" # Convert input audio file raw 16 kHz 1 channel 16 bit sox --encoding signed-integer "$1" -L -r 16000 -c 1 -b 16 "$RAW_INPUT" From 45da55c4ff4aad7af1f2b4448491e6ee0ee70e6c Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Mon, 27 Apr 2026 16:41:36 +0300 Subject: [PATCH 5/5] Audio: MFCC: Move setup and run scripts to module directory This patch moves the files from tools/tune/mfcc to directory src/audio/mfcc/tune. The patchs are fixed for the new location. Signed-off-by: Seppo Ingalsuo --- .../mfcc => src/audio/mfcc/tune}/README.txt | 0 .../audio/mfcc/tune}/decode_ceps.m | 0 .../mfcc => src/audio/mfcc/tune}/run_mfcc.sh | 0 .../mfcc => src/audio/mfcc/tune}/setup_mfcc.m | 19 +++++++++++-------- 4 files changed, 11 insertions(+), 8 deletions(-) rename {tools/tune/mfcc => src/audio/mfcc/tune}/README.txt (100%) rename {tools/tune/mfcc => src/audio/mfcc/tune}/decode_ceps.m (100%) rename {tools/tune/mfcc => src/audio/mfcc/tune}/run_mfcc.sh (100%) rename {tools/tune/mfcc => src/audio/mfcc/tune}/setup_mfcc.m (92%) diff --git a/tools/tune/mfcc/README.txt b/src/audio/mfcc/tune/README.txt similarity index 100% rename from tools/tune/mfcc/README.txt rename to src/audio/mfcc/tune/README.txt diff --git a/tools/tune/mfcc/decode_ceps.m b/src/audio/mfcc/tune/decode_ceps.m similarity index 100% rename from tools/tune/mfcc/decode_ceps.m rename to src/audio/mfcc/tune/decode_ceps.m diff --git a/tools/tune/mfcc/run_mfcc.sh b/src/audio/mfcc/tune/run_mfcc.sh similarity index 100% rename from tools/tune/mfcc/run_mfcc.sh rename to src/audio/mfcc/tune/run_mfcc.sh diff --git a/tools/tune/mfcc/setup_mfcc.m b/src/audio/mfcc/tune/setup_mfcc.m similarity index 92% rename from tools/tune/mfcc/setup_mfcc.m rename to src/audio/mfcc/tune/setup_mfcc.m index 9b27703e98bd..e0d42e1e034d 100644 --- a/tools/tune/mfcc/setup_mfcc.m +++ b/src/audio/mfcc/tune/setup_mfcc.m @@ -5,11 +5,12 @@ % below from code % % Create binary configuration blob for MFCC component. The hex data -% is written to tools/topology/topology1/m4/mfcc/mfcc_config.m4 +% is written to tools/topology/topology2/include/components/mfcc and +% tools/topology/topology1/m4/mfcc. % SPDX-License-Identifier: BSD-3-Clause % -% Copyright (c) 2018-2020, Intel Corporation. All rights reserved. +% Copyright (c) 2018-2026, Intel Corporation. All rights reserved. function setup_mfcc(cfg) @@ -45,12 +46,14 @@ function setup_mfcc(cfg) cfg.top_db = 200; % Set to 80 for librosa end -cfg.tplg_fn = '../../topology/topology1/m4/mfcc/mfcc_config.m4'; +cfg.tools = '../../../../tools/'; + +cfg.tplg_fn = [cfg.tools 'topology/topology1/m4/mfcc/mfcc_config.m4']; cfg.tplg_ver = 1; cfg.ipc_ver = 3; export_mfcc_setup(cfg); -cfg.tplg_fn = '../../topology/topology2/include/components/mfcc/default.conf'; +cfg.tplg_fn = [cfg.tools 'topology/topology2/include/components/mfcc/default.conf']; cfg.tplg_ver = 2; cfg.ipc_ver = 4; export_mfcc_setup(cfg); @@ -60,7 +63,7 @@ function setup_mfcc(cfg) function export_mfcc_setup(cfg) %% Use blob tool from EQ -addpath('../common'); +addpath([cfg.tools 'tune/common']); %% Blob size, size plus reserved(8) + current parameters nbytes_data = 104; @@ -122,16 +125,16 @@ function export_mfcc_setup(cfg) case 1 sof_tplg_write(cfg.tplg_fn, b8, "DEF_MFCC_PRIV", ... "Exported with script setup_mfcc.m", ... - "cd tools/tune/mfcc; octave setup_mfcc.m"); + "cd src/audio/mfcc/tune; octave setup_mfcc.m"); case 2 sof_tplg2_write(cfg.tplg_fn, b8, "mfcc_config", ... "Exported MFCC configuration", ... - "cd tools/tune/mfcc; octave setup_mfcc.m"); + "cd src/audio/mfcc/tune; octave setup_mfcc.m"); otherwise error("Illegal cfg.tplg_ver, use 1 for topology v1 or 2 topology v2."); end -rmpath('../common'); +rmpath([cfg.tools 'tune/common']); end