Additional Compression Methods Specification
NOTE: WinZip® users do not need to read or understand the information contained on this page. It is intended for developers of Zip file utilities.
This document describes the file format that WinZip uses to create PPMd compressed, WavPack compressed and Jpeg compressed Zip files. The PPMd compression format was introduced in WinZip 10.0 Beta, released in August 2005. The WavPack compression format was introduced in WinZip 11.0 Beta, released in October 2006. The compressed Jpeg format was introduced in WinZip 12.0, released in September 2008. In WinZip 12.1, released in May of 2009, the Zipx file was introduced. The Zipx file is a Zip file that uses any of the aforementioned compression methods or the LZMA or bzip2 compression methods as documented in the Zip file appnote.txt specification.
From time to time we may update the information provided here, for example to document any changes to the file formats, or to add additional notes or implementation tips. If you would like to receive e-mail announcements of any substantive changes we make to this document, you can sign up below for our Developer Information mailing list.
Without compromising the basic Zip file format, WinZip Computing has extended the format specification to support PPMd and WavPack compression and compressed JPEG's, and this document describes the format extensions. Additionally, we are providing information about no-cost third-party source for the actual PPMd and WavPack compression code, the same code that is used by WinZip. We believe that use of the free compression code and of this specification will make it easy for all developers to add compatible compression to their Zip file utilities.
This document is not a tutorial on compression or Zip file structure. While we have attempted to provide the necessary details of the current PPMd, WavPack, and compressed Jpeg method specification in Zip file format, developers and other interested third parties will need to have or obtain an understanding of basic compression concepts, Zip file format, etc.
WinZip Computing makes no warranties regarding the information provided in this document. In particular, WinZip Computing does not represent or warrant that the information provided here is free from errors or is suitable for any particular use, or that the file formats described here will be supported in future versions of WinZip. You should test and validate all code and techniques in accordance with good programming practice.
Jpeg Compression - Compression Method 96
Compressed Jpeg is a lossless compression format for JPEG files. Information for compressed Jpeg 1.0, used in WinZip 12.0 or later, can be found on the internet at http://www.winzip.com/wz_jpg_comp.pdf.
WinZip stores each compressed JPEG file as output from the compressed JPEG routine in the Zip file immediately after the end of the local header. It sets the compression method to 96 in the local and central headers. WinZip also sets the version needed to extract and version made by fields in the local and central headers to the same values it would use if the files had been compressed with the Deflate algorithm.
WavPack - Compression Method 97
WavPack is an open-source lossless audio compression format developed by David Bryant. Information and source code for WavPack 4.32, which is backward and forward compatible with the version of WavPack used in WinZip 11.0 or later, can be found on the internet at http://www.wavpack.com.
WinZip stores each WavPack compressed .WAV file as output from the WavPack routines in the Zip file immediately after the end of the local header. It sets the compression method to 97 in the local and central headers. WinZip also sets the version needed to extract and version made by fields in the local and central headers to the same values it would use if the files had been compressed with the Deflate algorithm.
NOTE: it is necessary to compress the entire sequence of bytes used to store a sample, not just the bits used to represent the sample itself. For example, 12-bit samples require 2 bytes (16-bits) in the .WAV file format. If you tell WavPack that the sample size is only 12-bits, it will ignore the 4 unused bits during compression and set them to 0 on extract, regardless of what they were set to in the original file. Instead, telling WavPack that the sample size is the full 16-bits instead of the actual 12-bits is necessary to insure that the file extracts to one that is bit for bit identical to the original
PPMd - Compression Method 98
PPMd is an open-source data compression algorithm developed by Dmitry Shkarin. WinZip uses Version I, revision 1 of the algorithm. Information and source code for PPMd I rev. 1 can be found on the internet at http://www.compression.ru/ds/.
WinZip appends to the start of the PPMd compressed data in a Zip file a single two byte WORD of data containing the following three fields:
- Method of model restoration at memory insufficiency:
MRM_RESTART - restart model from scratch (0 - default)
MRM_CUT_OFF - cut off model (1)
MRM_FREEZE - freeze context tree (2)
- SubAlloc Size (in MB): default is 50MB.
WinZip will extract files with a SubAlloc Size anywhere from 1MB through and including 256MB (assuming there is enough free memory available on the PC running WinZip).
- Maximum model order: default is 8.
WinZip will extract files with a max model order anywhere from 2 through and including 16 (again, assuming that enough free memory is available on the PC running WinZip).
These fields are packed into the two byte WORD (stored in Intel low-byte/high-byte order) at the beginning of a compressed file as indicated in the following C++ code snippet:
- WORD wInfo = static_cast<WORD>(MaxModelOrder - 1)
| static_cast<WORD>((SubAllocatorSize - 1) << 4)
| static_cast<WORD>>(ModelRestorationMethod) << 12;
For files compressed with PPMd WinZip sets the version needed to extract and version made by fields in the local and central headers to the same values it would use if the files had been compressed with the Deflate algorithm.
XZ - Compression Method 95
XZ is an open-source data compression format co-developed by Igor Pavlov and Lasse Collin. It incorporates the LZMA2 compression algorithm combined with optional pre-processing filters for greater compression. Information and source code can be found online at http://tukaani.org/xz/.
WinZip supports the complete XZ 1.0.4 specification with the following two restrictions:
- Only a single stream is used. The stream can be optionally zero-padded.
- Only the LZMA2 filter plus one additional filter is supported. All predefined filters described in the XZ specification are recognized.
WinZip creates a stream block with a check type of NONE. Data integrity is handled via the standard CRC-32 mechanism described in the Zip format specification. All XZ check types including CRC-64 and SHA-256 are supported for applications that implement them. Multiple blocks within a stream are supported and must be zero-padded as described in the XZ specification.
For files compressed with XZ, WinZip sets the version needed to extract and version made by fields in the local and central headers to the same values it would use if the files had been compressed with the Deflate algorithm.
All credit and our thanks go to:
- Dmitry Shkarin for sharing PPMd with the world
- Dmitry Subbotin for placing his 'carryless rangecoder' into the public domain
- David Bryant for making the WavPack sources open-source
- Igor Pavlov and Lasse Collin for making the XZ sources available to all
We plan to use this mailing list to notify subscribers of any substantive changes made to the Developer Information pages on the WinZip web site.
Document version: 3.1
Last modified: April 14, 2014
Copyright© 2003-2015 WinZip International LLC
All Rights Reserved