-
Notifications
You must be signed in to change notification settings - Fork 41
LZFFormat
cowtowncoder edited this page Mar 7, 2013
·
17 revisions
At file or stream level, LZF compressed content consists of a simple sequence of chunks. Chunks consists of simple header and payload. There are no chunk separators, nor sequence numbers or other kind of metadata. This means that one can simply keep on appending chunks at the end of stream or file.
Each chunk consists of two parts: header and payload.
Header block is either 5 or 7 bytes long: uncompressed blocks 5, compressed blocks 7.
Both start with same 5 bytes which contains a brief signature for content auto-detection (first 2 bytes); identifies chunk type (compressed or not), and indicates length of actual stored chunk:
- Letter 'Z' (0x5A)
- Letter 'V' (0x56)
- Type bits
- 0x00: Non-compressed chunk
- 0x01: Compressed chunk
- Other values reserved -- it is possible that in future this byte is considered a bit field, where least-significant bit determines compression status of the chunl
- Chunk length: most-significant byte (MSB)
- Chunk length: least-significant byte (LSB)
In addition, compressed chunks (type 0x01
) contain additional 2 header bytes: