| Class TLZHCompressor (unit TLZHCOMP) |
TComponent
| Constructors |
constructor Create(AOwner: TComponent);decoder table
| Functions |
destructor Destroy;
function IsError : Integer;
procedure Compress;
procedure Decompress;
procedure GetBytesBuff(var DTA; NBytes:WORD; var Bytes_Got : WORD);
procedure OnGetBytes(var DTA;NBytes: WORD;var Bytes_Put: WORD);
procedure OnPutBytes(var DTA;NBytes: WORD;var Bytes_Put: WORD);
procedure PutBytesBuff(var DTA; NBytes:WORD; var Bytes_Put : WORD);
Function DecodeChar: Integer;
Function DecodePosition: WORD;
Procedure DeleteNode(p: Integer);remove p
Procedure EncodeChar(c: WORD);repeat it until reaching the root
Procedure EncodeEnd;
Procedure EncodePosition(c : WORD);
Function GetBit: Integer;Huffman coding parameters
Function GetByte: Integer;get one bit
Procedure Init;
Procedure InitTree;
Procedure InsertNode(r : Integer);node
Procedure Putcode(l : Integer; c: WORD);get a byte
Procedure Reconst;reconstruct freq tree
procedure SetReadBuffer(BufSize : Word);
procedure SetWriteBuffer(BufSize : Word);
Procedure StartHuff;initialize freq tree
Procedure update(c : Integer);update freq tree
| Properties |
property ReadBufSize : Word
property WriteBufSize : Word
property Finished : Boolean| Events |
| Variables |
code : WORD;
codesize : longint;
dad : WordRayPtr;
EOI : Boolean;
FfFinished : Boolean;
FReadBufSize : Word;
freq : FreqPtr;
FwError : Integer;
FWriteBufSize : Word;
getbuf : WORD;
getlen : BYTE;
GetPosn : word;
InBuf : BufPtr;
IOGetBuf : word;
len : WORD;
lson : WordRayPtr;
match_length : Integer;
match_position : Integer;
OutBuf : BufPtr;
printcount : longint;
prnt : PntrPtr;
putbuf : WORD;
putlen : BYTE;
PutPosn : word;
rson : BWordRayPtr;
son : SonPtr;
textsize : longint;
text_buf : TBufPtr;| Constructors |
constructor Create(AOwner: TComponent);Public declarations
decoder table
| Functions |
destructor Destroy;Initialize properties - order IS important
function IsError : Integer;
procedure Compress;Protected declarations } { I/O Buffering routines.
input lower 6 bits directly
procedure Decompress;Signal to flush the buffers.
procedure GetBytesBuff(var DTA; NBytes:WORD; var Bytes_Got : WORD);Flush condition
procedure OnGetBytes(var DTA;NBytes: WORD;var Bytes_Put: WORD);
procedure OnPutBytes(var DTA;NBytes: WORD;var Bytes_Put: WORD);
procedure PutBytesBuff(var DTA; NBytes:WORD; var Bytes_Put : WORD);Buffer routines (because this algorithm crunches a byte at a time, I/O buffering is implemented here to improve performance.
Function DecodeChar: Integer;Add a bit to signal the end of the data.
Function DecodePosition: WORD;Special end of decompress case - get out.
Procedure DeleteNode(p: Integer);Inserting node to the tree
remove p
Procedure EncodeChar(c: WORD);update freq tree
repeat it until reaching the root
Procedure EncodeEnd;output lower 6 bits directly
Procedure EncodePosition(c : WORD);if node's address is odd, output 1 else output 0
Function GetBit: Integer;Deleting node from the tree } { Huffman coding parameters
Huffman coding parameters
Function GetByte: Integer;get one bit
get one bit
Procedure Init;
Procedure InitTree;
Procedure InsertNode(r : Integer);Initializing tree
node
Procedure Putcode(l : Integer; c: WORD);get a byte
get a byte
Procedure Reconst;initialize freq tree
reconstruct freq tree
procedure SetReadBuffer(BufSize : Word);May be unnecesary.
procedure SetWriteBuffer(BufSize : Word);Don't mess with these values while compressing or decompressing!!!
Procedure StartHuff;output l bits
initialize freq tree
Procedure update(c : Integer);reconstruct freq tree
update freq tree
| Properties |
property ReadBufSize : WordPublished declarations
property WriteBufSize : Word
property Finished : Boolean| Events |
| Variables |
code : WORD;
codesize : longint;
dad : WordRayPtr;
EOI : Boolean;
FfFinished : Boolean;End of Input flag - for decoding. } { Properties
FReadBufSize : Word;
freq : FreqPtr;
FwError : Integer;When we're doing an operation this is False
FWriteBufSize : Word;
getbuf : WORD;Private declarations
getlen : BYTE;
GetPosn : word;
InBuf : BufPtr;
IOGetBuf : word;
len : WORD;
lson : WordRayPtr;
match_length : Integer;
match_position : Integer;
OutBuf : BufPtr;
printcount : longint;
prnt : PntrPtr;cumulative freq table } * pointing parent nodes. * area [T..(T + N_CHAR - 1)] are pointers for leaves
putbuf : WORD;
putlen : BYTE;
PutPosn : word;I/O Buffer variables
rson : BWordRayPtr;
son : SonPtr;pointing children nodes (son[], son[] + 1
textsize : longint;
text_buf : TBufPtr;