Skip to content

audio: src: use size_t for processing counts and unsigned channel counts - #11338

Open
softwarecki wants to merge 3 commits into
thesofproject:mainfrom
softwarecki:p20-src
Open

softwarecki wants to merge 3 commits into
thesofproject:mainfrom
softwarecki:p20-src

Conversation

@softwarecki

Copy link
Copy Markdown
Collaborator

Convert stream-boundary counts, polyphase sample and address offset counters, and per-stage block sizes to size_t. Use unsigned channel counts throughout setup and processing while retaining signed byte strides for the Xtensa intrinsics and keeping filter geometry constants as int.

Convert the source and sink frame, sample container and byte counters
exchanged with the sink/source API to size_t. The internal polyphase
block accounting is left unchanged.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Store the channel count as unsigned int across the parameter and stage
structures and the setup path, matching the stream channel count type.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Convert the word, sample and address offset counters in the polyphase
kernels, and the per-stage block sizes, to size_t. The signed byte
strides used by the Xtensa intrinsics and the filter geometry
constants stay int.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

4 open issues
What changed in this PR

Updates SRC processing and configuration types to use size_t for counts/sizes and unsigned for channel counts, reducing signed overflow risk and improving type correctness across SRC implementations.

Changes:

  • Converted block sizes, tap/count variables, and frame counters from int to size_t in generic and HiFi implementations.
  • Updated channel count fields to unsigned int in shared SRC structs and several call sites.
  • Adjusted logging format specifier for size_t (%zu) where updated types are logged.
File Description
src/​audio/​src/​src_hifi5.c Switches internal loop/counter variables and derived block sizes to size_t.
src/​audio/​src/​src_hifi4.c Mirrors HiFi5 changes for size/count variables to size_t.
src/​audio/​src/​src_hifi3.c Updates loop/counter variables and derived sizes to size_t.
src/​audio/​src/​src_hifi2ep.c Uses size_t for counters and derived block sizes in HiFi2EP path.
src/​audio/​src/​src_generic.c Converts FIR tap/count math and stage counters to size_t.
src/​audio/​src/​src_common.h Changes shared SRC struct fields (blk_in/out, nch, frames/bytes) to size_t/unsigned.
src/​audio/​src/​src_common.c Propagates size_t/unsigned into runtime sizing, fragment sizing, and debug logging.

Review effort: Lite

Comment thread src/audio/src/src_common.c
Comment thread src/audio/src/src_generic.c
Comment thread src/audio/src/src_hifi5.c
Comment thread src/audio/src/src_generic.c
@intel-sofci

Copy link
Copy Markdown

PR 11338: test results

Run date: 2026-10-22 21:31 UTC

Tested commit: cd38b54024e920fb0689fbe70f967b23ae90781d

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

@kv2019i

kv2019i commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

@softwarecki Can you comment on the github comments? It seems this is snowballing to the filter interface - do you plan to tackle those separately...?

@softwarecki

Copy link
Copy Markdown
Collaborator Author

@kv2019i At this point I want to stay focused on the full pipeline 2.0 implementation. I don't plan to refactor all existing modules and interfaces to use size_t and unsigned int for channel counts as part of this work.

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