Repository navigation
audio: drc: const-correctness, unsigned/size_t types and comp_buffer removal - #11310
softwarecki wants to merge 4 commits into
Conversation
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>
There was a problem hiding this comment.
🟡 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_tand unsigned channel counts consistently. - Preserves const qualifiers in circular-buffer processing.
- Removes
comp_bufferusage 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.
| 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; |
| const ae_int16 *x = source->ptr; | ||
| ae_int16 *y = sink->ptr; |
There was a problem hiding this comment.
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 ?
PR 11310: test resultsRun date: 2026-10-14 19:34 UTC Tested commit: a63a058d78c29b573c5d2c11dacba9c878ef7fca |
|
@softwarecki did not expect CI to fail, but maybe changing some of the types forced a different compiler optimization path ? |

Declare the source read pointers const and drop the casts that discarded const. Use
source_cir_buf_wrapfor the source-side wrap to preserve the qualifier. In the HiFi4 path, switch the sample pointers toae_int16andae_int32end to end, which also removes theint16_ttoae_int16bridging casts.Change the channels field, the channel-count parameters and the per-channel loop counters from
intanduint16_ttounsigned int. This matches the type returned bysource_get_channelsandsink_get_channelsand removes the signed/unsigned comparisons.Convert the frame, sample and byte counts from
intanduint32_ttosize_tand 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_bufferuses in the module.