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++
docs: close VFG optimization validation
Veyra Goal Agentcc22e88c3107
diff --git a/docs/VFG_OPTIMIZATION_PLAN_2026-10-07.md b/docs/VFG_OPTIMIZATION_PLAN_2026-10-07.mdindex 77ed83b2..ff48966c 100644--- a/docs/VFG_OPTIMIZATION_PLAN_2026-10-07.md+++ b/docs/VFG_OPTIMIZATION_PLAN_2026-10-07.md@@ -9,3 +9,7 @@5. P4:匹配原片4K30/原版单层1080NR/强度1/零运动/调控关/GPU普通/Auto同步/限帧关,先测Medium3/4与High2,再按效果扩大档位。GUI正常负载串行,每进程≤300秒、构建≤900秒;验证8/10-bit所有质量/倍率、切镜/reset、关闭/seek/倍率与后端切换、完整导出计数与异常回退。只承诺本机实测,不预先承诺高档8X实时。产物统一E:/项目/Veyra/{archives,build,logs,tests,tmp,test-packages,verify}/vfg-optimization-20261007。先执行scripts/acceptance/vfg-opt-control.py,旧guard/start基线不改。各节点commit/checkpoint,负优化回退并留证据;最终提供有实测收益的本地候选与报告。源代码/运行组件严格分开,DLL/模型保持原字节。++实际收尾:P0/P1/P2/P4完成,核心ddf71b1、最终candidate-build-v3。P1仅减少重复绑定,83fps未证明收益;P2才消除了送显线程阻塞。相邻Medium4原80→120fps(+50%),同EXE同步控制76.5fps;High2原35.5→60fps(+69.0%)。21档正常播放矩阵、913项GPU合同/168张同步异步相同像素、331项设置、GUI生命周期和24导出用例通过,完整表与限制见VFG_OPTIMIZATION_REPORT_2026-10-07.md。++P3未实施:中档6X以上/高档3X以上仍未全部达标,但本轮主因已修正;保留共享准入/恢复策略,不能为追求数字改其它补帧。当前仅本地独立NVIDIA测试候选,无merge/push/Release;全片长稳、其它硬件及NV显存问题不由短测视为通过。包内冷启及最终保护检查以verify/vfg-optimization-20261007/candidate-cold.json、final-check.json为实际回执。diff --git a/docs/VFG_OPTIMIZATION_REPORT_2026-10-07.md b/docs/VFG_OPTIMIZATION_REPORT_2026-10-07.mdnew file mode 100644index 00000000..91526868--- /dev/null+++ b/docs/VFG_OPTIMIZATION_REPORT_2026-10-07.md@@ -0,0 +1,66 @@+# VFG 专项优化实测(2026-10-07)++状态:本机VFG专项短测通过,已达到部分主要档位目标;更高倍率仍有明确限制。++本轮只修改VFG。DLSS/XeSS/FSR实现、默认选择、准入策略、NR算法、shader、运行库及用户配置保持。核心源码ddf71b1,隔离分支codex/vfg-optimization-20261007;main、已发布2.0.5及其它工作树不变。最终候选显示版本2.0.5-vfg-test,不是新正式版本。++## 实现与原因++源30fps给每对输入约33.33ms计算预算,4X送显却需要约8.33ms一次。原版虽已有独立GPU呈现队列,CPU同一线程仍整组调用VFG后才推进呈现。分段实测NvVFX_Run平均约6.2ms/次,Medium4需三次,参数设置只需微秒。原19ms左右的增强总耗时低于源帧预算,并不能阻止已就绪插帧被22ms左右的CPU提交挡住。++先按固定官方样例减少重复输入绑定与倍率设置,Medium4仍83fps,未证明提速。随后仅实时VFG启用有界工作线程,CUDA推理仍在一个stream串行;图owner只排producer/consumer fence及输出GPU copy,独立呈现队列与原PTS、过期阈值、音频一倍速、批次租约和command-slot上限均保留。最多14个接受但未完成的SDK子任务,覆盖两组8X输出,队列满时在加入GPU等待前明确拒绝。++每个输出槽独立记录Pending/Succeeded/Failed,GPU复制完成后还要核对SDK成功;失败槽不允许变成Valid。已接受任务在拒绝、退出或重建时必须释放其等待,异常路径先排空CUDA写入;停止worker并join后才能销毁SDK图像、导入映射、semaphore、stream及DLL。正常帧不加CPU fence wait或像素回读。导出保留同步SDK判定路径。++官方API/来源:[VFG 1.3.0](https://docs.nvidia.com/maxine/vfx/1.3.0/Filters/VideoFrameGeneration.html)、[固定MIT样例52011f89](https://github.com/NVIDIA-Maxine/VFX-SDK-Samples/blob/52011f89c1741d06b40ea312af1f20be8be9ec62/apps/VideoFrameGenerationEffectApp/VideoFrameGenerationEffectApp.cpp)。既有THIRD_PARTY_NOTICES已登记同一来源;未新增SDK/模型/DLL进Git。++## 条件和口径++本机RTX5070 12GB、驱动616.56。原GTA6视频3840×2160/30fps,单层原版NR内部1080p、强度1、风格0、零运动,调控/抗闪/SR/HDR/调色关,GPU普通实际class2、呈现queue Priority0,窗口1280×800、Auto同步、输出限帧关。**VFG仍处理4K,1080p仅是NR内部尺寸。** 每质量/倍率独立进程、正常播放、约5秒预热+20秒观察,串行且单次低于300秒;未启动竞争GPU压力或修改系统驱动/显示/用户配置。++原视频14115273308字节与mtimeNs1789034773254693400核对既有身份,复用之前完整SHA256 93db61292353f19aaf6bfa2fbd3a094d1140300785ab2d93b0c06aa7881f8b3f,本轮不声称重算14GB散列。原版NR SHA256 E16BCF15E16E13F527491CDF7845B2FE6521A738D8F7C9C721866A8496E1FC8E;随包VFG五文件与官方2.0.5 manifest完全一致,SDK1.3.0/nvidia-vfx0.2.0.0。++FPS是1Hz观察窗口中应用实际呈现提交读数的中位数,非物理屏幕FPS或屏幕端到端延迟。CPU P95为各日志滚动P95的中位数,不能称整段合并P95;GPU阶段含跨队列交接及实际对应工作,非纯模型内核时间。脚本passed表示采样、后端、退出契约,不等于每个倍率跑满。系统日常桌面应用未擅自关闭,单轮GPU占用/时钟会变化,因此另做相邻原版/候选和同步提交对照,不用非相邻GPU耗时计算算法提速。++## 全档位与相邻对照++| 倍率 | 源30目标fps | Low 前→后 | Medium 前→后 | High 前→后 |+| --- | ---: | ---: | ---: | ---: |+| 2X | 60 | 60→60 | 60→60 | 37→60 |+| 3X | 90 | 90→90 | 82→90 | 30→60(降档) |+| 4X | 120 | 112→120 | 84→120 | 30→58(降档) |+| 5X | 150 | 123→150 | 74→150 | 33→52.5(降档) |+| 6X | 180 | 130.5→180 | 57→174(降档) | 33→38(降档) |+| 7X | 210 | 131.5→210 | 34.5→178(降档) | 32.5→36(降档) |+| 8X | 240 | 128.5→240 | 30→156(降档) | 32→40(降档) |++“前”为上一轮正式2.0.5诊断参考,“后”为本轮最终候选21组。非相邻矩阵不用于精确归因百分比;下面相邻对照才用于计算收益。++| 对照 | 原版fps | 候选fps | 提升 | 原版CPU滚动P95中位ms | 候选CPU滚动P95中位ms |+| --- | ---: | ---: | ---: | ---: | ---: |+| medium4 | 80 | 120 | 50.0% | 23.450 | 1.198 |+| high2 | 35.5 | 60 | 69.0% | 30.940 | 1.079 |++同一候选仅强制同步提交的控制组Medium4为76.5fps;对应正常异步组为120fps,支持“送显线程被SDK调用占住”的因果解释。++首轮Medium4为120fps(前83–84),High2为60fps(前37);Medium8首轮191fps但最终矩阵可能波动且持续降档,不能宣称240fps达标。Medium6以上、High3以上需逐项按目标与降档状态判断,不能由性能球颜色推断。优化没有减少VFG模型的推理复杂度;更及时送显会增加实际呈现工作,GPU利用率/阶段时间不保证下降。++## 验收++- 最终候选构建candidate-build-v3 exit0,EXE SHA256 `751e1032cd3b2c00d1e95bf9c80bd4e5dba746b9b63fe4f16fba03a955b78653`,核心源码ddf71b1。+- 21组原片正常播放、5组相邻/同步控制均采样与退出通过;是否跑满按上表判定。+- 8/10位、三质量、2X–8X、切镜/相同CUDA地址刷新/反向运动/parity与2X→4X→8X恢复:720p同步、720p异步、4K异步各913项0失败,最终EXE再做720p检查通过;168张同步/异步插帧GPU像素哈希一致。+- GUI热切换质量/倍率、VFG↔DLSS6X、暂停/seek/缩放、全屏进入/返回、列表/节点预设与重启通过;缺VFG运行库沿用原有启动迁移到FSR2X并继续播放,未修改该共享策略。异步Run拒绝后实际FG关闭、原帧继续,无等待悬挂。GUI独立导出worker保持同步SDK判定,8源帧输出64帧/240fps。+- VFG设置/预设/会话及倍率/PTS单元测试331项0失败。+- 21组720p三质量×2X–8X实际NVENC导出及4K GTA短片原生NR+VFG4导出通过;每组源8帧、输出8×倍率、HEVC/CFR与严格递增PTS核对,无源帧丢弃。边界hold仍按原导出合同计数,不能把所有输出都称神经生成帧。取消和缺运行库导出失败清理通过。+- 失败记录保留:初次两个异步拒绝断言误把QML保存的fgEnabled请求当实际后端;首次缺运行库断言误以为旧策略必定关闭FG,实际已迁移FSR;首次八帧MP4导出断言未考虑微秒time_base取整(16帧、标称60fps,平均59.999925fps)。按实际接口和时间刻度修正测试后通过,没有为迁就测试改产品。settings-tests首次漏传必需的绝对输出目录而exit2,补齐参数后331项通过。++4K短测与像素检查不代表所有40/50系、所有驱动、真实采集/串流或全片长稳验收。10位测试验证SDK编码布局、运动与切镜,不是HDR观感验收。NVIDIA显存增长未修复;本轮不恢复已延期的泄漏排查。高倍率完整成本样本老化后的恢复策略仍沿用旧版,未以修改共享准入策略扩大到其它补帧。++## 证据与使用++命令均在E:/项目/Veyra/worktrees/vfg-optimization-20261007运行:python -B scripts/acceptance/vfg-opt-build.py candidate-build-v3;vfg-opt-run.py matrix及匹配case;vfg-opt-native.py;vfg-opt-lifecycle.py;vfg-opt-export.py;vfg-opt-report.py;vfg-opt-control.py及vfg-opt-run.py audit。++日志/原始JSON在E:/项目/Veyra/logs/vfg-optimization-20261007;构建build/vfg-optimization-20261007;独立测试app/profile、输出视频、GPU像素结果在tests/vfg-optimization-20261007;缓存/TEMP/TMP在tmp/vfg-optimization-20261007;不可变基线/Git bundle在archives/vfg-optimization-20261007;最终回执verify/vfg-optimization-20261007。没有修改旧guard/start来放行新文件,没有merge/push/Release或关机。++本地候选从正式NVIDIA包独立复制,替换本轮EXE并重建包manifest,QML/运行库/模型原字节保留,测试loader、日志、私人profile及媒体不进入候选包。对应源码随本地候选提供。建议先用原片、普通GPU优先级、单层1080NR验证Medium4/5或High2;更高档按实际输出状态判断。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex 6ec4153c..aa3e5e76 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,6 +1,6 @@# Veyra 工作记录-## 2026-10-07 VFG 专项优化(进行中)+## 2026-10-07 VFG 专项优化用户授权“尝试优化VFG,其他的补帧暂时不动”。排查分支封存aec800e,优化隔离codex/vfg-optimization-20261007;开工tag checkpoint/pre-vfg-optimization-20261007,完整Git bundle与不可变start.json在E:/项目/Veyra/archives/vfg-optimization-20261007。当前任务计划docs/VFG_OPTIMIZATION_PLAN_2026-10-07.md;新guard逐文件保护其它全部工作树、正式2.0.5 EXE/Main/VFG运行库及非VFG实现,未改旧guard/start。所有构建、测试、日志、临时目录使用E:/项目/Veyra对应vfg-optimization-20261007目录;无子Agent、竞争GPU压力、驱动/用户配置变更、merge/push/Release/关机。@@ -12,6 +12,14 @@ async-build-v1构建通过。async-native-720-v1:8/10位、三质量、2X–8XP2后续:async-build-v2成功;async-native-720-v2、sync-native-720-v2、async-native-4k-v2各913检查0失败(4K进程108.453秒)。相同候选同步/异步42组共168插帧逐像素哈希完全一致,native-hash-comparison.json;新增相同导入地址更新像素、反向运动、parity切换、切镜后2X→4X→8X验证。async-medium8-nr-v2约191fps且仍降档,明确未达240fps。failure-verified-v2第3次Run注入拒绝后实际multiplier=1、fgActive=false、视频继续,进程7.860秒正常退出,无等待悬挂。初次failure-v2及复核failure-observe-v2测试断言失败:误把QML fgEnabled(保存的节点请求)当实际后端;日志证实实际已降为1X,fgActive=false/failed=false。修正的是测试语义,保留两个失败日志,未为此改产品UI或其它后端。最终默认路径只加拒绝hook长度边界和准确注释,再构建最终候选;全档位重复/热切换/完整导出仍在验收,不预先算通过。+最终核心提交ddf71b10cee673e5f50cd1425377f26206eb5214 / checkpoint/vfg-bounded-submission-20261007。python -B scripts/acceptance/vfg-opt-build.py candidate-build-v3退出0,EXE SHA751e1032cd3b2c00d1e95bf9c80bd4e5dba746b9b63fe4f16fba03a955b78653。随后只有本轮验收脚本/文档变化,产品代码未再改。vfg-opt-run.py matrix串行21组:Low2–8X达到60–240fps;Medium2–5X达到60–150,6/7/8X为174/178/156且降档;High2为60,高档3X以上均降档。这里fps为应用提交中位数,不能称物理屏幕fps或保证每帧稳定。vfg-opt-matched.py五组相邻对照:原版Medium4 80→候选120(+50%),同一候选强制同步仅76.5;原版High2 35.5→60(+69.0%)。Medium4 CPU滚动P95中位23.450→1.198ms,已就绪插帧累计过期增量726→0;GPU推理复杂度未变,实际送显增加反而提升GPU工作量,不宣传NR/GPU模型提速。完整数据见本轮REPORT和verify/measurements.json。++vfg-opt-native.py candidate-native-720-v3:最终候选913项0失败,168张插帧与前轮同步/异步哈希再次相同。veyra_vfg_settings_tests.exe首次漏传绝对输出目录而exit2、无断言执行;补传E:/项目/Veyra/tests/vfg-optimization-20261007/settings-v3后331项0失败,日志settings-v3.log/json。vfg-opt-lifecycle.py lifecycle-v3正常/恢复两阶段57.313/4.313秒通过,含全屏进入/返回、暂停seek/resize、全部倍率与质量、VFG↔DLSS6X、列表/节点独立预设与重启、GUI独立同步导出worker。该轮缺运行库测试断言失败:现有启动迁移本就改选FSR2X且保持启用,不是强制原帧;原日志保留。只修测试,vfg-opt-lifecycle.py lifecycle-edge-v3 --edge-from lifecycle-v3分别8.297/5.718秒通过缺库迁移与第3次Run拒绝(实际FG关、视频继续、正常退出),既有共享回退代码逐字节不改。GUI导出8源帧/64输出/240fps经ffprobe核对。++vfg-opt-export.py export-v3首组16帧正确,但avg_frame_rate=16000000/266667即59.999925fps,旧断言没考虑1微秒MP4刻度而失败。修测试按time_base推导容差,同时严格核对标称CFR/PTS递增与间距/时长,export-v3-verified全24组通过:21种720p质量×倍率、GTA4K30短片原生NR+VFG4、取消与缺库失败清理。源8帧输出8×倍率,导出不丢源帧,边界hold不算神经生成。所有GPU用例串行,每进程≤300秒,没有竞争压力。vfg-opt-finish.py生成最终REPORT/measurements.json;失败证据不覆盖、不改旧baseline。++vfg-opt-stage.py从正式NVIDIA包独立复制本地Veyra-2.0.5-VFG-test-NVIDIA-win64-portable,1606载荷文件,只有EXE及包manifest更新并新增本轮报告,全部QML/runtime/model/license原字节保持、无可写hardlink。源码ZIP对应准确构建提交ddf71b1,SHAf8aebe0ae7fe504c15dc00daa539f9215869029d911e7dadf2e8492c480906a3。包、源码、构建及必要验证输出保留;冷启/最终保护/自有临时缓存整理按同任务verify/candidate-cold.json、final-check.json及logs/cleanup.json实际回执报告,不由本段推断尚未执行结果。main、旧发布包和其它工作树不变,无新推送/发布/关机。高倍率恢复策略P3保持旧版,NV显存增长仍未修复,未做全片长稳或其它显卡验收。+## 2026-10-07 2.0.5 正式发布完成已正式发布https://github.com/Likely7/Veyra-NRVideo/releases/tag/v2.0.5(Release ID 405358232,2026-10-07T03:59:46Z),5资产远端大小/SHA256 digest一致,最新正式版本、对应源码/依赖源码、正文/双QR和下载可用性核对通过。两最终ZIP冷启及26个包内模块路径各通过,产品字节保持。实际命令、结果、失败复核、哈希与日志路径见[PUBLISH_2.0.5_REPORT](PUBLISH_2.0.5_REPORT_2026-10-07.md)。main合并939f1a5afa7b1d122adf656d157d4df6b6fad9af、源码e44e828119710b8f031cc968e8ddb1982aecc873;随后只提交此正式回执,不改标签/资产/产品。NV显存未修复;公告≤1000字,只交用户,不代发不关机。diff --git a/scripts/acceptance/vfg-opt-cleanup.ps1 b/scripts/acceptance/vfg-opt-cleanup.ps1new file mode 100644index 00000000..7c59833e--- /dev/null+++ b/scripts/acceptance/vfg-opt-cleanup.ps1@@ -0,0 +1,24 @@+$ErrorActionPreference = 'Stop'+$base = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../../../..'))+if ([IO.Path]::GetPathRoot($base) -ne 'E:\' -or (Split-Path $base -Leaf) -ne 'Veyra') { throw 'Unexpected artifact root' }+$root = (Resolve-Path -LiteralPath (Join-Path $base 'tmp/vfg-optimization-20261007')).Path+$prefix = $root.TrimEnd('\') + '\'+if (Get-Process -Name veyra,veyra_qml_ui,veyra_vfg_gpu_tests,veyra_vfg_export_probe -ErrorAction SilentlyContinue) { throw 'Test process still running' }+$receipt = Join-Path $base 'logs/vfg-optimization-20261007/cleanup.json'+if (Test-Path -LiteralPath $receipt) { throw 'Existing cleanup receipt' }+$targets = @()+foreach ($case in Get-ChildItem -LiteralPath $root -Directory) {+ $path = Join-Path $case.FullName 'cuda-cache'+ if (!(Test-Path -LiteralPath $path)) { continue }+ $resolved = (Resolve-Path -LiteralPath $path).Path+ if (!$resolved.StartsWith($prefix, [StringComparison]::OrdinalIgnoreCase) -or (Split-Path $resolved -Leaf) -ne 'cuda-cache') { throw 'Cache escaped task directory' }+ $entries = @((Get-Item -LiteralPath $resolved)) + @(Get-ChildItem -LiteralPath $resolved -Recurse -Force)+ if ($entries | Where-Object { $_.Attributes -band [IO.FileAttributes]::ReparsePoint }) { throw 'Reparse point in cache' }+ $files = @($entries | Where-Object { !$_.PSIsContainer })+ $targets += [pscustomobject]@{ path=$resolved; files=$files.Count; bytes=[long](($files | Measure-Object Length -Sum).Sum) }+}+# Every resolved target has been checked before the first recursive deletion.+foreach ($target in $targets) { Remove-Item -LiteralPath $target.path -Recurse -Force }+[pscustomobject]@{ task='vfg-optimization-20261007'; removed=$targets; bytes=[long](($targets | Measure-Object bytes -Sum).Sum); retained='Build, candidate, sources, test fixtures, profiles, outputs, receipts and logs' } |+ ConvertTo-Json -Depth 5 | Set-Content -LiteralPath $receipt -Encoding UTF8+Write-Output ('Removed task-only CUDA caches: ' + $targets.Count + ' directories')diff --git a/scripts/acceptance/vfg-opt-close.py b/scripts/acceptance/vfg-opt-close.pynew file mode 100644index 00000000..73b99100--- /dev/null+++ b/scripts/acceptance/vfg-opt-close.py@@ -0,0 +1,47 @@+"""Final source, evidence and local candidate audit; no product mutation."""+from pathlib import Path+import ast,hashlib,json,re,subprocess,sys,zipfile,psutil+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-optimization-20261007';VERIFY=BASE/'verify'/TASK+def read(p):return json.loads(p.read_text(encoding='utf-8-sig'))+def sha(p):+ with p.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()+def git(*args):return subprocess.check_output(['git',*args],cwd=ROOT).decode('utf8').strip()+for script,args in (('vfg-opt-control.py',[]),('vfg-opt-run.py',['audit'])):+ subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance'/script),*args],cwd=ROOT,check=True,timeout=90)+assert not any(p.info['name'].lower() in ('veyra.exe','veyra_qml_ui.exe','veyra_vfg_gpu_tests.exe','veyra_vfg_export_probe.exe') for p in psutil.process_iter(['name']))+subprocess.run(['git','diff','--check'],cwd=ROOT,check=True)+assert not git('status','--porcelain=v1'),'Commit completed source/evidence helpers before final audit'+core=['src/pipeline/VfgBackend.cpp','include/veyra/pipeline/VfgBackend.h','src/pipeline/EnhanceGraph.cpp','include/veyra/pipeline/EnhanceGraph.h','src/engine/EngineController.cpp','tests/integration/VfgGpuTests.cpp']+assert not git('diff','--name-only','ddf71b1','--','src','include','shaders','qml','CMakeLists.txt','tests/integration/VfgGpuTests.cpp'),'Product differs from measured build'+changed=git('diff','--name-only','aec800e','HEAD').splitlines()+assert all(Path(p).suffix.lower() in ('.md','.cpp','.h','.py','.qml','.ps1') for p in changed),changed+pythonFiles=list((ROOT/'scripts/acceptance').glob('vfg-opt-*.py'))+for p in pythonFiles:ast.parse(p.read_text(encoding='utf8'),filename=str(p))+measurements=read(VERIFY/'measurements.json');package=read(VERIFY/'candidate-package.json');cold=read(VERIFY/'candidate-cold.json')+assert measurements['buildSource']==package['buildSource'] and measurements['buildExeSha256']==package['exeSha256']==cold['exeSha256'] and cold['passed']+assert sha(BASE/'build'/TASK/'veyra_qml_ui.exe')==package['exeSha256']+app=Path(package['app']);manifest=read(app/'package-manifest.json')+assert manifest['localOnly'] and not manifest['releaseReady'] and manifest['displayVersion']=='2.0.5-vfg-test'+for row in manifest['files']:assert sha(app/row['path'])==row['sha256'],row['path']+assert {x.relative_to(app).as_posix() for x in app.rglob('*') if x.is_file()}=={x['path'] for x in manifest['files']}|{'package-manifest.json'}+assert sha(ROOT/'docs/VFG_OPTIMIZATION_REPORT_2026-10-07.md')==sha(app/'VFG-TEST-NOTES.zh-CN.md')+source=Path(package['source']);assert sha(source)==package['sourceSha256']+with zipfile.ZipFile(source) as z:+ assert z.testzip() is None+ for p in core:+ # git archive is materialized with the repository's Windows text checkout+ # convention here; compare normalized bytes to the exact commit object.+ archived=z.read('Veyra-vfg-test/'+p).replace(bytes([13,10]),bytes([10]))+ committed=subprocess.check_output(['git','show',package['buildSource']+':'+p],cwd=ROOT)+ assert archived==committed,p+ for item in z.infolist():assert not re.search(r'\.(dll|lib|exe|pdb|onnx|f16|hsaco|cubin)$',item.filename,re.I),item.filename+cleanup=read(BASE/'logs'/TASK/'cleanup.json')+result={'passed':True,'head':git('rev-parse','HEAD'),'branch':git('branch','--show-current'),'productSource':package['buildSource'],+ 'exeSha256':package['exeSha256'],'sourceSha256':package['sourceSha256'],'candidate':str(app),+ 'coreSha256':{p:sha(ROOT/p) for p in core},'changedFiles':changed,'pythonSyntaxFiles':len(pythonFiles),+ 'mainAndOtherWorktreesPreserved':True,'publishedAppAndRuntimePreserved':True,'noSdkOrRuntimeAddedToGit':True,+ 'matched':measurements['matched'],'matrixCases':len(measurements['matrix']),'exportCases':measurements['exportCases'],+ 'candidateCold':cold,'removedTemporaryCacheBytes':cleanup['bytes'],'packageManifestSha256':sha(app/'package-manifest.json'),+ 'measurementReceiptSha256':sha(VERIFY/'measurements.json'),'sourceArchiveCrcVerified':True}+(VERIFY/'final-check.json').write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf8')+print('VFG FINAL AUDIT PASS',result['head'],len(manifest['files']),'candidate payload files',flush=True)diff --git a/scripts/acceptance/vfg-opt-cold.py b/scripts/acceptance/vfg-opt-cold.pynew file mode 100644index 00000000..fadf0f90--- /dev/null+++ b/scripts/acceptance/vfg-opt-cold.py@@ -0,0 +1,77 @@+"""Cold-start the independent candidate with a private tested VFG/NR profile."""+from pathlib import Path+import ctypes,hashlib,json,os,re,shutil,subprocess,sys,time,psutil+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-optimization-20261007'+VERIFY=BASE/'verify'/TASK;receipt=json.loads((VERIFY/'candidate-package.json').read_text(encoding='utf8'));APP=Path(receipt['app'])+assert not any(p.info['name'].lower() in ('veyra.exe','veyra_qml_ui.exe','veyra_vfg_gpu_tests.exe','veyra_vfg_export_probe.exe') for p in psutil.process_iter(['name']))+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-opt-control.py')],cwd=ROOT,check=True)+def sha(p):+ with p.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()+manifest=json.loads((APP/'package-manifest.json').read_text(encoding='utf8'))+for row in manifest['files']:assert sha(APP/row['path'])==row['sha256'],row['path']+assert sha(APP/'veyra_qml_ui.exe')==receipt['exeSha256']+def vfg4_running(text):+ return bool(re.search(r'\[vfg\] SDK version=.* multiplier=4 quality=1 async=1',text)) and bool(re.search(r'\[fg-validity\].* valid=[1-9][0-9]* invalid=0.*backend=NVIDIA-VFG',text))+def verify_payload():+ for row in manifest['files']:assert sha(APP/row['path'])==row['sha256'],'Candidate payload changed during startup: '+row['path']+ assert {x.relative_to(APP).as_posix() for x in APP.rglob('*') if x.is_file()}=={x['path'] for x in manifest['files']}|{'package-manifest.json'},'Unexpected candidate payload'+if '--verify-existing' in sys.argv:+ # Preserve the failed harness receipt and re-evaluate its existing successful+ # run; no new GPU playback is needed for a corrected log-field assertion.+ prior=VERIFY/'candidate-cold.json';initial=VERIFY/'candidate-cold-initial.json'+ result=json.loads(prior.read_text(encoding='utf8'));assert not initial.exists() and not result['passed'] and not result['vfg4']+ assert result['exit']==0 and result['exeSha256']==receipt['exeSha256'] and not result['errors'] and len(result['ownQtAndCodecModulePaths'])>10+ assert all(result[k] for k in ('boundedWorker','nr1080','normalGpuPriority'))+ engine=Path(result['engine']);console=Path(result['console']);text=engine.read_text(encoding='utf8',errors='replace')+'\n'+console.read_text(encoding='utf8',errors='replace')+ assert vfg4_running(text)+ verify_payload();shutil.copy2(prior,initial)+ result.update(vfg4=True,passed=True,revalidatedFrom=str(initial),initialReceiptSha256=sha(initial),engineSha256=sha(engine),consoleSha256=sha(console),revalidation='Use actual VFG SDK configuration plus successful fg-validity fields; original playback exit0 preserved')+ prior.write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf8')+ print('VFG CANDIDATE COLD START PASS (existing run verified)',len(result['ownQtAndCodecModulePaths']),'own Qt/codec modules',flush=True)+ sys.exit(0)+out,logs,tmp=(BASE/k/TASK/'candidate-cold-v3' for k in ('tests','logs','tmp'))+for p in (out,logs,tmp):p.mkdir(parents=True,exist_ok=False)+profile=out/'profile';shutil.copytree(BASE/'tests'/TASK/'matched-new-medium4/profile',profile)+env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_','QSG_'))}+windows=Path(env['WINDIR']);engine=logs/'engine.log';console=logs/'console.log'+env.update(TEMP=str(tmp),TMP=str(tmp),CUDA_CACHE_PATH=str(tmp/'cuda-cache'),VEYRA_LOG_FILE=str(engine),+ QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1',+ PATH=os.pathsep.join(map(str,(windows/'System32',windows,windows/'System32/Wbem'))))+cmd=[str(APP/'veyra_qml_ui.exe'),'--data-dir',str(profile),'--page','pro','--size','1280x800','--exit-after','28000',+ 'E:/Ai/知识/小七姐/GTAVI_An_Extended_Look_4K_Native.mp4']+start=time.monotonic();modules=[]+with console.open('xb') as f:+ process=subprocess.Popen(cmd,cwd=APP,env=env,stdout=f,stderr=subprocess.STDOUT)+ try:+ time.sleep(12)+ kernel=ctypes.WinDLL('kernel32',use_last_error=True);psapi=ctypes.WinDLL('psapi',use_last_error=True)+ kernel.OpenProcess.argtypes=[ctypes.c_ulong,ctypes.c_int,ctypes.c_ulong];kernel.OpenProcess.restype=ctypes.c_void_p+ kernel.CloseHandle.argtypes=[ctypes.c_void_p]+ psapi.EnumProcessModulesEx.argtypes=[ctypes.c_void_p,ctypes.POINTER(ctypes.c_void_p),ctypes.c_ulong,ctypes.POINTER(ctypes.c_ulong),ctypes.c_ulong]+ psapi.GetModuleFileNameExW.argtypes=[ctypes.c_void_p,ctypes.c_void_p,ctypes.c_wchar_p,ctypes.c_ulong]+ handle=kernel.OpenProcess(0x0410,False,process.pid);assert handle+ try:+ items=(ctypes.c_void_p*1024)();needed=ctypes.c_ulong()+ assert psapi.EnumProcessModulesEx(handle,items,ctypes.sizeof(items),ctypes.byref(needed),3)+ for i in range(min(1024,needed.value//ctypes.sizeof(ctypes.c_void_p))):+ buffer=ctypes.create_unicode_buffer(32768)+ if psapi.GetModuleFileNameExW(handle,items[i],buffer,len(buffer)):+ path=Path(buffer.value)+ if path.name.startswith(('Qt6','avcodec-','avformat-','avutil-','swscale-','swresample-')):+ assert path.resolve().is_relative_to(APP.resolve()),str(path);modules.append(str(path))+ finally:kernel.CloseHandle(handle)+ rc=process.wait(timeout=65)+ except BaseException:+ if process.poll() is None:process.kill();process.wait(timeout=10)+ raise+text=engine.read_text(encoding='utf8',errors='replace')+'\n'+console.read_text(encoding='utf8',errors='replace')+bad=[line for line in text.splitlines() if re.search(r'\[ERROR\s*\]|\[FATAL\s*\]|ReferenceError:|TypeError:|no root object',line)]+result={'exit':rc,'seconds':time.monotonic()-start,'command':cmd,'exeSha256':receipt['exeSha256'],'ownQtAndCodecModulePaths':modules,+ 'boundedWorker':'SDK submission=bounded worker' in text,'nr1080':'internal=1920x1080 composite=3840x2160' in text,+ 'vfg4':vfg4_running(text),+ 'normalGpuPriority':'requested=2 actual=2' in text,'errors':bad,'engine':str(engine),'console':str(console)}+result['passed']=rc==0 and len(modules)>10 and all(result[k] for k in ('boundedWorker','nr1080','vfg4','normalGpuPriority')) and not bad+(VERIFY/'candidate-cold.json').write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf8')+assert result['passed'],result+verify_payload()+print('VFG CANDIDATE COLD START PASS',len(modules),'own Qt/codec modules',result['seconds'],flush=True)diff --git a/scripts/acceptance/vfg-opt-export.py b/scripts/acceptance/vfg-opt-export.pyindex ad75d09e..df7ac9b0 100644--- a/scripts/acceptance/vfg-opt-export.py+++ b/scripts/acceptance/vfg-opt-export.py@@ -30,11 +30,16 @@ def run(name,media,m,q,flags=(),expected='success'):data=json.loads(subprocess.check_output([probe,'-v','error','-count_frames','-show_streams','-of','json',str(file)],timeout=30))v=next(x for x in data['streams'] if x['codec_type']=='video')assert v['codec_name']=='hevc' and int(v['nb_read_frames'])==8*m,data- assert all(abs(int(v[k].split('/')[0])/int(v[k].split('/')[1])-30*m)<.00001 for k in ('avg_frame_rate','r_frame_rate')),data- assert abs(float(v['duration'])-8/30)<1/(30*m),data+ tick=int(v['time_base'].split('/')[0])/int(v['time_base'].split('/')[1])+ rate=lambda k:int(v[k].split('/')[0])/int(v[k].split('/')[1])+ assert abs(rate('r_frame_rate')-30*m)<.00001,data+ # MP4 uses integer time-base ticks: an eight-frame clip's rounded duration+ # changes avg_frame_rate slightly even with strictly CFR packet timestamps.+ assert abs(rate('avg_frame_rate')-30*m)<=30*m*tick/(8/30-tick)+1e-9,data+ assert abs(float(v['duration'])-8/30)<=tick+1e-9,datafor audio in (x for x in data['streams'] if x['codec_type']=='audio'):assert abs(float(audio['duration'])-8/30)<.06,datapackets=json.loads(subprocess.check_output([probe,'-v','error','-select_streams','v','-show_entries','packet=pts_time','-of','json',str(file)],timeout=30))['packets']- pts=[float(x['pts_time']) for x in packets];assert len(pts)==8*m and all(abs(b-a-1/(30*m))<.000003 for a,b in zip(pts,pts[1:])),pts+ pts=[float(x['pts_time']) for x in packets];assert len(pts)==8*m and all(b>a and abs(b-a-1/(30*m))<=2*tick+1e-9 for a,b in zip(pts,pts[1:])),ptsif '--nr' in flags:assert 'nr=1' in text and (v['width'],v['height'])==(3840,2160),text[-5000:]item.update(frames=8*m,probe=data,pts=pts)results.append(item);(logs/'summary.json').write_text(json.dumps(results,ensure_ascii=False,indent=2),encoding='utf8');print('VFG EXPORT PASS',name,flush=True)diff --git a/scripts/acceptance/vfg-opt-finish.py b/scripts/acceptance/vfg-opt-finish.pynew file mode 100644index 00000000..116bb194--- /dev/null+++ b/scripts/acceptance/vfg-opt-finish.py@@ -0,0 +1,62 @@+"""Validate completed receipts and render the final local VFG report."""+from pathlib import Path+import hashlib,json,re,subprocess,sys+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-optimization-20261007';LOGS=BASE/'logs'/TASK+def read(p):return json.loads(p.read_text(encoding='utf-8-sig'))+def sha(p):+ with p.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-opt-control.py')],cwd=ROOT,check=True)+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-opt-report.py')],cwd=ROOT,check=True)+exe=sha(BASE/'build'/TASK/'veyra_qml_ui.exe');matrix=[]+for q in ('low','medium','high'):+ for m in range(2,9):+ case=read(LOGS/f'{q}{m}-nr/result.json');assert case['passed'] and case['exeSha256']==exe and case['exitCode']==0,case+ assert case['config']['nr'] and case['config']['seconds']==20 and case['observations']>=17,case+ text=(LOGS/f'{q}{m}-nr/player.log').read_text(encoding='utf8',errors='replace')+ assert not re.search(r'\[ERROR\s*\]|\[FATAL\s*\]',text),q+str(m)+ matrix.append({'quality':q,'multiplier':m,'fps':case['fps'],'status':case['status']})+rows=['| 倍率 | 源30目标fps | Low 前→后 | Medium 前→后 | High 前→后 |','| --- | ---: | ---: | ---: | ---: |']+for m in range(2,9):+ values=[]+ for q in ('low','medium','high'):+ old=read(BASE/'logs/vfg-diagnosis-20261007'/f'{q}{m}-nr/result.json');new=read(LOGS/f'{q}{m}-nr/result.json')+ suffix='(降档)' if any('降档' in s for s in new['status']) else '(未满)' if new['fps']<30*m*.99 else ''+ values.append(f'{old["fps"]:g}→{new["fps"]:g}{suffix}')+ rows.append(f'| {m}X | {30*m} | '+' | '.join(values)+' |')+rows+=['','“前”为上一轮正式2.0.5诊断参考,“后”为本轮最终候选21组。非相邻矩阵不用于精确归因百分比;下面相邻对照才用于计算收益。']+controls=[];matched=['| 对照 | 原版fps | 候选fps | 提升 | 原版CPU滚动P95中位ms | 候选CPU滚动P95中位ms |','| --- | ---: | ---: | ---: | ---: | ---: |']+for name in ('medium4','high2'):+ old=read(LOGS/f'matched-old-{name}/analysis.json');new=read(LOGS/f'matched-new-{name}/analysis.json')+ assert old['result']['passed'] and new['result']['passed'] and new['result']['exeSha256']==exe+ assert old['result']['config']==new['result']['config']+ oldfps,newfps=old['result']['fps'],new['result']['fps'];gain=(newfps/oldfps-1)*100+ a=old['timing']['medianReportedWindowP95Ms']['graphSubmitP95Ms'];b=new['timing']['medianReportedWindowP95Ms']['graphSubmitP95Ms']+ controls.append({'case':name,'oldFps':oldfps,'newFps':newfps,'fpsGainPercent':gain,'oldCpuWindowP95Ms':a,'newCpuWindowP95Ms':b,'cpuWindowP95ReductionPercent':(1-b/a)*100,'oldCadence':old['submissionCadenceMs'],'newCadence':new['submissionCadenceMs'],'oldExpired':old['timing']['cumulativeDeltas']['expiredGenerated'],'newExpired':new['timing']['cumulativeDeltas']['expiredGenerated']})+ matched.append(f'| {name} | {oldfps:g} | {newfps:g} | {gain:.1f}% | {a:.3f} | {b:.3f} |')+sync=read(LOGS/'matched-sync-medium4/result.json');assert sync['passed'] and sync['syncSubmit'] and sync['exeSha256']==exe+matched+=['',f'同一候选仅强制同步提交的控制组Medium4为{sync["fps"]:g}fps;对应正常异步组为{controls[0]["newFps"]:g}fps,支持“送显线程被SDK调用占住”的因果解释。']+native=read(LOGS/'candidate-native-720-v3.json');assert native['exit']==0+native4k=read(LOGS/'async-native-4k-v2.json');assert native4k['exit']==0+hashes=read(LOGS/'native-hash-comparison.json');assert hashes['allGpuPixelHashesIdentical'] and hashes['intermediateFrames']==168 and hashes['finalCandidateHashMatches'] and hashes['finalCandidateExeSha256']==exe+exports=read(LOGS/'export-v3-verified/summary.json');assert len(exports)==24 and all(x['exit']==(1 if x['expected']=='missing' else 0) for x in exports)+life=[dict(x,evidence='lifecycle-v3') for x in read(LOGS/'lifecycle-v3/summary.json') if x['phase'] in ('run','restore')]+life += [dict(x,evidence='lifecycle-edge-v3') for x in read(LOGS/'lifecycle-edge-v3/summary.json')]+assert {x['phase'] for x in life}=={'run','restore','missing','failure'} and len(life)==4 and all(x['passed'] for x in life)+assert 'unavailable saved backend=NVIDIA-VFG selected=AMD-FSR' in (LOGS/'lifecycle-edge-v3/missing-engine.log').read_text(encoding='utf8')+gui=read(LOGS/'lifecycle-edge-v3/export-probe.json');guiVideo=next(x for x in gui['streams'] if x['codec_type']=='video');assert guiVideo['nb_read_frames']=='64' and guiVideo['r_frame_rate']=='240/1'+settings=read(LOGS/'settings-v3.json');assert settings['exit']==0 and '331 checks, 0 failures' in (LOGS/'settings-v3.log').read_text(encoding='utf-8-sig')+validation='\n'.join(['- 最终候选构建candidate-build-v3 exit0,EXE SHA256 `'+exe+'`,核心源码ddf71b1。',+ '- 21组原片正常播放、5组相邻/同步控制均采样与退出通过;是否跑满按上表判定。',+ '- 8/10位、三质量、2X–8X、切镜/相同CUDA地址刷新/反向运动/parity与2X→4X→8X恢复:720p同步、720p异步、4K异步各913项0失败,最终EXE再做720p检查通过;168张同步/异步插帧GPU像素哈希一致。',+ '- GUI热切换质量/倍率、VFG↔DLSS6X、暂停/seek/缩放、全屏进入/返回、列表/节点预设与重启通过;缺VFG运行库沿用原有启动迁移到FSR2X并继续播放,未修改该共享策略。异步Run拒绝后实际FG关闭、原帧继续,无等待悬挂。GUI独立导出worker保持同步SDK判定,8源帧输出64帧/240fps。',+ '- VFG设置/预设/会话及倍率/PTS单元测试331项0失败。',+ '- 21组720p三质量×2X–8X实际NVENC导出及4K GTA短片原生NR+VFG4导出通过;每组源8帧、输出8×倍率、HEVC/CFR与严格递增PTS核对,无源帧丢弃。边界hold仍按原导出合同计数,不能把所有输出都称神经生成帧。取消和缺运行库导出失败清理通过。',+ '- 失败记录保留:初次两个异步拒绝断言误把QML保存的fgEnabled请求当实际后端;首次缺运行库断言误以为旧策略必定关闭FG,实际已迁移FSR;首次八帧MP4导出断言未考虑微秒time_base取整(16帧、标称60fps,平均59.999925fps)。按实际接口和时间刻度修正测试后通过,没有为迁就测试改产品。settings-tests首次漏传必需的绝对输出目录而exit2,补齐参数后331项通过。'])+path=ROOT/'docs/VFG_OPTIMIZATION_REPORT_2026-10-07.md';text=path.read_text(encoding='utf8')+text=text.replace('状态:验收进行中,以下已完成证据不代表尚未执行的检查通过。','状态:本机VFG专项短测通过,已达到部分主要档位目标;更高倍率仍有明确限制。')+assert all(marker in text for marker in ('<!-- MATRIX_TABLE -->','<!-- MATCHED_TABLE -->','<!-- VALIDATION -->'))+text=text.replace('<!-- MATRIX_TABLE -->','\n'.join(rows)).replace('<!-- MATCHED_TABLE -->','\n'.join(matched)).replace('<!-- VALIDATION -->',validation)+path.write_text(text,encoding='utf8')+receipt={'buildExeSha256':exe,'buildSource':read(LOGS/'candidate-build-v3.json')['sourceHead'],'matrix':matrix,'matched':controls,'syncControlFps':sync['fps'],'nativeHashComparison':hashes,'exportCases':len(exports),'lifecycle':life,'settings':settings,'report':str(path)}+verify=BASE/'verify'/TASK;verify.mkdir(parents=True,exist_ok=True);(verify/'measurements.json').write_text(json.dumps(receipt,ensure_ascii=False,indent=2),encoding='utf8')+print(json.dumps({'exeSha256':exe,'matched':controls,'matrixCases':len(matrix),'exports':len(exports)},ensure_ascii=False),flush=True)diff --git a/scripts/acceptance/vfg-opt-lifecycle.py b/scripts/acceptance/vfg-opt-lifecycle.pyindex d70d0d74..ba63e33c 100644--- a/scripts/acceptance/vfg-opt-lifecycle.py+++ b/scripts/acceptance/vfg-opt-lifecycle.py@@ -2,12 +2,20 @@from pathlib import Pathimport argparse,json,os,re,shutil,subprocess,time,psutilROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-optimization-20261007';APP=BASE/'tests'/TASK/'app'-p=argparse.ArgumentParser();p.add_argument('label');p.add_argument('--failure-only',action='store_true');a=p.parse_args();assert a.label.replace('-','').isalnum()+p=argparse.ArgumentParser();p.add_argument('label');modes=p.add_mutually_exclusive_group();modes.add_argument('--failure-only',action='store_true');modes.add_argument('--edge-from');a=p.parse_args();assert a.label.replace('-','').isalnum()+if a.edge_from:assert a.edge_from.replace('-','').isalnum()subprocess.run(['python','-B',str(ROOT/'scripts/acceptance/vfg-opt-control.py')],cwd=ROOT,check=True)assert not any(x.info['name'].lower() in ('veyra.exe','veyra_qml_ui.exe','veyra_vfg_gpu_tests.exe','veyra_vfg_export_probe.exe') for x in psutil.process_iter(['name']))out,logs,tmp=(BASE/k/TASK/a.label for k in ('tests','logs','tmp'))for x in (out,logs,tmp):x.mkdir(parents=True,exist_ok=False)-profile=out/'profile';profile.mkdir();(profile/'qml-preferences.v1.json').write_text(json.dumps({'overlayCompat':'off','gpuPriority':'normal','obsGameCapture':False}),encoding='utf8')+profile=out/'profile'+if a.edge_from:+ prior=BASE/'tests'/TASK/a.edge_from+ receipt=json.loads((BASE/'logs'/TASK/a.edge_from/'summary.json').read_text(encoding='utf8'))+ assert all(any(x['phase']==phase and x['passed'] for x in receipt) for phase in ('run','restore'))+ shutil.copytree(prior/'profile',profile)+else:+ profile.mkdir();(profile/'qml-preferences.v1.json').write_text(json.dumps({'overlayCompat':'off','gpuPriority':'normal','obsGameCapture':False}),encoding='utf8')outputs=out/'outputs';outputs.mkdir()media=Path('E:/Ai/知识/小七姐/GTAVI_An_Extended_Look_4K_Native.mp4')short=BASE/'tests/runtime-size-20261004/export-basic-v2/input.mp4';assert short.is_file()@@ -18,14 +26,14 @@ env['PATH']=os.pathsep.join((env['WINDIR']+'/System32',env['WINDIR'],env['WINDIRpackage=BASE/'releases/publish-2.0.5-20261007/packages/Veyra-2.0.5-NVIDIA-win64-portable'original=(package/'qml/Veyra/Main.qml').read_bytes();source=original.decode('utf8');at=source.rfind('}');main=APP/'qml/Veyra/Main.qml';results=[]try:- for phase in (['failure'] if a.failure_only else ['run','restore','missing','failure']):+ for phase in (['failure'] if a.failure_only else ['missing','failure'] if a.edge_from else ['run','restore','missing','failure']):child=env.copy();data=profilechild['VEYRA_LOG_FILE']=str(logs/(phase+'-engine.log'))if phase in ('missing','failure'):data=out/(phase+'-profile');shutil.copytree(profile,data)if phase=='missing':child['VEYRA_VFG_RUNTIME']=str(tmp/'missing-runtime')if phase=='failure':child['VEYRA_TEST_VFG_REJECT_RUN']='3'- qml=ROOT/'scripts/acceptance'/('vfg-opt-failure.qml' if phase=='failure' else 'vfg-ui.qml')+ qml=ROOT/'scripts/acceptance'/('vfg-opt-failure.qml' if phase=='failure' else 'vfg-opt-ui.qml')settings='item.media='+json.dumps(str(media))+';'if phase!='failure':settings+='item.shortMedia='+json.dumps(str(short))+';item.evidence='+json.dumps(str(out))+';item.phase='+json.dumps(phase)+';'loader='\nLoader { source: '+json.dumps(qml.as_uri())+'; onLoaded: { '+settings+' } }\n'@@ -49,7 +57,7 @@ try:print(results[-1],flush=True)finally:main.write_bytes(original)if not a.failure_only:- files=list(outputs.glob('*.mp4'));assert len(files)==1,files+ files=list((prior/'outputs' if a.edge_from else outputs).glob('*.mp4'));assert len(files)==1,filesprobe=json.loads(subprocess.check_output([shutil.which('ffprobe'),'-v','error','-count_frames','-show_streams','-of','json',str(files[0])],timeout=30))video=next(x for x in probe['streams'] if x['codec_type']=='video');assert int(video['nb_read_frames'])==64 and video['r_frame_rate']=='240/1',probe(logs/'export-probe.json').write_text(json.dumps(probe,indent=2),encoding='utf8')diff --git a/scripts/acceptance/vfg-opt-matched.py b/scripts/acceptance/vfg-opt-matched.pynew file mode 100644index 00000000..5cd8b8e0--- /dev/null+++ b/scripts/acceptance/vfg-opt-matched.py@@ -0,0 +1,9 @@+"""Adjacent original/candidate controls, serial and unchanged GPU class."""+from pathlib import Path+import subprocess,sys+ROOT=Path(__file__).resolve().parents[2]+cases=[('matched-old-medium4',1,4,['--original']),('matched-new-medium4',1,4,[]),+ ('matched-sync-medium4',1,4,['--sync-submit']),('matched-old-high2',2,2,['--original']),('matched-new-high2',2,2,[])]+for name,q,m,flags in cases:+ subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-opt-run.py'),'case',name,'--quality',str(q),'--multiplier',str(m),*flags],cwd=ROOT,timeout=160,check=True)+print('VFG ADJACENT CONTROLS PASS',len(cases),flush=True)diff --git a/scripts/acceptance/vfg-opt-stage.py b/scripts/acceptance/vfg-opt-stage.pynew file mode 100644index 00000000..ba4be298--- /dev/null+++ b/scripts/acceptance/vfg-opt-stage.py@@ -0,0 +1,38 @@+"""Local NVIDIA candidate from the approved package; independent file copies."""+from pathlib import Path+import hashlib,json,os,shutil,subprocess,sys+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-optimization-20261007'+PACKAGE=BASE/'releases/publish-2.0.5-20261007/packages/Veyra-2.0.5-NVIDIA-win64-portable'+OUT=BASE/'test-packages'/TASK;APP=OUT/'Veyra-2.0.5-VFG-test-NVIDIA-win64-portable'+def sha(p):+ with p.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-opt-control.py')],cwd=ROOT,check=True)+build=json.loads((BASE/'logs'/TASK/'candidate-build-v3.json').read_text(encoding='utf8'));assert build['exit']==0+head=build['sourceHead'];assert head.startswith('ddf71b1')+old=json.loads((PACKAGE/'package-manifest.json').read_text(encoding='utf-8-sig'))+for item in old['files']:assert sha(PACKAGE/item['path'])==item['sha256'].lower(),item['path']+assert not APP.exists();OUT.mkdir(parents=True,exist_ok=True)+shutil.copytree(PACKAGE,APP,copy_function=shutil.copy2)+shutil.copy2(BASE/'build'/TASK/'veyra_qml_ui.exe',APP/'veyra_qml_ui.exe')+notes=ROOT/'docs/VFG_OPTIMIZATION_REPORT_2026-10-07.md';assert notes.is_file()+assert '状态:本机VFG专项短测通过' in notes.read_text(encoding='utf8') and '<!--' not in notes.read_text(encoding='utf8')+shutil.copy2(notes,APP/'VFG-TEST-NOTES.zh-CN.md')+source=OUT/'Veyra-2.0.5-VFG-test-source.zip';assert not source.exists()+subprocess.run(['git','archive','--format=zip','--prefix=Veyra-vfg-test/','--output='+str(source),head],cwd=ROOT,check=True,timeout=90)+manifest={'schema':3,'version':'2.0.5','candidate':'2.0.5-vfg-test','displayVersion':'2.0.5-vfg-test','releaseReady':False,'localOnly':True,'gpuPackage':'NVIDIA',+ 'baseCommit':head,'sourceArchiveCommit':head,'publishedBaseVersion':'2.0.5','publishedBaseExeSha256':sha(PACKAGE/'veyra_qml_ui.exe'),+ 'correspondingSource':{'application':'../'+source.name,'applicationSha256':sha(source),'dependencies':old['correspondingSource']['dependencies'],'dependencySha256':old['correspondingSource']['dependencySha256'],'instructions':'docs/BUILD_2.0.5.md','displayVersionOverride':'-DVEYRA_DISPLAY_VERSION=2.0.5-vfg-test'},+ 'knownIssues':['NVIDIA VRAM growth remains unresolved; this is a VFG submission optimization','High quality above 2X and higher Medium multipliers do not all reach the requested output rate on the tested RTX5070'],+ 'files':[]}+for file in sorted(APP.rglob('*')):+ if not file.is_file() or file.name=='package-manifest.json':continue+ rel=file.relative_to(APP).as_posix();original=PACKAGE/rel+ if original.is_file():+ assert not os.path.samefile(file,original),'Candidate must not share writable hardlinks'+ if rel!='veyra_qml_ui.exe':assert sha(file)==sha(original),rel+ manifest['files'].append({'path':rel,'size':file.stat().st_size,'sha256':sha(file)})+(APP/'package-manifest.json').write_text(json.dumps(manifest,ensure_ascii=False,indent=2),encoding='utf8')+receipt={'app':str(APP),'exeSha256':sha(APP/'veyra_qml_ui.exe'),'source':str(source),'sourceSha256':sha(source),'files':len(manifest['files']),'runtimeAndQmlUnchanged':True,'independentCopies':True,'buildSource':head}+verify=BASE/'verify'/TASK;verify.mkdir(parents=True,exist_ok=True);(verify/'candidate-package.json').write_text(json.dumps(receipt,ensure_ascii=False,indent=2),encoding='utf8')+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-opt-control.py')],cwd=ROOT,check=True)+print(json.dumps(receipt,ensure_ascii=False),flush=True)diff --git a/scripts/acceptance/vfg-opt-ui.qml b/scripts/acceptance/vfg-opt-ui.qmlnew file mode 100644index 00000000..7d177617--- /dev/null+++ b/scripts/acceptance/vfg-opt-ui.qml@@ -0,0 +1,144 @@+// Disposable staging loader using the actual bridge, engine and export worker.+import QtQuick+Item {+ id: test+ property var appWindow: Window.window+ property string media: ""+ property string shortMedia: ""+ property string evidence: ""+ property string phase: "run"+ property int step: 0+ property int ticks: 0+ property int waited: 0+ property int current: 0+ property real beforePosition: 0+ property var cases: [{m:2,q:1},{m:3,q:1},{m:4,q:1},{m:5,q:1},{m:6,q:1},{m:7,q:1},{m:8,q:1},{m:8,q:0},{m:8,q:2}]+ function check(ok,why){if(!ok){console.error("VFG_UI_FAIL",phase,step,why);timer.stop();Qt.quit();throw new Error(why)}}+ function next(n){step=n;waited=0}+ function find(item,name){if(item.objectName===name)return item;for(const child of item.children||[]){const r=find(child,name);if(r)return r}return null}+ function findNodePage(item){if(typeof item.selectId==="function")return item;for(const child of item.children||[]){const r=findNodePage(child);if(r)return r}return null}+ function findProPage(item){if(typeof item.overlayContains==="function"&&typeof item.tab==="string")return item;for(const child of item.children||[]){const r=findProPage(child);if(r)return r}return null}+ function preset(name){return veyra.presets.findIndex(x=>x.name===name)}+ function startCase(){const c=cases[current];beforePosition=veyra.position;veyra.fgMultiplier=c.m;veyra.vfgQuality=c.q;next(2)}+ Connections {target: veyra;function onNotice(message,error){console.log("VFG_NOTICE",message,error)}}+ Timer {id: timer;interval: 200;running: true;repeat: true+ onTriggered: {try {+ if(++test.ticks>1150)test.check(false,"230-second deadline");++test.waited+ if(!test.media.length)return+ const rtss=test.find(test.appWindow.contentItem,"overlay-restart-confirm")+ if(rtss&&rtss.shown){rtss.close();rtss.rejected();console.log("VFG_UI_RTSS_DEFER")}+ if(test.step===0){+ if(test.waited<10)return+ test.check(veyra.fgBackendChoices.some(x=>x.id==="vfg"),"VFG backend menu")+ if(test.phase==="restore"){+ test.check(veyra.nodeMode===0&&veyra.fgBackendName==="vfg"&&veyra.fgMultiplier===8&&veyra.vfgQuality===1,"list restart preserves 8X Medium")+ test.check(test.preset("VFG List 8 Medium")>=0&&test.preset("VFG Node 8 High")>=0,"preset restart")+ veyra.nodeMode=1;test.check(veyra.fgBackendName==="vfg"&&veyra.fgMultiplier===8&&veyra.vfgQuality===2,"node restart preserves independent 8X High")+ test.check(veyra.applyPresetIndex(test.preset("VFG Node 8 High")),"node VFG preset applies")+ veyra.nodeMode=0;test.check(veyra.vfgQuality===1,"switch back restores list Medium")+ console.log("VFG_UI_RESTORE_PASS");timer.stop();Qt.quit();return+ }+ veyra.muted=true;veyra.nrEnabled=false;veyra.srEnabled=false+ test.appWindow.page="pro"+ const professional=test.findProPage(test.appWindow.contentItem)+ if(professional)professional.tab="fg"+ if(test.phase==="missing"){+ veyra.openPath(test.media);test.next(20);return+ }+ test.check(veyra.addEffect("vfg-fg")>=0,"add VFG list stage")+ const factor=test.find(test.appWindow.contentItem,"list-vfg-multiplier")+ const quality=test.find(test.appWindow.contentItem,"list-vfg-quality")+ test.check(factor&&quality,"list controls created")+ test.check(factor.options.map(x=>x.id).join(",")==="2,3,4,5,6,7,8","all seven multiplier controls")+ for(let q=0;q<3;++q){quality.picked(String(q));test.check(veyra.vfgQuality===q,"quality control commits "+q)}+ for(let m=2;m<=8;++m){factor.picked(String(m));test.check(veyra.fgMultiplier===m,"multiplier control commits "+m)}+ veyra.vfgQuality=1;veyra.fgMultiplier=2;veyra.openPath(test.media);test.next(1)+ }else if(test.step===1){+ if(!veyra.running||!veyra.hasSource||veyra.applying)return+ test.startCase()+ }else if(test.step===2){+ if(test.waited<12||veyra.applying)return+ const c=test.cases[test.current]+ test.check(veyra.running&&veyra.fgActive&&veyra.fgBackendName==="vfg","VFG inactive "+veyra.statusText)+ test.check(veyra.fgMultiplier===c.m&&veyra.vfgQuality===c.q,"hot settings rollback")+ test.check(veyra.position>test.beforePosition+0.3,"playback clock stopped")+ test.check(veyra.runStatusDetail.indexOf("NVIDIA VFG")>=0,"actual running backend label")+ console.log("VFG_UI_CASE",c.m,c.q,"submitFps",veyra.submitFps,"detail",veyra.runStatusDetail)+ if(++test.current<test.cases.length){test.startCase();return}+ veyra.vfgQuality=1;test.next(3)+ }else if(test.step===3){+ if(test.waited<8||veyra.applying)return+ test.check(veyra.savePresetAs("VFG List 8 Medium",15,false),"save list VFG preset")+ test.next(12)+ test.appWindow.contentItem.grabToImage(r=>{test.check(r.saveToFile(test.evidence+"/vfg-list.png"),"list screenshot");veyra.fgBackendName="dlss";veyra.fgMultiplier=6;test.next(15)})+ }else if(test.step===15){+ if(test.waited<12||veyra.applying)return+ if(veyra.runStatusDetail.indexOf("DLSS")<0||veyra.runStatusDetail.indexOf("6X")<0){if(test.waited<100)return;test.check(false,"DLSS 6X actual running label")}+ test.check(veyra.fgActive&&veyra.fgBackendName==="dlss"&&veyra.fgMultiplier===6,"legacy DLSS 6X works after VFG 8X")+ console.log("VFG_UI_DLSS6_PASS",veyra.runStatusDetail)+ veyra.fgBackendName="vfg";veyra.fgMultiplier=8;test.next(16)+ }else if(test.step===16){+ if(test.waited<12||veyra.applying)return+ if(veyra.runStatusDetail.indexOf("NVIDIA VFG")<0||veyra.runStatusDetail.indexOf("8X")<0){if(test.waited<100)return;test.check(false,"VFG 8X actual running label after DLSS")}+ test.check(veyra.fgActive&&veyra.fgBackendName==="vfg"&&veyra.fgMultiplier===8,"VFG 8X restores after DLSS 6X")+ veyra.togglePlayPause();test.next(4)+ }else if(test.step===4){+ if(!veyra.paused)return+ veyra.seekTo(2);test.appWindow.width=1160;test.appWindow.height=740;test.next(5)+ }else if(test.step===5){+ if(test.waited<10)return+ test.check(veyra.paused&&veyra.position>=1.9,"paused seek")+ veyra.togglePlayPause();test.next(6)+ }else if(test.step===6){+ if(test.waited<10||veyra.applying)return+ test.check(veyra.running&&!veyra.paused&&veyra.position>2.5,"resume after seek/resize")+ test.beforePosition=veyra.position;test.appWindow.toggleFullscreen();test.next(17)+ }else if(test.step===17){+ if(test.waited<10||veyra.applying)return+ test.check(test.appWindow.fullscreen&&veyra.running&&veyra.fgActive&&veyra.position>test.beforePosition+0.5,"VFG fullscreen playback")+ test.beforePosition=veyra.position;test.appWindow.toggleFullscreen();test.next(18)+ }else if(test.step===18){+ if(test.waited<10||veyra.applying)return+ test.check(!test.appWindow.fullscreen&&veyra.running&&veyra.fgActive&&veyra.position>test.beforePosition+0.5,"VFG return to window playback")+ console.log("VFG_UI_FULLSCREEN_PASS")+ veyra.nodeMode=1;test.appWindow.page="node";test.check(veyra.addEffect("vfg-fg")>=0,"add VFG node")+ veyra.fgMultiplier=8;veyra.vfgQuality=2;test.next(7)+ }else if(test.step===7){+ if(test.waited<10||veyra.applying)return+ test.check(veyra.chainValid&&veyra.fgActive&&veyra.vfgQuality===2,"node VFG running")+ test.check(veyra.effectCatalog.some(x=>x.id==="vfg-fg"),"node add menu includes VFG")+ const page=test.findNodePage(test.appWindow.contentItem),fg=veyra.chain.find(x=>x.type==="frame-generation")+ if(page&&fg)page.selectId(fg.id)+ test.check(veyra.savePresetAs("VFG Node 8 High",15,true),"save node VFG preset")+ test.next(12)+ test.appWindow.contentItem.grabToImage(r=>{test.check(r.saveToFile(test.evidence+"/vfg-node.png"),"node screenshot");veyra.stopPlayback();test.next(8)})+ }else if(test.step===8){+ if(test.waited<8||veyra.hasSource)return+ veyra.nodeMode=0;test.appWindow.page="pro"+ test.check(veyra.fgMultiplier===8&&veyra.vfgQuality===1,"list state survives node High")+ veyra.vfgQuality=2+ veyra.addExportFiles([test.shortMedia]);veyra.exportCompletionSound=false;veyra.exportHevc=true;veyra.exportSrTargetIndex=-1;veyra.exportRateControl=1;veyra.exportBitrateMbps=18+ test.next(9)+ }else if(test.step===9){+ if(veyra.exportReadyCount!==1)return+ veyra.startExport();test.check(veyra.exportRunning,"VFG worker started")+ veyra.vfgQuality=0;veyra.fgMultiplier=2;test.next(10)+ }else if(test.step===10){+ if(veyra.exportRunning)return+ test.check(veyra.exportItems.filter(x=>x.state==="done").length===1,"native VFG worker export")+ veyra.fgMultiplier=8;veyra.vfgQuality=1;test.next(11)+ }else if(test.step===11){+ if(test.waited<10)return+ console.log("VFG_UI_PASS");timer.stop();Qt.quit()+ }else if(test.step===20){+ if(test.waited<20||veyra.applying||!veyra.running)return+ console.log("VFG_UI_MISSING_STATE",JSON.stringify({active:veyra.fgActive,enabled:veyra.fgEnabled,position:veyra.position,backend:veyra.fgBackendName,multiplier:veyra.fgMultiplier,quality:veyra.vfgQuality,warning:veyra.backendWarning}))+ // Existing startup capability migration chooses FSR when a+ // saved VFG runtime is unavailable. Preserve that policy.+ test.check(veyra.fgActive&&veyra.fgEnabled&&veyra.position>0.4&&veyra.fgBackendName==="fsr3"&&veyra.fgMultiplier===2,"existing missing-runtime FSR fallback continues playback")+ test.check(veyra.runStatusDetail.indexOf("FSR")>=0,"actual fallback backend label")+ console.log("VFG_UI_MISSING_PASS",veyra.runStatusDetail);timer.stop();Qt.quit()+ }+ }catch(e){console.error("VFG_UI_FAIL",e.message);timer.stop();Qt.quit()}}+ }+}