fix: preserve component sample model band offsets#3108
Open
ShiroKSH wants to merge 1 commit into
Open
Conversation
jiayuasu
reviewed
Jul 16, 2026
jiayuasu
left a comment
Member
There was a problem hiding this comment.
One question on the offset handling.
| for k, bank_index in enumerate(self.bank_indices): | ||
| bank_data = data_buffer.bank_data[bank_index] | ||
| offset = self.band_offsets[bank_index] | ||
| offset = self.band_offsets[k] |
Member
There was a problem hiding this comment.
Could we calculate the effective start here (data_buffer.offsets[bank_index] + self.band_offsets[k]) and always slice a width * height window? I may be missing an invariant, but a component model can have a zero band offset with a padded backing bank; then the current branch seems to pass the whole bank to reshape(). The slow path may need the buffer offset too. A zero-offset case in the new test would help confirm it.
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.
Summary
ComponentSampleModelband offsets with band positions in its contiguous fast pathThe slow path already uses the band position. The fast path used the mapped bank number instead, returning samples from the wrong positions when the mapping is non-identity.
Validation
git diff --check