70 lines
1.6 KiB
C++
70 lines
1.6 KiB
C++
#ifndef _LZWDECOMPRESSION_HPP_
|
||
#define _LZWDECOMPRESSION_HPP_
|
||
#ifndef _COMMON_WINDOWS_HPP_
|
||
#include <common/windows.hpp>
|
||
#endif
|
||
#ifndef _COMMON_STRING_HPP_
|
||
#include <common/string.hpp>
|
||
#endif
|
||
#ifndef _GIF_ISTREAM_HPP_
|
||
#include <gif/istream.hpp>
|
||
#endif
|
||
|
||
class LZWDecompression : public IStream
|
||
{
|
||
public:
|
||
LZWDecompression(void);
|
||
virtual ~LZWDecompression();
|
||
BOOL unpackData(USHORT imageWide,USHORT imageDeep,USHORT isInterlaced,USHORT pixelSize);
|
||
protected:
|
||
virtual void errorHandler(CHAR *errorMessage);
|
||
virtual void showHandler(UCHAR FAR *lpOutRow,USHORT yLocation);
|
||
private:
|
||
enum{CMASKSIZE=9,STARTTABLESIZE=5,INCTABLESIZE=5};
|
||
enum{OUTROWSIZE=2048,CTSIZE=4096,STACKSIZE=4096};
|
||
BOOL initialize(void);
|
||
void cleanup(void);
|
||
void flush(void);
|
||
void initializeTable(SHORT clearCode);
|
||
WORD insertCode(SHORT code);
|
||
void putx(SHORT code,SHORT pixelSize);
|
||
void doPixel(CHAR tempCode);
|
||
USHORT getCode(USHORT reqct);
|
||
USHORT getBCode(USHORT code);
|
||
UCHAR getGB(void);
|
||
|
||
static USHORT mcMask[];
|
||
static USHORT mStartTable[];
|
||
static USHORT mIncTable[];
|
||
static CHAR errorMessage[];
|
||
USHORT mImageWide;
|
||
USHORT mImageDeep;
|
||
USHORT mIsInterlaced;
|
||
USHORT mOldCode;
|
||
USHORT mNextCode;
|
||
USHORT mCode;
|
||
USHORT mPixelSize;
|
||
USHORT mNextLimit;
|
||
USHORT mBufferCount;
|
||
USHORT mRemct;
|
||
USHORT mReqct;
|
||
USHORT mRem;
|
||
USHORT mPass;
|
||
USHORT mxLocation;
|
||
USHORT myLocation;
|
||
USHORT mRowCount;
|
||
CHAR FAR *mlpctFirst;
|
||
CHAR FAR *mlpctLast;
|
||
SHORT FAR *mlpctLink;
|
||
UCHAR FAR *mlpOutRow;
|
||
UCHAR FAR *mlpStack;
|
||
|
||
HGLOBAL mhGlobalctFirst;
|
||
HGLOBAL mhGlobalctLast;
|
||
HGLOBAL mhGlobalctLink;
|
||
HGLOBAL mhGlobalOutRow;
|
||
HGLOBAL mhGlobalStack;
|
||
WORD mIsConstructed;
|
||
};
|
||
#endif
|
||
|