Skip to content

perf(vision): fuse bilinear resize to grayscale - #45

Merged
rsasaki0109 merged 1 commit into
mainfrom
agent/fused-resize-gray
Jul 15, 2026
Merged

perf(vision): fuse bilinear resize to grayscale#45
rsasaki0109 merged 1 commit into
mainfrom
agent/fused-resize-gray

Conversation

@rsasaki0109

Copy link
Copy Markdown
Owner

Summary

  • add safe allocating and caller-owned fused bilinear RGB resize-to-gray APIs
  • reuse Q11 sampling plans, preserve strided views and Gray metadata, and avoid the intermediate RGB image
  • expose resize_rgb_to_gray_image(..., out=...) in Python with synchronized stubs and tests
  • add Criterion coverage, a paired OpenCV 4.13 harness, README/roadmap/GitHub Pages updates, and a dated receipt

Results

On the recorded 12-thread Windows host, the allocated 1920x1080 to 960x540 pipeline measured 0.677 ms versus OpenCV's two-call 0.755 ms, a 1.12x SpatialRust win. Native caller-owned fused execution improves over SpatialRust's unfused path by 1.09x at 1080p, 1.15x at 4K, and 1.17x at 8K.

The claim is scoped: 4K allocated is effectively tied, while OpenCV leads 8K allocation and all caller-owned-output comparisons.

Fused output is bit-exact with the SpatialRust unfused plan. Canonical and 300 randomized OpenCV comparisons have maximum absolute error 1/255.

Validation

  • cargo test -p spatialrust-vision --features full
  • generated-size fused/unfused property test
  • cargo clippy -p spatialrust-vision --features preprocess --all-targets -- -D warnings
  • Python crate clippy
  • Python binding pytest
  • release maturin build
  • focused paired OpenCV harness
  • rustdoc, rustfmt, py_compile, and diff checks

@rsasaki0109
rsasaki0109 marked this pull request as ready for review July 15, 2026 22:52
@rsasaki0109
rsasaki0109 merged commit c7560fd into main Jul 15, 2026
86 of 92 checks passed
@rsasaki0109
rsasaki0109 deleted the agent/fused-resize-gray branch July 15, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant