fix: make pen drafts immediate and serializable, reject stale edits, and align tracked path ROI and optical flow with local reference evidence

这个提交包含在:
mac 于 2026-11-01 23:15:31 +08:00 提交
1 父节点 38adc259e0
当前提交 0b53fdcdfd
9 个文件已更改
+522 -55

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

+4 -4
查看文件
@@ -34,20 +34,20 @@ public:
if(!ready()||!f.valid())return false;
info_={};info_.levels=1;info_.width[0]=f.width;info_.height[0]=f.height;
int total=f.width*f.height;
while(info_.levels<5&&info_.width[info_.levels-1]>=80&&info_.height[info_.levels-1]>=80) {
while(info_.levels<dy::TrackerPyramidLevels&&info_.width[info_.levels-1]>=80&&info_.height[info_.levels-1]>=80) {
int i=info_.levels++;info_.width[i]=info_.width[i-1]/2;info_.height[i]=info_.height[i-1]/2;
info_.offset[i]=total;total+=info_.width[i]*info_.height[i];
}
for(int i=0;i<2;i++){[frames_[i] release];frames_[i]=nil;}[points_ release];points_=nil;[results_ release];results_=nil;
for(int i=0;i<2;i++)frames_[i]=[device_ newBufferWithLength:total*sizeof(float) options:MTLResourceStorageModeShared];
points_=[device_ newBufferWithLength:180*sizeof(dy::FlowPoint) options:MTLResourceStorageModeShared];
results_=[device_ newBufferWithLength:180*sizeof(FlowOutput) options:MTLResourceStorageModeShared];
points_=[device_ newBufferWithLength:dy::TrackerFeatureLimit*sizeof(dy::FlowPoint) options:MTLResourceStorageModeShared];
results_=[device_ newBufferWithLength:dy::TrackerFeatureLimit*sizeof(FlowOutput) options:MTLResourceStorageModeShared];
if(!frames_[0]||!frames_[1]||!points_||!results_)return false;
previous_=0;memcpy(frames_[0].contents,f.pixels.data(),f.pixels.size()*sizeof(float));
id<MTLCommandBuffer>b=[queue_ commandBuffer];pyramid(b,frames_[0]);return finish(b);
}
bool advance(const dy::GrayFrame& f,const std::vector<dy::FlowPoint>& points,std::vector<dy::FlowMatch>& matches) override {
if(!f.valid()||f.width!=info_.width[0]||f.height!=info_.height[0]||points.empty()||points.size()>180)return false;
if(!f.valid()||f.width!=info_.width[0]||f.height!=info_.height[0]||points.empty()||points.size()>dy::TrackerFeatureLimit)return false;
int next=1-previous_;memcpy(frames_[next].contents,f.pixels.data(),f.pixels.size()*sizeof(float));
memcpy(points_.contents,points.data(),points.size()*sizeof(dy::FlowPoint));
id<MTLCommandBuffer>b=[queue_ commandBuffer];pyramid(b,frames_[next]);