| 1 |
# fdeflate |
| 2 |
|
| 3 |
[](https://crates.io/crates/fdeflate) |
| 4 |
[](https://docs.rs/fdeflate) |
| 5 |
[](https://github.com/image-rs/fdeflate/actions) |
| 6 |
|
| 7 |
A fast deflate implementation. |
| 8 |
|
| 9 |
This crate contains an optimized implementation of the deflate algorithm tuned to compress PNG |
| 10 |
images. It is compatible with standard zlib, but make a bunch of simplifying assumptions that |
| 11 |
drastically improve encoding performance: |
| 12 |
|
| 13 |
- Exactly one block per deflate stream. |
| 14 |
- No distance codes except for run length encoding of zeros. |
| 15 |
- A single fixed huffman tree trained on a large corpus of PNG images. |
| 16 |
- All huffman codes are <= 12 bits. |
| 17 |
|
| 18 |
It also contains a fast decompressor that supports arbitrary zlib streams but does especially |
| 19 |
well on streams that meet the above assumptions. |
| 20 |
|
| 21 |
### Inspiration |
| 22 |
|
| 23 |
The algorithms in this crate take inspiration from multiple sources: |
| 24 |
* [fpnge](https://github.com/veluca93/fpnge) |
| 25 |
* [zune-inflate](https://github.com/etemesi254/zune-image/tree/main/zune-inflate) |
| 26 |
* [RealTime Data Compression blog](https://fastcompression.blogspot.com/2015/10/huffman-revisited-part-4-multi-bytes.html) |