From ba7cfb6a8872ca7975f36cf2f4aa3be317cc5cfa Mon Sep 17 00:00:00 2001 From: Russel Arbore <russel.jma@gmail.com> Date: Wed, 5 Mar 2025 10:01:44 -0600 Subject: [PATCH] Inline gaussian size --- .../benches/edge_detection_bench.rs | 1 - juno_samples/edge_detection/src/edge_detection.jn | 15 ++++++++------- juno_samples/edge_detection/src/lib.rs | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/juno_samples/edge_detection/benches/edge_detection_bench.rs b/juno_samples/edge_detection/benches/edge_detection_bench.rs index 49e67a29..01ae418a 100644 --- a/juno_samples/edge_detection/benches/edge_detection_bench.rs +++ b/juno_samples/edge_detection/benches/edge_detection_bench.rs @@ -87,7 +87,6 @@ fn edge_detection_bench(c: &mut Criterion) { r.run( height as u64, width as u64, - gs as u64, input_h.to(), gaussian_filter_h, structure_h, diff --git a/juno_samples/edge_detection/src/edge_detection.jn b/juno_samples/edge_detection/src/edge_detection.jn index da1977b6..be987812 100644 --- a/juno_samples/edge_detection/src/edge_detection.jn +++ b/juno_samples/edge_detection/src/edge_detection.jn @@ -1,6 +1,10 @@ -fn gaussian_smoothing<n, m, gs : usize>( +const gs : usize = 7; +const sz : usize = 3; +const sb : usize = 3; + +fn gaussian_smoothing<n, m : usize>( input: f32[n, m], - filter: f32[gs, gs], + filter: f32[7, 7], ) -> f32[n, m] { @res let result : f32[n, m]; @@ -34,7 +38,6 @@ fn laplacian_estimate<n, m : usize>( input: f32[n, m], structure: f32[3, 3], ) -> f32[n, m] { - const sz = 3; const r = sz / 2; @res let result : f32[n, m]; @@ -79,7 +82,6 @@ fn zero_crossings<n, m : usize>( input: f32[n, m], structure: f32[3, 3], ) -> f32[n, m] { - const sz = 3; const r = sz / 2; @res let result : f32[n, m]; @@ -127,7 +129,6 @@ fn gradient<n, m : usize>( sx: f32[3, 3], sy: f32[3, 3], ) -> f32[n, m] { - const sb = 3; const sbr = sb / 2; @res let result : f32[n, m]; @@ -191,7 +192,7 @@ fn reject_zero_crossings<n, m: usize>( } #[entry] -fn edge_detection<n, m, gs: usize>( +fn edge_detection<n, m : usize>( input: f32[n, m], gaussian_filter: f32[gs, gs], structure: f32[3, 3], @@ -199,7 +200,7 @@ fn edge_detection<n, m, gs: usize>( sy: f32[3, 3], theta: f32, ) -> f32[n, m] { - let smoothed = gaussian_smoothing::<n, m, gs>(input, gaussian_filter); + let smoothed = gaussian_smoothing::<n, m>(input, gaussian_filter); @le let laplacian = laplacian_estimate::<n, m>(smoothed, structure); @zc let zcs = zero_crossings::<n, m>(laplacian, structure); let gradient = gradient::<n, m>(smoothed, sx, sy); diff --git a/juno_samples/edge_detection/src/lib.rs b/juno_samples/edge_detection/src/lib.rs index 3eaf38dc..c1d04b0f 100644 --- a/juno_samples/edge_detection/src/lib.rs +++ b/juno_samples/edge_detection/src/lib.rs @@ -194,7 +194,6 @@ pub fn edge_detection_harness(args: EdgeDetectionInputs) { r.run( height as u64, width as u64, - gs as u64, input_h.to(), gaussian_filter_h.to(), structure_h.to(), -- GitLab