The lossless deflate compression algorithm is based on two other compression algorithms: Huffman encoding and LZ77 compression. You have to understand how these two algorithms work in order to understand deflate compression.
How Flate works
Deflate is a smart algorithm that adapts the way it compresses data to the actual data themselves. There are three modes of compression that the compressor has available:
- Not compressed at all. This is an intelligent choice for, say, data that’s already been compressed. Data stored in this mode will expand slightly, but not by as much as it would if it were already compressed and one of the other compression methods was tried upon it.
- Compression, first with LZ77, and then with a slightly modified version of Huffman coding. The trees that are used to compress in this mode are defined by the Deflate specification itself, and so no extra space needs to be taken to store those trees.
- Compression, first with LZ77 and then with a slightly modified version of Huffman coding with trees that the compressor creates and stores along with the data.
The data is broken up in “blocks,” and each block uses a single mode of compression. If the compressor wants to switch from non-compressed storage to compression with the trees defined by the specification, or to compression with specified Huffman trees, or to compression with a different pair of Huffman trees, the current block must be ended and a new one begun.
Advantages and disadvantages
I have no idea – add a comment if you know anything about the pros and cons.
Where is Flate/deflate compression used
I am only aware of one generic prepress application that relies on flate compression which is Adobe Acrobat. Flate compression is a standard feature of the PDF file format that Acrobat can handle.