WIP verify eight print-look resources and append compatible controls
这个提交包含在:
1 父节点
e7fa8e6cf5
当前提交
7d895750cf
18 个文件已更改
+248
-7
没有与搜索条件相匹配的文件
@@ -0,0 +1,21 @@
|
||||
# 八种印片外观:1.6.0接续
|
||||
|
||||
2026-11-02。用户补充明确纳入八种印片外观,接续已交付1.5.0(34);基线main `e7fa8e6cf5690395272cbb76d7698dba77883b01`,正式版在开发期间保留。
|
||||
|
||||
## 参考取证
|
||||
|
||||
本机Color Finale 2.16.2(625),RenderingEngine SHA `32dca93459347e5ad363cb145d0ccf84b933b2045eee2c9535676a01744b84e3`,GradeKit SHA `e868a8c6df64bf03b7c24af5657c5ac7a2259a1943dfe06e01dbb7881df018a3`。REA/Ghidra12.1.4只读分析,两个会话均已关闭。快照在本机ColorResearch的 `dayu-print-rendering-snapshot-20261102.json` / `dayu-print-gradekit-snapshot-20261102.json`,原版运行探针和导出留在同目录的 `dayu-film-mixer-20261102/print-reference`。
|
||||
|
||||
- 资源装载与binary16转RGBA32:`ev_2963c6285fc85f3255d57d56657e98c3a81446bd0d0cafa5046d6298b84af7cb`;65³红轴最快。独立解码后八份RGBA32全部与原版 `cubeData` 逐字节一致,摘要见 `PrintLooksResources.json`。移入产品的只有重新封装的数值数据,没有原版可执行文件、framework或shader。
|
||||
- 原版LMT processor:`ev_64067f2914fc23f8e1e2a47a9a272076b4c7842907dfde08a6308de87d46904e`;Metal AIR `FTAcesLMT` 用0–1限幅、六分支四面体插值,保留预乘alpha。
|
||||
- 顺序:`ev_b38658366c168d4336e0998f030a8024b73f79119b764eff1df82fc822118462`,stack转换→LMT→ODT;stack曲线合同 `ev_9993ec73114bb2de791e5ddb43bc422ad4666b34e40dd0d2d9e2326ddb8ba27e`。
|
||||
- 默认工作空间明确为ACEScct:`ev_7f30f36b78c55e71b807e378fd6b53e6d0f75db2123160d35800b6b60dcf788b`。ACEScc仅是未指定时的旧回退,不替代当前默认。
|
||||
- `inspect_colorfinale_print --matrix` 通过原版FTColorSpaceFilter核对Rec.709线性↔ACEScg(AP1/D60)矩阵,白点往返为1;Core Image上下方向另由输出对照控制。
|
||||
|
||||
## 接入合同
|
||||
|
||||
在胶片五处理之后、全胶片mix和蒙版之前追加印片点阶段。沿用本工程显示链宿主线性Rec.709边界,转换AP1/D60→ACEScct→原LMT四面体采样→ACEScct解码→线性Rec.709;按印片强度混合,再沿用总强度与原蒙版。这是独立模块接入,不将原版任意ACES ODT或完整CMS偷偷移入旧链。
|
||||
|
||||
新增第六页“印片”,默认无,八项Kodak2383/2393/2302 BW、Fuji3510/3513/3519/3521、AgfaCP30;旧参数、1.5.0的1296字节前缀及颗粒时间位置保留。预设v6继续读旧版本,新参数缺省中性,独立层默认无。印片是逐像素变换,可写入静态Cube;空间、时间和蒙版限制继续保留。
|
||||
|
||||
当前为WIP检查点,渲染接入、图像对照与正式交付尚未完成,不能凭资源导入称为完成。
|
||||
@@ -0,0 +1,97 @@
|
||||
{
|
||||
"referenceVersion": "2.16.2 (625)",
|
||||
"referenceSHA256": "32dca93459347e5ad363cb145d0ccf84b933b2045eee2c9535676a01744b84e3",
|
||||
"tables": [
|
||||
{
|
||||
"index": 1,
|
||||
"name": "kodak_2383",
|
||||
"side": 65,
|
||||
"sourceSHA256": "9224997a8996a1c4d44ad489d66b3886e8137924f019e7001b3491b22020c269",
|
||||
"rgba32SHA256": "462407f0105a9588d78306f136dc1aacabadb8ac51771c540c9be2d7a85da06f",
|
||||
"bytes": 1256178,
|
||||
"sha256": "466a88c64ce7c96255acb081b5ff68bb02ba53cbfa54561fece5ef09397df666",
|
||||
"resource": "\u5927\u9c7c\u8c03\u8272/Plugin/Resources/PrintLooks/kodak_2383.dylut",
|
||||
"nativeCubeDataByteIdentical": true
|
||||
},
|
||||
{
|
||||
"index": 2,
|
||||
"name": "kodak_2393",
|
||||
"side": 65,
|
||||
"sourceSHA256": "6bf05ba88600cf4597b8969e030179db2baef08b638ca05654df3c2472df06dd",
|
||||
"rgba32SHA256": "024e046ac2d4fad2493b1ba17de6b9269ea2ce2924ad0801700a57651fa2ff5b",
|
||||
"bytes": 1239890,
|
||||
"sha256": "fc49e73830eb12763cab29329de8485ba85476ec5823ce967e2d0d5e089984cc",
|
||||
"resource": "\u5927\u9c7c\u8c03\u8272/Plugin/Resources/PrintLooks/kodak_2393.dylut",
|
||||
"nativeCubeDataByteIdentical": true
|
||||
},
|
||||
{
|
||||
"index": 3,
|
||||
"name": "kodak_2302_bw",
|
||||
"side": 65,
|
||||
"sourceSHA256": "00c4841c2f7fb1e40fe6452935b7c133a628fc8b41990aedfdc457907eeb1472",
|
||||
"rgba32SHA256": "6ef56e8e0ea4c16c1c333471db1ad3898335f2b336b7f1a76c8da4f7ac759ab0",
|
||||
"bytes": 466705,
|
||||
"sha256": "69e995a585b8386426b11f1839d817866194ceca34caab9dda4bf691b233ef33",
|
||||
"resource": "\u5927\u9c7c\u8c03\u8272/Plugin/Resources/PrintLooks/kodak_2302_bw.dylut",
|
||||
"nativeCubeDataByteIdentical": true
|
||||
},
|
||||
{
|
||||
"index": 4,
|
||||
"name": "fuji_3510",
|
||||
"side": 65,
|
||||
"sourceSHA256": "bd39cdd4e719a6fafdc7097e15d81ddb58a388f4a1c28bf147ce9a1cb7ecb28b",
|
||||
"rgba32SHA256": "b8658f5a0659f3a72bb98a3d171b90d20fe960a27d5220177ec8639fdd6b279e",
|
||||
"bytes": 1256103,
|
||||
"sha256": "2383db3a8e4c523af09d952709b3638459c9bef710080f787756d1c8cba26daf",
|
||||
"resource": "\u5927\u9c7c\u8c03\u8272/Plugin/Resources/PrintLooks/fuji_3510.dylut",
|
||||
"nativeCubeDataByteIdentical": true
|
||||
},
|
||||
{
|
||||
"index": 5,
|
||||
"name": "fuji_3513",
|
||||
"side": 65,
|
||||
"sourceSHA256": "58eb01a447c21f4670765e435cdb7fddf3b3b4e042a76b30b91a906413723d6b",
|
||||
"rgba32SHA256": "946a1fbbbd9ddcbb98f9a3227e42d9e31cb15191051047134c7a69adc5c069d6",
|
||||
"bytes": 1233606,
|
||||
"sha256": "56c281c30f21c3344d21195ba16a5d8b850f5493cf487f4511929d036f6abdcf",
|
||||
"resource": "\u5927\u9c7c\u8c03\u8272/Plugin/Resources/PrintLooks/fuji_3513.dylut",
|
||||
"nativeCubeDataByteIdentical": true
|
||||
},
|
||||
{
|
||||
"index": 6,
|
||||
"name": "fuji_3519",
|
||||
"side": 65,
|
||||
"sourceSHA256": "84ace607eefdac45c7f6b9c6ffe50271d70f7bbe56223dc47de19900ae9401c6",
|
||||
"rgba32SHA256": "01ea1984dc24998735ab42034f8d7bd19ef9f4c001f748e39a91c8923f1d6b1f",
|
||||
"bytes": 1231622,
|
||||
"sha256": "8c4891cc331634a36dbf40ead21c78f4a1dbd5283d29f351a43aadd6615040ee",
|
||||
"resource": "\u5927\u9c7c\u8c03\u8272/Plugin/Resources/PrintLooks/fuji_3519.dylut",
|
||||
"nativeCubeDataByteIdentical": true
|
||||
},
|
||||
{
|
||||
"index": 7,
|
||||
"name": "fuji_3521",
|
||||
"side": 65,
|
||||
"sourceSHA256": "ac13b327ea6a2d5752b201f3cf0ecea1df375341935b6a3aa3c9494c0b6b866b",
|
||||
"rgba32SHA256": "592dd37648e2568e3747714bc87590126dac052e4b06f839d09590c462e86c00",
|
||||
"bytes": 1267728,
|
||||
"sha256": "8b508f5e2168657814f533c281d234a374299503f8abed5da769ac9989438e4e",
|
||||
"resource": "\u5927\u9c7c\u8c03\u8272/Plugin/Resources/PrintLooks/fuji_3521.dylut",
|
||||
"nativeCubeDataByteIdentical": true
|
||||
},
|
||||
{
|
||||
"index": 8,
|
||||
"name": "agfa_cp30",
|
||||
"side": 65,
|
||||
"sourceSHA256": "62b71c675e89ce161e4ad5cc37ffa28d882b1b724de4bb15a30da70fb3daa0d9",
|
||||
"rgba32SHA256": "744b01a229f4132aa5a95c468aad7d25d8d9407ddc28771d0398369bdcdba6e5",
|
||||
"bytes": 1276279,
|
||||
"sha256": "55f6c58df7959bbc2cf9c2d2893d6971674f13a257dbd4c2d2a285136279cd56",
|
||||
"resource": "\u5927\u9c7c\u8c03\u8272/Plugin/Resources/PrintLooks/agfa_cp30.dylut",
|
||||
"nativeCubeDataByteIdentical": true
|
||||
}
|
||||
],
|
||||
"cubeOrder": "red fastest; green; blue",
|
||||
"interpolation": "tetrahedral (six cases)",
|
||||
"sourceRole": "data only; no reference executable or shader shipped"
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Import the eight identity-verified local LMT tables into standalone Dayu data.
|
||||
|
||||
Run inspect_colorfinale_print --export first. Independent half decoding must
|
||||
match every float returned by the installed reference's own cubeData property.
|
||||
No vendor executable or shader is copied into the product.
|
||||
"""
|
||||
from pathlib import Path
|
||||
import argparse
|
||||
import array
|
||||
import hashlib
|
||||
import json
|
||||
import math
|
||||
import struct
|
||||
import zlib
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
REFERENCE = Path('/Applications/ColorFinale.app/Contents/PlugIns/ColorFinale.pluginkit/Contents/Frameworks/RenderingEngine.framework/Versions/A')
|
||||
IDENTITY = '32dca93459347e5ad363cb145d0ccf84b933b2045eee2c9535676a01744b84e3'
|
||||
NAMES = ['kodak_2383', 'kodak_2393', 'kodak_2302_bw', 'fuji_3510', 'fuji_3513', 'fuji_3519', 'fuji_3521', 'agfa_cp30']
|
||||
|
||||
|
||||
def digest(data):
|
||||
return hashlib.sha256(data).hexdigest()
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--reference-export', required=True, type=Path)
|
||||
args = parser.parse_args()
|
||||
assert digest((REFERENCE / 'RenderingEngine').read_bytes()) == IDENTITY, 'Reference identity changed'
|
||||
output = ROOT / '\u5927\u9c7c\u8c03\u8272/Plugin/Resources/PrintLooks'
|
||||
output.mkdir(parents=True, exist_ok=True)
|
||||
records = []
|
||||
for number, name in enumerate(NAMES, 1):
|
||||
source = (REFERENCE / 'Resources' / (name + '.lmt')).read_bytes()
|
||||
# Observed local resource format: repeated SHA256 mask, RGB binary16,
|
||||
# 65 cubed, red axis fastest. The literal prefix is exactly 23 bytes.
|
||||
mask = hashlib.sha256(b'FT.ColorFinale.LMT.2026' + name.encode()).digest()
|
||||
half = bytes(value ^ mask[index % 32] for index, value in enumerate(source))
|
||||
assert len(half) == 65**3 * 6
|
||||
floats = array.array('f')
|
||||
for pixel in struct.iter_unpack('<eee', half):
|
||||
assert all(math.isfinite(value) for value in pixel)
|
||||
floats.extend((*pixel, 1.0))
|
||||
if struct.pack('=I', 1) != struct.pack('<I', 1):
|
||||
floats.byteswap()
|
||||
raw = floats.tobytes()
|
||||
assert raw == (args.reference_export / (name + '.rgba32f')).read_bytes(), name + ': native cubeData mismatch'
|
||||
blob = struct.pack('<4sII6f', b'DYLT', 65, len(raw), 0, 0, 0, 1, 1, 1) + zlib.compress(raw, 9)
|
||||
destination = output / (name + '.dylut')
|
||||
destination.write_bytes(blob)
|
||||
records.append(dict(index=number, name=name, side=65, sourceSHA256=digest(source), rgba32SHA256=digest(raw),
|
||||
bytes=len(blob), sha256=digest(blob), resource=str(destination.relative_to(ROOT)),
|
||||
nativeCubeDataByteIdentical=True))
|
||||
manifest = dict(referenceVersion='2.16.2 (625)', referenceSHA256=IDENTITY, tables=records,
|
||||
cubeOrder='red fastest; green; blue', interpolation='tetrahedral (six cases)',
|
||||
sourceRole='data only; no reference executable or shader shipped')
|
||||
(ROOT / 'research/PrintLooksResources.json').write_text(json.dumps(manifest, indent=2) + '\n')
|
||||
print(json.dumps(dict(tables=len(records), bytes=sum(item['bytes'] for item in records), nativeCubeDataByteIdentical=True)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,48 @@
|
||||
// Read-only reference metadata probe; never linked into the product.
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreImage/CoreImage.h>
|
||||
#import <objc/runtime.h>
|
||||
#import <objc/message.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";
|
||||
if(!dlopen(path.fileSystemRepresentation,RTLD_NOW|RTLD_LOCAL)){fprintf(stderr,"%s\n",dlerror());return 1;}
|
||||
NSMutableDictionary *out=[NSMutableDictionary dictionary];
|
||||
if(argc==2&&strcmp(argv[1],"--matrix")==0){
|
||||
Class space=NSClassFromString(@"FTColorSpace");id from=((id(*)(id,SEL))objc_msgSend)((id)space,sel_registerName("Rec709Linear"));id to=((id(*)(id,SEL))objc_msgSend)((id)space,sel_registerName("ACEScg"));
|
||||
CIContext *context=[CIContext contextWithOptions:@{kCIContextWorkingColorSpace:NSNull.null,kCIContextOutputColorSpace:NSNull.null}];
|
||||
float input[16]={1,0,0,1,0,1,0,1,0,0,1,1,1,1,1,1};
|
||||
for(int direction=0;direction<2;direction++){
|
||||
CIFilter *f=((id(*)(id,SEL,id,id))objc_msgSend)((id)NSClassFromString(@"FTColorSpaceFilter"),sel_registerName("filterFromColorSpace:toColorSpace:"),direction?to:from,direction?from:to);
|
||||
if(!f)return 5;[f setValue:[CIImage imageWithBitmapData:[NSData dataWithBytes:input length:sizeof(input)] bytesPerRow:sizeof(input) size:CGSizeMake(4,1) format:kCIFormatRGBAf colorSpace:nil]forKey:kCIInputImageKey];float result[16]={};[context render:f.outputImage toBitmap:result rowBytes:sizeof(result) bounds:CGRectMake(0,0,4,1) format:kCIFormatRGBAf colorSpace:nil];
|
||||
NSMutableArray *values=[NSMutableArray array];for(int i=0;i<16;i++)[values addObject:@(result[i])];out[direction?@"AP1-to-709":@"709-to-AP1"]=values;
|
||||
}
|
||||
NSData *json=[NSJSONSerialization dataWithJSONObject:out options:NSJSONWritingPrettyPrinted error:nil];fwrite(json.bytes,1,json.length,stdout);return 0;
|
||||
}
|
||||
if(argc==3&&strcmp(argv[1],"--export")==0){
|
||||
NSString *directory=@(argv[2]);[[NSFileManager defaultManager]createDirectoryAtPath:directory withIntermediateDirectories:YES attributes:nil error:nil];
|
||||
NSMutableArray *exports=[NSMutableArray array];
|
||||
for(NSString *name in @[@"kodak_2383",@"kodak_2393",@"kodak_2302_bw",@"fuji_3510",@"fuji_3513",@"fuji_3519",@"fuji_3521",@"agfa_cp30"]){
|
||||
id filter=((id(*)(id,SEL,id))objc_msgSend)((id)NSClassFromString(@"FTAcesLMTFilter"),sel_registerName("filterWithLMT:"),name);
|
||||
NSData *data=[filter valueForKey:@"cubeData"];if(data.length!=65*65*65*16)return 3;
|
||||
NSString *destination=[directory stringByAppendingPathComponent:[name stringByAppendingString:@".rgba32f"]];
|
||||
if(![data writeToFile:destination atomically:YES])return 4;
|
||||
[exports addObject:@{@"name":name,@"bytes":@(data.length),@"path":destination}];
|
||||
}
|
||||
NSData *json=[NSJSONSerialization dataWithJSONObject:exports options:NSJSONWritingPrettyPrinted error:nil];fwrite(json.bytes,1,json.length,stdout);return 0;
|
||||
}
|
||||
for(NSString *name in @[@"FTAcesLMTFilter",@"FTLMTCIImageProcessor",@"FTCubeProcessor",@"FTCubeCIImageProcessor",@"FTColorCubeFilter",@"FTAcesTypes",@"FTColorSpace"]){
|
||||
Class cls=NSClassFromString(name);if(!cls)continue;
|
||||
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;
|
||||
}
|
||||
unsigned n=0;Ivar *ivars=class_copyIvarList(cls,&n);NSMutableArray *ivs=[NSMutableArray array];
|
||||
for(unsigned i=0;i<n;i++)[ivs addObject:@{@"name":@(ivar_getName(ivars[i])),@"type":@(ivar_getTypeEncoding(ivars[i])),@"offset":@(ivar_getOffset(ivars[i]))}];free(ivars);entry[@"ivars"]=ivs;
|
||||
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;
|
||||
}}
|
||||
@@ -9,6 +9,8 @@ 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 bool DYFilmPrintActive(DYUniforms u){return u.film.enabled>.5f&&u.film.mix>0&&u.filmPrint.x>=1&&u.filmPrint.x<=8&&u.filmPrint.y>0;}
|
||||
inline bool DYFilmToolActive(DYUniforms u){return DYFilmActive(u.film)||DYFilmPrintActive(u);}
|
||||
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;}
|
||||
|
||||
@@ -580,7 +580,7 @@ static NSImage *DYWheelImage(void) {
|
||||
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];
|
||||
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];
|
||||
@@ -1069,7 +1069,7 @@ static NSImage *DYWheelImage(void) {
|
||||
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);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":@5,@"values":values,@"paths":paths,@"spider":spider,@"tools":tools?:@""};
|
||||
return @{@"format":@"com.dayu.color.preset",@"version":@6,@"values":values,@"paths":paths,@"spider":spider,@"tools":tools?:@""};
|
||||
}
|
||||
- (void)savePreset:(id)sender {
|
||||
NSDictionary *snapshot=[self presetSnapshot];if(!snapshot)return;
|
||||
@@ -1084,7 +1084,7 @@ static NSImage *DYWheelImage(void) {
|
||||
NSError *error=nil;NSData *data=[NSData dataWithContentsOfURL:panel.URL options:0 error:&error];
|
||||
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,@4,@5]containsObject:json[@"version"]]||![json[@"values"] isKindOfClass:NSDictionary.class]||![json[@"paths"] isKindOfClass:NSDictionary.class]){[self showError:@"这不是有效的大鱼调色预设。"];return;}
|
||||
if(![json isKindOfClass:NSDictionary.class]||![json[@"format"] isEqual:@"com.dayu.color.preset"]||![@[@1,@2,@3,@4,@5,@6]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()) {
|
||||
|
||||
@@ -180,6 +180,10 @@ static void initialize(){static dispatch_once_t once;dispatch_once(&once,^{
|
||||
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);
|
||||
NSMutableDictionary *printLook=[[row(@"filmPrintLook",@"印片外观",offsetof(DYUniforms,filmPrint),0,8,0,@"popup")mutableCopy]autorelease];
|
||||
printLook[@"filmTab"]=@5;printLook[@"notAnimatable"]=@YES;printLook[@"values"]=@[@0,@1,@2,@3,@4,@5,@6,@7,@8];printLook[@"options"]=@[@"无",@"Kodak 2383",@"Kodak 2393",@"Kodak 2302 BW",@"Fuji 3510",@"Fuji 3513",@"Fuji 3519",@"Fuji 3521",@"Agfa CP30"];
|
||||
[descriptors replaceObjectAtIndex:descriptors.count-1 withObject:printLook];[film addObject:printLook];
|
||||
NSMutableDictionary *printStrength=[[row(@"filmPrintStrength",@"印片强度",offsetof(DYUniforms,filmPrint)+sizeof(float),0,1,1,@"float")mutableCopy]autorelease];printStrength[@"filmTab"]=@5;[descriptors replaceObjectAtIndex:descriptors.count-1 withObject:printStrength];[film addObject:printStrength];
|
||||
section(@"film",@"胶片模拟",offsetof(DYUniforms,film)+offsetof(DYFilmSettings,enabled),film);
|
||||
#undef FR
|
||||
#undef FE
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
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];
|
||||
if(!active&&!DYChannelMixerActive(u)&&!DYFilmToolActive(u))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];}
|
||||
@@ -90,14 +90,14 @@
|
||||
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;}
|
||||
for(NSString *type in @[@"mixer",@"film"]){BOOL enabled=[type isEqual:@"mixer"]?DYChannelMixerActive(u):DYFilmToolActive(u);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。请保存完整预设。");}
|
||||
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;
|
||||
}}
|
||||
@@ -72,7 +72,7 @@ DYUniforms DYToolUniforms(NSDictionary *node){DYUniforms u;DYDefaultUniforms(&u)
|
||||
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;}
|
||||
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 !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(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;
|
||||
|
||||
@@ -131,6 +131,7 @@ typedef struct DYUniforms {
|
||||
float mixerSectionEnabled,mixerPreserveLuma,mixerPreserveSaturation,mixerMix;
|
||||
DYFilmSettings film;
|
||||
DYUInt filmFrameKey; // frozen render time, never an author parameter
|
||||
DYFloat4 filmPrint; // appended after the complete 1.5.0 prefix: look, strength, reserved, reserved
|
||||
} DYUniforms;
|
||||
|
||||
typedef struct DYVertex2D { DYFloat2 position; DYFloat2 textureCoordinate; } DYVertex2D;
|
||||
@@ -148,6 +149,10 @@ typedef struct DYRenderOptions {
|
||||
#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, film) == 1168, "1.5.0 film settings stay fixed");
|
||||
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(sizeof(DYUniforms) == 1312, "1.6.0 uniform 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");
|
||||
|
||||
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
在新工单中引用
屏蔽一个用户