1 #ifndef APE_UNBITARRAYBASE_H 2 #define APE_UNBITARRAYBASE_H 3 4 class IAPEDecompress; 5 class CIO; 6 7 struct UNBIT_ARRAY_STATE 8 { 9 uint32 k; 10 uint32 nKSum; 11 }; 12 13 enum DECODE_VALUE_METHOD 14 { 15 DECODE_VALUE_METHOD_UNSIGNED_INT, 16 DECODE_VALUE_METHOD_UNSIGNED_RICE, 17 DECODE_VALUE_METHOD_X_BITS 18 }; 19 20 class CUnBitArrayBase 21 { 22 public: 23 24 // virtual destructor 25 virtual ~CUnBitArrayBase() {} 26 27 // functions 28 virtual int FillBitArray(); 29 virtual int FillAndResetBitArray(int nFileLocation = -1, int nNewBitIndex = 0); 30 31 virtual void GenerateArray(int * pOutputArray, int nElements, int nBytesRequired = -1) {} 32 virtual unsigned int DecodeValue(DECODE_VALUE_METHOD DecodeMethod, int nParam1 = 0, int nParam2 = 0) { return 0; } 33 34 virtual void AdvanceToByteBoundary(); 35 36 virtual int DecodeValueRange(UNBIT_ARRAY_STATE & BitArrayState) { return 0; } 37 virtual void FlushState(UNBIT_ARRAY_STATE & BitArrayState) {} 38 virtual void FlushBitArray() {} 39 virtual void Finalize() {} 40 41 protected: 42 43 virtual int CreateHelper(CIO * pIO, int nBytes, int nVersion); 44 virtual uint32 DecodeValueXBits(uint32 nBits); 45 46 uint32 m_nElements; 47 uint32 m_nBytes; 48 uint32 m_nBits; 49 50 int m_nVersion; 51 CIO * m_pIO; 52 53 uint32 m_nCurrentBitIndex; 54 uint32 * m_pBitArray; 55 }; 56 57 CUnBitArrayBase * CreateUnBitArray(IAPEDecompress * pAPEDecompress, int nVersion); 58 59 #endif // #ifndef APE_UNBITARRAYBASE_H 60