https://github.com/t-88/compression-algorithms
leaning how to compress files
https://github.com/t-88/compression-algorithms
Last synced: about 2 months ago
JSON representation
leaning how to compress files
- Host: GitHub
- URL: https://github.com/t-88/compression-algorithms
- Owner: t-88
- License: mit
- Created: 2023-11-20T12:34:05.000Z (about 2 years ago)
- Default Branch: base
- Last Pushed: 2023-11-22T22:56:54.000Z (about 2 years ago)
- Last Synced: 2025-02-01T23:44:54.533Z (11 months ago)
- Language: Rust
- Size: 362 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Compression
reading about compression for some reason.
## Dev Notes:
this is a implemntaion for the algorthims, that means i stop with the algorithm output but a real implementation accounts for the probability table or smth like that and the final binary output.
# Resources
check out [resources](./resources.md)
# Done List
- [X] Huffman Codes
- [X] Arithmetic Coding
**CHECK EXAMPLES FOR HOW TO USE**
## Huffman coding:
- pretty simple and *straightforward* algorithm :P
```rust
let mut coder = huffman_coding::HuffmanCoder::new(); // init struct
let encoded_str = coder.encode(&input_str); // then just encode
let decoded_str = coder.decode(encoded_str.clone()); // decode by giving it the encoded str back
coder.display_table(); // display symbol table
```
## Arithmetic Coding:
- using conditional probabily and scaling floats to decode a message is on a whole new lvl, Nice :)
- u get a float as the encoded message xd, its pretty funny
```rust
let mut coder = arithmetic_coding::ArithmeticCoder::new(); // init struct
let encoded_number = coder.encode(&input_str); // ask for encoding u get a float
let decoded_str = coder.decode(encoded_number); // decode that float
coder.display_table(); // symbol table
```