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

Entropy coding with range encoder. More...

#include <rangecoder.hh>

Detailed Description

template<class UInt>
class RangeEncoder< UInt >

Entropy coding with range encoder.

A range encoder. It encodes a sequence of symbols \( (s_i)_i \). See base class RangeCoder for a definition of symbols and alphabets.

Note that the encoding is completed only after destruction of the encoder, since the destructor writes the remaining characters to the output stream.

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

Definition at line 135 of file rangecoder.hh.

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

Public Member Functions

 RangeEncoder (std::ostream &out_)
 
 ~RangeEncoder ()
 Destructor writes the remaining data to the output stream. More...
 
void push (std::pair< UInt, UInt > s, UInt totalRange)
 Encodes one symbol. More...
 
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 , 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. More...
 

Constructor & Destructor Documentation

◆ RangeEncoder()

template<class UInt >
RangeEncoder< UInt >::RangeEncoder ( std::ostream &  out_)
inline

Definition at line 144 of file rangecoder.hh.

◆ ~RangeEncoder()

template<class UInt >
RangeEncoder< UInt >::~RangeEncoder ( )
inline

Destructor writes the remaining data to the output stream.

Definition at line 151 of file rangecoder.hh.

Member Function Documentation

◆ push()

template<class UInt >
void RangeEncoder< UInt >::push ( std::pair< UInt, UInt >  s,
UInt  totalRange 
)
inline

Encodes one symbol.

Encodes the symbol that covers the half-open range [s.first,s.second[ of the totalRange. totalRange must not exceed maxRange. Characters may be written to the output stream. If the write operation is not successful, this method throws an exception.

See also the convenience function encodeSymbol().

Definition at line 168 of file rangecoder.hh.

Referenced by RangeEncoder< UInt >::encodeSymbol().

◆ 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 RangeEncoder< UInt >::maxRange = RangeCoder<UInt>::maxRange
static

Definition at line 142 of file rangecoder.hh.

Referenced by RangeEncoder< UInt >::push().

◆ range

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

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