KASKADE 7 development version
Loading...
Searching...
No Matches
PrefixDecoder< Symbol, IIter, Input, State > Class Template Reference

A decoder for arbitrary prefix codes. More...

#include <prefixcoder.hh>

Public Member Functions

 PrefixDecoder (IIter in_)
Symbol pop_front (PrefixCode< Symbol, State > const &code)
 Extract a symbol from the head of the remaining encoded message.
State pop_front (int n)
 Extract a code word of given length from the head of the remaining encoded message.

Detailed Description

template<class Symbol, class IIter, class Input = typename std::iterator_traits<IIter>::value_type, class State = size_t>
class PrefixDecoder< Symbol, IIter, Input, State >

A decoder for arbitrary prefix codes.

The decoder supports decoding each symbol with an individual prefix code (i.e. it's context adaptive), but the context (i.e. the actual code) needs to be communicated as side information, it is not contained in the message.

Note that the decoder reads up to sizeof(State)-sizeof(Input) bytes past the end of the encoded message - as many as the encoder put out after the end of the encoded message. If compression rate is at a premium, up to sizeof(State) trailing zero bytes of the message can be discarded before storage/transmission and sizeof(State) zero bytes be appended before decoding.

Template Parameters
Symbolan unsigned integral type for representing symbols.
IIteran input iterator type for reading the encoded message. Input needs to be convertible from IIter's value type without any information loss.
Inputan unsigned integral type used for reading the encoded message. Note that 8*sizeof(Input)+maxLength <= 8*sizeof(State) hast to hold.
Statean unsigned integral type used for representing part of the message and for deassembling the message. It has to be large enough to hold 8*sizeof(Input)+maxLength bits. On general purpose CPUs, this appears to have a negligible impact on performance, such that it should be chosen to be as large as possible.

Definition at line 366 of file prefixcoder.hh.

Constructor & Destructor Documentation

◆ PrefixDecoder()

template<class Symbol, class IIter, class Input = typename std::iterator_traits<IIter>::value_type, class State = size_t>
PrefixDecoder< Symbol, IIter, Input, State >::PrefixDecoder ( IIter in_)
inline

Definition at line 373 of file prefixcoder.hh.

Member Function Documentation

◆ pop_front() [1/2]

template<class Symbol, class IIter, class Input = typename std::iterator_traits<IIter>::value_type, class State = size_t>
State PrefixDecoder< Symbol, IIter, Input, State >::pop_front ( int n)
inline

Extract a code word of given length from the head of the remaining encoded message.

Parameters
nn length of the code word (in bits) to extract. Has to be at most 8*(sizeof(State)-sizeof(Input)).

This should match corresponding encoder calls.

Definition at line 407 of file prefixcoder.hh.

◆ pop_front() [2/2]

template<class Symbol, class IIter, class Input = typename std::iterator_traits<IIter>::value_type, class State = size_t>
Symbol PrefixDecoder< Symbol, IIter, Input, State >::pop_front ( PrefixCode< Symbol, State > const & code)
inline

Extract a symbol from the head of the remaining encoded message.

Parameters
codethe prefix code used for storing the symbol.

Definition at line 381 of file prefixcoder.hh.


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