Repository navigation
audio: src: use size_t for processing counts and unsigned channel counts - #11338
Open
softwarecki wants to merge 3 commits into
Open
softwarecki wants to merge 3 commits into
softwarecki wants to merge 3 commits into
Conversation
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>
softwarecki
requested review from
abonislawski,
lgirdwood,
serhiy-katsyuba-intel,
tmleman and
wjablon1
October 22, 2026 20:55
Contributor
There was a problem hiding this comment.
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
Please align these local types with the actual return types ofsource_get_data_available()/… · New These assignments store intosize_t, but most expressions are still evaluated in (signed)int… · News->nchis nowunsigned int(persrc_common.h), but it’s assigned into a signedinthere.… · New Channel count is being standardized tounsignedin the shared structs, butfir_filter_generic()… · New
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
inttosize_tin generic and HiFi implementations. - Updated channel count fields to
unsigned intin 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 on lines
+245
to
+249
| size_t avail_b = source_get_data_available(source); | ||
| size_t free_b = sink_get_free_size(sink); | ||
| size_t sz = cd->sample_container_bytes; | ||
| size_t source_frag_size = cd->param.blk_in * source_get_frame_bytes(source); | ||
| size_t sink_frag_size = cd->param.blk_out * sink_get_frame_bytes(sink); |
Comment on lines
+232
to
+238
| const size_t nch_x_odm = cfg->odm * nch; | ||
| const size_t blk_in_words = nch * cfg->blk_in; | ||
| const size_t blk_out_words = nch * cfg->num_of_subfilters; | ||
| const size_t rewind = nch * (cfg->blk_in + (cfg->num_of_subfilters - 1) * cfg->idm); | ||
| const size_t nch_x_idm = nch * cfg->idm; | ||
| const size_t fir_size = fir->fir_delay_size * sizeof(int32_t); | ||
| const int taps_x_nch = cfg->subfilter_length * nch; | ||
| const size_t taps_x_nch = cfg->subfilter_length * nch; |
Comment on lines
353
to
+356
| const int nch = s->nch; | ||
| const int nch_x_odm = cfg->odm * nch; | ||
| const int blk_in_words = nch * cfg->blk_in; | ||
| const int blk_out_words = nch * cfg->num_of_subfilters; | ||
| const size_t nch_x_odm = cfg->odm * nch; | ||
| const size_t blk_in_words = nch * cfg->blk_in; | ||
| const size_t blk_out_words = nch * cfg->num_of_subfilters; |
Comment on lines
+25
to
26
| const size_t taps_x_nch, | ||
| const int shift, const int nch) |
PR 11338: test resultsRun date: 2026-10-22 21:31 UTC Tested commit: cd38b54024e920fb0689fbe70f967b23ae90781d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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