Westwood LZW-14
Format type | Compression algorithm |
---|---|
Type | Stream |
I/O unit size | 1-bit |
Games |
Westwood LZW-14 is a textbook implementation of LZW compression with a code length of 14 bits, following the basic LZW algorithm as described Mark Nelson. It is often referred to as "Format 2" or "Westwood Compression Method 2", because it is generally indicated in file headers' compression type as value "2".
As with LZW-12, this method has been seen in the game BattleTech: The Crescent Hawk's Revenge, but also in the demo version of Eye of the Beholder, the first game in the series. Both LZW variants were abandoned around 1993-1994 due to copyright enforcement on LZW by Unisys, and replaced by Westwood LCW.
Compressed structure
The limitation of 4095 indexes in method one has been overcome by increasing the bit length of the groups in method two. Other than that the compression is almost identical. The groups are thus 14 bits in length throughout the compressed data stream. The last group is set to 0x3fff and is used as the end marker. Finally the stream ends with 8 bits set to zero for files with even length.
- Byte group
- 000000 cccccccc - When the first six bits are set to zero the following eight bits represents a byte to store in the decompressed data stream.
- Index group
- xxxxxx yyyyyyyy - When the first six bits are not set to zero the whole group represents an index value which points to a previous group in the compressed data stream. To get the correct index value you first need to decrease the first six bits by one.
Other than that the decompression should work the same as with Westwood LZW-12.