Show synchronized frame previews and progress for stamp and mask tracking
这个提交包含在:
1 父节点
7b6a3106ca
当前提交
687a366e1c
11 个文件已更改
+363
-17
没有与搜索条件相匹配的文件
@@ -7,13 +7,34 @@
|
||||
auto timeAt=[](int frame){return CMTimeMake(frame*1001,24000);};auto capture=[&](int step){setFrame(step);host->_time=timeAt(step);NSData *state=nil;[plugin pluginState:&state atTime:host->_time quality:(FxQuality)0 error:&error];return [plugin renderDestinationImage:out sourceImages:@[frame] pluginState:state atTime:host->_time error:&error];};
|
||||
auto request=[&](int direction){if(direction!=9)host->_state=kFxAnalysisState_NotAnalyzing;[plugin toolTrackRequested:[NSNotification notificationWithName:@"DYToolTrack" object:host userInfo:@{@"node":@"base:hsl",@"mask":mask[@"id"],@"direction":@(direction)}]];};
|
||||
auto drain=[&](){double end=NSProcessInfo.processInfo.systemUptime+.15;while(NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.005]];};CMTimeRange inputRange=CMTimeRangeMake(kCMTimeZero,CMTimeMake(6*1001,24000)),desired;
|
||||
NSMutableArray *updates=[NSMutableArray array];
|
||||
id observer=[NSNotificationCenter.defaultCenter addObserverForName:@"DYToolTrackingStatus" object:host queue:nil usingBlock:^(NSNotification *note){if(note.userInfo[@"tracking"])[updates addObject:note.userInfo];}];
|
||||
run.need(@"tracking-renders-valid-source-before-analysis",capture(0));run.record(@"inactive-tracking-avoids-full-frame-motion-readback",[[plugin valueForKey:@"toolCaptureDevices"]count]==0);int undoBefore=base->_undoStarts;request(1);BOOL callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:&error]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:&error];
|
||||
for(int i=0;i<6&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:&error];}host->_state=kFxAnalysisState_AnalysisCompleted;[plugin cleanupAnalysis:nil];drain();NSDictionary *tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];DYMaskParameters end=DYMaskAtTime(tracked,timeAt(5));run.record(@"host-callback-opencv-tracking-six-exact-frames",callbacks&&[tracked[@"keys"]count]==6&&fabs(end.centerX-(.5+10./tw))<.004&&fabs(end.centerY-(.5+5./th))<.004,@{@"keyCount":@([tracked[@"keys"]count]),@"centerX":@(end.centerX),@"centerY":@(end.centerY),@"error":reason(error)});
|
||||
run.record(@"tracking-results-use-one-undo-action",base->_undoStarts==undoBefore+1&&base->_undoStarts==base->_undoEnds);BOOL captureFreed=YES;for(NSDictionary *entry in [[plugin valueForKey:@"toolCaptureDevices"]allValues])captureFreed&=!entry[@"encoded"]&&!entry[@"bytes"]&&!entry[@"buffer"];run.record(@"completed-tracking-releases-4k-gpu-analysis-working-images",captureFreed);int writes=base->_undoStarts;[plugin cleanupAnalysis:nil];[plugin cleanupAnalysis:nil];drain();run.record(@"duplicate-analysis-cleanup-never-commits-twice",base->_undoStarts==writes);
|
||||
NSDictionary *lastPreview=updates.count>=2?updates[updates.count-2]:nil;
|
||||
DYMaskParameters shown{};
|
||||
[lastPreview[@"shape"] getBytes:&shown length:sizeof(shown)];
|
||||
NSData *previewPixels=lastPreview[@"rgba"];
|
||||
run.record(@"mask-analysis-emits-matching-frame-geometry-and-completed-progress",
|
||||
[lastPreview[@"completed"]intValue]==6&&[lastPreview[@"total"]intValue]==6&&
|
||||
fabs([lastPreview[@"time"]doubleValue]-CMTimeGetSeconds(timeAt(5)))<1e-9&&
|
||||
previewPixels.length==tw*th*4&&shown.centerX==end.centerX&&shown.centerY==end.centerY&&
|
||||
!lastPreview[@"sourceShape"]&&![updates.lastObject[@"tracking"]boolValue]&&host->_seekCount==0);
|
||||
run.record(@"tracking-results-use-one-undo-action",base->_undoStarts==undoBefore+1&&base->_undoStarts==base->_undoEnds);BOOL captureFreed=YES;for(NSDictionary *entry in [[plugin valueForKey:@"toolCaptureDevices"]allValues])captureFreed&=!entry[@"encoded"]&&!entry[@"bytes"]&&!entry[@"buffer"]&&!entry[@"previewBuffer"];run.record(@"completed-tracking-releases-4k-gpu-analysis-working-images",captureFreed);int writes=base->_undoStarts;[plugin cleanupAnalysis:nil];[plugin cleanupAnalysis:nil];drain();run.record(@"duplicate-analysis-cleanup-never-commits-twice",base->_undoStarts==writes);
|
||||
// Mid-analysis author edits must reject the result rather than clobber them.
|
||||
capture(0);request(1);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=0;i<3&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}NSMutableDictionary *changed=DYMutablePlist(DYReadTools(base,kCMTimeZero).document);changed[@"baseMasks"][@"hsl"][0][@"enabled"]=@NO;DYWriteTools(base,changed,kCMTimeZero);[plugin cleanupAnalysis:nil];drain();run.record(@"stale-analysis-cannot-overwrite-edited-mask",[DYReadTools(base,kCMTimeZero).document isEqual:changed]&&base->_undoStarts==writes);
|
||||
DYWriteTools(base,doc,kCMTimeZero);capture(0);request(1);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=0;i<3&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}request(9);setFrame(3);NSError *cancelError=nil;BOOL stopped=![plugin analyzeFrame:frame atTime:timeAt(3) error:&cancelError];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"cancel-keeps-only-contiguous-trusted-segment",callbacks&&stopped&&[tracked[@"keys"]count]==3&&base->_undoStarts==writes+1);run.record(@"cancel-sends-sdk-quiet-analysis-termination",[cancelError.domain isEqual:FxPlugErrorDomain]&&cancelError.code==kFxError_UserCancelled);
|
||||
[updates removeAllObjects];
|
||||
DYWriteTools(base,doc,kCMTimeZero);capture(2);host->_state=kFxAnalysisState_NotAnalyzing;request(0);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=2;i<6&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}[plugin cleanupAnalysis:nil];drain();BOOL backward=host->_backwardStarts==1;callbacks&=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=2;i>=0&&callbacks;i--){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}[plugin cleanupAnalysis:nil];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"bidirectional-passes-share-reference-and-merge-once",callbacks&&backward&&[tracked[@"keys"]count]==6&&base->_undoStarts==writes+2);
|
||||
NSUInteger previous=0;BOOL progress=YES,sawForward=NO,sawBackward=NO;
|
||||
for(NSDictionary *update in updates){
|
||||
if(!update[@"shape"])continue;
|
||||
NSUInteger current=[update[@"completed"]unsignedIntegerValue];
|
||||
progress&=current>=previous&&[update[@"total"]intValue]==6;
|
||||
if([update[@"backward"]boolValue])sawBackward=YES;else sawForward=YES;
|
||||
previous=current;
|
||||
}
|
||||
run.record(@"bidirectional-progress-counts-reference-once-and-never-regresses",progress&&sawForward&&sawBackward&&previous==6);
|
||||
DYWriteTools(base,doc,kCMTimeZero);capture(2);host->_timelineOffset=CMTimeMake(4,1);host->_state=kFxAnalysisState_NotAnalyzing;request(-2);BOOL range=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&CMTimeCompare(desired.start,timeAt(1))==0&&CMTimeCompare(desired.duration,timeAt(2))==0;[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=2;i>=1;i--){setFrame(i);[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}setFrame(0);NSError *singleStopError=nil;stopped=![plugin analyzeFrame:frame atTime:timeAt(0) error:&singleStopError];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"backward-single-step-includes-reference-and-one-neighbor",range&&stopped&&[tracked[@"keys"]count]==2);run.record(@"single-step-sends-sdk-quiet-analysis-termination",[singleStopError.domain isEqual:FxPlugErrorDomain]&&singleStopError.code==kFxError_UserCancelled);
|
||||
run.record(@"backward-single-step-seeks-timeline-with-clip-offset",host->_seekCount==1&&CMTimeCompare(host->_seekTime,CMTimeAdd(CMTimeMake(4,1),timeAt(1)))==0&&CMTimeCompare(host->_time,timeAt(1))==0);
|
||||
DYWriteTools(base,doc,kCMTimeZero);capture(2);BOOL repeated=YES;for(int first=2;first<4;first++){request(2);repeated&=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=first;i<=first+1&&repeated;i++){setFrame(i);repeated&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}[plugin cleanupAnalysis:nil];drain();repeated&=CMTimeCompare(host->_time,timeAt(first+1))==0;}run.record(@"repeated-forward-single-step-continues-source-frames-at-offset-clip",repeated&&host->_seekCount==3&&CMTimeCompare(host->_seekTime,CMTimeAdd(CMTimeMake(4,1),timeAt(4)))==0);
|
||||
@@ -112,6 +133,14 @@
|
||||
DYStampMotion motion=DYStampMotionAtTime(saved,timeAt(5));
|
||||
DYMaskParameters covered=DYMaskAtTime(saved,timeAt(5));
|
||||
NSArray *sampled=DYStampSourceAtTime(saved,timeAt(5));
|
||||
lastPreview=updates.count>=2?updates[updates.count-2]:nil;
|
||||
DYMaskParameters shownSource{},shownTarget{};
|
||||
[lastPreview[@"sourceShape"] getBytes:&shownSource length:sizeof(shownSource)];
|
||||
[lastPreview[@"shape"] getBytes:&shownTarget length:sizeof(shownTarget)];
|
||||
run.record(@"clone-analysis-preview-displays-both-regions-on-the-same-frame",
|
||||
[lastPreview[@"completed"]intValue]==6&&fabs([lastPreview[@"time"]doubleValue]-CMTimeGetSeconds(timeAt(5)))<1e-9&&
|
||||
fabs(shownSource.centerX-[sampled[0]doubleValue])<1e-6&&shownTarget.centerX==covered.centerX&&
|
||||
fabs(shownTarget.width-covered.width)<1e-6&&[lastPreview[@"rgba"]length]==tw*th*4);
|
||||
run.record(@"host-clone-stamp-follows-two-independent-centers-and-scales",
|
||||
paired&&[saved[@"keys"] count]==6&&motion.active&&
|
||||
fabs(covered.centerX-(.75+10./tw))<.006&&fabs(covered.centerY-(.5-3.75/th))<.008&&
|
||||
@@ -140,5 +169,6 @@
|
||||
paired&&ended&&[saved[@"keys"] count]==3&&[sourceLoss.domain isEqual:FxPlugErrorDomain]&&
|
||||
sourceLoss.code==kFxError_UserCancelled&&[sourceLoss.localizedDescription containsString:@"取样区域"]);
|
||||
}
|
||||
[NSNotificationCenter.defaultCenter removeObserver:observer];
|
||||
[plugin release];
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户