Repository navigation
audio: volume: use size_t for processing counts and unsigned channel counts - #11337
Open
softwarecki wants to merge 2 commits into
Open
softwarecki wants to merge 2 commits into
softwarecki wants to merge 2 commits into
Conversation
Convert the remaining channel count and channel loop variables in the ARM and RISC-V paths to unsigned int, aligning them with the generic and HiFi implementations. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Widen the processing frame count and the per-chunk sample counters in all format variants to size_t. The scalar unrolled loops use an addition based bound instead of a subtraction so the unsigned counters cannot underflow. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
softwarecki
requested review from
abonislawski,
lgirdwood,
piotrhoppeintel,
serhiy-katsyuba-intel,
tmleman and
wjablon1
and
a balanced review from Copilot
October 22, 2026 20:54
softwarecki
requested review from
dbaluta,
kv2019i,
lbetlej,
mmaka1 and
plbossart
as code owners
October 22, 2026 20:54
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused type conversions and loop-bound updates are consistent across implementations, with no blocking issues identified by static review; builds and tests were not run.
No open issues 🎉
What changed in this PR
This PR standardizes count types in SOF’s volume processing interface and backends, keeping callback signatures aligned and making scalar loop bounds safe for unsigned counts.
Changes:
- Use
size_tfor frame parameters across all volume backends. - Convert ARM and RISC-V sample counts and indices to
size_t, and channel counters to unsigned types. - Rewrite scalar unrolled loop bounds to avoid unsigned subtraction underflow.
| File | Description |
|---|---|
src/audio/volume/volume.h |
Updates the scaling callback’s frame-count type. |
src/audio/volume/volume.c |
Uses an unsigned channel count for alignment. |
src/audio/volume/volume_riscv.c |
Converts scalar counts and updates loop bounds. |
src/audio/volume/volume_riscv_with_peakvol.c |
Applies count and loop-bound changes to peak-meter processing. |
src/audio/volume/volume_hifi5.c |
Aligns HiFi5 frame parameters with the callback. |
src/audio/volume/volume_hifi5_with_peakvol.c |
Aligns HiFi5 peak-meter frame parameters. |
src/audio/volume/volume_hifi4.c |
Aligns HiFi4 frame parameters with the callback. |
src/audio/volume/volume_hifi4_with_peakvol.c |
Aligns HiFi4 peak-meter frame parameters. |
src/audio/volume/volume_hifi3.c |
Aligns HiFi3 frame parameters with the callback. |
src/audio/volume/volume_hifi3_with_peakvol.c |
Aligns HiFi3 peak-meter frame parameters. |
src/audio/volume/volume_generic.c |
Aligns generic frame parameters with the callback. |
src/audio/volume/volume_generic_with_peakvol.c |
Aligns generic peak-meter frame parameters. |
src/audio/volume/volume_arm.c |
Converts scalar counts and updates loop bounds. |
src/audio/volume/volume_arm_with_peakvol.c |
Applies count and loop-bound changes to peak-meter processing. |
Review effort: Balanced
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 frame and sample counts to
size_tacross the processing implementations, and align the remaining channel counters with theunsignedstream channel count. Update the scalar unrolled loop bounds to avoid unsigned underflow.