A state might not be compressible (details in next section). We need to use 1 bit, that is, 0 as the header of an uncompressible state. Again, there m

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-05-12 07:00:05

A state might not be compressible (details in next section). We need to use 1 bit, that is, 0 as the header of an uncompressible state.

Again, there might be many uncompressible bytes (low-frequency bytes). Each uncompressible bytes would be expanded to 9 bits because a header 0 is needed to indicate the following 8 bits are not compressed.

For compressible bytes (high-frequency bytes recorded in the dictionary), we put one bit, that is 1 to indicate the compression. The actual length of the compressed byte would be reflected by the METHOD code of this state.

For each state, we calculate the possible compression ratio of the 4 methods above and determine the real method adopted and put it to the header as METHOD code. For the DICT_ELEM_SIZE, we calculate the maximum size of the index of Top(N) and determin the size and the code in the header.

If all the possible compression ratios are greater than 1.0, we just give up and tag it as "uncompressible" with a one-bit header 0, and move on to the next state.

Leave a Comment