Variable-Length Bit-Level Encoding

James Buren via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 12 11:19:58 PST 2016


On Saturday, 12 November 2016 at 19:13:13 UTC, Nordlöw wrote:
> Does anybody have a suggestion for an encoder that is more 
> suitable for real-world values that are, for instance, normally 
> distributed?

I don't recall the name, but there is an algorithm for encoding 
data of an arbitrary number of bytes/bits into a stream of 
octets. It reserves the MSB of each octet for use as a marker. If 
it is set to 1, then there are yet more bits to read. If it is 
set to 0, then this is the last group of bits. This enables each 
octet to carry 7 bits at a time, while allowing you to encode 
data of any bit size into an octet stream. You just need to break 
your data down into groups of 7 bits.



More information about the Digitalmars-d-learn mailing list