diagram "Realtime Media & Compute Pipeline" routing=orthogonal # Try opening this file directly: # design-it examples/sample_engine.dit.txt # Or exporting it headlessly to SVG: # design-it examples/sample_engine.dit.txt --set="color scheme=nord" --export-svg=pipeline.svg module "Ingest" id=mod_ingest tag=ingest { interface "PacketSource" id=src stereo="<>" tag=ingest { section "contract" { + poll(buf) : usize [non-blocking] + close() : void } } class "FileDemuxer" id=demux tag=ingest { section "fields" { - fd : s32 - cursor : u64 [offset] } section "methods" { + seek(pts) : bool } } storage "PacketRing" id=ring stereo="lock-free SPSC" tag=hot { section "memory (cache-isolated)" { + write_idx : atomic [0x00] + read_idx : atomic [0x40] + slots[4096] : Packet [256 KB] } } } module "Compute" id=mod_compute tag=compute { system "DecodeWorker" id=worker stereo="dedicated thread" tag=hot { section "pipeline" { + decode_batch() : u32 [SIMD] + flush() : void } } enum "FrameFormat" id=fmt tag=compute { section "variants" { RGBA8 [4 Bpp] NV12 [planar] F32_STEREO [audio] } } struct "Frame" id=frame stereo="arena-backed" tag=compute { section "fields" { + pts_ns : u64 + format : FrameFormat + data : u8* [64B align] } } } module "Presentation" id=mod_present tag=render { system "VulkanPresenter" id=presenter stereo="vk 1.3 sync2" tag=render { section "methods" { + upload(Frame*) : void [staging] + present() : bool [mailbox] } } state "Idle -> Running -> Draining" id=lifecycle tag=render { note "Zero CPU wakeups while Idle" } } demux ..|> src : "implements" demux ==> ring : "enqueue packets" [1 -> 0..4096] worker ==> ring : "consume SPSC" tag=hot worker *-> frame : "produces" frame -> fmt : "tagged by" worker ==> presenter : "frame handoff" [1 -> 2] tag=hot presenter ..> lifecycle : "tracks state" route=bezier