bzip2_os/huffman_coding/mod.rs
1//! The huffman module compresses the MTF/RLE2 data into a bistream. Decoding huffman (decompression) data happens in the decompress function.
2//!
3//! Huffman encoding is used in lieu of arithmetic encoding because of an historical problem with licensing restrictions.
4//! While that has been resolved in more recent years, the BZIP2 standard was set based on the huffman standard.
5//!
6//! The huffman coding algorithm as used by BZIP2 is both block and chunk oriented. The data stream is broken into blocks of
7//! approximately 100-900k (at the RLE1 stage), based on parameters specified by the user. Within each block, chunks of 50
8//! bytes of data are encoded separately using one of six huffman tables. This allows for higher compression ratios compared to
9//! using one huffman table per block (or for the entire file).
10//!
11//! The process of huffman encoding a block is inherently sequential and does not benefit from multithreading.
12//!
13//!
14
15pub mod huffman;
16pub mod huffman_code_from_weights;