Repository navigation
Close the last bench cases: thin strokes on transparency, thin-stroke edges, half-turn symmetry - #28
Merged
Merged
Conversation
…uality) The native-alpha palette walks colours by pixel count, and a stroke under about two pixels wide has more partly covered pixels than covered ones, or none covered at all: - Hairline (ribbon_w1, ribbon_w1.5): every pixel of a 1-1.5 px line split across two rows is translucent with no interior, each was refused, and the line vanished. A candidate refused only for that, at least HAIRLINE_MIN_ALPHA (0.5) opaque, is now weighed as its opaque version (opaque_version: the straight colour, s = (W - (1 - a)) / a), through every gate. - Twin coverage (sawtooth_diag): the 0.83-covered pixels of a 2 px diagonal came first, passed with an interior borrowed from the core they claimed, and the core followed as a second ink. After the walk, a translucent ink whose opaque version is an accepted opaque ink is weighed again with every other ink in place and dropped when the blend tests call it coverage (drop_twin_coverage). Accepting the opaque version early instead was tried and promoted rejected blend greys on noto-emoji (+0.45 %). - Thin faces: a flat face of an opaque ink with no interior pixel, whose pixels read as that ink partly covering the clear ground (1 + a(k - 1) over white, per pixel), is painted its ink instead of the ink diluted towards white, which the boundary solve had widened to match (paint_thin_faces_their_ink). An opaque tint on the same line is told apart by its alpha. The per-pixel reference walk mirrors both palette rules. The 1 px column at 0.5 in the old hairline test sat exactly on the new threshold; it is restated at 0.6 (now an opaque ink) and 0.3 (still dropped). Measured against main (1b13418): - bench/cases Quality 38 -> 40 (sawtooth_diag, ribbon_w1.5); Fast unchanged at 26. - bench/alpha_eval.py, all 1386 icons: 90 traces change, 44 better and 46 worse, every family level or better (dark -0.45 % overall; simple-icons -0.79 %, openmoji -0.45 %, noto-emoji -0.23 %, twemoji -0.20 %, material-icons -0.08 %, lucide 0). - Fast output byte-identical on 28 corpus icons at 512 px, 19.6 -> 19.3 ms; Quality 580.6 -> 582.7 ms. Binding contract output unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013vmThm51KN5odxUsbS6Zry
… centre A stroke narrower than about a pixel and a half cuts every pixel it touches with both of its edges, so its coverage never reaches 1: a 1 px line between two rows reads 0.62 / 0.38. The refinement read each edge at the profile's 0.5 crossing, which for such a line lies on its centre line, and bench/cases ribbon_w1 came out half as wide (the boundary solve could not recover it: it stalled at its 64-iteration cap). When the coverage across a vertex starts and ends on the ground over +-2.5 px, has one peak below 0.97, and both faces are flat, the edge is now the stroke's centre (the coverage centroid) plus or minus half its width (coverage integrated along the normal, W = integral of a ds), on the vertex's own side (ridge_offset). Every other vertex is read as before. Measured against the build before it (the native palette commit): - bench/cases: Quality 40 -> 41 (ribbon_w1); Fast's 26 unchanged. - Regression gate, all six conditions, PASSED. dE00 quality-128ss -1.6 %, fast-128ss -0.6 %, level at 512 px (opaque too); parameters +0.2-0.4 % in Quality, -0.6-1.0 % in Fast; Fast turning -0.7-0.9 %. - Speed unchanged (28 corpus icons at 512 px). - New test: a 1 px line split 0.62 / 0.38 keeps both edges within 0.02 px (fails without the rule: top edge 4.806 for 4.88). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013vmThm51KN5odxUsbS6Zry
…boundary The label map can be symmetric at pixel resolution while the drawing is not. Four colours meeting 0.27 px off the image centre (bench/cases junction_quad) leave a label map that is exactly its own half turn, and averaging the boundary with its image pulled the junction onto the centre; that is why the half turn of 206a1dd needed a 0.08 px cut-off. Before a symmetry is enforced now, the 90th percentile of its paired points' disagreement, in standard deviations of their measured positions, must be at most AGREEMENT_Z (3); otherwise it is dropped and its fits are not reflected either. This applies to the two mirrors as well as to the half turn, which is detected when neither mirror holds. mirror_fit (one side of an axis, reflected) keeps to axis mirrors. Measured: - bench/cases: Quality 41 -> 42 (mirror_r; junction_quad still passes), Fast 26 -> 27 (mirror_r). - Disagreement on the cases: symmetric figures 0.3-1.2 sd (0.03-0.09 px), junction_quad 7.6-8.2 sd (0.54-0.58 px). On 500 corpus traces (5 families, 128 and 512 px, both modes): every Quality mirror at most 0.96 sd, none dropped. Fast drops 4 of 84; scored against the artist's file, dropping them improves twemoji 1f7eb 4x and the 1f1f2-1f1fb flag 1.8x and costs 271d 11 % of a 1e-4 error. - Regression gate PASSED: against the build before it, Quality within +-0.1 %, Fast dE00 -0.21 % at 128 px. - Speed unchanged: Fast 18.8 -> 18.5 ms, Quality 544 -> 546 ms per 512 px icon. - Tests: the half turn is found only when neither mirror holds; a symmetry contradicted by half a pixel at 0.05 px uncertainty is dropped and nothing moves; paths and primitives map onto their half-turn images. The 0.2.7 crash this code shape once hit (wazero on macOS arm64, index out of bounds in enforce) is to be checked by the Go job on this PR; it does not reproduce on x86-64. bench/quality_budget.json: cases:quality 42, cases:fast 27, test_functions 1096. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013vmThm51KN5odxUsbS6Zry
…dges The ridge reading (planar::ridge_offset) moves edges of the opaque tiny.png contract input, so its seven cases trace to new SVGs; the white_on_clear cases are unchanged. Re-recorded with `INKVEC_BLESS=1 cargo test -p inkvec --release --test contract`, which drops the other targets' hashes; until the Windows ones are added from the facade job's artifact, Windows is checked on everything but the exact bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013vmThm51KN5odxUsbS6Zry
Member
Author
|
CI status on
Generated by Claude Code |
…-stroke edges Taken unchanged from the facade (windows-latest) job's INKVEC_BLESS=add artifact on 5037e79 (run 37995567892): 48 lines added, nothing else differs from the committed file. The white_on_clear cases' Windows hashes equal the ones before this change, as their output did not change; the tiny.png cases' are new, as on Linux. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013vmThm51KN5odxUsbS6Zry
…compiler bug The Go package's macOS test panicked in the symmetry pass: an index of 4294337216 into a 256-point boundary, from `(shift + i) % n`. It is wazero's arm64 compiler (v1.12.0, the latest), not the tracer: wazero's interpreter traces the same module correctly, and so does its amd64 compiler. wazero lowers a remainder to `udiv rd, rn, rm`, a branch to the division-by-zero exit, and `msub rd, rd, rm, rn`, defining rd twice. Its register allocator stores a spilled value after the value's (last) defining instruction, so when the exit path's temporary forces rd out between the two, msub reloads a quotient that was never stored. A 40-value module reproduces it: `1000 rem_u 256` returns 1000. Any of the module's 346 remainders could hit it, so this is not specific to the new code (the 0.2.7 crash of the first half-turn attempt was the same bug). tools/wasm_float_select.py becomes tools/wasm_wazero_fixes.py and also rewrites every remainder exactly: rem_u(a, b) -> a - div_u(a, b) * b, and rem_s with a divisor of -1 replaced by 1, which keeps rem_s(MIN, -1) = 0 where div_s would trap. Checked: - Reproduced and fixed on linux/arm64 under QEMU (the same wazero backend as macOS): TestWhiteDiscOnTransparent panicked before and passes after; the full Go suite passes on amd64. - The rewrite is exact: on 1323 edge cases (MIN, MAX, -1, 0 divisors, i32 and i64) the original and rewritten modules give the same results and the same traps, in wazero's interpreter and compiler, amd64 and arm64. 12 corpus icons trace byte-identically. - Speed: Fast 41.0 -> 41.8 ms/icon on amd64, measured interleaved while another job held 1.5 of 4 cores. - TestWazeroRemainder reports whether wazero still has the bug (it does on arm64, not on amd64), like TestWazeroFloatSelect for the amd64 select bug. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013vmThm51KN5odxUsbS6Zry
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.
What changed
With these commits every
bench/casescase passes in Quality (38 → 42), and Fast gainsmirror_r(26 → 27). Each commit message has the full measurements.1.
native: thin strokes on a transparent ground keep their opaque ink (Quality only). Fixessawtooth_diagandribbon_w1.5.2.
planar: a stroke too thin to cover a pixel is read from its width and centre (all modes). Fixesribbon_w1. When the coverage profile across a vertex rises from the ground and falls back without reaching 0.97, the edges are now the coverage centroid ± half the integrated coverage. Before, the edge was taken at the 0.5 crossing, which for such a stroke is its centre line.3.
symmetry: the half turn, and every symmetry confirmed by the refined boundary (all modes). Fixesmirror_r. The 0.08 px cut-off the reverted attempt needed is replaced by a measured test:junction_quad, which is symmetric only at pixel resolution, measures 7.6–8.2.4. Go: integer remainders rewritten as divisions, around a wazero arm64 compiler bug. The Go macOS job panicked in the symmetry pass (index 4294337216 into a 256-point boundary), as the first half-turn attempt had in 0.2.7. It is wazero's arm64 compiler (v1.12.0, the latest), not the tracer:
udiv rd→ division-by-zero exit →msub rd, rd, …, definingrdtwice. When register pressure spillsrdbetween the two, the spill is stored after themsub, so themsubreloads a quotient that was never stored. A 40-value module reproduces it:1000 rem_u 256returns 1000. Any of the module's 346 remainders could hit it.tools/wasm_float_select.pybecomestools/wasm_wazero_fixes.pyand also rewrites every remainder exactly (a - div(a, b) * b; forrem_sa divisor of −1 becomes 1, sorem_s(MIN, -1)stays 0 instead of trapping).TestWazeroRemainderreports whether wazero still has the bug, likeTestWazeroFloatSelectfor the amd64 one.Contract hashes: the seven
tiny_*cases change with the ridge reading (2). Thex86_64-linux-gnuhashes were re-recorded locally. Thex86_64-windows-msvcones come unchanged from CI's facade (windows-latest) artifact; theclear_*cases' Windows hashes equal main's.How verified
cargo testpasses locally forinkvec-traceandinkvec-cli, including 9 new tests. Each new test of a rule fails with that rule disabled; checked for the twin rule and the ridge rule.cargo fmt --all -- --check,cargo clippy --workspace --all-targets(-D clippy::correctness -D clippy::suspicious),RUSTDOCFLAGS=-Dwarnings cargo doc --workspace --no-depsandcargo +1.88 check --workspaceare clean.bench/quality.pypasses: no new lint warnings,test_functions1088 → 1096.--no-tighten). The baseline is from v0.2.4, so all builds show large gains against it. The steps compared with each other:bench/alpha_eval.py, all 1,386 icons) for commit 1: 90 traces change, and every family is level or better (dark ground −0.45 % overall).docs/THIRD_PARTY.md: no dependency changes.CHANGELOG.mdupdated underUnreleased.🤖 Generated with Claude Code
https://claude.ai/code/session_013vmThm51KN5odxUsbS6Zry