feat: implement video compositor review recommendations#136
Merged
streamer45 merged 1 commit intovideofrom Mar 13, 2026
Merged
Conversation
- Add debug assertions for Y-plane raw pointer aliasing in convert.rs - Clarify AVX2 packus cross-lane comments in simd_x86_64.rs - Shrink ConversionCache entries when resolution decreases (>2x) - Add max-entry bound (64) to FONT_CACHE with eviction - Validate decoded image dimensions against max_canvas_dimension - Fix fragile sleep-based test in pixel_convert.rs - Derive Copy for Rect and BlitRect, remove unnecessary clones - Remove compositor/pixel_ops/mod.rs re-export shim - Extract shared bench_utils module for generate_rgba_frame - Use font.metrics() instead of rasterize() for measurement - Migrate compositor_only and pixel_convert benchmarks to criterion Signed-off-by: Devin AI <devin@cognition.ai> Co-Authored-By: Staging-Devin AI <166158716+staging-devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Implement video compositor review recommendations
Summary
Implements all actionable findings from the video compositor & pixel operations code review. Changes span safety hardening, performance improvements, API ergonomics, and benchmark modernisation.
Changes by finding
rgba8_to_i420_bufandrgba8_to_nv12_buf_mm256_packus_epi16cross-lane comments insimd_x86_64.rsConversionCacheentries when resolution decreases (>2× old size)FONT_CACHEwith non-bundled evictionmax_canvas_dimensionbeforeto_rgba8()sleep(50ms)withrecv_timeoutintest_identical_frame_cachingCopyforRectandBlitRect, remove unnecessary.clone()callscompositor/pixel_ops/mod.rsre-export shim (all consumers updated tocrate::video::pixel_ops)bench_utilsmodule forgenerate_rgba_frameand frame generatorsfont.metrics()instead offont.rasterize()for measurement-only calls inmeasure_textcompositor_onlyandpixel_convertbenchmarks to criterionBenchmark results (criterion, 100 samples)
Compositor (1280×720)
Pixel convert (1280×720)
Review & Testing Checklist for Human
decode_image_overlaydimension check rejects oversized images (finding chore: proper notice file #7) — construct a test image wider thanmax_canvas_dimensionand confirm the errorFONT_CACHEeviction preserves bundled fonts under pressure — send >64 uniquefont_data_base64overlays and confirm bundled entries survivecargo bench -p streamkit-engine --bench compositor_onlyand--bench pixel_convertlocally to verify criterion produces sensible results on your hardwareRectbeingCopydoesn't break any downstream serialisation / TypeScript codegen (theDeserialize/JsonSchema/ts_rs::TSderives are unaffected but worth a spot check)Notes
compositor_pipeline.rsis kept as a custom harness (not criterion) since it's an integration benchmark with validation logic (EBML header, output size checks)pixel_convert.rswas intentionally not migrated to criterion — its pre-allocated-unique-buffers approach doesn't map well to criterion's iteration modelDevin Session: https://staging.itsdev.in/sessions/832613bfbf1f4ace9294ba1525e568ec