Three-phase roadmap to close the stitching gap — X1 through X3
The xFLAC bundle — aFLAC v1.3, vFLAC v1.5, and avFLAC v1.2 — produces valid .flac files. As of March 2026, avFLAC beats lax_t6 on Abyssal by 14,667 bytes — our first full-track win over the strongest single FLAC encoder. vFLAC v1.5 with MDL block probe won 21/22 arena segments. On 15 benchmark clips, avFLAC beats FLAC-12 on all 15 and beats the best baseline on 8. Three Radiohead clips beat even OptimFROG by 31–40%.
The remaining gap: Ethereal Arc still +7 KB behind lax_t6 (stitching overhead), and 24-bit content (LG-DWAS) has a vFLAC block probe bias that needs bit-depth-aware correction.
| # | Codec | Bytes | vs FLAC-12 | Notes |
|---|---|---|---|---|
| 1 | OptimFROG | 7,530,383 | −421,206 | Range coder · closed source |
| 2 | WavPack -hh | 7,934,862 | −16,727 | Context mixing |
| 3 | lax_t6 | 7,951,589 | baseline | Best single FLAC encoder · TARGET |
| 4 | 8Z-avFLAC v1.2 | 7,958,631 | +7,042 | ✓ VF_whole · vFLAC 16/16 segs |
| 5 | 8Z-vFLAC v1.5 | 7,958,631 | +7,042 | ✓ MDL block probe · 190/280 changed |
| 6 | 8Z-aFLAC v1.3 | 7,965,119 | +13,530 | ✓ Arena + stitch |
| 7 | FLAC -12 (max) | 7,996,121 | +44,532 | Standard reference |
| # | Codec | Bytes | vs FLAC-12 | Notes |
|---|---|---|---|---|
| 1 | OptimFROG | 16,283,191 | −1,162,008 | Range coder · 6% gap |
| 2 | 8Z-avFLAC v1.2 | 17,305,557 | −139,642 | ✓ BEATS lax_t6 by 14,667B · arena stitch |
| 3 | lax_t6 | 17,320,224 | −124,975 | Previous best single FLAC encoder |
| 4 | 8Z-aFLAC v1.3 | 17,369,506 | −75,693 | ✓ Beats FLAC-12 |
| 5 | FLAC -12 (max) | 17,445,199 | baseline | |
| 6 | 8Z-vFLAC v1.5 | 17,512,422 | +67,223 | Standalone (VF_whole) |
This is the single most important finding from the xFLAC R&D cycle so far. The --fast vs --full experiment on Ethereal Arc produced identical output (7,965,119 bytes) despite --full evaluating 42 candidates per subframe vs --fast's 4–11. The DCC pruning isn't losing compression — the candidate pool already contains the winners. The bottleneck is not search depth. It is stitching overhead.
lax_t6 whole: 7,951,589B aFLAC raw-sum: 7,936,170B ← WINS by 7,133B aFLAC stitched: 7,965,119B ← headers ADD 28,949B Net vs lax_t6: +13,530B ← loss
lax_t6 whole: 17,320,224B avFLAC stitch: 17,305,557B ← WINS by 14,667B vFLAC wins: 21/22 segs ← vFLAC v1.5 MDL block probe dominates Seg raw sum: 17,301,297B ← raw is even better
| Source | Bytes | Notes |
|---|---|---|
| Frame number UTF-8 growth | 1–3 | Per frame; larger numbers = more bytes |
| Cold-start LPC penalty | 50–200 | Per segment; first frame has no context |
| Short tail block | 100–500 | Per segment; remainder < blocksize |
| Total per boundary | 200–700 | 16 segments × ~400B = ~6,400B structural |
| Context-loss penalty | ~22,500 | Remaining gap: per-segment LPC < whole-file |
┌──────────────────────────────────────────────────────────────┐ │ X1 Transient Blocks │ vFLAC v1.3 → v1.4 │ │ onset detection │ block plan rewrite │ │ 1024-sample attack │ LPC order cap per class │ ├───────────────────────────┼──────────────────────────────────┤ │ X2 LPC Search Expand │ vFLAC v1.4 → v1.5 │ │ TOP_K 16→24 │ DCC-gated tonal boost │ │ improved proxy │ +hamming window │ ├───────────────────────────┼──────────────────────────────────┤ │ X3 Stitch Elimination │ aFLAC v1.3 → v1.4 │ │ a: segment merging │ avFLAC v1.2 → v1.3 │ │ b: overlapping segs │ cold-start elimination │ │ c: frame-level arena │ (optional, if a+b insufficient)│ └───────────────────────────┴──────────────────────────────────┘ Cumulative gain estimates (65% stacking discount): X1 Transient blocks → 0.1–0.3% (~8–24 KB) X2 LPC search expansion → 0.2–0.5% (~16–40 KB) X3 Stitch elimination → 0.1–0.4% (~8–30 KB) Combined: 0.3–0.8% (~24–65 KB) Need to beat lax_t6: 0.17% (13.5 KB)
Two-stage onset detection: coarse scan (energy derivative between 1024-sample windows) followed by sample-level refinement (64-sample hops). Place 1024–2048 sample blocks precisely around attacks, then immediately return to optimal larger blocks for sustain/decay. FLAC spec allows any block size 16–65535. No other FLAC encoder does this.
| Content Type | Current vFLAC | After X1 | Δ |
|---|---|---|---|
| Pure tonal (FH clips) | −2% to −4% | −2% to −4% | 0% |
| Mixed (WDIG, AAI) | +0.5% to +1.5% | −0.5% to +0.5% | ~1% |
| Heavy transient (EOTS, LRR) | +11% to +12% | +3% to +6% | ~6–8% |
| Ethereal Arc (mostly tonal) | +0.5% | ≤ +0.5% | ~0.1% |
Wider search: TOP_K 16→24 (50% more candidates survive proxy screening).
Tonal boost: When difficulty < 0.05 AND pred_gain > 35 dB, trigger exhaustive 384-eval search (TOP_K=48, 5 windows). Affects ~40% of frames on Ethereal Arc.
Improved proxy: Coefficient-aware cost estimate includes quantization loss + coefficient overhead. Fewer false rejections of high-order candidates.
| Mode | TOP_K | Windows | QL Vals | Evals | vs v1.3 |
|---|---|---|---|---|---|
| --fast (default) | 8 | 2 | 3 | 24 | +33% |
| --full (normal) | 24 | 4 | 8 | 192 | +50% |
| --full (boost) | 48 | 5 | 8 | 384 | +200% |
| Component | Ethereal Arc | Abyssal |
|---|---|---|
| TOP_K 16→24 | 0.1–0.2% (8–16 KB) | 0.05–0.1% |
| Tonal boost | 0.1–0.3% (8–24 KB) | 0.05–0.1% |
| Improved proxy | 0.05–0.1% (4–8 KB) | 0.05% |
| Combined X2 | 0.2–0.5% (16–40 KB) | 0.1–0.2% |
After arena picks winners, merge adjacent segments with the same winner and re-encode as one larger segment. On Ethereal Arc where flake_L11 wins 15/16 segments, this collapses to ~2 segments — eliminating ~14 boundary penalties.
Estimated savings: 3,000–5,000B on Ethereal, 4,000–6,000B on Abyssal.
Extend each segment by one block (16384 samples) before its start. Encoder processes extended segment; we keep only frames after the warm-up block. Every frame gets preceding audio context — no cold-start LPC penalty.
Cost: ~3% encoding time increase. Estimated savings: 2,000–4,000B on Ethereal, 4,000–8,000B on Abyssal.
Encode entire file with each external encoder at the same blocksize, parse into frame arrays, select best encoder per FLAC frame via MDL. Zero stitching overhead by construction. Loses vFLAC variable-blocksize advantage. Only if X3a+X3b don't close the gap.
| Step | Ethereal vs lax_t6 | Status |
|---|---|---|
| Current (avFLAC v1.2 + vFLAC v1.5) | +7,042B | nearly there |
| After X3a (merge) | +2,000 to +5,000B | closing |
| After X3a+X3b | −2,000 to +2,000B | likely win |
| After X1+X2+X3 | −5,000 to −10,000B | confident win |
Added --fast (18 evals/subframe) and --full (128 evals) modes. Proved DCC pruning isn't losing compression — identical output on Ethereal Arc. Established that stitching overhead is the bottleneck.
Onset detector + block plan rewrite + LPC order cap. Validate on EOTS and LRR clips (key transient tests). No regression on FH tonal clips.
TOP_K expansion + DCC-gated boost + improved proxy. Validate against GPT/GEM/CLA CSVs per-frame.
Post-arena merge of same-winner segments. Re-encode merged regions. Track boundary count reduction.
Extend segments by one warm-up block. Trim after encoding. Compare per-frame sizes at boundaries.
Whole-file multi-encoder → per-frame MDL → stream rebuild. Only if X3a+X3b insufficient.
| Stage | avFLAC (bytes) | vs FLAC-12 | vs lax_t6 |
|---|---|---|---|
| Current (AF_whole) | 7,965,119 | −0.39% | +13,530 |
| After X1 | ~7,960,000 | −0.45% | +8,400 |
| After X1+X2 | ~7,945,000 | −0.64% | −6,600 |
| After X1+X2+X3 | ~7,935,000 | −0.76% | −16,600 |
| Stage | vFLAC (bytes) | vs FLAC-8 | Notes |
|---|---|---|---|
| Current v1.3 | 8,032,276 | +0.45% | Loses on mixed content |
| After X1 | ~8,020,000 | +0.30% | Transient blocks help |
| After X1+X2 | ~7,995,000 | −0.01% | Match FLAC-8 standard |
WAV Input
│
│ 8Z_Encode.py (orchestrator, --fast/--full)
│
├───────────────────────────────────────────────┐
│ │
▼ ▼ ▼ ▼
aFLAC v1.3 vFLAC v1.3 avFLAC v1.2 AC v1.7H
1633 lines 859 lines 960 lines (separate)
Arena: Pure Python Hybrid:
segment FLAC writer arena + Non-FLAC
compete variable BS vFLAC as format
+ stitch candidate
│ │ │
▼ ▼ ▼
_AF.flac _VF.flac _AVF.flac
Best arena Variable-BS MDL picks
stitch standalone smallest
| Risk | Phase | Impact | Mitigation |
|---|---|---|---|
| Onset over-splitting | X1 | Header overhead exceeds gains | Merge pass + min block 1024 |
| Tonal regression | X1 | Block plan fragments tonal content | High threshold (6.0) + FH validation |
| Speed regression | X2 | Boost mode too slow | Strict should_boost() criteria |
| Proxy backfire | X2 | New proxy rejects good candidates | A/B test on all 7 clips first |
| Merge re-encode time | X3a | Extra encoding passes | Net neutral: 1 large replaces N small |
| Overlap context mismatch | X3b | Arena comparison unfair | Full re-benchmark after change |
| Combined insufficient | All | Still > lax_t6 after X1+X2+X3 | X3c frame-level competition |
flac -t and decode to bit-identical PCM. We operate within the FLAC specification — no custom extensions, no metadata hacks. Any standard FLAC decoder must play our files.
| Document | Status | Scope |
|---|---|---|
| CONTINUE_vFLAC_FastFull.md | DONE | --fast/--full modes for vFLAC |
| CONTINUE_xFLAC_X1_Transient_Blocks.md | READY | Onset detection + block plan rewrite |
| CONTINUE_xFLAC_X2_LPC_Search.md | READY | TOP_K expansion + tonal boost |
| CONTINUE_xFLAC_X3_Stitching.md | READY | Segment merging + overlap + frame-level |
| 8Z-AC_Classical_Max_Roadmap.html | DONE | Parallel track: AC C1–C5 roadmap |
| 8Z_Audio_Peer_Review_Feedbacks.md | DONE | DreamTeam review of both tracks |