Skip to content

perf(linux-camera): scale instant overlay from YUYV - #3298

Open
kyzer1023 wants to merge 8 commits into
CapSoftware:mainfrom
kyzer1023:perf/linux-camera-yuyv-overlay-scale
Open

kyzer1023 wants to merge 8 commits into
CapSoftware:mainfrom
kyzer1023:perf/linux-camera-yuyv-overlay-scale

Conversation

@kyzer1023

@kyzer1023 kyzer1023 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Blur-off X11 instant recording scales the camera overlay from packed YUYV422 instead of expanding every frame to full BGRA first. One bilinear swscale (YUYV422 → overlay RGBA). Blur still publishes filtered BGRA. Horizontal mirror reverses YUYV macropixels before scale.

Benchmarks

Hardware: Intel Xeon (4 vCPU), rustc 1.88.0, release (opt-level=s, codegen-units=1, thin LTO). Warmup 8, 31 samples, median at sorted index 15.

Path Median
Scaler BGRA 1920×1080 → RGBA 576×324 5.950 ms
Scaler YUYV 1920×1080 → RGBA 576×324 1.134 ms (~5.2×)
End-to-end two-stage (full BGRA → overlay) 14.644 ms
End-to-end direct YUYV 1.770 ms (~8.3×)
End-to-end direct YUYV, mirrored 2.430 ms

Pixel fidelity

One YUYV resample is not bit-identical to the old two-stage bilinear. On a 1080p luma gradient with constant non-neutral chroma, max abs channel delta is 58. Flat color stays within 8.

Tests

cargo test -p cap-recording --lib instant_recording::linux_camera::tests — 50 passed, 4 ignored.

Notes

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues were found.

Summary

The PR scales blur-off Linux camera overlays directly from packed YUYV. It keeps blurred frames on the BGRA path and adds mirror coverage.

  • Blur-off camera frames scale from packed YUYV straight to the recording overlay.
  • Wayland display listings wait longer for compositor replies.
  • The Linux camera job prepares kernel support before it builds its virtual camera.
  • Hyprland screenshot runs use the monitor's configured size.

Reviews (8) · Last reviewed commit: "fix: allow busy Wayland compositors to e..." · Reviewed by Greptile

Blur-off Linux instant recording expanded each camera frame to full BGRA
and then bilinear-scaled that to the overlay. The compositor now scales
even-width YUYV422 directly. Blur still publishes the filtered BGRA frame.
Horizontal mirror reverses packed YUYV macropixels before that single
scale, so the compositor does not mirror a second time.

Release profile (opt-level=s, codegen-units=1, thin LTO), Intel Xeon,
rustc 1.88.0. Warmup 8, 31 samples, median at sorted index 15.

scaler BGRA 1920x1080 -> RGBA 576x324 median 5.950 ms
scaler YUYV 1920x1080 -> RGBA 576x324 median 1.134 ms
e2e two-stage median 14.644 ms
e2e direct median 1.770 ms
e2e direct mirrored median 2.430 ms

Max abs channel delta versus the two-stage bilinear on a 1080p luma
gradient is 58. Flat color stays within 8. This is one bilinear resample
from YUYV, not the previous full-frame BGRA expand plus a second scale.

Copy link
Copy Markdown
Contributor Author

@greptileai review

@vercel

vercel Bot commented Oct 26, 2026

Copy link
Copy Markdown
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.

The overlay test derived its expected row from mirror_yuyv_row and used
pairs with identical luma and chroma, so those mistakes still passed.

Copy link
Copy Markdown
Contributor Author

@greptileai review

@kyzer1023

Copy link
Copy Markdown
Contributor Author

@greptileai review

Copy link
Copy Markdown
Contributor Author

@greptileai review

Copy link
Copy Markdown
Contributor Author

@greptileai review

Copy link
Copy Markdown
Contributor Author

@greptileai review

Copy link
Copy Markdown
Contributor Author

@greptileai review

This branch has not been deployed

No deployments
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