@@ -495,7 +495,7 @@ impl<R: Read> Decoder<R> {
495
495
compute_image_lossless ( & frame, planes_u16)
496
496
}
497
497
else {
498
- compute_image ( & frame, planes, self . is_jfif , self . color_transform )
498
+ compute_image ( & frame. components , planes, frame . output_size , self . is_jfif , self . color_transform )
499
499
}
500
500
}
501
501
@@ -955,15 +955,14 @@ fn refine_non_zeroes<R: Read>(reader: &mut R,
955
955
Ok ( last)
956
956
}
957
957
958
- fn compute_image ( frame : & FrameInfo ,
958
+ fn compute_image ( components : & [ Component ] ,
959
959
mut data : Vec < Vec < u8 > > ,
960
+ output_size : Dimensions ,
960
961
is_jfif : bool ,
961
962
color_transform : Option < AdobeColorTransform > ) -> Result < Vec < u8 > > {
962
963
if data. is_empty ( ) || data. iter ( ) . any ( Vec :: is_empty) {
963
964
return Err ( Error :: Format ( "not all components have data" . to_owned ( ) ) ) ;
964
965
}
965
- let output_size = frame. output_size ;
966
- let components = & frame. components ;
967
966
968
967
if components. len ( ) == 1 {
969
968
let component = & components[ 0 ] ;
@@ -976,7 +975,7 @@ fn compute_image(frame: &FrameInfo,
976
975
977
976
// if the image width is a multiple of the block size,
978
977
// then we don't have to move bytes in the decoded data
979
- if frame . coding_process != CodingProcess :: Lossless && usize:: from ( output_size. width ) != line_stride {
978
+ if usize:: from ( output_size. width ) != line_stride {
980
979
let mut buffer = vec ! [ 0u8 ; width] ;
981
980
// The first line already starts at index 0, so we need to move only lines 1..height
982
981
for y in 1 ..height {
0 commit comments