Skip to content

Suggested changes for predictors #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

kylebarron
Copy link

@kylebarron kylebarron commented Apr 2, 2025

  • Remove registry
  • Rename "RevPredict" to Unpredict
  • Change to pub(crate) fields
  • Remove unused sample_format field
  • Remove lifetime on PredictorInfo and Tile and store a single element for bits_per_pixel
  • Remove now-unused planar configuration
  • Move PredictorInfo into predictor.rs
  • Remove unnecessary doctests and unused code (I don't think we need to have doctests for internal APIs like this. If you want to bring back those two tests, let's put them in the tests at the bottom of the file)
  • Ensure no copies when data endianness matches system endianness

@feefladder
Copy link
Owner

Planar configuration is actually important, but I overlooked it in the PR earlier:
output_row_stride<-bits_per_pixel is determined (also) by planar configuration like.

pub fn bits_per_pixel(&self) -> usize {
  match self.planar_configuration {
    Chunky => self.bits_per_sample * self.samples_per_pixel,
    Planar => self.bits_per_sample
  }
}

Then, I don't know exactly if we want to incorporate, and that's a little foggy (tiff2 gave errors on test tiffs, which I think had to do with improper buffer sizing), but I thought something like this was also possible:

/// chunk height (number of rows)
/// If PlanarConfiguration == Planar, we do smart things
pub fn chunk_height_pixels(&self, y: u32) -> usize {
  let res = todo!() // old calculations
  match self.planar_configuration {
    Chunky => res,
    Planar => res * self.samples_per_pixel
  }
}

I'll see if I can get this PR-on-a-PR thing figured out

@feefladder
Copy link
Owner

all the rest, great changes!

* Remove unnecessary doctests and unused code (I don't think we need to have doctests for internal APIs like this. If you want to bring back those two tests, let's put them in the tests at the bottom of the file)

I already made a test for the doctest, so no problem there!

@feefladder feefladder merged commit be74506 into feefladder:predictors Apr 3, 2025
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