fix: close the [288,512) auto-enhance dead zone - #30
Merged
Conversation
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>
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.
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_EDGE512 → 288 soenhance=autoruns 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-linesscores 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 sinceneeds_upscalealready 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
test_enhance_assess.py; end-to-end auto-fires-with-no-ladder-shrink intest_enhance.py.🤖 Generated with Claude Code