diff --git a/src/distance_transform.rs b/src/distance_transform.rs index 5afa5992..b2fb6455 100644 --- a/src/distance_transform.rs +++ b/src/distance_transform.rs @@ -114,8 +114,8 @@ pub(crate) enum DistanceFrom { pub(crate) fn distance_transform_impl(image: &mut GrayImage, norm: Norm, from: DistanceFrom) { match norm { - Norm::LInf => distance_transform_impl_linf(image, from), - Norm::L1 => distance_transform_impl_l1(image, from), + Norm::LInf => distance_transform_impl_linf_or_l1::(image, from), + Norm::L1 => distance_transform_impl_linf_or_l1::(image, from), Norm::L2 => { match from { DistanceFrom::Foreground => (), @@ -133,21 +133,6 @@ pub(crate) fn distance_transform_impl(image: &mut GrayImage, norm: Norm, from: D } } -#[inline(always)] -fn distance_transform_impl_linf(image: &mut GrayImage, from: DistanceFrom) { - // the boolean generic parameter "IS_LINF" allows - // for there to be one compiled fuction per norm, - // reducing the number of if statements evaluated at runtime - distance_transform_impl_linf_or_l1::(image, from) -} -#[inline(always)] -fn distance_transform_impl_l1(image: &mut GrayImage, from: DistanceFrom) { - // the boolean generic parameter "IS_LINF" allows - // for there to be one compiled fuction per norm, - // reducing the number of if statements evaluated at runtime - distance_transform_impl_linf_or_l1::(image, from) -} - fn distance_transform_impl_linf_or_l1( image: &mut GrayImage, from: DistanceFrom, @@ -184,7 +169,6 @@ fn distance_transform_impl_linf_or_l1( check(image, x, y, x, y - 1); if IS_LINF { - // this 'if' statement will be compiled away because IS_LINF is a const if x > 0 { check(image, x, y, x - 1, y - 1); } @@ -207,7 +191,6 @@ fn distance_transform_impl_linf_or_l1( check(image, x, y, x, y + 1); if IS_LINF { - // this 'if' statement will be compiled away because IS_LINF is a const if x < image.width() - 1 { check(image, x, y, x + 1, y + 1); }