Skip to main content

Course sequence

The course starts with what a file contains and what lossless compression must preserve. It then builds from two simple ideas—shorter codes for common values and references to repeated data—to prediction, context models, and the codecs in this repository. The codebase material is a separate part; no Rust knowledge is needed for the compression chapters.

No compression or information-theory background is assumed. A byte and a bit are defined in the first part. Fractions and probabilities are introduced before they are used for coding. Rust notation is explained before the source walkthroughs.

PartRead in this orderWhat becomes clear
1. Files and the lossless contractWhat compression does → Bytes and bits → First round tripWhat the input and output are; what “exactly restored” means; why an archive has overhead.
2. Frequency codesProbability and surprise → Prefix codes → HuffmanHow counts can lead to shorter codes, and how a decoder identifies each byte.
3. Repeated sequencesLZ77How a decoder reconstructs bytes from earlier output rather than from a code tree.
4. Probabilistic codingArithmetic coding → Byte PPMHow changing predictions become bits and why both sides must update in the same order.
5. More context modelsBit PPM → PPMD and exclusionWhat changes when the predicted unit is a bit, and what an escape rules out.
6. Combining predictorsMixing → Match prediction → WikiMix-5 → How the methods fit togetherHow several imperfect models contribute to one decodable prediction, and how all codec families compare.
7. The implementationCodebase overview → Rust notation → File flow → LZ77 source → Huffman source → Byte PPM source → Integer arithmetic coder → Other model familiesWhere data moves, where each algorithm lives, and how encoder and decoder mirror each other.
8. Working on the projectArchive formats → Developer onboarding → Experiments and measurementHow formats are identified, what to change, and how to check correctness and size.

Each concept chapter uses a small example before describing the repository's implementation. The examples are models for understanding, not claims that the Rust codec writes those exact bytes. The interactive examples are optional visualizations of three ideas; the linked source walkthroughs describe the actual implementation.

For a specific CLI name or unfamiliar term, use the codec reference or glossary. For a particular file, use the source map.