The zlib trailer consists of a 4-byte CRC value, based on the uncompressed data. The algorithm for
computing the CRC is defined in the zlib specification. As per the zlib specification, the CRC value is
stored in big-endian byte order, regardless of the byte order specified in the TIFF file header.
The actual compressed data portion of the zlib data stream consists of one or more data blocks. The first
block begins on a byte boundary, immediately following the header. Succeeding blocks are concatenated
together, and do not necessarily begin on byte boundaries. The final block will be padded to the next byte
boundary, prior to the CRC trailer. Each block begins with a 3-bit header. The first bit is a flag which
indicates the final data block in the zlib data stream. The next two bits indicate the compression type for the
block: uncompressed, LZ77 with fixed Huffman codes, or LZ77 with dynamic Huffman codes.
The compressed data may contain backward pointers to repeated byte strings. Although it should be
obvious, we will state the following rule for completeness: while backward pointers may cross block
boundaries (they may reference repeated byte strings up to 32K bytes away), they must not attempt to point
outside of the current zlib data stream (i.e., they must not reference a block in another image segment).
Further, these backward pointers bear no relationship whatsoever to TIFF offsets (which are often referred
to as pointers in this document).