kornia/kornia-rs

[Feature]: Reduce per-frame buffer copy cost in GStreamer video writing

Aperta

#860 aperta il 27 mar 2026

 (1 commento) (0 reazioni) (0 assegnatari)Rust (188 fork)auto 404
enhancementhelp wantedtriage

Metriche repository

Star
 (675 stelle)
Metriche merge PR
 (Merge medio 3g 9h) (39 PR mergiate in 30 g)

Descrizione

Investigate whether the current GStreamer write path can avoid or reduce per-frame buffer copying.

Motivation

If each frame allocates and copies data before pushing to GStreamer, that adds overhead in hot video paths. This is especially important for high resolution, high FPS, or embedded scenarios where allocation and memory bandwidth costs are more visible.

Proposed Solution

  • Profile the current buffer creation and copy path.
  • Explore cheaper alternatives such as reusable buffers, buffer pools, or safer zero-copy-style handoff patterns where possible.
  • Keep correctness and ownership semantics explicit.
  • Add benchmark coverage or before/after measurements.

Expected Outcome

Video writing becomes more efficient, with lower per-frame overhead and better scalability for demanding workloads.

✅ Acceptance Criteria

  • Current copy cost is measured or characterized.
  • At least one cheaper path is evaluated or implemented.
  • Public behavior remains correct and documented.
  • Benchmark or measured evidence is included in the PR.

Additional Context

This issue complements async write support but should remain separate. One focuses on blocking behavior and API design, while this one focuses on memory and copy efficiency in the hot path.

Code Reference

// crates/kornia-io/src/gstreamer/video.rs ~204
// TODO: verify is there is a cheaper way to copy the buffer

🤝 Contribution Intent

  • I plan to submit a PR to implement this feature
  • I'm requesting this feature but not planning to implement it

Guida contributor