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