修复 LUT 浏览器帧比例和会话内排序

这个提交包含在:
mac 于 2026-11-08 21:03:09 +08:00 提交
1 父节点 5c0f177bde
当前提交 b7c2e291ec
18 个文件已更改
+205 -139

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

+10 -6
查看文件
@@ -1,11 +1,15 @@
- (void)managedPreview:(id<MTLTexture>)texture origin:(FxImageOrigin)origin entry:(NSMutableDictionary*)entry {
@synchronized(_previewLock){if(_exporting||CACurrentMediaTime()-_lastPreview<=.5)return;}
- (void)managedPreview:(id<MTLTexture>)texture source:(FxImageTile*)source entry:(NSMutableDictionary*)entry {
NSSize size=DYLookSampleSize(texture,source.pixelAspect,DYLookPreviewStandardEdge);
@synchronized(_previewLock){if(_exporting||(NSEqualSizes(size,_lastLookPreviewSize)&&CACurrentMediaTime()-_lastPreview<=.5))return;}
id<MTLComputePipelineState>p=[self computePipeline:@"dyManagedPreview" entry:entry error:nil];if(!p)return;
id<MTLBuffer>b=[entry[@"device"]newBufferWithLength:320*180*16 options:MTLResourceStorageModeShared];if(!b)return;
id<MTLBuffer>b=[[entry[@"device"]newBufferWithLength:320*180*16 options:MTLResourceStorageModeShared]autorelease];if(!b)return;
id<MTLCommandBuffer>cb=[entry[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>ce=[cb computeCommandEncoder];[ce setComputePipelineState:p];[ce setTexture:texture atIndex:0];[ce setBuffer:b offset:0 atIndex:0];[ce dispatchThreads:MTLSizeMake(320,180,1) threadsPerThreadgroup:MTLSizeMake(8,8,1)];[ce endEncoding];
id<MTLBuffer>lookHD=[self encodeLookHD:texture inputLUT:nil strength:0 origin:origin entry:entry commands:cb];
FxImageOrigin origin=source.imageOrigin;
id<MTLBuffer>standard=NSEqualSizes(size,NSMakeSize(320,180))?nil:[self encodeLookPreview:texture inputLUT:nil strength:0 size:size standard:YES origin:origin entry:entry commands:cb];
NSSize highSize=DYLookSampleSize(texture,source.pixelAspect,DYLookPreviewHighEdge);
id<MTLBuffer>high=[self encodeLookPreview:texture inputLUT:nil strength:0 size:highSize standard:NO origin:origin entry:entry commands:cb];
[cb commit];[cb waitUntilCompleted];
if(cb.status==MTLCommandBufferStatusCompleted){@synchronized(_previewLock){[_preview release];_preview=[[NSData alloc]initWithBytes:b.contents length:b.length];[_lookLUTPreview release];if(origin==kFxImageOrigin_BOTTOM_LEFT){NSMutableData *flipped=[NSMutableData dataWithLength:b.length];for(NSUInteger y=0;y<180;y++)memcpy((uint8_t*)flipped.mutableBytes+y*320*16,(uint8_t*)b.contents+(179-y)*320*16,320*16);_lookLUTPreview=[flipped copy];}else _lookLUTPreview=[_preview retain];[self replaceLookHDBuffer:lookHD];_lastPreview=CACurrentMediaTime();}dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:@"DYPreviewDidChange" object:self];});}[b release];
if(cb.status==MTLCommandBufferStatusCompleted)[self publishPreview:b standard:standard size:size high:high highSize:highSize origin:origin];
}
// Included in DYRenderer. V1 callers and their ABI remain on renderSource:...tools:error:.
- (NSDictionary*)colorContext {@synchronized(_previewLock){return [[_colorContext copy]autorelease];}}
@@ -142,7 +146,7 @@
NSDictionary *finishPaths=DYVisibleBaseToolPaths(paths,finishing);
NSArray *activeFinish=DYManagedActiveFinishing(u,finishPaths,spider,finishing);
if(((mode!=1&&(output==6||output==7))||(mode==1&&primaries==kFxColorPrimaries_Rec2020))&&activeFinish.count)return fail(error,@"HDR 输出或跟随 Rec.2020 宿主时,目前支持一级调色与印片。请关闭 SDR 修饰工具;需要这些工具时,请明确选择 SDR 输出。");
[self managedPreview:current origin:src.imageOrigin entry:entry];
[self managedPreview:current source:src entry:entry];
if(activeFinish.count){id<MTLTexture>out=next();if(!out)return fail(error,@"无法分配显示域修饰缓冲区。");_managedFinishing=YES;BOOL ok=NO;@try{ok=[self renderSource:tile(current) destination:tile(out) uniforms:u paths:finishPaths spider:spider tools:finishing error:error];}@finally{_managedFinishing=NO;}if(!ok)return NO;current=out;}
DYColorProfile*returnProfile=[[[DYColorProfile alloc]initWithSource:linear709 target:dstSpace error:error]autorelease];if(!profile(returnProfile))return NO;
_managedFinishing=YES;@try{return [self copyTile:tile(current) to:dst entry:entry error:error];}@finally{_managedFinishing=NO;}