Skip to content

Add windowSize option for sliding window diff counts#170

Merged
mourner merged 1 commit into
mainfrom
window-size
Jul 6, 2026
Merged

Add windowSize option for sliding window diff counts#170
mourner merged 1 commit into
mainfrom
window-size

Conversation

@mourner

@mourner mourner commented Jul 6, 2026

Copy link
Copy Markdown
Member

New opt-in windowSize option. When set to a finite N, pixelmatch returns the maximum number of diff pixels in any N×N window instead of the total count. Omitted or Infinity keeps current behavior (the total is just the whole-image window).

Why: scattered GPU/AA speckle never packs densely into one window, but a genuine regression does. Failing on window density lets a harness run stricter thresholds to catch smaller real changes without tripping over noise.

How: a lazily-allocated diff mask (only when the option is set, so the default path stays allocation-free) plus an O(len) sliding-window sum. Default behavior and perf are unchanged; windowSize: 32 adds ~16% overhead.

@mourner mourner requested a review from a team as a code owner July 6, 2026 13:37
@mourner mourner requested review from underoot and removed request for a team July 6, 2026 13:37
@mourner mourner merged commit 63ab459 into main Jul 6, 2026
5 checks passed
@mourner mourner deleted the window-size branch July 6, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant