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

feat(color): per-section bypass eyes with schema v19 (pixel-verified) + UI pass 5

Veyra Goal Agente20e282b859b
diff --git a/apps/veyra/SettingsWindow.cpp b/apps/veyra/SettingsWindow.cpp
index ddca7b1c..2a049a1b 100644
--- a/apps/veyra/SettingsWindow.cpp
+++ b/apps/veyra/SettingsWindow.cpp
@@ -147,6 +147,10 @@ int colourMixerBand=0; // 0..7, the eight colour ranges
// which control point is being dragged.
constexpr int colorCurveCanvasId=850,colorCurveChannelId=851,colorCurveResetId=855;
constexpr const wchar_t* kColorCurveClass=L"VeyraToneCurve";
+// Per-section bypass "eye" (plan T3). One small owner-drawn control per section,
+// sitting at the right end of its header row.
+constexpr int colorSectionEyeId(int section){return 860+section;}
+constexpr const wchar_t* kColorEyeClass=L"VeyraColorEye";
int colourCurveChannel=0;
int colourCurveDragPoint=-1;
constexpr int kColorMaxParams=100;
@@ -243,6 +247,7 @@ void layoutColorPage(){
for(int section=0;section<kColorSections;++section){
const bool collapsed=(colorFoldMask>>section)&1u;
place(810+section,y,32,false);
+ place(colorSectionEyeId(section),y+3,26,false,bodyWidthDip-40,26);
const auto title=std::format(L"{} {}",collapsed?L"▸":L"▾",colorSectionName(section));
putText(810+section,title.c_str());
y+=38;
@@ -315,6 +320,7 @@ void syncColorControls(){
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);
+ for(int section=0;section<kColorSections;++section)if(auto eye=item(colorSectionEyeId(section)))InvalidateRect(eye,nullptr,FALSE);
for(int zone=0;zone<engine::kColorGradingZones;++zone)if(auto wheel=item(colorWheelId(zone)))InvalidateRect(wheel,nullptr,FALSE);
syncingColour=false;
}
@@ -726,6 +732,61 @@ void registerToneCurveClass(){
};
RegisterClassW(&classDescription);
}
+// Section bypass eye: open = active, struck through + dimmed = bypassed.
+void paintSectionEye(HWND h,HDC dc,RECT r){
+ const int section=GetDlgCtrlID(h)-colorSectionEyeId(0);
+ const bool bypassed=(colourTarget().groupBypassMask&(1u<<unsigned(std::max(0,section))))!=0;
+ fillSurface(dc,r,h);
+ AlphaGraphics drawing(dc);
+ auto& graphics=drawing.get();
+ graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+ const float centreX=float(r.right-r.left)*0.5f,centreY=float(r.bottom-r.top)*0.5f;
+ const float halfWidth=float(std::min(r.right-r.left,r.bottom-r.top))*0.38f,halfHeight=halfWidth*0.58f;
+ const COLORREF tint=bypassed?RGB(96,99,104):RGB(214,218,224);
+ Gdiplus::Pen outline(color(tint),1.6f);
+ Gdiplus::GraphicsPath path;
+ path.AddBezier(centreX-halfWidth,centreY,centreX-halfWidth*0.35f,centreY-halfHeight,
+ centreX+halfWidth*0.35f,centreY-halfHeight,centreX+halfWidth,centreY);
+ path.AddBezier(centreX+halfWidth,centreY,centreX+halfWidth*0.35f,centreY+halfHeight,
+ centreX-halfWidth*0.35f,centreY+halfHeight,centreX-halfWidth,centreY);
+ path.CloseFigure();
+ graphics.DrawPath(&outline,&path);
+ Gdiplus::SolidBrush pupil(color(tint));
+ const float pupilRadius=halfHeight*0.55f;
+ graphics.FillEllipse(&pupil,centreX-pupilRadius,centreY-pupilRadius,pupilRadius*2,pupilRadius*2);
+ if(bypassed){
+ Gdiplus::Pen strike(color(RGB(230,122,49)),1.8f);
+ graphics.DrawLine(&strike,centreX-halfWidth,centreY+halfHeight*1.15f,centreX+halfWidth,centreY-halfHeight*1.15f);
+ }
+}
+void registerSectionEyeClass(){
+ static bool registered=false;
+ if(registered)return;
+ registered=true;
+ WNDCLASSW classDescription{};
+ classDescription.hInstance=GetModuleHandleW(nullptr);
+ classDescription.lpszClassName=kColorEyeClass;
+ classDescription.hCursor=LoadCursorW(nullptr,IDC_HAND);
+ classDescription.lpfnWndProc=[](HWND h,UINT msg,WPARAM wp,LPARAM lp)->LRESULT{
+ if(msg==WM_ERASEBKGND)return 1;
+ if(msg==WM_PAINT||msg==WM_PRINTCLIENT){PaintBuffer paint(h,reinterpret_cast<HDC>(wp));paintSectionEye(h,paint.dc,paint.rect);return 0;}
+ if(msg==WM_LBUTTONDOWN){
+ const int section=GetDlgCtrlID(h)-colorSectionEyeId(0);
+ auto colour=colourTarget();
+ colour.groupBypassMask^=1u<<unsigned(std::max(0,section));
+ if(applyColour(colour,true)){
+ veyra::log::info("color-ui",std::format("section bypass section={} mask={}",section,colour.groupBypassMask));
+ message(colour.groupBypassMask&(1u<<unsigned(section))
+ ?std::format(L"“{}”这一组已临时停用(数值保留,取消勾选即恢复)。",colorSectionName(section))
+ :std::format(L"“{}”这一组已启用。",colorSectionName(section)));
+ }
+ syncColorControls();
+ return 0;
+ }
+ return DefWindowProcW(h,msg,wp,lp);
+ };
+ RegisterClassW(&classDescription);
+}
bool colourFieldEdited(int index,float value){
if(index<0||size_t(index)>=colorParams.size())return false;
auto colour=colourTarget();
@@ -1310,6 +1371,11 @@ case WM_CREATE:{window=h;font=makeFont(h);items.clear();displayedBackendWarning.
add(kColorCurveClass,L"",colorCurveCanvasId,WS_TABSTOP,2,12,0,-1,260);
SetPropW(item(colorCurveCanvasId),L"veyra.tip",HANDLE(L"左键在网格上点一下加点、拖动移动;双击控制点删除(两个端点保留);“拉平”恢复恒等曲线。"));
for(int section=0;section<kColorSections;++section)add(L"BUTTON",L"",810+section,BS_PUSHBUTTON|WS_TABSTOP,2,12,12,-1,32);
+ registerSectionEyeClass();
+ for(int section=0;section<kColorSections;++section){
+ add(kColorEyeClass,L"",colorSectionEyeId(section),0,2,12,12,26,26);
+ SetPropW(item(colorSectionEyeId(section)),L"veyra.tip",HANDLE(L"点一下临时停用这一组(数值保留),再点恢复:用来对比某一组到底起了什么作用。"));
+ }
// Preset toolbar.
combo(803,2,0,{});add(L"EDIT",L"",804,ES_AUTOHSCROLL|WS_TABSTOP,2,12,0,-1,26);send(804,EM_SETLIMITTEXT,48,0);
button(L"保存预设",805,2,12,0,96);button(L"应用",806,2,12,0,80);button(L"删除",807,2,12,0,80);
@@ -1477,6 +1543,7 @@ bool settingsColorWheelTestBarPoint(int zone,float luminance,POINT& out){
int colourWheelControlId(int zone){return colorWheelId(zone);}
int colourBandsControlId(){return colorBandsId;}
int colourCurveCanvasControlId(){return colorCurveCanvasId;}
+int colourSectionEyeControlId(int section){return colorSectionEyeId(std::clamp(section,0,kColorSections-1));}
void settingsColorSectionForTest(int section,bool expanded){
if(section<0||section>=kColorSections)return;
if(expanded)colorFoldMask&=~(1u<<section);
diff --git a/apps/veyra/SettingsWindow.h b/apps/veyra/SettingsWindow.h
index 0e55ca03..0a894772 100644
--- a/apps/veyra/SettingsWindow.h
+++ b/apps/veyra/SettingsWindow.h
@@ -32,4 +32,5 @@ bool settingsCurveTestPoint(float x,float y,POINT& out);
// Expand/collapse one colour section (acceptance code needs the target section
// unfolded regardless of what the previous run persisted).
void settingsColorSectionForTest(int section,bool expanded);
+int colourSectionEyeControlId(int section);
}
diff --git a/apps/veyra/ui/AppShell.cpp b/apps/veyra/ui/AppShell.cpp
index e56991ee..a94a5d5a 100644
--- a/apps/veyra/ui/AppShell.cpp
+++ b/apps/veyra/ui/AppShell.cpp
@@ -909,7 +909,25 @@ else if(colorStep==68){
// Hold the curve view steady for a moment: acceptance screenshots and a human
// can actually see the editor before the fold checks scroll the page.
else if(colorStep==69&&elapsed>9000){colorStep=70;}
+// Section bypass eyes (plan T3): one click stops a group from affecting the
+// picture while its numbers stay in the panel.
else if(colorStep==70){
+ veyra::ui::settingsColorScrollToTest(veyra::ui::colourSectionEyeControlId(0));
+ if(auto eye=colourControl(veyra::ui::colourSectionEyeControlId(0)))SendMessageW(eye,WM_LBUTTONDOWN,0,MAKELPARAM(4,4));
+ colorStep=71;
+}
+else if(colorStep==71){
+ const bool bypassed=(colourSnapshot.desired.color.groupBypassMask&1u)!=0u;
+ veyra::log::info("color-ui-test",std::format("section eye bypass pass={} mask={}",bypassed,colourSnapshot.desired.color.groupBypassMask));
+ if(auto eye=colourControl(veyra::ui::colourSectionEyeControlId(0)))SendMessageW(eye,WM_LBUTTONDOWN,0,MAKELPARAM(4,4));
+ colorStep=bypassed?72:-1;
+}
+else if(colorStep==72){
+ const bool restored=(colourSnapshot.desired.color.groupBypassMask&1u)==0u;
+ veyra::log::info("color-ui-test",std::format("section eye restore pass={} mask={}",restored,colourSnapshot.desired.color.groupBypassMask));
+ colorStep=restored?73:-1;
+}
+else if(colorStep==73){
auto edit=colourControl(1300);
const bool beforeVisible=edit&&IsWindowVisible(edit);
const bool beforeMask=(preferences.load().colourFoldMask&1u)!=0u;
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index e61a9d53..3c013ce8 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1,5 +1,33 @@
# 2026-09-11 继续修复目标模式执行中
+## 2026-09-17 色彩页 P1/T3 收口:分组“眼睛”bypass + schema v19
+
+方案 T3 要求的“分组眼睛”落地,并且是**真 bypass**(不只是隐藏 UI):
+
+- 模型:`ColorSettings` 新增 `groupBypassMask`(一位一组:亮/颜色/曲线/混色器/颜色分级/校准/LUT);
+ **预设 schema v18 → v19**(写在颜色块内、LUT 引用之后,v18 老文件按 `version` 跳过该字段照常读);
+ `.vpcolor` 与 `runtime_local/color-looks.v1` 文件版本 1 → 2(v1 仍可读,写 2);
+- 烘焙:`ColorGradeTables::bake()` 先把被 bypass 的组按“中性值”复制一份再烘焙,
+ 所以**数值全部保留**、只是这一组不参与画面,且无需给 shader 加分支;
+- UI:每个分组标题右侧一个自绘“眼睛”(`VeyraColorEye`,id 860..866):睁眼=生效、斜杠+橙色=已停用,
+ 点一下切换并即时生效(不重建管线);
+- 烟测覆盖:点眼睛 → `mask=1`,再点 → `mask=0`;
+- **像素级验证**(`veyra_color_grade_gpu_tests` 新增两条):把“亮”组停用后,
+ 渲染结果与“未调色参考帧”**逐字节一致**,同时 `off.color.exposure==1.0`(数值确实还在)。
+
+顺带修掉期间引入的一个递归(bypass 分支里 `bake(masked)` 忘记清 mask → 栈溢出),
+以及测试里两处 `auto x=s;` 后误改 `s` 的复制粘贴错误。
+
+**验证**:`veyra_color_grade_tests`、`veyra_color_grade_gpu_tests`、`veyra_color_look_tests`、
+`veyra_color_lut_tests`、`veyra_hdr_color_tests`、`veyra_ui_contract_tests`、
+`veyra_repair_preset_tests`(含 v18→v19 迁移与损坏保护)、`veyra_repair_contract_tests 191/0` 全 exit 0;
+`--smoke-color` exit 0;`scripts/gates/delivery.ps1` → **DELIVERY SHORT GATE PASS**
+(`logs/delivery/4651417ba2ca4c35b0eceb894059d936/result.json`)。
+真机截图:`logs/color/ui-preview-eyes2.png`(分组眼睛 + 曲线通道按钮同屏)。
+
+**至此 UI 四批(渐变轨道/四色轮/混色器色点条/曲线编辑器)+ 眼睛全部落地**;
+剩余可选项:分区图标、字号与间距抛光。
+
## 2026-09-17 色彩页 UI:真曲线编辑器 + 面板默认更宽(专业型第四批)
- **曲线编辑器**(自绘控件 `VeyraToneCurve`,id 850):网格画布 + 对角参考线 + 四条通道曲线
diff --git a/include/veyra/engine/ColorSettings.h b/include/veyra/engine/ColorSettings.h
index 8addb89c..fa8fd247 100644
--- a/include/veyra/engine/ColorSettings.h
+++ b/include/veyra/engine/ColorSettings.h
@@ -87,6 +87,11 @@ struct ColorSettings {
// reference, 2 = PQ. The plan forbids silently applying a display-referred
// LUT to HDR content, so the choice is explicit and logged.
int lutInputSpace=0;
+ // Per-section bypass (plan T3 "分组眼睛"): bit per colour page section -
+ // 0 亮, 1 颜色, 2 曲线, 3 混色器, 4 颜色分级, 5 校准, 6 LUT. A bypassed section
+ // is baked as neutral, so the user can A/B one group without losing its
+ // numbers. Lives in the settings (not the UI) because it changes the pixels.
+ uint32_t groupBypassMask=0;
bool operator==(const ColorSettings&)const=default;
// Neutral means "renders exactly like no grading at all", ignoring the
@@ -147,7 +152,7 @@ struct ColorSettings {
}
};
-// PresetStore schema v18: one appended block per entry. The field order is part
+// PresetStore schema v19: one appended block per entry. The field order is part
// of the on-disk format - never reorder without a new version. The stream is
// narrow UTF-8 (PresetStore owns the wide/UTF-8 conversion of lutPath) so this
// header stays free of platform includes.
@@ -158,6 +163,9 @@ inline void writeColorSettings(std::ostream& out,const ColorSettings& c,const st
<<c.splitHighlights<<' '<<c.splitMidtones<<' '<<c.splitShadows<<' '
<<(c.blackWhite?1:0)<<' '<<c.gradingBlending<<' '<<c.gradingBalance<<' '<<c.calibrationShadowTint<<' '
<<c.lutStrength<<' '<<c.lutInputSpace<<' '<<std::quoted(lutPathUtf8);
+ // v19 keeps the per-section bypass after the LUT reference, so v18 files stay
+ // readable (they simply have no mask) and the curves keep their positions.
+ out<<' '<<c.groupBypassMask;
for(const auto& curve:c.curves){
out<<' '<<curve.count;
for(int i=0;i<curve.count;++i)out<<' '<<curve.points[std::size_t(i)].x<<' '<<curve.points[std::size_t(i)].y;
@@ -170,7 +178,10 @@ inline void writeColorSettings(std::ostream& out,const ColorSettings& c,const st
for(float v:c.calibrationHue)out<<' '<<v;
for(float v:c.calibrationSaturation)out<<' '<<v;
}
-inline bool readColorSettings(std::istream& in,ColorSettings& c,std::string& lutPathUtf8){
+// `schemaVersion` is the *file* version: v18 files stop after the LUT reference,
+// v19 adds the per-section bypass mask. Callers pass their file's version so old
+// presets keep loading.
+inline bool readColorSettings(std::istream& in,ColorSettings& c,std::string& lutPathUtf8,int schemaVersion=19){
int blackWhite=0,enabled=0;
if(!(in>>enabled>>c.temperature>>c.tint>>c.exposure>>c.contrast>>c.highlights>>c.shadows>>c.whites>>c.blacks
>>c.texture>>c.clarity>>c.dehaze>>c.vibrance>>c.saturation
@@ -180,6 +191,7 @@ inline bool readColorSettings(std::istream& in,ColorSettings& c,std::string& lut
>>c.lutStrength>>c.lutInputSpace>>std::quoted(lutPathUtf8))||(blackWhite!=0&&blackWhite!=1)||(enabled!=0&&enabled!=1))return false;
c.enabled=enabled!=0;
c.blackWhite=blackWhite!=0;
+ if(schemaVersion>=19&&!(in>>c.groupBypassMask))return false;
for(auto& curve:c.curves){
if(!(in>>curve.count))return false;
for(int i=0;i<curve.count&&i<kColorCurvePoints;++i)if(!(in>>curve.points[std::size_t(i)].x>>curve.points[std::size_t(i)].y))return false;
diff --git a/src/engine/ColorLookStore.cpp b/src/engine/ColorLookStore.cpp
index 2eeeb8c0..ff336504 100644
--- a/src/engine/ColorLookStore.cpp
+++ b/src/engine/ColorLookStore.cpp
@@ -36,14 +36,15 @@ bool ColorLookStore::load(){
std::istringstream stream(data);
stream.imbue(std::locale::classic());
std::string magic;int version=0;
- if(!(stream>>magic>>version)||magic!="VEYRA_COLOR_LOOKS"||version!=1){corrupt_=true;error_=L"色彩预设文件损坏或版本不支持;原文件已保留";return false;}
+ if(!(stream>>magic>>version)||magic!="VEYRA_COLOR_LOOKS"||version<1||version>2){corrupt_=true;error_=L"色彩预设文件损坏或版本不支持;原文件已保留";return false;}
std::vector<ColorLook> loaded;
for(;;){
std::string name;
if(!(stream>>std::quoted(name)))break;
ColorLook look;look.name=wide(name);
std::string lut;
- if(!readColorSettings(stream,look.color,lut)){corrupt_=true;error_=L"色彩预设文件损坏;原文件已保留";return false;}
+ // Version 1 predates the per-section bypass mask (schema 18).
+ if(!readColorSettings(stream,look.color,lut,version>=2?19:18)){corrupt_=true;error_=L"色彩预设文件损坏;原文件已保留";return false;}
if(!lut.empty()&&!look.color.setLutName(wide(lut))){corrupt_=true;error_=L"色彩预设里的 LUT 名字非法;原文件已保留";return false;}
if(!nameOk(look.name)){corrupt_=true;error_=L"色彩预设名字非法;原文件已保留";return false;}
loaded.push_back(std::move(look));
@@ -60,7 +61,7 @@ bool ColorLookStore::save(){
if(ec){error_=L"无法创建预设目录";return false;}
std::ostringstream out;
out.imbue(std::locale::classic());out<<std::setprecision(std::numeric_limits<float>::max_digits10);
- out<<"VEYRA_COLOR_LOOKS 1\n";
+ out<<"VEYRA_COLOR_LOOKS 2\n";
for(const auto& look:entries_){
out<<std::quoted(utf8(look.name))<<' ';
writeColorSettings(out,look.color,utf8(look.color.lutNameString()));
@@ -107,7 +108,7 @@ bool ColorLookStore::exportFile(size_t index,const std::filesystem::path& target
const auto& look=entries_[index];
std::ostringstream out;
out.imbue(std::locale::classic());out<<std::setprecision(std::numeric_limits<float>::max_digits10);
- out<<"VEYRA_COLOR_LOOK 1\n"<<std::quoted(utf8(look.name))<<' ';
+ out<<"VEYRA_COLOR_LOOK 2\n"<<std::quoted(utf8(look.name))<<' ';
writeColorSettings(out,look.color,utf8(look.color.lutNameString()));
out<<'\n';
const auto data=out.str();
@@ -126,10 +127,10 @@ bool ColorLookStore::importFile(const std::filesystem::path& source,std::wstring
std::istringstream stream(data);
stream.imbue(std::locale::classic());
std::string magic,name;int version=0;
- if(!(stream>>magic>>version)||magic!="VEYRA_COLOR_LOOK"||version!=1){error_=L"不是有效的 .vpcolor 文件";return false;}
+ if(!(stream>>magic>>version)||magic!="VEYRA_COLOR_LOOK"||version<1||version>2){error_=L"不是有效的 .vpcolor 文件";return false;}
if(!(stream>>std::quoted(name))){error_=L"导入文件缺少预设名";return false;}
ColorSettings colour;std::string lut;
- if(!readColorSettings(stream,colour,lut)){error_=L"导入文件的参数块损坏";return false;}
+ if(!readColorSettings(stream,colour,lut,version>=2?19:18)){error_=L"导入文件的参数块损坏";return false;}
if(!lut.empty()&&!colour.setLutName(wide(lut))){error_=L"导入文件里的 LUT 名字非法";return false;}
stream>>std::ws;
if(!stream.eof()){error_=L"导入文件尾部有残余内容";return false;}
diff --git a/src/engine/PresetStore.cpp b/src/engine/PresetStore.cpp
index 4690edc8..5edf1284 100644
--- a/src/engine/PresetStore.cpp
+++ b/src/engine/PresetStore.cpp
@@ -13,12 +13,12 @@ bool nameOk(const std::wstring& s){return !s.empty()&&s.size()<=48&&s.front()!=L
std::wstring trim(std::wstring s){auto a=s.find_first_not_of(L" \t\r\n");if(a==s.npos)return {};auto b=s.find_last_not_of(L" \t\r\n");return s.substr(a,b-a+1);}
}
std::string PresetStore::serialize()const{
- std::ostringstream o;o.imbue(std::locale::classic());o<<std::setprecision(std::numeric_limits<float>::max_digits10)<<"VEYRA_PRESETS 18\n"<<std::quoted(utf8(default_))<<' '<<entries_.size()<<'\n';
+ std::ostringstream o;o.imbue(std::locale::classic());o<<std::setprecision(std::numeric_limits<float>::max_digits10)<<"VEYRA_PRESETS 19\n"<<std::quoted(utf8(default_))<<' '<<entries_.size()<<'\n';
for(auto& p:entries_){const auto& s=p.settings;const auto& m=s.model;const auto& r=s.residual;o<<std::quoted(utf8(p.name))<<' '<<m.intensity<<' '<<m.tone<<' '<<m.structure<<' '<<m.skin<<' '<<m.style<<' '<<m.autoMask<<' '<<m.uiCorrection<<' '<<r.total<<' '<<r.darken<<' '<<r.brighten<<' '<<r.color<<' '<<r.luminance<<' '<<s.nr<<' '<<s.sr<<' '<<s.multiplier<<' '<<int(s.nrPolicy)<<' '<<int(s.flow)<<' '<<int(s.content)<<' '<<s.protection.enabled<<' '<<s.protection.featherPixels;for(auto q:s.protection.regions)o<<' '<<q.left<<' '<<q.top<<' '<<q.right<<' '<<q.bottom;o<<' '<<s.videoSrQuality<<' '<<int(s.frameGenerationBackend)<<' '<<int(s.srTarget)<<' '<<int(s.opticalFlowBackend)<<' '<<s.amdFlowHalfResolution<<' '<<int(s.audioSync)<<' '<<s.audioOffsetMs<<' '<<int(s.nrRuntime)<<' '<<s.captureCompatible<<' '<<s.lowLatency<<' '<<s.forceSdrPreview<<' '<<int(s.captureAudio)<<' '<<s.exportBitrateMbps<<' '<<s.captureFlipVertical<<' '<<int(s.captureBuffer)<<' ';writeColorSettings(o,s.color,utf8(s.color.lutNameString()));o<<'\n';}return o.str();
}
bool PresetStore::parse(const std::string& data,std::vector<UserPreset>& out,std::wstring& def){
if(data.size()>65536)return false;std::istringstream in(data);in.imbue(std::locale::classic());std::string magic,d;int version=0;size_t count=0;
- if(!(in>>magic>>version)||magic!="VEYRA_PRESETS"||(version<1||version>18)||!(in>>std::quoted(d)>>count)||count>64)return false;def=wide(d);if(!d.empty()&&def.empty())return false;
+ if(!(in>>magic>>version)||magic!="VEYRA_PRESETS"||(version<1||version>19)||!(in>>std::quoted(d)>>count)||count>64)return false;def=wide(d);if(!d.empty()&&def.empty())return false;
for(size_t i=0;i<count;++i){UserPreset p;std::string n;int policy,flow,content,nr,sr;auto& s=p.settings;auto& m=s.model;auto& r=s.residual;
if(!(in>>std::quoted(n)>>m.intensity>>m.tone>>m.structure>>m.skin>>m.style>>m.autoMask>>m.uiCorrection>>r.total>>r.darken>>r.brighten>>r.color>>r.luminance>>nr>>sr>>s.multiplier>>policy>>flow>>content))return false;
if(version>=2){int enabled;if(!(in>>enabled>>s.protection.featherPixels)||enabled<0||enabled>1)return false;s.protection.enabled=enabled!=0;
@@ -44,7 +44,7 @@ bool PresetStore::parse(const std::string& data,std::vector<UserPreset>& out,std
// v17 appends the capture video-pin buffer policy.
if(version>=17){int buffer;if(!(in>>buffer)||buffer<0||buffer>2)return false;s.captureBuffer=static_cast<veyra::source::CaptureBufferMode>(buffer);}
// v18 appends the full colour grade block (see ColorSettings.h).
- if(version>=18){std::string lut;if(!readColorSettings(in,s.color,lut))return false;if(!lut.empty()&&!s.color.setLutName(wide(lut)))return false;}
+ if(version>=18){std::string lut;if(!readColorSettings(in,s.color,lut,version))return false;if(!lut.empty()&&!s.color.setLutName(wide(lut)))return false;}
p.name=wide(n);if(!nameOk(p.name)||std::any_of(out.begin(),out.end(),[&](auto& a){return a.name==p.name;})||nr<0||nr>1||sr<0||sr>1)return false;
s.nr=nr;s.sr=sr;s.nrPolicy=static_cast<pipeline::NrSizePolicy>(policy);s.flow=static_cast<FlowQuality>(flow);s.content=static_cast<ContentRate>(content);
if(!s.validate().empty())return false;out.push_back(std::move(p));
diff --git a/src/pipeline/ColorGradeTables.cpp b/src/pipeline/ColorGradeTables.cpp
index 714bad7e..0bf1c5e2 100644
--- a/src/pipeline/ColorGradeTables.cpp
+++ b/src/pipeline/ColorGradeTables.cpp
@@ -86,6 +86,29 @@ float ColorGradeTables::decodeLog(float encoded){
float ColorGradeTables::curveValue(const engine::ColorCurve& curve,float x){return pointCurve(curve,std::clamp(x,0.0f,1.0f));}
ColorGradeTables ColorGradeTables::bake(const engine::ColorSettings& s){
+ // Per-section bypass ("分组眼睛"): a bypassed section is baked as if its
+ // parameters were neutral, so the user can A/B one group without losing the
+ // numbers they dialled in. Cheap, exact and no shader branch is needed.
+ const auto bypassed=[&](int section){return (s.groupBypassMask&(1u<<unsigned(section)))!=0;};
+ if(s.groupBypassMask){
+ auto masked=s;
+ if(bypassed(0)){masked.exposure=masked.contrast=masked.highlights=masked.shadows=masked.whites=masked.blacks=0;}
+ if(bypassed(1)){masked.temperature=masked.tint=masked.vibrance=masked.saturation=0;}
+ if(bypassed(2)){
+ masked.paramHighlights=masked.paramLights=masked.paramDarks=masked.paramShadows=0;
+ masked.splitHighlights=masked.splitMidtones=masked.splitShadows=0;
+ for(auto& curve:masked.curves)curve.reset();
+ }
+ if(bypassed(3)){
+ masked.mixerHue.fill(0);masked.mixerSaturation.fill(0);masked.mixerLuminance.fill(0);
+ masked.blackWhite=false;masked.blackWhiteMix.fill(0);
+ }
+ if(bypassed(4)){for(auto& wheel:masked.grading)wheel={};masked.gradingBlending=50;masked.gradingBalance=0;}
+ if(bypassed(5)){masked.calibrationShadowTint=0;masked.calibrationHue.fill(0);masked.calibrationSaturation.fill(0);}
+ if(bypassed(6)){masked.lutStrength=0;}
+ masked.groupBypassMask=0; // the recursion must not bypass again
+ return bake(masked);
+ }
ColorGradeTables out;
out.exposure=s.exposure;
out.saturation=s.saturation;
diff --git a/tests/integration/ColorGradeGpuTests.cpp b/tests/integration/ColorGradeGpuTests.cpp
index c64723b3..216ca85c 100644
--- a/tests/integration/ColorGradeGpuTests.cpp
+++ b/tests/integration/ColorGradeGpuTests.cpp
@@ -207,6 +207,22 @@ int wmain(){
std::format("turning the black and white mixer off restores the colour image (applied={} r={} g={} b={})",applied,back.r,back.g,back.b));
}
}
+ {
+ // Section bypass ("分组眼睛"): stopping the 亮 group must render
+ // exactly like the ungraded reference while the numbers stay stored.
+ engine::EnhancementSettings lit;lit.color.enabled=true;lit.color.exposure=1.0f;lit.color.contrast=-40.0f;
+ sink::RgbaImage graded,bypassed;
+ // A fresh default settings object differs from this graph in a
+ // non-colour field, so the reference keeps the accepted payload and
+ // only resets the colour block (enabled but neutral = identity).
+ auto reference=lit;reference.color=engine::ColorSettings{};reference.color.enabled=true;
+ const bool referenced=graph.apply(reference)&&graph.render(neutral,graded);
+ auto off=lit;off.color.groupBypassMask=1u<<0;
+ const bool ignored=graph.apply(off)&&graph.render(neutral,bypassed);
+ check(referenced&&ignored&&!graded.pixels.empty()&&graded.pixels==bypassed.pixels,
+ "bypassing the 亮 group renders exactly like the ungraded reference");
+ check(off.color.exposure==1.0f,"the bypassed group keeps its stored numbers");
+ }
}
// 3. Output dither (plan section 4.1): a smooth ramp pushed through a
// compressing grade must not turn into long flat plateaus at the 8-bit
diff --git a/tests/unit/ColorGradeTableTests.cpp b/tests/unit/ColorGradeTableTests.cpp
index 2315c948..c1fae2c6 100644
--- a/tests/unit/ColorGradeTableTests.cpp
+++ b/tests/unit/ColorGradeTableTests.cpp
@@ -154,6 +154,27 @@ int main(){
ColorSettings plain;s.enabled=true;
check(ColorGradeTables::bake(plain).hue[std::size_t(greenIndex)*4+3]==0.0f,"identity bake leaves the B&W column at zero");
}
+ // 11. Per-section bypass ("分组眼睛"): bypassing a group must bake as if that
+ // group were neutral while leaving the other groups alone.
+ {
+ ColorSettings s;s.enabled=true;s.exposure=1.0f;s.saturation=-100.0f;
+ const auto full=ColorGradeTables::bake(s);
+ check(!full.identity,"a real grade clears the identity flag");
+ auto lightOnly=s;lightOnly.groupBypassMask=1u<<0; // 亮 bypassed
+ const auto withoutLight=ColorGradeTables::bake(lightOnly);
+ check(withoutLight.exposure==0.0f,"bypassing 亮 removes its exposure from the bake");
+ check(withoutLight.saturation==-100.0f,"bypassing 亮 leaves the 颜色 section alone");
+ check(!withoutLight.identity,"a bypassed section still leaves the rest of the grade active");
+ auto colOnly=s;colOnly.groupBypassMask=(1u<<0)|(1u<<1);
+ check(ColorGradeTables::bake(colOnly).identity,"bypassing every used section bakes back to identity");
+ auto curve=s;curve.curves[1].count=3;curve.curves[1].points[1]={0.5f,0.8f};
+ auto curvesOff=curve;curvesOff.groupBypassMask=1u<<2;
+ auto curvesReset=curve;curvesReset.curves[1].reset();
+ check(ColorGradeTables::bake(curvesOff).curve==ColorGradeTables::bake(curvesReset).curve,
+ "bypassing 曲线 bakes exactly the same table as resetting those curves");
+ check(ColorGradeTables::bake(curve).curve!=ColorGradeTables::bake(curvesReset).curve,
+ "the point curve still changes the table when it is not bypassed");
+ }
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;
diff --git a/tests/unit/RepairPresetTests.cpp b/tests/unit/RepairPresetTests.cpp
index 34a46eae..5e9019bc 100644
--- a/tests/unit/RepairPresetTests.cpp
+++ b/tests/unit/RepairPresetTests.cpp
@@ -42,7 +42,7 @@ bool legacyBackends(const std::filesystem::path& path) {
if(version>=7&&(value.audioSync!=AudioSyncMode::Manual||value.audioOffsetMs!=137))return false;
if(!store.put(L"legacy",value,true))return false;
std::ifstream file(path);std::string magic;int savedVersion=0;file>>magic>>savedVersion;
- if(magic!="VEYRA_PRESETS"||savedVersion!=18)return false; // schema v18 adds the colour block
+ if(magic!="VEYRA_PRESETS"||savedVersion!=19)return false; // schema v19 adds the per-section colour bypass
PresetStore reloaded(path);
if(!reloaded.load()||reloaded.defaultSettings()!=value)return false;
}else{
@@ -134,7 +134,9 @@ ok=ok&&b.entries().size()==1&&b.defaultSettings()==s;
PresetStore old(p);ok=ok&&old.load()&&!old.defaultSettings().protection.enabled&&old.defaultSettings().srTarget==veyra::pipeline::SrTarget::Uhd4K&&old.put(L"v2",s);
PresetStore upgraded(p);ok=ok&&upgraded.load()&&upgraded.entries().size()==2&&upgraded.entries()[1].settings==s;
- {std::ofstream f(p);f<<"VEYRA_PRESETS 99\ncorrupt mediaPath executable must reject";}PresetStore c(p);ok=ok&&!c.load()&&!c.put(L"override",{});std::ifstream f(p);std::string data((std::istreambuf_iterator<char>(f)),{});ok=ok&&data=="VEYRA_PRESETS 99\ncorrupt mediaPath executable must reject";
+{std::ofstream f(p);f<<"VEYRA_PRESETS 99\ncorrupt mediaPath executable must reject";}PresetStore c(p);const bool corruptLoaded=c.load();const bool corruptPut=c.put(L"override",{});std::ifstream f(p);std::string data((std::istreambuf_iterator<char>(f)),{});
+ const bool corruptPreserved=data=="VEYRA_PRESETS 99\ncorrupt mediaPath executable must reject";
+ ok=ok&&!corruptLoaded&&!corruptPut&&corruptPreserved;
f.close();ok=legacyBackends(p)&&ok;
std::cout<<"preset roundtrip, all fields, duplicate, rename-default, delete, validation, unknown schema, corrupt-preservation="<<ok<<'\n';return ok?0:1;}