Information and Compression
-
A Message Over an Alphabet
A source alphabet lists the discrete symbols a message can contain. The choice of symbols can be bytes, tokens, or another agreed unit.
-
A Fixed-Length Code for a Small Alphabet
Choose how many bits per symbol a fixed-length binary code needs for a small alphabet.
-
Variable Code Length and Expected Cost
A variable-length code gives different symbols different lengths. Its expected length weights each symbol length by its probability.
-
A Prefix-Free Code Can Mark Its Own Symbol End
In a prefix-free code, no codeword is the start of a different codeword. That lets a decoder identify a symbol as soon as its full codeword is read.
-
Finding an Ambiguous Encoded Message
Some variable-length assignments allow the same encoded stream to describe several distinct symbol sequences.
-
Reading a Prefix Code as a Tree
A binary prefix tree can label edges with bits and leaves with symbols. Decoding follows edges from the root until it reaches a leaf.
-
A Small Kraft Sum Calculation
Check whether three codeword lengths can fit a binary prefix tree by adding their shares of the tree.
-
Huffman Merges on Three Frequencies
A binary Huffman construction repeatedly combines the two least available weights, making their subtrees siblings.
-
Run-Length Encoding by Example
Run-length encoding records a repeated symbol and the length of its consecutive run.
-
Splitting a Run Across Bounded Count Fields
A run length field can encode only a finite count. A codec needs a way to represent a longer run without overflow.
-
Delta Coding Ordered Numeric Values
Delta coding stores a starting value and changes from preceding values. A decoder reconstructs each value by accumulating the changes.
-
Encoding Differences from a Prediction
A predictive format can transmit residuals against a shared model. Compression can improve if those residuals have a distribution cheaply encoded by the chosen code.
-
Replacing Repeated Fragments with Dictionary Entries
A dictionary codec can assign compact references to repeated fragments and restore them during decoding.
-
A Back Reference to Earlier Output
A back-reference codec can describe a repeated fragment by where it begins in already reconstructed output and how much to copy.
-
What the Compressed Size Includes
An encoded result can contain payload, metadata, and padding. Comparing only payload bits may overstate the savings.
-
Lossless and Lossy Format Guarantees
A lossless format reconstructs its declared input exactly. A lossy format can change selected information according to its design.
-
Quantizing Numeric Samples
Quantization maps a range of inputs to a finite set of output codes or representable values. Its step and rounding rule determine error.
-
Measuring Error from Uniform Quantization
Uniform rounding to a nearest representable value can bound absolute rounding error by half a step for inputs within the usable grid range.
-
Entropy of a Fair Bit
Calculate the Shannon entropy of a fair bit and compare it with the entropy of a source that always returns the same value.
-
The Information of a Rare Symbol
Compare how much information two observed symbols convey under the same probability model.
-
An Empirical Symbol Distribution
Counting observed symbols and dividing by the message length gives a sample distribution. It describes that observed message under the selected alphabet.
-
Why Order Can Matter for Compressibility
Two messages with the same marginal frequencies can have different predictable structure across positions.
-
Padding a Bitstream into Whole Bytes
A bitstream stored as bytes may leave unused bits in its last byte. Its format needs a way to tell the decoder how many bits matter.
-
Bit Order and Byte Order in a Packed Stream
Byte order describes the order of multiple byte units. Bit packing also chooses which position inside each byte is filled first.
-
Escaping a Reserved Framing Symbol
A framing format can reserve a symbol for control and encode its occurrences inside payload with an escape convention.
-
Resetting Codec State at a Record Boundary
A codec can retain context across records or start each one from the same known state. That choice affects compression and independent reads.
-
Testing a Lossless Codec with Independent Evidence
Testing decode after encode verifies reconstruction. An independently known byte sample also checks compatibility when two implementations may share a mistake.
-
The Cost of Using a Code for Another Distribution
A code emphasizing common symbols in one source can perform poorly when the recipient data has different frequencies.
-
Why a Compressor Can Produce a Larger File
A format needs storage for its decoding information, and many inputs have few patterns the codec can exploit.
-
Decoding with an Output Budget
An encoded record can reconstruct more data than its input size suggests. A decoder can enforce a documented limit on the actual output it builds.