home *** CD-ROM | disk | FTP | other *** search
- Ok, here are the steps required to implement 13-bit squashing:
-
- 1). Squashing uses 9 to 13 bit codes while crunching only uses 9 to 12.
- Change the constant CrunchBits from 12 to 13.
-
- 2). The use of 13-bit codes requires a larger code table since the largest
- possible code will increase from 4095 to 8191. Change the constant
- TableSize to 8191.
-
- 3). In 12-bit "Crunching", the header record written to the archive file
- for each file archived is 30 bytes long. The last of these bytes
- contains the maximum code size (in bits). The header records for
- squashed files does not contain this entry in the header (ie. squash
- headers are only 29 bytes long). Remove the field MaxBits from the
- HdrRec type definition and also remove any references to MaxBits.
-
- 4). Since we removed that byte from the header record in step 3, the
- resulting archived filesize doesn't need the extra help that is
- provided in the Update_ARC_Header procedure via the succ function.
- Change the assignment statement for ArcHdr.Size to read: ArcHdr.Size :=
- EndPos - HdrOffset - SizeOf(ArcHdr);
-
- 5). Crunched files are recognized by archive extraction programs by a value
- of 8 in the Compression Type field of the header record. Squashed files
- have a 9 in this field. Modify the Begin_Arc procedure to set the
- header record field ComprType to 9 instead of 8.
-
- 6). The crunching algorithm calls for "packing" of repeated input
- characters before actually crunching the file. Squashing does not
- pre-pack the input before applying the LZW compression technique.
- So...change the Pack_and_Crunch procedure to look like:
-
- Procedure Pack_and_Crunch(Source : String);
- Var
- I : Word;
- Begin
- If FirstCh then
- CrcVal := 0;
-
- If Source = '' then
- Crunch(-1)
- else
- For I := 1 to Length(Source) do begin
- Inc(BytesIn);
- CRCVal := ((CRCVal shr 8) and $00FF) xor
- CRCTab[(CRCVal xor Ord(Source[I])) and $00FF];
- Crunch(Ord(Source[I]));
- end {for};
-
- end {Pack_and_Crunch};
-
-
- rpb
- 12/15/88
-