| Crates.io | simple-arithmetic-coding |
| lib.rs | simple-arithmetic-coding |
| version | 0.2.2 |
| created_at | 2024-08-08 14:19:04.551198+00 |
| updated_at | 2025-03-04 21:10:56.748917+00 |
| description | Arithmetic coding, directly derived from the well-known CACM87 C-language implementation. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1329600 |
| size | 43,187 |
A simple arithmetic coder implementation that should be easy to read. Includes a driver binary and a library. By default a binary is built.
Run target/release/simple-arithmetic-coding -e <input from stdin> or wherever you have compiled the binary. For example on Linux, you can pipe your file using cat, and then direct the output to file: cat war_and_peace.txt | target/release/simple-arithmetic-coding -e > output.bin
Similarly to encoding, run target/release/simple-arithmetic-coding -d <input from stdin>. Only the command line switch is different.
The library version provides two functions and two iterators. The functions are very much self-explanatory: there is the encoding_routine and the decoding_routine. Their respective argument names are self-documenting and, with an IDE or a text editor, you can see their trait bounds. The iterators work similarly, except that they only need to wrap inputs. The result that you get is an iterator over u8s for both iterators. A goal of this project is to keep the external API unchanged forever.