Abstract: A method for compressing a data stream based on a combination of two digests is used. Each combination of digests that occurs multiple times is assigned a codeword. When the first digest matches, a data structure of second digests occurring with the same first digest is built, associating each combination of digests with a position in the stream where the combination of digests is found. When a new match is found a new codeword is defined. When a match with an existing codeword is found, a byte sequence is emitted that identifies the codeword associated with the matched data. When a partial match is found, the length of a codeword is changed and a corresponding byte sequence is emitted. The method finds particular application in data streams that are sent to printers, and which contain large blocks of identical data such as images or repetitive text.
Abstract: A method for compressing a data stream based on a 3 byte sequence is used. Each three byte sequence is assigned a code word including a location and a length of the data associated with the code word. When a 6 byte sequence is located, a binary tree of 6 byte sequences sharing the same first three bytes is built, associating each 6 byte sequence with a position in the stream where the 6 byte sequence is found. When the length of a code word is changed, a byte sequence is emitted that identifies the code word to be changed and updating the length of the code word, so that when a match is found, a byte sequence is emitted that identifies the code word associated with the matched data. The method finds particular application in data streams that are sent to printers, and which contain large blocks of identical data.