LZSS Compression: Difference between revisions

>Aruki
>Aruki
Line 57: Line 57:
If the bit corresponding to the current data chunk is not set, you read one byte group directly from the compressed buffer; simple.
If the bit corresponding to the current data chunk is not set, you read one byte group directly from the compressed buffer; simple.


If the bit is set, then that means you need to read data back from the decompressed buffer, which is where it gets a little more complicated. Read two bytes from the decompressed buffer; these tell you exactly how far back in the decompressed buffer to seek, and how many byte groups to read from it. The exact way to utilize it varies depending which mode is set:
If the bit is set, then that means you need to read data back from the decompressed buffer, which is where it gets a little more complicated. Read two bytes from the compressed buffer; these tell you exactly how far back in the decompressed buffer to seek, and how many byte groups to read from it. The exact way to utilize it varies depending which mode is set:


{| class="wikitable"
{| class="wikitable"
Anonymous user