Variable-Length Bit-Level Encoding

LiNbO3 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Nov 13 06:53:04 PST 2016


On Saturday, 12 November 2016 at 19:19:58 UTC, James Buren wrote:
> 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.

Maybe the LEB128 encoding [1] ?

[1] https://en.wikipedia.org/wiki/LEB128


More information about the Digitalmars-d-learn mailing list