The Z_RLE implementation

There are many ways to implement Z_RLE. The simplest approach that does not impact performance and makes use of the existing code, is the following:

I wish to mention that I intended to implement a faster version of Z_HUFFMAN_ONLY and Z_RLE.

It is quite likely that the user might not want to change the strategy parameter from Z_HUFFMAN_ONLY or Z_RLE while compressing one file (i.e. the user might not want to call deflateParams()). This means that maintaining s->prev and s->head in the deflate_state would be unnecessary.

In this case, the user might notify deflate, which would run a specialized function that completely avoids the Ziv-Lempel searches, and simply sends literals or run-lengths instead, to _tr_tally.

Also note that, since s->prev and s->head are not used, they don't need to occupy memory.

Unfortunately, the lack of time prevented me from doing this. It might not be such a big problem, however, because these particular memory and time savings don't seem to matter nowadays; apparently, even the palmtops are running Java with inside, without problems.

Back to Z_RLE main page