Skip to content

perf(camera): scaled IDCT for instant MJPEG bubble - #3321

Open
kyzer1023 wants to merge 9 commits into
CapSoftware:mainfrom
kyzer1023:perf/camera-mjpeg-scaled-idct
Open

kyzer1023 wants to merge 9 commits into
CapSoftware:mainfrom
kyzer1023:perf/camera-mjpeg-scaled-idct

Conversation

@kyzer1023

@kyzer1023 kyzer1023 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Linux instant MJPEG uses the largest FFmpeg lowres whose decoded frame still covers the overlay. A 1080p camera into the default 324 bubble decodes at 1/2 (960×540). Studio sources::Camera holds full resolution for the whole segment (that hold wins over any overlay budget). The first captured frame is always full resolution, so VideoInfo stays the camera size. Blur raises the budget to at least 640×360. YUYV / non-MJPEG unchanged. macOS and Windows ignore the budget.

Benchmarks

Same 1920×1080 q=4 JPEG (40072 bytes) → 324×324 bubble, decode + reused bilinear scale to BGRA, 40 iterations, 3 runs (release).

Run Full decode + scale Scaled IDCT + scale Speedup
1 2.783 ms 1.678 ms 1.66×
2 2.770 ms 1.729 ms 1.60×
3 2.756 ms 1.670 ms 1.65×

Max channel Δ vs full+bilinear: 2 (mean 0.233). Noisier/high-bitrate JPEGs spend more in Huffman → smaller speedup.

Notes

  • Head: 08b3ac67d on perf/camera-mjpeg-scaled-idct.
  • Studio stays full-res — not unconditional.

RetriggerView in GreptileConfidence Score: 5/5

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

Summary

The PR reduces Linux MJPEG decode work for Instant camera overlays while keeping Studio camera tracks at full resolution.

  • Linux instant camera bubbles decode only as large as their overlay needs.
  • Setup retries downloads after brief network failures.
  • Linux desktop checks follow the active Hyprland display.

Reviews (9) · Last reviewed commit: "fix: retry transient native dependency d..." · Reviewed by Greptile

Decode Linux MJPEG at the largest FFmpeg lowres that still covers the
instant overlay. Studio holds full resolution, and the first captured
frame stays native so VideoInfo does not shrink. Blur coverage stays
at least 640x360.
@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.

Copy link
Copy Markdown
Contributor Author

@greptileai review

Comment thread crates/camera-ffmpeg/src/lib.rs Resolved
Clippy -D warnings fails on macOS and Windows because idct_lowres and scaled_dimensions are only used by the Linux capture path.
@kyzer1023

Copy link
Copy Markdown
Contributor Author

@greptileai review

Clippy -D warnings fails on macOS and Windows because overlay_target is only called from the Linux capture path. Keep the method for tests so the budget checks still compile on every target.

Copy link
Copy Markdown
Contributor Author

@greptileai please re-review — Clippy fix: overlay_target gated with #[cfg(any(target_os = "linux", test))] so macOS/Windows builds no longer see unused dead code.

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