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++
Withdraw SR quality experiments and prepare local fixes test package
Veyra Goal Agent48d8f3464d64
diff --git a/AGENTS.md b/AGENTS.mdindex e622c511..4e8b3ad9 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,5 +1,9 @@# Veyra 项目 Agent 执行规则+> **2026-10-10 超分实验撤回与本地测试包**:用户要求停止超分继续优化、去掉负优化并汇报,随后明确“弄好了打个测试包给我”。本轮所有SR生产实验(局部/整帧静态运动校验、额外纹理/pass、DLSS档位及FSR曝光实验)全部撤回到c664a67,保留此前已验功能修复和共同参考测试工具。本地制作2.0.6-fixes-20261010完整NVIDIA测试包与对应源码,逐文件核对既有批准runtime、patched FFmpeg的zlib/PS5 slices256、许可证、私有配置冷启动与ZIP;覆盖下条“不打测试包”。不新发正式版、不merge/push/Release/关机,不派Agent,不动45既有工作树/495脏文件/main或真实配置。不得把重复帧误差改善说成一般视频画质提升。++> **2026-10-10 超分画质需求纠正**:用户明确RTX Video SR/DLSS/FSR均提升不明显,要求改善已经运行时的实际画质。按 docs/SR_VISUAL_QUALITY_PLAN_2026-10-10.md 从c664a67隔离codex/sr-visual-quality-20261010,必要SR后端/共享采样及前后链路/验证接点覆盖旧冻结。45既有工作树/495脏文件/main独立start保护;全产物E盘,不派Agent、不改运行库/模型/驱动/真实配置,不打测试包/merge/push/Release/关机。像素变化只能证明执行,不能当画质提升;先同源参考和实际视觉检查,修有证据的问题,不强加滤镜/隐藏延迟或编造收益。+> **2026-10-10 关闭效果器编辑卡顿修复**:用户反馈仅编辑未开启效果器也卡顿,按 docs/INACTIVE_EFFECTS_PLAN_2026-10-10.md 从30c6f60隔离codex/inactive-effects-20261010,允许必要设置比较/共享引擎更新路径/定向测试接点,覆盖这些接点旧冻结。QML重启回归发现的全局抗闪烁保存缺口仅补已有preferences读写,不改会话格式。独立start保护44既有工作树/495脏文件及main;全产物E盘,不派Agent、不改运行库/驱动/模型/真实配置、不打测试包、不合并/push/Release。每测试≤300秒,保存关闭参数、开启时实际应用,验证共享光流及多NR实例,不能将软件连续提交冒充屏幕端到端延迟;此前关机任务已完成,本次没有新关机指令。> **2026-10-10 四项现场修复授权**:用户提供日志46及手动数字输入后快捷键失效截图,要求修复设置切换致软件错误、数字输入焦点、优化超分和多语言/中文布局溢出,完成后汇报并关机。在 codex/settings-sr-ui-20261010 从 af2edf4 隔离实施必要 engine/presenter/SR/共享QML组件/翻译与构建定向验收接点,覆盖这些必要接点的旧冻结。独立不可变start保护43既有工作树/495脏文件与main;产物全E盘,保留已验DeckLink/字幕/播放列表改动。不派Agent,不改驱动、运行库/模型原件或用户配置,不打测试包、不merge/push/Release。测试每进程≤300秒,构建≤900秒;实测与现场未复现的边界分别报告。源码/报告/证据保存后按本次用户授权安排关机,不强制丢弃未保存内容。diff --git a/docs/SETTINGS_SR_UI_REPORT_2026-10-10.md b/docs/SETTINGS_SR_UI_REPORT_2026-10-10.mdindex 1fda63b4..cf95a427 100644--- a/docs/SETTINGS_SR_UI_REPORT_2026-10-10.md+++ b/docs/SETTINGS_SR_UI_REPORT_2026-10-10.md@@ -24,7 +24,9 @@ DXGI 对同一 HWND 的 flip-model 交换链有生命周期约束,外部仍持现在提交、Esc 和失焦关闭均清除编辑器焦点。仅当它仍持有活动焦点时才返回窗口内容焦点;用户点击另一个输入框时不会把新输入框的焦点抢走。真实键盘测试覆盖 Return/Esc 后方向快捷键、点击外部、继续编辑下一项、数值限幅/百分比/无效输入,13 条 Qt 测试记录通过。-## 3. 超分“几乎没效果”+## 3. 超分执行路径修复(未完成实际画质优化)++2026-10-10用户纠正:原需求是三个超分后端的画质改善不明显,不是算法没有运行。本节证据仅覆盖执行路径和输出变化,不能作为该画质需求已完成的结论;实际画质工作续见 `SR_VISUAL_QUALITY_PLAN_2026-10-10.md`。已确认并修复两处真正没有执行模型的路径:diff --git a/docs/SR_VISUAL_QUALITY_PLAN_2026-10-10.md b/docs/SR_VISUAL_QUALITY_PLAN_2026-10-10.mdnew file mode 100644index 00000000..b6f9f822--- /dev/null+++ b/docs/SR_VISUAL_QUALITY_PLAN_2026-10-10.md@@ -0,0 +1,23 @@+# 超分实际画质优化(2026-10-10)++用户纠正:需求是已运行的超分画质改善不足,RTX Video SR、DLSS SR、FSR 都不明显;上一任务的执行路径修复和像素变化不是画质验收。本轮基于 c664a675c7b7a5c6cb54ed79c07b8a72127f4dfb,在 codex/sr-visual-quality-20261010 隔离排查和改善现有三个 SR 后端与共享输入/采样/输出接点。独立 start 保护45既有工作树、495脏文件及 main。后端必要接点覆盖历史QML迁移冻结,不派子Agent、不打测试包、不合并/push/Release/关机。++先核对原有SR的颜色、采样、运动/历史、NR残差和最终呈现链;没有证据不得把它们直接当原因。以用户GTA6 4K原图为共同参考,受控降采样到1080p再放大,NR/FG默认关闭,比较普通缩放、VSR1/4、DLSS、FSR;检查连续帧/静态累积,另核查NR组合和缩小显示。只拿输出差异不通过质量验收,不通过锐化强度冒充真实重建,也不承诺从已丢失的信息恢复准确原图。++测试代码只调用产品 EnhanceGraph/后端;可离线回读验证,正常播放/导出不新增像素回读、逐pass CPU等待、隐藏延迟或无界队列。先记录旧输出,针对明确接入缺口修复;新参数/后处理若确有需要必须可解释且有对照,优先已有成熟开源实现,记录固定来源/许可证;不换未知运行库/模型,不改原件或用户配置。默认避免强滤镜掩盖模型。++实际画质对照以原图误差/结构/边缘与逐像素裁切共同判断,纹理、文字、人脸、高反差边缘的恶化不能被一个全图平均值掩盖;动态部分关注拖影/闪烁/切镜。相对同源受控参考的指标不当作所有视频的提升百分比。验证产品构建、预览/导出共享合同及已修复的关闭项无重建;保持HDR和其他补帧现状。现场硬件边界如实报告,不拿N卡测试冒充AMD。++所有新产物在 E:/项目/Veyra/{build,tests,logs,tmp,reports,archives}/sr-visual-quality-20261010;源码在 worktrees 同名目录。构建复用只读已验缓存并核对源/头依赖闭包与SHA;私有runtime用硬链接共享,EXE/QML按原子替换防止改原件,不复制媒体/整个便携包。单测试≤300秒、构建≤900秒。施工与失败写WORKLOG/同轮REPORT,收尾commit/checkpoint/增量bundle/保护检查。前轮SR报告标注为执行修复已完成、画质优化未完成,保留原证据。++画质测试与性能测试分开:已有播放器进程不结束、不操作。仅独立无窗口 reference 测试可显式启用 quality-only-concurrent,且每项前要求本机空闲显存≥6000MiB、GPU占用≤20%;记录并发进程与资源读数,不从其墙钟时间推断性能。其他呈现/交互测试仍要求没有已有播放器。若资源不足,保留记录并暂停GPU测试。++实测追加范围:静止帧中光流导致DLSS/FSR历史漂移,零运动对照改善静止却恶化真实运动,因此仅SR增加保守静态假设校验。新增shaders/SrMotion.hlsl、CMake shader目标及独立SR motion纹理/生命周期;不改共享光流、NR/FG消费者或其shader。测试描述可关闭该校验取得同EXE对照,生产默认开启,仅DLSS/FSR实际超分且使用光流时分配。此为本轮用户SR授权所必需的构建接点,覆盖旧CMake冻结。++首次0.5/255局部阈值在运动夜景使DLSS参考MSE增加18.19%,不验收该实现。收紧为3×3逐像素完全一致、静态假设严格优于原光流才归零;同样好的匹配保留原向量。再次检查全部场景,增加真实NR/SR/DLSS2X、NR先行与AMD半尺寸光流的D3D12 debug回归;N卡上的AMD provider验证不代表AMD实卡验收。++严格3×3仍使DLSS运动夜景MSE增加11.31%,也撤回。最终只对整个光流输入RGB逐像素完全相同的重复帧归零SR运动,正常变化帧保留原向量/FlowAdapt尺度;SR独立R32_UINT标志、GPU精确比较/缩放两个pass,不回读到CPU、不更改共享流。新增SrStaticDetect shader及构建目标,clear使用非shader-visible CPU UAV描述符并显式barrier。用户确认主要1080p或以下→2K/4K,因此追加720p→2K/4K静止/运动参考,不能把重复帧修复声称为全面清晰度改善。++收尾决定(覆盖上段继续实验):用户要求停止优化、撤回负优化。整帧重复检测虽在本次四段运动样本72张PNG与旧版逐字节相同,仍逐帧增加两个GPU pass与额外纹理,仅重复帧获益,不值得作为本次默认改变。因此所有SR生产实验均撤回c664a67,不继续720p测试;只保留共同原图参考测量工具和诚实的失败记录。源码CMake/EnhanceGraph/后端/着色器与基点相同,实验patch及两份shader留E盘archives而非产品。++用户随后授权本地测试包:2.0.6-fixes-20261010,包含此前设置/快捷键/布局/未开启效果编辑/字幕/播放列表/BMD原生开关等修复。基于已审1614文件NVIDIA便携母包清单硬链接暂存,仅原子替换当前EXE/QML/必要shader和已验zlib版FFmpeg;不使用运行过的目录作为包来源。构建标签与Windows属性一致;应用源码按clean commit保存,FFmpeg/dav1d/zlib对应源码及许可证随附,未变依赖保留2.0.6来源链接。私有data-dir冷启动及ZIP逐文件SHA/CRC核验后交付,本轮没有main合并、推送、公开发布或关机授权。diff --git a/docs/SR_VISUAL_QUALITY_REPORT_2026-10-10.md b/docs/SR_VISUAL_QUALITY_REPORT_2026-10-10.mdnew file mode 100644index 00000000..a747688d--- /dev/null+++ b/docs/SR_VISUAL_QUALITY_REPORT_2026-10-10.md@@ -0,0 +1,52 @@+# 超分画质实验撤回与本地修复测试包(2026-10-10)++本轮从 `c664a675c7b7a5c6cb54ed79c07b8a72127f4dfb`,在 `codex/sr-visual-quality-20261010` 隔离工作。用户明确三个超分的实际画质提升均不明显,主要场景是1080p或更低→2K/4K;随后决定停止继续优化、去掉负优化,最后授权制作本地测试包。++结论:**没有找到可靠的普遍画质提升,本轮所有SR生产实验全部撤回**。最终 CMakeLists、EnhanceGraph、SR后端和生产shader与本轮基点一致;SrMotion/SrStaticDetect及额外纹理、检测pass不进入产品。只保留共同原图参考的验证工具、报告和此前已经完成的功能修复。不能将“像素变了”或静止重复帧误差下降当成一般视频画质提升。++## 测法与判断依据++本机RTX5070 12GB、驱动616.56。直接只读用户的 `E:/Ai/知识/小七姐/GTAVI_An_Extended_Look_4K_Native.mp4`,3840×2160/30fps,14,115,273,308字节,不复制媒体。选原生4K帧作为共同参考,Lanczos降至1080p后恢复到4K,对比普通双线性、VSR1、VSR4、DLSS、FSR。NR/FG关闭;同帧参考SHA一致。++第60秒做重复输入,第90/300/900/1200秒各32帧连续运动,保存第1/8/32帧。精确向前解码到目标PTS,颜色转换使用实际标签/明确BT.709,避免把前一个关键帧或BT.601误算为参考。测量coded BT.709亮度MSE/PSNR/MAE、8×8不重叠总体方差SSIM、梯度误差;这里的SSIM不是标准高斯窗口版。另存原像素裁切,不通过缩放截图制造细节。指标是相对受控参考的误差,不是主观画质或所有素材收益百分比。++最终基线:`logs/sr-visual-quality-20261010/tests-20261010-143134`、`tests-20261010-143421`,以下相对证据均在 `E:/项目/Veyra/`。早期142741试跑未精确前解码且默认矩阵不明确,已经纠正,不用于最终质量结论。用户要求停止后,没有继续720p→2K/4K测试。++| 实验 | 实际结果 | 决定 |+| --- | --- | --- |+| DLSS Balanced切Quality | 本次路径默认preset下输出逐像素相同 | 恢复原档位,不宣传提升 |+| FSR自动曝光 | 变化很小、正负混合,没有稳定收益 | 恢复原设置 |+| 离线RCAS 0.25/0.5/1 | 第900秒各后端的参考误差均增加 | 不接入产品 |+| 全局零运动 | 重复帧DLSS MSE 5.696424→4.405476,FSR 11.816919→7.952452;第900秒运动DLSS 2.014786→2.514555,FSR 2.577306→4.933844 | 运动恶化,拒绝 |+| 3×3局部静态校验,0.5/255容差 | 第1200秒运动DLSS MSE增加18.19% | 拒绝 |+| 3×3完全相等且匹配严格优于原运动 | 第1200秒运动DLSS MSE仍增加11.31% | 拒绝 |+| 整个光流输入完全重复才归零 | 本次四段运动72张输出PNG与基线字节一致,重复帧误差改善;每个适用SR帧增加两次GPU dispatch、R32标志及RG16F纹理 | 收益仅重复帧,仍有默认运行成本,按用户要求全部撤回 |++整帧候选在4K DLSS时额外RG16F约31.64MiB,1080p FSR时约7.91MiB,另有标志资源分配;没有测出对应毫秒代价,不捏造帧率/功耗收益。它不是本次普遍清晰度优化,最终包不包含它。实验patch、两个shader及SHA在 `archives/sr-visual-quality-20261010/withdrawal.json`;四段一致性在 `reports/sr-visual-quality-20261010/discarded-global-candidate.json`。局部和整帧候选的shader/NR/FG组合检查通过也不抵消画质失败。++## 接入核对与限制++VSR调用现有SDK参数与1–4质量档,没有发现已公开的另一个强度控制。DLSS/FSR使用线性输入;现有motion缩放合同、零jitter、常量相对depth与真实游戏引擎提供的采样信息不同。普通视频没有实际渲染jitter/depth,不能凭空填写来制造重建信息。NR残差合成保留全分辨率基底,不是简单把整幅画面强制变成1080p;最终缩小显示也可能削弱超分细节的可见度。未证明存在另一个能简单调参解决的共享颜色或采样错误。++核对的一手资料:[NVIDIA RTX Video SDK](https://developer.nvidia.com/rtx-video-sdk)、[DLSS公开定义](https://github.com/NVIDIA/DLSS/blob/main/include/nvsdk_ngx_defs.h)、[DLSS开发指南](https://raw.githubusercontent.com/NVIDIA/DLSS/main/doc/DLSS_Programming_Guide_Release.pdf)、[AMD FSR接入手册](https://gpuopen.com/manuals/fidelityfx_sdk/techniques/super-resolution-upscaler/)。没有拷贝新上游算法、下载/更换未知运行库,SDK/模型/二进制不入Git。++## 撤回后构建和回归++- `py -3.11 -B scripts/acceptance/sr-visual-build.py`:最终撤回后16个EXE链接成功,`logs/sr-visual-quality-20261010/build-20261010-152739/receipt.json`;当前源/头依赖闭包编译或按SHA重用,旧缓存只读,不冒称所有第三方clean重编。+- `...build.py cmake-check`:`build-20261010-153030/receipt.json`,DeckLink原生/no-SDK两种配置及驱动对象、当前集成测试对象编译通过。此配置检查关闭串流依赖;实际GUI链接仍使用完整PS5/Moonlight/Xbox/libass配置。+- `...test.py sr presenter slider menu components lifecycle video rollback inactive inactive-node chain contracts hdr`:`tests-20261010-152929/receipt.json`,13组全部通过。包含三个SR实际执行合同、SDR/HDR设置事务、13项数字输入键盘、8项菜单布局、22项组件、呈现生命周期、用户GTA6热切换及失败回退、列表/节点关闭效果编辑各70项、chain287项、repair259项、HDR颜色合同。+- 末次仅改变本地构建标签及Windows版本资源:`...build.py ui-only`,`build-20261010-153535/receipt.json`,界面/文件属性均为 `2.0.6-fixes-20261010`。引擎/管线测试对象没有改变。生产版本仍2.0.6,不推送新正式版。++早期测试编译缺fstream等问题修正后重新构建;错误日志保留。局部静态算法的负收益没有通过删掉断言“解决”。正常播放未新增GPU像素回读、逐pass CPU等待或无界队列。每个测试进程≤300秒;质量并发试验不作为性能数字,最终回归时用户播放器已退出。++## 本地测试包++包目录 `E:/项目/Veyra/test-packages/fixes-20261010/`,完整NVIDIA候选 `Veyra-2.0.6-fixes-20261010-NVIDIA-win64-portable.zip`,另有当前应用源码和FFmpeg/dav1d/zlib对应源码。基于已审母包的1614文件清单暂存,不从运行过的APP目录复制;EXE/QML/必要shader/FFmpeg按原子替换,原件SHA不变。运行组件维持批准身份,社区NR的HashMismatch/NotSigned仍明确标注;软件没有恢复哈希锁。源码与运行二进制物理分离。++测试包保留此前设置切换恢复、手动数字输入焦点、长文字布局、关闭效果编辑、抗闪烁参数保存、PGS/压缩字幕、播放列表/PR31、Blackmagic原生开关、HDR补帧兼容开关及既有VFG修复。BMD/HDR两个兼容开关默认关闭。原尺寸VSR执行和FSR首帧修复属于先前有效功能修复,仍保留;不是本轮画质收益。++打包命令 `...sr-visual-package.py stage / smoke / seal`(依次单独运行)。使用独立data-dir、仅系统PATH与包内DLL分别做GPU/软件QML冷启动和GTA6实际播放,日志、QML缓存、截图、配置均在E盘外部目录,不修改产品QML。最终状态以同目录 `package-smoke.json`、`package.json` 和 `reports/sr-visual-quality-20261010/package-current.json` 为准,包含EXE/源码/ZIP SHA、来源提交、逐文件SHA/CRC、运行组件记录和原件核查。++封装前两种界面冷启动/实际播放均exit0,生产包文件前后SHA一致,`package-smoke.json`保留每次实际realPresented计数和命令。初次打包检查错误匹配了不存在的frames字段而断言失败,实际日志已经realPresented=460;修正脚本为核对realPresented≥100后重验两种模式,未改产品或降低为只检查进程退出。最终GUI SHA-256 `870623fec3b265bf9f3ce0837449e90934ec47164d22eb8b484e33ee95dbfc4c`。++本机没有AMD/BMD实卡;未重测全部串流/导出编码器,不声称反馈者黑屏/overlay问题或NV显存增长已根治。没有main合并、push、GitHub Release或关机。独立start保护45既有工作树、495脏文件和main `0e7018adab9b211d76dd05da40cfbaeb9d77cf2c`;源码commit/checkpoint、增量bundle及最终守卫见 `reports/sr-visual-quality-20261010/final.json`。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex a6e66691..edc25699 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -8994,3 +8994,21 @@ media, SDK files or runtime binaries.产物统一`E:/项目/Veyra/{build,tests,logs,tmp,reports,archives}/settings-sr-ui-20261010`,仅单份私有运行目录和当前构建,不打包或复制整工程。最后control.py final-audit核对旧树/main/范围,源码commit/checkpoint/source-after.bundle、构建和各回执哈希、磁盘占用与清理记录存reports同名/final.json。现场5070Ti+overlay/AMD9070未复测,未重验全部编码器/封装,不宣称所有用户已根治;保存证据后按本次用户请求安排非强制关机,动作另存shutdown回执。收尾缓存删除被自动审批拒绝:PowerShell已解析并检查`E:/项目/Veyra/tmp/settings-sr-ui-20261010`绝对范围,Remove-Item请求仍返回`blocked by policy`,命令未执行;未更换工具绕过。2773文件/284748097逻辑字节保留,非磁盘已释放。cleanup.json与disk-before-cleanup.json如实记录,修复/构建/源码收尾继续。++## 2026-10-10 SR画质实验、全部撤回及本地测试包++用户纠正三个SR均画质改善不明显,主要1080p或更低→2K/4K;最后要求停止优化、去掉负优化并汇报,又明确“弄好了打个测试包给我”。从c664a675c7b7a5c6cb54ed79c07b8a72127f4dfb隔离codex/sr-visual-quality-20261010,独立不可变start保护45旧工作树/495脏文件/main0e7018ad。当前源码在E:/项目/Veyra/worktrees/sr-visual-quality-20261010,产物统一E:/项目/Veyra/{build,tests,logs,tmp,reports,archives}/sr-visual-quality-20261010,包单独在test-packages/fixes-20261010。没有子Agent、main合并、push/Release或新关机。++新增SrQualityTests共同参考模式;用户GTA6 4K原图→Lanczos1080p→4K,NR/FG关闭,普通缩放/VSR1/VSR4/DLSS/FSR,同参考SHA、精确前解码PTS、明确BT.709/源range。基线tests-20261010-143134与143421,静态第60秒、运动90/300/900/1200秒各32帧、输出1/8/32。早期142741后关键帧/默认矩阵试跑不作最终证据;质量测试墙钟不作性能数字。官方SDK/指南一手核对、方法与逐项实际结果详见docs/SR_VISUAL_QUALITY_REPORT_2026-10-10.md。用户停止后没有继续720p试验。++DLSS Quality档输出相同,FSR曝光没有可靠收益,离线RCAS参考误差更大,均恢复/拒绝。零运动静态MSE下降但真实运动恶化;局部3×3的0.5/255容差使DLSS运动误差增加18.19%,完全一致阈值仍增加11.31%,均撤回。整帧完全重复检测在四个运动窗口72张PNG与基线字节一致,却每帧增加两个GPU pass、额外纹理,只改善重复帧,故也撤回。生产CMake/EnhanceGraph/后端/shader均与基点一致,新SrMotion/SrStaticDetect源码及自产dxil从本轮产品/构建删除;patch和两个shader保存在archives同名/withdrawal.json对应清单,未删除他人文件。保留此前真实执行、设置/焦点/布局/关闭项编辑等有效修复,不宣称本次一般画质提升或FPS收益。++命令均以py -3.11 -B运行。sr-visual-build.py撤回后最终16EXE构建通过,logs同名/build-20261010-152739/receipt.json;cmake-check的153030原生/no-SDK配置、驱动/当前测试对象通过。此前测试编译缺fstream等已经修正重验;所有失败日志保留。实际GUI仍完整PS5/Moonlight/Xbox/libass,配置检查关闭串流不冒充最终GUI能力。build.py ui-only仅更新测试显示标签/Windows资源,153535回执18.344秒,GUI SHA870623fec3b265bf9f3ce0837449e90934ec47164d22eb8b484e33ee95dbfc4c,版本2.0.6-fixes-20261010;受影响18对象按源/依赖SHA重编或重用,旧缓存输入未改。++sr-visual-test.py sr presenter slider menu components lifecycle video rollback inactive inactive-node chain contracts hdr:logs同名/tests-20261010-152929/receipt.json全部13组通过,包括三SR合同、设置SDR/HDR事务、真实数字键盘13项、菜单8/组件22、生命周期、GTA6热切/失败回退、关闭项列表/节点各70、chain287/repair259/HDR。用户播放器已经自行关闭,不终止或修改其进程/配置。每个测试<300秒。正常产品不新增回读、逐pass等待或无界队列。++sr-visual-package.py stage:1614文件已审NVIDIA母包清单硬链接暂存,原子替换当前EXE/QML/必要PackedCaptureToLinear shader及已验zlib FFmpeg;不从运行过的APP复制。FFmpeg保留PS5 slices256/dav1d、zlib许可证/构建清单;已有FFmpeg-9.0.1-slices256-dav1d-zlib-source.zip SHA49db22049f072bd5448faa664aa736074dccfe6e72b4a933f673d8ae954b0bb6作为对应源码。未变依赖沿2.0.6对应源码链接;运行库身份原样,社区HashMismatch/NotSigned明确,不恢复软件哈希锁。源码ZIP仅clean commit文件、明确排除历史pycache,不含SDK/runtime/模型/测试媒体。++package.py smoke:未改生产QML,私有data-dir、系统PATH、缓存/日志外置;GPU/软件QML两个冷启动和GTA6实际播放均通过、包文件SHA前后相同。第一次误匹配不存在frames日志字段而失败,实际realPresented=460;改核对realPresented≥100重跑两种模式通过,不冒称初次脚本也通过。真实播放计数/命令在test-packages/fixes-20261010/package-smoke.json。源码commit后seal封装并逐文件SHA/CRC、manifest唯一性/路径/私密产物排除、runtime清单核对;实际最终包路径/SHA/字节/源码提交与审计状态写同目录package.json和reports同名/package-current.json,收尾final.json链接本次全部回执及保护守卫/bundle结果。++本地候选包含此前字幕、播放列表/PR31、BMD原生开关、HDR补帧默认关闭开关、设置切换/输入/布局/关闭项编辑/保存及既有VFG修复。没有本轮SR生产实验;未重测所有编码器/串流,无AMD/BMD实卡,不宣称NV显存增长/现场黑屏全根治。原件、45工作树/495脏文件/main继续由sr-visual-control.py守卫核对;不处理先前被自动审批拒绝的其它任务缓存。diff --git a/scripts/acceptance/sr-visual-build.py b/scripts/acceptance/sr-visual-build.pynew file mode 100644index 00000000..66e140fa--- /dev/null+++ b/scripts/acceptance/sr-visual-build.py@@ -0,0 +1,208 @@+"""Scoped visual-SR build; immutable accepted cache, current dependency closure."""+from pathlib import Path+import ctypes, hashlib, json, os, re, subprocess, sys, time+from concurrent.futures import ThreadPoolExecutor++ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='sr-visual-quality-20261010'+CACHE=BASE/'build/vfg-next-20261007';OUT=BASE/'build'/TASK+SDK=BASE/'deps/decklink-sdk-obs31-20261009'+LABEL='2.0.6-fixes-20261010'+LOG=BASE/'logs'/TASK/('build-'+time.strftime('%Y%m%d-%H%M%S'));TMP=BASE/'tmp'/TASK/'build'+for p in (OUT,LOG,TMP):p.mkdir(parents=True,exist_ok=True)+def sha(p):return hashlib.sha256(Path(p).read_bytes()).hexdigest()+shell=ctypes.WinDLL('shell32');shell.CommandLineToArgvW.argtypes=[ctypes.c_wchar_p,ctypes.POINTER(ctypes.c_int)];shell.CommandLineToArgvW.restype=ctypes.POINTER(ctypes.c_wchar_p);ctypes.windll.kernel32.LocalFree.argtypes=[ctypes.c_void_p]+def args(s):+ n=ctypes.c_int();p=shell.CommandLineToArgvW(s,ctypes.byref(n));a=[p[i] for i in range(n.value)];ctypes.windll.kernel32.LocalFree(p);return a+def unescape(s):return s.replace('$ ',' ').replace('$:',':').replace('$$','$')+tool=re.search(r'^CMAKE_MAKE_PROGRAM:FILEPATH=(.*)$',(CACHE/'CMakeCache.txt').read_text(encoding='utf8'),re.M).group(1)+ninja=(CACHE/'build.ninja').read_text(encoding='utf8');inputs={};sources={};commands=[];start=time.monotonic()+def protect(p):+ p=Path(p);p=p if p.is_absolute() else CACHE/p;assert p.is_file(),p+ if str(p) not in inputs:inputs[str(p)]=sha(p)+ return p+def rule(name):+ lines=re.search(r'^build '+re.escape(name)+r': .*?(?=\n\n)',ninja,re.M|re.S).group().splitlines()+ var=dict(re.match(r' ([A-Z_]+) = (.*)',l).groups() for l in lines[1:] if re.match(r' ([A-Z_]+) = (.*)',l))+ objects=[unescape(n).replace('\\','/') for n in lines[0].split('Release ',1)[1].split(' | ',1)[0].split(' || ',1)[0].split(' ')]+ for value in args(unescape(var.get('LINK_LIBRARIES',''))):+ if value.lower().endswith('.lib') and (Path(value).is_file() or (CACHE/value).is_file()):protect(value)+ return objects,var+def compiler(name):+ command=args(subprocess.check_output([tool,'-t','commands',name],cwd=CACHE,text=True,encoding='utf8').splitlines()[-1])+ return ['-DVEYRA_DISPLAY_VERSION="'+LABEL+'"' if v.startswith(('-DVEYRA_DISPLAY_VERSION=','/DVEYRA_DISPLAY_VERSION=')) else v for v in command]+env=dict(os.environ);env.update(TEMP=str(TMP),TMP=str(TMP),VSLANG='1033')+setup=subprocess.run(['cmd.exe','/u','/d','/c',r'call C:\PROGRA~2\MICROS~3\2022\BUILDT~1\VC\Auxiliary\Build\vcvars64.bat >nul && set'],capture_output=True,text=True,encoding='utf-16-le',env=env,check=True)+for line in setup.stdout.splitlines():+ if '=' in line:+ k,v=line.split('=',1)+ if k and not k.startswith('='):env[k]=v+env.update(TEMP=str(TMP),TMP=str(TMP))+def run(command,name,cwd=TMP):+ commands.append(command);remaining=890-(time.monotonic()-start);assert remaining>0+ with (LOG/(name+'.log')).open('wb') as stream:r=subprocess.run(command,cwd=cwd,env=env,stdout=stream,stderr=subprocess.STDOUT,timeout=min(300,remaining))+ print(name,'exit',r.returncode,flush=True)+ if r.returncode:print((LOG/(name+'.log')).read_text(encoding='utf8',errors='replace')[-6000:]);raise RuntimeError(name)++if sys.argv[1:]==['cmake-check']:+ cache=dict(re.findall(r'^([^#/:=]+):[^=]+=(.*)$',(CACHE/'CMakeCache.txt').read_text(encoding='utf8'),re.M))+ cmake=r'C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe'+ names=('VEYRA_DLSS_SDK_ROOT','VEYRA_NVOF_SDK_ROOT','VEYRA_NVENC_HEADERS_ROOT','VEYRA_XESS_ROOT',+ 'VEYRA_FIDELITYFX_ROOT','VEYRA_FIDELITYFX2_ROOT','VEYRA_MAGEWELL_SDK_DIR','VEYRA_LIBASS_ROOT','CMAKE_PREFIX_PATH')+ for native in (True,False):+ name='cmake-sdk' if native else 'cmake-no-sdk';directory=OUT/name+ flags=['-D'+key+'='+cache[key] for key in names]+ # The accepted vcpkg prefix supplies MSVC import libraries. The patched+ # runtime prefix used in tests contains DLLs/DEFs, not MSVC libraries.+ flags+=['-DVEYRA_FFMPEG_ROOT='+cache['VEYRA_FFMPEG_ROOT'],+ '-DVEYRA_ENABLE_EXPERIMENTAL_DLSSNR=ON','-DVEYRA_ENABLE_D3D12_DEBUG=OFF','-DVEYRA_BUILD_QML_UI=ON',+ '-DVEYRA_ENABLE_REMOTEPLAY=OFF','-DVEYRA_ENABLE_MOONLIGHT=OFF','-DVEYRA_ENABLE_XBOX=OFF',+ '-DVEYRA_DECKLINK_SDK_DIR='+(str(SDK) if native else ''),'-DCMAKE_BUILD_TYPE=Release','-DCMAKE_MAKE_PROGRAM='+tool]+ run([cmake,'-S',str(ROOT),'-B',str(directory),'-G','Ninja',*flags],name+'-configure')+ run([cmake,'--build',str(directory),'--target','CMakeFiles/veyra_sources.dir/src/source/DeckLinkDriver.cpp.obj','-j','2'],name+'-compile')+ if native:+ run([cmake,'--build',str(directory),'--target',+ 'CMakeFiles/veyra_settings_transaction_tests.dir/tests/integration/SettingsTransactionTests.cpp.obj',+ 'CMakeFiles/veyra_sr_quality_tests.dir/tests/integration/SrQualityTests.cpp.obj','-j','2'],name+'-test-objects')+ (LOG/'receipt.json').write_text(json.dumps({'commands':commands,'passed':True,'seconds':time.monotonic()-start},ensure_ascii=False,indent=2),encoding='utf8')+ (BASE/'reports'/TASK/'cmake-current.json').write_text(json.dumps({'receipt':str(LOG/'receipt.json')},indent=2),encoding='utf8')+ print('CMake native/no-SDK configurations, driver objects and current test objects passed;',LOG,flush=True)+ raise SystemExit(0)+headerKey=hashlib.sha256(''.join(str(p)+sha(p) for folder in ('include','tests') for p in sorted((ROOT/folder).rglob('*.h'))).encode()).hexdigest()+def compile(source,name,a,extra=(),dependencyKey=''):+ sources[str(source)]=sha(source);target=OUT/(name+'.obj')+ command=a[:1]+['/utf-8','/I'+str(OUT),'/I'+str(ROOT/'include'),'/I'+str(ROOT/'src')]+[v.replace(str(CACHE).replace('\\','/'),str(OUT).replace('\\','/')) if v.startswith(('/DVEYRA_SHADER_DIR','-DVEYRA_SHADER_DIR')) else v for v in a[1:-1] if not v.startswith(('/Fo','/Fd')) and v!='/showIncludes']+ command+=list(extra)+['/Fo'+str(target),'/Fd'+str(OUT/(name+'.pdb')),str(source)]+ key=hashlib.sha256((json.dumps(command)+sources[str(source)]+headerKey+dependencyKey).encode()).hexdigest();stamp=target.with_suffix('.build.json')+ if target.is_file() and stamp.is_file():+ old=json.loads(stamp.read_text());+ if old['key']==key and old['object']==sha(target):print('reuse',name,flush=True);return target+ run(command,'compile-'+name);stamp.write_text(json.dumps({'key':key,'object':sha(target)}),encoding='utf8');return target+previous=json.loads((BASE/'logs/inactive-effects-20261010/build-20261010-105757/receipt.json').read_text(encoding='utf8'))+overrides={name:protect(row['path']) for name,row in previous['overrides'].items()}+for name,row in previous['overrides'].items():assert sha(row['path'])==row['sha256'],name+targets={n:rule(n+'.exe') for n in ('veyra_qml_ui','veyra_capture_tests','veyra_capture_color_tests','veyra_capture_format_selection_tests','veyra_hdr_color_tests','veyra_capture_audio_tests','veyra_qml_quick_tests','veyra_present_sink_lifecycle_tests','veyra_live_presentation_tests','veyra_nr_video_quality_probe','veyra_effect_chain_tests','veyra_repair_contract_tests')}+objects=set(p for obj,var in targets.values() for p in obj)+def libraries(var):return {Path(v).stem for v in args(unescape(var.get('LINK_LIBRARIES',''))) if v.endswith('.lib') and Path(v).stem.startswith('veyra_')}+groups=set().union(*(libraries(var) for objs,var in targets.values()))+for group in groups:+ if re.search(r'^build '+re.escape(group+'.lib')+r': (?:CXX|C)_STATIC_',ninja,re.M):objects.update(rule(group+'.lib')[0])+baseline=json.loads((BASE/'archives'/TASK/'start.json').read_text(encoding='utf8'))['base']+changed_headers=[p.replace('\\','/') for p in subprocess.check_output(['git','diff','--name-only',baseline],cwd=ROOT,text=True,encoding='utf8').splitlines() if p.startswith('include/')]+dependencies={};current=None+for line in subprocess.check_output([tool,'-t','deps'],cwd=CACHE,text=True,encoding='utf8').splitlines():+ if line and not line[0].isspace():current=line.split(': #deps ',1)[0].replace('\\','/');dependencies[current]=[]+ elif current and line.strip():dependencies[current].append(line.strip().replace('\\','/'))+rebuild=[]+for obj in objects:+ relative=obj.split('.dir/',1)[-1][:-4]+ if not relative.startswith(('src/','apps/','tests/')) or not (ROOT/relative).is_file():continue+ original=next((p for p in previous['sources'] if p.replace('\\','/').endswith('/'+relative)),None)+ source_changed=original is not None and Path(original).read_bytes().replace(b'\r\n',b'\n')!=(ROOT/relative).read_bytes().replace(b'\r\n',b'\n')+ directly=relative in ('src/source/CaptureCardSource.cpp','src/engine/EngineController.cpp','src/pipeline/EnhanceGraph.cpp','src/ui/QmlPlayerBridge.cpp','tests/integration/HdrColorTests.cpp','src/engine/VideoPresenter.cpp','src/gfx/PresentSink.cpp')+ dep_changed=any(any(d.endswith('/'+h) for d in dependencies.get(obj,())) for h in changed_headers)+ if source_changed or directly or dep_changed or not (CACHE/obj).is_file():rebuild.append((obj,ROOT/relative,compiler(obj)))+moc=protect(Path('C:/veyra-deps/qt-veyra/6.8.3/msvc2022_64/bin/moc.exe'))+run([str(moc),str(ROOT/'tests/qml/QuickSmokeTests.cpp'),'-o',str(OUT/'QuickSmokeTests.moc')],'generate-quick-test-moc')++def job(row):+ obj,source,a=row;return obj,compile(source,obj.replace('/','-').replace('.','-'),a)+with ThreadPoolExecutor(max_workers=4) as pool:+ for obj,p in pool.map(job,rebuild):overrides[obj]=p+quickAutogen='CMakeFiles/veyra_qml_quick_tests.dir/veyra_qml_quick_tests_autogen/mocs_compilation.cpp.obj'+emptyMoc=OUT/'quick-mocs.cpp';emptyMoc.write_text('// Setup moc is included explicitly by QuickSmokeTests.cpp.\n',encoding='utf8')+overrides[quickAutogen]=compile(emptyMoc,'quick-mocs',compiler(quickAutogen))+for obj in objects:+ if obj not in overrides:protect(obj)+# Unchanged objects added by PR31, not present in the older cached CMake graph.+playlist=[protect(BASE/'build/pr31-playlist-20261009'/n) for n in ('PlaylistModel.obj','playlist-moc.obj')]+for relative in ('include/veyra/ui/QmlPlayerBridge.h','include/veyra/ui/PlaylistModel.h','src/ui/PlaylistModel.cpp'):+ original=next(p for p in previous['sources'] if p.replace('\\','/').endswith('/'+relative));assert sha(original)==previous['sources'][original]+ assert Path(original).read_bytes().replace(b'\r\n',b'\n')==(ROOT/relative).read_bytes().replace(b'\r\n',b'\n');sources[str(ROOT/relative)]=sha(ROOT/relative)+sourceCompiler=compiler('CMakeFiles/veyra_sources.dir/src/source/CaptureCardSource.cpp.obj')+generatedSdk=OUT/'decklink-generated';generatedSdk.mkdir(exist_ok=True)+for file in SDK.rglob('*'):+ if file.is_file():protect(file)+midl=protect(Path(r'C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x64/midl.exe'))+run([str(midl),'/nologo','/env','x64','/I',str(SDK),'/out',str(generatedSdk),'/h','DeckLinkAPI_h.h',+ '/iid','DeckLinkAPI_i.c','/tlb','DeckLinkAPI.tlb','/client','none','/server','none',str(SDK/'DeckLinkAPI.idl')],'generate-decklink-abi')+nativeCore=compile(ROOT/'src/source/DeckLinkCapture.cpp','DeckLinkCapture',sourceCompiler)+nativeDriver=compile(ROOT/'src/source/DeckLinkDriver.cpp','DeckLinkDriver',sourceCompiler,['/DVEYRA_HAS_DECKLINK=1','/I'+str(generatedSdk)],sha(generatedSdk/'DeckLinkAPI_h.h'))+stubDriver=compile(ROOT/'src/source/DeckLinkDriver.cpp','DeckLinkDriver-stub',sourceCompiler,['/DVEYRA_HAS_DECKLINK=0'])+native=[nativeCore,nativeDriver]+uiOnly=sys.argv[1:]==['ui-only']+if uiOnly:+ for name in ('veyra_capture_tests','veyra_capture_color_tests','veyra_capture_format_selection_tests',+ 'veyra_hdr_color_tests','veyra_capture_audio_tests','decklink-tests','decklink-stub-tests'):+ protect(OUT/(name+'.exe'))+for file in SDK.rglob('*'):+ if file.is_file():protect(file)++shaderOut=OUT/'shaders';shaderOut.mkdir(exist_ok=True)+for source in (CACHE/'shaders').rglob('*'):+ if not source.is_file() or source.name=='PackedCaptureToLinear.dxil':continue+ protect(source);target=shaderOut/source.relative_to(CACHE/'shaders');target.parent.mkdir(parents=True,exist_ok=True)+ if not target.exists():os.link(source,target)+dxc=protect(Path(r'C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x64/dxc.exe'))+run([str(dxc),'-T','cs_6_0','-E','main','-O3','-Qstrip_debug','-Qstrip_reflect','-Fo',str(shaderOut/'PackedCaptureToLinear.dxil'),str(ROOT/'shaders/PackedCaptureToLinear.hlsl')],'shader-packed')+resource='CMakeFiles/veyra_qml_ui.dir/.qt/rcc/qrc_veyra_i18n.cpp.obj'+rcc=protect(Path('C:/veyra-deps/qt-veyra/6.8.3/msvc2022_64/bin/rcc.exe'))+qrc=OUT/'i18n.qrc';qrc.write_text('<RCC><qresource prefix="/i18n"><file alias="catalog.json">'+(ROOT/'i18n/catalog.json').as_posix()+'</file></qresource></RCC>',encoding='utf8')+generated=OUT/'qrc_veyra_i18n.cpp';run([str(rcc),'--name','veyra_i18n','--no-zstd','-o',str(generated),str(qrc)],'generate-i18n')+overrides[resource]=compile(generated,'qrc_veyra_i18n',compiler(resource));sources[str(ROOT/'i18n/catalog.json')]=sha(ROOT/'i18n/catalog.json')++# Match the UI label and Windows file properties without changing the release+# version or any production source. Equivalent to CMake's display-version input.+versionSource=ROOT/'apps/veyra/version.rc.in'+version=versionSource.read_text(encoding='utf8')+for key,value in {'PROJECT_VERSION_MAJOR':'2','PROJECT_VERSION_MINOR':'0','PROJECT_VERSION_PATCH':'6',+ 'VEYRA_DISPLAY_VERSION':LABEL,'VEYRA_RESOURCE_FILENAME':'veyra_qml_ui.exe'}.items():+ version=version.replace('@'+key+'@',value)+assert '@' not in version+versionRc=OUT/'veyra-qml-version.rc';versionRc.write_text(version,encoding='utf8')+(OUT/'veyra-resource.h').write_bytes((ROOT/'apps/veyra/resource.h').read_bytes())+if not (OUT/'veyra.ico').exists():os.link(protect(ROOT/'assets/veyra.ico'),OUT/'veyra.ico')+rc=protect(Path(r'C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x64/rc.exe'))+versionRes=OUT/'veyra-qml-version.rc.res'+run([str(rc),'/nologo','/c65001','/fo',str(versionRes),str(versionRc)],'compile-version-resource',OUT)+overrides['CMakeFiles/veyra_qml_ui.dir/veyra-qml-version.rc.res']=versionRes+for p in (versionSource,ROOT/'apps/veyra/resource.h',ROOT/'assets/veyra.ico'):sources[str(p)]=sha(p)++cmake=r'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe'+link=r'C:\PROGRA~2\MICROS~3\2022\BUILDT~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\link.exe';executables=[]+def linkTarget(name,objs,var):+ rsp=OUT/(name+'.rsp');rsp.write_text('\n'.join(subprocess.list2cmdline([str(p)]) for p in objs)+'\n'+unescape(var.get('LINK_PATH',''))+'\n'+unescape(var['LINK_LIBRARIES']),encoding='utf8')+ directory=OUT/('manifest-'+name);directory.mkdir(exist_ok=True)+ flags=[('/MANIFESTINPUT:'+str(CACHE/'veyra-qml.manifest')) if a.startswith('/MANIFESTINPUT:') else a for a in args(unescape(var.get('LINK_FLAGS','')))]+ command=[cmake,'-E','vs_link_exe','--msvc-ver=1944','--intdir='+str(directory),r'--rc=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\rc.exe',r'--mt=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\mt.exe','--manifests','--',link,'/nologo','@'+str(rsp),'/out:'+str(OUT/(name+'.exe')),'/implib:'+str(OUT/(name+'.lib')),'/pdb:'+str(OUT/(name+'.pdb')),'/version:0.0']+flags+ run(command,'link-'+name,CACHE);executables.append(OUT/(name+'.exe'))+for name,(objs,var) in targets.items():+ if uiOnly and name!='veyra_qml_ui':continue+ selected=[overrides.get(obj,CACHE/obj) for obj in objs]+ linked=libraries(var)+ selected+=[p for obj,p in overrides.items() if obj not in objs and any(obj.startswith('CMakeFiles/'+group+'.dir/') for group in linked) and+ (name!='veyra_capture_audio_tests' or obj.endswith('/src/sink/CaptureAudioSession.cpp.obj'))]+ if name=='veyra_qml_ui':selected+=playlist+ # Static-library closure flattened by CMake into the immutable GUI graph.+ if 'veyra_sources' in linked:selected+=native+ linkTarget(name,selected,var)+if not uiOnly:+ objects,var=targets['veyra_live_presentation_tests']+ linked=libraries(var)+ modules=[p for obj,p in overrides.items() if any(obj.startswith('CMakeFiles/'+group+'.dir/') for group in linked)]+ for name,source in (('veyra_settings_transaction_tests','tests/integration/SettingsTransactionTests.cpp'),('veyra_sr_quality_tests','tests/integration/SrQualityTests.cpp')):+ test=compile(ROOT/source,name,compiler(objects[0]))+ linkTarget(name,[test]+modules+native,var)+if not uiOnly:+ test=compile(ROOT/'tests/unit/DeckLinkCaptureTests.cpp','DeckLinkCaptureTests',sourceCompiler)+ var=targets['veyra_capture_tests'][1]+ baseObj=protect(CACHE/'CMakeFiles/veyra_base.dir/src/base/Log.cpp.obj')+ linkTarget('decklink-tests',[test,nativeCore,nativeDriver,baseObj],var)+ linkTarget('decklink-stub-tests',[test,nativeCore,stubDriver,baseObj],var)+for p,d in inputs.items():assert sha(p)==d,p+for folder in ('include','src','shaders','qml','tests'):+ for file in (ROOT/folder).rglob('*'):+ if file.is_file() and file.suffix in ('.h','.hlsl','.hlsli','.qml','.cpp'):sources[str(file)]=sha(file)+receipt={'commands':commands,'displayVersion':LABEL,'sources':sources,'overrides':{n:{'path':str(p),'sha256':sha(p)} for n,p in overrides.items()},'inputsUnchanged':inputs,'seconds':time.monotonic()-start,'executables':{p.name:sha(p) for p in executables},'recompiledDependencyClosure':len(rebuild)}+(LOG/'receipt.json').write_text(json.dumps(receipt,ensure_ascii=False,indent=2),encoding='utf8')+(BASE/'reports'/TASK/'build-current.json').write_text(json.dumps({'receipt':str(LOG/'receipt.json')},indent=2),encoding='utf8')+print('Built current product and native/legacy tests; immutable inputs unchanged;',LOG,flush=True)diff --git a/scripts/acceptance/sr-visual-control.py b/scripts/acceptance/sr-visual-control.pynew file mode 100644index 00000000..a6c73efd--- /dev/null+++ b/scripts/acceptance/sr-visual-control.py@@ -0,0 +1,46 @@+"""Audit immutable pre-task worktrees and this task's narrow source scope."""+from pathlib import Path+import hashlib+import json+import re+import subprocess+import sys++ROOT = Path(__file__).resolve().parents[2]+BASE = Path('E:/项目/Veyra')+TASK = 'sr-visual-quality-20261010'+start = json.loads((BASE/'archives'/TASK/'start.json').read_text(encoding='utf8'))++def git(*args, cwd=ROOT):+ return subprocess.check_output(['git', *args], cwd=cwd)++def sha(path):+ with path.open('rb') as stream:+ return hashlib.file_digest(stream, 'sha256').hexdigest()++for name, row in start['worktrees'].items():+ path = Path(name)+ assert git('rev-parse', 'HEAD', cwd=path).decode().strip() == row['head'], name+ assert hashlib.sha256(git('status', '--porcelain=v1', '-z', cwd=path)).hexdigest() == row['statusSha256'], name+ for relative, digest in row['dirtyFiles'].items():+ file = path/relative+ assert (sha(file) if file.is_file() else None) == digest, str(file)+assert git('rev-parse', 'main').decode().strip() == start['main']+assert git('branch', '--show-current').decode().strip() == 'codex/'+TASK+allowed = {'THIRD_PARTY_NOTICES.md', 'src/pipeline/EnhanceGraph.cpp', 'scripts/acceptance/sr-visual-build.py', 'include/veyra/engine/GraphDescription.h', 'docs/WORKLOG.md', 'shaders/PresentBlit.hlsl', 'docs/SR_VISUAL_QUALITY_PLAN_2026-10-10.md', 'src/gfx/FsrSrBackend.cpp', 'src/ngx/DlssSrBackend.cpp', 'scripts/acceptance/sr-visual-test.py', 'docs/SETTINGS_SR_UI_REPORT_2026-10-10.md', 'src/ngx/VideoSrBackend.cpp', 'scripts/acceptance/sr-visual-metrics.py', 'tests/unit/EffectChainTests.cpp', 'shaders/ScaleBlit.hlsl', 'tests/unit/RepairContractTests.cpp', 'include/veyra/gfx/FsrSrBackend.h', 'scripts/acceptance/sr-visual-control.py', 'include/veyra/pipeline/EnhanceGraph.h', 'tests/integration/SrQualityTests.cpp', 'include/veyra/ngx/DlssSrBackend.h', 'include/veyra/engine/EnhancementSettings.h', 'include/veyra/ngx/VideoSrBackend.h', 'docs/SR_VISUAL_QUALITY_REPORT_2026-10-10.md', 'AGENTS.md'}++allowed.add('scripts/acceptance/sr-visual-package.py')+dirty = {p.decode('utf8') for p in git('ls-files', '-m', '-d', '--others', '--exclude-standard', '-z').split(b'\0') if p}+++changed = {p.decode('utf8') for p in git('diff', '--name-only', start['base']).splitlines() if p}+assert (changed | dirty) <= allowed, (changed | dirty) - allowed+git('diff', '--check')+git('diff', '--cached', '--check')+label = sys.argv[1] if len(sys.argv) > 1 else 'audit'+assert re.fullmatch('[a-z0-9-]+', label)+report = {'baselineWorktreesUnchanged': len(start['worktrees']),+ 'dirtyFilesUnchanged': sum(len(v['dirtyFiles']) for v in start['worktrees'].values()),+ 'scopePass': True, 'changed': sorted(changed | dirty), 'mainHead': start['main'], 'base': start['base']}+(BASE/'reports'/TASK/(label+'.json')).write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding='utf8')+print(json.dumps(report, ensure_ascii=False), flush=True)diff --git a/scripts/acceptance/sr-visual-metrics.py b/scripts/acceptance/sr-visual-metrics.pynew file mode 100644index 00000000..5d21f2b3--- /dev/null+++ b/scripts/acceptance/sr-visual-metrics.py@@ -0,0 +1,85 @@+"""Same-source coded-luma reconstruction error, box-window SSIM and crop evidence."""+from pathlib import Path+import hashlib,json,math,sys+import numpy as np+from PIL import Image,ImageDraw++def measure(reference,candidate):+ a=np.asarray(reference.convert('RGB'),dtype=np.float32);b=np.asarray(candidate.convert('RGB'),dtype=np.float32)+ assert a.shape==b.shape+ [email protected]([.2126,.7152,.0722],np.float32);[email protected]([.2126,.7152,.0722],np.float32)+ mse=float(np.mean((a-b)**2));edge=float((np.mean(abs(np.diff(a,axis=0)-np.diff(b,axis=0)))+np.mean(abs(np.diff(a,axis=1)-np.diff(b,axis=1))))/2)+ h=a.shape[0]//8*8;w=a.shape[1]//8*8+ aa=a[:h,:w].reshape(h//8,8,w//8,8).transpose(0,2,1,3);bb=b[:h,:w].reshape(h//8,8,w//8,8).transpose(0,2,1,3)+ ma=aa.mean((2,3));mb=bb.mean((2,3));va=((aa-ma[:,:,None,None])**2).mean((2,3));vb=((bb-mb[:,:,None,None])**2).mean((2,3))+ cov=((aa-ma[:,:,None,None])*(bb-mb[:,:,None,None])).mean((2,3))+ ssim=((2*ma*mb+6.5025)*(2*cov+58.5225))/((ma**2+mb**2+6.5025)*(va+vb+58.5225))+ return {'psnrY':10*math.log10(255**2/mse) if mse else 100.0,'maeY':float(np.mean(abs(a-b))),'mseY':mse,'ssim8x8':float(ssim.mean()),'gradientMaeY':edge}++def main():+ if sys.argv[1]=='compare':+ compare(Path(sys.argv[2]),Path(sys.argv[3]),Path(sys.argv[4]));return+ folder=Path(sys.argv[1]);out=Path(sys.argv[2]);out.mkdir(parents=True,exist_ok=True)+ refs=sorted(folder.glob('reference*.png')) or [folder/'4-native-off.png'];rows=[]+ for refPath in refs:+ ref=Image.open(refPath).convert('RGB');suffix=refPath.stem.removeprefix('reference')+ candidates=sorted(folder.glob('*'+suffix+'.png')) if refPath.stem.startswith('reference') else sorted(folder.glob('*upscale-on.png'))+ for file in candidates:+ if file==refPath:continue+ candidate=Image.open(file).convert('RGB')+ row={'reference':refPath.name,'candidate':file.name,**measure(ref,candidate)};rows.append(row)+ print(json.dumps(row,ensure_ascii=False),flush=True)+ if not candidates:continue+ # Fixed positions are recorded and identical for all algorithms. No rescaling.+ boxes=[(ref.width//4,ref.height//3,ref.width//4+384,ref.height//3+256),(ref.width//2,ref.height//2,ref.width//2+384,ref.height//2+256)]+ chosen=[refPath]+[p for p in candidates if p!=refPath and 'color' not in p.name]+ for index,box in enumerate(boxes):+ sheet=Image.new('RGB',(384*len(chosen),284),(25,25,25));draw=ImageDraw.Draw(sheet)+ for i,file in enumerate(chosen):+ with Image.open(file) as im:sheet.paste(im.convert('RGB').crop(box),(384*i,28))+ draw.text((384*i+8,8),file.stem,fill='white')+ sheet.save(out/('crops'+suffix+'-'+str(index)+'.png'))+ report={'method':'BT709 coded luma; non-overlapping 8x8 population SSIM (not Gaussian SSIM); same source/extent; no quality-percentage inference','rows':rows}+ (out/'metrics.json').write_text(json.dumps(report,ensure_ascii=False,indent=2),encoding='utf8')++def compare(baseline,candidate,out):+ out.mkdir(parents=True,exist_ok=True);rows=[];regions={}+ for refPath in sorted(baseline.glob('reference*.png')):+ counterpart=candidate/refPath.name+ assert hashlib.sha256(refPath.read_bytes()).digest()==hashlib.sha256(counterpart.read_bytes()).digest(),refPath.name+ ref=Image.open(refPath).convert('RGB');suffix=refPath.stem.removeprefix('reference')+ for oldPath in sorted(baseline.glob('*'+suffix+'.png')):+ if oldPath==refPath:continue+ newPath=candidate/oldPath.name+ old=Image.open(oldPath).convert('RGB');new=Image.open(newPath).convert('RGB')+ delta=np.asarray(old,dtype=np.int16)-np.asarray(new,dtype=np.int16)+ row={'frame':refPath.name,'backend':oldPath.name,'before':measure(ref,old),'after':measure(ref,new),+ 'changedPixels':int(np.count_nonzero(np.any(delta,axis=2))),'oldNewMaeRgb':float(np.abs(delta).mean())}+ rows.append(row)+ if suffix!='-f32':continue+ # Pick two separated texture regions using ONLY the reference.+ # Every backend uses the same boxes, independent of its output.+ if suffix not in regions:+ y=np.asarray(ref,dtype=np.float32)@np.array([.2126,.7152,.0722],np.float32)+ tiles=[]+ for fy in (.25,.375,.5,.625,.75):+ for fx in (.25,.375,.5,.625,.75):+ x0=int(ref.width*fx)-192;y0=int(ref.height*fy)-128+ tile=y[y0:y0+256,x0:x0+384]+ score=float(np.abs(np.diff(tile,axis=0)).mean()+np.abs(np.diff(tile,axis=1)).mean())+ tiles.append((score,(x0,y0,x0+384,y0+256)))+ boxes=[]+ for _,box in sorted(tiles,reverse=True):+ if all(abs(box[0]-other[0])+abs(box[1]-other[1])>=600 for other in boxes):boxes.append(box)+ if len(boxes)==2:break+ regions[suffix]=boxes+ if oldPath.name.startswith('bilinear'):continue+ for i,box in enumerate(regions[suffix]):+ sheet=Image.new('RGB',(1152,284),(25,25,25));draw=ImageDraw.Draw(sheet)+ for col,(label,im) in enumerate((('4K reference',ref),('before '+oldPath.stem,old),('after '+oldPath.stem,new))):+ sheet.paste(im.crop(box),(384*col,28));draw.text((384*col+8,8),label,fill='white')+ sheet.save(out/(oldPath.stem+'-'+str(i)+'.png'))+ print(json.dumps(row,ensure_ascii=False),flush=True)+ (out/'comparison.json').write_text(json.dumps({'baseline':str(baseline),'candidate':str(candidate),+ 'referenceIdentical':True,'regions':regions,'method':'same method as measure(); regions selected only from reference gradient; metrics are not perceptual quality percentages','rows':rows},ensure_ascii=False,indent=2),encoding='utf8')+if __name__=='__main__':main()diff --git a/scripts/acceptance/sr-visual-package.py b/scripts/acceptance/sr-visual-package.pynew file mode 100644index 00000000..1c870743--- /dev/null+++ b/scripts/acceptance/sr-visual-package.py@@ -0,0 +1,210 @@+"""Local fixes candidate: immutable donor whitelist, current code, sealed audit."""+from pathlib import Path+import hashlib, importlib.util, json, os, re, shutil, subprocess, sys, time, zipfile+import psutil++ROOT=Path(__file__).resolve().parents[2]+BASE=Path('E:/项目/Veyra');TASK='sr-visual-quality-20261010';LABEL='2.0.6-fixes-20261010'+DONOR=BASE/'test-packages/vfg-next-20261007/Veyra-2.0.6-VFG-next-NVIDIA-win64-portable'+BUILD=BASE/'build'/TASK;OUT=BASE/'test-packages/fixes-20261010'+STAGE=OUT/('Veyra-'+LABEL+'-NVIDIA-win64-portable')+FFMPEG=BASE/'deps/ffmpeg-subtitle-formats-20261009/installed'+FFSOURCE=BASE/'test-packages/subtitle-formats-20261009/FFmpeg-9.0.1-slices256-dav1d-zlib-source.zip'+FFSHA='49db22049f072bd5448faa664aa736074dccfe6e72b4a933f673d8ae954b0bb6'+SOURCE=OUT/('Veyra-'+LABEL+'-source.zip')+REPORT=BASE/'reports'/TASK+spec=importlib.util.spec_from_file_location('qml_package',ROOT/'scripts/package-qml-release.py')+pkg=importlib.util.module_from_spec(spec);spec.loader.exec_module(pkg)+donor=json.loads((DONOR/'package-manifest.json').read_text(encoding='utf8'))++def sha(path):+ with Path(path).open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()++def verify_donor():+ for row in donor['files']:+ f=DONOR/row['path'];assert f.stat().st_size==row['size'] and sha(f)==row['sha256'],row['path']++def atomic(source,target):+ target.parent.mkdir(parents=True,exist_ok=True)+ swap=target.with_name(target.name+'.swap');shutil.copyfile(source,swap);os.replace(swap,target)++def write(target,data):+ target.parent.mkdir(parents=True,exist_ok=True)+ swap=target.with_name(target.name+'.swap');swap.write_bytes(data);os.replace(swap,target)++def document(target,data):write(target,(json.dumps(data,ensure_ascii=False,indent=2)+'\n').encode('utf8'))++def payload():+ records=[]+ for f in sorted(STAGE.rglob('*')):+ if not f.is_file() or f.name=='package-manifest.json':continue+ name=f.relative_to(STAGE).as_posix();pkg.validate_payload(name)+ assert f.name not in ('SrMotion.dxil','SrStaticDetect.dxil'),name+ records.append(dict(path=name,size=f.stat().st_size,sha256=sha(f)))+ assert not pkg.REQUIRED-{r['path'] for r in records}+ return records++def runtime_audit():+ runtime=json.loads((STAGE/'release-runtime-manifest.json').read_text(encoding='utf8'))+ assert runtime['enforcedAtRuntime'] is False+ for row in runtime['files']:+ f=STAGE/row['path']+ assert f.stat().st_size==row['size'] and sha(f)==row['sha256'].lower(),row['path']+ assert (STAGE/'release-runtime-manifest.json').read_bytes()==(STAGE/'runtime/experimental/release-runtime-manifest.json').read_bytes()+ assert '--enable-zlib' in json.loads((STAGE/'licenses/FFMPEG-VEYRA-BUILD.json').read_text(encoding='utf8'))['configuration']+ assert sha(STAGE/'veyra_qml_ui.exe')==sha(BUILD/'veyra_qml_ui.exe')+ return len(runtime['files'])++def refresh():+ atomic(BUILD/'veyra_qml_ui.exe',STAGE/'veyra_qml_ui.exe')+ for f in (ROOT/'qml').rglob('*'):+ if f.is_file() and (f.suffix in ('.qml','.js') or f.name=='qmldir'):+ atomic(f,STAGE/'qml'/f.relative_to(ROOT/'qml'))+ for f in (BUILD/'shaders').glob('*.dxil'):atomic(f,STAGE/'shaders'/f.name)+ for name in ('README.md','README.en.md','LICENSE','THIRD_PARTY_NOTICES.md'):+ if (ROOT/name).is_file():atomic(ROOT/name,STAGE/name)+ docs={r['path'] for r in donor['files'] if r['path'].startswith('docs/')}+ docs|={'docs/'+name for name in ('SR_VISUAL_QUALITY_REPORT_2026-10-10.md','SR_VISUAL_QUALITY_PLAN_2026-10-10.md',+ 'SETTINGS_SR_UI_REPORT_2026-10-10.md','INACTIVE_EFFECTS_REPORT_2026-10-10.md','DECKLINK_NATIVE_REPORT_2026-10-09.md',+ 'SUBTITLE_FORMATS_REPORT_2026-10-09.md','PR31_PLAYLIST_REPORT_2026-10-09.md','HDR_FG_COMPAT_TOGGLE_REPORT_2026-10-09.md')}+ for name in docs:+ if (ROOT/name).is_file():atomic(ROOT/name,STAGE/name)+ ff=pkg.audit_ffmpeg(FFMPEG)+ for row in ff['files']:atomic(FFMPEG/'bin'/row['name'],STAGE/row['name'])+ atomic(FFMPEG/'share/ffmpeg/veyra-local-build.json',STAGE/'licenses/FFMPEG-VEYRA-BUILD.json')+ atomic(FFMPEG/'share/zlib/copyright',STAGE/'licenses/ZLIB-COPYRIGHT.txt')+ atomic(FFMPEG/'share/zlib/vcpkg.spdx.json',STAGE/'licenses/ZLIB-SPDX.json')+ runtime=json.loads((DONOR/'release-runtime-manifest.json').read_text(encoding='utf8'))+ runtime.update(package='2.0.6',candidate=LABEL,localOnly=True)+ for name in ('release-runtime-manifest.json','runtime/experimental/release-runtime-manifest.json'):+ document(STAGE/name,runtime)+ notes='''# Veyra 2.0.6-fixes-20261010 本地测试版(NVIDIA)++完整解压到新目录,运行 veyra_qml_ui.exe;不要只复制 EXE 覆盖旧版。+本包为本地测试候选,未发布正式新版。优先复测:播放中切换设置后的软件错误、手动输入数字后快捷键、关闭效果器时编辑参数的卡顿、长文字菜单和窄窗口布局。++包含已完成的播放列表/文件夹导入、PGS/SUP 等字幕、Blackmagic 原生采集开关和 HDR 补帧兼容开关。两个兼容开关默认关闭;Blackmagic 开关在采集设置,美乐威开关旁。BMD 原生驱动由 Desktop Video 提供,包内不安装驱动。显存持续增长的问题仍未根治。++超分保留此前实现:原尺寸 RTX Video SR 的执行门控及 FSR 首帧修复仍在。此次画质实验全部撤回,没有新增锐化、局部静态检测、整帧检测或额外 SR GPU pass,不宣称全面画质提升。实际开启/切换效果时仍有必要的初始化。++本机 RTX 5070 回归通过;这不是 AMD、BMD 实卡或所有用户环境通过的证明。+已批准的 NVIDIA/Intel/AMD 运行组件原样沿用,社区 NR 的 HashMismatch/NotSigned 身份保留在 release-runtime-manifest.json,软件不以清单锁定用户自行替换的 DLL。++应用源码:同目录上一级 Veyra-2.0.6-fixes-20261010-source.zip。+本次 FFmpeg/dav1d/zlib 对应源码:同目录上一级 FFmpeg-9.0.1-slices256-dav1d-zlib-source.zip;保留 PS5 H.264 slices256 补丁。+其余未变依赖源码: https://github.com/Likely7/Veyra-NRVideo/releases/download/v2.0.6/Veyra-2.0.6-dependency-source.zip+构建方法见 docs/BUILD_2.0.6.md;本测试版增加 -DVEYRA_DISPLAY_VERSION=2.0.6-fixes-20261010,并明确配置 DeckLink SDK。源码包不含 SDK、运行库、模型、凭据或测试视频。+'''+ write(STAGE/'README-TEST.zh-CN.md',notes.encode('utf8'))++def manifest(source=None):+ data={k:v for k,v in donor.items() if k!='files'}+ head=subprocess.check_output(['git','rev-parse','HEAD'],cwd=ROOT,text=True).strip()+ data.update(candidate=LABEL,displayVersion=LABEL,releaseReady=False,localOnly=True,+ baseCommit='c664a675c7b7a5c6cb54ed79c07b8a72127f4dfb',sourceArchiveCommit=head,+ validationRecord='docs/SR_VISUAL_QUALITY_REPORT_2026-10-10.md',+ srExperimentsWithdrawn=True)+ data['knownIssues']=[*donor['knownIssues'],+ 'No general SR quality gain from this round; all SR production experiments withdrawn',+ 'Blackmagic native and AMD field results require affected hardware/user testing']+ data['correspondingSource'].update(application='../'+SOURCE.name,+ applicationSha256=sha(SOURCE) if source else None,+ ffmpeg='../'+FFSOURCE.name,ffmpegSha256=FFSHA,+ displayVersionOverride='-DVEYRA_DISPLAY_VERSION='+LABEL,+ deckLinkBuildOption='-DVEYRA_DECKLINK_SDK_DIR=<external SDK12.0 directory>')+ data['files']=payload();document(STAGE/'package-manifest.json',data)+ return data++def stage():+ assert not STAGE.exists(),STAGE+ verify_donor();STAGE.mkdir(parents=True)+ for row in donor['files']:+ pkg.validate_payload(row['path']);target=STAGE/row['path'];target.parent.mkdir(parents=True,exist_ok=True)+ os.link(DONOR/row['path'],target)+ refresh();manifest();runtime_audit();verify_donor()+ print('Staged',STAGE,flush=True)++def smoke():+ for p in psutil.process_iter(['name']):assert not (p.info['name'] or '').lower().startswith(('veyra','fg-presentation','flash-pixel')),p.info+ before=payload();results=[]+ for mode in ('gpu','software'):+ label='package-'+time.strftime('%Y%m%d-%H%M%S')+'-'+mode+ profile=BASE/'tests'/TASK/label;tmp=BASE/'tmp'/TASK/label;logs=BASE/'logs'/TASK/label+ for p in (profile,tmp,logs):p.mkdir(parents=True,exist_ok=False)+ document(profile/'qml-preferences.v1.json',{'language':'zh-CN','autoResume':False,'rememberPosition':False,+ 'prewarmEnhancement':False,'gpuPriority':'normal','screenshotDir':str(logs/'screenshots'),'sentinel':'preserved'})+ env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QML_','QT_','QSG_'))}+ env.update(PATH=os.environ['WINDIR']+'/System32;'+os.environ['WINDIR'],TEMP=str(tmp),TMP=str(tmp),+ CUDA_CACHE_PATH=str(tmp/'cuda'),QML_DISK_CACHE_PATH=str(tmp/'qml-cache'),+ VEYRA_LOG_FILE=str(logs/'engine.log'),QT_FORCE_STDERR_LOGGING='1')+ if mode=='software':env['QT_QUICK_BACKEND']='software'+ command=[str(STAGE/'veyra_qml_ui.exe'),'--data-dir',str(profile),'--page','pro','--size','1280x900',+ '--exit-after','16000','E:/Ai/知识/小七姐/GTAVI_An_Extended_Look_4K_Native.mp4']+ with (logs/'console.log').open('wb') as f:+ run=subprocess.run(command,cwd=STAGE,env=env,stdout=f,stderr=subprocess.STDOUT,timeout=40)+ console=(logs/'console.log').read_text(encoding='utf8',errors='replace')+ engine=(logs/'engine.log').read_text(encoding='utf8',errors='replace')+ errors=[line for line in (console+'\n'+engine).splitlines() if re.search(+ r'ReferenceError:|TypeError:|\[ERROR\s*\]|\[FATAL\s*\]|D3D12 ERROR|D3D12 CORRUPTION|Cannot assign|Binding loop',line)]+ assert run.returncode==0 and not errors,(run.returncode,errors)+ assert 'GTAVI_An_Extended_Look_4K_Native.mp4' in engine,engine[-3000:]+ presented=[int(v) for v in re.findall(r'\brealPresented=(\d+)',engine)]+ assert presented and max(presented)>=100,engine[-3000:]+ assert json.loads((profile/'qml-preferences.v1.json').read_text(encoding='utf8'))['sentinel']=='preserved'+ assert before==payload(),'Sealed app changed or generated unlisted data'+ results.append(dict(mode=mode,exit=run.returncode,passed=True,command=command,logs=str(logs),+ profile=str(profile),realPresented=max(presented),exeSha256=sha(STAGE/'veyra_qml_ui.exe')))+ print('Sealed package cold playback PASS',mode,flush=True)+ runtime_audit();verify_donor()+ document(OUT/'package-smoke.json',dict(passed=True,results=results,files=len(before)))++def source_archive():+ assert not subprocess.check_output(['git','status','--porcelain'],cwd=ROOT).strip(),'Commit source first'+ assert not SOURCE.exists(),SOURCE+ names=subprocess.check_output(['git','ls-files','-z'],cwd=ROOT).decode('utf8').split('\0')+ records=[];skipped=[];prefix=SOURCE.stem+'/'+ with zipfile.ZipFile(SOURCE,'x',zipfile.ZIP_DEFLATED,compresslevel=6) as z:+ for name in sorted(filter(None,names)):+ pkg.relative(name)+ if '__pycache__' in name or name.endswith('.pyc'):skipped.append(name);continue+ assert not re.search(r'\.(dll|exe|lib|pdb|obj|onnx|pth|zip|7z|ptx|addon64)$|(^|/)(runtime_local|third_party_local|\.git)/',name,re.I),name+ f=ROOT/name;assert not f.is_symlink(),name+ data=f.read_bytes();z.writestr(prefix+name,data)+ records.append(dict(path=name,size=len(data),sha256=hashlib.sha256(data).hexdigest()))+ metadata=dict(schema=1,commit=subprocess.check_output(['git','rev-parse','HEAD'],cwd=ROOT,text=True).strip(),+ displayVersion=LABEL,exeSha256=sha(BUILD/'veyra_qml_ui.exe'),files=records,excludedTrackedCache=skipped,+ dependencySource=donor['correspondingSource']['dependencies'],+ dependencySha256=donor['correspondingSource']['dependencySha256'],ffmpegSource=FFSOURCE.name,ffmpegSha256=FFSHA)+ z.writestr(prefix+'source-snapshot-manifest.json',json.dumps(metadata,ensure_ascii=False,indent=2))+ with zipfile.ZipFile(SOURCE) as z:+ assert z.testzip() is None+ for r in records:assert hashlib.sha256(z.read(prefix+r['path'])).hexdigest()==r['sha256'],r['path']+ return dict(path=str(SOURCE),sha256=sha(SOURCE),files=len(records),excludedTrackedCache=skipped)++def seal():+ smoke=json.loads((OUT/'package-smoke.json').read_text(encoding='utf8'));assert smoke['passed']+ assert all(r['exeSha256']==sha(BUILD/'veyra_qml_ui.exe') for r in smoke['results'])+ verify_donor();source=source_archive();refresh();data=manifest(source);count=runtime_audit()+ assert sha(FFSOURCE)==FFSHA+ with zipfile.ZipFile(FFSOURCE) as z:assert z.testzip() is None+ linked=OUT/FFSOURCE.name+ if not linked.exists():os.link(FFSOURCE,linked)+ assert sha(linked)==FFSHA+ archive=Path(str(STAGE)+'.zip');assert not archive.exists(),archive+ with zipfile.ZipFile(archive,'x',zipfile.ZIP_DEFLATED,compresslevel=6) as z:+ for row in data['files']:z.write(STAGE/row['path'],STAGE.name+'/'+row['path'])+ z.write(STAGE/'package-manifest.json',STAGE.name+'/package-manifest.json')+ verified=pkg.verify_zip(archive)+ with zipfile.ZipFile(archive) as z:assert z.testzip() is None+ verify_donor();assert data['files']==payload()+ for p in (archive,SOURCE,linked):+ write(Path(str(p)+'.sha256'),(sha(p)+' '+p.name+'\n').encode('ascii'))+ receipt=dict(passed=True,archive=verified,source=source,ffmpegSource=dict(path=str(linked),sha256=FFSHA),+ displayVersion=LABEL,sourceCommit=data['sourceArchiveCommit'],exeSha256=sha(STAGE/'veyra_qml_ui.exe'),+ runtimeRecordsVerified=count,donorUnchanged=len(donor['files']),srProductionChanges=0,+ byteSize=archive.stat().st_size,smoke=str(OUT/'package-smoke.json'))+ document(OUT/'package.json',receipt);document(REPORT/'package-current.json',receipt)+ print(json.dumps(receipt,ensure_ascii=False,indent=2),flush=True)++assert sys.argv[1:] in (['stage'],['smoke'],['seal'])+{'stage':stage,'smoke':smoke,'seal':seal}[sys.argv[1]]()diff --git a/scripts/acceptance/sr-visual-test.py b/scripts/acceptance/sr-visual-test.pynew file mode 100644index 00000000..41901e27--- /dev/null+++ b/scripts/acceptance/sr-visual-test.py@@ -0,0 +1,90 @@+"""Bounded actual GPU/QML regressions; shared private runtime, immutable donor."""+from pathlib import Path+import hashlib,json,os,re,shutil,subprocess,sys,time+import psutil+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='sr-visual-quality-20261010'+DONOR=BASE/'test-packages/vfg-next-20261007/Veyra-2.0.6-VFG-next-NVIDIA-win64-portable'+BUILD=BASE/'build'/TASK;APP=BASE/'tests'/TASK/'app'+QT=Path('C:/veyra-deps/qt-veyra/6.8.3/msvc2022_64')+FFMPEG=BASE/'deps/ffmpeg-subtitle-formats-20261009/installed/bin'+quality_only='--quality-only-concurrent' in sys.argv[1:]+cases=[v for v in sys.argv[1:] if v!='--quality-only-concurrent'];assert cases+assert not quality_only or all(re.fullmatch(r'quality-\d+-(still|moving)',v) for v in cases)+manifest=json.loads((DONOR/'package-manifest.json').read_text(encoding='utf8'))+def sha(p):return hashlib.file_digest(p.open('rb'),'sha256').hexdigest()+def verify():+ for row in manifest['files']:assert sha(DONOR/row['path'])==row['sha256'],row['path']+def replace(source,target):+ target.parent.mkdir(parents=True,exist_ok=True);swap=target.with_name(target.name+'.swap');shutil.copy2(source,swap);os.replace(swap,target)+verify()+running=[proc.info for proc in psutil.process_iter(['pid','name']) if (proc.info['name'] or '').lower().startswith(('veyra','fg-presentation','flash-pixel'))]+def quality_headroom():+ if not running:return None+ assert quality_only and all(p['name'].lower()=='veyra_qml_ui.exe' for p in running),running+ query=subprocess.run(['nvidia-smi','--query-gpu=memory.free,utilization.gpu','--format=csv,noheader,nounits'],capture_output=True,text=True,check=True,timeout=10)+ free,util=[int(v.strip()) for v in query.stdout.strip().split(',')]+ assert free>=6000 and util<=20,{'freeMiB':free,'utilPercent':util,'running':running}+ return {'freeMiB':free,'utilPercent':util,'running':running,'performanceValid':False}+headroom=quality_headroom()+if not APP.exists():+ APP.mkdir(parents=True)+ for row in manifest['files']:+ rel=Path(row['path'])+ if rel.parts[0] in ('runtime_local','logs') or rel.name=='veyra_qml_ui.exe':continue+ target=APP/rel;target.parent.mkdir(parents=True,exist_ok=True);os.link(DONOR/rel,target)+ (APP/'runtime_local').mkdir(exist_ok=True)+for source in BUILD.glob('*.exe'):replace(source,APP/source.name)+for source in (ROOT/'qml').rglob('*'):+ if source.is_file() and (source.suffix in ('.qml','.js') or source.name=='qmldir'):replace(source,APP/'qml'/source.relative_to(ROOT/'qml'))+for source in (BUILD/'shaders').glob('*.dxil'):replace(source,APP/'shaders'/source.name)+for source in FFMPEG.glob('*.dll'):+ target=APP/source.name;swap=target.with_name(target.name+'.swap');os.link(source,swap);os.replace(swap,target)+for source in (DONOR/'runtime_local/amd/fidelityfx').glob('*.dll'):+ target=APP/'runtime_local/amd/fidelityfx'/source.name+ if not target.exists():+ target.parent.mkdir(parents=True,exist_ok=True);os.link(source,target)+ assert sha(source)==sha(target)+for source in (ROOT/'tests/qml/quick').glob('*.qml'):replace(source,APP/'qml-tests'/source.name)+log=BASE/'logs'/TASK/('tests-'+time.strftime('%Y%m%d-%H%M%S'));log.mkdir(parents=True,exist_ok=False)+results=[]+for case in cases:+ quality_headroom()+ output=log/case;output.mkdir();temporary=BASE/'tmp'/TASK/log.name/case;temporary.mkdir(parents=True)+ env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_','QSG_'))}+ env.update(TEMP=str(temporary),TMP=str(temporary),CUDA_CACHE_PATH=str(temporary/'cuda'),QML_DISK_CACHE_PATH=str(temporary/'qml'),+ PATH=str(APP)+os.pathsep+str(QT/'bin')+os.pathsep+env['PATH'],QML_IMPORT_PATH=str(QT/'qml'),QT_FORCE_STDERR_LOGGING='1',VEYRA_EXPORT_TEST_ARTIFACTS=str(output))+ if case in ('slider','menu','components'):+ file={'slider':'tst_slider_value.qml','menu':'tst_menu_layout.qml','components':'tst_components.qml'}[case]+ env['QSG_RHI_BACKEND']='d3d12'+ command=[str(APP/'veyra_qml_quick_tests.exe'),'-input',str(APP/'qml-tests'/file),'-o','-,txt']+ elif case in ('sr-baseline','sr','sr-gta'):+ command=[str(APP/'veyra_sr_quality_tests.exe'),str(output)]+(['baseline'] if case=='sr-baseline' else ['natural','E:/Ai/知识/小七姐/GTAVI_An_Extended_Look_4K_Native.mp4'] if case=='sr-gta' else [])+ elif case.startswith('quality-'):+ seconds=case.split('-')[1];mode='-'.join(case.split('-')[2:]) if len(case.split('-'))>2 else 'still'+ command=[str(APP/'veyra_sr_quality_tests.exe'),str(output),'reference','E:/Ai/知识/小七姐/GTAVI_An_Extended_Look_4K_Native.mp4',seconds,mode]+ elif case=='inactive':command=[str(APP/'veyra_live_presentation_tests.exe'),'E:/Ai/知识/小七姐/GTAVI_An_Extended_Look_4K_Native.mp4',str(output),'--inactive-effects']+ elif case=='inactive-node':command=[str(APP/'veyra_live_presentation_tests.exe'),'E:/Ai/知识/小七姐/GTAVI_An_Extended_Look_4K_Native.mp4',str(output),'--inactive-effects-node']+ elif case=='chain':command=[str(APP/'veyra_effect_chain_tests.exe')]+ elif case=='contracts':command=[str(APP/'veyra_repair_contract_tests.exe')]+ elif case=='video':command=[str(APP/'veyra_live_presentation_tests.exe'),'E:/Ai/知识/小七姐/GTAVI_An_Extended_Look_4K_Native.mp4',str(output),'--settings-rebuild']+ elif case=='rollback':command=[str(APP/'veyra_live_presentation_tests.exe'),'E:/Ai/知识/小七姐/GTAVI_An_Extended_Look_4K_Native.mp4',str(output),'--reset-rollback']+ elif case=='presenter':command=[str(APP/'veyra_settings_transaction_tests.exe'),str(output)]+ elif case=='lifecycle':command=[str(APP/'veyra_present_sink_lifecycle_tests.exe'),str(output)]+ elif case=='hdr':command=[str(APP/'veyra_hdr_color_tests.exe')]+ elif case=='color':command=[str(APP/'veyra_capture_color_tests.exe')]+ elif case=='formats':command=[str(APP/'veyra_capture_format_selection_tests.exe')]+ else:raise AssertionError(case)+ start=time.monotonic()+ with (output/'console.log').open('wb') as stream:+ try:run=subprocess.run(command,cwd=APP,env=env,stdout=stream,stderr=subprocess.STDOUT,timeout=290);code=run.returncode+ except subprocess.TimeoutExpired:code=-1+ text=(output/'console.log').read_text(encoding='utf8',errors='replace')+ errors=[line for line in text.splitlines() if re.search(r'^FAIL |FAIL!|passed=0|ReferenceError:|TypeError:|Binding loop|Cannot assign|D3D12 ERROR|D3D12 CORRUPTION',line)]+ passed=code==0 and not errors+ row={'case':case,'command':command,'exit':code,'seconds':time.monotonic()-start,'passed':passed,'errors':errors,'events':[l for l in text.splitlines() if re.search('PASS|SR_CASE|SR_POLICY|SR_NATIVE|SR_PRECOLOR|SR_QUALITY|SR_REFERENCE|RESULT|SETTINGS_REUSE|SETTINGS_HDR|Totals:',l)]}+ results.append(row);print(json.dumps({k:v for k,v in row.items() if k!='events'}|{'eventCount':len(row['events'])},ensure_ascii=False),flush=True)+ if not passed:break+verify();receipt={'results':results,'passed':len(results)==len(cases) and all(r['passed'] for r in results),'qualityOnlyConcurrent':headroom,'donorUnchanged':len(manifest['files']),'executables':{p.name:sha(p) for p in APP.glob('*.exe')}}+(log/'receipt.json').write_text(json.dumps(receipt,ensure_ascii=False,indent=2),encoding='utf8')+(BASE/'reports'/TASK/'tests-current.json').write_text(json.dumps({'receipt':str(log/'receipt.json')},indent=2),encoding='utf8')+raise SystemExit(not receipt['passed'])diff --git a/tests/integration/SrQualityTests.cpp b/tests/integration/SrQualityTests.cppindex 042672ff..02bd240e 100644--- a/tests/integration/SrQualityTests.cpp+++ b/tests/integration/SrQualityTests.cpp@@ -8,6 +8,8 @@#include "veyra/Log.h"#include <filesystem>#include <iostream>+#include <fstream>+#include <memory>#include <array>extern "C" {#include <libavutil/frame.h>@@ -17,11 +19,83 @@ extern "C" {// Matched deterministic frames, actual SDK evaluation and output pixels.// Readbacks are restricted to this test; these are not playback timings.+static int referenceTest(const std::filesystem::path& directory,const std::wstring& path,int seconds,bool moving,bool zeroMotion,int inputHeight,int outputHeight){+ using namespace veyra;+ std::filesystem::create_directories(directory);Logger::instance().openFile((directory/L"engine.log").wstring());+ gfx::D3D12DeviceContext ctx;gfx::CommandSlotRing ring;Status status;+ if(!ctx.initialize({},status)||!ring.initialize(ctx.device(),ctx.directQueue(),ctx.fence(),ctx.fenceEvent(),4,status))return 2;+ struct Case{const char* name;unsigned quality;bool reference,enabled;};+ bool ok=true;+ for(const auto test:std::array<Case,6>{{{"reference",4,true,false},{"bilinear",4,false,false},+ {"vsr1",1,false,true},{"vsr4",4,false,true},{"dlss",0,false,true},{"fsr",5,false,true}}}){+ source::MediaFileSource media;source::SourceOpenDesc open;open.path=path;open.preferHardwareDecode=false;+ if(!media.open(open)||!media.seek({seconds,1}))return 2;+ pipeline::FramePacket packet;const AVFrame* natural=nullptr;+ do{+ if(media.read(packet,&natural)!=source::SourceReadStatus::Frame||!natural||natural->width!=3840||natural->height!=2160)return 2;+ }while(packet.pts.toDouble()+1e-6<seconds);+ const double startPts=packet.pts.toDouble();+ engine::EnhancementSettings settings;settings.nr=false;settings.sr=!test.reference;settings.multiplier=1;+ settings.videoSrQuality=test.quality;settings.srTarget=outputHeight==1440?pipeline::SrTarget::Qhd:pipeline::SrTarget::Uhd4K;+ settings.nrPolicy=pipeline::NrSizePolicy::Native;settings.srMotion=zeroMotion?engine::MotionSource::Zero:engine::MotionSource::OpticalFlow;+ engine::StageRequest request;request.height=test.reference?outputHeight:inputHeight;request.width=request.height*16/9;request.sr=settings.sr;+ pipeline::EnhanceGraphDesc desc;engine::describeStages(request,settings,desc);+ desc.enableSr=test.enabled;desc.rgbInput=true;desc.runtimeAbsPath=runtime::localRuntimeDirectory().wstring();+ pipeline::EnhanceGraph graph(ctx,ring);if(!graph.initialize(desc)||!graph.createViews())return 2;+ graph.recordGpuTimings();std::ofstream timings(directory/(std::string(test.name)+"-gpu.csv"));timings<<"frame,srMs\n";+ auto freeFrame=[](AVFrame* frame){av_frame_free(&frame);};+ std::unique_ptr<AVFrame,decltype(freeFrame)> owned(av_frame_alloc(),freeFrame);auto* frame=owned.get();+ if(!frame)return 2;frame->format=AV_PIX_FMT_RGBA;frame->width=request.width;frame->height=request.height;+ if(av_frame_get_buffer(frame,32)<0)return 2;+ auto* scaler=sws_getContext(natural->width,natural->height,AVPixelFormat(natural->format),frame->width,frame->height,AV_PIX_FMT_RGBA,SWS_LANCZOS,nullptr,nullptr,nullptr);+ if(!scaler)return 2;+ // swscale defaults to BT.601; explicitly retain the actual video's+ // matrix and range when making the controlled low-resolution input.+ const int matrix=(natural->colorspace==AVCOL_SPC_BT709||+ (natural->colorspace==AVCOL_SPC_UNSPECIFIED&&natural->height>=720))?SWS_CS_ITU709:+ natural->colorspace==AVCOL_SPC_BT2020_NCL?SWS_CS_BT2020:SWS_CS_ITU601;+ const int* coefficients=sws_getCoefficients(matrix);+ if(sws_setColorspaceDetails(scaler,coefficients,natural->color_range==AVCOL_RANGE_JPEG,+ coefficients,1,0,1<<16,1<<16)<0){sws_freeContext(scaler);return 2;}+ bool passed=true;uint64_t firstEvaluations=0;double lastPts=0;+ for(unsigned i=0;i<32&&passed;++i){+ if(i&&moving&&(media.read(packet,&natural)!=source::SourceReadStatus::Frame||!natural)){passed=false;break;}+ if(sws_scale(scaler,natural->data,natural->linesize,0,natural->height,frame->data,frame->linesize)!=frame->height){passed=false;break;}+ frame->color_range=AVCOL_RANGE_JPEG;frame->color_primaries=natural->color_primaries;frame->color_trc=natural->color_trc;frame->colorspace=AVCOL_SPC_RGB;+ pipeline::EnhanceGraph::FrameOutputs out;+ lastPts=moving?packet.pts.toDouble():seconds+i/30.0;+ passed=graph.process(frame,lastPts*1000,i==0,out,i+1)&&ring.waitIdle();+ for(const auto& t:graph.takeGpuTimings()){const auto& v=t.gpu[size_t(diagnostics::GpuStage::Sr)];if(v.milliseconds)timings<<t.identity.sourceFrameId<<','<<*v.milliseconds<<'\n';}+ if(i==0)firstEvaluations=graph.metrics().srEvaluateCount;+ if(passed&&(i==0||i==7||i==31)){+ sink::RgbaImage image;passed=sink::readRgba8(ctx,ring,graph.videoFrameResource(out.videoSlot),image)&&+ sink::saveImage((directory/(std::string(test.name)+"-f"+std::to_string(i+1)+".png")).wstring(),image,false);+ }+ }+ sws_freeContext(scaler);+ const auto evaluations=graph.metrics().srEvaluateCount;+ passed=passed&&evaluations==(test.enabled?32u:0u);ok=passed&&ok;+ std::cout<<"SR_REFERENCE case="<<test.name<<" moving="<<moving<<" zeroMotion="<<zeroMotion<<" source="<<request.width<<'x'<<request.height+ <<" target="<<desc.workWidth<<'x'<<desc.workHeight<<" sourceStartPts="<<startPts<<" sourceEndPts="<<packet.pts.toDouble()+ <<" firstEvaluations="<<firstEvaluations<<" evaluations="<<evaluations<<" passed="<<passed<<std::endl;+ ring.drainQueue();graph.shutdown();media.close();+ }+ ring.shutdown();ctx.shutdown();return ok?0:1;+}++int wmain(int argc,wchar_t** argv){using namespace veyra;if(argc<2)return 2;const HRESULT com=CoInitializeEx(nullptr,COINIT_MULTITHREADED);if(FAILED(com))return 2;+ if(argc>5&&std::wstring_view(argv[2])==L"reference"){+ const std::wstring_view mode=argv[5];+ if(mode.starts_with(L"legacy-"))return 2; // withdrawn experiment; no production toggle remains+ const int result=referenceTest(argv[1],argv[3],std::stoi(argv[4]),mode.ends_with(L"moving"),mode.starts_with(L"zero-"),+ mode.find(L"p720")!=std::wstring_view::npos?720:1080,mode.find(L"qhd")!=std::wstring_view::npos?1440:2160);+ CoUninitialize();return result;+ }const bool baseline=argc>2&&std::wstring_view(argv[2])==L"baseline";source::MediaFileSource media;const AVFrame* natural=nullptr;if(argc>3){