diff --git a/akaze/src/descriptors.rs b/akaze/src/descriptors.rs index 4afb3718..7d3c30dc 100644 --- a/akaze/src/descriptors.rs +++ b/akaze/src/descriptors.rs @@ -18,27 +18,29 @@ impl Akaze { evolutions: &[EvolutionStep], keypoints: &[KeyPoint], ) -> (Vec, Vec>) { - #[cfg(not(feature = "rayon"))] { - keypoints - .iter() - .filter_map(|&keypoint| { - Some(( - keypoint, - self.get_mldb_descriptor(&keypoint, evolutions).ok()?, - )) - }) - .unzip() + #[cfg(not(feature = "rayon"))] + { + keypoints + .iter() + .filter_map(|&keypoint| { + Some(( + keypoint, + self.get_mldb_descriptor(&keypoint, evolutions).ok()?, + )) + }) + .unzip() } - #[cfg(feature = "rayon")] { - keypoints - .par_iter() - .filter_map(|&keypoint| { - Some(( - keypoint, - self.get_mldb_descriptor(&keypoint, evolutions).ok()?, - )) - }) - .unzip() + #[cfg(feature = "rayon")] + { + keypoints + .par_iter() + .filter_map(|&keypoint| { + Some(( + keypoint, + self.get_mldb_descriptor(&keypoint, evolutions).ok()?, + )) + }) + .unzip() } } diff --git a/akaze/src/detector_response.rs b/akaze/src/detector_response.rs index 70ae8bb4..696c03a1 100644 --- a/akaze/src/detector_response.rs +++ b/akaze/src/detector_response.rs @@ -58,24 +58,28 @@ impl Akaze { } fn compute_multiscale_derivatives_for_evolution(evolution: &mut EvolutionStep, sigma_size: u32) { - #[cfg(not(feature = "rayon"))] { + #[cfg(not(feature = "rayon"))] + { evolution.Lx = derivatives::scharr_horizontal(&evolution.Lsmooth, sigma_size); evolution.Ly = derivatives::scharr_vertical(&evolution.Lsmooth, sigma_size); evolution.Lxx = derivatives::scharr_horizontal(&evolution.Lx, sigma_size); evolution.Lyy = derivatives::scharr_vertical(&evolution.Ly, sigma_size); evolution.Lxy = derivatives::scharr_vertical(&evolution.Lx, sigma_size); } - #[cfg(feature = "rayon")] { + #[cfg(feature = "rayon")] + { (evolution.Lx, evolution.Ly) = rayon::join( || derivatives::scharr_horizontal(&evolution.Lsmooth, sigma_size), || derivatives::scharr_vertical(&evolution.Lsmooth, sigma_size), ); (evolution.Lxx, (evolution.Lyy, evolution.Lxy)) = rayon::join( || derivatives::scharr_horizontal(&evolution.Lx, sigma_size), - || rayon::join( - || derivatives::scharr_vertical(&evolution.Ly, sigma_size), - || derivatives::scharr_vertical(&evolution.Lx, sigma_size), - ) + || { + rayon::join( + || derivatives::scharr_vertical(&evolution.Ly, sigma_size), + || derivatives::scharr_vertical(&evolution.Lx, sigma_size), + ) + }, ) } } diff --git a/akaze/src/lib.rs b/akaze/src/lib.rs index d8192029..571d90bd 100644 --- a/akaze/src/lib.rs +++ b/akaze/src/lib.rs @@ -201,13 +201,15 @@ impl Akaze { } evolutions[i].Lsmooth = gaussian_blur(&evolutions[i].Lt, 1.0f32); trace!("Gaussian blur finished."); - #[cfg(not(feature = "rayon"))] { + #[cfg(not(feature = "rayon"))] + { evolutions[i].Lx = derivatives::simple_scharr_horizontal(&evolutions[i].Lsmooth); trace!("Computing derivative Lx done."); evolutions[i].Ly = derivatives::simple_scharr_vertical(&evolutions[i].Lsmooth); trace!("Computing derivative Ly done."); } - #[cfg(feature = "rayon")] { + #[cfg(feature = "rayon")] + { (evolutions[i].Lx, evolutions[i].Ly) = rayon::join( || derivatives::simple_scharr_horizontal(&evolutions[i].Lsmooth), || derivatives::simple_scharr_vertical(&evolutions[i].Lsmooth), diff --git a/akaze/src/scale_space_extrema.rs b/akaze/src/scale_space_extrema.rs index 322032d0..f368baf4 100644 --- a/akaze/src/scale_space_extrema.rs +++ b/akaze/src/scale_space_extrema.rs @@ -347,10 +347,7 @@ fn do_subpixel_refinement( } }; #[cfg(not(feature = "rayon"))] - let result: Vec<_> = in_keypoints - .iter() - .filter_map(process_keypoint) - .collect(); + let result: Vec<_> = in_keypoints.iter().filter_map(process_keypoint).collect(); #[cfg(feature = "rayon")] let result: Vec<_> = in_keypoints .par_iter()