Expand description
Run-length encoding (encoding id 2).
Runs are split into two streams, values and run lengths, each stored in
the frame-of-reference container so both compress with the same machinery
chunk-granular readers already understand.
Layout: run_count: u32 LE, values_len: u32 LE, values container,
lengths container.
Functionsยง
- decode
- Decodes an encoded buffer, appending at most
max_valuesvalues toout. The ceiling bounds the run streams (every run carries at least one value) and the materialized total, and the total is summed checked so hostile run lengths cannot overflow it past the wall. The two containers stream chunk by chunk in lockstep, so scratch stays two MiniBlock chunks however many runs the segment holds. - encode
- Encodes
valuesintoout, returning the encoded byte length.