3.1.4.1.1.2.2 DIRECT2 Encoding Algorithm
The basic notion of the DIRECT2 encoding algorithm is that data appears unchanged in the compressed representation (it is not recommended to try to further compress the data by, for example, applying Huffman compression to that payload), and metadata is encoded in the same output stream, and in line with, the data.
The key to decoding the compressed data is recognizing what bytes are metadata and what bytes are data. The decoder MUST be able to identify the presence of metadata in the compressed and encoded data stream. To provide this information to the decoder, bitmasks are inserted periodically in the byte stream.
The bitmasks that enable the decoder to distinguish data from metadata and the process of encoding the metadata are specified in section 3.1.4.1.1.2.2.1 through section 3.1.4.1.1.2.2.4.