KASKADE 7 development version
|
Entropy coding with range decoder. More...
#include <rangecoder.hh>
Entropy coding with range decoder.
A range decoder. It decodes to a sequence of symbols \( (s_i)_i \). See base class RangeCoder for a definition of symbols and alphabets.
UInt | an unsigned integral type (usually 32 or 64 bit usigned integer). |
Definition at line 244 of file rangecoder.hh.
Public Member Functions | |
RangeDecoder (std::istream &input_) | |
UInt | front (UInt totalRange) const |
void | pop (std::pair< UInt, UInt > s, UInt totalRange) |
size_t | size () const |
Number of processed encoded bytes. More... | |
Static Public Attributes | |
static UInt const | maxRange = RangeCoder<UInt>::maxRange |
Protected Attributes | |
UInt | low |
UInt | range |
size_t | count |
Related Functions | |
(Note that these are not member functions.) | |
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. More... | |
|
inline |
Constructor. Note that reading the input stream starts already on construction. Keep this in mind if you decide to transmit the length of the symbol sequence before the encoded characters.
Definition at line 261 of file rangecoder.hh.
|
inline |
Returns a value \( c \) that is contained in the half-open range of the current symbol \( s \): \( s_{\text{low}} \le c < s_{\text{high}} \).
See also the convenience function decodeSymbol().
Definition at line 282 of file rangecoder.hh.
Referenced by RangeDecoder< UInt >::decodeSymbol(), and RangeDecoder< UInt >::pop().
|
inline |
Removes the current symbol from the sequence. The given symbol must mach the current symbol, i.e., s.first <= front(totalRange) < s.second.
Characters may be read from the input stream. If this operation fails (e.g. because of end of stream is reached), an exception is thrown.
If the same number of symbols are pop'ed as have previously been push'ed, the same number of encoded characters is read from the input stream as has previously been written to the output stream. Note that this does NOT imply that only as many symbols can be pop'ed as have been push'ed before (it only means that at least as many symbols can be decoded as have been encoded). Spurious trailing symbols may be encountered before EOF is reached.
Definition at line 307 of file rangecoder.hh.
Referenced by RangeDecoder< UInt >::decodeSymbol().
|
inlineinherited |
Number of processed encoded bytes.
When encoding, this is the number of bytes already written to the output stream. When decoding, this is the number of bytes already read from the input stream.
Definition at line 100 of file rangecoder.hh.
|
protectedinherited |
Definition at line 114 of file rangecoder.hh.
Referenced by RangeDecoder< UInt >::pop(), RangeDecoder< UInt >::RangeDecoder(), and RangeCoder< UInt >::size().
|
protectedinherited |
Definition at line 113 of file rangecoder.hh.
Referenced by RangeDecoder< UInt >::front(), RangeDecoder< UInt >::pop(), and RangeEncoder< UInt >::push().
|
static |
Definition at line 254 of file rangecoder.hh.
|
protectedinherited |
Definition at line 113 of file rangecoder.hh.
Referenced by RangeDecoder< UInt >::front(), RangeDecoder< UInt >::pop(), and RangeEncoder< UInt >::push().