A pure Java implementation of ANS. Currently, only the rANS variant has been implemented.
ANS has time performance similar to Huffman coding, but its compression is as efficient as Arithmetic coding. However, ANS requires more memory (O(N)) as symbols need to be buffered and encoded in reverse order of their appearance. The encoded stream also needs to be reversed, requiring temporary storage, but that should not take up a lot of space (due to compression).
This library uses an abstract Symbol Statistics interface, thus providing full cusomtization. Some example Statistical implementations are in the tests.
The current focus is on stability. The code has been well tested (see test/), but consider it beta quality as of now.
Future ideas:
- Use a dynamically growing stack
- (optimisation) : Avoid division in encoder by using "reciprocals", ala Alverson
LGPL3 (See LICENSE.txt)
- Jarek Duda who invented ANS
- Code inspiration from https://github.com/rygorous/ryg_rans