Work in Progress
You are viewing unfinished draft material right now.
Basmati Codes
We define the Basmati codes, a bit-based variable-length encoding scheme for integers between zero and some maximal number 2^k. The Basmati codes are essentially the base-two Exponential-Golomb codes, except that numbers sufficiently close to 2^k get a more efficient encoding than their normal Exponential-Golomb code. For max == 1, the encoding specialises to a single bit per number, and for max == 0, the only code is the empty string.
TODO specify things properly. Basically, do normal exponential-golomb codes, but once you get close enough to the max, use a sequence of all-zeroes as the prefix (instead of the normal many-zeroes-followed-by-exactly-one-one), and then use truncated binary encodings for the remaining bits. See the example table below in lieu of a proper definition for now.
TODO no need to restrict this to powers of two, should define these in full generality. That kinda breaks the name though (Basmati is a reference to Rice codes, which are specialised to powers of two). But the increased flexibility is probably more important than the bad pun...
