Skip to main content

Module entropy_coding

Module entropy_coding 

Source
Expand description

Entropy coding primitives.

This module provides simplified implementations of common entropy coding techniques used in video codecs: arithmetic coding, range coding, and Huffman coding.

Structs§

AdaptiveFrequencyTracker
Adaptive frequency tracker using a sliding window.
ArithmeticCoder
Simplified binary arithmetic coder.
CabacContext
A single CABAC context model.
CabacEncoder
CABAC encoder with multiple context models.
HuffmanNode
A node in a Huffman tree.
ProbTableEntry
Pre-computed lookup table entry for one probability value.
RangeCoder
Simplified range coder (decoder side).
RangeEncoder
Multi-symbol range encoder that writes bytes to an output buffer.
TableArithmeticCoder
High-throughput table-based arithmetic coder.
TableArithmeticDecoder
Table-based arithmetic decoder counterpart.

Functions§

build_huffman_tree
Builds a Huffman tree from a frequency table using a greedy (priority-queue) algorithm.
build_prob_table
Builds a probability lookup table for n_syms symbols.
compare_coding_strategies
Compare two coding strategies and return which uses fewer estimated bits.
compute_huffman_codes
Traverses the Huffman tree depth-first, collecting (symbol, code_bits) pairs at each leaf.
estimate_block_entropy
Estimate the number of bits needed to encode a block of symbols without actually producing a bitstream.
estimate_entropy_from_freqs
Estimate the entropy (bits per symbol) of a frequency distribution.
optimal_code_lengths
Compute optimal code lengths for a set of symbol frequencies.