Add RTX super resolution postprocessor#395
Conversation
Greptile SummaryThis PR adds an NVIDIA RTX Video Super Resolution post-processor (
Confidence Score: 5/5Safe to merge; new code paths are well-isolated behind optional nvvfx and the existing postprocess chain abstraction, and the FFmpeg rewrite addresses all previously flagged output-writing issues. The RTX post-processor, WebRTC session input override, HUD toggle, and FFmpeg writer are all implemented correctly with proper resource lifecycle management and CUDA synchronization. No functional regressions were found across the changed paths. No files require special attention beyond the cosmetic HUD label noted above. Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser
participant Server as aiohttp Server
participant Manager as OmnidreamsWebRTCSessionManager
participant Runtime as OmnidreamsInferenceRuntime
participant VFX as nvvfx.VideoSuperRes
Browser->>Server: GET /api/postprocess/options
Server-->>Browser: "{default_preset, presets[]}"
Browser->>Server: "POST /api/session/input {postprocess_preset}"
Server->>Manager: set_pending_session_input(OmnidreamsSessionInput)
Manager->>Manager: resolve_postprocess_preset(preset) [validate]
Server-->>Browser: "{postprocess_preset}"
Browser->>Server: WebRTC connect
Server->>Manager: _reset_runtime_for_session(session_input)
Manager->>Runtime: reset_for_new_session(session_input)
Runtime->>Runtime: _reset_postprocess_stream(session_input)
Runtime->>Runtime: VideoPostprocessStream created
loop Per generated chunk
Runtime->>VFX: effect.run(frame, non_blocking, stream_ptr)
VFX-->>Runtime: result.image (DLPack)
Runtime->>Runtime: cuda.synchronize (if non_blocking)
Runtime->>Runtime: from_dlpack(result.image).clone()
Runtime-->>Manager: video_chunk (processed, on GPU)
Manager-->>Browser: WebRTC video frame (CPU)
end
Reviews (3): Last reviewed commit: "Add optional NVIDIA VFX dependency extra" | Re-trigger Greptile |
Signed-off-by: Gangzheng Tong <gtong@nvidia.com>
Signed-off-by: Gangzheng Tong <tonggangzheng@gmail.com>
Signed-off-by: Gangzheng Tong <tonggangzheng@gmail.com>
Signed-off-by: Gangzheng Tong <tonggangzheng@gmail.com>
Signed-off-by: Gangzheng Tong <tonggangzheng@gmail.com>
|
/ok to test 1278c91 |
Benchmark Report
Summary
Add optional NVIDIA RTX Video Super Resolution and deblur postprocessing to FlashDreams, then wire it through all OmniDreams output paths:
flashdreams-rungeneration;The feature remains opt-in. Existing runs produce the same native-resolution output unless a postprocess preset is selected. The proprietary NVIDIA VFX bindings live in the dedicated
flashdreams[rtx-postprocess]optional extra, so they are not part of a default install. Video persistence requires a host-installedffmpegexecutable or fails with an actionable error; there is noimageio-ffmpegdependency or fallback.This branch is rebased onto
origin/mainateadf2596and adapts the feature to main's shared runner-I/O and reusable packaged-WebRTC infrastructure.Motivation
OmniDreams normally generates 1280×704 RGB frames. Displaying those frames in a larger browser or local window only performs conventional presentation scaling, which makes the postprocess toggle appear ineffective and does not expose the higher-resolution VSR result.
This change makes postprocessing part of the decoded-frame pipeline and preserves its native output size through presentation. With RTX VSR enabled, clients receive and display a true 2560×1408 raster. With it disabled, the 1280×704 stream remains centered at native size while the surrounding HUD canvas stays visible.
What changed
RTX postprocessor
RTXVideoSuperResolutionPostProcessorConfig, processor factory, and per-stream session underflashdreams.infra.postprocess.[-1, 1]video contract.nvvfx.VideoSuperResonly when an RTX preset is selected, with a clear runtime error whennvidia-vfxis unavailable.rtx-super-resolutionHIGHrtx-super-resolution-ultraULTRArtx-deblur-ultraDEBLUR_ULTRADeblur and super resolution are exposed as separate presets because the NVIDIA VFX API represents them as distinct quality modes; the same
VideoSuperResinvocation cannot requestDEBLUR_ULTRAand 2× scaling simultaneously.Offline generation
VideoPostprocessStream.runner_io.write_video_tensorhelper.ffmpeg, pad odd dimensions for YUV420p, reap failed encoder processes, and preserve FFmpeg diagnostics on broken pipes.imageio-ffmpeg; missing host FFmpeg fails loudly.Example:
WebRTC demo
--postprocess-presetas the server-side default./api/postprocess/options.create_packaged_webrtc_app(..., configure_app=...)hook.Example:
USE_LIBUV=0is required only for Windows PyTorch builds without libuv support; it is not part of the postprocessor itself.Local interactive demo and HUD
--postprocess-presetto the interactive-drive CLI.ON,OFF, orN/Astate.Performance benchmark
The benchmark used matched offline OmniDreams generations with and without
rtx-super-resolution.Setup
nvidia-vfxomnidreams-sv-2steps-chunk2-loc6-lightvae-lighttae239560dc-33d1-11ef-9720-00044bcbccacBoth variants ran in fresh processes with the same dependency environment, input, prompt, seed, model configuration, and frame count. RTX effective latency is the pipeline's
total_msplus the separately measured postprocess event.Results
Per measured chunk:
The first RTX call took 1,599.98 ms for five frames because it created and initialized the VFX session. Subsequent calls stabilized at 8.59–9.72 ms for eight frames. Long-lived demos should therefore initialize/warm the selected processor before latency-sensitive interaction when possible.
Fresh-process wall times were 133.71 seconds native and 103.04 seconds RTX, but they are intentionally not used as a performance conclusion: the native run executed first and populated shared checkpoint/compile caches, and wall time also includes model loading, graph compilation, input decoding, and MP4 encoding.
The benchmark was captured on pre-rebase feature commit
34bbd2ae. The RTX execution path and measured preset configuration are unchanged by the rebase; post-rebase CPU contract tests and static checks are reported below. A repeated GPU sweep would still be appropriate before treating the figures as a release SLA.Output quality analysis
There is no native high-resolution ground truth for this generated sequence. The quality comparison therefore uses a deterministic Lanczos 2× upscale of the exact 1280×704 generated output as the conventional-scaling reference and asks:
Metrics cover all 45 decoded H.264 CRF 18 frames:
Interpretation
RTX VSR is working: it produces four times as many output pixels and materially strengthens fine contours. In a 1:1 crop, the clearest changes appear around vehicle bodywork and wheels, lane markings, vegetation, and utility-pole edges.
The difference remains subtle when the full 2560×1408 image is reduced to the same on-screen size as 1280×704. That is expected: display downscaling discards much of the additional edge information. This is why the HUD now preserves native output resolution and expands the window only when the processed frame is larger.
The sharpness metrics should not be read as proof that RTX recovered ground-truth detail. Increased Laplacian/Sobel response can include useful detail, stronger existing contours, ringing, compression residue, or noise. The 5.4% increase in temporal frame delta may reflect sharper moving detail, temporally varying enhancement, or both; this 1.5-second sample is too short to label it as flicker.
Both comparison videos were independently encoded as H.264 CRF 18/YUV420p, so the measurements include small codec differences. A reference-grade follow-up should start with known high-resolution footage, downsample it to the model resolution, apply VSR, and compare the result against the original high-resolution source.
The complete local benchmark report, logs, videos, full-frame comparison, close-up crop, and machine-readable metrics were generated separately in
artifacts/omnidreams_rtx_sr_benchmark_20260722and committed ondev/gtong/rtx-ss-reportasfea5f1db.Dependency and licensing behavior
nvidia-vfx==0.1.0.1is isolated in theflashdreams[rtx-postprocess]optional extra and recorded in the lockfile; it is not installed by default.nvidia-vfx; selecting an RTX preset performs the guarded import.uv pip install 'flashdreams[rtx-postprocess]'; workspace one-off commands can continue to useuv run --with "nvidia-vfx==0.1.0.1" ....ffmpegonPATH. Missing FFmpeg raises a clearRuntimeError.imageio-ffmpegdependency or fallback, avoiding redistribution of an FFmpeg binary through this Python dependency path.This keeps optional proprietary/runtime components outside the core Apache-2.0 package. Deployments remain responsible for reviewing and accepting the licenses of their separately installed NVIDIA VFX package and host FFmpeg build.
Validation
Post-rebase focused CPU suite:
Command:
Repository hooks over all PR files:
GPU/manual coverage completed before the rebase:
Limitations and follow-ups
nvidia-vfxpackage.rtx-deblur-ultrais same-resolution; it is not composited with the 2× presets in this PR.Reviewer guide
Suggested review order:
flashdreams/flashdreams/infra/postprocess/rtx.py— processor/session contract and VFX interop.flashdreams/flashdreams/infra/runner_io.py— host-FFmpeg-only writer behavior after the main refactor.integrations/omnidreams/omnidreams/webrtc/session.pyandwebrtc/server.py— per-session selection and lifecycle.integrations/omnidreams/omnidreams/interactive_drive/world_model/flashdreams_adapter.py— local worker postprocess state.integrations/omnidreams/omnidreams/interactive_drive/slangpy_hud_presenter.py— native-resolution presentation and HUD interaction.