@@ -122,11 +122,11 @@ impl<'a> ImageBuffer for GrayImage<'a> {
122122}
123123
124124#[ inline( always) ]
125- fn get_line ( data : & [ u8 ] , y : u16 , width : u16 , num_colors : usize ) -> & [ u8 ] {
126- let width= usize:: from ( width) ;
125+ fn get_line ( data : & [ u8 ] , y : u16 , width : u16 , num_colors : usize ) -> & [ u8 ] {
126+ let width = usize:: from ( width) ;
127127 let y = usize:: from ( y) ;
128128
129- let start = y * width * num_colors;
129+ let start = y * width * num_colors;
130130 let end = start + width * num_colors;
131131
132132 & data[ start..end]
@@ -155,13 +155,13 @@ macro_rules! ycbcr_image {
155155
156156 // Doing the convertion in chunks allows the compiler to vectorize the code
157157 // A size of 16 seems optimal for SSE and AVX capable hardware
158- const CHUNK_SIZE : usize = 16 ;
158+ const CHUNK_SIZE : usize = 16 ;
159159
160- let mut y_buffer = [ 0 ; CHUNK_SIZE ] ;
161- let mut cb_buffer = [ 0 ; CHUNK_SIZE ] ;
162- let mut cr_buffer = [ 0 ; CHUNK_SIZE ] ;
160+ let mut y_buffer = [ 0 ; CHUNK_SIZE ] ;
161+ let mut cb_buffer = [ 0 ; CHUNK_SIZE ] ;
162+ let mut cr_buffer = [ 0 ; CHUNK_SIZE ] ;
163163
164- for chuck in line. chunks_exact( $num_colors* CHUNK_SIZE ) {
164+ for chuck in line. chunks_exact( $num_colors * CHUNK_SIZE ) {
165165 for i in ( 0 ..CHUNK_SIZE ) {
166166 let ( y, cb, cr) = rgb_to_ycbcr(
167167 chuck[ i * $num_colors + $o1] ,
@@ -182,11 +182,11 @@ macro_rules! ycbcr_image {
182182 // Add the remaining pixels in case the number of
183183 // pixels is not a multiple of CHUNK_SIZE
184184 let pixel = line. len( ) / $num_colors;
185- for i in pixel/ CHUNK_SIZE * CHUNK_SIZE ..pixel {
185+ for i in pixel / CHUNK_SIZE * CHUNK_SIZE ..pixel {
186186 let ( y, cb, cr) = rgb_to_ycbcr(
187- line[ i* $num_colors + $o1] ,
188- line[ i* $num_colors + $o2] ,
189- line[ i* $num_colors + $o3] ,
187+ line[ i * $num_colors + $o1] ,
188+ line[ i * $num_colors + $o2] ,
189+ line[ i * $num_colors + $o3] ,
190190 ) ;
191191
192192 buffers[ 0 ] . push( y) ;
@@ -275,13 +275,7 @@ impl<'a> ImageBuffer for CmykAsYcckImage<'a> {
275275 let line = get_line ( self . 0 , y, self . width ( ) , 4 ) ;
276276
277277 for pixel in line. chunks_exact ( 4 ) {
278-
279- let ( y, cb, cr, k) = cmyk_to_ycck (
280- pixel[ 0 ] ,
281- pixel[ 1 ] ,
282- pixel[ 2 ] ,
283- pixel[ 3 ] ,
284- ) ;
278+ let ( y, cb, cr, k) = cmyk_to_ycck ( pixel[ 0 ] , pixel[ 1 ] , pixel[ 2 ] , pixel[ 3 ] ) ;
285279
286280 buffers[ 0 ] . push ( y) ;
287281 buffers[ 1 ] . push ( cb) ;
@@ -310,7 +304,6 @@ impl<'a> ImageBuffer for YcckImage<'a> {
310304 let line = get_line ( self . 0 , y, self . width ( ) , 4 ) ;
311305
312306 for pixel in line. chunks_exact ( 4 ) {
313-
314307 buffers[ 0 ] . push ( pixel[ 0 ] ) ;
315308 buffers[ 1 ] . push ( pixel[ 1 ] ) ;
316309 buffers[ 2 ] . push ( pixel[ 2 ] ) ;
@@ -330,7 +323,6 @@ mod tests {
330323
331324 #[ test]
332325 fn test_rgb_to_ycbcr ( ) {
333-
334326 assert_rgb_to_ycbcr ( [ 0 , 0 , 0 ] , [ 0 , 128 , 128 ] ) ;
335327 assert_rgb_to_ycbcr ( [ 255 , 255 , 255 ] , [ 255 , 128 , 128 ] ) ;
336328 assert_rgb_to_ycbcr ( [ 255 , 0 , 0 ] , [ 76 , 85 , 255 ] ) ;
0 commit comments