|
FZGPUModules 2.0
GPU-accelerated modular compression pipelines
|
Header: modules/coders/golomb_rice/golomb_rice_stage.h
Class: fz::GolombRiceStage<T> — T is int16_t or int32_t
Category: Coder (lossless)
Common instantiation:
A chunk-local Golomb-Rice entropy coder for signed integer streams, aimed at predictor residuals (most values near zero, a long thin tail). Each value is zigzag-mapped to unsigned and split by a per-chunk parameter k into a quotient (u >> k, written as that many one bits and a zero stop bit) and k raw remainder bits, so small values cost about k + 1 bits.
The stage zigzags internally, so feed it signed residuals directly; an upstream zigzag transform would double-encode.
| Direction | Input | Output |
|---|---|---|
| Forward | T residual stream | byte stream (output) |
| Inverse | byte stream | T residual stream |
Presets: examples/presets/diffplain_golomb_rice.toml (fused chain), examples/presets/lorenzo_golomb_rice.toml (experimental).
Requires input to be a multiple of chunk_size bytes; the pipeline pads automatically.
The 5-byte stage header holds chunk_size (uint32) and the element DataType (INT16 or INT32), so an archive decodes without knowing T in advance.
Compress fuses as a chunk-cooperative segment codec for T = int32_t and chunk_size = 16384, for example Quantizer → Difference (plain) → GolombRice. The fused encoder produces the same bytes as the staged one, so the ordinary inverse decodes either. Decode is not fused.