Skip to content

recmo/EntropyCoder

Repository files navigation

EntropyCoder Build Status Documentation Status

Library for optimal compression using entropy/arithmetic/range coding.

Why not a 64 bit coder?

While a binary coder is simpler and allows more optimization, it can only encode a binary choice at a time. At best it will produce one bit at a time.

A 64 bit coder is slower to encode a symbol (though this implementation aims to be fast). Yet it can handle a very large alphabet, and if the model permits, encode up to 63 bits at a time.

Perfection

If we encode symbols with probability $0.5$ then the outcome should be exactly the bits we feed in plus a final one.

If we encode a stream of $n$ identical symbols with probability $0$ or $1$ then the outcome should be the $n$th finitely odd number. This effectively encodes only the length of the stream.

If we encode symbols with probabilities that are multiples of $2⁻ⁿ$ for some $n$ then we output should be equivalent to that of some Huffman code, followed by a trailing $1$.

Getting up and running

Configuring your system:

apt-get install make git clang libunittest++-dev

Make sure clang supports -std=c++14. The following should not produce errors:

echo "int main(){return 0;}" | clang++ -std=c++14 -x c++ - -o /dev/null

Obtaining the project source code:

git clone git@github.com:Recmo/EntropyCoder.git
cd EntropyCoder

Building the project source code:

make build

Testing the project build:

make run-tests

Making changes

Submitting changes:

To be written

Learn more

Appendix

Building and running in docker

cd EntropyCoder
docker run -t -i -v (pwd)/.git:/git:ro ubuntu:wily /bin/bash

Then in the docker instance:

apt-get update
apt-get install -y git make clang pkg-config libunittest++-dev

git clone /git /build
cd /build
make

About

Library for optimal compression using entropy/arithmetic/range coding.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages