Skip to main content

Module comp

Module comp 

Source
Expand description

Lossless wire compression for numeric LSL streams (comp/1). docs/extensions.md, section comp. docs/roadmap.md, step 7.

Each numeric channel passes through a bit-exact bijection to an unsigned integer of the channel width (identity for integer formats, order-preserving IEEE-754 mapping for Float32 and Double64), a wrapping first-order delta against the previous sample on the same channel, ZigZag sign folding, and an adaptive LSB-first Golomb-Rice coder.

On TCP, a connection keeps one CompState across frames and emits either a compressed sample (0xF9 deduced timestamp, 0xFA transmitted timestamp) or a plain LSL sample (0x01 or 0x02) when compression does not save bytes. Worst-case expansion on incompressible data is zero bytes.

On UDP (dgram/1), each crate::dgram::DATA_COMP datagram is self-contained with its own anchor sample and delta-coded timestamps, so a lost or reordered datagram never corrupts later datagrams.

Structs§

CompState
Per-channel delta + adaptive Rice state for comp/1.
DgramCompEncoder
Incremental single-pass encoder for one self-contained DATA_COMP UDP datagram payload (docs/extensions.md, section comp).

Constants§

COMP_DEDUCED_TAG
Tag byte of a compressed TCP sample with a deduced timestamp (comp/1).
COMP_TIMESTAMP_TAG
Tag byte of a compressed TCP sample with a transmitted f64 timestamp (comp/1).

Functions§

decode_dgram_payload
Decode a self-contained DATA_COMP UDP datagram payload holding count samples, appending decoded PackedSamples into out.