Skip to content

audio: drc: const-correctness, unsigned/size_t types and comp_buffer removal - #11310

Open
softwarecki wants to merge 4 commits into
thesofproject:mainfrom
softwarecki:p20-drc
Open

softwarecki wants to merge 4 commits into
thesofproject:mainfrom
softwarecki:p20-drc

Conversation

@softwarecki

Copy link
Copy Markdown
Collaborator

Declare the source read pointers const and drop the casts that discarded const. Use source_cir_buf_wrap for the source-side wrap to preserve the qualifier. In the HiFi4 path, switch the sample pointers to ae_int16 and ae_int32 end to end, which also removes the int16_t to ae_int16 bridging casts.

Change the channels field, the channel-count parameters and the per-channel loop counters from int and uint16_t to unsigned int. This matches the type returned by source_get_channels and sink_get_channels and removes the signed/unsigned comparisons.

Convert the frame, sample and byte counts from int and uint32_t to size_t and propagate the type through the dependent locals and the DSP helper signatures.

Convert prepare and the IPC4 params helper to the sink/source API and drop struct comp_buffer uses in the module.

Declare the source read pointers const and drop the casts that discarded
const. Use source_cir_buf_wrap for the source-side wrap to preserve the
const qualifier, and take const void * in the local set_circular helpers.
In the HiFi4 path, switch the sample pointers to ae_int16 and ae_int32
end to end, which also removes the int16_t-to-ae_int16 bridging casts.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Change the channels field, the channel-count parameters and the per-channel
loop counters from int and uint16_t to unsigned int. This matches the type
returned by source_get_channels and sink_get_channels and removes the
signed/unsigned comparisons.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Convert the frame, sample and byte counts from int and uint32_t to size_t
and propagate the type through the dependent locals and the DSP helper
signatures. This aligns with the size_t byte sizes already used by the
sink/source API.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Convert prepare and the IPC4 params helper to the sink/source API and drop
the struct comp_buffer uses in the module.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
@softwarecki
softwarecki requested a review from a team as a code owner October 14, 2026 16:02
Copilot AI balanced review requested due to automatic review settings October 14, 2026 16:02

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.

🟡 Changes recommended

The new prepare cardinality check breaks the existing DRC processing test setup.

1 open finding
What changed in this PR

Improves DRC const-correctness, count types, and adoption of sink/source APIs.

Changes:

  • Uses size_t and unsigned channel counts consistently.
  • Preserves const qualifiers in circular-buffer processing.
  • Removes comp_buffer usage from DRC preparation.
File Description
src/​audio/​drc/​drc.h Updates DRC types and callback signatures.
src/​audio/​drc/​drc.c Migrates preparation to sink/source APIs.
src/​audio/​drc/​drc_hifi4.c Updates HiFi4 pointer and count types.
src/​audio/​drc/​drc_hifi3.c Updates HiFi3 helper signatures.
src/​audio/​drc/​drc_generic.c Updates generic processing types and const handling.
src/​audio/​drc/​drc_algorithm.h Aligns shared algorithm declarations.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/audio/drc/drc.c
Comment on lines +393 to 396
if (num_of_sources != 1 || num_of_sinks != 1) {
comp_err(dev, "expected 1 source and 1 sink, got %d sources and %d sinks",
num_of_sources, num_of_sinks);
return -ENOTCONN;
Comment thread src/audio/drc/drc_hifi4.c
Comment on lines +620 to +621
const ae_int16 *x = source->ptr;
ae_int16 *y = sink->ptr;

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.

Just a query here, do we need to __assume_aligned(vector_size)__ to help the vectorizer, the cast may have helped in the past, not a blocker, just wondering if the compiler is throwing up any info here ?

@intel-sofci

Copy link
Copy Markdown

PR 11310: test results

Run date: 2026-10-14 19:34 UTC

Tested commit: a63a058d78c29b573c5d2c11dacba9c878ef7fca

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

@lgirdwood

Copy link
Copy Markdown
Member

@softwarecki did not expect CI to fail, but maybe changing some of the types forced a different compiler optimization path ?

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