Skip to content

Commit

Permalink
Applied cargo fmt.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanemagnenat committed Jun 17, 2023
1 parent 732e315 commit f5692d5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 32 deletions.
42 changes: 22 additions & 20 deletions akaze/src/descriptors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,29 @@ impl Akaze {
evolutions: &[EvolutionStep],
keypoints: &[KeyPoint],
) -> (Vec<KeyPoint>, Vec<BitArray<64>>) {
#[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()
}
}

Expand Down
16 changes: 10 additions & 6 deletions akaze/src/detector_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
},
)
}
}
6 changes: 4 additions & 2 deletions akaze/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
5 changes: 1 addition & 4 deletions akaze/src/scale_space_extrema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit f5692d5

Please sign in to comment.