Westwood Compression Method 2

From ModdingWiki
Jump to: navigation, search
Westwood Compression Method 2
Format typeCompression algorithm
I/O unit size1-bit

As with compression method one 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.

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 Compression Method One.

/ Linus Kalliope