The current URL is datacrystal.tcrf.net.
Crystal Beans from Dungeon Explorer/Cutscene Data Compression: Difference between revisions
(Created page) |
m (Hawk moved page Crystal Beans From Dungeon Explorer/Cutscene Data Compression to Crystal Beans from Dungeon Explorer/Cutscene Data Compression) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{subpage}} | |||
The compression scheme used for cutscene data is a LZSS with a 256 bytes dictionary initialized to 0. It uses an 8-bits index initialized to 0xEF and a 4-bits count. It's peculiar in that to avoid wasting a nibble it encodes the count of 2 index/count pair in a single byte. | The compression scheme used for cutscene data is a LZSS with a 256 bytes dictionary initialized to 0. It uses an 8-bits index initialized to 0xEF and a 4-bits count. It's peculiar in that to avoid wasting a nibble it encodes the count of 2 index/count pair in a single byte. | ||
Latest revision as of 21:03, 28 January 2024
This is a sub-page of Crystal Beans from Dungeon Explorer.
The compression scheme used for cutscene data is a LZSS with a 256 bytes dictionary initialized to 0. It uses an 8-bits index initialized to 0xEF and a 4-bits count. It's peculiar in that to avoid wasting a nibble it encodes the count of 2 index/count pair in a single byte.
Decompression
This is a pretty standard procedure apart from the fact that the count byte must be saved to process a second index/count pair and that a variable is needed to check whether the low or high nibble is to be used.
The most significant nibble is used first, then the least significant one.
The dictionary is initialized to 0 and its index is initialized to 0xEF.
The control byte is checked from the most significant bit to the least significant bit. If the bit is set, output a literal byte, otherwise read the source index byte and the count byte if applicable and output count + 2 bytes from the dictionary starting at index.
Compression
For the compression, the location of the count byte within the output must be remembered to update its value when making a second index/count pair.