Skip to content

P20 eq iir - convert the eq_iir module to only use the sink/source api - #11234

Merged
lgirdwood merged 1 commit into
thesofproject:mainfrom
piotrhoppeintel:p20-eq-iir
Oct 13, 2026
Merged

lgirdwood merged 1 commit into
thesofproject:mainfrom
piotrhoppeintel:p20-eq-iir

Conversation

@piotrhoppeintel

Copy link
Copy Markdown
Contributor

Rework the eq_iir 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

🟢 Approval recommended

No unresolved review issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Reworks the EQ IIR module to use the sink/source API for Pipeline 2.0 compatibility.

Changes:

  • Migrates processing and circular-buffer handling to sink/source APIs.
  • Updates EQ, passthrough, and format-conversion callbacks.
  • Adapts unit tests to the new processing interface.
File Description
test/​cmocka/​src/​audio/​eq_iir/​eq_iir_process.c Updates EQ IIR tests for sink/source processing.
src/​audio/​eq_iir/​eq_iir.h Updates processing interfaces and state.
src/​audio/​eq_iir/​eq_iir.c Integrates sink/source processing and preparation.
src/​audio/​eq_iir/​eq_iir_ipc3.c Adapts IPC3 format-conversion routines.
src/​audio/​eq_iir/​eq_iir_generic.c Migrates generic IIR and passthrough processing.

💡 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_iir/eq_iir.c
size_t frame_count;
int ret;

if (num_input_buffers != 1 || num_output_buffers != 1) {

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.

do we commonly check this in all / most modules? This is a hot path, wouldn't it be enough to check this where buffers / connections are configured?

@lgirdwood lgirdwood Sep 28, 2026 •

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.

ack, we could actually put this in a cold path and have a simpler helper too. This shouldn't block this, @piotrhoppeintel we should follow up in another PR as I suspect we have copy and paste for this in more than 1 place.

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.

We dont need to check it every process call. One check in prepare should be fine.

@lgirdwood

Copy link
Copy Markdown
Member

@piotrhoppeintel 1 CI open.

@softwarecki softwarecki 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.

Please check variable types in every processing function.

Comment thread src/audio/eq_iir/eq_iir.c Outdated

source = sources[0];
sink = sinks[0];
cd->channels = source_get_channels(source);

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.

Do we need this in every process call?

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. The line has been removed.

Comment thread src/audio/eq_iir/eq_iir.c Outdated
&source_buf.buf_start, &source_buf_size);
if (ret < 0)
return ret;
if (source_buf_size < source_bytes) {

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.

Is it possible?

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. The redundant check has been removed.

Comment thread src/audio/eq_iir/eq_iir.c Outdated
source_release_data(source, 0);
return ret;
}
if (sink_buf_size < sink_bytes) {

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.

ditto

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. The redundant check has been removed.

Comment thread src/audio/eq_iir/eq_iir.c Outdated
if (!sourceb || !sinkb) {
/* EQ component will only ever have 1 source and 1 sink buffer. */
if (num_of_sources != 1 || num_of_sinks != 1) {
comp_err(dev, "no source or sink buffer");

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.

Fix error msg

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_iir/eq_iir.c
comp_err(dev, "source and sink channel counts do not match");
return -EINVAL;
}
cd->channels = channels;

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.

cd is filled here, so doing it in process is redundant.

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. The redundant in process function has been removed.

Comment thread src/audio/eq_iir/eq_iir.h Outdated
struct output_stream_buffer *bsink, uint32_t frames);
typedef void (*eq_iir_func)(struct processing_module *mod,
struct cir_buf_source *source,
struct cir_buf_sink *sink, uint32_t frames);

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.

frames as size_t

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_iir/eq_iir.h Outdated
int32_t *iir_delay; /**< pointer to allocated RAM */
size_t config_size; /**< configuration size */
size_t iir_delay_size; /**< allocated size */
int channels; /**< number of channels */

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.

unsigned int

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_iir/eq_iir_generic.c Outdated
int j;
int n;
const int nch = audio_stream_get_channels(source);
const int nch = cd->channels;

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.

unsigned int

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_iir/eq_iir_generic.c Outdated
int n;
const int nch = audio_stream_get_channels(source);
const int nch = cd->channels;
const int samples = frames * nch;

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.

size_t here and below

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_iir/eq_iir_generic.c Outdated

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.

static size_t eq_iir_init_coef(struct processing_module *mod, unsigned int nch)

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_iir/eq_iir_generic.c Outdated

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.

size_t

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_iir/eq_iir_generic.c Outdated

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.

unsigned int

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_iir/eq_iir_generic.c Outdated

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.

unsigned int nch

Comment thread src/audio/eq_iir/eq_iir_generic.c Outdated

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.

unsigned int i;

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_iir/eq_iir_generic.c Outdated
void eq_iir_pass(struct processing_module *mod, struct input_stream_buffer *bsource,
struct output_stream_buffer *bsink, uint32_t frames)
void eq_iir_pass(struct processing_module *mod, struct cir_buf_source *source,
struct cir_buf_sink *sink, uint32_t frames)

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.

size_t frames

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_iir/eq_iir_generic.c Outdated
int eq_iir_setup(struct processing_module *mod, int nch)
{
struct comp_data *cd = module_get_private_data(mod);
int delay_size;

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.

size_t

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_iir/eq_iir.h Outdated
struct cir_buf_sink *sink, uint32_t frames);

int eq_iir_new_blob(struct processing_module *mod, enum sof_ipc_frame source_format,
enum sof_ipc_frame sink_format, int channels);

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.

unsigned int channels

Comment thread src/audio/eq_iir/eq_iir.c Outdated
struct sof_sink *sink;
enum sof_ipc_frame source_format;
enum sof_ipc_frame sink_format;
int channels;

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.

unsigned int

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.

Migrate EQ IIR processing from legacy stream buffers to the source/sink
module API. Use circular buffer views for generic processing and IPC3
S32-to-S16/S24 conversion paths, with exact source release and sink
commit handling.

Signed-off-by: Piotr Hoppe <piotr.hoppe@intel.com>
@intel-sofci

Copy link
Copy Markdown

PR 11234: test results

Run date: 2026-10-13 08:13 UTC

Tested commit: 649d255b1f7ef7424d4da53fb67d5e5d5591e7ef

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

Comment thread src/audio/eq_iir/eq_iir.c
size_t source_bytes;
size_t sink_bytes;
size_t source_buf_size;
size_t sink_buf_size;

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.

source_frame_bytes and sink_frame_bytes seem unnecessary, as they are used only once. The corresponding expressions could be inlined at the call sites, which would reduce the number of temporary variables.

source_buf_size and sink_buf_size could be merged into a single variable.

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 do this as a followup, I'd like to give full e2e P20 pipelines a good run in CI to shake out any integration issues over next few weeks.

@lgirdwood
lgirdwood merged commit 1061bcd into thesofproject:main Oct 13, 2026
46 checks passed
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.

6 participants