Databases Reference
In-Depth Information
The cleanup pass is a catch-all pass in which all bits not encoded in the significance
propagation pass and the magnitude refinement pass are encoded. These bits are encoded in
either the run-length mode or one of the nine zero-coding modes. The run-length mode is
used if four consecutive samples are insignificant, the neighbors of all these coefficients are
insignificant, the samples all reside in the same subblock, and the horizontal index of the first
symbol is even. If all these conditions are satisfied, the encoder switches to the run-length
mode and emits a 0 in the run-length context. Once in the run-length mode, if a significant
coefficient is encountered, the encoder generates a 1 that is encoded in the run-length context.
This is followed by the position of the coefficient encoded in the equiprobable context followed
by the encoding of the sign as described previously. Once the encoder is out of the run-length
mode, it encodes the bits in the zero-coding mode until the conditions again allow a transition
into the run-length coding mode. At the beginning of the encoding of the highest bitplane in a
subblock, none of the coefficients will have been declared significant. Therefore, even though
for the other bitplanes the significance coding pass is the first pass, the very first bitplane is
encoded using the cleanup pass.
We work through a toy example to see how these passes are used to encode a stripe
in a code-block. (Another, more detailed example, by Xavier Delaunay, can be found at
http://d.xav.free.fr/ebcot/ . )
Examp l e 16 . 5 . 2 : JPEG 2000 Tier I Coding
The codeblock in JPEG 2000 is divided into stripes, where a stripe consists of four rows, except
possibly the last stripe. We will work through the encoding of a stripe using the example shown
in Figure 16.16 . We will assume the rows above and below the stripe have coefficients that are
not significant. The encoder first determines the highest significant bitplane in the stripe. In
this particular example, the largest coefficient magnitude is 12, which means that the encoder
will encode a total of four bitplanes. The bits from the most significant bitplane are shown in
Figure 16.17 .
Nominally, the first pass should be the significance propagation pass. However, the signifi-
cance propagation pass relies on the existence of coefficients that have been declared significant
in previous bitplanes. As this is the first pass through this particular stripe, none of the coeffi-
cients have been declared significant. Therefore, for the first bitplane, we use a cleanup pass.
The first four bits in the bitplane are all zero. Furthermore, none of them are neighbors of any
coefficients that have been declared significant. Therefore, we encode the first column as a 0
using the run-length context. The second column is also encoded with a zero in the run-length
context. The second coefficient in the third row is significant. Therefore, we send a 1 in the
run-length context to indicate that we are no longer in the run-length mode. We then encode
the position of the coefficient (01) using the equiprobable context. As this is the first time this
coefficient has been declared significant, the next step is to encode the sign of the coefficient.
As none of the neighbors have a declared sign, the value of both s h and s v is 0. Looking up
the corresponding row in Table 16.4 , we find the predicted value of the sign to be positive and
the context to be SC0. As the predicted sign is correct, a 0 is encoded in the context SC0.
We are no longer in the run-length mode; therefore, the next bit is encoded in the zero-
coding mode. For the next coefficient, the only significant neighbor is the coefficient above it,
so
σ h =
0
v =
1 and
σ d
=
0. In order to find the zero-coding context we need to know the
Search WWH ::




Custom Search