Skip to content

Commit 931f58d

Browse files
committed
Remove unnecessary doctests and unused code
1 parent 4787983 commit 931f58d

File tree

1 file changed

+12
-71
lines changed

1 file changed

+12
-71
lines changed

src/predictor.rs

Lines changed: 12 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ impl PredictorInfo {
6161
chunk_width,
6262
chunk_height,
6363
// TODO: validate this? Restore handling for different PlanarConfiguration?
64+
// PlanarConfiguration::Chunky => {
65+
// if self.bits_per_sample.len() == 1 {
66+
// self.samples_per_pixel as usize * self.bits_per_sample[0] as usize
67+
// } else {
68+
// assert_eq!(self.samples_per_pixel as usize, self.bits_per_sample.len());
69+
// self.bits_per_sample.iter().map(|v| *v as usize).product()
70+
// }
71+
// }
6472
bits_per_sample: ifd.bits_per_sample[0],
6573
samples_per_pixel: ifd.samples_per_pixel,
6674
}
@@ -69,29 +77,6 @@ impl PredictorInfo {
6977
/// chunk width in pixels, taking padding into account
7078
///
7179
/// strips are considered image-width chunks
72-
///
73-
/// # Example
74-
///
75-
/// ```rust
76-
/// # use async_tiff::tiff::tags::{SampleFormat, PlanarConfiguration};
77-
/// # use async_tiff::reader::Endianness;
78-
/// # use async_tiff::PredictorInfo;
79-
/// let info = PredictorInfo {
80-
/// # endianness: Endianness::LittleEndian,
81-
/// image_width: 15,
82-
/// image_height: 15,
83-
/// chunk_width: 8,
84-
/// chunk_height: 8,
85-
/// # bits_per_sample: &[32],
86-
/// # samples_per_pixel: 1,
87-
/// # sample_format: &[SampleFormat::IEEEFP],
88-
/// # planar_configuration: PlanarConfiguration::Chunky,
89-
/// };
90-
///
91-
/// assert_eq!(info.chunk_width_pixels(0).unwrap(), (8));
92-
/// assert_eq!(info.chunk_width_pixels(1).unwrap(), (7));
93-
/// info.chunk_width_pixels(2).unwrap_err();
94-
/// ```
9580
fn chunk_width_pixels(&self, x: u32) -> AsyncTiffResult<u32> {
9681
if x >= self.chunks_across() {
9782
Err(crate::error::AsyncTiffError::TileIndexError(
@@ -110,29 +95,7 @@ impl PredictorInfo {
11095
///
11196
/// strips are considered image-width chunks
11297
///
113-
/// # Example
114-
///
115-
/// ```rust
116-
/// # use async_tiff::tiff::tags::{SampleFormat, PlanarConfiguration};
117-
/// # use async_tiff::reader::Endianness;
118-
/// # use async_tiff::PredictorInfo;
119-
/// let info = PredictorInfo {
120-
/// # endianness: Endianness::LittleEndian,
121-
/// image_width: 15,
122-
/// image_height: 15,
123-
/// chunk_width: 8,
124-
/// chunk_height: 8,
125-
/// # bits_per_sample: &[32],
126-
/// # samples_per_pixel: 1,
127-
/// # sample_format: &[SampleFormat::IEEEFP],
128-
/// # planar_configuration: PlanarConfiguration::Chunky,
129-
/// };
130-
///
131-
/// assert_eq!(info.chunk_height_pixels(0).unwrap(), (8));
132-
/// assert_eq!(info.chunk_height_pixels(1).unwrap(), (7));
133-
/// info.chunk_height_pixels(2).unwrap_err();
134-
/// ```
135-
pub fn chunk_height_pixels(&self, y: u32) -> AsyncTiffResult<u32> {
98+
fn chunk_height_pixels(&self, y: u32) -> AsyncTiffResult<u32> {
13699
if y >= self.chunks_down() {
137100
Err(crate::error::AsyncTiffError::TileIndexError(
138101
y,
@@ -147,39 +110,17 @@ impl PredictorInfo {
147110
}
148111

149112
/// get the output row stride in bytes, taking padding into account
150-
pub fn output_row_stride(&self, x: u32) -> AsyncTiffResult<usize> {
113+
fn output_row_stride(&self, x: u32) -> AsyncTiffResult<usize> {
151114
Ok((self.chunk_width_pixels(x)? as usize).saturating_mul(self.bits_per_sample as _) / 8)
152115
}
153116

154-
// /// The total number of bits per pixel, taking into account possible different sample sizes
155-
// ///
156-
// /// Technically bits_per_sample.len() should be *equal* to samples, but libtiff also allows
157-
// /// it to be a single value that applies to all samples.
158-
// ///
159-
// /// Libtiff and image-tiff do not support mixed bits per sample, but we give the possibility
160-
// /// unless you also have PlanarConfiguration::Planar, at which point the first is taken
161-
// pub fn bits_per_pixel(&self) -> usize {
162-
// self.bits_per_sample
163-
// match self.planar_configuration {
164-
// PlanarConfiguration::Chunky => {
165-
// if self.bits_per_sample.len() == 1 {
166-
// self.samples_per_pixel as usize * self.bits_per_sample[0] as usize
167-
// } else {
168-
// assert_eq!(self.samples_per_pixel as usize, self.bits_per_sample.len());
169-
// self.bits_per_sample.iter().map(|v| *v as usize).product()
170-
// }
171-
// }
172-
// PlanarConfiguration::Planar => self.bits_per_sample[0] as usize,
173-
// }
174-
// }
175-
176117
/// The number of chunks in the horizontal (x) direction
177-
pub fn chunks_across(&self) -> u32 {
118+
fn chunks_across(&self) -> u32 {
178119
self.image_width.div_ceil(self.chunk_width)
179120
}
180121

181122
/// The number of chunks in the vertical (y) direction
182-
pub fn chunks_down(&self) -> u32 {
123+
fn chunks_down(&self) -> u32 {
183124
self.image_height.div_ceil(self.chunk_height)
184125
}
185126
}

0 commit comments

Comments
 (0)