Delta Coding Ordered Numeric Values

Delta coding stores a starting value and changes from preceding values. A decoder reconstructs each value by accumulating the changes.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace three observations
  2. Choose a delta domain
  3. Save the initial value and reconstruct by addition
  4. Verify signedness and resynchronization

Trace three observations

Sorted offsets 20, 23, and 28 can be represented as starting 20 and deltas 3, 5. Their cumulative reconstruction gives 23 and 28. See prefix accumulation.

Choose a delta domain

If the data is promised nondecreasing, the deltas can be nonnegative. A decreasing input needs rejection or a signed representation. Input contracts define which sequence is supported.[1][2]

Save the initial value and reconstruct by addition

Values twelve, sixteen, sixteen and twenty-one can be encoded as initial twelve and differences four, zero and five. Starting from twelve, cumulative addition reconstructs each original position. See prefix scans.

Sequence: 12,16,16,21
Store starting 12 and deltas 4,0,5
Recover: 12→16→16→21

Verify signedness and resynchronization

A decreasing sequence requires signed differences unless the input contract forbids it. Losing one delta can affect later recovered values. A periodic absolute checkpoint can support seeking or limit error propagation.

References

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