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

Prepare 1.4.4 beta capture color controls

Veyra Goal Agent275f561ee84b
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5fe5b40a..774d6487 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.24)
-project(veyra VERSION 1.4.3 LANGUAGES CXX RC)
+project(veyra VERSION 1.4.4 LANGUAGES CXX RC)
# Shown in the EXE's version resource and in the package name. CMake versions
# must be numeric, so the beta marker lives here instead.
-set(VEYRA_DISPLAY_VERSION "1.4.3" CACHE STRING "Human-readable version string")
+set(VEYRA_DISPLAY_VERSION "1.4.4beta" CACHE STRING "Human-readable version string")
# The cache keeps the first value it ever saw, so a release that bumps
# project(VERSION) used to ship an EXE still stamped with the previous display
# string. Re-align it whenever the cached label does not start with the project
diff --git a/apps/veyra/ui/CapturePanel.cpp b/apps/veyra/ui/CapturePanel.cpp
index fc0d6b1a..7ce1e310 100644
--- a/apps/veyra/ui/CapturePanel.cpp
+++ b/apps/veyra/ui/CapturePanel.cpp
@@ -16,6 +16,13 @@ std::future<Query> pending;bool busy=false,refreshAfterQuery=false;int queriedDe
std::vector<source::CaptureFormat> formats;
std::vector<source::CaptureDevice> videoDevices,audioDevices;
CapturePreferences remembered;
+unsigned selectedColor(HWND h){return source::captureColorOverride(unsigned(SendDlgItemMessageW(h,10,CB_GETCURSEL,0,0)),unsigned(SendDlgItemMessageW(h,20,CB_GETCURSEL,0,0)));}
+void saveDeviceColor(HWND h){
+ const int device=int(SendDlgItemMessageW(h,1,CB_GETCURSEL,0,0));
+ if(device<0||size_t(device)>=videoDevices.size())return;
+ remembered.deviceColors[videoDevices[size_t(device)].path]=selectedColor(h);
+ if(!CapturePreferenceStore(runtime::localDataDirectory()).save(remembered))log::warn("capture","Failed to save capture color preference");
+}
std::function<bool()> readSdr;std::function<bool(bool)> setSdr;std::function<int()> readAudioIngress;std::function<bool(int)> setAudioIngress;
std::function<bool()> readFlip;std::function<bool(bool)> setFlip;
std::function<int()> readBuffer;std::function<bool(int)> setBuffer;
@@ -53,9 +60,10 @@ void maybeShowFormatHint(HWND h){
}
void query(int device){if(busy)return;busy=true;queriedDevice=device;queryStarted=GetTickCount64();SetDlgItemTextW(window,8,L"正在查询设备能力…当前播放继续");EnableWindow(GetDlgItem(window,4),FALSE);EnableWindow(GetDlgItem(window,5),FALSE);EnableWindow(GetDlgItem(window,1),FALSE);
const std::wstring videoPath=device>=0&&size_t(device)<videoDevices.size()?videoDevices[size_t(device)].path:L"";
+ EnableWindow(GetDlgItem(window,10),FALSE);EnableWindow(GetDlgItem(window,20),FALSE);
pending=std::async(std::launch::async,[device,videoPath]{CoInitializeEx(nullptr,COINIT_MULTITHREADED);Query result;result.device=device;try{if(device<0){result.video=source::CaptureCardSource::deviceDetails();result.audio=source::CaptureCardSource::deviceDetails(true);}else result.formats=videoPath.empty()?source::CaptureCardSource::formats(unsigned(device)):source::CaptureCardSource::formatsByPath(videoPath);}catch(...){}CoUninitialize();return result;});
}
-void arrange(){RECT r{};GetClientRect(window,&r);const int width=MulDiv(r.right,96,veyra::ui::layoutDpi(window));const int ys[]={0,44,114,184,448,448,14,84,380,154,254,224,294,514,484,602,566,542,338,342};for(int id=1;id<=19;++id){int x=id==5?width-152:id==18?width-156:16;int w=id==4?width-184:id==5||id==18?136:id==19?width-184:width-32;MoveWindow(GetDlgItem(window,id),dip(window,x),dip(window,ys[id]),dip(window,w),dip(window,(id<=3||id==10||id==13||id==16)?180:id==8?56:id==4||id==5?36:id==18?32:24),TRUE);}}
+void arrange(){RECT r{};GetClientRect(window,&r);const int width=MulDiv(r.right,96,veyra::ui::layoutDpi(window));const int ys[]={0,44,114,184,448,448,14,84,380,154,254,224,294,514,484,602,566,542,338,342,254,224};for(int id=1;id<=21;++id){int x=id==5?width-152:id==18?width-156:(id==20||id==21)?width-180:16;int w=id==4?width-184:id==5||id==18?136:id==19?width-184:(id==10||id==11)?width-212:(id==20||id==21)?164:width-32;MoveWindow(GetDlgItem(window,id),dip(window,x),dip(window,ys[id]),dip(window,w),dip(window,(id<=3||id==10||id==13||id==16||id==20)?180:id==8?56:id==4||id==5?36:id==18?32:24),TRUE);}}
LRESULT CALLBACK proc(HWND h,UINT msg,WPARAM wp,LPARAM lp){switch(msg){
case WM_CREATE:{window=h;font=makeFont(h);titleTheme(h);auto add=[&](const wchar_t* cls,const wchar_t* label,int id,DWORD style){auto c=CreateWindowExW(0,cls,label,WS_CHILD|WS_VISIBLE|style,0,0,1,1,h,HMENU(INT_PTR(id)),GetModuleHandleW(nullptr),nullptr);SendMessageW(c,WM_SETFONT,WPARAM(font),TRUE);themeControl(c);};
remembered=CapturePreferenceStore(runtime::localDataDirectory()).load();
@@ -65,7 +73,9 @@ case WM_CREATE:{window=h;font=makeFont(h);titleTheme(h);auto add=[&](const wchar
refreshAfterQuery=busy;
for(int i=1;i<=3;++i)add(L"COMBOBOX",L"",i,CBS_DROPDOWNLIST|WS_VSCROLL|WS_TABSTOP);
add(L"COMBOBOX",L"",10,CBS_DROPDOWNLIST|WS_VSCROLL|WS_TABSTOP);add(L"STATIC",L"输入颜色(变更需重连)",11,0);
- for(auto name:{L"自动识别 SDR / HDR · 设备元数据",L"手动 HDR10 / PQ · BT.2020",L"手动 HLG · BT.2020 / 1000nit参考"})SendDlgItemMessageW(h,10,CB_ADDSTRING,0,LPARAM(name));SendDlgItemMessageW(h,10,CB_SETCURSEL,0,0);
+ for(auto name:{L"自动 · 设备元数据",L"Rec.2100 PQ · HDR10",L"Rec.2100 HLG",L"Rec.709 · SDR"})SendDlgItemMessageW(h,10,CB_ADDSTRING,0,LPARAM(name));SendDlgItemMessageW(h,10,CB_SETCURSEL,0,0);
+ add(L"COMBOBOX",L"",20,CBS_DROPDOWNLIST|WS_VSCROLL|WS_TABSTOP);add(L"STATIC",L"输入范围",21,0);
+ for(auto name:{L"自动",L"有限 / Limited",L"完整 / Full"})SendDlgItemMessageW(h,20,CB_ADDSTRING,0,LPARAM(name));SendDlgItemMessageW(h,20,CB_SETCURSEL,0,0);
add(L"BUTTON",L"转为 SDR 显示(所有预览,立即生效)",12,BS_AUTOCHECKBOX|WS_TABSTOP);SendDlgItemMessageW(h,12,BM_SETCHECK,readSdr()?BST_CHECKED:BST_UNCHECKED,0);
add(L"COMBOBOX",L"",13,CBS_DROPDOWNLIST|WS_VSCROLL|WS_TABSTOP);add(L"STATIC",L"采集音频(变更需重连)",14,0);
for(auto name:{L"自动:优先线性 PCM,必要时 Dolby/DTS 位流解码",L"强制线性 PCM(不接受 Dolby/DTS 位流)",L"位流优先:优先直通给功放(无直通时解码为 PCM)"})SendDlgItemMessageW(h,13,CB_ADDSTRING,0,LPARAM(name));
@@ -105,8 +115,11 @@ case WM_TIMER:
const bool sameDevice=size_t(result.device)<videoDevices.size()&&videoDevices[size_t(result.device)].path==remembered.videoPath;
if(sameDevice&&!remembered.formatKey.empty()){
restore=-1;for(size_t i=0;i<formats.size();++i)if(formats[i].key==remembered.formatKey)restore=int(i);
- SendDlgItemMessageW(h,10,CB_SETCURSEL,remembered.colorOverride,0);
- }else SendDlgItemMessageW(h,10,CB_SETCURSEL,0,0);
+ }
+ const auto color=size_t(result.device)<videoDevices.size()?remembered.colorForDevice(videoDevices[size_t(result.device)].path):0;
+ SendDlgItemMessageW(h,10,CB_SETCURSEL,source::captureColorSpace(color),0);
+ SendDlgItemMessageW(h,20,CB_SETCURSEL,source::captureColorRange(color),0);
+ EnableWindow(GetDlgItem(h,10),TRUE);EnableWindow(GetDlgItem(h,20),TRUE);
SetDlgItemTextW(h,18,std::format(L"{:g}",sameDevice?remembered.requestedFps:0).c_str());
SendDlgItemMessageW(h,2,CB_SETCURSEL,restore,0);EnableWindow(GetDlgItem(h,4),restore>=0);
SetDlgItemTextW(h,8,formats.empty()?L"未读到有效的4K以内采集格式,或设备正被其他应用占用。":L"连接后使用当前增强设置。格式与音频变更需要重新连接。");
@@ -116,6 +129,7 @@ case WM_TIMER:
}else if(busy&&GetTickCount64()-queryStarted>5000)SetDlgItemTextW(h,8,L"设备查询耗时较长。可以关闭此面板,当前播放不受影响。");
return 0;
case WM_COMMAND:
+ if((LOWORD(wp)==10||LOWORD(wp)==20)&&HIWORD(wp)==CBN_SELCHANGE){saveDeviceColor(h);return 0;}
if(LOWORD(wp)==12&&HIWORD(wp)==BN_CLICKED){
const bool enabled=SendDlgItemMessageW(h,12,BM_GETCHECK,0,0)==BST_CHECKED;
if(!setSdr(enabled))SetDlgItemTextW(h,8,L"当前正在切换增强,请稍后再试。");
@@ -148,9 +162,10 @@ case WM_COMMAND:
const bool audioIndexValid=SendDlgItemMessageW(h,3,CB_GETCURSEL,0,0)!=CB_ERR&&(audio<0||size_t(audio)<audioDevices.size());
if(!busy&&device==queriedDevice&&format>=0&&size_t(format)<formats.size()&&device>=0&&size_t(device)<videoDevices.size()&&audioIndexValid){
const auto* audioDevice=audio>=0?&audioDevices[size_t(audio)]:nullptr;
- const auto path=source::CaptureCardSource::makeCapturePath(unsigned(device),videoDevices[size_t(device)],formats[size_t(format)].index,audio,audioDevice,unsigned(SendDlgItemMessageW(h,10,CB_GETCURSEL,0,0)),requestedFps);
+ const auto path=source::CaptureCardSource::makeCapturePath(unsigned(device),videoDevices[size_t(device)],formats[size_t(format)].index,audio,audioDevice,selectedColor(h),requestedFps);
if(!path.empty()){
- remembered={videoDevices[size_t(device)].path,formats[size_t(format)].key,audioDevice?audioDevice->path:L"",audioDevice?(audioDevice->wasapi?source::kCaptureAudioWasapi:0):audio,unsigned(SendDlgItemMessageW(h,10,CB_GETCURSEL,0,0)),remembered.formatHintDismissed,requestedFps};
+ auto colors=remembered.deviceColors;colors[videoDevices[size_t(device)].path]=selectedColor(h);
+ remembered={videoDevices[size_t(device)].path,formats[size_t(format)].key,audioDevice?audioDevice->path:L"",audioDevice?(audioDevice->wasapi?source::kCaptureAudioWasapi:0):audio,selectedColor(h),remembered.formatHintDismissed,requestedFps,std::move(colors)};
if(!CapturePreferenceStore(runtime::localDataDirectory()).save(remembered))log::warn("capture","Failed to save capture selection");
start(path);DestroyWindow(h);
}
diff --git a/apps/veyra/ui/CapturePreferenceStore.h b/apps/veyra/ui/CapturePreferenceStore.h
index b331943b..b51c397f 100644
--- a/apps/veyra/ui/CapturePreferenceStore.h
+++ b/apps/veyra/ui/CapturePreferenceStore.h
@@ -5,7 +5,9 @@
#include <iomanip>
#include <sstream>
#include <string>
+#include <map>
#include "veyra/source/CaptureFrameRate.h"
+#include "veyra/source/CaptureColorOverride.h"
namespace veyra::ui {
struct CapturePreferences {
@@ -15,6 +17,11 @@ struct CapturePreferences {
// N3: the one-time "this format is high cost" hint was already shown.
bool formatHintDismissed=false;
double requestedFps=0;
+ std::map<std::wstring,unsigned> deviceColors;
+ unsigned colorForDevice(const std::wstring& device)const {
+ const auto found=deviceColors.find(device);
+ return found!=deviceColors.end()?found->second:device==videoPath?colorOverride:0;
+ }
};
class CapturePreferenceStore {
std::filesystem::path path_;
@@ -29,15 +36,18 @@ public:
if(!file.read(reinterpret_cast<char*>(data.data()),size))return {};
std::wistringstream in(data);std::wstring magic;int version=0;CapturePreferences result;
if(!(in>>magic>>version>>std::quoted(result.videoPath)>>std::quoted(result.formatKey)>>result.audioMode>>std::quoted(result.audioPath)>>result.colorOverride)||
- magic!=L"VEYRA_CAPTURE"||(version<1||version>3)||result.audioMode< -3||result.audioMode>0||result.colorOverride>2)return {};
+ magic!=L"VEYRA_CAPTURE"||(version<1||version>4)||result.audioMode< -3||result.audioMode>0||!source::validCaptureColorOverride(result.colorOverride))return {};
if(version>=2){int dismissed=0;if(!(in>>dismissed)||(dismissed!=0&&dismissed!=1))return {};result.formatHintDismissed=dismissed!=0;}
if(version>=3&&(!(in>>result.requestedFps)||!source::validCaptureFrameRate(result.requestedFps)))return {};
+ if(version>=4){unsigned count=0;if(!(in>>count)||count>128)return {};for(unsigned i=0;i<count;++i){std::wstring device;unsigned color=0;if(!(in>>std::quoted(device)>>color)||device.empty()||!source::validCaptureColorOverride(color)||!result.deviceColors.emplace(device,color).second)return {};}}
in>>std::ws;return in.eof()?result:CapturePreferences{};
}
bool save(const CapturePreferences& p)const {
- if(p.audioMode< -3||p.audioMode>0||p.colorOverride>2||!source::validCaptureFrameRate(p.requestedFps))return false;
+ if(p.audioMode< -3||p.audioMode>0||!source::validCaptureColorOverride(p.colorOverride)||!source::validCaptureFrameRate(p.requestedFps)||p.deviceColors.size()>128)return false;
std::error_code ec;std::filesystem::create_directories(path_.parent_path(),ec);if(ec)return false;
- std::wostringstream out;out<<L"VEYRA_CAPTURE 3\n"<<std::quoted(p.videoPath)<<L' '<<std::quoted(p.formatKey)<<L' '<<p.audioMode<<L' '<<std::quoted(p.audioPath)<<L' '<<p.colorOverride<<L' '<<(p.formatHintDismissed?1:0)<<L' '<<std::setprecision(12)<<p.requestedFps<<L'\n';
+ std::wostringstream out;out<<L"VEYRA_CAPTURE 4\n"<<std::quoted(p.videoPath)<<L' '<<std::quoted(p.formatKey)<<L' '<<p.audioMode<<L' '<<std::quoted(p.audioPath)<<L' '<<p.colorOverride<<L' '<<(p.formatHintDismissed?1:0)<<L' '<<std::setprecision(12)<<p.requestedFps<<L'\n';
+ out<<p.deviceColors.size()<<L'\n';
+ for(const auto& [device,color]:p.deviceColors){if(device.empty()||!source::validCaptureColorOverride(color))return false;out<<std::quoted(device)<<L' '<<color<<L'\n';}
const auto data=out.str();if(data.size()>65536/sizeof(wchar_t))return false;const DWORD bytes=DWORD(data.size()*sizeof(wchar_t));
auto tmp=path_;tmp+=L".tmp-"+std::to_wstring(GetCurrentProcessId());
HANDLE file=CreateFileW(tmp.c_str(),GENERIC_WRITE,0,nullptr,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,nullptr);if(file==INVALID_HANDLE_VALUE)return false;
diff --git a/docs/RELEASE_NOTES_1.4.4.md b/docs/RELEASE_NOTES_1.4.4.md
new file mode 100644
index 00000000..11a001f0
--- /dev/null
+++ b/docs/RELEASE_NOTES_1.4.4.md
@@ -0,0 +1,16 @@
+# Veyra 1.4.4beta
+
+本地内测版,基于 1.4.3,未发布 GitHub 正式版本。
+
+- 采集卡新增独立的自动 / 有限 / 完整输入范围,以及手动 Rec.709 SDR。保留 PQ 与 HLG 输入选择。
+- 色彩空间和范围按设备保存,修改立即记忆;切换格式、帧率、刷新和重连保留该设备的选择。旧配置自动兼容。
+- 手动 HDR 使用 P010/P016。压缩采集继续读取码流元数据;不支持的手动组合明确报错,不静默忽略。
+- 修正混色器色相分区之间的响应缺口,以及跨越红色色相零点时的错误。保持原有调节幅度;旧预设在分区交界处的表现可能变化。
+
+Elgato 4K60 Pro MK.2 HDR 测试:选择 P010、Rec.2100 PQ、有限 / Limited 后重连。
+先关闭调色和增强,与 OBS 同一画面比较。P010 本身不能证明输入是 HDR。
+原生 HDR 仍按 PQ 绝对亮度输出,没有强加减红或二次色调映射。
+该设备的偏红问题尚待实卡反馈,不能将新增选项等同于根因已修复。
+
+本版不新增白点/峰值滑块。OBS 全局输出的 300/1400 nit 不直接等同于采集输入参数。
+运行组件身份、实验功能边界及 1.4.3 已知限制保留。
diff --git a/docs/REMOTEPLAY_BUILD_1.4.4.md b/docs/REMOTEPLAY_BUILD_1.4.4.md
new file mode 100644
index 00000000..63210bd3
--- /dev/null
+++ b/docs/REMOTEPLAY_BUILD_1.4.4.md
@@ -0,0 +1,13 @@
+# Veyra 1.4.4beta Build
+
+Local beta on codex/capture-color-144beta-20260920, based on main 05998da.
+Build using scripts/build-isolated.ps1 with DisplayVersion=1.4.4beta.
+Corresponding source archive records the exact Git commit.
+
+Remote Play is enabled, unchanged from 1.4.3. Chiaki-ng commit
+0e16950165f06e5c3291537c2eeba6e852be7120 and local patches under
+scripts/remoteplay/patches remain in use. Its AGPL-3.0-only with OpenSSL
+exception applies to the combined program; notices are under licenses/remoteplay.
+FFmpeg retains the PS5 H.264 256-slice patch and dav1d.
+Verified dependency source archives originally supplied for 1.4.1 are reused
+in the corresponding-source package. No proprietary SDK/runtime is in Git.
diff --git a/docs/RUNTIME_COMPONENTS_1.4.4.md b/docs/RUNTIME_COMPONENTS_1.4.4.md
new file mode 100644
index 00000000..98564dc3
--- /dev/null
+++ b/docs/RUNTIME_COMPONENTS_1.4.4.md
@@ -0,0 +1,12 @@
+# Veyra 1.4.4beta Runtime Components
+
+All runtime identities are unchanged from 1.4.3. No SDK or model is added.
+Per-file origins, hashes, versions, sizes and signatures are recorded in the
+three release-runtime-manifest.json files under runtime/experimental,
+runtime_local/intel/experimental and runtime_local/amd/fidelityfx.
+Community/Ampere NR modules retain their declared HashMismatch status.
+RTX Video HDR retains NVIDIA RTX Video SDK 1.1.0 TrueHDR, SHA256
+9A80575F247190C05FE80EAC0C4BAA1D0D4D932348F26808310B5EC4BF9EEB4B.
+Licenses are included under licenses/. Patched FFmpeg and dav1d are unchanged;
+licenses/FFMPEG-VEYRA-BUILD.json records binary provenance.
+Publisher identity auditing does not restrict user runtime replacement.
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 38463d58..5d6c8805 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1,5 +1,26 @@
# Veyra 工作记录
+## 2026-09-20 1.4.4beta 本地内测包
+
+在 `codex/capture-color-144beta-20260920` 接入采集卡输入色彩空间与范围选择:
+自动、Rec.2100 PQ、Rec.2100 HLG、Rec.709,以及自动/有限/完整范围。选择编码
+向后兼容旧的 0..2 值;新值在 `CaptureColorOverride.h` 中定义并经过严格校验。
+设置按 DirectShow 设备路径保存,跨格式/帧率切换与重连保留;旧 v1-v3 配置仍可读。
+原生手动 HDR 仅接受 P010/P016,压缩输入拒绝手动覆盖而继续使用码流 VUI,不再静默丢弃
+用户选择。同步包含色相分区和 hue wrap 修复。
+
+Build: `scripts/build-isolated.ps1`,`E:/项目/Veyra/build/color-mixer-hue-20260920`,
+DisplayVersion `1.4.4beta`,目标 `veyra`,exit 0。测试:`veyra_ui_contract_tests`、
+`veyra_capture_color_tests`、`veyra_color_grade_gpu_tests` 均 exit 0;日志在
+`E:/项目/Veyra/logs/capture-color-144beta-20260920/`。独立窗口检查确认颜色/范围控件
+不重叠且包含四个色彩空间、三个范围选项,截图在对应 `tests/.../dialog-window/`。
+
+便携包:`E:/项目/Veyra/test-packages/1.4.4beta/final/Veyra-1.4.4beta-win64-portable.zip`,
+472349725 bytes,SHA256 `2A2C8F37DC1F8E875B834B6072C8E7AF0B5B0052B40FDCF6A48BD72E762DA91B`。
+包内 120 个 payload 文件及 manifest 哈希通过。通用 portable-smoke 的 Video SR 项目在本机
+未通过(`VSR creation or GPU execution missing`,日志显示 `gpuSrP95Ms=0`);其余基础、NR、
+FG 和 UI/颜色测试通过,不能把该项写成通过。未进行真实 Elgato 实卡验收,未推送或发布 GitHub。
+
## 2026-09-20 1.4.3 publication verified
Released https://github.com/Likely7/Veyra-NRVideo/releases/tag/v1.4.3 as Latest,
@@ -5245,3 +5266,30 @@ and leaves the previously verified resize-fix package untouched. Existing
evidence/build paths are E:/项目/Veyra/tests/resize-hang-20260920 and
E:/项目/Veyra/build/slider-reset-20260919; no new binary artifacts, runtime
changes, publication or shutdown.
+# 2026-09-20 Color mixer hue coverage and circular conversion
+
+User reported weak/imprecise per-colour hue adjustments. Inspected the UI,
+CPU response bake and shared ingest shader. Fixed-radius 32-degree masks left
+only 0.01123 weight per adjacent band at the midpoint of a 60-degree gap.
+Hue-only masks now interpolate linearly between neighbouring centres on the
+ring; their weights sum to one. Existing +/-100 -> +/-30-degree centre scale
+is retained. An initial unverified +/-100-degree amplification was withdrawn.
+Saturation, brightness and B&W masks remain unchanged. Old nonzero hue presets
+can look different between band centres because the coverage bug is corrected.
+
+HsvToRgb now wraps shifted hue with frac before sector selection. Previously
+negative red shifts or values above 360 used the wrong sector. Corrected the
+old orange test's settings typo (enabled was assigned to s, not o); restored
+orange dominance coverage instead of accepting the earlier unexplained result.
+
+Build: scripts/build-isolated.ps1, build/color-mixer-hue-20260920, dependency
+cache build/frame-pacing-20260918/CMakeCache.txt, targets veyra,
+veyra_color_grade_tests and veyra_color_grade_gpu_tests, DisplayVersion 1.4.3.
+Build exited 0. CPU tests exited 0. Initial GPU launch failed with missing DLL
+(-1073741515); rerun with the configured patched FFmpeg bin on process PATH
+exited 0, including red +/- hue direction and existing real-graph regressions.
+Tests used run-short-test.ps1 with 60/120-second watchdogs. Logs are under
+E:/项目/Veyra/logs/color-mixer-hue-20260920/{cpu,gpu,gpu-runtime}.*.log;
+build and process-local tmp are under the matching E:/项目/Veyra directories.
+git diff --check passed. No PS/LR visual equivalence or user-image acceptance
+claimed; no packaging, publication, runtime changes or additional GPU pass.
diff --git a/include/veyra/source/CaptureCardSource.h b/include/veyra/source/CaptureCardSource.h
index 2eb5e192..c2a76b72 100644
--- a/include/veyra/source/CaptureCardSource.h
+++ b/include/veyra/source/CaptureCardSource.h
@@ -1,5 +1,6 @@
#pragma once
#include "veyra/source/IFrameSource.h"
+#include "veyra/source/CaptureColorOverride.h"
#include <memory>
#include <string_view>
#include <vector>
diff --git a/include/veyra/source/CaptureColorOverride.h b/include/veyra/source/CaptureColorOverride.h
new file mode 100644
index 00000000..4a4ffc65
--- /dev/null
+++ b/include/veyra/source/CaptureColorOverride.h
@@ -0,0 +1,23 @@
+#pragma once
+#include "veyra/pipeline/FramePacket.h"
+
+namespace veyra::source {
+// Persisted connection value: low two bits = auto/PQ/HLG/709;
+// next two bits = auto/limited/full. Legacy values 0..2 retain their meaning.
+constexpr unsigned captureColorSpace(unsigned value) { return value & 3u; }
+constexpr unsigned captureColorRange(unsigned value) { return value >> 2; }
+constexpr unsigned captureColorOverride(unsigned space,unsigned range) { return space | (range << 2); }
+constexpr bool validCaptureColorOverride(unsigned value) { return value <= 11; }
+inline void applyCaptureColorOverride(pipeline::ColorDescription& color,unsigned value) {
+ using namespace pipeline;
+ const auto space=captureColorSpace(value),range=captureColorRange(value);
+ if(space) {
+ color.transfer=space==1?TransferFunction::PQ:space==2?TransferFunction::HLG:TransferFunction::BT709;
+ color.matrix=space==3?YuvMatrix::BT709:YuvMatrix::BT2020NCL;
+ color.primaries=space==3?ColorPrimaries::BT709:ColorPrimaries::BT2020;
+ color.preserveSdrCodeValues=space==3;
+ color.transferAssumed=color.matrixAssumed=color.primariesAssumed=false;
+ }
+ if(range) { color.range=range==1?ColorRange::Limited:ColorRange::Full;color.rangeAssumed=false; }
+}
+}
diff --git a/scripts/acceptance/ui-capture-color.py b/scripts/acceptance/ui-capture-color.py
new file mode 100644
index 00000000..eacaa955
--- /dev/null
+++ b/scripts/acceptance/ui-capture-color.py
@@ -0,0 +1,82 @@
+"""Inspect the capture dialog in an owned beta process, without connecting a device."""
+import ctypes as c
+from ctypes import wintypes as w
+import json
+import os
+from pathlib import Path
+import subprocess
+import sys
+import time
+from PIL import ImageGrab
+
+exe, out = Path(sys.argv[1]).resolve(), Path(sys.argv[2]).resolve()
+out.mkdir(parents=True, exist_ok=True)
+os.environ['TEMP'] = os.environ['TMP'] = str(out)
+u = c.WinDLL('user32')
+u.SetProcessDpiAwarenessContext.argtypes = [w.HANDLE]
+u.SetProcessDpiAwarenessContext(c.c_void_p(-4))
+u.GetDlgItem.argtypes = [w.HWND, c.c_int]
+u.GetDlgItem.restype = w.HWND
+u.GetWindowRect.argtypes = [w.HWND, c.POINTER(w.RECT)]
+u.GetWindowThreadProcessId.argtypes = [w.HWND, c.POINTER(w.DWORD)]
+u.GetClassNameW.argtypes = [w.HWND, w.LPWSTR, c.c_int]
+u.SendMessageTimeoutW.argtypes = [w.HWND, w.UINT, w.WPARAM, w.LPARAM, w.UINT, w.UINT, c.POINTER(c.c_size_t)]
+u.ShowWindow.argtypes = [w.HWND, c.c_int]
+visit_type = c.WINFUNCTYPE(w.BOOL, w.HWND, w.LPARAM)
+
+def find(name):
+ found = []
+ @visit_type
+ def visit(hwnd, unused):
+ pid, cls = w.DWORD(), c.create_unicode_buffer(128)
+ u.GetWindowThreadProcessId(hwnd, c.byref(pid))
+ u.GetClassNameW(hwnd, cls, 128)
+ if pid.value == process.pid and cls.value == name:
+ found.append(hwnd)
+ return True
+ u.EnumWindows(visit, 0)
+ return found[0] if found else None
+
+def send(hwnd, msg, first=0, second=0):
+ value = c.c_size_t()
+ assert u.SendMessageTimeoutW(hwnd, msg, first, second, 2, 1500, c.byref(value)), 'UI unresponsive'
+ return value.value
+
+def wait(name):
+ for _ in range(200):
+ hwnd = find(name)
+ if hwnd:
+ return hwnd
+ assert process.poll() is None, 'early process exit'
+ time.sleep(.05)
+ raise AssertionError('missing window: ' + name)
+
+def rect(hwnd):
+ value = w.RECT()
+ assert u.GetWindowRect(hwnd, c.byref(value))
+ return [value.left, value.top, value.right, value.bottom]
+
+with (out/'stdout.log').open('w') as stdout, (out/'stderr.log').open('w') as stderr:
+ startup = subprocess.STARTUPINFO()
+ startup.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+ startup.wShowWindow = 0
+ process = subprocess.Popen([str(exe), '--smoke-empty', '--smoke-seconds', '45', '--no-nr', '--no-sr', '--no-fg'], cwd=out, stdout=stdout, stderr=stderr, startupinfo=startup)
+ try:
+ main = wait('VeyraApp')
+ send(main, 0x111, 110)
+ dialog = wait('VeyraCaptureSetup')
+ u.ShowWindow(dialog, 4)
+ time.sleep(1)
+ color, span = u.GetDlgItem(dialog, 10), u.GetDlgItem(dialog, 20)
+ assert send(color, 0x146) == 4 and send(span, 0x146) == 3, 'missing color choices'
+ a, b, outer = rect(color), rect(span), rect(dialog)
+ assert a[2] <= b[0] and outer[0] <= a[0] and b[2] <= outer[2], 'overlapping color controls'
+ ImageGrab.grab(window=dialog).save(out/'capture-color.png')
+ send(dialog, 0x10)
+ send(main, 0x10)
+ assert process.wait(timeout=15) == 0
+ (out/'result.json').write_text(json.dumps(dict(passed=True, colorRect=a, rangeRect=b, scope='Owned-process dialog geometry and options; no real-card color acceptance.'), indent=2))
+ finally:
+ if process.poll() is None:
+ process.kill()
+ process.wait()
diff --git a/shaders/ColorGrade.hlsli b/shaders/ColorGrade.hlsli
index 7306aab5..5f25c29e 100644
--- a/shaders/ColorGrade.hlsli
+++ b/shaders/ColorGrade.hlsli
@@ -108,7 +108,7 @@ float3 RgbToHsv(float3 c)
}
float3 HsvToRgb(float3 hsv)
{
- const float h = hsv.x / 60.0;
+ const float h = frac(hsv.x / 360.0) * 6.0;
const float c = hsv.z * hsv.y;
const float x = c * (1.0 - abs(fmod(h, 2.0) - 1.0));
const float m = hsv.z - c;
diff --git a/src/pipeline/ColorGradeTables.cpp b/src/pipeline/ColorGradeTables.cpp
index a257c45a..1bad7150 100644
--- a/src/pipeline/ColorGradeTables.cpp
+++ b/src/pipeline/ColorGradeTables.cpp
@@ -217,15 +217,23 @@ ColorGradeTables ColorGradeTables::bake(const engine::ColorSettings& s){
float shift=0,sat=1,lum=1,bw=0;
constexpr float centres[engine::kColorMixerBands]={0,30,60,120,180,240,280,320};
for(int b=0;b<engine::kColorMixerBands;++b){
- float d=std::abs(hue-centres[b]);
- d=std::min(d,360.0f-d);
- // Half-width 32 degrees with a smoothstep falloff: wide enough for a
- // colour range, narrow enough that the red band does not drag orange
- // (skin) along with it. The shader matches these bands against the
- // display-referred hue, so the centres are the hues users see.
- const float t=std::max(0.0f,1.0f-d/32.0f);
+ // Use a continuous triangular mask between adjacent hue centres.
+ // The old fixed 32-degree radius left large gaps (for example around
+ // 90/150/210 degrees), so a slider could appear to do nothing for
+ // perfectly valid colours. The ring topology also makes magenta ->
+ // red wrap around without a seam.
+ const int prev=(b+engine::kColorMixerBands-1)%engine::kColorMixerBands;
+ const int next=(b+1)%engine::kColorMixerBands;
+ const float left=centres[b]-centres[prev]+(b==0?360.0f:0.0f);
+ const float right=centres[next]-centres[b]+(next==0?360.0f:0.0f);
+ const float delta=std::remainder(hue-centres[b],360.0f);
+ const float hueWeight=std::max(0.0f,1.0f-std::abs(delta)/(delta<0?left:right));
+ // Preserve the established UI scale: +/-100 is approximately +/-30
+ // degrees at the centre of a band, as in existing saved presets.
+ shift+=hueWeight*s.mixerHue[std::size_t(b)]*0.3f;
+ // Keep existing saturation, brightness and B&W preset responses.
+ const float t=std::max(0.0f,1.0f-std::abs(delta)/32.0f);
const float w=t*t*(3.0f-2.0f*t);
- shift+=w*s.mixerHue[std::size_t(b)]*0.3f;
sat*=1.0f+w*s.mixerSaturation[std::size_t(b)]/100.0f;
lum*=1.0f+w*s.mixerLuminance[std::size_t(b)]/100.0f;
// Black & white mixer: per-band lighten/darken of the monochrome
diff --git a/src/source/CaptureCardSource.cpp b/src/source/CaptureCardSource.cpp
index f3236d14..a7e802b2 100644
--- a/src/source/CaptureCardSource.cpp
+++ b/src/source/CaptureCardSource.cpp
@@ -210,13 +210,13 @@ bool parseCapturePath(std::wstring_view path,CaptureSelection& selection){
if(path.starts_with(prefix)){
std::array<std::wstring_view,5> fields{};size_t cursor=prefix.size();
for(size_t i=0;i<fields.size();++i){const size_t end=path.find(L':',cursor);if(i+1<fields.size()){if(end==std::wstring_view::npos)return false;fields[i]=path.substr(cursor,end-cursor);cursor=end+1;}else{if(end!=std::wstring_view::npos)return false;fields[i]=path.substr(cursor);}}
- if(fields[0].empty()||!decodePath(fields[0],selection.videoPath)||!parseInt(fields[1],selection.format)||!parseInt(fields[2],selection.audio)||!decodePath(fields[3],selection.audioPath)||!parseUnsigned(fields[4],selection.colorOverride)||selection.format<0||selection.colorOverride>2)return false;
+ if(fields[0].empty()||!decodePath(fields[0],selection.videoPath)||!parseInt(fields[1],selection.format)||!parseInt(fields[2],selection.audio)||!decodePath(fields[3],selection.audioPath)||!parseUnsigned(fields[4],selection.colorOverride)||selection.format<0||!validCaptureColorOverride(selection.colorOverride))return false;
if(selection.audio!=kCaptureAudioDisabled&&selection.audio!=kCaptureAudioFromVideoDevice&&selection.audio!=kCaptureAudioWasapi&&selection.audio<0)return false;
if((selection.audio>=0||selection.audio==kCaptureAudioWasapi)&&selection.audioPath.empty())return false;selection.stable=true;return true;
}
unsigned videoIndex=0,colorOverride=0;int format=0,audio=kCaptureAudioDisabled;const std::wstring legacy(path);
const int fields=swscanf_s(legacy.c_str(),L"capture:%u:%d:%d:%u",&videoIndex,&format,&audio,&colorOverride);
- if(fields<3||format<0||audio<kCaptureAudioFromVideoDevice||colorOverride>2)return false;
+ if(fields<3||format<0||audio<kCaptureAudioFromVideoDevice||!validCaptureColorOverride(colorOverride))return false;
selection.videoIndex=videoIndex;selection.format=format;selection.audio=audio;selection.colorOverride=fields>=4?colorOverride:0;return true;
}
}
@@ -471,7 +471,7 @@ std::vector<CaptureDevice> CaptureCardSource::deviceDetails(bool audio){
}
std::vector<std::wstring> CaptureCardSource::devices(bool audio){std::vector<std::wstring> result;for(auto& device:deviceDetails(audio))result.push_back(std::move(device.name));return result;}
std::wstring CaptureCardSource::makeCapturePath(unsigned videoIndex,const CaptureDevice& video,int format,int audioMode,const CaptureDevice* audio,unsigned colorOverride,double requestedFps){
- if(!validCaptureFrameRate(requestedFps))return {};
+ if(!validCaptureFrameRate(requestedFps)||!validCaptureColorOverride(colorOverride))return {};
const auto suffix=requestedFps>0?std::format(L"?fps={:.6f}",requestedFps):L"";
if(audio&&audio->wasapi){
if(video.path.empty()||audio->path.empty())return {};
@@ -693,13 +693,13 @@ bool CaptureCardSource::configure(const SourceOpenDesc& desc){close();error_.cle
if(p.cpuUnpack&&captureLegacyCpuLayout(p.layout))log::warn("capture-unpack",std::format("legacy CPU unpack path active packing={} format={} (per-pixel conversion stays on the callback thread)",int(p.layout.packing),int(p.layout.format)));
const unsigned colorOverride=selection.colorOverride;
log::info("capture-color",std::format("driver controlFlags=0x{:08X} colorInfoPresent={} transfer={} matrix={} primaries={} chroma={} override={}",p.layout.colorControlFlags,bool(p.layout.colorControlFlags&AMCONTROL_COLORINFO_PRESENT),int(p.layout.color.transfer),int(p.layout.color.matrix),int(p.layout.color.primaries),int(p.layout.color.chromaLocation),colorOverride));
- if(colorOverride>2)return false;
- if(colorOverride&&!compressedPath){
- if(p.layout.format!=AV_PIX_FMT_P010&&p.layout.format!=AV_PIX_FMT_P016){log::error("capture-color","Explicit HDR requires P010/P016; select a 10/16-bit capture format");return false;}
- p.layout.color.transfer=colorOverride==1?pipeline::TransferFunction::PQ:pipeline::TransferFunction::HLG;
- p.layout.color.matrix=pipeline::YuvMatrix::BT2020NCL;p.layout.color.primaries=pipeline::ColorPrimaries::BT2020;
- p.layout.color.transferAssumed=p.layout.color.matrixAssumed=p.layout.color.primariesAssumed=false;
- log::info("capture-color",std::format("manual override={} BT2020; range retains negotiated metadata",colorOverride==1?"PQ":"HLG"));
+ if(!validCaptureColorOverride(colorOverride))return false;
+ if(colorOverride){
+ if(compressedPath){error_=L"压缩采集使用码流颜色信息;手动颜色和范围请选择原生采集格式。";log::error("capture-color","Manual color override requires raw capture; compressed override is not silently ignored");return false;}
+ const auto space=captureColorSpace(colorOverride);
+ if((space==1||space==2)&&p.layout.format!=AV_PIX_FMT_P010&&p.layout.format!=AV_PIX_FMT_P016){error_=L"手动 HDR 需要 P010/P016 格式;SDR 信号请选择自动或 Rec.709。";log::error("capture-color","Explicit HDR requires P010/P016");return false;}
+ applyCaptureColorOverride(p.layout.color,colorOverride);
+ log::info("capture-color",std::format("manual space={} range={} effective transfer={} matrix={} primaries={} range={} (0=auto, space 1=PQ 2=HLG 3=709, range 1=limited 2=full)",space,captureColorRange(colorOverride),int(p.layout.color.transfer),int(p.layout.color.matrix),int(p.layout.color.primaries),int(p.layout.color.range)));
}
p.info={};p.info.kind=pipeline::SourceKind::CaptureCard;p.info.width=p.layout.width;p.info.height=p.layout.height;p.info.averageFps=p.layout.duration>0?1e7/p.layout.duration:0;p.info.duration=pipeline::Rational::unknown();p.info.color=p.layout.color;
if(selection.requestedFps>0){
diff --git a/tests/integration/ColorGradeGpuTests.cpp b/tests/integration/ColorGradeGpuTests.cpp
index 12651d31..d1a6bfff 100644
--- a/tests/integration/ColorGradeGpuTests.cpp
+++ b/tests/integration/ColorGradeGpuTests.cpp
@@ -143,6 +143,19 @@ Pixel center(const sink::RgbaImage& image){
}
}
int wmain(){
+ {
+ Graph graph;Frame red;
+ bool ready=graph.start(true)&&red.make(200,0,0);
+ for(float amount:{-100.0f,100.0f}){
+ engine::EnhancementSettings settings;settings.color.enabled=true;
+ settings.color.mixerHue[0]=amount;
+ sink::RgbaImage image;
+ const bool rendered=ready&&graph.apply(settings)&&graph.render(red,image)&&!image.pixels.empty();
+ const auto p=rendered?center(image):Pixel{};
+ check(rendered&&p.r>150&&(amount<0?(p.b>60&&p.g<5):(p.g>60&&p.b<5)),
+ amount<0?"negative red hue wraps towards magenta":"positive red hue moves towards orange");
+ }
+ }
for(bool rgb:{true,false}){
Graph graph;Frame frame;
bool ok=graph.start(true,rgb);
diff --git a/tests/unit/ColorGradeTableTests.cpp b/tests/unit/ColorGradeTableTests.cpp
index f869c91b..c7fce319 100644
--- a/tests/unit/ColorGradeTableTests.cpp
+++ b/tests/unit/ColorGradeTableTests.cpp
@@ -214,19 +214,30 @@ int main(){
s.mixerHue[0]=100.0f; // red band shifted hard
const auto redOnly=ColorGradeTables::bake(s);
const int skinIndex=int(30.0f/360.0f*kH); // ~orange
- const int orangeIndex=int(30.0f/360.0f*kH);
const float redAtSkin=hueAt(redOnly,skinIndex,0);
- ColorSettings o;s.enabled=true;o.mixerHue[1]=100.0f; // orange band shifted hard
- const auto orangeOnly=ColorGradeTables::bake(o);
- // NOTE: an assertion that the orange band *dominates* a skin-tone hue was
- // dropped again - baking a single shifted band (index >= 1) came back as
- // the identity table for reasons this session did not explain, and a test
- // that only passes sometimes is worse than none. Tracked in WORKLOG.
check(std::abs(redAtSkin)<6.0f,"the red band only nudges skin tones (narrow smooth falloff)");
check(std::abs(hueAt(redOnly,0,0))>15.0f,"the red band still moves an actual red strongly");
- check(std::abs(redAtSkin)<6.0f,"the red band only nudges skin tones (narrow smooth falloff)");
const int deepRed=0;
check(std::abs(hueAt(redOnly,deepRed,0))>15.0f,"the red band still moves an actual red strongly");
+
+ // Adjacent bands must cover the gaps between their centres, while a
+ // single band remains isolated at the neighbouring centre.
+ ColorSettings yellow;yellow.enabled=true;yellow.mixerHue[2]=100.0f;
+ const auto yellowOnly=ColorGradeTables::bake(yellow);
+ check(std::abs(hueAt(yellowOnly,int(90.0f/360.0f*kH),0))>10.0f,
+ "the yellow band has continuous coverage through the yellow-green gap");
+ check(std::abs(hueAt(yellowOnly,int(120.0f/360.0f*kH),0))<1.0f,
+ "the yellow band fades at the green centre");
+ ColorSettings orange;orange.enabled=true;orange.mixerHue[1]=100.0f;
+ check(hueAt(ColorGradeTables::bake(orange),skinIndex,0)>27.0f,
+ "orange controls skin hue; the test must enable its own settings");
+ ColorSettings all;all.enabled=true;all.mixerHue.fill(100.0f);
+ const auto uniform=ColorGradeTables::bake(all);
+ bool covered=true;
+ for(int i=0;i<kH;++i)covered&=std::abs(hueAt(uniform,i,0)-30.0f)<1e-4f;
+ check(covered,"equal hue adjustments cover the entire ring without gaps or overlaps");
+ check(std::abs(hueAt(redOnly,0,0)-hueAt(redOnly,kH-1,0))<1e-5f,
+ "red hue response joins continuously at the ring seam");
}
if(failures){std::printf("FAIL: colour grade bake (%d checks)\n",failures);return 1;}
std::printf("PASS: colour grade bake tables (identity, white balance, tone, curves, mixer, grading, lut)\n");
diff --git a/tests/unit/UiContractTests.cpp b/tests/unit/UiContractTests.cpp
index a0c06e85..b567b846 100644
--- a/tests/unit/UiContractTests.cpp
+++ b/tests/unit/UiContractTests.cpp
@@ -66,6 +66,19 @@ int wmain(int argc,wchar_t** argv){try{
const auto restored=store.load();require(restored.videoPath==p.videoPath&&restored.formatKey==p.formatKey&&restored.audioPath==p.audioPath&&restored.audioMode==p.audioMode&&restored.colorOverride==p.colorOverride,"capture stable identifiers and Unicode round trip");
for(double fps:{0.0,29.97,30.0,40.0,50.0,60.0}){p.requestedFps=fps;require(store.save(p)&&store.load().requestedFps==fps,"device capture rate survives restart");}
p.requestedFps=-1;require(!store.save(p),"invalid capture rate not persisted");
+ p.requestedFps=0;p.colorOverride=5;p.deviceColors={{L"card-A",5},{L"card-B",10}};
+ require(store.save(p),"per-device capture color save");
+ const auto profiles=store.load();
+ require(profiles.colorForDevice(L"card-A")==5&&profiles.colorForDevice(L"card-B")==10&&profiles.colorForDevice(L"new-card")==0,"independent device PQ limited and HLG full survive restart");
+ p.colorOverride=12;require(!store.save(p),"invalid packed color rejected");
+ for(unsigned space=0;space<4;++space)for(unsigned range=0;range<3;++range){
+ const unsigned packed=source::captureColorOverride(space,range);
+ pipeline::ColorDescription color; color.range=pipeline::ColorRange::Full;
+ source::applyCaptureColorOverride(color,packed);
+ require(source::validCaptureColorOverride(packed)&&source::captureColorSpace(packed)==space&&source::captureColorRange(packed)==range,"capture color encoding round trip");
+ require(color.range==(range==1?pipeline::ColorRange::Limited:pipeline::ColorRange::Full),"range auto preserves metadata, manual wins");
+ if(space)require(color.transfer==(space==1?pipeline::TransferFunction::PQ:space==2?pipeline::TransferFunction::HLG:pipeline::TransferFunction::BT709)&&!color.transferAssumed&&!color.matrixAssumed&&color.preserveSdrCodeValues==(space==3),"manual color transfer and SDR preservation contract");
+ }
for(int version:{1,2}){
std::wstring legacy=L"VEYRA_CAPTURE "+std::to_wstring(version)+L"\n\"video\" \"format\" -1 \"\" 0"+(version==2?L" 1":L"")+L"\n";
{std::ofstream file(std::filesystem::path(argv[1])/"capture-preferences.v1",std::ios::binary|std::ios::trunc);file.write(reinterpret_cast<const char*>(legacy.data()),std::streamsize(legacy.size()*sizeof(wchar_t)));}