The present invention provides a system that compresses and decompresses
an image. The system includes a first codec a first stage codec for
identifying runs of pixels of a defined value in a data stream of the
image data beginning from the left and right margins of a line, such that
information regarding the runs is assigned as a header and appended to
the data stream. The compression device includes a second stage codec for
scanning over remaining data in the data stream and compressing all but
the header by utilizing a Huffman encoding scheme to reduce amount of
data stored in the data stream, wherein the Huffman encoding scheme
interleaves Huffman code values with unencrypted data while maintaining
long word boundaries for the unencrypted data. The second codec also
performs the operation of decompressing a compressed image.