![]() |
KASKADE 7 development version
|
A simple alphabet of symbols with frequencies to be used with the range coder. More...
#include <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[. | |
| UInt | totalRange () const |
| Returns the total range, i.e. the maximum upper range bound of any symbol in the alphabet. | |
| UInt | size () const |
| Returns the number of symbols in the alphabet. | |
| UInt | symbol (UInt value) const |
| Returns the symbol that contains the given value. | |
| std::pair< UInt, UInt > | range (UInt symbol) const |
| Returns the symbol's half-open cumulative frequency range. | |
| template<class InIter> | |
| Alphabet (InIter first, InIter last, UInt maxRange=std::numeric_limits< UInt >::max()) | |
| Constructor. Constructs an alphabet from a sequence of frequencies of symbols. Note that for each symbol the frequency must be larger than 0. | |
| 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[. | |
| UInt | totalRange () const |
| Returns the total range, i.e. the maximum upper range bound of any symbol in the alphabet. | |
| UInt | size () const |
| Returns the number of symbols in the alphabet. | |
| double | entropy () const |
| Returns the entropy of the alphabet. | |
| UInt | symbol (UInt value) const |
| Returns the symbol that contains the given value. | |
| std::pair< UInt, UInt > | range (UInt symbol) const |
| Returns the symbol's half-open cumulative frequency range. | |
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.
|
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.
|
inline |
Constructor. 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 91 of file alphabet.hh.
|
inline |
Returns the entropy of the alphabet.
The entropy is \( H = -\sum_{s\in A} p_s \log_2 p_s \) and gives the expected number of bits/symbol with optimal coding.
Definition at line 161 of file alphabet.hh.
|
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().
|
inline |
Returns the symbol's half-open cumulative frequency range.
Definition at line 192 of file alphabet.hh.
|
inline |
Returns the number of symbols in the alphabet.
Definition at line 383 of file rangecoder.hh.
Referenced by Alphabet(), LossyStorage< Grid, VariableSet, Space, QuantizationPolicy >::decode(), LossyStorage< Grid, VariableSet, Space, QuantizationPolicy >::encode(), entropy(), range(), and update().
|
inline |
Returns the number of symbols in the alphabet.
Definition at line 150 of file alphabet.hh.
|
inline |
Returns the symbol that contains the given value.
Definition at line 391 of file rangecoder.hh.
Referenced by RangeDecoder< UInt >::decodeSymbol(), and range().
|
inline |
Returns the symbol that contains the given value.
Definition at line 176 of file alphabet.hh.
|
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 Alphabet(), RangeDecoder< UInt >::decodeSymbol(), RangeEncoder< UInt >::encodeSymbol(), and entropy().
|
inline |
Returns the total range, i.e. the maximum upper range bound of any symbol in the alphabet.
Definition at line 142 of file alphabet.hh.
|
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(), LossyStorage< Grid, VariableSet, Space, QuantizationPolicy >::decode(), LossyStorage< Grid, VariableSet, Space, QuantizationPolicy >::decode(), LossyStorage< Grid, VariableSet, Space, QuantizationPolicy >::encode(), LossyStorage< Grid, VariableSet, Space, QuantizationPolicy >::encode(), and LossyStorage< Grid, VariableSet, Space, QuantizationPolicy >::encode().
|
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 132 of file alphabet.hh.