Apple Data Compression (ADC) data format
ADC compression is used in various data formats used on Mac OS, including Universal Disk Image Format (UDIF) files (.dmg).
Overview
ADC compressed data consist of:
- one or more chunks
Characteristics
| Characteristics | Description |
|---|---|
| Byte order | big-endian |
ADC chunk
An ADC chunk is of variable size and consists of consists of:
| Offset | Size | Value | Description |
|---|---|---|---|
| 0.0 | 1 bit | Literal chunk flag | |
| If literal chunk flag is set (1) | |||
| 0.1 | 7 bits | Literal data size, in number of bytes, where size = value + 1 | |
| 1.0 | ... | Literal (uncompressed) data | |
| If literal chunk flag is not set (0) | |||
| 0.1 | 1 bit | Extended-size chunk flags | |
| If extended-size chunk flag is not set (0) | |||
| 0.2 | 4 bits | Compressed data size, in number of bytes, where size = value + 3 | |
| 0.6 | 10 bits | Compressed data distance, where 0 is the offset of the last previously uncompressed byte | |
| If extended-size chunk flag is set (1) | |||
| 0.2 | 6 bits | Compressed data size, in number of bytes, where size = value + 4 | |
| 1.0 | 16 bits | Compressed data distance, where 0 is the offset of the last previously uncompressed byte | |