diff --git a/research/CanvasTools-20261105.md b/research/CanvasTools-20261105.md index e6022c4..7a77959 100644 --- a/research/CanvasTools-20261105.md +++ b/research/CanvasTools-20261105.md @@ -36,3 +36,9 @@ AddressSanitizer 发现旧 renderLegacy 的 C++ 引用捕获向异步通知泄 肤色预览改为在原生皮肤阶段读取同一个色选算法、同一预HSL参考、同一用户蒙版与人脸覆盖,白色代表保护权重。初次真人测试识别人脸但MTLTexture→CIImage上下相反,已按TOP_LEFT归一化修正,正在重跑;未通过前不交付。 曲线直方图由成功渲染的分析更新发布到同时间快照,播放头不匹配时不展示旧帧。人脸只缓存完全相同的标准化像素;无脸或输入失败时为空,不延续上一镜头。新增空间处理的Cube导出会明确拒绝,完整预设继续保存。 + +## 候选 1.11.0(73) + +724项原生回归通过;真实人脸中心归一化坐标约(0.437,0.244),双人检测2张脸。上下原点输出最大误差0;同色背景差异0,人脸保护生效。独立层、零强度用户蒙版和无脸清空均通过。新的完整724项AddressSanitizer运行未报告内存错误;唯一失败为启用插桩后的旧主队列响应阈值(约226ms),无插桩Release该项通过,未放宽阈值。 + +最终交付脚本显式关闭ASAN并清理专用构建后重编译,正式安装自检自动提供版本化真人fixture。FCP已通过正常退出保存现有验收库;不修改库数据库。准备正式构建和宿主验收,尚未交付新版。 diff --git a/template/sources/RegisteredParameters.json b/template/sources/RegisteredParameters.json index 3ea2845..68f5726 100644 --- a/template/sources/RegisteredParameters.json +++ b/template/sources/RegisteredParameters.json @@ -1271,6 +1271,28 @@ "step": 1, "title": "肤色色相" }, + { + "default": 1, + "key": "skinFaceOnly", + "kind": "bool", + "max": 1, + "min": 0, + "offset": 1332, + "pid": 2333, + "step": 0.01, + "title": "仅保护人脸肤色" + }, + { + "default": 0, + "key": "skinVisualize", + "kind": "bool", + "max": 1, + "min": 0, + "offset": 1336, + "pid": 2334, + "step": 0.01, + "title": "显示肤色保护区域" + }, { "default": 1, "key": "skinEnabled", @@ -3630,6 +3652,61 @@ "pid": 2292, "step": 0.01, "title": "胶片模拟" + }, + { + "default": 0, + "key": "lensStrength", + "kind": "float", + "max": 100, + "min": -100, + "offset": 1316, + "pid": 2329, + "step": 1, + "title": "畸变校正" + }, + { + "default": 1, + "key": "lensScale", + "kind": "float", + "max": 2, + "min": 1, + "offset": 1320, + "pid": 2330, + "step": 0.01, + "title": "画面缩放" + }, + { + "default": 0.5, + "key": "lensCenterX", + "kind": "float", + "max": 1, + "min": 0, + "offset": 1324, + "pid": 2331, + "step": 0.01, + "title": "光学中心 X" + }, + { + "default": 0.5, + "key": "lensCenterY", + "kind": "float", + "max": 1, + "min": 0, + "offset": 1328, + "pid": 2332, + "step": 0.01, + "title": "光学中心 Y" + }, + { + "default": 1, + "key": "lensEnabled", + "kind": "bool", + "max": 1, + "min": 0, + "offset": 1312, + "pid": 2328, + "step": 0.01, + "title": "镜头畸变修复" } ], "sourceSHA256": { @@ -3641,11 +3718,11 @@ "大鱼调色/Plugin/DYManagedColor.h": "d5901d6ac11d93f3f4438dd8d48bb3a123d06d9b79ed39e8dca38db4261bc87a", "大鱼调色/Plugin/DYManagedColor.mm": "d9d2688f26a51d1131ee63b415e0c09989616312d31eb3b636fd299f475ece08", "大鱼调色/Plugin/DYModel.h": "a28652bd53aa9e1d085af1108c344b5d673c5e1b3731531e1bb2982efeb8708c", - "大鱼调色/Plugin/DYModel.mm": "29fea6064d3131119933401f554cc04e48cadf07d0c62f25b8d66795201396f8", + "大鱼调色/Plugin/DYModel.mm": "e5bdf3177e164c0b97e535be7e6d14ea56d49f3f74c3622078374e7a9597d2c1", "大鱼调色/Plugin/DYSpiderState.h": "0c80747e41e8fc97762e301b011bd08c18865a825eaafde086ed79ace37b22f9", "大鱼调色/Plugin/DYToolState.h": "0a83109d2c02626d6b9e7340b74be6e6a74f366f31f9d7622b4a88000d5ad7b9", - "大鱼调色/Plugin/DYToolState.mm": "be984c73f5c4e563e3ac8de2b911e33071773f3d823b6b2d631444d3aa2baea2", - "大鱼调色/Plugin/DYUniforms.h": "207d36b5b53ab084fa8eb3813ccbbeb5193178e3468a37e9dc692ab196ffbb6a", + "大鱼调色/Plugin/DYToolState.mm": "49ccde836056123cc4912eaf43da11af1713db19add5e833d0287586554acd09", + "大鱼调色/Plugin/DYUniforms.h": "4901446fa6b2a6987a6a137baa458df70f5e25a1e64fdb5c502f765b20edc0c0", "大鱼调色/Plugin/MaskCore/DYMask.h": "5b9aa44390d4a1fca1baf5e34cb9eefc8483c939a65cc2a0412b7b41fc85bc16", "大鱼调色/Plugin/MaskCore/DYMaskOperator.h": "43fa701ad574f38ce0ab4f4d3900bb034edaaa1adc09821d2f4443ee2b687ba2", "大鱼调色/Plugin/SpiderCore/DYColorMath.h": "bdd6278e17ff4208ad94a8b0e834c817c0a3475f205dd79898e8fd88e84a19c9", diff --git a/template/verification/StaticContract.json b/template/verification/StaticContract.json index e9e85d2..7487aaf 100644 --- a/template/verification/StaticContract.json +++ b/template/verification/StaticContract.json @@ -1,10 +1,10 @@ { "passed": true, - "sha256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891", + "sha256": "eaf60224f8d970f8841a03fe0325adc4af73d1c017375b020bcc0e256f0cd803", "version": "5.11", "displayversion": "5.4.5", "filterCount": 1, - "nativeFloatParameters": 278, + "nativeFloatParameters": 285, "customParameters": 3, "publications": [ { diff --git a/template/大鱼调色.moef b/template/大鱼调色.moef index 41c01a4..5370d54 100644 --- a/template/大鱼调色.moef +++ b/template/大鱼调色.moef @@ -306,6 +306,8 @@ + + @@ -513,6 +515,11 @@ + + + + + diff --git a/tools/deliver.py b/tools/deliver.py index e76ba7a..a5a6af1 100644 --- a/tools/deliver.py +++ b/tools/deliver.py @@ -35,7 +35,7 @@ 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) + result=subprocess.run([str(executable),'--self-test'],cwd=ROOT,text=True,capture_output=True,env=dict(os.environ,DY_DIAGNOSTIC_FACE_FIXTURE=str(ROOT/'tools/fixtures/astronaut.png'))) report.write_text(result.stdout) report.with_suffix('.stderr').write_text(result.stderr) try:parsed=json.loads(result.stdout) @@ -53,7 +53,7 @@ def main(): if IDENTITY not in ids:raise RuntimeError('有效发布证书或私钥不可用') if any(l.endswith('/Contents/MacOS/大鱼调色') for l in run('ps','-axo','comm=').splitlines()):raise RuntimeError('请先正常退出当前大鱼调色窗口') print('Building final Release',flush=True) - run('xcodebuild','-project','大鱼调色.xcodeproj','-scheme','Wrapper Application','-configuration','Release','-derivedDataPath',str(CACHE/'DerivedData'),'build',log=CACHE/'release-build.log') + run('xcodebuild','-project','大鱼调色.xcodeproj','-scheme','Wrapper Application','-configuration','Release','-enableAddressSanitizer','NO','-derivedDataPath',str(CACHE/'DerivedData'),'clean','build',log=CACHE/'release-build.log') b=APP/'Contents/Resources/FCP Templates/大鱼调色.moef';b.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(ROOT/'template/大鱼调色.moef',b) for name in ['large.png','small.png']: if (ROOT/'template'/name).exists():shutil.copy2(ROOT/'template'/name,b.parent/name) diff --git a/verification/CanvasToolsASAN1.11.0.json b/verification/CanvasToolsASAN1.11.0.json new file mode 100644 index 0000000..c2b010a --- /dev/null +++ b/verification/CanvasToolsASAN1.11.0.json @@ -0,0 +1,14 @@ +{ + "checks": 724, + "memoryError": false, + "stackUseAfterReturnEnabled": true, + "failedChecks": [ + { + "heartbeats": 0, + "maximumGapMS": 226.45924999960698, + "name": "external-activation-main-loop-responsive", + "pass": false + } + ], + "note": "Instrumented main-loop timing exceeds the unchanged release threshold; the non-instrumented Release check passes." +} diff --git a/大鱼调色/Plugin/DYCanvasToolsDiagnostics.inc.h b/大鱼调色/Plugin/DYCanvasToolsDiagnostics.inc.h index 877ee85..ecc1209 100644 --- a/大鱼调色/Plugin/DYCanvasToolsDiagnostics.inc.h +++ b/大鱼调色/Plugin/DYCanvasToolsDiagnostics.inc.h @@ -52,5 +52,10 @@ if(faceFixture.length){ u.skinProtection.x=1;u.skinVisualize=1;Pixels selection=render(run,face,src,dst,gpu,u,@{},@"face-actual-selection-preview-render");double white=0,black=0;for(NSUInteger y=65;y<185;y++)for(NSUInteger x=175;x<275;x++)white=MAX(white,(float)selection[(y*w+x)*4]);for(NSUInteger y=410;y<470;y++)for(NSUInteger x=410;x<470;x++)black=MAX(black,(float)selection[(y*w+x)*4]); double maximum=0;NSUInteger maxX=0,maxY=0;for(NSUInteger y=0;ymaximum){maximum=selection[(y*w+x)*4];maxX=x;maxY=y;} run.record(@"face-preview-shows-actual-weight-and-excludes-background",white>.01&&black<.001,@{@"faceWeight":@(white),@"backgroundWeight":@(black),@"maximum":@(maximum),@"maxX":@(maxX),@"maxY":@(maxY)}); + // Both FxPlug row conventions must resolve the same visual face. + Pixels flipped(portrait.size());for(NSUInteger y=0;y.01&&layerBackground<.001); + DYDiagnosticTile *twoSource=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:1024 height:512]autorelease],*twoDest=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:1024 height:512]autorelease];Pixels two(1024*512*4);for(NSUInteger y=0;y<512;y++)for(NSUInteger x=0;x<1024;x++)memcpy(two.data()+(y*1024+x)*4,portrait.data()+(y*512+x%512)*4,8);[[twoSource metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,1024,512)mipmapLevel:0 withBytes:two.data()bytesPerRow:1024*8];u.skinProtection.x=1;BOOL twoOK=[face renderSource:twoSource destination:twoDest uniforms:u paths:@{}error:&maskError];NSData *twoEntries=[face valueForKey:@"faceEntries"];const DYToolMaskEntry *twoMasks=(const DYToolMaskEntry*)twoEntries.bytes;NSInteger faceCount=0;for(NSUInteger i=0;i.5&&u.skinFaceOnly>.5)||u.skinVisualize>.5;for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);face|=[node[@"type"]isEqual:@"skin"]&&layer.skinProtection.x>.5&&layer.skinFaceOnly>.5;} + DYUniforms effective=u;bypassNeutralTools(&effective);bypassIdleSkin(&effective);BOOL face=effective.skinProtection.x>.5&&(u.skinFaceOnly>.5||u.skinVisualize>.5);for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);face|=[node[@"type"]isEqual:@"skin"]&&layer.skinProtection.x>.5&&layer.skinFaceOnly>.5;} if(face&&!_exporting)[self prepareFaceSupport:src];else{[_faceEntries release];_faceEntries=nil;} BOOL ok=[self renderToolsSource:src destination:dst uniforms:u paths:paths spider:spider tools:tools error:error]; return ok; diff --git a/大鱼调色/Plugin/DYGrade.metal b/大鱼调色/Plugin/DYGrade.metal index 59a7b50..a7d8b74 100644 --- a/大鱼调色/Plugin/DYGrade.metal +++ b/大鱼调色/Plugin/DYGrade.metal @@ -173,9 +173,9 @@ fragment half4 dyMaskedFragment(DYRaster in [[stage_in]], 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],uniforms.skinVisualize); + 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],(uniforms.skinProtection.x>.5?uniforms.skinVisualize:0)); 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],uniforms.skinVisualize); + 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],(uniforms.skinProtection.x>.5?uniforms.skinVisualize:0)); result.rgb=mix(color.rgb,result.rgb,half(options.blackWhiteMix)); } if(uniforms.skinVisualize<.5f && spiderSize.x>0 && uniforms.spiderSectionEnabled>.5f && uniforms.spiderMix>0.0f){ @@ -219,9 +219,9 @@ fragment half4 dySegmentFragment(DYRaster in [[stage_in]], 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],uniforms.skinVisualize,uint(stages.first),uint(stages.last),skinEncoded,encoded); + 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],(uniforms.skinProtection.x>.5?uniforms.skinVisualize:0),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],uniforms.skinVisualize,uint(stages.first),uint(stages.last),skinEncoded,encoded); + 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],(uniforms.skinProtection.x>.5?uniforms.skinVisualize:0),uint(stages.first),uint(stages.last),skinEncoded,encoded); result.rgb=mix(color.rgb,result.rgb,half(options.blackWhiteMix)); } result.a = sample.a; @@ -332,7 +332,7 @@ kernel void dyToolBlend(texture2d before [[texture(0)]],text extern "C" float dy_skinWeight(float3 color,float3 reference,constant DYUniforms& uniforms); extern "C" float3 dy_skinExtra(float3 color,float3 reference,constant DYUniforms& uniforms); kernel void dyToolSkin(texture2d before [[texture(0)]],texture2d reference [[texture(1)]],texture2d 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=u.skinVisualize>.5?float3(dy_skinWeight(float3(0),dyToolEncode(b.a>0?b.rgb/b.a:float3(0)),u)*clamp(u.skinProtection.y*.01f,0.f,1.f)*a.a):dyToolDecode(c)*a.a;}output.write(half4(a),pos); + 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=u.skinProtection.x>.5&&u.skinVisualize>.5?float3(dy_skinWeight(float3(0),dyToolEncode(b.a>0?b.rgb/b.a:float3(0)),u)*clamp(u.skinProtection.y*.01f,0.f,1.f)*a.a):dyToolDecode(c)*a.a;}output.write(half4(a),pos); } fragment half4 dyToolCopyFragment(DYRaster in [[stage_in]],texture2d source [[texture(0)]]){constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);return source.sample(f,in.uv);} diff --git a/大鱼调色/Plugin/DYToolRender.inc.h b/大鱼调色/Plugin/DYToolRender.inc.h index 414ef0f..f8eaf2b 100644 --- a/大鱼调色/Plugin/DYToolRender.inc.h +++ b/大鱼调色/Plugin/DYToolRender.inc.h @@ -38,7 +38,7 @@ idcb=[entry[@"queue"]commandBuffer];idce=[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]&&layer.skinFaceOnly<.5&&layer.skinVisualize<.5)return YES; MTLTextureDescriptor *desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:after.width height:after.height mipmapped:NO];desc.storageMode=MTLStorageModePrivate;desc.usage=MTLTextureUsageRenderTarget|MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite;idblend=[d newTextureWithDescriptor:desc];if(!blend)return fail(error,@"无法分配新增工具蒙版缓冲区"); - DYToolMaskHeader h{};h.section=3;h.faceOnly=layer.skinFaceOnly>.5;h.skinPreview=layer.skinVisualize>.5;idbuffer=[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; + DYToolMaskHeader h{};h.section=3;h.faceOnly=layer.skinFaceOnly>.5;h.skinPreview=layer.skinProtection.x>.5&&layer.skinVisualize>.5;idbuffer=[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)renderToolsSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){return DYRenderWithPool(error,[&]()->BOOL{ @@ -46,7 +46,7 @@ DYApplyRemovedBaseTools(&u,tools);paths=DYVisibleBaseToolPaths(paths,tools);if(DYBaseToolRemoved(tools,@"spider"))spider=nil; 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)&&!DYFilmToolActive(u)&&u.lensSectionEnabled<.5)return [self renderLegacy:src destination:dst uniforms:u paths:paths spider:spider masks:tools[@"baseMasks"] error:error]; + if(!active&&!DYChannelMixerActive(u)&&!DYFilmToolActive(u)&&(u.lensSectionEnabled<.5||(u.lensStrength==0&&u.lensScale==1)))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;idd=entry[@"device"];idinput=[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];} @@ -100,8 +100,8 @@ });}} - (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){ if(tools&&!DYValidToolDocument(tools))return fail(error,@"工具或蒙版数据损坏,未更改原工程");DYApplyRemovedBaseTools(&u,tools);paths=DYVisibleBaseToolPaths(paths,tools);if(DYBaseToolRemoved(tools,@"spider"))spider=nil; - if((u.lensSectionEnabled>.5&&(u.lensStrength!=0||u.lensScale!=1))||u.skinVisualize>.5)return fail(error,@"镜头修复与肤色区域显示无法保存到 Cube,请保存完整预设。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"lens"]&&!DYToolIsNeutral(node))return fail(error,@"镜头畸变属于空间处理,请保存完整预设。");} - DYUniforms effective=u;bypassNeutralTools(&effective);bypassIdleSkin(&effective);if(effective.skinFaceOnly>.5&&effective.skinProtection.x>.5&&effective.skinProtection.y>0)return fail(error,@"人脸限定肤色保护属于空间选区,Cube 无法保存。请保存完整预设,或关闭人脸限定后导出。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"skin"]&&layer.skinProtection.x>.5&&layer.skinProtection.y>0&&(layer.skinFaceOnly>.5||layer.skinVisualize>.5))return fail(error,@"新增肤色层含人脸空间选区,请保存完整预设。");} + if((u.lensSectionEnabled>.5&&(u.lensStrength!=0||u.lensScale!=1))||(u.skinProtection.x>.5&&u.skinVisualize>.5))return fail(error,@"镜头修复与肤色区域显示无法保存到 Cube,请保存完整预设。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"lens"]&&!DYToolIsNeutral(node))return fail(error,@"镜头畸变属于空间处理,请保存完整预设。");} + DYUniforms effective=u;if(![paths[@"input"]length]&&effective.inputProfile==0)effective.preLUTStrength=0;if(![paths[@"look0"]length])effective.postLUTStrength=0;for(int i=0;i<4;i++)if(![paths[[NSString stringWithFormat:@"look%d",i+1]]length])effective.extraPostLUTStrengths[i]=0;bypassNeutralTools(&effective);bypassIdleSkin(&effective);if(effective.skinFaceOnly>.5&&effective.skinProtection.x>.5&&effective.skinProtection.y>0)return fail(error,@"人脸限定肤色保护属于空间选区,Cube 无法保存。请保存完整预设,或关闭人脸限定后导出。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"skin"]&&layer.skinProtection.x>.5&&layer.skinProtection.y>0&&(layer.skinFaceOnly>.5||layer.skinVisualize>.5))return fail(error,@"新增肤色层含人脸空间选区,请保存完整预设。");} if(DYFilmToolActive(u)&&DYFilmSpatialActive(u.film))return fail(error,@"当前胶片含晕光、辉光、颗粒或暗角,无法完整保存到静态 Cube。请保存完整预设,或关闭这些处理后再导出。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"film"]&&DYFilmToolActive(layer)&&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; diff --git a/大鱼调色/Plugin/DYToolState.mm b/大鱼调色/Plugin/DYToolState.mm index 3866fde..1de363a 100644 --- a/大鱼调色/Plugin/DYToolState.mm +++ b/大鱼调色/Plugin/DYToolState.mm @@ -124,7 +124,7 @@ DYUniforms DYToolUniforms(NSDictionary *node){DYUniforms u;DYDefaultUniforms(&u) // new layers explicitly disable mapping so adding a neutral layer is identity. if([type isEqual:@"primary"]){u.primarySectionEnabled=1;u.cm.configured=1;u.cm.inputTransfer=u.cm.outputTransfer;u.cm.inputGamut=u.cm.outputGamut;u.cm.toneMapping=0;} 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:@"primary"]&&u.cm.toneMapping>.5)return NO;if([type isEqual:@"mixer"])return !DYChannelMixerActive(u);if([type isEqual:@"film"])return !DYFilmToolActive(u);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([type isEqual:@"primary"]&&[d[@"key"]isEqual:@"cmtoneMapping"]&&v.floatValue==0)continue;if(v&&v.floatValue!=[d[@"default"]floatValue])return NO;}return YES;} +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:@"primary"]&&u.cm.toneMapping>.5)return NO;if([type isEqual:@"lens"])return u.lensStrength==0&&u.lensScale==1;if([type isEqual:@"mixer"])return !DYChannelMixerActive(u);if([type isEqual:@"film"])return !DYFilmToolActive(u);if([type isEqual:@"skin"])return u.skinProtection.y==0&&u.skinVisualize<.5;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([type isEqual:@"primary"]&&[d[@"key"]isEqual:@"cmtoneMapping"]&&v.floatValue==0)continue;if(v&&v.floatValue!=[d[@"default"]floatValue])return NO;}return YES;} @implementation DYToolManager { id _host;NSString *_nodeID,*_type;NSInteger _depth;CMTime _time;NSMutableDictionary *_pending;DYInspectorToken *_token; diff --git a/大鱼调色/Plugin/DYUniforms.h b/大鱼调色/Plugin/DYUniforms.h index 47aa50d..d6c60f7 100644 --- a/大鱼调色/Plugin/DYUniforms.h +++ b/大鱼调色/Plugin/DYUniforms.h @@ -156,6 +156,7 @@ DY_ABI_ASSERT(offsetof(DYUniforms, film) == 1168, "1.5.0 film settings stay fixe DY_ABI_ASSERT(offsetof(DYUniforms, filmFrameKey) == 1284, "1.5.0 frozen frame key stays fixed"); DY_ABI_ASSERT(offsetof(DYUniforms, filmPrint) == 1296, "complete 1.5.0 prefix stays fixed"); DY_ABI_ASSERT(offsetof(DYUniforms, lensSectionEnabled) == 1312, "complete 1.10 prefix stays fixed"); +DY_ABI_ASSERT(sizeof(DYUniforms) == 1344, "1.11 append-only extension size"); 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"); diff --git a/大鱼调色/Plugin/DYViewerParameterPanel.inc.h b/大鱼调色/Plugin/DYViewerParameterPanel.inc.h index 7c1f02d..8a358a1 100644 --- a/大鱼调色/Plugin/DYViewerParameterPanel.inc.h +++ b/大鱼调色/Plugin/DYViewerParameterPanel.inc.h @@ -118,7 +118,7 @@ [self text:title rect:NSInsetRect(r,5*s,5*s) size:[kind isEqual:@"open"]?12:11 color:[kind isEqual:@"toolUnavailable"]?[ink colorWithAlphaComponent:.35]:ink alignment:NSTextAlignmentCenter]; } } - if(_open){NSString*hint=_catalog?@"选择当前工具的图层":(_graphMode&&[_toolType isEqual:@"curve"])?@"点击加点 · 拖动调整":(_graphMode&&[_toolType isEqual:@"grading"])?@"拖动色轮 · 参数查看亮度":@"拖动调节 · ↺ 还原";if(_hover==20000||_movingPanel)hint=@"拖动标题移动 · 单击折叠";[self text:hint rect:NSMakeRect(_panel.origin.x+40*s,NSMaxY(_panel)-22*s,_panel.size.width-168*s,18*s) size:9 color:ink alignment:NSTextAlignmentCenter];} + if(_open){NSString*hint=_catalog?@"选择当前工具的图层":(_graphMode&&[_toolType isEqual:@"curve"])?@"点击加点 · 拖动调整":(_graphMode&&[_toolType isEqual:@"grading"])?@"拖动色轮 · 参数查看亮度":@"拖动调节 · ↺ 还原";if(_graphMode&&[_toolType isEqual:@"hsl"])hint=@"拖动色点 · 参数精调";if(_graphMode&&[_toolType isEqual:@"spider"])hint=@"拖点联动 · 固定与还原选中点";if(_hover==20000||_movingPanel)hint=@"拖动标题移动 · 单击折叠";[self text:hint rect:NSMakeRect(_panel.origin.x+40*s,NSMaxY(_panel)-22*s,_panel.size.width-168*s,18*s) size:9 color:ink alignment:NSTextAlignmentCenter];} [NSGraphicsContext restoreGraphicsState]; } - (NSInteger)partAtPoint:(NSPoint)p{if(!_visible||!std::isfinite(p.x)||!std::isfinite(p.y)||!_bridge||!NSPointInRect(p,NSIntersectionRect(_panel,NSMakeRect(0,0,_size.width,_size.height))))return 0;for(NSDictionary*a in [_areas reverseObjectEnumerator])if(![a[@"kind"]isEqual:@"toolUnavailable"]&&NSPointInRect(p,[a[@"rect"]rectValue]))return [a[@"part"]integerValue];return _open&&NSPointInRect(p,_panel)?20006:0;} diff --git a/大鱼调色/Plugin/Info.plist b/大鱼调色/Plugin/Info.plist index 91ac436..03913ad 100644 --- a/大鱼调色/Plugin/Info.plist +++ b/大鱼调色/Plugin/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 1.10.0 + 1.11.0 CFBundleVersion - 72 + 73 NSHumanReadableCopyright PlugInKit @@ -71,7 +71,7 @@ uuid 1C17B73B-F229-4C09-A434-EAF6DFF5F22A version - 1.10.0 + 1.11.0 className diff --git a/大鱼调色/Wrapper Application/Info.plist b/大鱼调色/Wrapper Application/Info.plist index 0a4ee6b..c144bac 100644 --- a/大鱼调色/Wrapper Application/Info.plist +++ b/大鱼调色/Wrapper Application/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.10.0 + 1.11.0 CFBundleVersion - 72 + 73 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright