Cleanup documentation
This commit is contained in:
1 parent
6fe21da979
commit
c3882b252c
2 files changed
+11
-18
No files matched your search
+10
-9
@@ -29,15 +29,6 @@ pub(crate) struct TileAttributes {
|
|||||||
pub tile_length: usize,
|
pub tile_length: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct PlaneLayout {
|
|
||||||
/// The underlying readout layout.
|
|
||||||
pub readout: ReadoutLayout,
|
|
||||||
/// Buffer offset from one plane of output to the next.
|
|
||||||
pub plane_offsets: Vec<usize>,
|
|
||||||
/// Total number of bytes for all planes in given order.
|
|
||||||
pub total_bytes: usize,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TileAttributes {
|
impl TileAttributes {
|
||||||
pub fn tiles_across(&self) -> usize {
|
pub fn tiles_across(&self) -> usize {
|
||||||
self.image_width.div_ceil(self.tile_width)
|
self.image_width.div_ceil(self.tile_width)
|
||||||
@@ -132,6 +123,16 @@ pub(crate) struct ReadoutLayout {
|
|||||||
pub chunks_per_plane: u32,
|
pub chunks_per_plane: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A `ReadoutLayout` with pre-calculated plane information.
|
||||||
|
pub(crate) struct PlaneLayout {
|
||||||
|
/// The underlying readout layout.
|
||||||
|
pub readout: ReadoutLayout,
|
||||||
|
/// Buffer offset from one plane of output to the next.
|
||||||
|
pub plane_offsets: Vec<usize>,
|
||||||
|
/// Total number of bytes for all planes in given order.
|
||||||
|
pub total_bytes: usize,
|
||||||
|
}
|
||||||
|
|
||||||
impl Image {
|
impl Image {
|
||||||
pub fn from_reader<R: Read + Seek>(
|
pub fn from_reader<R: Read + Seek>(
|
||||||
decoder: &mut ValueReader<R>,
|
decoder: &mut ValueReader<R>,
|
||||||
|
|||||||
+1
-9
@@ -1009,9 +1009,6 @@ impl<R: Read + Seek> Decoder<R> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: it's unusual for this method to take a `usize` dimension parameter since those would
|
|
||||||
// typically come from the image data. The preferred consistent representation should be `u32`
|
|
||||||
// and that would avoid some unusual casts `usize -> u64` with a `u64::from` instead.
|
|
||||||
// FIXME: when planes are not homogenous (i.e. subsampled or differing depths) then the
|
// FIXME: when planes are not homogenous (i.e. subsampled or differing depths) then the
|
||||||
// `readout_for_size` or `to_plane_layout` needs a parameter to determine the planes being
|
// `readout_for_size` or `to_plane_layout` needs a parameter to determine the planes being
|
||||||
// read instead of assuming a constant repeated size for them.
|
// read instead of assuming a constant repeated size for them.
|
||||||
@@ -1020,12 +1017,6 @@ impl<R: Read + Seek> Decoder<R> {
|
|||||||
read: &image::ReadoutLayout,
|
read: &image::ReadoutLayout,
|
||||||
planes: core::ops::Range<u16>,
|
planes: core::ops::Range<u16>,
|
||||||
) -> TiffResult<DecodingExtent> {
|
) -> TiffResult<DecodingExtent> {
|
||||||
let bits_per_sample = read.color.bit_depth();
|
|
||||||
|
|
||||||
// If samples take up more than one byte, we expand it to a full number (integer or float)
|
|
||||||
// and the number of samples in that integer type just counts the number in the underlying
|
|
||||||
// image itself. Otherwise, a row is represented as the byte slice of bitfields without
|
|
||||||
// expansion. The output did that computation for us.
|
|
||||||
let buffer = read.to_plane_layout()?;
|
let buffer = read.to_plane_layout()?;
|
||||||
|
|
||||||
// The layout is for all planes. So restrict ourselves to the planes that were requested.
|
// The layout is for all planes. So restrict ourselves to the planes that were requested.
|
||||||
@@ -1044,6 +1035,7 @@ impl<R: Read + Seek> Decoder<R> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let buffer_bytes = end - offset;
|
let buffer_bytes = end - offset;
|
||||||
|
let bits_per_sample = read.color.bit_depth();
|
||||||
|
|
||||||
Ok(match self.image().sample_format {
|
Ok(match self.image().sample_format {
|
||||||
SampleFormat::Uint => match bits_per_sample {
|
SampleFormat::Uint => match bits_per_sample {
|
||||||
|
|||||||
Reference in new issue
Block a user