perf(vision): fuse paired Sobel gradients - #41
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
abs(Gx) + abs(Gy)path that avoids materializing two gradient imagesWhy
The previous generic Sobel path traversed the source independently for X and Y and allocated intermediate images. This slice establishes a specialized paired contract and a canonical fused workload where SpatialRust can outperform OpenCV without relaxing result accuracy.
Measured impact
Windows 11, Intel 6C/12T, OpenCV 4.13.0, OpenCL disabled, 300 randomized exactness cases:
The claim is intentionally scoped to allocated L1 magnitude. Caller-owned reuse is approximately tied at 1080p and OpenCV remains slightly faster at 4K/8K. Standalone paired gradients also remain an optimization target.
Validation
cargo test -p spatialrust-vision --features full— 113 unit + 11 property tests passedcargo clippy -p spatialrust-vision --features imgproc-canny -- -D warningscargo test -p spatialrust-vision --features imgproc-canny --libcargo test -p spatialrust-vision --features imgproc-filter advanced_filter --libcargo bench -p spatialrust-vision --features imgproc-filter --bench filter --no-runcargo doc -p spatialrust-vision --features imgproc-canny --no-depsRust 1.82 dependency resolution is currently blocked before compilation by the repository's floating
clap_builder 4.6.0requiring Edition 2024; this is independent of the Sobel implementation.