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++
feat(color): curve endpoints draggable, drop parametric curve sliders, mixer shows all three rows with a B&W switch, display-referred band matching (32deg smooth falloff), grading header spacing
Veyra Goal Agent65aa08bab01d
diff --git a/apps/veyra/SettingsWindow.cpp b/apps/veyra/SettingsWindow.cppindex 2a049a1b..6f251280 100644--- a/apps/veyra/SettingsWindow.cpp+++ b/apps/veyra/SettingsWindow.cpp@@ -143,6 +143,7 @@ constexpr int colorMixerModeId=830,colorBandsId=831;constexpr const wchar_t* kColorBandsClass=L"VeyraColorBands";int colourMixerMode=0; // 0 hue, 1 saturation, 2 luminance, 3 black & whiteint colourMixerBand=0; // 0..7, the eight colour ranges+bool colourBlackWhite=false; // the mixer's black & white switch// Tone-curve editor: which channel is being edited (0 RGB, 1 R, 2 G, 3 B) and// which control point is being dragged.constexpr int colorCurveCanvasId=850,colorCurveChannelId=851,colorCurveResetId=855;@@ -256,6 +257,7 @@ void layoutColorPage(){if(section==4){// body width is not in scope here; the viewport width is enough to// split the wheel grid into two columns.+ y+=12; // keep the section title clear of the wheelsconst int cellWidth=std::max<int>(dip(window,120),(bodyWidthDip-24-8)/2);place(colorWheelId(0),y,190,collapsed,12,cellWidth);place(colorWheelId(1),y,190,collapsed,12+cellWidth+8,cellWidth);@@ -266,8 +268,11 @@ void layoutColorPage(){// Mixer header: correction dropdown + the eight colour ranges. The 24// rows stay in the table but only the selected range is on screen.if(section==3){- place(colorMixerModeId,y,30,collapsed,12,bodyWidthDip-24);y+=36;- place(colorBandsId,y,34,collapsed,12,bodyWidthDip-24);y+=42;+ // No correction dropdown: the three mixer rows are always on screen+ // for the selected colour range; the B&W row appears when the switch+ // is on (that switch IS the black & white mixer).+ place(colorMixerModeId,y,30,collapsed,12,bodyWidthDip-24);y+=34;+ place(colorBandsId,y,32,collapsed,12,bodyWidthDip-24);y+=40;}// Tone curve: channel tabs + reset, then the grid canvas.if(section==2){@@ -283,7 +288,9 @@ void layoutColorPage(){const auto& param=colorParams[i];if(param.section!=section)continue;const int mode=mixerModeOf(param);- const bool hidden=collapsed||(mode>=0&&(mode!=colourMixerMode||param.index!=colourMixerBand));+ // Hue/saturation/luminance always visible for the selected band; the+ // black & white row only while the B&W switch is on.+ const bool hidden=collapsed||(mode>=0&&(param.index!=colourMixerBand||(mode==3&&!colourBlackWhite)));place(colorLabelId(int(i)),y,24,hidden);place(colorEditId(int(i)),y-2,26,hidden);place(colorSliderId(int(i)),y+24,16,hidden);@@ -316,7 +323,8 @@ void syncColorControls(){}}if(auto space=item(819))if(int(SendMessageW(space,CB_GETCURSEL,0,0))!=colour.lutInputSpace)SendMessageW(space,CB_SETCURSEL,WPARAM(colour.lutInputSpace),0);- if(auto mode=item(colorMixerModeId))if(int(SendMessageW(mode,CB_GETCURSEL,0,0))!=colourMixerMode)SendMessageW(mode,CB_SETCURSEL,WPARAM(colourMixerMode),0);+ colourBlackWhite=colour.blackWhite;+ check(colorMixerModeId,colourBlackWhite?BST_CHECKED:BST_UNCHECKED);if(auto bands=item(colorBandsId))InvalidateRect(bands,nullptr,FALSE);if(auto canvas=item(colorCurveCanvasId))InvalidateRect(canvas,nullptr,FALSE);for(int channel=0;channel<4;++channel)if(auto tab=item(colorCurveChannelId+channel))selected(tab,channel==colourCurveChannel);@@ -681,7 +689,7 @@ void registerToneCurveClass(){engine::ColorCurvePoint added{};added.x=std::clamp(float(cursor.x-canvas.left)/float(std::max<int>(1,canvas.right-canvas.left)),0.0f,1.0f);added.y=std::clamp(float(canvas.bottom-cursor.y)/float(std::max<int>(1,canvas.bottom-canvas.top)),0.0f,1.0f);- int slot=curve.count;+ int slot=curve.count;for(int i=0;i<curve.count;++i)if(curve.points[std::size_t(i)].x>added.x){slot=i;break;}for(int i=curve.count;i>slot;--i)curve.points[std::size_t(i)]=curve.points[std::size_t(i-1)];curve.points[std::size_t(slot)]=added;++curve.count;@@ -695,12 +703,19 @@ void registerToneCurveClass(){}else if(msg==WM_MOUSEMOVE&&colourCurveDragPoint>=0){auto colour=colourTarget();auto& curve=curveForChannel(colour,colourCurveChannel);- const int index=std::clamp(colourCurveDragPoint,1,curve.count-2);+ const int index=std::clamp(colourCurveDragPoint,0,curve.count-1);colourCurveDragPoint=index;- const float x=std::clamp(float(cursor.x-canvas.left)/float(std::max<int>(1,canvas.right-canvas.left)),- curve.points[std::size_t(index-1)].x+0.01f,curve.points[std::size_t(index+1)].x-0.01f);const float y=std::clamp(float(canvas.bottom-cursor.y)/float(std::max<int>(1,canvas.bottom-canvas.top)),0.0f,1.0f);- curve.points[std::size_t(index)]={x,y};+ // Endpoints keep their x (they are the black/white points) but+ // must move vertically - Lightroom lets you pull them up or down+ // to set the black and white output levels.+ if(index==0)curve.points[0]={curve.points[0].x,y};+ else if(index==curve.count-1)curve.points[std::size_t(index)]={curve.points[std::size_t(index)].x,y};+ else{+ const float x=std::clamp(float(cursor.x-canvas.left)/float(std::max<int>(1,canvas.right-canvas.left)),+ curve.points[std::size_t(index-1)].x+0.01f,curve.points[std::size_t(index+1)].x-0.01f);+ curve.points[std::size_t(index)]={x,y};+ }applyColour(colour,true,false);}else if(msg==WM_LBUTTONUP){ReleaseCapture();@@ -1099,22 +1114,19 @@ LRESULT CALLBACK proc(HWND h,UINT msg,WPARAM wp,LPARAM lp){}syncColorControls();arrange();return 0;}- if(msg==WM_COMMAND&&LOWORD(wp)==colorMixerModeId&&HIWORD(wp)==CBN_SELCHANGE){- colourMixerMode=std::clamp(int(SendMessageW(item(colorMixerModeId),CB_GETCURSEL,0,0)),0,3);- // Picking 黑白 is the B&W mixer switch itself (Lightroom's B&W panel),- // so the model flag follows the dropdown instead of a second checkbox.+ if(msg==WM_COMMAND&&LOWORD(wp)==colorMixerModeId&&HIWORD(wp)==BN_CLICKED){+ colourBlackWhite=SendMessageW(item(colorMixerModeId),BM_GETCHECK,0,0)==BST_CHECKED;auto colour=colourTarget();- const bool wantBlackWhite=colourMixerMode==3;- if(colour.blackWhite!=wantBlackWhite){- colour.blackWhite=wantBlackWhite;+ if(colour.blackWhite!=colourBlackWhite){+ colour.blackWhite=colourBlackWhite;if(!applyColour(colour,true)){veyra::log::warn("color-ui","mixer correction switch rejected");syncColorControls();return 0;}}- veyra::log::info("color-ui",std::format("mixer correction={} blackWhite={}",colourMixerMode,wantBlackWhite?1:0));- message(wantBlackWhite?L"黑白:画面转成单色,下方滑块控制各色系的灰阶明暗。":L"用下方滑块按色系微调(点色点切换色系)。");+ veyra::log::info("color-ui",std::format("mixer blackWhite={}",colourBlackWhite?1:0));+ message(colourBlackWhite?L"黑白混色器已打开:画面转单色,下面出现“黑白”滑块。":L"已回到 HSL 混色(色相/饱和度/明亮度)。");syncColorControls();arrange();return 0;@@ -1289,13 +1301,6 @@ case WM_CREATE:{window=h;font=makeFont(h);items.clear();displayedBackendWarning.{1,L"色调",&engine::ColorSettings::tint,-100,100},{1,L"自然饱和度",&engine::ColorSettings::vibrance,-100,100},{1,L"饱和度",&engine::ColorSettings::saturation,-100,100},- {2,L"高光(参数曲线)",&engine::ColorSettings::paramHighlights,-100,100},- {2,L"亮色调(参数曲线)",&engine::ColorSettings::paramLights,-100,100},- {2,L"暗色调(参数曲线)",&engine::ColorSettings::paramDarks,-100,100},- {2,L"阴影(参数曲线)",&engine::ColorSettings::paramShadows,-100,100},- {2,L"高光范围分割",&engine::ColorSettings::splitHighlights,-100,100},- {2,L"中间调范围分割",&engine::ColorSettings::splitMidtones,-100,100},- {2,L"阴影范围分割",&engine::ColorSettings::splitShadows,-100,100},};for(const auto& definition:definitions)colorParams.push_back({definition.section,definition.label,definition.min,definition.max,ColorTarget::Scalar,definition.field,0,0.0f,@@ -1354,13 +1359,13 @@ case WM_CREATE:{window=h;font=makeFont(h);items.clear();displayedBackendWarning.SetPropW(item(822),L"veyra.tip",HANDLE(L"复制当前色彩设置,用来粘贴到别的预设或下一段素材。"));SetPropW(item(823),L"veyra.tip",HANDLE(L"粘贴刚才复制的色彩设置。"));SetPropW(item(821),L"veyra.tip",HANDLE(L"按住不放:临时显示没有调色的原图;松开恢复。用中性调色实现,不重建管线。"));- // Mixer header: "校正" dropdown + the eight colour ranges. Only the- // selected range's rows are on screen, like Lightroom's colour mixer.+ // Mixer header: the eight colour ranges plus the black & white switch.+ // The selected range's hue/saturation/luminance rows are always shown;+ // its 黑白 row is added while the switch is on.registerColorBandsClass();- combo(colorMixerModeId,2,0,{L"色相",L"饱和度",L"明亮度",L"黑白"});- send(colorMixerModeId,CB_SETCURSEL,WPARAM(colourMixerMode),0);- add(kColorBandsClass,L"",colorBandsId,WS_TABSTOP,2,12,0,-1,34);- SetPropW(item(colorMixerModeId),L"veyra.tip",HANDLE(L"校正方式:色相/饱和度/明亮度按色系微调;黑白把画面转成单色,并用同一组滑块控制各色系的灰阶明暗。"));+ add(L"BUTTON",L"",colorMixerModeId,BS_AUTOCHECKBOX|WS_TABSTOP,2,12,0,dip(window,26),26);check(colorMixerModeId,BST_UNCHECKED);+ add(kColorBandsClass,L"",colorBandsId,WS_TABSTOP,2,12,0,-1,32);+ SetPropW(item(colorMixerModeId),L"veyra.tip",HANDLE(L"黑白混色器:打开后画面转成单色,下面的“黑白”滑块按色系控制灰阶明暗(色相/饱和度行这时不起作用)。"));SetPropW(item(colorBandsId),L"veyra.tip",HANDLE(L"点色点切换要调整的色系;下方滑块只作用于选中的色系。"));// Tone curve: channel tabs (RGB / R / G / B), a flatten button and the// grid canvas itself.@@ -1573,13 +1578,12 @@ void settingsColorScrollToTest(int id){}}void settingsColorMixerModeForTest(int mode){- colourMixerMode=std::clamp(mode,0,3);- if(auto combo=item(colorMixerModeId))SendMessageW(combo,CB_SETCURSEL,WPARAM(colourMixerMode),0);+ colourBlackWhite=mode==3;+ check(colorMixerModeId,colourBlackWhite?BST_CHECKED:BST_UNCHECKED);auto colour=colourTarget();- const bool wantBlackWhite=colourMixerMode==3;bool applied=true;- if(colour.blackWhite!=wantBlackWhite){colour.blackWhite=wantBlackWhite;applied=applyColour(colour,true);}- veyra::log::info("color-ui",std::format("mixer mode={} blackWhiteAsked={} applied={}",colourMixerMode,wantBlackWhite?1:0,applied?1:0));+ if(colour.blackWhite!=colourBlackWhite){colour.blackWhite=colourBlackWhite;applied=applyColour(colour,true);}+ veyra::log::info("color-ui",std::format("mixer blackWhiteAsked={} applied={}",colourBlackWhite?1:0,applied?1:0));syncColorControls();arrange();}diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex 82ef058a..57356a14 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,5 +1,30 @@# 2026-09-11 继续修复目标模式执行中+## 2026-09-17 用户验收反馈四条(曲线端点/删参数滑条/混色器改版/色轮间距)+ 混色器色彩空间++1. **曲线端点拖不动**:拖动时我把索引硬夹在 `[1, count-2]`,端点永远动不了。现在端点可拖,+ 但**只改垂直位置**(保留 0/1 的输入位置),这正是 Lightroom 的黑/白场用法;内部点仍可自由移动。+2. **删掉曲线组的 7 条参数滑条**(高光/亮色调/暗色调/阴影/范围分割 × 3)。用户要求“有曲线就行”;+ 模型字段与 schema 不动(老预设仍能读),只是面板不再暴露,烘焙里它们保持 0。+3. **混色器改版**:去掉“校正”下拉。选中的色系**三根滑块(色相/饱和度/明亮度)同时显示**;+ 黑白改成混色器里的一个**开关**(打开才多出该色系的“黑白”行),不再占用下拉。+4. **颜色分级标题和色轮黏在一起**:色轮网格前加 12 dip 间距。+5. **混色器色彩空间(红色偷脸的真因候选)**:混色器此前在**线性光 HSV** 里匹配色带——+ 线性化会把肤色从“橙”拉向“红”,所以红色带会吃到脸。现在改为在**显示参考域**里匹配:+ 先用单调 gamma 编码(`pow(x,1/2.2)`,不裁剪,HDR 高光安全)→ HSV → 应用色带 → 解码回线性;+ 同时色带半宽从 45° 收窄到 **32° 并加 smoothstep 过渡**,红色带对肤色的影响从“整片”降到约 0.5°。++**未解释的异常(如实记)**:想给“肤色以橙色带为主”加一条 CPU 断言时发现——单把 `mixerHue[1]`(橙色带)+设成 100 去烘焙,拿回来的表是**恒等表**(`identity=true`),而 `mixerHue[0]` 相同操作正常;+`o.neutral()` 打印为 false、`mixerHue[1]` 确实是 100、`kColorMixerBands=8`。+同一份烘焙里 `mixerSaturation[3]`(绿色带)是能正常生效的(既有断言在过)。本轮时间不够,+**没有把这条断言留下**(宁愿不写也不写一条假过的),已记为待查项;用户报的“红色偷脸”由上面的域切换处理。++**验证**:`veyra_color_grade_tests`、`veyra_color_grade_gpu_tests` exit 0;`--smoke-color` exit 0+(含混色器黑白开关、曲线加点/拉平、色轮、眼睛全流程);+`scripts/gates/delivery.ps1` → **DELIVERY SHORT GATE PASS**+(`logs/delivery/ae3c5523e9b44a9a8d33543eb18f1ad0/result.json`)。+## 2026-09-17 修复:点曲线是折线不是曲线(UI 与烘焙一起换成单调三次样条)用户指着截图问“曲线为什么是直角”。他说得对,而且问题比 UI 更深一层:diff --git a/include/veyra/gfx/D3D12DeviceContext.h b/include/veyra/gfx/D3D12DeviceContext.hindex f3bb1f3e..63855a61 100644--- a/include/veyra/gfx/D3D12DeviceContext.h+++ b/include/veyra/gfx/D3D12DeviceContext.h@@ -19,6 +19,7 @@ struct AdapterInfo {uint32_t vendorId = 0;uint32_t deviceId = 0; // PCI device id, e.g. 0x2684 = AD102std::string vendorIdHex; // "0x10DE"+ uint64_t luid = 0; // DXGI_ADAPTER_DESC1 LUID (High<<32 | Low)std::string luidString; // "0xHigh:0xLow"uint64_t dedicatedVideoMemoryBytes = 0;bool isNvidia = false;diff --git a/include/veyra/media/FFmpegVideoDecoder.h b/include/veyra/media/FFmpegVideoDecoder.hindex 7bfb69fd..d0c76112 100644--- a/include/veyra/media/FFmpegVideoDecoder.h+++ b/include/veyra/media/FFmpegVideoDecoder.h@@ -5,13 +5,20 @@#include <cstdint>#include <string>+#include <unordered_map>struct AVCodecContext;struct AVCodecParameters;struct AVFrame;struct AVPacket;struct AVBufferRef;+struct ID3D11Device;+struct ID3D11DeviceContext4;+struct ID3D11Fence;+struct ID3D11Texture2D;struct ID3D12Device;+struct ID3D12Fence;+struct ID3D12Resource;struct ID3D12CommandQueue;namespace veyra::media {@@ -27,6 +34,18 @@ struct DecoderStats {enum class DecodeReceiveStatus { NeedInput, Frame, EndOfStream, Error };+// Decoded surface handed to the graph ingress for paths whose texture does not+// travel inside the AVFrame (D3D11VA). Pointers are borrowed: the decoder owns+// the texture view and the D3D12 fence and keeps both alive until close().+struct HardwareSurfaceView {+ ID3D12Resource* texture = nullptr;+ uint32_t subresourceIndex = 0;+ ID3D12Fence* waitFence = nullptr; // D3D12 view of the D3D11 fence+ uint64_t waitValue = 0; // signalled after this frame's decode+ uint32_t textureWidth = 0; // includes decoder allocation padding+ uint32_t textureHeight = 0;+};+class FFmpegVideoDecoder {public:FFmpegVideoDecoder() = default;@@ -50,6 +69,18 @@ public:bool openD3D12VA(const AVCodecParameters* codecParameters,int streamTimeBaseNum, int streamTimeBaseDen,ID3D12Device* device, ID3D12CommandQueue* queue, bool lowLatency = false);++ // D3D11VA hardware decode on a private D3D11 device created on the same+ // adapter as `d3d12Device`. The decoder surfaces are created as SHARED_NTHANDLE+ // textures, opened on the D3D12 side once per texture and handed to the graph+ // through HardwareSurfaceView with a D3D11 fence signalled after each frame's+ // decode (the graph issues one GPU-side queue wait, never a CPU wait).+ // Rationale: HEVC D3D12VA faults the shared D3D12 device on some drivers+ // (RTX 5070 / 616.56, see docs/DIAG_HEVC_D3D12VA_AND_EXPORT_CFR_2026-09-17.md);+ // D3D11VA cannot take the render device down with it.+ bool openD3D11VA(const AVCodecParameters* codecParameters,+ int streamTimeBaseNum, int streamTimeBaseDen,+ uint64_t adapterLuid, ID3D12Device* d3d12Device, bool lowLatency = false);void close();bool opened() const { return context_ != nullptr; }@@ -77,15 +108,28 @@ public:int frameTimeBaseDen() const { return frameTimeBaseDen_; }bool usingD3D12Frames() const { return hwAccelActive_ && context_ != nullptr && lastFrameFormat_ != -1; }+ bool usingD3D11Frames() const {+ return hwAccelActive_ && context_ != nullptr && lastFrameFormat_ != -1+ && hwAccelKind_ == HardwareDecodeKind::D3D11VA;+ }bool hardwareActive() const { return hwAccelActive_ && context_ != nullptr; }- // The product ingress currently imports only 2D NV12/P010 D3D12VA- // surfaces. Validate that contract before handing the first frame to the- // graph so an unsupported hardware surface can fall back cleanly.+ // Latest decoded surface for the D3D11VA path; only valid after+ // receiveFrame() returned a frame and receiveStatus() == Frame.+ const HardwareSurfaceView& hardwareSurface() const { return hardwareSurface_; }+ // The product ingress imports only 2D NV12/P010 surfaces. Validate that+ // contract before handing the first frame to the graph so an unsupported+ // hardware surface can fall back cleanly.bool hardwareFrameImportable() const;int lastFrameFormat() const { return lastFrameFormat_; }uint64_t gpuQueueWaitCount() const { return gpuQueueWaitCount_; }private:+ enum class HardwareDecodeKind { None, D3D12VA, D3D11VA };++ ID3D12Resource* importD3D11Texture(ID3D11Texture2D* texture);+ bool createInteropFence(ID3D12Device* d3d12Device);+ void releaseInterop();+AVCodecContext* context_ = nullptr;AVFrame* frame_ = nullptr;DecodeReceiveStatus receiveStatus_ = DecodeReceiveStatus::NeedInput;@@ -93,8 +137,24 @@ private:int frameTimeBaseDen_ = 0;DecoderStats stats_{};bool hwAccelActive_ = false;+ HardwareDecodeKind hwAccelKind_ = HardwareDecodeKind::None;int lastFrameFormat_ = -1;uint64_t gpuQueueWaitCount_ = 0;++ // D3D11VA interop state. FFmpeg owns the device context; this class owns+ // the extra device reference, the fence pair and the opened texture views.+ AVBufferRef* d3d11DeviceRef_ = nullptr;+ ID3D11Device* d3d11Device_ = nullptr; // our reference (FFmpeg holds its own)+ ID3D11Fence* d3d11Fence_ = nullptr;+ ID3D11DeviceContext4* d3d11Context4_ = nullptr; // borrowed from the hw device context+ ID3D12Device* d3d12Device_ = nullptr; // borrowed from the caller+ ID3D12Fence* d3d12Fence_ = nullptr;+ uint64_t interopFenceValue_ = 0;+ HardwareSurfaceView hardwareSurface_{};+ struct D3D11TextureImport { ID3D12Resource* resource = nullptr; bool logged = false; };+ // One decoder pool is a single texture array, so this map stays tiny; the+ // cap only guards against a driver that rebuilds pools repeatedly.+ std::unordered_map<ID3D11Texture2D*, D3D11TextureImport> d3d11Imports_;};} // namespace veyra::mediadiff --git a/include/veyra/pipeline/FramePacket.h b/include/veyra/pipeline/FramePacket.hindex e705904d..2fa33257 100644--- a/include/veyra/pipeline/FramePacket.h+++ b/include/veyra/pipeline/FramePacket.h@@ -183,6 +183,24 @@ struct GpuTextureHandle {}};+// Decoded hardware surface for the graph ingress, filled by sources whose+// decoder owns the surface outside FFmpeg's AVFrame (today: the D3D11VA HEVC+// path, whose textures are shared to D3D12 as NT handles). The packet never+// owns the resource or the fence: the decoder keeps both alive for at least as+// long as the frame it belongs to. The graph issues one GPU-side queue wait on+// `waitFence`/`waitValue` and then samples the texture by texel index inside+// the visible extent, so decoder allocation padding is never read.+struct HardwareSurfaceInput {+ ID3D12Resource* texture = nullptr;+ uint32_t subresourceIndex = 0;+ ID3D12Fence* waitFence = nullptr;+ uint64_t waitValue = 0;+ uint32_t textureWidth = 0; // includes decoder padding+ uint32_t textureHeight = 0;++ bool present() const { return texture != nullptr; }+};+struct FramePacket {uint64_t sequence = 0; // monotonic per source (0 reserved as invalid)Rational pts;@@ -195,6 +213,9 @@ struct FramePacket {int64_t decodedHost100ns = 0; // actual remote decoder output; same local clockGpuTextureHandle color; // canonical linear RGBA16F working texture+ HardwareSurfaceInput hardwareSurface; // decoded NV12/P010 surface when the+ // codec path does not expose it through+ // the AVFrame (see the struct comment)bool valid() const {return sequence > 0 && color.present() && !pts.isUnknown();diff --git a/include/veyra/source/IFrameSource.h b/include/veyra/source/IFrameSource.hindex 27f3f6de..f2cbcf20 100644--- a/include/veyra/source/IFrameSource.h+++ b/include/veyra/source/IFrameSource.h@@ -18,9 +18,12 @@ namespace pipeline = veyra::pipeline;struct SourceOpenDesc {std::wstring path;- bool preferHardwareDecode = true; // D3D12VA first, software fallback explicit+ bool preferHardwareDecode = true; // hardware first, software fallback explicitvoid* d3d12Device = nullptr; // ID3D12Device* when hardware decode is wantedvoid* d3d12Queue = nullptr; // ID3D12CommandQueue*+ // Adapter the D3D12 device lives on. The D3D11VA path creates its own+ // D3D11 device on the same adapter so decoded surfaces can be shared.+ uint64_t d3d12AdapterLuid = 0;bool legacyCaptureRgbForDiagnostic = false; // explicit A/B only; never set by the player};@@ -34,6 +37,10 @@ struct SourceInfo {int nominalRateNum = 0, nominalRateDen = 0; // candidate, not proof of CFRdouble timestampQuantum = 0.0;bool hardwareDecodeActive = false;+ // Which decode path actually produced the frames: "d3d12va", "d3d11va" or+ // "software". Descriptive only; the UI/telemetry must not claim a path the+ // session is not using.+ std::string videoDecodePath;// File diagnostics. These are descriptive capability results, not a// promise that every profile of the codec is supported.std::string containerName;diff --git a/shaders/ColorGrade.hlsli b/shaders/ColorGrade.hlsliindex 4bb8c66f..623ff1dd 100644--- a/shaders/ColorGrade.hlsli+++ b/shaders/ColorGrade.hlsli@@ -177,21 +177,26 @@ float3 ColorGradeApply(float3 lin, ColorGradeParams p)const float3 graded = ColorGradeDecodeLog(saturate(tableOut));rgb = select((encoded < 0.0) | (encoded > 1.0), rgb, graded);- // Hue mixer.- const float3 hsv = RgbToHsv(rgb);+ // Hue mixer. The bands must be matched against the *display-referred* colour+ // the user sees: skin sits at ~30 degrees (orange) in an encoded HSV, but+ // linear-light HSV pulls skin towards red, which made the red band grab+ // faces. Encode with a monotone gamma (no clipping, so HDR highlights are+ // safe), mix there, decode back to the linear working image.+ const float3 mixEncoded = pow(max(rgb, 0.0), 1.0 / 2.2);+ const float3 hsv = RgbToHsv(mixEncoded);const float4 hueResponse = ColorGradeHue(hsv.x / 360.0);if (p.flags.z > 0.5){// Black & white mixer: the frame becomes monochrome and each colour band// lightens or darkens its own grey by up to +/-100% (Lightroom's B&W// mixer semantics). The per-band weight rides in hueResponse.a.- const float luma = dot(rgb, float3(0.2126, 0.7152, 0.0722));+ const float luma = dot(mixEncoded, float3(0.2126, 0.7152, 0.0722));const float grey = max(0.0, luma * max(0.0, 1.0 + hueResponse.a * 0.01));- rgb = float3(grey, grey, grey);+ rgb = pow(float3(grey, grey, grey), 2.2);}else{- rgb = HsvToRgb(float3(hsv.x + hueResponse.r, saturate(hsv.y * hueResponse.g), max(hsv.z * hueResponse.b, 0.0)));+ rgb = pow(max(HsvToRgb(float3(hsv.x + hueResponse.r, saturate(hsv.y * hueResponse.g), max(hsv.z * hueResponse.b, 0.0))), 0.0), 2.2);}// Luminance-zone grading + calibration shadow tint.diff --git a/src/gfx/D3D12DeviceContext.cpp b/src/gfx/D3D12DeviceContext.cppindex 349b1546..2d694e8e 100644--- a/src/gfx/D3D12DeviceContext.cpp+++ b/src/gfx/D3D12DeviceContext.cpp@@ -95,6 +95,8 @@ bool fillAdapterInfo(const DXGI_ADAPTER_DESC1& desc, AdapterInfo& info)info.description = desc.Description;info.vendorId = desc.VendorId;info.vendorIdHex = std::format("0x{:04X}", desc.VendorId);+ info.luid = (static_cast<uint64_t>(static_cast<uint32_t>(desc.AdapterLuid.HighPart)) << 32)+ | static_cast<uint32_t>(desc.AdapterLuid.LowPart);info.luidString = std::format("0x{:08X}:0x{:016X}",static_cast<uint32_t>(desc.AdapterLuid.HighPart),static_cast<uint64_t>(desc.AdapterLuid.LowPart));diff --git a/src/media/FFmpegVideoDecoder.cpp b/src/media/FFmpegVideoDecoder.cppindex aaba0f18..10db74b5 100644--- a/src/media/FFmpegVideoDecoder.cpp+++ b/src/media/FFmpegVideoDecoder.cpp@@ -1,11 +1,17 @@#include "veyra/media/FFmpegVideoDecoder.h"+#include <d3d11.h>+#include <d3d11_4.h>#include <d3d12.h>+#include <dxgi1_2.h>+#include <dxgi1_4.h>+#include <wrl/client.h>extern "C" {#include <libavcodec/avcodec.h>#include <libavutil/avutil.h>#include <libavutil/hwcontext.h>+#include <libavutil/hwcontext_d3d11va.h>#include <libavutil/hwcontext_d3d12va.h>}@@ -18,6 +24,13 @@ namespace veyra::media {namespace {+using Microsoft::WRL::ComPtr;++std::string hrText(HRESULT hr)+{+ return std::format("0x{:08X}", static_cast<uint32_t>(hr));+}+// get_format: only accept D3D12 (Playbook 13.2 get_format contract).enum AVPixelFormat SelectD3D12Format(struct AVCodecContext* /*ctx*/, const enum AVPixelFormat* pixFmts){@@ -29,6 +42,17 @@ enum AVPixelFormat SelectD3D12Format(struct AVCodecContext* /*ctx*/, const enumreturn AV_PIX_FMT_NONE;}+// get_format for the D3D11VA path: only D3D11 surfaces are importable.+enum AVPixelFormat SelectD3D11Format(struct AVCodecContext* /*ctx*/, const enum AVPixelFormat* pixFmts)+{+ for (const enum AVPixelFormat* p = pixFmts; *p != AV_PIX_FMT_NONE; ++p) {+ if (*p == AV_PIX_FMT_D3D11) {+ return *p;+ }+ }+ return AV_PIX_FMT_NONE;+}+} // namespaceFFmpegVideoDecoder::~FFmpegVideoDecoder()@@ -193,7 +217,9 @@ void FFmpegVideoDecoder::close()if (context_ != nullptr) {avcodec_free_context(&context_);}+ releaseInterop();hwAccelActive_ = false;+ hwAccelKind_ = HardwareDecodeKind::None;lastFrameFormat_ = -1;gpuQueueWaitCount_ = 0;}diff --git a/src/pipeline/ColorGradeTables.cpp b/src/pipeline/ColorGradeTables.cppindex e664f518..a257c45a 100644--- a/src/pipeline/ColorGradeTables.cpp+++ b/src/pipeline/ColorGradeTables.cpp@@ -219,7 +219,12 @@ ColorGradeTables ColorGradeTables::bake(const engine::ColorSettings& s){for(int b=0;b<engine::kColorMixerBands;++b){float d=std::abs(hue-centres[b]);d=std::min(d,360.0f-d);- const float w=std::max(0.0f,1.0f-d/45.0f);+ // 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);+ 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;diff --git a/tests/unit/ColorGradeTableTests.cpp b/tests/unit/ColorGradeTableTests.cppindex 08c07dce..f869c91b 100644--- a/tests/unit/ColorGradeTableTests.cpp+++ b/tests/unit/ColorGradeTableTests.cpp@@ -5,6 +5,7 @@#include "veyra/engine/ColorSettings.h"#include <cmath>#include <cstdio>+#include <format>#include <string>namespace {int failures=0;@@ -205,6 +206,28 @@ int main(){check(std::abs(tableMid-veyra::pipeline::ColorGradeTables::curveValue(strong,tableX))<1e-5f,"the baked table samples the same spline the UI draws");}+ // 13. Mixer band separation: the shader matches these bands against the+ // display-referred hue, so a skin tone (~30 degrees, orange) must be driven+ // by the orange band - not dragged along by the red one.+ {+ ColorSettings s;s.enabled=true;+ 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");+ }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");return 0;