KASKADE 7 development version
Public Member Functions | Static Public Attributes | Protected Attributes | Related Functions | List of all members
RangeDecoder< UInt > Class Template Reference

Entropy coding with range decoder. More...

#include <rangecoder.hh>

Detailed Description

template<class UInt>
class RangeDecoder< UInt >

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.

Template Parameters
UIntan unsigned integral type (usually 32 or 64 bit usigned integer).

Definition at line 244 of file rangecoder.hh.

Inheritance diagram for RangeDecoder< UInt >:
RangeCoder< UInt >

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...
 

Constructor & Destructor Documentation

◆ RangeDecoder()

template<class UInt >
RangeDecoder< UInt >::RangeDecoder ( std::istream &  input_)
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.

Member Function Documentation

◆ front()

template<class UInt >
UInt RangeDecoder< UInt >::front ( UInt  totalRange) const
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().

◆ pop()

template<class UInt >
void RangeDecoder< UInt >::pop ( std::pair< UInt, UInt >  s,
UInt  totalRange 
)
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().

◆ size()

template<class UInt >
size_t RangeCoder< UInt >::size ( ) const
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.

Member Data Documentation

◆ count

template<class UInt >
size_t RangeCoder< UInt >::count
protectedinherited

◆ low

template<class UInt >
UInt RangeCoder< UInt >::low
protectedinherited

◆ maxRange

template<class UInt >
UInt const RangeDecoder< UInt >::maxRange = RangeCoder<UInt>::maxRange
static

Definition at line 254 of file rangecoder.hh.

◆ range

template<class UInt >
UInt RangeCoder< UInt >::range
protectedinherited

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