Skip to content

[EPIC] Pre-publish full-surpass campaign — collapse Effort, implement libwebp-parity encoding, animation authoring, bit-exact resize (P1-P9) #31

Description

@P4suta

Tracking epic for the pre-publish full-surpass campaign: take webpkit from "publish-quality engineering artifact that is a strict subset of libwebp" to "dramatically beats the defacto (cwebp/dwebp/gif2webp/webpmux) on both UX and capability". Authored 2026-07-17 from an 83-agent audit workflow (10-dimension audit → adversarial verification → 2-design merge): 50 findings verified (false-positives / intentional-by-design excluded).

This epic exists so the campaign survives session interruptions — every phase, design decision, and gate is captured in the linked issues.

Confirmed direction (decided 2026-07-17)

  1. Full surpass of the defacto — including implementing psychovisual RD tuning and libwebp-bit-exact resize. Blast radius / breaking changes accepted; judge by architectural beauty.
  2. Collapse the 3-tier Effort enum into a single auto-adaptive effort — the lossless default must ALWAYS apply the spatial predictor/cross-color/palette transforms so the weak default (gradient 140-281x bloat, photo==fast) disappears structurally.
  3. Implement libwebp's psychovisual knobs and expose them (stop rejecting) while keeping a clean auto default (zero knobs = near-best).

Design backbone

One auto-adaptive Effort feeding a shared lossless pre-analysis and a shared lossy perceptual-distortion/tuning model; one core geometry engine (crop + libwebp rescaler) shared by encode/decode; one animation/mux pipeline with GIF as merely one frame source; the CLI reduced to a thin table-driven surface over all of it.

Phases

✅ All 9 implementation phases complete & committed (branch feat/full-surpass-campaign: 3444b06 P1-P7, bc4aeae P8a, f2366c2 P8b, 56bf0ac P9). Each independently verified. Remaining before publish: follow-ups #32/#33/#34 (local tuning + fidelity + full mutation sweep) and release-plz version bump + ordered publish (webpkit before CLI).

Follow-ups (deferred; written down when deferred, per owner policy)

Dependency spine: P1 → P2 → P2b → P3 → (P4 ∥ P5) → P6 → P8; P7 independent after P1; P9 last. On the single working tree these run serially (parallel tracks are a human-scheduling optimization, unsafe for one autonomous tree-mutating pipeline).

Key design decisions log

  • Effort type: Effort(Depth{Auto,Level(0..=9)}), AUTO default. encode_best_at(level) breadth schedule; L9 == historical encode_best byte-exact (pinned). Floor (lz77) stays in every candidate set so keep_smaller (real-byte ranking) guarantees no size regression. Auto = fixed-point entropy+size heuristic.
  • Metrics schema: the fast/balanced/best sampling triad → l0/auto/l9 (fastest / default / max).
  • P2b peak decision (user, 2026-07-17): solve the large-image peak by streaming (byte-exact sliding-window optimal-parse), do NOT accept the memory regression.
  • AnimCodec: P1 does the minimal forward-compat (#[non_exhaustive] + Lossy { quality }); P6 upgrades the payload to the full LossyParams.

Byte-exact vs tolerance (per subsystem)

  • Byte-exact achievable: WebPRescaler (P7), lossy-alpha level-quant (P5), and all pure-memory refactors (P2b).
  • Tolerance only (PSNR/SSIM): SNS/segment/filter (P3) and sharp_yuv (P4) — libwebp float pow/exp reformulated in fixed-point cannot be byte-exact; determinism (float-free) is our surpass there. Any test asserting cwebp byte-equality for lossy shaping is a false expectation.

Top residual risks

  • Default-output byte churn is pervasive (P2/P3/P4/P6/P7 each change default bytes → goldens/ledgers regenerated multiple times). The P1 fail-closed ledger assertion + P9 rayon differential are the mechanical guards; between phases, regeneration is only as good as reviewer diligence + round-trip/oracle differentials. Regenerate only after correctness gates pass — never bless a regression.
  • P3 + P6 together approximate re-implementing libwebp's entire lossy RD/psychovisual/rate-control pipeline in forbid-unsafe fixed-point Rust — the single largest scope/timeline risk and the most likely place for partial descope; likely to need human design input.
  • The inter-frame animation optimizer (P8) has no existing library backing — real new codec work, not CLI plumbing.
  • New subsystems must stay forbid(unsafe) + float-free to keep the deterministic/no_std baseline.
  • Multi-month effort. A defensible earlier-publish cut line exists after P2 (surface locked + lossless default fixed + no correctness bugs), shipping 0.x with the psychovisual/resize/animation parity in later minors — a fallback only, since it trades the full-surpass end-state for time.

Process

Orchestrated via delegated multi-agent workflows: per-phase implement → strict gate (build/lint/test/conformance-drift + oracle tolerance-or-byte-exact) → bounded fix-retry → advance on green, halt-and-report on any phase that cannot reach a green gate (rather than blessing plausible-but-unverified codec code).

Metadata

Metadata

Assignees

No one assigned

    Labels

    campaignPre-publish full-surpass campaign

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions