1 collapse by releasing contained air or gas; "deflate a balloon"
2 release contained air or gas from; "deflate the air mattress"
3 reduce or lessen the size or importance of; "The bad review of his work deflated his self-confidence" [syn: puncture]
4 produce deflation in; "The new measures deflated the economy" [ant: inflate]
5 reduce or cut back the amount or availability of, creating a decline in value or prices; "deflate the currency" [ant: inflate]
6 become deflated or flaccid, as by losing air; "The balloons deflated" [ant: inflate]
- Rhymes: -eɪt
Deflate is a lossless data compression algorithm that uses a combination of the LZ77 algorithm and Huffman coding. It was originally defined by Phil Katz for version 2 of his PKZIP archiving tool, and was later specified in RFC 1951.
Deflate is widely thought to be free of any subsisting patents, and at a time before the patent on LZW (which is used in the GIF file format) expired, this has led to its use in gzip compressed files and PNG image files, in addition to the ZIP file format for which Katz originally designed it.
Stream formatA Deflate stream consists of a series of blocks. Each block is preceded by a 3-bit header:
- 1-bit: Last block in stream marker:
- 2-bits: Encoding method used for this block type:
Most blocks will end up being encoded using method 10, the dynamic Huffman encoding, which produces an optimised Huffman tree customised for each block of data individually. Instructions to generate the necessary Huffman tree immediately follow the block header.
Compression is achieved through two steps
- The matching and replacement of duplicate strings with pointers.
- Replacing symbols with new, weighted symbols based on frequency of use.
Duplicate string eliminationWithin compressed blocks, if a duplicate series of bytes is spotted (a repeated string), then a back-reference is inserted, linking to the previous location of that identical string instead. An encoded match to an earlier string consists of a length (3-258 bytes) and a distance (1-32768 bytes). Relative back-references can be made across any number of blocks, as long as the distance appears within the last 32kB of uncompressed data decoded (termed the sliding window).
The second compression stage consists of replacing commonly-used symbols with shorter representations and less commonly used symbols with longer representations. The method used is Huffman coding which creates an unprefixed tree of non-overlapping bit-sequences, where the length of each sequence is inversely proportional to the likelihood of that symbol needing to be encoded. The more likely a symbol has to be encoded, the shorter its bit-sequence will be.
A tree is created which contains space for 288 symbols:
- 0–255: represent the literal bytes/symbols 0–255.
- 256: end of block – stop processing if last block, otherwise start processing next block.
- 257–285: combined with extra-bits, a match length of 3–258 bytes.
- 286,287: not used, reserved and illegal but still part of the tree.
A match length code will always be followed by a distance code. Based on the distance code read, further "extra" bits may be read in order to produce the final distance. The distance tree contains space for 32 symbols:
- 0–3: distances 1–4
- 4–5: distances 5–8, 1 extra bit
- 6–7: distances 9–16, 2 extra bits
- 8–9: distances 17–32, 3 extra bits
- 26–27: distances 8193–16384, 12 extra bits
- 28–29: distances 16385–32768, 13 extra bits
- 30–31: not used, reserved and illegal but still part of the tree.
Note that for the match distance symbols 2–29, the number of extra bits can be calculated as n/2-1.
Encoder / CompressorDuring the compression stage, it is the encoder that chooses the amount of time spent looking for matching strings. The zlib/gzip reference implementation allows the user to select from a sliding scale of likely resulting compression-level vs. speed of encoding. Options range from -0 (do not attempt compression, just store uncompressed) to -9 representing the maximum capability of the reference implementation in zlib/gzip.
Other Deflate encoders have been produced, all of which will also produce a compatible bitstream capable of being decompressed by any existing Deflate decoder. Differing implementations will likely produce variations on the final encoded bit-stream produced. The focus with non-zlib versions of an encoder has normally been to produce a more efficiently compressed and small encoded stream.
Deflate64/Enhanced DeflateIt is a variant of Deflate that uses larger dictionary (64 kibibyte), 16-bit length code (match lengths 3-65538 byte), support of 14-bit distance code (30-31).
PKZIP supports Deflate64 beginning with version 2.50.
Using Deflate in new softwareImplementations of Deflate are freely available in many languages. C programs typically use the zlib library (under the old BSD license without advertising clause). Programs written using the Borland dialects of Pascal can use paszlib, a C++ library is included as part of 7-Zip/AdvanceCOMP. Java includes support as part of the standard library (in java.util.zip). Microsoft .NET Framework 2.0 base class library supports it in the System.IO.Compression namespace.
- PKZIP: the first implementation, originally done by Phil Katz as part of PKZip.
- zlib/gzip: standard reference implementation used in a huge amount of software, owing to public availability of the source code and a license allowing inclusion into other software.
- KZIP/PNGOUT: an encoder by the game-programmer Ken Silverman using "an exhaustive search of all patterns" and "[an] advanced block splitter".
- PuZip: designed for Commodore 64/C128 computers. PuZip is limited to an 8kB LZ77 window size, with only the store (type 00) and fixed Huffman (type 01) methods.
- BigSpeed Deflate: "Tiny in-memory compression library" available as a MS Windows DLL limited to 32kB blocks at a time and three compression settings.
- BJWFlate/DeflOpt: Ben Jos Walbeehm's utilities "designed to attempt to squeeze every possible byte out of the files it compresses". Note that the author has stopped development on BJWFlate (but not DeflOpt) in March 2004.
- Crypto++: contains a public domain implementation in C++ aimed mainly at reducing potential security vulnerabilities. The author, Wei Dai states "This code is less clever, but hopefully more understandable and maintainable [than zlib]".
- 7-Zip/AdvanceCOMP: written by Igor Pavlov in C++, this version is freely licensed and tends to achieve higher compression than zlib at the expense of CPU usage.
- PuTTY `sshzlib.c`: a standalone implementation, capable of full decode, but static tree only creation, by Simon Tatham. MIT licenced.
- Halibut `deflate.c`: a standalone implementation capable of full decode. Forked from PuTTY's `sshzlib.c`, but extended to write dynamic Huffman trees and provides Adler-32 and CRC-32 checksum support.
AdvanceCOMP uses the higher compression ratio version of Deflate as implemented by 7-Zip to enable recompression of gzip, PNG, MNG and ZIP files with the possibility of achieving smaller file sizes than zlib is able to at maximum settings. An even more effective (but also more user-input-demanding and CPU intensive) Deflate encoder is employed inside Ken Silverman's KZIP and PNGOUT utilities.
- AHA361-PCIX/AHA362-PCIX from Comtech AHA. Comtech produce a PCI-X only card (PCI-ID: 193f:0001) capable of compressing streams using Deflate at a claimed rate of up to 3.0 Gbit/s (375 MB/s) for uncompressed incoming data. Accompanying the Linux kernel driver for the AHA362-PCIX are an 'ahagzip' utility and customised 'mod_deflate_aha' capable of using the hardware compression from Apache. Despite containing a Xilinx Virtex FPGA and four custom AHA3601 ASICs, the hardware appears to be somewhat limited in only handling static Huffman blocks.
- StorCompress 300/MX3 from Indra Networks. This is a range of PCI (PCI-ID: 17b4:0011) or PCI-X cards featuring between one and six compression engines with claimed processing speeds of up to 3.6 Gbit/s (450 MB/s). A version of the cards are available with the separate brand WebEnhance specifically designed for web-serving use rather than SAN or backup use. There is also a PCI-E card which is the next generation of compression hardware available from this company, see: MX4E.
Decoder / DecompressorInflate is the decoding process that takes a Deflate bit stream for decompression and correctly produces the original full-size data or file.
Inflate-only implementationsThe normal intent with an alternative Inflate implementation is highly optimised decoding speed, or extremely predictable RAM usage for micro-controller embedded systems.
- inflate.cl: by John Foderaro. Self-standing Common Lisp decoder distributed with a GNU LGPL license.
- kunzip: by Michael Kohn and unrelated to "KZIP". Comes with C source-code under the GNU LGPL license. Used in the GIMP installer.
- lodepng: by Lode Vandevenne. A BSD-licensed single file PNG file reader with built-in C++ Inflate implementation and no external dependencies.
- pyflate: a pure-Python stand-alone Deflate (gzip) and bzip2 decoder by Paul Sladen. Written for research/prototyping and made available under the BSD/GPL/LGPL/DFSG licenses.
- PCDEZIP, Bob Flanders and Michael Holmes, published in PC Magazine 1994–01–11.
- puff.c, a small, unencumbered, single-file reference implementation included in the /contrib/puff directory of the zlib distribution.
- Serial Inflate GPU from BitSim. Hardware implementation of Inflate. Part of BitSim's graphics controller IP for embedded systems, BADGE (Bitsim Accelerated Display Graphics Engine).
- 6502 inflate written by Piotr Fusik in 6502 assembly language.
- tinf written by Jørgen Ibsen in ANSI C and comes with zlib license. Adds about 2k code.
- PKWARE's appnote.txt, .ZIP File Format Specification; Section 10, X. Deflating - Method 8.
- RFC 1951 – Deflate Compressed Data Format Specification version 1.3
- zlib Home Page
- An Explanation of the Deflate Algorithm by Antaeus Feldspar.
- Extended Application of Suffix Trees to Data Compression An excellent algorithm to implement Deflate by Jesper Larsson
deflate in German: Deflate
deflate in Spanish: Deflación (algoritmo)
deflate in French: Deflate
deflate in Korean: DEFLATE
deflate in Dutch: Deflate
deflate in Japanese: Deflate
deflate in Polish: Deflate
deflate in Portuguese: DEFLATE
deflate in Russian: DEFLATE
deflate in Slovenian: DEFLATE
deflate in Finnish: Deflate
deflate in Swedish: DEFLATE
deflate in Chinese: DEFLATE
abridge, beat down, belie, blow sky-high, blow up, break, cave, cave in, cheapen, collapse, compress, curtail, cut, cut back, cut down, cut prices, damp, dampen, decline, decrease, deduct, depreciate, depress, devaluate, diminish, disarm, disconfirm, discredit, disgrace, disprove, dive, downgrade, embarrass, enchain, explode, expose, fall, fall in, fall in price, fold, fold up, gag, give way, hamstring, handcuff, hobble, hog-tie, humble, humiliate, implode, invalidate, jew down, knock out, lessen, let down, lower, manacle, mark down, mortify, muzzle, negate, negative, nose-dive, paralyze, pare, plummet, plunge, prostrate, prove the contrary, puncture, put out, put to shame, reduce, retrench, roll back, sag, scale down, shame, shave, shorten, show up, silence, simplify, slash, slump, step down, strangle, take from, throttle, trim, truss up, tune down, undercut