Skip to content

faster resizing - #66

Merged
matmen merged 1 commit into
masterfrom
faster-resize
Oct 16, 2026
Merged

matmen merged 1 commit into
masterfrom
faster-resize

Conversation

@matmen

@matmen matmen commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Faster resizing (bilinear, bicubic and area):

  • The horizontal pass reads the coefficients outside the pixel loop.
  • The vertical pass sums each value over its rows in a variable, instead of reading and writing the output once per row. The sum is rounded to float32 after every row, exactly like the Float32Array did. The weights of up to 4 rows are kept in variables.

Identical results: every mode, shrinking and enlarging, checked against master on 1593 images.

Speed: halving a 1920×1080 photo takes about 8–10% less time.

@matmen matmen added this to the v3.2.0 milestone Oct 16, 2026
@matmen matmen self-assigned this Oct 16, 2026
@matmen matmen added the enhancement New feature or request label Oct 16, 2026
The horizontal pass reads the coefficients outside the pixel loop, the vertical pass sums each value over its
rows in a variable (rounded to float32 after every row, as the Float32Array did) instead of reading and writing
the output once per row, with the weights of up to 4 rows in variables. The results are bit-identical: checked
against master on 1593 images (every mode, shrinking and enlarging). About 10% faster for halving a
1920×1080 photo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJgRK5qpwJEbHPuFv6kgAQ
@matmen
matmen merged commit 8b8da51 into master Oct 16, 2026
13 checks passed
@matmen
matmen deleted the faster-resize branch October 16, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant