Skip to content

A library to help statistically encode and decode data

License

Notifications You must be signed in to change notification settings

abrensch/statcoding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Statcoding

A library to help statistically encode and decode data. 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

Usage

  • Java 8 or higher

  • Compile the library using Maven:

    mvn install

    Recommended use is to just copy the java-sources + unit-tests you are actually using into your project. While in beta, I will not upload the statcoding library to maven-central, and reserve the right to change the binary format created by the library in an incompatible way.

Examples

Release History

2022.11.27 Version 0.0.1

2023.03.19 Version 0.9.0