Greatly improved performance for 16 bit images
This commit is contained in:
1 parent
724e5e8c80
commit
345aff0629
2 files changed
+12
-6
No files matched your search
+4
-6
@@ -427,15 +427,13 @@ impl<R: Read + Seek> Decoder<R> {
|
||||
}
|
||||
(ColorType::RGBA(16), DecodingBuffer::U16(ref mut buffer)) |
|
||||
(ColorType:: RGB(16), DecodingBuffer::U16(ref mut buffer)) => {
|
||||
for datum in buffer[..bytes/2].iter_mut() {
|
||||
*datum = try!(reader.read_u16())
|
||||
}
|
||||
try!(reader.read_u16_into(&mut buffer[..bytes/2]));
|
||||
bytes/2
|
||||
}
|
||||
(ColorType::Gray(16), DecodingBuffer::U16(ref mut buffer)) => {
|
||||
for datum in buffer[..bytes/2].iter_mut() {
|
||||
*datum = try!(reader.read_u16());
|
||||
if self.photometric_interpretation == PhotometricInterpretation::WhiteIsZero {
|
||||
try!(reader.read_u16_into(&mut buffer[..bytes/2]));
|
||||
if self.photometric_interpretation == PhotometricInterpretation::WhiteIsZero {
|
||||
for datum in buffer[..bytes/2].iter_mut() {
|
||||
*datum = 0xffff - *datum
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user