World Library  
Flag as Inappropriate
Email this Article

Zlib

Article Id: WHEBN0000034499
Reproduction Date:

Title: Zlib  
Author: World Heritage Encyclopedia
Language: English
Subject: Rsync, Portable Network Graphics, Adler-32, Btrfs, List of RFCs
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Zlib

zlib
zlib logo
Initial release 1 May 1995 (1995-05-01)
Stable release 1.2.8 / 28 April 2013 (2013-04-28)
Written in C
Operating system Cross-platform
Type Data compression
License zlib license
Website .netzlib

zlib is a software library used for data compression. zlib was written by Jean-Loup Gailly and Mark Adler and is an abstraction of the DEFLATE compression algorithm used in their gzip file compression program. zlib is also a crucial component of many software platforms including Linux, Mac OS X, and iOS. It has also been used in gaming consoles such as the PlayStation 4, PlayStation 3, Wii U, Wii, Xbox One and Xbox 360.

The first public version of zlib, 0.9, was released on 1 May 1995 and was originally intended for use with the libpng image library. It is free software, distributed under the zlib license.

Capabilities

Encapsulation

zlib compressed data are typically written with a gzip or a zlib wrapper. The wrapper encapsulates the raw DEFLATE data by adding a header and trailer. This provides stream identification and error detection that are not provided by the raw DEFLATE data.

The gzip header is larger than the zlib header, as it stores a file name and other file system information. This is the header format used in the ubiquitous gzip file format.

Algorithm

As of February 2010, zlib only supports one algorithm called DEFLATE, that is a variation of LZ77 (Lempel–Ziv 1977). This algorithm provides good compression on a wide variety of data with minimal use of system resources. This is also the algorithm used in the ZIP archive format.

The header makes allowance for other algorithms, but none are currently implemented.

Resource use

zlib provides facilities for control of processor and memory use. A compression level value may be supplied that trades-off speed with compression. There are also facilities for conserving memory. These are probably only useful in restricted memory environments such as some embedded systems.

Strategy

The compression can be optimized for specific types of data. If one is using the library to always compress specific types of data, then using a specific strategy may improve compression and performance. For example, if the data contain long lengths of repeated bytes, the RLE (run-length encoding) strategy may give good results at higher speed. For general data, the default strategy is preferred.

Error handling

Errors in compressed data may be detected and skipped. Further, if "full-flush" points are written to the compressed stream, then corrupt data can be skipped, and the decompression will resynchronize at the next flush point - although no error recovery of the corrupt data is provided. Full-flush points are useful for large data streams on unreliable channels, where some data loss is unimportant, such as in some multimedia applications. However, creating many flush points can affect the speed as well as amount (ratio) of compression.

Data length

There is no limit to the length of data that can be compressed or decompressed. Repeated calls to the library allow an unlimited numbers of blocks of data to be handled. Some ancillary code (counters) may suffer from overflow for long data streams, but this does not affect the actual compression or decompression.

When compressing a long (or infinite) data stream, it is advisable to write regular full-flush points.

Applications

Today, zlib is something of a de facto standard, to the point that zlib and DEFLATE are often used interchangeably in standards documents, with thousands of applications relying on it for compression, either directly or indirectly.[1] These include:

zlib is also used in many embedded devices, such as the Apple iPhone and Sony PlayStation 3, because the code is portable, liberally licensed, and has a relatively small memory footprint.

See also

References

  1. ^ Gailly, Jean-loup; Adler, Mark (2002-04-18), zlib Applications 
  2. ^ System.IO.Compression.DeflateStream. MSDN Library.

External links

  • Official website
  • RFC 1950—ZLIB Compressed Data Format
  • RFC 1951—DEFLATE Compressed Data Format
  • RFC 1952—GZIP file format
  • miniz.c, a single-source-file, public-domain implementation of the zlib API for embedded and memory-limited use cases
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.