The JBIG2 Standard
Again, the JBIG2 standard does not specify how a JBIG2 encoder shall operate, but rather how a JBIG2 decoder represents a JBIG2 bitstream. Because JBIG2 offers a number of encoding options for any image, there are a significant number of different JBIG2 bitstreams that may result. The limitation on JBIG2 decoding simply means that for every JBIG2 bitstream there is only one resulting raw image that can be decoded.
This versatility in encoder design allows for encoders to offer a wide variety of features. That being said, JBIG2 encoding is not a free-for-all process: every JBIG2 encoder must produce bitstreams compliant to the standard’s bitstream syntax.
As noted earlier, the JBIG2 standard offers two main coding methods: arithmetic coding & Huffman coding. With few exceptions, arithmetic coding has better compression performance than Huffman coding, and compression technology has taken advantage of that factor.
A JBIG2 bitstream (encoding) is a collection of ordered JBIG2 segments. Each segment contains a segment header that contains a type identifier which specifies how the data part of the segment, if present, is to be decoded. (Some simpler segment types need no data part; e.g. an end of page segment.)
Most segments have a data part of substantial size. Each data part has a data header that offers details about how the data was encoded. A JBIG2 decoder examines the segment header and data header of the segment to properly interpret and process the bitstream information.
The sequence of the segments is crucial. To accurately process the data in one segment, the decoder may need to have already processed the data in one or more previous segments. When this happens, one segment is described as referring to the other.
JBIG2 segments can be classified into three loose categories:control segments, region segments, and support segments.
Control segments give the decoder “broad boundary” information such as the page dimensions and end-of-page markers.
Region segments offer the needed information to produce an image on a page. This information may pertain to the entire page, or a specific rectangular region of the page. A single page may contain several region segments, which can overlap. There are four different types of region segments: generic regions, refinement regions, text regions, and halftone regions.
Support segments contain data that will be used by region segments, but are not region segments themselves. Two important support segment types are dictionary segments and pattern segments.
JBIG2 offers a flexibility never before seen in compression codecs. That flexibility can leverage the dynamics of compression itself. Our discussion continues with descriptions of two fundamental types of data compression (lossless and lossy) and, through a very select group of vendors, a category of compression called perceptually lossless compression.