1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#ifndef DecodeBuffer_H
# define DecodeBuffer_H
class IntCache;
class CharCache;
class PixelCache;
class HuffmanCoder;
class DecodeBuffer
{
public:
DecodeBuffer(const unsigned char *data, unsigned int length);
int decodeValue(unsigned int &value, unsigned int numBits,
unsigned int blockSize = 0, int endOkay = 0);
int decodeCachedValue(unsigned int &value, unsigned int numBits,
IntCache & cache, unsigned int blockSize = 0,
int endOkay = 0);
int decodeCachedValue(unsigned char &value, unsigned int numBits,
CharCache & cache, unsigned int blockSize = 0,
int endOkay = 0);
int decodeCachedValue(unsigned int &value, unsigned int numBits,
PixelCache & cache, HuffmanCoder & escapeCoder0,
HuffmanCoder & escapeCoder1, int endOkay = 0);
const unsigned char *decodeRawMem(unsigned int len);
int decodeDirect(unsigned int &value, unsigned int numBits, int endOkay = 0);
private:
const unsigned char *buffer;
const unsigned char *end;
const unsigned char *nextSrc;
unsigned int availableBitsInSrc;
int countLeadingZeros(unsigned &value, int endOkay);
};
#endif /* DecodeBuffer_H */
|