This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Variable RLE implementation | |
// Reference: Data Compression (Summer 2023) - Lecture 5 - Basic Techniques | https://youtu.be/TdFWb8mL5Gk?si=ENq0CFiiz-uC7Mib | |
use anyhow::Result; | |
use bitvec::prelude::*; | |
fn min_number_of_bits_required_to_represent(value: usize) -> usize { | |
if value == 0 { | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// - This is a simple implementation of the LZW compression algorithm | |
// - The implementation is based on the https://www.youtube.com/watch?v=1cJL9Va80Pk&t=3962s by Bill Bird. | |
// - https://en.wikipedia.org/wiki/Compress_(software) | |
use bitvec::prelude::*; | |
use std::collections::HashMap; | |
use std::io::Read; | |
use std::io::Write; |