KASKADE 7 development version
Loading...
Searching...
No Matches
Entropy coding

Tools for entropy coding, i.e. storing sequences of symbols with different frequencies in a (small) bitstream. More...

Classes

class  RangeCoder< UInt >
 Base class for entropy coding with range encoder and decoder. More...
class  RangeEncoder< UInt >
 Entropy coding with range encoder. More...
class  RangeDecoder< UInt >
 Entropy coding with range decoder. More...
class  Alphabet< UInt >
 A simple alphabet of symbols with frequencies to be used with the range coder. More...
class  PrefixEncoder< Symbol, OIter, Output, State >
 An encoder for arbitrary prefix codes. More...
class  PrefixDecoder< Symbol, IIter, Input, State >
 A decoder for arbitrary prefix codes. More...
class  HuffmanCodec< Symbol >
 A simple Huffman codec with byte-oriented bitstream. More...

Typedefs

template<class State, class Symbol>
using CodeBook = std::vector<std::pair<Symbol, std::pair<State,int>>>
 The type of a code book - a map from symbols to codes and their lengths.

Functions

template<class State, class Freq, class Symbol>
CodeBook< State, Symbol > huffmanCodeBook (Frequencies< Freq, Symbol > const &f)
 Creates a code book for a fixed-length code of minimal size.
template<class UInt, class Symbol>
void encodeSymbol (RangeEncoder< UInt > &encoder, Alphabet< UInt > const &alphabet, Symbol const &s)
 A convenience function that encodes a symbol in a range encoder.
template<class UInt>
UInt decodeSymbol (RangeDecoder< UInt > &decoder, Alphabet< UInt > const &alphabet)
 A convenience function that retrieves and pops the current symbol from a range decoder.

Detailed Description

Tools for entropy coding, i.e. storing sequences of symbols with different frequencies in a (small) bitstream.

Typedef Documentation

◆ CodeBook

template<class State, class Symbol>
using CodeBook = std::vector<std::pair<Symbol, std::pair<State,int>>>

The type of a code book - a map from symbols to codes and their lengths.

Template Parameters
Statean unsigned integer type for representing code words

Definition at line 22 of file prefixcoder.hh.

Function Documentation

◆ decodeSymbol()

template<class UInt>
UInt decodeSymbol ( RangeDecoder< UInt > & decoder,
Alphabet< UInt > const & alphabet )
related

A convenience function that retrieves and pops the current symbol from a range decoder.

Definition at line 436 of file rangecoder.hh.

◆ encodeSymbol()

template<class UInt, class Symbol>
void encodeSymbol ( RangeEncoder< UInt > & encoder,
Alphabet< UInt > const & alphabet,
Symbol const & s )
related

A convenience function that encodes a symbol in a range encoder.

Definition at line 424 of file rangecoder.hh.

◆ huffmanCodeBook()

template<class State, class Freq, class Symbol>
CodeBook< State, Symbol > huffmanCodeBook ( Frequencies< Freq, Symbol > const & f)

Creates a code book for a fixed-length code of minimal size.

Each symbol is assigned a code of \( \lceil \log_2 n \rceil \) bits, where \( n\) is the size of the alphabet.

Parameters
nSymbolsthe size \( n \) of the alphabet.

Creates a code book for a Huffman code.

Each symbol is assigned a code according to its

Parameters
nSymbolsthe size \( n \) of the alphabet.