1 #ifndef APE_UNBITARRAY_H 2 #define APE_UNBITARRAY_H 3 4 5 #include "UnBitArrayBase.h" 6 7 8 class IAPEDecompress; 9 10 11 struct RANGE_CODER_STRUCT_DECOMPRESS 12 { 13 unsigned int low; // low end of interval 14 unsigned int range; // length of interval 15 unsigned int buffer; // buffer for input/output 16 }; 17 18 19 class CUnBitArray : public CUnBitArrayBase 20 { 21 public: 22 CUnBitArray(CIO* pIO, int nVersion); 23 ~CUnBitArray(); 24 25 uint DecodeValue(DECODE_VALUE_METHOD DecodeMethod, 26 int nParam1 = 0, int nParam2 = 0); 27 28 void GenerateArray(int * pOutputArray, int nElements, 29 int nBytesRequired = -1); 30 31 int DecodeValueRange(UNBIT_ARRAY_STATE & BitArrayState); 32 33 void FlushState(UNBIT_ARRAY_STATE & BitArrayState); 34 void FlushBitArray(); 35 void Finalize(); 36 37 private: 38 void GenerateArrayRange(int * pOutputArray, int nElements); 39 40 // data 41 int m_nFlushCounter; 42 int m_nFinalizeCounter; 43 44 RANGE_CODER_STRUCT_DECOMPRESS m_RangeCoderInfo; 45 46 uint32 m_nRefillBitThreshold; 47 48 // functions 49 inline int RangeDecodeFast(int nShift); 50 inline int RangeDecodeFastWithUpdate(int nShift); 51 inline uchar GetC(); 52 }; 53 54 55 #endif // #ifndef APE_UNBITARRAY_H 56