Files
Work/mdiwin/LZW.HPP
2024-08-07 09:16:27 -04:00

63 lines
1.5 KiB
C++
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef _LZWDECOMPRESSION_HPP_
#define _LZWDECOMPRESSION_HPP_
#include <string.h>
#include <mdiwin/windows.hpp>
#include <mdiwin/types.hpp>
#include <mdiwin/istream.hpp>
class LZWDecompression : public IStream
{
public:
LZWDecompression(const char *pathFileName);
virtual ~LZWDecompression();
enum{CMASKSIZE=9,STARTTABLESIZE=5,INCTABLESIZE=5};
enum{OUTROWSIZE=2048,CTSIZE=4096,STACKSIZE=4096};
void unpackData(USHORT imageWide,USHORT imageDeep,USHORT isInterlaced,USHORT pixelSize);
protected:
virtual void errorHandler(CHAR *errorMessage);
virtual void showHandler(UCHAR FAR *lpOutRow,USHORT yLocation);
private:
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