@@ -190,25 +190,16 @@ fn box_blur_vertical_pass_strategy<T: Pixel, P: Primitive>(
190190 height : u32 ,
191191 radius : usize ,
192192) {
193- if T :: CHANNEL_COUNT == 1 {
194- box_blur_vertical_pass_impl :: < P , 1 > (
195- src, src_stride, dst, dst_stride, width, height, radius,
196- ) ;
197- } else if T :: CHANNEL_COUNT == 2 {
198- box_blur_vertical_pass_impl :: < P , 2 > (
199- src, src_stride, dst, dst_stride, width, height, radius,
200- ) ;
201- } else if T :: CHANNEL_COUNT == 3 {
202- box_blur_vertical_pass_impl :: < P , 3 > (
203- src, src_stride, dst, dst_stride, width, height, radius,
204- ) ;
205- } else if T :: CHANNEL_COUNT == 4 {
206- box_blur_vertical_pass_impl :: < P , 4 > (
207- src, src_stride, dst, dst_stride, width, height, radius,
208- ) ;
209- } else {
210- unimplemented ! ( "More than 4 channels is not yet implemented" ) ;
211- }
193+ box_blur_vertical_pass_impl :: < P > (
194+ src,
195+ src_stride,
196+ dst,
197+ dst_stride,
198+ width,
199+ height,
200+ radius,
201+ T :: CHANNEL_COUNT as usize ,
202+ ) ;
212203}
213204
214205fn box_blur_horizontal_pass_impl < T , const CN : usize > (
@@ -415,14 +406,16 @@ fn box_blur_horizontal_pass_impl<T, const CN: usize>(
415406 }
416407}
417408
418- fn box_blur_vertical_pass_impl < T : Primitive , const CN : usize > (
409+ #[ allow( clippy:: too_many_arguments) ]
410+ fn box_blur_vertical_pass_impl < T : Primitive > (
419411 src : & [ T ] ,
420412 src_stride : usize ,
421413 dst : & mut [ T ] ,
422414 dst_stride : usize ,
423415 width : u32 ,
424416 height : u32 ,
425417 radius : usize ,
418+ n : usize ,
426419) {
427420 assert ! ( width > 0 , "Width must be sanitized before this method" ) ;
428421 assert ! ( height > 0 , "Height must be sanitized before this method" ) ;
@@ -435,7 +428,7 @@ fn box_blur_vertical_pass_impl<T: Primitive, const CN: usize>(
435428
436429 let weight = 1f32 / ( radius * 2 + 1 ) as f32 ;
437430
438- let buf_size = width as usize * CN ;
431+ let buf_size = width as usize * n ;
439432
440433 let buf_cap = buf_size;
441434
@@ -462,8 +455,8 @@ fn box_blur_vertical_pass_impl<T: Primitive, const CN: usize>(
462455 let next = ( y + half_kernel + 1 ) . min ( height_bound) * src_stride;
463456 let previous = ( y as i64 - half_kernel as i64 ) . max ( 0 ) as usize * src_stride;
464457
465- let next_row = & src[ next..next + width as usize * CN ] ;
466- let previous_row = & src[ previous..previous + width as usize * CN ] ;
458+ let next_row = & src[ next..next + width as usize * n ] ;
459+ let previous_row = & src[ previous..previous + width as usize * n ] ;
467460
468461 for ( ( ( src_next, src_previous) , buffer) , dst) in next_row
469462 . iter ( )
0 commit comments