比较提交
| 作者 | SHA1 | 提交日期 | |
|---|---|---|---|
|
|
85b6590944 | ||
|
|
06d531c443 | ||
|
|
eeeee102cd | ||
|
|
f575c01893 | ||
|
|
a249436776 | ||
|
|
b640b5da06 | ||
|
|
7814a03f95 | ||
|
|
301b31438e | ||
|
|
100941fab3 | ||
|
|
26a888f453 | ||
|
|
b4dc7e3267 | ||
|
|
f664887de3 | ||
|
|
38bf12326e | ||
|
|
696580210b | ||
|
|
123a6c8507 | ||
|
|
b3176f854d | ||
|
|
020f064a28 | ||
|
|
6de86a8ec3 | ||
|
|
c771a9274a | ||
|
|
3b57e36eb1 | ||
|
|
847a5ea999 | ||
|
|
2f81cad3ed | ||
|
|
a5adf39a1d | ||
|
|
23d5af7dcf | ||
|
|
0eb56aed12 | ||
|
|
7bac613f4a | ||
|
|
0b53fdcdfd | ||
|
|
38adc259e0 | ||
|
|
745aa1626e | ||
|
|
fa7ef93714 | ||
|
|
1932565ecd | ||
|
|
dbf25fe671 | ||
|
|
375761619f | ||
|
|
34162025b6 | ||
|
|
3fc32f3e19 | ||
|
|
659a8c540d | ||
|
|
cec044f124 | ||
|
|
f72aa2609d | ||
|
|
edfb74b171 | ||
|
|
bbdd47d1d7 |
没有与搜索条件相匹配的文件
@@ -0,0 +1,27 @@
|
||||
大鱼调色 1.4.0(24),适用于 Apple Silicon Mac,最低 macOS 14.6。
|
||||
|
||||
- 十二个模块标题增加“添加蒙版”和“再加一层”。新增工具从初始化参数开始,独立保存参数、开关、折叠、复位、删除、LUT和蒙版;同类HSL可以连续叠加。
|
||||
- 蒙版包括椭圆、矩形、钢笔、线性渐变、HSL和亮度选区,可相加、减去、相交、反转、羽化和调节强度。画面提供轮廓和左侧工具栏,面板可编辑各类型参数。
|
||||
- 从“大鱼调色盘”源码适配Metal光流与仿射跟踪,支持几何蒙版的正向、反向、双向和单帧跟踪,取消保留可信段,一次撤销恢复;单帧完成后移动播放头。
|
||||
- 完整预设v4保留每层工具、蒙版和逐帧轨迹,兼容旧预设。旧float参数和原调色链保留。
|
||||
|
||||
正式版本222项原生检查通过。FCP12.4实测第二HSL初始化为零、红色色相32且原层仍为零,原层椭圆与新增层矩形独立;正向99帧轨迹、双向100帧轨迹、新增层单帧2键及播放头移动通过。一次撤销/重做、正常退出重开后的完整预设均逐字节一致。远端独立恢复210文件,模型/模板和Metal着色器重建一致。
|
||||
|
||||
画面中心拖动已经由用户用实际鼠标确认,原生点击/拖动回调及原层蒙版坐标变化已核对,新增层蒙版坐标保持不变。旋转、缩放和钢笔手势尚未实机确认;原生模拟宿主的真实Metal叠加、命中、拖动提交、一次撤销及Esc检查通过。Motion、Intel、旧系统、变速/裁剪/非方像素工程未实测。
|
||||
|
||||
新增工具标量目前是静态作者值,蒙版轨迹按时间求值。跟踪不含透视、剪切。空间蒙版不能导出为Cube,需保存完整预设。旧模板实例若不显示画面控件,可先保存完整预设,再应用新版效果并载入;不自动覆盖旧效果。
|
||||
|
||||
安装包包含原生FxPlug APP和FCP模板,不含用户LUT、预设、最近使用记录或媒体。安装前保存工作并正常退出Final Cut Pro/Motion。唯一APP位置为 `/Library/Plug-Ins/FxPlug/大鱼调色.app`。APP已正式安装;PKG另做签名、公证、票据、Gatekeeper及展开验包,不重复执行安装器。
|
||||
|
||||
版本标签:`v1.4.0-tool-masks-20261101`
|
||||
APP实际编译源码:`dbf25fe6719f17075362538dad0404951102524d`
|
||||
APP公证:`40fdaaaa-1821-4cc8-bec3-c5dc6d8b9f77`,Accepted
|
||||
|
||||
PKG公证:`da6edea3-11f4-451b-aece-91916cca329a`,Accepted
|
||||
APP和PKG均通过Developer ID签名、票据与Gatekeeper;20项展开验包通过。
|
||||
|
||||
附件:`大鱼调色-1.4.0.pkg`
|
||||
大小:14,250,425字节
|
||||
SHA-256:`16a4958e28bc2a43c40e6131067eb03a49aecba5bbe3c0424bc7024fa532af38`
|
||||
|
||||
安装包明细见本标签的 `verification/Package.json`;实际发布及完整下载校验见后续主分支的 `verification/Release.json`。
|
||||
@@ -0,0 +1,7 @@
|
||||
新增工具现在紧接点击的模块插入,初始化参数独立;旧工程已有的末尾层保留原位置与画面。蒙版检视器扩大文字、数值框和按钮,滑杆分行显示。修复钢笔进入绘制态、实时预览、曲柄、闭合/取消/重画及提示文字方向。
|
||||
|
||||
跟踪参考Color Finale行为独立适配:实际钢笔路径范围、300特征、亚像素精炼、21×21光流,最高3840×2160分析采样。281项原生检查及18项独立CPU/Metal跟踪检查通过。FCP12.4实测相邻插入、独立参数、绘制态与面板、钢笔蒙版正向99键、一次撤销/重做及保存重开完整预设一致。
|
||||
|
||||
用户已用实际鼠标确认钢笔“可以绘制并闭合”,放点与闭合验收通过。自动化输入没有进入FCP画面回调,曲柄/删除等其它手势仍以原生OSC模拟检查为据。当前不含Color Finale全部能力,B样条、编组、人物/图像/外部蒙版和完整轨迹区段编辑等尚有差异;未做同一真实视频的完整轨迹等价对照。跟踪不含透视/剪切。详细证据见仓库交接文档和verification/HostMaskWorkflow1.4.1.json。
|
||||
|
||||
版本1.4.1(26),Apple Silicon,macOS14.6起;APP实际编译源码 `0eb56aed126c825ca89712ce90f8cc1c05b03d89`。APP公证 `1ddc5499-2da3-4d98-8b2d-09272b0ee326`、PKG公证 `9a5ff448-2ac1-444e-b993-2928cf8c333f` 均Accepted,票据/Gatekeeper和20项展开验包通过。包 `大鱼调色-1.4.1.pkg`,14,337,616字节,SHA-256 `0c167aba339bbfdd9c4cbd96aea384e2d43f6d498629ebaf7b1c18cbc6dca5c6`。发行标签保留完整源码和交付记录,APP编译节点与发行记录节点分别列明。唯一正式APP位置 `/Library/Plug-Ins/FxPlug/大鱼调色.app`;不含用户LUT、预设或媒体。
|
||||
@@ -0,0 +1,9 @@
|
||||
修复真实素材从中间帧启动跟踪依赖预览缓存的问题,分析首帧直接作为种子。4K细纹低通后按比例缩小至最高1280×720运动分析,调色输出分辨率不变;重新校准运动拟合容差与置信度,保留可信度和错误变换保护。
|
||||
|
||||
失跟显示原因和保留帧数,正常结束宿主后台分析,可立即重新跟踪。修复首帧反向边界互等、带前置片段时单帧定位错误,以及已有相同轨迹的单帧操作不前进问题。
|
||||
|
||||
FCP12.4正式31版实测同一4K60素材在25p时间线中间双向285键、首帧正向285键;取消后重启、失跟后连续重试、边界与连续前后单帧通过。正常退出冷重开完整预设逐字节一致。正式路径293项原生检查与19项独立CPU/Metal检查通过,源码已从远端独立恢复重建核验。
|
||||
|
||||
区域仿射跟踪不等同人物分割或非刚性描边;遮挡/变形可能需要手工调整后继续。未宣称完整Color Finale能力等价。原工程与用户媒体保留,包内不含用户媒体、预设或LUT。
|
||||
|
||||
版本1.4.2(31),Apple Silicon,macOS14.6起;APP实际编译源码 `123a6c85078e8aa41fe55577b6dab5622ed7d128`。APP公证 `0bb9a94e-c54a-4d87-95ec-51338579c04f`、PKG公证 `2de9f8bb-91b5-41dc-924c-1136ae7bf73f` 均Accepted,票据/Gatekeeper和20项展开验包通过。包 `大鱼调色-1.4.2.pkg`,14,339,640字节,SHA-256 `d137e3516b9c4abc1e6959b83693f5ed09e040cf018b2e29508cc92246fe76f2`。固定正式APP位置 `/Library/Plug-Ins/FxPlug/大鱼调色.app`。发行标签 `v1.4.2-tracking-midpoint-20261102` 另含最终验收和恢复记录,保留全部历史标签及安装包。
|
||||
@@ -0,0 +1,7 @@
|
||||
修复模块折叠时蒙版控件没有一起收起的问题,展开后恢复已有蒙版面板。原模块和独立叠层都遵循自身折叠状态。
|
||||
|
||||
标题栏的蒙版按钮旁新增数量标记;无蒙版时隐藏,已停用的蒙版也计入已添加数量。折叠后数量仍可见,删除和撤销会即时更新,便于辨认哪一层有蒙版。
|
||||
|
||||
正式路径293项既有原生检查通过。FCP12.4验证原模块/独立层分别折叠和展开、2/1数量、删除至0及撤销、保存冷重开;完整预设逐字节一致,用户现有286个轨迹键保留。仅改变布局及标题状态,不修改调色渲染、跟踪算法或数据结构;未另做Motion/Intel实机验收。
|
||||
|
||||
版本1.4.3(33),Apple Silicon,macOS14.6起。APP实际编译源码 `26a888f4534792481c6a9933091cb0b23307cd24`;APP公证 `e755670d-8fb3-46d2-95c3-1206f014d16d`、PKG公证 `f9218078-8fd0-4a0c-9240-4b1acf7d9655` 均Accepted,签名、票据、Gatekeeper和20项展开验包通过。包 `大鱼调色-1.4.3.pkg`,14,340,650字节,SHA-256 `41bba698a70a7629438688a4be74947f424f3af04190090c44f248827b4c3bb2`。唯一正式APP位置 `/Library/Plug-Ins/FxPlug/大鱼调色.app`,包内不含用户预设、媒体或LUT。历史标签和发行包保留。
|
||||
@@ -0,0 +1,7 @@
|
||||
新增通道混合器:RGB三输出矩阵、保持亮度、保持饱和度和混合强度。新增胶片模拟:减色、晕光、辉光、颗粒、暗角五组,独立启停;颗粒支持固定种子与1–5帧保持。新模块均支持蒙版、区域跟踪、相邻初始化叠层和完整预设保存,既有调色链与旧工程数据保留。
|
||||
|
||||
参考本机Color Finale 2.16.2组件独立实现,产品运行和构建不加载原厂二进制。减色/颗粒接入既有sRGB边界,其余在线性纹理上;本版不含八种ACES印片外观,不承诺原版任意ACES链完全等价。纯矩阵及减色可导出Cube,活跃空间/时间效果或蒙版会提示无法保存为静态Cube。
|
||||
|
||||
349项原生检查、四种尺寸184项原版组件对照通过。FCP12.4验证用户旧234参数、资产路径、蜘蛛盘和287键蒙版载荷保持,新增层/蒙版/折叠及删除撤销重做通过。正式ProRes导出确认颗粒两帧保持,组合与颗粒完整预设冷重开前后逐字节一致,三项目FCPXML回导通过。Motion、Intel未实机验收。
|
||||
|
||||
版本1.5.0(34),Apple Silicon,macOS14.6起。APP实际编译源码 `06d531c443b0bb2f179022a4e64148394f5d0690`;APP公证 `164abf2b-4e67-4504-b72a-04122da9e381`、PKG公证 `05f849da-5567-4351-9556-742d17b95723` 均Accepted,签名、票据、Gatekeeper和20项展开验包通过。包 `大鱼调色-1.5.0.pkg`,14,380,104字节,SHA-256 `3ecabc7a8bfd675b228a5f00016aa17a35b65b544055e57793ec3bff3d7e0294`。唯一正式APP位置 `/Library/Plug-Ins/FxPlug/大鱼调色.app`,包内不含用户预设、媒体或LUT。APP已独立安装并在FCP验收;PKG仅展开验包,未再次运行系统安装器。历史标签和发行包保留。
|
||||
@@ -1,6 +1,32 @@
|
||||
# 大鱼调色
|
||||
|
||||
原生 FxPlug 4 调色器,当前正式版本 **1.3.1(19)**。唯一安装位置为 `/Library/Plug-Ins/FxPlug/大鱼调色.app`;Final Cut Pro 中从“效果 → 大鱼调色”添加。
|
||||
原生 FxPlug 4 调色器,当前正式安装版本 **1.5.0(34)**。唯一安装位置为 `/Library/Plug-Ins/FxPlug/大鱼调色.app`;Final Cut Pro 中从“效果 → 大鱼调色”添加。
|
||||
|
||||
交接与恢复入口:[大鱼调色FxPlug4交接.md](大鱼调色FxPlug4交接.md)。
|
||||
|
||||
## 胶片模拟与通道混合器
|
||||
|
||||
新增可重复的胶片模拟和通道混合器,现有调色、蒙版、区域跟踪和相邻叠层保留。每个新工具都有独立眼睛、折叠、复位、蒙版、数量标记和“再加一层”;新增层从默认值开始。
|
||||
|
||||
通道混合器按红、绿、蓝输出分组,每个输出有三个输入系数,并提供保持亮度、保持饱和度和混合强度。胶片包含减色、晕光、辉光、颗粒、暗角五组,各自启停;颗粒支持精确帧时间、1–5帧保持和固定种子。默认保持中性,旧工程缺省不改变画面。
|
||||
|
||||
本机Color Finale 2.16.2的相关数学已单独取证并对照,产品独立构建,不加载原版APP或原版二进制。新阶段位于既有显示域链之后;减色/颗粒沿用本工程sRGB边界,其余在线性域。活跃减色沿用原核的0–1限幅;不宣称与原版全部ACES管理路径完全等价。原版ACES输出中的八种印片外观未纳入本版五组处理。
|
||||
|
||||
完整预设升级为v5,兼容旧版。纯通道矩阵和减色可导出Cube;活跃晕光、辉光、颗粒、暗角和蒙版不能保存为静态Cube,导出时说明原因。
|
||||
|
||||
349项原生检查、四种尺寸184项原版组件对照通过。FCP12.4验证旧234参数、LUT路径、蜘蛛盘和全部287键蒙版载荷不变;新增层默认值、蒙版数量、折叠、删除撤销/重做、冷重开通过。1920×1080正式导出验证“两帧保持”,组合预设8987字节及颗粒预设8420字节重开前后逐字节一致。见[研究与边界](research/ColorFinaleFilmMixer.md)、[组件对照](verification/FilmMixerReference.json)、[宿主验收](verification/HostFilmMixer1.5.0.json)。
|
||||
|
||||
## 蒙版折叠与标题标记
|
||||
|
||||
蒙版面板随所属模块一起折叠,展开后恢复已有控件。标题栏蒙版按钮旁显示已添加的蒙版数量,无蒙版时隐藏标记;原模块与独立叠层分别计数,已停用的蒙版也计入数量。标记在折叠后仍可见,不改变蒙版和轨迹。
|
||||
|
||||
1.4.3正式路径293项既有原生检查通过;FCP12.4验证原模块、独立层、删除到零/撤销、折叠后数量标记及冷重开,完整预设逐字节一致。当前用户设置中的286个轨迹键保留。见[本轮宿主验收](verification/HostMaskFolding1.4.3.json)。
|
||||
|
||||
## 1.4.2 跟踪修复
|
||||
|
||||
中间帧启动直接使用宿主分析首帧,预览缓存缺失或陈旧不会阻止开始。真实素材的细纹运动采样和拟合容差已调整,仍保留可信度与错误变换保护。失跟说明原因与保留帧数;正常取消标记结束宿主后台任务。单帧跟踪会把源时间转换到时间线位置,支持片段前有其它内容时连续操作。
|
||||
|
||||
1.4.2的293项原生检查和19项独立CPU/Metal跟踪检查通过。该版FCP12.4实测同一4K素材中间双向285键、首帧正向285键;取消后重启、失跟后连续重试、边界停止与连续单帧通过,后台任务正常闲置。正常退出冷重开后完整预设逐字节一致。APP已公证、粘附票据并安装;安装包与Release结果见对应版本验证记录。用户媒体、预设和项目快照只保存在本机。
|
||||
|
||||
## 色彩管理与一级调色
|
||||
|
||||
@@ -22,13 +48,36 @@ LUT 缩略图浏览器使用宿主的独立可调整窗口:拖动标题栏移
|
||||
|
||||
五套主题跨实例记忆。风格 LUT 网格打开缩略图浏览库;用户库为 `~/Movies/大鱼调色LUT/look LUTs`。后台扫描、导入、解析、预览、取消和最后一次选择生效的机制保留;支持既有 UTF-8/16/32 与旧编码 Cube 兼容。用户文件不进入源码或安装包。
|
||||
|
||||
## 每工具蒙版与再次添加工具
|
||||
|
||||
十四个模块标题均有“添加蒙版”和“再加一层”。新增工具紧接点击的原工具或新增工具插入,从本工具的初始化参数开始,拥有独立启停、折叠、复位、删除、LUT 和蒙版;不会复制原层当前设置。新增一级采用 Rec.709/Gamma 2.4 同域输入输出,新增肤色保护强度为零。
|
||||
|
||||
蒙版包括椭圆、矩形、钢笔、线性渐变、HSL 和亮度选区,支持相加、减去、相交、反转、羽化和强度。矩形、椭圆和闭合钢笔区域可正向、反向、双向或单帧跟踪。算法从“大鱼调色盘”固定源码适配,随本产品独立构建;不依赖安装父插件。完整预设 v5 保存新增工具、蒙版和逐帧轨迹,兼容旧预设。空间蒙版不能导出到 Cube,导出时会提示。
|
||||
|
||||
蒙版检视器采用13pt参数文字和数值、32–36pt按钮、独立整行滑杆及两列跟踪操作。钢笔菜单直接进入绘制态,可点击放点、拖出曲柄、点首节点/Return/“完成绘制”闭合,Esc/取消保留原路径;支持重画、Delete回退和即时预览。跟踪改进实际路径搜索边界、300点特征、亚像素精炼和21×21光流,运动分析按显示比例限制到1280×720,4K细纹先低通再缩小,调色渲染和输出分辨率保持原设置。
|
||||
|
||||
1.4.1的281项原生检查、独立CPU/Metal跟踪18项通过。FCP实测相邻插入、初始化与独立参数、大号面板、绘制态切换、钢笔蒙版正向99键、一次撤销/重做及保存重开完整预设一致。画面提示文字方向已修正。用户随后用实际鼠标确认“可以绘制并闭合”,钢笔放点和闭合实机验收通过;自动化输入未进入OSC回调,曲柄/删除等其它手势仍以原生模拟宿主检查为据。1.4.0的中心拖动已有用户确认。新增工具标量仍为静态值,蒙版轨迹按时间求值,跟踪不含透视/剪切。
|
||||
|
||||
旧schema1末尾层保持原保存位置与渲染,避免改变旧工程外观;新添加的层使用schema2插入锚点。原生固定模块的既有处理顺序保留。当前实现参考本机Color Finale的行为和参数独立适配,并非全部功能完整移植;B样条、编组、人物/图像/外部蒙版及完整轨迹区段编辑等差异见专项清单。
|
||||
旧模板实例可能保留关闭画面控件的状态;可先保存完整预设,再重新应用新版效果并载入预设。不会自动覆盖旧实例。实现与验收边界见 [实现说明](research/ToolMaskImplementation.md)、[宿主记录](verification/HostToolMasks.json) 和 [恢复核验](verification/ToolMaskRecovery.json)。
|
||||
|
||||
## 验证与恢复
|
||||
|
||||
- [本轮交接](大鱼调色FxPlug4交接.md)
|
||||
- [当前正式路径原生检查](verification/InstalledSelfTest.json)
|
||||
- [中间帧与真实素材跟踪修复](research/TrackingMidpoint1.4.2.md)
|
||||
- [跟踪宿主验收](verification/HostTrackingMidpoint1.4.2.json)
|
||||
- [跟踪源码独立恢复](verification/TrackingMidpointRecovery.json)
|
||||
- [插入、钢笔和跟踪工作流](research/MaskWorkflow1.4.1.md)
|
||||
- [1.4.1 FCP验收及用户实际钢笔确认](verification/HostMaskWorkflow1.4.1.json)
|
||||
- [Color Finale对照和未迁移范围](research/ColorFinaleMasksFollowup.md)
|
||||
- [1.4.1远端源码独立恢复](verification/MaskWorkflowRecovery.json)
|
||||
- [每工具蒙版、跟踪、保存重开与用户实际拖动](verification/HostToolMasks.json)
|
||||
- [1.4.0 发行标签独立恢复](verification/ToolMaskReleaseRecovery.json)
|
||||
- [CST 来源与集成边界](research/CSTIntegration.md)
|
||||
- [CST 固定源码节点与摘要](research/CSTIntegration.json)
|
||||
- [蜘蛛盘与色轮来源和适配](research/SpiderAndBalanceIntegration.md)
|
||||
- [201 项正式版原生与独立像素对照](verification/BrowserNative.json)
|
||||
- [1.3.1 的 201 项原生与独立像素对照](verification/BrowserNative.json)
|
||||
- [浏览器布局与最近使用专项检查](verification/BrowserCustomization.json)
|
||||
- [大规模 LUT 加载与取消回归](verification/BrowserRegression.json)
|
||||
- [204,683 项网格数学检查](verification/SpiderMath.json)
|
||||
@@ -42,6 +91,6 @@ LUT 缩略图浏览器使用宿主的独立可调整窗口:拖动标题栏移
|
||||
|
||||
正式发行包由 PKG 工坊技能生成,包含 APP 与 FCP 模板,不含用户 LUT、预设或媒体。安装与发布证据分别保存在 [Package.json](verification/Package.json) 和 [Release.json](verification/Release.json);以其中记录的版本和成功状态为准。
|
||||
|
||||
本版本正式包目标 `../发行包/大鱼调色-1.3.1.pkg`;安装包和发布状态以验证记录的 1.3.1 结果为准。历史发行包保留。
|
||||
正式发行包:[大鱼调色-1.5.0.pkg](../发行包/大鱼调色-1.5.0.pkg);APP与PKG均已签名、公证、粘附票据并通过Gatekeeper,20项展开验包通过。发行标签 `v1.5.0-film-mixer-20261102`,上传与下载核验结果以 [Release.json](verification/Release.json) 中匹配本版的记录为准。历史[1.4.3 Release](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.4.3-mask-fold-20261102)及更早发行包、标签和验收记录保留。
|
||||
|
||||
FCP 已验证 Sony 默认、可见复位、浮动浏览器、系统窗口缩放、两种布局、最近排序与关闭重开。原生检查单独覆盖几何/布局持久化和鼠标事件;自动化没有独立确认自由标题栏/边缘拖动。用户开始使用后保留其当前布局与选择,未为额外测试再次重启宿主。
|
||||
1.3.1 的历史验收包含 Sony 默认、可见复位、浮动浏览器、系统窗口缩放、两种布局、最近排序与关闭重开。原生检查单独覆盖几何/布局持久化和鼠标事件;当时自动化没有独立确认自由标题栏/边缘拖动。1.4.0 另在独立合成工程中完成上文的宿主检查,用户确认中心拖动后保留其试调状态。
|
||||
+75
-1
@@ -1,6 +1,74 @@
|
||||
# 大鱼调色恢复说明
|
||||
|
||||
## 当前 1.3.1(19):色轮复位、可调整浏览器与最近使用
|
||||
当前交接:[大鱼调色FxPlug4交接.md](大鱼调色FxPlug4交接.md)。
|
||||
|
||||
## 当前1.5.0(34):胶片与通道混合器
|
||||
|
||||
正式路径 `/Library/Plug-Ins/FxPlug/大鱼调色.app`;Bundle ID `com.dayu.color` / `com.dayu.color.XPC`。实际编译源码 `06d531c443b0bb2f179022a4e64148394f5d0690`;APP公证 `164abf2b-4e67-4504-b72a-04122da9e381` Accepted,签名、票据和Gatekeeper通过。安装与启动从唯一正式位置执行,FCP12.4已验收,记录见 `verification/Delivery.json` 与 `verification/HostFilmMixer1.5.0.json`。
|
||||
|
||||
主分支远程 `https://dayu.media/git/dayu/dayu-color.git`,无LFS或子模块。新增胶片与RGB混合的全部源码、Metal、参数/模板均在仓库,不依赖本机Color Finale、REA缓存或父工程。42个参数追加,944字节GPU前缀和1104字节旧版完整前缀保持。恢复时使用固定标签/提交,证书与私钥须单独恢复,不能由Git替代。
|
||||
|
||||
远端独立clone已完成Release构建及349项检查,四种尺寸原版组件对照184项通过。组件证据、域/顺序及限制见 `research/ColorFinaleFilmMixer.md`。当前用户媒体、完整预设、FCP资源库和验收导出只在本机,不进入仓库或安装包。安装包与Release元数据见本轮Package/Release记录。
|
||||
|
||||
正式PKG `../发行包/大鱼调色-1.5.0.pkg`,14,380,104字节,SHA-256 `3ecabc7a8bfd675b228a5f00016aa17a35b65b544055e57793ec3bff3d7e0294`;PKG公证 `05f849da-5567-4351-9556-742d17b95723` Accepted,签名、票据、Gatekeeper与20项展开验包通过。本轮未再次运行系统安装器,正式APP已有独立安装和宿主验收。发行标签 `v1.5.0-film-mixer-20261102`;发布与全量下载结果见匹配本版的 `verification/Release.json`。
|
||||
|
||||
## 历史 1.4.3(33):蒙版折叠与数量标记
|
||||
|
||||
当前正式版1.4.3(33),APP实际编译源码 `26a888f4534792481c6a9933091cb0b23307cd24`,公证 `e755670d-8fb3-46d2-95c3-1206f014d16d` Accepted。签名、票据、Gatekeeper、唯一正式安装及正式路径293项既有原生检查通过。正式位置和Bundle ID不变。
|
||||
|
||||
修复模块折叠时蒙版面板仍显示的问题;内容高度和行显示都遵循模块折叠状态。标题蒙版按钮旁新增已添加数量标记,无蒙版时隐藏;原模块和独立层各自计数,停用蒙版仍计入,折叠后保留标记。状态徽标不拦截鼠标,按钮提示和辅助说明同步数量。未改渲染、跟踪算法或数据结构。
|
||||
|
||||
FCP12.4验证用户现有蜘蛛盘蒙版的收起/展开,完整77276字节预设与修改前逐字节一致,286个轨迹键保留;独立合成片段验证原HSL2个蒙版(含1个停用)、独立HSL1个,分别折叠/展开,删除2→1→0与撤销0→1→2即时刷新。两层折叠后蒙版面板为0,数量2/1保留。正常退出冷重开,完整8471字节预设前后及重开均逐字节一致。未强制结束宿主。32版为折叠修复候选,33版纳入用户补充的数量标记;32未发布。
|
||||
|
||||
入口:[本轮说明](research/MaskFolding1.4.3.md)、[正式宿主验收](verification/HostMaskFolding1.4.3.json)、[远端源码恢复](verification/MaskFoldingRecovery.json)、[副本清理](verification/MaskFoldingCleanup.json)。远端独立恢复240个文件并比较全部字节、full/strict fsck、原生模型模板和Metal重建通过;着色器摘要沿用上一版且与正式库一致。用户媒体和预设留在本机,无LFS/子模块。PKG和Release最终结果以对应版本验证记录为准。
|
||||
|
||||
|
||||
|
||||
本轮正式安装包 `../发行包/大鱼调色-1.4.3.pkg`,14,340,650字节,SHA-256 `41bba698a70a7629438688a4be74947f424f3af04190090c44f248827b4c3bb2`;PKG公证 `f9218078-8fd0-4a0c-9240-4b1acf7d9655` Accepted,签名/票据/Gatekeeper与20项展开验包通过。APP已有独立正式安装及宿主验收,本轮未再次运行系统安装器。Release标签 `v1.4.3-mask-fold-20261102` 已发布,标签提交 `301b31438e8da95dc4e6e1c09498ad814a0ebcfc`;[Release371](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.4.3-mask-fold-20261102) / 附件16在草稿和发布后均完整下载校验14,340,650字节及SHA-256一致。发行标签已从远端独立恢复244文件,全部字节比较及full/strict fsck通过,见 `verification/MaskFoldingReleaseRecovery.json`。核验下载副本和恢复clone已清理,仓库可见性不变。
|
||||
|
||||
## 历史 1.4.2(31):真实素材与中间起点跟踪
|
||||
|
||||
当前正式版1.4.2(31),APP实际编译源码 `123a6c85078e8aa41fe55577b6dab5622ed7d128`。APP公证 `0bb9a94e-c54a-4d87-95ec-51338579c04f` Accepted,签名、票据、Gatekeeper、唯一正式安装及正式路径293项原生检查通过。固定位置 `/Library/Plug-Ins/FxPlug/大鱼调色.app`,Bundle ID和签名团队不变。PKG与Release最终结果见对应版本记录。
|
||||
|
||||
中间起点以宿主分析首帧为准,不再依赖预览缓存。4K细纹先低通再按比例缩到最高1280×720运动分析,调色渲染输出分辨率不变;拟合容差与置信度一致归一化,保留失效与过期写入保护。失跟显示具体原因、保留可信帧数并正常结束宿主任务;首帧反向使用有效种子范围正常结束;单帧经源时间到时间线转换,已有相同轨迹也正常前进。
|
||||
|
||||
FCP12.4正式31版在同一4K60素材的25p时间线中:中间双向285键、首帧正向285键;取消保留159键后任务闲置,可重新跟完整段;切换画面在2秒失跟、保留50键,连续重试无弹窗且任务闲置。带4秒前置片段的连续单帧7:17→7:18→7:19→7:18;首帧反向保持响应。正常退出冷重开完整预设77087字节逐字节一致。原工程、原媒体与原65键设置保留,验收只在独立副本进行。候选27–30发现的生命周期、单帧和边界问题均有记录,未发布候选包。
|
||||
|
||||
新增层相邻插入、加大的蒙版面板、实际鼠标钢笔/中心拖动确认等1.4.1与1.4.0历史保留。仍不是完整Color Finale移植或人物分割,遮挡/变形可能需要手工修正再从当前帧继续。Motion、Intel、变速/裁剪/非方像素工程未实机验收。
|
||||
|
||||
入口:[实现与边界](research/TrackingMidpoint1.4.2.md)、[正式宿主验收](verification/HostTrackingMidpoint1.4.2.json)、[原生及离线聚合](verification/TrackingMidpoint1.4.2.json)、[编译源码远端恢复](verification/TrackingMidpointRecovery.json)、[本轮清理](verification/TrackingMidpointCleanup.json)、[恢复方法](RECOVERY.md)。
|
||||
|
||||
|
||||
从大鱼远程克隆 main 后检出上述实际编译SHA,构建方法沿用本文件下文。已独立恢复233个提交文件并核对每个字节,full/strict fsck、原生模型模板与Metal重建通过;着色器SHA `b3258b903ed485b4b738a823a7de929bca9380365ad2de9c2c7781660293df7e` 与正式库一致。无LFS/子模块,恢复clone已清理。用户媒体、预设、签名私钥不在Git中。
|
||||
|
||||
|
||||
本轮正式PKG `../发行包/大鱼调色-1.4.2.pkg`:14,339,640字节,SHA-256 `d137e3516b9c4abc1e6959b83693f5ed09e040cf018b2e29508cc92246fe76f2`;PKG公证 `2de9f8bb-91b5-41dc-924c-1136ae7bf73f` Accepted,签名/票据/Gatekeeper与20项展开验包通过。本轮未再次运行系统安装器,正式APP已有独立安装与宿主验收。Release标签 `v1.4.2-tracking-midpoint-20261102` 已发布,标签提交 `38bf12326e74f2f026bc4c7627729121b6aa261d`;[Release370](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.4.2-tracking-midpoint-20261102) / 附件15在草稿与发布后均完整下载核对14,339,640字节及SHA-256一致,仓库可见性保持原状。发行标签从远端独立恢复237个文件,见 `verification/TrackingMidpointReleaseRecovery.json`,全部字节比较和full/strict fsck通过;核验下载副本与恢复clone已清理。
|
||||
|
||||
## 历史 1.4.1(26):相邻插入、蒙版可读性与钢笔流程
|
||||
|
||||
APP实际编译 `0eb56aed126c825ca89712ce90f8cc1c05b03d89`,公证 `1ddc5499-2da3-4d98-8b2d-09272b0ee326` Accepted;票据、Gatekeeper、唯一正式安装和安装后281项原生检查通过。正式路径、Bundle ID和签名团队不变。PKG/Release以当前验证JSON的版本和成功状态为准。 本轮发行标签 `v1.4.1-mask-workflow-20261101`;包 `../发行包/大鱼调色-1.4.1.pkg`,14,337,616字节,SHA-256 `0c167aba339bbfdd9c4cbd96aea384e2d43f6d498629ebaf7b1c18cbc6dca5c6`。PKG公证 `9a5ff448-2ac1-444e-b993-2928cf8c333f` Accepted,票据/Gatekeeper与20项展开验包通过;本轮未再次执行系统安装器。
|
||||
|
||||
新层紧接点击源插入,schema2的after保存原模块或UUID锚点;旧schema1尾层不迁移,保留旧画面。渲染在原固定工具对应阶段执行新层,非只移动界面。保持无新增激活层时原融合路径、CST参考、肤色参考、黑白混合和原蜘蛛盘顺序。详见 `research/MaskWorkflow1.4.1.md`。
|
||||
|
||||
蒙版面板扩大文字/数值和按钮,钢笔有明确的绘制、完成、取消与重画状态;实时草稿不调用宿主API,完成后单次提交。跟踪采用实际路径范围、300特征、亚像素精炼、21×21光流,采样最高3840×2160。Color Finale只读研究与独立适配差异见 `research/ColorFinaleMasksFollowup.md`,并非完整移植所有原版蒙版能力。
|
||||
|
||||
FCP12.4相邻插入、独立初始化参数、面板/绘制态、钢笔蒙版正向99键、一次撤销/重做和冷重开完整预设一致;用户实际鼠标钢笔落点/闭合已确认通过,答复“可以绘制并闭合”;自动输入未进入OSC回调。原生281项和独立跟踪18项通过,不等同所有真实素材与手势均已验收。详见 `verification/HostMaskWorkflow1.4.1.json`。
|
||||
|
||||
从远端独立恢复224文件、full/strict fsck,并从恢复源码重建模型/模板及Metal,与正式版着色器一致,见 `verification/MaskWorkflowRecovery.json`。无LFS/子模块;临时clone已清理。中间25版及24版临时APP备份在26版验证后清理,历史正式PKG保留。 发行标签提交 `23d5af7dcfecc9042896a7fa3e8b8b150ed874b8` 已从远端独立恢复228文件并逐字节核对,见 `verification/MaskWorkflowReleaseRecovery.json`。Release369/附件14已经草稿网页和发布后完整下载校验,详见 `verification/Release.json`。
|
||||
|
||||
## 历史 1.4.0(24):每工具蒙版与初始化叠层
|
||||
|
||||
APP 实际编译 `dbf25fe6719f17075362538dad0404951102524d`,公证 `40fdaaaa-1821-4cc8-bec3-c5dc6d8b9f77`,Accepted;票据、Gatekeeper、唯一正式安装、222项原生检查及FCP保存重开通过。安装和实际宿主证据分别见 `verification/Delivery.json`、`verification/HostToolMasks.json`。正式包和Release以对应JSON记录的1.4.0状态为准,不套用历史1.3.1记录。
|
||||
|
||||
发行标签 `v1.4.0-tool-masks-20261101`,PKG公证 `da6edea3-11f4-451b-aece-91916cca329a` Accepted,20项展开验包通过。包 `../发行包/大鱼调色-1.4.0.pkg`,14,250,425字节,SHA-256 `16a4958e28bc2a43c40e6131067eb03a49aecba5bbe3c0424bc7024fa532af38`。本轮正式APP已安装和宿主验证,PKG未重复运行安装器。
|
||||
|
||||
新增9002静态作者文档保存UUID工具实例和每层蒙版,9003仅作不保存的OSC会话路由。旧float ID、9001资产和1104字节制服ABI保持。预设v4保存完整工具与轨迹,兼容v1–3;轨迹用精确CMTime求值,新增工具标量暂不支持宿主标量关键帧。空间蒙版不能表达为Cube,应保存完整预设。蒙版/Metal光流来源固定为父库 `f8950384e514685c8809fe8e8ee2dd5f16ad0bd7`,摘要见 `research/ToolMaskPort.json`;构建与运行不读取父库或Color Finale。
|
||||
|
||||
远端独立克隆该编译节点,210个提交文件逐字节核对、strict/full fsck通过;从恢复源码和本机SDK重建模型/模板及Metal,模板和正式着色器摘要完全一致,见 `verification/ToolMaskRecovery.json`。不含LFS或子模块。恢复临时目录已清理,签名证书私钥仍需独立恢复。
|
||||
|
||||
FCP实测独立HSL、每层椭圆/矩形、数值编辑、正向99键、双向100键、单帧2键、一次撤销/重做及冷重开完整预设一致。用户已实际确认中心拖动,原生hit/drag回调和原层坐标变化已核对,新增层蒙版坐标不变;旋转/缩放/钢笔尚未实机验证,模拟宿主的原生OSC检查通过。旧模板实例可能保留关闭OSC的状态,可保存完整预设后重新应用新版效果再载入,不自动覆盖旧工程。
|
||||
|
||||
## 历史 1.3.1(19):色轮复位、可调整浏览器与最近使用
|
||||
|
||||
实际编译 `dbb7ca4a995ef832178a32f35939aed7d3a85012`,APP 公证 `9e93dc7f-04a3-44f9-a1e4-792bd7b31533`,Accepted;票据、Gatekeeper、唯一正式安装与 FCP 12.4 加载通过。发行标签 `v1.3.1-browser-recents-20261101`,包目标 `../发行包/大鱼调色-1.3.1.pkg`。本版本发布结果见 verification/Package.json 和 verification/Release.json。
|
||||
|
||||
@@ -198,3 +266,9 @@ python3 Packaging/build_pkg.py --pkg-forge-repo /实际/PKG工坊源码目录 --
|
||||
## 1.3.1 正式 PKG
|
||||
|
||||
正式包 `../发行包/大鱼调色-1.3.1.pkg`,14,073,683 字节,SHA-256 `954b10c581f31d23a8c417a6f37b24fae19939786dce8733b4d6f09c7ed3adae`。PKG 公证 `85cad776-c3d7-4037-9643-24041b269002`,Accepted;Installer 团队 B3W25FX5H5、可信时间戳、票据、Gatekeeper 和 20 项真实展开验包通过。包内 APP 与已验收的正式安装一致,APP 实际编译 `dbb7ca4a995ef832178a32f35939aed7d3a85012`;未重复执行系统安装。
|
||||
|
||||
正式 Release 已发布并完整下载校验:[1.3.1 Release](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.3.1-browser-recents-20261101),Release ID 366、附件 ID 12;标签提交 `281721bda11484c23f294b4f0d9e0b30ef829288`,APP 编译 `dbb7ca4a995ef832178a32f35939aed7d3a85012`。附件 14,073,683 字节,SHA-256 `954b10c581f31d23a8c417a6f37b24fae19939786dce8733b4d6f09c7ed3adae`。草稿经已登录会话完整下载校验后发布,正式链接再次完整下载校验;只上传一次并复用同一附件。临时下载副本已核实清理,正式发行包保留。交付标签远端独立恢复 184 文件与 full/strict fsck 通过,见 verification/BrowserReleaseRecovery.json。
|
||||
|
||||
## 蒙版、跟踪与可重复工具的文档交接(2026-11-01)
|
||||
|
||||
文档整理前 main 为 `bbdd47d1d74e241f1f144bb2c245204e86973b3f`。交接标签 `handoff-mask-tracking-tools-20261101` 保存最新 `大鱼调色FxPlug4交接.md` 及 `research/MaskTrackingAndToolStack.md`,区分正式 1.3.1(19)与尚未实现的多个独立 HSL、每实例蒙版和跟踪。本文档提交未重新构建、安装或发布 APP/PKG,不移动原发行标签;父级“大鱼调色盘”只读参考。接续时保护用户当前窗口、布局、LUT 选择和工程。
|
||||
@@ -0,0 +1,52 @@
|
||||
# Color Finale 胶片与通道混合:本机移植记录
|
||||
|
||||
2026-11-02,基线 `b640b5da06f4c4455bb79c9b6bc16daa3088fa92`,正式1.4.3(33)。当前为研究检查点,尚未替换正式程序。
|
||||
|
||||
## 目标身份与保存位置
|
||||
|
||||
参考为本机 ColorFinale 2.16.2(625)。插件 SHA-256 `49121a6f5487060d322a59e7658166ab772e8a56f7dc1bcfa9d433a89436b30f`;RenderingEngine `32dca93459347e5ad363cb145d0ccf84b933b2045eee2c9535676a01744b84e3`;GradeKit `e868a8c6df64bf03b7c24af5657c5ac7a2259a1943dfe06e01dbb7881df018a3`。
|
||||
|
||||
REA/Ghidra12.1.4目标绑定;Hopper在本机不可用,未改环境或安装工具。原始反编译、AIR和原版运行探针数据仅在 `/Users/mac/Library/Caches/CodexBuilds/ColorResearch/dayu-film-mixer-20261102/` 及其父目录的本轮 evidence/snapshot 文件中。产品不得依赖这些缓存或 Color Finale 的安装。
|
||||
|
||||
在改动前通过现有正式插件保存当前用户完整预设到 `.../com.dayu.color/fcp-qa/film-mixer-before-user.json`,77437字节;界面显示286个轨迹键。该私有预设不入Git或发行包。接手源码工作区干净,main与远程完整SHA一致,无待补推分支。
|
||||
|
||||
## 已观察的原版合同
|
||||
|
||||
| 模块 | 观察 | 证据 |
|
||||
| --- | --- | --- |
|
||||
| 通道混合器 | RGB三个输出行各读取RGB三系数,独立保持亮度、保持饱和度;缺省恒等矩阵,两保持选项为关 | `ev_de17c8b567e4f5b5975b7f65df03a00b6b48ccbc1053283619c02b95a8543387`、`ev_05d57fdd47b4aeca7b6928f1e37f3dd1f7d8ea482cb53c62689f0ed01d0194a4`;原版AIR `ChannelMixer` |
|
||||
| 减色 | gammaAll/Cyan/Magenta/Yellow、density、densitySwitch、valueSwitch进入SubSat;通道归一化幂函数再以白归一化,不是简单RGB幂函数 | `ev_90babd33318d6df4735fc2b4fd8ff79a76e6a035939d53e9dff1abdd99c0fa0d`;AIR `SubSat`、`compute_norm` |
|
||||
| 晕光 | 原图clamp边缘→CIGaussianBlur(scatter)→HalationKernel;R/G使用boost/dyeTransmission,B保持 | `ev_a187b1b5479b8dcd3419136e4d6c7b4de8b1fd692e3469f8ce760277fc82e5b3`;AIR `HalationKernel` |
|
||||
| 辉光 | sensitivity、blurRadius、intensity送入独立通用kernel,后续Fx包装仍需追查 | `ev_91b77df09f4b079fb6dd3ec48048b920a1712de647717a18349585dab51035d2` |
|
||||
| 颗粒 | seed、intensity、grainSize、filmResponse、correlation及RGB标准差;PCG哈希+Box-Muller正态噪声;grainSize>1由MPS高斯扩散;逐通道响应与相关性混合 | `ev_ff3cd2863e3fcf6d834c2a9e80a550bb6c2c85fa28ccdd1f8c4ac941aba9f469`、`ev_591f74d294cd90958b4b5212f004171b38a49fc1799547b93b062c29f04b68ef`、`ev_6ddb156a25bce95378ef3b21653a84779d5a9a9f4924820f46a14d103359ff5e`;AIR `BoxMullerPCG`、`GrainFilter` |
|
||||
|
||||
RenderingEngine `default.metallib` SHA-256 `6fd43083a38e76c95c6256a331eabb85d97b48c32d3418e8fee4c1d28480c7ff`;`metal_kernels.metallib` `ee21f6115ef96937d7e2c41e5293bcdb8a0fbaeee9570c60e547f550399920a3`。用本机Apple Metal工具只读解析指令;静态观察不能替代实际输出对照。
|
||||
|
||||
原版最终根级顺序已由身份匹配的既有证据 `ev_c0a2873d5bcdbddba37830f470f8face16b6ffef6f4ca3da012a3abd863f3164` 建立:图层树→减色→晕光→辉光→颗粒→暗角→输出;ACES输出可选八种印片LMT。各Fx的数值映射、工作域、暗角和LMT仍在追查,不能宣称已经移植或等效。
|
||||
|
||||
## 本工程接入边界
|
||||
|
||||
保留原参数ID及944字节GPU前缀;新的参数仅追加。新增可重复通道混合器与胶片工具,沿用现有启停、折叠、蒙版、数量标记和相邻插入。旧工程缺省为严格中性,保留schema1尾层、schema2锚点及286键用户状态。
|
||||
|
||||
Cube只允许可静态表示的颜色数学;空间效果、颗粒和蒙版必须明确拒绝,完整预设保留其状态。待本机原版图像对照、原生回归和正式宿主验收完成后再记录结论。
|
||||
|
||||
## 开发检查点
|
||||
|
||||
已追加两种工具、42个宿主浮点参数及完整预设v5;旧ID与1104字节完整前缀保留。CST及原调色/蒙版/跟踪调度不重排;两个新根工具位于原显示域链/蜘蛛盘之后,schema1尾层之前。减色与颗粒用既有sRGB编码边界,晕光/辉光/暗角用宿主线性纹理;这属于本工程接入合同,并不声称与任意ACES管理的原版整条CMS完全等效。
|
||||
|
||||
原版Fx包装确认辉光使用固定2.5像素稀疏高斯预滤→向量Sobel阈值→用户diffusion高斯扩散→相加;晕光scatter缺省5,透射参数/500,boost缺省1;颗粒PCG与Box-Muller直接原版shader输出逐样本相符,相关性=1−2×colorVariation。暗角直接复用同一系统CIVignetteEffect及参数映射。证据:`ev_f0221c32adbaa1e108aa560f0f8fa60c067619ac9f5b06225df548e2671a448f`、`ev_932531fcd8aaebf06eabd6e22f1a56615ba2462f6efc3fb53cfdbdb9fd618816`、`ev_b500f2f762efd1dbbd8ae7efab9d48016482ff1463775039d25504cb4ccd9d3f`、`ev_850af09a4640201b65745c78a10a0e0a0ef67eee9614d129517f6bf13c54c11e`。
|
||||
|
||||
当前原生346项通过;独立原版CI/Metal对照仍在修正辉光边界采样。CI读取bitmap的上下行与Metal纹理相反,对照工具已有往返控制;产品CI→Metal往返验证无翻转。颗粒比对采用原版BoxMullerPCG/GrainFilter明确尺寸/种子,避免把Core Image内部切块的噪声坐标当作固定全帧坐标。此检查点尚未正式安装和宿主验收。
|
||||
|
||||
|
||||
独立原版对照38项现已全部通过:四组通道保持选项、12组减色、3种晕光半径、3种辉光阈值、4种PCG种子与12组颗粒。最大线性RGB绝对差0.0001328(通道双保持),低于预先记录的0.00015浮点容差;其余各项有各自阈值。辉光普通区域采用可分离预滤,最外一圈直接求原25点邻域,保留原版clamp边界,避免把裁切中间图的边界当作原图边界。见 `verification/FilmMixerReference.json`。这只覆盖声明的有限组件和参数,不代表原版整条CMS、全部素材或全部印片外观等价。
|
||||
|
||||
|
||||
正式构建准备:1.5.0(34),349项原生检查通过;独立原版对照在64×48、63×47、1×17、17×1四种尺寸共184项全部通过,含零矩阵/灰矩阵退化分支。上下纹理方向的颗粒固定全帧坐标验证通过;元数据旧前缀、原有跟踪/钢笔检查仍包含在原生回归中。静态3D Cube允许通道矩阵和纯减色,拒绝活跃的晕光/辉光/颗粒/暗角。FCP夹具只有三个独立合成项目,FCPXML1.12严格DTD与素材检查通过,不把内部FxPlug ID冒充模板发布参数路径;通过正式检视器设置验收参数。
|
||||
|
||||
兼容边界:新模块关闭/零混合以及旧工程缺省走原融合链;活跃减色沿用原SubSat对0…1的限幅。晕光/辉光保留邻域alpha权重,所有新处理保留入口alpha,非正alpha旁路;颗粒全帧种子不依赖Core Image内部切块顺序。原厂八种印片外观是ACES输出的另外一组资源,本轮五组胶片处理未使用这些资源,也不以相机F-Log名称冒充印片外观。
|
||||
## 正式1.5.0(34)验收完成
|
||||
|
||||
实际编译源码 `06d531c443b0bb2f179022a4e64148394f5d0690`。正式安装349项原生检查通过,FCP12.4对用户旧234参数、资产路径、蜘蛛盘及287键蒙版载荷核验保持。新工具、胶片椭圆蒙版、折叠数量、独立初始化叠层及删除撤销/重做通过。正式ProRes导出验证颗粒两帧保持,组合/颗粒完整预设冷重开前后逐字节相同。三项目原生FCPXML回导严格校验与字段比较通过。见 `verification/HostFilmMixer1.5.0.json`;四尺寸184项独立组件对照见 `verification/FilmMixerReference.json`。本轮交付五组胶片处理及矩阵,不含八种ACES印片外观。
|
||||
|
||||
APP和PKG均Developer ID签名、公证Accepted、票据/Gatekeeper通过;PKG有20项展开验包,未再次执行安装脚本。发行包、标签、全量下载和恢复结果分别见 `verification/Package.json`、`verification/Release.json` 与本版恢复记录。
|
||||
@@ -0,0 +1,261 @@
|
||||
{
|
||||
"date": "2026-11-01",
|
||||
"scope": "Read-only installed Color Finale 2.16.2(625) static analysis and independent Dayu tracking reconstruction; no target runtime/GUI",
|
||||
"target": {
|
||||
"path": "/Applications/ColorFinale.app/Contents/PlugIns/ColorFinale.pluginkit/Contents/MacOS/ColorFinale",
|
||||
"sha256": "49121a6f5487060d322a59e7658166ab772e8a56f7dc1bcfa9d433a89436b30f",
|
||||
"architecture": "arm64",
|
||||
"provider": "Ghidra 12.1.4"
|
||||
},
|
||||
"baselineCommit": "745aa1626e1df368290fbbd47a716ff3ce9ca630",
|
||||
"evidence": [
|
||||
{
|
||||
"evidence_id": "ev_6539e1080a6e0d9cf27d9cb3c26703110b8f50030981b18cc075356840849e08",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTShapeTrackerView::addShapeForEvent:",
|
||||
"address": "0x1000e2900",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_0f9372e98efac18d8f666dcf137addc2ecdaffdfdb153f0a31b3ecfc2ba8b9ca",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTShapeTrackerView::setShapeEditMode:",
|
||||
"address": "0x1000e1fcc",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_2dd4ac418346bd4d15d05f8145bb2a547ab531d742b4e8edfb3314fc49fdde0a",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTOnScreenBezierShape::mouseDown:",
|
||||
"address": "0x10009be0c",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_8aa635a486e91b5af36bc39d424964417e0b6b77706cb24218640ac253b426b6",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTOnScreenBezierShape::mouseUp:",
|
||||
"address": "0x10009c084",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_4c3864a55c7dc71ee02b67c4eed011dbe00a9d8072c275ff002607d22618c288",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTOnScreenPathShape::closePath",
|
||||
"address": "0x100033ec8",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_2fc54b9d31f2ac894aae0b560fee33284a155fe6505697c0a83be1af0bc0a8ea",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTOnScreenPathShape::controlPoint:mouseDown:",
|
||||
"address": "0x10003429c",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_d3bea253005ee2007c110f15d6658e542de8f2075d40585897b875f9b517ec2b",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTOnScreenPathShape::keyDown:",
|
||||
"address": "0x1000345c8",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_ba0c6d39ae45e26b8ade69f41f6fb8da934c526a686e64be89690b762a11e585",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTShapeBezierControlPoint::controlPoint:mouseDragged:",
|
||||
"address": "0x10009d178",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_ea178e24d10afea13fa74a0d70941648d1ca4c45005a1533df478c9212f6f9b7",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTShapeTrackerControl::addToolbarButtons",
|
||||
"address": "0x10001ef7c",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_dcd7aa770925f63c8c14c968ae6b417fda78685c7be7fa739a78209957d40e2d",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTAreaTracker::track:trackerState:",
|
||||
"address": "0x100035e40",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_e798c4e6e032e085812f81831ecc16196bd3c2278bf634961379669ee1308f7e",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTAreaTracker::trackFrame:inScene:",
|
||||
"address": "0x100036cbc",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_8bad5bbc4bd2890227567b9799cfc1e68c6d56631e67a73224d57971767664c4",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "-[FTTrackerShape(FTOnScreenShape)_addKeyFrameForShape:atTime:]",
|
||||
"address": "0x100047dc4",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_fe677a9c456fc8739e0c33edd513c3f6b94431c7fbb6f1194a78801f39f32072",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTShapeTrackerControl::shapeTrackerView:geometryDidChangeForShapes:",
|
||||
"address": "0x100025414",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_533595e2ddf4c96d5c82f3ce25c7ff44a3549f37d8b80e5b5b5a82360e283c77",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTMaskShapeViewController::viewDidLoad",
|
||||
"address": "0x10007f3b0",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
}
|
||||
],
|
||||
"localOnlyEvidenceDirectory": "/Users/mac/Library/Caches/CodexBuilds/ColorResearch/dayu-mask-followup-20261101",
|
||||
"sourceApplicationRuntimeDependency": false,
|
||||
"proprietaryCodeOrResourcesCommitted": false,
|
||||
"originalArtifactModified": false,
|
||||
"completeMigrationClaim": false,
|
||||
"limitations": [
|
||||
"Static analysis is not live runtime acceptance.",
|
||||
"Independent detector/gray conversion/LK/RANSAC safeguards do not exactly reproduce OpenCV results.",
|
||||
"Interface Builder default 64-document coverage omitted mask nibs; exact full inspector pixel sizes are unknown.",
|
||||
"B-spline, grouping/parent masks, image/person/external inputs, published masks and full keyframe-region editing are outside this fault-fix implementation.",
|
||||
"No same-video, same-path, whole-trajectory comparison to the original product has been performed."
|
||||
],
|
||||
"independentVerification": {
|
||||
"passResult": true,
|
||||
"count": 18,
|
||||
"checks": [
|
||||
{
|
||||
"name": "cpu-pen-texture-outside-creation-box-starts",
|
||||
"pass": true,
|
||||
"features": 117
|
||||
},
|
||||
{
|
||||
"yErrorPixels": 0.03234100341796875,
|
||||
"xErrorPixels": 0.007296752929676131,
|
||||
"name": "cpu-extended-pen-region-subpixel-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cpu-real-300-feature-capacity",
|
||||
"pass": true,
|
||||
"features": 300
|
||||
},
|
||||
{
|
||||
"pass": true,
|
||||
"rotation": 0.02499544620513916,
|
||||
"scaleX": 1.025027871131897,
|
||||
"scaleY": 0.9799908995628357,
|
||||
"xErrorPixels": 0.0009307861328267109,
|
||||
"yErrorPixels": 0.0005807876586860772,
|
||||
"name": "cpu-translation-rotation-independent-xy-scale"
|
||||
},
|
||||
{
|
||||
"name": "cpu-subpixel-refinement-and-redetection-remain-stationary",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cpu-unrelated-cut-is-not-trusted-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cpu-flat-region-still-refuses-tracking",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"generatedFramesAndAnalysisMilliseconds": 43.247542,
|
||||
"features": 300,
|
||||
"name": "cpu-1080p-complete-frame-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"generatedFramesAndAnalysisMilliseconds": 111.362708,
|
||||
"features": 300,
|
||||
"name": "cpu-3840x2160-complete-frame-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "metal-pen-texture-outside-creation-box-starts",
|
||||
"pass": true,
|
||||
"features": 117
|
||||
},
|
||||
{
|
||||
"yErrorPixels": 0.03234100341796875,
|
||||
"xErrorPixels": 0.007296752929676131,
|
||||
"name": "metal-extended-pen-region-subpixel-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "metal-real-300-feature-capacity",
|
||||
"pass": true,
|
||||
"features": 300
|
||||
},
|
||||
{
|
||||
"pass": true,
|
||||
"rotation": 0.02499544620513916,
|
||||
"scaleX": 1.025027871131897,
|
||||
"scaleY": 0.9799908995628357,
|
||||
"xErrorPixels": 0.0009307861328267109,
|
||||
"yErrorPixels": 0.0005807876586860772,
|
||||
"name": "metal-translation-rotation-independent-xy-scale"
|
||||
},
|
||||
{
|
||||
"name": "metal-subpixel-refinement-and-redetection-remain-stationary",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "metal-unrelated-cut-is-not-trusted-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "metal-flat-region-still-refuses-tracking",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"generatedFramesAndAnalysisMilliseconds": 31.447709,
|
||||
"features": 300,
|
||||
"name": "metal-1080p-complete-frame-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"generatedFramesAndAnalysisMilliseconds": 88.904167,
|
||||
"features": 300,
|
||||
"name": "metal-3840x2160-complete-frame-motion",
|
||||
"pass": true
|
||||
}
|
||||
],
|
||||
"memoryRunPass": true,
|
||||
"peakResidentBytes": 299597824,
|
||||
"generatedImageOracles": true,
|
||||
"baselineExtendedRegion": {
|
||||
"started": false,
|
||||
"features": 0
|
||||
},
|
||||
"newExtendedRegion": {
|
||||
"started": true,
|
||||
"features": 117
|
||||
},
|
||||
"appLaunched": false,
|
||||
"scope": "Independent generated images, CPU tracker and optional real Metal optical flow. No app or GUI host launched."
|
||||
},
|
||||
"implementationSHA256": {
|
||||
"大鱼调色/Plugin/MaskCore/DYTracker.hpp": "68d32e8704e737587729397b0e8dd856f40c26aff479af7a65e5a32c48e95d6b",
|
||||
"大鱼调色/Plugin/DYToolFlow.inc.h": "f4426c1bc4a36a93561c9d43ea794b89c10767fb94cbc442b82563766b1856d8",
|
||||
"大鱼调色/Plugin/DYTracking.metal": "e0c13390a952b13eb92081840069f79632c05326aaf1a0cc927200a84d4e4ac0",
|
||||
"tools/verify_tool_tracking_followup.mm": "961c3ff4359bc06bf7b6d1f71b8fcfa40efee32d2f7722a0af9ba813971d7c64"
|
||||
},
|
||||
"independentShaderSHA256": "2899508dbcff3329531ec23f9fe13f30993ba5416bf7788697557f5d611783f8"
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
# Color Finale 蒙版与跟踪的本机复核(2026-11-01)
|
||||
|
||||
本轮针对用户报告的“层在最底部新增、蒙版控件太小、钢笔不可用”核对本机发行产物。目标为 ColorFinale 2.16.2(625)的 arm64 插件,完整文件 SHA-256 `49121a6f5487060d322a59e7658166ab772e8a56f7dc1bcfa9d433a89436b30f`,与此前归档研究一致。原程序始终只读,未执行或操作其 FCP 界面。静态观察不是运行行为验收,也不能据此声称整个原版功能已完整迁移。
|
||||
|
||||
这里只保存行为、接口、参数和 Evidence 索引,不保存原版反编译源码、二进制、图标或其他资源。新功能仍是本产品自己的源码与 Metal 实现,不依赖 Color Finale 安装。
|
||||
|
||||
## 钢笔状态与可迁移交互
|
||||
|
||||
| 本机静态观察 | 入口与 Evidence |
|
||||
| --- | --- |
|
||||
| 选择 Bezier 新建模式后,首次点击建立可编辑/选中的零尺寸路径,交给新路径处理该点击,随后进入独立的路径编辑模式 | `FTShapeTrackerView::addShapeForEvent:` `0x1000e2900`,`ev_6539e1080a6e0d9cf27d9cb3c26703110b8f50030981b18cc075356840849e08` |
|
||||
| 新建与编辑路径是不同模式;离开路径编辑模式会尝试闭合当前路径 | `setShapeEditMode:` `0x1000e1fcc`,`ev_0f9372e98efac18d8f666dcf137addc2ecdaffdfdb153f0a31b3ecfc2ba8b9ca` |
|
||||
| 编辑态可向未闭合路径追加锚点,也有在曲线上插点的分支;放置后可拖出共线双柄 | `FTOnScreenBezierShape::mouseDown:` `0x10009be0c`,`ev_2dd4ac418346bd4d15d05f8145bb2a547ab531d742b4e8edfb3314fc49fdde0a`;`FTShapeBezierControlPoint::controlPoint:mouseDragged:` `0x10009d178`,`ev_ba0c6d39ae45e26b8ade69f41f6fb8da934c526a686e64be89690b762a11e585` |
|
||||
| 未闭合且至少三个点才允许闭合;点击首锚点会闭合 | `FTOnScreenPathShape::closePath` `0x100033ec8`,`ev_4c3864a55c7dc71ee02b67c4eed011dbe00a9d8072c275ff002607d22618c288`;`controlPoint:mouseDown:` `0x10003429c`,`ev_2fc54b9d31f2ac894aae0b560fee33284a155fe6505697c0a83be1af0bc0a8ea` |
|
||||
| 原版未闭合路径接收 Return 或 Esc 时均尝试闭合;Delete 删除选中锚点 | `FTOnScreenPathShape::keyDown:` `0x1000345c8`,`ev_d3bea253005ee2007c110f15d6658e542de8f2075d40585897b875f9b517ec2b` |
|
||||
| 画面工具栏有选择、路径编辑、矩形、椭圆、渐变边、B 样条、Bezier;预览按钮原生最小尺寸为30×22,另有8×8内边距 | `FTShapeTrackerControl::addToolbarButtons` `0x10001ef7c`,`ev_ea178e24d10afea13fa74a0d70941648d1ca4c45005a1533df478c9212f6f9b7` |
|
||||
|
||||
大鱼本轮保留明确的“Esc取消草稿”行为,与原版“Esc尝试结束闭合”不同。不能把新实现描述为所有快捷键均完全相同。当前产品旧钢笔入口未携带绘制态,且通知会清除绘制态;即使菜单项存在,也不能证明进入了放点模式。修复应同时覆盖绘制态、首点/Return结束、删除、草稿预览、提交和取消,以及再次选择已有路径的编辑。
|
||||
|
||||
形状属性控制器将 `feather`、`opacity`、`position`、`scale`、`rotation` 绑定到对应作者属性,见 `FTMaskShapeViewController::viewDidLoad` `0x10007f3b0`,Evidence `ev_533595e2ddf4c96d5c82f3ce25c7ff44a3549f37d8b80e5b5b5a82360e283c77`。完整检视器字号和运行时像素布局未取得充分静态证据;不能从符号名称推断其可读性。
|
||||
|
||||
## 跟踪差异与本轮改进
|
||||
|
||||
原版核心 `FTAreaTracker::track:trackerState:` `0x100035e40`,Evidence `ev_dcd7aa770925f63c8c14c968ae6b417fda78685c7be7fa739a78209957d40e2d`。逐帧作者状态 Evidence `ev_e798c4e6e032e085812f81831ecc16196bd3c2278bf634961379669ee1308f7e`(`0x100036cbc`)。原版每帧接收完整图像、最多3840×2160转换为8位灰度,将 position/rotation/scale 按 effectTime 写入作者键,不是渲染时临时估计。当前大鱼已经有精确时间键、相邻帧参考、丢失停止和这些变换输出;这些并非本轮才补齐。
|
||||
|
||||
| 项目 | 原版静态观察 | 大鱼1.4.0(24)与本轮选择 |
|
||||
| --- | --- | --- |
|
||||
| 区域 | 用形状点的凸包构造特征遮罩 | 原有实际多边形判断更贴合凹路径,但包围框和前置±0.5裁剪错误。本轮改为从实际路径顶点推导变换后搜索边界,保留实际多边形判断,修复默认框外钢笔纹理被裁掉的问题 |
|
||||
| 特征 | 300点,quality0.03,最小距离10,blockSize3 | 原有180点、0.012相对阈值、按帧大小变化的间距、5×5邻域。本轮调整为300点、0.03、10像素、3×3;仍采用独立中心差分与2像素候选扫描,并不等同OpenCV检测器 |
|
||||
| 角点精炼 | `cornerSubPix` 半窗10,20次/0.03 | 原有无亚像素精炼。本轮用独立加权梯度交点迭代,半窗10、20次/0.03,限制发散并保留初始点回退;不是复制OpenCV内部实现 |
|
||||
| 光流 | LK21×21,maxLevel3即最多4级,30次/0.01;前后误差严格小于1 | 原有9×9、最多5级、20次。本轮CPU和Metal统一21×21、最多4级、30次/0.01;保留原有均值去除、RMSE及≤1.1像素前后检查,不声称数值全等 |
|
||||
| 重检测 | 分析计数小于2或偶数时重检测并精炼 | 原有每5帧或少于60点补点。本轮每2帧或不足60时重选;新点少于12时保留仍可信旧点,后续仍须通过完整拟合/失效条件 |
|
||||
| 拟合 | `estimateAffine2D` RANSAC2000次、阈值3、confidence0.99、refine10 | 本轮保留确定性400次、1.6/1.5阈值、3次最小二乘、至少8点/52%内点与非线状分布检查。阈值不能无验证地照搬,否则可能把错误帧当作成功 |
|
||||
| 输出/失效 | 原版持久化位置、旋转和独立XY缩放,失败节点不再继续 | 大鱼保持QR分解位置/旋转/独立XY缩放,丢失停止、置信度和每步缩放/旋转保护。它比已观察到的原版分支更保守,不含透视或剪切输出 |
|
||||
|
||||
独立检查 `tools/verify_tool_tracking_followup.mm` 使用已知仿射变换生成图像,分别运行CPU和真实Metal后端。默认创建框外的钢笔区域在旧提交 `745aa1626e1df368290fbbd47a716ff3ce9ca630` 检出0点、无法启动;新版本检出117点,12帧亚像素移动末帧误差约X0.0073/Y0.0323像素。另覆盖300点实际传输、旋转与非等比缩放、静止重检测、换景拒绝、平坦区域拒绝,以及1920×1080/3840×2160完整帧。18项通过;4K生成两帧及分析本机记录约CPU111ms/Metal89ms,不是所有素材的性能承诺。
|
||||
|
||||
## “完整移植”的边界
|
||||
|
||||
本轮是可验证的独立重建与关键交互修复,不能宣称完整复制Color Finale蒙版系统。原版还观察到B样条、形状多选/编组、父蒙版、图像/人物/宿主外部蒙版、HSL取色增减与来源/模糊、发布蒙版/抠出、轨迹区域选择与按键区段编辑等体系;当前大鱼每工具六类蒙版不具备全部对应能力。`FTMaskDetailViewController` 的形状、HSL、图像、人物、FCP控制器方法库存见 Evidence `ev_0497fc6415b6b210fea8a052adf0f93483af228b44063dffd2c76d93a990cef1`。大鱼独立“亮度选区”不能据此称为已复刻原版某个独立Luma类;本次主插件范围没有取得该类的充分证据。
|
||||
|
||||
算法阈值及默认值对齐不是对真实视频的等价证明。本轮尚未取得原版与大鱼在同一真实视频、相同路径及分析范围下的完整轨迹对照,也未分析原版所有链接框架和动态形状UI。完整范围继续由差异清单追踪,不能把当前故障修复或合成检查通过替代这些开放项。
|
||||
|
||||
完整REA证据和恢复snapshot仅在本机研究缓存:`/Users/mac/Library/Caches/CodexBuilds/ColorResearch/dayu-mask-followup-20261101/`。当前REA目标已关闭,原产物未修改。Interface Builder decoder默认64文档首先遍历Sparkle,未覆盖后续蒙版nib;不能把该局限解释为蒙版UI不存在。新摘要保留此未知,不复制原版资源作为新产品界面。
|
||||
@@ -0,0 +1,13 @@
|
||||
# 1.4.3(33)蒙版面板随模块折叠
|
||||
|
||||
用户报告模块收起后蒙版面板仍显示。正式1.4.2(31)中已复现:蜘蛛盘标题为折叠状态,蒙版类型、几何参数与跟踪控件仍出现在检视器。当前完整预设(含286个轨迹键)已先保存到本机验收缓存。
|
||||
|
||||
原因是DYInspector布局在内容高度累计和行显示两处,均把DYToolMaskPanel排除在collapsed条件之外。两处统一遵循模块折叠状态,折叠后隐藏整个蒙版面板并去掉占用高度;展开后恢复已有蒙版控件。原模块和新增独立层使用同一布局代码。
|
||||
|
||||
用户补充希望折叠后能辨认有蒙版的层:标题栏蒙版图标增加数量徽标(1–16),无蒙版时隐藏,启停蒙版都计入已添加数量。徽标不拦截鼠标,蒙版按钮的提示及辅助说明同步数量。五套主题从现有配色取色,展开和折叠时均保留标记。32版仅折叠修复候选完成公证安装,未发布;33版包含本次补充。
|
||||
|
||||
本次只改布局、标题栏状态显示和版本元数据,不改变启用、调色、蒙版几何、轨迹、合成方式或渲染代码。沿用现有原生检查,在正式签名公证安装后验证原模块及新增层的折叠、展开和状态保留;不为这次布局修复另写重复单元测试。
|
||||
|
||||
正式宿主和交付结果见 verification/HostMaskFolding1.4.3.json、Delivery.json、Package.json、Release.json 对应版本记录。用户预设和项目快照保留在本机,不进入Git。
|
||||
|
||||
最终33版正式路径293项检查通过。FCP验证蒙版面板随原模块和独立HSL层分别折叠,折叠后保留2/1数量标记;删除到零隐藏、撤销恢复,包含停用蒙版。用户77276字节预设和286个轨迹键不变,合成片段8471字节预设在操作前后及冷重开逐字节一致。蓝色主题实屏标记清楚可读;未单独遍历其它主题、Motion或Intel。
|
||||
@@ -0,0 +1,95 @@
|
||||
# 续作方案:工具实例、蒙版与跟踪
|
||||
|
||||
2026-11-01。**这是下一阶段方案,尚未实现。** 用户明确要增加蒙版、跟踪和可添加工具,并举例“一层 HSL 不够,再加一个 HSL”。本文的具体类型、按钮和实施顺序为建议,不把参考库现有全部功能自动扩为新产品的承诺。
|
||||
|
||||
## 一、先解决多个 HSL 的身份和执行问题
|
||||
|
||||
当前固定 HSL 在 `DYModel.mm` 注册,使用 `DYUniforms` 的一组 `hsl*` 字段,`DYColorTables.mm` 构造一份 24 参数 HSL 查表。`DYGrade.metal` 调用融合的 `dy_grade`,蜘蛛盘随后执行。CST 位于原有显示域调色链之前。
|
||||
|
||||
推荐为可添加工具建立统一实例模型;先开放 HSL,一旦成立再扩展支持的类型。一个实例至少保存稳定 UUID、工具类型及版本、名称、启用状态、混合强度、独立参数和其蒙版引用;作者文档保存有序实例列表。显示名称和列表位置都不能代替身份。
|
||||
|
||||
界面最小闭环:添加工具 → HSL → 出现第二张独立 HSL 卡片 → 调整各自参数 → 单独启停/折叠 → 保存重开仍互不覆盖。复制、删除、重命名、排序是适合此模型的后续操作建议;若本阶段提供,均须使用同一作者状态和单次宿主撤销。
|
||||
|
||||
折叠只写 `folds[nodeID]` 一类界面状态,眼睛写实例启用;不能共用现有 `folds["hsl"]`。所有控件回调、异步加载、选中目标和 Undo 都绑定 nodeID + 参数键,不能绑定可能因插入/删除变化的数组下标。
|
||||
|
||||
### 渲染与旧参数的适配
|
||||
|
||||
先写清工具顺序和每个阶段的颜色域。保持 CST 输入/一级/输出的现有全局前段;新增 HSL 不应再执行一次 CST 或其它全局调整。当前固定链有融合内核,**不能为每个工具直接重复调用整个 `renderSource`**,否则会重复曝光、LUT、统计或空间处理。
|
||||
|
||||
原固定 HSL 可用稳定的兼容实例映射到原参数 ID,以保留旧工程和已有宿主动画;新增 HSL 必须有自己的参数存储与缓存。若需要将原链拆成可重排阶段,先做旧路径与拆分路径数值回归,再让新文档使用新计划。若先采用附加工具段,也必须在界面和文档明确其实际执行位置,不能让 UI 顺序与渲染顺序不同。
|
||||
|
||||
无新增状态的旧工程必须沿用原路径;显式迁移后记录格式版本,避免同一 HSL 同时从旧融合链和新实例链执行两次。旧参数 ID、枚举值、944 字节 ABI 前缀不能重排。新工具使用中性参数时应直通;关闭工具、混合为零或空新增列表应恢复原结果。
|
||||
|
||||
每个实例的查表/中间纹理缓存至少按 device、类型、完整有效参数和相关域信息隔离。第一层调值不能污染第二层。建立完整帧/分块、半透明、负值/HDR、重排以及连续多实例的检查,不把“面板能多开”当成多工具渲染已完成。
|
||||
|
||||
## 二、作者状态、动画和预设先定合同
|
||||
|
||||
本项目现有 `DYAssetState` 在参数 9001,标志含 `NOT_ANIMATABLE`。可以保留它存 LUT/蜘蛛盘资源;若新增工具参数需要宿主关键帧,须另行选择可动画的参数方案或明确时间化作者状态,不能直接塞入 9001 后默认为支持关键帧。
|
||||
|
||||
需区分:宿主可动画参数、工具/蒙版作者数据、逐帧求值后的不可变渲染计划,以及可丢弃缓存。轨迹作者数据随工程保存,运行计划按给定 CMTime 求值,不能由 UI 当前播放头或可变全局选择决定渲染。
|
||||
|
||||
所有新增类型应覆盖 NSSecureCoding 白名单、copy、isEqual、hash、验证、资源路径、预设、宿主归档和渲染状态。当前 InspectorToken schema 2、预设 JSON v3、临时 render-state schema 1 分属不同格式。不要用一次任意“schema++”代替各格式的明确迁移。
|
||||
|
||||
对新数据设置数量/大小/嵌套上限,验证有限数值、合法工具类型、UUID 唯一和引用完整性。失败加载保持旧作者文档;不加载任意类。必要时为当前插件增加明确文档格式,而不是依赖不可版本化的 UI 对象。
|
||||
|
||||
## 三、把蒙版绑定到工具实例
|
||||
|
||||
建议先移植矩形、椭圆和闭合钢笔;羽化、反转、强度和组合规则应有明确数学定义。其它 HSL/亮度键、人物或外部蒙版只作为父库的后续候选,未获本轮逐项指定。
|
||||
|
||||
每个工具保存自己的蒙版列表和当前蒙版 ID。首阶段优先正常混合:`output = mix(toolInput, toolResult, clamp(maskCoverage * toolOpacity, 0, 1))`。多蒙版的加/减/交集顺序、无蒙版的覆盖语义、空路径和禁用蒙版的含义须先确定并测试。不要用一个全局蒙版同时影响所有 HSL。
|
||||
|
||||
CPU、Metal、预览和 OSC 共用坐标合同:源图/目的图范围、宿主 tile bounds、top/bottom origin、非方形像素、缩放/旋转及视图变换都要处理。计算蒙版不能依赖检查器或浏览器尺寸。保留 alpha,明确直通 RGB 与预乘 RGB 的转换和混合边界。
|
||||
|
||||
画面控件通过宿主的 OSC 机制绘制,使用当前效果实例和稳定工具/蒙版 ID 隔离。点击效果标题、开关显示控件、关闭工具窗口后是否保留轮廓等行为在正式 FCP 中验证。不要自建一张静帧预览来冒充宿主当前画面的编辑和跟踪。
|
||||
|
||||
## 四、跟踪移植的范围与易错点
|
||||
|
||||
父库正式68采用 Metal 图像金字塔/正反光流与确定性 RANSAC,输出位置、旋转和独立横纵缩放。其输出合同不包括透视/剪切。建议复用前向、后向、同参考帧双向和前后单帧;连续范围、单帧参考区间、取消行为均按精确帧长定义,不猜帧率。
|
||||
|
||||
从宿主分析接口取得实际源帧。当前 `lookLUTPreview` 只是 320×180 预览,不足以替代最终跟踪输入;也不能靠拖动播放头或缓存最后一帧伪造完整分析。需要检查、实现并验证 FxAnalyzer / FxAnalysisAPI 生命周期和真实帧调度。
|
||||
|
||||
分析开始时冻结效果实例、文档/工具/蒙版 ID、形状 revision、参考 CMTime、范围和帧长。每次结果发布验证目标仍匹配;切片段、切实例、删除工具、编辑蒙版或新一轮分析后,过时回调不得写回当前文档。
|
||||
|
||||
将手工键和自动轨迹分开保存;手工修正优先,合并只替换指定区间的可替换自动结果,保留区间外轨迹、羽化和强度动画。取消保留可信段;空结果不制造作者编辑。低置信度/丢失要有明确提示,不能静默填成功或持续外推。
|
||||
|
||||
**先读父库 `research/tracking-host-lifecycle.md`。** 它记录过提前返回后不收尾、跨 action 分组无效、预览刷新吃掉 Undo/Redo、旧实例在切片段后持续刷新等实际问题。当前可复用方案在准备好结果后,单个有效 action 内完成命名 Undo 起止和完整作者状态写入,然后 endAction;分析收尾保证一次,迟到/重复收尾不再编辑。别恢复早期58–67的已知问题流程。
|
||||
|
||||
## 五、参考库导航(只读)
|
||||
|
||||
本次核对:`/Volumes/备份/大鱼调色/大鱼调色盘`,HEAD `f8950384e514685c8809fe8e8ee2dd5f16ad0bd7`;正式68源码 `d05994d5f4547687511bef524efe8c881e8a5c9c`。接手时先检查差异,若参考更新则固定并记录新节点。
|
||||
|
||||
| 参考入口 | 复用方向 |
|
||||
| --- | --- |
|
||||
| `HANDOFF.md`、`verification/release-2.0.0-build68.json` | 正式68的真实完成范围与宿主证据 |
|
||||
| `Sources/DYSettings.h/.mm` | 作者文档、图层、每层蒙版与归档 |
|
||||
| `Sources/DYPanelLayers.inc` | 图层/工具列表操作与编辑目标 |
|
||||
| `Sources/DYMaskState.h/.mm` | 精确 CMTime、手动/自动键、形状与变换求值 |
|
||||
| `Core/DYMask.h`、`DYMaskOperator.h`、`DYLayerPlan.h` | 蒙版数学、组合/源阶段、渲染计划 |
|
||||
| `Sources/DYPanelMasks.inc`、`DYInspectorMaskControls.inc` | 蒙版编辑器、宿主检查器入口 |
|
||||
| `Core/DYTracker.hpp`、`Sources/DYMetalTracker.h/.mm` | 光流后端、RANSAC、结果/区间合并 |
|
||||
| `Sources/DYPlugin.mm` | FxAnalyzer、目标冻结、取消/收尾、预览归属、Undo 提交 |
|
||||
| `Sources/DYRenderer.mm`、`Shaders/DYColor.metal` | 计划执行、纹理与蒙版合成,需适配本项目 |
|
||||
| `research/tracking-host-lifecycle.md` | 宿主生命周期、单 action 撤销和旧实例刷新防护 |
|
||||
| `Tools/test_tracking.py`、`Tools/test_mask_refinement.py` | 参考测试和合成运动素材思路,不能替代本产品验收 |
|
||||
|
||||
父库有独立 Bundle ID、参数表、1032 字节 DYGrade、作者格式和更大的产品范围。本项目为 1104 字节 DYUniforms。按功能适配源码,保留本产品颜色链和品牌/安装身份;不整仓覆盖、不盲抄 PID/结构体,不把父库已验收数量记成本项目通过。移入源码时记录来源节点、文件摘要与必要资源,构建不得依赖兄弟 APP 或另一目录运行时存在。
|
||||
|
||||
## 六、建议里程碑与验收
|
||||
|
||||
| 阶段 | 可交付行为 | 最低验收重点 |
|
||||
| --- | --- | --- |
|
||||
| A:两个 HSL | 独立添加、调值、眼睛和折叠;实例保存 | 不共用参数/缓存;旧工程画面不变;删除/插入不串目标;单次 Undo/Redo;重开与预设 |
|
||||
| B:每实例蒙版 | 两个 HSL 分别影响不同区域 | 蒙版/羽化/反转/透明度 CPU–GPU 对照;原点、tile、4K与非方形画面;关闭精确旁路 |
|
||||
| C:宿主控件 | 在 FCP 检视器画与改蒙版 | 当前实例隔离、真实拖动/绘制、工具窗口关闭后的行为、一次手势一次撤销 |
|
||||
| D:跟踪 | 实际运动帧驱动对应蒙版 | 前后/双向/单帧;取消可信段;低置信度;手工键优先;精确 CMTime;切片段/旧回调隔离 |
|
||||
| E:正式回归 | 保存、导出、性能与发行 | 冷重开轨迹完整一致;一次 Undo/Redo 的作者文档核对;旧预设/工程、CST/蜘蛛盘/LUT 回归;正式交付 |
|
||||
|
||||
用本产品独立合成源验证平移、旋转、独立轴缩放、边界/透明、局部遮挡或目标离画;量化中心和尺寸误差,并区分算法样本与实机结果。对任意遮挡不能作无证据保证。导出后检查完整运动序列,不能只看静态首帧轮廓。
|
||||
|
||||
新增无蒙版、无逐帧依赖的逐像素 HSL 可表达为 LUT;空间蒙版和跟踪不能完整写入普通 3D Cube。到实现时应明确选择阻止完整导出、或让用户明确导出全局部分,并在 UI 说明;不得静默丢掉局部调色后仍称完整一致。
|
||||
|
||||
## 七、工作与交付边界
|
||||
|
||||
本轮只交接,不实现这些功能、不改变正式 1.3.1(19)。下一轮遵循 `/Users/mac/.codex/AGENTS.md`:先保护当前工作,保存并推送阶段检查点;构建/CLI 测试在固定缓存,用户可见测试走已签名公证的唯一正式安装。新增功能后递增版本/构建号,刷新模型模板,完整签名、公证、安装、FCP 验收、清理、PKG、Release 完整下载与远端恢复。
|
||||
|
||||
用户正在使用浏览器时,不为额外测试重启或复位其工程。优先用新合成测试库,完整保留其 LUT、预设、最近使用和现有轨迹。此任务不需要 NAS 后端部署,不新增生产服务。
|
||||
@@ -0,0 +1,39 @@
|
||||
# 1.4.1:就地插层、蒙版可读性和钢笔修复
|
||||
|
||||
基线为1.4.0(24)后的主分支 `745aa1626e1df368290fbbd47a716ff3ce9ca630`。本轮原生Release构建281项检查通过,独立跟踪18项检查通过。正式签名、公证、宿主和安装包状态分别以 `verification/Delivery.json`、宿主记录、`Package.json`、`Release.json` 为准;此说明不代替实机验收。
|
||||
|
||||
## 插入位置与运算
|
||||
|
||||
新建工具文档schema2的节点保存 `after` 锚点,可引用原工具或另一个工具UUID。点击原HSL或新增HSL的“再加一层”,新层立即排在该层之后。再次点击原层时插在原层与此前第二层之间;删除层重接后续节点。参数仍从初始化值开始,独立保存身份、折叠、启停、蒙版和资源。
|
||||
|
||||
schema1及没有after的既有1.4.0尾部层保留原位置和原数学,不在打开旧工程时偷偷改变调色;新层和旧尾部层的子层可并存。序号按当前显示位置生成,作者身份始终为UUID。
|
||||
|
||||
原固定融合链的操作顺序早于当前界面分组,不重新排列旧模块。活跃插入通过独立分段内核执行在原工具的实际阶段之后;基础调整在第二阶段后、CST在前段、蜘蛛盘在原末端。原始内核保留,没有活跃新增层时使用原融合路径,初始化新层像素精确直通。
|
||||
|
||||
分段保留首次CST后的原图,供原邻域、白点统计、亮度权重和蒙版取样;保留原uniform及旧输入LUT,只禁止后段再次CST。肤色参考保留在原HSL之前。部分黑白混合若被黑白/LUT锚点切开,在共同前缀后保留黑白与彩色两支,原肤色之后混合,再执行新增肤色与一次蜘蛛盘。可证明全零覆盖的额外工具直接复制输入,避免空蒙版额外裁切HDR/负值。
|
||||
|
||||
HSL与后续颜色分级、红通道曲线与HSL的独立非交换参照,以及Cube同序检查通过。CST、原三原色+白点统计/纹理、旧输入LUT、亮度选区、肤色、基础第二阶段、部分黑白混合和蜘蛛盘的零覆盖插层参照通过,分段半浮点最大差异约0.001465。此差异不适用于所有素材和参数组合的精度保证。
|
||||
|
||||
## 蒙版控件与钢笔
|
||||
|
||||
面板参数与数字为13pt,状态12pt;数值框88×32pt,滑条单独占一行,操作按钮32–36pt高,跟踪按钮两列三行。六种类型在220/300/420pt宽度的边界、不重叠、字号和目标尺寸检查通过。画面工具栏依据宿主backingScaleFactor绘制,短画面换列。
|
||||
|
||||
修复检视器添加钢笔未携带绘制态的问题,提供“重画钢笔”“完成绘制”“取消绘制”。点击放点、按住拖出共线双柄,鼠标移动显示下一段预览;至少三个点时点首节点、Return或完成按钮闭合。Delete回退未提交点,选中已闭合路径节点可删除(至少保留三点)。Esc/取消恢复原作者路径。绘制中禁用跟踪,完成或取消后恢复。
|
||||
|
||||
OSC回调只在锁内更新内存草稿,立即供下一次绘制读取;宿主参数提交留到回调结束后的主队列,形成一次撤销。连续手势排队保留,跨帧草稿、过期目标和迟到模式通知拒绝覆盖。绘制、命中和坐标缓存也有自身互斥。画面位图上下坐标与AppKit上下文方向保持一致,修正钢笔提示条文字翻转。原生检查覆盖检视器入口、默认形状外放点、即时预览、曲柄、首节点/Return闭合、完成/取消按钮、归档、连续手势和跨帧拒绝。
|
||||
|
||||
## Color Finale 对照与跟踪
|
||||
|
||||
本机Color Finale 2.16.2(625)只读静态证据、精确产物摘要和迁移边界见 `ColorFinaleMasksFollowup.md/.json`。没有复制原版反编译源码、二进制、图标或运行库作为产品依赖。
|
||||
|
||||
修复原跟踪器将钢笔区域预先裁到创建框±0.5的问题。特征搜索边界由实际变换后的路径推导,保留真实多边形判断;300特征、相对质量0.03、10像素间隔、亚像素精炼、21×21 LK、最多4级、30次迭代、每两帧重检测。继续保留现有严格仿射拟合、置信度、丢失停止和手工键优先。宿主实际分析采样上限3840×2160,兼顾像素长宽比。
|
||||
|
||||
默认框外钢笔纹理在旧版检出0点、无法启动,新版117点;12帧亚像素运动末帧误差约X0.0073/Y0.0323像素。独立CPU与真实Metal18项覆盖300点容量、旋转、独立缩放、静止、换景/低纹理拒绝及4K;本产品281项原生集成同时覆盖实际插件FxAnalyzer回调的精确帧序、撤销、取消和过期写入。
|
||||
|
||||
这些是有证据的独立重建与适配,不代表Color Finale全部蒙版系统已经完整迁移。B样条、多选/编组、图像/人物/外部蒙版、来源和轨迹区段编辑等差异见专项清单;未进行同一真实视频的完整原版轨迹等价对照。旧系统、Intel、Motion和非方像素/变速工程仍需实机覆盖。
|
||||
|
||||
## 正式宿主验收
|
||||
|
||||
1.4.1(26)APP公证Accepted,唯一正式安装与281项原生检查通过。FCP12.4在独立合成工程中验证:相邻插入、连续原层点击插入顺序、零参数新层与32色相既有层独立、放大面板、绘制态/跟踪禁用、提示文字方向、钢笔蒙版正向99键和一次撤销/重做。冷重开后完整预设逐字节相同。
|
||||
|
||||
CUA坐标输入未进入原生OSC回调;用户随后实际鼠标确认“可以绘制并闭合”,钢笔放点与闭合通过。跟踪宿主验收使用现存默认闭合四点钢笔路径,不称为新手绘路径。真实鼠标中心拖动有1.4.0用户确认;本轮钢笔确认仅覆盖放点和闭合,不扩大为曲柄、删除、旋转/缩放等全部手势已实测。记录见 `verification/HostMaskWorkflow1.4.1.json`。
|
||||
@@ -0,0 +1,35 @@
|
||||
# 每工具蒙版与初始化叠层(1.4 开发记录)
|
||||
|
||||
基线:`edfb74b171f51d4beaa9926e27d2d80791fbf43c`,原正式版本 1.3.1(19)。当前正式安装 1.4.0(24),实际编译 `dbf25fe6719f17075362538dad0404951102524d`。以 verification/Delivery.json、HostToolMasks.json、Package.json 和 Release.json 分别核对安装、宿主、包和发布状态。
|
||||
|
||||
## 界面与顺序
|
||||
|
||||
十二个原模块标题栏均增加“添加蒙版”和“再加一层”。新增工具在原模块列表之后按添加顺序执行,使用稳定 UUID;不复制原层当前参数。每层保留原生 HSL、曲线、色轮、蜘蛛盘和 LUT 浏览器。独立启停、折叠、复位、删除;原层宿主 float ID 不动。新增一级使用 Rec.709/Gamma 2.4 同域输入输出,避免默认再次转换 Sony Log;新增肤色保护强度从零开始。
|
||||
|
||||
原有工具保留原融合内核顺序。单独增加 `dy_gradeMasked`,在原生运算各阶段按该模块覆盖率混合;基础调整原生分布的两个阶段共用它自己的蒙版。原 `dy_grade` 保留,不增加蒙版的旧工程调用它。蜘蛛盘在原末端、CST 在原前段,蒙版分别作用在自己的阶段。新增工具用只开启该工具的制服参数执行,不重放其它原模块。新增肤色保护以本次效果的源画面作为保护参考。
|
||||
|
||||
## 状态与数学
|
||||
|
||||
9002 为 `DYToolDocument` 静态作者参数,独立于旧9001资源参数;9003 为不随工程保存的 OSC 会话路由。新工具标量目前为静态作者值,不声称支持宿主标量关键帧。蒙版轨迹独立以精确 CMTime 存储,并在 pluginState 的给定时间求值。预设 v4 在 JSON 中用 base64 二进制 plist 保留完整工具/蒙版/轨迹,兼容载入 v1–3;无9002旧工程使用空文档。
|
||||
|
||||
最多32个新增工具;每工具16个蒙版;每蒙版16384个轨迹键,全文最多65536键和24MiB plist。验证工具类型、UUID、数值、路径/节点、时间顺序和合法参数。归档使用 NSSecureCoding 类白名单、独立 copy/equality/hash。缓存按设备/完整参数,非共享可变面板状态。循环纹理只保留当前与下一层,不将所有中间4K帧保留至函数结束。
|
||||
|
||||
六种蒙版:矩形、椭圆、闭合贝塞尔、线性渐变、HSL、亮度;复用父库128字节蒙版参数及原始覆盖数学。多蒙版有序相加 `1-(1-a)*(1-b)`、减去 `a*(1-b)`、相交 `a*b`;第一项减去从1开始;无启用蒙版为全覆盖。色彩选区取本段输入的显示编码色;几何使用源图完整范围、原点和像素长宽比。各运算在既有颜色域混合,保持alpha。空间蒙版/跟踪不能用Cube表达,导出时明确拒绝,完整预设可保留。
|
||||
|
||||
## 宿主画面与跟踪
|
||||
|
||||
原生 FxOnScreenControl_v4 注册到本产品 UUID。画面工具栏提供选择、钢笔、矩形、椭圆、渐变、HSL、亮度及显示开关;面板提供相同类型和数值编辑作为替代操作。中心、大小、旋转、钢笔节点和手柄在宿主真实画面编辑;钢笔 Enter 闭合、Escape 取消。画面手势先编辑内存草稿,结束时在单个 host action 中提交一次撤销。
|
||||
|
||||
跟踪从父库移植 Metal 金字塔/正反光流及确定性仿射 RANSAC(来源与摘要见 ToolMaskPort.json)。通过 FxAnalyzer 请求宿主实际完整源帧;960宽采样区别于320×180浏览器预览。参考帧和分析首帧比对方向;帧调度采用精确CMTime,遇到重复、跳帧、尺寸变化或低置信度停止。输出位置、旋转、独立宽高,不含透视和剪切。矩形/椭圆/闭合钢笔可前向、后向、双向、单帧跟踪。取消保留可信连续段,手工键优先,保留区间外键。冻结目标UUID和完整蒙版,过期目标不回写。一次收尾防重入、宿主状态轮询补缺失cleanup;结果准备好后单action写入、单次撤销。没有周期写入预览参数。
|
||||
|
||||
## 验证入口
|
||||
|
||||
`--self-test` 增加实际IOSurface/Metal多HSL独立顺序参照、六类型CPU/GPU覆盖对照、alpha、空/默认直通、归档/非法数据、原生面板复用和实际插件分析回调(模拟宿主调度,使用真实Metal运动帧)的检查。它不代替实机宿主验证。
|
||||
|
||||
`python3 tools/create_mask_host_fixture.py` 生成本产品专用合成运动和两个独立FCP项目;不修改旧项目或用户媒体。最终验收必须在唯一正式安装的已公证版本中进行,并另存结果。
|
||||
|
||||
24版正式路径222项原生检查通过;新增OSC检查使用真实Metal叠加,验证透明背景、坐标命中、异步拖动写回、单次撤销和Esc取消。作者文档以不可变快照供OSC读取,不在绘制回调中进入主插件宿主API;添加蒙版先发布选择快照,再结束参数提交。轨迹查找使用CMTime二分定位,渲染快照仅替换各蒙版的当前参数,不重复序列化全部轨迹。
|
||||
|
||||
24版FCP12.4实测:第二HSL从0到32独立保存,原HSL保持0;原层椭圆中心X数值改为0.6,新增层矩形保持0.5;正向99键,一次Undo到0键,一次Redo到99键且完整预设逐字节一致;双向100键;新增层独立单帧2键,播放头由1帧到2帧。正常退出重开后,完整预设逐字节一致,分别保留100/2键。初验自动化坐标点击未进入真实宿主hit/event回调;随后用户已确认实际鼠标中心拖动正常,原生hit/mouseDown/mouseDragged日志也已捕获,原层中心变为0.378/0.379而新增层仍0.5/0.5。用户试调结果保留。旋转、缩放、钢笔手势未实机确认,不能以模拟器通过代替。取消、过期目标和逆向精确节奏由原生模拟调度覆盖;Motion、Intel、变速/裁剪/非方像素未实测。发行标签保存首次验收快照,用户后续实际鼠标确认保存在主分支当前记录,标签不移动。
|
||||
|
||||
20–23版是本次中间验收节点,不作为最终发行。模板10005现采用父库原生Boolean flags8589934592/default0/value1,pluginVersion0解析当前插件。既有FCP保存的旧模板实例可能保留10005=0;画面控件需保存完整预设后重新应用新版效果,旧实例调色数学不自动迁移或覆盖。
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"sourceRepository": "https://dayu.media/git/dayu/dayu-colorplate.git",
|
||||
"sourceCommit": "f8950384e514685c8809fe8e8ee2dd5f16ad0bd7",
|
||||
"files": {
|
||||
"Core/DYMask.h": "ede701e3636c7608f5f8be3be2d95acfdd8080e751d18f89c6660bd874997101",
|
||||
"Core/DYMaskOperator.h": "43fa701ad574f38ce0ab4f4d3900bb034edaaa1adc09821d2f4443ee2b687ba2",
|
||||
"Core/DYTracker.hpp": "0d67d4d7d919cf3f255fe39f949c3e3ae6cad1a2ae07ad429ee45f1e23bdeb3e",
|
||||
"Sources/DYMetalTracker.mm": "11b49215e9e024e5d1aa59a57dc7ab28048f569cfa3ef6943c014ad26040883d",
|
||||
"Shaders/DYTracking.metal": "4949ffcc32701c95c2385e1ebd6425fbb8fe66771c801b65aaf0a308d23e155c"
|
||||
},
|
||||
"status": "implementation-in-progress",
|
||||
"scope": "Adapt parent mask mathematics, Metal bidirectional optical flow and deterministic affine RANSAC. No reference app runtime dependency."
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
# 1.4.2 中间帧启动与真实素材跟踪修复
|
||||
|
||||
本轮针对用户报告的“从中间没有反应、必须首帧正向、失去可靠跟踪”复现。FCP12.4使用当前正式1.4.1(26),把用户工程原生导出到本机验收缓存并导入独立副本,保留原项目、媒体与调色/蒙版设置。4K60源在25帧时间线:首帧正向保留65键;源时间3.68秒中间启动仅增加3键后失败,并弹出宿主分析错误。此前的合成视频检查不能替代这个真实素材问题。
|
||||
|
||||
## 修复
|
||||
|
||||
启动不再要求当前预览缓存存在且时间完全相等。FCP可以复用已渲染画面而不再进入插件渲染回调,因此缓存只作可选方向校对;实际FxAnalyzer首帧才是跟踪种子。仍检查分析起点范围、精确帧序、取消、冻结目标与迟到写入。新增原生检查覆盖无任何渲染缓存的中间启动、陈旧预览缓存和像素不同的预览缓存。
|
||||
|
||||
分析从完整宿主源图读取,按显示长宽比限制到1280×720,不放大小图;降采样前对源像素覆盖范围作低通,避免4K衣物细纹混叠为不一致运动。原调色渲染和输出分辨率不变。上一轮3840×2160是分析采样上限,本轮改用稳定的运动分析尺度;不再把“输入支持4K”写成仍逐像素4K分析。原生GPU检查使用3像素周期纹理,证明4K→720p先低通而非只抽中间像素。
|
||||
|
||||
仿射RANSAC细化容差改为3像素,并相应归一化残差置信度惩罚;只扩大容差而保留旧惩罚会在一致运动上过早低置信度停止。至少8内点、52%一致运动、最低0.3置信度、非线状分布、单步缩放/旋转和累计变换保护仍保留。未采用丢失后复制坐标伪造轨迹。新增确定平移、2.15像素非刚性残差和10%离群对应点的拟合检查;另有真实CPU/Metal图像光流、画面切换和平坦区域拒绝。
|
||||
|
||||
第一帧开始立即显示进度。失跟按特征不足、运动不一致、置信度、出画或变换问题区分,说明保留的可信帧数。普通失跟、主动取消、单帧完成使用SDK的 `FxPlugErrorDomain / kFxError_UserCancelled` 正常取消标记,既结束宿主后台任务又不弹错误;引擎、无效源图和时序错误仍明确失败。27版候选仅返回NO/nil时,FCP的诊断分析残留在50%并影响退出,已在28版修复;不能把本地trackingActive清理当作宿主任务已结束。SDK证据见本机FxTypes.h的UserCancelled说明。最终31版正式宿主已确认任务回到闲置、可再次启动和正常退出。
|
||||
|
||||
单帧完成后先由FxTimingAPI把分析源时间转换为时间线时间,再移动播放头。28版候选在前有4秒片段时错误跳到源3.72秒,29版修正为时间线7.72秒。原生覆盖带4秒偏移的反向单帧和连续两次正向单帧,包含非整数帧率的精确CMTime。
|
||||
|
||||
已有相同轨迹的单帧操作也应前进播放头,以实际完成的连续两帧为依据,不以作者数据是否改变为依据;重复结果不增加一次无效作者写入或撤销。
|
||||
|
||||
首帧反向不拒绝desiredAnalysisTimeRange,而是返回只含种子的有效一帧范围,正常完成且不写入新轨迹。30版在范围发现回调返回NO/UserCancelled时,FCP主线程等范围回包、SDK工作线程同步调用宿主setAnalysisState而互等;本机进程采样确认。SIGTERM未能结束阻塞的服务,随后仅终止无作者数据的本产品XPC服务后FCP恢复并正常退出,没有强制结束宿主,验收完整预设已提前保存。31版边界回调不再进入该错误路径。
|
||||
|
||||
## 验证与边界
|
||||
|
||||
31版正式Release原生293项通过,包含真实Metal采样、三组新增中间启动回调和五组宿主正常终止/边界与两组偏移片段单帧定位与已有相同轨迹仍前进检查;独立19项通过。用户同一素材的离线1280×720灰度分析覆盖首帧正向285帧、中间正向193帧、中间反向93帧。这里只承诺对应的分析范围完成,灰度解码与宿主半浮点源采样不完全相同,也不以“跟完”代替轮廓/漂移质量验证。正式安装后FCP12.4验证同一素材:中间双向285键、首帧正向285键;中途取消保留159键并回到闲置,随后可重启跟完整段;画面切换在2秒失跟,保留0–1.96秒50键,连续重试无弹窗且后台任务闲置。首帧反向正常提示边界,连续单帧在前有4秒片段时7:17→7:18→7:19→7:18,已有相同轨迹仍正常移动。正常退出、冷重开后完整77087字节预设逐字节一致。27/28候选中间正向193新键、反向93键与撤销重做记录单列在宿主报告;27–30均未发布。
|
||||
|
||||
原始媒体、FCPXML快照、作者状态和解码帧均仅在本机验收缓存,普通Git只保存聚合结果与通用诊断源码。未修改父“大鱼调色盘”或Color Finale。不是人物分割/非刚性逐点描边;转身、遮挡、变形和出画仍可能需要手工调整后从当前帧继续。新增工具标量和透视/剪切等既有边界保持。
|
||||
@@ -0,0 +1,122 @@
|
||||
# 大鱼调色交接:1.4.3 基线与 Color Finale 胶片模拟接续
|
||||
|
||||
更新日期:2026-11-02(Asia/Shanghai)。本轮只整理交接文档,未改程序、未重新安装或重启宿主,也未开始胶片模块的算法迁移。下一阶段目标是从本机 Color Finale 分析并移植胶片模拟模块。
|
||||
|
||||
## 1. 先认准项目与可恢复基线
|
||||
|
||||
| 项目 | 当前值 |
|
||||
| --- | --- |
|
||||
| 当前源码根目录 | `/Volumes/备份/大鱼调色/大鱼调色` |
|
||||
| 远程 / 分支 | `https://dayu.media/git/dayu/dayu-color.git` / `main` |
|
||||
| 交接文档编辑前 main | `7814a03f95f9f3c3461af2566e7412c1e5c561e1`;后续文档提交在此节点之上 |
|
||||
| 正式 APP | `/Library/Plug-Ins/FxPlug/大鱼调色.app`,1.4.3(33) |
|
||||
| 主 / XPC Bundle ID | `com.dayu.color` / `com.dayu.color.XPC` |
|
||||
| APP 实际编译源码 | `26a888f4534792481c6a9933091cb0b23307cd24` |
|
||||
| 已发布标签 | `v1.4.3-mask-fold-20261102` |
|
||||
| 标签对应提交 | `301b31438e8da95dc4e6e1c09498ad814a0ebcfc`,含最终交付记录,区别于 APP 编译节点 |
|
||||
| FCP 模板 | `/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef` |
|
||||
| 固定构建缓存 | `/Users/mac/Library/Caches/CodexBuilds/com.dayu.color` |
|
||||
| 父“大鱼调色盘”源码 | `/Volumes/备份/大鱼调色/大鱼调色盘`,只读参考固定提交 `f8950384e514685c8809fe8e8ee2dd5f16ad0bd7` |
|
||||
|
||||
接手后先查看实际工作区、分支和远端;不要用本表覆盖其他任务的新改动。当前大鱼调色是独立 FxPlug 程序,不依赖父项目或 Color Finale APP 才能运行。历史各轮说明已归档到 [历史交接](research/handoffs/DayuColorThrough1.4.3-20261102.md)。
|
||||
|
||||
## 2. 已完成并应保留的行为
|
||||
|
||||
- 一级调色包含输入 CST → 工作空间一级处理 → 输出 CST;后续基础调整、HSL、曲线等仍按既有显示域链处理。胶片接入时要重新确定域和位置,不能把父项目的顺序直接套进来。
|
||||
- 各模块标题只控制展开/折叠,眼睛控制启用/旁路。再次添加工具在点击处相邻插入初始化层,旧 schema1 尾层保留位置;新增层参数独立。
|
||||
- 每工具蒙版含椭圆、矩形、钢笔、线性渐变、HSL、亮度选区;支持组合、反转、羽化和强度。矩形/椭圆/闭合钢笔有区域运动跟踪。
|
||||
- 1.4.1 已有用户实际鼠标确认钢笔可绘制并闭合;1.4.0 已有中心拖动确认。自动化鼠标未可靠进入 FCP 的画面回调,不能把其余手势扩大为实鼠验收。
|
||||
- 1.4.2 修复中间帧起跟、4K细纹误失跟、取消/失跟后的宿主任务结束、偏移片段单帧定位和边界互等。运动分析最高1280×720,先低通再降采样;调色渲染和输出分辨率不变。区域仿射跟踪不是人物分割或非刚性描边。
|
||||
- 1.4.3 蒙版面板随所属模块一起折叠;标题栏蒙版按钮旁显示数量标记,无蒙版时隐藏。计入已停用蒙版,原模块和独立层分别计数,删除/撤销即时更新。
|
||||
|
||||
正式1.4.3通过293项既有原生检查。FCP12.4验证折叠/展开、数量2/1、删除到零和撤销、正常退出冷重开;用户当时完整77276字节预设逐字节一致,286个轨迹键保留,独立合成片段8471字节预设操作前后及重开也一致。293项检查不是对尚未实现的胶片模块的验收。
|
||||
|
||||
最近用户试调位于独立验收项目“大鱼调色_28_中间帧双向”,不能当作随时可复位的空白实例。完整预设和 FCPXML 仅在本机 `.../com.dayu.color/fcp-qa/`:`fold31-before.json`、`fold33-user-after.json`、`fold33-fixture-reopen.json` 等;不要写进 Git、PKG 或覆盖原素材。
|
||||
|
||||
## 3. 源码接入入口
|
||||
|
||||
下表路径相对于当前源码根目录。
|
||||
|
||||
| 入口 | 用途 |
|
||||
| --- | --- |
|
||||
| `大鱼调色/Plugin/DYModel.mm`、`DYModel.h` | 参数描述、分组、默认值、宿主参数与预设 |
|
||||
| `大鱼调色/Plugin/DYUniforms.h` | CPU/Metal ABI;当前自检1104字节,`cm`偏移944的前缀有静态断言 |
|
||||
| `大鱼调色/Plugin/DYRenderer.mm` | Metal设备、渲染调度、LUT资源、输入输出与导出 |
|
||||
| `大鱼调色/Plugin/DYGrade.metal` | 现有 GPU 包装、色彩管理及逐像素处理入口 |
|
||||
| `大鱼调色/Plugin/DYToolRender.inc.h`、`DYToolGPU.h` | 独立工具计划、逐层处理与蒙版混合 |
|
||||
| `大鱼调色/Plugin/DYToolState.mm`、`DYToolState.h` | `DYToolTypes`、工具默认状态、schema1/2、after锚点、蒙版与安全归档 |
|
||||
| `大鱼调色/Plugin/DYInspector.mm` | 模块布局、`toggleSection:`、`DYMaskCountBadge`、蒙版数量刷新 |
|
||||
| `大鱼调色/Plugin/DYToolInspector.inc.h` | 相邻插入、独立层界面及其布局 |
|
||||
| `大鱼调色/Plugin/DYMaskPanel.inc.h` | 蒙版控件、状态和跟踪按钮 |
|
||||
| `大鱼调色/Plugin/DYToolHostMethods.inc.h` | FxAnalyzer 生命周期;胶片任务无需顺带改写 |
|
||||
| `tools/build_kernels.py`、`tools/kernels/` | 可版本恢复的 AIR/Metal 生成与链接,不能只替换某个本机 metallib |
|
||||
| `tools/build_template.py`、`template/sources/` | 原生模板与参数档案;模型改变后重建并核对 |
|
||||
|
||||
当前 `DYToolTypes` 有12类,未注册独立胶片模拟工具。相机输入项里的 Blackmagic Film / Fujifilm F-Log 是色彩管理输入名称,不能据此认定已有胶片模拟模块。完整预设当前为 v4,已有9000/9001/9002自定义载荷及9003画布会话;参数ID、归档兼容和既有 Uniform 前缀不能挪作新用途。
|
||||
|
||||
## 4. Color Finale 参考身份与已有证据
|
||||
|
||||
本次只复核了本机包元数据和可执行文件摘要,未新做胶片函数分析或原版输出对照。
|
||||
|
||||
| 项目 | 本机已核对值 |
|
||||
| --- | --- |
|
||||
| APP | `/Applications/ColorFinale.app`,2.16.2(625),`com.colorfinale.app` |
|
||||
| 主插件二进制 | `/Applications/ColorFinale.app/Contents/PlugIns/ColorFinale.pluginkit/Contents/MacOS/ColorFinale` |
|
||||
| 插件 Bundle ID | `com.colorfinale.ColorFinaleFxPlug` |
|
||||
| 二进制 SHA-256 | `49121a6f5487060d322a59e7658166ab772e8a56f7dc1bcfa9d433a89436b30f` |
|
||||
| 胶片界面定位线索 | `Contents/PlugIns/ColorFinale.pluginkit/Contents/Resources/zh-Hans.lproj/FTFilmEmulationViewController.strings`(相对APP) |
|
||||
| 既有只读研究 | [ColorFinaleMasksFollowup.md](research/ColorFinaleMasksFollowup.md) 与对应 JSON |
|
||||
| 既有本机 REA 缓存 | `/Users/mac/Library/Caches/CodexBuilds/ColorResearch/dayu-mask-followup-20261101/` |
|
||||
|
||||
现有 REA 证据主要对应蒙版/跟踪,不能当作胶片模块已分析。下一轮先核对目标摘要、可用会话及保留证据;仅复用身份匹配的资料。原版胶片的参数、默认值、阶段、数学、资源依赖和实际图像行为均需要单独取证。
|
||||
|
||||
REA 技能入口:`/Users/mac/.agents/skills/reverse-engineer-anything/SKILL.md`。分析原厂二进制时使用其目标绑定和证据流程;查看当前完整源码则直接读工程,不为普通源码阅读启动逆向工具。静态字符串/类名只是定位线索,不能代替执行行为或图像对照。
|
||||
|
||||
## 5. 父项目可以参考什么
|
||||
|
||||
`research/color-finale/` 内四份研究资料是父工程提交 `4458dc0c0ae7f51046b8cfa4b19626e80f7cf6ca` 的快照,见 [快照来源](research/color-finale/README.md)。其中“已接入”“正式版”等表述属于父工程,不能当作当前大鱼调色的完成项。快照里部分相对链接没有随包文件,应回到父工程查找。
|
||||
|
||||
父工程固定提交 `f8950384e514685c8809fe8e8ee2dd5f16ad0bd7` 中可只读参考:
|
||||
|
||||
- `research/film-processing-contract.md`、`research/colorfinale-film-chart-findings.md`;
|
||||
- `Core/DYFilm.h`、`Core/DYFilmCPU.hpp`;
|
||||
- `Sources/DYFilmState.h`、`DYFilmState.inc`、`DYPanelFilm.inc`、`DYFilmEditor.inc`;
|
||||
- `Tools/film_test.mm`、`film_panel_test.inc`、`test_film.py` 与 `verification/film-development.json`。
|
||||
|
||||
父合同记录的是独立算法v1:减色→晕光→辉光→暗角→颗粒,父工程根级状态、线性域处理及保守拒绝活跃胶片的LUT导出。可复用其工程组织、时间一致性和边界测试思路;不代表当前工程已有相同链路,更不代表与 Color Finale 数学或同名胶片外观一致。不要把父工程“只在根级”的约束当作用户已经确定的本工程设计。
|
||||
|
||||
## 6. 下一阶段建议的工作顺序
|
||||
|
||||
1. **先建立原版功能与参数表。** 从本机胶片面板定位 Film Look、减色、Halation、Bloom、Vignette、Grain 等候选功能,逐项确认本机版本是否具备、名称、默认、范围、单位、开关、预设及资源依赖;候选清单不是已证实功能清单。
|
||||
2. **确认处理域和顺序。** 跟进面板状态→归档/参数→渲染调度→CPU/Metal/表格资源,明确与输入、工作空间、输出CST、HDR、alpha和混合的关系。先记录已观察、推断、未知,再决定当前大鱼的接入位置。
|
||||
3. **确定模块形态。** 尚未定为全局胶片阶段还是可重复工具。若进入现有工具模块体系,接好独立初始化、眼睛、折叠、蒙版及数量标记;若全局阶段有不同语义,先把具体设计说明写清。保留旧工程缺省时的旁路与原画面。
|
||||
4. **做可比较的图像验证。** 同一输入、同一色彩空间、同一参数分别取得原版与大鱼输出,覆盖灰阶/色块/高光、真实素材、不同分辨率及透明边缘。不能只靠“视觉像胶片”或加一个LUT宣称等价;确属独立重建的部分写明差异。
|
||||
5. **补齐空间与时间行为。** 晕光/辉光若涉及邻域需独立中间纹理和预算;颗粒若随时间变化需精确帧时间、固定种子/状态、随机访问/并发/重开的一致性。零强度与关闭保持中性,保留负值/HDR、alpha与非有限值处理。
|
||||
6. **完成持久化、导出和正式验收。** 新参数ID不复用,归档/预设兼容旧版本;纯色变换与空间/时间效果的Cube能力分别判定,不能把颗粒、晕光等错误写成静态3D LUT。随后做撤销/重做、保存重开、旧工程、蒙版/重复层、FCP实际渲染和正式交付。
|
||||
|
||||
## 7. 构建、交付与恢复入口
|
||||
|
||||
沿用本机全局规则与项目现有工具。本轮是文档更新,未生成新构建或移动已发布标签;下一轮真正改程序后再递增构建与版本。
|
||||
|
||||
```sh
|
||||
# 在源码根目录;模型改变时先更新原生参数档案和模板
|
||||
python3 tools/build_template.py --refresh-model --overwrite
|
||||
# Release构建、由内到外签名、公证Accepted、票据、唯一安装;等待宿主验收
|
||||
python3 tools/deliver.py
|
||||
# 宿主验收通过后才在交付进程输入complete,并补写本轮hostVerification记录
|
||||
python3 Packaging/build_pkg.py --pkg-forge-repo /Users/mac/Documents/dayu-git/repositories/pkg-forge
|
||||
```
|
||||
|
||||
- 正式宿主测试使用固定位置的已公证APP;不从DerivedData启动临时GUI,不强制结束宿主绕过保存。
|
||||
- 产品交付锁:`/Users/mac/.codex/app-delivery-locks/com.dayu.color.lock`。Git检查点用 `tools/checkpoint.py` 的仓库锁;只提交已审查的本任务文件。
|
||||
- 签名团队 `B3W25FX5H5`;Application / Installer身份和公证profile按本机规则重新验证。公证profile `codex-dayu-notary-B3W25FX5H5`,钥匙串 `/Users/mac/Library/Keychains/login.keychain-db`。文档中不存凭据。
|
||||
- 正式PKG生成后,标签先推送核验,再用 `Packaging/publish_release.py` 上传草稿;完整下载核对大小及SHA-256后发布,再核验已发布下载。保持现有仓库可见性,不覆盖旧附件或移动标签。
|
||||
- 无LFS/子模块。恢复任一已保存源码:克隆上述远程,检出明确提交或标签,再依 RECOVERY 构建;证书私钥、用户媒体与预设独立保存。
|
||||
|
||||
当前发行包:`/Volumes/备份/大鱼调色/发行包/大鱼调色-1.4.3.pkg`,14,340,650字节,SHA-256 `41bba698a70a7629438688a4be74947f424f3af04190090c44f248827b4c3bb2`。APP公证 `e755670d-8fb3-46d2-95c3-1206f014d16d`,PKG公证 `f9218078-8fd0-4a0c-9240-4b1acf7d9655`,均Accepted;签名/票据/Gatekeeper、20项展开验包通过。PKG未再次运行安装器,APP已有独立正式安装和宿主验收。
|
||||
|
||||
[Release371](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.4.3-mask-fold-20261102) / 附件16已在草稿与发布后完整下载核验。对应证据:[Delivery](verification/Delivery.json)、[Package](verification/Package.json)、[Release](verification/Release.json)、[本轮宿主验收](verification/HostMaskFolding1.4.3.json)、[编译源码恢复](verification/MaskFoldingRecovery.json)、[发行标签恢复](verification/MaskFoldingReleaseRecovery.json)、[RECOVERY](RECOVERY.md)。
|
||||
|
||||
## 8. 新对话的接手提示
|
||||
|
||||
> 阅读 `/Volumes/备份/大鱼调色/大鱼调色/大鱼调色FxPlug4交接.md`。以当前正式1.4.3(33)和已推送源码为基线,接下来分析本机Color Finale 2.16.2(625)的胶片模拟模块,先产出功能/参数/处理域与顺序的证据表,再按现有大鱼调色架构移植并完成正式交付。父“大鱼调色盘”的胶片代码仅作有出处的参考;保留用户现有调色、蒙版、轨迹、相邻叠层、折叠和数量标记行为。
|
||||
@@ -0,0 +1,183 @@
|
||||
# 历史交接归档:截至 1.4.3(33)
|
||||
|
||||
本文归档自提交 `7814a03f95f9f3c3461af2566e7412c1e5c561e1` 的根目录交接文档。原文件 SHA-256:`2c750076d4c44e8f024298f3da23f093f79735bd8b0cb81e26e499b42702f6dd`。正文保留,调整了相对链接。下文“当前”等表述属于各轮历史记录;现行接手入口为 [大鱼调色FxPlug4交接.md](../../大鱼调色FxPlug4交接.md)。
|
||||
|
||||
# 大鱼调色:1.4.3(33)蒙版折叠与数量标记交接
|
||||
|
||||
当前正式版1.4.3(33),APP实际编译源码 `26a888f4534792481c6a9933091cb0b23307cd24`,公证 `e755670d-8fb3-46d2-95c3-1206f014d16d` Accepted。签名、票据、Gatekeeper、唯一正式安装及正式路径293项既有原生检查通过。正式位置和Bundle ID不变。
|
||||
|
||||
修复模块折叠时蒙版面板仍显示的问题;内容高度和行显示都遵循模块折叠状态。标题蒙版按钮旁新增已添加数量标记,无蒙版时隐藏;原模块和独立层各自计数,停用蒙版仍计入,折叠后保留标记。状态徽标不拦截鼠标,按钮提示和辅助说明同步数量。未改渲染、跟踪算法或数据结构。
|
||||
|
||||
FCP12.4验证用户现有蜘蛛盘蒙版的收起/展开,完整77276字节预设与修改前逐字节一致,286个轨迹键保留;独立合成片段验证原HSL2个蒙版(含1个停用)、独立HSL1个,分别折叠/展开,删除2→1→0与撤销0→1→2即时刷新。两层折叠后蒙版面板为0,数量2/1保留。正常退出冷重开,完整8471字节预设前后及重开均逐字节一致。未强制结束宿主。32版为折叠修复候选,33版纳入用户补充的数量标记;32未发布。
|
||||
|
||||
入口:[本轮说明](../../research/MaskFolding1.4.3.md)、[正式宿主验收](../../verification/HostMaskFolding1.4.3.json)、[远端源码恢复](../../verification/MaskFoldingRecovery.json)、[副本清理](../../verification/MaskFoldingCleanup.json)。远端独立恢复240个文件并比较全部字节、full/strict fsck、原生模型模板和Metal重建通过;着色器摘要沿用上一版且与正式库一致。用户媒体和预设留在本机,无LFS/子模块。PKG和Release最终结果以对应版本验证记录为准。
|
||||
|
||||
本轮正式安装包 `../发行包/大鱼调色-1.4.3.pkg`,14,340,650字节,SHA-256 `41bba698a70a7629438688a4be74947f424f3af04190090c44f248827b4c3bb2`;PKG公证 `f9218078-8fd0-4a0c-9240-4b1acf7d9655` Accepted,签名/票据/Gatekeeper与20项展开验包通过。APP已有独立正式安装及宿主验收,本轮未再次运行系统安装器。Release标签 `v1.4.3-mask-fold-20261102` 已发布,标签提交 `301b31438e8da95dc4e6e1c09498ad814a0ebcfc`;[Release371](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.4.3-mask-fold-20261102) / 附件16在草稿和发布后均完整下载校验14,340,650字节及SHA-256一致。发行标签已从远端独立恢复244文件,全部字节比较及full/strict fsck通过,见 `verification/MaskFoldingReleaseRecovery.json`。核验下载副本和恢复clone已清理,仓库可见性不变。
|
||||
|
||||
## 以下为1.4.2(31)的历史交接
|
||||
|
||||
# 大鱼调色:1.4.2(31)中间帧与真实素材跟踪修复交接
|
||||
|
||||
当前正式版1.4.2(31),APP实际编译源码 `123a6c85078e8aa41fe55577b6dab5622ed7d128`。APP公证 `0bb9a94e-c54a-4d87-95ec-51338579c04f` Accepted,签名、票据、Gatekeeper、唯一正式安装及正式路径293项原生检查通过。固定位置 `/Library/Plug-Ins/FxPlug/大鱼调色.app`,Bundle ID和签名团队不变。PKG与Release最终结果见对应版本记录。
|
||||
|
||||
中间起点以宿主分析首帧为准,不再依赖预览缓存。4K细纹先低通再按比例缩到最高1280×720运动分析,调色渲染输出分辨率不变;拟合容差与置信度一致归一化,保留失效与过期写入保护。失跟显示具体原因、保留可信帧数并正常结束宿主任务;首帧反向使用有效种子范围正常结束;单帧经源时间到时间线转换,已有相同轨迹也正常前进。
|
||||
|
||||
FCP12.4正式31版在同一4K60素材的25p时间线中:中间双向285键、首帧正向285键;取消保留159键后任务闲置,可重新跟完整段;切换画面在2秒失跟、保留50键,连续重试无弹窗且任务闲置。带4秒前置片段的连续单帧7:17→7:18→7:19→7:18;首帧反向保持响应。正常退出冷重开完整预设77087字节逐字节一致。原工程、原媒体与原65键设置保留,验收只在独立副本进行。候选27–30发现的生命周期、单帧和边界问题均有记录,未发布候选包。
|
||||
|
||||
新增层相邻插入、加大的蒙版面板、实际鼠标钢笔/中心拖动确认等1.4.1与1.4.0历史保留。仍不是完整Color Finale移植或人物分割,遮挡/变形可能需要手工修正再从当前帧继续。Motion、Intel、变速/裁剪/非方像素工程未实机验收。
|
||||
|
||||
入口:[实现与边界](../../research/TrackingMidpoint1.4.2.md)、[正式宿主验收](../../verification/HostTrackingMidpoint1.4.2.json)、[原生及离线聚合](../../verification/TrackingMidpoint1.4.2.json)、[编译源码远端恢复](../../verification/TrackingMidpointRecovery.json)、[本轮清理](../../verification/TrackingMidpointCleanup.json)、[恢复方法](../../RECOVERY.md)。
|
||||
|
||||
|
||||
本轮正式PKG `../发行包/大鱼调色-1.4.2.pkg`:14,339,640字节,SHA-256 `d137e3516b9c4abc1e6959b83693f5ed09e040cf018b2e29508cc92246fe76f2`;PKG公证 `2de9f8bb-91b5-41dc-924c-1136ae7bf73f` Accepted,签名/票据/Gatekeeper与20项展开验包通过。本轮未再次运行系统安装器,正式APP已有独立安装与宿主验收。Release标签 `v1.4.2-tracking-midpoint-20261102` 已发布,标签提交 `38bf12326e74f2f026bc4c7627729121b6aa261d`;[Release370](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.4.2-tracking-midpoint-20261102) / 附件15在草稿与发布后均完整下载核对14,339,640字节及SHA-256一致,仓库可见性保持原状。发行标签从远端独立恢复237个文件,见 `verification/TrackingMidpointReleaseRecovery.json`,全部字节比较和full/strict fsck通过;核验下载副本与恢复clone已清理。
|
||||
|
||||
## 以下为1.4.1(26)的历史交接
|
||||
|
||||
# 大鱼调色:1.4.1(26)相邻插入、蒙版面板和钢笔修复交接
|
||||
|
||||
当前正式版为1.4.1(26)。APP编译源码 `0eb56aed126c825ca89712ce90f8cc1c05b03d89` 已推送;公证 `1ddc5499-2da3-4d98-8b2d-09272b0ee326` Accepted,正式位置 `/Library/Plug-Ins/FxPlug/大鱼调色.app`。PKG和Release结果以本版本验证记录为准。
|
||||
|
||||
新添加工具紧接点击处插入,重复点击原层也插在原层与既有子层之间;参数初始化且相互独立。schema2保存after锚点,实际渲染也插入对应阶段;旧schema1末尾工具保持原位置与画面。蒙版参数和数值为13pt、按钮32–36pt、滑杆单独整行,跟踪按钮两列并保留完整中文。
|
||||
|
||||
钢笔入口现可进入空白草稿绘制态,放点/拖柄、首点或Return/面板完成闭合、Delete回退、取消/重画、即时预览、单次撤销及连续手势已实现。修正画面提示文字上下翻转。同步内存草稿与延后作者提交分离,避免宿主回调内读写、过期目标与跨帧草稿覆盖。
|
||||
|
||||
跟踪按Color Finale只读行为证据独立适配实际路径范围、300特征、亚像素精炼、21×21光流及最高4K灰度帧,保留严格失效与过期写入保护。独立CPU/Metal18项通过。不能称为完整Color Finale移植;B样条、编组、人物/图像/外部蒙版、完整轨迹区段编辑等仍有差异,未做同一真实视频的完整轨迹等价对照。
|
||||
|
||||
正式版281项原生检查通过。FCP12.4实测相邻插入/初始化独立参数、大号面板/绘制态、钢笔蒙版正向99键、一次撤销和重做、保存重开完整预设逐字节一致。**用户已用实际鼠标确认钢笔可以绘制并闭合**,原答复“可以绘制并闭合”;自动化鼠标未触发画面回调。其它曲柄/删除等手势的模拟宿主原生OSC回归通过,不扩大为全部实机手势验收。1.4.0用户确认的中心拖动历史保留。
|
||||
|
||||
入口:[本轮实现](../../research/MaskWorkflow1.4.1.md)、[Color Finale证据与差异](../../research/ColorFinaleMasksFollowup.md)、[实际宿主记录](../../verification/HostMaskWorkflow1.4.1.json)、[远端独立恢复](../../verification/MaskWorkflowRecovery.json)、[副本清理](../../verification/MaskWorkflowCleanup.json)、[恢复与构建](../../RECOVERY.md)。正式包和下载核验见Package.json/Release.json。
|
||||
|
||||
## 以下为1.4.0(24)的历史交接
|
||||
|
||||
更新日期:2026-11-01,Asia/Shanghai。当前 APP 已完成正式签名、公证、票据、唯一安装与宿主工作流检查;PKG/Release 状态以本仓库相应验证记录为准。
|
||||
|
||||
## 本轮结果与入口
|
||||
|
||||
十二个模块标题右侧已有“添加蒙版”和“再加一层”。第二个HSL等新增工具使用独立UUID、初始化参数、折叠/启停/复位/删除和自己的蒙版;新增工具依次排在原模块之后。原固定float ID、9001资产和1104字节ABI不变,无蒙版旧工程保留原融合内核。新增一级使用Rec.709/Gamma2.4同域默认,新增肤色保护强度零。
|
||||
|
||||
六种蒙版是椭圆、矩形、钢笔、线性渐变、HSL、亮度;支持相加/减去/相交、启停、反转、羽化、强度和几何数值。几何跟踪从父库固定节点 `f8950384e514685c8809fe8e8ee2dd5f16ad0bd7` 移植Metal光流和仿射RANSAC,并适配本产品FxAnalyzer生命周期;支持正向、反向、双向、单帧、取消及单次撤销,过期目标不回写。当前没有新增对Color Finale二进制的依赖,父工程未修改。
|
||||
|
||||
作者状态:`DYToolState.h/.mm`,9002静态工具文档、9003不保存的OSC会话。渲染:`DYToolRender.inc.h`、`DYToolGPU.h`、`DYGrade.metal`、`tools/build_masked_kernel.py`。面板:`DYMaskPanel.inc.h`、`DYInspector.mm`。原生画面与跟踪:`DYToolOSC.inc.h`、`DYToolHost*.inc.h`、`DYToolFlow.inc.h`、`DYTracking.metal`、`MaskCore/`。归档使用安全类白名单,预设v4包含完整工具/蒙版/轨迹,兼容v1–3。
|
||||
|
||||
实际编译源码 `dbf25fe6719f17075362538dad0404951102524d` 已推送。APP公证 `40fdaaaa-1821-4cc8-bec3-c5dc6d8b9f77` Accepted;正式位置仍为 `/Library/Plug-Ins/FxPlug/大鱼调色.app`,Bundle ID仍为 `com.dayu.color`。Release前后均通过222项原生检查。FCP12.4独立合成工程实测HSL第二层0→32而原层0,独立椭圆/矩形、数值编辑、正向99键、双向100键、新增层单帧2键与播放头前进;一次撤销/重做及正常退出重开后完整预设逐字节一致。
|
||||
|
||||
**用户已确认实际鼠标可拖动蒙版中心。** 初次自动化坐标点击未进入宿主回调,随后用户实测“可以拖动,蒙版随鼠标移动”;真实hit/mouseDown/mouseDragged日志已捕获,原层中心由0.6/0.5变成0.378/0.379,新增层矩形仍为0.5/0.5。用户试调结果保留,不再自动复位或重启宿主。旋转、缩放和钢笔手势未实机确认,原生模拟宿主相关检查通过;不要扩大为所有手势都已实测。Motion、Intel、变速/裁剪/非方像素工程未实测;跟踪不含透视/剪切。新增工具标量为静态作者值,只有蒙版轨迹随时间求值;空间蒙版拒绝Cube导出,应保存完整预设。
|
||||
|
||||
旧模板实例可能保留关闭OSC的10005值,可先存完整预设,再应用新版效果并载入;不自动覆盖旧效果。当前模板使用父库Boolean发布契约,最新插件解析。中间20–23版均未发布最终包,旧生成APP备份在24版宿主确认后清理。远端独立恢复210文件、strict/full fsck、模型模板和着色器重建一致,临时clone已清理。
|
||||
|
||||
证据:[实现说明](../../research/ToolMaskImplementation.md)、[移植来源](../../research/ToolMaskPort.json)、[正式安装](../../verification/Delivery.json)、[222项原生检查](../../verification/InstalledSelfTest.json)、[宿主结果及缺口](../../verification/HostToolMasks.json)、[远端恢复](../../verification/ToolMaskRecovery.json)、[副本清理](../../verification/ToolMaskCleanup.json)。打包入口 `Packaging/build_pkg.py`,发布入口 `Packaging/publish_release.py`;版本标签、PKG公证和下载摘要见 `verification/Package.json`、`verification/Release.json`,不要将历史版本记录当作当前发行成功。
|
||||
|
||||
## 以下为1.3.1接手时的历史快照
|
||||
|
||||
下面各节中的“当前”“下一阶段”和“尚未实现”均指本轮开发前的1.3.1(19),保留作为兼容背景;最新实现以上文和实现说明为准。历史说明整理本身未编译、替换或操作当时的FCP窗口。
|
||||
|
||||
## 1. 下一阶段目标与当前边界
|
||||
|
||||
用户最新需求:继续增加**蒙版、跟踪,以及自行添加工具的能力**。明确例子是:一层 HSL 不够时,可以再添加一个 HSL,分别调整。
|
||||
|
||||
这里的核心是“同类工具可有多个独立实例”。新增 HSL 不能只是另一张面板共用原 HSL 的参数。蒙版应能绑定到具体工具实例,跟踪结果应驱动对应蒙版。
|
||||
|
||||
**上述功能尚未在“大鱼调色”实现。** 当前 1.3.1 是固定模块调色器;“大鱼调色盘”的图层、蒙版和跟踪代码只是下一阶段参考,不能把父库已完成的功能写成当前产品已完成。
|
||||
|
||||
建议开发次序:工具实例和第二个 HSL → 每实例蒙版 → 宿主画面控件 → 蒙版跟踪 → 持久化、撤销和正式交付。设计、源码入口、迁移风险及验收清单见 [蒙版跟踪与工具栈续作方案](../../research/MaskTrackingAndToolStack.md)。其中标为“建议”的内容是接手方案,不代表用户已经逐项指定所有类型和操作。
|
||||
|
||||
## 2. 实际项目与可恢复节点
|
||||
|
||||
| 项目 | 当前值 |
|
||||
| --- | --- |
|
||||
| 主源码目录 | `/Volumes/备份/大鱼调色/大鱼调色` |
|
||||
| 远程 / 分支 | `https://dayu.media/git/dayu/dayu-color.git` / `main` |
|
||||
| 文档整理前 main | `bbdd47d1d74e241f1f144bb2c245204e86973b3f` |
|
||||
| 本次交接标签 | `handoff-mask-tracking-tools-20261101`;最终提交可通过此标签解析 |
|
||||
| 当前正式版本 | **1.3.1(19)** |
|
||||
| APP 实际编译源码 | `dbb7ca4a995ef832178a32f35939aed7d3a85012` |
|
||||
| 正式版本标签 | `v1.3.1-browser-recents-20261101` |
|
||||
| 正式版本标签提交 | `281721bda11484c23f294b4f0d9e0b30ef829288` |
|
||||
| 主 ID / 插件 ID | `com.dayu.color` / `com.dayu.color.XPC` |
|
||||
| 唯一正式 APP | `/Library/Plug-Ins/FxPlug/大鱼调色.app` |
|
||||
| 唯一 FCP 模板 | `/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef` |
|
||||
| 固定构建缓存 | `/Users/mac/Library/Caches/CodexBuilds/com.dayu.color` |
|
||||
| 工程 / Scheme | `大鱼调色.xcodeproj` / `Wrapper Application`,Release |
|
||||
|
||||
工作目录、APP 编译提交、发行标签提交与后续文档提交是不同概念。恢复正式程序源码取编译提交;恢复含包记录的发行节点取版本标签;继续下一阶段从最新 main 或本次交接标签开始。已有历史版本、标签和安装包保留。
|
||||
|
||||
## 3. 已交付行为,后续须保留
|
||||
|
||||
- 一级调色将输入转换、工作空间、一级参数和输出转换放在一张卡片中。使用大鱼 CST 的固定源码数学取代新实例的输入还原 LUT;四个可见旁路选项已移除,一级眼睛统一启停。旧输入 LUT、旧参数 ID 和兼容解释仍保留。
|
||||
- 新实例及全部还原:输入 **Sony S-Log3(28)/ S-Gamut3.Cine(27)**;工作 **DaVinci Intermediate(10)/ DaVinci Wide Gamut(16)**;输出 **Gamma 2.4(1002)/ Rec.709(22)**;自动色调映射关闭。不要根据曲线名称覆盖用户手选色域。
|
||||
- 一级白平衡采用原 CST 色轮,保留原图、+104° 方位、/5 精细拖动、双击复位和方向键微调。底部可见“复位”只将该色轮方向、强度置零。原 BASIS 强度平方×4 的数学不变。
|
||||
- 蜘蛛盘来自“大鱼调色盘”,默认联动 6×6、31 节点;两轴可分别选择 6/8/12/16/24。固定、多选、同列自由点联动、整环/整列、复位、归档和 Cube 导出已接入。中性盘精确直通。
|
||||
- 新实例默认展开**一级调色、蜘蛛盘校色仪、基础调整**,其他模块折叠,全部眼睛打开。标题仅折叠,眼睛仅启停;状态独立保存。黑白混合默认 0%。
|
||||
- 风格 LUT 最多五层。库路径 `/Users/mac/Movies/大鱼调色LUT/look LUTs`。后台导入、取消、最后一次选择生效和 UTF-8/16/32 等编码兼容均保留。
|
||||
- LUT 浏览器在 FCP 中使用独立宿主浮动窗口。网格/列表、缩略图大小、可调整侧栏、窗口/布局偏好按库保存。最近使用分类第一位,成功应用后去重、最新优先,最多 40 个;全部及文件夹也优先显示最近项。旧版未记录的所有历史不能凭空补造;首次打开可从已有当前 LUT 初始化。
|
||||
- 33³ Cube 导出包含开启的 CST、一级白平衡、蜘蛛盘及其它逐像素色彩操作,遵循眼睛开关,折叠不影响导出;不含纹理、清晰度、去朦胧和逐画面统计。将来出现空间蒙版/跟踪后必须重新定义并明确提示导出边界。
|
||||
|
||||
## 4. 当前实现结构与兼容约束
|
||||
|
||||
| 文件 / 位置 | 接手用途 |
|
||||
| --- | --- |
|
||||
| `大鱼调色/Plugin/DYModel.h/.mm` | 234 个固定 float 参数、参数 ID、默认值、资产与界面归档 |
|
||||
| `大鱼调色/Plugin/DYUniforms.h` | 当前 CPU/Metal 缓冲 1104 字节;原 944 字节前缀保持;CST 在偏移 944 追加 |
|
||||
| `大鱼调色/Plugin/DYInspector.mm` | 固定卡片、标题/眼睛、预设 v3、LUT 提交与浏览器宿主 API |
|
||||
| `大鱼调色/Plugin/DYNewPanels.inc.h` | 一级白平衡色轮、可见复位、蜘蛛盘面板 |
|
||||
| `大鱼调色/Plugin/DYColorTables.mm` | HSL、白平衡、颜色分级等 LUT 构建与缓存 |
|
||||
| `大鱼调色/Plugin/DYRenderer.mm` | CST 前段、固定调色链、蜘蛛盘、Metal 资源、预览、Cube 导出 |
|
||||
| `大鱼调色/Plugin/DYGrade.metal`、`tools/kernels/*.ll` | Metal 边界和已版本化运算内核;当前固定调色链有融合执行,尚非工具栈 |
|
||||
| `大鱼调色/Plugin/DYPlugIn.mm` | FxTileableEffect、按宿主时间生成渲染状态、归档白名单及导出 |
|
||||
| `大鱼调色/Plugin/DYLUTBrowser.mm`、`DYLUTLibrary.mm` | 窗口/布局、异步确认、最近使用;不要混入工具作者数据 |
|
||||
|
||||
当前两项 custom 参数:`9000 DYInspectorToken`(schema 2,folds 字典),`9001 DYAssetState`(LUT paths、spiderMesh、spiderLinked)。**9001 注册为 NOT_ANIMATABLE**,不能简单把动态工具塞进去就宣称支持宿主参数关键帧。预设 JSON 版本是 **3**;插件临时渲染状态的 schema 是 **1**;它们是不同格式的版本号。
|
||||
|
||||
当前 HSL 只有一组 `hsl*` 固定字段和一份 HSL 查表。重复工具需要独立身份、参数、缓存和撤销目标。父库 `DYGrade` 是 1032 字节,与本项目 `DYUniforms` 不同;不能直接复制其参数号、POD、Bundle ID 或整个插件入口覆盖当前产品。
|
||||
|
||||
归档、预设、复制、相等性、hash、允许解码类和渲染状态都必须一起演进。旧字段与数学 ID 不重排;旧工程无新增状态时保留原画面。UI 折叠键在多工具场景下应按实例 ID 隔离,不能全部共用 `hsl`。
|
||||
|
||||
## 5. 可复用参考:父级“大鱼调色盘”
|
||||
|
||||
只读目录 `/Volumes/备份/大鱼调色/大鱼调色盘`;远程 `https://dayu.media/git/dayu/dayu-colorplate.git`。本次核对干净 HEAD `f8950384e514685c8809fe8e8ee2dd5f16ad0bd7`。其正式 2.0.0(68)编译源码为 `d05994d5f4547687511bef524efe8c881e8a5c9c`,标签 `v2.0.0-build68`。
|
||||
|
||||
先读父库 `HANDOFF.md`、`research/tracking-host-lifecycle.md` 及 `verification/release-2.0.0-build68.json`。该库记录了矩形/椭圆/闭合钢笔区域、前后/双向/单帧、位置/旋转/独立横纵缩放、取消保留可信段和一次撤销等实现与宿主证据。它输出仿射分解后的这些变换,不能宣传为透视/剪切跟踪或任意遮挡均可靠。
|
||||
|
||||
下一阶段按具体功能复用其作者状态、蒙版数学、OSC 和 FxAnalyzer 生命周期适配,源文件导航见续作方案。父库现有交接另有胶片/CMS等任务,**不属于本次“大鱼调色”新增范围**。不改动兄弟仓库、不替换兄弟 APP、不恢复或覆盖其用户调色文件。
|
||||
|
||||
## 6. 验证现状与用户工作保护
|
||||
|
||||
| 证据 | 本版本实际覆盖 |
|
||||
| --- | --- |
|
||||
| `verification/InstalledSelfTest.json` | 正式路径常规 158 项原生检查 |
|
||||
| `verification/BrowserNative.json` | 正式路径 201 项,含独立 CST 像素参照、色轮/蜘蛛盘、归档与渲染 |
|
||||
| `verification/BrowserCustomization.json` | 23 项离屏浏览器、几何/布局/历史检查 |
|
||||
| `verification/BrowserRegression.json` | 67 项回归,含 3,025 项目录虚拟化、取消及应用确认 |
|
||||
| `verification/SpiderMath.json` | 25 种网格、204,683 项数学检查 |
|
||||
| `verification/HostBrowserAndReset.json` | FCP 12.4 的 Sony 默认、可见复位、独立窗口及系统缩放、两种布局、最近排序、浏览器关闭重开 |
|
||||
| `verification/BrowserRecovery.json` | 编译节点远端恢复 178 文件、fsck、Metal 重建与正式库一致 |
|
||||
| `verification/BrowserReleaseRecovery.json` | 发行节点远端恢复 184 文件、fsck |
|
||||
|
||||
自由标题栏/窗口边缘拖动未由自动化独立确认。用户开始操作浏览器后,保留其当时的网格布局、约 197.97 缩略图大小、窗口位置和 LUT 选择,**未再次重启 FCP 或全部还原**。这些是当时观察,不是要求下一轮强制恢复的偏好;接手以用户最新操作为准。浏览器关闭重开已测,不写成此次已重新冷启动宿主。Motion、Intel、旧系统未验收。
|
||||
|
||||
测试库位于 `/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/大鱼调色_验收.fcpbundle`;本轮独立项目 `大鱼调色_1.3.1_浏览器与复位`。只读/引用现有 LUT,未导入或删除用户 LUT。新功能用独立合成运动素材验收,不修改用户正在工作的调色、跟踪或媒体。
|
||||
|
||||
## 7. 正式交付与发布记录
|
||||
|
||||
- APP 公证:`9e93dc7f-04a3-44f9-a1e4-792bd7b31533`,Accepted。
|
||||
- PKG 公证:`85cad776-c3d7-4037-9643-24041b269002`,Accepted。
|
||||
- 正式包:`/Volumes/备份/大鱼调色/发行包/大鱼调色-1.3.1.pkg`;14,073,683 字节。
|
||||
- SHA-256:`954b10c581f31d23a8c417a6f37b24fae19939786dce8733b4d6f09c7ed3adae`。
|
||||
- [1.3.1 Release](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.3.1-browser-recents-20261101),Release ID 366,附件 ID 12;附件下载链接见 `verification/Release.json`。
|
||||
- APP/PKG 的 Developer ID、票据、Gatekeeper、20 项展开验包通过。草稿与正式链接均完整下载校验,只上传一次。正式 APP 已安装,本轮未重复执行 PKG 安装器。
|
||||
|
||||
详细恢复与历史仍在 [RECOVERY.md](../../RECOVERY.md)。本次整理不修改上述正式发行标签、附件或程序版本。
|
||||
|
||||
## 8. 下一位接手的操作入口
|
||||
|
||||
1. 读取本文件、续作方案和本机 `/Users/mac/.codex/AGENTS.md`;核对 main、本地未提交改动、远端及同产品任务,保留用户正在操作的 FCP 状态。
|
||||
2. 先完成工具实例/参数/顺序/迁移合同,以“两个独立 HSL”形成可验收的第一阶段;避免先给所有模块套一个全局蒙版而日后重做。
|
||||
3. 再按续作方案接蒙版、OSC、精确时间分析、取消和单次 Undo/Redo。每阶段提交并立即推送;只暂存本任务文件。
|
||||
4. 模型修改后刷新模板:`python3 tools/build_template.py --refresh-model --overwrite`。
|
||||
5. 编译和 CLI 检查可在固定缓存执行;用户可见验收必须从正式安装的已公证版本进行。正式交付使用 `python3 tools/deliver.py`,它持有产品锁并等待宿主验收输入 `complete`。
|
||||
6. PKG 入口:`python3 Packaging/build_pkg.py --pkg-forge-repo /Users/mac/Documents/dayu-git/repositories/pkg-forge`。发布入口:`python3 Packaging/publish_release.py --tag <新标签> --notes <对应说明>`。不要复用本次版本号、覆盖旧包或移动旧标签。
|
||||
7. 产品身份、正式路径、逐层签名、公证、票据、PluginKit 唯一登记、生成副本清理、Release 完整下载及远端恢复都继续按全局约定执行。证书/profile/权限在下次发布时重新复核,凭据不进文档或源码。
|
||||
|
||||
可直接用于下一聊的任务描述:
|
||||
|
||||
> 先读“大鱼调色FxPlug4交接.md”和 research/MaskTrackingAndToolStack.md,从当前 1.3.1(19)继续。我要能添加多个独立工具,例如第二个 HSL,并给具体工具添加蒙版及蒙版跟踪。参考父级“大鱼调色盘”,保留当前 CST、折叠/眼睛、蜘蛛盘、LUT 浏览器和最近使用行为,保护已有工程和当前用户操作,分阶段验证并完成正式交付。
|
||||
@@ -1,7 +1,8 @@
|
||||
{
|
||||
"archivesBase64": {
|
||||
"9000": "AAAAAAAAAisqYnBsaXN0MDDUAQIDBAUGBwxYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctIICQoLXERhdGFJc0xlZ2FjeV8QD0JsaW5kRGF0YU9iamVjdIACgAGjDQ4PVSRudWxsTxEBa2JwbGlzdDAw1AECAwQFBgcKWCR2ZXJzaW9uWSRhcmNoaXZlclQkdG9wWCRvYmplY3RzEgABhqBfEA9OU0tleWVkQXJjaGl2ZXLRCAlbQ3VzdG9tIERhdGGAAaULDBMZH1UkbnVsbNMNDg8QERJVZm9sZHNWc2NoZW1hViRjbGFzc4ACEAKABNMUFQ8WFxhXTlMua2V5c1pOUy5vYmplY3RzoKCAA9IaGxwdWiRjbGFzc25hbWVYJGNsYXNzZXNcTlNEaWN0aW9uYXJ5ohweWE5TT2JqZWN00hobICFfEBBEWUluc3BlY3RvclRva2VuoiIeXxAQRFlJbnNwZWN0b3JUb2tlbgAIABEAGgAkACkAMgA3AEkATABYAFoAYABmAG0AcwB6AIEAgwCFAIcAjgCWAKEAogCjAKUAqgC1AL4AywDOANcA3ADvAPIAAAAAAAACAQAAAAAAAAAjAAAAAAAAAAAAAAAAAAABBQgACAARABoAJAApADIANwBJAE4AWwBtAG8AcQB1AHsB6gAAAAAAAAIBAAAAAAAAABAAAAAAAAAAAAAAAAAAAAHrAA==",
|
||||
"9001": "AAAAAAAAAjcqYnBsaXN0MDDUAQIDBAUGBwxYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctIICQoLXERhdGFJc0xlZ2FjeV8QD0JsaW5kRGF0YU9iamVjdIACgAGjDQ4PVSRudWxsTxEBd2JwbGlzdDAw1AECAwQFBgcKWCR2ZXJzaW9uWSRhcmNoaXZlclQkdG9wWCRvYmplY3RzEgABhqBfEA9OU0tleWVkQXJjaGl2ZXLRCAlbQ3VzdG9tIERhdGGAAaULDBUbIVUkbnVsbNQNDg8QERITFFVwYXRoc1YkY2xhc3Ncc3BpZGVyTGlua2VkWnNwaWRlck1lc2iAAoAECYAA0xYXDhgZGldOUy5rZXlzWk5TLm9iamVjdHOgoIAD0hwdHh9aJGNsYXNzbmFtZVgkY2xhc3Nlc1xOU0RpY3Rpb25hcnmiHiBYTlNPYmplY3TSHB0iI1xEWUFzc2V0U3RhdGWiJCBcRFlBc3NldFN0YXRlAAgAEQAaACQAKQAyADcASQBMAFgAWgBgAGYAbwB1AHwAiQCUAJYAmACZAJsAogCqALUAtgC3ALkAvgDJANIA3wDiAOsA8AD9AQAAAAAAAAACAQAAAAAAAAAlAAAAAAAAAAAAAAAAAAABDQgACAARABoAJAApADIANwBJAE4AWwBtAG8AcQB1AHsB9gAAAAAAAAIBAAAAAAAAABAAAAAAAAAAAAAAAAAAAAH3AA=="
|
||||
"9001": "AAAAAAAAAjcqYnBsaXN0MDDUAQIDBAUGBwxYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctIICQoLXERhdGFJc0xlZ2FjeV8QD0JsaW5kRGF0YU9iamVjdIACgAGjDQ4PVSRudWxsTxEBd2JwbGlzdDAw1AECAwQFBgcKWCR2ZXJzaW9uWSRhcmNoaXZlclQkdG9wWCRvYmplY3RzEgABhqBfEA9OU0tleWVkQXJjaGl2ZXLRCAlbQ3VzdG9tIERhdGGAAaULDBUbIVUkbnVsbNQNDg8QERITFFVwYXRoc1YkY2xhc3Ncc3BpZGVyTGlua2VkWnNwaWRlck1lc2iAAoAECYAA0xYXDhgZGldOUy5rZXlzWk5TLm9iamVjdHOgoIAD0hwdHh9aJGNsYXNzbmFtZVgkY2xhc3Nlc1xOU0RpY3Rpb25hcnmiHiBYTlNPYmplY3TSHB0iI1xEWUFzc2V0U3RhdGWiJCBcRFlBc3NldFN0YXRlAAgAEQAaACQAKQAyADcASQBMAFgAWgBgAGYAbwB1AHwAiQCUAJYAmACZAJsAogCqALUAtgC3ALkAvgDJANIA3wDiAOsA8AD9AQAAAAAAAAACAQAAAAAAAAAlAAAAAAAAAAAAAAAAAAABDQgACAARABoAJAApADIANwBJAE4AWwBtAG8AcQB1AHsB9gAAAAAAAAIBAAAAAAAAABAAAAAAAAAAAAAAAAAAAAH3AA==",
|
||||
"9002": "AAAAAAAAApUqYnBsaXN0MDDUAQIDBAUGBwxYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctIICQoLXERhdGFJc0xlZ2FjeV8QD0JsaW5kRGF0YU9iamVjdIACgAGjDQ4PVSRudWxsTxEB1WJwbGlzdDAw1AECAwQFBgcKWCR2ZXJzaW9uWSRhcmNoaXZlclQkdG9wWCRvYmplY3RzEgABhqBfEA9OU0tleWVkQXJjaGl2ZXLRCAlbQ3VzdG9tIERhdGGAAawLDBEdHh8gJCotMDFVJG51bGzSDQ4PEFhkb2N1bWVudFYkY2xhc3OAAoAL0xITDhQYHFdOUy5rZXlzWk5TLm9iamVjdHOjFRYXgAOABIAFoxkaG4AGgAiACoAHWWJhc2VNYXNrc1ZsYXllcnNWc2NoZW1h0xITDiEiHKCggAfSJSYnKFokY2xhc3NuYW1lWCRjbGFzc2VzXE5TRGljdGlvbmFyeaInKVhOU09iamVjdNITDissoIAJ0iUmLi9XTlNBcnJheaIuKRAB0iUmMjNeRFlUb29sRG9jdW1lbnSiNCleRFlUb29sRG9jdW1lbnQACAARABoAJAApADIANwBJAEwAWABaAGcAbQByAHsAggCEAIYAjQCVAKAApACmAKgAqgCuALAAsgC0ALYAwADHAM4A1QDWANcA2QDeAOkA8gD/AQIBCwEQAREBEwEYASABIwElASoBOQE8AAAAAAAAAgEAAAAAAAAANQAAAAAAAAAAAAAAAAAAAUsIAAgAEQAaACQAKQAyADcASQBOAFsAbQBvAHEAdQB7AlQAAAAAAAACAQAAAAAAAAAQAAAAAAAAAAAAAAAAAAACVQA="
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
@@ -3061,16 +3062,542 @@
|
||||
"pid": 2188,
|
||||
"step": 0.01,
|
||||
"title": "色彩平衡"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"key": "mixer00",
|
||||
"kind": "float",
|
||||
"max": 2,
|
||||
"min": -2,
|
||||
"mixerTab": 0,
|
||||
"offset": 1104,
|
||||
"pid": 2276,
|
||||
"step": 0.01,
|
||||
"title": "红输出 ← 红输入"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"key": "mixer01",
|
||||
"kind": "float",
|
||||
"max": 2,
|
||||
"min": -2,
|
||||
"mixerTab": 0,
|
||||
"offset": 1108,
|
||||
"pid": 2277,
|
||||
"step": 0.01,
|
||||
"title": "红输出 ← 绿输入"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"key": "mixer02",
|
||||
"kind": "float",
|
||||
"max": 2,
|
||||
"min": -2,
|
||||
"mixerTab": 0,
|
||||
"offset": 1112,
|
||||
"pid": 2278,
|
||||
"step": 0.01,
|
||||
"title": "红输出 ← 蓝输入"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"key": "mixer10",
|
||||
"kind": "float",
|
||||
"max": 2,
|
||||
"min": -2,
|
||||
"mixerTab": 1,
|
||||
"offset": 1120,
|
||||
"pid": 2280,
|
||||
"step": 0.01,
|
||||
"title": "绿输出 ← 红输入"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"key": "mixer11",
|
||||
"kind": "float",
|
||||
"max": 2,
|
||||
"min": -2,
|
||||
"mixerTab": 1,
|
||||
"offset": 1124,
|
||||
"pid": 2281,
|
||||
"step": 0.01,
|
||||
"title": "绿输出 ← 绿输入"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"key": "mixer12",
|
||||
"kind": "float",
|
||||
"max": 2,
|
||||
"min": -2,
|
||||
"mixerTab": 1,
|
||||
"offset": 1128,
|
||||
"pid": 2282,
|
||||
"step": 0.01,
|
||||
"title": "绿输出 ← 蓝输入"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"key": "mixer20",
|
||||
"kind": "float",
|
||||
"max": 2,
|
||||
"min": -2,
|
||||
"mixerTab": 2,
|
||||
"offset": 1136,
|
||||
"pid": 2284,
|
||||
"step": 0.01,
|
||||
"title": "蓝输出 ← 红输入"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"key": "mixer21",
|
||||
"kind": "float",
|
||||
"max": 2,
|
||||
"min": -2,
|
||||
"mixerTab": 2,
|
||||
"offset": 1140,
|
||||
"pid": 2285,
|
||||
"step": 0.01,
|
||||
"title": "蓝输出 ← 绿输入"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"key": "mixer22",
|
||||
"kind": "float",
|
||||
"max": 2,
|
||||
"min": -2,
|
||||
"mixerTab": 2,
|
||||
"offset": 1144,
|
||||
"pid": 2286,
|
||||
"step": 0.01,
|
||||
"title": "蓝输出 ← 蓝输入"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"key": "mixerPreserveLuma",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1156,
|
||||
"pid": 2289,
|
||||
"step": 0.01,
|
||||
"title": "保持亮度"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"key": "mixerPreserveSaturation",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1160,
|
||||
"pid": 2290,
|
||||
"step": 0.01,
|
||||
"title": "保持饱和度"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"key": "mixerMix",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1164,
|
||||
"pid": 2291,
|
||||
"step": 0.01,
|
||||
"title": "通道混合强度"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"key": "mixerEnabled",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1152,
|
||||
"pid": 2288,
|
||||
"step": 0.01,
|
||||
"title": "通道混合器"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"filmTab": -1,
|
||||
"key": "filmMix",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1172,
|
||||
"pid": 2293,
|
||||
"step": 0.01,
|
||||
"title": "胶片混合强度"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"filmTab": 0,
|
||||
"key": "filmSubtractive",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1176,
|
||||
"pid": 2294,
|
||||
"step": 0.01,
|
||||
"title": "启用减色"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"filmTab": 0,
|
||||
"key": "filmGammaAll",
|
||||
"kind": "float",
|
||||
"max": 4,
|
||||
"min": 0.25,
|
||||
"offset": 1180,
|
||||
"pid": 2295,
|
||||
"step": 0.01,
|
||||
"title": "整体减色"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"filmTab": 0,
|
||||
"key": "filmGammaCyan",
|
||||
"kind": "float",
|
||||
"max": 4,
|
||||
"min": 0.25,
|
||||
"offset": 1184,
|
||||
"pid": 2296,
|
||||
"step": 0.01,
|
||||
"title": "青色减色"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"filmTab": 0,
|
||||
"key": "filmGammaMagenta",
|
||||
"kind": "float",
|
||||
"max": 4,
|
||||
"min": 0.25,
|
||||
"offset": 1188,
|
||||
"pid": 2297,
|
||||
"step": 0.01,
|
||||
"title": "洋红减色"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"filmTab": 0,
|
||||
"key": "filmGammaYellow",
|
||||
"kind": "float",
|
||||
"max": 4,
|
||||
"min": 0.25,
|
||||
"offset": 1192,
|
||||
"pid": 2298,
|
||||
"step": 0.01,
|
||||
"title": "黄色减色"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"filmTab": 0,
|
||||
"key": "filmDensity",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": -1,
|
||||
"offset": 1196,
|
||||
"pid": 2299,
|
||||
"step": 0.01,
|
||||
"title": "密度"
|
||||
},
|
||||
{
|
||||
"default": 2,
|
||||
"filmTab": 0,
|
||||
"key": "filmDensityMode",
|
||||
"kind": "popup",
|
||||
"max": 2,
|
||||
"min": 1,
|
||||
"offset": 1200,
|
||||
"options": [
|
||||
"模式 1 · 最大值",
|
||||
"模式 2 · 平均值"
|
||||
],
|
||||
"pid": 2300,
|
||||
"step": 0.01,
|
||||
"title": "密度模式",
|
||||
"values": [
|
||||
2,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"default": 6,
|
||||
"key": "filmValueMode",
|
||||
"kind": "float",
|
||||
"max": 6,
|
||||
"min": 1,
|
||||
"offset": 1204,
|
||||
"pid": 2301,
|
||||
"step": 0.01,
|
||||
"title": "胶片亮度模型"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"filmTab": 1,
|
||||
"key": "filmHalation",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1208,
|
||||
"pid": 2302,
|
||||
"step": 0.01,
|
||||
"title": "启用晕光"
|
||||
},
|
||||
{
|
||||
"default": 5,
|
||||
"filmTab": 1,
|
||||
"key": "filmScatter",
|
||||
"kind": "float",
|
||||
"max": 100,
|
||||
"min": 0,
|
||||
"offset": 1212,
|
||||
"pid": 2303,
|
||||
"step": 1,
|
||||
"title": "散射半径"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"filmTab": 1,
|
||||
"key": "filmTransmission",
|
||||
"kind": "float",
|
||||
"max": 100,
|
||||
"min": 0,
|
||||
"offset": 1216,
|
||||
"pid": 2304,
|
||||
"step": 1,
|
||||
"title": "染料透射"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"filmTab": 1,
|
||||
"key": "filmBoost",
|
||||
"kind": "float",
|
||||
"max": 5,
|
||||
"min": 0,
|
||||
"offset": 1220,
|
||||
"pid": 2305,
|
||||
"step": 0.01,
|
||||
"title": "晕光增强"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"filmTab": 2,
|
||||
"key": "filmBloom",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1224,
|
||||
"pid": 2306,
|
||||
"step": 0.01,
|
||||
"title": "启用辉光"
|
||||
},
|
||||
{
|
||||
"default": 50,
|
||||
"filmTab": 2,
|
||||
"key": "filmSensitivity",
|
||||
"kind": "float",
|
||||
"max": 100,
|
||||
"min": 0,
|
||||
"offset": 1228,
|
||||
"pid": 2307,
|
||||
"step": 1,
|
||||
"title": "辉光灵敏度"
|
||||
},
|
||||
{
|
||||
"default": 30,
|
||||
"filmTab": 2,
|
||||
"key": "filmDiffusion",
|
||||
"kind": "float",
|
||||
"max": 100,
|
||||
"min": 0,
|
||||
"offset": 1232,
|
||||
"pid": 2308,
|
||||
"step": 1,
|
||||
"title": "辉光扩散"
|
||||
},
|
||||
{
|
||||
"default": 50,
|
||||
"filmTab": 2,
|
||||
"key": "filmIntensity",
|
||||
"kind": "float",
|
||||
"max": 100,
|
||||
"min": 0,
|
||||
"offset": 1236,
|
||||
"pid": 2309,
|
||||
"step": 1,
|
||||
"title": "辉光强度"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"filmTab": 3,
|
||||
"key": "filmGrain",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1240,
|
||||
"pid": 2310,
|
||||
"step": 0.01,
|
||||
"title": "启用颗粒"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"filmTab": 3,
|
||||
"key": "filmGrainAmount",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1244,
|
||||
"pid": 2311,
|
||||
"step": 0.01,
|
||||
"title": "颗粒数量"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"filmTab": 3,
|
||||
"key": "filmGrainSize",
|
||||
"kind": "float",
|
||||
"max": 20,
|
||||
"min": 1,
|
||||
"offset": 1248,
|
||||
"pid": 2312,
|
||||
"step": 1,
|
||||
"title": "颗粒大小"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"filmTab": 3,
|
||||
"key": "filmGrainResponse",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": -1,
|
||||
"offset": 1252,
|
||||
"pid": 2313,
|
||||
"step": 0.01,
|
||||
"title": "胶片响应"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"filmTab": 3,
|
||||
"key": "filmGrainColor",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1256,
|
||||
"pid": 2314,
|
||||
"step": 0.01,
|
||||
"title": "颜色变化"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"filmTab": 3,
|
||||
"key": "filmGrainHold",
|
||||
"kind": "popup",
|
||||
"max": 5,
|
||||
"min": 1,
|
||||
"offset": 1260,
|
||||
"options": [
|
||||
"每帧更新",
|
||||
"保持 2 帧",
|
||||
"保持 3 帧",
|
||||
"保持 4 帧",
|
||||
"保持 5 帧"
|
||||
],
|
||||
"pid": 2315,
|
||||
"step": 0.01,
|
||||
"title": "颗粒帧保持",
|
||||
"values": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"filmTab": 3,
|
||||
"key": "filmGrainSeed",
|
||||
"kind": "float",
|
||||
"max": 65535,
|
||||
"min": 0,
|
||||
"offset": 1264,
|
||||
"pid": 2316,
|
||||
"step": 1,
|
||||
"title": "颗粒种子"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"filmTab": 4,
|
||||
"key": "filmVignette",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1268,
|
||||
"pid": 2317,
|
||||
"step": 0.01,
|
||||
"title": "启用暗角"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"filmTab": 4,
|
||||
"key": "filmVignetteIntensity",
|
||||
"kind": "float",
|
||||
"max": 2,
|
||||
"min": -2,
|
||||
"offset": 1272,
|
||||
"pid": 2318,
|
||||
"step": 0.01,
|
||||
"title": "暗角强度"
|
||||
},
|
||||
{
|
||||
"default": 50,
|
||||
"filmTab": 4,
|
||||
"key": "filmVignetteRadius",
|
||||
"kind": "float",
|
||||
"max": 100,
|
||||
"min": 0,
|
||||
"offset": 1276,
|
||||
"pid": 2319,
|
||||
"step": 1,
|
||||
"title": "暗角半径"
|
||||
},
|
||||
{
|
||||
"default": 0.5,
|
||||
"filmTab": 4,
|
||||
"key": "filmVignetteFalloff",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1280,
|
||||
"pid": 2320,
|
||||
"step": 0.01,
|
||||
"title": "暗角过渡"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"key": "filmEnabled",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1168,
|
||||
"pid": 2292,
|
||||
"step": 0.01,
|
||||
"title": "胶片模拟"
|
||||
}
|
||||
],
|
||||
"sourceSHA256": {
|
||||
"template/tools/dump_model.mm": "2ef22e010e0cae15b73107d39fb2c125f6049b1e5405e88078f936cf29e79350",
|
||||
"template/tools/dump_model.mm": "04e04446aa351d774913bc25b06512fefe7969bdf4c6e471a91f1e9d6c4fc3b5",
|
||||
"大鱼调色/Plugin/DYCSTTypes.h": "3372e3cd77248eeb374e54675d2902befceea8e00a2afc4f9543116ef3027696",
|
||||
"大鱼调色/Plugin/DYColorManagement.h": "b0a4cd1b8c45dbce90a7b4f30f72ebf95ecd382895e74e3bfeda0f7cdb185157",
|
||||
"大鱼调色/Plugin/DYFilmMath.h": "e41d44790c6bb42db7c68520d442b39c381b4db4056d40a44426e21f62e9bf6b",
|
||||
"大鱼调色/Plugin/DYFilmTypes.h": "c35a43b5b93988e8517e5db8f281da0dfd1e02f5b0e7bfb62e7345cec444a36d",
|
||||
"大鱼调色/Plugin/DYModel.h": "80e88add97deeac7a9dc47d12f68b0245905786297de2e6553b3da15c729da6e",
|
||||
"大鱼调色/Plugin/DYModel.mm": "bbc393bd1b5fb4e98ce800a017d8ea3544e0904035c86421dac8cf6fcb05a6a0",
|
||||
"大鱼调色/Plugin/DYModel.mm": "48d0e8a36f41001c63e0f95faa99f8dd910b0227d7b93ff2a90006673c3e3c36",
|
||||
"大鱼调色/Plugin/DYSpiderState.h": "0c80747e41e8fc97762e301b011bd08c18865a825eaafde086ed79ace37b22f9",
|
||||
"大鱼调色/Plugin/DYUniforms.h": "8ef480025c739b29f55884ba0c7218e9d6fd8d80c46cfc72d6ee3da90215abe4",
|
||||
"大鱼调色/Plugin/DYToolState.h": "28088ec819307a60f2e52334fd807a514c3ff8a550bc0efbe7069b68a6242320",
|
||||
"大鱼调色/Plugin/DYToolState.mm": "6502e412532f2be2589188c1b99579ae59ab279d814805e38b0c8042e921a5bd",
|
||||
"大鱼调色/Plugin/DYUniforms.h": "8c494532d534b65622039605073b554bafd92ec0efe1e0d207d822b59862a1cb",
|
||||
"大鱼调色/Plugin/MaskCore/DYMask.h": "5b9aa44390d4a1fca1baf5e34cb9eefc8483c939a65cc2a0412b7b41fc85bc16",
|
||||
"大鱼调色/Plugin/MaskCore/DYMaskOperator.h": "43fa701ad574f38ce0ab4f4d3900bb034edaaa1adc09821d2f4443ee2b687ba2",
|
||||
"大鱼调色/Plugin/SpiderCore/DYColorMath.h": "bdd6278e17ff4208ad94a8b0e834c817c0a3475f205dd79898e8fd88e84a19c9",
|
||||
"大鱼调色/Plugin/SpiderCore/DYSpiderMesh.hpp": "81ecf1f0bae4030615144c7cd7ca492f93f2d718ff9e45da8242f97848e3d754"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "DYModel.h"
|
||||
#import "DYToolState.h"
|
||||
|
||||
static NSString *archive(id object) {
|
||||
NSKeyedArchiver *inner=[[[NSKeyedArchiver alloc]initRequiringSecureCoding:YES]autorelease];
|
||||
@@ -17,7 +18,7 @@ static NSString *archive(id object) {
|
||||
return [carrier base64EncodedStringWithOptions:0];
|
||||
}
|
||||
int main(void){@autoreleasepool{
|
||||
NSDictionary *out=@{@"parameters":DYDescriptors(),@"archivesBase64":@{@"9000":archive([[[DYInspectorToken alloc]init]autorelease]),@"9001":archive([[[DYAssetState alloc]init]autorelease])}};
|
||||
NSDictionary *out=@{@"parameters":DYDescriptors(),@"archivesBase64":@{@"9000":archive([[[DYInspectorToken alloc]init]autorelease]),@"9001":archive([[[DYAssetState alloc]init]autorelease]),@"9002":archive([[[DYToolDocument alloc]init]autorelease])}};
|
||||
NSError *error=nil;NSData *json=[NSJSONSerialization dataWithJSONObject:out options:NSJSONWritingPrettyPrinted|NSJSONWritingSortedKeys error:&error];
|
||||
if(!json){fprintf(stderr,"Could not export our model metadata\n");return 2;}fwrite(json.bytes,1,json.length,stdout);return 0;
|
||||
}}
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"passed": true,
|
||||
"sha256": "86d62016bf9089d1eda07cc6a533bcb82d905df18351f48e73d6fb87945e09de",
|
||||
"sha256": "7476fb5a3cfad5f4dafb7a887dcc787b9cbcba6ad64df3b4939b336444cf8bfc",
|
||||
"version": "5.13",
|
||||
"displayversion": "5.6.7",
|
||||
"filterCount": 1,
|
||||
"nativeFloatParameters": 234,
|
||||
"customParameters": 2,
|
||||
"nativeFloatParameters": 276,
|
||||
"customParameters": 3,
|
||||
"publications": [
|
||||
{
|
||||
"object": "10081",
|
||||
|
||||
+49
-2
@@ -288,7 +288,7 @@
|
||||
<parameter name="宽度" id="313" flags="8589934610" default="1" value="3840" />
|
||||
<parameter name="高度" id="314" flags="8589934610" default="1" value="2160" />
|
||||
</parameter>
|
||||
<filter name="大鱼调色" id="10060" factoryID="5" pluginUUID="1C17B73B-F229-4C09-A434-EAF6DFF5F22A" pluginVersion="1" pluginName="大鱼调色" pluginDynamicParams="0">
|
||||
<filter name="大鱼调色" id="10060" factoryID="5" pluginUUID="1C17B73B-F229-4C09-A434-EAF6DFF5F22A" pluginVersion="0" pluginName="大鱼调色" pluginDynamicParams="0">
|
||||
<timing in="0 1 1 0" out="1199198 120000 1 0" offset="0 1 1 0" />
|
||||
<baseFlags>8589934608</baseFlags>
|
||||
<parameter name="大鱼调色" id="9000" flags="12884901888">
|
||||
@@ -301,6 +301,11 @@
|
||||
<defaultVal>*********XQeMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-Rq7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**OI91-IP6JIYPbJgPBEB1UwE2F6H33JkMLFcQpMYMqlVQrBQQr-dN4JmH4ZiOqJYKbBkOKFZQYpZQqW**c*20M**olML1VUN4ZRCImtfNLZnKYtH9axWOaJXR5CUc6*1oVkR5VxO74BgMLBnPa3hNJUYMqlVQrBZQplCIoFdMrFdPqtVQbaW5W-MHZBDMadZMrHG5-oW6pl2KI3nQqJoIrFVR4KW70-QF3Z-QrBZR3BoMLFZ**U*2E*O*0E*8E*m*1Q*GE-A*3U*KU-U*4M*Pk-p*5k*WE0I*7M*a*0N*7g*cU0e*9I*hU0r*9Y*jU17*B6*rk1W*Cg*w*1x*E*********0*E*********Z*******************-1EU*0**F*-c*7**d*16*Bk-7*2s*Kk-h*4w*QE-p*5g-xU********6-*********-********************5r**</defaultVal>
|
||||
<dataValue>*********XQeMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-Rq7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**OI91-IP6JIYPbJgPBEB1UwE2F6H33JkMLFcQpMYMqlVQrBQQr-dN4JmH4ZiOqJYKbBkOKFZQYpZQqW**c*20M**olML1VUN4ZRCImtfNLZnKYtH9axWOaJXR5CUc6*1oVkR5VxO74BgMLBnPa3hNJUYMqlVQrBZQplCIoFdMrFdPqtVQbaW5W-MHZBDMadZMrHG5-oW6pl2KI3nQqJoIrFVR4KW70-QF3Z-QrBZR3BoMLFZ**U*2E*O*0E*8E*m*1Q*GE-A*3U*KU-U*4M*Pk-p*5k*WE0I*7M*a*0N*7g*cU0e*9I*hU0r*9Y*jU17*B6*rk1W*Cg*w*1x*E*********0*E*********Z*******************-1EU*0**F*-c*7**d*16*Bk-7*2s*Kk-h*4w*QE-p*5g-xU********6-*********-********************5r**</dataValue>
|
||||
</parameter>
|
||||
<parameter name="工具与蒙版" id="9002" flags="12889161776">
|
||||
<numberOfKeypoints>0</numberOfKeypoints>
|
||||
<defaultVal>*********dIeMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-pK7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**Ok91-2R5VwU70chA13J74tpP4nG1EsD23VYPqBpPKJiR3MYMqlVQrC**c*9ol6H1VEM53RCImtfNLZnKYtH9axWOaJXR5CX3FMLU*C*-6*3clYO4s*4U*W*0c*5KK7VQqJBMLBfQpNgMLZZQbBKQqBcNKpVol6H1W2W580UU*TG7GMb83cYMqlVQrBiMKpZK0FXP43nQqJnL2tHF4ZXR4ZjPa3mSO6b8JVCIoxWOaJXRB6H1Wggc6*7oWIa9WxLHZB-Qb7VSO6i8F*-oWIaAXBSF3ZIPqxgF4xXRKpZPbGWB0ZSF3ZIPqxgF4xXRKpZPbE*0**F*-c*7**d*16*Bk-7*2k*K*-O*4Q*PE-m*5g*UU02*6M*XE0J*8**d*0a*8U*eU0i*9**gU0o*9M*k*15*As*pE1K*BQ*qE1S*CY*wU1z*E6-0k2E*F2-2k2M*G*-6k2Z*Gc-CE2w*********U2*********BE*******************Ig6**U*2E*O*0E*8E*m*1Q*GE-C*3g*PE-j*52*RE-v*ZE********0*E*********E*******************0JE*</defaultVal>
|
||||
<dataValue>*********dIeMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-pK7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**Ok91-2R5VwU70chA13J74tpP4nG1EsD23VYPqBpPKJiR3MYMqlVQrC**c*9ol6H1VEM53RCImtfNLZnKYtH9axWOaJXR5CX3FMLU*C*-6*3clYO4s*4U*W*0c*5KK7VQqJBMLBfQpNgMLZZQbBKQqBcNKpVol6H1W2W580UU*TG7GMb83cYMqlVQrBiMKpZK0FXP43nQqJnL2tHF4ZXR4ZjPa3mSO6b8JVCIoxWOaJXRB6H1Wggc6*7oWIa9WxLHZB-Qb7VSO6i8F*-oWIaAXBSF3ZIPqxgF4xXRKpZPbGWB0ZSF3ZIPqxgF4xXRKpZPbE*0**F*-c*7**d*16*Bk-7*2k*K*-O*4Q*PE-m*5g*UU02*6M*XE0J*8**d*0a*8U*eU0i*9**gU0o*9M*k*15*As*pE1K*BQ*qE1S*CY*wU1z*E6-0k2E*F2-2k2M*G*-6k2Z*Gc-CE2w*********U2*********BE*******************Ig6**U*2E*O*0E*8E*m*1Q*GE-C*3g*PE-j*52*RE-v*ZE********0*E*********E*******************0JE*</dataValue>
|
||||
</parameter>
|
||||
<parameter name="相机输入" id="2013" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="旧版输入强度" id="2014" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="CST 配置版本" id="2236" flags="12889161760" default="0" value="0" />
|
||||
@@ -535,10 +540,52 @@
|
||||
<parameter name="高光 洋红 ↔ 绿" id="2201" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="高光 黄 ↔ 蓝" id="2202" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="色彩平衡" id="2188" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="红输出 ← 红输入" id="2276" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="红输出 ← 绿输入" id="2277" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="红输出 ← 蓝输入" id="2278" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="绿输出 ← 红输入" id="2280" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="绿输出 ← 绿输入" id="2281" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="绿输出 ← 蓝输入" id="2282" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="蓝输出 ← 红输入" id="2284" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="蓝输出 ← 绿输入" id="2285" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="蓝输出 ← 蓝输入" id="2286" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="保持亮度" id="2289" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="保持饱和度" id="2290" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="通道混合强度" id="2291" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="通道混合器" id="2288" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="胶片混合强度" id="2293" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="启用减色" id="2294" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="整体减色" id="2295" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="青色减色" id="2296" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="洋红减色" id="2297" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="黄色减色" id="2298" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="密度" id="2299" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="密度模式" id="2300" flags="12889161760" default="2" value="2" />
|
||||
<parameter name="胶片亮度模型" id="2301" flags="12889161760" default="6" value="6" />
|
||||
<parameter name="启用晕光" id="2302" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="散射半径" id="2303" flags="12889161760" default="5" value="5" />
|
||||
<parameter name="染料透射" id="2304" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="晕光增强" id="2305" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="启用辉光" id="2306" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="辉光灵敏度" id="2307" flags="12889161760" default="50" value="50" />
|
||||
<parameter name="辉光扩散" id="2308" flags="12889161760" default="30" value="30" />
|
||||
<parameter name="辉光强度" id="2309" flags="12889161760" default="50" value="50" />
|
||||
<parameter name="启用颗粒" id="2310" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="颗粒数量" id="2311" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="颗粒大小" id="2312" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="胶片响应" id="2313" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="颜色变化" id="2314" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="颗粒帧保持" id="2315" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="颗粒种子" id="2316" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="启用暗角" id="2317" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="暗角强度" id="2318" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="暗角半径" id="2319" flags="12889161760" default="50" value="50" />
|
||||
<parameter name="暗角过渡" id="2320" flags="12889161760" default="0.5" value="0.5" />
|
||||
<parameter name="胶片模拟" id="2292" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="混合" id="10001" flags="12884901888" default="1" value="1" />
|
||||
<parameter name="翻转" id="10002" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="输入点" id="10003" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="发布 OSC" id="10005" flags="4294967296" default="0" value="0" />
|
||||
<parameter name="发布 OSC" id="10005" flags="8589934592" default="0" value="1" />
|
||||
</filter>
|
||||
</scenenode>
|
||||
<aspectRatio>1</aspectRatio>
|
||||
|
||||
+10
-1
@@ -3,6 +3,7 @@
|
||||
from pathlib import Path
|
||||
import argparse
|
||||
import subprocess
|
||||
from build_masked_kernel import masked_kernel
|
||||
|
||||
|
||||
def main():
|
||||
@@ -17,13 +18,21 @@ def main():
|
||||
objects = []
|
||||
for name in ('DYGradeKernel', 'DYStatisticsKernel', 'DYLUTExportKernel', 'CSTKernel', 'BasisKernel'):
|
||||
target = work / (name + '.air')
|
||||
subprocess.run(['xcrun', 'metal-opt', str(root / 'tools/kernels' / (name + '.ll')),
|
||||
source = root / 'tools/kernels' / (name + '.ll')
|
||||
if name == 'DYGradeKernel':
|
||||
generated = work / 'DYGradeMasked.ll'
|
||||
generated.write_text(masked_kernel(source.read_text()))
|
||||
source = generated
|
||||
subprocess.run(['xcrun', 'metal-opt', str(source),
|
||||
'-o', str(target)], check=True)
|
||||
objects.append(str(target))
|
||||
wrapper = work / 'DYGradeWrapper.air'
|
||||
subprocess.run(['xcrun', '-sdk', 'macosx', 'metal', '-std=metal3.1',
|
||||
'-mmacosx-version-min=14.6', '-c',
|
||||
str(root / '大鱼调色/Plugin/DYGrade.metal'), '-o', str(wrapper)], check=True)
|
||||
tracking=work / 'DYTracking.air'
|
||||
subprocess.run(['xcrun','-sdk','macosx','metal','-std=metal3.1','-mmacosx-version-min=14.6','-c',str(root/'大鱼调色/Plugin/DYTracking.metal'),'-o',str(tracking)],check=True)
|
||||
objects.append(str(tracking))
|
||||
subprocess.run(['xcrun', '-sdk', 'macosx', 'metallib', str(wrapper), *objects,
|
||||
'-o', str(args.output)], check=True)
|
||||
print(args.output)
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
"""Add per-stage coverage to a separate entry; preserve the legacy AIR function.
|
||||
|
||||
Anchors are exact SSA values of the versioned source, not guessed byte offsets.
|
||||
No target runtime or installed reference binary is a build dependency.
|
||||
"""
|
||||
import re
|
||||
|
||||
def masked_kernel(source):
|
||||
original = re.search(r'define <4 x half> @dy_grade\(.*?\n\}', source, re.S).group()
|
||||
body = original.replace('@dy_grade(', '@dy_gradeMasked(', 1)
|
||||
args = ', '.join(f'float %dyWeight{i}' for i in range(12))
|
||||
body = body.replace(') local_unnamed_addr #0 {', ', '+args+') local_unnamed_addr #0 {', 1)
|
||||
# Each stage mixes against its actual input. Split basic adjustment has
|
||||
# two native locations; both use the same per-module coverage.
|
||||
stages = [(82,53,0),(83,82,8),(408,83,2),(409,408,6),
|
||||
(410,409,9),(411,410,11),(498,411,5),(519,498,7),
|
||||
(520,519,2),(521,520,10),(668,521,4),(669,668,3)]
|
||||
for value, before, section in stages:
|
||||
target = f'%v{value}'
|
||||
lines = body.splitlines()
|
||||
index = next(i for i,l in enumerate(lines) if l.startswith(' '+target+' = '))
|
||||
# Keep all PHIs first in a block, then insert the coverage operation.
|
||||
end = index+1
|
||||
while end<len(lines) and re.match(r' %\w+ = phi ',lines[end]): end+=1
|
||||
lines[index] = lines[index].replace(target+' = ',f'%dyRaw{value} = ',1)
|
||||
lines[end:end] = [
|
||||
f' %dyScalar{value} = insertelement <3 x float> undef, float %dyWeight{section}, i64 0',
|
||||
f' %dyVector{value} = shufflevector <3 x float> %dyScalar{value}, <3 x float> undef, <3 x i32> zeroinitializer',
|
||||
f' {target} = tail call <3 x float> @air.mix.v3f32(<3 x float> %v{before}, <3 x float> %dyRaw{value}, <3 x float> %dyVector{value}) #1']
|
||||
body='\n'.join(lines)
|
||||
# A second, explicitly ranged entry lets anchored extra tools interrupt the
|
||||
# existing native instruction order. The historical entry above is unchanged.
|
||||
segment = body.replace('@dy_gradeMasked(', '@dy_gradeSegment(', 1)
|
||||
segment = segment.replace(') local_unnamed_addr #0 {', ', i32 %dyStageFirst, i32 %dyStageLast, <3 x float> %dyExternalSkinReference, <3 x float> %dyOriginalReference) local_unnamed_addr #0 {', 1)
|
||||
for stage, (value, before, section) in enumerate(stages):
|
||||
target = f' %dyScalar{value} = insertelement <3 x float> undef, float %dyWeight{section}, i64 0'
|
||||
replacement = '\n'.join([
|
||||
f' %dyAtOrAfter{value} = icmp ule i32 %dyStageFirst, {stage}',
|
||||
f' %dyAtOrBefore{value} = icmp uge i32 %dyStageLast, {stage}',
|
||||
f' %dyStageActive{value} = and i1 %dyAtOrAfter{value}, %dyAtOrBefore{value}',
|
||||
f' %dyEffective{value} = select i1 %dyStageActive{value}, float %dyWeight{section}, float 0.000000e+00',
|
||||
target.replace(f'%dyWeight{section}', f'%dyEffective{value}')])
|
||||
assert target in segment
|
||||
segment = segment.replace(target, replacement, 1)
|
||||
skin_call = ' %dyRaw669 = tail call fast fastcc <3 x float> @_ZL19applySkinProtection'
|
||||
assert skin_call in segment
|
||||
segment = segment.replace(skin_call, ' %dyHasLocalSkinReference = icmp ule i32 %dyStageFirst, 5\n %dySkinReference = select i1 %dyHasLocalSkinReference, <3 x float> %v411, <3 x float> %dyExternalSkinReference\n'+skin_call, 1)
|
||||
segment = segment.replace('(<3 x float> %v668, <3 x float> %v411,', '(<3 x float> %v668, <3 x float> %dySkinReference,', 1)
|
||||
# Highlight/shadow spatial weighting uses the same original post-CST
|
||||
# reference as the historical fused function, not a later segment's input.
|
||||
original_luma = next(line for line in segment.splitlines() if line.startswith(' %v213 = '))
|
||||
assert '@air.dot.v3f32(<3 x float> %v53,' in original_luma
|
||||
segment = segment.replace(original_luma, original_luma.replace('<3 x float> %v53,', '<3 x float> %dyOriginalReference,'), 1)
|
||||
clamp = next(line for line in segment.splitlines() if line.startswith(' %v672 = '))
|
||||
segment = segment.replace(clamp, '\n'.join([
|
||||
clamp.replace('%v672 = ', '%dyClamped672 = ', 1),
|
||||
' %dyIncludesFinalFirst = icmp ule i32 %dyStageFirst, 11',
|
||||
' %dyIncludesFinalLast = icmp uge i32 %dyStageLast, 11',
|
||||
' %dyIncludesFinal = and i1 %dyIncludesFinalFirst, %dyIncludesFinalLast',
|
||||
' %v672 = select i1 %dyIncludesFinal, <3 x float> %dyClamped672, <3 x float> %v669']), 1)
|
||||
skin='''
|
||||
define <3 x float> @dy_skinExtra(<3 x float> %color, <3 x float> %reference, %struct.DYUniforms addrspace(2)* %uniforms) {
|
||||
entry:
|
||||
%result = call fastcc <3 x float> @_ZL19applySkinProtectionDv3_fS_RU11MTLconstantK17DYUniforms(<3 x float> %color, <3 x float> %reference, %struct.DYUniforms addrspace(2)* %uniforms)
|
||||
ret <3 x float> %result
|
||||
}
|
||||
'''
|
||||
return source+'\n'+body+'\n'+segment+'\n'+skin
|
||||
+10
-7
@@ -20,14 +20,14 @@ CONTENT_TAGS={'scenenode','layer','group','filter','behavior','mask'}
|
||||
def sha(data):return hashlib.sha256(data).hexdigest()
|
||||
|
||||
def model_identity():
|
||||
files=['大鱼调色/Plugin/DYModel.h','大鱼调色/Plugin/DYModel.mm','大鱼调色/Plugin/DYUniforms.h','大鱼调色/Plugin/DYColorManagement.h','大鱼调色/Plugin/DYCSTTypes.h','大鱼调色/Plugin/DYSpiderState.h','大鱼调色/Plugin/SpiderCore/DYColorMath.h','大鱼调色/Plugin/SpiderCore/DYSpiderMesh.hpp','template/tools/dump_model.mm']
|
||||
files=['大鱼调色/Plugin/DYModel.h','大鱼调色/Plugin/DYModel.mm','大鱼调色/Plugin/DYUniforms.h','大鱼调色/Plugin/DYColorManagement.h','大鱼调色/Plugin/DYCSTTypes.h','大鱼调色/Plugin/DYSpiderState.h','大鱼调色/Plugin/SpiderCore/DYColorMath.h','大鱼调色/Plugin/SpiderCore/DYSpiderMesh.hpp','template/tools/dump_model.mm','大鱼调色/Plugin/DYFilmTypes.h','大鱼调色/Plugin/DYFilmMath.h','大鱼调色/Plugin/DYToolState.h','大鱼调色/Plugin/DYToolState.mm','大鱼调色/Plugin/MaskCore/DYMaskOperator.h','大鱼调色/Plugin/MaskCore/DYMask.h']
|
||||
return {name:sha((ROOT/name).read_bytes()) for name in files}
|
||||
|
||||
def refresh_metadata():
|
||||
cache=Path('/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/template-model')
|
||||
cache.mkdir(parents=True,exist_ok=True)
|
||||
executable=cache/'dump_model'
|
||||
command=['xcrun','clang++','-std=c++17','-fno-objc-arc','-fblocks','-F','/Library/Developer/SDKs/FxPlug.sdk/Library/Frameworks','-F','/Library/Developer/Frameworks','-framework','Foundation','-framework','AppKit','-framework','FxPlug','-Wl,-rpath,/Library/Developer/Frameworks','-I',str(ROOT/'大鱼调色/Plugin'),str(TEMPLATE/'tools/dump_model.mm'),str(ROOT/'大鱼调色/Plugin/DYModel.mm'),'-o',str(executable)]
|
||||
command=['xcrun','clang++','-std=c++17','-fno-objc-arc','-fblocks','-F','/Library/Developer/SDKs/FxPlug.sdk/Library/Frameworks','-F','/Library/Developer/Frameworks','-framework','Foundation','-framework','AppKit','-framework','FxPlug','-framework','CoreMedia','-Wl,-rpath,/Library/Developer/Frameworks','-I',str(ROOT/'大鱼调色/Plugin'),str(TEMPLATE/'tools/dump_model.mm'),str(ROOT/'大鱼调色/Plugin/DYModel.mm'),str(ROOT/'大鱼调色/Plugin/DYToolState.mm'),'-o',str(executable)]
|
||||
subprocess.run(command,check=True)
|
||||
result=json.loads(subprocess.check_output([str(executable)],text=True))
|
||||
result['sourceSHA256']=model_identity()
|
||||
@@ -67,14 +67,14 @@ def build(model):
|
||||
insert_at=list(root).index(root.findall('factory')[-1])+1
|
||||
for uuid,fid in factory_ids.items():
|
||||
factory=copy.deepcopy(lookup[uuid]);factory.set('id',fid);root.insert(insert_at,factory);insert_at+=1
|
||||
filt=E.parse(SOURCES/'NativeFxPlugShell.xml').getroot()
|
||||
filt=E.parse(SOURCES/'NativeFxPlugShell.xml').getroot();filt.set('pluginVersion','0')
|
||||
# Keep the original native host mix/flip/input-point/OSC parameters, replace
|
||||
# the product's entire registered parameter set and custom archives.
|
||||
host=list(filt.findall('parameter'))
|
||||
for node in host:filt.remove(node)
|
||||
for pid,name in [('9000','大鱼调色'),('9001','LUT 文件')]:
|
||||
for pid,name in [('9000','大鱼调色'),('9001','LUT 文件'),('9002','工具与蒙版')]:
|
||||
text,class_name=custom_archive(model['archivesBase64'][pid])
|
||||
expected='DYInspectorToken' if pid=='9000' else 'DYAssetState'
|
||||
expected={'9000':'DYInspectorToken','9001':'DYAssetState','9002':'DYToolDocument'}[pid]
|
||||
if class_name!=expected:raise ValueError('Wrong custom parameter class')
|
||||
flags='12884901888' if pid=='9000' else '12889161776'
|
||||
param=E.SubElement(filt,'parameter',name=name,id=pid,flags=flags)
|
||||
@@ -83,7 +83,9 @@ def build(model):
|
||||
for row in model['parameters']:
|
||||
value=format(float(row['default']),'.17g')
|
||||
E.SubElement(filt,'parameter',name=row['title'],id=str(row['pid']),flags='12889161776' if row.get('notAnimatable') else '12889161760',default=value,value=value)
|
||||
for node in host:filt.append(node)
|
||||
for node in host:
|
||||
if node.get("id")=="10005":node.set("value","1");node.set("default","0");node.set("flags","8589934592")
|
||||
filt.append(node)
|
||||
source.append(filt)
|
||||
copyright=E.parse(SOURCES/'CopyrightRig.xml').getroot()
|
||||
entity_map={'3356608241':'10080','3356608243':'10081','3356608245':'10082'}
|
||||
@@ -118,6 +120,7 @@ def verify(data,model):
|
||||
assert len(filters)==1 and filters[0].get('pluginUUID')==PLUGIN_UUID
|
||||
f=filters[0];params={p.get('id'):p for p in f.findall('parameter')}
|
||||
assert len(params)==len(list(f.findall('parameter')))
|
||||
assert params["10005"].get("value")=="1" and params["10005"].get("flags")=="8589934592" and f.get("pluginVersion")=="0"
|
||||
for row in model['parameters']:
|
||||
p=params[str(row['pid'])];assert float(p.get('default'))==float(row['default'])==float(p.get('value'))
|
||||
assert all(not v in data for v in (b'CameraRawTables',b'1.png',b'relativeURL'))
|
||||
@@ -148,7 +151,7 @@ def verify(data,model):
|
||||
assert [entry.attrib for entry in menu.findall('entry')]==[{'name':title,'tag':'2'}]
|
||||
assert widget.findtext('affecting')=='2' and widget.findtext('snapshot')=='3'
|
||||
assert len({n.get('id') for n in scene.iter() if n.tag in CONTENT_TAGS})==len([n for n in scene.iter() if n.tag in CONTENT_TAGS])
|
||||
return {'passed':True,'sha256':sha(data),'version':root.get('version'),'displayversion':root.findtext('displayversion'),'filterCount':1,'nativeFloatParameters':len(model['parameters']),'customParameters':2,'publications':[dict(t.attrib) for t in pub],'effectSourceType':3,'externalMediaRequired':False,'placeholder':'native Drop Zone.tiff','animationObjects':0,'copyright':{'passed':True,'rig':'10080','author':'10081','site':'10082','unbound':True},'savedSelection':{'passed':True,'selectedContentCount':0,'currentObjectIsProject':True},'hostUIVerified':False,'hostRenderVerified':False}
|
||||
return {'passed':True,'sha256':sha(data),'version':root.get('version'),'displayversion':root.findtext('displayversion'),'filterCount':1,'nativeFloatParameters':len(model['parameters']),'customParameters':3,'publications':[dict(t.attrib) for t in pub],'effectSourceType':3,'externalMediaRequired':False,'placeholder':'native Drop Zone.tiff','animationObjects':0,'copyright':{'passed':True,'rig':'10080','author':'10081','site':'10082','unbound':True},'savedSelection':{'passed':True,'selectedContentCount':0,'currentObjectIsProject':True},'hostUIVerified':False,'hostRenderVerified':False}
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Isolated synthetic FCP acceptance; never edits a library or user media."""
|
||||
from pathlib import Path
|
||||
import json,uuid,xml.etree.ElementTree as E
|
||||
|
||||
root=Path(__file__).resolve().parent.parent
|
||||
qa=Path('/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa')
|
||||
model=json.loads((root/'template/sources/RegisteredParameters.json').read_text())
|
||||
by_key={p['key']:p for p in model['parameters']}
|
||||
movie=qa/'大鱼调色_蒙版合成运动.mov'
|
||||
chart=qa/'大鱼调色验收图.png'
|
||||
assert movie.is_file() and chart.is_file()
|
||||
xml=E.Element('fcpxml',version='1.12');resources=E.SubElement(xml,'resources')
|
||||
E.SubElement(resources,'format',id='f1',width='960',height='540',frameDuration='1/25s',colorSpace='1-1-1 (Rec. 709)')
|
||||
E.SubElement(resources,'format',id='f2',width='1920',height='1080',frameDuration='1/25s',colorSpace='1-1-1 (Rec. 709)')
|
||||
E.SubElement(resources,'format',id='f3',width='1920',height='1080',name='FFVideoFormatRateUndefined')
|
||||
for ident,path,fmt,duration in [('a1',movie,'f1','4s'),('a2',chart,'f3','0s')]:
|
||||
asset=E.SubElement(resources,'asset',id=ident,name=path.stem,start='0s',duration=duration,format=fmt,hasVideo='1',videoSources='1')
|
||||
E.SubElement(asset,'media-rep',kind='original-media',src=path.resolve().as_uri())
|
||||
template=Path('/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef')
|
||||
E.SubElement(resources,'effect',id='fx',name='大鱼调色',uid='~/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef',src=template.as_uri())
|
||||
event=E.SubElement(E.SubElement(xml,'library'),'event',name='大鱼调色_1.5_胶片与通道验收',uid=str(uuid.uuid4()).upper())
|
||||
settings=[('大鱼调色_1.5_胶片与混合器','a1','f1',dict(mixer01=.2,filmSubtractive=1,filmGammaCyan=1.2,filmHalation=1,filmScatter=5,filmBloom=1,filmSensitivity=25,filmDiffusion=5,filmIntensity=25,filmGrain=1,filmGrainAmount=.25,filmGrainHold=2,filmVignette=1,filmVignetteIntensity=.5,filmVignetteRadius=30)),('大鱼调色_1.5_初始化与叠层','a1','f1',{}),('大鱼调色_1.5_颗粒时间验收','a2','f2',dict(filmGrain=1,filmGrainAmount=.65,filmGrainHold=2))]
|
||||
for name,asset,fmt,values in settings:
|
||||
project=E.SubElement(event,'project',name=name,uid=str(uuid.uuid4()).upper())
|
||||
sequence=E.SubElement(project,'sequence',format=fmt,duration='4s',tcStart='0s',tcFormat='NDF',audioLayout='stereo',audioRate='48k')
|
||||
spine=E.SubElement(sequence,'spine');clip=E.SubElement(spine,'video' if asset=='a2' else 'asset-clip',ref=asset,name=name,offset='0s',start='0s',duration='4s')
|
||||
effect=E.SubElement(clip,'filter-video',ref='fx',name='大鱼调色',enabled='1')
|
||||
# Hidden FxPlug IDs are not invented as Motion/FCPXML parameter paths.
|
||||
# Apply the intended settings through the formal native inspector in host QA.
|
||||
E.indent(xml);output=qa/'film-mixer-1.5.fcpxml'
|
||||
output.write_text('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE fcpxml>\n'+E.tostring(xml,encoding='unicode')+'\n')
|
||||
print(output)
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Synthetic, isolated mask/layer acceptance projects; no user media writes."""
|
||||
from pathlib import Path
|
||||
import subprocess,xml.etree.ElementTree as E
|
||||
out=Path('/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa');out.mkdir(parents=True,exist_ok=True)
|
||||
media=out/'大鱼调色_蒙版合成运动.mov'
|
||||
if not media.exists():
|
||||
subprocess.run(['/opt/homebrew/bin/ffmpeg','-v','error','-f','lavfi','-i',"nullsrc=s=1080x640:r=25:d=4,geq=lum='128+70*sin(X/11)*cos(Y/9)+35*sin((X+Y)/4)':cb='128+35*sin(X/17)':cr='128+35*cos(Y/21)',crop=960:540:'40+10*t':'40+5*t'",'-c:v','prores_ks','-profile:v','2','-pix_fmt','yuv422p10le','-color_primaries','bt709','-color_trc','bt709','-colorspace','bt709',str(media)],check=True)
|
||||
root=E.Element('fcpxml',version='1.12');res=E.SubElement(root,'resources');E.SubElement(res,'format',id='f1',width='960',height='540',frameDuration='1/25s',colorSpace='1-1-1 (Rec. 709)');a=E.SubElement(res,'asset',id='a1',name='合成运动纹理',start='0s',duration='4s',format='f1',hasVideo='1',videoSources='1');E.SubElement(a,'media-rep',kind='original-media',src=media.as_uri());template=Path('/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef');E.SubElement(res,'effect',id='fx',name='大鱼调色',uid='~/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef',src=template.as_uri());lib=E.SubElement(root,'library');event=E.SubElement(lib,'event',name='大鱼调色_1.4.1_26_蒙版与工具层验收')
|
||||
for name in ['大鱼调色_1.4.1_26_独立工具与蒙版','大鱼调色_1.4.1_26_逐帧跟踪']:
|
||||
project=E.SubElement(event,'project',name=name);seq=E.SubElement(project,'sequence',format='f1',tcStart='0s',tcFormat='NDF',audioLayout='stereo',audioRate='48k',duration='4s');spine=E.SubElement(seq,'spine');clip=E.SubElement(spine,'asset-clip',ref='a1',name=name,offset='0s',start='0s',duration='4s');E.SubElement(clip,'filter-video',ref='fx',name='大鱼调色',enabled='1')
|
||||
E.indent(root);xml=out/'大鱼调色_1.4.1_26_蒙版与工具层.fcpxml';xml.write_text('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE fcpxml>\n'+E.tostring(root,encoding='unicode')+'\n');print(xml)
|
||||
+19
-4
@@ -29,6 +29,16 @@ def identity(path,expected):
|
||||
def unregister(path):
|
||||
reg=run('pluginkit','-m','-A','-D','-v','-i','com.dayu.color.XPC')
|
||||
if any(l.rstrip().endswith('\t'+str(path)) for l in reg.splitlines()):run('pluginkit','-r',str(path))
|
||||
def self_test(executable,report):
|
||||
result=subprocess.run([str(executable),'--self-test'],cwd=ROOT,text=True,capture_output=True)
|
||||
report.write_text(result.stdout)
|
||||
report.with_suffix('.stderr').write_text(result.stderr)
|
||||
try:parsed=json.loads(result.stdout)
|
||||
except json.JSONDecodeError:raise RuntimeError('原生自检未返回有效结果,诊断已保留:'+str(report))
|
||||
if result.returncode or not parsed.get('pass'):
|
||||
failed=[x.get('name') for x in parsed.get('results',[]) if not x.get('pass',True)]
|
||||
raise RuntimeError('原生自检未通过,正式旧版未替换。诊断:'+str(report)+';失败项:'+str(failed))
|
||||
return parsed
|
||||
def main():
|
||||
hosts_closed();CACHE.mkdir(parents=True,exist_ok=True);LOCK.parent.mkdir(parents=True,exist_ok=True);LOCK.mkdir()
|
||||
(LOCK/'owner.json').write_text(json.dumps(dict(PID=os.getpid(),cwd=str(ROOT),product='大鱼调色',started=datetime.datetime.now(datetime.timezone.utc).isoformat())))
|
||||
@@ -49,7 +59,7 @@ def main():
|
||||
run('codesign','--verify','--deep','--strict',str(APP))
|
||||
details=run('codesign','-dvvv',str(APP))
|
||||
if 'TeamIdentifier=B3W25FX5H5' not in details or 'Timestamp=' not in details or 'runtime' not in details:raise RuntimeError('签名身份/时间戳/runtime未通过')
|
||||
preflight=json.loads(run(str(plugin/'Contents/MacOS/大鱼调色 XPC Service'),'--self-test'))
|
||||
preflight=self_test(plugin/'Contents/MacOS/大鱼调色 XPC Service',CACHE/'release-preflight.json')
|
||||
(CACHE/'release-preflight.json').write_text(json.dumps(preflight,ensure_ascii=False,indent=2)+'\n')
|
||||
if not preflight.get('pass'):raise RuntimeError('Release集成自检失败,正式旧版未替换')
|
||||
archive=CACHE/'notarization-submission.zip'
|
||||
@@ -66,7 +76,7 @@ def main():
|
||||
os.replace(stage,DEST);stage=None
|
||||
try:
|
||||
identity(DEST,'com.dayu.color');run('codesign','--verify','--deep','--strict',str(DEST));run('xcrun','stapler','validate',str(DEST));gate=run('spctl','--assess','--type','execute','--verbose=2',str(DEST))
|
||||
installedTest=json.loads(run(str(DEST/PLUGIN/'Contents/MacOS/大鱼调色 XPC Service'),'--self-test'))
|
||||
installedTest=self_test(DEST/PLUGIN/'Contents/MacOS/大鱼调色 XPC Service',CACHE/'installed-self-test.json')
|
||||
if not installedTest.get('pass'):raise RuntimeError('正式安装版原生集成自检失败')
|
||||
(ROOT/'verification/InstalledSelfTest.json').write_text(json.dumps(installedTest,ensure_ascii=False,indent=2)+'\n')
|
||||
run('open',str(DEST))
|
||||
@@ -92,8 +102,13 @@ def main():
|
||||
if old:unregister(old/PLUGIN)
|
||||
archive.unlink();backup=CACHE/'previous-template.moef'
|
||||
if backup.exists():backup.unlink()
|
||||
run('pluginkit','-a',str(DEST/PLUGIN));registry=run('pluginkit','-m','-A','-D','-v','-i','com.dayu.color.XPC')
|
||||
entries=[l for l in registry.splitlines() if 'com.dayu.color.XPC(' in l]
|
||||
# Unregistering an old copy can race the host's launch registration. Re-add
|
||||
# only the verified installed path; never repeat signing/notarization/install.
|
||||
for attempt in range(3):
|
||||
run('pluginkit','-a',str(DEST/PLUGIN));registry=run('pluginkit','-m','-A','-D','-v','-i','com.dayu.color.XPC')
|
||||
entries=[l for l in registry.splitlines() if 'com.dayu.color.XPC(' in l]
|
||||
if entries:break
|
||||
time.sleep(.5)
|
||||
if len(entries)!=1 or not entries[0].rstrip().endswith('\t'+str(DEST/PLUGIN)):raise RuntimeError('PluginKit发现多份/错误版本: '+registry)
|
||||
record=dict(status='installed-awaiting-host-verification',path=str(DEST),bundleID='com.dayu.color',version=plistlib.loads((DEST/'Contents/Info.plist').read_bytes())['CFBundleShortVersionString'],build=plistlib.loads((DEST/'Contents/Info.plist').read_bytes())['CFBundleVersion'],team='B3W25FX5H5',notaryID=result['id'],notaryStatus=result['status'],gatekeeper=gate,sourceCommit=run('git','rev-parse','HEAD'),templatePath=str(TEMPLATE),templateSHA256=hashlib.sha256(TEMPLATE.read_bytes()).hexdigest(),shaderSHA256=hashlib.sha256((DEST/PLUGIN/'Contents/Resources/default.metallib').read_bytes()).hexdigest())
|
||||
if old:record['previousInstallBackup']=str(old)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// Read-only research probe. Loads only the user's installed reference framework.
|
||||
// No reference binary, texture, preset or disassembly is bundled with Dayu.
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreImage/CoreImage.h>
|
||||
#import <objc/runtime.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
int main(int argc,const char **argv){@autoreleasepool{
|
||||
NSString *path=@"/Applications/ColorFinale.app/Contents/PlugIns/ColorFinale.pluginkit/Contents/Frameworks/RenderingEngine.framework/Versions/A/RenderingEngine";
|
||||
void *handle=dlopen(path.fileSystemRepresentation,RTLD_NOW|RTLD_LOCAL);
|
||||
if(!handle){fprintf(stderr,"%s\n",dlerror());return 1;}
|
||||
NSMutableDictionary *out=[NSMutableDictionary dictionary];
|
||||
for(NSString *name in @[@"FTChannelMixerFilter",@"FTFilmSaturationFilter",@"FTHalationFilter",@"FTBloomFilter",@"FTGrainFilter",@"FTGrainProcessor",@"FTNoiseGeneratorSimple"]){
|
||||
Class cls=NSClassFromString(name);NSMutableDictionary *entry=[NSMutableDictionary dictionary];
|
||||
for(int meta=0;meta<2;meta++){
|
||||
unsigned count=0;Method *methods=class_copyMethodList(meta?object_getClass(cls):cls,&count);NSMutableArray *list=[NSMutableArray array];
|
||||
for(unsigned i=0;i<count;i++)[list addObject:@{@"selector":NSStringFromSelector(method_getName(methods[i])),@"encoding":@(method_getTypeEncoding(methods[i]))}];free(methods);entry[meta?@"class":@"instance"]=list;
|
||||
}
|
||||
if([cls isSubclassOfClass:CIFilter.class]){@try{CIFilter *filter=[[cls alloc]init];[filter setDefaults];entry[@"attributes"]=filter.attributes?:@{};entry[@"inputKeys"]=filter.inputKeys?:@[];
|
||||
NSMutableDictionary *values=[NSMutableDictionary dictionary];
|
||||
for(NSString *key in @[@"gammaAll",@"gammaCyan",@"gammaMagenta",@"gammaYellow",@"density",@"densitySwitch",@"valueSwitch",@"scatter",@"dyeTransmission",@"boost",@"sensitivity",@"blurRadius",@"intensity",@"grainSize",@"filmResponse",@"correlation",@"stdRed",@"stdGreen",@"stdBlue",@"seed"]){@try{id value=[filter valueForKey:key];if([value isKindOfClass:NSNumber.class])values[key]=value;}@catch(NSException *e){}}
|
||||
for(NSString *key in @[@"colorKernel",@"genericKernel"]){@try{id value=[filter valueForKey:key];if(value)values[key]=[value name]?:@"";}@catch(NSException *e){}}
|
||||
entry[@"defaults"]=values;
|
||||
}@catch(NSException *e){entry[@"exception"]=e.reason;}}
|
||||
if([name isEqual:@"FTNoiseGeneratorSimple"]){id object=[[cls alloc]init];entry[@"defaults"]=@{@"radius":[object valueForKey:@"radius"],@"blurSize":[object valueForKey:@"blurSize"]};}
|
||||
out[name]=entry;
|
||||
}
|
||||
NSData *json=[NSJSONSerialization dataWithJSONObject:out options:NSJSONWritingPrettyPrinted|NSJSONWritingSortedKeys error:nil];
|
||||
if(!json)return 2;fwrite(json.bytes,1,json.length,stdout);fputc('\n',stdout);return 0;
|
||||
}}
|
||||
@@ -0,0 +1,68 @@
|
||||
// Executes the user's installed Color Finale only as a read-only test oracle.
|
||||
// Product builds and product rendering never load these reference frameworks.
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreImage/CoreImage.h>
|
||||
#import <Metal/Metal.h>
|
||||
#import <MetalPerformanceShaders/MetalPerformanceShaders.h>
|
||||
#include <dlfcn.h>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
#include "../大鱼调色/Plugin/DYFilmMath.h"
|
||||
using Floats=std::vector<float>;
|
||||
static id<MTLDevice> gpu;
|
||||
static id<MTLCommandQueue> queue;
|
||||
static CIContext *context;
|
||||
static unsigned W=64,H=48;
|
||||
static void require(bool p,NSString *m){if(!p)@throw [NSException exceptionWithName:@"FilmReference" reason:m userInfo:nil];}
|
||||
static float encode(float v){return v<=.0031308f?v*12.92f:1.055f*powf(fmaxf(0,v),1/2.4f)-.055f;}
|
||||
static float decode(float v){return v<=.04045f?v/12.92f:powf(fmaxf(0,(v+.055f)/1.055f),2.4f);}
|
||||
static id<MTLTexture> texture(const Floats& data={}){MTLTextureDescriptor *d=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA32Float width:W height:H mipmapped:NO];d.storageMode=MTLStorageModeShared;d.usage=MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite|MTLTextureUsageRenderTarget;id<MTLTexture>t=[gpu newTextureWithDescriptor:d];require(t!=nil,@"texture allocation");if(!data.empty())[t replaceRegion:MTLRegionMake2D(0,0,W,H) mipmapLevel:0 withBytes:data.data() bytesPerRow:W*16];return t;}
|
||||
static Floats read(id<MTLTexture> t){Floats v(W*H*4);[t getBytes:v.data() bytesPerRow:W*16 fromRegion:MTLRegionMake2D(0,0,W,H) mipmapLevel:0];return v;}
|
||||
static void finish(id<MTLCommandBuffer> c){[c commit];[c waitUntilCompleted];require(c.status==MTLCommandBufferStatusCompleted,c.error.description?:@"GPU command");}
|
||||
static CIImage *image(id<MTLTexture> t){return [CIImage imageWithMTLTexture:t options:@{kCIImageColorSpace:NSNull.null}];}
|
||||
static Floats render(CIImage *ci){require(ci!=nil,@"reference output image");Floats v(W*H*4);[context render:ci toBitmap:v.data() rowBytes:W*16 bounds:CGRectMake(0,0,W,H) format:kCIFormatRGBAf colorSpace:nil];Floats top(v.size());for(unsigned y=0;y<H;y++)memcpy(top.data()+y*W*4,v.data()+(H-1-y)*W*4,W*16);return top;}
|
||||
static id<MTLComputePipelineState> pipeline(id<MTLLibrary> library,NSString *name){NSError *error=nil;id<MTLFunction> f=[library newFunctionWithName:name];require(f!=nil,name);id<MTLComputePipelineState>p=[gpu newComputePipelineStateWithFunction:f error:&error];require(p!=nil,error.description);return p;}
|
||||
static void dispatch(id<MTLComputeCommandEncoder> e){[e dispatchThreads:MTLSizeMake(W,H,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[e endEncoding];}
|
||||
static Floats point(id<MTLLibrary> library,id<MTLTexture> src,id<MTLTexture> aux,DYUniforms u,int operation){id<MTLTexture>out=texture();id<MTLCommandBuffer>c=[queue commandBuffer];id<MTLComputeCommandEncoder>e=[c computeCommandEncoder];[e setComputePipelineState:pipeline(library,@"dyFilmPoint")];[e setTexture:src atIndex:0];[e setTexture:aux?:src atIndex:1];[e setTexture:out atIndex:2];[e setBytes:&u length:sizeof(u) atIndex:0];struct {int operation;float radius;unsigned frame,reserved;}p={operation,0,u.filmFrameKey,0};[e setBytes:&p length:sizeof(p) atIndex:1];dispatch(e);finish(c);return read(out);}
|
||||
static NSDictionary *difference(const Floats&a,const Floats&b){double maximum=0,sum=0;unsigned count=0,nonfinite=0,different=0;for(size_t i=0;i<a.size();i++){if(i%4==3)continue;if(a[(i/4)*4+3]<=0)continue;double d=fabs(a[i]-b[i]);if(!std::isfinite(d))nonfinite++;else{maximum=fmax(maximum,d);sum+=d*d;count++;if(d>1e-5)different++;}}return @{@"maximum":@(maximum),@"rms":@(sqrt(sum/fmax(1,count))),@"nonfinite":@(nonfinite),@"different":@(different)};}
|
||||
int main(int argc,const char **argv){@autoreleasepool{@try{
|
||||
require(argc==2||argc==4,@"Usage: verify_film_reference /absolute/path/default.metallib [width height]");if(argc==4){W=atoi(argv[2]);H=atoi(argv[3]);require(W>0&&H>0&&W<=4096&&H<=4096,@"bounded reference dimensions");}gpu=MTLCreateSystemDefaultDevice();queue=[gpu newCommandQueue];context=[CIContext contextWithMTLDevice:gpu options:@{kCIContextWorkingColorSpace:NSNull.null,kCIContextOutputColorSpace:NSNull.null}];NSError *error=nil;
|
||||
id<MTLLibrary> dayu=[gpu newLibraryWithURL:[NSURL fileURLWithPath:@(argv[1])] error:&error];require(dayu!=nil,error.description);
|
||||
NSString *framework=@"/Applications/ColorFinale.app/Contents/PlugIns/ColorFinale.pluginkit/Contents/Frameworks/RenderingEngine.framework/Versions/A";
|
||||
require(dlopen([[framework stringByAppendingPathComponent:@"RenderingEngine"]fileSystemRepresentation],RTLD_NOW|RTLD_LOCAL)!=nullptr,@"load installed reference framework");
|
||||
id<MTLLibrary> original=[gpu newLibraryWithURL:[NSURL fileURLWithPath:[framework stringByAppendingPathComponent:@"Resources/metal_kernels.metallib"]] error:&error];require(original!=nil,error.description);
|
||||
Floats linear(W*H*4),encoded(linear.size());for(unsigned y=0;y<H;y++)for(unsigned x=0;x<W;x++){unsigned i=(y*W+x)*4;float a=(x%11==0&&W>1)?0:(x%3==0?.25f:1);for(int k=0;k<3;k++){float c=float((x*17+y*23+k*71)%257)/256;if(x%17==0)c=k==0?1.3f:k==1?-.02f:c;linear[i+k]=float((__fp16)(decode(c)*a));encoded[i+k]=encode(a>0?linear[i+k]/a:0)*a;}linear[i+3]=encoded[i+3]=a;}
|
||||
id<MTLTexture>source=texture(linear),codes=texture(encoded);Floats probe=render(image(source));require([difference(linear,probe)[@"maximum"]doubleValue]==0,@"CI bitmap orientation control");id<MTLTexture>roundtrip=texture();id<MTLCommandBuffer>roundtripCommands=[queue commandBuffer];[context render:image(source) toMTLTexture:roundtrip commandBuffer:roundtripCommands bounds:CGRectMake(0,0,W,H) colorSpace:nil];finish(roundtripCommands);require([difference(linear,read(roundtrip))[@"maximum"]doubleValue]==0,@"CI texture orientation control");NSMutableArray *rows=[NSMutableArray array];bool passed=true;
|
||||
auto check=[&](NSString*name,const Floats&a,const Floats&b,double tolerance){NSDictionary *d=difference(a,b);BOOL ok=[d[@"nonfinite"]intValue]==0&&[d[@"maximum"]doubleValue]<tolerance;NSMutableDictionary *r=[d mutableCopy];r[@"name"]=name;r[@"pass"]=@(ok);r[@"tolerance"]=@(tolerance);[rows addObject:r];passed&=ok;};
|
||||
DYUniforms u={};u.mixerMix=1;u.mixerRed=(DYFloat4){.75,.3,-.05,0};u.mixerGreen=(DYFloat4){.15,.85,0,0};u.mixerBlue=(DYFloat4){.05,-.1,1.05,0};u.film.gammaAll=u.film.gammaCyan=u.film.gammaMagenta=u.film.gammaYellow=1;u.film.valueMode=6;
|
||||
for(int matrixCase=0;matrixCase<3;matrixCase++){
|
||||
if(matrixCase==1)u.mixerRed=u.mixerGreen=u.mixerBlue=(DYFloat4){0,0,0,0};
|
||||
if(matrixCase==2)u.mixerRed=u.mixerGreen=u.mixerBlue=(DYFloat4){1.f/3,1.f/3,1.f/3,0};
|
||||
for(int options=0;options<4;options++){
|
||||
u.mixerPreserveLuma=options&1;u.mixerPreserveSaturation=(options>>1)&1;CIFilter *f=[[NSClassFromString(@"FTChannelMixerFilter")alloc]init];[f setDefaults];[f setValue:image(codes) forKey:kCIInputImageKey];[f setValue:[CIVector vectorWithX:u.mixerRed.x Y:u.mixerRed.y Z:u.mixerRed.z]forKey:@"inputRVector"];[f setValue:[CIVector vectorWithX:u.mixerGreen.x Y:u.mixerGreen.y Z:u.mixerGreen.z]forKey:@"inputGVector"];[f setValue:[CIVector vectorWithX:u.mixerBlue.x Y:u.mixerBlue.y Z:u.mixerBlue.z]forKey:@"inputBVector"];[f setValue:@(u.mixerPreserveLuma>0) forKey:@"inputPreserveLuma"];[f setValue:@(u.mixerPreserveSaturation>0)forKey:@"inputPreserveSaturation"];
|
||||
Floats expected=render(f.outputImage);for(size_t i=0;i<expected.size()/4;i++)for(int k=0;k<3;k++){float a=expected[i*4+3];expected[i*4+k]=a>0?decode(expected[i*4+k]/a)*a:0;}check([NSString stringWithFormat:@"original-mixer-case-%d-options-%d",matrixCase,options],expected,point(dayu,source,nil,u,0),.00015);
|
||||
}
|
||||
}
|
||||
for(int mode=1;mode<=2;mode++)for(float density:{-.4f,0.f,.65f})for(float gamma:{.75f,1.3f}){
|
||||
u.film.densityMode=mode;u.film.density=density;u.film.gammaAll=gamma;u.film.gammaCyan=1.2;u.film.gammaMagenta=.9;u.film.gammaYellow=1.1;CIFilter *f=[[NSClassFromString(@"FTFilmSaturationFilter")alloc]init];[f setDefaults];[f setValue:image(codes)forKey:kCIInputImageKey];[f setValue:@(gamma)forKey:@"gammaAll"];[f setValue:@1.2 forKey:@"gammaCyan"];[f setValue:@.9 forKey:@"gammaMagenta"];[f setValue:@1.1 forKey:@"gammaYellow"];[f setValue:@(density)forKey:@"density"];[f setValue:@(mode)forKey:@"densitySwitch"];
|
||||
Floats expected=render(f.outputImage);for(size_t i=0;i<expected.size()/4;i++)for(int k=0;k<3;k++){float a=expected[i*4+3];expected[i*4+k]=a>0?decode(expected[i*4+k]/a)*a:0;}check([NSString stringWithFormat:@"original-subtractive-%d-%.2f-%.2f",mode,density,gamma],expected,point(dayu,source,nil,u,1),.00012);
|
||||
}
|
||||
for(float scatter:{1.f,5.f,20.f}){
|
||||
u.film.scatter=scatter;u.film.boost=1.7;u.film.dyeTransmission=70;CIFilter *f=[[NSClassFromString(@"FTHalationFilter")alloc]init];[f setDefaults];[f setValue:image(source)forKey:kCIInputImageKey];[f setValue:@(scatter)forKey:@"scatter"];[f setValue:@1.7 forKey:@"boost"];[f setValue:@(70.f/500)forKey:@"dyeTransmission"];
|
||||
CIImage *blur=[[[image(source)imageByClampingToExtent]imageByApplyingFilter:@"CIGaussianBlur" withInputParameters:@{kCIInputRadiusKey:@(scatter)}]imageByCroppingToRect:CGRectMake(0,0,W,H)];id<MTLTexture>aux=texture(render(blur));check([NSString stringWithFormat:@"original-halation-radius-%.0f",scatter],render(f.outputImage),point(dayu,source,aux,u,2),.00012);
|
||||
}
|
||||
for(float sensitivity:{20.f,50.f,80.f}){
|
||||
DYFilmSettings settings={};settings.sensitivity=sensitivity;settings.intensity=70;
|
||||
CIFilter *filter=[[NSClassFromString(@"FTBloomFilter")alloc]init];[filter setValue:image(source)forKey:kCIInputImageKey];[filter setValue:@2.5 forKey:@"blurRadius"];[filter setValue:@(sensitivity/100)forKey:@"sensitivity"];[filter setValue:@.7 forKey:@"intensity"];
|
||||
id<MTLTexture>horizontal=texture(),vertical=texture(),edges=texture();id<MTLCommandBuffer>commands=[queue commandBuffer];
|
||||
for(int direction=0;direction<2;direction++){id<MTLComputeCommandEncoder>e=[commands computeCommandEncoder];[e setComputePipelineState:pipeline(dayu,@"dyFilmSparseBlur")];[e setTexture:direction?horizontal:source atIndex:0];[e setTexture:direction?vertical:horizontal atIndex:1];[e setBytes:&direction length:4 atIndex:0];dispatch(e);}
|
||||
id<MTLComputeCommandEncoder>e=[commands computeCommandEncoder];[e setComputePipelineState:pipeline(dayu,@"dyFilmBloomEdges")];[e setTexture:vertical atIndex:0];[e setTexture:source atIndex:1];[e setTexture:edges atIndex:2];[e setBytes:&settings length:sizeof(settings) atIndex:0];dispatch(e);finish(commands);
|
||||
Floats actual=read(edges),expected=render(filter.outputImage);unsigned inside=0,border=0;for(unsigned y=0;y<H;y++)for(unsigned x=0;x<W;x++)if(expected[(y*W+x)*4+3]>0&&fabs(actual[(y*W+x)*4]-expected[(y*W+x)*4])>.01){if(x>=8&&x<W-8&&y>=8&&y<H-8)inside++;else border++;}fprintf(stderr,"bloom %.0f mismatches interior=%u border=%u\n",sensitivity,inside,border);check([NSString stringWithFormat:@"original-bloom-edge-sensitivity-%.0f",sensitivity],expected,actual,.00001);
|
||||
}
|
||||
for(unsigned seed:{0u,1u,7919u,0xffffffffu}){
|
||||
auto noise=[&](id<MTLLibrary>lib,NSString *name){id<MTLTexture>out=texture();id<MTLCommandBuffer>c=[queue commandBuffer];id<MTLComputeCommandEncoder>e=[c computeCommandEncoder];[e setComputePipelineState:pipeline(lib,name)];[e setTexture:out atIndex:0];[e setBytes:&seed length:4 atIndex:0];if([name isEqual:@"dyFilmNoise"]){unsigned bottom=0;[e setBytes:&bottom length:4 atIndex:1];}dispatch(e);finish(c);return out;};
|
||||
id<MTLTexture>ref=noise(original,@"BoxMullerPCG"),ours=noise(dayu,@"dyFilmNoise");check([NSString stringWithFormat:@"original-pcg-box-muller-%u",seed],read(ref),read(ours),.00002);
|
||||
for(float color:{0.f,.35f,1.f}){u.film.grainAmount=.5;u.film.grainSize=1;u.film.grainResponse=.4;u.film.grainColor=color;float corr=1-2*color,other=1-corr,norm=sqrtf(corr*corr+other*other);float params[9]={.4f,.6f,corr/norm,other/norm,corr/norm,other/norm,.025f,.025f,.025f};id<MTLTexture>referenceOutput=texture();id<MTLCommandBuffer>commands=[queue commandBuffer];id<MTLComputeCommandEncoder>encoder=[commands computeCommandEncoder];[encoder setComputePipelineState:pipeline(original,@"GrainFilter")];[encoder setTexture:codes atIndex:0];[encoder setTexture:ref atIndex:1];[encoder setTexture:referenceOutput atIndex:2];[encoder setBytes:params length:sizeof(params) atIndex:0];dispatch(encoder);finish(commands);Floats expected=read(referenceOutput);for(size_t i=0;i<expected.size()/4;i++)for(int k=0;k<3;k++){float a=expected[i*4+3];expected[i*4+k]=a>0?decode(expected[i*4+k]/a)*a:0;}check([NSString stringWithFormat:@"original-grain-%u-%.2f",seed,color],expected,point(dayu,source,ours,u,4),.0002);}
|
||||
}
|
||||
NSDictionary *result=@{@"pass":@(passed),@"checks":@(rows.count),@"width":@(W),@"height":@(H),@"gpu":gpu.name,@"referenceVersion":@"ColorFinale 2.16.2 (625)",@"scope":@"Independent installed-reference CI/Metal output versus authored production Metal point kernels; source grayscale/color/HDR/negative and fractional-alpha vectors; reference frame seed is explicit.",@"results":rows};NSData *json=[NSJSONSerialization dataWithJSONObject:result options:NSJSONWritingPrettyPrinted|NSJSONWritingSortedKeys error:nil];fwrite(json.bytes,1,json.length,stdout);puts("");return passed?0:1;
|
||||
}@catch(NSException *e){fprintf(stderr,"%s\n",e.reason.UTF8String);return 2;}}}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Read-only tracker probe for caller-decoded top-first gray8 frames.
|
||||
// Media remains outside the repository. This is independent of host scheduling.
|
||||
#import <Foundation/Foundation.h>
|
||||
#include "../大鱼调色/Plugin/MaskCore/DYTracker.hpp"
|
||||
#include "../大鱼调色/Plugin/DYToolFlow.inc.h"
|
||||
#include <fstream>
|
||||
#include <chrono>
|
||||
|
||||
class MeasuredFlow final : public dy::FlowBackend {
|
||||
std::shared_ptr<dy::FlowBackend> base_;
|
||||
public:
|
||||
size_t matches=0;
|
||||
explicit MeasuredFlow(std::shared_ptr<dy::FlowBackend> base):base_(std::move(base)){}
|
||||
bool reset(const dy::GrayFrame& f) override {matches=0;return base_->reset(f);}
|
||||
bool advance(const dy::GrayFrame& f,const std::vector<dy::FlowPoint>& p,
|
||||
std::vector<dy::FlowMatch>& out) override {
|
||||
bool ok=base_->advance(f,p,out);matches=out.size();return ok;
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc,const char*argv[]) {@autoreleasepool {
|
||||
if(argc!=14){fprintf(stderr,"gray8 width height start end step metallib|- cx cy width height angle output.json\n");return 2;}
|
||||
const int width=atoi(argv[2]),height=atoi(argv[3]),start=atoi(argv[4]),end=atoi(argv[5]),step=atoi(argv[6]);
|
||||
if(width<16||height<16||start<0||end<0||(step!=1&&step!=-1)||(end-start)*step<0)return 2;
|
||||
dy::TrackerROI roi{float(atof(argv[8])),float(atof(argv[9])),float(atof(argv[10])),float(atof(argv[11])),float(atof(argv[12]))};
|
||||
std::ifstream input(argv[1],std::ios::binary);if(!input)return 2;
|
||||
auto read=[&](int index){
|
||||
std::vector<uint8_t> bytes(size_t(width)*height);
|
||||
input.clear();input.seekg(std::streamoff(index)*bytes.size());input.read((char*)bytes.data(),bytes.size());
|
||||
if(input.gcount()!=std::streamsize(bytes.size()))return dy::GrayFrame{};
|
||||
dy::GrayFrame f{width,height,std::vector<float>(bytes.size())};
|
||||
for(size_t i=0;i<bytes.size();++i)f.pixels[i]=bytes[i]/255.f;
|
||||
return f;
|
||||
};
|
||||
dy::Tracker tracker;std::shared_ptr<MeasuredFlow> measured;
|
||||
bool metal=strcmp(argv[7],"-")!=0;
|
||||
if(metal){NSError *error=nil;auto backend=DYToolCreateMetalFlow([NSURL fileURLWithPath:[NSString stringWithUTF8String:argv[7]]],&error);if(!backend){fprintf(stderr,"%s\n",error.localizedDescription.UTF8String);return 2;}measured=std::make_shared<MeasuredFlow>(backend);tracker.setBackend(measured);}
|
||||
tracker.setMask({{-.5f,-.5f},{.5f,-.5f},{.5f,.5f},{-.5f,.5f}});
|
||||
NSMutableArray *frames=[NSMutableArray array];bool complete=true;
|
||||
auto beginning=std::chrono::steady_clock::now();
|
||||
for(int index=start;(end-index)*step>=0;index+=step){
|
||||
auto frame=read(index);if(!frame.valid())return 2;
|
||||
bool valid=index==start?tracker.reset(frame,roi):tracker.track(frame).valid;
|
||||
auto r=tracker.result();
|
||||
[frames addObject:@{@"frame":@(index),@"valid":@(valid),@"features":@(r.features),@"flowMatches":@(r.matches),@"inliers":@(r.inliers),@"confidence":@(r.confidence),@"medianResidualPixels":@(r.medianError),@"failure":@((int)r.failure),@"centerX":@(r.cx),@"centerY":@(r.cy),@"scaleX":@(r.scaleX),@"scaleY":@(r.scaleY),@"rotation":@(r.rotation)}];
|
||||
if(!valid){complete=false;break;}
|
||||
}
|
||||
auto milliseconds=std::chrono::duration<double,std::milli>(std::chrono::steady_clock::now()-beginning).count();
|
||||
NSDictionary *report=@{@"complete":@(complete),@"backend":metal?@"Metal":@"CPU",@"width":@(width),@"height":@(height),@"start":@(start),@"end":@(end),@"milliseconds":@(milliseconds),@"frames":frames,@"scope":@"Caller-decoded top-first gray8 frames; no host timing or original-video equivalence claim."};
|
||||
NSData *json=[NSJSONSerialization dataWithJSONObject:report options:NSJSONWritingPrettyPrinted error:nil];
|
||||
if(![json writeToFile:[NSString stringWithUTF8String:argv[13]] atomically:YES])return 2;
|
||||
fprintf(stdout,"%s frames=%lu last=%d complete=%d\n",metal?"Metal":"CPU",(unsigned long)frames.count,[frames.lastObject[@"frame"]intValue],complete);return 0;
|
||||
}}
|
||||
@@ -0,0 +1,128 @@
|
||||
// Independent generated-image oracles for free-path ROI, subpixel motion,
|
||||
// anisotropic transforms, feature capacity, and loss protection. No host UI.
|
||||
#import <Foundation/Foundation.h>
|
||||
#include "../大鱼调色/Plugin/MaskCore/DYTracker.hpp"
|
||||
#include "../大鱼调色/Plugin/DYToolFlow.inc.h"
|
||||
#include <chrono>
|
||||
|
||||
static float noise(int x,int y,uint32_t seed=0) {
|
||||
uint32_t n=uint32_t(x)*73856093u^uint32_t(y)*19349663u^seed;
|
||||
n^=n>>13;n*=1274126177u;n^=n>>16;
|
||||
return .1f+.8f*float(n&65535)/65535.f;
|
||||
}
|
||||
static float scene(float x,float y,bool extended=false,uint32_t seed=0) {
|
||||
if(extended&&(x<251||x>379||y<77||y>307))return .5f;
|
||||
float gx=x/3.f,gy=y/3.f;int ix=int(std::floor(gx)),iy=int(std::floor(gy));
|
||||
float dx=gx-ix,dy=gy-iy;
|
||||
return (1-dy)*((1-dx)*noise(ix,iy,seed)+dx*noise(ix+1,iy,seed))+
|
||||
dy*((1-dx)*noise(ix,iy+1,seed)+dx*noise(ix+1,iy+1,seed));
|
||||
}
|
||||
static dy::GrayFrame frame(int w,int h,double tx=0,double ty=0,double angle=0,
|
||||
double sx=1,double sy=1,bool extended=false,uint32_t seed=0) {
|
||||
dy::GrayFrame f{w,h,std::vector<float>(size_t(w)*h)};
|
||||
double cx=w*(extended?.35:.5),cy=h*.5,c=cos(angle),s=sin(angle);
|
||||
for(int y=0;y<h;y++)for(int x=0;x<w;x++) {
|
||||
double dx=x-cx-tx,dy=y-cy-ty;
|
||||
float u=float((c*dx+s*dy)/sx+cx),v=float((-s*dx+c*dy)/sy+cy);
|
||||
f.pixels[y*w+x]=scene(u,v,extended,seed);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
// Isolate robust fitting and confidence from optical flow: coherent cloth-like
|
||||
// 2.15px residuals plus 10% gross outliers, with a known mean translation.
|
||||
class FitBudgetFlow final : public dy::FlowBackend {
|
||||
public:
|
||||
bool reset(const dy::GrayFrame&)override{return true;}
|
||||
bool advance(const dy::GrayFrame&,const std::vector<dy::FlowPoint>& points,
|
||||
std::vector<dy::FlowMatch>& out)override{
|
||||
for(size_t i=0;i<points.size();i++){
|
||||
float angle=float(i)*2.39996323f;
|
||||
float dx=2.25f+2.15f*cosf(angle),dy=-1.5f+2.15f*sinf(angle);
|
||||
if(i%10==0){dx+=35;dy-=25;}
|
||||
auto p=points[i];out.push_back({p,{p.x+dx,p.y+dy},0});
|
||||
}return true;
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc,const char*argv[]) {@autoreleasepool {
|
||||
NSMutableArray *checks=[NSMutableArray array];bool all=true;
|
||||
auto record=[&](NSString *name,bool pass,NSDictionary *extra=nil) {
|
||||
NSMutableDictionary *d=[NSMutableDictionary dictionaryWithDictionary:extra?:@{}];
|
||||
d[@"name"]=name;d[@"pass"]=@(pass);[checks addObject:d];all&=pass;
|
||||
};
|
||||
NSURL *library=argc>1?[NSURL fileURLWithPath:[NSString stringWithUTF8String:argv[1]]]:nil;
|
||||
{
|
||||
dy::Tracker tracker;tracker.setBackend(std::make_shared<FitBudgetFlow>());
|
||||
auto image=frame(640,480);bool started=tracker.reset(image,{.5,.5,.85,.85,0});
|
||||
auto result=tracker.track(image);double ex=fabs(result.cx-(.5+2.25/640))*640,ey=fabs(result.cy-(.5-1.5/480))*480;
|
||||
record(@"coherent-residual-fit-budget-with-ten-percent-outliers",started&&result.valid&&ex<.8&&ey<.8&&fabs(result.scaleX-1)<.02&&fabs(result.scaleY-1)<.02,
|
||||
@{@"scope":@"Controlled correspondence unit test; not an optical-flow image oracle",@"inliers":@(result.inliers),@"matches":@(result.matches),@"confidence":@(result.confidence),@"xErrorPixels":@(ex),@"yErrorPixels":@(ey)});
|
||||
}
|
||||
for(int mode=0;mode<(library?2:1);mode++) {
|
||||
NSString *prefix=mode?@"metal":@"cpu";
|
||||
auto setup=[&](dy::Tracker& tracker) {
|
||||
if(!mode)return true;
|
||||
NSError *error=nil;auto backend=DYToolCreateMetalFlow(library,&error);
|
||||
if(!backend){record([prefix stringByAppendingString:@"-backend"],false,@{@"error":error.localizedDescription?:@"unavailable"});return false;}
|
||||
tracker.setBackend(backend);return true;
|
||||
};
|
||||
{
|
||||
dy::Tracker tracker;if(!setup(tracker))continue;
|
||||
tracker.setMask({{.8f,-.5f},{1.8f,-.5f},{1.8f,.5f},{.8f,.5f}});
|
||||
auto f=frame(512,384,0,0,0,1,1,true);
|
||||
bool started=tracker.reset(f,{.35f,.5f,.2f,.45f,0});
|
||||
record([prefix stringByAppendingString:@"-pen-texture-outside-creation-box-starts"],started,
|
||||
@{@"features":@(tracker.result().features)});
|
||||
bool passed=started;dy::TrackResult result;
|
||||
for(int i=1;i<=12&&passed;i++) {result=tracker.track(frame(512,384,1.25*i,.5*i,0,1,1,true));passed=result.valid;}
|
||||
double ex=fabs(result.cx-(.35+15./512))*512,ey=fabs(result.cy-(.5+6./384))*384;
|
||||
record([prefix stringByAppendingString:@"-extended-pen-region-subpixel-motion"],passed&&ex<.65&&ey<.65,
|
||||
@{@"xErrorPixels":@(ex),@"yErrorPixels":@(ey)});
|
||||
}
|
||||
{
|
||||
dy::Tracker tracker;if(!setup(tracker))continue;
|
||||
auto f=frame(640,480);bool started=tracker.reset(f,{.5,.5,.85,.85,0});
|
||||
record([prefix stringByAppendingString:@"-real-300-feature-capacity"],started&&tracker.result().features==300,
|
||||
@{@"features":@(tracker.result().features)});
|
||||
auto result=tracker.track(frame(640,480,2.25,-1.5,.025,1.025,.98));
|
||||
double ex=fabs(result.cx-(.5+2.25/640))*640,ey=fabs(result.cy-(.5-1.5/480))*480;
|
||||
record([prefix stringByAppendingString:@"-translation-rotation-independent-xy-scale"],
|
||||
started&&result.valid&&ex<.5&&ey<.5&&fabs(result.rotation-.025)<.004&&fabs(result.scaleX-1.025)<.005&&fabs(result.scaleY-.98)<.005,
|
||||
@{@"xErrorPixels":@(ex),@"yErrorPixels":@(ey),@"rotation":@(result.rotation),@"scaleX":@(result.scaleX),@"scaleY":@(result.scaleY)});
|
||||
}
|
||||
{
|
||||
dy::Tracker tracker;if(!setup(tracker))continue;
|
||||
auto f=frame(640,480);bool passed=tracker.reset(f,{.5,.5,.65,.65,0});dy::TrackResult result;
|
||||
for(int i=1;i<=6&&passed;i++){result=tracker.track(f);passed=result.valid;}
|
||||
record([prefix stringByAppendingString:@"-subpixel-refinement-and-redetection-remain-stationary"],passed&&fabs(result.cx-.5)*640<.05&&fabs(result.cy-.5)*480<.05);
|
||||
}
|
||||
{
|
||||
dy::Tracker tracker;if(!setup(tracker))continue;
|
||||
auto f=frame(640,480);bool started=tracker.reset(f,{.5,.5,.7,.7,0});
|
||||
auto result=tracker.track(frame(640,480,0,0,0,1,1,false,0x3344));
|
||||
record([prefix stringByAppendingString:@"-unrelated-cut-is-not-trusted-motion"],started&&!result.valid&&!tracker.active());
|
||||
dy::GrayFrame flat{640,480,std::vector<float>(640*480,.5f)};
|
||||
record([prefix stringByAppendingString:@"-flat-region-still-refuses-tracking"],!tracker.reset(flat,{.5,.5,.7,.7,0}));
|
||||
}
|
||||
{
|
||||
dy::Tracker tracker;if(!setup(tracker))continue;
|
||||
auto t=std::chrono::steady_clock::now();auto f=frame(1920,1080);bool started=tracker.reset(f,{.5,.5,.5,.5,0});
|
||||
auto result=tracker.track(frame(1920,1080,4,2));
|
||||
double ms=std::chrono::duration<double,std::milli>(std::chrono::steady_clock::now()-t).count();
|
||||
record([prefix stringByAppendingString:@"-1080p-complete-frame-motion"],started&&result.valid&&fabs(result.cx-(.5+4./1920))*1920<.5&&fabs(result.cy-(.5+2./1080))*1080<.5,
|
||||
@{@"generatedFramesAndAnalysisMilliseconds":@(ms),@"features":@(result.features)});
|
||||
}
|
||||
{
|
||||
dy::Tracker tracker;if(!setup(tracker))continue;
|
||||
auto t=std::chrono::steady_clock::now();auto f=frame(3840,2160);bool started=tracker.reset(f,{.5,.5,.5,.5,0});
|
||||
auto result=tracker.track(frame(3840,2160,8,4));
|
||||
double ms=std::chrono::duration<double,std::milli>(std::chrono::steady_clock::now()-t).count();
|
||||
record([prefix stringByAppendingString:@"-3840x2160-complete-frame-motion"],started&&result.valid&&fabs(result.cx-(.5+8./3840))*3840<.5&&fabs(result.cy-(.5+4./2160))*2160<.5,
|
||||
@{@"generatedFramesAndAnalysisMilliseconds":@(ms),@"features":@(result.features)});
|
||||
}
|
||||
}
|
||||
NSDictionary *report=@{@"pass":@(all),@"checks":checks,@"scope":@"Independent generated images, CPU tracker and optional real Metal optical flow. No app or GUI host launched.",@"sourceApplicationRuntimeDependency":@NO};
|
||||
NSData *json=[NSJSONSerialization dataWithJSONObject:report options:NSJSONWritingPrettyPrinted error:nil];
|
||||
fwrite(json.bytes,1,json.length,stdout);fputc('\n',stdout);return all?0:1;
|
||||
}}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"tag": "v1.3.1-browser-recents-20261101",
|
||||
"releaseCommit": "281721bda11484c23f294b4f0d9e0b30ef829288",
|
||||
"restoredFiles": 184,
|
||||
"fsck": "full strict passed",
|
||||
"compiledSource": "dbb7ca4a995ef832178a32f35939aed7d3a85012",
|
||||
"compiledSourceRecovery": "verification/BrowserRecovery.json",
|
||||
"cloneCleaned": true
|
||||
}
|
||||
@@ -2,15 +2,17 @@
|
||||
"status": "verified",
|
||||
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"bundleID": "com.dayu.color",
|
||||
"version": "1.3.1",
|
||||
"build": "19",
|
||||
"version": "1.5.0",
|
||||
"build": "34",
|
||||
"team": "B3W25FX5H5",
|
||||
"notaryID": "9e93dc7f-04a3-44f9-a1e4-792bd7b31533",
|
||||
"notaryID": "164abf2b-4e67-4504-b72a-04122da9e381",
|
||||
"notaryStatus": "Accepted",
|
||||
"gatekeeper": "/Library/Plug-Ins/FxPlug/大鱼调色.app: accepted\nsource=Notarized Developer ID",
|
||||
"sourceCommit": "dbb7ca4a995ef832178a32f35939aed7d3a85012",
|
||||
"sourceCommit": "06d531c443b0bb2f179022a4e64148394f5d0690",
|
||||
"templatePath": "/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef",
|
||||
"templateSHA256": "86d62016bf9089d1eda07cc6a533bcb82d905df18351f48e73d6fb87945e09de",
|
||||
"shaderSHA256": "034fdf3de0c8ab0ac8eacc8f8a4bd6fbb8ee8c8c93ed3af61363c8175f0196e2",
|
||||
"hostVerification": "verification/HostBrowserAndReset.json"
|
||||
"templateSHA256": "7476fb5a3cfad5f4dafb7a887dcc787b9cbcba6ad64df3b4939b336444cf8bfc",
|
||||
"shaderSHA256": "b05051fa34cf68bfb7fd3cc77f277620c7e744f927c35dd956e144ed1f748679",
|
||||
"hostVerification": "verification/HostFilmMixer1.5.0.json",
|
||||
"nativeChecks": 349,
|
||||
"referenceChecks": 184
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"status": "verified-formal-install-and-host",
|
||||
"baseline": "1.4.3 (33)",
|
||||
"nativePass": true,
|
||||
"checks": 349,
|
||||
"referenceComparison": {
|
||||
"passed": true,
|
||||
"checks": 184,
|
||||
"dimensions": [
|
||||
[
|
||||
64,
|
||||
48
|
||||
],
|
||||
[
|
||||
63,
|
||||
47
|
||||
],
|
||||
[
|
||||
1,
|
||||
17
|
||||
],
|
||||
[
|
||||
17,
|
||||
1
|
||||
]
|
||||
]
|
||||
},
|
||||
"formalInstallUnchanged": false,
|
||||
"formalVersion": "1.5.0",
|
||||
"formalBuild": "34",
|
||||
"compiledSource": "06d531c443b0bb2f179022a4e64148394f5d0690",
|
||||
"hostVerification": "verification/HostFilmMixer1.5.0.json",
|
||||
"packageVerification": "verification/Package.json",
|
||||
"targetVersion": "1.5.0",
|
||||
"targetBuild": "34"
|
||||
}
|
||||
文件差异过大,未显示。
加载差异
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"status": "verified",
|
||||
"remote": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"commit": "eeeee102cd78b8f99be743be634739286fed8a76",
|
||||
"clone": "/Users/mac/Library/Caches/CodexRecovery/dayu-color-film-1.5.0",
|
||||
"lfs": false,
|
||||
"submodules": false,
|
||||
"releaseBuild": true,
|
||||
"nativeChecks": 349,
|
||||
"nativePass": true,
|
||||
"sourceHasAllFilmMath": true,
|
||||
"generatedAppsRemoved": [
|
||||
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/RecoveryDerivedData/Build/Products/Release/大鱼调色.app",
|
||||
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/RecoveryDerivedData/Build/Products/Release/大鱼调色 XPC Service.pluginkit"
|
||||
]
|
||||
}
|
||||
文件差异过大,未显示。
加载差异
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"status": "passed",
|
||||
"targetVersion": "1.5.0",
|
||||
"build": "34",
|
||||
"sourceCommit": "06d531c443b0bb2f179022a4e64148394f5d0690",
|
||||
"formalPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"host": "Final Cut Pro 12.4",
|
||||
"baseline": {
|
||||
"version": 4,
|
||||
"presetBytes": 77437,
|
||||
"presetSHA256": "02b4f0e8ff52b9d27449d208fd7b2b09ed92440a578f09688a1a5f461cfcc172",
|
||||
"floatParameterCount": 234,
|
||||
"toolLayers": 0,
|
||||
"masks": 1,
|
||||
"trackKeys": 287
|
||||
},
|
||||
"nativeChecks": 349,
|
||||
"referenceCases": 184,
|
||||
"privacy": "User media, project and full presets stay local; report contains aggregate counts and hashes.",
|
||||
"userCompatibility": {
|
||||
"allExisting234ValuesUnchanged": true,
|
||||
"assetPathsAndSpiderUnchanged": true,
|
||||
"toolsAndAll287KeysByteIdentical": true,
|
||||
"uiTrustedKeys": 286,
|
||||
"newDefaultParameters": 42,
|
||||
"afterVersion": 5,
|
||||
"afterBytes": 78460,
|
||||
"afterSHA256": "40772a5b481f197a4f1bf75e51f14159d02416ef68a7e68fca2397c2fc26e094"
|
||||
},
|
||||
"hostGrainExport": {
|
||||
"width": 1920,
|
||||
"height": 1080,
|
||||
"fps": "25/1",
|
||||
"duration": "4.000000",
|
||||
"codec": "prores",
|
||||
"frames": [
|
||||
"7719df2ae1cf5ea9375041270cf71e926472250e6813797b31f0a7a76bed11fb",
|
||||
"7719df2ae1cf5ea9375041270cf71e926472250e6813797b31f0a7a76bed11fb",
|
||||
"84b06b3dbb1f4acf6540a93f3f9ddfec1e806ca09bf6523bcf2f4853c292b252",
|
||||
"84b06b3dbb1f4acf6540a93f3f9ddfec1e806ca09bf6523bcf2f4853c292b252",
|
||||
"36fb6225db64ecafbc98bac0c864b9b7406226ff452e1b8c32b52f7fe282c4e1",
|
||||
"36fb6225db64ecafbc98bac0c864b9b7406226ff452e1b8c32b52f7fe282c4e1"
|
||||
],
|
||||
"adjacentEqual": [
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
true
|
||||
],
|
||||
"presetHold": 2
|
||||
},
|
||||
"hostChecks": {
|
||||
"newModulesVisible": true,
|
||||
"mixerThreeOutputsAndPreserveControls": true,
|
||||
"filmFiveTabs": true,
|
||||
"subtractiveHalationBloomVignetteAdjusted": true,
|
||||
"filmMaskCount": 1,
|
||||
"foldHidesMaskControlsKeepsBadge": true,
|
||||
"independentMixerLayerInitialized": true,
|
||||
"layerDeleteUndoRedoRestored": true,
|
||||
"normalQuitConfirmed": true,
|
||||
"coldReopenAllStatePreserved": true
|
||||
},
|
||||
"combinedPresetBefore": {
|
||||
"bytes": 8987,
|
||||
"sha256": "6c7c08c8b17add17c22d165b2190eff3919c742b8dfae46703ff399cabd71581"
|
||||
},
|
||||
"roundtrip": {
|
||||
"projects": 3,
|
||||
"format": "FCPXML 1.14",
|
||||
"strictDTD": "pass",
|
||||
"missingMedia": 0,
|
||||
"comparedFields": "match",
|
||||
"differences": []
|
||||
},
|
||||
"hostCombinedExport": {
|
||||
"width": 960,
|
||||
"height": 540,
|
||||
"fps": "25/1",
|
||||
"durationSeconds": 4,
|
||||
"allFramesDecode": true
|
||||
},
|
||||
"coldReopen": {
|
||||
"combined": {
|
||||
"semanticEqual": true,
|
||||
"byteIdentical": true,
|
||||
"bytes": 8987,
|
||||
"sha256": "6c7c08c8b17add17c22d165b2190eff3919c742b8dfae46703ff399cabd71581"
|
||||
},
|
||||
"grain": {
|
||||
"semanticEqual": true,
|
||||
"byteIdentical": true,
|
||||
"bytes": 8420,
|
||||
"sha256": "f87d0cf75c77c01ffa5076592f133f3a957a0480077752f0fcdef8be765c468d"
|
||||
}
|
||||
},
|
||||
"passResult": true,
|
||||
"appSourceIdenticalToReferenceCandidate": "eeeee102cd78b8f99be743be634739286fed8a76"
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"version": "1.4.3",
|
||||
"build": "33",
|
||||
"sourceCommit": "26a888f4534792481c6a9933091cb0b23307cd24",
|
||||
"host": "Final Cut Pro 12.4",
|
||||
"formalPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"nativeChecks": 293,
|
||||
"baseline": {
|
||||
"version": "1.4.2",
|
||||
"build": "31",
|
||||
"spiderCollapsed": true,
|
||||
"maskControlsStillVisible": true,
|
||||
"userTrustedKeys": 286
|
||||
},
|
||||
"userState": {
|
||||
"fullPresetBytes": 77276,
|
||||
"fullPresetSHA256": "1563d53e6e7b9d45ee3e959a008713401e5c8a7cf82c960443dcc35d7a04d330",
|
||||
"foldUnfoldByteIdentical": true,
|
||||
"trustedKeysPreserved": 286
|
||||
},
|
||||
"hostChecks": {
|
||||
"originalModuleFoldHidesMaskPanel": true,
|
||||
"originalModuleUnfoldRestoresControls": true,
|
||||
"foldedHeaderBadgeVisible": true,
|
||||
"fixtureOriginalHSLMaskCount": 2,
|
||||
"fixtureOriginalHSLDisabledMasks": 1,
|
||||
"fixtureRepeatedHSLMaskCount": 1,
|
||||
"repeatedLayerFoldUnfoldIndependent": true,
|
||||
"bothFoldedVisibleMaskPanels": 0,
|
||||
"deleteCounts": [
|
||||
2,
|
||||
1,
|
||||
0
|
||||
],
|
||||
"noMasksBadgeHidden": true,
|
||||
"undoCounts": [
|
||||
0,
|
||||
1,
|
||||
2
|
||||
],
|
||||
"noMaskModuleNoBadge": true,
|
||||
"normalQuitAndColdReopen": true,
|
||||
"coldReopenBothHSLFolded": true,
|
||||
"coldReopenBadgeCounts": [
|
||||
2,
|
||||
1
|
||||
],
|
||||
"fixturePresetBytes": 8471,
|
||||
"fixtureFullPresetSHA256": "ee8f0e2d165b41478ca9bae5176b9bcd2bf95d07a60baae7ddfda0c26f79f05a",
|
||||
"fixtureBeforeAfterAndColdReopenByteIdentical": true,
|
||||
"visualBlueThemeBadgeReadable": true
|
||||
},
|
||||
"scope": "Only fold layout and header status UI changed; no renderer/tracking/data-schema change. Existing native checks reused; no new redundant unit tests.",
|
||||
"privacy": "Synthetic fixture is local only. User media, project and full presets remain local; only aggregate checks/hashes are committed.",
|
||||
"limits": [
|
||||
"Live host QA on Apple Silicon Final Cut Pro12.4; Motion, Intel and all alternate themes were not separately live verified."
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
{
|
||||
"status": "verified",
|
||||
"host": "Final Cut Pro 12.4",
|
||||
"formalApp": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"fixtureProject": "大鱼调色_1.4.1_25_独立工具与蒙版",
|
||||
"preliminaryBuild": "25",
|
||||
"newDocumentSchema": 2,
|
||||
"checks": [
|
||||
{
|
||||
"name": "native-inspector-add-layer-immediately-after-source",
|
||||
"passed": true,
|
||||
"evidence": "AX HSL base → HSL2 → HSL3 → Curve; schema2 after anchors match"
|
||||
},
|
||||
{
|
||||
"name": "repeated-add-at-original-inserts-before-existing-child",
|
||||
"passed": true,
|
||||
"newLayerID": "276668CB-1409-43E2-8967-012378413F4E",
|
||||
"oldLayerID": "B27B1FDF-EEEB-4307-8CE5-9F8128BB8F0D",
|
||||
"newValues": {},
|
||||
"oldValues": {
|
||||
"hsl0_0": 32.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "larger-mask-inspector-readable-in-formal-FCP",
|
||||
"passed": true,
|
||||
"evidence": "Observed screenshot: full-width sliders, large values and separate drawing rows"
|
||||
},
|
||||
{
|
||||
"name": "new-pen-enters-drawing-and-disables-tracking",
|
||||
"passed": true,
|
||||
"evidence": "Inspector drawing buttons enabled; tracking disabled; empty canvas draft and draw status"
|
||||
},
|
||||
{
|
||||
"name": "cold-reopen-entire-preset-byte-exact",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "upright-canvas-pen-hint-and-symbols",
|
||||
"passed": true,
|
||||
"evidence": "Final installed build 26 FCP screenshot"
|
||||
},
|
||||
{
|
||||
"name": "native-FCP-bezier-forward-tracking",
|
||||
"passed": true,
|
||||
"keys": 99,
|
||||
"mask": "Existing default closed 4-point Bezier; no claim of real-mouse drawn path"
|
||||
},
|
||||
{
|
||||
"name": "single-undo-clears-track-and-redo-exactly-restores-full-preset",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "user-actual-mouse-pen-placement-and-closure",
|
||||
"passed": true,
|
||||
"evidence": "User answered: 可以绘制并闭合"
|
||||
}
|
||||
],
|
||||
"presetBefore": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/workflow25-before-reopen.json",
|
||||
"bytes": 8258,
|
||||
"sha256": "9654ff3be150928e20f1b8536227bc39169997f36c6b82f91c3c945ef1fbcb0a"
|
||||
},
|
||||
"limitations": [
|
||||
"CUA coordinate clicks did not enter native OSC callbacks; actual-mouse pen point placement and closure were separately confirmed by the user. Other pen gestures are covered by native simulated-host tests unless independently noted.",
|
||||
"No claim of full Color Finale migration or same-real-video trajectory parity.",
|
||||
"Old schema1 tail layers keep their saved position and rendering for compatibility."
|
||||
],
|
||||
"userMediaModified": false,
|
||||
"finalBuild": "26",
|
||||
"compiledSource": "0eb56aed126c825ca89712ce90f8cc1c05b03d89",
|
||||
"formalXPCProcess": 8304,
|
||||
"formalHostProcess": 8287,
|
||||
"singlePluginKitPath": true,
|
||||
"presets": {
|
||||
"workflow26-after-reopen.json": {
|
||||
"sha256": "9654ff3be150928e20f1b8536227bc39169997f36c6b82f91c3c945ef1fbcb0a",
|
||||
"keys": 0,
|
||||
"layers": 2,
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/workflow26-after-reopen.json"
|
||||
},
|
||||
"workflow26-tracked.json": {
|
||||
"sha256": "b7c76ab254a0f0edd7f3bd6cc116a6d56966212267834350d6b16adfe17c8873",
|
||||
"keys": 99,
|
||||
"layers": 2,
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/workflow26-tracked.json"
|
||||
},
|
||||
"workflow26-undo.json": {
|
||||
"sha256": "9654ff3be150928e20f1b8536227bc39169997f36c6b82f91c3c945ef1fbcb0a",
|
||||
"keys": 0,
|
||||
"layers": 2,
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/workflow26-undo.json"
|
||||
},
|
||||
"workflow26-redo.json": {
|
||||
"sha256": "b7c76ab254a0f0edd7f3bd6cc116a6d56966212267834350d6b16adfe17c8873",
|
||||
"keys": 99,
|
||||
"layers": 2,
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/workflow26-redo.json"
|
||||
}
|
||||
},
|
||||
"nativeChecks": {
|
||||
"checks": 281,
|
||||
"passResult": true,
|
||||
"timingNote": "First build26 cache run had 280/281: external-activation-main-loop-responsive had 0 heartbeat /155.951ms; repeat, Release preflight, and installed runs all281 pass. Commit0eb56ae message prematurely said281pass before inspecting the initial run."
|
||||
},
|
||||
"userPenGestureConfirmation": {
|
||||
"answer": "可以绘制并闭合",
|
||||
"method": "User actual mouse in prepared independent FCP acceptance project; reply to three-point pen and closure question",
|
||||
"build": "26",
|
||||
"recordedAt": "2026-11-01T23:59:27.929332+08:00",
|
||||
"scope": [
|
||||
"pen point placement",
|
||||
"pen path closure"
|
||||
],
|
||||
"otherGesturesNotImplied": true,
|
||||
"currentUserDrawingPreserved": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
2026-11-01 22:38:15.062 Df 大鱼调色 XPC Service[2015:f58e1b] dayu_tool_osc_hit x=1043.19 y=497.04 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.122 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=982.30 y=678.64 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.140 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=969.16 y=688.19 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.160 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=969.16 y=688.19 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.306 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=905.88 y=707.31 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.325 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=878.42 y=667.88 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.356 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=870.06 y=648.77 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.376 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=859.31 y=612.93 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.395 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=858.12 y=592.62 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.410 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=858.12 y=586.65 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.504 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=859.31 y=580.67 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.692 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=859.31 y=580.67 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.702 Df 大鱼调色 XPC Service[2015:f58e1b] dayu_tool_osc_event type=1 part=1 x=859.31 y=580.67 plugin=1
|
||||
2026-11-01 22:38:15.708 Df 大鱼调色 XPC Service[2015:f59ed4] dayu_tool_osc_event type=6 part=1 x=880.81 y=584.26 plugin=1
|
||||
2026-11-01 22:38:15.760 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_event type=6 part=1 x=895.13 y=586.65 plugin=1
|
||||
2026-11-01 22:38:15.826 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_event type=6 part=1 x=915.43 y=586.65 plugin=1
|
||||
2026-11-01 22:38:15.843 Df 大鱼调色 XPC Service[2015:f58e1b] dayu_tool_osc_event type=6 part=1 x=916.63 y=586.65 plugin=1
|
||||
2026-11-01 22:38:15.863 Df 大鱼调色 XPC Service[2015:f5c5a6] dayu_tool_osc_event type=6 part=1 x=919.01 y=586.65 plugin=1
|
||||
2026-11-01 22:38:15.876 Df 大鱼调色 XPC Service[2015:f5c707] dayu_tool_osc_event type=6 part=1 x=921.40 y=586.65 plugin=1
|
||||
2026-11-01 22:38:15.893 Df 大鱼调色 XPC Service[2015:f5c708] dayu_tool_osc_event type=6 part=1 x=921.40 y=585.45 plugin=1
|
||||
2026-11-01 22:38:15.910 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_event type=6 part=1 x=923.79 y=585.45 plugin=1
|
||||
2026-11-01 22:38:15.929 Df 大鱼调色 XPC Service[2015:f58e1b] dayu_tool_osc_event type=6 part=1 x=924.99 y=584.26 plugin=1
|
||||
2026-11-01 22:38:16.009 Df 大鱼调色 XPC Service[2015:f5c5a6] dayu_tool_osc_event type=6 part=1 x=932.15 y=577.09 plugin=1
|
||||
2026-11-01 22:38:16.026 Df 大鱼调色 XPC Service[2015:f5c5a6] dayu_tool_osc_event type=6 part=1 x=934.54 y=572.31 plugin=1
|
||||
2026-11-01 22:38:17.140 Df 大鱼调色 XPC Service[2015:f59ed4] dayu_tool_osc_hit x=527.37 y=673.86 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:17.158 Df 大鱼调色 XPC Service[2015:f5c708] dayu_tool_osc_hit x=546.48 y=610.54 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
@@ -0,0 +1,104 @@
|
||||
{
|
||||
"status": "host-workflows-and-user-operated-center-drag-passed",
|
||||
"version": "1.4.0",
|
||||
"build": "24",
|
||||
"host": "Final Cut Pro 12.4",
|
||||
"platform": "Apple M4 / macOS 27.1",
|
||||
"formalPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"compiledSource": "dbf25fe6719f17075362538dad0404951102524d",
|
||||
"verifiedAt": "2026-11-01T14:33:04.639635+00:00",
|
||||
"userMediaTouched": false,
|
||||
"checks": {
|
||||
"allTwelveHeadersHaveBothButtons": true,
|
||||
"extraHSLStartsZero": true,
|
||||
"extraHSLIndependent32Original0": true,
|
||||
"perLayerEllipseAndRectangle": true,
|
||||
"numericalMaskCenterEdit": true,
|
||||
"hostCanvasOutlineAndToolbarVisible": true,
|
||||
"forwardTracking99Exact25fpsKeys": true,
|
||||
"singleUndoZeroKeys": true,
|
||||
"singleRedoByteExact": true,
|
||||
"bidirectional100Keys": true,
|
||||
"extraLayerSingleFrameTwoKeys": true,
|
||||
"singleFramePlayhead": "00:00:00:01 to 00:00:00:02",
|
||||
"coldReopenCompletePresetByteExact": true,
|
||||
"formalExecutablePathVerified": true,
|
||||
"liveCanvasCenterDragUserVerified": true
|
||||
},
|
||||
"presets": {
|
||||
"independent": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/mask24-independent.json",
|
||||
"sha256": "c135ff71d798bb95745bf820dadac461064cfd5c6f6eec803316f1c5b6ddc266",
|
||||
"originalHSLRedHue": 0,
|
||||
"extraHSLRedHue": 32.0,
|
||||
"baseMaskKeys": 0,
|
||||
"extraMaskKeys": 0
|
||||
},
|
||||
"tracked": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/mask24-tracked.json",
|
||||
"sha256": "04fbeb6d3adf16e3d720e3004fb8fa90025ffa801fc3d656bcb5c2e25754d13b",
|
||||
"originalHSLRedHue": 0,
|
||||
"extraHSLRedHue": 32.0,
|
||||
"baseMaskKeys": 99,
|
||||
"extraMaskKeys": 0
|
||||
},
|
||||
"undo": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/mask24-undo.json",
|
||||
"sha256": "cd5afc39f7a135ab4f2d0bcfadf226a7dbe8a257a0352e3bccfc4c552209c6ac",
|
||||
"originalHSLRedHue": 0,
|
||||
"extraHSLRedHue": 32.0,
|
||||
"baseMaskKeys": 0,
|
||||
"extraMaskKeys": 0
|
||||
},
|
||||
"redo": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/mask24-redo.json",
|
||||
"sha256": "04fbeb6d3adf16e3d720e3004fb8fa90025ffa801fc3d656bcb5c2e25754d13b",
|
||||
"originalHSLRedHue": 0,
|
||||
"extraHSLRedHue": 32.0,
|
||||
"baseMaskKeys": 99,
|
||||
"extraMaskKeys": 0
|
||||
},
|
||||
"before-reopen": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/mask24-before-reopen.json",
|
||||
"sha256": "effbee122eb84087b9ba389d73a677c65c8d6c0cd3ee8258211906f0fda31bba",
|
||||
"originalHSLRedHue": 0,
|
||||
"extraHSLRedHue": 32.0,
|
||||
"baseMaskKeys": 100,
|
||||
"extraMaskKeys": 2
|
||||
},
|
||||
"after-reopen": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/mask24-after-reopen.json",
|
||||
"sha256": "effbee122eb84087b9ba389d73a677c65c8d6c0cd3ee8258211906f0fda31bba",
|
||||
"originalHSLRedHue": 0,
|
||||
"extraHSLRedHue": 32.0,
|
||||
"baseMaskKeys": 100,
|
||||
"extraMaskKeys": 2
|
||||
}
|
||||
},
|
||||
"nativeChecks": 222,
|
||||
"limitations": [
|
||||
"Live FCP center dragging is confirmed by the user and by native hit/mouseDown/mouseDragged logs; AX values changed on the intended original HSL mask while the extra HSL mask remained unchanged. Live rotation, resize and pen gestures remain unverified; direct native OSC simulator regressions pass.",
|
||||
"Live FCP covers forward, bidirectional and single-frame tracking. Cancellation, stale-target rejection and backward cadence are additionally covered by native simulated host scheduling.",
|
||||
"Motion, Intel, older systems, non-square-pixel/cropped/retimed projects are unverified. Tracking covers translation, rotation and independent XY scale, not perspective or shear.",
|
||||
"Extra scalar tool values are static author data. Temporal mask tracks are supported. Spatial masks cannot be exported into Cube; complete presets preserve them."
|
||||
],
|
||||
"manualCanvasAcceptance": {
|
||||
"confirmedBy": "User in this chat",
|
||||
"confirmation": "Mask follows the actual mouse when dragged.",
|
||||
"verifiedAt": "2026-11-01T14:39:11.615310+00:00",
|
||||
"baseEllipseBefore": [
|
||||
0.6,
|
||||
0.5
|
||||
],
|
||||
"baseEllipseAfterAX": [
|
||||
0.378,
|
||||
0.379
|
||||
],
|
||||
"independentExtraRectangleAfterAX": [
|
||||
0.5,
|
||||
0.5
|
||||
],
|
||||
"nativeHitAndDragCallbacksObserved": true,
|
||||
"userChangesPreserved": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"version": "1.4.2",
|
||||
"build": "31",
|
||||
"host": "Final Cut Pro 12.4",
|
||||
"sourceCommit": "123a6c85078e8aa41fe55577b6dab5622ed7d128",
|
||||
"formalAppPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"runtimeXPCPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit/Contents/MacOS/大鱼调色 XPC Service",
|
||||
"originalUserProjectPreserved": true,
|
||||
"media": {
|
||||
"width": 3840,
|
||||
"height": 2160,
|
||||
"sourceFPS": 60,
|
||||
"timelineFPS": 25,
|
||||
"durationSeconds": 11.4
|
||||
},
|
||||
"testProjects": "Independent copies created as build28 QA projects; final actual runtime is build31. Native XML1.14 strict DTD and all3 source media references verified before import.",
|
||||
"final31": {
|
||||
"middleReferenceSeconds": 3.68,
|
||||
"middleBothTrustedKeys": 285,
|
||||
"sourceRangeSeconds": [
|
||||
0,
|
||||
11.36
|
||||
],
|
||||
"forwardFromStartTrustedKeys": 285,
|
||||
"activeCancelTrustedPrefixKeys": 159,
|
||||
"activeCancelPrefixEndSeconds": 6.32,
|
||||
"activeCancelHostTaskIdle": true,
|
||||
"cancelThenRestartCompleted": true,
|
||||
"cutLossTrustedKeys": 50,
|
||||
"cutLossRangeSeconds": [
|
||||
0,
|
||||
1.96
|
||||
],
|
||||
"cutLossAtSeconds": 2,
|
||||
"cutLossImmediateRerun": true,
|
||||
"cutLossModal": false,
|
||||
"cutLossHostTaskIdle": true,
|
||||
"firstFrameBackward": "Boundary message, no new keys, host remains responsive, all background tasks idle",
|
||||
"singleStepsTimeline": [
|
||||
"00:00:07:17",
|
||||
"00:00:07:18",
|
||||
"00:00:07:19",
|
||||
"00:00:07:18"
|
||||
],
|
||||
"singleStepsRepeatExistingKeys": true,
|
||||
"normalHostQuit": true,
|
||||
"coldReopenFullPresetByteIdentical": true,
|
||||
"coldReopenPresetBytes": 77087,
|
||||
"coldReopenPresetSHA256": "44228227dd318a051f4f6e786b8b756f36792df12b5009464d1ffed34bd50ae2"
|
||||
},
|
||||
"candidate27Math": {
|
||||
"midForwardNewKeys": 193,
|
||||
"midForwardTotalKeys": 258,
|
||||
"midBackwardKeys": 93,
|
||||
"midBothKeys": 285,
|
||||
"startForwardKeys": 285,
|
||||
"undoRestoresOriginalFullPreset": true,
|
||||
"redoRestoresTrackedFullPreset": true,
|
||||
"xmlRoundtrip": "All5 project format/timecode/clip boundaries/media/static transforms/effect references compared_fields_match; opaque plugin parameter semantics tested through full preset"
|
||||
},
|
||||
"candidate28Lifecycle": {
|
||||
"midBothKeys": 285,
|
||||
"midForwardNewKeys": 193,
|
||||
"lossAndRerunHostTaskIdle": true,
|
||||
"activeCancelHostTaskIdle": true,
|
||||
"normalHostQuit": true,
|
||||
"offsetSingleStepBug": "Fixed in29/30; final31 retested"
|
||||
},
|
||||
"rejectedCandidate30Boundary": "Range rejection SDK synchronous setAnalysisState deadlocked; stateless XPC service stopped after QA preset saved, FCP recovered and quit normally. No host kill. Final31 seed-only boundary task completes.",
|
||||
"limits": [
|
||||
"Region affine tracking, not per-point deformable rotoscoping or subject segmentation; large occlusion/rotation/deformation may need manual adjustment and retracking.",
|
||||
"Full Color Finale parity is not claimed; Motion, Intel, retiming/crop/non-square-pixel projects were not live verified.",
|
||||
"No decoded user frames, media, author presets or FCP project contents are stored in Git."
|
||||
]
|
||||
}
|
||||
+951
-10
文件差异过大,未显示。
加载差异
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"version": "1.4.3",
|
||||
"build": "33",
|
||||
"removedKnownPriorBackups": [
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-f88addf10c2a4cfc983ef8cf3361852c.app",
|
||||
"build": "31"
|
||||
}
|
||||
],
|
||||
"immediate32BackupRemovedByDelivery": true,
|
||||
"originalUserPresetsAndMediaPreserved": true,
|
||||
"otherProductsUntouched": true,
|
||||
"scannedRoots": [
|
||||
"/Applications",
|
||||
"/Library/Plug-Ins/FxPlug",
|
||||
"/Users/mac/Library/Plug-Ins/FxPlug",
|
||||
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color",
|
||||
"/Volumes/备份/大鱼调色",
|
||||
"/Users/mac/Desktop",
|
||||
"/Users/mac/Downloads"
|
||||
],
|
||||
"remainingProductApps": [
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"build": "33"
|
||||
}
|
||||
],
|
||||
"pluginKit": "com.dayu.color.XPC(1.1)\tBAE13DB2-1BF0-42D1-AFA3-86DF1B0496E7\t2026-11-02 04:27:46 +0000\t/Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit\n (1 plug-in)"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"sourceCommit": "26a888f4534792481c6a9933091cb0b23307cd24",
|
||||
"restoredFiles": 240,
|
||||
"fsck": "full strict passed",
|
||||
"rebuiltShaderSHA256": "b3258b903ed485b4b738a823a7de929bca9380365ad2de9c2c7781660293df7e",
|
||||
"formalShaderMatches": true,
|
||||
"templateRebuiltFromNativeModel": true,
|
||||
"templateSHA256": "9b8f6e407545429b77c1de88d4cceb738760771c5a7f1dbd9732bdcc95c23738",
|
||||
"LFS": false,
|
||||
"submodules": false,
|
||||
"cloneCleaned": true
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"tag": "v1.4.3-mask-fold-20261102",
|
||||
"releaseCommit": "301b31438e8da95dc4e6e1c09498ad814a0ebcfc",
|
||||
"appCompiledSource": "26a888f4534792481c6a9933091cb0b23307cd24",
|
||||
"restoredFiles": 244,
|
||||
"fsck": "full strict passed",
|
||||
"everyTrackedFileByteCompared": true,
|
||||
"packageBytes": 14340650,
|
||||
"packageSHA256": "41bba698a70a7629438688a4be74947f424f3af04190090c44f248827b4c3bb2",
|
||||
"formalNativeAndHostReportsRecovered": true,
|
||||
"compiledSourceRebuildRecord": "verification/MaskFoldingRecovery.json",
|
||||
"LFS": false,
|
||||
"submodules": false,
|
||||
"cloneCleaned": true
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"build": "26",
|
||||
"removedEarlierBackup": [
|
||||
"/Library/Plug-Ins/FxPlug/.dayu-color-previous-57969b9e8916483b9ac4e8aa4ac25f61.app"
|
||||
],
|
||||
"immediateBuild25Backup": "removed by tools/deliver.py after host verification",
|
||||
"copiesInInspectedRoots": [
|
||||
"/Library/Plug-Ins/FxPlug/大鱼调色.app"
|
||||
],
|
||||
"scope": [
|
||||
"/Library/Plug-Ins/FxPlug",
|
||||
"/Applications",
|
||||
"/Users/mac/Library/Plug-Ins/FxPlug",
|
||||
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/DerivedData/Build/Products/Release"
|
||||
],
|
||||
"historicalPackagesPreserved": true
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"sourceCommit": "0eb56aed126c825ca89712ce90f8cc1c05b03d89",
|
||||
"restoredFiles": 224,
|
||||
"fsck": "full strict passed",
|
||||
"rebuiltShaderSHA256": "757b240921846ed06ca294a9bbfbd4aee5d41c6361a3918254a806187eb997ea",
|
||||
"templateRebuiltFromNativeModel": true,
|
||||
"templateSHA256": "9b8f6e407545429b77c1de88d4cceb738760771c5a7f1dbd9732bdcc95c23738",
|
||||
"LFS": false,
|
||||
"submodules": false,
|
||||
"cloneCleaned": true,
|
||||
"formalShaderSHA256": "757b240921846ed06ca294a9bbfbd4aee5d41c6361a3918254a806187eb997ea",
|
||||
"formalShaderMatches": true
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"tag": "v1.4.1-mask-workflow-20261101",
|
||||
"tagCommit": "23d5af7dcfecc9042896a7fa3e8b8b150ed874b8",
|
||||
"compiledSource": "0eb56aed126c825ca89712ce90f8cc1c05b03d89",
|
||||
"restoredFiles": 228,
|
||||
"fsck": "full strict passed",
|
||||
"sourceRecovery": "verification/MaskWorkflowRecovery.json",
|
||||
"packageBytes": 14337616,
|
||||
"packageSHA256": "0c167aba339bbfdd9c4cbd96aea384e2d43f6d498629ebaf7b1c18cbc6dca5c6",
|
||||
"allTaggedFilesMatch": true,
|
||||
"LFS": false,
|
||||
"submodules": false,
|
||||
"cloneCleaned": true
|
||||
}
|
||||
+15
-15
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.3.1.pkg",
|
||||
"sha256": "954b10c581f31d23a8c417a6f37b24fae19939786dce8733b4d6f09c7ed3adae",
|
||||
"bytes": 14073683,
|
||||
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.5.0.pkg",
|
||||
"sha256": "3ecabc7a8bfd675b228a5f00016aa17a35b65b544055e57793ec3bff3d7e0294",
|
||||
"bytes": 14380104,
|
||||
"testUnsigned": false,
|
||||
"installationExecuted": false,
|
||||
"checks": [
|
||||
@@ -31,34 +31,34 @@
|
||||
"source": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"payload": "Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"bundleID": "com.dayu.color",
|
||||
"version": "1.3.1",
|
||||
"build": "19"
|
||||
"version": "1.5.0",
|
||||
"build": "34"
|
||||
},
|
||||
{
|
||||
"source": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/pkg-inputs/大鱼调色",
|
||||
"payload": "Library/Application Support/PKGForge/Payload/com.dayu.color.installer.65103cc9-6665-4d36-b01f-133a9a371475/740F02F8-EDB2-42B1-B5C8-D2D7138B46E7/大鱼调色"
|
||||
"payload": "Library/Application Support/PKGForge/Payload/com.dayu.color.installer.210510f9-2b2c-4b85-8a6d-055789dd7acf/8FC61176-5CC6-435D-BD1C-99D0AF0117E6/大鱼调色"
|
||||
}
|
||||
],
|
||||
"signature": "Package \"大鱼调色-1.3.1.pkg\":\n Status: signed by a developer certificate issued by Apple for distribution\n Notarization: trusted by the Apple notary service\n Signed with a trusted timestamp on: 2026-11-01 12:55:56 +0000\n Certificate Chain:\n 1. Developer ID Installer: zhong luo (B3W25FX5H5)\n Expires: 2027-02-01 22:12:15 +0000\n SHA256 Fingerprint:\n C0 19 01 3C 67 88 8F 34 65 56 C5 91 3C E5 B6 12 4C 5D A6 DA F9 D8 \n DA 00 37 52 DF F0 F3 E6 00 B4\n ------------------------------------------------------------------------\n 2. Developer ID Certification Authority\n Expires: 2027-02-01 22:12:15 +0000\n SHA256 Fingerprint:\n 7A FC 9D 01 A6 2F 03 A2 DE 96 37 93 6D 4A FE 68 09 0D 2D E1 8D 03 \n F2 9C 88 CF B0 B1 BA 63 58 7F\n ------------------------------------------------------------------------\n 3. Apple Root CA\n Expires: 2035-02-09 21:40:36 +0000\n SHA256 Fingerprint:\n B0 B1 73 0E CB C7 FF 45 05 14 2C 49 F1 29 5E 6E DA 6B CA ED 7E 2C \n 68 C5 BE 91 B5 A1 10 01 F0 24",
|
||||
"gatekeeper": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.3.1.pkg: accepted\nsource=Notarized Developer ID",
|
||||
"signature": "Package \"大鱼调色-1.5.0.pkg\":\n Status: signed by a developer certificate issued by Apple for distribution\n Notarization: trusted by the Apple notary service\n Signed with a trusted timestamp on: 2026-11-02 06:12:29 +0000\n Certificate Chain:\n 1. Developer ID Installer: zhong luo (B3W25FX5H5)\n Expires: 2027-02-01 22:12:15 +0000\n SHA256 Fingerprint:\n C0 19 01 3C 67 88 8F 34 65 56 C5 91 3C E5 B6 12 4C 5D A6 DA F9 D8 \n DA 00 37 52 DF F0 F3 E6 00 B4\n ------------------------------------------------------------------------\n 2. Developer ID Certification Authority\n Expires: 2027-02-01 22:12:15 +0000\n SHA256 Fingerprint:\n 7A FC 9D 01 A6 2F 03 A2 DE 96 37 93 6D 4A FE 68 09 0D 2D E1 8D 03 \n F2 9C 88 CF B0 B1 BA 63 58 7F\n ------------------------------------------------------------------------\n 3. Apple Root CA\n Expires: 2035-02-09 21:40:36 +0000\n SHA256 Fingerprint:\n B0 B1 73 0E CB C7 FF 45 05 14 2C 49 F1 29 5E 6E DA 6B CA ED 7E 2C \n 68 C5 BE 91 B5 A1 10 01 F0 24",
|
||||
"gatekeeper": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.5.0.pkg: accepted\nsource=Notarized Developer ID",
|
||||
"pass": true,
|
||||
"scope": "Expanded package structural and payload verification only; no installer scripts executed and no host quit or registration performed.",
|
||||
"notarization": {
|
||||
"id": "05f849da-5567-4351-9556-742d17b95723",
|
||||
"message": "Successfully received submission info",
|
||||
"name": "大鱼调色-1.5.0.pkg",
|
||||
"status": "Accepted",
|
||||
"createdDate": "2026-11-01T12:55:58.535Z",
|
||||
"id": "85cad776-c3d7-4037-9643-24041b269002",
|
||||
"name": "大鱼调色-1.3.1.pkg"
|
||||
"createdDate": "2026-11-02T06:12:31.089Z"
|
||||
},
|
||||
"appCompiledSource": "dbb7ca4a995ef832178a32f35939aed7d3a85012",
|
||||
"appBuild": "19",
|
||||
"appCompiledSource": "06d531c443b0bb2f179022a4e64148394f5d0690",
|
||||
"appBuild": "34",
|
||||
"packageBuilderRemote": "https://dayu.media/git/dayu/pkg-forge.git",
|
||||
"packageBuilderCommit": "eb53707c0e67d8ddeab8c1270bb079f1050cfafe",
|
||||
"templateSHA256": {
|
||||
"大鱼调色.moef": "86d62016bf9089d1eda07cc6a533bcb82d905df18351f48e73d6fb87945e09de",
|
||||
"大鱼调色.moef": "7476fb5a3cfad5f4dafb7a887dcc787b9cbcba6ad64df3b4939b336444cf8bfc",
|
||||
"large.png": "ab12611e8801cff86332ccc505a4cffa0c1120541c2efb9bb9908be2c9fe631a",
|
||||
"small.png": "41fec3138aee904fc39d6982e6fde809243ffec55298dbfe966f4f48d89caf8a"
|
||||
},
|
||||
"installedAppHostAcceptance": "verification/HostBrowserAndReset.json",
|
||||
"installedAppHostAcceptance": "verification/HostFilmMixer1.5.0.json",
|
||||
"installScope": "本轮仅生成并验包,未再次执行系统安装;正式 APP 已有独立宿主验收。"
|
||||
}
|
||||
+17
-26
@@ -3,33 +3,24 @@
|
||||
"repository": "dayu/dayu-color",
|
||||
"repositoryID": 52,
|
||||
"private": false,
|
||||
"tag": "v1.3.0-spider-balance-20261101",
|
||||
"releaseCommit": "6528f888affe0acdd4292bc0c5ae0dac3a89b5a5",
|
||||
"releaseID": 365,
|
||||
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.3.0-spider-balance-20261101",
|
||||
"assetID": 11,
|
||||
"assetName": "大鱼调色-1.3.0.pkg",
|
||||
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.3.0-spider-balance-20261101/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.3.0.pkg",
|
||||
"bytes": 14066399,
|
||||
"sha256": "36c251722d3c9e4aaed8d5a09bf5afd3bf84039e9d1161c63635ab9d8224f506",
|
||||
"tag": "v1.4.3-mask-fold-20261102",
|
||||
"releaseCommit": "301b31438e8da95dc4e6e1c09498ad814a0ebcfc",
|
||||
"releaseID": 371,
|
||||
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.4.3-mask-fold-20261102",
|
||||
"assetID": 16,
|
||||
"assetName": "大鱼调色-1.4.3.pkg",
|
||||
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.4.3-mask-fold-20261102/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.4.3.pkg",
|
||||
"bytes": 14340650,
|
||||
"sha256": "41bba698a70a7629438688a4be74947f424f3af04190090c44f248827b4c3bb2",
|
||||
"existingAssetReused": true,
|
||||
"verification": "Authenticated full download SHA-256 and byte count, then release/asset read-back.",
|
||||
"credentialSource": "macOS Keychain: dayu-git-api",
|
||||
"status": "published-and-download-verified",
|
||||
"verifiedAt": "2026-11-01T12:32:32.150064+00:00",
|
||||
"prePublishDraftDownload": {
|
||||
"passResult": true,
|
||||
"path": "/Volumes/备份/大鱼调色-1.3.0.pkg",
|
||||
"bytes": 14066399,
|
||||
"sha256": "36c251722d3c9e4aaed8d5a09bf5afd3bf84039e9d1161c63635ab9d8224f506",
|
||||
"sourceURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.3.0-spider-balance-20261101/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.3.0.pkg",
|
||||
"source": "Completed authenticated Microsoft Edge draft download; UI confirmed completion and opened containing folder.",
|
||||
"birthtime": 1793536278.86,
|
||||
"releaseID": 365,
|
||||
"assetID": 11,
|
||||
"temporaryCopyRemoved": true
|
||||
},
|
||||
"actualAppCompiledSource": "c2818cbb1157093f80efd2a85cea0cf1509f565e",
|
||||
"assetUploads": 1,
|
||||
"credentialValueRecorded": false
|
||||
"status": "published-and-fully-verified",
|
||||
"version": "1.4.3",
|
||||
"build": "33",
|
||||
"appCompiledSource": "26a888f4534792481c6a9933091cb0b23307cd24",
|
||||
"draftDownloadVerification": "verification/ReleaseDraftDownload1.4.3.json",
|
||||
"repositoryVisibilityUnchanged": true,
|
||||
"hostVerification": "verification/HostMaskFolding1.4.3.json",
|
||||
"temporaryDownloadCleaned": true
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"method": "Authenticated existing Edge session full web download while release remained draft",
|
||||
"path": "/Volumes/备份/大鱼调色-1.4.1.pkg",
|
||||
"bytes": 14337616,
|
||||
"sha256": "0c167aba339bbfdd9c4cbd96aea384e2d43f6d498629ebaf7b1c18cbc6dca5c6",
|
||||
"releaseID": 369,
|
||||
"assetID": 14,
|
||||
"tag": "v1.4.1-mask-workflow-20261101",
|
||||
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.4.1-mask-workflow-20261101/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.4.1.pkg",
|
||||
"temporaryDownloadCleaned": true,
|
||||
"formalPackagePreserved": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.4.1.pkg"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"version": "1.4.2",
|
||||
"build": "31",
|
||||
"releaseID": 370,
|
||||
"assetID": 15,
|
||||
"releaseCommit": "38bf12326e74f2f026bc4c7627729121b6aa261d",
|
||||
"draft": true,
|
||||
"method": "Complete download through existing authenticated browser session; verified before publishing",
|
||||
"bytes": 14339640,
|
||||
"sha256": "d137e3516b9c4abc1e6959b83693f5ed09e040cf018b2e29508cc92246fe76f2",
|
||||
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.4.2-tracking-midpoint-20261102/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.4.2.pkg"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"version": "1.4.3",
|
||||
"build": "33",
|
||||
"releaseID": 371,
|
||||
"assetID": 16,
|
||||
"releaseCommit": "301b31438e8da95dc4e6e1c09498ad814a0ebcfc",
|
||||
"draft": true,
|
||||
"method": "Complete download through existing authenticated browser session; verified before publishing",
|
||||
"bytes": 14340650,
|
||||
"sha256": "41bba698a70a7629438688a4be74947f424f3af04190090c44f248827b4c3bb2",
|
||||
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.4.3-mask-fold-20261102/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.4.3.pkg"
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"removed": [
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-7d4cb59101b145c9831f00eb51f1e512.app",
|
||||
"version": "1.4.0",
|
||||
"build": "22",
|
||||
"reason": "Task-created previous formal install; final installed build24 verified"
|
||||
},
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-793570296f434520b48336b9fc33da85.app",
|
||||
"version": "1.3.1",
|
||||
"build": "19",
|
||||
"reason": "Task-created previous formal install; final installed build24 verified"
|
||||
},
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-eb52cb62e5b64c3dbcbe51b4a4f07173.app",
|
||||
"version": "1.4.0",
|
||||
"build": "21",
|
||||
"reason": "Task-created previous formal install; final installed build24 verified"
|
||||
},
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-cc56f5cdd2894832abaa89e76df4de8b.app",
|
||||
"version": "1.4.0",
|
||||
"build": "20",
|
||||
"reason": "Task-created previous formal install; final installed build24 verified"
|
||||
}
|
||||
],
|
||||
"immediatePreviousBuild23RemovedByDelivery": true,
|
||||
"formalBuild": "24",
|
||||
"registry": [
|
||||
" com.dayu.color.XPC(1.1)\t8C45F711-7E1E-43F1-907D-95297F896CE2\t2026-11-01 14:20:28 +0000\t/Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit"
|
||||
],
|
||||
"scope": "Current product standard install dirs, fixed build cache and current checkout; unrelated user archives and products excluded",
|
||||
"verifiedAt": "2026-11-01T14:33:52.542279+00:00"
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"status": "superseded-before-release",
|
||||
"version": "1.4.0",
|
||||
"build": "20",
|
||||
"sourceCommit": "659a8c540db47ed593059127ab7c5ab018c359c0",
|
||||
"notaryID": "f3a3ff9e-91e6-4d7f-9e3b-12cb19e74e31",
|
||||
"nativeChecks": 216,
|
||||
"liveFCP": {
|
||||
"addedInitializedSecondHSL": true,
|
||||
"changedSecondHueTo32": true,
|
||||
"perInstanceEllipse": true,
|
||||
"singleStepRealHostKeys": 2,
|
||||
"undoKeyCount": 0,
|
||||
"redoKeyCount": 2,
|
||||
"redoCompletePresetBytesEqual": true,
|
||||
"oscVerified": false,
|
||||
"oscBlocker": "Motion wrapper parameter 10005 remained zero; fixed to publish native OSC for build21."
|
||||
},
|
||||
"userMediaModified": false
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"sourceCommit": "dbf25fe6719f17075362538dad0404951102524d",
|
||||
"restoredFiles": 210,
|
||||
"fsck": "full strict passed",
|
||||
"rebuiltShaderSHA256": "df82ed0310281e854085063276ab161db7c623511751a1c1c63607b4072c8097",
|
||||
"formalShaderSHA256": "df82ed0310281e854085063276ab161db7c623511751a1c1c63607b4072c8097",
|
||||
"templateRebuiltFromNativeModel": true,
|
||||
"templateSHA256": "9b8f6e407545429b77c1de88d4cceb738760771c5a7f1dbd9732bdcc95c23738",
|
||||
"clone": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/mask-remote-restore-leyx6cd4/source",
|
||||
"LFS": false,
|
||||
"submodules": false,
|
||||
"cloneCleaned": true
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"tag": "v1.4.0-tool-masks-20261101",
|
||||
"commit": "fa7ef93714c93ba959276e21be60e5758f37e0ad",
|
||||
"restoredFiles": 214,
|
||||
"fsck": "full strict passed",
|
||||
"packageSHA256": "16a4958e28bc2a43c40e6131067eb03a49aecba5bbe3c0424bc7024fa532af38",
|
||||
"packageBytes": 14250425,
|
||||
"sourceRecovery": "verification/ToolMaskRecovery.json",
|
||||
"cloneCleaned": true
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
{
|
||||
"status": "formal-native-and-fcp-validated",
|
||||
"version": "1.4.2",
|
||||
"build": "31",
|
||||
"baselineSource": "847a5ea99903c0b7427301c799e1c40f3fe6c5ad",
|
||||
"nativeChecks": 293,
|
||||
"independentChecks": [
|
||||
{
|
||||
"pass": true,
|
||||
"confidence": 0.38259220123291016,
|
||||
"scope": "Controlled correspondence unit test; not an optical-flow image oracle",
|
||||
"xErrorPixels": 0.09802246093748579,
|
||||
"inliers": 270,
|
||||
"yErrorPixels": 0.011092185974126423,
|
||||
"name": "coherent-residual-fit-budget-with-ten-percent-outliers",
|
||||
"matches": 300
|
||||
},
|
||||
{
|
||||
"name": "cpu-pen-texture-outside-creation-box-starts",
|
||||
"pass": true,
|
||||
"features": 117
|
||||
},
|
||||
{
|
||||
"yErrorPixels": 0.03234100341796875,
|
||||
"xErrorPixels": 0.007296752929676131,
|
||||
"name": "cpu-extended-pen-region-subpixel-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cpu-real-300-feature-capacity",
|
||||
"pass": true,
|
||||
"features": 300
|
||||
},
|
||||
{
|
||||
"pass": true,
|
||||
"rotation": 0.02499544620513916,
|
||||
"scaleX": 1.025027871131897,
|
||||
"scaleY": 0.9799908995628357,
|
||||
"xErrorPixels": 0.0009307861328267109,
|
||||
"yErrorPixels": 0.0005807876586860772,
|
||||
"name": "cpu-translation-rotation-independent-xy-scale"
|
||||
},
|
||||
{
|
||||
"name": "cpu-subpixel-refinement-and-redetection-remain-stationary",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cpu-unrelated-cut-is-not-trusted-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cpu-flat-region-still-refuses-tracking",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"generatedFramesAndAnalysisMilliseconds": 51.241667,
|
||||
"features": 300,
|
||||
"name": "cpu-1080p-complete-frame-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"generatedFramesAndAnalysisMilliseconds": 130.370417,
|
||||
"features": 300,
|
||||
"name": "cpu-3840x2160-complete-frame-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "metal-pen-texture-outside-creation-box-starts",
|
||||
"pass": true,
|
||||
"features": 117
|
||||
},
|
||||
{
|
||||
"yErrorPixels": 0.03234100341796875,
|
||||
"xErrorPixels": 0.007296752929676131,
|
||||
"name": "metal-extended-pen-region-subpixel-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "metal-real-300-feature-capacity",
|
||||
"pass": true,
|
||||
"features": 300
|
||||
},
|
||||
{
|
||||
"pass": true,
|
||||
"rotation": 0.02499544620513916,
|
||||
"scaleX": 1.025027871131897,
|
||||
"scaleY": 0.9799908995628357,
|
||||
"xErrorPixels": 0.0009307861328267109,
|
||||
"yErrorPixels": 0.0005807876586860772,
|
||||
"name": "metal-translation-rotation-independent-xy-scale"
|
||||
},
|
||||
{
|
||||
"name": "metal-subpixel-refinement-and-redetection-remain-stationary",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "metal-unrelated-cut-is-not-trusted-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "metal-flat-region-still-refuses-tracking",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"generatedFramesAndAnalysisMilliseconds": 37.962792,
|
||||
"features": 300,
|
||||
"name": "metal-1080p-complete-frame-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"generatedFramesAndAnalysisMilliseconds": 109.041875,
|
||||
"features": 300,
|
||||
"name": "metal-3840x2160-complete-frame-motion",
|
||||
"pass": true
|
||||
}
|
||||
],
|
||||
"hostBaseline": {
|
||||
"version": "1.4.1",
|
||||
"build": "26",
|
||||
"sourceWidth": 3840,
|
||||
"sourceHeight": 2160,
|
||||
"sourceFPS": 60,
|
||||
"timelineFPS": 25,
|
||||
"sourceDurationSeconds": 11.4,
|
||||
"forwardFromStartTrustedKeys": 65,
|
||||
"middleReferenceSeconds": 3.68,
|
||||
"newMiddleKeys": 3,
|
||||
"displayedFailure": "失去可靠跟踪,保留最后可信帧",
|
||||
"modalAlert": true,
|
||||
"originalUserProjectPreserved": true
|
||||
},
|
||||
"realMediaOffline": {
|
||||
"start": {
|
||||
"complete": true,
|
||||
"frames": 285,
|
||||
"startFrame": 0,
|
||||
"endFrame": 284,
|
||||
"last": {
|
||||
"failure": 0,
|
||||
"confidence": 0.978393018245697,
|
||||
"rotation": -0.11834434419870377,
|
||||
"valid": true,
|
||||
"frame": 284,
|
||||
"centerY": 0.9093142151832581,
|
||||
"flowMatches": 252,
|
||||
"medianResidualPixels": 0.05460958555340767,
|
||||
"centerX": 0.4167436957359314,
|
||||
"scaleY": 1.8007324934005737,
|
||||
"scaleX": 1.2875596284866333,
|
||||
"features": 252,
|
||||
"inliers": 252
|
||||
},
|
||||
"scope": "Offline decoded gray8 at 1280x720; host confirmation is separate"
|
||||
},
|
||||
"middle-forward": {
|
||||
"complete": true,
|
||||
"frames": 193,
|
||||
"startFrame": 92,
|
||||
"endFrame": 284,
|
||||
"last": {
|
||||
"failure": 0,
|
||||
"confidence": 0.9728200435638428,
|
||||
"rotation": -0.03911023586988449,
|
||||
"valid": true,
|
||||
"frame": 284,
|
||||
"centerY": 0.8755143284797668,
|
||||
"flowMatches": 298,
|
||||
"medianResidualPixels": 0.06889039278030396,
|
||||
"centerX": 0.4592028260231018,
|
||||
"scaleY": 2.144608974456787,
|
||||
"scaleX": 1.803216576576233,
|
||||
"features": 298,
|
||||
"inliers": 298
|
||||
},
|
||||
"scope": "Offline decoded gray8 at 1280x720; host confirmation is separate"
|
||||
},
|
||||
"middle-backward": {
|
||||
"complete": true,
|
||||
"frames": 93,
|
||||
"startFrame": 92,
|
||||
"endFrame": 0,
|
||||
"last": {
|
||||
"failure": 0,
|
||||
"confidence": 0.8557574152946472,
|
||||
"rotation": 0.0420353040099144,
|
||||
"valid": true,
|
||||
"frame": 0,
|
||||
"centerY": 0.5898973941802979,
|
||||
"flowMatches": 165,
|
||||
"medianResidualPixels": 0.314788281917572,
|
||||
"centerX": 0.5102063417434692,
|
||||
"scaleY": 1.157965064048767,
|
||||
"scaleX": 1.2286995649337769,
|
||||
"features": 170,
|
||||
"inliers": 165
|
||||
},
|
||||
"scope": "Offline decoded gray8 at 1280x720; host confirmation is separate"
|
||||
}
|
||||
},
|
||||
"analysisMaximum": [
|
||||
1280,
|
||||
720
|
||||
],
|
||||
"sampling": "Low-pass encoded display luma over the source footprint before decimation, top-first, with pixel aspect correction",
|
||||
"fitTolerancePixels": 3,
|
||||
"confidence": "Residual penalty normalized to accepted fit budget; minimum confidence .3, minimum8 inliers,52%consensus and transform/2D-spread guards retained",
|
||||
"cachePolicy": "First analyzer frame is authoritative; fresh instance, stale cache and changed preview pixels cannot veto the start",
|
||||
"privacy": "Only aggregate test metadata is committed. User media, exported timeline and decoded frames remain local.",
|
||||
"limitations": [
|
||||
"Region affine tracking, not per-point subject segmentation or deformable rotoscoping; occlusion/deformation may need manual adjustment and continuation.",
|
||||
"Full Color Finale migration is not claimed; live Motion, Intel and retiming/crop/non-square-pixel projects are outside this acceptance."
|
||||
],
|
||||
"initialNativeTimingFailure": {
|
||||
"check": "external-activation-main-loop-responsive",
|
||||
"maximumGapMS": 178.33579168654978,
|
||||
"context": "Initial run overlapped diagnostic decoding; quiet complete repeat285/285 passed. No test threshold changed."
|
||||
},
|
||||
"quietTermination": "FxPlugErrorDomain/kFxError_UserCancelled for expected loss, explicit cancel, extra single-step frames and late callbacks. A normal backward boundary returns a valid seed-only analysis range and completes successfully; no rejected range.",
|
||||
"candidate27Rejected": "NO/nil suppressed the modal but left the diagnostic host background analysis at 50%; candidate not released. Own diagnostic task canceled normally before host quit.",
|
||||
"singleStepTimeMapping": "FxTimingAPI_v4 timelineTime:fromInputTime: converts source analysis time before FxCommandAPI_v2 seek; exact rational offset-clip backward step and consecutive forward-step checks pass",
|
||||
"candidate28Host": "Midpoint both285, midpoint forward193 new/258 total, loss50 keys task idle with immediate rerun, active cancel task idle and normal quit passed. Offset-clip single-step sought source3.72 as timeline3.72 instead of7.72; candidate not released; corrected in29.",
|
||||
"existingSingleStep": "An already identical tracked pair must still advance the playhead without duplicating the author write; regression added in30.",
|
||||
"nativeRegressionFixtureNote": "Initial unchanged-step fixture followed a different reference frame, legitimately changed the reference confidence. Correct fixture repeats the same two-frame operation twice; second pass advances without author write.",
|
||||
"boundaryPolicy": "At the first frame, backward analysis returns a valid one-seed-frame range and completes with no new author keys; never reject desiredAnalysisTimeRange for this normal boundary. Candidate30 NO/UserCancelled at range discovery deadlocked FCP main waiting for plugin range reply while SDK tried synchronous host setAnalysisState. Own stateless XPC service stopped after saved QA preset, restoring FCP; FCP quit normally, original user project untouched.",
|
||||
"sourceCommit": "123a6c85078e8aa41fe55577b6dab5622ed7d128",
|
||||
"hostVerification": "verification/HostTrackingMidpoint1.4.2.json",
|
||||
"formalNativeChecks": 293
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"formalBuild": "31",
|
||||
"removedKnownCandidateBackups": [
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-d04b2bcc671f4022a6747fa05d7f6822.app",
|
||||
"build": "26"
|
||||
},
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-13eeb98213d24a1da3f49781429e4ed5.app",
|
||||
"build": "27"
|
||||
},
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-30dacc70582b49b281f331992f0eae95.app",
|
||||
"build": "28"
|
||||
},
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-6025c526da6a416eb90435cf7a8e3dd1.app",
|
||||
"build": "29"
|
||||
}
|
||||
],
|
||||
"deliveryScriptRemovedImmediatePreviousBackup": true,
|
||||
"decodedDiagnosticFramesRemoved": [
|
||||
{
|
||||
"name": "real-25fps-3840x2160.gray",
|
||||
"bytes": 2363904000
|
||||
},
|
||||
{
|
||||
"name": "real-25fps-1920x1080.gray",
|
||||
"bytes": 590976000
|
||||
},
|
||||
{
|
||||
"name": "real-25fps-1280x720.gray",
|
||||
"bytes": 262656000
|
||||
},
|
||||
{
|
||||
"name": "real-25fps-960x540.gray",
|
||||
"bytes": 147744000
|
||||
}
|
||||
],
|
||||
"originalMediaPreserved": true,
|
||||
"localUserProjectSnapshotsAndPresetsPreserved": true,
|
||||
"formalPluginKitEntries": 1,
|
||||
"otherProductBackupsUntouched": true,
|
||||
"scannedRoots": [
|
||||
"/Applications",
|
||||
"/Library/Plug-Ins/FxPlug",
|
||||
"/Users/mac/Library/Plug-Ins/FxPlug",
|
||||
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color",
|
||||
"/Volumes/备份/大鱼调色",
|
||||
"/Users/mac/Desktop",
|
||||
"/Users/mac/Downloads"
|
||||
],
|
||||
"remainingProductApps": [
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"build": "31"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"sourceCommit": "123a6c85078e8aa41fe55577b6dab5622ed7d128",
|
||||
"restoredFiles": 233,
|
||||
"fsck": "full strict passed",
|
||||
"rebuiltShaderSHA256": "b3258b903ed485b4b738a823a7de929bca9380365ad2de9c2c7781660293df7e",
|
||||
"formalShaderMatches": true,
|
||||
"templateRebuiltFromNativeModel": true,
|
||||
"templateSHA256": "9b8f6e407545429b77c1de88d4cceb738760771c5a7f1dbd9732bdcc95c23738",
|
||||
"LFS": false,
|
||||
"submodules": false,
|
||||
"cloneCleaned": true
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"tag": "v1.4.2-tracking-midpoint-20261102",
|
||||
"releaseCommit": "38bf12326e74f2f026bc4c7627729121b6aa261d",
|
||||
"appCompiledSource": "123a6c85078e8aa41fe55577b6dab5622ed7d128",
|
||||
"restoredFiles": 237,
|
||||
"fsck": "full strict passed",
|
||||
"everyTrackedFileByteCompared": true,
|
||||
"packageBytes": 14339640,
|
||||
"packageSHA256": "d137e3516b9c4abc1e6959b83693f5ed09e040cf018b2e29508cc92246fe76f2",
|
||||
"formalNativeAndHostReportsRecovered": true,
|
||||
"compiledSourceRebuildRecord": "verification/TrackingMidpointRecovery.json",
|
||||
"LFS": false,
|
||||
"submodules": false,
|
||||
"cloneCleaned": true
|
||||
}
|
||||
@@ -60,12 +60,14 @@
|
||||
Plugin/DYDiagnostics.mm,
|
||||
Plugin/DYGrade.metal,
|
||||
Plugin/DYInspector.mm,
|
||||
Plugin/DYTheme.mm,
|
||||
Plugin/DYLUTLibrary.mm,
|
||||
Plugin/DYLUTBrowser.mm,
|
||||
Plugin/DYLUTLibrary.mm,
|
||||
Plugin/DYModel.mm,
|
||||
Plugin/DYPlugIn.mm,
|
||||
Plugin/DYRenderer.mm,
|
||||
Plugin/DYTheme.mm,
|
||||
Plugin/DYToolState.mm,
|
||||
Plugin/DYTracking.metal,
|
||||
Plugin/Info.plist,
|
||||
Plugin/main.m,
|
||||
Plugin/Resources/DayuColorTables.bin,
|
||||
@@ -121,9 +123,9 @@
|
||||
Plugin/Resources/InputLUTs/sony_slog3_sgamut3cine_to_rec709.dylut,
|
||||
"Plugin/Resources/THIRD-PARTY-NOTICES.txt",
|
||||
"Wrapper Application/AppDelegate.m",
|
||||
"Wrapper Application/Resources/DayuColor.icns",
|
||||
"Wrapper Application/Info.plist",
|
||||
"Wrapper Application/main.m",
|
||||
"Wrapper Application/Resources/DayuColor.icns",
|
||||
);
|
||||
target = 04962E5C3095058F009952AA /* XPC Service */;
|
||||
};
|
||||
@@ -376,6 +378,8 @@
|
||||
"-framework",
|
||||
Metal,
|
||||
"-framework",
|
||||
MetalPerformanceShaders,
|
||||
"-framework",
|
||||
QuartzCore,
|
||||
"-lcompression",
|
||||
"-lz",
|
||||
@@ -407,6 +411,8 @@
|
||||
"-framework",
|
||||
Metal,
|
||||
"-framework",
|
||||
MetalPerformanceShaders,
|
||||
"-framework",
|
||||
QuartzCore,
|
||||
"-lcompression",
|
||||
"-lz",
|
||||
@@ -433,6 +439,8 @@
|
||||
"-framework",
|
||||
Metal,
|
||||
"-framework",
|
||||
MetalPerformanceShaders,
|
||||
"-framework",
|
||||
QuartzCore,
|
||||
"-lcompression",
|
||||
"-lz",
|
||||
@@ -458,6 +466,8 @@
|
||||
"-framework",
|
||||
Metal,
|
||||
"-framework",
|
||||
MetalPerformanceShaders,
|
||||
"-framework",
|
||||
QuartzCore,
|
||||
"-lcompression",
|
||||
"-lz",
|
||||
|
||||
+17
-3
@@ -1,3 +1,5 @@
|
||||
#include "DYFilmMath.h"
|
||||
#include "DYFilmTime.h"
|
||||
#import "DYDiagnostics.h"
|
||||
#import "DYModel.h"
|
||||
#import "DYRenderer.h"
|
||||
@@ -13,6 +15,7 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include "DYToolTrackingProbe.inc.h"
|
||||
|
||||
// Fake host objects implement the real selectors used by the model and renderer.
|
||||
// They never connect to a host document or enter the FxPrincipal service loop.
|
||||
@@ -56,9 +59,12 @@
|
||||
- (BOOL)addFloatSliderWithName:(NSString *)name parameterID:(UInt32)pid defaultValue:(double)value parameterMin:(double)minimum parameterMax:(double)maximum sliderMin:(double)sliderMinimum sliderMax:(double)sliderMaximum delta:(double)delta parameterFlags:(FxParameterFlags)flags {
|
||||
if(_values[@(pid)]||_custom[@(pid)]){_duplicate=YES;return NO;}_values[@(pid)]=@(value);return YES;
|
||||
}
|
||||
- (BOOL)addStringParameterWithName:(NSString*)name parameterID:(UInt32)pid defaultValue:(NSString*)value parameterFlags:(FxParameterFlags)flags{if(_values[@(pid)]||_custom[@(pid)]){_duplicate=YES;return NO;}_custom[@(pid)]=value;return YES;}
|
||||
- (BOOL)addCustomParameterWithName:(NSString *)name parameterID:(UInt32)pid defaultValue:(NSObject<NSSecureCoding,NSCopying> *)value parameterFlags:(FxParameterFlags)flags {
|
||||
if(_values[@(pid)]||_custom[@(pid)]){_duplicate=YES;return NO;}_custom[@(pid)]=value;return YES;
|
||||
}
|
||||
- (BOOL)getStringParameterValue:(NSString**)value fromParameter:(UInt32)pid{id string=_custom[@(pid)];if(![string isKindOfClass:NSString.class])return NO;if(value)*value=string;return YES;}
|
||||
- (BOOL)setStringParameterValue:(NSString*)value toParameter:(UInt32)pid{if(![_custom[@(pid)]isKindOfClass:NSString.class])return NO;_custom[@(pid)]=value;return YES;}
|
||||
- (BOOL)getFloatValue:(double *)value fromParameter:(UInt32)pid atTime:(CMTime)time {
|
||||
NSNumber *stored=_values[@(pid)];if(!stored)return NO;if(value)*value=stored.doubleValue;return YES;
|
||||
}
|
||||
@@ -104,6 +110,7 @@
|
||||
- (FxRect)imagePixelBounds {return _bounds;}
|
||||
- (uint64_t)deviceRegistryID {return _registry;}
|
||||
- (FxImageOrigin)imageOrigin {return _diagnosticOrigin;}
|
||||
- (double)pixelAspect{return 1;}
|
||||
- (void)setDiagnosticImageOrigin:(FxImageOrigin)origin {_diagnosticOrigin=origin;}
|
||||
@end
|
||||
|
||||
@@ -173,7 +180,7 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
|
||||
for(NSDictionary *section in sections){BOOL base=YES;for(NSDictionary *row in descriptors)if([row[@"pid"]isEqual:section[@"enabled"]])initialGroups&=([row[@"default"]doubleValue]>=.5)==base;}
|
||||
run.record(@"all-module-eyes-enabled-by-default",initialGroups);
|
||||
DYDiagnosticManager *manager=[[[DYDiagnosticManager alloc]init]autorelease];error=nil;
|
||||
run.need(@"native-parameter-creation",DYCreateParameters(manager,&error)&&!manager->_duplicate&&manager->_values.count==descriptors.count&&manager->_custom.count==2,@{@"error":reason(error)});
|
||||
run.need(@"native-parameter-creation",DYCreateParameters(manager,&error)&&!manager->_duplicate&&manager->_values.count==descriptors.count&&manager->_custom.count==4,@{@"error":reason(error)});
|
||||
id<FxParameterSettingAPI_v6> setter=[manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];id<FxParameterRetrievalAPI_v6> getter=[manager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];
|
||||
[setter setFloatValue:.75 toParameter:2000 atTime:kCMTimeZero];double value=0;[getter getFloatValue:&value fromParameter:2000 atTime:kCMTimeZero];DYUniforms restored;DYReadUniforms(manager,kCMTimeZero,&restored);
|
||||
run.record(@"native-get-set-model-roundtrip",value==.75&&restored.exposure==.75f);
|
||||
@@ -212,7 +219,7 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
|
||||
NSWindow *interactionWindow=[[[NSWindow alloc]initWithContentRect:NSMakeRect(0,0,400,780) styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO]autorelease];interactionWindow.contentView=inspector;[inspector layoutSubtreeIfNeeded];
|
||||
NSArray *graphics=[inspector valueForKey:@"graphics"];NSView *wheel=nil;for(NSView *graphic in graphics)if([NSStringFromClass(graphic.class)isEqual:@"DYPrimaryBalanceWheel"])wheel=graphic;
|
||||
run.need(@"primary-balance-wheel-restored-and-palette-loaded",wheel&&[wheel valueForKey:@"wheel"]!=nil);
|
||||
BOOL merged=cards.count==12&&[cards[0][@"section"][@"key"]isEqual:@"primary"]&&[cards[1][@"section"][@"key"]isEqual:@"spider"];for(NSDictionary *card in cards)merged&=![@[@"input",@"output"]containsObject:card[@"section"][@"key"]];
|
||||
BOOL merged=cards.count==14&&[cards[0][@"section"][@"key"]isEqual:@"primary"]&&[cards[1][@"section"][@"key"]isEqual:@"spider"];for(NSDictionary *card in cards)merged&=![@[@"input",@"output"]containsObject:card[@"section"][@"key"]];
|
||||
NSDictionary *controls=[inspector valueForKey:@"controls"];for(NSDictionary *record in controls.allValues)merged&=![[record[@"descriptor"]objectForKey:@"key"]hasPrefix:@"cmbypass"];
|
||||
run.record(@"single-primary-card-no-bypass-checkboxes",merged);
|
||||
auto mouseFor=[&](NSView *view,NSEventType type,NSPoint point,NSEventModifierFlags flags=0,NSInteger clicks=1){return [NSEvent mouseEventWithType:type location:[view convertPoint:point toView:nil] modifierFlags:flags timestamp:0 windowNumber:interactionWindow.windowNumber context:nil eventNumber:0 clickCount:clicks pressure:type==NSEventTypeLeftMouseUp?0:1];};
|
||||
@@ -234,7 +241,7 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
|
||||
run.record(@"spider-single-drag-spoke-following-and-pin",dragged.x[0]>initialMesh.x[0]&&dragged.x[1]>initialMesh.x[1]&&dragged.x[3]>initialMesh.x[3]&&dragged.x[4]==initialMesh.x[4]&&dragged.x[5]==initialMesh.x[5]&&dragged.pins[2]);
|
||||
run.record(@"spider-drag-one-host-undo-group",uiHost->_undoStarts==starts+1&&uiHost->_undoEnds==ends+1&&!uiHost->_undoActive);
|
||||
error=nil;NSData *spiderArchive=[NSKeyedArchiver archivedDataWithRootObject:spiderSaved requiringSecureCoding:YES error:&error];DYAssetState *decodedSpider=[NSKeyedUnarchiver unarchivedObjectOfClass:DYAssetState.class fromData:spiderArchive error:&error];run.record(@"spider-archive-retains-mesh-pins-and-lut-paths",decodedSpider&&[decodedSpider isEqual:spiderSaved],@{@"error":reason(error)});
|
||||
NSDictionary *snapshot=[inspector performSelector:@selector(presetSnapshot)];NSData *presetJSON=[NSJSONSerialization dataWithJSONObject:snapshot options:0 error:&error];NSDictionary *decodedPreset=[NSJSONSerialization JSONObjectWithData:presetJSON options:0 error:&error];run.record(@"complete-version-three-preset-includes-mesh",[decodedPreset[@"version"]isEqual:@3]&&[DYSpiderFromJSON(decodedPreset[@"spider"])isEqual:spiderSaved.spiderMesh]);
|
||||
NSDictionary *snapshot=[inspector performSelector:@selector(presetSnapshot)];NSData *presetJSON=[NSJSONSerialization dataWithJSONObject:snapshot options:0 error:&error];NSDictionary *decodedPreset=[NSJSONSerialization JSONObjectWithData:presetJSON options:0 error:&error];run.record(@"complete-version-five-preset-includes-mesh",[decodedPreset[@"version"]isEqual:@5]&&[DYSpiderFromJSON(decodedPreset[@"spider"])isEqual:spiderSaved.spiderMesh]);
|
||||
NSDictionary *portable=DYSpiderJSON(spiderSaved.spiderMesh,spiderSaved.spiderLinked);NSData *decodedPortable=DYSpiderFromJSON(portable);run.record(@"spider-json-preset-exact-roundtrip",[decodedPortable isEqual:spiderSaved.spiderMesh]);
|
||||
NSMutableDictionary *badJSON=[[portable mutableCopy]autorelease];badJSON[@"hues"]=@7;run.record(@"spider-json-rejects-unsupported-topology",!DYSpiderFromJSON(badJSON));auto corrupt=dragged;corrupt.x[0]=NAN;run.record(@"spider-archive-rejects-nonfinite-coordinates",!DYSpiderMeshIsValid([NSData dataWithBytes:&corrupt length:sizeof(corrupt)]));
|
||||
[disc changeHueCount:12 saturationCount:8];spiderSaved=DYReadAssets(uiHost,kCMTimeZero);auto dense=DYSpiderMesh(spiderSaved.spiderMesh);run.record(@"spider-independent-resolution-and-resample",dense.hues==12&&dense.rings==7&&fabs(dy::meshDelta(dense,0,.6).x)>0);
|
||||
@@ -412,6 +419,13 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
|
||||
}}
|
||||
run.record(@"user-folder-all-luts-prepared-and-rendered",userCount>0&&allUserFrames,@{@"files":@(userCount),@"sourceFolder":userFolder,@"sourceFilesModified":@NO});
|
||||
}
|
||||
#include "DYToolDiagnostics.inc.h"
|
||||
#include "DYToolInsertionDiagnostics.inc.h"
|
||||
#include "DYFilmDiagnostics.inc.h"
|
||||
#include "DYToolTrackingDiagnostics.inc.h"
|
||||
#include "DYToolCanvasDiagnostics.inc.h"
|
||||
#include "DYToolPenDiagnostics.inc.h"
|
||||
#include "DYMaskPanelDiagnostics.inc.h"
|
||||
[gpu release];
|
||||
} @catch(NSException *exception) {
|
||||
run.record(@"diagnostic-exception",false,@{@"exception":exception.name?:@"unknown",@"message":exception.reason?:@"unknown"});
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
DYToolDocument *empty=[[[DYToolDocument alloc]init]autorelease];
|
||||
auto uploadFilm=[&](const Pixels& pixels){[[source metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:pixels.data() bytesPerRow:width*8];};
|
||||
auto filmRender=[&](DYUniforms value,NSDictionary *tools,NSString *name){NSError *failure=nil;BOOL ok=[renderer renderSource:source destination:destination uniforms:value paths:@{} spider:nil tools:tools?:empty.document error:&failure];run.need(name,ok,@{@"error":reason(failure)});return read(destination,gpu);};
|
||||
uploadFilm(input);DYUniforms neutral=DYToolUniforms(@{@"type":@"mixer"});neutral.mixerSectionEnabled=1;
|
||||
Pixels before=filmRender(neutral,nil,@"film-neutral-production-render");
|
||||
run.record(@"new-tools-default-to-neutral",!DYChannelMixerActive(neutral)&&!DYFilmActive(defaults.film)&&DYToolTypes().count==14&&DYToolIsNeutral(DYNewTool(@"film"))&&DYToolIsNeutral(DYNewTool(@"mixer")));
|
||||
BOOL alpha=YES;for(size_t i=0;i<before.size()/4;i++)alpha&=before[i*4+3]==input[i*4+3];run.record(@"new-neutral-tools-preserve-existing-alpha",alpha);
|
||||
DYUniforms matrix=neutral;matrix.mixerRed=(DYFloat4){.8,.25,-.05,0};matrix.mixerBlue=(DYFloat4){.1,0,.9,0};
|
||||
Pixels mixed=filmRender(matrix,nil,@"channel-mixer-production-render");auto delta=difference(before,mixed);run.record(@"channel-mixer-affects-real-frame",delta.different>50&&delta.nonfinite==0,measure(delta));
|
||||
matrix.mixerSectionEnabled=0;Pixels bypass=filmRender(matrix,nil,@"channel-mixer-eye-bypass-render");run.record(@"channel-mixer-eye-exact-bypass",difference(before,bypass).maximum==0);
|
||||
matrix.mixerSectionEnabled=1;matrix.mixerMix=0;bypass=filmRender(matrix,nil,@"channel-mixer-zero-render");run.record(@"channel-mixer-zero-exact-bypass",difference(before,bypass).maximum==0);
|
||||
for(int stage=0;stage<5;stage++){
|
||||
DYUniforms value=neutral;value.film.enabled=1;
|
||||
if(stage==0){value.film.subtractiveEnabled=1;value.film.gammaCyan=1.4;value.film.gammaYellow=.8;value.film.density=.35;}
|
||||
if(stage==1){value.film.halationEnabled=1;value.film.scatter=4;value.film.boost=2;value.film.dyeTransmission=60;}
|
||||
if(stage==2){value.film.bloomEnabled=1;value.film.sensitivity=1;value.film.diffusion=3;value.film.intensity=75;}
|
||||
if(stage==3){value.film.grainEnabled=1;value.film.grainAmount=.7;value.film.grainColor=.35;value.film.grainSize=3;value.filmFrameKey=7;}
|
||||
if(stage==4){value.film.vignetteEnabled=1;value.film.vignetteIntensity=1;value.film.vignetteRadius=15;}
|
||||
Pixels after=filmRender(value,nil,[NSString stringWithFormat:@"film-stage-%d-production",stage]);Difference change=difference(before,after);BOOL sameAlpha=YES;for(size_t i=0;i<after.size()/4;i++)sameAlpha&=after[i*4+3]==before[i*4+3];run.record([NSString stringWithFormat:@"film-stage-%d-finite-active-alpha",stage],change.different>20&&change.nonfinite==0&&sameAlpha,measure(change));
|
||||
if(stage==3){Pixels repeat=filmRender(value,nil,@"grain-random-access-repeat");run.record(@"grain-identical-frozen-frame-is-bit-exact",difference(after,repeat).maximum==0);value.filmFrameKey=8;Pixels next=filmRender(value,nil,@"grain-next-frozen-frame");run.record(@"grain-frame-changes-noise",difference(after,next).different>100);}
|
||||
value.film.mix=0;bypass=filmRender(value,nil,[NSString stringWithFormat:@"film-stage-%d-zero-mix",stage]);run.record([NSString stringWithFormat:@"film-stage-%d-zero-is-exact",stage],difference(before,bypass).maximum==0);
|
||||
value.film.mix=1;value.film.enabled=0;bypass=filmRender(value,nil,[NSString stringWithFormat:@"film-stage-%d-eye-off",stage]);run.record([NSString stringWithFormat:@"film-stage-%d-eye-preserves-old-frame",stage],difference(before,bypass).maximum==0);
|
||||
}
|
||||
DYUniforms originGrain=neutral;originGrain.film.enabled=1;originGrain.film.grainEnabled=1;originGrain.film.grainAmount=.7;originGrain.filmFrameKey=31;
|
||||
Pixels topGrain=filmRender(originGrain,nil,@"grain-top-origin-render"),bottomInput(input.size());for(NSUInteger y=0;y<height;y++)memcpy(bottomInput.data()+y*width*4,input.data()+(height-1-y)*width*4,width*8);uploadFilm(bottomInput);[source setDiagnosticImageOrigin:kFxImageOrigin_BOTTOM_LEFT];Pixels bottomGrain=filmRender(originGrain,nil,@"grain-bottom-origin-render");run.record(@"grain-canonical-coordinates-survive-texture-origin",difference(topGrain,bottomGrain).maximum==0,measure(difference(topGrain,bottomGrain)));[source setDiagnosticImageOrigin:kFxImageOrigin_TOP_LEFT];uploadFilm(input);
|
||||
CMTime duration=CMTimeMake(1001,30000),origin=CMTimeMake(17,3);BOOL rational=YES;
|
||||
for(int i=-12;i<=12;i++){CMTime t=CMTimeAdd(origin,CMTimeMultiply(duration,i));rational&=DYFilmFrameIndex(t,duration,origin)==i;for(int hold=1;hold<=5;hold++)rational&=DYFilmFrameKey(i,hold,0)==(uint32_t)(int64_t)floor(double(i)/hold);}
|
||||
rational&=DYFilmFrameIndex(CMTimeMake(-1,1000000),duration,kCMTimeZero)==-1;
|
||||
run.record(@"grain-exact-ntsc-signed-frame-and-hold",rational);
|
||||
NSMutableDictionary *doc=DYMutablePlist(empty.document);NSMutableDictionary *mixer=(id)DYInsertTool(doc,@"mixer",@"base:mixer");mixer[@"values"][@"mixer01"]=@.3;
|
||||
NSMutableDictionary *film=(id)DYInsertTool(doc,@"film",mixer[@"id"]);film[@"values"][@"filmSubtractive"]=@1;film[@"values"][@"filmGammaCyan"]=@1.5;
|
||||
run.record(@"film-mixer-adjacent-schema-two-valid",DYValidToolDocument(doc)&&[[DYToolDisplayOrder(doc) objectAtIndex:13]isEqual:mixer[@"id"]]&&[[DYToolDisplayOrder(doc)objectAtIndex:14]isEqual:film[@"id"]]);
|
||||
Pixels layered=filmRender(neutral,doc,@"film-mixer-adjacent-render");run.record(@"film-mixer-adjacent-layers-affect-frame",difference(before,layered).different>50);
|
||||
NSMutableDictionary *mask=DYMutablePlist(DYNewMask(DYMaskRectangle));DYMaskParameters p=DYMaskAtTime(mask,kCMTimeZero);p.strength=0;mask[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];[mixer[@"masks"]addObject:mask];[film[@"masks"]addObject:DYMutablePlist(DYNewMask(DYMaskEllipse))];
|
||||
DYToolDocument *saved=[[[DYToolDocument alloc]init]autorelease];saved.document=doc;NSData *archive=[NSKeyedArchiver archivedDataWithRootObject:saved requiringSecureCoding:YES error:&error];DYToolDocument *restored=[NSKeyedUnarchiver unarchivedObjectOfClass:DYToolDocument.class fromData:archive error:&error];run.record(@"film-mixer-mask-archive-exact-roundtrip",[saved isEqual:restored]);
|
||||
NSMutableDictionary *baseMask=DYMutablePlist(empty.document);baseMask[@"baseMasks"][@"film"]=@[mask];DYUniforms masked=neutral;masked.film.enabled=1;masked.film.grainEnabled=1;masked.film.grainAmount=.5;Pixels zeroMask=filmRender(masked,baseMask,@"film-zero-mask-render");run.record(@"film-zero-mask-exact-source",difference(before,zeroMask).maximum==0);
|
||||
NSURL *cube=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"film-mixer.cube"]];error=nil;
|
||||
BOOL rejected=![renderer exportLUT:cube uniforms:masked paths:@{} spider:nil tools:empty.document error:&error];run.record(@"grain-rejected-by-static-cube",rejected&&error!=nil);
|
||||
masked.film.grainEnabled=0;masked.film.subtractiveEnabled=1;masked.film.gammaAll=1.1;error=nil;run.record(@"pure-subtractive-cube-supported",[renderer exportLUT:cube uniforms:masked paths:@{} spider:nil tools:empty.document error:&error],@{@"error":reason(error)});
|
||||
masked=matrix;masked.mixerMix=1;error=nil;run.record(@"channel-mixer-cube-supported",[renderer exportLUT:cube uniforms:masked paths:@{} spider:nil tools:empty.document error:&error],@{@"error":reason(error)});
|
||||
uploadFilm(input);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// Included after DYGrade.metal's sRGB boundary helpers.
|
||||
#include "DYFilmMath.h"
|
||||
struct DYFilmPass {int operation;float radius;uint frameKey;uint reserved;};
|
||||
kernel void dyFilmPoint(texture2d<float,access::read> source [[texture(0)]],texture2d<float,access::read> auxiliary [[texture(1)]],texture2d<float,access::write> output [[texture(2)]],constant DYUniforms& uniforms [[buffer(0)]],constant DYFilmPass& pass [[buffer(1)]],uint2 pos [[thread_position_in_grid]]){
|
||||
if(pos.x>=output.get_width()||pos.y>=output.get_height())return;
|
||||
float4 pixel=source.read(pos);if(!(pixel.a>0)){output.write(pixel,pos);return;}
|
||||
float3 c=pixel.rgb/pixel.a,result=c;DYFilmSettings film=uniforms.film;
|
||||
if(pass.operation==0)result=dyDecode(dyFilmMixer(dyEncode(c),uniforms));
|
||||
else if(pass.operation==1)result=dyDecode(dyFilmSubtractive(dyEncode(c),film));
|
||||
else if(pass.operation==2){float3 b=auxiliary.read(pos).rgb;float3 w=float3(film.boost,film.dyeTransmission/500.f,0);result=(c+b*w)/(1+w);}
|
||||
else if(pass.operation==3)result=c+auxiliary.read(pos).rgb;
|
||||
else if(pass.operation==4)result=dyDecode(dyFilmGrain(dyEncode(c),auxiliary.read(pos).rgb,film));
|
||||
else if(pass.operation==5){float4 filtered=auxiliary.read(pos);result=filtered.rgb/pixel.a;}
|
||||
float amount=pass.operation==0?uniforms.mixerMix:1;
|
||||
pixel.rgb=dyLimit((c*(1-amount)+result*amount)*pixel.a);output.write(pixel,pos);
|
||||
}
|
||||
kernel void dyFilmNoise(texture2d<float,access::write> output [[texture(0)]],constant uint& seed [[buffer(0)]],constant uint& bottomOrigin [[buffer(1)]],uint2 pos [[thread_position_in_grid]]){
|
||||
if(pos.x>=output.get_width()||pos.y>=output.get_height())return;uint y=bottomOrigin?output.get_height()-1-pos.y:pos.y;output.write(float4(dyFilmNormal(pos.x,y,seed),1),pos);
|
||||
}
|
||||
// Separable form of the reference's sparse 5x5 prefilter: same 25 weighted
|
||||
// samples, followed by its 3x3 vector Sobel norm. Only two 5-tap passes.
|
||||
kernel void dyFilmSparseBlur(texture2d<float,access::sample> source [[texture(0)]],texture2d<float,access::write> output [[texture(1)]],constant int& vertical [[buffer(0)]],uint2 pos [[thread_position_in_grid]]){
|
||||
if(pos.x>=output.get_width()||pos.y>=output.get_height())return;constexpr sampler f(coord::pixel,address::clamp_to_edge,filter::linear);
|
||||
float3 value=0;float total=0;float radius=2.5f;
|
||||
for(int i=-2;i<=2;i++){float weight=exp(-float(i*i)/(2*radius*radius));float2 delta=vertical?float2(0,i*radius):float2(i*radius,0);value+=source.sample(f,float2(pos)+.5f+delta).rgb*weight;total+=weight;}
|
||||
output.write(float4(value/total,1),pos);
|
||||
}
|
||||
inline float3 dyFilmBorderPrefilter(texture2d<float,access::sample> source,float2 coordinate){
|
||||
constexpr sampler f(coord::pixel,address::clamp_to_edge,filter::linear);float3 value=0;float sum=0;
|
||||
for(int x=-2;x<=2;x++)for(int y=-2;y<=2;y++){float weight=exp(-float(x*x+y*y)/12.5f);value+=source.sample(f,coordinate+float2(x,y)*2.5f).rgb*weight;sum+=weight;}return value/sum;
|
||||
}
|
||||
kernel void dyFilmBloomEdges(texture2d<float,access::sample> blurred [[texture(0)]],texture2d<float,access::sample> original [[texture(1)]],texture2d<float,access::write> output [[texture(2)]],constant DYFilmSettings& film [[buffer(0)]],uint2 pos [[thread_position_in_grid]]){
|
||||
if(pos.x>=output.get_width()||pos.y>=output.get_height())return;constexpr sampler f(coord::pixel,address::clamp_to_edge,filter::linear);
|
||||
float3 gx=0,gy=0;
|
||||
bool border=pos.x==0||pos.y==0||pos.x+1==output.get_width()||pos.y+1==output.get_height();
|
||||
for(int x=-1;x<=1;x++)for(int y=-1;y<=1;y++){float2 coordinate=float2(pos)+.5f+float2(x,y);float3 c=border?dyFilmBorderPrefilter(original,coordinate):blurred.sample(f,coordinate).rgb;gx+=c*float(y)*(x==0?2.f:1.f);gy+=c*float(x)*(y==0?2.f:1.f);}
|
||||
float magnitude=sqrt(dot(gx,gx)+dot(gy,gy)),a=original.read(pos).a;
|
||||
float strength=magnitude>=film.sensitivity/100.f?film.intensity/100.f:0;
|
||||
output.write(float4(float3(strength*a),a),pos);
|
||||
}
|
||||
kernel void dyFilmMix(texture2d<float,access::read> before [[texture(0)]],texture2d<float,access::read> after [[texture(1)]],texture2d<float,access::write> output [[texture(2)]],constant float& amount [[buffer(0)]],uint2 pos [[thread_position_in_grid]]){
|
||||
if(pos.x>=output.get_width()||pos.y>=output.get_height())return;float4 a=before.read(pos),b=after.read(pos);output.write(float4(dyLimit(mix(a.rgb,b.rgb,amount)),a.a),pos);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
#include "DYUniforms.h"
|
||||
#include "SpiderCore/DYColorMath.h"
|
||||
// Re-expressed mathematical contracts from the local reference's AIR.
|
||||
// Research identities, operating domains and deviations: ColorFinaleFilmMixer.md.
|
||||
inline float dyFilmMax(float3 c){return c.x>c.y?(c.x>c.z?c.x:c.z):(c.y>c.z?c.y:c.z);}
|
||||
inline float dyFilmMin(float3 c){return c.x<c.y?(c.x<c.z?c.x:c.z):(c.y<c.z?c.y:c.z);}
|
||||
inline float dyFilmLuma(float3 c){return c.x*.2126f+c.y*.7152f+c.z*.0722f;}
|
||||
inline float dyFilmSat(float3 c){float m=dyFilmMax(c);return m!=0?(m-dyFilmMin(c))/m:0;}
|
||||
inline float3 dyFilmPositive(float3 c){for(int i=0;i<3;i++)if(c[i]<0)c[i]=0;return c;}
|
||||
inline bool DYChannelMixerActive(DYUniforms u){return u.mixerSectionEnabled>.5f&&u.mixerMix>0&&(u.mixerRed.x!=1||u.mixerRed.y!=0||u.mixerRed.z!=0||u.mixerGreen.x!=0||u.mixerGreen.y!=1||u.mixerGreen.z!=0||u.mixerBlue.x!=0||u.mixerBlue.y!=0||u.mixerBlue.z!=1);}
|
||||
inline float3 dyFilmMixer(float3 c,DYUniforms u){
|
||||
float3 r={c.x*u.mixerRed.x+c.y*u.mixerRed.y+c.z*u.mixerRed.z,c.x*u.mixerGreen.x+c.y*u.mixerGreen.y+c.z*u.mixerGreen.z,c.x*u.mixerBlue.x+c.y*u.mixerBlue.y+c.z*u.mixerBlue.z};
|
||||
if(u.mixerPreserveLuma>.5f){r=dyFilmPositive(r);float ratio=dyFilmLuma(c)/dyFilmLuma(r);if(!isfinite(ratio))ratio=1;r*=ratio;}
|
||||
if(u.mixerPreserveSaturation>.5f){float3 p=dyFilmPositive(r);float source=dyFilmSat(c),ratio=source/dyFilmSat(p);if(isfinite(ratio)){float y=dyFilmLuma(p);r=source==0?float3{y,y,y}:float3{y,y,y}*(1-ratio)+p*ratio;}}
|
||||
return r;
|
||||
}
|
||||
inline float dyFilmNorm(float3 c,int mode){
|
||||
if(mode==2)return dyFilmMax(c);
|
||||
if(mode==1)return (c.x+c.y+c.z)/3;
|
||||
if(mode==6){float3 e={exp(c.x*3),exp(c.y*3),exp(c.z*3)};return (e.x*c.x+e.y*c.y+e.z*c.z)/(e.x+e.y+e.z);}
|
||||
return dyFilmMax(c);
|
||||
}
|
||||
inline float3 dyFilmSubtractive(float3 input,DYFilmSettings p){
|
||||
float3 c=input;for(int i=0;i<3;i++)c[i]=dyClamp(c[i],0,1);
|
||||
float n=dyFilmNorm(c,int(p.densityMode));if(n<=0)return float3{0,0,0};
|
||||
float v=dyFilmNorm(c,int(p.valueMode));float weight=n*(1-p.density)+v*p.density;
|
||||
float gamma[3]={p.gammaAll*p.gammaCyan,p.gammaAll*p.gammaMagenta,p.gammaAll*p.gammaYellow};
|
||||
// Both UI density choices (mean/max), and softmax value, normalize white to 1.
|
||||
for(int i=0;i<3;i++)c[i]=dyClamp(weight*pow(c[i]/n,gamma[i]),0,1);
|
||||
return c;
|
||||
}
|
||||
inline DYUInt dyFilmPCG(DYUInt value){DYUInt state=value*747796405u+2891336453u;DYUInt word=((state>>((state>>28u)+4u))^state)*277803737u;return (word>>22u)^word;}
|
||||
inline float3 dyFilmNormal(DYUInt x,DYUInt y,DYUInt seed){
|
||||
DYUInt h=dyFilmPCG(dyFilmPCG(dyFilmPCG(x)^y)^seed);
|
||||
float u1=(float(dyFilmPCG(h^2769414579u)>>8)+.5f)/16777216.f;
|
||||
float u2=(float(dyFilmPCG(h^1675113877u)>>8)+.5f)/16777216.f;
|
||||
float u3=(float(dyFilmPCG(h^2135587861u)>>8)+.5f)/16777216.f;
|
||||
float u4=(float(dyFilmPCG(h^476689394u)>>8)+.5f)/16777216.f;
|
||||
float a=sqrt(-2*log(u1>1e-7f?u1:1e-7f)),b=sqrt(-2*log(u3>1e-7f?u3:1e-7f));
|
||||
return {a*cos(6.28318530718f*u2),a*sin(6.28318530718f*u2),b*cos(6.28318530718f*u4)};
|
||||
}
|
||||
inline float3 dyFilmGrain(float3 c,float3 noise,DYFilmSettings p){
|
||||
float corr=1-2*p.grainColor,other=1-corr,den=sqrt(corr*corr+other*other);
|
||||
float3 n={(corr*noise.y+other*noise.x)/den,noise.y,(corr*noise.y+other*noise.z)/den};
|
||||
float amount=.05f*p.grainAmount*((p.grainSize-1)*.5f+1),offset=p.grainResponse>=0?1-p.grainResponse:1;
|
||||
for(int i=0;i<3;i++){float response=p.grainResponse*c[i]+offset;if(response<0)response=0;c[i]+=n[i]*response*amount;}
|
||||
return c;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// All work uses the renderer instance's lock and frozen state. No vendor code
|
||||
// or vendor runtime is loaded by the product.
|
||||
- (BOOL)renderFilmTool:(NSString*)type source:(FxImageTile*)source destination:(FxImageTile*)destination uniforms:(DYUniforms)u masks:(NSArray*)masks entry:(NSMutableDictionary*)entry error:(NSError**)error {
|
||||
BOOL mixer=[type isEqual:@"mixer"],active=mixer?DYChannelMixerActive(u):DYFilmActive(u.film);
|
||||
if(!active)return [self copyTile:source to:destination entry:entry error:error];
|
||||
id<MTLDevice>d=entry[@"device"];id<MTLTexture>before=[source metalTextureForDevice:d];
|
||||
if(!before)return fail(error,@"胶片输入纹理不可用");
|
||||
// At most two working, two auxiliary half-float textures and two float32
|
||||
// bloom prefilters. Allocate lazily; reuse between all five stages.
|
||||
uint64_t bytes=uint64_t(before.width)*before.height*(mixer?16:DYFilmBloomActive(u.film)?64:32);
|
||||
uint64_t budget=MIN(uint64_t(2)*1024*1024*1024,MAX(uint64_t(512)*1024*1024,d.recommendedMaxWorkingSetSize/3));
|
||||
if(bytes>budget)return fail(error,@"当前画面超过胶片处理内存预算,请降低工程分辨率后重试。");
|
||||
NSMutableArray *textures=[NSMutableArray array];id<MTLTexture>slots[6]={nil,nil,nil,nil,nil,nil};
|
||||
auto texture=[&](int slot)->id<MTLTexture>{if(!slots[slot]){MTLTextureDescriptor *desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:slot>=4?MTLPixelFormatRGBA32Float:MTLPixelFormatRGBA16Float width:before.width height:before.height mipmapped:NO];desc.storageMode=MTLStorageModePrivate;desc.usage=MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite|MTLTextureUsageRenderTarget;id<MTLTexture>t=[d newTextureWithDescriptor:desc];if(t){[textures addObject:t];slots[slot]=t;[t release];}}return slots[slot];};
|
||||
CIContext *context=entry[@"filmCIContext"];if(!context){context=[CIContext contextWithMTLDevice:d options:@{kCIContextWorkingColorSpace:NSNull.null,kCIContextOutputColorSpace:NSNull.null,kCIContextCacheIntermediates:@NO}];if(!context)return fail(error,@"胶片空间处理器不可用");entry[@"filmCIContext"]=context;}
|
||||
CGRect bounds=CGRectMake(0,0,before.width,before.height);id<MTLCommandBuffer>commands=[entry[@"queue"]commandBuffer];
|
||||
auto image=[&](id<MTLTexture>t){return [CIImage imageWithMTLTexture:t options:@{kCIImageColorSpace:NSNull.null}];};
|
||||
auto blur=[&](id<MTLTexture>input,id<MTLTexture>output,float radius,BOOL clamp){
|
||||
CIImage *ci=image(input);if(!ci)return NO;if(clamp)ci=[ci imageByClampingToExtent];
|
||||
ci=[[ci imageByApplyingFilter:@"CIGaussianBlur" withInputParameters:@{kCIInputRadiusKey:@(radius)}]imageByCroppingToRect:bounds];
|
||||
[context render:ci toMTLTexture:output commandBuffer:commands bounds:bounds colorSpace:nil];return YES;
|
||||
};
|
||||
auto encode=[&](NSString *name,id<MTLTexture>a,id<MTLTexture>b,id<MTLTexture>out,const void *data,NSUInteger length){
|
||||
id<MTLComputeCommandEncoder>ce=[commands computeCommandEncoder];[ce setComputePipelineState:entry[name]];[ce setTexture:a atIndex:0];if(b)[ce setTexture:b atIndex:1];[ce setTexture:out atIndex:b?2:1];if(data)[ce setBytes:data length:length atIndex:0];[ce dispatchThreads:MTLSizeMake(out.width,out.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];
|
||||
};
|
||||
id<MTLTexture>current=before;
|
||||
auto point=[&](int operation,id<MTLTexture>aux){id<MTLTexture>out=texture(current==slots[0]?1:0);if(!out)return NO;struct {int operation;float radius;unsigned frameKey,reserved;}pass={operation,0,u.filmFrameKey,0};id<MTLComputeCommandEncoder>ce=[commands computeCommandEncoder];[ce setComputePipelineState:entry[@"dyFilmPoint"]];[ce setTexture:current atIndex:0];[ce setTexture:aux?:current atIndex:1];[ce setTexture:out atIndex:2];[ce setBytes:&u length:sizeof(u) atIndex:0];[ce setBytes:&pass length:sizeof(pass) atIndex:1];[ce dispatchThreads:MTLSizeMake(out.width,out.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];current=out;return YES;};
|
||||
@try{
|
||||
if(mixer){if(!point(0,nil))return fail(error,@"无法分配通道混合缓冲区");}
|
||||
else {
|
||||
if(DYFilmSubActive(u.film)&&!point(1,nil))return fail(error,@"无法分配减色缓冲区");
|
||||
if(DYFilmHaloActive(u.film)){id<MTLTexture>aux=texture(2);if(!aux||!blur(current,aux,u.film.scatter,YES)||!point(2,aux))return fail(error,@"晕光空间处理失败");}
|
||||
if(DYFilmBloomActive(u.film)){
|
||||
id<MTLTexture>a=texture(4),b=texture(5),edges=texture(2),spread=texture(3);if(!a||!b||!edges||!spread)return fail(error,@"无法分配辉光缓冲区");
|
||||
int direction=0;encode(@"dyFilmSparseBlur",current,nil,a,&direction,sizeof(direction));direction=1;encode(@"dyFilmSparseBlur",a,nil,b,&direction,sizeof(direction));
|
||||
encode(@"dyFilmBloomEdges",b,current,edges,&u.film,sizeof(u.film));if(!blur(edges,spread,u.film.diffusion,NO)||!point(3,spread))return fail(error,@"辉光空间处理失败");
|
||||
}
|
||||
if(DYFilmGrainActive(u.film)){
|
||||
id<MTLTexture>noise=texture(2);if(!noise)return fail(error,@"无法分配颗粒缓冲区");
|
||||
id<MTLComputeCommandEncoder>ce=[commands computeCommandEncoder];[ce setComputePipelineState:entry[@"dyFilmNoise"]];[ce setTexture:noise atIndex:0];[ce setBytes:&u.filmFrameKey length:4 atIndex:0];unsigned bottom=source.imageOrigin==kFxImageOrigin_BOTTOM_LEFT;[ce setBytes:&bottom length:4 atIndex:1];[ce dispatchThreads:MTLSizeMake(noise.width,noise.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];
|
||||
if(u.film.grainSize>1){id<MTLTexture>smooth=texture(3);if(!smooth)return fail(error,@"无法分配颗粒扩散缓冲区");
|
||||
// Reference radius=2. Recover the same sigma search without frame state.
|
||||
double sigma=1,step=1;for(int iteration=0;iteration<20000;iteration++){double density=exp(-4/(sigma*sigma))/(sigma*sigma*6.283185307179586);if(.02/5<density){if(step<=.02)break;sigma-=step;step*=.1;}sigma+=step;if(sigma>1000){sigma=1;break;}}
|
||||
MPSImageGaussianBlur *gaussian=[[[MPSImageGaussianBlur alloc]initWithDevice:d sigma:float(sigma*u.film.grainSize/5)]autorelease];gaussian.edgeMode=MPSImageEdgeModeClamp;[gaussian encodeToCommandBuffer:commands sourceTexture:noise destinationTexture:smooth];noise=smooth;
|
||||
}
|
||||
if(!point(4,noise))return fail(error,@"颗粒处理失败");
|
||||
}
|
||||
if(DYFilmVignetteActive(u.film)){
|
||||
id<MTLTexture>aux=texture(2);if(!aux)return fail(error,@"无法分配暗角缓冲区");CIImage *ci=image(current);if(!ci)return fail(error,@"暗角输入不可用");
|
||||
ci=[ci imageByApplyingFilter:@"CIVignetteEffect" withInputParameters:@{kCIInputCenterKey:[CIVector vectorWithX:before.width*.5 Y:before.height*.5],kCIInputIntensityKey:@(u.film.vignetteIntensity),kCIInputRadiusKey:@(u.film.vignetteRadius/100.f*MAX(before.width,before.height)),@"inputFalloff":@(u.film.vignetteFalloff)}];[context render:ci toMTLTexture:aux commandBuffer:commands bounds:bounds colorSpace:nil];if(!point(5,aux))return fail(error,@"暗角处理失败");
|
||||
}
|
||||
if(u.film.mix<1){id<MTLTexture>out=texture(current==slots[0]?1:0);if(!out)return fail(error,@"无法分配胶片混合缓冲区");encode(@"dyFilmMix",before,current,out,&u.film.mix,4);current=out;}
|
||||
}
|
||||
// Finish the effect before the module's existing mask blend. Source and
|
||||
// result retain identical alpha, and an empty mask group means full coverage.
|
||||
if(masks.count){id<MTLTexture>out=texture(current==slots[0]?1:0);if(!out)return fail(error,@"无法分配胶片蒙版缓冲区");DYToolMaskHeader header{};header.section=(int)[DYToolTypes()indexOfObject:type];id<MTLBuffer>buffer=[self maskBuffer:@{type:masks} tile:source device:d header:&header];[self encodeBlend:before after:current output:out masks:buffer header:header entry:entry commands:commands];current=out;}
|
||||
[commands commit];[commands waitUntilCompleted];if(commands.status!=MTLCommandBufferStatusCompleted)return fail(error,commands.error.localizedDescription);
|
||||
DYExportTile *result=[[[DYExportTile alloc]initWithTexture:current registry:d.registryID]autorelease];[result setBounds:source.tilePixelBounds origin:source.imageOrigin];[result setPixelAspect:source.pixelAspect];return [self copyTile:result to:destination entry:entry error:error];
|
||||
}@catch(NSException *exception){return fail(error,[@"胶片处理失败:" stringByAppendingString:exception.reason?:@""]);}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#import <CoreMedia/CoreMedia.h>
|
||||
#include <stdint.h>
|
||||
// Exact signed rational floor. Freeze once in pluginState, never from wall time.
|
||||
inline int64_t DYFilmFrameIndex(CMTime time,CMTime duration,CMTime origin){
|
||||
if(!CMTIME_IS_NUMERIC(time))return 0;
|
||||
if(!CMTIME_IS_NUMERIC(duration)||duration.value<=0)duration=CMTimeMake(1,30);
|
||||
if(CMTIME_IS_NUMERIC(origin)&&origin.epoch==time.epoch)time=CMTimeSubtract(time,origin);
|
||||
__int128 n=(__int128)time.value*duration.timescale,d=(__int128)time.timescale*duration.value;
|
||||
if(d<=0)return 0;__int128 q=n/d;if(n<0&&n%d)q--;
|
||||
if(q>INT64_MAX)return INT64_MAX;if(q<INT64_MIN)return INT64_MIN;return (int64_t)q;
|
||||
}
|
||||
inline uint32_t DYFilmFrameKey(int64_t frame,float hold,float seed){
|
||||
int64_t divisor=(int64_t)llroundf(hold);if(divisor<1)divisor=1;if(divisor>5)divisor=5;
|
||||
int64_t value=frame/divisor;if(frame<0&&frame%divisor)value--;
|
||||
return (uint32_t)value+(uint32_t)llroundf(seed);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
// Host float parameters, appended after the complete 1.4.3 uniform prefix.
|
||||
typedef struct DYFilmSettings {
|
||||
float enabled,mix;
|
||||
float subtractiveEnabled,gammaAll,gammaCyan,gammaMagenta,gammaYellow,density,densityMode,valueMode;
|
||||
float halationEnabled,scatter,dyeTransmission,boost;
|
||||
float bloomEnabled,sensitivity,diffusion,intensity;
|
||||
float grainEnabled,grainAmount,grainSize,grainResponse,grainColor,grainHold,grainSeed;
|
||||
float vignetteEnabled,vignetteIntensity,vignetteRadius,vignetteFalloff;
|
||||
} DYFilmSettings;
|
||||
|
||||
inline bool DYFilmSubActive(DYFilmSettings p){return p.subtractiveEnabled>.5f&&(p.gammaAll!=1||p.gammaCyan!=1||p.gammaMagenta!=1||p.gammaYellow!=1||p.density!=0);}
|
||||
inline bool DYFilmHaloActive(DYFilmSettings p){return p.halationEnabled>.5f&&p.scatter>0&&(p.boost>0||p.dyeTransmission>0);}
|
||||
inline bool DYFilmBloomActive(DYFilmSettings p){return p.bloomEnabled>.5f&&p.intensity>0;}
|
||||
inline bool DYFilmGrainActive(DYFilmSettings p){return p.grainEnabled>.5f&&p.grainAmount>0&&p.grainSize>0;}
|
||||
inline bool DYFilmVignetteActive(DYFilmSettings p){return p.vignetteEnabled>.5f&&p.vignetteIntensity!=0;}
|
||||
inline bool DYFilmSpatialActive(DYFilmSettings p){return DYFilmHaloActive(p)||DYFilmBloomActive(p)||DYFilmGrainActive(p)||DYFilmVignetteActive(p);}
|
||||
inline bool DYFilmActive(DYFilmSettings p){return p.enabled>.5f&&p.mix>0&&(DYFilmSubActive(p)||DYFilmSpatialActive(p));}
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <metal_stdlib>
|
||||
#include "DYUniforms.h"
|
||||
#include "DYToolGPU.h"
|
||||
#include "SpiderCore/DYColorMath.h"
|
||||
using namespace metal;
|
||||
|
||||
@@ -11,6 +12,18 @@ extern "C" half4 dy_grade(half4 sample, float2 uv, texture2d<half> source,
|
||||
texture3d<float> hslMixer, texture3d<float> whiteBalance,
|
||||
texture3d<float> colorGrading, constant DYUniforms& uniforms,
|
||||
constant float& sceneLevel);
|
||||
extern "C" half4 dy_gradeMasked(half4 sample, float2 uv, texture2d<half> source,
|
||||
texture3d<float> preLUT, texture3d<float> look1, texture3d<float> look2,
|
||||
texture3d<float> look3, texture3d<float> look4, texture3d<float> look5,
|
||||
texture3d<float> hslMixer, texture3d<float> whiteBalance,
|
||||
texture3d<float> colorGrading, constant DYUniforms& uniforms,
|
||||
constant float& sceneLevel,float w0,float w1,float w2,float w3,float w4,float w5,float w6,float w7,float w8,float w9,float w10,float w11);
|
||||
extern "C" half4 dy_gradeSegment(half4 sample, float2 uv, texture2d<half> source,
|
||||
texture3d<float> preLUT, texture3d<float> look1, texture3d<float> look2,
|
||||
texture3d<float> look3, texture3d<float> look4, texture3d<float> look5,
|
||||
texture3d<float> hslMixer, texture3d<float> whiteBalance,
|
||||
texture3d<float> colorGrading, constant DYUniforms& uniforms,
|
||||
constant float& sceneLevel,float w0,float w1,float w2,float w3,float w4,float w5,float w6,float w7,float w8,float w9,float w10,float w11,uint stageFirst,uint stageLast,float3 skinReference,float3 originalReference);
|
||||
|
||||
struct DYRaster {
|
||||
float4 position [[position]];
|
||||
@@ -61,6 +74,161 @@ fragment half4 dyFragment(DYRaster in [[stage_in]],
|
||||
return result;
|
||||
}
|
||||
|
||||
inline float dyToolMaskSoftStep(float low,float high,float value){if(high<=low)return value>=high?1:0;return dySmooth(low,high,value);}
|
||||
inline float dyToolMaskRangeWeight(float value,thread const DYMaskRange& range){
|
||||
float low=value>=range.low?1:dyToolMaskSoftStep(range.low-range.softLow,range.low,value);
|
||||
float high=value<=range.high?1:1-dyToolMaskSoftStep(range.high,range.high+range.softHigh,value);
|
||||
return low*high;
|
||||
}
|
||||
inline float dyToolMaskLeveledCoverage(float raw,thread const DYMaskParameters& p){
|
||||
float a=dyClamp((raw-p.inputBlack)/(p.inputWhite-p.inputBlack),0,1);
|
||||
if(p.inputGamma!=1&&a>0&&a<1)a=pow(a,1/p.inputGamma);
|
||||
return p.outputBlack+(p.outputWhite-p.outputBlack)*a;
|
||||
}
|
||||
inline float dyToolMaskFinalCoverage(float a,thread const DYMaskParameters& p){
|
||||
if(p.flags&DYMaskInvert)a=1-a;
|
||||
return dyClamp(a*p.strength,0,1);
|
||||
}
|
||||
inline float dyToolMaskLevels(float raw,thread const DYMaskParameters& p){return dyToolMaskFinalCoverage(dyToolMaskLeveledCoverage(raw,p),p);}
|
||||
inline float dyToolMaskHSLWeight(float3 source,thread const DYMaskParameters& p){
|
||||
float3 c=dyLimit(source);float lo=c.x<c.y?(c.x<c.z?c.x:c.z):(c.y<c.z?c.y:c.z),hi=c.x>c.y?(c.x>c.z?c.x:c.z):(c.y>c.z?c.y:c.z);
|
||||
// Same signed/HDR interval convention as the quick HSL tools. This is code
|
||||
// RGB selection; use LumaKey levels when absolute HDR brightness is needed.
|
||||
float base=lo<0?lo:0,scale=hi-base;if(scale<1)scale=1;
|
||||
float3 hsl=dyRGBHSL((c-float3{base,base,base})/scale);float weight=1;
|
||||
if(p.flags&DYMaskHueEnabled){
|
||||
float distance=dyHueDistance(hsl.x,p.hueCenterTurns),outer=p.hueCoreHalfWidth+p.hueSoftWidth;if(outer>.5f)outer=.5f;
|
||||
float hue=p.hueCoreHalfWidth>=.5f||distance<=p.hueCoreHalfWidth?1:1-dyToolMaskSoftStep(p.hueCoreHalfWidth,outer,distance);
|
||||
float chroma=(hi-lo)/scale;weight*=hue*dyToolMaskSoftStep(p.neutralChromaLow,p.neutralChromaHigh,chroma);
|
||||
}
|
||||
if(p.flags&DYMaskSaturationEnabled)weight*=dyToolMaskRangeWeight(hsl.y,p.saturationRange);
|
||||
if(p.flags&DYMaskLightnessEnabled)weight*=dyToolMaskRangeWeight(hsl.z,p.lightnessRange);
|
||||
return weight;
|
||||
}
|
||||
inline float dyToolMaskShapeWeight(float x,float y,thread const DYMaskParameters& p,thread const DYMaskPath& path){
|
||||
float dx=(x-p.centerX)*p.imageAspect,dy=y-p.centerY,ca=cos(p.angle),sa=sin(p.angle);
|
||||
float px=dx*ca+dy*sa,py=-dx*sa+dy*ca;
|
||||
if(p.kind==DYMaskLinearGradient){
|
||||
if(p.gradientWidth==0)return px>=0?1:0;
|
||||
return dyToolMaskSoftStep(0,1,.5f+px/(p.gradientWidth>1e-12f?p.gradientWidth:1e-12f));
|
||||
}
|
||||
float physicalWidth=p.width*p.imageAspect,physicalHeight=p.height;if(physicalWidth<1e-12f)physicalWidth=1e-12f;if(physicalHeight<1e-12f)physicalHeight=1e-12f;
|
||||
if(p.kind==DYMaskEllipse){float u=px/(physicalWidth*.5f),v=py/(physicalHeight*.5f),r=sqrt(u*u+v*v);if(p.feather==0)return r<=1?1:0;if(p.version==2&&(p.flags&DYMaskFeatherOutsideFlag))return 1-dyToolMaskSoftStep(1,1+p.feather,r);return 1-dyToolMaskSoftStep(1-p.feather,1,r);}
|
||||
float shorter=physicalWidth<physicalHeight?physicalWidth:physicalHeight;
|
||||
if(p.kind==DYMaskRectangle){float ax=px<0?-px:px,ay=py<0?-py:py,a=physicalWidth*.5f-ax,b=physicalHeight*.5f-ay;if(p.version==2&&(p.flags&DYMaskFeatherOutsideFlag)){if(p.feather==0)return a>=0&&b>=0?1:0;return dyToolMaskSoftStep(-p.feather*.5f*shorter,0,a<b?a:b);}if(a<0||b<0)return 0;if(p.feather==0)return 1;return dyToolMaskSoftStep(0,p.feather*.5f,(a<b?a:b)/shorter);}
|
||||
if(path.count<3||path.count>256)return 0;
|
||||
float u=px/physicalWidth,v=py/physicalHeight,sx=physicalWidth/shorter,sy=physicalHeight/shorter,distance2=1e10f;bool inside=false;
|
||||
for(int i=0,j=path.count-1;i<path.count;j=i++){
|
||||
float ax=path.x[j],ay=path.y[j],bx=path.x[i],by=path.y[i];if((ay>v)!=(by>v))if(u<(bx-ax)*(v-ay)/(by-ay)+ax)inside=!inside;
|
||||
float ex=(bx-ax)*sx,ey=(by-ay)*sy,xx=(u-ax)*sx,yy=(v-ay)*sy,den=ex*ex+ey*ey,t=den>1e-12f?dyClamp((xx*ex+yy*ey)/den,0,1):0;
|
||||
xx-=t*ex;yy-=t*ey;float d=xx*xx+yy*yy;if(d<distance2)distance2=d;
|
||||
}
|
||||
if(!inside)return 0;if(p.feather==0)return 1;return dyToolMaskSoftStep(0,p.feather*.5f,sqrt(distance2));
|
||||
}
|
||||
inline float dyToolMaskRawCoverage(float x,float y,float3 source,thread const DYMaskParameters& p,thread const DYMaskPath& path){return p.kind==DYMaskHSLKey?dyToolMaskHSLWeight(source,p):(p.kind==DYMaskLumaKey?dyLuma(dyLimit(source)):dyToolMaskShapeWeight(x,y,p,path));}
|
||||
inline float dyToolMaskOperator(float x,float y,float3 source,thread const DYMaskParameters& p,thread const DYMaskPath& path){
|
||||
if((p.version!=1&&p.version!=2)||p.kind>DYMaskLumaKey)return 0;
|
||||
float raw=dyToolMaskRawCoverage(x,y,source,p,path);
|
||||
return dyToolMaskLevels(raw,p);
|
||||
}
|
||||
|
||||
inline float dyToolMask(float x,float y,float3 source,device const DYResolvedMask& value){DYResolvedMask local=value;return dyToolMaskOperator(x,y,source,local.parameters,local.path);}
|
||||
|
||||
|
||||
inline float3 dyToolEncode(float3 linear){return select(1.055f*pow(max(linear,float3(0)),float3(1.f/2.4f))-.055f,linear*12.92f,linear<=.0031308f);}
|
||||
inline float3 dyToolDecode(float3 encoded){return select(pow(max((encoded+.055f)/1.055f,float3(0)),float3(2.4f)),encoded/12.92f,encoded<=.04045f);}
|
||||
inline float dyToolCoverage(float2 uv,float3 source,device const DYToolMaskEntry* masks,constant DYToolMaskHeader& h,int section){
|
||||
float x=h.offsetX+uv.x*h.scaleX,y=h.offsetY+uv.y*h.scaleY;float coverage=1;bool found=false;
|
||||
for(uint i=0;i<h.count;i++){if(masks[i].section!=section)continue;
|
||||
// Copy device data to thread storage; shared mask math accepts constant
|
||||
// descriptors, so evaluate through the address-space-neutral copy below.
|
||||
float a=dyToolMask(x,y,source,masks[i].mask);
|
||||
if(!found){coverage=masks[i].combine==1?1-a:a;found=true;}
|
||||
else if(masks[i].combine==1)coverage*=1-a;else if(masks[i].combine==2)coverage*=a;else coverage=1-(1-coverage)*(1-a);
|
||||
}return clamp(coverage,0.f,1.f);
|
||||
}
|
||||
|
||||
fragment half4 dyMaskedFragment(DYRaster in [[stage_in]],
|
||||
texture2d<half> source [[texture(0)]],
|
||||
texture3d<float> preLUT [[texture(1)]],
|
||||
texture3d<float> look1 [[texture(2)]],
|
||||
texture3d<float> look2 [[texture(3)]],
|
||||
texture3d<float> look3 [[texture(4)]],
|
||||
texture3d<float> look4 [[texture(5)]],
|
||||
texture3d<float> look5 [[texture(6)]],
|
||||
texture3d<float> hslMixer [[texture(7)]],
|
||||
texture3d<float> whiteBalance [[texture(8)]],
|
||||
texture3d<float> colorGrading [[texture(9)]],
|
||||
constant DYUniforms& uniforms [[buffer(0)]],
|
||||
constant float& sceneLevel [[buffer(1)]],
|
||||
constant DYRenderOptions& options [[buffer(2)]],
|
||||
constant DYUniforms& colorUniforms [[buffer(3)]],
|
||||
device const float* spiderSamples [[buffer(4)]],
|
||||
constant int2& spiderSize [[buffer(5)]],
|
||||
device const DYToolMaskEntry* masks [[buffer(6)]],
|
||||
constant DYToolMaskHeader& maskHeader [[buffer(7)]]) {
|
||||
constexpr sampler sampleFilter(coord::normalized, address::clamp_to_edge, filter::linear);
|
||||
half4 sample = source.sample(sampleFilter, in.uv);
|
||||
if (!(sample.a > half(0.0))) return half4(0.0h);
|
||||
float weights[12];float3 encoded=dyToolEncode(float3(sample.rgb));
|
||||
for(int i=0;i<12;i++)weights[i]=dyToolCoverage(in.uv,encoded,masks,maskHeader,i);
|
||||
half4 result = dy_gradeMasked(sample, in.uv, source, preLUT, look1, look2, look3,
|
||||
look4, look5, hslMixer, whiteBalance, colorGrading, uniforms, sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11]);
|
||||
if(options.blackWhiteMix>0.0f && options.blackWhiteMix<1.0f) {
|
||||
half4 color=dy_gradeMasked(sample,in.uv,source,preLUT,look1,look2,look3,look4,look5,hslMixer,whiteBalance,colorGrading,colorUniforms,sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11]);
|
||||
result.rgb=mix(color.rgb,result.rgb,half(options.blackWhiteMix));
|
||||
}
|
||||
if(spiderSize.x>0 && uniforms.spiderSectionEnabled>.5f && uniforms.spiderMix>0.0f){
|
||||
float3 color=float3(result.rgb);float3 warped=dyVariableSpider(color,spiderSize.x,spiderSize.y,spiderSamples);
|
||||
result.rgb=half3(dyLimit(mix(color,warped,uniforms.spiderMix*weights[1])));
|
||||
}
|
||||
result.a = sample.a;
|
||||
if (options.outputPremultiplied) result.rgb *= result.a;
|
||||
return result;
|
||||
}
|
||||
|
||||
fragment half4 dySegmentFragment(DYRaster in [[stage_in]],
|
||||
texture2d<half> source [[texture(0)]],
|
||||
texture3d<float> preLUT [[texture(1)]],
|
||||
texture3d<float> look1 [[texture(2)]],
|
||||
texture3d<float> look2 [[texture(3)]],
|
||||
texture3d<float> look3 [[texture(4)]],
|
||||
texture3d<float> look4 [[texture(5)]],
|
||||
texture3d<float> look5 [[texture(6)]],
|
||||
texture3d<float> hslMixer [[texture(7)]],
|
||||
texture3d<float> whiteBalance [[texture(8)]],
|
||||
texture3d<float> colorGrading [[texture(9)]],
|
||||
constant DYUniforms& uniforms [[buffer(0)]],
|
||||
constant float& sceneLevel [[buffer(1)]],
|
||||
constant DYRenderOptions& options [[buffer(2)]],
|
||||
constant DYUniforms& colorUniforms [[buffer(3)]],
|
||||
device const float* spiderSamples [[buffer(4)]],
|
||||
constant int2& spiderSize [[buffer(5)]],
|
||||
device const DYToolMaskEntry* masks [[buffer(6)]],
|
||||
constant DYToolMaskHeader& maskHeader [[buffer(7)]],
|
||||
constant DYToolStageRange& stages [[buffer(8)]],
|
||||
texture2d<half> skinReference [[texture(10)]],
|
||||
texture2d<half> nativeSource [[texture(11)]]) {
|
||||
constexpr sampler sampleFilter(coord::normalized, address::clamp_to_edge, filter::linear);
|
||||
half4 sample = source.sample(sampleFilter, in.uv);
|
||||
if (!(sample.a > half(0.0))) return half4(0.0h);
|
||||
half4 originalSample=nativeSource.sample(sampleFilter,in.uv);
|
||||
float weights[12];float3 encoded=dyToolEncode(float3(originalSample.rgb));
|
||||
for(int i=0;i<12;i++)weights[i]=dyToolCoverage(in.uv,encoded,masks,maskHeader,i);
|
||||
if(stages.suppressBlackWhite)weights[10]=0;
|
||||
half4 reference=skinReference.sample(sampleFilter,in.uv);
|
||||
float3 skinEncoded=dyToolEncode(reference.a>half(0)?float3(reference.rgb/reference.a):float3(0));
|
||||
half4 result = dy_gradeSegment(sample, in.uv, nativeSource, preLUT, look1, look2, look3,
|
||||
look4, look5, hslMixer, whiteBalance, colorGrading, uniforms, sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],uint(stages.first),uint(stages.last),skinEncoded,encoded);
|
||||
if(stages.first<=9 && stages.last>=9 && options.blackWhiteMix>0.0f && options.blackWhiteMix<1.0f) {
|
||||
half4 color=dy_gradeSegment(sample,in.uv,nativeSource,preLUT,look1,look2,look3,look4,look5,hslMixer,whiteBalance,colorGrading,colorUniforms,sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],uint(stages.first),uint(stages.last),skinEncoded,encoded);
|
||||
result.rgb=mix(color.rgb,result.rgb,half(options.blackWhiteMix));
|
||||
}
|
||||
result.a = sample.a;
|
||||
if (options.outputPremultiplied) result.rgb *= result.a;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Optional boundary conversion. Use this before both statistics and grading
|
||||
// when the host supplies premultiplied RGB; all neighborhood samples then see
|
||||
// the same straight RGB representation. Source and destination must differ.
|
||||
@@ -144,3 +312,16 @@ kernel void dyColorManagement(texture2d<float,access::read> source [[texture(0)]
|
||||
c.rgb=mix(raw.rgb,c.rgb,amount);
|
||||
destination.write(half4(half3(dyDecode(c.rgb)),half(sample.a)),pos);
|
||||
}
|
||||
|
||||
// Premultiplication is preserved by mixing the two equally-alpha images.
|
||||
kernel void dyToolBlend(texture2d<float,access::read> before [[texture(0)]],texture2d<float,access::read> after [[texture(1)]],texture2d<half,access::write> output [[texture(2)]],device const DYToolMaskEntry* masks [[buffer(0)]],constant DYToolMaskHeader& h [[buffer(1)]],uint2 pos [[thread_position_in_grid]]){
|
||||
if(pos.x>=output.get_width()||pos.y>=output.get_height())return;float4 a=before.read(pos),b=after.read(pos);float2 uv=(float2(pos)+.5f)/float2(output.get_width(),output.get_height());float amount=dyToolCoverage(uv,dyToolEncode(a.a>0?(h.premultiplied?a.rgb/a.a:a.rgb):float3(0)),masks,h,h.section);output.write(half4(mix(a,b,amount)),pos);
|
||||
}
|
||||
extern "C" float3 dy_skinExtra(float3 color,float3 reference,constant DYUniforms& uniforms);
|
||||
kernel void dyToolSkin(texture2d<float,access::read> before [[texture(0)]],texture2d<float> reference [[texture(1)]],texture2d<half,access::write> output [[texture(2)]],constant DYUniforms& u [[buffer(0)]],uint2 pos [[thread_position_in_grid]]){
|
||||
if(pos.x>=output.get_width()||pos.y>=output.get_height())return;constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);float4 a=before.read(pos),b=reference.sample(f,(float2(pos)+.5f)/float2(output.get_width(),output.get_height()));if(a.a>0){float3 c=dy_skinExtra(dyToolEncode(a.rgb/a.a),dyToolEncode(b.a>0?b.rgb/b.a:float3(0)),u);a.rgb=dyToolDecode(c)*a.a;}output.write(half4(a),pos);
|
||||
}
|
||||
|
||||
fragment half4 dyToolCopyFragment(DYRaster in [[stage_in]],texture2d<half> source [[texture(0)]]){constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);return source.sample(f,in.uv);}
|
||||
|
||||
#include "DYFilmKernels.inc.h"
|
||||
+85
-27
@@ -1,5 +1,8 @@
|
||||
#import "DYInspector.h"
|
||||
#import "DYModel.h"
|
||||
#import "DYToolState.h"
|
||||
#import "DYAutoGrade.h"
|
||||
#import "DYColorTables.h"
|
||||
#import "DYTheme.h"
|
||||
#import "DYLUTLibrary.h"
|
||||
#import "DYLUTBrowser.h"
|
||||
@@ -23,6 +26,26 @@ static NSButton *DYButton(NSString *title,id target,SEL action) {
|
||||
b.bezelStyle=NSBezelStyleRounded; b.font=[NSFont systemFontOfSize:11];
|
||||
b.contentTintColor=DYAccent(); return b;
|
||||
}
|
||||
// Header status stays visible while the body is folded and never intercepts clicks.
|
||||
@interface DYMaskCountBadge : NSView
|
||||
@property(nonatomic) NSUInteger count;
|
||||
@end
|
||||
@implementation DYMaskCountBadge
|
||||
- (void)setCount:(NSUInteger)count {_count=count;self.hidden=count==0;[self setNeedsDisplay:YES];}
|
||||
- (NSView*)hitTest:(NSPoint)point {return nil;}
|
||||
- (BOOL)isAccessibilityElement {return YES;}
|
||||
- (NSString*)accessibilityRole {return NSAccessibilityStaticTextRole;}
|
||||
- (id)accessibilityValue {return [NSString stringWithFormat:@"%lu 个蒙版",(unsigned long)_count];}
|
||||
- (void)drawRect:(NSRect)dirtyRect {
|
||||
if(!_count)return;NSRect frame=NSInsetRect(self.bounds,.6,.6);
|
||||
NSBezierPath *pill=[NSBezierPath bezierPathWithRoundedRect:frame xRadius:6 yRadius:6];
|
||||
[DYThemeColor(@"field") setFill];[pill fill];[DYAccent() setStroke];pill.lineWidth=1.2;[pill stroke];
|
||||
NSString *text=[NSString stringWithFormat:@"%lu",(unsigned long)_count];
|
||||
NSDictionary *attributes=@{NSFontAttributeName:[NSFont monospacedDigitSystemFontOfSize:10.5 weight:NSFontWeightBold],NSForegroundColorAttributeName:DYInk()};
|
||||
NSSize size=[text sizeWithAttributes:attributes];[text drawAtPoint:NSMakePoint(NSMidX(self.bounds)-size.width/2,NSMidY(self.bounds)-size.height/2) withAttributes:attributes];
|
||||
}
|
||||
@end
|
||||
|
||||
static BOOL DYStrengthUsesUnitRange(NSDictionary *d) {
|
||||
return [d[@"key"] hasSuffix:@"Strength"] && [d[@"max"] doubleValue]<=1;
|
||||
}
|
||||
@@ -83,6 +106,7 @@ static NSArray *DYAccessibleSubviews(NSView *view, BOOL visibleOnly) {
|
||||
if(visibleOnly&&!NSIntersectsRect(child.frame,visible))continue;
|
||||
[children addObject:child];
|
||||
}
|
||||
[children sortUsingComparator:^NSComparisonResult(NSView *a,NSView *b){if(NSMinY(a.frame)!=NSMinY(b.frame))return NSMinY(a.frame)<NSMinY(b.frame)?NSOrderedAscending:NSOrderedDescending;if(NSMinX(a.frame)!=NSMinX(b.frame))return NSMinX(a.frame)<NSMinX(b.frame)?NSOrderedAscending:NSOrderedDescending;return NSOrderedSame;}];
|
||||
return NSAccessibilityUnignoredChildren(children);
|
||||
}
|
||||
|
||||
@@ -121,6 +145,7 @@ static NSArray *DYAccessibleSubviews(NSView *view, BOOL visibleOnly) {
|
||||
- (NSArray *)accessibilityVisibleChildren { return self.accessibilityChildren; }
|
||||
- (NSArray *)accessibilityChildrenInNavigationOrder { return self.accessibilityChildren; }
|
||||
- (id)accessibilityVerticalScrollBar { return self.hasVerticalScroller?self.verticalScroller:nil; }
|
||||
- (void)scrollWheel:(NSEvent*)event{if(!self.hasVerticalScroller){[self.nextResponder scrollWheel:event];return;}[super scrollWheel:event];}
|
||||
@end
|
||||
|
||||
@interface DYCard : DYFlippedView @end
|
||||
@@ -179,7 +204,7 @@ static NSArray *DYPresentationSections(void) {
|
||||
for(NSString *key in @[@"temperature",@"tint",@"exposure",@"contrast",@"highlights",@"shadows",@"whites",@"blacks",@"texture",@"clarity",@"dehaze",@"vibrance",@"saturation",@"skinEnabled",@"copyAutoGrade"]){NSDictionary*d=byKey[key];if(d)[rows addObject:d];}
|
||||
base[@"rows"]=rows;base[@"extraEnabled"]=bySection[@"color"][@"enabled"];
|
||||
base[@"title"]=@"基础调整";
|
||||
return @[primary,bySection[@"spider"],base,bySection[@"skin"],bySection[@"look"],bySection[@"hsl"],bySection[@"curve"],bySection[@"grading"],bySection[@"primaries"],bySection[@"levels"],bySection[@"blackwhite"],bySection[@"balance"]];
|
||||
return @[primary,bySection[@"spider"],base,bySection[@"skin"],bySection[@"look"],bySection[@"hsl"],bySection[@"curve"],bySection[@"grading"],bySection[@"primaries"],bySection[@"levels"],bySection[@"blackwhite"],bySection[@"balance"],bySection[@"mixer"],bySection[@"film"]];
|
||||
}
|
||||
|
||||
|
||||
@@ -378,6 +403,7 @@ static NSImage *DYWheelImage(void) {
|
||||
@end
|
||||
|
||||
#include "DYNewPanels.inc.h"
|
||||
#include "DYMaskPanel.inc.h"
|
||||
|
||||
@interface DYInspector () <DYGraphicDelegate> {
|
||||
id<PROAPIAccessing> _manager;
|
||||
@@ -399,6 +425,7 @@ static NSImage *DYWheelImage(void) {
|
||||
NSMutableDictionary *_tabs;
|
||||
NSInteger _visibleLooks;
|
||||
BOOL _refreshing,_graphicUndoOpen;
|
||||
BOOL _embedded;NSMutableDictionary *_stackViews;NSArray *_stackOrder;NSDictionary *_stackRoots;CGFloat _stackHeight;
|
||||
DYSpiderPanel *_spiderPanel;
|
||||
NSMutableDictionary *_assetLoads,*_assetLoadIDs;
|
||||
NSUInteger _nextAssetLoadID;
|
||||
@@ -410,13 +437,16 @@ static NSImage *DYWheelImage(void) {
|
||||
@end
|
||||
|
||||
@implementation DYInspector
|
||||
#include "DYToolInspector.inc.h"
|
||||
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager {
|
||||
return [self initWithAPIManager:manager renderer:nil];
|
||||
}
|
||||
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager renderer:(DYRenderer *)renderer {
|
||||
if((self=[super initWithFrame:NSMakeRect(0,0,360,780)])) {
|
||||
_assetLoads=[NSMutableDictionary new];_assetLoadIDs=[NSMutableDictionary new];_manager=manager; _renderer=[renderer retain];_library=[DYLUTLibrary new];_tabs=[NSMutableDictionary new];_visibleLooks=1;
|
||||
_sections=[DYPresentationSections() copy];
|
||||
_embedded=[manager isKindOfClass:DYToolManager.class];if(_embedded)[(id)_manager retain];
|
||||
NSArray *presentation=DYPresentationSections();if(_embedded){NSMutableArray *filtered=[NSMutableArray array];for(NSDictionary *s in presentation)if([s[@"key"]isEqual:[(DYToolManager*)manager type]])[filtered addObject:s];presentation=filtered;}
|
||||
_sections=[presentation copy];_stackViews=[NSMutableDictionary new];_stackOrder=[@[]copy];
|
||||
_cards=[[NSMutableArray alloc] init]; _controls=[[NSMutableDictionary alloc] init];
|
||||
_assetButtons=[[NSMutableDictionary alloc] init]; _graphics=[[NSMutableArray alloc] init];
|
||||
self.autoresizingMask=NSViewWidthSizable;
|
||||
@@ -430,13 +460,13 @@ static NSImage *DYWheelImage(void) {
|
||||
_save=[DYButton(@"保存预设",self,@selector(savePreset:)) retain];
|
||||
_load=[DYButton(@"载入预设",self,@selector(loadPreset:)) retain];
|
||||
_export=[DYButton(@"导出 LUT",self,@selector(exportLUT:)) retain];
|
||||
for(NSView *v in @[_brand,_subtitle,_resetAll,_save,_load,_export]) [self addSubview:v];
|
||||
for(NSView *v in @[_brand,_subtitle,_resetAll,_save,_load,_export]){[self addSubview:v];v.hidden=_embedded;}
|
||||
NSMutableArray *themes=[NSMutableArray array];for(NSInteger i=0;i<5;i++){
|
||||
DYSwatchButton *b=[[[DYSwatchButton alloc]initWithFrame:NSZeroRect]autorelease];[b setButtonType:NSButtonTypePushOnPushOff];b.swatch=DYThemeSwatch(i);b.tag=i;b.target=self;b.action=@selector(selectTheme:);b.title=@"";b.bordered=NO;
|
||||
b.toolTip=[DYThemeNames()[i] stringByAppendingString:@"主题"];b.accessibilityLabel=b.toolTip;[self addSubview:b];[themes addObject:b];
|
||||
b.toolTip=[DYThemeNames()[i] stringByAppendingString:@"主题"];b.accessibilityLabel=b.toolTip;[self addSubview:b];b.hidden=_embedded;[themes addObject:b];
|
||||
}_themeButtons=[themes copy];
|
||||
_scroll=[[DYInspectorScrollView alloc] initWithFrame:NSZeroRect];
|
||||
_scroll.hasVerticalScroller=YES; _scroll.hasHorizontalScroller=NO; _scroll.drawsBackground=NO;
|
||||
_scroll.hasVerticalScroller=!_embedded; _scroll.hasHorizontalScroller=NO; _scroll.drawsBackground=NO;
|
||||
_scroll.autohidesScrollers=YES; _scroll.borderType=NSNoBorder;
|
||||
_scroll.clipsToBounds=YES;_scroll.wantsLayer=YES;_scroll.layer.masksToBounds=YES;
|
||||
_scroll.contentView.clipsToBounds=YES;
|
||||
@@ -460,6 +490,7 @@ static NSImage *DYWheelImage(void) {
|
||||
for(id graphic in _graphics)if([graphic isKindOfClass:DYPrimaryBalanceWheel.class])[(DYPrimaryBalanceWheel*)graphic setDelegate:nil];
|
||||
for(NSProgress *p in _assetLoads.allValues)[p cancel];[_assetLoads release];[_assetLoadIDs release];[_menuScan cancel];[_menuScan release];[_pendingAssetMenuCommand release];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
if(_embedded)[(id)_manager release];[_stackViews release];[_stackOrder release];[_stackRoots release];
|
||||
[_brand release]; [_subtitle release]; [_resetAll release]; [_save release]; [_load release]; [_export release];
|
||||
[_scroll release]; [_document release]; [_sections release]; [_cards release]; [_controls release]; [_assetButtons release]; [_graphics release]; [_sampler release];
|
||||
[_browser close];[_browser release];[_renderer release];[_library release];[_themeButtons release];[_tabs release];
|
||||
@@ -481,7 +512,7 @@ static NSImage *DYWheelImage(void) {
|
||||
}
|
||||
}
|
||||
- (void)modelChanged:(NSNotification *)n {
|
||||
if([NSThread isMainThread]) [self refresh];
|
||||
if([NSThread isMainThread]) {[self refresh];NSString *ID=n.userInfo[@"scrollToTool"];if(!_embedded&&ID.length&&_stackViews[ID]){[self layoutSubtreeIfNeeded];NSView *child=_stackViews[ID];[_document scrollPoint:NSMakePoint(0,MAX(0,child.frame.origin.y-8))];}}
|
||||
else dispatch_async(dispatch_get_main_queue(),^{ [self refresh]; });
|
||||
}
|
||||
- (void)selectTheme:(NSButton *)button {DYSetThemeIndex(button.tag);}
|
||||
@@ -548,6 +579,9 @@ static NSImage *DYWheelImage(void) {
|
||||
if([key isEqual:@"levels"]||[key isEqual:@"balance"]) {
|
||||
NSSegmentedControl *tabs=[NSSegmentedControl segmentedControlWithLabels:[key isEqual:@"levels"]?@[@"RGB",@"红",@"绿",@"蓝"]:@[@"阴影",@"中间调",@"高光"] trackingMode:NSSegmentSwitchTrackingSelectOne target:self action:@selector(tabChanged:)];tabs.identifier=key;tabs.selectedSegment=0;tabs.controlSize=NSControlSizeSmall;tabs.accessibilityLabel=[section[@"title"] stringByAppendingString:@"通道"];[card addSubview:tabs];[body addObject:tabs];
|
||||
}
|
||||
if([key isEqual:@"mixer"]||[key isEqual:@"film"]){
|
||||
NSSegmentedControl *tabs=[NSSegmentedControl segmentedControlWithLabels:[key isEqual:@"mixer"]?@[@"红输出",@"绿输出",@"蓝输出"]:@[@"减色",@"晕光",@"辉光",@"颗粒",@"暗角"] trackingMode:NSSegmentSwitchTrackingSelectOne target:self action:@selector(tabChanged:)];tabs.identifier=key;tabs.selectedSegment=0;tabs.controlSize=NSControlSizeSmall;tabs.accessibilityLabel=[section[@"title"]stringByAppendingString:@"分组"];[card addSubview:tabs];[body addObject:tabs];
|
||||
}
|
||||
if([key isEqual:@"curve"]) {
|
||||
DYCurvePanel *graph=[[[DYCurvePanel alloc]initWithFrame:NSZeroRect]autorelease];graph.delegate=self;graph.identifier=@"curveGraph";[card addSubview:graph];[body addObject:graph];[_graphics addObject:graph];
|
||||
}
|
||||
@@ -609,6 +643,13 @@ static NSImage *DYWheelImage(void) {
|
||||
}
|
||||
NSMutableDictionary *record=[NSMutableDictionary dictionaryWithDictionary:@{@"section":section,@"view":card,@"header":header,@"enabled":enabled,@"reset":reset,@"body":body,@"collapsed":@(![@[@"primary",@"spider",@"base"]containsObject:key])}];
|
||||
if([key isEqual:@"look"]){NSButton *add=DYButton(@"+",self,@selector(addLook:));add.bordered=NO;add.font=[NSFont boldSystemFontOfSize:20];add.accessibilityLabel=@"添加风格 LUT";[card addSubview:add];record[@"add"]=add;}
|
||||
id<PROAPIAccessing> host=_embedded?[(DYToolManager*)_manager host]:_manager;
|
||||
NSString *nodeID=_embedded?[(DYToolManager*)_manager nodeID]:[@"base:" stringByAppendingString:key];
|
||||
DYToolMaskPanel *maskPanel=[[[DYToolMaskPanel alloc]initWithManager:host nodeID:nodeID]autorelease];[card addSubview:maskPanel];[body insertObject:maskPanel atIndex:0];record[@"maskPanel"]=maskPanel;
|
||||
NSButton *mask=DYButton(@"",self,@selector(toolMask:));mask.tag=index;mask.bordered=NO;mask.image=[NSImage imageWithSystemSymbolName:@"circle.dashed.inset.filled" accessibilityDescription:@"添加蒙版"];mask.toolTip=@"添加本工具的独立蒙版";mask.accessibilityLabel=[section[@"title"]stringByAppendingString:@"添加蒙版"];[card addSubview:mask];record[@"maskButton"]=mask;
|
||||
DYMaskCountBadge *maskBadge=[[[DYMaskCountBadge alloc]initWithFrame:NSZeroRect]autorelease];maskBadge.hidden=YES;maskBadge.accessibilityLabel=[section[@"title"] stringByAppendingString:@"蒙版数量"];[card addSubview:maskBadge];record[@"maskBadge"]=maskBadge;
|
||||
NSButton *repeat=DYButton(@"",self,@selector(repeatTool:));repeat.tag=index;repeat.bordered=NO;repeat.image=[NSImage imageWithSystemSymbolName:@"plus.square.on.square" accessibilityDescription:@"再加一层"];repeat.toolTip=@"紧接当前工具插入一层初始化工具";repeat.accessibilityLabel=[section[@"title"]stringByAppendingString:@"再加一层"];[card addSubview:repeat];record[@"repeatButton"]=repeat;
|
||||
if(_embedded){NSButton *remove=DYButton(@"删除此层",self,@selector(removeTool:));remove.identifier=@"removeTool";[card addSubview:remove];[body addObject:remove];}
|
||||
[_cards addObject:record];
|
||||
index++;
|
||||
}
|
||||
@@ -628,6 +669,7 @@ static NSImage *DYWheelImage(void) {
|
||||
return row;
|
||||
}
|
||||
- (BOOL)showRow:(NSView *)row section:(NSString *)section {
|
||||
if([row.identifier isEqual:@"toolMasks"])return [(DYToolMaskPanel*)row contentHeight]>0;
|
||||
NSString *key=row.identifier?:@"";NSInteger tab=[_tabs[section]integerValue];
|
||||
if([key isEqual:@"legacyInput"])return [_tabs[@"legacyInput"]boolValue];
|
||||
if([section isEqual:@"curve"] && ![key isEqual:@"curveGraph"])return NO;
|
||||
@@ -638,10 +680,11 @@ static NSImage *DYWheelImage(void) {
|
||||
if([section isEqual:@"grading"]){int wheel=0,axis=0;if(sscanf(key.UTF8String,"grade%d_%d",&wheel,&axis)==2)return axis==2;}
|
||||
if([section isEqual:@"levels"]){int channel=0,axis=0;if(sscanf(key.UTF8String,"level%d_%d",&channel,&axis)==2)return channel==tab;}
|
||||
if([section isEqual:@"balance"]){int channel=0,axis=0;if(sscanf(key.UTF8String,"balance%d_%d",&channel,&axis)==2)return channel==tab;}
|
||||
if([section isEqual:@"mixer"]||[section isEqual:@"film"]){for(NSDictionary *d in DYToolSection(section)[@"rows"])if([d[@"key"]isEqual:key]){NSNumber *group=d[[section isEqual:@"mixer"]?@"mixerTab":@"filmTab"];return !group||group.intValue<0||group.intValue==tab;}}
|
||||
if([section isEqual:@"look"]){int slot=0;if(sscanf(key.UTF8String,"asset:look%d",&slot)==1)return slot<_visibleLooks;if([key isEqual:@"postLUTStrength"])return YES;int number=0;if(sscanf(key.UTF8String,"look%dStrength",&number)==1)return number-1<_visibleLooks;return NO;}
|
||||
return YES;
|
||||
}
|
||||
- (CGFloat)heightForRow:(NSView *)row {if([row.identifier isEqual:@"spiderGraph"])return 444;if([row.identifier isEqual:@"primaryBalance"])return 232;if([row.identifier hasPrefix:@"heading:"])return 27;return [row.identifier isEqual:@"curveGraph"]?240:[row.identifier isEqual:@"gradingWheels"]?292:32;}
|
||||
- (CGFloat)heightForRow:(NSView *)row {if([row isKindOfClass:DYToolMaskPanel.class])return [(DYToolMaskPanel*)row contentHeight];if([row.identifier isEqual:@"spiderGraph"])return 444;if([row.identifier isEqual:@"primaryBalance"])return 232;if([row.identifier hasPrefix:@"heading:"])return 27;return [row.identifier isEqual:@"curveGraph"]?240:[row.identifier isEqual:@"gradingWheels"]?292:32;}
|
||||
- (void)layout {
|
||||
[super layout];
|
||||
CGFloat w=MAX(280,self.bounds.size.width),h=self.bounds.size.height;
|
||||
@@ -650,23 +693,25 @@ static NSImage *DYWheelImage(void) {
|
||||
_resetAll.frame=NSMakeRect(w-33,16,23,24);
|
||||
CGFloat gap=7,bw=(w-32-gap*2)/3;
|
||||
_save.frame=NSMakeRect(16,50,bw,27); _load.frame=NSMakeRect(16+bw+gap,50,bw,27); _export.frame=NSMakeRect(16+(bw+gap)*2,50,bw,27);
|
||||
_scroll.frame=NSMakeRect(0,88,w,MAX(80,h-88));
|
||||
_scroll.frame=_embedded?NSMakeRect(0,0,w,h):NSMakeRect(0,88,w,MAX(80,h-88));
|
||||
CGFloat cw=MAX(244,_scroll.contentSize.width-32),y=8;
|
||||
for(NSMutableDictionary *c in _cards) {
|
||||
DYCard *card=c[@"view"];BOOL collapsed=[c[@"collapsed"]boolValue];NSString *key=c[@"section"][@"key"];
|
||||
NSArray *body=c[@"body"];CGFloat contentHeight=0;
|
||||
for(NSView *row in body)if([self showRow:row section:key])contentHeight+=[self heightForRow:row];
|
||||
for(NSView *row in body)if([self showRow:row section:key]&&!collapsed)contentHeight+=[self heightForRow:row];
|
||||
[c[@"enabled"]setFrame:NSMakeRect(12,12,20,20)];
|
||||
CGFloat titleWidth=MIN(cw-104,MAX(94,[[(NSButton *)c[@"header"]title]sizeWithAttributes:@{NSFontAttributeName:[NSFont boldSystemFontOfSize:12]}].width+36));
|
||||
CGFloat titleWidth=MIN(cw-143,MAX(94,[[(NSButton *)c[@"header"]title]sizeWithAttributes:@{NSFontAttributeName:[NSFont boldSystemFontOfSize:12]}].width+36));
|
||||
[c[@"header"]setFrame:NSMakeRect(42,8,titleWidth,28)];
|
||||
CGFloat headerHeight=43;
|
||||
card.frame=NSMakeRect(16,y,cw,headerHeight+(collapsed?0:contentHeight+8));y+=card.frame.size.height+12;
|
||||
[c[@"reset"]setFrame:NSMakeRect(cw-36,10,24,24)];
|
||||
[c[@"add"]setFrame:NSMakeRect(cw-64,10,24,24)];[c[@"add"]setEnabled:_visibleLooks<5];[c[@"add"]setHidden:collapsed];
|
||||
card.frame=NSMakeRect(16,y,cw,headerHeight+(contentHeight>0?contentHeight+8:0));y+=card.frame.size.height+12;
|
||||
[c[@"reset"]setFrame:NSMakeRect(cw-34,10,24,24)];
|
||||
[c[@"repeatButton"]setFrame:NSMakeRect(cw-62,10,24,24)];[c[@"maskButton"]setFrame:NSMakeRect(cw-90,10,24,24)];[c[@"maskBadge"]setFrame:NSMakeRect(cw-83,3,18,16)];
|
||||
[c[@"add"]setFrame:NSMakeRect(cw-33,headerHeight+contentHeight-28,20,24)];[c[@"add"]setEnabled:_visibleLooks<5];[c[@"add"]setHidden:collapsed];
|
||||
CGFloat rowY=headerHeight;
|
||||
for(NSView *row in body) {
|
||||
BOOL show=!collapsed&&[self showRow:row section:key];row.hidden=!show;if(!show)continue;
|
||||
CGFloat rh=[self heightForRow:row];row.frame=NSMakeRect(12,rowY,cw-24,rh-1);rowY+=rh;
|
||||
if([row.identifier isEqual:@"removeTool"]){/* NSButton fills its row. */}
|
||||
if([row.identifier isEqual:@"primaryBalance"])for(NSView *v in row.subviews)v.frame=row.bounds;
|
||||
if([row.identifier hasPrefix:@"heading:"])for(NSView *v in row.subviews)v.frame=NSMakeRect(3,7,row.bounds.size.width-6,18);
|
||||
if([row.identifier isEqual:@"autoControls"]||[row.identifier isEqual:@"sampleControls"]) {
|
||||
@@ -675,6 +720,7 @@ static NSImage *DYWheelImage(void) {
|
||||
}
|
||||
if([row.identifier isEqual:@"hslTabs"]){CGFloat width=row.bounds.size.width/9;NSInteger i=0;for(NSView *button in row.subviews)[button setFrame:NSMakeRect(i++*width,1,width-1,27)];}
|
||||
}
|
||||
y=[self layoutRepeatedToolsAfter:[@"base:" stringByAppendingString:key] y:y width:w];
|
||||
}
|
||||
for(NSDictionary *record in _controls.allValues) {
|
||||
CGFloat rw=[record[@"row"]bounds].size.width,lw=MIN(103,MAX(77,rw*.34)),eyeWidth=record[@"itemEnabled"]?20:0;
|
||||
@@ -689,7 +735,8 @@ static NSImage *DYWheelImage(void) {
|
||||
[r[@"browse"]setHidden:input];[r[@"eye"]setFrame:NSMakeRect(0,5,18,20)];[r[@"browse"]setFrame:NSMakeRect(r[@"eye"]?20:0,4,20,24)];[r[@"label"]setFrame:NSMakeRect(input?2:r[@"eye"]?43:25,7,input?86:r[@"eye"]?51:69,18)];
|
||||
[r[@"choose"]setFrame:NSMakeRect(97,3,MAX(65,rw-152),26)];[r[@"folder"]setFrame:NSMakeRect(rw-51,4,24,24)];[r[@"remove"]setFrame:NSMakeRect(rw-23,4,22,24)];
|
||||
}
|
||||
[_document setFrameSize:NSMakeSize(_scroll.contentSize.width,MAX(y,_scroll.contentSize.height))];
|
||||
y=[self layoutRepeatedToolsAfter:@"tail" y:y width:w];
|
||||
_stackHeight=y;[_document setFrameSize:NSMakeSize(_scroll.contentSize.width,MAX(y,_scroll.contentSize.height))];
|
||||
}
|
||||
- (id<FxCustomParameterActionAPI_v4>)actionAPI { return [_manager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)]; }
|
||||
- (void)refresh {
|
||||
@@ -731,6 +778,12 @@ static NSImage *DYWheelImage(void) {
|
||||
[c[@"enabled"]setToolTip:enabled?@"停用本组,保留参数和展开状态":@"启用本组,保留展开状态"];[c[@"enabled"]setAccessibilityHelp:[c[@"enabled"]toolTip]];
|
||||
for(NSView *row in c[@"body"])row.alphaValue=enabled?1:.45;
|
||||
}
|
||||
id<PROAPIAccessing> maskHost=_embedded?[(DYToolManager*)_manager host]:_manager;NSDictionary *tools=DYReadTools(maskHost,t).document;for(NSDictionary *card in _cards){
|
||||
[card[@"maskPanel"]refreshWithDocument:tools time:t];
|
||||
NSString *nodeID=_embedded?[(DYToolManager*)_manager nodeID]:[@"base:" stringByAppendingString:card[@"section"][@"key"]];NSUInteger count=[DYMasksForTool(tools,nodeID) count];
|
||||
[(DYMaskCountBadge*)card[@"maskBadge"]setCount:count];NSString *hint=count?[NSString stringWithFormat:@"已有 %lu 个蒙版;点击添加独立蒙版",(unsigned long)count]:@"添加本工具的独立蒙版";
|
||||
[card[@"maskButton"]setToolTip:hint];[card[@"maskButton"]setAccessibilityHelp:hint];
|
||||
}
|
||||
DYAssetState *assets=DYReadAssets(_manager,t);[_spiderPanel setMesh:assets.spiderMesh linked:assets.spiderLinked];
|
||||
double profile=0,configured=0;[get getFloatValue:&profile fromParameter:2013 atTime:t];[get getFloatValue:&configured fromParameter:2236 atTime:t];
|
||||
DYInspectorToken *oldToken=nil;[get getCustomParameterValue:&oldToken fromParameter:DYInspectorParameterID atTime:t];
|
||||
@@ -748,9 +801,10 @@ static NSImage *DYWheelImage(void) {
|
||||
} @finally { [action endAction:self]; _refreshing=NO; }
|
||||
// Remote layout/accessibility can re-enter the host. Let the parameter
|
||||
// action and current callback unwind before notifying the remote view.
|
||||
if(!_embedded)[self synchronizeTools];
|
||||
if(groupingChanged)dispatch_async(dispatch_get_main_queue(),^{NSAccessibilityPostNotification(self,NSAccessibilityLayoutChangedNotification);});
|
||||
}
|
||||
- (void)postChanged { [[NSNotificationCenter defaultCenter] postNotificationName:@"DYModelChanged" object:_manager]; }
|
||||
- (void)postChanged { [[NSNotificationCenter defaultCenter] postNotificationName:@"DYModelChanged" object:_embedded?[(DYToolManager*)_manager host]:_manager]; }
|
||||
- (void)scalarChanged:(NSControl *)sender {
|
||||
if(_refreshing)return;
|
||||
NSNumber *pid=@(sender.tag); NSDictionary *r=_controls[pid],*d=r[@"descriptor"]; if(!d)return;
|
||||
@@ -848,6 +902,7 @@ static NSImage *DYWheelImage(void) {
|
||||
@try{id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];[set setFloatValue:1 toParameter:2236 atTime:a.currentTime];[self clearPrimaryBypasses:set time:a.currentTime];} @finally{[a endAction:self];}[self postChanged];
|
||||
}
|
||||
- (void)resetSection:(NSButton *)sender {
|
||||
if(_embedded){[self resetRepeatedTool];return;}
|
||||
[self cancelAssetLoads];
|
||||
if(sender.tag>=_cards.count)return;
|
||||
NSDictionary *section=_cards[sender.tag][@"section"];
|
||||
@@ -884,7 +939,7 @@ static NSImage *DYWheelImage(void) {
|
||||
@try {
|
||||
CMTime t=action.currentTime;id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];
|
||||
for(NSDictionary *d in DYDescriptors())[set setFloatValue:[d[@"default"] doubleValue] toParameter:[d[@"pid"] unsignedIntValue] atTime:t];
|
||||
DYAssetState *assets=[[[DYAssetState alloc] init] autorelease];assets.paths=@{};DYWriteAssets(_manager,assets,t);
|
||||
DYAssetState *assets=[[[DYAssetState alloc] init] autorelease];assets.paths=@{};DYWriteAssets(_manager,assets,t);DYWriteTools(_manager,[[[DYToolDocument alloc]init]autorelease].document,t);
|
||||
[set setCustomParameterValue:[[[DYInspectorToken alloc]init]autorelease] toParameter:DYInspectorParameterID atTime:t];
|
||||
for(NSMutableDictionary *card in _cards)card[@"collapsed"]=@(![@[@"primary",@"spider",@"base"]containsObject:card[@"section"][@"key"]]);
|
||||
} @finally {[action endAction:self];}
|
||||
@@ -1006,15 +1061,15 @@ static NSImage *DYWheelImage(void) {
|
||||
}
|
||||
- (NSDictionary *)presetSnapshot {
|
||||
id<FxCustomParameterActionAPI_v4> action=[self actionAPI];if(!action)return nil;
|
||||
NSMutableDictionary *values=[NSMutableDictionary dictionary];NSDictionary *paths=@{},*spider=nil;
|
||||
NSMutableDictionary *values=[NSMutableDictionary dictionary];NSDictionary *paths=@{},*spider=nil;NSString *tools=nil;
|
||||
[action startAction:self];
|
||||
@try {
|
||||
CMTime t=action.currentTime;id<FxParameterRetrievalAPI_v6> get=[_manager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];
|
||||
for(NSDictionary *d in DYDescriptors()) {double v=[d[@"default"] doubleValue];[get getFloatValue:&v fromParameter:[d[@"pid"] unsignedIntValue] atTime:t];if(std::isfinite(v))values[d[@"key"]]=@(v);}
|
||||
DYUniforms effective;DYReadUniforms(_manager,t,&effective);values[@"cmConfigured"]=@(effective.cm.configured);values[@"blackWhiteMix"]=@(effective.cm.blackWhiteMix);
|
||||
DYAssetState *state=DYReadAssets(_manager,t);paths=[[state.paths copy]autorelease]?:@{};spider=DYSpiderJSON(state.spiderMesh,state.spiderLinked);
|
||||
DYAssetState *state=DYReadAssets(_manager,t);paths=[[state.paths copy]autorelease]?:@{};spider=DYSpiderJSON(state.spiderMesh,state.spiderLinked);NSData *toolData=[NSPropertyListSerialization dataWithPropertyList:DYReadTools(_manager,t).document format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil];tools=[toolData base64EncodedStringWithOptions:0];
|
||||
} @finally {[action endAction:self];}
|
||||
return @{@"format":@"com.dayu.color.preset",@"version":@3,@"values":values,@"paths":paths,@"spider":spider};
|
||||
return @{@"format":@"com.dayu.color.preset",@"version":@5,@"values":values,@"paths":paths,@"spider":spider,@"tools":tools?:@""};
|
||||
}
|
||||
- (void)savePreset:(id)sender {
|
||||
NSDictionary *snapshot=[self presetSnapshot];if(!snapshot)return;
|
||||
@@ -1027,10 +1082,11 @@ static NSImage *DYWheelImage(void) {
|
||||
NSOpenPanel *panel=[NSOpenPanel openPanel];panel.allowedFileTypes=@[@"json"];panel.allowsMultipleSelection=NO;panel.canChooseDirectories=NO;
|
||||
if([panel runModal]!=NSModalResponseOK)return;
|
||||
NSError *error=nil;NSData *data=[NSData dataWithContentsOfURL:panel.URL options:0 error:&error];
|
||||
if(!data||data.length>2*1024*1024){[self showError:error.localizedDescription?:@"预设文件过大"];return;}
|
||||
if(!data||data.length>32*1024*1024){[self showError:error.localizedDescription?:@"预设文件过大"];return;}
|
||||
id json=[NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
|
||||
if(![json isKindOfClass:NSDictionary.class]||![json[@"format"] isEqual:@"com.dayu.color.preset"]||![@[@1,@2,@3]containsObject:json[@"version"]]||![json[@"values"] isKindOfClass:NSDictionary.class]||![json[@"paths"] isKindOfClass:NSDictionary.class]){[self showError:@"这不是有效的大鱼调色预设。"];return;}
|
||||
NSDictionary *values=json[@"values"],*paths=json[@"paths"];NSData *mesh=[json[@"version"]isEqual:@3]?DYSpiderFromJSON(json[@"spider"]):nil;if([json[@"version"]isEqual:@3]&&!mesh){[self showError:@"预设包含无效蜘蛛盘,当前调色未修改。"];return;}
|
||||
if(![json isKindOfClass:NSDictionary.class]||![json[@"format"] isEqual:@"com.dayu.color.preset"]||![@[@1,@2,@3,@4,@5]containsObject:json[@"version"]]||![json[@"values"] isKindOfClass:NSDictionary.class]||![json[@"paths"] isKindOfClass:NSDictionary.class]){[self showError:@"这不是有效的大鱼调色预设。"];return;}
|
||||
NSDictionary *values=json[@"values"],*paths=json[@"paths"];NSData *mesh=[json[@"version"]integerValue]>=3?DYSpiderFromJSON(json[@"spider"]):nil;if([json[@"version"]integerValue]>=3&&!mesh){[self showError:@"预设包含无效蜘蛛盘,当前调色未修改。"];return;}
|
||||
NSDictionary *tools=[[[DYToolDocument alloc]init]autorelease].document;if([json[@"version"]integerValue]>=4){id encoded=json[@"tools"];NSData *binary=[encoded isKindOfClass:NSString.class]?[[[NSData alloc]initWithBase64EncodedString:encoded options:0]autorelease]:nil;tools=binary?[NSPropertyListSerialization propertyListWithData:binary options:NSPropertyListImmutable format:NULL error:nil]:nil;if(!DYValidToolDocument(tools)){[self showError:@"预设包含无效工具或蒙版,当前调色未修改。"];return;}}
|
||||
for(NSDictionary *d in DYDescriptors()) {
|
||||
id v=values[d[@"key"]];if(!v)continue;
|
||||
if(![v isKindOfClass:NSNumber.class]||!std::isfinite([v doubleValue])||[v doubleValue]<[d[@"min"] doubleValue]||[v doubleValue]>[d[@"max"] doubleValue]||(d[@"values"]&&![d[@"values"]containsObject:v])){[self showError:@"预设包含无效参数,尚未修改当前调色。"];return;}
|
||||
@@ -1041,20 +1097,21 @@ static NSImage *DYWheelImage(void) {
|
||||
if(![path isKindOfClass:NSString.class]||![path isAbsolutePath]||![[path pathExtension].lowercaseString isEqual:@"cube"]){[self showError:@"预设包含无效 LUT 路径,尚未修改当前调色。"];return;}
|
||||
if([[NSFileManager defaultManager] isReadableFileAtPath:path])validPaths[key]=path;else [missing addObject:[path lastPathComponent]];
|
||||
}
|
||||
NSMutableDictionary *restoredTools=DYMutablePlist(tools);for(NSMutableDictionary *node in restoredTools[@"layers"]){NSMutableDictionary *nodePaths=node[@"paths"];for(NSString *key in [[nodePaths.allKeys copy]autorelease])if(![NSFileManager.defaultManager isReadableFileAtPath:nodePaths[key]]){[missing addObject:[nodePaths[key]lastPathComponent]];[nodePaths removeObjectForKey:key];}}tools=restoredTools;
|
||||
[self cancelAssetLoads];
|
||||
id<FxCustomParameterActionAPI_v4> action=[self actionAPI];if(!action)return;
|
||||
[action startAction:self];
|
||||
@try {
|
||||
CMTime t=action.currentTime;id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];
|
||||
for(NSDictionary *d in DYDescriptors())if(values[d[@"key"]])[set setFloatValue:[values[d[@"key"]] doubleValue] toParameter:[d[@"pid"] unsignedIntValue] atTime:t];
|
||||
for(NSDictionary *d in DYDescriptors()){id value=values[d[@"key"]];if(!value&&[d[@"offset"]integerValue]>=1104)value=d[@"default"];if(value)[set setFloatValue:[value doubleValue] toParameter:[d[@"pid"]unsignedIntValue] atTime:t];}
|
||||
if([json[@"version"]isEqual:@1]&&!values[@"cmConfigured"]){[set setFloatValue:-1 toParameter:2236 atTime:t];[set setFloatValue:1 toParameter:2270 atTime:t];}
|
||||
DYAssetState *assets=[[[DYAssetState alloc] init] autorelease];assets.paths=validPaths;assets.spiderMesh=mesh;assets.spiderLinked=mesh?[json[@"spider"][@"linked"]boolValue]:YES;DYWriteAssets(_manager,assets,t);
|
||||
DYAssetState *assets=[[[DYAssetState alloc] init] autorelease];assets.paths=validPaths;assets.spiderMesh=mesh;assets.spiderLinked=mesh?[json[@"spider"][@"linked"]boolValue]:YES;DYWriteAssets(_manager,assets,t);DYWriteTools(_manager,tools,t);
|
||||
} @finally {[action endAction:self];}
|
||||
[self postChanged];
|
||||
if(missing.count)[self showError:[@"调色参数已恢复,以下 LUT 文件需要重新选择:\n" stringByAppendingString:[missing componentsJoinedByString:@"\n"]]];
|
||||
}
|
||||
- (void)autoGrade:(id)sender { [[NSNotificationCenter defaultCenter]postNotificationName:@"DYAutoGrade" object:_manager]; }
|
||||
- (void)autoWhiteBalance:(id)sender { [[NSNotificationCenter defaultCenter]postNotificationName:@"DYAutoWhiteBalance" object:_manager]; }
|
||||
- (void)autoGrade:(id)sender { if(_embedded){[self writeGraphicValues:DYAutoGrade([_renderer preview])];return;}[[NSNotificationCenter defaultCenter]postNotificationName:@"DYAutoGrade" object:_manager]; }
|
||||
- (void)autoWhiteBalance:(id)sender { if(_embedded){[self writeGraphicValues:DYAutoWhiteBalance([_renderer preview])];return;}[[NSNotificationCenter defaultCenter]postNotificationName:@"DYAutoWhiteBalance" object:_manager]; }
|
||||
- (void)sampleWhiteBalance:(id)sender { [self sampleColorForWhiteBalance:YES]; }
|
||||
- (void)sampleCustomColor:(id)sender { [self sampleColorForWhiteBalance:NO]; }
|
||||
- (void)sampleColorForWhiteBalance:(BOOL)whiteBalance {
|
||||
@@ -1063,7 +1120,8 @@ static NSImage *DYWheelImage(void) {
|
||||
[_sampler showSamplerWithSelectionHandler:^(NSColor *selectedColor) {
|
||||
NSColor *color=[selectedColor colorUsingColorSpace:NSColorSpace.sRGBColorSpace];
|
||||
if(color) {
|
||||
if(whiteBalance)[[NSNotificationCenter defaultCenter]postNotificationName:@"DYWhiteBalanceColor" object:_manager userInfo:@{@"color":color}];
|
||||
if(whiteBalance&&_embedded){float t=0,i=0;if([DYColorTables neutralizeColor:(vector_float3){(float)color.redComponent,(float)color.greenComponent,(float)color.blueComponent} temperature:&t tint:&i])[self writeGraphicValues:@{@"temperature":@(t),@"tint":@(i)}];}
|
||||
else if(whiteBalance)[[NSNotificationCenter defaultCenter]postNotificationName:@"DYWhiteBalanceColor" object:_manager userInfo:@{@"color":color}];
|
||||
else [self writeGraphicValues:@{@"sample0":@(color.redComponent),@"sample1":@(color.greenComponent),@"sample2":@(color.blueComponent)}];
|
||||
}
|
||||
[_sampler release];_sampler=nil;
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
// Native per-tool mask editor, shared by original and repeated tool cards.
|
||||
@interface DYToolMaskPanel : DYFlippedView
|
||||
@property(nonatomic,readonly) CGFloat contentHeight;
|
||||
- (instancetype)initWithManager:(id<PROAPIAccessing>)manager nodeID:(NSString*)nodeID;
|
||||
- (void)refreshWithDocument:(NSDictionary*)document time:(CMTime)time;
|
||||
- (void)addMenu:(NSView*)anchor;
|
||||
@end
|
||||
@implementation DYToolMaskPanel {
|
||||
id<PROAPIAccessing> _host;NSString *_nodeID,*_maskID;NSDictionary *_document;CMTime _time;
|
||||
NSPopUpButton *_list,*_combine;NSButton *_eye,*_add,*_remove,*_invert,*_canvas,*_clear,*_penRedraw,*_penFinish,*_penCancel;NSMutableArray *_rows,*_tracking;NSTextField *_trackingTitle,*_status;BOOL _refreshing,_drawing,_canvasActive;CGFloat _contentHeight;
|
||||
}
|
||||
@synthesize contentHeight=_contentHeight;
|
||||
- (instancetype)initWithManager:(id<PROAPIAccessing>)manager nodeID:(NSString*)nodeID{
|
||||
if((self=[super initWithFrame:NSZeroRect])){_host=manager;_nodeID=[nodeID copy];_rows=[NSMutableArray new];_tracking=[NSMutableArray new];self.identifier=@"toolMasks";
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(trackingStatus:) name:@"DYToolTrackingStatus" object:_host];
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(canvasSelected:) name:@"DYToolCanvasSelection" object:_host];
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(canvasState:) name:@"DYToolCanvasState" object:_host];
|
||||
}return self;
|
||||
}
|
||||
- (void)buildControls{if(_list)return;
|
||||
_list=[[NSPopUpButton alloc]initWithFrame:NSZeroRect pullsDown:NO];_list.target=self;_list.action=@selector(selection:);_list.font=[NSFont systemFontOfSize:13 weight:NSFontWeightMedium];_list.controlSize=NSControlSizeRegular;_list.accessibilityLabel=@"本层蒙版";[self addSubview:_list];
|
||||
_eye=[DYButton(@"",self,@selector(enabled:))retain];_eye.image=[NSImage imageWithSystemSymbolName:@"eye" accessibilityDescription:@"蒙版启用"];_eye.imageScaling=NSImageScaleProportionallyUpOrDown;_eye.bordered=NO;[_eye setButtonType:NSButtonTypePushOnPushOff];[self addSubview:_eye];
|
||||
_add=[DYButton(@"+",self,@selector(add:))retain];_add.toolTip=@"再添加一个蒙版";_add.accessibilityLabel=_add.toolTip;[self addSubview:_add];
|
||||
_remove=[DYButton(@"−",self,@selector(remove:))retain];_remove.toolTip=@"删除选中的蒙版";_remove.accessibilityLabel=_remove.toolTip;[self addSubview:_remove];
|
||||
_combine=[[NSPopUpButton alloc]initWithFrame:NSZeroRect pullsDown:NO];[_combine addItemsWithTitles:@[@"相加",@"减去",@"相交"]];_combine.font=[NSFont systemFontOfSize:13];_combine.controlSize=NSControlSizeRegular;_combine.target=self;_combine.action=@selector(combine:);_combine.accessibilityLabel=@"蒙版组合方式";[self addSubview:_combine];
|
||||
_invert=[[NSButton checkboxWithTitle:@"反转" target:self action:@selector(inverted:)]retain];_invert.font=[NSFont systemFontOfSize:13];_invert.controlSize=NSControlSizeRegular;[self addSubview:_invert];
|
||||
_canvas=[DYButton(@"画面编辑",self,@selector(canvas:))retain];_canvas.toolTip=@"在宿主画面拖动中心、大小、旋转与钢笔节点;回车闭合钢笔";_canvas.accessibilityLabel=@"编辑本层蒙版画面控件";[self addSubview:_canvas];
|
||||
_penRedraw=[DYButton(@"重画钢笔",self,@selector(redrawPen:))retain];_penRedraw.toolTip=@"从空白重画钢笔;完成前保留原路径,可随时取消";_penRedraw.accessibilityLabel=@"重画钢笔蒙版";[self addSubview:_penRedraw];
|
||||
_penFinish=[DYButton(@"完成绘制",self,@selector(penCommand:))retain];_penFinish.toolTip=@"闭合当前钢笔路径并保存";_penFinish.accessibilityLabel=@"完成钢笔绘制";[self addSubview:_penFinish];
|
||||
_penCancel=[DYButton(@"取消绘制",self,@selector(penCommand:))retain];_penCancel.toolTip=@"取消当前绘制,保留原蒙版路径";_penCancel.accessibilityLabel=@"取消钢笔绘制";[self addSubview:_penCancel];
|
||||
_clear=[DYButton(@"清除轨迹",self,@selector(clear:))retain];[self addSubview:_clear];
|
||||
NSArray *names=@[@"强度",@"羽化",@"中心 X",@"中心 Y",@"宽度",@"高度",@"旋转",@"渐变宽度",@"色相中心",@"色相范围",@"色相柔边",@"饱和度下限",@"饱和度上限",@"亮度下限",@"亮度上限",@"输入黑",@"输入白",@"输入伽马"];
|
||||
for(NSInteger i=0;i<names.count;i++){NSTextField *label=[DYLabel(names[i],13)retain];label.font=[NSFont systemFontOfSize:13 weight:NSFontWeightMedium];NSSlider *slider=[[NSSlider alloc]initWithFrame:NSZeroRect];slider.tag=i;slider.target=self;slider.action=@selector(valueChanged:);slider.continuous=NO;slider.controlSize=NSControlSizeRegular;slider.accessibilityLabel=[names[i]stringByAppendingString:@"蒙版"];NSTextField *field=[[NSTextField alloc]initWithFrame:NSZeroRect];field.cell=[[[DYNumberFieldCell alloc]initTextCell:@"0"]autorelease];field.font=[NSFont monospacedDigitSystemFontOfSize:13 weight:NSFontWeightMedium];field.textColor=DYInk();field.backgroundColor=DYThemeColor(@"field");field.bezeled=NO;field.bordered=NO;field.drawsBackground=NO;field.tag=i;field.target=self;field.action=@selector(valueChanged:);field.accessibilityLabel=[names[i]stringByAppendingString:@"蒙版数值"];field.alignment=NSTextAlignmentCenter;[self addSubview:label];[self addSubview:slider];[self addSubview:field];[_rows addObject:@{@"label":label,@"slider":slider,@"field":field}];[label release];[slider release];[field release];}
|
||||
NSArray *titles=@[@"反向单帧",@"反向跟踪",@"双向跟踪",@"正向跟踪",@"正向单帧",@"取消跟踪"];
|
||||
for(int i=0;i<6;i++){NSButton *b=DYButton(titles[i],self,@selector(track:));b.tag=((int[]){-2,-1,0,1,2,9})[i];b.font=[NSFont systemFontOfSize:13 weight:NSFontWeightMedium];b.controlSize=NSControlSizeRegular;b.accessibilityLabel=@[@"反向跟踪一帧",@"反向蒙版跟踪",@"双向蒙版跟踪",@"正向蒙版跟踪",@"正向跟踪一帧",@"取消蒙版跟踪"][i];[self addSubview:b];[_tracking addObject:b];}
|
||||
for(NSButton *b in @[_eye,_add,_remove,_canvas,_clear,_penRedraw,_penFinish,_penCancel]){b.controlSize=NSControlSizeRegular;b.font=[NSFont systemFontOfSize:(b==_add||b==_remove)?18:13 weight:NSFontWeightMedium];}
|
||||
_trackingTitle=[DYLabel(@"运动跟踪",13)retain];_trackingTitle.font=[NSFont systemFontOfSize:13 weight:NSFontWeightSemibold];[self addSubview:_trackingTitle];
|
||||
_status=[DYLabel(@"",12)retain];_status.maximumNumberOfLines=3;_status.lineBreakMode=NSLineBreakByWordWrapping;[self addSubview:_status];_contentHeight=0;
|
||||
}
|
||||
- (void)dealloc{[NSNotificationCenter.defaultCenter removeObserver:self];[_nodeID release];[_maskID release];[_document release];[_list release];[_combine release];[_eye release];[_add release];[_remove release];[_invert release];[_canvas release];[_clear release];[_penRedraw release];[_penFinish release];[_penCancel release];[_rows release];[_tracking release];[_trackingTitle release];[_status release];[super dealloc];}
|
||||
- (NSDictionary*)mask{for(NSDictionary *m in DYMasksForTool(_document,_nodeID))if([m[@"id"]isEqual:_maskID])return m;return nil;}
|
||||
- (void)refreshWithDocument:(NSDictionary*)doc time:(CMTime)time{
|
||||
_refreshing=YES;NSDictionary *saved=[doc copy];[_document release];_document=saved;_time=time;NSArray *masks=DYMasksForTool(doc,_nodeID);if(masks.count)[self buildControls];[_list removeAllItems];NSInteger selected=0,index=0;
|
||||
for(NSDictionary *m in masks){DYMaskParameters p=DYMaskAtTime(m,time);[_list addItemWithTitle:[NSString stringWithFormat:@"%@ %ld",@[@"椭圆",@"矩形",@"钢笔",@"线性渐变",@"HSL 选区",@"亮度选区"][p.kind],(long)index+1]];if([m[@"id"]isEqual:_maskID])selected=index;index++;}
|
||||
if(!masks.count){_contentHeight=0;_drawing=_canvasActive=NO;_refreshing=NO;return;}[_list selectItemAtIndex:selected];if(![_maskID isEqual:masks[selected][@"id"]])_drawing=_canvasActive=NO;[_maskID release];_maskID=[masks[selected][@"id"]copy];NSDictionary *m=[self mask];DYMaskParameters p=DYMaskAtTime(m,time);if(p.kind!=DYMaskBezier)_drawing=NO;
|
||||
_eye.state=[m[@"enabled"]boolValue]?NSControlStateValueOn:NSControlStateValueOff;_eye.image=[NSImage imageWithSystemSymbolName:[m[@"enabled"]boolValue]?@"eye":@"eye.slash" accessibilityDescription:@"启用蒙版"];[_combine selectItemAtIndex:[m[@"combine"]integerValue]];_invert.state=(p.flags&DYMaskInvert)?NSControlStateValueOn:NSControlStateValueOff;
|
||||
float values[]={p.strength,p.feather,p.centerX,p.centerY,p.width,p.height,float(p.angle*180.f/M_PI),p.gradientWidth,p.hueCenterTurns*360.f,p.hueCoreHalfWidth*360.f,p.hueSoftWidth*360.f,p.saturationRange.low,p.saturationRange.high,p.lightnessRange.low,p.lightnessRange.high,p.inputBlack,p.inputWhite,p.inputGamma};
|
||||
NSInteger visible=0;for(NSInteger i=0;i<_rows.count;i++){BOOL show=i==0||(i==1&&p.kind<3)||(i>=2&&i<=6&&p.kind<4)||(i==7&&p.kind==3)||(i>=8&&i<=14&&p.kind==4)||(i>=15&&p.kind>=4);NSDictionary *row=_rows[i];for(NSView *v in row.allValues)v.hidden=!show;if(!show)continue;visible++;double lo=0,hi=1;if(i==2||i==3)lo=-1,hi=2;if(i==4||i==5||i==7)lo=.001,hi=2;if(i==6)lo=-180,hi=180;if(i==8)hi=360;if(i==9||i==10)hi=180;if(i==15)hi=.99;if(i==16)lo=.01,hi=2;if(i==17)lo=.01,hi=4;NSSlider *slider=row[@"slider"];slider.minValue=lo;slider.maxValue=hi;slider.doubleValue=values[i];[row[@"field"]setStringValue:[NSString stringWithFormat:@"%.3f",values[i]]];}
|
||||
BOOL shape=p.kind<3;for(NSButton *b in _tracking)b.hidden=!shape;_trackingTitle.hidden=!shape;_clear.hidden=!shape;_clear.enabled=[m[@"keys"]count]>0;
|
||||
BOOL pen=p.kind==DYMaskBezier;_penRedraw.hidden=!pen;_penFinish.hidden=!pen;_penCancel.hidden=!pen;
|
||||
[self updateDrawingControls];
|
||||
_status.stringValue=m[@"status"]?:([m[@"keys"]count]?[NSString stringWithFormat:@"%lu 个轨迹键 · 修改几何会在当前帧建立手工键",(unsigned long)[m[@"keys"]count]]:pen?@"重画钢笔后,点击起点或“完成绘制”闭合;取消或 Esc 保留原路径。":@"各蒙版只影响当前工具层");
|
||||
// Keep every scalar readable at the narrowest native inspector width. A
|
||||
// label/value line and a separate full-width slider avoid compressed controls.
|
||||
_contentHeight=136+(pen?84:0)+visible*58+(shape?184:0)+58;[self setNeedsLayout:YES];_refreshing=NO;
|
||||
}
|
||||
- (void)layout{
|
||||
[super layout];CGFloat w=self.bounds.size.width;
|
||||
_eye.frame=NSMakeRect(0,4,32,34);_list.frame=NSMakeRect(38,4,MAX(60,w-114),34);_add.frame=NSMakeRect(w-70,4,32,34);_remove.frame=NSMakeRect(w-32,4,32,34);
|
||||
CGFloat combineWidth=MIN(112,MAX(90,w*.45));_combine.frame=NSMakeRect(0,46,combineWidth,34);_invert.frame=NSMakeRect(combineWidth+12,49,MAX(70,w-combineWidth-12),28);_canvas.frame=NSMakeRect(0,88,w,36);
|
||||
CGFloat y=136;if(_penRedraw&&!_penRedraw.hidden){CGFloat bw=(w-8)/2;_penRedraw.frame=NSMakeRect(0,y,bw,34);_penFinish.frame=NSMakeRect(bw+8,y,bw,34);_penCancel.frame=NSMakeRect(0,y+40,w,34);y+=84;}for(NSDictionary *r in _rows){NSTextField *label=r[@"label"];if(label.hidden)continue;label.frame=NSMakeRect(2,y+6,MAX(60,w-100),22);[r[@"field"]setFrame:NSMakeRect(w-90,y,88,32)];[r[@"slider"]setFrame:NSMakeRect(0,y+32,w,24)];y+=58;}
|
||||
if(_tracking.count&&![_tracking[0]isHidden]){_trackingTitle.frame=NSMakeRect(2,y+2,w-4,20);y+=28;CGFloat bw=(w-8)/2;const int order[]={0,4,1,3,2,5};for(int i=0;i<6;i++)[_tracking[order[i]]setFrame:NSMakeRect((i%2)*(bw+8),y+(i/2)*38,bw,34)];y+=114;_clear.frame=NSMakeRect(0,y,w,34);y+=42;}
|
||||
_status.frame=NSMakeRect(2,y+2,w-4,52);
|
||||
}
|
||||
- (void)edit:(NSString*)title block:(void (^)(NSMutableDictionary*,NSMutableDictionary*))block{
|
||||
id<FxCustomParameterActionAPI_v4>a=[_host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(_host,a.currentTime).document);NSMutableArray *masks=(id)DYMasksForTool(doc,_nodeID);NSMutableDictionary *mask=nil;for(NSMutableDictionary *m in masks)if([m[@"id"]isEqual:_maskID])mask=m;if(!mask)return;block(doc,mask);if(!DYValidToolDocument(doc)){NSBeep();return;}id<FxUndoAPI>undo=[_host apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:title];DYWriteTools(_host,doc,a.currentTime);[undo endUndoGroup];}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_host];}
|
||||
- (void)add:(id)sender{[self addMenu:_add];}
|
||||
- (void)addMenu:(NSView*)anchor{NSMenu *menu=[[[NSMenu alloc]initWithTitle:@"添加蒙版"]autorelease];for(int i=0;i<6;i++){NSMenuItem *item=[menu addItemWithTitle:@[@"椭圆",@"矩形",@"钢笔",@"线性渐变",@"HSL 选区",@"亮度选区"][i] action:@selector(addKind:) keyEquivalent:@""];item.target=self;item.tag=i;}[menu popUpMenuPositioningItem:nil atLocation:NSMakePoint(0,anchor.bounds.size.height) inView:anchor];}
|
||||
- (void)addKind:(NSMenuItem*)sender{
|
||||
id<FxCustomParameterActionAPI_v4>a=[_host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(_host,a.currentTime).document);NSMutableArray *masks=[[DYMasksForTool(doc,_nodeID)mutableCopy]autorelease];if(masks.count>=DYToolMaskLimit){NSBeep();return;}NSDictionary *mask=DYNewMask(sender.tag);[masks addObject:mask];if(!DYSetToolMasks(doc,_nodeID,masks))return;[_maskID release];_maskID=[mask[@"id"]copy];NSDictionary *staged=[doc copy];[_document release];_document=staged;[self sendCanvasDrawing:sender.tag==DYMaskBezier];id<FxUndoAPI>undo=[_host apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"添加工具蒙版"];DYWriteTools(_host,doc,a.currentTime);[undo endUndoGroup];[_maskID release];_maskID=[mask[@"id"]copy];}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_host];[self sendCanvasDrawing:sender.tag==DYMaskBezier];}
|
||||
- (void)selection:(id)sender{NSArray *m=DYMasksForTool(_document,_nodeID);if(_list.indexOfSelectedItem<0||_list.indexOfSelectedItem>=m.count)return;[_maskID release];_maskID=[m[_list.indexOfSelectedItem][@"id"]copy];[self refreshWithDocument:_document time:_time];[self canvas:nil];[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_host];}
|
||||
- (void)remove:(id)sender{[self edit:@"删除工具蒙版" block:^(NSMutableDictionary *doc,NSMutableDictionary *mask){NSMutableArray *masks=[[DYMasksForTool(doc,self->_nodeID)mutableCopy]autorelease];[masks removeObject:mask];DYSetToolMasks(doc,self->_nodeID,masks);}];[self canvas:nil];}
|
||||
- (void)enabled:(NSButton*)sender{[self edit:@"启停蒙版" block:^(NSMutableDictionary *d,NSMutableDictionary *m){m[@"enabled"]=@(sender.state==NSControlStateValueOn);}];}
|
||||
- (void)combine:(id)sender{[self edit:@"蒙版组合" block:^(NSMutableDictionary *d,NSMutableDictionary *m){m[@"combine"]=@(self->_combine.indexOfSelectedItem);}];}
|
||||
- (void)inverted:(NSButton*)sender{[self edit:@"反转蒙版" block:^(NSMutableDictionary *d,NSMutableDictionary *m){DYMaskParameters p;[m[@"parameters"]getBytes:&p length:sizeof(p)];if(sender.state)p.flags|=DYMaskInvert;else p.flags&=~DYMaskInvert;m[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];}];}
|
||||
- (void)valueChanged:(NSControl*)sender{if(_refreshing)return;double value=sender.doubleValue;if(!std::isfinite(value)){NSBeep();return;}NSInteger i=sender.tag;[self edit:@"调整工具蒙版" block:^(NSMutableDictionary *d,NSMutableDictionary *m){DYMaskParameters p=DYMaskAtTime(m,self->_time);float *fields[]={&p.strength,&p.feather,&p.centerX,&p.centerY,&p.width,&p.height,&p.angle,&p.gradientWidth,&p.hueCenterTurns,&p.hueCoreHalfWidth,&p.hueSoftWidth,&p.saturationRange.low,&p.saturationRange.high,&p.lightnessRange.low,&p.lightnessRange.high,&p.inputBlack,&p.inputWhite,&p.inputGamma};*fields[i]=(i==6?value*M_PI/180:i>=8&&i<=10?value/360:value);if(p.kind==DYMaskHSLKey)p.flags|=DYMaskHueEnabled|DYMaskSaturationEnabled|DYMaskLightnessEnabled;if(!dyValidMaskParameters(p))return;if([m[@"keys"]count]&&i<8){NSMutableArray *keys=[[m[@"keys"]mutableCopy]autorelease];[keys filterUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSDictionary *key,NSDictionary *bindings){CMTime t=CMTimeMakeWithEpoch([key[@"value"]longLongValue],[key[@"scale"]intValue],[key[@"epoch"]longLongValue]);return CMTimeCompare(t,self->_time)!=0;}]];[keys addObject:DYMaskKey(self->_time,p,YES,1)];[keys sortUsingComparator:^NSComparisonResult(NSDictionary *a,NSDictionary *b){CMTime x=CMTimeMakeWithEpoch([a[@"value"]longLongValue],[a[@"scale"]intValue],[a[@"epoch"]longLongValue]),y=CMTimeMakeWithEpoch([b[@"value"]longLongValue],[b[@"scale"]intValue],[b[@"epoch"]longLongValue]);return (NSComparisonResult)CMTimeCompare(x,y);}];m[@"keys"]=keys;}else m[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];}];}
|
||||
- (void)updateDrawingControls{for(NSButton *button in _tracking)button.enabled=!_drawing;_clear.enabled=!_drawing&&[[self mask][@"keys"]count]>0;_penFinish.enabled=_drawing;_penCancel.enabled=_drawing;}
|
||||
- (void)canvasSelected:(NSNotification*)n{_canvasActive=[n.userInfo[@"node"]isEqual:_nodeID]&&[n.userInfo[@"mask"]length];if(_canvasActive){NSString *ID=[n.userInfo[@"mask"]copy];[_maskID release];_maskID=ID;_drawing=[n.userInfo[@"draw"]boolValue];}else _drawing=NO;[self updateDrawingControls];}
|
||||
- (void)canvasState:(NSNotification*)n{if(!_canvasActive||![n.userInfo[@"node"]isEqual:_nodeID]||![n.userInfo[@"mask"]isEqual:_maskID])return;_drawing=[n.userInfo[@"drawing"]boolValue];[self updateDrawingControls];}
|
||||
- (void)sendCanvasDrawing:(BOOL)drawing{[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasSelection" object:_host userInfo:@{@"node":_nodeID,@"mask":_maskID?:@"",@"document":_document?:@{},@"draw":@(drawing)}];}
|
||||
- (void)canvas:(id)sender{[self sendCanvasDrawing:NO];}
|
||||
- (void)redrawPen:(id)sender{[self sendCanvasDrawing:YES];}
|
||||
- (void)penCommand:(NSButton*)sender{[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasCommand" object:_host userInfo:@{@"node":_nodeID,@"mask":_maskID?:@"",@"command":sender==_penFinish?@"finish":@"cancel",@"timeValue":@(_time.value),@"timeScale":@(_time.timescale),@"timeEpoch":@(_time.epoch)}];}
|
||||
- (void)clear:(id)sender{if(_drawing)return;[self edit:@"清除蒙版轨迹" block:^(NSMutableDictionary *d,NSMutableDictionary *m){DYMaskParameters p=DYMaskAtTime(m,self->_time);m[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];m[@"keys"]=@[];[m removeObjectForKey:@"status"];}];}
|
||||
- (void)track:(NSButton*)sender{if(_drawing)return;[self canvas:nil];[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolTrack" object:_host userInfo:@{@"node":_nodeID,@"mask":_maskID?:@"",@"direction":@(sender.tag)}];}
|
||||
- (void)trackingStatus:(NSNotification*)n{if([n.userInfo[@"node"]isEqual:_nodeID])_status.stringValue=n.userInfo[@"message"]?:@"";}
|
||||
@end
|
||||
@@ -0,0 +1,47 @@
|
||||
// Native inspector geometry/readability and pen command routing, without a GUI
|
||||
// document. Include inside DYDiagnostics' existing run/manager/renderer scope.
|
||||
{
|
||||
BOOL readable=YES,contained=YES,noOverlap=YES,penVisibility=YES;
|
||||
DYToolDocument *empty=[[[DYToolDocument alloc]init]autorelease];
|
||||
for(int kind=0;kind<6;kind++){
|
||||
NSMutableDictionary *document=DYMutablePlist(empty.document);
|
||||
document[@"baseMasks"][@"hsl"]=[NSMutableArray arrayWithObject:DYNewMask(kind)];
|
||||
DYWriteTools(manager,document,kCMTimeZero);
|
||||
DYInspector *inspector=[[[DYInspector alloc]initWithAPIManager:manager renderer:renderer]autorelease];
|
||||
[inspector refresh];NSDictionary *hslCard=nil;
|
||||
for(NSDictionary *card in [inspector valueForKey:@"_cards"])if([card[@"section"][@"key"]isEqual:@"hsl"])hslCard=card;
|
||||
NSView *panel=hslCard[@"maskPanel"];
|
||||
if(!panel){readable=contained=noOverlap=penVisibility=NO;continue;}
|
||||
NSArray *rows=[panel valueForKey:@"_rows"],*tracking=[panel valueForKey:@"_tracking"];
|
||||
NSButton *redraw=[panel valueForKey:@"_penRedraw"],*finish=[panel valueForKey:@"_penFinish"],*cancel=[panel valueForKey:@"_penCancel"];
|
||||
penVisibility&=redraw.hidden==(kind!=DYMaskBezier)&&finish.hidden==redraw.hidden&&cancel.hidden==redraw.hidden;
|
||||
for(NSNumber *width in @[@220,@300,@420]){
|
||||
CGFloat height=[[panel valueForKey:@"contentHeight"]doubleValue];[panel setFrameSize:NSMakeSize(width.doubleValue,height)];[panel layoutSubtreeIfNeeded];
|
||||
for(NSView *view in panel.subviews)if(!view.hidden)contained&=NSContainsRect(panel.bounds,view.frame)&&view.frame.size.width>0&&view.frame.size.height>0;
|
||||
for(NSDictionary *row in rows){NSTextField *label=row[@"label"],*field=row[@"field"];NSSlider *slider=row[@"slider"];if(label.hidden)continue;
|
||||
readable&=label.font.pointSize>=13&&field.font.pointSize>=13&&field.frame.size.width>=80&&field.frame.size.height>=30&&slider.frame.size.height>=24;
|
||||
noOverlap&=!NSIntersectsRect(label.frame,field.frame)&&!NSIntersectsRect(label.frame,slider.frame)&&!NSIntersectsRect(field.frame,slider.frame);
|
||||
}
|
||||
for(NSButton *button in tracking)if(!button.hidden)readable&=button.font.pointSize>=13&&button.frame.size.width>=100&&button.frame.size.height>=32;
|
||||
if(kind==DYMaskBezier)for(NSButton *button in @[redraw,finish,cancel])readable&=button.font.pointSize>=13&&button.frame.size.width>=100&&button.frame.size.height>=32;
|
||||
}
|
||||
if(kind==DYMaskBezier){
|
||||
NSMutableArray *events=[NSMutableArray array];NSNotificationCenter *center=NSNotificationCenter.defaultCenter;
|
||||
id selection=[center addObserverForName:@"DYToolCanvasSelection" object:manager queue:nil usingBlock:^(NSNotification *note){[events addObject:@{@"name":note.name,@"payload":note.userInfo?:@{}}];}];
|
||||
id command=[center addObserverForName:@"DYToolCanvasCommand" object:manager queue:nil usingBlock:^(NSNotification *note){[events addObject:@{@"name":note.name,@"payload":note.userInfo?:@{}}];}];
|
||||
[redraw performClick:nil];[finish performClick:nil];[cancel performClick:nil];
|
||||
BOOL routed=events.count==3&&[events[0][@"payload"][@"draw"]boolValue]&&[events[0][@"payload"][@"node"]isEqual:@"base:hsl"]&&[events[0][@"payload"][@"document"]isEqual:document]&&[events[1][@"payload"][@"command"]isEqual:@"finish"]&&[events[2][@"payload"][@"command"]isEqual:@"cancel"];
|
||||
for(NSDictionary *event in events)routed&=[event[@"payload"][@"mask"]isEqual:document[@"baseMasks"][@"hsl"][0][@"id"]];
|
||||
routed&=[events.lastObject[@"payload"][@"timeScale"]intValue]==kCMTimeZero.timescale;
|
||||
run.record(@"native-pen-panel-routes-redraw-finish-and-cancel-to-own-mask",routed);[center removeObserver:selection];[center removeObserver:command];
|
||||
[inspector refresh];BOOL drawingProtected=[[panel valueForKey:@"_drawing"]boolValue];for(NSButton *button in tracking)drawingProtected&=!button.enabled;drawingProtected&=![[panel valueForKey:@"_clear"]isEnabled];
|
||||
[center postNotificationName:@"DYToolCanvasState" object:manager userInfo:@{@"node":@"base:hsl",@"mask":@"different-mask",@"drawing":@NO}];drawingProtected&=[[panel valueForKey:@"_drawing"]boolValue];
|
||||
[center postNotificationName:@"DYToolCanvasState" object:manager userInfo:@{@"node":@"base:hsl",@"mask":document[@"baseMasks"][@"hsl"][0][@"id"],@"drawing":@NO}];BOOL restored=![[panel valueForKey:@"_drawing"]boolValue];for(NSButton *button in tracking)restored&=button.enabled;restored&=!finish.enabled&&!cancel.enabled;
|
||||
run.record(@"pen-panel-disables-tracking-through-refresh-and-restores-after-own-finish",drawingProtected&&restored);
|
||||
}
|
||||
}
|
||||
run.record(@"mask-panel-readable-fields-and-button-targets-at-native-narrow-width",readable);
|
||||
run.record(@"six-mask-panel-layouts-fit-220-300-and-420-point-widths",contained&&noOverlap);
|
||||
run.record(@"pen-drawing-actions-visible-only-for-bezier-mask",penVisibility);
|
||||
DYWriteTools(manager,empty.document,kCMTimeZero);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
#import "DYModel.h"
|
||||
#import "DYToolState.h"
|
||||
#include <cmath>
|
||||
#include "DYSpiderState.h"
|
||||
NSString *const DYModelChanged=@"DYModelChanged";
|
||||
@@ -154,6 +155,34 @@ static void initialize(){static dispatch_once_t once;dispatch_once(&once,^{
|
||||
NSMutableArray*levels=[NSMutableArray array];for(int c=0;c<4;c++)for(int a=0;a<5;a++)[levels addObject:scalar([NSString stringWithFormat:@"level%d_%d",c,a],[NSString stringWithFormat:@"%@ %@",@[@"RGB",@"红",@"绿",@"蓝"][c],@[@"输入黑",@"伽马",@"输入白",@"输出黑",@"输出白"][a]],624+a*16+c*4,a==1?.1:0,a==1?10:255,a==1?1:(a==2||a==4)?255:0)];section(@"levels",@"色阶",608,levels);
|
||||
NSMutableArray*bw=[NSMutableArray array];for(int c=0;c<6;c++)[bw addObject:scalar([NSString stringWithFormat:@"bw%d",c],[NSString stringWithFormat:@"黑白 %@",@[@"红",@"黄",@"绿",@"青",@"蓝",@"洋红"][c]],c<4?720+c*4:736+(c-4)*4,0,200,((double[]){40,60,40,60,20,80})[c])];[bw addObject:scalar(@"bwHue",@"着色色相",744,0,360)];[bw addObject:scalar(@"bwSat",@"着色饱和度",748,0,100)];[bw insertObject:scalar(@"blackWhiteMix",@"黑白混合",offsetof(DYUniforms,cm)+offsetof(DYCMSettings,blackWhiteMix),0,1,0) atIndex:0];section(@"blackwhite",@"黑白混色",704,bw,1);
|
||||
NSMutableArray*balance=[NSMutableArray arrayWithObject:row(@"preserveLuma",@"保持明度",756,0,1,1,@"bool")];for(int c=0;c<3;c++)for(int a=0;a<3;a++)[balance addObject:scalar([NSString stringWithFormat:@"balance%d_%d",c,a],[NSString stringWithFormat:@"%@ %@",@[@"阴影",@"中间调",@"高光"][c],@[@"青 ↔ 红",@"洋红 ↔ 绿",@"黄 ↔ 蓝"][a]],768+c*16+a*4)];section(@"balance",@"色彩平衡",752,balance);
|
||||
NSMutableArray *mixer=[NSMutableArray array];
|
||||
for(int output=0;output<3;output++)for(int input=0;input<3;input++){
|
||||
NSMutableDictionary *d=[[scalar([NSString stringWithFormat:@"mixer%d%d",output,input],[NSString stringWithFormat:@"%@输出 ← %@输入",@[@"红",@"绿",@"蓝"][output],@[@"红",@"绿",@"蓝"][input]],offsetof(DYUniforms,mixerRed)+output*16+input*4,-2,2,output==input?1:0)mutableCopy]autorelease];
|
||||
d[@"mixerTab"]=@(output);[descriptors replaceObjectAtIndex:descriptors.count-1 withObject:d];[mixer addObject:d];
|
||||
}
|
||||
[mixer addObject:row(@"mixerPreserveLuma",@"保持亮度",offsetof(DYUniforms,mixerPreserveLuma),0,1,0,@"bool")];
|
||||
[mixer addObject:row(@"mixerPreserveSaturation",@"保持饱和度",offsetof(DYUniforms,mixerPreserveSaturation),0,1,0,@"bool")];
|
||||
[mixer addObject:scalar(@"mixerMix",@"通道混合强度",offsetof(DYUniforms,mixerMix),0,1,1)];
|
||||
section(@"mixer",@"通道混合器",offsetof(DYUniforms,mixerSectionEnabled),mixer);
|
||||
NSMutableArray *film=[NSMutableArray array];
|
||||
auto filmRow=[&](NSString *key,NSString *title,NSUInteger offset,double lo,double hi,double value,int tab,NSString *kind=@"float"){
|
||||
NSMutableDictionary *d=[[row(key,title,offsetof(DYUniforms,film)+offset,lo,hi,value,kind)mutableCopy]autorelease];d[@"filmTab"]=@(tab);[descriptors replaceObjectAtIndex:descriptors.count-1 withObject:d];[film addObject:d];return d;
|
||||
};
|
||||
#define FR(f,key,title,lo,hi,value,tab) filmRow(key,title,offsetof(DYFilmSettings,f),lo,hi,value,tab)
|
||||
#define FE(f,key,title,tab) filmRow(key,title,offsetof(DYFilmSettings,f),0,1,0,tab,@"bool")
|
||||
FR(mix,@"filmMix",@"胶片混合强度",0,1,1,-1);
|
||||
FE(subtractiveEnabled,@"filmSubtractive",@"启用减色",0);
|
||||
FR(gammaAll,@"filmGammaAll",@"整体减色",.25,4,1,0);FR(gammaCyan,@"filmGammaCyan",@"青色减色",.25,4,1,0);FR(gammaMagenta,@"filmGammaMagenta",@"洋红减色",.25,4,1,0);FR(gammaYellow,@"filmGammaYellow",@"黄色减色",.25,4,1,0);FR(density,@"filmDensity",@"密度",-1,1,0,0);
|
||||
NSMutableDictionary *density=FR(densityMode,@"filmDensityMode",@"密度模式",1,2,2,0);density[@"kind"]=@"popup";density[@"values"]=@[@2,@1];density[@"options"]=@[@"模式 1 · 最大值",@"模式 2 · 平均值"];
|
||||
row(@"filmValueMode",@"胶片亮度模型",offsetof(DYUniforms,film)+offsetof(DYFilmSettings,valueMode),1,6,6,@"float");
|
||||
FE(halationEnabled,@"filmHalation",@"启用晕光",1);FR(scatter,@"filmScatter",@"散射半径",0,100,5,1);FR(dyeTransmission,@"filmTransmission",@"染料透射",0,100,0,1);FR(boost,@"filmBoost",@"晕光增强",0,5,1,1);
|
||||
FE(bloomEnabled,@"filmBloom",@"启用辉光",2);FR(sensitivity,@"filmSensitivity",@"辉光灵敏度",0,100,50,2);FR(diffusion,@"filmDiffusion",@"辉光扩散",0,100,30,2);FR(intensity,@"filmIntensity",@"辉光强度",0,100,50,2);
|
||||
FE(grainEnabled,@"filmGrain",@"启用颗粒",3);FR(grainAmount,@"filmGrainAmount",@"颗粒数量",0,1,0,3);FR(grainSize,@"filmGrainSize",@"颗粒大小",1,20,1,3);FR(grainResponse,@"filmGrainResponse",@"胶片响应",-1,1,0,3);FR(grainColor,@"filmGrainColor",@"颜色变化",0,1,0,3);
|
||||
NSMutableDictionary *hold=FR(grainHold,@"filmGrainHold",@"颗粒帧保持",1,5,1,3);hold[@"kind"]=@"popup";hold[@"options"]=@[@"每帧更新",@"保持 2 帧",@"保持 3 帧",@"保持 4 帧",@"保持 5 帧"];hold[@"values"]=@[@1,@2,@3,@4,@5];FR(grainSeed,@"filmGrainSeed",@"颗粒种子",0,65535,0,3);
|
||||
FE(vignetteEnabled,@"filmVignette",@"启用暗角",4);FR(vignetteIntensity,@"filmVignetteIntensity",@"暗角强度",-2,2,1,4);FR(vignetteRadius,@"filmVignetteRadius",@"暗角半径",0,100,50,4);FR(vignetteFalloff,@"filmVignetteFalloff",@"暗角过渡",0,1,.5,4);
|
||||
section(@"film",@"胶片模拟",offsetof(DYUniforms,film)+offsetof(DYFilmSettings,enabled),film);
|
||||
#undef FR
|
||||
#undef FE
|
||||
});}
|
||||
NSArray<NSDictionary*> *DYSections(void){initialize();return sections;} NSArray<NSDictionary*> *DYDescriptors(void){initialize();return descriptors;}
|
||||
void DYDefaultUniforms(DYUniforms*u){memset(u,0,sizeof(*u));for(NSDictionary*r in DYDescriptors())if([r[@"offset"]integerValue]>=0)*(float*)((uint8_t*)u+[r[@"offset"]unsignedIntegerValue])=[r[@"default"]floatValue];u->primariesM0=(DYFloat3){1,0,0};u->primariesM1=(DYFloat3){0,1,0};u->primariesM2=(DYFloat3){0,0,1};}
|
||||
@@ -164,6 +193,8 @@ BOOL DYCreateParameters(id<PROAPIAccessing>m,NSError**error){id<FxParameterCreat
|
||||
ok=[a addCustomParameterWithName:@"大鱼调色" parameterID:DYInspectorParameterID defaultValue:[[[DYInspectorToken alloc]init]autorelease] parameterFlags:kFxParameterFlag_CUSTOM_UI|kFxParameterFlag_USE_FULL_VIEW_WIDTH|kFxParameterFlag_DONT_DISPLAY_IN_DASHBOARD|kFxParameterFlag_NOT_ANIMATABLE]&&ok;
|
||||
for(NSDictionary*r in DYDescriptors())ok=[a addFloatSliderWithName:r[@"title"] parameterID:[r[@"pid"]unsignedIntValue] defaultValue:[r[@"default"]doubleValue] parameterMin:[r[@"min"]doubleValue] parameterMax:[r[@"max"]doubleValue] sliderMin:[r[@"min"]doubleValue] sliderMax:[r[@"max"]doubleValue] delta:[r[@"step"]doubleValue] parameterFlags:kFxParameterFlag_HIDDEN|([r[@"notAnimatable"]boolValue]?kFxParameterFlag_NOT_ANIMATABLE:0)]&&ok;
|
||||
ok=[a addCustomParameterWithName:@"LUT 文件" parameterID:DYAssetsParameterID defaultValue:[[[DYAssetState alloc]init]autorelease] parameterFlags:kFxParameterFlag_HIDDEN|kFxParameterFlag_NOT_ANIMATABLE]&&ok;
|
||||
ok=[a addCustomParameterWithName:@"工具与蒙版" parameterID:DYToolsParameterID defaultValue:[[[DYToolDocument alloc]init]autorelease] parameterFlags:kFxParameterFlag_HIDDEN|kFxParameterFlag_NOT_ANIMATABLE]&&ok;
|
||||
ok=[a addStringParameterWithName:@"蒙版画布会话" parameterID:DYCanvasSessionParameterID defaultValue:@"" parameterFlags:kFxParameterFlag_HIDDEN|kFxParameterFlag_NOT_ANIMATABLE|kFxParameterFlag_DONT_SAVE]&&ok;
|
||||
if(!ok&&error)*error=[NSError errorWithDomain:FxPlugErrorDomain code:kFxError_InvalidParameter userInfo:@{NSLocalizedDescriptionKey:@"无法创建大鱼调色参数"}];return ok;}
|
||||
@implementation DYAssetState
|
||||
+ (BOOL)supportsSecureCoding{return YES;}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#import <FxPlug/FxPlugSDK.h>
|
||||
@interface DYPlugIn : NSObject<FxTileableEffect,FxCustomParameterViewHost_v2>
|
||||
@interface DYPlugIn : NSObject<FxTileableEffect,FxCustomParameterViewHost_v2,FxAnalyzer>
|
||||
@property(assign) id<PROAPIAccessing> apiManager;
|
||||
@end
|
||||
+20
-9
@@ -4,30 +4,41 @@
|
||||
#import "DYInspector.h"
|
||||
#import "DYColorTables.h"
|
||||
#import "DYAutoGrade.h"
|
||||
#import "DYToolState.h"
|
||||
#include "DYFilmTime.h"
|
||||
#import <CoreImage/CoreImage.h>
|
||||
#import <os/log.h>
|
||||
#include "MaskCore/DYTracker.hpp"
|
||||
#include <atomic>
|
||||
#include "DYToolHostDeclarations.inc.h"
|
||||
#include "DYToolFlow.inc.h"
|
||||
@implementation DYPlugIn {
|
||||
DYRenderer *_renderer;
|
||||
BOOL _copyAnalyzed;
|
||||
#include "DYToolHostIvars.inc.h"
|
||||
}
|
||||
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager{if((self=[super init])){_apiManager=manager;_renderer=[DYRenderer new];NSNotificationCenter*n=NSNotificationCenter.defaultCenter;[n addObserver:self selector:@selector(exportRequested:) name:@"DYExportLUT" object:manager];[n addObserver:self selector:@selector(autoRequested:) name:@"DYAutoGrade" object:manager];[n addObserver:self selector:@selector(autoRequested:) name:@"DYAutoWhiteBalance" object:manager];[n addObserver:self selector:@selector(whiteBalanceRequested:) name:@"DYWhiteBalanceColor" object:manager];}return self;}
|
||||
- (void)dealloc{[NSNotificationCenter.defaultCenter removeObserver:self];[_renderer release];[super dealloc];}
|
||||
- (BOOL)properties:(NSDictionary**)p error:(NSError**)e{*p=@{kFxPropertyKey_MayRemapTime:@NO,kFxPropertyKey_PixelTransformSupport:@(kFxPixelTransform_ScaleTranslate),kFxPropertyKey_VariesWhenParamsAreStatic:@NO,kFxPropertyKey_DesiredProcessingColorInfo:@(kFxImageColorInfo_RGB_LINEAR),kFxPropertyKey_NeedsFullBuffer:@YES};return YES;}
|
||||
#include "DYToolHostMethods.inc.h"
|
||||
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager{if((self=[super init])){_apiManager=manager;_renderer=[DYRenderer new];[self initializeToolHost];NSNotificationCenter*n=NSNotificationCenter.defaultCenter;[n addObserver:self selector:@selector(exportRequested:) name:@"DYExportLUT" object:manager];[n addObserver:self selector:@selector(autoRequested:) name:@"DYAutoGrade" object:manager];[n addObserver:self selector:@selector(autoRequested:) name:@"DYAutoWhiteBalance" object:manager];[n addObserver:self selector:@selector(whiteBalanceRequested:) name:@"DYWhiteBalanceColor" object:manager];}return self;}
|
||||
- (void)dealloc{[self tearDownToolHost];[NSNotificationCenter.defaultCenter removeObserver:self];[_renderer release];[super dealloc];}
|
||||
- (BOOL)properties:(NSDictionary**)p error:(NSError**)e{*p=@{kFxPropertyKey_MayRemapTime:@NO,kFxPropertyKey_PixelTransformSupport:@(kFxPixelTransform_ScaleTranslate),kFxPropertyKey_VariesWhenParamsAreStatic:@YES,kFxPropertyKey_DesiredProcessingColorInfo:@(kFxImageColorInfo_RGB_LINEAR),kFxPropertyKey_NeedsFullBuffer:@YES};return YES;}
|
||||
- (BOOL)addParametersWithError:(NSError**)e{return DYCreateParameters(_apiManager,e);}
|
||||
- (NSSet<Class>*)classesForCustomParameterID:(UInt32)pid{return pid==DYAssetsParameterID?[NSSet setWithObjects:DYAssetState.class,NSDictionary.class,NSString.class,NSData.class,nil]:[NSSet setWithObjects:DYInspectorToken.class,NSDictionary.class,NSString.class,NSNumber.class,nil];}
|
||||
- (NSView*)createViewForParameterID:(UInt32)pid{return pid==DYInspectorParameterID?[[DYInspector alloc]initWithAPIManager:_apiManager renderer:_renderer]:[[NSView alloc]initWithFrame:NSZeroRect];}
|
||||
- (BOOL)parameterChanged:(UInt32)pid atTime:(CMTime)t error:(NSError**)e{if(pid==2013||pid==2014||(pid>=2236&&pid<2400)||pid==DYAssetsParameterID)[_renderer invalidatePreview];dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self.apiManager];});return YES;}
|
||||
- (NSSet<Class>*)classesForCustomParameterID:(UInt32)pid{return pid==DYToolsParameterID?[NSSet setWithObjects:DYToolDocument.class,NSDictionary.class,NSArray.class,NSString.class,NSNumber.class,NSData.class,nil]:pid==DYAssetsParameterID?[NSSet setWithObjects:DYAssetState.class,NSDictionary.class,NSString.class,NSData.class,nil]:[NSSet setWithObjects:DYInspectorToken.class,NSDictionary.class,NSString.class,NSNumber.class,nil];}
|
||||
- (NSView*)createViewForParameterID:(UInt32)pid{[self scheduleToolCanvasRegistration];return pid==DYInspectorParameterID?[[DYInspector alloc]initWithAPIManager:_apiManager renderer:_renderer]:[[NSView alloc]initWithFrame:NSZeroRect];}
|
||||
- (BOOL)parameterChanged:(UInt32)pid atTime:(CMTime)t error:(NSError**)e{if(pid==DYToolsParameterID)[self adoptToolCanvasDocument:DYReadTools(_apiManager,t).document];if(pid==DYToolsParameterID||pid==2013||pid==2014||(pid>=2236&&pid<2400)||pid==DYAssetsParameterID)[_renderer invalidatePreview];dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self.apiManager];});return YES;}
|
||||
- (BOOL)pluginState:(NSData**)state atTime:(CMTime)t quality:(FxQuality)q error:(NSError**)e{
|
||||
DYUniforms u;DYReadUniforms(_apiManager,t,&u);DYAssetState*a=DYReadAssets(_apiManager,t);double copyAuto=0;[[_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getFloatValue:©Auto fromParameter:8800 atTime:t];NSDictionary*s=@{@"schema":@1,@"copyAuto":@(copyAuto>.5),@"uniforms":[NSData dataWithBytes:&u length:sizeof(u)],@"paths":a.paths?:@{},@"spider":a.spiderMesh?:[NSData data]};*state=[NSPropertyListSerialization dataWithPropertyList:s format:NSPropertyListBinaryFormat_v1_0 options:0 error:e];return *state!=nil;
|
||||
DYUniforms u;DYReadUniforms(_apiManager,t,&u);CMTime frameDuration=kCMTimeInvalid,origin=kCMTimeZero;id<FxTimingAPI_v4>timing=[_apiManager apiForProtocol:@protocol(FxTimingAPI_v4)];if([timing respondsToSelector:@selector(frameDuration:)])[timing frameDuration:&frameDuration];if([timing respondsToSelector:@selector(startTimeForEffect:)])[timing startTimeForEffect:&origin];int64_t frame=DYFilmFrameIndex(t,frameDuration,origin);u.filmFrameKey=DYFilmFrameKey(frame,u.film.grainHold,u.film.grainSeed);DYAssetState*a=DYReadAssets(_apiManager,t);DYToolDocument *tools=DYReadTools(_apiManager,t);[self adoptToolCanvasDocument:tools.document];double copyAuto=0;[[_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getFloatValue:©Auto fromParameter:8800 atTime:t];NSMutableDictionary *snapshot=DYMutablePlist(DYToolRenderSnapshot(tools.document,t));for(NSMutableDictionary *node in snapshot[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"film"])node[@"filmFrameKey"]=@(DYFilmFrameKey(frame,layer.film.grainHold,layer.film.grainSeed));}NSDictionary*s=@{@"schema":@2,@"tools":snapshot,@"copyAuto":@(copyAuto>.5),@"uniforms":[NSData dataWithBytes:&u length:sizeof(u)],@"paths":a.paths?:@{},@"spider":a.spiderMesh?:[NSData data]};*state=[NSPropertyListSerialization dataWithPropertyList:s format:NSPropertyListBinaryFormat_v1_0 options:0 error:e];return *state!=nil;
|
||||
}
|
||||
- (BOOL)destinationImageRect:(FxRect*)rect sourceImages:(NSArray<FxImageTile*>*)src destinationImage:(FxImageTile*)dst pluginState:(NSData*)s atTime:(CMTime)t error:(NSError**)e{if(!src.count)return NO;*rect=src[0].imagePixelBounds;return YES;}
|
||||
- (BOOL)sourceTileRect:(FxRect*)rect sourceImageIndex:(NSUInteger)i sourceImages:(NSArray<FxImageTile*>*)src destinationTileRect:(FxRect)dstRect destinationImage:(FxImageTile*)dst pluginState:(NSData*)s atTime:(CMTime)t error:(NSError**)e{if(i>=src.count)return NO;*rect=src[i].imagePixelBounds;return YES;}
|
||||
- (BOOL)renderDestinationImage:(FxImageTile*)dst sourceImages:(NSArray<FxImageTile*>*)src pluginState:(NSData*)s atTime:(CMTime)t error:(NSError**)e{
|
||||
if(!src.count||!src[0].ioSurface||!dst.ioSurface||!s.length)return NO;NSDictionary*p=[NSPropertyListSerialization propertyListWithData:s options:NSPropertyListImmutable format:NULL error:e];if(![p isKindOfClass:NSDictionary.class])return NO;NSData*b=p[@"uniforms"];if(![p[@"schema"]isEqual:@1]||![b isKindOfClass:NSData.class]||b.length!=sizeof(DYUniforms)||![p[@"paths"]isKindOfClass:NSDictionary.class])return NO;DYUniforms u;[b getBytes:&u length:sizeof(u)];BOOL ok=[_renderer renderSource:src[0] destination:dst uniforms:u paths:p[@"paths"] spider:p[@"spider"] error:e];if(ok){BOOL analyze=NO;@synchronized(self){if(![p[@"copyAuto"]boolValue])_copyAnalyzed=NO;else if(!_copyAnalyzed){_copyAnalyzed=YES;analyze=YES;}}if(analyze){NSDictionary*values=DYAutoGrade([_renderer preview]);if(values)dispatch_async(dispatch_get_main_queue(),^{[self applyValues:values];});}}return ok;
|
||||
if(!src.count||!src[0].ioSurface||!dst.ioSurface||!s.length)return NO;NSDictionary*p=[NSPropertyListSerialization propertyListWithData:s options:NSPropertyListImmutable format:NULL error:e];if(![p isKindOfClass:NSDictionary.class])return NO;NSData*b=p[@"uniforms"];if(![@[@1,@2]containsObject:p[@"schema"]]||![b isKindOfClass:NSData.class]||b.length!=sizeof(DYUniforms)||![p[@"paths"]isKindOfClass:NSDictionary.class])return NO;DYUniforms u;[b getBytes:&u length:sizeof(u)];BOOL ok=[_renderer renderSource:src[0] destination:dst uniforms:u paths:p[@"paths"] spider:p[@"spider"] tools:p[@"tools"] error:e];if(ok){if(_toolCaptureEnabled&&!_trackingActive.load()){dy::GrayFrame frame=[self toolGrayFrame:src[0] error:nil];if(frame.valid()){@synchronized(self){_toolSourceFrame=std::move(frame);_toolSourceTime=t;}}}BOOL analyze=NO;@synchronized(self){if(![p[@"copyAuto"]boolValue])_copyAnalyzed=NO;else if(!_copyAnalyzed){_copyAnalyzed=YES;analyze=YES;}}if(analyze){NSDictionary*values=DYAutoGrade([_renderer preview]);if(values)dispatch_async(dispatch_get_main_queue(),^{[self applyValues:values];});}}return ok;
|
||||
}
|
||||
- (void)alert:(NSString*)message{dispatch_async(dispatch_get_main_queue(),^{NSAlert*a=[NSAlert new];a.messageText=@"大鱼调色";a.informativeText=message?:@"操作未完成";[a runModal];[a release];});}
|
||||
- (void)exportRequested:(NSNotification*)n{
|
||||
NSURL*url=n.userInfo[@"url"];if(![url isKindOfClass:NSURL.class])return;id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];[a startAction:self];DYUniforms u;DYReadUniforms(_apiManager,a.currentTime,&u);DYAssetState *assets=DYReadAssets(_apiManager,a.currentTime);NSDictionary*paths=[assets.paths copy];NSData *mesh=[assets.spiderMesh copy];[a endAction:self];NSError*e=nil;BOOL ok=[_renderer exportLUT:url uniforms:u paths:paths spider:mesh error:&e];[mesh release];[paths release];if(!ok)[self alert:e.localizedDescription];
|
||||
NSURL*url=n.userInfo[@"url"];if(![url isKindOfClass:NSURL.class])return;id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];[a startAction:self];DYUniforms u;DYReadUniforms(_apiManager,a.currentTime,&u);DYAssetState *assets=DYReadAssets(_apiManager,a.currentTime);NSDictionary*paths=[assets.paths copy];NSData *mesh=[assets.spiderMesh copy];NSDictionary *tools=[DYReadTools(_apiManager,a.currentTime).document copy];[a endAction:self];NSError*e=nil;BOOL ok=[_renderer exportLUT:url uniforms:u paths:paths spider:mesh tools:tools error:&e];[tools release];[mesh release];[paths release];if(!ok)[self alert:e.localizedDescription];
|
||||
}
|
||||
- (void)applyValues:(NSDictionary*)values{if(!values){[self alert:@"尚未拿到当前片段画面,请移动播放头后重试。"];return;}id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];[a startAction:self];@try{id<FxParameterSettingAPI_v6>s=[_apiManager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];for(NSDictionary*r in DYDescriptors()){NSNumber*v=values[r[@"key"]];if(v)[s setFloatValue:v.doubleValue toParameter:[r[@"pid"]unsignedIntValue] atTime:a.currentTime];}}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_apiManager];}
|
||||
- (void)autoRequested:(NSNotification*)n{NSData*frame=[_renderer preview];[self applyValues:[n.name isEqual:@"DYAutoGrade"]?DYAutoGrade(frame):DYAutoWhiteBalance(frame)];}
|
||||
- (void)whiteBalanceRequested:(NSNotification*)n{NSColor*c=[n.userInfo[@"color"]colorUsingColorSpace:NSColorSpace.sRGBColorSpace];if(!c)return;float temp=0,tint=0;if([DYColorTables neutralizeColor:(vector_float3){(float)c.redComponent,(float)c.greenComponent,(float)c.blueComponent} temperature:&temp tint:&tint])[self applyValues:@{@"temperature":@(temp),@"tint":@(tint)}];else [self alert:@"所选颜色过暗,请选择白色或中性灰区域。"];}
|
||||
@end
|
||||
#include "DYToolOSC.inc.h"
|
||||
@@ -2,6 +2,7 @@
|
||||
#import <Metal/Metal.h>
|
||||
#import <FxPlug/FxPlugSDK.h>
|
||||
#import "DYUniforms.h"
|
||||
#import "DYToolState.h"
|
||||
@interface DYRenderer : NSObject
|
||||
/// Decode and upload before committing a host parameter. The renderer retains
|
||||
/// the immutable selected contents independently of the thumbnail cache.
|
||||
@@ -10,6 +11,8 @@
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths error:(NSError**)error;
|
||||
- (BOOL)renderSource:(FxImageTile*)source destination:(FxImageTile*)destination uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths spider:(NSData*)spider error:(NSError**)error;
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths spider:(NSData*)spider error:(NSError**)error;
|
||||
- (BOOL)renderSource:(FxImageTile*)source destination:(FxImageTile*)destination uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error;
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error;
|
||||
- (NSData*)preview;
|
||||
/// Display-encoded float RGBA, 320×180, with the visually top row first.
|
||||
/// Analysis preview retains the host texture's original row order separately.
|
||||
|
||||
+36
-13
@@ -1,6 +1,10 @@
|
||||
#import "DYRenderer.h"
|
||||
#import "DYModel.h"
|
||||
#include "DYSpiderState.h"
|
||||
#include "DYToolGPU.h"
|
||||
#include "DYFilmMath.h"
|
||||
#import <CoreImage/CoreImage.h>
|
||||
#import <MetalPerformanceShaders/MetalPerformanceShaders.h>
|
||||
#import "DYColorTables.h"
|
||||
#import "DYLUTLibrary.h"
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
@@ -11,17 +15,22 @@ static BOOL fail(NSError**e,NSString*m){if(e)*e=[NSError errorWithDomain:@"com.d
|
||||
static NSArray *inputFiles(){return @[@"",@"apple_log_to_rec709",@"arri_logc3_to_rec709",@"arri_logc4_to_rec709",@"blackmagic_film_gen5_to_rec709",@"canon_clog_bt709_to_rec709",@"canon_clog2_cinema_gamut_to_rec709",@"canon_clog3_cinema_gamut_to_rec709",@"dji_dlog_to_rec709",@"dji_dlog_m_to_rec709",@"fujifilm_flog_to_rec709",@"fujifilm_flog2_to_rec709",@"nikon_nlog_to_rec709",@"panasonic_vlog_vgamut_to_rec709",@"red_log3g10_rwg_to_rec709",@"sony_slog2_sgamut_to_rec709",@"sony_slog3_sgamut3cine_to_rec709",@"sony_hlg_bt2020_to_rec709"];}
|
||||
static id<MTLTexture> texture3D(id<MTLDevice>d,const float*values,NSUInteger n){MTLTextureDescriptor*t=[MTLTextureDescriptor new];t.textureType=MTLTextureType3D;t.pixelFormat=MTLPixelFormatRGBA32Float;t.width=n;t.height=n;t.depth=n;t.storageMode=MTLStorageModeShared;t.usage=MTLTextureUsageShaderRead;id<MTLTexture>x=[d newTextureWithDescriptor:t];[t release];if(x)[x replaceRegion:MTLRegionMake3D(0,0,0,n,n,n) mipmapLevel:0 slice:0 withBytes:values bytesPerRow:n*16 bytesPerImage:n*n*16];return [x autorelease];}
|
||||
// A synthetic texture lattice uses exactly the production render path for Cube export.
|
||||
@interface DYExportTile : FxImageTile { id<MTLTexture> _tex; uint64_t _registry; }
|
||||
@interface DYExportTile : FxImageTile { id<MTLTexture> _tex; uint64_t _registry; FxRect _bounds;FxImageOrigin _origin; double _pixelAspect; }
|
||||
- (instancetype)initWithTexture:(id<MTLTexture>)texture registry:(uint64_t)registry;
|
||||
- (void)setBounds:(FxRect)bounds origin:(FxImageOrigin)origin;
|
||||
- (void)setPixelAspect:(double)aspect;
|
||||
@end
|
||||
@implementation DYExportTile
|
||||
- (instancetype)initWithTexture:(id<MTLTexture>)texture registry:(uint64_t)registry{if((self=[super init])){_tex=[texture retain];_registry=registry;}return self;}
|
||||
- (instancetype)initWithTexture:(id<MTLTexture>)texture registry:(uint64_t)registry{if((self=[super init])){_tex=[texture retain];_registry=registry;_bounds=(FxRect){0,0,(SInt32)texture.width,(SInt32)texture.height};_origin=kFxImageOrigin_TOP_LEFT;_pixelAspect=1;}return self;}
|
||||
- (void)dealloc{[_tex release];[super dealloc];}
|
||||
- (id<MTLTexture>)metalTextureForDevice:(id<MTLDevice>)d{return d.registryID==_registry?_tex:nil;}
|
||||
- (FxRect)tilePixelBounds{return (FxRect){0,0,(SInt32)_tex.width,(SInt32)_tex.height};}
|
||||
- (void)setBounds:(FxRect)bounds origin:(FxImageOrigin)origin{_bounds=bounds;_origin=origin;}
|
||||
- (FxRect)tilePixelBounds{return _bounds;}
|
||||
- (FxRect)imagePixelBounds{return self.tilePixelBounds;}
|
||||
- (uint64_t)deviceRegistryID{return _registry;}
|
||||
- (FxImageOrigin)imageOrigin{return kFxImageOrigin_TOP_LEFT;}
|
||||
- (FxImageOrigin)imageOrigin{return _origin;}
|
||||
- (double)pixelAspect{return _pixelAspect;}
|
||||
- (void)setPixelAspect:(double)aspect{_pixelAspect=aspect>0?aspect:1;}
|
||||
@end
|
||||
static BOOL managed(DYUniforms u,NSDictionary *paths){return u.cm.configured>=0&&(u.cm.configured>.5||(![paths[@"input"]length]&&u.inputProfile<.5));}
|
||||
static BOOL identityCM(DYUniforms u){
|
||||
@@ -55,9 +64,12 @@ static void bypassIdleSkin(DYUniforms *u){
|
||||
NSData *_preview,*_lookLUTPreview;
|
||||
CFTimeInterval _lastPreview;
|
||||
BOOL _exporting;
|
||||
NSDictionary *_toolDocument;
|
||||
}
|
||||
@end
|
||||
@implementation DYRenderer
|
||||
#include "DYFilmRender.inc.h"
|
||||
#include "DYToolRender.inc.h"
|
||||
- (instancetype)init{if((self=[super init])){_previewLock=[NSObject new];_devices=[NSMutableDictionary new];_luts=[NSMutableDictionary new];_preparedLUTs=[NSMutableDictionary new];_activeLUTPaths=[NSSet new];_lutPreparationQueue=dispatch_queue_create("com.dayu.color.lut-upload",DISPATCH_QUEUE_SERIAL);dispatch_set_target_queue(_lutPreparationQueue,dispatch_get_global_queue(QOS_CLASS_USER_INITIATED,0));_tables=[DYColorTables new];}return self;}
|
||||
- (void)dealloc{[_devices release];[_luts release];[_preparedLUTs release];[_activeLUTPaths release];dispatch_release(_lutPreparationQueue);[_tables release];[_preview release];[_lookLUTPreview release];[_previewLock release];[super dealloc];}
|
||||
- (void)trimPreparedLUTsKeeping:(NSString *)path {
|
||||
@@ -91,7 +103,7 @@ static void bypassIdleSkin(DYUniforms *u){
|
||||
NSURL*url=[[NSBundle bundleForClass:self.class]URLForResource:@"default" withExtension:@"metallib"];
|
||||
id<MTLLibrary>lib=[d newLibraryWithURL:url error:err];if(!lib){[d release];return nil;}
|
||||
id<MTLCommandQueue>q=[d newCommandQueue];entry=[NSMutableDictionary dictionaryWithDictionary:@{@"device":d,@"library":lib,@"queue":q,@"pipelines":[NSMutableDictionary dictionary]}];
|
||||
for(NSString*fn in @[@"dyUnpremultiply",@"dyWhitesSceneStatistics",@"dyLUTExportKernel",@"dyInputAnalysis",@"dyColorManagement"]){id<MTLFunction>f=[lib newFunctionWithName:fn];if(!f){fail(err,[fn stringByAppendingString:@" 缺失"]);[lib release];[q release];[d release];return nil;}id<MTLComputePipelineState>p=[d newComputePipelineStateWithFunction:f error:err];[f release];if(!p){[lib release];[q release];[d release];return nil;}entry[fn]=p;[p release];}
|
||||
for(NSString*fn in @[@"dyUnpremultiply",@"dyWhitesSceneStatistics",@"dyLUTExportKernel",@"dyInputAnalysis",@"dyColorManagement",@"dyToolBlend",@"dyToolSkin",@"dyFilmPoint",@"dyFilmNoise",@"dyFilmSparseBlur",@"dyFilmBloomEdges",@"dyFilmMix"]){id<MTLFunction>f=[lib newFunctionWithName:fn];if(!f){fail(err,[fn stringByAppendingString:@" 缺失"]);[lib release];[q release];[d release];return nil;}id<MTLComputePipelineState>p=[d newComputePipelineStateWithFunction:f error:err];[f release];if(!p){[lib release];[q release];[d release];return nil;}entry[fn]=p;[p release];}
|
||||
float identity[32];for(int z=0;z<2;z++)for(int y=0;y<2;y++)for(int x=0;x<2;x++){int i=((z*2+y)*2+x)*4;identity[i]=x;identity[i+1]=y;identity[i+2]=z;identity[i+3]=1;}id<MTLTexture>neutral=texture3D(d,identity,2);if(!neutral){fail(err,@"无法分配中性 LUT");return nil;}entry[@"identity"]=neutral;
|
||||
// Preparing before the first frame may use registry 0. Reuse those pipelines
|
||||
// when the host subsequently supplies that device's actual registry ID.
|
||||
@@ -121,13 +133,16 @@ static void bypassIdleSkin(DYUniforms *u){
|
||||
id<MTLTexture>h=[_tables hslForDevice:d uniforms:u],w=[_tables whiteBalanceForDevice:d uniforms:u],g=[_tables gradingForDevice:d uniforms:u];if(!h||!w||!g){fail(err,_tables.lastError?:@"颜色查表构建失败");return nil;}[ts addObjectsFromArray:@[h,w,g]];return ts;
|
||||
}
|
||||
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths error:(NSError**)err{return [self renderSource:src destination:dst uniforms:u paths:paths spider:nil error:err];}
|
||||
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData *)spider error:(NSError**)err{@synchronized(self){@autoreleasepool{
|
||||
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData *)spider error:(NSError**)err{return [self renderSource:src destination:dst uniforms:u paths:paths spider:spider tools:nil error:err];}
|
||||
- (BOOL)renderLegacy:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData *)spider masks:(NSDictionary*)masks error:(NSError**)err{return [self renderLegacy:src destination:dst uniforms:u paths:paths spider:spider masks:masks stageFirst:-1 stageLast:-1 skinReference:nil originalReference:nil captureOriginal:nullptr suppressBlackWhite:NO error:err];}
|
||||
- (BOOL)renderLegacy:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData *)spider masks:(NSDictionary*)masks stageFirst:(NSInteger)stageFirst stageLast:(NSInteger)stageLast skinReference:(FxImageTile*)skinReference originalReference:(FxImageTile*)originalReference captureOriginal:(DYExportTile**)captureOriginal suppressBlackWhite:(BOOL)suppressBlackWhite error:(NSError**)err{@synchronized(self){@autoreleasepool{
|
||||
BOOL segmented=stageFirst>=0;if(segmented&&(stageFirst>stageLast||stageLast>11))return fail(err,@"原生工具分段范围无效");
|
||||
if(spider.length&&!DYSpiderMeshIsValid(spider))return fail(err,@"蜘蛛盘数据无效");
|
||||
if(u.primarySectionEnabled<.5){u.inputSectionEnabled=0;u.cm.basisEnabled=0;u.cm.outputEnabled=0;}
|
||||
|
||||
[_activeLUTPaths release];_activeLUTPaths=[[NSSet alloc]initWithArray:paths.allValues?:@[]];
|
||||
NSMutableDictionary*e=[self device:dst.deviceRegistryID error:err];if(!e)return NO;id<MTLDevice>d=e[@"device"];id<MTLTexture>input=[src metalTextureForDevice:d],output=[dst metalTextureForDevice:d];if(!input||!output)return fail(err,@"宿主图像纹理不可用");
|
||||
BOOL useCM=managed(u,paths);bypassNeutralTools(&u);float bwMix=fmaxf(0,fminf(1,u.cm.blackWhiteMix));if(bwMix<=0)u.blackWhiteSectionEnabled=0;
|
||||
BOOL useCM=managed(u,paths)&&(!segmented||stageFirst==0);bypassNeutralTools(&u);float bwMix=fmaxf(0,fminf(1,u.cm.blackWhiteMix));if(bwMix<=0)u.blackWhiteSectionEnabled=0;
|
||||
NSArray*ts=[self textures:paths uniforms:&u entry:e error:err];if(!ts)return NO;bypassIdleSkin(&u);
|
||||
// Only a deformed active mesh allocates samples; device entries retain the
|
||||
// current buffer across frames. Neutral grids are exact identity at all densities.
|
||||
@@ -138,24 +153,31 @@ static void bypassIdleSkin(DYUniforms *u){
|
||||
}
|
||||
if([e[@"spiderActive"]boolValue]){spiderBuffer=e[@"spiderBuffer"];spiderSize={ [e[@"spiderHues"]intValue],[e[@"spiderRings"]intValue]};}
|
||||
}
|
||||
NSMutableDictionary*ps=e[@"pipelines"];NSNumber*format=@(output.pixelFormat);id<MTLRenderPipelineState>pipeline=ps[format];if(!pipeline){MTLRenderPipelineDescriptor*p=[MTLRenderPipelineDescriptor new];p.vertexFunction=[e[@"library"]newFunctionWithName:@"dyVertex"];p.fragmentFunction=[e[@"library"]newFunctionWithName:@"dyFragment"];p.colorAttachments[0].pixelFormat=output.pixelFormat;pipeline=[d newRenderPipelineStateWithDescriptor:p error:err];[p.vertexFunction release];[p.fragmentFunction release];[p release];if(!pipeline)return NO;ps[format]=pipeline;[pipeline release];}
|
||||
DYToolMaskHeader maskHeader{};id<MTLBuffer>maskBuffer=(masks.count||segmented)?[self maskBuffer:masks tile:src device:d header:&maskHeader]:nil;BOOL hasMasks=maskHeader.count>0;if((hasMasks||segmented)&&!maskBuffer)return fail(err,@"无法分配蒙版缓冲区");
|
||||
NSMutableDictionary*ps=e[@"pipelines"];NSString*format=[NSString stringWithFormat:@"%lu-%d-%d",(unsigned long)output.pixelFormat,hasMasks,segmented];id<MTLRenderPipelineState>pipeline=ps[format];if(!pipeline){MTLRenderPipelineDescriptor*p=[MTLRenderPipelineDescriptor new];p.vertexFunction=[e[@"library"]newFunctionWithName:@"dyVertex"];p.fragmentFunction=[e[@"library"]newFunctionWithName:segmented?@"dySegmentFragment":hasMasks?@"dyMaskedFragment":@"dyFragment"];p.colorAttachments[0].pixelFormat=output.pixelFormat;pipeline=[d newRenderPipelineStateWithDescriptor:p error:err];[p.vertexFunction release];[p.fragmentFunction release];[p release];if(!pipeline)return NO;ps[format]=pipeline;[pipeline release];}
|
||||
MTLTextureDescriptor*td=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:input.width height:input.height mipmapped:NO];td.storageMode=MTLStorageModePrivate;td.usage=MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite;id<MTLTexture>straight=[d newTextureWithDescriptor:td];if(!straight)return fail(err,@"无法分配调色缓冲区");
|
||||
id<MTLCommandBuffer>cb=[e[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyUnpremultiply"]];[ce setTexture:input atIndex:0];[ce setTexture:straight atIndex:1];[ce dispatchThreads:MTLSizeMake(input.width,input.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];
|
||||
if(useCM&&!identityCM(u)&&u.cm.mix>0){
|
||||
DayuRenderParams cm=DYCMRender(u.cm);cm.stages=(cm.stages&~1)|(u.inputSectionEnabled>.5?1:0);
|
||||
if(cm.stages){id<MTLTexture>converted=[d newTextureWithDescriptor:td];if(!converted){[straight release];return fail(err,@"无法分配 CST 缓冲区");}
|
||||
ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyColorManagement"]];[ce setTexture:straight atIndex:0];[ce setTexture:converted atIndex:1];[ce setBytes:&cm length:sizeof(cm) atIndex:0];[ce setBytes:&u.cm.mix length:4 atIndex:1];[ce dispatchThreads:MTLSizeMake(input.width,input.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];[straight release];straight=converted;
|
||||
ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyColorManagement"]];[ce setTexture:straight atIndex:0];[ce setTexture:converted atIndex:1];[ce setBytes:&cm length:sizeof(cm) atIndex:0];[ce setBytes:&u.cm.mix length:4 atIndex:1];[ce dispatchThreads:MTLSizeMake(input.width,input.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];if(hasMasks){id<MTLTexture>blended=[d newTextureWithDescriptor:td];if(!blended){[converted release];[straight release];return fail(err,@"无法分配一级蒙版缓冲区");}maskHeader.section=0;maskHeader.premultiplied=0;[self encodeBlend:straight after:converted output:blended masks:maskBuffer header:maskHeader entry:e commands:cb];[converted release];converted=blended;}[straight release];straight=converted;
|
||||
}
|
||||
}
|
||||
// Keep the actual post-CST straight source alive across all native segments.
|
||||
// Both native spatial helpers and whites statistics historically read this
|
||||
// source; the current segment's center color is a different input.
|
||||
id<MTLTexture>nativeSource=segmented&&originalReference?[originalReference metalTextureForDevice:d]:straight;
|
||||
if(!nativeSource){[straight release];return fail(err,@"原生工具参考纹理不可用");}
|
||||
if(segmented&&captureOriginal&&!*captureOriginal){DYExportTile *reference=[[DYExportTile alloc]initWithTexture:nativeSource registry:d.registryID];[reference setBounds:src.tilePixelBounds origin:src.imageOrigin];[reference setPixelAspect:src.pixelAspect];*captureOriginal=reference;}
|
||||
float level=.5;id<MTLBuffer>scene=[d newBufferWithBytes:&level length:4 options:MTLResourceStorageModeShared];
|
||||
if(!_exporting&&u.whites>0&&u.whitesEnabled>.5&&u.baseSectionEnabled>.5){ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyWhitesSceneStatistics"]];[ce setTexture:straight atIndex:0];[ce setTexture:ts[7] atIndex:1];[ce setBytes:&u length:sizeof(u) atIndex:0];[ce setBuffer:scene offset:0 atIndex:1];[ce dispatchThreadgroups:MTLSizeMake(1,1,1) threadsPerThreadgroup:MTLSizeMake(256,1,1)];[ce endEncoding];}
|
||||
BOOL preview=NO;@synchronized(_previewLock){preview=!_exporting&&CACurrentMediaTime()-_lastPreview>.5;}id<MTLBuffer>pb=nil;if(preview){pb=[d newBufferWithLength:320*180*16 options:MTLResourceStorageModeShared];ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyInputAnalysis"]];[ce setTexture:straight atIndex:0];[ce setTexture:ts[0] atIndex:1];float inputStrength=u.inputSectionEnabled>.5?u.preLUTStrength:0;[ce setBytes:&inputStrength length:4 atIndex:1];[ce setBuffer:pb offset:0 atIndex:0];[ce dispatchThreads:MTLSizeMake(320,180,1) threadsPerThreadgroup:MTLSizeMake(8,8,1)];[ce endEncoding];}
|
||||
if(!_exporting&&(!segmented||(stageFirst<=2&&stageLast>=2))&&u.whites>0&&u.whitesEnabled>.5&&u.baseSectionEnabled>.5){ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyWhitesSceneStatistics"]];[ce setTexture:nativeSource atIndex:0];[ce setTexture:ts[7] atIndex:1];[ce setBytes:&u length:sizeof(u) atIndex:0];[ce setBuffer:scene offset:0 atIndex:1];[ce dispatchThreadgroups:MTLSizeMake(1,1,1) threadsPerThreadgroup:MTLSizeMake(256,1,1)];[ce endEncoding];}
|
||||
BOOL preview=NO;@synchronized(_previewLock){preview=(!segmented||stageFirst==0)&&!_exporting&&CACurrentMediaTime()-_lastPreview>.5;}id<MTLBuffer>pb=nil;if(preview){pb=[d newBufferWithLength:320*180*16 options:MTLResourceStorageModeShared];ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyInputAnalysis"]];[ce setTexture:straight atIndex:0];[ce setTexture:ts[0] atIndex:1];float inputStrength=u.inputSectionEnabled>.5?u.preLUTStrength:0;[ce setBytes:&inputStrength length:4 atIndex:1];[ce setBuffer:pb offset:0 atIndex:0];[ce dispatchThreads:MTLSizeMake(320,180,1) threadsPerThreadgroup:MTLSizeMake(8,8,1)];[ce endEncoding];}
|
||||
MTLRenderPassDescriptor*rp=[MTLRenderPassDescriptor renderPassDescriptor];rp.colorAttachments[0].texture=output;rp.colorAttachments[0].loadAction=MTLLoadActionDontCare;rp.colorAttachments[0].storeAction=MTLStoreActionStore;id<MTLRenderCommandEncoder>re=[cb renderCommandEncoderWithDescriptor:rp];[re setRenderPipelineState:pipeline];
|
||||
float w=output.width,h=output.height;FxRect s=src.tilePixelBounds,t=dst.tilePixelBounds;float sw=s.right-s.left,sh=s.top-s.bottom;float l=(t.left-s.left)/sw,r=(t.right-s.left)/sw,top=(s.top-t.top)/sh,bottom=(s.top-t.bottom)/sh;
|
||||
if(src.imageOrigin==kFxImageOrigin_BOTTOM_LEFT){top=1-top;bottom=1-bottom;}
|
||||
DYVertex2D vs[]={{{w/2,-h/2},{r,bottom}},{{-w/2,-h/2},{l,bottom}},{{w/2,h/2},{r,top}},{{-w/2,h/2},{l,top}}};
|
||||
if(dst.imageOrigin==kFxImageOrigin_BOTTOM_LEFT)for(int i=0;i<4;i++)vs[i].position.y=-vs[i].position.y;
|
||||
vector_uint2 vp={(unsigned)output.width,(unsigned)output.height};[re setVertexBytes:vs length:sizeof(vs) atIndex:0];[re setVertexBytes:&vp length:sizeof(vp) atIndex:1];[re setViewport:(MTLViewport){0,0,w,h,0,1}];[re setFragmentTexture:straight atIndex:0];for(NSUInteger i=0;i<ts.count;i++)[re setFragmentTexture:ts[i] atIndex:i+1];[re setFragmentBytes:&u length:sizeof(u) atIndex:0];[re setFragmentBuffer:scene offset:0 atIndex:1];DYRenderOptions options={1,bwMix,0,0};[re setFragmentBytes:&options length:sizeof(options) atIndex:2];DYUniforms color=u;color.blackWhiteSectionEnabled=0;[re setFragmentBytes:&color length:sizeof(color) atIndex:3];if(spiderBuffer)[re setFragmentBuffer:spiderBuffer offset:0 atIndex:4];else{float empty[2]={0,0};[re setFragmentBytes:empty length:sizeof(empty) atIndex:4];}[re setFragmentBytes:&spiderSize length:sizeof(spiderSize) atIndex:5];[re drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4];[re endEncoding];[cb commit];[cb waitUntilCompleted];BOOL ok=cb.status==MTLCommandBufferStatusCompleted;
|
||||
vector_uint2 vp={(unsigned)output.width,(unsigned)output.height};[re setVertexBytes:vs length:sizeof(vs) atIndex:0];[re setVertexBytes:&vp length:sizeof(vp) atIndex:1];[re setViewport:(MTLViewport){0,0,w,h,0,1}];[re setFragmentTexture:straight atIndex:0];for(NSUInteger i=0;i<ts.count;i++)[re setFragmentTexture:ts[i] atIndex:i+1];[re setFragmentBytes:&u length:sizeof(u) atIndex:0];[re setFragmentBuffer:scene offset:0 atIndex:1];DYRenderOptions options={1,bwMix,0,0};[re setFragmentBytes:&options length:sizeof(options) atIndex:2];DYUniforms color=u;color.blackWhiteSectionEnabled=0;[re setFragmentBytes:&color length:sizeof(color) atIndex:3];if(spiderBuffer)[re setFragmentBuffer:spiderBuffer offset:0 atIndex:4];else{float empty[2]={0,0};[re setFragmentBytes:empty length:sizeof(empty) atIndex:4];}[re setFragmentBytes:&spiderSize length:sizeof(spiderSize) atIndex:5];if(hasMasks||segmented){[re setFragmentBuffer:maskBuffer offset:0 atIndex:6];[re setFragmentBytes:&maskHeader length:sizeof(maskHeader) atIndex:7];}if(segmented){DYToolStageRange range={(int)stageFirst,(int)stageLast,(int)suppressBlackWhite};[re setFragmentBytes:&range length:sizeof(range) atIndex:8];[re setFragmentTexture:skinReference?[skinReference metalTextureForDevice:d]:input atIndex:10];[re setFragmentTexture:nativeSource atIndex:11];}[re drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4];[re endEncoding];[cb commit];[cb waitUntilCompleted];BOOL ok=cb.status==MTLCommandBufferStatusCompleted;
|
||||
if(ok&&pb){@synchronized(_previewLock){
|
||||
[_preview release];_preview=[[NSData alloc]initWithBytes:pb.contents length:320*180*16];
|
||||
// The analysis kernel reads physical texture rows. Its result remains intact
|
||||
@@ -172,6 +194,7 @@ static void bypassIdleSkin(DYUniforms *u){
|
||||
}}}
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)u paths:(NSDictionary*)paths error:(NSError**)err{return [self exportLUT:url uniforms:u paths:paths spider:nil error:err];}
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider error:(NSError**)err{@synchronized(self){
|
||||
if(DYFilmActive(u.film)&&DYFilmSpatialActive(u.film))return fail(err,@"胶片空间和颗粒处理不能保存到静态 Cube,请保存完整预设。");
|
||||
NSMutableDictionary *e=[self device:0 error:err];if(!e)return NO;id<MTLDevice>d=e[@"device"];const NSUInteger n=33,count=n*n*n,width=n*n,height=n;
|
||||
MTLTextureDescriptor *desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:width height:height mipmapped:NO];desc.storageMode=MTLStorageModeShared;desc.usage=MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite|MTLTextureUsageRenderTarget;
|
||||
id<MTLTexture>input=[d newTextureWithDescriptor:desc],output=[d newTextureWithDescriptor:desc];if(!input||!output){[input release];[output release];return fail(err,@"无法分配 LUT 色格");}
|
||||
@@ -179,7 +202,7 @@ static void bypassIdleSkin(DYUniforms *u){
|
||||
[input replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:values.data() bytesPerRow:width*8];
|
||||
DYExportTile *source=[[[DYExportTile alloc]initWithTexture:input registry:d.registryID]autorelease],*dest=[[[DYExportTile alloc]initWithTexture:output registry:d.registryID]autorelease];
|
||||
u.textureEnabled=0;u.clarityEnabled=0;u.dehazeEnabled=0;BOOL ok=NO;_exporting=YES;
|
||||
@try{ok=[self renderSource:source destination:dest uniforms:u paths:paths spider:spider error:err];}@finally{_exporting=NO;}
|
||||
@try{ok=[self renderSource:source destination:dest uniforms:u paths:paths spider:spider tools:_toolDocument error:err];}@finally{_exporting=NO;}
|
||||
if(ok)[output getBytes:values.data() bytesPerRow:width*8 fromRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0];[input release];[output release];if(!ok)return NO;
|
||||
NSMutableString *text=[NSMutableString stringWithString:@"TITLE \"大鱼调色\"\n# 包含 CST 与逐像素颜色;不包含纹理、清晰度和逐画面分析。\nLUT_3D_SIZE 33\nDOMAIN_MIN 0 0 0\nDOMAIN_MAX 1 1 1\n"];
|
||||
for(NSUInteger i=0;i<count;i++){float rgb[3];for(int c=0;c<3;c++){float v=values[i*4+c];rgb[c]=v<=.0031308f?v*12.92f:1.055f*powf(v,1/2.4f)-.055f;if(!std::isfinite(rgb[c]))return fail(err,@"LUT 输出含无效值");}[text appendFormat:@"%.8f %.8f %.8f\n",rgb[0],rgb[1],rgb[2]];}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,&error);DYToolCanvasProbe *host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero;
|
||||
NSMutableDictionary *doc=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document);NSDictionary *mask=DYNewMask(DYMaskRectangle);doc[@"baseMasks"][@"hsl"]=[NSMutableArray arrayWithObject:mask];DYWriteTools(base,doc,kCMTimeZero);
|
||||
id<DYToolCanvasHostProbe>plugin=(id)[[NSClassFromString(@"DYPlugIn")alloc]initWithAPIManager:host];[plugin scheduleToolCanvasRegistration];NSData *state=nil;[plugin pluginState:&state atTime:kCMTimeZero quality:(FxQuality)0 error:&error];
|
||||
auto drain=[](){double end=NSProcessInfo.processInfo.systemUptime+.1;while(NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.005]];};drain();
|
||||
NSDictionary *snapshot=[plugin toolCanvasMaskAtTime:kCMTimeZero];run.record(@"canvas-cold-load-selects-saved-mask-from-immutable-snapshot",[snapshot[@"id"]isEqual:mask[@"id"]]&&[snapshot[@"parameters"]length]==sizeof(DYMaskParameters));
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasSelection" object:host userInfo:@{@"node":@"base:hsl",@"mask":mask[@"id"],@"document":doc}];
|
||||
id<FxOnScreenControl_v4>osc=(id)[[NSClassFromString(@"DYToolOSC")alloc]initWithAPIManager:host];DYDiagnosticTile *overlay=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:640 height:400]autorelease];[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];Pixels pixels=read(overlay,gpu);NSUInteger opaque=0;BOOL finite=YES;for(NSUInteger i=0;i<640*400;i++){float a=pixels[i*4+3];opaque+=a>.01;finite&=std::isfinite(a);}run.record(@"native-osc-real-metal-overlay-transparent-around-controls",finite&&opaque>100&&opaque<640*400*.2,@{@"coveredPixels":@(opaque)});
|
||||
NSInteger part=0;[osc hitTestOSCAtMousePositionX:320 mousePositionY:212.5 activePart:&part atTime:kCMTimeZero];run.record(@"native-osc-object-to-canvas-center-hit",part==1);
|
||||
int undo=base->_undoStarts;BOOL update=NO;[osc mouseDownAtPositionX:320 positionY:212.5 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseDraggedAtPositionX:348 positionY:196.75 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseUpAtPositionX:348 positionY:196.75 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];drain();NSDictionary *moved=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];DYMaskParameters p=DYMaskAtTime(moved,kCMTimeZero);run.record(@"native-osc-drag-writes-independent-normalized-geometry",fabs(p.centerX-.55)<1e-5&&fabs(p.centerY-.55)<1e-5,@{@"x":@(p.centerX),@"y":@(p.centerY)});run.record(@"native-osc-drag-commits-one-undo-after-callback",base->_undoStarts==undo+1&&base->_undoStarts==base->_undoEnds);
|
||||
NSDictionary *before=[DYReadTools(base,kCMTimeZero).document copy];[plugin adoptToolCanvasDocument:before];[osc mouseDownAtPositionX:348 positionY:196.75 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseDraggedAtPositionX:370 positionY:180 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];BOOL handled=NO;[osc keyDownAtPositionX:370 positionY:180 keyPressed:27 modifiers:0 forceUpdate:&update didHandle:&handled atTime:kCMTimeZero];drain();run.record(@"native-osc-escape-discards-draft-without-host-edit",[before isEqual:DYReadTools(base,kCMTimeZero).document]&&base->_undoStarts==undo+1);[before release];[osc release];[plugin release];
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// OSC callbacks only mutate a locked in-memory draft. Host parameter writes are
|
||||
// deferred until the gesture has finished and the callback has returned.
|
||||
- (void)postToolCanvasStatus:(NSString*)message {
|
||||
NSString *node=nil,*maskID=nil;uint64_t revision;@synchronized(self){node=[_selectedToolNode copy];maskID=[_selectedToolMask copy];revision=_toolCanvasRevision;}
|
||||
dispatch_async(dispatch_get_main_queue(),^{BOOL drawing;@synchronized(self){if(revision!=self->_toolCanvasRevision||![node isEqual:self->_selectedToolNode]||![maskID isEqual:self->_selectedToolMask])return;drawing=self->_toolDrawingPen||self->_toolCanvasCommitPending;}if(message)[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolTrackingStatus" object:self->_apiManager userInfo:@{@"node":node?:@"",@"message":message}];[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasState" object:self->_apiManager userInfo:@{@"node":node?:@"",@"mask":maskID?:@"",@"drawing":@(drawing)}];});[node release];[maskID release];
|
||||
}
|
||||
- (void)discardToolCanvasDraft {
|
||||
@synchronized(self){[_toolCanvasDraft release];_toolCanvasDraft=nil;[_toolCanvasOriginal release];_toolCanvasOriginal=nil;_toolDrawingPen=NO;_toolCanvasHasHover=NO;_toolCanvasEditTime=kCMTimeInvalid;++_toolCanvasRevision;}[self postToolCanvasStatus:nil];
|
||||
}
|
||||
- (void)commitToolCanvasDraftAtTime:(CMTime)eventTime {
|
||||
NSDictionary *draft=nil,*original=nil;NSString *node=nil,*maskID=nil;CMTime time;uint64_t revision;
|
||||
@synchronized(self){if(!_toolCanvasDraft||!_toolCanvasOriginal)return;if(!CMTIME_IS_NUMERIC(eventTime)||CMTimeCompare(eventTime,_toolCanvasEditTime)!=0){[self discardToolCanvasDraft];[self postToolCanvasStatus:@"播放头已移动,请重新绘制。"];return;}draft=[_toolCanvasDraft copy];original=[_toolCanvasOriginal copy];node=[_selectedToolNode copy];maskID=[_selectedToolMask copy];time=_toolCanvasEditTime;[self discardToolCanvasDraft];revision=_toolCanvasRevision;_toolCanvasCommitPending=YES;}
|
||||
dispatch_async(dispatch_get_main_queue(),^{@try{
|
||||
@synchronized(self){if(self->_trackingActive.load()||revision!=self->_toolCanvasRevision||![node isEqual:self->_selectedToolNode]||![maskID isEqual:self->_selectedToolMask])return;}
|
||||
id<FxCustomParameterActionAPI_v4>a=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;BOOL changed=NO;
|
||||
[a startAction:self];@try{
|
||||
NSMutableDictionary *doc=DYMutablePlist(DYReadTools(self->_apiManager,time).document),*current=[self toolMask:maskID node:node document:doc];
|
||||
if(!current||![current isEqual:original]){[self postToolCanvasStatus:@"蒙版已在其它位置修改,本次画面草稿未覆盖它。"];return;}
|
||||
NSMutableDictionary *result=DYMutablePlist(draft);
|
||||
if([current[@"keys"]count]){DYMaskParameters p=DYMaskAtTime(result,time);NSMutableArray *keys=[[current[@"keys"]mutableCopy]autorelease];NSIndexSet *same=[keys indexesOfObjectsPassingTest:^BOOL(NSDictionary *key,NSUInteger i,BOOL *stop){return CMTimeCompare(CMTimeMakeWithEpoch([key[@"value"]longLongValue],[key[@"scale"]intValue],[key[@"epoch"]longLongValue]),time)==0;}];[keys removeObjectsAtIndexes:same];[keys addObject:DYMaskKey(time,p,YES,1)];result[@"keys"]=@[];if(!DYMergeTracking(result,keys))return;}
|
||||
if(DYValidToolMask(result)&&![current isEqual:result]){[current setDictionary:result];id<FxUndoAPI>undo=[self->_apiManager apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"编辑工具蒙版"];changed=DYWriteTools(self->_apiManager,doc,time);[undo endUndoGroup];if(changed){DYToolDocument *saved=[[[DYToolDocument alloc]init]autorelease];saved.document=doc;[self adoptToolCanvasDocument:saved.document];}}
|
||||
}@finally{[a endAction:self];}
|
||||
if(changed)[self postToolCanvasStatus:@"蒙版已保存 · 可一次撤销"];
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];
|
||||
}@finally{@synchronized(self){self->_toolCanvasCommitPending=NO;}[self postToolCanvasStatus:nil];}});[draft release];[original release];[node release];[maskID release];
|
||||
}
|
||||
- (void)toolCanvasCommand:(NSNotification*)notification {
|
||||
NSDictionary *info=notification.userInfo;@synchronized(self){if(![info[@"node"]isEqual:_selectedToolNode]||![info[@"mask"]isEqual:_selectedToolMask])return;}
|
||||
CMTime time=CMTimeMakeWithEpoch([info[@"timeValue"]longLongValue],[info[@"timeScale"]intValue],[info[@"timeEpoch"]longLongValue]);
|
||||
id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(a){[a startAction:self];@try{time=a.currentTime;}@finally{[a endAction:self];}}if(!CMTIME_IS_NUMERIC(time))return;NSString *command=info[@"command"];
|
||||
if([command isEqual:@"finish"]||[command isEqual:@"cancel"])[self toolCanvasEvent:NSEventTypeKeyDown point:NSZeroPoint part:1 modifiers:0 key:[command isEqual:@"finish"]?13:27 time:time];
|
||||
}
|
||||
- (void)toolCanvasEvent:(NSEventType)type point:(NSPoint)point part:(NSInteger)part modifiers:(FxModifierKeys)modifiers key:(unichar)key time:(CMTime)time {
|
||||
if(!CMTIME_IS_NUMERIC(time)||!std::isfinite(point.x)||!std::isfinite(point.y))return;
|
||||
@synchronized(self){if(_trackingActive.load()||!_selectedToolNode||!_selectedToolMask)return;if(_toolCanvasCommitPending){NSString *node=[_selectedToolNode copy],*maskID=[_selectedToolMask copy];dispatch_async(dispatch_get_main_queue(),^{@synchronized(self){if(![node isEqual:self->_selectedToolNode]||![maskID isEqual:self->_selectedToolMask])return;}[self toolCanvasEvent:type point:point part:part modifiers:modifiers key:key time:time];});[node release];[maskID release];return;}
|
||||
if(part>=10000&&type==NSEventTypeLeftMouseDown){
|
||||
NSInteger item=part-10000;
|
||||
if(item==7){_toolShowCoverage=!_toolShowCoverage;return;}
|
||||
if(item==8||item==10){[self discardToolCanvasDraft];if(item==8)_toolCanvasHidden=YES;[self postToolCanvasStatus:@"已取消绘制,保留原蒙版。"];return;}
|
||||
if(item==9){[self toolCanvasEvent:NSEventTypeKeyDown point:point part:1 modifiers:0 key:13 time:time];return;}
|
||||
if(item==0){if(_toolDrawingPen&&[_toolCanvasDraft[@"nodes"]length]>=3*sizeof(DYBezierNode))[self commitToolCanvasDraftAtTime:time];else [self discardToolCanvasDraft];return;}
|
||||
if(item<1||item>6)return;
|
||||
NSString *node=[_selectedToolNode copy];[self discardToolCanvasDraft];
|
||||
dispatch_async(dispatch_get_main_queue(),^{
|
||||
@synchronized(self){if(self->_trackingActive.load()||![node isEqual:self->_selectedToolNode])return;}
|
||||
id<FxCustomParameterActionAPI_v4>a=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;
|
||||
[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(self->_apiManager,time).document);NSMutableArray *masks=[[DYMasksForTool(doc,node)mutableCopy]autorelease];if(masks.count>=DYToolMaskLimit)return;NSInteger kind=((int[]){0,2,1,0,3,4,5})[item];NSDictionary *mask=DYNewMask(kind);[masks addObject:mask];if(!DYSetToolMasks(doc,node,masks))return;
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasSelection" object:self->_apiManager userInfo:@{@"node":node,@"mask":mask[@"id"],@"draw":@(kind==2),@"document":doc}];
|
||||
id<FxUndoAPI>u=[self->_apiManager apiForProtocol:@protocol(FxUndoAPI)];[u startUndoGroup:@"添加工具蒙版"];DYWriteTools(self->_apiManager,doc,time);[u endUndoGroup];
|
||||
}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];
|
||||
});[node release];return;
|
||||
}
|
||||
if(type==NSEventTypeKeyDown&&key==27){[self discardToolCanvasDraft];[self postToolCanvasStatus:@"已取消绘制,保留原蒙版。"];return;}
|
||||
if(type==NSEventTypeKeyDown&&(key==13||key==10||key==3)&&_toolDrawingPen){if([_toolCanvasDraft[@"nodes"]length]<3*sizeof(DYBezierNode)){[self postToolCanvasStatus:@"至少放置三个点,再点首节点或完成绘制。"];return;}[self commitToolCanvasDraftAtTime:time];return;}
|
||||
if(type==NSEventTypeKeyDown&&(key==8||key==127)&&_toolDrawingPen){NSMutableData *nodes=[[_toolCanvasDraft[@"nodes"]mutableCopy]autorelease];if(nodes.length)[nodes setLength:nodes.length-sizeof(DYBezierNode)];if(nodes)_toolCanvasDraft[@"nodes"]=nodes;[self postToolCanvasStatus:@"已移除最后一个钢笔点,继续点击放置。"];return;}
|
||||
if(type==NSEventTypeKeyDown&&(key==8||key==127)&&!_toolDrawingPen&&_toolDragPart>=1000){
|
||||
NSDictionary *mask=[self toolMask:_selectedToolMask node:_selectedToolNode document:_toolCanvasDocument];DYMaskParameters parameters=DYMaskAtTime(mask,time);NSUInteger count=[mask[@"nodes"]length]/sizeof(DYBezierNode),index=(_toolDragPart-1000)/3;if(parameters.kind!=DYMaskBezier||index>=count)return;
|
||||
if(count<=3){[self postToolCanvasStatus:@"闭合路径至少保留三个点;可使用重画钢笔重新绘制。"];return;}
|
||||
[self toolCanvasEvent:NSEventTypeLeftMouseDown point:point part:_toolDragPart modifiers:modifiers key:0 time:time];NSMutableData *nodes=[[_toolCanvasDraft[@"nodes"]mutableCopy]autorelease];[nodes replaceBytesInRange:NSMakeRange(index*sizeof(DYBezierNode),sizeof(DYBezierNode)) withBytes:NULL length:0];_toolCanvasDraft[@"nodes"]=nodes;[self commitToolCanvasDraftAtTime:time];return;
|
||||
}
|
||||
if(type==NSEventTypeMouseMoved){if(_toolDrawingPen){if(_toolCanvasDraft&&CMTimeCompare(time,_toolCanvasEditTime)!=0){[self discardToolCanvasDraft];return;}_toolCanvasHoverPoint=point;_toolCanvasHasHover=[_toolCanvasDraft[@"nodes"]length]>0;}return;}
|
||||
if(type==NSEventTypeLeftMouseDown){
|
||||
_toolCanvasHasHover=NO;
|
||||
if(_toolDrawingPen&&part==1000&&[_toolCanvasDraft[@"nodes"]length]>=3*sizeof(DYBezierNode)){[self commitToolCanvasDraftAtTime:time];return;}
|
||||
if(!_toolCanvasDraft){NSDictionary *mask=[self toolMask:_selectedToolMask node:_selectedToolNode document:_toolCanvasDocument];if(!mask)return;++_toolCanvasRevision;_toolCanvasOriginal=[DYMutablePlist(mask)retain];_toolCanvasDraft=[DYMutablePlist(mask)retain];_toolCanvasEditTime=time;_toolDragParameters=DYMaskAtTime(mask,time);_toolDragParameters.imageAspect=_toolSourceFrame.valid()?float(_toolSourceFrame.width)/_toolSourceFrame.height:1;_toolCanvasDraft[@"parameters"]=[NSData dataWithBytes:&_toolDragParameters length:sizeof(DYMaskParameters)];_toolCanvasDraft[@"keys"]=@[];if(_toolDrawingPen)_toolCanvasDraft[@"nodes"]=[NSData data];}
|
||||
if(CMTimeCompare(time,_toolCanvasEditTime)!=0){[self discardToolCanvasDraft];[self postToolCanvasStatus:@"播放头已移动,请重新绘制。"];return;}
|
||||
_toolDragStart=point;_toolDragPart=part;_toolDragParameters=DYMaskAtTime(_toolCanvasDraft,time);
|
||||
if(_toolDrawingPen){DYMaskParameters p=_toolDragParameters;float a=p.imageAspect,dx=(point.x-p.centerX)*a,dy=point.y-p.centerY,c=cos(p.angle),s=sin(p.angle),x=(dx*c+dy*s)/(p.width*a),y=(-dx*s+dy*c)/p.height;DYBezierNode n={x,y,x,y,x,y};NSMutableData *nodes=[[_toolCanvasDraft[@"nodes"]mutableCopy]autorelease];if(nodes.length>=32*sizeof(n)){[self postToolCanvasStatus:@"已达到32个钢笔点,请完成绘制。"];return;}[nodes appendBytes:&n length:sizeof(n)];_toolCanvasDraft[@"nodes"]=nodes;[self postToolCanvasStatus:[NSString stringWithFormat:@"钢笔已放置%lu个点 · 拖出曲柄;点首节点或完成绘制闭合。",(unsigned long)(nodes.length/sizeof(n))]];}return;
|
||||
}
|
||||
if(!_toolCanvasDraft)return;
|
||||
if(CMTimeCompare(time,_toolCanvasEditTime)!=0){[self discardToolCanvasDraft];return;}
|
||||
if(type==NSEventTypeLeftMouseDragged){_toolCanvasHasHover=NO;DYMaskParameters p=_toolDragParameters;float dx=point.x-_toolDragStart.x,dy=point.y-_toolDragStart.y;
|
||||
if(_toolDrawingPen||_toolDragPart>=1000){NSMutableData *data=[[_toolCanvasDraft[@"nodes"]mutableCopy]autorelease];NSUInteger count=data.length/sizeof(DYBezierNode);if(count){auto *nodes=(DYBezierNode*)data.mutableBytes;NSUInteger index=_toolDrawingPen?count-1:(_toolDragPart-1000)/3,handle=_toolDrawingPen?2:(_toolDragPart-1000)%3;float a=p.imageAspect,c=cos(p.angle),s=sin(p.angle),x=((point.x-p.centerX)*a*c+(point.y-p.centerY)*s)/(p.width*a),y=(-(point.x-p.centerX)*a*s+(point.y-p.centerY)*c)/p.height;if(index<count){if(handle==0){float mx=x-nodes[index].x,my=y-nodes[index].y;nodes[index].x=x;nodes[index].y=y;nodes[index].inX+=mx;nodes[index].inY+=my;nodes[index].outX+=mx;nodes[index].outY+=my;}else if(handle==1){nodes[index].inX=x;nodes[index].inY=y;}else{nodes[index].outX=x;nodes[index].outY=y;if(_toolDrawingPen){nodes[index].inX=2*nodes[index].x-x;nodes[index].inY=2*nodes[index].y-y;}}_toolCanvasDraft[@"nodes"]=data;}}}
|
||||
else if(_toolDragPart==6)p.angle=atan2((point.y-p.centerY),(point.x-p.centerX)*p.imageAspect)+M_PI/2;
|
||||
else if(_toolDragPart>=2&&_toolDragPart<=5){float a=p.imageAspect,c=cos(p.angle),s=sin(p.angle),x=(point.x-p.centerX)*a,y=point.y-p.centerY;p.width=MAX(.001f,2*fabs(x*c+y*s)/a);p.height=MAX(.001f,2*fabs(-x*s+y*c));}
|
||||
else{p.centerX+=dx;p.centerY+=dy;}if(dyValidMaskParameters(p))_toolCanvasDraft[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];return;
|
||||
}
|
||||
if(type==NSEventTypeLeftMouseUp&&!_toolDrawingPen)[self commitToolCanvasDraftAtTime:time];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Nontrivial authoring and GPU regressions; runs as part of the signed CLI self-test.
|
||||
{
|
||||
DYToolDocument *empty=[[[DYToolDocument alloc]init]autorelease];NSMutableDictionary *doc=DYMutablePlist(empty.document);
|
||||
NSMutableDictionary *first=DYMutablePlist(DYNewTool(@"hsl")),*second=DYMutablePlist(DYNewTool(@"hsl"));doc[@"layers"]=[NSMutableArray arrayWithObjects:first,second,nil];
|
||||
run.need(@"tool-document-two-independent-hsl",DYValidToolDocument(doc)&&![first[@"id"]isEqual:second[@"id"]]);
|
||||
first[@"values"][@"hsl0_0"]=@32;second[@"values"][@"hsl1_2"]=@55;
|
||||
DYToolDocument *authored=[[[DYToolDocument alloc]init]autorelease];authored.document=doc;NSData *archive=[NSKeyedArchiver archivedDataWithRootObject:authored requiringSecureCoding:YES error:&error];DYToolDocument *restored=[NSKeyedUnarchiver unarchivedObjectOfClass:DYToolDocument.class fromData:archive error:&error];
|
||||
run.record(@"tool-document-secure-archive-roundtrip",[restored isEqual:authored]&&restored.hash==authored.hash);
|
||||
DYToolManager *one=[[[DYToolManager alloc]initWithHost:manager node:first]autorelease];DYWriteTools(manager,doc,kCMTimeZero);id<FxCustomParameterActionAPI_v4>action=(id)one;[action startAction:one];
|
||||
[(id<FxParameterSettingAPI_v6>)one setFloatValue:17 toParameter:2068 atTime:kCMTimeZero];[(id<FxParameterSettingAPI_v6>)one setFloatValue:26 toParameter:2076 atTime:kCMTimeZero];[action endAction:one];NSDictionary *written=DYReadTools(manager,kCMTimeZero).document;
|
||||
run.record(@"instance-proxy-batches-multiple-fields-without-clobber",[DYToolWithID(written,first[@"id"])[@"values"][@"hsl0_0"]isEqual:@17]&&[DYToolWithID(written,first[@"id"])[@"values"][@"hsl1_0"]isEqual:@26]&&[DYToolWithID(written,second[@"id"])[@"values"][@"hsl1_2"]isEqual:@55]);
|
||||
DYInspector *stackInspector=[[[DYInspector alloc]initWithAPIManager:manager renderer:renderer]autorelease];[stackInspector refresh];[stackInspector setFrameSize:NSMakeSize(360,780)];[stackInspector layoutSubtreeIfNeeded];NSDictionary *stackViews=[stackInspector valueForKey:@"_stackViews"];BOOL nativeViews=stackViews.count==2;for(NSString *ID in stackViews){NSArray *c=[stackViews[ID]valueForKey:@"_cards"];nativeViews&=c.count==1&&c[0][@"maskButton"]&&c[0][@"repeatButton"]&&[c[0][@"section"][@"key"]isEqual:@"hsl"];}run.record(@"two-native-hsl-panels-with-mask-and-repeat-buttons",nativeViews);
|
||||
NSMutableDictionary *invalid=DYMutablePlist(doc);invalid[@"layers"][1][@"id"]=first[@"id"];run.record(@"tool-document-rejects-duplicate-identity",!DYValidToolDocument(invalid));invalid=DYMutablePlist(doc);invalid[@"layers"][0][@"values"][@"hsl0_0"]=@(NAN);run.record(@"tool-document-rejects-nonfinite",!DYValidToolDocument(invalid));
|
||||
NSMutableDictionary *mask=DYMutablePlist(DYNewMask(DYMaskRectangle));DYMaskParameters p=DYMaskAtTime(mask,kCMTimeZero);p.feather=0;p.width=.5;p.height=.5;mask[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];CMTime a=CMTimeMake(1001,24000),b=CMTimeMake(2002,24000);DYMaskParameters moved=p;moved.centerX=.7;moved.width=.6;moved.angle=.2;mask[@"keys"]=@[DYMaskKey(a,p,YES,1),DYMaskKey(b,moved,NO,.9)];
|
||||
DYMaskParameters mid=DYMaskAtTime(mask,CMTimeMake(3003,48000));run.record(@"mask-rational-time-interpolates-independent-geometry",fabs(mid.centerX-.6)<1e-6&&fabs(mid.width-.55)<1e-6&&fabs(mid.angle-.1)<1e-6);
|
||||
DYMaskParameters replacement=p;replacement.centerX=.8;BOOL merged=DYMergeTracking(mask,@[DYMaskKey(a,replacement,NO,.8),DYMaskKey(b,replacement,NO,.8)]);run.record(@"tracking-merge-preserves-manual-keys",merged&&fabs(DYMaskAtTime(mask,a).centerX-.5)<1e-6&&fabs(DYMaskAtTime(mask,b).centerX-.8)<1e-6);
|
||||
doc=DYMutablePlist(empty.document);doc[@"baseMasks"][@"hsl"]=[NSMutableArray arrayWithObject:mask];NSDictionary *snapshot=DYToolRenderSnapshot(doc,CMTimeMake(3003,48000));DYMaskParameters resolved=DYMaskAtTime(snapshot[@"baseMasks"][@"hsl"][0],kCMTimeZero);run.record(@"render-snapshot-freezes-time-without-author-keys",[snapshot[@"baseMasks"][@"hsl"][0][@"keys"]count]==0&&fabs(resolved.centerX-.65)<1e-6&&[mask[@"keys"]count]==2);
|
||||
auto renderTools=[&](NSDictionary *tools,DYUniforms u,NSData *mesh,NSString *name){NSError *failure=nil;BOOL ok=[renderer renderSource:source destination:destination uniforms:u paths:@{} spider:mesh tools:tools error:&failure];run.need(name,ok,@{@"error":reason(failure)});return read(destination,gpu);};
|
||||
[[source metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:input.data() bytesPerRow:width*8];
|
||||
Pixels baseline=renderTools(empty.document,defaults,nil,@"empty-tool-document-render");run.record(@"empty-tool-document-preserves-legacy-pixels-exactly",difference(baseline,neutral).maximum==0);
|
||||
doc=DYMutablePlist(empty.document);for(NSString *type in DYToolTypes())[doc[@"layers"]addObject:DYNewTool(type)];Pixels initialized=renderTools(doc,defaults,nil,@"all-twelve-initialized-tool-types-render");run.record(@"initialized-repeated-tools-are-exactly-neutral",difference(initialized,neutral).maximum==0);
|
||||
// Reference is two explicit isolated native operations, which catches shared
|
||||
// uniform or lookup caches, ordering, repeated CST and accidental base replay.
|
||||
DYUniforms layerOne=DYToolUniforms(first),layerTwo=DYToolUniforms(second);render(run,renderer,source,destination,gpu,layerOne,@{},@"hsl-stack-first-reference");DYDiagnosticTile *intermediate=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:width height:height]autorelease];Pixels single=read(destination,gpu);[[intermediate metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:single.data() bytesPerRow:width*8];Pixels expected=render(run,renderer,intermediate,destination,gpu,layerTwo,@{},@"hsl-stack-second-reference");
|
||||
doc=DYMutablePlist(empty.document);doc[@"layers"]=[NSMutableArray arrayWithObjects:first,second,nil];Pixels actual=renderTools(doc,defaults,nil,@"two-hsl-stack-render");run.record(@"two-hsl-stack-matches-independent-sequential-reference",difference(expected,actual).maximum<.003&&difference(actual,single).different>20,measure(difference(expected,actual)));
|
||||
// A hard rectangle's exterior must match the bypassed tool and its interior
|
||||
// must match the active tool; alpha cannot change on either side.
|
||||
DYUniforms hu=defaults;hu.hslHueA.x=32;hu.skinProtection.x=0;Pixels unmasked=render(run,renderer,source,destination,gpu,hu,@{},@"mask-hsl-active-reference");DYUniforms off=hu;off.hslSectionEnabled=0;Pixels noHSL=render(run,renderer,source,destination,gpu,off,@{},@"mask-hsl-bypass-reference");
|
||||
for(int kind=0;kind<6;kind++){@autoreleasepool{NSMutableDictionary *m=DYMutablePlist(DYNewMask(kind));DYMaskParameters params=DYMaskAtTime(m,kCMTimeZero);params.feather=0;params.width=.5;params.height=.5;params.angle=.21;if(kind==DYMaskLumaKey){params.inputBlack=.2;params.inputWhite=.8;}m[@"parameters"]=[NSData dataWithBytes:¶ms length:sizeof(params)];doc=DYMutablePlist(empty.document);doc[@"baseMasks"][@"hsl"]=[NSMutableArray arrayWithObject:m];Pixels pixels=renderTools(doc,hu,nil,[NSString stringWithFormat:@"mask-type-%d-gpu",kind]);BOOL finite=difference(pixels,pixels).nonfinite==0,alpha=YES;for(NSUInteger i=0;i<width*height;i++)alpha&=pixels[i*4+3]==input[i*4+3];run.record([NSString stringWithFormat:@"mask-type-%d-preserves-alpha-finite",kind],finite&&alpha);
|
||||
DYMaskPath path=dyFlattenMask((const DYBezierNode*)[m[@"nodes"]bytes],[m[@"nodes"]length]/sizeof(DYBezierNode));params.imageAspect=float(width)/height;double worst=0;for(NSUInteger y=0;y<height;y++)for(NSUInteger x=0;x<width;x++){auto index=(y*width+x)*4;float a=input[index+3];if(!(a>0))continue;float3 code;auto encode=[](float v){return v<=.0031308f?v*12.92f:1.055f*powf(MAX(0.f,v),1/2.4f)-.055f;};for(int c=0;c<3;c++)code[c]=encode((float)(__fp16)((float)input[index+c]/a));float coverage=dyMaskOperator((x+.5f)/width,(y+.5f)/height,code,params,path);for(int c=0;c<3;c++){float before=encode((float)noHSL[index+c]/a),after=encode((float)unmasked[index+c]/a),mixed=before+(after-before)*coverage;float expected=(mixed<=.04045f?mixed/12.92f:powf(MAX(0.f,(mixed+.055f)/1.055f),2.4f))*a;worst=MAX(worst,fabs(expected-(float)pixels[index+c]));}}run.record([NSString stringWithFormat:@"mask-type-%d-independent-cpu-coverage",kind],worst<.004,@{@"maximumError":@(worst)});}}
|
||||
mask=DYMutablePlist(DYNewMask(DYMaskRectangle));p=DYMaskAtTime(mask,kCMTimeZero);p.feather=0;p.width=p.height=.5;mask[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];doc=DYMutablePlist(empty.document);doc[@"baseMasks"][@"hsl"]=[NSMutableArray arrayWithObject:mask];actual=renderTools(doc,hu,nil,@"hsl-rectangle-isolated-render");BOOL region=YES;double maxRegion=0;for(NSUInteger y=0;y<height;y++)for(NSUInteger x=0;x<width;x++){BOOL inside=x>=width/4&&x<width*3/4&&y>=height/4&&y<height*3/4;for(int c=0;c<4;c++){auto index=(y*width+x)*4+c;double delta=fabs((float)actual[index]-(float)(inside?unmasked:noHSL)[index]);maxRegion=MAX(maxRegion,delta);region&=delta<.003;}}run.record(@"per-tool-mask-affects-only-own-region",region,@{@"maximumError":@(maxRegion)});
|
||||
mask[@"enabled"]=@NO;actual=renderTools(doc,hu,nil,@"mask-eye-disabled-render");run.record(@"disabled-mask-restores-unmasked-tool",difference(actual,unmasked).maximum==0);
|
||||
mask[@"enabled"]=@YES;p.width=p.height=4;mask[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];actual=renderTools(doc,hu,nil,@"all-one-mask-render");run.record(@"all-one-mask-preserves-native-operation",difference(actual,unmasked).maximum<.001);
|
||||
p.strength=0;mask[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];actual=renderTools(doc,hu,nil,@"all-zero-mask-render");run.record(@"all-zero-mask-bypasses-only-own-tool",difference(actual,noHSL).maximum<.003,measure(difference(actual,noHSL)));
|
||||
error=nil;NSURL *blocked=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"masked-export-must-not-exist.cube"]];BOOL exported=[renderer exportLUT:blocked uniforms:hu paths:@{} spider:nil tools:doc error:&error];run.record(@"cube-export-refuses-spatial-mask-with-clear-error",!exported&&error&&![NSFileManager.defaultManager fileExistsAtPath:blocked.path]);
|
||||
DYUniforms primary=defaults;primary.cm.exposure=.6;Pixels primaryFull=render(run,renderer,source,destination,gpu,primary,@{},@"primary-mask-full-reference");DYUniforms primaryOff=primary;primaryOff.primarySectionEnabled=0;Pixels primaryBypass=render(run,renderer,source,destination,gpu,primaryOff,@{},@"primary-mask-bypass-reference");mask=DYMutablePlist(DYNewMask(DYMaskRectangle));p=DYMaskAtTime(mask,kCMTimeZero);p.feather=0;p.width=p.height=.5;mask[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];doc=DYMutablePlist(empty.document);doc[@"baseMasks"][@"primary"]=[NSMutableArray arrayWithObject:mask];actual=renderTools(doc,primary,nil,@"primary-cst-mask-render");BOOL primaryRegion=YES;for(NSUInteger y=0;y<height;y++)for(NSUInteger x=0;x<width;x++)for(int c=0;c<4;c++){BOOL inside=x>=width/4&&x<width*3/4&&y>=height/4&&y<height*3/4;auto i=(y*width+x)*4+c;primaryRegion&=fabs((float)actual[i]-(float)(inside?primaryFull:primaryBypass)[i])<.003;}run.record(@"primary-mask-blends-cst-only-in-selected-region",primaryRegion);
|
||||
DYWriteTools(manager,empty.document,kCMTimeZero);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
namespace {
|
||||
struct FlowOutput {float x,y,error,valid;};
|
||||
struct PyramidInfo {int width[5],height[5],offset[5],levels;};
|
||||
class MetalFlow final : public dy::FlowBackend {
|
||||
id<MTLDevice> device_=nil;
|
||||
id<MTLCommandQueue> queue_=nil;
|
||||
id<MTLComputePipelineState> pyramid_=nil,flow_=nil;
|
||||
id<MTLBuffer> frames_[2]={nil,nil},points_=nil,results_=nil;
|
||||
PyramidInfo info_{};
|
||||
int previous_=0;
|
||||
bool finish(id<MTLCommandBuffer> b) {
|
||||
[b commit];[b waitUntilCompleted];return b.status==MTLCommandBufferStatusCompleted;
|
||||
}
|
||||
void pyramid(id<MTLCommandBuffer> b,id<MTLBuffer> frame) {
|
||||
for(int i=1;i<info_.levels;i++) {
|
||||
id<MTLComputeCommandEncoder>e=[b computeCommandEncoder];[e setComputePipelineState:pyramid_];
|
||||
[e setBuffer:frame offset:0 atIndex:0];[e setBytes:&info_ length:sizeof(info_) atIndex:1];[e setBytes:&i length:sizeof(i) atIndex:2];
|
||||
[e dispatchThreads:MTLSizeMake(info_.width[i],info_.height[i],1) threadsPerThreadgroup:MTLSizeMake(16,8,1)];[e endEncoding];
|
||||
}
|
||||
}
|
||||
public:
|
||||
MetalFlow(NSURL* url,NSError** error) {
|
||||
device_=MTLCreateSystemDefaultDevice();queue_=[device_ newCommandQueue];
|
||||
id<MTLLibrary> l=[device_ newLibraryWithURL:url error:error];if(!l)return;
|
||||
id<MTLFunction> p=[l newFunctionWithName:@"dyTrackPyramid"],f=[l newFunctionWithName:@"dyTrackFlow"];
|
||||
pyramid_=[device_ newComputePipelineStateWithFunction:p error:error];flow_=[device_ newComputePipelineStateWithFunction:f error:error];[p release];[f release];[l release];
|
||||
}
|
||||
~MetalFlow(){for(int i=0;i<2;i++)[frames_[i] release];[points_ release];[results_ release];[pyramid_ release];[flow_ release];[queue_ release];[device_ release];}
|
||||
bool ready()const{return device_&&queue_&&pyramid_&&flow_&&flow_.threadExecutionWidth==32;}
|
||||
bool reset(const dy::GrayFrame& f) override {
|
||||
if(!ready()||!f.valid())return false;
|
||||
info_={};info_.levels=1;info_.width[0]=f.width;info_.height[0]=f.height;
|
||||
int total=f.width*f.height;
|
||||
while(info_.levels<dy::TrackerPyramidLevels&&info_.width[info_.levels-1]>=80&&info_.height[info_.levels-1]>=80) {
|
||||
int i=info_.levels++;info_.width[i]=info_.width[i-1]/2;info_.height[i]=info_.height[i-1]/2;
|
||||
info_.offset[i]=total;total+=info_.width[i]*info_.height[i];
|
||||
}
|
||||
for(int i=0;i<2;i++){[frames_[i] release];frames_[i]=nil;}[points_ release];points_=nil;[results_ release];results_=nil;
|
||||
for(int i=0;i<2;i++)frames_[i]=[device_ newBufferWithLength:total*sizeof(float) options:MTLResourceStorageModeShared];
|
||||
points_=[device_ newBufferWithLength:dy::TrackerFeatureLimit*sizeof(dy::FlowPoint) options:MTLResourceStorageModeShared];
|
||||
results_=[device_ newBufferWithLength:dy::TrackerFeatureLimit*sizeof(FlowOutput) options:MTLResourceStorageModeShared];
|
||||
if(!frames_[0]||!frames_[1]||!points_||!results_)return false;
|
||||
previous_=0;memcpy(frames_[0].contents,f.pixels.data(),f.pixels.size()*sizeof(float));
|
||||
id<MTLCommandBuffer>b=[queue_ commandBuffer];pyramid(b,frames_[0]);return finish(b);
|
||||
}
|
||||
bool advance(const dy::GrayFrame& f,const std::vector<dy::FlowPoint>& points,std::vector<dy::FlowMatch>& matches) override {
|
||||
if(!f.valid()||f.width!=info_.width[0]||f.height!=info_.height[0]||points.empty()||points.size()>dy::TrackerFeatureLimit)return false;
|
||||
int next=1-previous_;memcpy(frames_[next].contents,f.pixels.data(),f.pixels.size()*sizeof(float));
|
||||
memcpy(points_.contents,points.data(),points.size()*sizeof(dy::FlowPoint));
|
||||
id<MTLCommandBuffer>b=[queue_ commandBuffer];pyramid(b,frames_[next]);
|
||||
id<MTLComputeCommandEncoder>e=[b computeCommandEncoder];[e setComputePipelineState:flow_];
|
||||
[e setBuffer:frames_[previous_] offset:0 atIndex:0];[e setBuffer:frames_[next] offset:0 atIndex:1];
|
||||
[e setBuffer:points_ offset:0 atIndex:2];[e setBuffer:results_ offset:0 atIndex:3];[e setBytes:&info_ length:sizeof(info_) atIndex:4];
|
||||
[e dispatchThreads:MTLSizeMake(points.size()*32,1,1) threadsPerThreadgroup:MTLSizeMake(flow_.threadExecutionWidth,1,1)];[e endEncoding];
|
||||
if(!finish(b))return false;auto*r=static_cast<const FlowOutput*>(results_.contents);
|
||||
for(size_t i=0;i<points.size();i++)if(r[i].valid>0)matches.push_back({points[i],{r[i].x,r[i].y},r[i].error});
|
||||
previous_=next;return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
std::shared_ptr<dy::FlowBackend> DYToolCreateMetalFlow(NSURL* url,NSError** error) {
|
||||
auto backend=std::make_shared<MetalFlow>(url,error);if(backend->ready())return backend;
|
||||
if(error&&!*error)*error=[NSError errorWithDomain:@"com.dayu.color.tracking" code:1 userInfo:@{NSLocalizedDescriptionKey:@"Metal 跟踪引擎不可用"}];return {};
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
#include "MaskCore/DYMaskOperator.h"
|
||||
struct DYToolMaskEntry {DYResolvedMask mask;int section,combine;};
|
||||
struct DYToolMaskHeader {unsigned count;float offsetX,offsetY,scaleX,scaleY;int section,premultiplied;};
|
||||
struct DYToolStageRange {int first,last,suppressBlackWhite;};
|
||||
@@ -0,0 +1,7 @@
|
||||
@class DYPlugIn;
|
||||
static NSMapTable *DYToolCanvasSessions(void){static NSMapTable *map;static dispatch_once_t once;dispatch_once(&once,^{map=[[NSMapTable strongToWeakObjectsMapTable]retain];});return map;}
|
||||
@interface DYPlugIn (ToolCanvas)
|
||||
- (NSDictionary*)toolCanvasMaskAtTime:(CMTime)time;
|
||||
- (void)toolCanvasEvent:(NSEventType)type point:(NSPoint)point part:(NSInteger)part modifiers:(FxModifierKeys)modifiers key:(unichar)key time:(CMTime)time;
|
||||
- (BOOL)toolCanvasVisible;
|
||||
@end
|
||||
@@ -0,0 +1,18 @@
|
||||
NSString *_toolSession,*_selectedToolNode,*_selectedToolMask;
|
||||
NSTimer *_toolAnalysisTimer;
|
||||
BOOL _toolCaptureEnabled,_toolCanvasHidden,_toolDrawingPen,_toolShowCoverage,_toolCanvasCommitPending;
|
||||
NSMutableDictionary *_toolCanvasDraft,*_toolCanvasOriginal;NSDictionary *_toolCanvasDocument;
|
||||
NSPoint _toolCanvasHoverPoint;BOOL _toolCanvasHasHover;
|
||||
NSPoint _toolDragStart;DYMaskParameters _toolDragParameters;NSInteger _toolDragPart;
|
||||
CMTime _toolCanvasEditTime;uint64_t _toolCanvasRevision;
|
||||
dy::GrayFrame _toolSourceFrame,_trackingReferenceFrame;
|
||||
CMTime _toolSourceTime,_trackingReferenceTime,_trackingFrameDuration,_trackingPreviousTime;
|
||||
std::atomic_bool _trackingActive,_trackingFinishing,_trackingInFrame,_trackingCancelled;
|
||||
BOOL _trackingBackward,_trackingBoth,_trackingSingle,_trackingFlip,_trackingDiscard;
|
||||
uint64_t _trackingGeneration;double _trackingStarted;
|
||||
NSString *_trackingNode,*_trackingMaskID,*_trackingMessage;
|
||||
NSDictionary *_trackingFrozenMask;NSMutableDictionary *_trackingCandidate;
|
||||
NSMutableArray *_trackingSamples;
|
||||
DYMaskParameters _trackingSeed;
|
||||
dy::Tracker _toolTracker;
|
||||
NSMutableDictionary *_toolCaptureDevices;
|
||||
@@ -0,0 +1,94 @@
|
||||
- (void)initializeToolHost {
|
||||
_toolCaptureDevices=[NSMutableDictionary new];_toolCanvasDocument=[[[[DYToolDocument alloc]init]autorelease].document copy];_toolSourceTime=kCMTimeInvalid;_toolCanvasEditTime=kCMTimeInvalid;
|
||||
NSNotificationCenter *n=NSNotificationCenter.defaultCenter;[n addObserver:self selector:@selector(toolCanvasSelection:) name:@"DYToolCanvasSelection" object:_apiManager];[n addObserver:self selector:@selector(toolCanvasCommand:) name:@"DYToolCanvasCommand" object:_apiManager];[n addObserver:self selector:@selector(toolTrackRequested:) name:@"DYToolTrack" object:_apiManager];
|
||||
}
|
||||
- (void)tearDownToolHost {
|
||||
[_toolAnalysisTimer invalidate];[_toolAnalysisTimer release];@synchronized(DYToolCanvasSessions()){if(_toolSession)[DYToolCanvasSessions()removeObjectForKey:_toolSession];}
|
||||
[_toolCanvasDocument release];[_toolSession release];[_selectedToolNode release];[_selectedToolMask release];[_toolCanvasDraft release];[_toolCanvasOriginal release];[_trackingNode release];[_trackingMaskID release];[_trackingFrozenMask release];[_trackingCandidate release];[_trackingSamples release];[_trackingMessage release];[_toolCaptureDevices release];
|
||||
}
|
||||
- (void)adoptToolCanvasDocument:(NSDictionary*)document {
|
||||
if(!document)return;@synchronized(self){[_toolCanvasDocument release];_toolCanvasDocument=[document copy];if([self toolMask:_selectedToolMask node:_selectedToolNode document:document])return;NSString *node=nil,*maskID=nil;for(NSString *type in DYToolTypes())for(NSDictionary *mask in document[@"baseMasks"][type])if(!node&&[mask[@"enabled"]boolValue]){node=[@"base:" stringByAppendingString:type];maskID=mask[@"id"];}for(NSDictionary *layer in document[@"layers"])for(NSDictionary *mask in layer[@"masks"])if(!node&&[mask[@"enabled"]boolValue]){node=layer[@"id"];maskID=mask[@"id"];}[_selectedToolNode release];_selectedToolNode=[node copy];[_selectedToolMask release];_selectedToolMask=[maskID copy];}
|
||||
}
|
||||
- (void)scheduleToolCanvasRegistration {
|
||||
_toolCaptureEnabled=YES;dispatch_async(dispatch_get_main_queue(),^{id<FxCustomParameterActionAPI_v4>a=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{if(!self->_toolSession){NSString *session=NSUUID.UUID.UUIDString;id<FxParameterSettingAPI_v6>s=[self->_apiManager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];BOOL accepted=[s setStringParameterValue:session toParameter:DYCanvasSessionParameterID];os_log(OS_LOG_DEFAULT,"dayu_tool_canvas_registered accepted=%{public}d",(int)accepted);{self->_toolSession=[session copy];@synchronized(DYToolCanvasSessions()){[DYToolCanvasSessions()setObject:self forKey:session];}}}}@finally{[a endAction:self];}});
|
||||
}
|
||||
- (dy::GrayFrame)toolGrayFrame:(FxImageTile*)tile error:(NSError**)error {
|
||||
@synchronized(_toolCaptureDevices){FxRect b=tile.tilePixelBounds,image=tile.imagePixelBounds;if(b.left!=image.left||b.right!=image.right||b.bottom!=image.bottom||b.top!=image.top)return {};
|
||||
NSNumber *key=@(tile.deviceRegistryID);NSMutableDictionary *entry=_toolCaptureDevices[key];if(!entry){NSArray *devices=MTLCopyAllDevices();id<MTLDevice>d=nil;for(id<MTLDevice>candidate in devices)if(candidate.registryID==tile.deviceRegistryID)d=candidate;if(d){id<MTLLibrary>library=[d newLibraryWithURL:[[NSBundle bundleForClass:self.class]URLForResource:@"default" withExtension:@"metallib"]error:error];id<MTLFunction>function=[library newFunctionWithName:@"dyToolCapture"];id<MTLComputePipelineState>pipeline=function?[d newComputePipelineStateWithFunction:function error:error]:nil;id<MTLCommandQueue>queue=[d newCommandQueue];if(pipeline&&queue){entry=[NSMutableDictionary dictionaryWithDictionary:@{@"device":d,@"pipeline":pipeline,@"queue":queue}];_toolCaptureDevices[key]=entry;}[pipeline release];[queue release];[function release];[library release];}[devices release];if(!entry)return {};}
|
||||
id<MTLTexture>texture=[tile metalTextureForDevice:entry[@"device"]];if(!texture)return {};double aspect=tile.pixelAspect;if(!std::isfinite(aspect)||aspect<=0)return {};aspect=MAX(.01,aspect);double displayHeight=texture.height/aspect,scale=MIN(1.,MIN(1280./texture.width,720./displayHeight));unsigned width=(unsigned)floor(texture.width*scale),height=(unsigned)floor(displayHeight*scale);if(width<16||height<16||height>720||width>1280)return {};
|
||||
id<MTLBuffer>buffer=[entry[@"device"]newBufferWithLength:width*height*sizeof(float) options:MTLResourceStorageModeShared];if(!buffer)return {};vector_uint3 info={width,height,(unsigned)(tile.imageOrigin==kFxImageOrigin_BOTTOM_LEFT)};id<MTLCommandBuffer>commands=[entry[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>encoder=[commands computeCommandEncoder];[encoder setComputePipelineState:entry[@"pipeline"]];[encoder setTexture:texture atIndex:0];[encoder setBuffer:buffer offset:0 atIndex:0];[encoder setBytes:&info length:sizeof(info) atIndex:1];[encoder dispatchThreads:MTLSizeMake(width,height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[encoder endEncoding];[commands commit];[commands waitUntilCompleted];dy::GrayFrame frame;if(commands.status==MTLCommandBufferStatusCompleted){frame={int(width),int(height),std::vector<float>(width*height)};memcpy(frame.pixels.data(),buffer.contents,width*height*sizeof(float));}[buffer release];return frame;
|
||||
}
|
||||
}
|
||||
- (NSMutableDictionary*)toolMask:(NSString*)maskID node:(NSString*)nodeID document:(NSDictionary*)doc {for(NSMutableDictionary *m in DYMasksForTool(doc,nodeID))if([m[@"id"]isEqual:maskID])return m;return nil;}
|
||||
- (void)toolStatus:(NSString*)message {
|
||||
NSString *node=[[_trackingNode?:_selectedToolNode copy]autorelease];dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolTrackingStatus" object:self->_apiManager userInfo:@{@"node":node?:@"",@"message":message?:@""}];});
|
||||
}
|
||||
- (void)toolCanvasSelection:(NSNotification*)notification {
|
||||
NSString *node=notification.userInfo[@"node"],*mask=notification.userInfo[@"mask"];if(!node||!mask)return;NSDictionary *document=notification.userInfo[@"document"];if(document&&DYValidToolDocument(document)){DYToolDocument *immutable=[[[DYToolDocument alloc]init]autorelease];immutable.document=document;[self adoptToolCanvasDocument:immutable.document];}os_log(OS_LOG_DEFAULT,"dayu_tool_canvas_selected");
|
||||
@synchronized(self){if(_trackingActive.load()&&(![_trackingNode isEqual:node]||![_trackingMaskID isEqual:mask])){_trackingCancelled.store(true);_trackingDiscard=YES;}[_selectedToolNode release];_selectedToolNode=[node copy];[_selectedToolMask release];_selectedToolMask=[mask copy];_toolCanvasHidden=[notification.userInfo[@"hidden"]boolValue];_toolDrawingPen=[notification.userInfo[@"draw"]boolValue];++_toolCanvasRevision;_toolCanvasEditTime=kCMTimeInvalid;_toolDragPart=0;_toolCanvasHasHover=NO;[_toolCanvasDraft release];_toolCanvasDraft=nil;[_toolCanvasOriginal release];_toolCanvasOriginal=nil;}[self postToolCanvasStatus:_toolDrawingPen?@"钢笔:点击放点,拖出曲柄;点首节点或完成绘制闭合。":@"已选中本层蒙版"];
|
||||
}
|
||||
- (BOOL)toolCanvasVisible {@synchronized(self){return _selectedToolNode&&_selectedToolMask&&!_toolCanvasHidden;}}
|
||||
- (NSDictionary*)toolCanvasMaskAtTime:(CMTime)time {
|
||||
@synchronized(self){if(_toolCanvasHidden||!_selectedToolMask)return nil;NSDictionary *m=_toolCanvasDraft?:[self toolMask:_selectedToolMask node:_selectedToolNode document:_toolCanvasDocument];if(!m)return nil;DYMaskParameters p=DYMaskAtTime(m,time);return @{@"id":m[@"id"],@"parameters":[NSData dataWithBytes:&p length:sizeof(p)],@"nodes":(_toolDrawingPen&&!_toolCanvasDraft)?[NSData data]:(m[@"nodes"]?:[NSData data]),@"drawing":@(_toolDrawingPen),@"hover":(_toolDrawingPen&&_toolCanvasHasHover)?@[@(_toolCanvasHoverPoint.x),@(_toolCanvasHoverPoint.y)]:@[],@"coverage":@(_toolShowCoverage)};}
|
||||
}
|
||||
- (void)toolTrackRequested:(NSNotification*)notification {
|
||||
NSInteger direction=[notification.userInfo[@"direction"]integerValue];if(direction==9){_trackingCancelled.store(true);return;}@synchronized(self){if(_toolDrawingPen||_toolCanvasCommitPending){[self postToolCanvasStatus:@"请先完成或取消钢笔绘制,再开始跟踪。"];return;}}if(_trackingActive.load()){[self toolStatus:@"请先取消当前跟踪"];return;}
|
||||
id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{
|
||||
id<FxAnalysisAPI>analysis=[_apiManager apiForProtocol:@protocol(FxAnalysisAPI)];FxAnalysisState state=[analysis analysisStateForEffect];if(!analysis||state==kFxAnalysisState_AnalysisRequested||state==kFxAnalysisState_AnalysisStarted){[self toolStatus:@"宿主未就绪,请等待当前分析结束"];return;}
|
||||
CMTime time=a.currentTime;NSDictionary *doc=DYReadTools(_apiManager,time).document;NSDictionary *mask=[self toolMask:notification.userInfo[@"mask"] node:notification.userInfo[@"node"] document:doc];if(!mask||![mask[@"enabled"]boolValue]){[self toolStatus:@"请先选择当前工具的启用蒙版"];return;}DYMaskParameters seed=DYMaskAtTime(mask,time);if(seed.kind>DYMaskBezier||(seed.kind==DYMaskBezier&&[mask[@"nodes"]length]<3*sizeof(DYBezierNode))){[self toolStatus:@"跟踪需要矩形、椭圆或闭合钢笔区域"];return;}
|
||||
// The host may reuse an already rendered frame without calling our renderer.
|
||||
// Analyzer input is authoritative; a matching preview is only an optional
|
||||
// orientation check, never a prerequisite for starting at the playhead.
|
||||
@synchronized(self){_trackingReferenceFrame={};if(_toolSourceFrame.valid()&&CMTIME_IS_NUMERIC(_toolSourceTime)&&CMTimeCompare(_toolSourceTime,time)==0)_trackingReferenceFrame=_toolSourceFrame;}
|
||||
id<FxTimingAPI_v4>timing=[_apiManager apiForProtocol:@protocol(FxTimingAPI_v4)];NSUInteger numerator=[timing timelineFpsNumeratorForEffect:self],denominator=[timing timelineFpsDenominatorForEffect:self];_trackingFrameDuration=numerator&&denominator&&numerator<=INT32_MAX?CMTimeMake(denominator,(int32_t)numerator):kCMTimeInvalid;if(!CMTIME_IS_NUMERIC(_trackingFrameDuration)||_trackingFrameDuration.value<=0){[self toolStatus:@"宿主未提供精确帧长,跟踪未启动"];return;}
|
||||
[_trackingNode release];_trackingNode=[notification.userInfo[@"node"]copy];[_trackingMaskID release];_trackingMaskID=[notification.userInfo[@"mask"]copy];[_trackingFrozenMask release];_trackingFrozenMask=[mask copy];[_trackingCandidate release];_trackingCandidate=[DYMutablePlist(mask)retain];[_trackingSamples release];_trackingSamples=[NSMutableArray new];[_trackingMessage release];_trackingMessage=nil;
|
||||
_trackingReferenceTime=time;_trackingSeed=seed;_trackingBackward=direction<0;_trackingBoth=direction==0;_trackingSingle=std::abs((int)direction)==2;_trackingDiscard=NO;_trackingCancelled.store(false);_trackingFinishing.store(false);_trackingActive.store(true);++_trackingGeneration;_trackingStarted=NSProcessInfo.processInfo.systemUptime;
|
||||
os_log(OS_LOG_DEFAULT,"dayu_tool_track_start direction=%{public}ld reference=%{public}.6f cached=%{public}d",(long)direction,CMTimeGetSeconds(time),_trackingReferenceFrame.valid());
|
||||
NSError *error=nil;BOOL started=_trackingBackward?[analysis startBackwardAnalysis:kFxAnalysisLocation_GPU error:&error]:[analysis startForwardAnalysis:kFxAnalysisLocation_GPU error:&error];if(!started){_trackingActive.store(false);[self toolStatus:error.localizedDescription?:@"宿主未启动逐帧分析"];return;}
|
||||
[self toolStatus:@"正在读取宿主源帧并跟踪…"];if(!_toolAnalysisTimer)_toolAnalysisTimer=[[NSTimer scheduledTimerWithTimeInterval:.3 target:self selector:@selector(pollToolAnalysis:) userInfo:nil repeats:YES]retain];
|
||||
}@finally{[a endAction:self];}
|
||||
}
|
||||
- (void)pollToolAnalysis:(NSTimer*)timer {
|
||||
if(!_trackingActive.load()||_trackingFinishing.load()||_trackingInFrame.load())return;id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{id<FxAnalysisAPI>api=[_apiManager apiForProtocol:@protocol(FxAnalysisAPI)];FxAnalysisState state=[api analysisStateForEffect];if(state==kFxAnalysisState_AnalysisCompleted||state==kFxAnalysisState_AnalysisInterrupted||(state==kFxAnalysisState_NotAnalyzing&&NSProcessInfo.processInfo.systemUptime-_trackingStarted>2))[self cleanupAnalysis:nil];}@finally{[a endAction:self];}
|
||||
}
|
||||
- (BOOL)stopToolAnalysis:(NSString*)message error:(NSError**)error {
|
||||
if(message){[_trackingMessage release];_trackingMessage=[message copy];if(error)*error=[NSError errorWithDomain:@"com.dayu.color.tracking" code:2 userInfo:@{NSLocalizedDescriptionKey:message}];}[self cleanupAnalysis:nil];return NO;
|
||||
}
|
||||
- (BOOL)finishToolAnalysis:(NSString*)message error:(NSError**)error {
|
||||
// FxAnalyzer's quiet cancellation is an explicit SDK error sentinel. A bare
|
||||
// NO/nil can leave FCP's background analysis task active after our cleanup.
|
||||
[self stopToolAnalysis:message error:nil];if(error)*error=[NSError errorWithDomain:FxPlugErrorDomain code:kFxError_UserCancelled userInfo:@{NSLocalizedDescriptionKey:message?:@"本次跟踪已结束"}];return NO;
|
||||
}
|
||||
- (BOOL)desiredAnalysisTimeRange:(CMTimeRange*)out forInputWithTimeRange:(CMTimeRange)input error:(NSError**)error {
|
||||
CMTime end=CMTimeRangeGetEnd(input),ref=_trackingReferenceTime,step=_trackingFrameDuration;if(!CMTIME_IS_NUMERIC(input.start)||!CMTIME_IS_NUMERIC(end)||!CMTIME_IS_NUMERIC(ref)||ref.epoch!=input.start.epoch||ref.epoch!=end.epoch||CMTimeCompare(ref,input.start)<0||CMTimeCompare(ref,end)>=0||!CMTIME_IS_NUMERIC(step)||step.value<=0)return [self stopToolAnalysis:@"跟踪起点或帧长无效" error:error];
|
||||
CMTime lo=_trackingBackward?input.start:ref,hi=_trackingBackward?CMTimeAdd(ref,step):end;if(_trackingSingle){if(_trackingBackward){lo=CMTimeSubtract(ref,step);if(CMTimeCompare(lo,input.start)<0)lo=input.start;}else hi=CMTimeAdd(ref,CMTimeMultiply(step,2));}if(CMTimeCompare(hi,end)>0)hi=end;if(_trackingBackward&&CMTimeCompare(ref,input.start)==0&&!_trackingBoth){[_trackingMessage release];_trackingMessage=[@"已到片段边界,未产生新轨迹" copy];}*out=CMTimeRangeFromTimeToTime(lo,hi);return out->duration.value>0;
|
||||
}
|
||||
- (BOOL)setupAnalysisForTimeRange:(CMTimeRange)range frameDuration:(CMTime)duration error:(NSError**)error {
|
||||
if(!CMTIME_IS_NUMERIC(duration)||duration.value<=0||duration.epoch!=0)return [self stopToolAnalysis:@"宿主分析帧长无效" error:error];_trackingFrameDuration=duration;_trackingPreviousTime=kCMTimeInvalid;_trackingFlip=NO;[_trackingSamples removeAllObjects];auto backend=DYToolCreateMetalFlow([[NSBundle bundleForClass:self.class]URLForResource:@"default" withExtension:@"metallib"],error);if(!backend)return [self stopToolAnalysis:@"Metal 跟踪后端无法启动" error:error];_toolTracker.setBackend(backend);
|
||||
std::vector<dy::FlowPoint>polygon;NSData *nodes=_trackingCandidate[@"nodes"];if(_trackingSeed.kind==DYMaskBezier){auto path=dyFlattenMask((const DYBezierNode*)nodes.bytes,nodes.length/sizeof(DYBezierNode));for(int i=0;i<path.count;i++)polygon.push_back({path.x[i],path.y[i]});}else if(_trackingSeed.kind==DYMaskRectangle)polygon={{-.5f,-.5f},{.5f,-.5f},{.5f,.5f},{-.5f,.5f}};else for(int i=0;i<128;i++){float angle=i*(2.f*M_PI/128);polygon.push_back({.5f*std::cos(angle),.5f*std::sin(angle)});}_toolTracker.setMask(std::move(polygon));return YES;
|
||||
}
|
||||
- (BOOL)analyzeFrame:(FxImageTile*)tile atTime:(CMTime)time error:(NSError**)error {
|
||||
if(!_trackingActive.load()||_trackingFinishing.load()){if(error)*error=[NSError errorWithDomain:FxPlugErrorDomain code:kFxError_UserCancelled userInfo:nil];return NO;}_trackingInFrame.store(true);@try{
|
||||
if(_trackingCancelled.load())return [self finishToolAnalysis:@"已取消;保留最后连续可信轨迹" error:error];if(_trackingSingle&&_trackingSamples.count>=2)return [self finishToolAnalysis:nil error:error];if(_trackingSamples.count>=DYToolKeyLimit)return [self finishToolAnalysis:@"轨迹已到数量上限,保留已完成部分" error:error];
|
||||
CMTime expected=CMTIME_IS_NUMERIC(_trackingPreviousTime)?(_trackingBackward?CMTimeSubtract(_trackingPreviousTime,_trackingFrameDuration):CMTimeAdd(_trackingPreviousTime,_trackingFrameDuration)):_trackingReferenceTime;if(!CMTIME_IS_NUMERIC(time)||time.epoch!=expected.epoch||CMTimeCompare(time,expected)!=0)return [self stopToolAnalysis:@"宿主帧序列不连续,停在最后可信帧" error:error];
|
||||
dy::GrayFrame frame=[self toolGrayFrame:tile error:error];if(!frame.valid())return [self stopToolAnalysis:@"宿主未返回完整源画面" error:error];
|
||||
if(!_trackingSamples.count){if(_trackingReferenceFrame.valid()&&frame.width==_trackingReferenceFrame.width&&frame.height==_trackingReferenceFrame.height){double same=0,flip=0;size_t count=0;for(int y=0;y<frame.height;y+=8)for(int x=0;x<frame.width;x+=8){float p=frame.pixels[y*frame.width+x];same+=fabs(p-_trackingReferenceFrame.pixels[y*frame.width+x]);flip+=fabs(p-_trackingReferenceFrame.pixels[(frame.height-1-y)*frame.width+x]);count++;}same/=MAX(size_t(1),count);flip/=MAX(size_t(1),count);_trackingFlip=flip<.035&&flip+.008<same&&flip<same*.8;}os_log(OS_LOG_DEFAULT,"dayu_tool_track_seed width=%{public}d height=%{public}d flip=%{public}d time=%{public}.6f",frame.width,frame.height,(int)_trackingFlip,CMTimeGetSeconds(time));}
|
||||
if(_trackingFlip)for(int y=0;y<frame.height/2;y++)for(int x=0;x<frame.width;x++)std::swap(frame.pixels[y*frame.width+x],frame.pixels[(frame.height-1-y)*frame.width+x]);
|
||||
if(!_trackingSamples.count){if(!_toolTracker.reset(frame,{_trackingSeed.centerX,_trackingSeed.centerY,_trackingSeed.width,_trackingSeed.height,_trackingSeed.angle}))return [self finishToolAnalysis:@"蒙版内纹理不足,原蒙版已保留" error:error];}else if(!_toolTracker.track(frame).valid){auto lost=_toolTracker.result();NSString *reason=@"区域内运动不一致";switch(lost.failure){case dy::TrackFailure::InsufficientMatches:reason=@"可用特征点不足";break;case dy::TrackFailure::LowConfidence:reason=@"运动可信度不足";break;case dy::TrackFailure::OutsideFrame:reason=@"目标已离开画面";break;case dy::TrackFailure::InvalidTransform:reason=@"运动变换过大";break;case dy::TrackFailure::Backend:case dy::TrackFailure::InvalidFrame:reason=@"源画面或跟踪引擎异常";break;default:break;}os_log(OS_LOG_DEFAULT,"dayu_tool_track_loss time=%{public}.6f reason=%{public}d features=%{public}d matches=%{public}d inliers=%{public}d confidence=%{public}.3f residual=%{public}.3f",CMTimeGetSeconds(time),(int)lost.failure,lost.features,lost.matches,lost.inliers,lost.confidence,lost.medianError);return [self finishToolAnalysis:[NSString stringWithFormat:@"%@,已保留 %lu 帧可信轨迹;可调整蒙版后从此处继续",reason,(unsigned long)_trackingSamples.count] error:error];}
|
||||
auto result=_toolTracker.result();DYMaskParameters p=DYMaskAtTime(_trackingFrozenMask,time);p.centerX=result.cx;p.centerY=result.cy;p.width=_trackingSeed.width*result.scaleX;p.height=_trackingSeed.height*result.scaleY;p.angle=_trackingSeed.angle+result.rotation;if(!dyValidMaskParameters(p))return [self stopToolAnalysis:@"跟踪变换无效,未写入错误结果" error:error];[_trackingSamples addObject:DYMaskKey(time,p,NO,result.confidence)];_trackingPreviousTime=time;
|
||||
if(_trackingSamples.count==1||_trackingSamples.count%15==0)[self toolStatus:[NSString stringWithFormat:@"已分析 %lu 帧 · 置信度 %.0f%%",(unsigned long)_trackingSamples.count,result.confidence*100]];return YES;
|
||||
}@finally{_trackingInFrame.store(false);}
|
||||
}
|
||||
- (BOOL)cleanupAnalysis:(NSError**)error {
|
||||
if(!_trackingActive.load()||_trackingFinishing.exchange(true))return YES;BOOL changed=_trackingSamples.count>1;if(changed&&!DYMergeTracking(_trackingCandidate,_trackingSamples)){[_trackingMessage release];_trackingMessage=[@"轨迹合并失败,原蒙版已保留" copy];_trackingDiscard=YES;}
|
||||
uint64_t generation=_trackingGeneration;BOOL second=_trackingBoth&&!_trackingBackward&&!_trackingCancelled.load()&&!_trackingDiscard;
|
||||
dispatch_async(dispatch_get_main_queue(),^{if(self->_trackingGeneration!=generation)return;
|
||||
if(second){self->_trackingBackward=YES;self->_trackingFinishing.store(false);self->_trackingStarted=NSProcessInfo.processInfo.systemUptime;id<FxCustomParameterActionAPI_v4>a=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];BOOL started=NO;if(a){[a startAction:self];@try{started=[[self->_apiManager apiForProtocol:@protocol(FxAnalysisAPI)]startBackwardAnalysis:kFxAnalysisLocation_GPU error:nil];}@finally{[a endAction:self];}}if(started){[self toolStatus:@"正向完成,正在从同一起点反向跟踪…"];return;}self->_trackingFinishing.store(true);}
|
||||
BOOL hasResults=![self->_trackingCandidate[@"keys"]isEqual:self->_trackingFrozenMask[@"keys"]];NSString *message=self->_trackingMessage?:[NSString stringWithFormat:@"%@跟踪完成 · %lu 个轨迹键",self->_trackingBoth?@"双向":(self->_trackingBackward?@"反向":@"正向"),(unsigned long)[self->_trackingCandidate[@"keys"]count]];
|
||||
if(hasResults&&!self->_trackingDiscard){id<FxCustomParameterActionAPI_v4>a=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(a){[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(self->_apiManager,a.currentTime).document);NSMutableDictionary *mask=[self toolMask:self->_trackingMaskID node:self->_trackingNode document:doc];if(mask&&[mask isEqual:self->_trackingFrozenMask]){self->_trackingCandidate[@"status"]=message;[mask setDictionary:self->_trackingCandidate];id<FxUndoAPI>undo=[self->_apiManager apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"蒙版区域跟踪"];BOOL written=DYWriteTools(self->_apiManager,doc,a.currentTime);[undo endUndoGroup];if(!written)message=@"宿主未接受轨迹,原蒙版已保留";}else message=@"目标工具或蒙版已更改,已丢弃过期跟踪结果";}@finally{[a endAction:self];}}}
|
||||
CMTime stepTime=self->_trackingPreviousTime;BOOL advance=self->_trackingSingle&&changed&&!self->_trackingDiscard&&!self->_trackingCancelled.load()&&CMTIME_IS_NUMERIC(stepTime);
|
||||
self->_trackingActive.store(false);if(advance){id<FxCustomParameterActionAPI_v4>seek=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(seek){[seek startAction:self];@try{id<FxTimingAPI_v4>timing=[self->_apiManager apiForProtocol:@protocol(FxTimingAPI_v4)];CMTime timelineTime=kCMTimeInvalid;[timing timelineTime:&timelineTime fromInputTime:stepTime];id<FxCommandAPI_v2>command=[self->_apiManager apiForProtocol:@protocol(FxCommandAPI_v2)];if(CMTIME_IS_NUMERIC(timelineTime)){NSError *seekError=nil;BOOL moved=[command movePlayheadToTime:timelineTime error:&seekError];if(!moved)os_log(OS_LOG_DEFAULT,"dayu_tool_track_seek timeline=%{public}.6f code=%{public}ld",CMTimeGetSeconds(timelineTime),(long)seekError.code);}else message=[message stringByAppendingString:@";宿主未提供有效播放头位置"];}@finally{[seek endAction:self];}}}[self->_toolAnalysisTimer invalidate];[self->_toolAnalysisTimer release];self->_toolAnalysisTimer=nil;[self toolStatus:message];[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];
|
||||
});return YES;
|
||||
}
|
||||
|
||||
#include "DYToolCanvasEditing.inc.h"
|
||||
@@ -0,0 +1,44 @@
|
||||
// Stable insertion identities, on-card layout and noncommuting render oracles.
|
||||
{
|
||||
DYToolDocument *empty=[[[DYToolDocument alloc]init]autorelease];NSMutableDictionary *doc=DYMutablePlist(empty.document);
|
||||
NSDictionary *one=DYInsertTool(doc,@"hsl",@"base:hsl"),*two=DYInsertTool(doc,@"hsl",one[@"id"]),*newest=DYInsertTool(doc,@"hsl",@"base:hsl");NSArray *order=DYToolDisplayOrder(doc);NSUInteger hslIndex=[order indexOfObject:@"base:hsl"];
|
||||
run.need(@"inserted-tool-documents-have-validated-anchors",DYValidToolDocument(doc)&&[doc[@"schema"]isEqual:@2]);
|
||||
run.record(@"repeat-splices-immediately-after-clicked-base-or-extra",[order[hslIndex+1]isEqual:newest[@"id"]]&&[order[hslIndex+2]isEqual:one[@"id"]]&&[order[hslIndex+3]isEqual:two[@"id"]]&&[order[hslIndex+4]isEqual:@"base:curve"]);
|
||||
run.record(@"inserted-tools-start-with-independent-initial-values",[one[@"values"]count]==0&&[two[@"values"]count]==0&&[newest[@"values"]count]==0&&![one[@"id"]isEqual:two[@"id"]]);
|
||||
DYToolDocument *authored=[[[DYToolDocument alloc]init]autorelease];authored.document=doc;NSData *archive=[NSKeyedArchiver archivedDataWithRootObject:authored requiringSecureCoding:YES error:&error];DYToolDocument *restored=[NSKeyedUnarchiver unarchivedObjectOfClass:DYToolDocument.class fromData:archive error:&error];run.record(@"inserted-order-secure-archive-roundtrip",[restored isEqual:authored]&&[DYToolDisplayOrder(restored.document)isEqual:order]);
|
||||
NSMutableDictionary *bad=DYMutablePlist(doc);bad[@"layers"][0][@"after"]=@"base:unknown";run.record(@"insertion-rejects-unknown-base-anchor",!DYValidToolDocument(bad));bad=DYMutablePlist(doc);bad[@"layers"][0][@"after"]=bad[@"layers"][0][@"id"];run.record(@"insertion-rejects-cyclic-anchor",!DYValidToolDocument(bad));
|
||||
BOOL removed=DYRemoveTool(doc,one[@"id"]);order=DYToolDisplayOrder(doc);hslIndex=[order indexOfObject:@"base:hsl"];run.record(@"delete-reconnects-child-without-moving-to-bottom",removed&&DYValidToolDocument(doc)&&[order[hslIndex+1]isEqual:newest[@"id"]]&&[order[hslIndex+2]isEqual:two[@"id"]]);
|
||||
DYWriteTools(manager,doc,kCMTimeZero);DYInspector *inspector=[[[DYInspector alloc]initWithAPIManager:manager renderer:renderer]autorelease];[inspector refresh];[inspector setFrameSize:NSMakeSize(360,780)];[inspector layoutSubtreeIfNeeded];NSDictionary *views=[inspector valueForKey:@"_stackViews"];NSArray *cards=[inspector valueForKey:@"_cards"];NSView *baseHSL=nil,*baseCurve=nil;for(NSDictionary *card in cards){if([card[@"section"][@"key"]isEqual:@"hsl"])baseHSL=card[@"view"];if([card[@"section"][@"key"]isEqual:@"curve"])baseCurve=card[@"view"];}NSView *newView=views[newest[@"id"]],*secondView=views[two[@"id"]];run.record(@"new-native-card-is-laid-out-between-its-source-and-next-module",newView&&secondView&&NSMinY(newView.frame)>=NSMaxY(baseHSL.frame)&&NSMinY(secondView.frame)>=NSMaxY(newView.frame)&&NSMinY(baseCurve.frame)>=NSMaxY(secondView.frame));
|
||||
doc=DYMutablePlist(empty.document);NSMutableDictionary *legacy=DYMutablePlist(DYNewTool(@"hsl"));[doc[@"layers"]addObject:legacy];NSDictionary *child=DYInsertTool(doc,@"hsl",legacy[@"id"]);run.record(@"schema-one-tail-layer-retains-tail-root-with-new-child",[DYToolRootAnchor(doc,legacy[@"id"])isEqual:@"tail"]&&[DYToolRootAnchor(doc,child[@"id"])isEqual:@"tail"]&&[DYToolDisplayOrder(doc).lastObject isEqual:child[@"id"]]);
|
||||
auto renderInserted=[&](NSDictionary *tools,DYUniforms u,NSString *name){NSError *failure=nil;BOOL ok=[renderer renderSource:source destination:destination uniforms:u paths:@{} spider:nil tools:tools error:&failure];run.need(name,ok,@{@"error":reason(failure)});return read(destination,gpu);};
|
||||
auto upload=[&](DYDiagnosticTile *tile,const Pixels &pixels){[[tile metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:pixels.data() bytesPerRow:width*8];};
|
||||
upload(source,input);DYUniforms base=DYToolUniforms(@{@"type":@"hsl",@"values":@{@"hsl0_0":@28}});base.colorGradingSectionEnabled=1;base.colorGradingHueSatA.x=210;base.colorGradingHueSatA.y=42;base.colorGradingLuma.x=18;
|
||||
Pixels original=renderInserted(empty.document,base,@"insertion-original-fused-oracle");doc=DYMutablePlist(empty.document);DYInsertTool(doc,@"hsl",@"base:hsl");Pixels idle=renderInserted(doc,base,@"insertion-neutral-child-render");run.record(@"untouched-inserted-tool-preserves-original-fused-pixels-exactly",difference(original,idle).maximum==0);
|
||||
NSMutableDictionary *extra=(id)doc[@"layers"][0];extra[@"values"][@"hsl1_2"]=@55;DYUniforms baseHSLOnly=base;baseHSLOnly.colorGradingSectionEnabled=0;Pixels first=render(run,renderer,source,destination,gpu,baseHSLOnly,@{},@"insertion-base-hsl-reference");DYDiagnosticTile *intermediate=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:width height:height]autorelease];upload(intermediate,first);Pixels second=render(run,renderer,intermediate,destination,gpu,DYToolUniforms(extra),@{},@"insertion-extra-hsl-reference");upload(intermediate,second);DYUniforms grading=DYToolUniforms(@{@"type":@"grading"});grading.colorGradingHueSatA.x=210;grading.colorGradingHueSatA.y=42;grading.colorGradingLuma.x=18;Pixels expected=render(run,renderer,intermediate,destination,gpu,grading,@{},@"insertion-later-native-grading-reference");Pixels actual=renderInserted(doc,base,@"anchored-hsl-before-grading-render");run.record(@"anchored-hsl-executes-before-later-native-grading",difference(expected,actual).maximum<.004,measure(difference(expected,actual)));
|
||||
NSMutableDictionary *tail=DYMutablePlist(doc);[tail[@"layers"][0]removeObjectForKey:@"after"];tail[@"schema"]=@1;Pixels oldTail=renderInserted(tail,base,@"historical-tail-hsl-render");run.record(@"anchored-hsl-is-not-only-a-visual-move-from-tail",difference(actual,oldTail).different>20,measure(difference(actual,oldTail)));
|
||||
// Two anchors must follow the legacy native operation order, not insertion time.
|
||||
doc=DYMutablePlist(empty.document);NSMutableDictionary *hsl=(id)DYInsertTool(doc,@"hsl",@"base:hsl");hsl[@"values"][@"hsl0_0"]=@35;NSMutableDictionary *curve=(id)DYInsertTool(doc,@"curve",@"base:curve");curve[@"values"][@"curveY4"]=@32;curve[@"values"][@"curveY5"]=@(-24);curve[@"values"][@"channel0X0"]=@.25;curve[@"values"][@"channel0X1"]=@.75;
|
||||
DYUniforms neutralBase=DYToolUniforms(@{@"type":@"hsl"});first=render(run,renderer,source,destination,gpu,DYToolUniforms(curve),@{},@"anchored-curve-first-reference");run.record(@"curve-anchor-reference-materially-adjusts-red-channel",difference(first,input).different>20&&difference(first,input).maximum>.01,measure(difference(first,input)));upload(intermediate,first);expected=render(run,renderer,intermediate,destination,gpu,DYToolUniforms(hsl),@{},@"anchored-hsl-second-reference");actual=renderInserted(doc,neutralBase,@"two-native-anchor-render");run.record(@"two-anchors-preserve-native-curve-before-hsl-operation-order",difference(expected,actual).maximum<.004,measure(difference(expected,actual)));
|
||||
first=render(run,renderer,source,destination,gpu,DYToolUniforms(hsl),@{},@"wrong-hsl-before-curve-reference");upload(intermediate,first);Pixels wrong=render(run,renderer,intermediate,destination,gpu,DYToolUniforms(curve),@{},@"wrong-curve-after-hsl-reference");run.record(@"anchor-reference-operations-are-noncommuting",difference(expected,wrong).different>20&&difference(expected,wrong).maximum>.005,measure(difference(expected,wrong)));
|
||||
|
||||
// A changed tool with a zero-strength mask forces the anchored scheduler but
|
||||
// contributes no correction. Compare against the untouched fused operation to
|
||||
// catch replayed CST, lost global-white statistics, a displaced spatial source,
|
||||
// lost pre-HSL skin reference, or moving the original Spider before color work.
|
||||
auto boundary=[&](NSString *name,DYUniforms u,NSString *anchor,NSData *mesh,NSDictionary *baseMasks=nil){
|
||||
NSMutableDictionary *control=DYMutablePlist(empty.document),*baselineDocument=DYMutablePlist(empty.document);if(baseMasks){control[@"baseMasks"]=DYMutablePlist(baseMasks);baselineDocument[@"baseMasks"]=DYMutablePlist(baseMasks);}NSMutableDictionary *node=(id)DYInsertTool(control,@"hsl",anchor);node[@"values"][@"hsl0_0"]=@32;NSMutableDictionary *mask=DYMutablePlist(DYNewMask(DYMaskRectangle));DYMaskParameters p=DYMaskAtTime(mask,kCMTimeZero);p.strength=0;mask[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];[node[@"masks"]addObject:mask];NSError *failure=nil;
|
||||
BOOL baselineOK=[renderer renderSource:source destination:destination uniforms:u paths:@{} spider:mesh tools:baselineDocument error:&failure];Pixels before=read(destination,gpu);BOOL insertedOK=[renderer renderSource:source destination:destination uniforms:u paths:@{} spider:mesh tools:control error:&failure];Pixels after=read(destination,gpu);Difference delta=difference(before,after);BOOL alpha=YES;for(NSUInteger i=0;i<width*height;i++)alpha&=before[i*4+3]==after[i*4+3];run.record(name,baselineOK&&insertedOK&&alpha&&delta.nonfinite==0&&delta.maximum<.006,measure(delta));
|
||||
};
|
||||
DYUniforms cstBoundary=defaults;cstBoundary.cm.configured=1;cstBoundary.cm.exposure=-.6;boundary(@"anchored-primary-cst-runs-once-before-native-stages",cstBoundary,@"base:primary",nil);
|
||||
DYUniforms skinBoundary=base;skinBoundary.skinProtection.x=1;skinBoundary.skinProtection.y=85;skinBoundary.skinProtection.z=28;boundary(@"anchored-split-retains-native-pre-hsl-skin-reference",skinBoundary,@"base:hsl",nil);
|
||||
DYUniforms textureBoundary=DYToolUniforms(@{@"type":@"base"});textureBoundary.whites=48;textureBoundary.texture=35;textureBoundary.clarity=25;textureBoundary.dehaze=15;textureBoundary.primariesSectionEnabled=1;textureBoundary.redPrimaryHue=20;textureBoundary.redPrimarySaturation=15;boundary(@"anchored-prefix-preserves-whites-statistics-and-spatial-base-input",textureBoundary,@"base:primaries",nil);
|
||||
DYUniforms oldInputBoundary=textureBoundary;oldInputBoundary.primarySectionEnabled=1;oldInputBoundary.inputSectionEnabled=1;oldInputBoundary.cm.configured=-1;oldInputBoundary.inputProfile=17;oldInputBoundary.preLUTStrength=1;boundary(@"anchored-legacy-input-lut-remains-available-to-spatial-neighbors",oldInputBoundary,@"base:primaries",nil);
|
||||
NSMutableDictionary *lumaMask=DYMutablePlist(DYNewMask(DYMaskLumaKey));DYMaskParameters luma=DYMaskAtTime(lumaMask,kCMTimeZero);luma.inputBlack=.25;luma.inputWhite=.8;lumaMask[@"parameters"]=[NSData dataWithBytes:&luma length:sizeof(luma)];boundary(@"anchored-original-color-mask-keeps-post-cst-source-reference",textureBoundary,@"base:primaries",nil,@{@"base":@[lumaMask]});
|
||||
DYUniforms chromaBoundary=base;chromaBoundary.baseSectionEnabled=1;chromaBoundary.colorSectionEnabled=1;chromaBoundary.saturation=45;chromaBoundary.vibrance=20;boundary(@"anchored-split-preserves-second-base-chroma-stage",chromaBoundary,@"base:hsl",nil);
|
||||
auto boundaryMesh=dy::neutralMesh();for(int i=0;i<dy::meshCount(boundaryMesh);i++){boundaryMesh.x[i]+=.04f;boundaryMesh.y[i]-=.02f;}NSData *meshData=[NSData dataWithBytes:&boundaryMesh length:sizeof(boundaryMesh)];DYUniforms spiderBoundary=base;spiderBoundary.spiderSectionEnabled=1;spiderBoundary.spiderMix=.8;boundary(@"anchored-spider-remains-after-native-color-stages",spiderBoundary,@"base:spider",meshData);
|
||||
DYUniforms bwBoundary=skinBoundary;bwBoundary.blackWhiteSectionEnabled=1;bwBoundary.cm.blackWhiteMix=.45;boundary(@"anchored-bw-suffix-defers-color-mixture-until-after-native-skin",bwBoundary,@"base:blackwhite",nil);bwBoundary.spiderSectionEnabled=1;bwBoundary.spiderMix=.8;boundary(@"anchored-look-suffix-keeps-bw-mixture-before-single-spider",bwBoundary,@"base:look",meshData);
|
||||
Pixels hdr=input;for(NSUInteger i=0;i<width*height;i++){float a=hdr[i*4+3];hdr[i*4]=a*1.35f;hdr[i*4+1]=a*.4f;hdr[i*4+2]=-a*.06f;}upload(source,hdr);boundary(@"zero-strength-extra-mask-preserves-hdr-and-negative-colors",neutralBase,@"base:primary",nil);upload(source,input);
|
||||
NSURL *cubeURL=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"inserted-tool-stack.cube"]];error=nil;BOOL exported=[renderer exportLUT:cubeURL uniforms:neutralBase paths:@{} spider:nil tools:doc error:&error];NSString *text=exported?[NSString stringWithContentsOfURL:cubeURL encoding:NSUTF8StringEncoding error:&error]:nil;std::vector<float>values;for(NSString *line in [text componentsSeparatedByCharactersInSet:NSCharacterSet.newlineCharacterSet]){float r,g,b;if(sscanf(line.UTF8String,"%f %f %f",&r,&g,&b)==3){values.push_back(r);values.push_back(g);values.push_back(b);}}
|
||||
float codes[3]={.5f,.25f,.75f};Pixels solid(input.size());for(NSUInteger i=0;i<width*height;i++){for(int c=0;c<3;c++)solid[i*4+c]=powf((codes[c]+.055f)/1.055f,2.4f);solid[i*4+3]=1;}upload(source,solid);actual=renderInserted(doc,neutralBase,@"inserted-cube-production-sample");BOOL matches=exported&&values.size()==33*33*33*3;for(int c=0;c<3&&matches;c++){float code=values[((24*33+8)*33+16)*3+c],linear=code<=.04045f?code/12.92f:powf((code+.055f)/1.055f,2.4f);matches&=fabs(linear-(float)actual[c])<.004;}run.record(@"cube-export-follows-identical-anchored-tool-order",matches,@{@"error":reason(error)});
|
||||
upload(source,input);DYWriteTools(manager,empty.document,kCMTimeZero);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
- (void)synchronizeTools {
|
||||
id<FxCustomParameterActionAPI_v4>a=[self actionAPI];if(!a)return;[a startAction:self];NSDictionary *document=nil;@try{document=[DYReadTools(_manager,a.currentTime).document copy];}@finally{[a endAction:self];}
|
||||
NSMutableArray *order=[NSMutableArray array];NSMutableDictionary *numbers=[NSMutableDictionary dictionary],*roots=[NSMutableDictionary dictionary];
|
||||
for(NSString *orderedID in DYToolDisplayOrder(document)){NSDictionary *node=DYToolWithID(document,orderedID);if(!node)continue;NSString *ID=node[@"id"],*type=node[@"type"];[order addObject:ID];roots[ID]=DYToolRootAnchor(document,ID)?:@"tail";NSInteger number=MAX(1,[numbers[type]integerValue])+1;numbers[type]=@(number);
|
||||
DYInspector *view=_stackViews[ID];if(!view){DYToolManager *manager=[[[DYToolManager alloc]initWithHost:_manager node:node]autorelease];view=[[[DYInspector alloc]initWithAPIManager:manager renderer:_renderer]autorelease];_stackViews[ID]=view;[_document addSubview:view];}
|
||||
if(view->_cards.count){NSDictionary *section=view->_cards[0][@"section"];[view->_cards[0][@"header"]setTitle:[NSString stringWithFormat:@"%@ %ld",section[@"title"],(long)number]];}
|
||||
[view refresh];[view setNeedsLayout:YES];
|
||||
}
|
||||
for(NSString *ID in [[_stackViews.allKeys copy]autorelease])if(![order containsObject:ID]){[_stackViews[ID]removeFromSuperview];[_stackViews removeObjectForKey:ID];}
|
||||
[_stackOrder release];_stackOrder=[order copy];[_stackRoots release];_stackRoots=[roots copy];[document release];[self setNeedsLayout:YES];
|
||||
}
|
||||
- (void)toolMask:(NSButton*)sender{if(sender.tag<0||sender.tag>=_cards.count)return;[(DYToolMaskPanel*)_cards[sender.tag][@"maskPanel"]addMenu:sender];}
|
||||
- (void)repeatTool:(NSButton*)sender{
|
||||
if(sender.tag<0||sender.tag>=_cards.count)return;id<PROAPIAccessing>host=_embedded?[(DYToolManager*)_manager host]:_manager;id<FxCustomParameterActionAPI_v4>a=[host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];
|
||||
NSString *addedID=nil;@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(host,a.currentTime).document);if([doc[@"layers"]count]>=DYToolLimit){[self showError:@"最多可添加 32 个独立工具层。"];return;}NSString *type=_cards[sender.tag][@"section"][@"key"],*anchor=_embedded?[(DYToolManager*)_manager nodeID]:[@"base:" stringByAppendingString:type];NSDictionary *node=DYInsertTool(doc,type,anchor);if(!node)return;addedID=[node[@"id"]copy];id<FxUndoAPI>undo=[host apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"再加一层初始化工具"];DYWriteTools(host,doc,a.currentTime);[undo endUndoGroup];}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:host userInfo:@{@"scrollToTool":addedID?:@""}];[addedID release];
|
||||
}
|
||||
- (void)removeTool:(id)sender{if(!_embedded)return;id<PROAPIAccessing>host=[(DYToolManager*)_manager host];id<FxCustomParameterActionAPI_v4>a=[host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(host,a.currentTime).document);if(!DYRemoveTool(doc,[(DYToolManager*)_manager nodeID]))return;id<FxUndoAPI>undo=[host apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"删除独立工具层"];DYWriteTools(host,doc,a.currentTime);[undo endUndoGroup];}@finally{[a endAction:self];}dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:host];});}
|
||||
|
||||
- (CGFloat)layoutRepeatedToolsAfter:(NSString*)anchor y:(CGFloat)y width:(CGFloat)w {if(_embedded)return y;for(NSString *ID in _stackOrder)if([_stackRoots[ID]isEqual:anchor]){DYInspector *child=_stackViews[ID];child.frame=NSMakeRect(0,y,w,MAX(60,child->_stackHeight));[child layoutSubtreeIfNeeded];CGFloat height=MAX(60,child->_stackHeight);child.frame=NSMakeRect(0,y,w,height);y+=height;}return y;}
|
||||
|
||||
- (void)resetRepeatedTool{if(!_embedded)return;id<PROAPIAccessing>host=[(DYToolManager*)_manager host];id<FxCustomParameterActionAPI_v4>a=[host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(host,a.currentTime).document);NSMutableDictionary *node=(id)DYToolWithID(doc,[(DYToolManager*)_manager nodeID]);if(!node)return;NSDictionary *fresh=DYNewTool(node[@"type"]);node[@"values"]=fresh[@"values"];node[@"paths"]=@{};[node removeObjectForKey:@"spider"];node[@"spiderLinked"]=@YES;id<FxUndoAPI>undo=[host apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"还原独立工具层"];DYWriteTools(host,doc,a.currentTime);[undo endUndoGroup];}@finally{[a endAction:self];}[self postChanged];}
|
||||
@@ -0,0 +1,64 @@
|
||||
// Host-provided canvas coordinates, normalized to the actual object transform.
|
||||
@interface DYToolOSC : NSObject<FxOnScreenControl_v4>
|
||||
@property(nonatomic,assign) id<PROAPIAccessing> apiManager;
|
||||
@end
|
||||
@implementation DYToolOSC {
|
||||
id<MTLDevice> _device;id<MTLCommandQueue> _queue;CIContext *_context;
|
||||
CGFloat _height,_uiScale;NSInteger _toolbarRows;NSRect _imageRect;NSDictionary *_mask;NSMutableArray *_handles;NSBezierPath *_outline;NSInteger _lastRoute;NSUInteger _drawCount,_hitDiagnostics,_eventDiagnostics;
|
||||
}
|
||||
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager{if((self=[super init])){_apiManager=manager;_handles=[NSMutableArray new];_lastRoute=-1;_uiScale=1;_toolbarRows=9;os_log(OS_LOG_DEFAULT,"dayu_tool_osc_init");}return self;}
|
||||
- (void)dealloc{[_device release];[_queue release];[_context release];[_mask release];[_handles release];[_outline release];[super dealloc];}
|
||||
- (FxDrawingCoordinates)drawingCoordinates{return kFxDrawingCoordinates_CANVAS;}
|
||||
- (DYPlugIn*)pluginAtTime:(CMTime)time{NSString *value=nil;id<FxParameterRetrievalAPI_v6>get=[_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];[get getStringParameterValue:&value fromParameter:DYCanvasSessionParameterID];@synchronized(DYToolCanvasSessions()){return [DYToolCanvasSessions()objectForKey:value];}}
|
||||
- (NSPoint)canvasPoint:(float)x y:(float)y parameters:(DYMaskParameters)p{
|
||||
float ca=cos(p.angle),sa=sin(p.angle),aspect=p.imageAspect;float px=x*p.width*aspect,py=y*p.height;float u=p.centerX+(px*ca-py*sa)/aspect,v=p.centerY+px*sa+py*ca;return NSMakePoint(_imageRect.origin.x+u*_imageRect.size.width,_imageRect.origin.y+v*_imageRect.size.height);
|
||||
}
|
||||
- (void)addHandle:(NSPoint)p part:(NSInteger)part{[_handles addObject:@{@"point":[NSValue valueWithPoint:p],@"part":@(part)}];}
|
||||
- (NSRect)toolbarRectForItem:(NSInteger)item{CGFloat scale=_uiScale,x=MAX(8*scale,_imageRect.origin.x+12*scale),y=MAX(8*scale,_imageRect.origin.y+12*scale);NSInteger rows=MAX(1,_toolbarRows);return NSMakeRect(x+(item/rows)*38*scale,y+(item%rows)*39*scale,32*scale,34*scale);}
|
||||
- (void)drawOSCWithWidth:(NSInteger)width height:(NSInteger)height activePart:(NSInteger)activePart destinationImage:(FxImageTile*)destination atTime:(CMTime)time {@synchronized(self){@autoreleasepool{
|
||||
if(!_device||_device.registryID!=destination.deviceRegistryID){[_device release];_device=nil;NSArray *devices=MTLCopyAllDevices();for(id<MTLDevice>d in devices)if(d.registryID==destination.deviceRegistryID)_device=[d retain];[devices release];[_queue release];_queue=[_device newCommandQueue];[_context release];_context=_device?[[CIContext contextWithMTLDevice:_device options:@{kCIContextWorkingColorSpace:NSNull.null,kCIContextOutputColorSpace:NSNull.null}]retain]:nil;}
|
||||
id<MTLTexture>texture=[destination metalTextureForDevice:_device];if(!texture||!_queue)return;id<MTLCommandBuffer>commands=[_queue commandBuffer];MTLRenderPassDescriptor *pass=[MTLRenderPassDescriptor renderPassDescriptor];pass.colorAttachments[0].texture=texture;pass.colorAttachments[0].loadAction=MTLLoadActionClear;pass.colorAttachments[0].storeAction=MTLStoreActionStore;pass.colorAttachments[0].clearColor=MTLClearColorMake(0,0,0,0);id<MTLRenderCommandEncoder>encoder=[commands renderCommandEncoderWithDescriptor:pass];[encoder endEncoding];
|
||||
_height=destination.imagePixelBounds.top-destination.imagePixelBounds.bottom;CGFloat canvasWidth=destination.imagePixelBounds.right-destination.imagePixelBounds.left;
|
||||
id<FxOnScreenControlAPI_v4>api=[_apiManager apiForProtocol:@protocol(FxOnScreenControlAPI_v4)];double lx=0,ly=0,ux=0,uy=0;[api convertPointFromSpace:kFxDrawingCoordinates_OBJECT fromX:0 fromY:0 toSpace:kFxDrawingCoordinates_CANVAS toX:&lx toY:&ly];[api convertPointFromSpace:kFxDrawingCoordinates_OBJECT fromX:1 fromY:1 toSpace:kFxDrawingCoordinates_CANVAS toX:&ux toY:&uy];_imageRect=NSMakeRect(lx,_height-uy,ux-lx,uy-ly);_uiScale=[api respondsToSelector:@selector(backingScaleFactor)]?MAX(1.,MIN(3.,[api backingScaleFactor])):1.;_toolbarRows=MAX(1,MIN(11,(NSInteger)floor((_height-MAX(8*_uiScale,_imageRect.origin.y+12*_uiScale)-8*_uiScale)/(39*_uiScale))));
|
||||
DYPlugIn *plugin=[self pluginAtTime:time];NSDictionary *mask=[plugin toolCanvasMaskAtTime:time];NSInteger route=(plugin?1:0)+(mask?2:0);if(route!=_lastRoute||_drawCount++<2){_lastRoute=route;os_log(OS_LOG_DEFAULT,"dayu_tool_osc_route plugin=%{public}d mask=%{public}d width=%{public}.2f height=%{public}.2f",plugin!=nil,mask!=nil,_imageRect.size.width,_imageRect.size.height);}[_mask release];_mask=[mask copy];[_handles removeAllObjects];[_outline release];_outline=nil;
|
||||
if(mask&&canvasWidth>0&&_height>0&&canvasWidth<16384&&_height<16384&&_imageRect.size.width>0&&_imageRect.size.height>0){
|
||||
NSBitmapImageRep *bitmap=[[[NSBitmapImageRep alloc]initWithBitmapDataPlanes:NULL pixelsWide:(NSInteger)canvasWidth pixelsHigh:(NSInteger)_height bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:(NSInteger)canvasWidth*4 bitsPerPixel:32]autorelease];memset(bitmap.bitmapData,0,bitmap.bytesPerRow*bitmap.pixelsHigh);[NSGraphicsContext saveGraphicsState];[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap]];NSAffineTransform *flip=[NSAffineTransform transform];[flip translateXBy:0 yBy:_height];[flip scaleXBy:1 yBy:-1];[flip concat];
|
||||
// Match AppKit text/image drawing to the top-down canvas CTM.
|
||||
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithCGContext:NSGraphicsContext.currentContext.CGContext flipped:YES]];
|
||||
DYMaskParameters p;[mask[@"parameters"]getBytes:&p length:sizeof(p)];p.imageAspect=_imageRect.size.width/_imageRect.size.height;_outline=[[NSBezierPath bezierPath]retain];
|
||||
if(p.kind==DYMaskBezier){NSData *data=mask[@"nodes"];auto *nodes=(const DYBezierNode*)data.bytes;NSUInteger count=data.length/sizeof(DYBezierNode);for(NSUInteger i=0;i<count;i++){NSPoint anchor=[self canvasPoint:nodes[i].x y:nodes[i].y parameters:p];if(i==0)[_outline moveToPoint:anchor];else{auto a=nodes[i-1],b=nodes[i];[_outline curveToPoint:anchor controlPoint1:[self canvasPoint:a.outX y:a.outY parameters:p] controlPoint2:[self canvasPoint:b.inX y:b.inY parameters:p]];}[self addHandle:anchor part:1000+i*3];for(int j=0;j<2;j++){NSPoint handle=[self canvasPoint:j?nodes[i].outX:nodes[i].inX y:j?nodes[i].outY:nodes[i].inY parameters:p];if(hypot(handle.x-anchor.x,handle.y-anchor.y)>3){NSBezierPath *line=[NSBezierPath bezierPath];[line moveToPoint:anchor];[line lineToPoint:handle];[[NSColor colorWithWhite:1 alpha:.55]setStroke];[line stroke];[self addHandle:handle part:1000+i*3+j+1];}}}
|
||||
NSArray *hover=mask[@"hover"];if(count&&[mask[@"drawing"]boolValue]&&hover.count==2){NSPoint target=NSMakePoint(_imageRect.origin.x+[hover[0]doubleValue]*_imageRect.size.width,_imageRect.origin.y+[hover[1]doubleValue]*_imageRect.size.height);[_outline curveToPoint:target controlPoint1:[self canvasPoint:nodes[count-1].outX y:nodes[count-1].outY parameters:p] controlPoint2:target];}
|
||||
if(count>=3&&![mask[@"drawing"]boolValue]){auto a=nodes[count-1],b=nodes[0];[_outline curveToPoint:[self canvasPoint:b.x y:b.y parameters:p] controlPoint1:[self canvasPoint:a.outX y:a.outY parameters:p] controlPoint2:[self canvasPoint:b.inX y:b.inY parameters:p]];[_outline closePath];}
|
||||
}else if(p.kind<2){int count=p.kind==DYMaskEllipse?96:4;for(int i=0;i<count;i++){float angle=i*(2.f*M_PI/count),x=p.kind==DYMaskEllipse?.5f*cosf(angle):((float[]){-.5,.5,.5,-.5})[i],y=p.kind==DYMaskEllipse?.5f*sinf(angle):((float[]){-.5,-.5,.5,.5})[i];NSPoint point=[self canvasPoint:x y:y parameters:p];if(i==0)[_outline moveToPoint:point];else[_outline lineToPoint:point];}[_outline closePath];}
|
||||
else if(p.kind==DYMaskLinearGradient){[_outline moveToPoint:[self canvasPoint:0 y:-2 parameters:p]];[_outline lineToPoint:[self canvasPoint:0 y:2 parameters:p]];}
|
||||
if([mask[@"coverage"]boolValue]&&p.kind<3){[[NSColor colorWithCalibratedRed:1 green:.7 blue:.05 alpha:.2]setFill];[_outline fill];}
|
||||
[[NSColor colorWithWhite:0 alpha:.8]setStroke];_outline.lineWidth=3.5*_uiScale;[_outline stroke];[[NSColor colorWithCalibratedRed:1 green:.8 blue:.15 alpha:1]setStroke];_outline.lineWidth=1.5*_uiScale;[_outline stroke];
|
||||
if(p.kind<4&&![mask[@"drawing"]boolValue]){[self addHandle:[self canvasPoint:0 y:0 parameters:p] part:1];if(p.kind!=DYMaskBezier){for(int i=0;i<4;i++)[self addHandle:[self canvasPoint:((float[]){-.5,.5,.5,-.5})[i] y:((float[]){-.5,-.5,.5,.5})[i] parameters:p] part:2+i];}[self addHandle:[self canvasPoint:0 y:-.68 parameters:p] part:6];}
|
||||
for(NSDictionary *handle in _handles){NSPoint point=[handle[@"point"]pointValue];NSRect rect=NSMakeRect(point.x-4*_uiScale,point.y-4*_uiScale,8*_uiScale,8*_uiScale);[[NSColor colorWithWhite:.1 alpha:1]setFill];[[NSBezierPath bezierPathWithOvalInRect:rect]fill];[NSColor.whiteColor setStroke];[[NSBezierPath bezierPathWithOvalInRect:rect]stroke];}
|
||||
NSArray *symbols=@[@"cursorarrow",@"point.topleft.down.to.point.bottomright.curvepath",@"rectangle",@"circle",@"line.diagonal",@"eyedropper",@"circle.lefthalf.filled",@"eye",@"xmark",@"checkmark",@"xmark.circle"];
|
||||
NSInteger buttonCount=[mask[@"drawing"]boolValue]?11:9;
|
||||
for(NSInteger i=0;i<buttonCount;i++){NSRect cell=[self toolbarRectForItem:i];BOOL active=(i==1&&[mask[@"drawing"]boolValue])||(i==0&&![mask[@"drawing"]boolValue]);[[NSColor colorWithCalibratedRed:active?.08:.12 green:active?.34:.12 blue:active?.58:.12 alpha:.94]setFill];[[NSBezierPath bezierPathWithRoundedRect:cell xRadius:5*_uiScale yRadius:5*_uiScale]fill];NSImage *icon=[NSImage imageWithSystemSymbolName:symbols[i] accessibilityDescription:nil];icon=[icon imageWithSymbolConfiguration:[NSImageSymbolConfiguration configurationWithPaletteColors:@[NSColor.whiteColor]]];[icon drawInRect:NSInsetRect(cell,7*_uiScale,7*_uiScale) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1 respectFlipped:YES hints:nil];}
|
||||
if([mask[@"drawing"]boolValue]){NSRect hint=NSMakeRect(MAX(12*_uiScale,_imageRect.origin.x+12*_uiScale),MIN(_height-36*_uiScale,NSMaxY(_imageRect)-36*_uiScale),MIN(460*_uiScale,canvasWidth-24*_uiScale),28*_uiScale);[[NSColor colorWithWhite:.08 alpha:.9]setFill];[[NSBezierPath bezierPathWithRoundedRect:hint xRadius:5*_uiScale yRadius:5*_uiScale]fill];[@"钢笔:点击放点,拖出曲柄;点首节点或 ✓ 闭合" drawInRect:NSInsetRect(hint,7*_uiScale,5*_uiScale) withAttributes:@{NSFontAttributeName:[NSFont systemFontOfSize:12*_uiScale],NSForegroundColorAttributeName:NSColor.whiteColor}];}
|
||||
[NSGraphicsContext restoreGraphicsState];CIImage *overlay=[CIImage imageWithCGImage:bitmap.CGImage options:@{kCIImageColorSpace:NSNull.null}];overlay=[overlay imageByApplyingTransform:CGAffineTransformMakeTranslation(0,texture.height-_height)];[_context render:overlay toMTLTexture:texture commandBuffer:commands bounds:CGRectMake(0,0,texture.width,texture.height) colorSpace:nil];
|
||||
}[commands commit];[commands waitUntilCompleted];
|
||||
}}}
|
||||
- (NSInteger)partAtPoint:(NSPoint)point {
|
||||
if(!_mask)return 0;BOOL drawing=[_mask[@"drawing"]boolValue];for(NSInteger i=0;i<(drawing?11:9);i++)if(NSPointInRect(point,[self toolbarRectForItem:i]))return 10000+i;
|
||||
DYMaskParameters p;[_mask[@"parameters"]getBytes:&p length:sizeof(p)];p.imageAspect=_imageRect.size.width/MAX(1.,_imageRect.size.height);
|
||||
if(drawing){NSData *data=_mask[@"nodes"];if(data.length>=3*sizeof(DYBezierNode)){const DYBezierNode *nodes=(const DYBezierNode*)data.bytes;NSPoint first=[self canvasPoint:nodes[0].x y:nodes[0].y parameters:p];if(hypot(point.x-first.x,point.y-first.y)<=10*_uiScale)return 1000;}return NSPointInRect(point,_imageRect)?1:0;}
|
||||
for(NSDictionary *h in _handles){NSPoint q=[h[@"point"]pointValue];if(hypot(q.x-point.x,q.y-point.y)<=9*_uiScale)return [h[@"part"]integerValue];}
|
||||
if(p.kind==DYMaskBezier||p.kind==DYMaskLinearGradient||[_outline containsPoint:point])return 1;return 0;
|
||||
}
|
||||
- (void)hitTestOSCAtMousePositionX:(double)x mousePositionY:(double)y activePart:(NSInteger*)part atTime:(CMTime)time{@synchronized(self){NSDictionary *fresh=[[self pluginAtTime:time]toolCanvasMaskAtTime:time];[_mask release];_mask=[fresh copy];NSInteger hit=[self partAtPoint:NSMakePoint(x,_height-y)];if(part)*part=hit;if(_hitDiagnostics++<16)os_log(OS_LOG_DEFAULT,"dayu_tool_osc_hit x=%{public}.2f y=%{public}.2f height=%{public}.2f rect=%{public}.2f,%{public}.2f,%{public}.2f,%{public}.2f mask=%{public}d hit=%{public}ld",x,y,_height,_imageRect.origin.x,_imageRect.origin.y,_imageRect.size.width,_imageRect.size.height,_mask!=nil,(long)hit);}}
|
||||
- (BOOL)event:(NSEventType)type x:(double)x y:(double)y part:(NSInteger)part modifiers:(FxModifierKeys)modifiers key:(unichar)key time:(CMTime)time {@synchronized(self){
|
||||
DYPlugIn *plugin=[self pluginAtTime:time];if(_eventDiagnostics++<12)os_log(OS_LOG_DEFAULT,"dayu_tool_osc_event type=%{public}ld part=%{public}ld x=%{public}.2f y=%{public}.2f plugin=%{public}d",(long)type,(long)part,x,y,plugin!=nil);if(!plugin||![plugin toolCanvasVisible]||_imageRect.size.width<=0||_imageRect.size.height<=0)return NO;NSPoint point=NSMakePoint((x-_imageRect.origin.x)/_imageRect.size.width,(_height-y-_imageRect.origin.y)/_imageRect.size.height);[plugin toolCanvasEvent:type point:point part:part modifiers:modifiers key:key time:time];return YES;
|
||||
}}
|
||||
- (void)mouseDownAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{if(update)*update=[self event:NSEventTypeLeftMouseDown x:x y:y part:part modifiers:m key:0 time:t];}
|
||||
- (void)mouseDraggedAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{if(update)*update=[self event:NSEventTypeLeftMouseDragged x:x y:y part:part modifiers:m key:0 time:t];}
|
||||
- (void)mouseUpAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{if(update)*update=[self event:NSEventTypeLeftMouseUp x:x y:y part:part modifiers:m key:0 time:t];}
|
||||
- (void)keyDownAtPositionX:(double)x positionY:(double)y keyPressed:(unsigned short)key modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update didHandle:(BOOL*)handled atTime:(CMTime)t{BOOL result=(key==27||key==13||key==10||key==3||key==8||key==127)&&[self event:NSEventTypeKeyDown x:x y:y part:1 modifiers:m key:key time:t];if(update)*update=result;if(handled)*handled=result;}
|
||||
- (void)mouseMovedAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{NSDictionary *mask=[[self pluginAtTime:t]toolCanvasMaskAtTime:t];BOOL drawing=[mask[@"drawing"]boolValue];NSCursor *cursor=part>=10000?NSCursor.pointingHandCursor:(drawing||part>=1000)?NSCursor.crosshairCursor:part?NSCursor.openHandCursor:NSCursor.arrowCursor;[[_apiManager apiForProtocol:@protocol(FxOnScreenControlAPI_v4)]setCursor:cursor];if(drawing)[self event:NSEventTypeMouseMoved x:x y:y part:part modifiers:m key:0 time:t];if(update)*update=drawing;}
|
||||
- (void)mouseEnteredAtPositionX:(double)x positionY:(double)y modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{if(update)*update=NO;}
|
||||
- (void)mouseExitedAtPositionX:(double)x positionY:(double)y modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{if(update)*update=NO;}
|
||||
- (void)keyUpAtPositionX:(double)x positionY:(double)y keyPressed:(unsigned short)key modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update didHandle:(BOOL*)handled atTime:(CMTime)t{if(update)*update=NO;if(handled)*handled=NO;}
|
||||
@end
|
||||
@@ -0,0 +1,31 @@
|
||||
// Exercises the inspector entry, real native OSC events and persisted path data.
|
||||
{
|
||||
DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,&error);DYToolCanvasProbe *host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero;
|
||||
NSMutableDictionary *doc=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document);NSDictionary *other=DYNewMask(DYMaskEllipse);doc[@"baseMasks"][@"hsl"]=[NSMutableArray arrayWithObject:other];DYWriteTools(base,doc,kCMTimeZero);
|
||||
id<DYToolCanvasHostProbe>plugin=(id)[[NSClassFromString(@"DYPlugIn")alloc]initWithAPIManager:host];[plugin scheduleToolCanvasRegistration];NSData *state=nil;[plugin pluginState:&state atTime:kCMTimeZero quality:(FxQuality)0 error:&error];
|
||||
auto drain=[](){double end=NSProcessInfo.processInfo.systemUptime+.1;while(NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.005]];};drain();
|
||||
id panel=[[[NSClassFromString(@"DYToolMaskPanel")alloc]initWithManager:host nodeID:@"base:hsl"]autorelease];[panel refreshWithDocument:DYReadTools(base,kCMTimeZero).document time:kCMTimeZero];NSMenuItem *item=[[[NSMenuItem alloc]initWithTitle:@"钢笔" action:nil keyEquivalent:@""]autorelease];item.tag=2;[panel performSelector:@selector(addKind:) withObject:item];
|
||||
NSDictionary *author=DYReadTools(base,kCMTimeZero).document,*mask=[author[@"baseMasks"][@"hsl"]lastObject];NSString *maskID=mask[@"id"];NSDictionary *snapshot=[plugin toolCanvasMaskAtTime:kCMTimeZero];
|
||||
run.record(@"inspector-add-pen-enters-empty-drawing-mode",[snapshot[@"drawing"]boolValue]&&[snapshot[@"nodes"]length]==0&&[snapshot[@"id"]isEqual:maskID]);
|
||||
id<FxOnScreenControl_v4>osc=(id)[[NSClassFromString(@"DYToolOSC")alloc]initWithAPIManager:host];DYDiagnosticTile *overlay=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:640 height:400]autorelease];[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];
|
||||
NSInteger part=0;[osc hitTestOSCAtMousePositionX:152 mousePositionY:307 activePart:&part atTime:kCMTimeZero];run.record(@"pen-can-start-anywhere-in-image-outside-default-shape",part==1);
|
||||
int undo=base->_undoStarts;BOOL update=NO;
|
||||
auto click=[&](double x,double y){[osc mouseDownAtPositionX:x positionY:y activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseUpAtPositionX:x positionY:y activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];};
|
||||
click(152,307);snapshot=[plugin toolCanvasMaskAtTime:kCMTimeZero];run.record(@"pen-point-snapshot-updates-before-main-queue-without-author-write",[snapshot[@"nodes"]length]==sizeof(DYBezierNode)&&base->_undoStarts==undo&&[DYReadTools(base,kCMTimeZero).document isEqual:author]);
|
||||
[osc mouseMovedAtPositionX:240 positionY:280 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];snapshot=[plugin toolCanvasMaskAtTime:kCMTimeZero];run.record(@"pen-cursor-previews-next-segment-without-parameter-or-undo-writes",update&&[snapshot[@"hover"]count]==2&&base->_undoStarts==undo&&[DYReadTools(base,kCMTimeZero).document isEqual:author]);
|
||||
[osc mouseDownAtPositionX:488 positionY:307 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseDraggedAtPositionX:509 positionY:290 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseUpAtPositionX:509 positionY:290 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];click(320,118);
|
||||
snapshot=[plugin toolCanvasMaskAtTime:kCMTimeZero];NSData *nodes=snapshot[@"nodes"];const DYBezierNode *v=(const DYBezierNode*)nodes.bytes;BOOL handles=nodes.length==3*sizeof(DYBezierNode)&&fabs(v[1].inX+v[1].outX-2*v[1].x)<1e-5&&fabs(v[1].inY+v[1].outY-2*v[1].y)<1e-5&&fabs(v[1].outX-v[1].x)>.01;run.record(@"pen-drag-creates-mirrored-cubic-handles",handles);
|
||||
[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];[osc hitTestOSCAtMousePositionX:152 mousePositionY:307 activePart:&part atTime:kCMTimeZero];run.record(@"pen-first-anchor-hit-closes-path-after-three-points",part==1000);[osc mouseDownAtPositionX:152 positionY:307 activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];drain();
|
||||
author=DYReadTools(base,kCMTimeZero).document;mask=[author[@"baseMasks"][@"hsl"]lastObject];run.record(@"pen-closed-cubic-path-persists-once-and-keeps-neighbor-mask",[mask[@"nodes"]length]==3*sizeof(DYBezierNode)&&base->_undoStarts==undo+1&&[author[@"baseMasks"][@"hsl"][0]isEqual:other]&&![[plugin toolCanvasMaskAtTime:kCMTimeZero][@"drawing"]boolValue]);
|
||||
NSData *archive=[NSKeyedArchiver archivedDataWithRootObject:DYReadTools(base,kCMTimeZero) requiringSecureCoding:YES error:&error];DYToolDocument *restored=[NSKeyedUnarchiver unarchivedObjectOfClass:DYToolDocument.class fromData:archive error:&error];run.record(@"pen-cubic-nodes-survive-secure-document-roundtrip",[restored.document isEqual:author]);
|
||||
auto redraw=[&](){[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasSelection" object:host userInfo:@{@"node":@"base:hsl",@"mask":maskID,@"document":DYReadTools(base,kCMTimeZero).document,@"draw":@YES}];};
|
||||
redraw();click(180,280);click(420,280);BOOL handled=NO;[osc keyDownAtPositionX:420 positionY:280 keyPressed:127 modifiers:0 forceUpdate:&update didHandle:&handled atTime:kCMTimeZero];run.record(@"pen-delete-removes-last-uncommitted-point",handled&&[[plugin toolCanvasMaskAtTime:kCMTimeZero][@"nodes"]length]==sizeof(DYBezierNode));
|
||||
[osc keyDownAtPositionX:180 positionY:280 keyPressed:27 modifiers:0 forceUpdate:&update didHandle:&handled atTime:kCMTimeZero];drain();run.record(@"pen-escape-cancels-without-overwriting-saved-curve",[DYReadTools(base,kCMTimeZero).document isEqual:author]&&base->_undoStarts==undo+1);
|
||||
redraw();click(180,280);click(450,260);click(330,145);[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasCommand" object:host userInfo:@{@"node":@"base:hsl",@"mask":maskID,@"command":@"finish",@"timeValue":@0,@"timeScale":@1,@"timeEpoch":@0}];drain();NSDictionary *buttonSaved=DYReadTools(base,kCMTimeZero).document;run.record(@"pen-inspector-finish-commits-without-viewer-keyboard-focus",![buttonSaved isEqual:author]&&base->_undoStarts==undo+2&&[[buttonSaved[@"baseMasks"][@"hsl"]lastObject][@"nodes"]length]==3*sizeof(DYBezierNode));
|
||||
redraw();click(160,270);[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasCommand" object:host userInfo:@{@"node":@"base:hsl",@"mask":maskID,@"command":@"cancel",@"timeValue":@0,@"timeScale":@1,@"timeEpoch":@0}];drain();run.record(@"pen-inspector-cancel-preserves-saved-curve-and-undo-count",[DYReadTools(base,kCMTimeZero).document isEqual:buttonSaved]&&base->_undoStarts==undo+2);
|
||||
redraw();click(190,280);click(460,280);click(300,150);[osc keyDownAtPositionX:300 positionY:150 keyPressed:13 modifiers:0 forceUpdate:&update didHandle:&handled atTime:kCMTimeZero];drain();run.record(@"pen-return-closes-and-saves-native-path",handled&&base->_undoStarts==undo+3&&![[plugin toolCanvasMaskAtTime:kCMTimeZero][@"drawing"]boolValue]);
|
||||
// Finish and the next drag can arrive before the main queue gets a turn.
|
||||
redraw();click(170,275);click(445,275);click(300,140);int queuedUndo=base->_undoStarts;[osc keyDownAtPositionX:300 positionY:140 keyPressed:13 modifiers:0 forceUpdate:&update didHandle:&handled atTime:kCMTimeZero];[osc mouseDownAtPositionX:320 positionY:212.5 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseDraggedAtPositionX:348 positionY:196.75 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseUpAtPositionX:348 positionY:196.75 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];drain();NSDictionary *queuedDoc=DYReadTools(base,kCMTimeZero).document;DYMaskParameters moved=DYMaskAtTime([queuedDoc[@"baseMasks"][@"hsl"]lastObject],kCMTimeZero);run.record(@"pen-finish-and-next-gesture-serialize-without-dropping-either",base->_undoStarts==queuedUndo+2&&fabs(moved.centerX-.55)<1e-5&&fabs(moved.centerY-.55)<1e-5);
|
||||
redraw();click(170,275);click(445,275);click(300,140);[osc keyDownAtPositionX:300 positionY:140 keyPressed:13 modifiers:0 forceUpdate:&update didHandle:&handled atTime:CMTimeMake(1,25)];drain();run.record(@"pen-refuses-to-finish-stale-draft-after-playhead-moves",[DYReadTools(base,kCMTimeZero).document isEqual:queuedDoc]&&base->_undoStarts==queuedUndo+2&&![[plugin toolCanvasMaskAtTime:CMTimeMake(1,25)][@"drawing"]boolValue]);
|
||||
[osc release];[plugin release];
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
// Included in DYRenderer; all calls execute under its per-instance recursive lock.
|
||||
- (id<MTLBuffer>)maskBuffer:(NSDictionary*)groups tile:(FxImageTile*)tile device:(id<MTLDevice>)device header:(DYToolMaskHeader*)h {
|
||||
std::vector<DYToolMaskEntry> entries;FxRect image=tile.imagePixelBounds,bounds=tile.tilePixelBounds;
|
||||
float w=image.right-image.left,ht=image.top-image.bottom;BOOL bottom=tile.imageOrigin==kFxImageOrigin_BOTTOM_LEFT;
|
||||
h->offsetX=(bounds.left-image.left)/w;h->scaleX=(bounds.right-bounds.left)/w;
|
||||
h->offsetY=bottom?(image.top-bounds.bottom)/ht:(image.top-bounds.top)/ht;h->scaleY=(bottom?-1:1)*(bounds.top-bounds.bottom)/ht;
|
||||
h->premultiplied=1;
|
||||
for(NSString *type in groups){NSInteger section=[DYToolTypes()indexOfObject:type];if(section==NSNotFound)continue;
|
||||
for(NSDictionary *m in groups[type]){if(![m[@"enabled"]boolValue])continue;DYToolMaskEntry entry{};entry.section=(int)section;entry.combine=[m[@"combine"]intValue];[m[@"parameters"]getBytes:&entry.mask.parameters length:sizeof(DYMaskParameters)];entry.mask.parameters.imageAspect=w/ht;NSData *nodes=m[@"nodes"];entry.mask.path=dyFlattenMask((const DYBezierNode*)nodes.bytes,nodes.length/sizeof(DYBezierNode));entries.push_back(entry);}
|
||||
}h->count=(unsigned)entries.size();if(entries.empty())entries.push_back({});return [[device newBufferWithBytes:entries.data() length:entries.size()*sizeof(DYToolMaskEntry) options:MTLResourceStorageModeShared]autorelease];
|
||||
}
|
||||
- (void)encodeBlend:(id<MTLTexture>)before after:(id<MTLTexture>)after output:(id<MTLTexture>)output masks:(id<MTLBuffer>)masks header:(DYToolMaskHeader)h entry:(NSDictionary*)entry commands:(id<MTLCommandBuffer>)commands {
|
||||
id<MTLComputeCommandEncoder>encoder=[commands computeCommandEncoder];[encoder setComputePipelineState:entry[@"dyToolBlend"]];[encoder setTexture:before atIndex:0];[encoder setTexture:after atIndex:1];[encoder setTexture:output atIndex:2];[encoder setBuffer:masks offset:0 atIndex:0];[encoder setBytes:&h length:sizeof(h) atIndex:1];[encoder dispatchThreads:MTLSizeMake(output.width,output.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[encoder endEncoding];
|
||||
}
|
||||
- (BOOL)copyTile:(FxImageTile*)source to:(FxImageTile*)dest entry:(NSMutableDictionary*)e error:(NSError**)error {
|
||||
id<MTLDevice>device=e[@"device"];id<MTLTexture>a=[source metalTextureForDevice:device],b=[dest metalTextureForDevice:device];
|
||||
NSMutableDictionary *pipelines=e[@"pipelines"];NSString *key=[NSString stringWithFormat:@"copy-%lu",(unsigned long)b.pixelFormat];id<MTLRenderPipelineState>pipeline=pipelines[key];
|
||||
if(!pipeline){MTLRenderPipelineDescriptor *desc=[MTLRenderPipelineDescriptor new];desc.vertexFunction=[e[@"library"]newFunctionWithName:@"dyVertex"];desc.fragmentFunction=[e[@"library"]newFunctionWithName:@"dyToolCopyFragment"];desc.colorAttachments[0].pixelFormat=b.pixelFormat;pipeline=[device newRenderPipelineStateWithDescriptor:desc error:error];[desc.vertexFunction release];[desc.fragmentFunction release];[desc release];if(!pipeline)return NO;pipelines[key]=pipeline;[pipeline release];}
|
||||
FxRect s=source.tilePixelBounds,t=dest.tilePixelBounds;float width=s.right-s.left,height=s.top-s.bottom,l=(t.left-s.left)/width,r=(t.right-s.left)/width,top=(s.top-t.top)/height,bottom=(s.top-t.bottom)/height;
|
||||
if(source.imageOrigin==kFxImageOrigin_BOTTOM_LEFT){top=1-top;bottom=1-bottom;}
|
||||
float w=b.width,h=b.height;DYVertex2D v[]={{{w/2,-h/2},{r,bottom}},{{-w/2,-h/2},{l,bottom}},{{w/2,h/2},{r,top}},{{-w/2,h/2},{l,top}}};if(dest.imageOrigin==kFxImageOrigin_BOTTOM_LEFT)for(auto &vertex:v)vertex.position.y=-vertex.position.y;
|
||||
vector_uint2 size={(unsigned)b.width,(unsigned)b.height};id<MTLCommandBuffer>cb=[e[@"queue"]commandBuffer];MTLRenderPassDescriptor *pass=[MTLRenderPassDescriptor renderPassDescriptor];pass.colorAttachments[0].texture=b;pass.colorAttachments[0].loadAction=MTLLoadActionDontCare;pass.colorAttachments[0].storeAction=MTLStoreActionStore;id<MTLRenderCommandEncoder>encoder=[cb renderCommandEncoderWithDescriptor:pass];[encoder setRenderPipelineState:pipeline];[encoder setVertexBytes:v length:sizeof(v) atIndex:0];[encoder setVertexBytes:&size length:sizeof(size) atIndex:1];[encoder setFragmentTexture:a atIndex:0];[encoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4];[encoder endEncoding];[cb commit];[cb waitUntilCompleted];return cb.status==MTLCommandBufferStatusCompleted?YES:fail(error,cb.error.localizedDescription);
|
||||
}
|
||||
// Extra skin keeps the source reference used by the prior release. All other
|
||||
// extra tools reuse the same isolated native tool path and their own mask group.
|
||||
- (BOOL)renderExtraTool:(NSDictionary*)node source:(FxImageTile*)source original:(FxImageTile*)original destination:(FxImageTile*)destination entry:(NSMutableDictionary*)entry error:(NSError**)error {
|
||||
// Prove a constant-zero aggregate conservatively. In particular a first
|
||||
// subtract mask of strength zero is full coverage, not an empty selection.
|
||||
// Skipping only this isolated operation preserves HDR/negative pixels that
|
||||
// the legacy grading entry would otherwise clip even at zero stage coverage.
|
||||
BOOL found=NO;float low=1,high=1;for(NSDictionary *mask in node[@"masks"]){if(![mask[@"enabled"]boolValue])continue;DYMaskParameters p=DYMaskAtTime(mask,kCMTimeInvalid);float a=0,b=p.strength==0?0:1;NSInteger combine=[mask[@"combine"]integerValue];if(!found){low=combine==1?1-b:a;high=combine==1?1-a:b;found=YES;}else if(combine==1){low*=1-b;high*=1-a;}else if(combine==2){low*=a;high*=b;}else{low=1-(1-low)*(1-a);high=1-(1-high)*(1-b);}}
|
||||
if(found&&high==0)return [self copyTile:source to:destination entry:entry error:error];
|
||||
DYUniforms layer=DYToolUniforms(node);NSString *type=node[@"type"];
|
||||
if([type isEqual:@"mixer"]||[type isEqual:@"film"]){layer.filmFrameKey=[node[@"filmFrameKey"]unsignedIntValue];return [self renderFilmTool:type source:source destination:destination uniforms:layer masks:node[@"masks"] entry:entry error:error];}
|
||||
if(![type isEqual:@"skin"])return [self renderLegacy:source destination:destination uniforms:layer paths:node[@"paths"] spider:node[@"spider"] masks:@{type:node[@"masks"]} error:error];
|
||||
id<MTLDevice>d=entry[@"device"];id<MTLTexture>before=[source metalTextureForDevice:d],input=[original metalTextureForDevice:d],after=[destination metalTextureForDevice:d];
|
||||
id<MTLCommandBuffer>cb=[entry[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>ce=[cb computeCommandEncoder];[ce setComputePipelineState:entry[@"dyToolSkin"]];[ce setTexture:before atIndex:0];[ce setTexture:input atIndex:1];[ce setTexture:after atIndex:2];[ce setBytes:&layer length:sizeof(layer) atIndex:0];[ce dispatchThreads:MTLSizeMake(after.width,after.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];[cb commit];[cb waitUntilCompleted];if(cb.status!=MTLCommandBufferStatusCompleted)return fail(error,cb.error.localizedDescription);
|
||||
if(![node[@"masks"]count])return YES;
|
||||
MTLTextureDescriptor *desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:after.width height:after.height mipmapped:NO];desc.storageMode=MTLStorageModePrivate;desc.usage=MTLTextureUsageRenderTarget|MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite;id<MTLTexture>blend=[d newTextureWithDescriptor:desc];if(!blend)return fail(error,@"无法分配新增工具蒙版缓冲区");
|
||||
DYToolMaskHeader h{};h.section=3;id<MTLBuffer>buffer=[self maskBuffer:@{type:node[@"masks"]} tile:source device:d header:&h];cb=[entry[@"queue"]commandBuffer];[self encodeBlend:before after:after output:blend masks:buffer header:h entry:entry commands:cb];[cb commit];[cb waitUntilCompleted];BOOL ok=cb.status==MTLCommandBufferStatusCompleted;
|
||||
DYExportTile *blended=[[DYExportTile alloc]initWithTexture:blend registry:d.registryID];[blended setBounds:source.tilePixelBounds origin:source.imageOrigin];[blended setPixelAspect:source.pixelAspect];[blend release];if(ok)ok=[self copyTile:blended to:destination entry:entry error:error];else fail(error,cb.error.localizedDescription);[blended release];return ok;
|
||||
}
|
||||
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){@autoreleasepool{
|
||||
if(!tools)tools=@{@"schema":@1,@"layers":@[],@"baseMasks":@{}};if(!DYValidToolDocument(tools))return fail(error,@"工具或蒙版数据损坏,未更改原工程");
|
||||
NSArray *layers=tools[@"layers"];BOOL active=NO,anchored=NO;for(NSDictionary *node in layers)if(!DYToolIsNeutral(node)){active=YES;anchored|=![DYToolRootAnchor(tools,node[@"id"])isEqual:@"tail"];}
|
||||
// No active extra tool keeps the exact historical fused path, including HDR.
|
||||
if(!active&&!DYChannelMixerActive(u)&&!DYFilmActive(u.film))return [self renderLegacy:src destination:dst uniforms:u paths:paths spider:spider masks:tools[@"baseMasks"] error:error];
|
||||
NSMutableDictionary *entry=[self device:dst.deviceRegistryID error:error];if(!entry)return NO;id<MTLDevice>d=entry[@"device"];id<MTLTexture>input=[src metalTextureForDevice:d];if(!input)return fail(error,@"宿主图像纹理不可用");
|
||||
MTLTextureDescriptor *desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:input.width height:input.height mipmapped:NO];desc.storageMode=MTLStorageModePrivate;desc.usage=MTLTextureUsageRenderTarget|MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite;
|
||||
DYExportTile *tile=nil,*skinReference=nil,*originalReference=nil;NSArray *order=DYToolDisplayOrder(tools);NSMutableDictionary *groups=[NSMutableDictionary dictionary];for(NSString *ID in order){NSDictionary *node=DYToolWithID(tools,ID);if(!node||DYToolIsNeutral(node))continue;NSString *root=DYToolRootAnchor(tools,ID);if(!groups[root])groups[root]=[NSMutableArray array];[groups[root]addObject:node];}
|
||||
auto makeTile=[&](){id<MTLTexture>texture=[d newTextureWithDescriptor:desc];if(!texture)return (DYExportTile*)nil;DYExportTile *result=[[DYExportTile alloc]initWithTexture:texture registry:d.registryID];[result setBounds:src.tilePixelBounds origin:src.imageOrigin];[result setPixelAspect:src.pixelAspect];[texture release];return result;};
|
||||
auto replace=[&](DYExportTile *next){[tile release];tile=next;};
|
||||
auto apply=[&](NSString *anchor){for(NSDictionary *node in groups[anchor]){@autoreleasepool{DYExportTile *next=makeTile();if(!next)return fail(error,@"无法分配新增工具缓冲区");BOOL ok=[self renderExtraTool:node source:tile original:src destination:next entry:entry error:error];if(!ok){[next release];return NO;}replace(next);}}return YES;};
|
||||
@try{
|
||||
if(!anchored){DYExportTile *next=makeTile();if(!next)return fail(error,@"无法分配工具图层缓冲区");BOOL ok=[self renderLegacy:src destination:next uniforms:u paths:paths spider:spider masks:tools[@"baseMasks"] error:error];if(!ok){[next release];return NO;}replace(next);}
|
||||
else {
|
||||
// Preserve the actual native stage order, which predates the visual cards.
|
||||
// Basic adjustment spans stages 2/8, so its insertion point is after stage 8.
|
||||
// CST precedes stage 0; Spider stays after all twelve fused color stages.
|
||||
NSArray *anchors=@[@"base:primary",@"base:primaries",@"",@"base:curve",@"base:levels",@"base:balance",@"base:hsl",@"base:grading",@"base:base",@"base:blackwhite",@"base:look",@"base:skin"];
|
||||
float bwMix=fmaxf(0,fminf(1,u.cm.blackWhiteMix));BOOL splitBW=u.blackWhiteSectionEnabled>.5&&bwMix>0&&bwMix<1&&([groups[@"base:blackwhite"]count]||[groups[@"base:look"]count]);
|
||||
NSInteger first=0;
|
||||
for(NSInteger last=0;last<(splitBW?9:12);last++)if(last==5||last==(splitBW?8:11)||[groups[anchors[last]]count]){@autoreleasepool{
|
||||
DYExportTile *next=makeTile();if(!next)return fail(error,@"无法分配原生工具分段缓冲区");DYUniforms segment=u;
|
||||
BOOL ok=[self renderLegacy:tile?:src destination:next uniforms:segment paths:paths spider:nil masks:tools[@"baseMasks"] stageFirst:first stageLast:last skinReference:skinReference originalReference:originalReference captureOriginal:first==0?&originalReference:nullptr suppressBlackWhite:NO error:error];if(!ok){[next release];return NO;}replace(next);
|
||||
if(!apply(anchors[last]))return NO;
|
||||
// Skin protects the native pre-HSL result, including tools inserted before it.
|
||||
if(last==5){[skinReference release];skinReference=[tile retain];}first=last+1;
|
||||
}}
|
||||
if(splitBW){
|
||||
// Native partial B&W mixes two complete color branches after native skin,
|
||||
// before Spider. Keep that fork if a B&W/Look insertion splits stages 9-11.
|
||||
// Only the suffix is duplicated; CST, statistics and the prefix stay shared.
|
||||
DYExportTile *prefix=[tile retain],*bwTile=nil;
|
||||
@try{
|
||||
for(int branch=0;branch<2;branch++){
|
||||
if(branch==1)replace([prefix retain]);DYUniforms branchUniforms=u;branchUniforms.cm.blackWhiteMix=1;NSInteger begin=9;
|
||||
for(NSInteger end=9;end<12;end++)if(end==11||[groups[anchors[end]]count]){@autoreleasepool{
|
||||
DYExportTile *next=makeTile();if(!next)return fail(error,@"无法分配黑白混合分支缓冲区");BOOL ok=[self renderLegacy:tile destination:next uniforms:branchUniforms paths:paths spider:nil masks:tools[@"baseMasks"] stageFirst:begin stageLast:end skinReference:skinReference originalReference:originalReference captureOriginal:nullptr suppressBlackWhite:branch==1 error:error];if(!ok){[next release];return NO;}replace(next);if(end<11&&!apply(anchors[end]))return NO;begin=end+1;
|
||||
}}
|
||||
if(branch==0)bwTile=[tile retain];
|
||||
}
|
||||
DYExportTile *mixed=makeTile();if(!mixed)return fail(error,@"无法分配黑白混合缓冲区");DYToolMaskEntry constant{};constant.section=0;constant.combine=0;constant.mask.parameters=dyDefaultMaskParameters();constant.mask.parameters.kind=DYMaskRectangle;constant.mask.parameters.width=constant.mask.parameters.height=4000;constant.mask.parameters.feather=0;constant.mask.parameters.outputBlack=constant.mask.parameters.outputWhite=1;constant.mask.parameters.strength=bwMix;
|
||||
id<MTLBuffer>weight=[[d newBufferWithBytes:&constant length:sizeof(constant) options:MTLResourceStorageModeShared]autorelease];if(!weight){[mixed release];return fail(error,@"无法分配黑白混合权重");}DYToolMaskHeader h{};h.count=1;h.section=0;h.premultiplied=1;h.scaleX=h.scaleY=1;id<MTLCommandBuffer>commands=[entry[@"queue"]commandBuffer];[self encodeBlend:[tile metalTextureForDevice:d] after:[bwTile metalTextureForDevice:d] output:[mixed metalTextureForDevice:d] masks:weight header:h entry:entry commands:commands];[commands commit];[commands waitUntilCompleted];if(commands.status!=MTLCommandBufferStatusCompleted){[mixed release];return fail(error,commands.error.localizedDescription);}replace(mixed);
|
||||
}@finally{[prefix release];[bwTile release];}
|
||||
// An extra skin tool follows the original skin and B&W mixture once.
|
||||
if(!apply(@"base:skin"))return NO;
|
||||
}
|
||||
if(u.spiderSectionEnabled>.5&&u.spiderMix>0&&spider.length){DYUniforms sp=DYToolUniforms(@{@"type":@"spider"});sp.spiderSectionEnabled=u.spiderSectionEnabled;sp.spiderMix=u.spiderMix;DYExportTile *next=makeTile();if(!next)return fail(error,@"无法分配蜘蛛盘缓冲区");BOOL ok=[self renderLegacy:tile destination:next uniforms:sp paths:@{} spider:spider masks:@{@"spider":tools[@"baseMasks"][@"spider"]?:@[]} error:error];if(!ok){[next release];return NO;}replace(next);}
|
||||
if(!apply(@"base:spider"))return NO;
|
||||
}
|
||||
// New end-of-chain base tools do not move any historical color stages.
|
||||
for(NSString *type in @[@"mixer",@"film"]){BOOL enabled=[type isEqual:@"mixer"]?DYChannelMixerActive(u):DYFilmActive(u.film);if(enabled){DYExportTile *next=makeTile();if(!next)return fail(error,@"无法分配胶片工具缓冲区");BOOL ok=[self renderFilmTool:type source:tile destination:next uniforms:u masks:tools[@"baseMasks"][type]?:@[] entry:entry error:error];if(!ok){[next release];return NO;}replace(next);}if(!apply([@"base:" stringByAppendingString:type]))return NO;}
|
||||
// Schema 1 extra layers (and children inserted after those layers) retain
|
||||
// their old end-of-chain order. Saving does not silently migrate old looks.
|
||||
if(!apply(@"tail"))return NO;return [self copyTile:tile to:dst entry:entry error:error];
|
||||
}@finally{[originalReference release];[skinReference release];[tile release];}
|
||||
}}}
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){
|
||||
if(DYFilmActive(u.film)&&DYFilmSpatialActive(u.film))return fail(error,@"当前胶片含晕光、辉光、颗粒或暗角,无法完整保存到静态 Cube。请保存完整预设,或关闭这些处理后再导出。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"film"]&&DYFilmActive(layer.film)&&DYFilmSpatialActive(layer.film))return fail(error,@"新增胶片层含空间或时间处理,无法完整保存到静态 Cube。请保存完整预设。");}
|
||||
for(NSArray *masks in [tools[@"baseMasks"]allValues])if(masks.count)return fail(error,@"当前调色含空间蒙版或跟踪,Cube 无法保存这些信息。请先保存完整预设,或移除蒙版后导出。");for(NSDictionary *node in tools[@"layers"])if([node[@"masks"]count])return fail(error,@"新增工具含蒙版,无法完整导出为 Cube。请保存完整预设。");
|
||||
_toolDocument=tools;BOOL ok=NO;@try{ok=[self exportLUT:url uniforms:u paths:paths spider:spider error:error];}@finally{_toolDocument=nil;}return ok;
|
||||
}}
|
||||
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
#import "DYModel.h"
|
||||
#include "MaskCore/DYMaskOperator.h"
|
||||
|
||||
enum { DYToolsParameterID=9002, DYCanvasSessionParameterID=9003, DYToolLimit=32, DYToolMaskLimit=16, DYToolKeyLimit=16384 };
|
||||
// Immutable property-list author state. Host float IDs and the legacy ABI stay fixed.
|
||||
@interface DYToolDocument : NSObject<NSSecureCoding,NSCopying,FxCustomParameterInterpolation_v2>
|
||||
@property(nonatomic,copy) NSDictionary *document;
|
||||
@end
|
||||
NSArray *DYToolTypes(void);
|
||||
NSDictionary *DYToolSection(NSString *type);
|
||||
NSDictionary *DYNewTool(NSString *type);
|
||||
// New documents splice a UUID after the clicked base/extra tool. Schema 1
|
||||
// layers without an anchor retain their historical end-of-chain semantics.
|
||||
NSDictionary *DYInsertTool(NSMutableDictionary *document,NSString *type,NSString *afterID);
|
||||
BOOL DYRemoveTool(NSMutableDictionary *document,NSString *nodeID);
|
||||
NSArray *DYToolDisplayOrder(NSDictionary *document);
|
||||
NSString *DYToolRootAnchor(NSDictionary *document,NSString *nodeID);
|
||||
NSDictionary *DYNewMask(NSInteger kind);
|
||||
BOOL DYValidToolDocument(NSDictionary *document);
|
||||
BOOL DYValidToolMask(NSDictionary *mask);
|
||||
NSMutableDictionary *DYMutablePlist(NSDictionary *value);
|
||||
DYToolDocument *DYReadTools(id<PROAPIAccessing> manager,CMTime time);
|
||||
BOOL DYWriteTools(id<PROAPIAccessing> manager,NSDictionary *document,CMTime time);
|
||||
NSArray *DYMasksForTool(NSDictionary *document,NSString *nodeID);
|
||||
NSDictionary *DYToolWithID(NSDictionary *document,NSString *nodeID);
|
||||
BOOL DYSetToolMasks(NSMutableDictionary *document,NSString *nodeID,NSArray *masks);
|
||||
DYMaskParameters DYMaskAtTime(NSDictionary *mask,CMTime time);
|
||||
NSDictionary *DYMaskKey(CMTime time,DYMaskParameters parameters,BOOL manual,float confidence);
|
||||
BOOL DYMergeTracking(NSMutableDictionary *mask,NSArray *samples);
|
||||
NSDictionary *DYToolRenderSnapshot(NSDictionary *document,CMTime time);
|
||||
DYUniforms DYToolUniforms(NSDictionary *node);
|
||||
BOOL DYToolIsNeutral(NSDictionary *node);
|
||||
// Routes an existing native panel to a UUID, batching edits into one host write.
|
||||
@interface DYToolManager : NSObject<PROAPIAccessing>
|
||||
@property(nonatomic,readonly) id<PROAPIAccessing> host;
|
||||
@property(nonatomic,readonly) NSString *nodeID,*type;
|
||||
- (instancetype)initWithHost:(id<PROAPIAccessing>)host node:(NSDictionary *)node;
|
||||
@end
|
||||
@@ -0,0 +1,92 @@
|
||||
#import "DYToolState.h"
|
||||
#include "DYSpiderState.h"
|
||||
#include "DYFilmMath.h"
|
||||
#include <set>
|
||||
#import <objc/runtime.h>
|
||||
|
||||
NSArray *DYToolTypes(void){return @[@"primary",@"spider",@"base",@"skin",@"look",@"hsl",@"curve",@"grading",@"primaries",@"levels",@"blackwhite",@"balance",@"mixer",@"film"];}
|
||||
NSDictionary *DYToolSection(NSString *type){for(NSDictionary *s in DYSections())if([s[@"key"]isEqual:type])return s;return nil;}
|
||||
NSMutableDictionary *DYMutablePlist(NSDictionary *value){if(!value)return [NSMutableDictionary dictionary];NSData *data=[NSPropertyListSerialization dataWithPropertyList:value format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil];return [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListMutableContainersAndLeaves format:NULL error:nil];}
|
||||
static NSDictionary *DYEmptyTools(){return @{@"schema":@1,@"layers":@[],@"baseMasks":@{}};}
|
||||
static BOOL finiteNumber(id v){return [v isKindOfClass:NSNumber.class]&&std::isfinite([v doubleValue]);}
|
||||
static BOOL validID(id v){return [v isKindOfClass:NSString.class]&&[[[NSUUID alloc]initWithUUIDString:v]autorelease]!=nil;}
|
||||
static NSData *parameterData(DYMaskParameters p){return [NSData dataWithBytes:&p length:sizeof(p)];}
|
||||
static BOOL readParameters(id data,DYMaskParameters *p){if(![data isKindOfClass:NSData.class]||[data length]!=sizeof(*p))return NO;[data getBytes:p length:sizeof(*p)];return dyValidMaskParameters(*p);}
|
||||
static CMTime keyTime(NSDictionary *key){return CMTimeMakeWithEpoch([key[@"value"]longLongValue],[key[@"scale"]intValue],[key[@"epoch"]longLongValue]);}
|
||||
NSDictionary *DYNewMask(NSInteger kind){if(kind<0||kind>5)return nil;DYMaskParameters p=dyDefaultMaskParameters();p.kind=(DYMaskKind)kind;p.width=.5;p.height=.5;p.sourceStage=DYMaskSourceOriginal;if(kind==DYMaskHSLKey)p.flags=DYMaskHueEnabled;NSData *nodes=[NSData data];if(kind==DYMaskBezier){DYBezierNode n[4]={};float x[4]={-.5,.5,.5,-.5},y[4]={-.5,-.5,.5,.5};for(int i=0;i<4;i++)n[i]={x[i],y[i],x[i],y[i],x[i],y[i]};nodes=[NSData dataWithBytes:n length:sizeof(n)];}return @{@"id":NSUUID.UUID.UUIDString,@"enabled":@YES,@"combine":@0,@"parameters":parameterData(p),@"nodes":nodes,@"keys":@[]};}
|
||||
NSDictionary *DYNewTool(NSString *type){if(![DYToolTypes()containsObject:type])return nil;return @{@"id":NSUUID.UUID.UUIDString,@"type":type,@"values":[type isEqual:@"skin"]?@{@"skinStrength":@0}:@{},@"paths":@{},@"spiderLinked":@YES,@"masks":@[]};}
|
||||
BOOL DYValidToolMask(NSDictionary *mask){
|
||||
if(![mask isKindOfClass:NSDictionary.class]||!validID(mask[@"id"])||!finiteNumber(mask[@"enabled"])||!finiteNumber(mask[@"combine"])||[mask[@"combine"]integerValue]<0||[mask[@"combine"]integerValue]>2)return NO;
|
||||
DYMaskParameters p;if(!readParameters(mask[@"parameters"],&p))return NO;NSData *nodes=mask[@"nodes"];if(![nodes isKindOfClass:NSData.class]||nodes.length%sizeof(DYBezierNode)||nodes.length>32*sizeof(DYBezierNode))return NO;
|
||||
const float *n=(const float*)nodes.bytes;for(NSUInteger i=0;i<nodes.length/4;i++)if(!std::isfinite(n[i])||fabs(n[i])>1000)return NO;
|
||||
NSArray *keys=mask[@"keys"];if(![keys isKindOfClass:NSArray.class]||keys.count>DYToolKeyLimit)return NO;CMTime last=kCMTimeInvalid;
|
||||
for(NSDictionary *k in keys){if(![k isKindOfClass:NSDictionary.class]||!finiteNumber(k[@"value"])||!finiteNumber(k[@"scale"])||!finiteNumber(k[@"epoch"])||!finiteNumber(k[@"manual"])||!finiteNumber(k[@"confidence"])||[k[@"confidence"]doubleValue]<0||[k[@"confidence"]doubleValue]>1)return NO;CMTime t=keyTime(k);DYMaskParameters q;if(!CMTIME_IS_NUMERIC(t)||!readParameters(k[@"parameters"],&q)||q.kind!=p.kind||(CMTIME_IS_NUMERIC(last)&&(last.epoch!=t.epoch||CMTimeCompare(last,t)>=0)))return NO;last=t;}return YES;
|
||||
}
|
||||
static BOOL validMasks(id masks,NSMutableSet *ids){if(![masks isKindOfClass:NSArray.class]||[masks count]>DYToolMaskLimit)return NO;for(NSDictionary *m in masks){if(!DYValidToolMask(m)||[ids containsObject:m[@"id"]])return NO;[ids addObject:m[@"id"]];}return YES;}
|
||||
BOOL DYValidToolDocument(NSDictionary *doc){
|
||||
if(![NSPropertyListSerialization propertyList:doc isValidForFormat:NSPropertyListBinaryFormat_v1_0])return NO;
|
||||
if(![doc isKindOfClass:NSDictionary.class]||(![doc[@"schema"]isEqual:@1]&&![doc[@"schema"]isEqual:@2])||![doc[@"layers"]isKindOfClass:NSArray.class]||[doc[@"layers"]count]>DYToolLimit||![doc[@"baseMasks"]isKindOfClass:NSDictionary.class]||[doc[@"baseMasks"]count]>DYToolTypes().count)return NO;
|
||||
NSMutableSet *ids=[NSMutableSet set];for(NSString *key in doc[@"baseMasks"]){if(![DYToolTypes()containsObject:key]||!validMasks(doc[@"baseMasks"][key],ids))return NO;}
|
||||
NSMutableDictionary *descriptors=[NSMutableDictionary dictionary];for(NSDictionary *d in DYDescriptors())descriptors[d[@"key"]]=d;
|
||||
for(NSDictionary *node in doc[@"layers"]){if(![node isKindOfClass:NSDictionary.class]||!validID(node[@"id"])||[ids containsObject:node[@"id"]]||![DYToolTypes()containsObject:node[@"type"]]||![node[@"values"]isKindOfClass:NSDictionary.class]||[node[@"values"]count]>descriptors.count||![node[@"paths"]isKindOfClass:NSDictionary.class]||[node[@"paths"]count]>6||!validMasks(node[@"masks"],ids))return NO;[ids addObject:node[@"id"]];
|
||||
for(NSString *key in node[@"values"]){NSDictionary *d=descriptors[key];id v=node[@"values"][key];if(!d||!finiteNumber(v)||[v doubleValue]<[d[@"min"]doubleValue]||[v doubleValue]>[d[@"max"]doubleValue]||(d[@"values"]&&![d[@"values"]containsObject:@((int)llround([v doubleValue]))]))return NO;}
|
||||
for(id key in node[@"paths"]){id p=node[@"paths"][key];if(![@[@"input",@"look0",@"look1",@"look2",@"look3",@"look4"]containsObject:key]||![p isKindOfClass:NSString.class]||[p length]>8192||![p isAbsolutePath]||![[p pathExtension].lowercaseString isEqual:@"cube"])return NO;}if(node[@"spider"]&&(![node[@"spider"]isKindOfClass:NSData.class]||!DYSpiderMeshIsValid(node[@"spider"])))return NO;
|
||||
}
|
||||
// Anchors are stable identities, never an array index or a translated title.
|
||||
// Reject unknown anchors/cycles so layout, rendering and undo share one order.
|
||||
for(NSDictionary *node in doc[@"layers"]){id after=node[@"after"];if(!after)continue;if(![doc[@"schema"]isEqual:@2]||![after isKindOfClass:NSString.class])return NO;NSMutableSet *seen=[NSMutableSet setWithObject:node[@"id"]];while(after){if([after hasPrefix:@"base:"]){if(![DYToolTypes()containsObject:[after substringFromIndex:5]])return NO;break;}if([seen containsObject:after])return NO;[seen addObject:after];NSDictionary *parent=DYToolWithID(doc,after);if(!parent)return NO;after=parent[@"after"];}}
|
||||
NSUInteger totalKeys=0;for(NSArray *masks in [doc[@"baseMasks"]allValues])for(NSDictionary *mask in masks)totalKeys+=[mask[@"keys"]count];for(NSDictionary *node in doc[@"layers"])for(NSDictionary *mask in node[@"masks"])totalKeys+=[mask[@"keys"]count];if(totalKeys>65536)return NO;NSData *bounded=[NSPropertyListSerialization dataWithPropertyList:doc format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil];return bounded&&bounded.length<=24*1024*1024;
|
||||
}
|
||||
@implementation DYToolDocument
|
||||
+ (BOOL)supportsSecureCoding{return YES;}
|
||||
- (instancetype)init{if((self=[super init]))_document=[DYEmptyTools()copy];return self;}
|
||||
- (void)dealloc{[_document release];[super dealloc];}
|
||||
- (void)setDocument:(NSDictionary *)d{if(!DYValidToolDocument(d))return;NSData *b=[NSPropertyListSerialization dataWithPropertyList:d format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil];NSDictionary *immutable=[NSPropertyListSerialization propertyListWithData:b options:NSPropertyListImmutable format:NULL error:nil];[_document release];_document=[immutable retain];}
|
||||
- (void)encodeWithCoder:(NSCoder*)c{[c encodeObject:_document forKey:@"document"];}
|
||||
- (instancetype)initWithCoder:(NSCoder*)c{if((self=[self init])){NSDictionary *d=[c decodeObjectOfClasses:[NSSet setWithObjects:NSDictionary.class,NSArray.class,NSString.class,NSNumber.class,NSData.class,nil] forKey:@"document"];if(!DYValidToolDocument(d)){[self release];return nil;}self.document=d;}return self;}
|
||||
- (id)copyWithZone:(NSZone*)zone{DYToolDocument *v=[[[self class]allocWithZone:zone]init];v.document=_document;return v;}
|
||||
- (BOOL)isEqual:(id)o{return [o isKindOfClass:DYToolDocument.class]&&[_document isEqual:[o document]];}
|
||||
- (NSUInteger)hash{return _document.hash;}
|
||||
- (id)interpolateBetween:(id)other withWeight:(float)weight{return [[self copy]autorelease];}
|
||||
@end
|
||||
DYToolDocument *DYReadTools(id<PROAPIAccessing>m,CMTime t){DYToolDocument *d=nil;[[(id)m apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getCustomParameterValue:&d fromParameter:DYToolsParameterID atTime:t];return [d isKindOfClass:DYToolDocument.class]?d:[[[DYToolDocument alloc]init]autorelease];}
|
||||
BOOL DYWriteTools(id<PROAPIAccessing>m,NSDictionary *d,CMTime t){if(!DYValidToolDocument(d))return NO;DYToolDocument *v=[[[DYToolDocument alloc]init]autorelease];v.document=d;return [[m apiForProtocol:@protocol(FxParameterSettingAPI_v6)]setCustomParameterValue:v toParameter:DYToolsParameterID atTime:t];}
|
||||
NSDictionary *DYToolWithID(NSDictionary *doc,NSString *ID){for(NSDictionary *n in doc[@"layers"])if([n[@"id"]isEqual:ID])return n;return nil;}
|
||||
static void DYAppendToolChildren(NSDictionary *doc,NSString *parent,NSMutableArray *order,NSMutableSet *seen){for(NSDictionary *node in doc[@"layers"])if([node[@"after"]isEqual:parent]&&![seen containsObject:node[@"id"]]){[seen addObject:node[@"id"]];[order addObject:node[@"id"]];DYAppendToolChildren(doc,node[@"id"],order,seen);}}
|
||||
NSArray *DYToolDisplayOrder(NSDictionary *doc){NSMutableArray *order=[NSMutableArray array];NSMutableSet *seen=[NSMutableSet set];for(NSString *type in DYToolTypes()){NSString *base=[@"base:" stringByAppendingString:type];[order addObject:base];DYAppendToolChildren(doc,base,order,seen);}for(NSDictionary *node in doc[@"layers"])if(!node[@"after"]&&![seen containsObject:node[@"id"]]){[seen addObject:node[@"id"]];[order addObject:node[@"id"]];DYAppendToolChildren(doc,node[@"id"],order,seen);}return order;}
|
||||
NSString *DYToolRootAnchor(NSDictionary *doc,NSString *ID){NSMutableSet *seen=[NSMutableSet set];NSDictionary *node=DYToolWithID(doc,ID);while(node[@"after"]){NSString *after=node[@"after"];if([after hasPrefix:@"base:"])return after;if([seen containsObject:after])return nil;[seen addObject:after];node=DYToolWithID(doc,after);}return @"tail";}
|
||||
NSDictionary *DYInsertTool(NSMutableDictionary *doc,NSString *type,NSString *after){if(!DYValidToolDocument(doc)||[doc[@"layers"]count]>=DYToolLimit)return nil;if(!([after hasPrefix:@"base:"]&&[DYToolTypes()containsObject:[after substringFromIndex:5]])&&!DYToolWithID(doc,after))return nil;NSDictionary *fresh=DYNewTool(type);if(!fresh)return nil;NSMutableDictionary *node=DYMutablePlist(fresh);node[@"after"]=after;NSMutableArray *layers=doc[@"layers"];for(NSMutableDictionary *old in layers)if([old[@"after"]isEqual:after])old[@"after"]=node[@"id"];NSUInteger index=0;NSDictionary *parent=DYToolWithID(doc,after);if(parent)index=[layers indexOfObjectIdenticalTo:parent]+1;[layers insertObject:node atIndex:MIN(index,layers.count)];doc[@"schema"]=@2;return node;}
|
||||
BOOL DYRemoveTool(NSMutableDictionary *doc,NSString *ID){NSMutableDictionary *node=(id)DYToolWithID(doc,ID);if(!node)return NO;NSString *after=node[@"after"];for(NSMutableDictionary *child in doc[@"layers"])if([child[@"after"]isEqual:ID]){if(after)child[@"after"]=after;else[child removeObjectForKey:@"after"];}[doc[@"layers"]removeObject:node];return YES;}
|
||||
NSArray *DYMasksForTool(NSDictionary *doc,NSString *ID){return [ID hasPrefix:@"base:"]?doc[@"baseMasks"][[ID substringFromIndex:5]]?:@[]:DYToolWithID(doc,ID)[@"masks"]?:@[];}
|
||||
BOOL DYSetToolMasks(NSMutableDictionary *doc,NSString *ID,NSArray *masks){if([ID hasPrefix:@"base:"]){NSString *type=[ID substringFromIndex:5];if(![DYToolTypes()containsObject:type])return NO;doc[@"baseMasks"][type]=masks;}else{NSMutableDictionary *n=(id)DYToolWithID(doc,ID);if(!n)return NO;n[@"masks"]=masks;}return YES;}
|
||||
DYMaskParameters DYMaskAtTime(NSDictionary *mask,CMTime time){DYMaskParameters p=dyDefaultMaskParameters();readParameters(mask[@"parameters"],&p);NSArray *keys=mask[@"keys"];if(!keys.count||!CMTIME_IS_NUMERIC(time))return p;if(keyTime(keys[0]).epoch!=time.epoch)return p;NSUInteger low=0,high=keys.count;while(low<high){NSUInteger mid=low+(high-low)/2;if(CMTimeCompare(keyTime(keys[mid]),time)<0)low=mid+1;else high=mid;}NSDictionary *left=keys[low?low-1:0],*right=keys[MIN(low,keys.count-1)];DYMaskParameters a,b;readParameters(left[@"parameters"],&a);readParameters(right[@"parameters"],&b);double duration=CMTimeGetSeconds(CMTimeSubtract(keyTime(right),keyTime(left)));float w=duration>0?fmax(0,fmin(1,CMTimeGetSeconds(CMTimeSubtract(time,keyTime(left)))/duration)):0;
|
||||
// Only temporal geometry/feather/strength interpolate; key selection and levels stay authored.
|
||||
float *v=&p.centerX,*av=&a.centerX,*bv=&b.centerX;for(int i=0;i<8;i++)v[i]=av[i]+(bv[i]-av[i])*w;return p;}
|
||||
NSDictionary *DYMaskKey(CMTime t,DYMaskParameters p,BOOL manual,float confidence){return @{@"value":@(t.value),@"scale":@(t.timescale),@"epoch":@(t.epoch),@"parameters":parameterData(p),@"manual":@(manual),@"confidence":@(confidence)};}
|
||||
BOOL DYMergeTracking(NSMutableDictionary *m,NSArray *samples){if(!samples.count)return YES;NSMutableArray *all=[NSMutableArray array];CMTime lo=keyTime(samples.firstObject),hi=keyTime(samples.lastObject);if(CMTimeCompare(lo,hi)>0)std::swap(lo,hi);for(NSDictionary *key in m[@"keys"])if([key[@"manual"]boolValue]||CMTimeCompare(keyTime(key),lo)<0||CMTimeCompare(keyTime(key),hi)>0)[all addObject:key];for(NSDictionary *key in samples){BOOL manual=NO;for(NSDictionary *old in all)if(CMTimeCompare(keyTime(old),keyTime(key))==0){manual=YES;break;}if(!manual)[all addObject:key];}[all sortUsingComparator:^NSComparisonResult(NSDictionary *a,NSDictionary *b){return (NSComparisonResult)CMTimeCompare(keyTime(a),keyTime(b));}];NSMutableDictionary *candidate=DYMutablePlist(m);candidate[@"keys"]=all;if(!DYValidToolMask(candidate))return NO;m[@"keys"]=all;return YES;}
|
||||
NSDictionary *DYToolRenderSnapshot(NSDictionary *doc,CMTime t){
|
||||
auto resolve=[&](NSArray *masks){NSMutableArray *result=[NSMutableArray arrayWithCapacity:masks.count];for(NSDictionary *mask in masks){NSMutableDictionary *m=[[mask mutableCopy]autorelease];m[@"parameters"]=parameterData(DYMaskAtTime(mask,t));m[@"keys"]=@[];[result addObject:m];}return result;};
|
||||
NSMutableDictionary *out=[[doc mutableCopy]autorelease],*base=[NSMutableDictionary dictionary];for(NSString *type in doc[@"baseMasks"])base[type]=resolve(doc[@"baseMasks"][type]);out[@"baseMasks"]=base;NSMutableArray *layers=[NSMutableArray array];for(NSDictionary *node in doc[@"layers"]){NSMutableDictionary *layer=[[node mutableCopy]autorelease];layer[@"masks"]=resolve(node[@"masks"]);[layers addObject:layer];}out[@"layers"]=layers;return out;
|
||||
}
|
||||
DYUniforms DYToolUniforms(NSDictionary *node){DYUniforms u;DYDefaultUniforms(&u);NSString *type=node[@"type"];for(NSDictionary *s in DYSections())for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:s[@"enabled"]])*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])=0;u.primarySectionEnabled=0;u.cm.configured=-1;u.inputProfile=u.preLUTStrength=0;u.skinProtection.x=0;
|
||||
NSArray *parts=[type isEqual:@"primary"]?@[@"input",@"primary",@"output"]:[type isEqual:@"base"]?@[@"base",@"color"]:@[type];for(NSString *part in parts){NSDictionary *s=DYToolSection(part);for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:s[@"enabled"]])*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])=1;}
|
||||
if([type isEqual:@"primary"]){u.primarySectionEnabled=1;u.cm.configured=1;u.cm.inputTransfer=u.cm.outputTransfer;u.cm.inputGamut=u.cm.outputGamut;}
|
||||
for(NSDictionary *d in DYDescriptors()){NSNumber *v=node[@"values"][d[@"key"]];if(v&&[d[@"offset"]integerValue]>=0)*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])=v.floatValue;}return u;}
|
||||
BOOL DYToolIsNeutral(NSDictionary *node){NSString *type=node[@"type"];DYUniforms u=DYToolUniforms(node);NSDictionary *section=DYToolSection(type);BOOL enabled=YES;if([type isEqual:@"primary"])enabled=u.primarySectionEnabled>.5;else if([type isEqual:@"base"])enabled=u.baseSectionEnabled>.5||u.colorSectionEnabled>.5;else for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:section[@"enabled"]])enabled=*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])>.5;if(!enabled)return YES;if([type isEqual:@"mixer"])return !DYChannelMixerActive(u);if([type isEqual:@"film"])return !DYFilmActive(u.film);if([type isEqual:@"skin"])return u.skinProtection.y==0;if([node[@"type"]isEqual:@"spider"]&&[node[@"spider"]length]){auto mesh=DYSpiderMesh(node[@"spider"]);for(float v:dy::meshSamples(mesh))if(v!=0)return NO;}if([node[@"paths"]count])return NO;for(NSDictionary *d in DYDescriptors()){NSNumber *v=node[@"values"][d[@"key"]];if(v&&v.floatValue!=[d[@"default"]floatValue])return NO;}return YES;}
|
||||
|
||||
@implementation DYToolManager {
|
||||
id<PROAPIAccessing> _host;NSString *_nodeID,*_type;NSInteger _depth;CMTime _time;NSMutableDictionary *_pending;DYInspectorToken *_token;
|
||||
}
|
||||
@synthesize host=_host,nodeID=_nodeID,type=_type;
|
||||
- (instancetype)initWithHost:(id<PROAPIAccessing>)h node:(NSDictionary*)n{if((self=[super init])){_host=h;_nodeID=[n[@"id"]copy];_type=[n[@"type"]copy];}return self;}
|
||||
- (void)dealloc{[_nodeID release];[_type release];[_pending release];[_token release];[super dealloc];}
|
||||
- (id)apiForProtocol:(Protocol*)p{if(protocol_isEqual(p,@protocol(FxParameterRetrievalAPI_v6))||protocol_isEqual(p,@protocol(FxParameterSettingAPI_v6))||protocol_isEqual(p,@protocol(FxCustomParameterActionAPI_v4)))return self;return [_host apiForProtocol:p];}
|
||||
- (void)startAction:(id)sender{if(_depth++==0){[[_host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)]startAction:sender];_time=[(id<FxCustomParameterActionAPI_v4>)[_host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)]currentTime];[_pending release];_pending=[DYMutablePlist(DYReadTools(_host,_time).document)retain];}}
|
||||
- (void)endAction:(id)sender{if(_depth<=0)return;if(--_depth==0){NSDictionary *original=DYReadTools(_host,_time).document;if(![_pending isEqual:original])DYWriteTools(_host,_pending,_time);if(_token)[[_host apiForProtocol:@protocol(FxParameterSettingAPI_v6)]setCustomParameterValue:_token toParameter:DYInspectorParameterID atTime:_time];[_token release];_token=nil;[[_host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)]endAction:sender];}}
|
||||
- (CMTime)currentTime{return _time;}
|
||||
- (NSDictionary*)node{return DYToolWithID(_pending?:DYReadTools(_host,_time).document,_nodeID);}
|
||||
- (BOOL)getFloatValue:(double*)out fromParameter:(UInt32)pid atTime:(CMTime)t{NSDictionary *n=[self node];DYUniforms u=DYToolUniforms(n?:@{@"type":_type});for(NSDictionary *d in DYDescriptors())if([d[@"pid"]unsignedIntValue]==pid){*out=[d[@"offset"]integerValue]>=0?*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue]):[d[@"default"]doubleValue];return YES;}return NO;}
|
||||
- (BOOL)setFloatValue:(double)v toParameter:(UInt32)pid atTime:(CMTime)t{if(!_depth||!std::isfinite(v))return NO;NSMutableDictionary *n=(id)[self node];if(!n)return NO;for(NSDictionary *d in DYDescriptors())if([d[@"pid"]unsignedIntValue]==pid){n[@"values"][d[@"key"]]=@(v);return YES;}return NO;}
|
||||
- (BOOL)getCustomParameterValue:(id*)out fromParameter:(UInt32)pid atTime:(CMTime)t{if(pid==DYAssetsParameterID){DYAssetState *a=[[[DYAssetState alloc]init]autorelease];NSDictionary *n=[self node];a.paths=n[@"paths"]?:@{};a.spiderMesh=n[@"spider"];a.spiderLinked=[n[@"spiderLinked"]boolValue];*out=a;return YES;}if(pid==DYInspectorParameterID){DYInspectorToken *global=_token; if(!global)[[_host apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getCustomParameterValue:&global fromParameter:pid atTime:t];DYInspectorToken *local=[[[DYInspectorToken alloc]init]autorelease];NSMutableDictionary *folds=[NSMutableDictionary dictionary];for(NSString *key in global.folds)if([key hasPrefix:[_nodeID stringByAppendingString:@":"]])folds[[key substringFromIndex:_nodeID.length+1]]=global.folds[key];local.folds=folds;*out=local;return YES;}return NO;}
|
||||
- (BOOL)setCustomParameterValue:(id)v toParameter:(UInt32)pid atTime:(CMTime)t{if(!_depth)return NO;NSMutableDictionary *n=(id)[self node];if(!n)return NO;if(pid==DYAssetsParameterID&&[v isKindOfClass:DYAssetState.class]){n[@"paths"]=DYMutablePlist([v paths]);if([v spiderMesh])n[@"spider"]=[v spiderMesh];else[n removeObjectForKey:@"spider"];n[@"spiderLinked"]=@([v spiderLinked]);return YES;}if(pid==DYInspectorParameterID){DYInspectorToken *old=nil;[[_host apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getCustomParameterValue:&old fromParameter:pid atTime:t];[_token release];_token=old?[old copy]:[DYInspectorToken new];NSMutableDictionary *folds=[[_token.folds mutableCopy]autorelease];for(NSString *key in [v folds])folds[[_nodeID stringByAppendingFormat:@":%@",key]]=[v folds][key];_token.folds=folds;return YES;}return NO;}
|
||||
@end
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,&error);DYToolTrackingProbe *host=[[[DYToolTrackingProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero;host->_state=kFxAnalysisState_NotAnalyzing;
|
||||
NSMutableDictionary *doc=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document),*mask=DYMutablePlist(DYNewMask(DYMaskRectangle));DYMaskParameters p=DYMaskAtTime(mask,kCMTimeZero);p.width=.65;p.height=.65;p.feather=0;mask[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];doc[@"baseMasks"][@"hsl"]=[NSMutableArray arrayWithObject:mask];DYWriteTools(base,doc,kCMTimeZero);
|
||||
id<DYToolHostProbe>plugin=(id)[[NSClassFromString(@"DYPlugIn")alloc]initWithAPIManager:host];[(NSObject*)plugin setValue:@YES forKey:@"_toolCaptureEnabled"];
|
||||
const NSUInteger tw=320,th=192;DYDiagnosticTile *frame=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:tw height:th]autorelease],*out=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:tw height:th]autorelease];
|
||||
auto setFrame=[&](int step){Pixels pixels(tw*th*4);for(NSUInteger y=0;y<th;y++)for(NSUInteger x=0;x<tw;x++){int xx=(int)x-step*2,yy=(int)y-step;uint32_t n=(uint32_t)(xx/3)*73856093u^(uint32_t)(yy/3)*19349663u;n^=n>>13;n*=1274126177u;float code=.15f+.7f*((n>>8)&255)/255.f,linear=code<=.04045f?code/12.92f:powf((code+.055f)/1.055f,2.4f);auto index=(y*tw+x)*4;pixels[index]=pixels[index+1]=pixels[index+2]=linear;pixels[index+3]=1;}[[frame metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,tw,th) mipmapLevel:0 withBytes:pixels.data() bytesPerRow:tw*8];};
|
||||
auto timeAt=[](int frame){return CMTimeMake(frame*1001,24000);};auto capture=[&](int step){setFrame(step);host->_time=timeAt(step);NSData *state=nil;[plugin pluginState:&state atTime:host->_time quality:(FxQuality)0 error:&error];return [plugin renderDestinationImage:out sourceImages:@[frame] pluginState:state atTime:host->_time error:&error];};
|
||||
auto request=[&](int direction){if(direction!=9)host->_state=kFxAnalysisState_NotAnalyzing;[plugin toolTrackRequested:[NSNotification notificationWithName:@"DYToolTrack" object:host userInfo:@{@"node":@"base:hsl",@"mask":mask[@"id"],@"direction":@(direction)}]];};
|
||||
auto drain=[&](){double end=NSProcessInfo.processInfo.systemUptime+.15;while(NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.005]];};CMTimeRange inputRange=CMTimeRangeMake(kCMTimeZero,CMTimeMake(6*1001,24000)),desired;
|
||||
run.need(@"tracking-captures-real-full-input-texture",capture(0));int undoBefore=base->_undoStarts;request(1);BOOL callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:&error]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:&error];
|
||||
for(int i=0;i<6&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:&error];}host->_state=kFxAnalysisState_AnalysisCompleted;[plugin cleanupAnalysis:nil];drain();NSDictionary *tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];DYMaskParameters end=DYMaskAtTime(tracked,timeAt(5));run.record(@"host-callback-metal-tracking-six-exact-frames",callbacks&&[tracked[@"keys"]count]==6&&fabs(end.centerX-(.5+10./tw))<.004&&fabs(end.centerY-(.5+5./th))<.004,@{@"keyCount":@([tracked[@"keys"]count]),@"centerX":@(end.centerX),@"centerY":@(end.centerY),@"error":reason(error)});
|
||||
run.record(@"tracking-results-use-one-undo-action",base->_undoStarts==undoBefore+1&&base->_undoStarts==base->_undoEnds);int writes=base->_undoStarts;[plugin cleanupAnalysis:nil];[plugin cleanupAnalysis:nil];drain();run.record(@"duplicate-analysis-cleanup-never-commits-twice",base->_undoStarts==writes);
|
||||
// Mid-analysis author edits must reject the result rather than clobber them.
|
||||
capture(0);request(1);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=0;i<3&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}NSMutableDictionary *changed=DYMutablePlist(DYReadTools(base,kCMTimeZero).document);changed[@"baseMasks"][@"hsl"][0][@"enabled"]=@NO;DYWriteTools(base,changed,kCMTimeZero);[plugin cleanupAnalysis:nil];drain();run.record(@"stale-analysis-cannot-overwrite-edited-mask",[DYReadTools(base,kCMTimeZero).document isEqual:changed]&&base->_undoStarts==writes);
|
||||
DYWriteTools(base,doc,kCMTimeZero);capture(0);request(1);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=0;i<3&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}request(9);setFrame(3);NSError *cancelError=nil;BOOL stopped=![plugin analyzeFrame:frame atTime:timeAt(3) error:&cancelError];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"cancel-keeps-only-contiguous-trusted-segment",callbacks&&stopped&&[tracked[@"keys"]count]==3&&base->_undoStarts==writes+1);run.record(@"cancel-sends-sdk-quiet-analysis-termination",[cancelError.domain isEqual:FxPlugErrorDomain]&&cancelError.code==kFxError_UserCancelled);
|
||||
DYWriteTools(base,doc,kCMTimeZero);capture(2);host->_state=kFxAnalysisState_NotAnalyzing;request(0);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=2;i<6&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}[plugin cleanupAnalysis:nil];drain();BOOL backward=host->_backwardStarts==1;callbacks&=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=2;i>=0&&callbacks;i--){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}[plugin cleanupAnalysis:nil];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"bidirectional-passes-share-reference-and-merge-once",callbacks&&backward&&[tracked[@"keys"]count]==6&&base->_undoStarts==writes+2);
|
||||
DYWriteTools(base,doc,kCMTimeZero);capture(2);host->_timelineOffset=CMTimeMake(4,1);host->_state=kFxAnalysisState_NotAnalyzing;request(-2);BOOL range=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&CMTimeCompare(desired.start,timeAt(1))==0&&CMTimeCompare(desired.duration,timeAt(2))==0;[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=2;i>=1;i--){setFrame(i);[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}setFrame(0);NSError *singleStopError=nil;stopped=![plugin analyzeFrame:frame atTime:timeAt(0) error:&singleStopError];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"backward-single-step-includes-reference-and-one-neighbor",range&&stopped&&[tracked[@"keys"]count]==2);run.record(@"single-step-sends-sdk-quiet-analysis-termination",[singleStopError.domain isEqual:FxPlugErrorDomain]&&singleStopError.code==kFxError_UserCancelled);
|
||||
run.record(@"backward-single-step-seeks-timeline-with-clip-offset",host->_seekCount==1&&CMTimeCompare(host->_seekTime,CMTimeAdd(CMTimeMake(4,1),timeAt(1)))==0&&CMTimeCompare(host->_time,timeAt(1))==0);
|
||||
DYWriteTools(base,doc,kCMTimeZero);capture(2);BOOL repeated=YES;for(int first=2;first<4;first++){request(2);repeated&=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=first;i<=first+1&&repeated;i++){setFrame(i);repeated&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}[plugin cleanupAnalysis:nil];drain();repeated&=CMTimeCompare(host->_time,timeAt(first+1))==0;}run.record(@"repeated-forward-single-step-continues-source-frames-at-offset-clip",repeated&&host->_seekCount==3&&CMTimeCompare(host->_seekTime,CMTimeAdd(CMTimeMake(4,1),timeAt(4)))==0);
|
||||
int priorWrites=0;for(int repeat=0;repeat<2;repeat++){priorWrites=base->_undoStarts;capture(2);request(2);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=2;i<=3&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}[plugin cleanupAnalysis:nil];drain();}run.record(@"unchanged-single-step-still-advances-without-duplicate-author-write",callbacks&&host->_seekCount==5&&CMTimeCompare(host->_time,timeAt(3))==0&&base->_undoStarts==priorWrites,@{@"seekCount":@(host->_seekCount),@"writesBefore":@(priorWrites),@"writesAfter":@(base->_undoStarts)});
|
||||
|
||||
|
||||
// An expected loss must end the host job, not only our local tracking state.
|
||||
DYWriteTools(base,doc,kCMTimeZero);capture(0);request(1);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=0;i<3&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}
|
||||
Pixels flat(tw*th*4,.1f);for(size_t i=3;i<flat.size();i+=4)flat[i]=1;[[frame metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,tw,th) mipmapLevel:0 withBytes:flat.data() bytesPerRow:tw*8];NSError *lossError=nil;stopped=![plugin analyzeFrame:frame atTime:timeAt(3) error:&lossError];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"texture-loss-keeps-prefix-and-sends-sdk-quiet-termination",callbacks&&stopped&&[tracked[@"keys"]count]==3&&[lossError.domain isEqual:FxPlugErrorDomain]&&lossError.code==kFxError_UserCancelled);
|
||||
DYWriteTools(base,doc,kCMTimeZero);capture(0);request(-1);NSError *boundaryError=nil;callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:&boundaryError]&&CMTimeCompare(desired.start,kCMTimeZero)==0&&CMTimeCompare(desired.duration,timeAt(1))==0&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:&boundaryError];setFrame(0);callbacks&=[plugin analyzeFrame:frame atTime:kCMTimeZero error:&boundaryError];host->_state=kFxAnalysisState_AnalysisCompleted;[plugin cleanupAnalysis:nil];drain();run.record(@"boundary-seed-only-range-completes-without-author-write-or-rejected-range",callbacks&&!boundaryError&&[DYReadTools(base,kCMTimeZero).document isEqual:doc]);
|
||||
NSError *lateError=nil;stopped=![plugin analyzeFrame:frame atTime:timeAt(0) error:&lateError];run.record(@"late-analysis-frame-also-terminates-host-job-quietly",stopped&&[lateError.domain isEqual:FxPlugErrorDomain]&&lateError.code==kFxError_UserCancelled);
|
||||
// A host cache hit can move the playhead without re-entering renderDestinationImage.
|
||||
// Starting at a middle frame must use analyzer input even on a fresh instance.
|
||||
DYWriteTools(base,doc,kCMTimeZero);id<DYToolHostProbe>cold=(id)[[NSClassFromString(@"DYPlugIn")alloc]initWithAPIManager:host];host->_time=timeAt(2);host->_state=kFxAnalysisState_NotAnalyzing;int starts=host->_forwardStarts;
|
||||
[cold toolTrackRequested:[NSNotification notificationWithName:@"DYToolTrack" object:host userInfo:@{@"node":@"base:hsl",@"mask":mask[@"id"],@"direction":@1}]];
|
||||
callbacks=host->_forwardStarts==starts+1&&[cold desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&CMTimeCompare(desired.start,timeAt(2))==0&&[cold setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];
|
||||
for(int i=2;i<6&&callbacks;i++){setFrame(i);callbacks&=[cold analyzeFrame:frame atTime:timeAt(i) error:nil];}[cold cleanupAnalysis:nil];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"middle-frame-start-with-no-preview-render-cache",callbacks&&[tracked[@"keys"]count]==4&&CMTimeCompare(CMTimeMake([tracked[@"keys"][0][@"value"]longLongValue],[tracked[@"keys"][0][@"scale"]intValue]),timeAt(2))==0);
|
||||
[cold release];
|
||||
DYWriteTools(base,doc,kCMTimeZero);capture(0);host->_time=timeAt(2);request(1);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];
|
||||
for(int i=2;i<6&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}[plugin cleanupAnalysis:nil];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"middle-frame-start-ignores-stale-preview-cache",callbacks&&[tracked[@"keys"]count]==4);
|
||||
DYWriteTools(base,doc,kCMTimeZero);capture(0);request(1);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];
|
||||
// Deliberately different preview pixels must not veto an authoritative analysis seed.
|
||||
for(int i=0;i<3&&callbacks;i++){setFrame(i+2);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}[plugin cleanupAnalysis:nil];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"analysis-seed-does-not-require-preview-pixel-equality",callbacks&&[tracked[@"keys"]count]==3);
|
||||
{
|
||||
const NSUInteger w=3840,h=2160;DYDiagnosticTile *fine=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease];Pixels pixels(w*h*4);
|
||||
for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w;x++){float encoded=x%3==1?.8f:.2f,linear=powf((encoded+.055f)/1.055f,2.4f);auto i=(y*w+x)*4;pixels[i]=pixels[i+1]=pixels[i+2]=linear;pixels[i+3]=1;}
|
||||
[[fine metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,w,h) mipmapLevel:0 withBytes:pixels.data() bytesPerRow:w*8];auto gray=[plugin toolGrayFrame:fine error:nil];double maximum=0;for(float v:gray.pixels)maximum=std::max(maximum,fabs(v-.4));
|
||||
run.record(@"tracking-4k-frame-lowpass-before-normalized-motion-grid",gray.valid()&&gray.width==1280&&gray.height==720&&maximum<.002,@{@"width":@(gray.width),@"height":@(gray.height),@"maximumError":@(maximum)});
|
||||
}
|
||||
[plugin release];
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#include "MaskCore/DYTracker.hpp"
|
||||
@interface DYToolTrackingProbe : NSObject<PROAPIAccessing> {
|
||||
@public
|
||||
id _base;CMTime _time,_timelineOffset,_seekTime;int _seekCount;FxAnalysisState _state;int _forwardStarts,_backwardStarts;
|
||||
}
|
||||
@end
|
||||
@implementation DYToolTrackingProbe
|
||||
- (id)apiForProtocol:(Protocol*)protocol{NSString *name=NSStringFromProtocol(protocol);if([@[@"FxAnalysisAPI",@"FxTimingAPI_v4",@"FxCustomParameterActionAPI_v4",@"FxCommandAPI_v2"]containsObject:name])return self;return [_base apiForProtocol:protocol];}
|
||||
- (void)startAction:(id)sender{[(id<FxCustomParameterActionAPI_v4>)_base startAction:sender];}
|
||||
- (void)endAction:(id)sender{[(id<FxCustomParameterActionAPI_v4>)_base endAction:sender];}
|
||||
- (CMTime)currentTime{return _time;}
|
||||
- (void)timelineTime:(CMTime*)timeline fromInputTime:(CMTime)input{*timeline=CMTimeAdd(input,CMTIME_IS_NUMERIC(_timelineOffset)?_timelineOffset:kCMTimeZero);}
|
||||
- (BOOL)movePlayheadToTime:(CMTime)time error:(NSError**)error{_seekTime=time;_seekCount++;_time=CMTimeSubtract(time,CMTIME_IS_NUMERIC(_timelineOffset)?_timelineOffset:kCMTimeZero);return YES;}
|
||||
- (FxAnalysisState)analysisStateForEffect{return _state;}
|
||||
- (BOOL)startForwardAnalysis:(FxAnalysisLocation)location error:(NSError**)error{_forwardStarts++;_state=kFxAnalysisState_AnalysisStarted;return YES;}
|
||||
- (BOOL)startBackwardAnalysis:(FxAnalysisLocation)location error:(NSError**)error{_backwardStarts++;_state=kFxAnalysisState_AnalysisStarted;return YES;}
|
||||
- (NSUInteger)timelineFpsNumeratorForEffect:(id)effect{return 24000;}
|
||||
- (NSUInteger)timelineFpsDenominatorForEffect:(id)effect{return 1001;}
|
||||
@end
|
||||
@protocol DYToolHostProbe
|
||||
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager;
|
||||
- (BOOL)pluginState:(NSData**)state atTime:(CMTime)time quality:(FxQuality)quality error:(NSError**)error;
|
||||
- (BOOL)renderDestinationImage:(FxImageTile*)dst sourceImages:(NSArray*)src pluginState:(NSData*)state atTime:(CMTime)time error:(NSError**)error;
|
||||
- (void)toolTrackRequested:(NSNotification*)notification;
|
||||
- (BOOL)desiredAnalysisTimeRange:(CMTimeRange*)out forInputWithTimeRange:(CMTimeRange)input error:(NSError**)error;
|
||||
- (BOOL)setupAnalysisForTimeRange:(CMTimeRange)range frameDuration:(CMTime)duration error:(NSError**)error;
|
||||
- (BOOL)analyzeFrame:(FxImageTile*)frame atTime:(CMTime)time error:(NSError**)error;
|
||||
- (BOOL)cleanupAnalysis:(NSError**)error;
|
||||
- (dy::GrayFrame)toolGrayFrame:(FxImageTile*)tile error:(NSError**)error;
|
||||
@end
|
||||
|
||||
@interface DYToolCanvasProbe : DYToolTrackingProbe @end
|
||||
@implementation DYToolCanvasProbe
|
||||
- (double)backingScaleFactor{return 1;}
|
||||
- (void)setCursor:(NSCursor*)cursor{}
|
||||
- (id)apiForProtocol:(Protocol*)p{if([NSStringFromProtocol(p)isEqual:@"FxOnScreenControlAPI_v4"])return self;return [super apiForProtocol:p];}
|
||||
- (BOOL)convertPointFromSpace:(FxDrawingCoordinates)from fromX:(double)x fromY:(double)y toSpace:(FxDrawingCoordinates)to toX:(double*)outX toY:(double*)outY{if(outX)*outX=40+x*560;if(outY)*outY=55+y*315;return YES;}
|
||||
@end
|
||||
@protocol DYToolCanvasHostProbe <DYToolHostProbe>
|
||||
- (void)scheduleToolCanvasRegistration;
|
||||
- (void)adoptToolCanvasDocument:(NSDictionary*)document;
|
||||
- (NSDictionary*)toolCanvasMaskAtTime:(CMTime)time;
|
||||
@end
|
||||
@@ -0,0 +1,60 @@
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
struct PyramidInfo {int width[5],height[5],offset[5],levels;};
|
||||
kernel void dyTrackPyramid(device float*f[[buffer(0)]],constant PyramidInfo&i[[buffer(1)]],constant int&level[[buffer(2)]],uint2 p[[thread_position_in_grid]]) {
|
||||
int w=i.width[level],h=i.height[level];if(p.x>=uint(w)||p.y>=uint(h))return;
|
||||
int sw=i.width[level-1],sh=i.height[level-1];float sum=0;
|
||||
for(int y=-1;y<=1;y++)for(int x=-1;x<=1;x++)sum+=f[i.offset[level-1]+clamp(int(p.y)*2+y,0,sh-1)*sw+clamp(int(p.x)*2+x,0,sw-1)]*(x==0?2.f:1.f)*(y==0?2.f:1.f);
|
||||
f[i.offset[level]+p.y*w+p.x]=sum/16.f;
|
||||
}
|
||||
inline bool inside(float2 p,int w,int h){return all(p>=12.f)&&p.x<w-13&&p.y<h-13;}
|
||||
inline float pixel(device const float*f,int w,float2 p) {
|
||||
int2 a=int2(p);float2 d=p-float2(a);int idx=a.y*w+a.x;
|
||||
return mix(mix(f[idx],f[idx+1],d.x),mix(f[idx+w],f[idx+w+1],d.x),d.y);
|
||||
}
|
||||
// One SIMD group per feature: lanes cooperatively reduce the 21x21 patch.
|
||||
// Forward and backward checks stay in the same dispatch and reuse the resident pyramids.
|
||||
bool trackFlow(device const float*prev,device const float*next,constant PyramidInfo&i,float2 p,float2 guess,thread float2&q,thread float&error,uint lane) {
|
||||
int level=i.levels-1;for(;level>0;level--){float s=float(1<<level);if(inside(p/s,i.width[level],i.height[level])&&inside(guess/s,i.width[level],i.height[level]))break;}
|
||||
q=guess/float(1<<level);error=0;
|
||||
for(;level>=0;level--) {
|
||||
float2 pp=p/float(1<<level);int w=i.width[level],h=i.height[level];if(!inside(pp,w,h))return false;
|
||||
device const float*a=prev+i.offset[level];device const float*b=next+i.offset[level];
|
||||
float ref[14],gx[14],gy[14],mean=0,hxx=0,hxy=0,hyy=0;
|
||||
for(uint j=0;j<14;j++) {
|
||||
uint k=lane+j*32;ref[j]=gx[j]=gy[j]=0;if(k>=441)continue;
|
||||
float2 pos=pp+float2(int(k%21)-10,int(k/21)-10);ref[j]=pixel(a,w,pos);mean+=ref[j];
|
||||
gx[j]=.5f*(pixel(a,w,pos+float2(1,0))-pixel(a,w,pos-float2(1,0)));
|
||||
gy[j]=.5f*(pixel(a,w,pos+float2(0,1))-pixel(a,w,pos-float2(0,1)));
|
||||
hxx+=gx[j]*gx[j];hxy+=gx[j]*gy[j];hyy+=gy[j]*gy[j];
|
||||
}
|
||||
mean=simd_sum(mean)/441;hxx=simd_sum(hxx);hxy=simd_sum(hxy);hyy=simd_sum(hyy);
|
||||
float det=hxx*hyy-hxy*hxy;if(det<1e-8f||hxx+hyy<1e-5f)return false;
|
||||
for(int iteration=0;iteration<30;iteration++) {
|
||||
if(!inside(q,w,h))return false;float target[14],tm=0;
|
||||
for(uint j=0;j<14;j++){uint k=lane+j*32;target[j]=k<441?pixel(b,w,q+float2(int(k%21)-10,int(k/21)-10)):0;tm+=target[j];}
|
||||
tm=simd_sum(tm)/441;float bx=0,by=0,sse=0;
|
||||
for(uint j=0;j<14;j++)if(lane+j*32<441){float e=ref[j]-mean-target[j]+tm;bx+=gx[j]*e;by+=gy[j]*e;sse+=e*e;}
|
||||
bx=simd_sum(bx);by=simd_sum(by);sse=simd_sum(sse);
|
||||
float2 delta=float2(hyy*bx-hxy*by,hxx*by-hxy*bx)/det;if(!all(isfinite(delta))||length(delta)>8)return false;
|
||||
q+=delta;error=sqrt(sse/441);if(dot(delta,delta)<.0001f)break;
|
||||
}
|
||||
if(level>0)q*=2;
|
||||
}
|
||||
return inside(q,i.width[0],i.height[0])&&error<.12f;
|
||||
}
|
||||
kernel void dyTrackFlow(device const float*prev[[buffer(0)]],device const float*next[[buffer(1)]],device const float2*points[[buffer(2)]],device float4*results[[buffer(3)]],constant PyramidInfo&i[[buffer(4)]],uint gid[[thread_position_in_grid]],uint lane[[thread_index_in_simdgroup]]) {
|
||||
uint idx=gid/32;float2 p=points[idx],q=0,back=0;float error=0,backError=0;
|
||||
bool ok=trackFlow(prev,next,i,p,p,q,error,lane);
|
||||
if(ok)ok=trackFlow(next,prev,i,q,p,back,backError,lane)&&distance(back,p)<=1.1f;
|
||||
if(lane==0)results[idx]=float4(q,error,ok?1.f:0.f);
|
||||
}
|
||||
|
||||
// Full host frame -> top-first display luma. Low-pass the source footprint
|
||||
// before decimation so 4K fabric detail cannot alias into inconsistent motion.
|
||||
// This analysis-only image never changes the full-resolution color render.
|
||||
kernel void dyToolCapture(texture2d<float> source [[texture(0)]],device float* pixels [[buffer(0)]],constant uint3& info [[buffer(1)]],uint2 pos [[thread_position_in_grid]]){
|
||||
if(pos.x>=info.x||pos.y>=info.y)return;constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);uint2 taps=clamp(uint2(ceil(float2(source.get_width(),source.get_height())/float2(info.xy))),uint2(1),uint2(8));float sum=0;
|
||||
for(uint y=0;y<taps.y;y++)for(uint x=0;x<taps.x;x++){float2 uv=(float2(pos)+(float2(x,y)+.5f)/float2(taps))/float2(info.xy);if(info.z)uv.y=1-uv.y;float4 sample=source.sample(f,uv);float3 linear=sample.a>0?sample.rgb/sample.a:float3(0);float3 encoded=select(1.055f*pow(max(linear,float3(0)),float3(1.f/2.4f))-.055f,linear*12.92f,linear<=.0031308f);sum+=dot(clamp(encoded,0.f,1.f),float3(.2126f,.7152f,.0722f));}
|
||||
pixels[pos.y*info.x+pos.x]=sum/float(taps.x*taps.y);
|
||||
}
|
||||
@@ -17,6 +17,7 @@ typedef uint32_t DYUInt;
|
||||
#endif
|
||||
|
||||
#include "DYColorManagement.h"
|
||||
#include "DYFilmTypes.h"
|
||||
|
||||
typedef struct DYUniforms {
|
||||
float exposure; // offset 0
|
||||
@@ -125,6 +126,11 @@ typedef struct DYUniforms {
|
||||
float primarySectionEnabled;
|
||||
float spiderSectionEnabled;
|
||||
float spiderMix;
|
||||
float legacyPadding;
|
||||
DYFloat4 mixerRed,mixerGreen,mixerBlue;
|
||||
float mixerSectionEnabled,mixerPreserveLuma,mixerPreserveSaturation,mixerMix;
|
||||
DYFilmSettings film;
|
||||
DYUInt filmFrameKey; // frozen render time, never an author parameter
|
||||
} DYUniforms;
|
||||
|
||||
typedef struct DYVertex2D { DYFloat2 position; DYFloat2 textureCoordinate; } DYVertex2D;
|
||||
@@ -141,6 +147,7 @@ typedef struct DYRenderOptions {
|
||||
#define DY_ABI_ASSERT _Static_assert
|
||||
#endif
|
||||
DY_ABI_ASSERT(offsetof(DYUniforms, cm) == 944, "DYUniforms must match recovered GPU ABI");
|
||||
DY_ABI_ASSERT(offsetof(DYUniforms, mixerRed) == 1104, "complete 1.4.3 prefix stays fixed");
|
||||
DY_ABI_ASSERT(offsetof(DYUniforms, exposure) == 0, "exposure offset");
|
||||
DY_ABI_ASSERT(offsetof(DYUniforms, contrast) == 4, "contrast offset");
|
||||
DY_ABI_ASSERT(offsetof(DYUniforms, highlights) == 8, "highlights offset");
|
||||
|
||||
已加载 100/106 个文件。由于本次变更涉及的文件过多,其余文件未显示。
显示更多
在新工单中引用
屏蔽一个用户