#if !defined(_LZW_20120101_H_)
#define _LZW_20120101_H_
class CLzw
{
private:
	DWORD   m_dwBitPoint;
	WORD    m_wInEx;

	WORD    m_wCurBit;
	WORD    m_wMinBit;
	WORD    m_wMaxBit;

private:
	BOOL    m_bStart;

private:
	DWORD* m_pdwT;
	int    m_nCodeLength;
	int    m_nLabelPoint;

	WORD   m_wPreCode;
	WORD   m_wSubCode;

	BYTE*  m_pBufferOut;

	int    m_nCountT;
	int    m_nCountOut;
private:
	int    Push_DeCode(WORD wCode);
	int    Push_InCode(WORD wCode);

	void   InitLzw(int nCodeLength, int nCountT);

public:
	int   DeCode(int nCodeLength, int nCountT,
				const WORD* pwIn, int nCountIn,
				BYTE* pbyOut, int* pnLeave, BOOL bFirst);

	int   InCode(int nCodeLength, int nCountT,
				const BYTE *pbyIn, int nCountIn,
				BYTE* pbyOut, int* pnLeave,
				BOOL bFirst, BOOL bAfter);

public:
	CLzw();
	~CLzw();
};
#endif
