This is my first post, though i have been visiting this site recently every now and then, watching professional and expert programmers exchange lively ideas and suggestions to come up with the most powerful compressors.
Let me share here my one way to output LZ77 codes, which may improve LZ77/LZSS/ or LZW.
LZ77 coding transmits <offset, length> codes. Many times in the compression process, the same matching string is coded with the same <length> code. We can avoid transmitting the <length> code for many strings as well as not outputting a bit to identify a literal (as in LZSS) by the following:
Instead, read the whole input or block (or history buffer) and gather matching strings and encode the <<the whole string>> e.g., <<offset>> plus <<length of the string (n>=2)>> only this one time, <<the number of the same matching strings (ie., number of following offset codes)>>, and its succeeding occurrences in the input block by transmitting only the said <<offset>> codes. This is actually a "Reduced Length LZ (RLLZ)".
The literals are outputted last *without bit flags* since they fall into the block buffers not covered or "not activated" by encoded strings.
During decoding, the strings are written first in the output buffer using the offsets, and the literals "fill in" the unwritten positions in the output buffer.
-- Gerald R. Tamayo