Sample format should not be a Vec (#226)
This commit is contained in:
1 parent
895c70a1ad
commit
9b06e3726d
2 files changed
+6
-11
No files matched your search
@@ -67,7 +67,7 @@ pub(crate) struct Image {
|
|||||||
pub bits_per_sample: u8,
|
pub bits_per_sample: u8,
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
pub samples: u16,
|
pub samples: u16,
|
||||||
pub sample_format: Vec<SampleFormat>,
|
pub sample_format: SampleFormat,
|
||||||
pub photometric_interpretation: PhotometricInterpretation,
|
pub photometric_interpretation: PhotometricInterpretation,
|
||||||
pub compression_method: CompressionMethod,
|
pub compression_method: CompressionMethod,
|
||||||
pub predictor: Predictor,
|
pub predictor: Predictor,
|
||||||
@@ -155,9 +155,9 @@ impl Image {
|
|||||||
return Err(TiffUnsupportedError::UnsupportedSampleFormat(sample_format).into());
|
return Err(TiffUnsupportedError::UnsupportedSampleFormat(sample_format).into());
|
||||||
}
|
}
|
||||||
|
|
||||||
sample_format
|
sample_format[0]
|
||||||
}
|
}
|
||||||
None => vec![SampleFormat::Uint],
|
None => SampleFormat::Uint,
|
||||||
};
|
};
|
||||||
|
|
||||||
let bits_per_sample: Vec<u8> = tag_reader
|
let bits_per_sample: Vec<u8> = tag_reader
|
||||||
|
|||||||
+3
-8
@@ -574,7 +574,7 @@ impl<R: Read + Seek> Decoder<R> {
|
|||||||
height: 0,
|
height: 0,
|
||||||
bits_per_sample: 1,
|
bits_per_sample: 1,
|
||||||
samples: 1,
|
samples: 1,
|
||||||
sample_format: vec![SampleFormat::Uint],
|
sample_format: SampleFormat::Uint,
|
||||||
photometric_interpretation: PhotometricInterpretation::BlackIsZero,
|
photometric_interpretation: PhotometricInterpretation::BlackIsZero,
|
||||||
compression_method: CompressionMethod::None,
|
compression_method: CompressionMethod::None,
|
||||||
jpeg_tables: None,
|
jpeg_tables: None,
|
||||||
@@ -1065,12 +1065,7 @@ impl<R: Read + Seek> Decoder<R> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let max_sample_bits = self.image().bits_per_sample;
|
let max_sample_bits = self.image().bits_per_sample;
|
||||||
match self
|
match self.image().sample_format {
|
||||||
.image()
|
|
||||||
.sample_format
|
|
||||||
.first()
|
|
||||||
.unwrap_or(&SampleFormat::Uint)
|
|
||||||
{
|
|
||||||
SampleFormat::Uint => match max_sample_bits {
|
SampleFormat::Uint => match max_sample_bits {
|
||||||
n if n <= 8 => DecodingResult::new_u8(buffer_size, &self.limits),
|
n if n <= 8 => DecodingResult::new_u8(buffer_size, &self.limits),
|
||||||
n if n <= 16 => DecodingResult::new_u16(buffer_size, &self.limits),
|
n if n <= 16 => DecodingResult::new_u16(buffer_size, &self.limits),
|
||||||
@@ -1096,7 +1091,7 @@ impl<R: Read + Seek> Decoder<R> {
|
|||||||
TiffUnsupportedError::UnsupportedBitsPerChannel(n),
|
TiffUnsupportedError::UnsupportedBitsPerChannel(n),
|
||||||
)),
|
)),
|
||||||
},
|
},
|
||||||
format => Err(TiffUnsupportedError::UnsupportedSampleFormat(vec![*format]).into()),
|
format => Err(TiffUnsupportedError::UnsupportedSampleFormat(vec![format]).into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user