#ifndef RC_DECODER_H
#define RC_DECODER_H
#include "types.h"
#include "rcmodel.h"
class RCdecoder {
public:
RCdecoder() : error(false), low(0), range(-1u), code(0) {}
virtual ~RCdecoder() {}
void init();
bool decode();
template <typename UINT>
UINT decode(uint n);
template <typename UINT>
UINT decode(UINT l, UINT h);
uint decode(RCmodel* rm);
virtual uint getbyte() = 0;
virtual size_t bytes() const = 0;
bool error;
private:
uint decode_shift(uint n);
uint decode_ratio(uint n);
void get(uint n);
void normalize();
uint low; uint range; uint code; };
#include "rcdecoder.inl"
#endif