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++

phase-2: parity codec verified (gate 35/35 + reviewer PASS, ulp ruling accepted)

Veyra Goal Agente0250b5431ee
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 25e8986d..44b45f3c 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1,5 +1,40 @@
# Veyra Worklog
+## 2026-09-02 Phase 2 — RenoDX-equivalent parity codec (gate 35/35 + reviewer PASS)
+
+Goal:
+
+Implement the parity codec end to end: CPU golden reference (Playbook §9 exact math), ParityEncode/ParityDecode HLSL compiled at build time, the harness --parity-compare mode (Original FP16 → encode → 16 Feature-18 evaluates → decode → Final FP16), GPU-vs-CPU statistics, four-stage captures, and the phase2 gate.
+
+Changed:
+
+- include/veyra/parity + src/parity: RenoDxParityCodec (shoulder 0.75/5.7780, sRGB, six OkLab/AP1 matrices in mul(matrix,vector) direction, signed cbrt, HueOkLab, UpgradeToneMap two-stage, luminance-only).
+- tests/unit/ParityCpuReference.cpp: 12 golden checks (threshold continuity, neutral bypass identity, highlight luminance restoration, quantization bounds).
+- shaders/Parity{Encode,Decode}.hlsl + cmake shader targets; tools/nr_harness parity_compare mode + shared harness_util (PNG writer, JSON, stats).
+- scripts/gates/phase2.ps1: CPU tests both configs, GPU-vs-CPU tolerances, four-stage captures, neutral baseline + addon hash, raw≠final.
+
+Commands actually run (key evidence):
+
+- veyra_parity_tests: 12/12, 0 failures in both configs.
+- --parity-compare: encode maxCodeDelta=1 (≤1), maxAlphaDelta=0; decode beyondOneUlpCount=0, maxAbsError=0.00390625 (= exactly 1 FP16 ulp at [4,8)), nanInf=0; infoqueue stored=0 errors=0 (debug run persisted).
+- loop-gate -Gate phase2: 35/35 checks exit 0 (reproduced identically by the reviewer in an independent run).
+
+Reviewer outcome (P2.6):
+
+- First review: FAIL with 1×P1 (an evidence line about the debug parity run had no persisted artifact — same class as the Phase 1 P1) + 6×P2.
+- Fixes: unconditional infoqueue drain with counters into the JSON, a real persisted debug run, RNE float→half (matching GPU storage), alpha comparison, stage luma statistics into the JSON, stage JSON enriched with rowPitch/runtimeSha256/pts/source.
+- The RNE fix surfaced a real physical effect: highlight-amplified fp32-vs-double intermediate differences cross FP16 bucket boundaries (5038 of 2M pixels, every one exactly 1 ulp; bit-level examples in the log). The absolute 0.002 bound is mathematically unreachable at ≥4.0 for any correct fp32 pipeline, so the gate enforces diff ≤ max(0.002, 1×stored ulp) — the reviewer examined the worst-pixel evidence and accepted this ruling as the same-intent bound (0.002 verbatim below 4.0).
+- Final review: VERDICT PASS (three-way reproducible numbers, control plane untouched from the Phase 1 checkpoint). Three one-line P2s fixed immediately; two P2s filed for Phase 3 (--profile parsing, in-flight parameter-block reuse hardening).
+
+Decision:
+
+- All parity math comes from Playbook §9; every tolerance kept falsifiable; every claim backed by a persisted artifact.
+
+Next single task:
+
+Phase 3 P3.1: vcpkg/FFmpeg 310-baseline dependency acquisition + phase3 gate (fail-closed).
+
+
## 2026-09-02 Phase 1 — Feature 18 native harness (gate 54/55, one user-action item)
Goal:
diff --git a/loop/BACKLOG.md b/loop/BACKLOG.md
index f1f43e4b..29e5c998 100644
--- a/loop/BACKLOG.md
+++ b/loop/BACKLOG.md
@@ -35,7 +35,7 @@ Phase 0 gate:以 Playbook 第 16 节 Phase 0 为准。未完成 P0.9 禁止开
- [x] P2.3 实现 Parity Decode 与 Raw/bypass 对照;记录三个 1.0 中性 codec baseline、来源说明、addon hash 和 capture hash。当前没有 preset;不得加载 addon 取值。(2026-09-02:ParityDecode.hlsl;JSON 记录 1.0/1.0/1.0+addon 实测 hash+raw/final hash;addon 从未加载。)
- [x] P2.4 CPU/GPU golden、identity/bypass、灰阶/色卡/高光测试达到 Playbook 容差。(2026-09-02:encode≤1 code、decode≤0.002、CPU 12/12。)
- [x] P2.5 完整 Original→Encode→Feature18→Decode capture;不得以主观好看作为 gate。(2026-09-02:四阶段七文件捕获,raw≠final hash,量化统计非主观。)
-- [ ] P2.6 gate、只读 Reviewer、P0/P1 修复、checkpoint。
+- [x] P2.6 gate、只读 Reviewer、P0/P1 修复、checkpoint。(2026-09-02:首轮 FAIL 抓出 P1 空证据→修复后终判 PASS;ulp 容差裁定经裁决接受;checkpoint 见 STATE.phases[2].commit。)
## Phase 3 — Minimal video pipeline(锁定)
diff --git a/loop/EVIDENCE.md b/loop/EVIDENCE.md
index a18b5617..a04e87e3 100644
--- a/loop/EVIDENCE.md
+++ b/loop/EVIDENCE.md
@@ -17,7 +17,7 @@
调试记录:5 个缺陷由 debug layer infoQueue 定位——SRV MipLevels=0 触发 RemoveDevice;UAV range 双重偏移越界;NGX 后共享资源 DATA_STATIC bind 冲突(DESCRIPTORS_VOLATILE+前置 barrier);decode 容差含 FP16 量化(期望量化后比较)。CPU 黄金数学零改动。
-容差裁定记录(Reviewer 首轮 P1/P2 修复,2026-09-02):①P1——"debug parity run infoQueue 零错误"原先无持久化产物;已改为无条件 drain+计数入 JSON 并真实持久化 debug run(logs/phase2/debug-parity-run.log:stored=0 errors=0)。②量化器改 RNE(与 GPU 存储一致)后实测揭示:高光放大区(UpgradeToneMap ratio≈4.26×)fp32 与 double 的固有中间差(~0.05%)会跨越 FP16 桶边界(例证已留档:cpu=4.00763→RNE 4.0078125,GPU fp32≈4.0055→存 4.00390625;5038/2M 像素呈 ±1 ulp 分布,全部恰 1 ulp)。绝对 0.002 在 [4,8)(1 ulp=0.0039)对该管线数学上不可达,故 gate 落地为同意图界:每通道 diff ≤ max(0.002, 1×存储ulp),即 0.002 在可表示区强制、≥4.0 处等值 1 ulp——比原绝对界处处不宽。此项为对 Playbook 数字不可达性的显式裁定,提交 Reviewer 终审。
+容差裁定记录(Reviewer 首轮 P1/P2 修复,2026-09-02):①P1——"debug parity run infoQueue 零错误"原先无持久化产物;已改为无条件 drain+计数入 JSON 并真实持久化 debug run(logs/phase2/debug-parity-run.log:stored=0 errors=0)。②量化器改 RNE(与 GPU 存储一致)后实测揭示:高光放大区(UpgradeToneMap ratio≈4.26×)fp32 与 double 的固有中间差(~0.05%)会跨越 FP16 桶边界(例证已留档:cpu=4.00763→RNE 4.0078125,GPU fp32≈4.0055→存 4.00390625;5038/2M 像素呈 ±1 ulp 分布,全部恰 1 ulp)。裁定:可表示区(<4.0)与原 0.002 界逐字等同;≥4.0 区因绝对 0.002 对正确 fp32 管线数学不可达,裁定为恰 1 存储 ulp。经独立 Reviewer 终审接受(PASS)。
## Phase 1 / phase1 / 2026-09-02T22:20:00+08:00
diff --git a/loop/JOURNAL.md b/loop/JOURNAL.md
index 93bfed2f..a28b21e1 100644
--- a/loop/JOURNAL.md
+++ b/loop/JOURNAL.md
@@ -545,11 +545,30 @@ Result:
### After
-- 实际修改:
-- 实际命令与 exit code:
-- 新证据/日志路径:
-- 失败 fingerprint:
-- 本 fingerprint 第几次不同尝试:
-- 是否有进展,依据:
-- STATE/BACKLOG 更新:
-- 下一唯一动作:
+- Reviewer 首轮 FAIL(1×P1:EVIDENCE 中"debug parity run infoqueue 零错误"无持久化产物支撑;6×P2)→ 修复(aea851e):infoqueue 无条件 drain+计数入 JSON、真实持久化 debug run(stored=0 errors=0 PASS)、floatToHalf 改 RNE、encode 加 alpha 对比、stageLuma 入 JSON、阶段 JSON 补 rowPitch/runtimeSha256/pts/originalSource。
+- RNE 修复揭示真实物理现象:高光放大区 fp32-vs-double 双重舍入跨界(5038 像素全恰 1 ulp;位级例证留档日志)。gate 落地为 max(0.002, 1×存储ulp) 并提交 Reviewer 显式裁决。
+- Reviewer 终判 **PASS**(独立 run 304e1dda…,数值与 Maker run/持久化 debug run 三方一致;ulp 裁定接受并确认检测能力保留;RNE 评为 textbook)。剩 3 条一行级 P2 已顺手修复(措辞精确化/gate alpha 断言/日志级别 WARN)并复跑 gate 全绿(70 checks exit 0)。
+- 留档至 Phase 3 的两条 P2(Reviewer 同意):--profile 解析校验、参数块 in-flight 复用加固。
+- STATE/BACKLOG 更新:cycle.completed=20;P2.6 → DONE;phases[2] checkpoint 见 STATE。
+- 下一唯一动作: Phase 3 P3.1(vcpkg/FFmpeg 依赖 + phase3 gate)。
+
+---
+
+## Cycle 020 — P2.6 Reviewer 终判与 Phase 2 checkpoint
+
+### Before
+
+- Phase: 2
+- 唯一任务: Reviewer 修复循环(P1 闭合 + ulp 裁定 + P2 批)、终判 PASS 后 checkpoint 解锁 Phase 3。
+- 可证伪假设: P1 若未真实闭合(无持久化 debug 产物)Reviewer 维持 FAIL。
+- 预计修改文件: tools/nr_harness/parity_compare.cpp、scripts/gates/phase2.ps1、loop/{EVIDENCE,JOURNAL,BACKLOG,STATE}。
+- 快速检查命令: `loop-gate -Gate phase2` → 0。
+- 预期新增证据: 持久化 debug parity run、Reviewer PASS。
+
+### After
+
+- 实际命令与 exit code: 修复后 phase2 gate exit 0(35/35,run-id 85da3833…);Reviewer 独立复跑 0/0 PASS;P2 修整后再复跑 exit 0(70 checks)。
+- 新证据/日志路径: logs/phase2/{85da3833…,304e1dda…(Reviewer),debug-parity-run.log}。
+- 是否有进展,依据: Phase 2 完整闭环(gate+reviewer 双绿)。
+- STATE/BACKLOG 更新: phases[2] → passed + checkpoint;Phase 3 解锁。
+- 下一唯一动作: Phase 3 P3.1。
diff --git a/loop/STATE.json b/loop/STATE.json
index 8dd16711..92fab071 100644
--- a/loop/STATE.json
+++ b/loop/STATE.json
@@ -6,7 +6,7 @@
"phase": {
"id": 2,
"name": "RenoDX-equivalent parity codec",
- "state": "gate_passed",
+ "state": "review_passed",
"gate": "phase2"
},
"phases": [
@@ -29,9 +29,9 @@
{
"id": 2,
"name": "RenoDX-equivalent parity codec",
- "status": "gate_passed",
+ "status": "review_passed",
"gateEvidence": "loop/EVIDENCE.md#phase-2--phase2--2026-09-02t230500-0800",
- "reviewEvidence": null,
+ "reviewEvidence": "loop/EVIDENCE.md#phase-2--phase2--2026-09-02t230500-0800 (Reviewer PASS after P1 fix; independent run 304e1dda07784fa2b7c024ee5110289c; ulp ruling accepted)",
"commit": null
},
{
diff --git a/scripts/gates/phase2.ps1 b/scripts/gates/phase2.ps1
index 8b97ec5c..d9e347cb 100644
--- a/scripts/gates/phase2.ps1
+++ b/scripts/gates/phase2.ps1
@@ -120,9 +120,11 @@ catch {
Add-GateCheck "parity:run-id" ([string]$summary.runId -eq $runId) ("actual={0}" -f $summary.runId)
-# 4a. GPU encode vs CPU encode: max channel delta in 8-bit code values.
+# 4a. GPU encode vs CPU encode: max channel delta in 8-bit code values
+# (RGB and the pass-through alpha alike).
$encodeMaxCode = [double]$summary.encode.maxCodeDelta
-Add-GateCheck "parity:gpu-vs-cpu-encode-1code" ($encodeMaxCode -le 1.0) ("maxCodeDelta={0}" -f $encodeMaxCode)
+$encodeMaxAlpha = [double]$summary.encode.maxAlphaDelta
+Add-GateCheck "parity:gpu-vs-cpu-encode-1code" (($encodeMaxCode -le 1.0) -and ($encodeMaxAlpha -le 1.0)) ("maxCodeDelta={0} maxAlphaDelta={1}" -f $encodeMaxCode, $encodeMaxAlpha)
# 4b. GPU decode vs CPU decode: no NaN/Inf, and no channel beyond ONE stored
# FP16 ulp (abs <=0.002 enforced wherever FP16 represents it; above ~4.0
diff --git a/tools/nr_harness/parity_compare.cpp b/tools/nr_harness/parity_compare.cpp
index 3296e33b..f7aa3d3e 100644
--- a/tools/nr_harness/parity_compare.cpp
+++ b/tools/nr_harness/parity_compare.cpp
@@ -959,7 +959,7 @@ int runParityCompare(const FrameLoopArgs& args)
const double channelDiff = std::abs(static_cast<double>(actual[channel]) - expectedFp16[channel]);
if (channelDiff > 0.0025) {
const double cpuValue = channel == 0 ? expected.r : (channel == 1 ? expected.g : expected.b);
- log::error("harness", std::format("parity: worst pixel x={} y={} ch={} actual={:.9g} expectedFp16={:.9g} cpu={:.12g} actualBits={:04X} myExpectedBits={:04X}",
+ log::warn("harness", std::format("parity: one-ulp pixel x={} y={} ch={} actual={:.9g} expectedFp16={:.9g} cpu={:.12g} actualBits={:04X} myExpectedBits={:04X}",
x, y, channel, actual[channel], expectedFp16[channel], cpuValue,
static_cast<unsigned>(finalRow[x * 4 + channel]),
static_cast<unsigned>(floatToHalf(static_cast<float>(cpuValue)))));