On Saturday, 12 November 2016 at 19:13:13 UTC, Nordlöw wrote:
0 => [0]
1 => [1,0]
2 => [1,1,0]
is easy but assumes a too extreme input value distribution.
Does anybody have a suggestion for an encoder that is more
suitable for real-world values that are, for instance, normally
distributed?
Hmm off hand I'm recalling there's a different encoding that
uses 0's to determine how long the encoding is, and then the
first 1 breaks it off to the actual encoding. Great for short
ints.
1 = 0
010 = 1
011 = 2
00101 = 4
000011111 = 30
https://en.wikipedia.org/wiki/Exponential-Golomb_coding
If you know the range of the data, I'd almost be more inclined
to do range encoding mixed with arithmetic coding.