@@ -229,23 +229,17 @@ impl Encoder {
229229 } ;
230230 match self . output_depth {
231231 BitDepth :: Eight => {
232- let planes = buffer. pixels ( ) . map ( |px| {
233- let ( y, u, v) = match self . color_model {
234- ColorModel :: YCbCr => rgb_to_8_bit_ycbcr ( px. rgb ( ) , BT601 ) ,
235- ColorModel :: RGB => rgb_to_8_bit_gbr ( px. rgb ( ) ) ,
236- } ;
237- [ y, u, v]
232+ let planes = buffer. pixels ( ) . map ( |px| match self . color_model {
233+ ColorModel :: YCbCr => rgb_to_8_bit_ycbcr ( px. rgb ( ) , BT601 ) . into ( ) ,
234+ ColorModel :: RGB => rgb_to_8_bit_gbr ( px. rgb ( ) ) . into ( ) ,
238235 } ) ;
239236 let alpha = buffer. pixels ( ) . map ( |px| px. a ) ;
240237 self . encode_raw_planes_8_bit ( width, height, planes, Some ( alpha) , PixelRange :: Full , matrix_coefficients)
241238 } ,
242239 BitDepth :: Ten | BitDepth :: Auto => {
243- let planes = buffer. pixels ( ) . map ( |px| {
244- let ( y, u, v) = match self . color_model {
245- ColorModel :: YCbCr => rgb_to_10_bit_ycbcr ( px. rgb ( ) , BT601 ) ,
246- ColorModel :: RGB => rgb_to_10_bit_gbr ( px. rgb ( ) ) ,
247- } ;
248- [ y, u, v]
240+ let planes = buffer. pixels ( ) . map ( |px| match self . color_model {
241+ ColorModel :: YCbCr => rgb_to_10_bit_ycbcr ( px. rgb ( ) , BT601 ) . into ( ) ,
242+ ColorModel :: RGB => rgb_to_10_bit_gbr ( px. rgb ( ) ) . into ( ) ,
249243 } ) ;
250244 let alpha = buffer. pixels ( ) . map ( |px| to_ten ( px. a ) ) ;
251245 self . encode_raw_planes_10_bit ( width, height, planes, Some ( alpha) , PixelRange :: Full , matrix_coefficients)
0 commit comments