Skip to content

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

C++

test: baseline guards for the UI migration

Veyra Goal Agent6a835b18f246
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 38d86c3d..84f67650 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -916,12 +916,23 @@ if(VEYRA_FFMPEG_ROOT AND EXISTS "${VEYRA_FFMPEG_ROOT}/include/libavformat/avform
target_include_directories(veyra_quality_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(veyra_quality_probe PRIVATE
veyra_pipeline veyra_sources veyra_media veyra_ngx veyra_nvof veyra_sinks
- ${FFMPEG_LIBRARIES} psapi dxgi)
+ ${FFMPEG_LIBRARIES} psapi dxgi shell32)
add_dependencies(veyra_quality_probe
veyra_shader_yuv_to_rgb veyra_shader_parity_encode
veyra_shader_parity_decode veyra_shader_scale_blit
veyra_shader_nv12_upload veyra_shader_nvof_densify)
+ # UI migration guard: per-frame output hashes for fixed stage configurations.
+ add_executable(veyra_chain_hash_probe tools/chain_hash_probe/main.cpp)
+ target_compile_features(veyra_chain_hash_probe PRIVATE cxx_std_20)
+ target_compile_options(veyra_chain_hash_probe PRIVATE /WX-)
+ target_compile_definitions(veyra_chain_hash_probe PRIVATE UNICODE _UNICODE WIN32_LEAN_AND_MEAN NOMINMAX)
+ target_include_directories(veyra_chain_hash_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
+ target_link_libraries(veyra_chain_hash_probe PRIVATE
+ veyra_pipeline veyra_sources veyra_media veyra_ngx veyra_nvof veyra_sinks
+ ${FFMPEG_LIBRARIES} dxgi shell32)
+ add_dependencies(veyra_chain_hash_probe veyra_quality_probe)
+
# Headless Remote Play probe: drives the product session stack with a saved
# profile so codec/bitrate variants can be compared without the GUI.
if(VEYRA_ENABLE_REMOTEPLAY)
diff --git a/docs/UI_MIGRATION_EXECUTION_2026-09-25.md b/docs/UI_MIGRATION_EXECUTION_2026-09-25.md
index e02d530a..349b9ec6 100644
--- a/docs/UI_MIGRATION_EXECUTION_2026-09-25.md
+++ b/docs/UI_MIGRATION_EXECUTION_2026-09-25.md
@@ -13,12 +13,27 @@
| 步骤 | 内容 | 状态 | 标签 | 说明 |
|---|---|---|---|---|
| S0.1 | 建分支、更新文档 | 完成 | `checkpoint/ui-mig-s0.1` | |
-| S0.2 | 构建与现有测试基线 | 待做 | | |
-| S0.3 | 抓帧哈希基线 | 待做 | | |
-| S0.4 | 性能 / 延迟基线 | 待做 | | |
+| S0.2 | 构建与现有测试基线 | 完成 | `checkpoint/ui-mig-s0` | 600/600 目标构建通过;交付门槛 PASS |
+| S0.3 | 抓帧哈希基线 | 完成 | `checkpoint/ui-mig-s0` | 13 种配置 × 24 帧,两次运行完全一致 |
+| S0.4 | 性能 / 延迟基线 | 完成 | `checkpoint/ui-mig-s0` | 4 种播放场景 |
## 发现并修复的 bug
-(施工中逐条记录)
+| # | 发现于 | 问题 | 修复 |
+|---|---|---|---|
+| B1 | S0.2 | `veyra_live_timing_tests` 的“输出上限仍会跳过候选帧”断言一直失败:09-22 把输出上限改到独立时间网格(`rateSubmitted`)后,测试只调用了 `submitted()`,测的是旧行为。产品逻辑正确,测试过期 | 测试补上 `rateSubmitted()` |
+| B2 | S0.2 | `veyra_quality_probe` 用 ANSI `argv` 转宽字符,输出目录含中文(`E:\项目`)时写图失败,交付门槛因此失败;门槛脚本原先用相对路径绕开,但源码在 C:、日志在 E: 时相对路径无法跨盘 | 探针改为从 UTF-16 命令行读参数;门槛改传绝对路径 |
## 日志
+
+### S0(2026-09-25)
+- 构建:`scripts/build-ui-migration.ps1`,沿用 1.4.4 发布配置,输出 `E:\项目\Veyra\build\ui-qml-migration-20260925`。`.cmd` 按 ANSI 解析,中文路径由 PowerShell 用环境变量传入。
+- 测试目录:`scripts/stage-ui-migration.ps1` 复制构建产物到 `E:\项目\Veyra\tests\ui-qml-migration-20260925\app`。运行组件用 junction 指向 1.4.4 发布包(7 个文件 SHA-256 与 manifest 全部一致),`runtime_local` 为测试专用新目录,不碰用户设置。
+- 交付门槛:`scripts/gates/delivery.ps1` PASS,`E:\项目\Veyra\logs\ui-qml-migration-20260925\s0-delivery\4acefbbfd4744c64bc274e2c9181e41e\result.json`(修复 B2 后)。
+- 单元测试:`scripts/run-unit-ui-migration.ps1` 无参数直接运行 75 个测试程序,40 个通过,其余 35 个需要参数或素材(用法退出码 2),不作为基线判据;基线判据为交付门槛与下面两项。
+- 抓帧哈希:新增 `veyra_chain_hash_probe` 与 `scripts/hash-ui-migration.ps1`。13 种配置(直通、NR、NR 风格 2、残差、保护区域、时域防闪、DLSS SR、RTX VSR、SR→NR、NR→SR、VSR→NR、调色、调色+NR)× 24 帧,CPU 解码,逐帧 SHA-256。两次运行 0 差异,13 个末帧哈希互不相同。基线 `E:\项目\Veyra\tests\ui-qml-migration-20260925\hash-baseline.json`。
+- 性能 / 延迟:新增 `scripts/perf-ui-migration.ps1`(真实播放器 8 秒,取 `[player-timing]` 各 P95 均值与 `[frame-flow]` 计数)。基线 `perf-baseline.json`:
+ - 1080p NR:提交 P95 0.92 ms,GPU 就绪 P95 8.09 ms,NR 5.78 ms,60 fps,跳帧 0
+ - 1080p NR + 2X:提交 1.28 ms,GPU 就绪 9.41 ms,120 fps,跳帧 0
+ - 4K NR + 2X:提交 1.38 ms,GPU 就绪 12.46 ms,120 fps,跳帧 0
+ - 1080p 无增强:提交 0.13 ms,GPU 就绪 1.57 ms
diff --git a/scripts/build-ui-migration.cmd b/scripts/build-ui-migration.cmd
new file mode 100644
index 00000000..6c537c59
--- /dev/null
+++ b/scripts/build-ui-migration.cmd
@@ -0,0 +1,24 @@
+@echo off
+rem Build for the QML UI migration branch with the 1.4.4 release configuration.
+rem The caller sets VEYRA_OUT (build dir) and VEYRA_TMP (process TEMP): a .cmd file
+rem is parsed in the ANSI code page, so non-ASCII paths must come from the environment.
+rem Use scripts/build-ui-migration.ps1. Usage: build-ui-migration.cmd [target...]
+call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" >nul 2>&1
+if errorlevel 1 exit /b 4
+set "ROOT=%~dp0.."
+if "%VEYRA_OUT%"=="" exit /b 3
+set "OUT=%VEYRA_OUT%"
+if not "%VEYRA_TMP%"=="" set "TEMP=%VEYRA_TMP%"
+if not "%VEYRA_TMP%"=="" set "TMP=%VEYRA_TMP%"
+set "CMAKE=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"
+if not exist "%OUT%\CMakeCache.txt" (
+ "%CMAKE%" --preset x64-release -S "%ROOT%" -B "%OUT%" -DVEYRA_ENABLE_EXPERIMENTAL_DLSSNR=ON -DVEYRA_DLSS_SDK_ROOT="%ROOT%\third_party_local\nvidia\DLSS_SDK_310.7.0" -DVEYRA_NVOF_SDK_ROOT="%ROOT%\third_party_local\nvidia\Optical_Flow_SDK_5.0.7" -DVEYRA_NVENC_HEADERS_ROOT="%ROOT%\third_party_local\nvidia\nv-codec-headers-13.0" -DVEYRA_XESS_ROOT="%ROOT%\third_party_local\intel\xess-3.0.2" -DVEYRA_FIDELITYFX_ROOT="%ROOT%\third_party_local\amd\FidelityFX-SDK\sdk" -DVEYRA_FIDELITYFX2_ROOT="%ROOT%\third_party_local\amd\FidelityFX-SDK-2.3.0\Kits\FidelityFX" -DVEYRA_FFMPEG_ROOT="C:\veyra-deps\ffmpeg-ps5-dav1d-installed" -DVEYRA_CLIP_TOOLS_ROOT="C:\veyra-deps\tools-installed\x64-windows" -DVEYRA_ENABLE_REMOTEPLAY=ON -DVEYRA_RP_CHIAKI_VERIFY_DIR="C:/veyra-deps/chiaki-source" -DVEYRA_RP_CHIAKI_SOURCE_DIR="%ROOT%\out\remoteplay\chiaki-msvc-stage" -DCMAKE_PREFIX_PATH="C:/veyra-deps/remoteplay-installed/x64-windows-static" -DPROTOC="C:/veyra-deps/remoteplay-installed/x64-windows/tools/protobuf/protoc.exe" -DPKG_CONFIG_EXECUTABLE="C:/veyra-deps/vcpkg/downloads/tools/msys2/3e71d1f8e22ab23f/mingw64/bin/pkg-config.exe"
+ if errorlevel 1 exit /b 5
+)
+if "%~1"=="" (
+ "%CMAKE%" --build "%OUT%"
+) else (
+ "%CMAKE%" --build "%OUT%" --target %*
+)
+if errorlevel 1 exit /b 6
+exit /b 0
diff --git a/scripts/build-ui-migration.ps1 b/scripts/build-ui-migration.ps1
new file mode 100644
index 00000000..a6766299
--- /dev/null
+++ b/scripts/build-ui-migration.ps1
@@ -0,0 +1,13 @@
+# Wrapper that sets the non-ASCII output paths and runs build-ui-migration.cmd.
+# Build output goes to the log file through cmd's own redirection, so compiler
+# warnings on stderr never become PowerShell errors.
+param([string[]]$Targets = @(), [string]$Log = 'E:\项目\Veyra\logs\ui-qml-migration-20260925\build.log')
+$env:VEYRA_OUT = 'E:\项目\Veyra\build\ui-qml-migration-20260925'
+$env:VEYRA_TMP = 'E:\项目\Veyra\tmp\ui-qml-migration-20260925'
+$env:VEYRA_LOG = $Log
+$cmd = Join-Path $PSScriptRoot 'build-ui-migration.cmd'
+& cmd.exe /c "`"$cmd`" $($Targets -join ' ') > `"%VEYRA_LOG%`" 2>&1"
+$code = $LASTEXITCODE
+Get-Content -LiteralPath $Log -Tail 25 -Encoding utf8
+"exit=$code"
+exit $code
diff --git a/scripts/gates/delivery.ps1 b/scripts/gates/delivery.ps1
index 9007d8e7..f39c7d18 100644
--- a/scripts/gates/delivery.ps1
+++ b/scripts/gates/delivery.ps1
@@ -1,4 +1,4 @@
-[CmdletBinding()]
+[CmdletBinding()]
param([Parameter(Mandatory=$true)][string]$Root,[switch]$VisiblePlayer,[string]$BuildDirectory,[string]$PlayerExe,[switch]$PortablePlayer,
[Parameter(Mandatory=$true)][string]$OutputDirectory,
[Parameter(Mandatory=$true)][string]$FixtureRoot)
@@ -15,9 +15,10 @@ $timer=[Diagnostics.Stopwatch]::StartNew()
$run=[Guid]::NewGuid().ToString('N')
$dir=Join-Path ([IO.Path]::GetFullPath($OutputDirectory)) $run
[IO.Directory]::CreateDirectory($dir)|Out-Null
-# The legacy quality probe accepts narrow paths; relative output avoids losing
-# Unicode directory names while keeping all artifacts in OutputDirectory.
-$qualityDir=(Resolve-Path -LiteralPath $dir -Relative)
+# The quality probe reads its arguments from the UTF-16 command line, so the
+# absolute output directory works even when it is on another drive or has
+# Unicode names (a relative path cannot cross from the repo drive to E:).
+$qualityDir=$dir
$bin=Join-Path $Root 'out/build/x64-release'
if($BuildDirectory){$bin=(Resolve-Path -LiteralPath $BuildDirectory).Path}
if(-not $PlayerExe){$PlayerExe=Join-Path $bin 'veyra.exe'}
diff --git a/scripts/hash-ui-migration.ps1 b/scripts/hash-ui-migration.ps1
new file mode 100644
index 00000000..7288f762
--- /dev/null
+++ b/scripts/hash-ui-migration.ps1
@@ -0,0 +1,39 @@
+# Runs veyra_chain_hash_probe for every case and compares with a stored baseline.
+# -Record : write the result as the new baseline (S0.3 only)
+# default : compare against the baseline and report every mismatching case
+param([string]$App = 'E:\项目\Veyra\tests\ui-qml-migration-20260925\app',
+ [string]$Clip = 'C:\Users\123\Desktop\Veyra DLSS Video Player\loop\local\fixed_clips\test_av_1080p.mp4',
+ [string]$Baseline = 'E:\项目\Veyra\tests\ui-qml-migration-20260925\hash-baseline.json',
+ [string]$Out = 'E:\项目\Veyra\logs\ui-qml-migration-20260925\hash',
+ [int]$Frames = 24,
+ [string[]]$Cases = @('passthrough','nr','nr-style2','nr-residual','nr-protect','nr-temporal','dlss-sr','vsr','sr-nr','nr-sr','vsr-nr','color','color-nr'),
+ [switch]$Record)
+$env:TEMP = 'E:\项目\Veyra\tmp\ui-qml-migration-20260925'; $env:TMP = $env:TEMP
+New-Item -ItemType Directory -Force $Out | Out-Null
+$probe = Join-Path $App 'veyra_chain_hash_probe.exe'
+$result = [ordered]@{}
+foreach ($c in $Cases) {
+ $file = Join-Path $Out "$c.json"
+ $p = Start-Process -FilePath $probe -ArgumentList @('--input', "`"$Clip`"", '--case', $c, '--frames', $Frames, '--out', "`"$file`"") -WorkingDirectory $App -PassThru -WindowStyle Hidden -RedirectStandardOutput (Join-Path $Out "$c.stdout.log") -RedirectStandardError (Join-Path $Out "$c.stderr.log")
+ $null = $p.Handle
+ if (-not $p.WaitForExit(120000)) { $p.Kill(); $result[$c] = 'timeout'; continue }
+ $p.WaitForExit()
+ if ($p.ExitCode -ne 0) { $result[$c] = "exit $($p.ExitCode)"; continue }
+ $result[$c] = (Get-Content -LiteralPath $file -Raw | ConvertFrom-Json).hashes
+}
+if ($Record) {
+ $result | ConvertTo-Json -Depth 4 | Set-Content -LiteralPath $Baseline -Encoding utf8
+ "recorded $($result.Count) cases -> $Baseline"
+ $result.GetEnumerator() | Where-Object { $_.Value -is [string] } | ForEach-Object { "ERROR $($_.Key): $($_.Value)" }
+ return
+}
+$base = Get-Content -LiteralPath $Baseline -Raw | ConvertFrom-Json
+$bad = 0
+foreach ($c in $Cases) {
+ $now = $result[$c]; $was = $base.$c
+ if ($now -is [string]) { "FAIL $c : $now"; $bad++; continue }
+ $diff = @(for ($i = 0; $i -lt [math]::Max($now.Count, $was.Count); $i++) { if ($now[$i] -ne $was[$i]) { $i } })
+ if ($diff.Count) { "FAIL $c : $($diff.Count) of $($was.Count) frames differ (first $($diff[0]))"; $bad++ } else { "same $c" }
+}
+"mismatching cases: $bad"
+exit $bad
diff --git a/scripts/perf-ui-migration.ps1 b/scripts/perf-ui-migration.ps1
new file mode 100644
index 00000000..2277281e
--- /dev/null
+++ b/scripts/perf-ui-migration.ps1
@@ -0,0 +1,51 @@
+# Performance / latency baseline for the UI migration (S0.4 and every engine step).
+# Runs the real player headless on fixed clips and averages the [player-timing]
+# P95 fields plus the final [frame-flow] counters. Compare two runs with -Compare.
+param([string]$App = 'E:\项目\Veyra\tests\ui-qml-migration-20260925\app',
+ [string]$Fixtures = 'C:\Users\123\Desktop\Veyra DLSS Video Player\loop\local\fixed_clips',
+ [string]$Out = 'E:\项目\Veyra\logs\ui-qml-migration-20260925\perf',
+ [string]$Save = '',
+ [string]$Compare = '',
+ [int]$Seconds = 8)
+$env:TEMP = 'E:\项目\Veyra\tmp\ui-qml-migration-20260925'; $env:TMP = $env:TEMP
+New-Item -ItemType Directory -Force $Out | Out-Null
+$exe = Join-Path $App 'veyra.exe'
+$cases = [ordered]@{
+ 'nr-1080' = @((Join-Path $Fixtures 'test_av_1080p.mp4'), '--nr', '--realtime')
+ 'nr-fg-1080' = @((Join-Path $Fixtures 'test_av_1080p.mp4'), '--nr', '--realtime', '--fg')
+ 'nr-fg-4k' = @((Join-Path $Fixtures 'test_av_4k.mp4'), '--nr', '--realtime', '--fg')
+ 'plain-1080' = @((Join-Path $Fixtures 'test_av_1080p.mp4'))
+}
+$fields = 'decodeP95Ms','graphSubmitP95Ms','gpuReadyP95Ms','presentP95Ms','gpuColorP95Ms','gpuSrP95Ms','gpuFlowP95Ms','gpuNrP95Ms','gpuResidualP95Ms','gpuFgBatchP95Ms','gpuBlitP95Ms'
+$summary = [ordered]@{}
+foreach ($name in $cases.Keys) {
+ $log = Join-Path $Out "$name.log"
+ $argv = @($cases[$name] | ForEach-Object { if ($_ -like '*\*') { "`"$_`"" } else { $_ } }) + @('--smoke-seconds', $Seconds)
+ $p = Start-Process -FilePath $exe -ArgumentList $argv -WorkingDirectory $App -PassThru -WindowStyle Minimized -RedirectStandardOutput $log -RedirectStandardError "$log.err"
+ $null = $p.Handle
+ if (-not $p.WaitForExit(($Seconds + 40) * 1000)) { $p.Kill(); $summary[$name] = 'timeout'; continue }
+ $lines = Get-Content -LiteralPath $log | Where-Object { $_ -match '\[player-timing\]' } | Select-Object -Skip 1
+ $row = [ordered]@{ exit = $p.ExitCode; samples = @($lines).Count }
+ foreach ($f in $fields) {
+ $vals = @($lines | ForEach-Object { if ($_ -match "$f=([0-9.]+)") { [double]$Matches[1] } })
+ $row[$f] = if ($vals.Count) { [math]::Round(($vals | Measure-Object -Average).Average, 3) } else { $null }
+ }
+ $flow = Get-Content -LiteralPath $log | Where-Object { $_ -match '\[frame-flow\] state=closed' } | Select-Object -Last 1
+ foreach ($k in 'presentSubmitFps','generatedFps','realPresented','generatedPresented','sourceSkippedBeforeGraph','slotWaitCount','cancelledBeforePresent') {
+ if ($flow -match "$k=([0-9.]+)") { $row[$k] = [double]$Matches[1] }
+ }
+ $summary[$name] = $row
+}
+$json = $summary | ConvertTo-Json -Depth 4
+if ($Save) { $json | Set-Content -LiteralPath $Save -Encoding utf8; "saved $Save" }
+if ($Compare) {
+ $base = Get-Content -LiteralPath $Compare -Raw | ConvertFrom-Json
+ foreach ($name in $summary.Keys) {
+ $now = $summary[$name]; $was = $base.$name
+ if ($now -is [string] -or -not $was) { "$name : $now (no comparison)"; continue }
+ $parts = foreach ($f in 'graphSubmitP95Ms','gpuReadyP95Ms','presentP95Ms','gpuNrP95Ms','presentSubmitFps','sourceSkippedBeforeGraph') {
+ if ($null -ne $now[$f] -and $null -ne $was.$f) { '{0} {1}->{2}' -f $f, $was.$f, $now[$f] }
+ }
+ "$name : " + ($parts -join ' | ')
+ }
+} else { $json }
diff --git a/scripts/run-unit-ui-migration.ps1 b/scripts/run-unit-ui-migration.ps1
new file mode 100644
index 00000000..cc641f5b
--- /dev/null
+++ b/scripts/run-unit-ui-migration.ps1
@@ -0,0 +1,30 @@
+# Runs the unit/contract test executables of the staged app and writes a JSON summary.
+# Tests that need hardware or media (capture, remote play, endpoint audio) are skipped:
+# they are listed in $skip with the reason, never reported as passed.
+param([string]$App = 'E:\项目\Veyra\tests\ui-qml-migration-20260925\app',
+ [string]$Out = 'E:\项目\Veyra\logs\ui-qml-migration-20260925\unit',
+ [int]$TimeoutSeconds = 120)
+$ErrorActionPreference = 'Continue'
+New-Item -ItemType Directory -Force $Out | Out-Null
+$env:TEMP = 'E:\项目\Veyra\tmp\ui-qml-migration-20260925'; $env:TMP = $env:TEMP
+# name -> reason. Anything not listed and matching *_tests.exe runs with no arguments.
+$skip = @{
+ 'veyra_capture_tests.exe' = 'needs a capture device'
+ 'veyra_wasapi_input_tests.exe' = 'needs an explicit recording endpoint'
+ 'veyra_capture_latency_tests.exe' = 'needs a capture device'
+}
+$results = @()
+Get-ChildItem -LiteralPath $App -Filter 'veyra_*_tests.exe' | Sort-Object Name | ForEach-Object {
+ $name = $_.Name
+ if ($skip.ContainsKey($name)) { $results += [pscustomobject]@{ name = $name; status = 'skipped'; exit = $null; seconds = 0; reason = $skip[$name] }; return }
+ $log = Join-Path $Out ($_.BaseName + '.log')
+ $sw = [Diagnostics.Stopwatch]::StartNew()
+ $p = Start-Process -FilePath $_.FullName -WorkingDirectory $App -PassThru -WindowStyle Hidden -RedirectStandardOutput $log -RedirectStandardError ($log + '.err')
+ $null = $p.Handle # cache the handle so ExitCode is readable after exit
+ if (-not $p.WaitForExit($TimeoutSeconds * 1000)) { $p.Kill(); $status = 'timeout'; $code = $null }
+ else { $p.WaitForExit(); $code = $p.ExitCode; $status = if ($code -eq 0) { 'pass' } else { 'fail' } }
+ $results += [pscustomobject]@{ name = $name; status = $status; exit = $code; seconds = [math]::Round($sw.Elapsed.TotalSeconds, 1); reason = '' }
+}
+$results | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $Out 'summary.json') -Encoding utf8
+$results | Group-Object status | ForEach-Object { "{0}={1}" -f $_.Name, $_.Count }
+$results | Where-Object { $_.status -in 'fail', 'timeout' } | ForEach-Object { "{0} {1} exit={2}" -f $_.status, $_.name, $_.exit }
diff --git a/scripts/stage-ui-migration.ps1 b/scripts/stage-ui-migration.ps1
new file mode 100644
index 00000000..b3ae6072
--- /dev/null
+++ b/scripts/stage-ui-migration.ps1
@@ -0,0 +1,29 @@
+# Stage the current branch build into a runnable app directory for tests.
+# Runtime components come from the verified 1.4.4 release (junctions, never copied
+# or modified); settings under runtime_local are fresh test-only files, so running
+# tests never touches the user's real configuration.
+param([string]$Build = 'E:\项目\Veyra\build\ui-qml-migration-20260925',
+ [string]$App = 'E:\项目\Veyra\tests\ui-qml-migration-20260925\app',
+ [string]$Release = 'E:\项目\Veyra\releases\1.4.4\final\Veyra-1.4.4-win64-portable')
+$ErrorActionPreference = 'Stop'
+New-Item -ItemType Directory -Force $App | Out-Null
+foreach ($name in 'runtime') {
+ $link = Join-Path $App $name
+ if (-not (Test-Path -LiteralPath $link)) { New-Item -ItemType Junction -Path $link -Target (Join-Path $Release $name) | Out-Null }
+}
+$local = Join-Path $App 'runtime_local'
+New-Item -ItemType Directory -Force $local | Out-Null
+foreach ($name in 'amd', 'intel') {
+ $link = Join-Path $local $name
+ if (-not (Test-Path -LiteralPath $link)) { New-Item -ItemType Junction -Path $link -Target (Join-Path (Join-Path $Release 'runtime_local') $name) | Out-Null }
+}
+# Application binaries, test executables, FFmpeg DLLs and shaders from the build.
+Get-ChildItem -LiteralPath $Build -File | Where-Object { $_.Extension -in '.exe', '.dll' } | ForEach-Object {
+ Copy-Item -LiteralPath $_.FullName -Destination $App -Force
+}
+foreach ($dll in 'avcodec-63.dll','avformat-63.dll','avutil-61.dll','dav1d.dll','swresample-7.dll','swscale-10.dll','msvcp140.dll','vcruntime140.dll','vcruntime140_1.dll') {
+ $target = Join-Path $App $dll
+ if (-not (Test-Path -LiteralPath $target)) { Copy-Item -LiteralPath (Join-Path $Release $dll) -Destination $target }
+}
+robocopy (Join-Path $Build 'shaders') (Join-Path $App 'shaders') /MIR /NJH /NJS /NP /NFL /NDL | Out-Null
+"staged $App"
diff --git a/tests/unit/LivePresentationTimingTests.cpp b/tests/unit/LivePresentationTimingTests.cpp
index e430748d..ce4977ca 100644
--- a/tests/unit/LivePresentationTimingTests.cpp
+++ b/tests/unit/LivePresentationTimingTests.cpp
@@ -28,7 +28,9 @@ int main(){
}
check(presented==240,"unpaced capture remains presentable after initial anchor");
check(!cadence.rateSkipsCandidate(100000000,1000000,interval,interval),"late completion recovers instead of starving on expired media deadline");
- cadence.submitted(100000000);
+ // The cap runs on its own absolute grid (rateSubmitted), not on the
+ // spacing anchor that submitted() moves.
+ cadence.submitted(100000000);cadence.rateSubmitted(100000000,interval*4);
check(cadence.rateSkipsCandidate(100000001,100000001,interval,interval*4),"active cap still skips candidates before its next slot");
cadence.reset();
check(!cadence.rateSkipsCandidate(100000001,100000001,interval,interval*4),"reset admits first frame immediately");
diff --git a/tools/chain_hash_probe/main.cpp b/tools/chain_hash_probe/main.cpp
new file mode 100644
index 00000000..155f7ca4
--- /dev/null
+++ b/tools/chain_hash_probe/main.cpp
@@ -0,0 +1,165 @@
+// Deterministic frame-hash probe for the UI migration (S0.3).
+//
+// Runs one fixed clip through EnhanceGraph with a named configuration and
+// prints a SHA-256 of every output frame (RGBA8 readback of the video slot).
+// The engine refactors in S1/S2 must keep these hashes identical wherever the
+// processing is meant to stay unchanged. Diagnostic tool: readback is allowed
+// here and never happens on the playback path.
+//
+// Usage: veyra_chain_hash_probe --input <clip> --case <name> [--frames N] [--out <json>]
+#include <windows.h>
+#include <shellapi.h>
+
+#include <cstdio>
+#include <format>
+#include <fstream>
+#include <string>
+#include <vector>
+
+#include "veyra/FileIdentity.h"
+#include "veyra/Log.h"
+#include "veyra/RuntimePaths.h"
+#include "veyra/gfx/CommandSlotRing.h"
+#include "veyra/gfx/D3D12DeviceContext.h"
+#include "veyra/pipeline/EnhanceGraph.h"
+#include "veyra/sink/ImageExportSink.h"
+#include "veyra/source/MediaFileSource.h"
+
+using namespace veyra;
+
+namespace {
+std::wstring widen(const std::string& utf8) {
+ const int chars = MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, nullptr, 0);
+ std::wstring wide(chars > 0 ? chars - 1 : 0, L'\0');
+ if (chars > 1) MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, wide.data(), chars);
+ return wide;
+}
+std::vector<std::string> utf8Arguments() {
+ std::vector<std::string> args;
+ int count = 0;
+ LPWSTR* wide = CommandLineToArgvW(GetCommandLineW(), &count);
+ for (int n = 0; wide && n < count; ++n) {
+ const int bytes = WideCharToMultiByte(CP_UTF8, 0, wide[n], -1, nullptr, 0, nullptr, nullptr);
+ std::string s(bytes > 0 ? bytes - 1 : 0, '\0');
+ if (bytes > 1) WideCharToMultiByte(CP_UTF8, 0, wide[n], -1, s.data(), bytes, nullptr, nullptr);
+ args.push_back(std::move(s));
+ }
+ LocalFree(wide);
+ return args;
+}
+
+// Named configurations. Each maps to the same desc fields the engine sets, so
+// the probe exercises exactly the product stages (NR, SR, order, colour,
+// residual, protection, temporal) without the player's scheduling.
+bool configure(const std::string& name, uint32_t w, uint32_t h, pipeline::EnhanceGraphDesc& gd) {
+ gd.sourceWidth = w; gd.sourceHeight = h;
+ gd.workWidth = w; gd.workHeight = h;
+ gd.nrWidth = w; gd.nrHeight = h;
+ gd.enableFg = false; gd.enableNr = false; gd.enableSr = false;
+ gd.enableNvofStandalone = false;
+ auto sr = [&](uint32_t quality) {
+ gd.enableSr = true; gd.videoSrQuality = quality;
+ gd.workWidth = w * 2; gd.workHeight = h * 2;
+ gd.nrWidth = gd.workWidth; gd.nrHeight = gd.workHeight;
+ };
+ auto nr = [&] { gd.enableNr = true; gd.enableNvofStandalone = true; };
+ if (name == "passthrough") return true;
+ if (name == "nr") { nr(); return true; }
+ if (name == "nr-style2") { nr(); gd.model.style = 2; gd.model.intensity = .6f; return true; }
+ if (name == "nr-residual") { nr(); gd.residual = {1.4f, .7f, 1.2f, .8f, 1.1f}; return true; }
+ if (name == "nr-protect") {
+ nr(); gd.protection.enabled = true; gd.protection.featherPixels = 8;
+ gd.protection.regions[0] = {.05f, .05f, .30f, .20f}; return true;
+ }
+ if (name == "nr-temporal") { nr(); gd.nrTemporal = true; return true; }
+ if (name == "dlss-sr") { sr(0); return true; }
+ if (name == "vsr") { sr(3); return true; }
+ if (name == "sr-nr") { sr(0); nr(); return true; }
+ if (name == "nr-sr") { sr(0); nr(); gd.nrBeforeSr = true; gd.nrWidth = w; gd.nrHeight = h; return true; }
+ if (name == "vsr-nr") { sr(3); nr(); return true; }
+ if (name == "color") {
+ gd.color.enabled = true; gd.color.exposure = .3f; gd.color.contrast = 20; gd.color.temperature = 15;
+ gd.color.saturation = -10; gd.color.shadows = 25; return true;
+ }
+ if (name == "color-nr") {
+ nr(); gd.color.enabled = true; gd.color.exposure = -.2f; gd.color.vibrance = 30; return true;
+ }
+ return false;
+}
+} // namespace
+
+int main() {
+ const auto args = utf8Arguments();
+ std::string input, caseName, outPath;
+ int frames = 24;
+ for (size_t i = 1; i < args.size(); ++i) {
+ auto next = [&] { return i + 1 < args.size() ? args[++i] : std::string(); };
+ if (args[i] == "--input") input = next();
+ else if (args[i] == "--case") caseName = next();
+ else if (args[i] == "--frames") frames = std::stoi(next());
+ else if (args[i] == "--out") outPath = next();
+ else { std::fprintf(stderr, "unknown arg %s\n", args[i].c_str()); return 2; }
+ }
+ if (input.empty() || caseName.empty() || frames <= 0) {
+ std::fprintf(stderr, "usage: --input <clip> --case <name> [--frames N] [--out json]\n");
+ return 2;
+ }
+ CoInitializeEx(nullptr, COINIT_MULTITHREADED);
+
+ gfx::D3D12DeviceContext ctx;
+ gfx::DeviceContextDesc ddesc;
+ ddesc.commandSlotCount = 4;
+ Status st = Status::Ok;
+ if (!ctx.initialize(ddesc, st)) { std::fprintf(stderr, "device init failed\n"); return 1; }
+ gfx::CommandSlotRing ring;
+ if (!ring.initialize(ctx.device(), ctx.directQueue(), ctx.fence(), ctx.fenceEvent(), 4, st)) return 1;
+
+ source::MediaFileSource src;
+ source::SourceOpenDesc od;
+ od.path = widen(input);
+ od.preferHardwareDecode = false; // CPU decode: bit-exact input every run
+ if (!src.open(od)) { std::fprintf(stderr, "open failed\n"); return 1; }
+
+ pipeline::EnhanceGraphDesc gd{};
+ if (!configure(caseName, src.info().width, src.info().height, gd)) {
+ std::fprintf(stderr, "unknown case %s\n", caseName.c_str());
+ return 2;
+ }
+ gd.runtimeAbsPath = runtime::localRuntimeDirectory().wstring();
+ pipeline::EnhanceGraph graph(ctx, ring);
+ if (!graph.initialize(gd) || !graph.createViews()) { std::fprintf(stderr, "graph init failed\n"); return 1; }
+
+ std::vector<std::string> hashes;
+ bool reset = true;
+ for (int n = 0; n < frames; ++n) {
+ pipeline::FramePacket packet;
+ const AVFrame* frame = nullptr;
+ if (src.read(packet, &frame) != source::SourceReadStatus::Frame || !frame) break;
+ pipeline::EnhanceGraph::FrameOutputs out;
+ if (!graph.process(frame, 1000.0 * packet.pts.toDouble(), reset, out, uint64_t(n + 1))) {
+ std::fprintf(stderr, "process failed at frame %d\n", n);
+ return 1;
+ }
+ reset = false;
+ sink::RgbaImage image;
+ if (!sink::readRgba8(ctx, ring, graph.videoFrameResource(out.videoSlot), image)) {
+ std::fprintf(stderr, "readback failed at frame %d\n", n);
+ return 1;
+ }
+ hashes.push_back(sha256Hex(image.pixels.data(), image.pixels.size()));
+ }
+ (void)ring.waitIdle();
+ graph.shutdown();
+
+ std::string json = std::format("{{\"case\":\"{}\",\"frames\":{},\"work\":\"{}x{}\",\"nr\":\"{}x{}\",\"hashes\":[",
+ caseName, hashes.size(), graph.workWidth(), graph.workHeight(), graph.nrWidth(), graph.nrHeight());
+ for (size_t n = 0; n < hashes.size(); ++n) json += (n ? ",\"" : "\"") + hashes[n] + "\"";
+ json += "]}\n";
+ std::fputs(json.c_str(), stdout);
+ if (!outPath.empty()) {
+ std::ofstream f(widen(outPath), std::ios::binary);
+ f << json;
+ if (!f) return 1;
+ }
+ return hashes.size() == size_t(frames) ? 0 : 3;
+}
diff --git a/tools/quality_probe/main.cpp b/tools/quality_probe/main.cpp
index b4c83208..1c688cbd 100644
--- a/tools/quality_probe/main.cpp
+++ b/tools/quality_probe/main.cpp
@@ -7,6 +7,7 @@
// readback on sampled frames - the normal playback path never reads back.
#include <windows.h>
#include <psapi.h>
+#include <shellapi.h>
#include <d3d12sdklayers.h>
#include <algorithm>
@@ -222,9 +223,32 @@ int main(int argc, char** argv)
int timeoutSeconds = 0;
std::string dumpPath;
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
+ // argv is in the ANSI code page, which cannot hold every Unicode path (the
+ // logs live under E:\项目). Take the arguments from the UTF-16 command line
+ // and keep them as UTF-8 in the std::string fields below.
+ std::vector<std::string> args;
+ {
+ int wideCount = 0;
+ LPWSTR* wide = CommandLineToArgvW(GetCommandLineW(), &wideCount);
+ for (int n = 0; wide && n < wideCount; ++n) {
+ const int bytes = WideCharToMultiByte(CP_UTF8, 0, wide[n], -1, nullptr, 0, nullptr, nullptr);
+ std::string utf8(bytes > 0 ? bytes - 1 : 0, '\0');
+ if (bytes > 1) WideCharToMultiByte(CP_UTF8, 0, wide[n], -1, utf8.data(), bytes, nullptr, nullptr);
+ args.push_back(std::move(utf8));
+ }
+ LocalFree(wide);
+ if (args.empty()) for (int n = 0; n < argc; ++n) args.emplace_back(argv[n]);
+ argc = int(args.size());
+ }
+ auto widen = [](const std::string& utf8) {
+ const int chars = MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, nullptr, 0);
+ std::wstring wide(chars > 0 ? chars - 1 : 0, L'\0');
+ if (chars > 1) MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, wide.data(), chars);
+ return wide;
+ };
for (int i = 1; i < argc; ++i) {
- const std::string arg = argv[i];
- auto value = [&]() -> std::string { return (i + 1 < argc) ? std::string(argv[++i]) : std::string(); };
+ const std::string arg = args[i];
+ auto value = [&]() -> std::string { return (i + 1 < argc) ? args[++i] : std::string(); };
if (arg == "--diag") diag = true;
else if(arg=="--legacy-motion")legacyMotion=true;
else if (arg == "--native") native = true;
@@ -260,14 +284,14 @@ int main(int argc, char** argv)
std::fprintf(stderr, "--corpus or --input required\n");
return 2;
}
- if (!logPath.empty()) (void)veyra::Logger::instance().openFile(std::wstring(logPath.begin(), logPath.end()));
+ if (!logPath.empty()) (void)veyra::Logger::instance().openFile(widen(logPath));
// Build the run list (single input looping, or every corpus clip).
struct RunClip { std::wstring path; std::string scenario; uint32_t w, h; };
std::vector<RunClip> clips;
std::string inputHashSource;
if (!inputPath.empty()) {
- clips.push_back({std::wstring(inputPath.begin(), inputPath.end()), "input",
+ clips.push_back({widen(inputPath), "input",
0, 0});
inputHashSource = inputPath;
} else {
@@ -286,7 +310,7 @@ int main(int argc, char** argv)
const size_t slash = corpusManifest.find_last_of("/\\");
const std::string base = slash == std::string::npos ? "." : corpusManifest.substr(0, slash);
const std::string full = base + "/" + rel;
- clips.push_back({std::wstring(full.begin(), full.end()), rel, 0, 0});
+ clips.push_back({widen(full), rel, 0, 0});
p = e;
}
if (clips.empty()) { noteFail("corpus manifest has no clips"); return 1; }
@@ -446,7 +470,7 @@ int main(int argc, char** argv)
if (!dumpPath.empty() && framesThisClip > 0) {
veyra::sink::RgbaImage image;
if (!veyra::sink::readRgba8(ctx, ring, graph.videoFrameResource(lastOut.videoSlot), image) ||
- !veyra::sink::saveImage(std::wstring(dumpPath.begin(),dumpPath.end()), image)) noteFail("diagnostic image write failed");
+ !veyra::sink::saveImage(widen(dumpPath), image)) noteFail("diagnostic image write failed");
}
aggNr += graph.metrics().nrEvaluateCount;
aggNrMotion += graph.metrics().nrMotionFrames;
@@ -533,7 +557,7 @@ int main(int argc, char** argv)
if (!jsonPath.empty()) {
(void)veyra::harness::util::writeTextFileUtf8(
- std::wstring(jsonPath.begin(), jsonPath.end()), j);
+ widen(jsonPath), j);
}
std::printf("%s", j.c_str());
veyra::Logger::instance().flush();