Specifically, correctly read stripped tifs for any bits_per_sample sized up to the normal maximum bits_per_sample limit. Also, correctly read tiled tiffs that have bit padding in the last tile of each row. Bit padding in more than one tile per row is not supported.
Future work could include error reporting about gaps in coverage, tests, and a separate newtype for buffer indexing (vs usize for bytes)
Addresses #217; here are the caveats/support:
32 bits and below should work for unsigned chunky stripped images
I haven't tested it with planar images, but it should work
This supports rgb(a) tiffs as well
Tiled tifs have the additional restriction that the only the final tile per row of tiles can have bit padding at the end. So this means that (samples*bits_per_sample*tile_width)%byte_len must be 0. Since tile dimensions are supposed to be multiples of 16, that means 1,2 and 4 bits_per_sample should always work. Other values may work correctly depending on the tile size and samples_per_pixel combination.
No validation was added or altered, except noting that horizontal prediction doesn't work for any non-byte-aligned bits_per_sample size for grayscale.
I think good future work would be to add a newtype wrapper around usize meant to index into DecodingBuffer, and then move most of the bit-padding calculation conversion logic into there.
Specifically, correctly read stripped tifs for any bits_per_sample sized up to the normal maximum bits_per_sample limit. Also, correctly read tiled tiffs that have bit padding in the last tile of each row. Bit padding in more than one tile per row is not supported.
Future work could include error reporting about gaps in coverage, tests, and a separate newtype for buffer indexing (vs usize for bytes)
Addresses #217; here are the caveats/support:
(samples*bits_per_sample*tile_width)%byte_len
must be 0. Since tile dimensions are supposed to be multiples of 16, that means 1,2 and 4 bits_per_sample should always work. Other values may work correctly depending on the tile size and samples_per_pixel combination.