A library to help statistically encode and decode data. Lightning fast.
It is refactored from field-proven code from the BRouter project.
Refactoring is aimed towards a clear API with 64-bit default width, less performance hacks, a more educational structure, full coverage of edge cases and as few traps and glitches as possible.
The very heart of this library are the classes Bit(In/Out)putStream. They implement the Data(In/Out)put interface and are able to switch back and forth between byte-aligned and bitwise operations. The bitwise operations use the "MSB first" bit ordering.
Huffman encoding and arithmetic encoding is included together with a concept for Codecs with fixed statistics and 2-pass encoding. These are fitted for write-once/read-many-times problems like the blockwise read-only random access database inside BRouter's RD5-Datafiles.
Arithmetic encoding was not included in BRouter, just added here for completeness, and is heavily inspired by: https://github.com/nayuki/Reference-arithmetic-coding
-
Java 11 or higher
-
Compile the library using Maven:
mvn install
-
Use it as a Maven dependency:
<dependency> <groupId>io.github.abrensch</groupId> <artifactId>statcoding</artifactId> <version>1.0</version> </dependency>
-
Example Lidar data processing:
examples/lidar/ -
Example QR code certificate:
examples/qr_certificate/ -
Example simple image encoding:
examples/images/
The cleanup branch of BRouter uses statcoding e.g. in its tile de-/encoder.
2022.11.27 Version 0.0.1
2023.03.19 Version 0.9.0
2026.12.05 Version 1.0