KASKADE 7 development version
Public Member Functions | List of all members
Alphabet< UInt > Class Template Reference

A simple alphabet of symbols with frequencies to be used with the range coder. More...

#include <rangecoder.hh>

Detailed Description

template<class UInt>
class Alphabet< UInt >

A simple alphabet of symbols with frequencies to be used with the range coder.

The symbols are consecutive integers 0..(size()-1). The half-open ranges associated to the symbols are derived from given frequencies of the symbols.

Definition at line 342 of file rangecoder.hh.

Public Member Functions

template<class InIter >
 Alphabet (InIter first, InIter last)
 
template<class InIter >
void update (InIter first, InIter last)
 Modifies the symbols' half-open ranges to represent the symbols' frequencies given in the range [first,last[. More...
 
UInt totalRange () const
 Returns the total range, i.e. the maximum upper range bound of any symbol in the alphabet. More...
 
UInt size () const
 Returns the number of symbols in the alphabet. More...
 
UInt symbol (UInt value) const
 Returns the symbol that contains the given value. More...
 
std::pair< UInt, UInt > range (UInt symbol) const
 Returns the symbol's half-open cumulative frequency range. More...
 

Constructor & Destructor Documentation

◆ Alphabet()

template<class UInt >
template<class InIter >
Alphabet< UInt >::Alphabet ( InIter  first,
InIter  last 
)
inline

Constructs an alphabet from a sequence of frequencies of symbols. Note that for each symbol the frequency must be larger than 0.

Definition at line 350 of file rangecoder.hh.

Member Function Documentation

◆ range()

template<class UInt >
std::pair< UInt, UInt > Alphabet< UInt >::range ( UInt  symbol) const
inline

Returns the symbol's half-open cumulative frequency range.

Definition at line 403 of file rangecoder.hh.

Referenced by RangeDecoder< UInt >::decodeSymbol(), and RangeEncoder< UInt >::encodeSymbol().

◆ size()

template<class UInt >
UInt Alphabet< UInt >::size ( ) const
inline

◆ symbol()

template<class UInt >
UInt Alphabet< UInt >::symbol ( UInt  value) const
inline

Returns the symbol that contains the given value.

Definition at line 391 of file rangecoder.hh.

Referenced by RangeDecoder< UInt >::decodeSymbol(), and Alphabet< UInt >::range().

◆ totalRange()

template<class UInt >
UInt Alphabet< UInt >::totalRange ( ) const
inline

Returns the total range, i.e. the maximum upper range bound of any symbol in the alphabet.

Definition at line 375 of file rangecoder.hh.

Referenced by RangeDecoder< UInt >::decodeSymbol(), and RangeEncoder< UInt >::encodeSymbol().

◆ update()

template<class UInt >
template<class InIter >
void Alphabet< UInt >::update ( InIter  first,
InIter  last 
)
inline

Modifies the symbols' half-open ranges to represent the symbols' frequencies given in the range [first,last[.

Note that for each symbol the frequency must be larger than 0. The length of the given sequence must match the size of the alphabet.

Definition at line 365 of file rangecoder.hh.

Referenced by LossyStorage< Grid, VariableSet, Space, QuantizationPolicy >::decode(), and LossyStorage< Grid, VariableSet, Space, QuantizationPolicy >::encode().


The documentation for this class was generated from the following file: