Repository navigation
Conversation
|
On it. I'm also trying to see if we can reproduce this issue for later and potentially improve the test suite to catch it in the future. Additionally, I want to see if i can do additional improvements to your solution. |
|
Thanks for the detailed write-up, benchmarks, and reproducer files (helped a lot with debugging on my end). It seems to me that the distortion and slowdown in these examples come from Lanczos ringing in the input PNGs (lanczos has negative lobes). The issue happens due to the following chain:
In short, lanczos is treated baddly when --lossy mode is auto on Lanczos PNGs. For comparison:
However, the bit-exact CPU optimizations in this PR are genuinely clean and useful! I'd be happy to merge a trimmed version of this PR (or a fresh PR) containing just those: Keep (all bit-exact, no snapshot changes):
Drop from this PR:
If you're interested in handling 1 to 2 px Lanczos/sinc undershoot halos automatically without --lossy on, feel free to open a separate issue (that fix belongs upstream in intake/palette overshoot rejection rather than in post-blend despeckle and ribbon gating) Let me know if you'd like to strip this PR down to the bit-exact changes (or open a new PR for them)! I can also help with integrating the needed PR work, if you need anything from me. |
e3d3d44 to
3b483c2
Compare
|
@Stefatorus Thanks for tracing the issue to Lanczos ringing. I trimmed this PR to the CPU optimizations you listed. The updated head is I compared it against |

Changes
Reduce CPU work in curve and stroke fitting by reusing tangent measurements and identical chain fits, refining only the winning closed cut, computing boundary cost only for viable primitive candidates, and skipping stroke fitting when the outline score is non-finite.
Validation
0633985) and this patch (3b483c2) across the full Inkvec gate on Linux x86_64. All 1,968 SVG pairs (246 icons × 8 conditions) were byte-for-byte identical, with zero failures.inkvec-cli,inkvec-fit, andinkvec-trace(8 ignored).--lossy auto, median single-threaded CPU time fell from 2.48 s to 0.59 s across five paired runs.