Skip to content

P20 eq fir convert the eq_fir module to only use the sink/source api - #11221

Open
piotrhoppeintel wants to merge 2 commits into
thesofproject:mainfrom
piotrhoppeintel:p20-eq-fir
Open

piotrhoppeintel wants to merge 2 commits into
thesofproject:mainfrom
piotrhoppeintel:p20-eq-fir

Conversation

@piotrhoppeintel

@piotrhoppeintel piotrhoppeintel commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 High severity · 1 Low severity

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_fir processing entrypoint to module_interface.process() and implement processing using sof_source/sof_sink acquire/commit APIs.
  • Update FIR inner-loop implementations (generic + HiFi variants) to operate on cir_buf_source/cir_buf_sink views.
  • 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.

Comment thread src/audio/eq_fir/eq_fir.c
Comment on lines +437 to +440
if (buffer_size < source_bytes) {
source_release_data(source, 0);
return -ENOSPC;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment thread src/audio/eq_fir/eq_fir.c

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@piotrhoppeintel can you resolve the GH comments too. Thanks !

Comment thread src/audio/eq_fir/eq_fir_hifi2ep.c Outdated
fir_get_lrshifts(f, &lshift, &rshift);
fir_hifiep_setup_circular(f);
y0 = snk + ch;
fir_32x16(f, src[ch], y0, lshift, rshift);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like the indentation is wrong here unless its the GH diff rendering ?

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>

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First commit looks good, I'd like @singalsu to sign of the variable naming change in second commit.

int max_samples;
int chunk_samples;
int sample_index;
int channel;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@singalsu Can you quickly check just the generic naming approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants