feat: overlay live vectorscope on spider disc and default skin protection off

这个提交包含在:
mac 于 2026-11-08 15:09:04 +08:00 提交
1 父节点 b34ef54ad8
当前提交 01efcc8a29
43 个文件已更改
+281 -67

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

+39 -10
查看文件
@@ -18,24 +18,53 @@
- (NSDictionary *)scopeMetadata{@synchronized(_previewLock){return [[_scopeMetadata retain]autorelease];}}
- (NSData*)outputHistogram{
DYScopeSample *sample=nil;
@synchronized(_previewLock){_outputHistogramObserved=YES;sample=[[_scopeLatest retain]autorelease];}
@synchronized(_previewLock){_outputObserved=YES;sample=[[_scopeLatest retain]autorelease];}
return sample.canvasHistogram;
}
- (void)queueOutputHistogramNotification{
- (void)queueOutputNotification{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW,NSEC_PER_SEC/30),dispatch_get_main_queue(),^{
@synchronized(_previewLock){_outputHistogramNotificationPending=NO;}
[NSNotificationCenter.defaultCenter postNotificationName:@"DYOutputHistogramDidChange" object:self];
@synchronized(_previewLock){_outputNotificationPending=NO;}
[NSNotificationCenter.defaultCenter postNotificationName:@"DYFinalOutputDidChange" object:self];
});
}
- (NSData *)canvasHistogramAtTime:(CMTime)time{
- (DYScopeSample *)finalSampleAtTime:(CMTime)time{
if(!CMTIME_IS_NUMERIC(time))return nil;
DYScopeSample *sample=nil;
@synchronized(_previewLock){sample=[_scopeLatest retain];}
NSDictionary *metadata=sample.metadata;
CMTime captured=CMTimeMakeWithEpoch([metadata[@"timeValue"]longLongValue],[metadata[@"timeScale"]intValue],[metadata[@"timeEpoch"]longLongValue]);
NSData *histogram=metadata&&CMTimeCompare(time,captured)==0?sample.canvasHistogram:nil;
if(metadata&&CMTimeCompare(time,captured)==0)return [sample autorelease];
[sample release];
return histogram;
return nil;
}
- (NSData *)canvasHistogramAtTime:(CMTime)time {
return [self finalSampleAtTime:time].canvasHistogram;
}
- (NSData *)canvasSpiderScopeAtTime:(CMTime)time {
return [self finalSampleAtTime:time].spiderScope;
}
- (NSData *)outputSpiderScope {
NSData *raster=nil;
@synchronized(_previewLock){
_outputObserved=YES;
raster=[[_spiderScopeRaster retain]autorelease];
if(!_scopeLatest||_spiderScopeWorkerRunning||_spiderScopeSerial==_scopeLatestSerial)return raster;
_spiderScopeWorkerRunning=YES;
}
dispatch_async(_scopeQueue,^{@autoreleasepool{
DYScopeSample *sample=nil;uint64_t serial;
@synchronized(_previewLock){sample=[_scopeLatest retain];serial=_scopeLatestSerial;}
NSData *measured=sample.spiderScope;
@synchronized(_previewLock){
[_spiderScopeRaster release];_spiderScopeRaster=[measured retain];_spiderScopeSerial=serial;
_spiderScopeWorkerRunning=NO;
}
[sample release];
dispatch_async(dispatch_get_main_queue(),^{
[NSNotificationCenter.defaultCenter postNotificationName:@"DYSpiderScopeDidChange" object:self];
});
}});
return raster;
}
- (void)captureScopeTile:(FxImageTile *)tile atTime:(CMTime)time{
NSUInteger generation;uint64_t serial;@synchronized(_previewLock){if(_exporting||!tile)return;generation=_scopeGeneration;serial=++_scopeCaptureSerial;}
@@ -58,14 +87,14 @@
FxRect bounds=tile.tilePixelBounds,image=tile.imagePixelBounds;BOOL whole=bounds.left==image.left&&bounds.right==image.right&&bounds.top==image.top&&bounds.bottom==image.bottom;
sample.metadata=@{@"time":@(CMTimeGetSeconds(time)),@"timeValue":@(time.value),@"timeScale":@(time.timescale),@"timeEpoch":@(time.epoch),@"source":context[@"destination"]?:@"宿主 RGB",@"wholeImage":@(whole),@"region":whole?@"整帧取样":@"仅当前宿主输出分块",@"width":@(dyscope::Width),@"height":@(dyscope::Height)};
[buffer release];[entry release];[context release];
BOOL start=NO,notifyHistogram=NO;@synchronized(_previewLock){
BOOL start=NO,notifyOutput=NO;@synchronized(_previewLock){
if(serial>=_scopeLatestSerial){
[_scopeLatest release];_scopeLatest=[sample retain];_scopeLatestSerial=serial;
if(_outputHistogramObserved&&!_outputHistogramNotificationPending){_outputHistogramNotificationPending=YES;notifyHistogram=YES;}
if(_outputObserved&&!_outputNotificationPending){_outputNotificationPending=YES;notifyOutput=YES;}
}
if(_scopeEnabled&&serial==_scopeLatestSerial&&(generation==_scopeGeneration||!CMTIME_IS_NUMERIC(_scopeRequestedTime)||CMTimeCompare(time,_scopeRequestedTime)==0)){sample.generation=_scopeGeneration;[_scopePending release];_scopePending=[sample retain];if(!_scopeWorkerRunning){_scopeWorkerRunning=YES;start=YES;}}
}[sample release];
if(notifyHistogram)[self queueOutputHistogramNotification];
if(notifyOutput)[self queueOutputNotification];
if(start)dispatch_async(_scopeQueue,^{[self processPendingScopeSamples];});
}@catch(NSException *exception){/* Scope diagnostics must never fail rendering. */}}
}