LZMA

LZMA, short for Lempel-Ziv-Markov chain-Algorithm, is a data compression algorithm developed until 2001 and used in the 7z format of the 7-Zip archiver and by StuffitX. It uses a dictionary compression scheme somewhat similar to LZ77 and features a high compression ratio (generally higher than Bzip2) and a variable compression-dictionary size (up to 4 GB). (see also LZW)

Contents

Overview

The open source (written in C++) LZMA compression library uses an improved LZ77 compression algorithm, as well as specific preprocessing routines for binaries. It uses some entropy coding.

Streams for data, repeated-sequence size and repeated-sequence location seem to be compressed separately.

Other used concepts include hash chains, binary trees and Patricia tries.

BCJ / BCJ2 binary file compression

The LZMA SDK comes with the BCJ / BCJ2 compressor included: For x86, ARM, PowerPC (PPC), IA64 and ARMThumb processors, jump targets are normalized before compression. For x86, this means that near jumps, calls and conditional jumps (but not short jumps and conditional jumps) are converted from the machine language "jump 1655 bytes backward" style notation to normalized "jump to address 5554" style notation.

While 7-Zip BCJ2 assumes 32 bit displacements (addresses), for example the UPX executable file compressor can also use 16 bit values when it detects 16 bit DOS binary file formats. The RAR compressor uses displacement compression for 32 bit x86 executables and IA64 Itanium executables.

The difference between BCJ and BCJ2 is that the former only translates near jump / call targets to their normalized form, BCJ2 compresses (x86 only) near jump, near call and conditional near jump targets separately.

7-Zip implementation

The reference implementation, which is available under the GNU LGPL license, has the following properties:

The decompression code for LZMA is around 5KB and the dynamic memory needed during decompression is modest (it depends on the dictionary size). These features make the decompression phase of the algorithm well-suited to embedded applications.

The use of Microsoft Windows specific features is deeply buried in the source code, which makes it very difficult to create a Unix-compatible version. However, there are two working ports to Unix-like platforms: p7zip (http://sourceforge.net/projects/p7zip/) is a more-or-less complete port of the 7z and 7za command-line versions of 7-zip for POSIX systems like Unix (Linux, Solaris, OpenBSD, FreeBSD, Cygwin, ...), MacOS X and BeOS. LZMA Unix Port (http://martinus.geekisp.com/rublog.cgi/Projects/LZMA) is a port of only the LZMA code to create a stream based compression utility similar to gzip. This tool is not an archiving utility and so its format is a plain one (and not equivalent to a raw LZMA stream from 7-zip due a missing UInt64 specifying uncompressed filesize at the end of the header). 7-zip uses a more flexible archive format, 7z, and thus neither tool can use the files the other creates, at least for now.

There is a Mac OS X port of 7zip called Compress (not related to the old archiving format), but it is buggy at best.

The PyLZMA Python Wrapper (http://www.joachim-bauch.de/projects/python/pylzma) supports compression and decompression on the Windows and Linux platforms.

Some embedded router-dsl-wireless devices (like the US Robotics 9105 and 9106) run a modified version of Linux (source code available on USR website (http://www.usr.com/support/s-gpl-code.asp), apparently the source comes from Broadcom) which boots on a filesystem which is basically Cramfs, modified to use LZMA compression instead of ZLIB. They seem to use a thick layer of glue code around the reference decompression code (it's a read-only filesystem like ISO9660, the standard compact disc filesystem). Modified cramfs tools (http://babel.ls.fi.upm.es/~aacosta/twiki/bin/view/Projects/CramfsPatches) are available to deal with such LZMA CRAMFS filesystem images.

External links

Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools