@@ -781,21 +781,19 @@ fn compute_image_parallel(components: &[Component],
781
781
output_size : Dimensions ,
782
782
is_jfif : bool ,
783
783
color_transform : Option < AdobeColorTransform > ) -> Result < Vec < u8 > > {
784
- use rayon:: iter :: * ;
784
+ use rayon:: prelude :: * ;
785
785
786
786
let color_convert_func = try!( choose_color_convert_func ( components. len ( ) , is_jfif, color_transform) ) ;
787
787
let upsampler = try!( Upsampler :: new ( components, output_size. width , output_size. height ) ) ;
788
788
let line_size = output_size. width as usize * components. len ( ) ;
789
789
let mut image = vec ! [ 0u8 ; line_size * output_size. height as usize ] ;
790
790
791
- image. chunks_mut ( line_size)
792
- . collect :: < Vec < & mut [ u8 ] > > ( )
793
- . par_iter_mut ( )
791
+ image. par_chunks_mut ( line_size)
794
792
. with_max_len ( 1 )
795
793
. enumerate ( )
796
794
. for_each ( |( row, line) | {
797
- upsampler. upsample_and_interleave_row ( data, row, output_size. width as usize , * line) ;
798
- color_convert_func ( * line, output_size. width as usize ) ;
795
+ upsampler. upsample_and_interleave_row ( data, row, output_size. width as usize , line) ;
796
+ color_convert_func ( line, output_size. width as usize ) ;
799
797
} ) ;
800
798
801
799
Ok ( image)
@@ -813,11 +811,9 @@ fn compute_image_parallel(components: &[Component],
813
811
let mut image = vec ! [ 0u8 ; line_size * output_size. height as usize ] ;
814
812
815
813
for ( row, line) in image. chunks_mut ( line_size)
816
- . collect :: < Vec < & mut [ u8 ] > > ( )
817
- . iter_mut ( )
818
814
. enumerate ( ) {
819
- upsampler. upsample_and_interleave_row ( data, row, output_size. width as usize , * line) ;
820
- color_convert_func ( * line, output_size. width as usize ) ;
815
+ upsampler. upsample_and_interleave_row ( data, row, output_size. width as usize , line) ;
816
+ color_convert_func ( line, output_size. width as usize ) ;
821
817
}
822
818
823
819
Ok ( image)
0 commit comments