A simple implementation of compression method known as context-adaptive arithmetic coding with scaling. What does it mean?
-
Arithmetic Coding - coding method used in this program.
-
Context-Adaptive - means that the the length of the codes depends on a frequency of individual bytes.
-
with Scaling - there is no problem with number precision.
Type ac --help
to get help. General usage:
ac (--encode|--decode) [-o,-s] source [dest]
-e,--encode Encode a file -d,--decode Decode a file -h,--help Print help message and exit -o,--override Whether output file should override existing file. -s,--stats Print stats during and after encoding process.
By default dest
is set to {source}.ac
.
There are currently 3 projects in this workspace.
Project | Description |
---|---|
AC_Core |
Core functionality of arithmetic coding. All logic is there including file i/o. This project produces static library that is used in AC_CLI and AC_Core_Tests as a dependency. |
AC_CLI |
Command-Line Interface for AC_Core functions. This project produces executable program called |
AC_Core_Tests |
Collection of unit tests for AC_Core functionalities. This project produces executable with embeded CLI from Catch2. For more info read official docs. |
You need Premake5 to easily generate project files (e.g. for Visual Studio, Code::Blocks, Xcode, GNU Make and more)
In root folder run premake5
with an argument depending on IDE you want to use. For example, run: premake5 vs2019
if you want to generate project for Visual Studio 2019.
In root folder run premak5 vs2019
. Visual Studio solution with projects will be generated. Open Arithmetic Coder.sln
with Visual Studio. Everything should be configured properly to build, run and test the program.
In root folder run premake5 [--cc=gcc|clang] gmake2
. If --cc
option is not set, then default C++ compiler will be used. Makefile files structure will be generated. In root folder run make help
to get available build options. General usage is:
make [config=release|debug] [target] TARGETS: all (default) AC_CLI AC_Core AC_Core_Tests
Executable binaries are stored in bin/
folder. Release config is used by default.
Importnat note: Because of using <filesystem>
standard library in AC_CLI
, AC_Core
and AC_Core_Tests
projects it is necessary to have it installed on your computer. If you generate project for gcc then library stdc+fs` is automatically linked via `-l` option. Note that `<filesystem>` library is available in gcc since version _8.x_. In earlier versions there was `<experimental/filesystem>`. Since version _9.x_ of gcc it's not necessary to link against `stdc+fs
anymore. Clang was not tested.
Project AC_Core_Tests contains all the tests for AC_Core. You can build it and run executable ac_core_tests
to verify tests.
Copyright © 2020 KyrietS
Use of this software is granted under the terms of the MIT License.
See the LICENSE for the full license text.