Unit LZSS32 |
LZ77 compression for 32-bit Delphi 2: Ported by C.J.Rankin from the 16-bit unit LZSSUnit. Rumour has it that the Pentium Pro cannot handle `partial register loads' efficiently; apparently, assigning a value to AL,AH,AX (e.g.) and then reading EAX, or assigning AL,AH and reading AX causes the pipelines to stall. Call me optimistic/pedantic, but I have tried to avoid this where possible. Original unit credits: Assembler Programmer: Andy Tam, Pascal Conversion: Douglas Webb, Unit Conversion and Dynamic Memory Allocation: Andrew Eigus. Written by Andrew Eigus (aka: Mr. Byte) of: Fidonet: 2:5100/33, Internet: aeigus@fgate.castle.riga.lv, aeigus@kristin.cclu.lv.
Classes |
Functions |
LZDecode - } { Restore registers and flush Output buffer } {
LZDone - #X LZDone
LZInit
LZEncode - #Z-
} { Move this node as the root of the subtree .
LZInit - #Z-
} { Restore registers and flush Output buffer .
LZSquash - #X LZUnsquash
LZDone
LZUnSquash - #X LZDone
LZSquash
Types |
PBinaryTree
PLZRWBuffer
TBinaryTree
TLeftMomTree
TLZRWBuffer
TLZSSWord
TLZTextBuf
TReadProc
TRightTree
TWriteProc
Constants |
F
Log2TLZSSWord
LZRWBufSize
LZSSMemRequired
N
Nul
Threshold
Variables |
BinaryTree
CodeBuf
Height
InBufP
InBufPtr
InBufSize
IsLZInitialized
LastLen
LZReadProc
LZWriteProc
MatchLen
MatchPos
OutBufP
OutBufPtr
Functions |
} { Move this node as the root of the subtree ... } {
} { Restore registers and flush Output buffer ... } {
LZSquash
Types |
PBinaryTree = ^TBinaryTree
PLZRWBuffer = ^TLZRWBufferThis is declaration for custom write function. It should write Count bytes into WriteBuf, returning the number of actual bytes written. } {#Z+
TBinaryTree = record
TextBuf : TLZTextBuf;
Left : TLeftMomTree;
Right : TRightTree;
Mom : TLeftMomTree
end;
TLeftMomTree = array[0..N] of TLZSSWord;
TLZRWBuffer = array[0..LZRWBufSize - 1] of Byte;
TLZSSWord = Cardinal#Z+
TLZTextBuf = array[0..N + F - 2] of Byte;file buffers
TReadProc = function(var ReadBuf): TLZSSWord#X LZUnsquash
TRightTree = array[0..N + 256] of TLZSSWord;
TWriteProc = function(var WriteBuf; Count: TLZSSWord): TLZSSWord#X LZUnsquash
Constants |
Variables |