Repository navigation
Cache round Linux camera crop runs - #3144
Merged
richiemcilroy merged 1 commit intoOct 24, 2026
Merged
Conversation
Contributor
Author
|
@greptileai review |
Contributor
|
@kyzer1023 is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
This was referenced Oct 25, 2026
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
Linux instant recordings use a round camera bubble by default.
crop_cameraonly took the fast row-copy path when the mask was empty. A circle mask is not empty, so every pixel did a scalar copy and anf64alpha multiply, andOverlayRunCacherebuilt those runs on every camera frame because it keyed oncamera_generation.This change builds opaque, edge, and transparent runs once from the mask and caches them by size and radius. Interior spans use
copy_from_slice. Mirrored frames still reverse pixels inside each span. Frames that are not fully opaque stay on the scalar path. Square and Full shapes with a corner radius use the same mask runs.Merged #2809 covered the empty-mask opaque path. This covers the default round mask.
Benchmark
Median of 101 iterations after 20 warmups. Release profile (
opt-level = "s"). Round shape, opaque RGBA frame of that size. Before is the previouscrop_cameraon the same VM. After iscached_runs(runs built once outside the timer).Hardware: Intel Xeon, family 6 model 207, 4 cores / 4 threads, KVM, AVX2 and AVX-512.
Test plan
cargo fmt -p cap-recordingcargo clippy -p cap-recording --release --lib --no-deps -- -D warningscargo test -p cap-recording --release --lib linux_camera::(49 passed, 3 ignored)

Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Speeds up Linux camera crops by caching mask runs across camera frames.
Review was based on code inspection; tests were not run.
Reviews (1) · Last reviewed commit: "perf: cache round Linux camera crop runs" · Reviewed by Greptile