Speed up suppression-region computation during region edits#1793
Merged
Conversation
Resizing a large suppression region on a frame with many detections lagged and briefly hung on release. Every drag event bumps the pending-save counter, which recomputed the dataset-wide fully- suppressed set (every keyframe of every track, each 16x16 point-sampled against the region polygon) per mouse move, and the per-frame suppression set was computed three times per update (canvas, type counts, track list). - getSuppressedTrackIds gains a cheap bbox-overlap upper bound so candidates that cannot possibly reach the coverage threshold skip the point sampling entirely. - Results are memoized per store+frame for one edit revision (the pending-save counter), so the canvas, per-frame type counts, and track list share a single computation. - The dataset-wide fully-suppressed totals recompute on a 500 ms debounce instead of synchronously on every save-counter bump, so corner drags stay responsive; the type-list totals settle right after the drag ends. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The debounced dataset-wide pass still ran at full price once a region edit settled. Two further cuts: - The fully-suppressed walk first collects the frames where any suppression region exists; a track with a keyframe on any other frame bails immediately, so frames without regions never reach the per-frame computation. - Vertex-heavy region polygons (the suppressor's warped field-of-view shapes) are rasterized once per frame with a scanline fill, turning each coverage sample into an O(1) mask lookup instead of an O(vertices) point-in-polygon test. Simple polygons (<= 8 vertices) keep the exact test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Combine main's configurable threshold and attribute-suppression APIs with this branch's revision cache, bbox prefilter, and region rasterization. Co-authored-by: Cursor <cursoragent@cursor.com>
BryonLewis
previously approved these changes
Jul 23, 2026
BryonLewis
left a comment
Collaborator
There was a problem hiding this comment.
Updated to fix a few minor issues:
- pendingSavecount was declared multiple times in LayerManager.vue
- Have FilterList use each regions tracks span so interpolated frames also count
- a few other minor changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Resizing a large suppression region (especially one carrying a polygon) on sequences with many detections lagged during the drag and briefly hung when releasing the corner handle.
Three compounding costs:
Fix
getSuppressedTrackIdsfirst computes a cheap bbox-overlap upper bound on the covered fraction; candidates that cannot possibly reach the threshold skip the point sampling entirely.Unit tests cover the prefilter behavior (covered vs. barely-touching vs. distant candidates) and the memoization/revision semantics.
🤖 Generated with Claude Code