reading about compression for some reason.
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.
check out resources
- Huffman Codes
- Arithmetic Coding
CHECK EXAMPLES FOR HOW TO USE
- pretty simple and straightforward algorithm :P
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
- 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
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