Resetting Codec State at a Record Boundary

A codec can retain context across records or start each one from the same known state. That choice affects compression and independent reads.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a repeated fragment
  2. Choose based on use
  3. Decode a record by starting at its boundary
  4. Balance independence and compression

Trace a repeated fragment

If consecutive records share a phrase, a shared dictionary may encode the second compactly. A fresh decoder starting at the second then needs context or a reset point. See dictionary references.

Choose based on use

Independent chunks can make selective access and error recovery easier under the format. Fixed-size batching provides a comparable boundary at a work interface.[1][2]

Decode a record by starting at its boundary

A stream delta-codes values using the last recovered reading. To decode record two on its own, store its starting value and reset the predictor. If it inherits record one's final state, seeking directly to record two lacks that state. See delta coding.

Record 1 encoded: absolute 10, delta +2
Record 2 encoded: absolute 20, delta -1
Stand-alone record 2 decodes 20,19 after reset

Balance independence and compression

Carrying context across records can help compression but makes recovery and seeking more dependent on earlier records. Test decoding a middle record by itself under the promised contract.

References

  1. Claude E. Shannon, A Mathematical Theory of Communication ↩
  2. David J. C. MacKay, Information Theory, Inference, and Learning Algorithms ↩