Solomus - #50
Merged
Merged
Conversation
The Q1-larger-than-Q2 inversion reported in roadmap 5b predates the 2.1/2.2 ladder retunes and no longer reproduces on flat, gradient, or noisy content. Tick the item and guard it with test_lossy_size_monotonic_in_quality so it cannot silently return.
Lossy quantized coefficient statistics diverge sharply by subband (large LL magnitudes, mostly-zero HH), so the RC now walks dyadic segments with per-band zero-run and threshold models. Measured on the forced-wavelet bench: 37701 to 37530 bytes at equal PSNR. Lossless stays on the single-context flag-3 stream: splitting its near-uniform 5/3 statistics cost more to context fragmentation than it saved. Flags 3 and 4 remain byte-compatible with 2.2.4 files; the decoder accepts 3 through 6 and derives segment layout from the flag.
Predictive residuals now compete as an RC candidate during scoring: signed residuals through the shared coefficient models, per-predictor context slots, two adaptive bits per predictor kind. Winning payloads ship with tile entropy byte 2; the decoder reconstructs the classic predictive payload from the RC stream and validates stream length. Noise-heavy forced-predictive bench: 92314 to 67853 bytes per image. Palette stays on zstd: index streams are near-uniform so the range coder has nothing to model there. Also fixes a latent MinGW-only heap corruption the new stress runs exposed: thread_local zstd contexts wrapped in destroying unique_ptr crash at worker-thread exit because emutls tears down TLS storage during pthread key cleanup. Contexts are now intentionally leaked (one bounded allocation per thread). Dr.Memory reports zero errors on the previously failing workload; 0 crashes in 120 hammer runs. Hardens RangeDecoder with a consumption limit derived from payload size so hostile or desynced streams throw instead of reading past the container.
Resolves the roadmap item by choosing the documented-deferral path: tiles are independently decodable, layer bookkeeping would touch every container invariant at once, and embedded progressive streams move to the WIMF 3.0 container break. Also refreshes the coding-modes section for range-coder entropy (flags 3/4/6, predictive entropy byte 2).
Companion to the predictive range-coder commit: entropy byte 2 tiles now raise a clear native-required message instead of falling into the zstd decompressor and failing with a confusing expansion error.
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.
No description provided.