请输入您要查询的百科知识:

 

词条 Compress
释义

  1. Description of program

  2. History

  3. Special output format

  4. See also

  5. References

  6. External links

{{about|the data compression utility|the cloth used in medicine|Compress (medical)|other uses|Compression (disambiguation)}}{{Refimprove|date=June 2012}}{{lowercase title}}{{Infobox Software
| name = compress / uncompress
| logo =
| screenshot =
| screenshot size =
| caption =
| author = Spencer Thomas
| developer =
| released = {{Start date and age|1985|2}}
| latest release version =
| latest release date =
| operating system = Unix and Unix-like
| genre = Command
| license =
| website =
}}{{Infobox file format
| name = compress .Z
| extension = .Z
| mime = application/x-compress
| owner = Spencer Thomas
| genre = data compression
| website =
}}

compress is a Unix shell compression program based on the LZW compression algorithm.[1] Compared to more modern compression utilities such as gzip and bzip2, compress performs faster and with less memory usage, at the cost of a significantly lower compression ratio.

The uncompress utility will restore files to their original state after they have been compressed using the compress utility. If no files are specified, the standard input will be uncompressed to the standard output.

In the up-coming POSIX and Single Unix Specification revision, it is planned that DEFLATE algorithm used in gzip format be supported in those utilities.[2]

Description of program

Files compressed by compress are typically given the extension ".Z" (modeled after the earlier pack program which used the extension ".z"). Most tar programs will pipe their data through compress when given the command line option "-Z". (The tar program in its own does not compress; it just stores multiple files within one tape archive.)

Files can be returned to their original state using uncompress. The usual action of uncompress is not merely to create an uncompressed copy of the file, but also to restore the timestamp and other attributes of the compressed file.

For files produced by compress on other systems, uncompress supports 9- to 16-bit compression.

History

The LZW algorithm used in compress was patented by Sperry Research Center in 1983. Terry Welch published an IEEE article on the algorithm in 1984,[3] but failed to note that he had applied for a patent on the algorithm. Spencer Thomas of the University of Utah took this article and implemented compress in 1984, without realizing that a patent was pending on the LZW algorithm. The GIF image format also incorporated LZW compression in this way, and Unisys later claimed royalties on implementations of GIF. Joseph M. Orost led the team and worked with Thomas et al. to create the 'final' (4.0) version of compress and published it as free software to the 'net.sources' USENET group in 1985. {{US patent|4558302}} was granted in 1985, and this is why compress could not be used without paying royalties to Sperry Research, which was eventually merged into Unisys. compress has fallen out of favor in particular user-groups because it makes use of the LZW algorithm, which was covered by a Unisys patent{{snd}} because of this, gzip and bzip2 increased in popularity on Linux-based operating systems due to their alternative algorithms, along with better file compression. compress has, however, maintained a presence on Unix and BSD systems. The US LZW patent expired in 2003, so it is now in the public domain in the United States. All patents on the LZW worldwide have also expired (see Graphics Interchange Format#Unisys and LZW patent enforcement).

In the up-coming POSIX and Single Unix Specification revision, it is planned that DEFLATE algorithm used in gzip format be supported in those utilities.

Special output format

Output binary consists of bit groups. Each bit group consists of codes with fixed amount of bits (9-16). Each group (except last) should be aligned by amount of bits multiplied by 8 and right padded with zeroes. Last group should be aligned by 8 and padded with zeroes. You can find more information in ncompress [https://github.com/vapier/ncompress/issues/5 issue].

For example you want to output 10 9 bit codes and than output 5 10 bit codes. You have 2 bit groups: 100 bits and 50 bits. First group should be aligned by 72 and right padded with zeroes. Second group should be aligned by 8 and right padded with zeroes. You need to output 100 bits, than 44 zero bits, than 50 bits, than 6 zero bits.

It is actually a bug. LZW doesn't require any alignment. This bug is a part of original UNIX compress, ncompress, gzip and even windows port. It exists more than 35 years. All application/x-compress files were created using this bug. So we have to include it in output specification.

Some compress implementations writes random bits from uninitialized buffer as alignment bits. There is no guarantee that alignment bits will be zeroes. So in terms of 100% compatibility decompressor have to just ignore alignment bit values.

See also

  • Data compression
  • Image compression
  • List of Unix commands
  • gzip

References

1. ^{{cite web |url=http://ncompress.sourceforge.net/ |title=ncompress: a public domain project |last=Frysinger |first=Mike |accessdate=2014-07-30 |quote=Compress is a fast, simple LZW file compressor. Compress does not have the highest compression rate, but it is one of the fastest programs to compress data. Compress is the defacto standard in the UNIX community for compressing files. }}
2. ^{{cite web|url=http://austingroupbugs.net/view.php?id=1041|website=Austin Group Bug Tracker|accessdate=2017-11-23|title=0001041: Encourage implementations to include better integrity checksum, compression and decompression utilities if possible.}}
3. ^{{cite journal|author=Welch, Terry A.|authorlink=Terry Welch|url=https://www.cs.duke.edu/courses/spring03/cps296.5/papers/welch_1984_technique_for.pdf|title=A technique for high performance data compression|journal=IEEE Computer|volume=17|issue=6|pages=8-19|year=1984|doi=10.1109/MC.1984.1659158}}

External links

  • {{man|cu|compress|SUS|compress data}}
  • ncompress - public domain compress/uncompress implementation for POSIX systems
  • compress - original Unix compress (in a compress'd archive)
  • compress - original Unix compress executable (gzip'd)
  • Source Code for compress v4.0 (gzip'd sharchives)
  • ZIP File containing a Windows port of the compress utility
  • [https://svnweb.freebsd.org/base/head/usr.bin/compress/ source code to the current version of fcompress.c from compress]
  • [https://github.com/vapier/ncompress/issues/5 bit groups alignment] - Explanation of bit groups alignment.
{{Compression Software Implementations}}

4 : Data compression software|Unix archivers and compression-related utilities|Standard Unix programs|Unix SUS2008 utilities

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/16 7:13:28