Skip to content

fix: close the [288,512) auto-enhance dead zone - #30

Merged
ozansozuozgit merged 2 commits into
mainfrom
fix/small-raster-enhance-dead-zone
Jul 15, 2026
Merged

fix: close the [288,512) auto-enhance dead zone#30
ozansozuozgit merged 2 commits into
mainfrom
fix/small-raster-enhance-dead-zone

Conversation

@ozansozuozgit

Copy link
Copy Markdown
Owner

Problem

Real-world small web rasters (300–511px icons/logos) fell into an auto-enhance dead zone: below the 512px upscale floor, above the legacy <64px superres path, and usually not blurry enough to trip restore. A 500×500 JPEG app icon reproduced it: the tracer ate raw JPEG noise + AA, producing splotchy gradient regions and wobbly rounded-square edges (visibly worse than Vectorizer.AI on the same input).

Fix

Lower DEFAULT_MIN_UPSCALE_EDGE 512 → 288 so enhance=auto runs the proven SR-before-trace recipe on the [288, 512) band.

Why size-only gating: content-signal detectors were measured across all fixtures first (soft-edge fraction, unique-color ratio, 8×8 blockiness) — none separates clean synthetic art from degraded rasters (e.g. clean thin-lines scores blockier than a q80 JPEG). 288 separates by construction: every synthetic golden/corpus fixture is ≤256px, and real ≥288px rasters essentially always carry AA/JPEG degradation that SR cleans.

Known-inert side effect: the restore blur-threshold split rides min_upscale_edge, so [288,512) now uses the loose 1.0 threshold — behaviorally inert there since needs_upscale already fires and the restore downscale-ladder no-ops below its own 512 floor (documented in the docstring, asserted in the new test).

Deliberately out of scope: [64, 288) stays unenhanced — SR from <288px to 1600 is a >5.5× factor with real hallucination risk; needs its own R&D + fixtures.

Verification

  • Full suite: 438 passed, goldens byte-identical (all ≤256px, below the floor by construction).
  • New regression tests: band boundaries (287/288/500) in test_enhance_assess.py; end-to-end auto-fires-with-no-ladder-shrink in test_enhance.py.
  • E2E on a 500px icon-proxy JPEG (auto → illustration): enhance fires (working res 1600), JPEG speckle patches gone, donut arcs smooth and continuous, rounded corners clean vs ragged/staircased before. Cost: 3.3s → 13.9s, 105KB → 449KB (gradient fits at higher working res — the known file-size axis).

🤖 Generated with Claude Code

ozansozuozgit and others added 2 commits July 15, 2026 19:32
Real-world small web rasters (300-511px icons/logos, AA + JPEG) got no
enhancement at all: below the 512 auto-upscale floor, not blurry enough
for restore. A reported 500x500 JPEG app icon traced its raw JPEG noise
into splotchy gradient regions and wobbly edges.

Lower DEFAULT_MIN_UPSCALE_EDGE 512 -> 288 so the SR-before-trace recipe
covers the band. Size-only gating is deliberate: measured content
signals (soft-edge fraction, unique-color ratio, 8px blockiness) do not
separate clean synthetic fixtures from degraded rasters, while 288
separates by construction (every synthetic golden/corpus fixture is
<= 256px, so goldens stay byte-identical -- verified, full suite green).

[64, 288) stays unenhanced pending real fixtures: SR from <288px to
1600 is a >5.5x jump with real hallucination risk.

E2E on a 500px icon-proxy JPEG (auto -> illustration): enhancement now
fires (working res 1600); JPEG speckle patches gone, donut arcs smooth,
rounded corners clean vs the ragged/staircased old output.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ozansozuozgit
ozansozuozgit merged commit 6453712 into main Jul 15, 2026
3 checks passed
@ozansozuozgit
ozansozuozgit deleted the fix/small-raster-enhance-dead-zone branch July 15, 2026 23:36
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