Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++

checkpoint: preserve pre-stability plan and unaccepted overlap experiment

Veyra Goal Agentd2ae8eebb5e9
diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.md
index f371da0f..1b2dca1d 100644
--- a/docs/CURRENT_STATUS.md
+++ b/docs/CURRENT_STATUS.md
@@ -1,5 +1,29 @@
# 当前项目状态 / Current Status
+## 当前执行入口(2026-09-21,链路复核后)
+
+最新方案:[补帧稳定性与现有功能收尾](FG_STABILITY_COMPLETION_PLAN_2026-09-21.md)。
+本轮只完成方案和文档更新,尚未按新方案改代码或运行测试。
+开发工作区为 `E:/项目/Veyra/worktrees/playback-nr-20260920`,
+分支 `codex/fg-utilization-20260921`、HEAD `e71d715`;现存未提交实验不等于已验收。
+正式版仍为1.4.3,最新本地交付仍为下述1.4.4beta。
+
+- **XeSS**:真实1080p到4K超分+NR+4X的源帧连续性比1.4.3差;旧版反复
+ 关闭补帧,不能直接恢复它并宣称4X修好。果冻感、功耗波动尚未解决。
+- **DLSS**:4X/6X重负载均匀呈现仍未通过;不能将原生4K输入的高FPS套用到真实超分。
+- **输出限制**:默认不限制;XeSS/FSR输出限帧尚未完成。
+- **NR**:防闪默认关闭、部分样本验证通过,快速游戏画质及重负载有待验收;
+ 独立降噪未接入,模型风格仍为0/1/2,NR叠层继续暂缓。
+- **UI/字幕/采集**:已有修复和局部回归不撤销;快速滚动、物理跨屏、受影响
+ 设备及HDR浮窗观感不得算全面通过。杜比视界新处理继续暂缓。
+
+最新同条件证据见[版本对照](RELEASE_143_SCHEDULING_COMPARISON_2026-09-21.md),
+原因与未知项见[链路审查](FG_PIPELINE_REASSESSMENT_2026-09-21.md)。
+下文按历史顺序保留;“未发现回退”“通过”“最新”等只适用于对应日期和工况,
+与本节冲突时以本节及其引用证据为准。
+
+## 既有交付与历史记录
+
2026-09-21 local test package delivered from source checkpoint `f029707`:
`E:/项目/Veyra/test-packages/1.4.4beta-20260921-nr-followup/`.
Seven portable smokes, packaged DLSS/XeSS switching and 124-file ZIP
diff --git a/docs/FG_PIPELINE_REASSESSMENT_2026-09-21.md b/docs/FG_PIPELINE_REASSESSMENT_2026-09-21.md
new file mode 100644
index 00000000..f92bcd1e
--- /dev/null
+++ b/docs/FG_PIPELINE_REASSESSMENT_2026-09-21.md
@@ -0,0 +1,129 @@
+# Frame-generation pipeline reassessment
+
+## Scope
+
+User cancelled further Magpie binary benchmarking and requested architectural
+diagnosis and remedies. This is source review using existing evidence, not
+implementation or new performance/physical-display acceptance.
+
+Veyra: e71d715, codex/fg-utilization-20260921, worktree
+E:/项目/Veyra/worktrees/playback-nr-20260920. Existing dirty overlap experiments
+are preserved and are not accepted fixes. The desktop checkout is older.
+Magpie: clean SAOG0721/Magpie checkout at
+3841698348bfb246623d4acf791984c8b68a577b under
+E:/项目/Veyra/downloads/magpie-six-issue-audit-20260920. Equivalence with the
+user's installed executable has not been established.
+
+## First principles and Magpie findings
+
+Smooth output requires correct temporal image positions, regular delivery,
+and continuous fresh source coverage. Average FPS alone proves none of these.
+60 FPS input gives a 16.667 ms source period; ideal 4X/6X output spacing is
+4.167/2.778 ms. Bursts separated by holes can report high average throughput.
+Five DLSS evaluations consume real work. Sustained critical-path cost above
+the source period cannot be fixed just by adjusting deadlines. Coarse GPU busy
+percentage neither proves spare critical resources nor excludes stalls.
+
+Magpie DLSS is D3D11 captured input/effects -> shared input/fence -> D3D12
+NGX evaluations -> shared output slots -> frontend FIFO/deadlines -> present.
+DLSSFrameGenerator waits on a CPU fence per generated image before reuse;
+Renderer also waits for shared-copy completion. It is not wait-free or a single
+inexpensive 4X call. Frontend retries deadlines/capacity and re-anchors after
+long stalls. A full ring backpressures capture, potentially costing source
+acceptance and frame age. Stable low latency is not proved.
+
+FramePacingOptions::ResolvePresentationFrameRate uses refreshRate/multiplier
+when the requested limit is zero; Renderer uses it as a base limit when sync
+is enabled. At 100 Hz and 4X this branch yields 25 base FPS. This is a possible
+explanation for a 25 FPS observation, not proof of the user's active settings.
+
+Magpie's patched XeSS path estimates accepted source cadence from source IDs
+and timestamps, a nine-sample median, discontinuity resets, and a fallback
+subtracting measured extra wait. This distinction is worth investigating;
+it is not proof that Magpie output is stable or superior.
+
+## Problems and remedies
+
+### 1. Heavy XeSS 4X regression: confirmed
+
+Existing matched true 1080p-to-4K Video SR + NR comparison: source58.51 ->
+39.84 FPS versus 1.4.3; SDK output96.39 ->129.79 FPS. The old version repeatedly
+suppressed generation. Restoring suppression is not a successful 4X repair.
+Native-input XeSS4 sustained source60/SDK240 in both versions.
+
+Current diagnostic pacing bypass reached source51.98/SDK183.61 versus normal
+39.84/129.79, GPU busy94.81% versus72.73%. Pacing/backpressure has meaningful
+cost, but bypass is unaccepted because delivery remains unproved. Veyra passes
+frameRenderTime=0 to avoid feeding its own wait back; zero alone is not an API
+violation. Next, align source ID/PTS, XeLL/Present entry/exit, resource
+retirement and all subframe/boundary intervals. Verify whether blocked input
+delivery inflates the provider's period estimate and which clock its parameter
+represents. Only then try source-aware timing with resets. Do not feed nominal
+16.667 ms across source skips or blindly remove pacing.
+
+### 2. DLSS high output still has long holes: confirmed
+
+Native NR DLSS6 submitted272.03 ->268.23 FPS old/current, with gap P99 about
+16.9 ms in both. True SR + NR currently submitted about134/138 FPS at4X/6X.
+These counters describe application submissions, not physical scanout.
+
+FgRecoveryBudget::admitFile checks first and last deadlines for a group.
+EnhanceGraph tracks skipped FG history and may reseed with one evaluation.
+Admission/recovery can leave interpolation holes; their measured share versus
+late discard/GPU waits still needs per-group attribution. Link every hole to
+rejection reason, estimated/actual GPU cost, fence readiness and warmup
+outcome. Fix demonstrated estimation/rejection errors; preserve discontinuity
+resets and per-output validity/fence ownership. Do not force late groups into
+the queue or silently reduce the multiplier.
+
+### 3. Input and presentation coupling: structural risk, not proven root cause
+
+EngineController services source reads and presentation progress on the same
+owner thread with bounded occupancy/resource gates. Blocking reads or provider
+Present can delay the other responsibility. Trace the actual blocked boundary
+before moving it to bounded asynchronous handoff. Seek, resize, provider switch
+and shutdown must retire resources correctly. Do not add unbounded queues.
+
+### 4. Real GPU cost and overlap: limited remaining opportunity
+
+Historical serial measurements were17.5-17.7 ms/input, including about9.73 ms
+for five FG evaluations in those runs. Removing roughly0.083 ms inter-call gaps
+cannot recover the whole deficit. A separate DLSS present queue exists. The
+opt-in NVOF/Video SR overlap experiment is off and unaccepted. Only overlap
+independent work with proved resource/fence lifetimes. Larger rings, priority,
+blind queue splitting and fixed20/35/50 ms holds were tried; consult
+FG_NON_NR_EXPERIMENTS_2026-09-20.md before repeating failed directions.
+
+### 5. Motion quality and diagnostic coverage
+
+Regular submissions cannot cure wrong motion scale, frame identity, history or
+occlusion. Check source/previous texture identity, motion extent and temporal
+position before blaming sharpening for XeSS wobble. Acceptance must include
+source coverage, frame age and whole-stream interval tails. Hook-return
+intervals are not GPU execution or scanout; in-burst averages omit boundary
+holes.
+
+### 6. NR anti-flicker is not independent denoising
+
+Temporal stabilization targets NR residual changes and defaults off. It is not
+a completed independent denoiser. The old42 ms statistic is not added
+anti-flicker delay; see NR_FG_FOLLOWUP_ACCEPTANCE_2026-09-21.md. The attempted
+NvVFX path was unavailable in the tested package. A working GPU-only provider
+and quality/ghosting validation remain necessary. Keep this separate from FG
+scheduling. NR multilayer remains deferred.
+
+## Order and acceptance
+
+1. XeSS heavy-load timing/backpressure attribution, one isolated remedy.
+2. DLSS per-group hole attribution and demonstrated estimation/continuity fixes.
+3. CPU blocking isolation or independent GPU overlap only if evidence warrants.
+4. Motion-quality validation and independent denoising as separate work.
+
+Checkpoint before implementation. Keep media, resolution, model quality and
+multiplier fixed. Require repeatable whole-stream cadence/source-coverage
+improvement without increased frame age, visual regression or lifecycle
+failure. Revert failed experiments and record them. No artificial delay,
+hidden fallback, or endless attempts to exceed sustained hardware capacity.
+
+Existing numerical evidence and artifact locations are documented in
+RELEASE_143_SCHEDULING_COMPARISON_2026-09-21.md.
diff --git a/docs/FG_STABILITY_COMPLETION_PLAN_2026-09-21.md b/docs/FG_STABILITY_COMPLETION_PLAN_2026-09-21.md
new file mode 100644
index 00000000..8048344f
--- /dev/null
+++ b/docs/FG_STABILITY_COMPLETION_PLAN_2026-09-21.md
@@ -0,0 +1,170 @@
+# 补帧稳定性与现有功能收尾方案
+
+日期:2026-09-21。状态:方案已编写,以下阶段尚未按本方案执行。
+本轮只更新文档,不启动性能测试、产品修改、构建、打包或发布。
+
+## 目标与边界
+
+目标是减少长空档、保持源画面连续并改善插值正确性,同时保留用户选择的
+倍率、分辨率、增强质量和功能。平均 FPS 提升不能单独作为修复完成依据。
+不添加固定等待,不自动降倍率,不靠模糊、关闭效果、降低内部尺寸或偷偷
+丢更多源帧制造收益。既有有界实时追赶仍须按真实 PTS 处理并记录丢帧。
+
+本机 RTX 5070 是工程验收基准;其他硬件交给用户内测,不阻塞本机修复,
+也不能把本机通过写成全部型号通过。NR 叠层、杜比视界新处理路径继续暂缓。
+已决定停止的泛化 1.4.2/1.4.3 功耗调查不重启;只研究本方案能复现的具体问题。
+
+60fps 源帧间隔为 16.667ms,4X/6X 的理想输出间隔为 4.167/2.778ms。
+必须分别观察源帧覆盖、生成画面的时间位置、提交间隔和帧龄。
+软件提交、SDK 内部提交、系统显示事件、屏幕实际发光是不同指标。
+GPU 平均占用低不证明关键资源有余量;功耗平稳也不独立证明流畅。
+
+## 基线与当前状态
+
+- 工作区:`E:/项目/Veyra/worktrees/playback-nr-20260920`。
+- 分支:`codex/fg-utilization-20260921`,当前 HEAD `e71d715`。
+- 已交付 beta:`f029707` 对应
+ `E:/项目/Veyra/test-packages/1.4.4beta-20260921-nr-followup/`。
+- 正式版参照:`v1.4.3` / `3b4570e`,不代表高倍率稳定性已经通过。
+- 现存未提交的光流/超分重叠实验、质量探针和脚本必须先清点,单独保存,
+ 不覆盖、不混入基线,也不把默认关闭的实验视为已验收优化。
+- 实施前为实际基线和实验状态分别创建可恢复存档。每项验收通过的修改独立
+ 提交;失败时只撤销本项改动,保留证据,不回退用户或其他任务的修改。
+
+| 项目 | 当前结论 | 后续归属 |
+| --- | --- | --- |
+| XeSS 4X 重负载源帧连续性 | 比 1.4.3 差;旧版反复停补帧,不是正确修复基准 | P1 |
+| DLSS 4X/6X 长空档 | 仍存在;不是所有负载都失败 | P2 |
+| 果冻感/变形 | 未取得改善验收证据 | P1/P2 图像合同检查 |
+| 输出限帧 | 默认不限制;XeSS/FSR 路径尚不支持 | P3 |
+| UI 布局/采集启动 | 已修并有局部回归,快速滚动与真实跨屏仍未完整验收 | P4 |
+| 字幕两行缩小/全屏锁定 | 默认字号已修、锁定已实现,HDR浮窗行为仍需核对 | P4 |
+| NR 防闪 | 已实现且默认关闭,部分样本有效,快速运动与重负载仍有限制 | P5 |
+| 独立降噪 | 未接入,已有 VFX 创建尝试失败 | P6 |
+| NR 模型风格 | 仍为 0/1/2,033 未提供可移植的新模型风格 | 不虚构新编号 |
+| GC551/GC573 等设备反馈 | 未有受影响设备修复验收 | 保留问题,不宣称解决 |
+| Elgato HDR | 有用户修复成功反馈,禁止推广为全设备验收 | 保留修复及回归 |
+
+## P0:收拢证据,建立可归因基线
+
+优先复用现有日志、源码与测试,不重复大矩阵跑分。固定媒体片段、效果顺序、
+NR内部尺寸、超分模式/质量、光流、窗口/交换链尺寸、显示模式和运行库身份。
+原生4K输入到4K不等于真实1080p超分到4K。XeSS与DLSS目前输出尺寸不同,
+不能把不同像素负载的跨后端结果当性能排名。
+
+先做时间线对齐:source ID、epoch、revision、真实 PTS、A/B 身份、子帧索引、
+生成有效性、预算拒绝原因、GPU提交/完成、XeLL、Present起止、队列驻留。
+复用有界内存追踪;整段在线累计间隔分布及长空档,不能只报告最后几秒或
+一组生成帧内部间隔。采样导出在测试结束后做,禁止正常播放逐帧写盘或像素回读。
+跨CPU/GPU时钟需校准;没有校准的数据分别报告,禁止相加无关阶段P95。
+
+产出:给主要长空档分类并标出证据覆盖率及未知部分。无证据不改调度。
+
+## P1:XeSS 时间与帧对应关系
+
+参照 Magpie fork `3841698348bfb246623d4acf791984c8b68a577b` 的源码,
+不再把不同输入链路的二进制面板跑分作为优劣判定。
+
+1. 核对输入纹理、上一帧、光流、尺寸/单位/方向与 A/B 时间间隔是否一致;
+ 覆盖跳帧、重复画面、重置、缩放和格式切换。游戏原生向量不可假定在视频中存在。
+2. 分开真实源时间、接受输入时间、GPU工作时间及SDK等待。确认 `frameRenderTime`
+ 在当前SDK和兼容补丁中的实际用途。当前传0不是已证实错误。
+3. 优先验证“Present反压使估计周期变长,进一步拖慢输入”的反馈假设。
+ 若成立,试验源身份/时间戳感知估计与明确重置;Magpie的中位数估计只作候选。
+ 不能把名义16.667ms硬填到实际跳过多帧的输入,也不能重复扣除等待。
+4. 若证据指向资源等待或XeLL标记周期,则只修该处;不同时换光流和节奏算法。
+
+核对文件:`src/engine/VideoPresenter.cpp`、`src/gfx/XessPresenter.cpp`、
+`src/gfx/XessPacing.cpp`、`src/engine/EngineController.cpp`。
+Magpie来源重点:`XeSSFGTiming.h`、`XeSSFGPresenter.cpp`、`Renderer.cpp`。
+复用代码须记录固定提交、GPLv3来源、实际改动和第三方声明。
+
+完成条件:同负载源帧覆盖和整段输出节奏改善,帧龄不增加,图像对应关系正确,
+轻载2X/4X及切换/缩放不退步。若仅FPS上涨、突发更重或变形增加,则回退。
+本地XeSS最高4X,禁止把DLSS6X配置当XeSS6X验收。
+
+## P2:DLSS 整组空档与恢复
+
+对每次长空档关联:首/尾截止时间、预算估计、实际GPU耗时、整组拒绝、
+过期丢弃、状态回读、历史预热。先区分“来不及算”和“有时间却被错误拒绝”。
+重点检查 `FgRecoveryBudget.h`、`EnhanceGraph.cpp`、`EngineController.cpp`。
+
+只修证实的重复计费、失效估计、错误期限或不必要恢复。需要恢复的历史不能
+跳过;每个生成输出仍须有匹配的有效性和fence。不能无限强制接纳晚到的整组。
+保留2X/4X/6X选择,不以自动降档替代用户请求。
+
+仅当时间线证明存在可消除空闲时,再选择一个方向:隔离阻塞的源读取/Present,
+或让真正独立的NVOF与Video SR工作重叠。资源所有权、取消、退休和队列上限先
+写清再实现。已有独立呈现队列,不把再加队列当新方案。
+
+完成条件:长空档数量/尾部间隔下降,生成有效覆盖不减少,源覆盖、帧龄、音频
+及画质不退步。计算能力不足的组合报告实测边界,不宣称稳定满倍率。
+
+## P3:完成输出限帧合同
+
+默认保持不限制;用户限帧与垂直同步、显示刷新率分别保存和解释。
+先验证XeSS/FSR提供方是否有可用输出节奏接口,禁止直接把真实输入限制成
+目标输出FPS/倍率来冒充输出限制。不能按显示刷新率偷偷降低源帧率。
+若需呈现层选择帧,必须证明不破坏SDK队列、生命周期和均匀采样合同;
+明确这是输出上限,不保证任意倍率/刷新率都能等间隔显示。
+
+覆盖不限、30/60/120、自定义非整除值、动态切换、保存恢复、垂直同步开关。
+24fps影片在60Hz上无法显示120张完整独立画面每秒,不作错误承诺。
+没有正确集成路径时保留明确“未完成”,不得伪装成功。
+
+## P4:现有功能回归收尾
+
+- UI:快速滚动、收放分组、下拉悬停、数值输入、单项还原、NR预设、专业窗口
+ 连续拖动和缩放;核对重叠、残影、闪烁和坐标漂移。布局单测不代替动态目视检查。
+- 字幕:同字号单行/双行/多行、文本/图形、字幕切换及连续调节;保留屏幕溢出保护。
+- 全屏锁定:鼠标移动不弹控件,退出路径有效;记录HDR状态与交换链重建,不能
+ 仅因锁定按钮有效就宣称HDR色调跳变消除。
+- 采集:在本机可用设备验证首帧、持续呈现、格式/帧率切换及断开恢复;没有有效
+ 信号时不能当游戏验收,视频也不能代替DirectShow采集验收。
+- DLSS/XeSS切换、seek、暂停恢复、场景切换、缩放/DPI、退出和初始化失败回退。
+ 本机只有单屏时明确记录真实跨屏未测,合成DPI不冒充物理多屏通过。
+- 保留HDR颜色合同、调色、截图、设置迁移;共享图有修改时增加针对性导出回归。
+
+只修复复现问题,不做全UI重构或全采集架构替换。
+
+## P5/P6:NR 防闪与独立降噪分开交付
+
+P5:防闪默认关闭。使用相同源帧对比关闭/开启,重点快速转身、遮挡、细线、
+文字、肤色、暗部噪点、切镜和HDR。既看残差闪烁,也看细节及拖尾;边缘能量
+不等于细节全保留。历史权重有视觉响应代价,不因没有额外未来帧就声称零延迟。
+先定位GPU成本/历史拒绝问题再优化,不通过强平滑换取低闪烁数值。
+
+P6:独立降噪先完成最小GPU-only创建、输入输出与质量验证,再讨论产品接入。
+之前NvVFX创建失败不等于本机显卡不支持;仅在有新接口/依赖证据时重试。
+不能把超分质量编号或命名预设说成新NR模型风格。无可用实现则明确未完成,
+不追加空开关;新运行组件需遵守现有来源、许可和发布授权规则。
+
+## 有限实验与验收规则
+
+每个已定位假设先做一个最小候选;失败后最多一次有新证据的修订,无新证据
+立即停该方向。禁止换参数无限刷跑分。旧失败方向查
+[非NR实验记录](FG_NON_NR_EXPERIMENTS_2026-09-20.md),不无理由重复。
+
+诊断通常10-30秒,候选采用相同片段顺序交错的30秒对照;只在有稳定收益时做
+120秒持续验证。每次进程最长300秒并带watchdog;构建与GPU性能测试不并行。
+记录全段和稳态段,启动、切镜另列;不同运行的收益必须超过基线自身波动。
+已有证据足够时不重跑,观察不到生成帧实际间隔或像素时明确该项未验收。
+
+验收同时记录:源帧覆盖/跳帧、有效生成帧、整段间隔P50/P95/P99/max与长空档
+次数、提交突发、帧龄/队列驻留、音频连续性、GPU耗时/等待以及画质。
+功耗/占用仅辅助定位。不增加固定等待,也不接受通过增加排队获得的平滑收益。
+
+每阶段状态用“待执行/已定位/候选验证/接受/回退/受条件限制”,禁止把进程退出0
+写成画质或帧节奏通过。接受后创建独立Git存档,记录命令、EXE及运行库身份、
+测试配置、结果、未测范围和可回退点。最终再决定是否制作新beta。
+
+产物统一在 `E:/项目/Veyra/{tests,logs,tmp,build}/fg-stability-20260921/`;
+源码、方案和WORKLOG在当前工作区。不推送、不发布、不替换现有交付包。
+
+## 证据入口
+
+- [当前状态](CURRENT_STATUS.md)
+- [链路审查](FG_PIPELINE_REASSESSMENT_2026-09-21.md)
+- [同条件1.4.3对照](RELEASE_143_SCHEDULING_COMPARISON_2026-09-21.md)
+- [已交付beta验收及限制](NR_FG_FOLLOWUP_ACCEPTANCE_2026-09-21.md)
+- [UI、采集及原六项需求纠偏](CORRECTIVE_AUDIT_2026-09-21.md)
diff --git a/docs/FG_UTILIZATION_REPAIR_2026-09-21.md b/docs/FG_UTILIZATION_REPAIR_2026-09-21.md
new file mode 100644
index 00000000..85836106
--- /dev/null
+++ b/docs/FG_UTILIZATION_REPAIR_2026-09-21.md
@@ -0,0 +1,41 @@
+# High-multiplier utilization investigation
+
+> This experiment plan is historical. Further broad benchmark runs were stopped
+> by the user. Follow [the current bounded repair plan](FG_STABILITY_COMPLETION_PLAN_2026-09-21.md)
+> for subsequent work; existing experiments are not automatically accepted.
+
+Authorized 2026-09-21: continue high-multiplier repair with different NR/SR/FG
+combinations and GPU utilization evidence. Baseline e71d715, checkpoint
+pre-fg-utilization-20260921; branch codex/fg-utilization-20260921 in the
+existing playback-nr worktree. No publication or runtime replacement.
+
+Use the local RTX 5070, p001 4K60 and its matched 1080p60 derivative.
+Native 4K has SR off; derived1080 uses RTX Video SR quality 3 to 4K.
+Cross NR off/on with DLSS 2X/4X/6X; compare XeSS 4X separately, because
+the current provider supports at most 4X. Include no-FG controls where useful.
+All cases use the same professional preview, default Performance flow,
+temporal NR off initially, no frame cap/pacing override, 30-second sequential
+runs with watchdogs. No compilation while GPU tests run.
+
+Sample system NVML read-only at 200 ms: GPU busy percentage, memory-controller
+busy percentage, power, clocks, temperature and VRAM. These are device-wide,
+coarsely averaged indicators, not SM occupancy or proof of frame-scale idle.
+Record host timestamps, skip startup in summaries and correlate with product
+stage timings, admissions and the bounded per-frame trace. Never infer GPU
+saturation from one utilization number or add unrelated stage P95s.
+
+Investigate the reproduced limiting combination using measured per-input
+dependencies. Read the failed-experiment record before modifications. Do not
+repeat priority, speculative timing, guidance resolution, fixed holdback or
+unsafe queue splits without new evidence. Keep output quality, resolution,
+NR processing policy and multiplier unchanged in repair comparisons.
+Save retained changes separately; revert experiments without repeatable gain.
+
+Acceptance requires repeated cadence/coverage benefit, no extra fixed delay,
+NR/SR still evaluated, no new dropped source coverage, lifecycle tests and
+targeted GPU checks. Distinguish app submissions, XeSS provider throughput
+and unmeasured physical scanout. A failed bounded experiment is not a fix.
+
+Artifacts: E:/项目/Veyra/{tests,logs,tmp}/fg-utilization-20260921.
+Reuse build/playback-nr-20260920 with explicit dependency/temp paths.
+The baseline portable package stays unchanged.
diff --git a/docs/NR_FG_NEXT_REPAIR_PLAN_2026-09-21.md b/docs/NR_FG_NEXT_REPAIR_PLAN_2026-09-21.md
index 4b8885a7..e2037426 100644
--- a/docs/NR_FG_NEXT_REPAIR_PLAN_2026-09-21.md
+++ b/docs/NR_FG_NEXT_REPAIR_PLAN_2026-09-21.md
@@ -1,5 +1,10 @@
# NR / frame generation: next repair plan
+> Historical execution plan. Current scope and remaining work are tracked in
+> [FG stability completion plan](FG_STABILITY_COMPLETION_PLAN_2026-09-21.md).
+> The goal-active statement below describes that earlier task, not a new goal.
+> Latest matched heavy-XeSS regression evidence supersedes earlier broad comparisons.
+
## Scope and baseline
User decision: stop investigating the general 1.4.3 versus 1.4.2 overhead
diff --git a/docs/PLAYBACK_SIX_ISSUE_AUDIT_PLAN_2026-09-20.md b/docs/PLAYBACK_SIX_ISSUE_AUDIT_PLAN_2026-09-20.md
index 713a8437..7c4c6cf8 100644
--- a/docs/PLAYBACK_SIX_ISSUE_AUDIT_PLAN_2026-09-20.md
+++ b/docs/PLAYBACK_SIX_ISSUE_AUDIT_PLAN_2026-09-20.md
@@ -1,5 +1,12 @@
# Playback, subtitles, HDR and NR: investigation and proposed work
+> Historical proposal and implementation notes. Use
+> [current plan](FG_STABILITY_COMPLETION_PLAN_2026-09-21.md) and
+> [corrective audit](CORRECTIVE_AUDIT_2026-09-21.md) for current scope.
+> Output cap now defaults OFF; XeSS/FSR support is incomplete. The experimental
+> accepted-Present timing hint described below was reverted. Its description
+> as improved timing is not current acceptance. Dolby Vision work is deferred.
+
Date: 2026-09-20. Status: proposal only; no implementation authorized in this request.
## Evidence and limits
diff --git a/docs/RELEASE_143_SCHEDULING_COMPARISON_2026-09-21.md b/docs/RELEASE_143_SCHEDULING_COMPARISON_2026-09-21.md
new file mode 100644
index 00000000..3eee537e
--- /dev/null
+++ b/docs/RELEASE_143_SCHEDULING_COMPARISON_2026-09-21.md
@@ -0,0 +1,121 @@
+# Released 1.4.3 scheduling comparison
+
+## Finding
+
+The tested current version is not uniformly faster than released 1.4.3.
+Heavy Video SR + NR + XeSS 4X has substantially worse source continuity.
+DLSS 4X/6X and native-input XeSS 4X are approximately unchanged in these
+matched short runs. Neither version passes stable full-rate 6X with NR and
+true 1080p-to-4K Video SR. A higher generated-frame counter is not a cadence
+acceptance criterion.
+
+## Controls and scope
+
+- GPU: local RTX 5070, driver 616.56; video only, not capture/PS5 testing.
+- Released executable: releases/1.4.3/final/Veyra-1.4.3-win64-portable/Veyra.exe,
+ SHA256 F2A1E407D2FE136C32771BCF25068A6F595D51CC6B4F15766964B6A358B80676.
+ Source tag v1.4.3 is 3b4570e1f3f7301fcce21b829003bb8ef7854e24.
+- Current branch baseline: e71d715. The first current test executable is
+ 839316B4F64F5B66988A0BBA4C6E1867CAF1665BA93E4C121A12D0994F9BEE9C.
+ It contains an opt-in overlap experiment, OFF in this comparison. Repeat
+ using the already delivered beta executable is recorded below separately.
+- The delivered beta SHA256 is
+ 318C6B0F44ADFC3BD8094DFD5BA39B1570AA56C5D01E9A95BC40430DFD28BDA8.
+- All 21 compared runtime/dependency DLLs matched by SHA256. No DLL replacement.
+- Native case: p001.mp4, 3840x2160 60fps, SR off, NR internal 1920x1080.
+- True SR case: matched p001-derived1080.mp4, 1920x1080 60fps, RTX Video SR
+ quality 3 to 3840x2160, NR internal 1920x1080. This is extra SR computation,
+ unlike the native case; their FPS must not be directly compared as a regression.
+- Temporal NR off, Performance flow, professional view, default window,
+ output cap/pacing overrides off. Same options and dimensions in both logs.
+- XeSS wraps a 2560x1440 swapchain; DLSS generates at 3840x2160. This is a
+ same-provider version comparison, not an equal-pixel provider benchmark.
+- Sequential 30-second runs. NVML sampled every 200ms, summarizing 10..29s.
+ GPU percentages are device-wide activity, not SM occupancy or scanout.
+
+Release 1.4.3 lacks the newer trace-file export. Common verbose logs are used
+for both versions, not an absent old trace treated as zero output. Counter
+rates use deltas in 10..29s; cadence excludes the first 10s after first Present.
+The old lateness sampler repeatedly sampled stale observations, so its P95
+lateness is NOT compared with the corrected current metric.
+
+## Matched verbose results
+
+| Same settings | 1.4.3 rate/s | Current rate/s | 1.4.3 gap P95/P99 ms | Current gap P95/P99 ms |
+| --- | ---: | ---: | --- | --- |
+| Native NR DLSS 6X | 272.03 | 268.23 | 16.418 / 16.934 | 16.397 / 16.899 |
+| True SR + NR DLSS 4X | 135.44 | 134.42 | 16.885 / 17.063 | 16.905 / 17.099 |
+| True SR + NR DLSS 6X | 139.67 | 138.05 | 16.933 / 17.125 | 16.936 / 17.127 |
+| Native NR XeSS 4X, source | 60.00 | 60.00 | 17.305 / 17.598 | 17.232 / 17.550 |
+| True SR + NR XeSS 4X, source | 58.51 | 39.84 | 21.447 / 30.279 | 39.637 / 40.921 |
+
+DLSS rate and gaps describe application presentation submissions. XeSS rows
+describe source processing and application Present-return gaps; the SDK's
+intermediate presents are not individually represented in those gaps.
+These observations cannot certify physical display smoothness or latency.
+
+XeSS SDK-reported output in the heavy case is 96.39/s in 1.4.3 and 129.79/s
+currently. That increased output coexists with worse source continuity.
+Native XeSS reports 240/s in both. Mean GPU activity for heavy XeSS falls
+from 79.74% to 72.73%; heavy DLSS remains approximately 92% in both versions.
+
+A second old-version run without verbose logs reports native DLSS6 273.49/s,
+SR+NR DLSS4 135.72/s, SR+NR DLSS6 137.19/s, native XeSS source60/output240,
+heavy XeSS source58.72/output93.75. It supports the major findings, but does
+not provide comparable per-frame gaps.
+
+## Attribution and diagnostic isolation
+
+1.4.3 repeatedly disables XeSS generation under load. Its heavy-case logs
+contain 27 and 37 suppress/resume transitions across the two 30-second runs,
+including enabled=0/framesPresented=1. It preserves source processing partly
+by not doing the requested interpolation during those intervals. This is not
+successful sustained 4X.
+
+Commit dd69e1f removed XessGenerationGate. XessPresenter.cpp and
+XessPacing.cpp have no source differences from v1.4.3. The gate removal and
+observed enable/disable behavior explain an important workload difference;
+a complete single-commit binary bisection has not been performed. Do not
+revert the entire mixed UI/capture-fix commit or restore silent suppression
+and describe it as a fixed 4X path.
+
+Two additional current controls isolate the heavy XeSS path:
+
+| Configuration | Source/s | SDK output/s | GPU mean | App gap P95/P99 ms |
+| --- | ---: | ---: | ---: | --- |
+| 2X, stock provider | 60.00 | 120.00 | 91.58% | 17.230 / 17.494 |
+| 4X, normal pacing | 39.84 | 129.79 | 72.73% | 39.637 / 40.921 |
+| 4X, diagnostic pacing disabled | 51.98 | 183.61 | 94.81% | 21.255 / 22.534 |
+
+The last control uses the existing VEYRA_DISABLE_XESS_PACING hook. It is not
+a shipping fix: unconstrained intermediate bursts are not accepted cadence.
+It shows meaningful scheduling/backpressure cost, but does not demonstrate
+that all remaining lost throughput is software overhead. No inference that
+73% busy guarantees enough compute for full 4X is justified.
+
+With normal pacing, the provider's scheduler is active (bypassed=0,
+refused=0). Heavy-case in-burst mean gaps settle near 8.2ms, versus 4.17ms
+for native NR XeSS4. The next focused investigation is the SDK scheduler's
+period estimate and application Present backpressure during source skips.
+Blindly setting frameRenderTime, removing pacing, adding fixed buffering,
+or moving SDK work to another queue without resource-retirement proof is
+not an accepted remedy.
+
+## Evidence and reproduction
+
+All artifacts below are rooted at E:/项目/Veyra/tests/fg-utilization-20260921:
+
+- release143-a: original released binary, five loads, normal logs.
+- release143-verbose-b: original released binary, same five loads, verbose.
+- current-verbose-a: current baseline, same loads in reversed order, verbose.
+- current-xess2-control and current-xess4-unpaced: isolation controls.
+- release-comparison-final.json and xess-isolation.json: common-log summaries.
+
+Commands: scripts/acceptance/fg-utilization-matrix.py with explicit --exe,
+--native, --derived, --output, --temp and --cases. Set
+VEYRA_VERBOSE_FRAME_LOGS=1 for the matched verbose runs. Analyze with
+scripts/acceptance/compare-release-scheduling.py <run-directories> --output
+<summary.json>. The result files preserve command arguments and EXE hashes.
+
+No rollback, publication, capture acceptance, or fixed-high-multiplier
+completion is claimed by this comparison.
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 1199dc41..ccc1fe32 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -5706,3 +5706,24 @@ This is software timing only, not display latency or subjective quality proof.
No independent denoiser was added because required VFX/NvCV/CUDA GPU-only
prerequisites and distribution identity remain unavailable. No guidance or
XeSS rollback was justified by the existing evidence. No release or shutdown.
+
+## 2026-09-21 FG architecture reassessment
+
+User cancelled further Magpie binary benchmarking and requested diagnosis and
+remedies. Reviewed active e71d715 worktree and clean Magpie fork
+3841698348bfb246623d4acf791984c8b68a577b: DLSS interop/fences, frontend FIFO,
+capacity/deadlines, XeSS source timing, Veyra admission/history recovery and
+existing matched 1.4.3 evidence. Added FG_PIPELINE_REASSESSMENT_2026-09-21.md
+with evidence boundaries, priorities and rollback criteria. Existing dirty
+experiments preserved. No product changes, benchmarks, builds, binary artifacts,
+runtime changes, publication or shutdown. Verification: git diff --check.
+
+## 2026-09-21 补帧稳定性与现有功能收尾方案
+
+按用户要求编写 FG_STABILITY_COMPLETION_PLAN_2026-09-21.md,包含证据基线、
+XeSS时间/帧对应、DLSS整组空档、输出限帧、UI/字幕/采集回归、NR防闪和独立
+降噪的分阶段方案。规定逐项存档、有限实验、全段节奏/源覆盖/帧龄/画质联合
+验收和失败回退。更新CURRENT_STATUS入口及三份旧计划的替代说明,纠正旧的
+默认限帧和XeSS时间提示结论。保留所有既有未提交代码及实验,不启动新目标、
+测试、构建或发布。本轮无新增二进制/临时产物。文档检查使用git diff --check
+及新方案的本地Markdown链接存在性校验;不将文档检查算产品验收。
diff --git a/scripts/acceptance/compare-release-scheduling.py b/scripts/acceptance/compare-release-scheduling.py
new file mode 100644
index 00000000..a2a663a5
--- /dev/null
+++ b/scripts/acceptance/compare-release-scheduling.py
@@ -0,0 +1,78 @@
+"""Compare common product log counters without requiring newer trace fields."""
+import argparse
+from datetime import datetime
+import importlib.util
+import json
+from pathlib import Path
+import re
+import sys
+
+sys.dont_write_bytecode = True
+
+
+def summarize(directory):
+ result = json.loads((directory / "result.json").read_text(encoding="utf-8"))
+ lines = (directory / "stdout.log").read_text(encoding="utf-8", errors="replace").splitlines()
+ origin = datetime.fromisoformat(lines[0].split()[0])
+ groups = {tag: [] for tag in ("player-timing", "frame-flow", "provider-flow", "xess-fg")}
+ for line in lines:
+ for tag, rows in groups.items():
+ if f"[{tag}]" not in line:
+ continue
+ elapsed = (datetime.fromisoformat(line.split()[0]) - origin).total_seconds()
+ if 10 <= elapsed <= 29:
+ fields = dict(re.findall(r"(\w+)=([^ ]+)", line))
+ if tag != "xess-fg" or "generatedTotal" in fields:
+ rows.append((elapsed, fields))
+ rates = {}
+ for tag, fields in (("player-timing", ("processed", "displaySubmits", "previewSkipped", "expiredGenerated")),
+ ("frame-flow", ("realPresented", "generatedPresented")),
+ ("provider-flow", ("sdkPresented", "sdkGenerated")),
+ ("xess-fg", ("presentId", "generatedTotal"))):
+ rows = groups[tag]
+ if len(rows) < 2:
+ continue
+ first, last = rows[0], rows[-1]
+ if first[1].get("revision") != last[1].get("revision"):
+ raise ValueError(f"Settings revision changed in {directory}")
+ seconds = last[0] - first[0]
+ rates[tag] = {"seconds": seconds}
+ for field in fields:
+ delta = int(last[1][field]) - int(first[1][field])
+ if delta < 0:
+ raise ValueError(f"Counter reset for {field} in {directory}")
+ rates[tag][field + "PerSecond"] = delta / seconds
+ if tag == "xess-fg":
+ rates[tag]["sdkPresentedPerSecond"] = rates[tag]["presentIdPerSecond"] + rates[tag]["generatedTotalPerSecond"]
+ summary = dict(directory=str(directory), case=result["case"],
+ executableSha256=result.get("executableSha256"),
+ gpu=result["telemetry"]["gpu"], power=result["telemetry"]["powerW"],
+ temperature=result["telemetry"]["temperatureC"], rates=rates,
+ gateTransitions=sum("[xess-fg-gate]" in line for line in lines),
+ smoke=result["smoke"])
+ if any("[pacing-sample]" in line for line in lines):
+ spec = importlib.util.spec_from_file_location("cadence", Path(__file__).with_name("analyze-fg-cadence.py"))
+ cadence = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(cadence)
+ summary["cadence"] = cadence.analyze(directory / "stdout.log")
+ return summary
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser()
+ parser.add_argument("directories", nargs="+", type=Path)
+ parser.add_argument("--output", required=True, type=Path)
+ args = parser.parse_args()
+ rows = [summarize(path) for directory in args.directories for path in sorted(directory.iterdir())
+ if path.is_dir() and (path / "result.json").exists()]
+ args.output.write_text(json.dumps(rows, indent=2), encoding="utf-8")
+ for row in rows:
+ timing = row["rates"].get("player-timing", {})
+ provider = row["rates"].get("xess-fg", row["rates"].get("provider-flow", {}))
+ gap = row.get("cadence", {}).get("intervalMs", {})
+ print(json.dumps(dict(run=Path(row["directory"]).parent.name, case=row["case"],
+ fps=timing.get("displaySubmitsPerSecond"),
+ source=timing.get("processedPerSecond"),
+ sdk=provider.get("sdkPresentedPerSecond"),
+ gpu=row["gpu"]["mean"], gate=row["gateTransitions"],
+ gapP95=gap.get("p95"), gapP99=gap.get("p99"))))
diff --git a/scripts/acceptance/fg-utilization-matrix.py b/scripts/acceptance/fg-utilization-matrix.py
new file mode 100644
index 00000000..cad76154
--- /dev/null
+++ b/scripts/acceptance/fg-utilization-matrix.py
@@ -0,0 +1,157 @@
+"""Sequential product UI loads with read-only NVML device telemetry."""
+import argparse
+import ctypes as c
+import hashlib
+import importlib.util
+import json
+import os
+from pathlib import Path
+import re
+import subprocess
+import sys
+import time
+
+sys.dont_write_bytecode = True
+
+
+class Utilization(c.Structure):
+ _fields_ = [("gpu", c.c_uint), ("memory", c.c_uint)]
+
+
+class Memory(c.Structure):
+ _fields_ = [("total", c.c_ulonglong), ("free", c.c_ulonglong), ("used", c.c_ulonglong)]
+
+
+class Nvml:
+ def __init__(self):
+ self.dll = c.CDLL(str(Path(os.environ["SystemRoot"]) / "System32/nvml.dll"))
+ self.call("nvmlInit_v2")
+ self.device = c.c_void_p()
+ self.call("nvmlDeviceGetHandleByIndex_v2", c.c_uint(0), c.byref(self.device))
+
+ def call(self, name, *args):
+ code = getattr(self.dll, name)(*args)
+ if code:
+ raise RuntimeError(f"{name} returned {code}")
+
+ def scalar(self, name, *args):
+ result = c.c_uint()
+ self.call(name, self.device, *args, c.byref(result))
+ return result.value
+
+ def sample(self):
+ util, memory = Utilization(), Memory()
+ self.call("nvmlDeviceGetUtilizationRates", self.device, c.byref(util))
+ self.call("nvmlDeviceGetMemoryInfo", self.device, c.byref(memory))
+ return dict(host100ns=time.perf_counter_ns() // 100,
+ gpu=util.gpu, memoryBusy=util.memory,
+ powerW=self.scalar("nvmlDeviceGetPowerUsage") / 1000,
+ smMHz=self.scalar("nvmlDeviceGetClockInfo", c.c_uint(1)),
+ memoryMHz=self.scalar("nvmlDeviceGetClockInfo", c.c_uint(2)),
+ temperatureC=self.scalar("nvmlDeviceGetTemperature", c.c_uint(0)),
+ pstate=self.scalar("nvmlDeviceGetPerformanceState"),
+ memoryMiB=memory.used / 1048576)
+
+ def close(self):
+ self.call("nvmlShutdown")
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--exe", type=Path, required=True)
+ parser.add_argument("--native", type=Path, required=True)
+ parser.add_argument("--derived", type=Path, required=True)
+ parser.add_argument("--output", type=Path, required=True)
+ parser.add_argument("--temp", type=Path, required=True)
+ parser.add_argument("--cases", nargs="*")
+ parser.add_argument("--seconds", type=int, default=30)
+ parser.add_argument("--temporal", action="store_true")
+ parser.add_argument("--sr-backend", choices=("video", "dlss"), default="video")
+ args = parser.parse_args()
+ if not 10 <= args.seconds <= 240:
+ parser.error("Each run must be 10..240 seconds")
+ spec = importlib.util.spec_from_file_location("cadence", Path(__file__).with_name("analyze-fg-cadence.py"))
+ cadence = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(cadence)
+ cases = {}
+ for source in ("native", "sr"):
+ for nr in (False, True):
+ for backend, multipliers in (("dlss", (1, 2, 4, 6)), ("xess", (2, 4))):
+ for multiplier in multipliers:
+ name = f"{source}-{'nr' if nr else 'plain'}-{backend}{multiplier}"
+ cases[name] = (source, nr, backend, multiplier)
+ selected = args.cases or list(cases)
+ if any(name not in cases for name in selected):
+ parser.error("Unknown case")
+ args.output.mkdir(parents=True, exist_ok=True)
+ args.temp.mkdir(parents=True, exist_ok=True)
+ with args.exe.open("rb") as executable:
+ executable_hash = hashlib.file_digest(executable, "sha256").hexdigest()
+ nvml = Nvml()
+ summaries = []
+ try:
+ for name in selected:
+ out = args.output / name
+ out.mkdir() # Never overwrite previous evidence.
+ source, nr, backend, multiplier = cases[name]
+ env = os.environ.copy()
+ env.update(TEMP=str(args.temp.resolve()), TMP=str(args.temp.resolve()),
+ VEYRA_LOG_FILE=str((out / "app.log").resolve()),
+ VEYRA_SMOKE_TRACE_FILE=str((out / "trace.txt").resolve()),
+ VEYRA_TEST_TRACE_SUBFRAMES="1")
+ argv = [str(args.exe.resolve()), str((args.native if source == "native" else args.derived).resolve()),
+ "--smoke-view", "pro", "--smoke-seconds", str(args.seconds),
+ "--nr" if nr else "--no-nr", "--realtime"]
+ argv += (["--no-sr"] if source == "native" else
+ ["--video-sr", "3"] if args.sr_backend == "video" else ["--sr"])
+ argv += ["--no-fg"] if multiplier == 1 else [f"--fg-{backend}", "--fg-multiplier", str(multiplier)]
+ if args.temporal:
+ argv += ["--nr-temporal"]
+ samples = []
+ started = time.perf_counter()
+ with (out / "stdout.log").open("w", encoding="utf-8") as stdout, (out / "stderr.log").open("w", encoding="utf-8") as stderr:
+ process = subprocess.Popen(argv, cwd=args.exe.parent, env=env, stdout=stdout, stderr=stderr)
+ try:
+ while process.poll() is None:
+ elapsed = time.perf_counter() - started
+ if elapsed > args.seconds + 45:
+ raise TimeoutError(f"{name} exceeded watchdog")
+ samples.append(dict(elapsed=elapsed, **nvml.sample()))
+ time.sleep(.2)
+ finally:
+ if process.poll() is None:
+ process.kill()
+ process.wait(timeout=10)
+ (out / "telemetry.json").write_text(json.dumps(samples), encoding="utf-8")
+ retained = [sample for sample in samples if 10 <= sample["elapsed"] <= args.seconds - 1]
+ result = dict(case=name, exit=process.returncode, argv=argv, srBackend=args.sr_backend,
+ executableSha256=executable_hash,
+ diagnosticEnvironment={key: value for key, value in env.items()
+ if key.startswith("VEYRA_TEST_") or key.startswith("VEYRA_DISABLE_")},
+ scope="NVML device-wide averaged activity, not SM occupancy or frame-scale GPU idle; software presentation is not scanout.",
+ telemetry={key: cadence.distribution([row[key] for row in retained])
+ for key in ("gpu", "memoryBusy", "powerW", "smMHz", "temperatureC", "memoryMiB")})
+ log = (out / "stdout.log").read_text(encoding="utf-8", errors="replace")
+ timing = [dict(re.findall(r"(\w+)=([^ ]+)", line)) for line in log.splitlines() if "[player-timing]" in line]
+ result["timingLast"] = timing[-1] if timing else None
+ result["smoke"] = next((line for line in reversed(log.splitlines()) if "smoke frames=" in line), None)
+ if (out / "trace.txt").exists():
+ try:
+ result["cadence"] = cadence.analyze_trace(out / "trace.txt")
+ except ValueError as error:
+ result["cadenceError"] = str(error)
+ (out / "result.json").write_text(json.dumps(result, indent=2), encoding="utf-8")
+ summaries.append(result)
+ (args.output / "matrix.json").write_text(json.dumps(summaries, indent=2), encoding="utf-8")
+ print(json.dumps({"case": name, "exit": process.returncode,
+ "gpuMean": result["telemetry"]["gpu"],
+ "submitFps": result.get("cadence", {}).get("submitFps"),
+ "smoke": result["smoke"]}), flush=True)
+ if process.returncode:
+ raise RuntimeError(f"{name} failed; inspect before continuing")
+ finally:
+ nvml.close()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cpp
index 27010bcb..afb1c4b0 100644
--- a/src/pipeline/EnhanceGraph.cpp
+++ b/src/pipeline/EnhanceGraph.cpp
@@ -1572,6 +1572,25 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
if (desc_.stageMark) desc_.stageMark("yuv");
cpuTrace.mark("color");
+ auto runVideoSr=[&]()->bool{
+ gpuTimer_.mark(list,GpuStage::Sr);
+ tracker_.transition(list,videoSrInput_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ const float enc[8]={uintBits(srcW_),uintBits(srcH_),uintBits(srcW_),uintBits(srcH_),desc_.hdrWorking()?3.0f:1.0f,0,0,0};
+ blitPass_.bind(list,enc,gpuHandleOf(blitPass_,desc_.nrBeforeSr?18:0).ptr,gpuHandleOf(blitPass_,16).ptr);list->Dispatch((srcW_+15)/16,(srcH_+15)/16,1);tracker_.uavBarrier(list,videoSrInput_.Get());
+ tracker_.transition(list,videoSrInput_.Get(),D3D12_RESOURCE_STATE_COMMON);tracker_.transition(list,videoSrOutput_.Get(),D3D12_RESOURCE_STATE_COMMON);
+ if(!videoSrBackend_->evaluate(list,videoSrInput_.Get(),videoSrOutput_.Get(),desc_.videoSrQuality)){failedBackend_=engine::FailedBackend::Sr;return false;}
+ tracker_.uavBarrier(list,videoSrOutput_.Get());tracker_.transition(list,videoSrOutput_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);tracker_.transition(list,workRgba_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ const float dec[8]={uintBits(workW_),uintBits(workH_),uintBits(workW_),uintBits(workH_),-1,0,0,0};
+ if(desc_.hdrWorking()){
+ tracker_.transition(list,videoSrInput_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ hdrVideoSrPass_.bind(list,dec,gpuHandleOf(hdrVideoSrPass_,desc_.nrBeforeSr?4:0).ptr,gpuHandleOf(hdrVideoSrPass_,3).ptr);
+ }else blitPass_.bind(list,dec,gpuHandleOf(blitPass_,17).ptr,gpuHandleOf(blitPass_,1).ptr);list->Dispatch((workW_+15)/16,(workH_+15)/16,1);tracker_.uavBarrier(list,workRgba_.Get());tracker_.transition(list,workRgba_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ ++metrics_.srEvaluateCount;gpuTimer_.mark(list,GpuStage::Sr,true);
+ return true;
+ };
+ bool videoSrReady=false;
+ const bool overlapVideoSr=srEnabled_&&videoSrBackend_&&!desc_.nrBeforeSr&&
+ GetEnvironmentVariableW(L"VEYRA_TEST_OVERLAP_VIDEO_SR",nullptr,0)>0;
// Guidance from original source-space color before SR/NR. Queue waits are GPU-side.
bool haveFlow = false;
const bool runMotion = nvofStandalone_ || presentSinkFg() || fgEnabled_ || (srEnabled_ && (desc_.videoSrQuality==0||desc_.videoSrQuality==engine::kVideoSrFsr));
@@ -1611,7 +1630,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
}
if (prevValid_ && !gpuDis_) {
if(!amdOf_){
- gpuTimer_.mark(list,GpuStage::Flow);
+ if(!overlapVideoSr)gpuTimer_.mark(list,GpuStage::Flow);
if(!ring_.submitAndSignal(slot))return false;
cpuTrace.mark("flowPrepare");
haveFlow=nvof_->execute(ring_.lastSignaledValue(),st);
@@ -1619,9 +1638,32 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
if(!haveFlow) { ++metrics_.nvofFrameFailures; mvecSource_="zero-motion-fallback (NVOF execute failed)"; }
else {
++metrics_.nvofExecuteCount;
- if(FAILED(context_.directQueue()->Wait(nvofOutFence_.Get(),nvof_->nextOutValue()-1)))return false;
+ auto waitForFlow=[&](){
+ const auto value=nvof_->nextOutValue()-1;
+ const HRESULT hr=context_.directQueue()->Wait(nvofOutFence_.Get(),value);
+ if(FAILED(hr))veyra::log::error("graph",std::format("NVOF output queue wait value={} hr=0x{:X}",value,unsigned(hr)));
+ return SUCCEEDED(hr);
+ };
+ if(overlapVideoSr){
+ // Video SR consumes color only. Keep NVOF resources intact
+ // and submit this independent work before its output wait.
+ list=ring_.acquireNext(slot,st);
+ if(!list||!runVideoSr()){
+ (void)waitForFlow();
+ return false;
+ }
+ videoSrReady=true;
+ // Flow now measures the uncovered queue wait, not SR twice.
+ gpuTimer_.mark(list,GpuStage::Flow);
+ if(!ring_.submitAndSignal(slot)){
+ (void)waitForFlow();
+ return false;
+ }
+ }
+ if(!waitForFlow())return false;
}
list=ring_.acquireNext(slot,st);if(!list)return false;
+ if(overlapVideoSr&&!haveFlow)gpuTimer_.mark(list,GpuStage::Flow);
gpuTimer_.mark(list,GpuStage::Flow,true);
}
if(haveFlow) {
@@ -1685,19 +1727,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
tracker_.uavBarrier(list,workRgba_.Get());
tracker_.transition(list,workRgba_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
} else if(srEnabled_&&videoSrBackend_){
- gpuTimer_.mark(list,GpuStage::Sr);
- tracker_.transition(list,videoSrInput_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
- const float enc[8]={uintBits(srcW_),uintBits(srcH_),uintBits(srcW_),uintBits(srcH_),desc_.hdrWorking()?3.0f:1.0f,0,0,0};
- blitPass_.bind(list,enc,gpuHandleOf(blitPass_,desc_.nrBeforeSr?18:0).ptr,gpuHandleOf(blitPass_,16).ptr);list->Dispatch((srcW_+15)/16,(srcH_+15)/16,1);tracker_.uavBarrier(list,videoSrInput_.Get());
- tracker_.transition(list,videoSrInput_.Get(),D3D12_RESOURCE_STATE_COMMON);tracker_.transition(list,videoSrOutput_.Get(),D3D12_RESOURCE_STATE_COMMON);
- if(!videoSrBackend_->evaluate(list,videoSrInput_.Get(),videoSrOutput_.Get(),desc_.videoSrQuality)){failedBackend_=engine::FailedBackend::Sr;return false;}
- tracker_.uavBarrier(list,videoSrOutput_.Get());tracker_.transition(list,videoSrOutput_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);tracker_.transition(list,workRgba_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
- const float dec[8]={uintBits(workW_),uintBits(workH_),uintBits(workW_),uintBits(workH_),-1,0,0,0};
- if(desc_.hdrWorking()){
- tracker_.transition(list,videoSrInput_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
- hdrVideoSrPass_.bind(list,dec,gpuHandleOf(hdrVideoSrPass_,desc_.nrBeforeSr?4:0).ptr,gpuHandleOf(hdrVideoSrPass_,3).ptr);
- }else blitPass_.bind(list,dec,gpuHandleOf(blitPass_,17).ptr,gpuHandleOf(blitPass_,1).ptr);list->Dispatch((workW_+15)/16,(workH_+15)/16,1);tracker_.uavBarrier(list,workRgba_.Get());tracker_.transition(list,workRgba_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
- ++metrics_.srEvaluateCount;gpuTimer_.mark(list,GpuStage::Sr,true);
+ if(!videoSrReady&&!runVideoSr())return false;
} else if (srEnabled_ && srBackend_ && srBackend_->created()) {
gpuTimer_.mark(list,GpuStage::Sr);
tracker_.transition(list, workRgba_.Get(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
diff --git a/tests/integration/NrVideoQualityProbe.cpp b/tests/integration/NrVideoQualityProbe.cpp
index 97a29e08..8fa9f30b 100644
--- a/tests/integration/NrVideoQualityProbe.cpp
+++ b/tests/integration/NrVideoQualityProbe.cpp
@@ -8,6 +8,7 @@
#include <fstream>
#include <iostream>
#include <array>
+#include <string_view>
#include <d3d12sdklayers.h>
#include <vector>
@@ -55,7 +56,9 @@ bool dumpCrop(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing& ring,
}
}
int wmain(int argc,wchar_t** argv){
- if(argc!=5)return 2; // source, output directory, start seconds, frame count
+ if(argc!=5&&argc!=6)return 2; // source, output directory, start seconds, frame count, optional video-sr4k
+ const bool videoSr4k=argc==6&&std::wstring_view(argv[5])==L"video-sr4k";
+ if(argc==6&&!videoSr4k)return 2;
const double start=_wtof(argv[3]);const unsigned count=unsigned(_wtoi(argv[4]));
if(start<0||count<2||count>240)return 2;
const std::filesystem::path directory=argv[2];std::filesystem::create_directories(directory);
@@ -68,7 +71,7 @@ int wmain(int argc,wchar_t** argv){
open.path=argv[1];open.preferHardwareDecode=false;
if(!source.open(open))return 2;
const auto info=source.info();
- // Same-size SDR avoids resampling the motion crop or hiding colour conversion.
+ // Keep input/motion at 1080p; the optional SR case exercises a 4K working image.
if(info.width!=1920||info.height!=1080)return 2;
if(start>0&&!source.seek({int64_t(start*1000),1000}))return 2;
pipeline::EnhanceGraph graph(ctx,ring);pipeline::EnhanceGraphDesc settings;
@@ -76,6 +79,10 @@ int wmain(int argc,wchar_t** argv){
settings.sourceHeight=settings.workHeight=settings.nrHeight=settings.flowHeight=info.height;
settings.enableNr=true;settings.nrTemporal=true;settings.enableFg=false;settings.enableSr=false;
settings.enableNvofStandalone=true;settings.runtimeAbsPath=runtime::localRuntimeDirectory().wstring();
+ if(videoSr4k){
+ settings.workWidth=3840;settings.workHeight=2160;
+ settings.enableSr=true;settings.videoSrQuality=3;
+ }
if(!graph.initialize(settings)||!graph.createViews())return 2;
std::array<std::ofstream,4> streams;
const char* names[]={"base.rgba16f","raw.rgba16f","filtered.rgba16f","motion.rg16f"};
@@ -87,7 +94,7 @@ int wmain(int argc,wchar_t** argv){
if(source.read(packet,&frame)!=source::SourceReadStatus::Frame){ok=false;break;}
if(packet.pts.toDouble()<start)continue;
pipeline::EnhanceGraph::FrameOutputs output;
- if(!graph.process(frame,packet.pts.toDouble()*1000,captured==0,output,packet.sequence,&packet.colorInfo)||!ring.waitIdle()){ok=false;break;}
+ if(!graph.process(frame,packet.pts.toDouble()*1000,captured==0||(videoSr4k&&captured==count/2),output,packet.sequence,&packet.colorInfo)||!ring.waitIdle()){ok=false;break;}
ID3D12Resource* textures[]={graph.diagnosticNrBase(),graph.diagnosticNrRaw(),graph.diagnosticNrFiltered(),graph.flowResource()};
for(unsigned i=0;i<4;++i)ok=dumpCrop(ctx,ring,textures[i],streams[i])&&ok;
if(!ok)break;