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