Skip to content

Commit 075bada

Browse files
committed
Admit more bit precision values for JPEG lossless
- accept precision between 2 and 16 if coding process is lossless - map more frame precision values to the right `PixelFormat`
1 parent 02d98b3 commit 075bada

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/decoder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ impl<R: Read> Decoder<R> {
174174
Some(ref frame) => {
175175
let pixel_format = match frame.components.len() {
176176
1 => match frame.precision {
177-
8 => PixelFormat::L8,
178-
16 => PixelFormat::L16,
177+
2..=8 => PixelFormat::L8,
178+
9..=16 => PixelFormat::L16,
179179
_ => panic!(),
180180
},
181181
3 => PixelFormat::RGB24,
@@ -361,7 +361,7 @@ impl<R: Read> Decoder<R> {
361361
frame.precision,
362362
)));
363363
}
364-
if frame.precision != 8 && frame.precision != 16 {
364+
if !(2..=16).contains(&frame.precision) {
365365
return Err(Error::Unsupported(UnsupportedFeature::SamplePrecision(
366366
frame.precision,
367367
)));

0 commit comments

Comments
 (0)