Skip to content

fix: preserve component sample model band offsets#3108

Open
ShiroKSH wants to merge 1 commit into
apache:masterfrom
ShiroKSH:fix/raster-component-band-offset
Open

fix: preserve component sample model band offsets#3108
ShiroKSH wants to merge 1 commit into
apache:masterfrom
ShiroKSH:fix/raster-component-band-offset

Conversation

@ShiroKSH

Copy link
Copy Markdown
Contributor

Summary

  • pair ComponentSampleModel band offsets with band positions in its contiguous fast path
  • add coverage for a legal raster layout that reorders data banks and uses distinct offsets

The 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

  • executed the regression fixture against the updated fast-path implementation
  • ran Python bytecode compilation
  • ran Black formatting verification
  • checked the staged diff with git diff --check

@ShiroKSH
ShiroKSH requested a review from jiayuasu as a code owner July 15, 2026 10:58

@jiayuasu jiayuasu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

2 participants