P20 eq fir convert the eq_fir module to only use the sink/source api - #11221
piotrhoppeintel wants to merge 2 commits into
Conversation
Replace legacy input/output buffer processing with the source/sink API. Handle circular-buffer wrapping in FIR kernels and use direct source-to-sink copy for pass-through operation. Validate matching source and sink formats and add tests for invalid configurations and odd frame counts. Signed-off-by: Piotr Hoppe <piotr.hoppe@intel.com>
Replace abbreviated local variable names with descriptive names across the generic, HiFi2EP, and HiFi3 EQ FIR implementations. Clarify channel, sample, pointer, filter, and stride handling without changing processing behavior. Signed-off-by: Piotr Hoppe <piotr.hoppe@intel.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
eq_fir_process() returns -ENOSPC for fatal buffer-capacity mismatches, which can be silently treated as non-fatal by module_process_sink_src(), masking real errors and risking stalled processing.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
Converts the eq_fir audio module (and its cmocka coverage) from legacy audio_stream buffer handling to the sink/source API, aligning it with the pipeline 2.0 direction.
Changes:
- Switch
eq_firprocessing entrypoint tomodule_interface.process()and implement processing usingsof_source/sof_sinkacquire/commit APIs. - Update FIR inner-loop implementations (generic + HiFi variants) to operate on
cir_buf_source/cir_buf_sinkviews. - Extend cmocka tests to prepare/process via sink/source APIs and add negative/config/alignment-related test cases.
| File | Description |
|---|---|
| test/cmocka/src/audio/eq_fir/eq_fir_process.c | Updates unit tests to use sink/source prepare + processing, and adds new validation/alignment tests. |
| src/audio/eq_fir/eq_fir.h | Updates FIR function signatures to take circular buffer views and explicit channel count. |
| src/audio/eq_fir/eq_fir.c | Reworks module processing + prepare to use sink/source APIs and passthrough via source_to_sink_copy(). |
| src/audio/eq_fir/eq_fir_hifi3.c | Adapts HiFi3 optimized FIR processing to circular buffer view API. |
| src/audio/eq_fir/eq_fir_hifi2ep.c | Adapts HiFi2EP optimized FIR processing to circular buffer view API. |
| src/audio/eq_fir/eq_fir_generic.c | Adapts generic FIR processing to circular buffer view API. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (buffer_size < source_bytes) { | ||
| source_release_data(source, 0); | ||
| return -ENOSPC; | ||
| } |
| /* copy and process stream data from source to sink buffers */ | ||
| static int eq_fir_process(struct processing_module *mod, | ||
| struct input_stream_buffer *input_buffers, | ||
| int num_input_buffers, | ||
| struct output_stream_buffer *output_buffers, | ||
| int num_output_buffers) | ||
| struct sof_source **sources, int num_of_sources, | ||
| struct sof_sink **sinks, int num_of_sinks) |
lgirdwood
left a comment
There was a problem hiding this comment.
@piotrhoppeintel can you resolve the GH comments too. Thanks !
| fir_get_lrshifts(f, &lshift, &rshift); | ||
| fir_hifiep_setup_circular(f); | ||
| y0 = snk + ch; | ||
| fir_32x16(f, src[ch], y0, lshift, rshift); |
There was a problem hiding this comment.
looks like the indentation is wrong here unless its the GH diff rendering ?


Rework the crossover module to only use the sink/source api to
prepare the SOF for the full transition to pipeline 2.0.