![]() |
KASKADE 7 development version
|
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. | |
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.
| Symbol | an unsigned integral type for representing symbols. |
| IIter | an input iterator type for reading the encoded message. Input needs to be convertible from IIter's value type without any information loss. |
| Input | an unsigned integral type used for reading the encoded message. Note that 8*sizeof(Input)+maxLength <= 8*sizeof(State) hast to hold. |
| State | an 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.
|
inline |
Definition at line 373 of file prefixcoder.hh.
|
inline |
Extract a code word of given length from the head of the remaining encoded message.
| n | n 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.
|
inline |
Extract a symbol from the head of the remaining encoded message.
| code | the prefix code used for storing the symbol. |
Definition at line 381 of file prefixcoder.hh.