Skip to content

Fix native MV blur for noncanonical premultiplied pixels - #17

Merged
bbbreaddd merged 2 commits into
bbbreaddd:mainfrom
AbdullahTrees:pr/native-blur-over-alpha
Nov 15, 2026
Merged

bbbreaddd merged 2 commits into
bbbreaddd:mainfrom
AbdullahTrees:pr/native-blur-over-alpha

Conversation

@AbdullahTrees

@AbdullahTrees AbdullahTrees commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Native MV blur currently rejects snapshots whose premultiplied RGB exceeds alpha, sending additive and fade snapshots through the stock Canvas path.

Accept pixels with nonzero alpha directly. For nonzero RGB at zero alpha, use the existing rasterizer for the first pass's five padded source-over copies, then run the separable convolution. Keep the existing browser-compatible rounding and native API.

Validation:

  • Pinned Chromium 65 CPU reference: 253 cases, including widths 1–130, thin canvases, WebGL snapshots and full-size 640×480, 816×624, 960×720 and 1280×720 inputs.
  • Actual ARM handheld: 506 native blur calls with exact reference pixels and no refusals; Canvas state, content revisions and queued-source ownership checks pass.
  • Native and JavaScript blur regressions, 31 content-revision tests, x64/ARM builds, and source verification pass.

The accelerated-browser Canvas parity TODO is unchanged; pixel equivalence above targets the pinned CPU reference.

AbdullahTrees and others added 2 commits November 15, 2026 00:11
blurMv used the x86 Skia65 encoding of alpha 1/9 ((c*29)>>8), so on arm64
its result differed from the stock Bitmap.blur (round(c/9)) in most pixels,
and it refused canvases with alpha-zero RGB, falling back to the ~2 s stock
blur (e.g. snapshots taken during a white screen tint).

The gate now measures once, through the same Canvas operations the stock
blur uses, a per-channel scale table and the source-over batch width that
decides which alpha-zero pixels survive the pad copy. The native blur uses
the table and rebuilds the padded copy with that batch rule; if the batch
width cannot be measured, alpha-zero content still falls back to stock.

Adds node-mv-blur-equivalence: byte-exact comparison of native blurMv with
the stock blur over canonical, over-alpha, opaque, transparent and
alpha-zero content at many sizes (3,025 cases pass on the RG40XX-H).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bbbreaddd bbbreaddd changed the title fix: make native MV blur match the stock blur on every platform Fix native MV blur for noncanonical premultiplied pixels Nov 15, 2026
@bbbreaddd
bbbreaddd merged commit 287d84c into bbbreaddd:main Nov 15, 2026
2 checks passed
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.

2 participants