#author("2024-08-30T03:45:49+00:00","default:yoya","yoya")
#author("2024-08-30T03:46:00+00:00","default:yoya","yoya")
TITLE:zlib (A Massively Spiffy Yet Delicately Unobtrusive Compression Library)
[[Compression]]
- http://www.zlib.net/
-- http://www.zlib.net/zlib_tech.html Technical Details
- http://oku.edu.mie-u.ac.jp/~okumura/compression/zlib.html zlib 入門
- http://dencha.ojaru.jp/programs/pg_filer_04_extra_03.html zlib1.2.2 FAQ 訳
- http://www.futomi.com/lecture/japanese/rfc1950.html RFC 1950 ZLIB Compressed Data Format Specification version 3.3 日本語訳
- [[Deflate]] (圧縮アルゴリズム)
* 実装 [#r039a549]
- http://www.zlib.net/ # zlib
-- https://github.com/madler/zlib # adler32のひと
- https://github.com/jtkukunas/zlib # Intel
- https://github.com/cloudflare/zlib # CloudFlare
- https://github.com/ebiggers/libdeflate # Libdeflate
- https://github.com/zlib-ng/zlib-ng # zlib-ng
- https://github.com/simonis/zlib-chromium # zlib-chromium
- [[zlib-rs]]
- [[zlib-rs]] (Rust)
** 比較 [#compare]
- A comparison of Zlib implementations
-- http://www.htslib.org/benchmarks/zlib.html
- Improving zlib-cloudflare and comparing performance with other zlib forks
-- https://aws.amazon.com/jp/blogs/opensource/improving-zlib-cloudflare-and-comparing-performance-with-other-zlib-forks/
* compress / uncompress [#comp_uncomp]
** compress [#compress]
compsize = ~; // 圧縮後のサイズより大きな値
compbuff = malloc(compsize);
int result = compress(compbuff, &compsize, origbuff, origsize);
if (result != Z_OK) {
if (result == Z_MEM_ERROR) {
fprintf(stderr, "compress: Z_MEM_ERROR: can't malloc\n");
} else if (result == Z_BUF_ERROR) {
fprintf(stderr, "compress: Z_BUF_ERROR: not enough buff size\n");
}
return 1; // FAILURE
}
** uncompress [#uncompress]
origsize = ~; // 伸張後のサイズより大きな値
origbuff = malloc(origsize);
int result = uncompress(origbuff, &origsize, compbuff, compsize);
if (result != Z_OK) {
if (result == Z_MEM_ERROR) {
fprintf(stderr, "uncompress: Z_MEM_ERROR: can't malloc\n");
} else if (result == Z_BUF_ERROR) {
fprintf(stderr, "uncompress: Z_BUF_ERROR: not enough buff size\n");
}
return 1; // FAILURE
}
* inflate / defrate [#q681d972]
(予定)
* 発表スライド [#slide]
未圧縮形式と固定ハフマン
-- http://www.slideshare.net/7shi/deflate
* 参考 [#ref]
- http://tools.ietf.org/rfc/rfc1950.pdf
- http://tools.ietf.org/rfc/rfc1951.pdf
- http://tools.ietf.org/rfc/rfc1952.pdf
- PNG Deflate/Inflate 圧縮
-- http://www.sutv.zaq.ne.jp/linuz/tks/PngSpec1.2/PNG-Compression.html
- Zlib Flush Modes
- https://www.bolet.org/~pornin/deflate-flush.html
- カスタムハフマン (dynamic huffman)
-- http://d.hatena.ne.jp/n7shi/20110719/1311093479
- Zlib (Deflate のコンテナ)
-- http://www.futomi.com/lecture/japanese/rfc1950.html
- Deflate (圧縮の仕様
-- http://www.futomi.com/lecture/japanese/rfc1951.html)
- IO_Zlib 1.0.0 リリース (ハマりどころメモ)
-- http://d.hatena.ne.jp/yoya/20110726/io_zlib
- SWFバイナリ編集のススメ番外編 (zlib 伸張)
-- https://labs.gree.jp/blog/2012/01/4082/
-- https://labs.gree.jp/blog/2014/01/4530/
* 関連 [#rel]
- [[Deflate]]
- [[PNG]]
- [[IO_Zlib]]
- [[LZFSE]] (Apple の圧縮技術)