Nvvfx videosuperres - #797
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There are confirmed logic issues in the NVVFX path (misleading global runtime buffer logs/warnings and a width/height check that can skip the NVVFX pass).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new NVVFX-based resize algorithm nvvfx-videosuperres (MAXINE VideoEffects SDK 1.2 “VideoSuperRes”) to NVEnc’s NVEncCore resize pipeline, including CLI parameter plumbing and documentation/help updates.
Changes:
- Introduces
RGY_VPP_RESIZE_NVVFX_VIDEO_SUPER_RES+nvvfx-videosuperresoption and wires it through resize selection/printing. - Adds
videosuperres-quality=<int>parsing and command/help/doc generation. - Implements
NVEncFilterNvvfxVideoSuperRes, including RGBA U8 (SDK 1.2+) vs legacy BGR F32 (older runtime) buffer handling and ratio-search initialization.
File summaries
| File | Description |
|---|---|
| NVEncCore/rgy_prm.h | Adds the new resize enum + string mapping and exposes videosuperres-quality as a resize parameter. |
| NVEncCore/rgy_cmd.cpp | Extends --vpp-resize help text with videosuperres-quality semantics and constraints. |
| NVEncCore/NVEncFilterResize.cu | Adds initialization path and runtime execution support for the new NVVFX VideoSuperRes resize filter. |
| NVEncCore/NVEncFilterParam.h | Adds VppNvvfxVideoSuperRes and default quality constant to the shared VPP parameter model. |
| NVEncCore/NVEncFilterParam.cpp | Implements printing/comparison, parses videosuperres-quality, and emits it in generated command lines. |
| NVEncCore/NVEncFilterNvvfx.h | Adds VideoSuperRes effect selectors + new parameter/filter class declarations and RGBA buffer support members. |
| NVEncCore/NVEncFilterNvvfx.cpp | Implements the VideoSuperRes NVVFX effect, including buffer allocation/conversion changes. |
| NVEncCore/NVEncFilter.h | Extends resize filter params/state to carry the new NVVFX VideoSuperRes configuration and instance. |
| NVEncCore/NVEncCore.cpp | Ensures NVVFX is enabled for the new algorithm and enforces same-res creation behavior for quality 8–15. |
| NVEncC_Options.en.md | Documents nvvfx-videosuperres and videosuperres-quality usage/constraints (English). |
| NVEncC_Options.ja.md | Documents nvvfx-videosuperres and videosuperres-quality usage/constraints (Japanese). |
| NVEncC_Options.zh-cn.md | Documents nvvfx-videosuperres and videosuperres-quality usage/constraints (Simplified Chinese). |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (pResizeParam->frameOut.width != ppOutputFrames[0]->width | ||
| && pResizeParam->frameOut.height != ppOutputFrames[0]->height) { | ||
| int nvvfxOutputNum = 0; |
| // VFX SDK 1.2+ expects RGBA U8 interleaved buffers for VideoSuperRes, | ||
| // while pre-1.2 runtimes (0.7.x) only accept the legacy BGR F32 planar | ||
| // layout. Pick the buffer format by the loaded runtime version so that | ||
| // behavior on older runtimes stays identical to the legacy format. | ||
| { | ||
| uint32_t vfxVersion = 0; | ||
| if (err_to_rgy(NvVFX_GetVersion(&vfxVersion)) == RGY_ERR_NONE | ||
| && vfxVersion >= ((1u << 24) | (2u << 16))) { | ||
| AddMessage(RGY_LOG_DEBUG, _T("nvvfx runtime version %d.%d: using RGBA U8 buffers.\n"), | ||
| (vfxVersion >> 24) & 0xff, (vfxVersion >> 16) & 0xff); | ||
| } else { | ||
| m_bgraU8 = false; | ||
| AddMessage(RGY_LOG_WARN, _T("nvvfx runtime version %d.%d does not support RGBA U8 buffers (requires 1.2+), using legacy BGR F32 planar buffers.\n"), | ||
| (vfxVersion >> 24) & 0xff, (vfxVersion >> 16) & 0xff); | ||
| if (auto prmVsr = dynamic_cast<const NVEncFilterParamNvvfxVideoSuperRes*>(pParam.get()); | ||
| prmVsr != nullptr && prmVsr->nvvfxVideoSuperRes.quality >= 8) { | ||
| AddMessage(RGY_LOG_ERROR, _T("quality 8-19 requires VFX SDK 1.2 or later, but the loaded nvvfx runtime is %d.%d. Please install or update the NVIDIA Video Effects runtime, or use quality 1-4.\n"), | ||
| (vfxVersion >> 24) & 0xff, (vfxVersion >> 16) & 0xff); | ||
| return RGY_ERR_UNSUPPORTED; | ||
| } | ||
| } | ||
| } |
…log to VideoSuperRes - run the post-resize nvvfx pass when either output dimension differs from the target: the previous && condition (inherited from upstream) silently skipped the AI pass when only one dimension differed - perform the RGBA U8 runtime-version detection only for the VideoSuperRes effect, so other nvvfx effects no longer log misleading buffer-format messages
|
Thank you for the pull request! I don't think retaining backward compatibility is necessary in this case. Therefore, I'm sorry for the extra work, but would you please remove the current codes for SDK 1.0-1.1, and replace |
Summary
Adds a new resize algorithm
nvvfx-videosuperresusing theVideoSuperReseffectintroduced in NVIDIA MAXINE VideoEffects SDK 1.2 (in SDK 1.0/1.1 the same feature
was named
SuperRes).videosuperres-quality=<int>(1 - 19, except 5 - 7, default = 1):created even when no resize is requested, and an explicit
--output-resmatching the input resolution is required. Modes 1 - 4 and 16 - 19 are
upscalers and follow the normal resize rules (intermediate ratio search like
nvvfx-superres).runtimes the filter falls back to the legacy BGR F32 planar buffers and warns.
NVEncC_Options.en.md/.ja.md/.zh-cn.md).Design note
SDK 1.2 renamed SuperResolution to VideoSuperResolution and changed both the
parameter semantics (quality levels replacing mode/strength) and the required
buffer format (RGBA8). I therefore added a separate
nvvfx-videosuperresalgorithm instead of extending
nvvfx-superreswith runtime version detection,so users on SDK 1.0/1.1 are unaffected. If you would rather have a single
nvvfx-superresalgorithm that switches on the SDK version, I'm happy torework it that way.
Testing
--output-res, 16 - 19 upscaling; same-res mode without--output-rescorrectly errors out.
Notes
Related PR: ngx-vsr quality 8 - 19 support (the same SDK 1.2 dll also exposes
these modes through the NGX path)
Runtime / SDK
Install the Video Effects SDK Core,
then run
install_feature.ps1with the feature namenvvfxvideosuperres.Per the SDK docs, the effect's GPU buffers are BGRA/RGBA interleaved 8-bit
(what the filter uses on SDK 1.2+ runtimes), and the suggested minimum input
resolution is 360p.