WIP integrate eight print looks; pass 393 native checks, reference comparison pending

这个提交包含在:
mac 于 2026-11-02 14:33:33 +08:00 提交
1 父节点 7d895750cf
当前提交 ab7cb759e5
13 个文件已更改
+2199 -16

没有与搜索条件相匹配的文件

@@ -39,5 +39,40 @@
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)});
// Exercise the shipped print resources through the complete production path.
// The separate installed-reference oracle checks interpolation and color math.
NSArray *printNames=@[@"kodak_2383",@"kodak_2393",@"kodak_2302_bw",@"fuji_3510",@"fuji_3513",@"fuji_3519",@"fuji_3521",@"agfa_cp30"];
std::vector<Pixels> printFrames;BOOL printFramesDistinct=YES;
DYUniforms printValue=neutral;printValue.film.enabled=1;printValue.filmPrint.y=1;
for(NSUInteger index=0;index<printNames.count;index++){
NSString *resource=[[NSBundle bundleForClass:renderer.class]pathForResource:printNames[index] ofType:@"dylut" inDirectory:@"PrintLooks"];std::vector<float> table;NSUInteger side=0;error=nil;
BOOL resourceOK=resource&&DYLUTReadCube(resource,table,side,&error)&&side==65&&table.size()==65*65*65*4;
run.record([NSString stringWithFormat:@"print-%lu-shipped-65cube",(unsigned long)index+1],resourceOK,@{@"error":reason(error),@"side":@(side)});
printValue.filmPrint.x=index+1;Pixels printed=filmRender(printValue,nil,[NSString stringWithFormat:@"print-%lu-production-render",(unsigned long)index+1]);Difference change=difference(before,printed);BOOL sameAlpha=YES;
for(size_t pixel=0;pixel<printed.size()/4;pixel++)sameAlpha&=printed[pixel*4+3]==before[pixel*4+3];
run.record([NSString stringWithFormat:@"print-%lu-active-finite-preserves-alpha",(unsigned long)index+1],change.different>20&&change.nonfinite==0&&sameAlpha,measure(change));
for(const Pixels& previous:printFrames)printFramesDistinct&=difference(previous,printed).different>20;printFrames.push_back(printed);
}
run.record(@"all-eight-print-looks-have-distinct-production-output",printFramesDistinct);
printValue.filmPrint.y=0;bypass=filmRender(printValue,nil,@"print-zero-strength-render");run.record(@"print-zero-strength-exact-old-frame",difference(before,bypass).maximum==0);
printValue.filmPrint.y=1;printValue.film.mix=0;bypass=filmRender(printValue,nil,@"print-zero-film-mix-render");run.record(@"print-zero-film-mix-exact-old-frame",difference(before,bypass).maximum==0);
printValue.film.mix=1;printValue.film.enabled=0;bypass=filmRender(printValue,nil,@"print-eye-off-render");run.record(@"print-eye-off-exact-old-frame",difference(before,bypass).maximum==0);printValue.film.enabled=1;
DYUniforms freshPrint=DYToolUniforms(DYNewTool(@"film"));run.record(@"new-film-layer-print-default-is-none",freshPrint.filmPrint.x==0&&freshPrint.filmPrint.y==1&&DYToolIsNeutral(DYNewTool(@"film")));
NSMutableDictionary *printDoc=DYMutablePlist(empty.document),*printLayer=(id)DYInsertTool(printDoc,@"film",@"base:film");printLayer[@"values"][@"filmPrintLook"]=@2;
run.record(@"print-only-independent-layer-is-active",DYValidToolDocument(printDoc)&&!DYToolIsNeutral(printLayer)&&DYFilmPrintActive(DYToolUniforms(printLayer)));
Pixels printLayerFrame=filmRender(neutral,printDoc,@"print-only-independent-layer-render");run.record(@"print-only-independent-layer-affects-frame",difference(before,printLayerFrame).different>20);
NSMutableDictionary *secondPrintLayer=(id)DYInsertTool(printDoc,@"film",printLayer[@"id"]);secondPrintLayer[@"values"][@"filmPrintLook"]=@8;secondPrintLayer[@"values"][@"filmPrintStrength"]=@.4;
DYToolDocument *printSaved=[[[DYToolDocument alloc]init]autorelease];printSaved.document=printDoc;error=nil;NSData *printArchive=[NSKeyedArchiver archivedDataWithRootObject:printSaved requiringSecureCoding:YES error:&error];DYToolDocument *printRestored=[NSKeyedUnarchiver unarchivedObjectOfClass:DYToolDocument.class fromData:printArchive error:&error];
DYUniforms firstRestored=DYToolUniforms(DYToolWithID(printRestored.document,printLayer[@"id"])),secondRestored=DYToolUniforms(DYToolWithID(printRestored.document,secondPrintLayer[@"id"]));
run.record(@"two-print-layers-archive-independent-choices-and-strength",[printSaved isEqual:printRestored]&&firstRestored.filmPrint.x==2&&firstRestored.filmPrint.y==1&&secondRestored.filmPrint.x==8&&secondRestored.filmPrint.y==.4f,@{@"error":reason(error)});
Pixels twoPrintLayers=filmRender(neutral,printRestored.document,@"two-print-layers-production-render");run.record(@"second-print-layer-is-rendered-independently",difference(printLayerFrame,twoPrintLayers).different>20);
Pixels printZeroMask=filmRender(printValue,baseMask,@"print-zero-mask-render");run.record(@"print-zero-mask-exact-source",difference(before,printZeroMask).maximum==0);
printValue.filmPrint.x=1;error=nil;BOOL printExported=[renderer exportLUT:cube uniforms:printValue paths:@{} spider:nil tools:empty.document error:&error];run.record(@"print-only-static-cube-supported",printExported,@{@"error":reason(error)});
std::vector<float> printCubeValues;NSUInteger printCubeSide=0;error=nil;BOOL printCubeParsed=printExported&&DYLUTReadCube(cube.path,printCubeValues,printCubeSide,&error)&&printCubeSide==33;
Pixels printCubeInput(input.size());float printCodes[3]={.5f,.25f,.75f};for(size_t pixel=0;pixel<printCubeInput.size()/4;pixel++){for(int channel=0;channel<3;channel++){float code=printCodes[channel];printCubeInput[pixel*4+channel]=code<=.04045f?code/12.92f:powf((code+.055f)/1.055f,2.4f);}printCubeInput[pixel*4+3]=1;}
uploadFilm(printCubeInput);Pixels printCubeRendered=filmRender(printValue,nil,@"print-cube-production-lattice-point");BOOL printCubeMatches=printCubeParsed&&printCubeValues.size()==33*33*33*4;
for(int channel=0;channel<3&&printCubeMatches;channel++){float code=printCubeValues[((24*33+8)*33+16)*4+channel],linear=code<=.04045f?code/12.92f:powf((code+.055f)/1.055f,2.4f);printCubeMatches&=fabs(linear-(float)printCubeRendered[channel])<.0005;}
run.record(@"print-static-cube-matches-production-lattice-point",printCubeMatches,@{@"side":@(printCubeSide),@"error":reason(error)});
printValue.film.grainEnabled=1;printValue.film.grainAmount=.5;error=nil;run.record(@"print-with-grain-still-rejected-by-static-cube",![renderer exportLUT:cube uniforms:printValue paths:@{} spider:nil tools:empty.document error:&error]&&error!=nil);
uploadFilm(input);
}