# - Acharya T.

ISBN 0-471-48422-9

**Download**(direct link)

**:**

**70**> 71 72 73 74 75 76 .. 100 >> Next

After completion of the run-length coding or zero coding, we need to check whether we need to apply sign coding (SC) before we move on to code the next bit. Suppose the last coded position is (i,j). If vp[i,j] =

1, which indicates this bit is the most significant bit of the current sample, the cleanup pass applies sign coding and assigns cr value of the last coded location to be 1 (i.e., cr\i,j] = 1) right after run-length or zero coding is done. Otherwise, no sign coding is needed.

Continue coding the bits along the scan pattern until all of the bits of the bit-plane are coded. After completion of the cleanup pass for a bitplane, reset Tj[m,n\ = 0 for all m and n in the bit-plane before moving into the next bit-plane. Figure 7.3 shows the flowchart of the cleanup pass we just described.

Significance Propagation Pass (SPP): This is the first pass applied to every bit-plane of a code-block, except the first bit-plane. Significance propagation pass first applies zero coding if the current scan position (m,n) is in a preferred neighborhood and a[m,n] = 0. If zero coding cannot be applied, then proceed to the next bit position. If the zero coding is applied, r][m,n\ is set to 1. After zero coding is completed, we need to check whether sign coding is needed at the current bit position (m, n). If vp[m, n] = 1, then sign coding is applied and we set <r[m, n\ = 1.

Continue coding the bits along the scan pattern until all of the bits of the bit-plane are coded. Figure 7.4 shows the flowchart of the significance propagation pass.

Magnitude Refinement Pass (MRP): This is the second pass applied to every bit-plane of a code-block, except the first bit-plane, which does not need magnitude refinement pass.

174

CODING ALGORITHMS IN JPEG2000

Fie. 7.3 Flowchart of cleamin nass

TIER-1 CODING IN JPEG2000

175

Fig. 7.4 Flowchart of significance propagation pass.

176

CODING ALGORITHMS IN JPEG2000

Fig. 7.5 Flowchart of magnitude refinement pass.

If the state variables a[m, n] = 1 and r)[m, n] = 0, then we apply magnitude refinement coding (MRC) to the current scan position (m,n) and set cr'[m,n] = 1. Continue coding the bits along the scan pattern until all of the bits of the bit-plane are coded. Figure 7.5 shows the flowchart of the magnitude refinement pass.

TIER-1 CODING IN JPEG2000 177

• Selective binary arithmetic coding—bypass mode: Instead of applying the binary arithmetic coding (MQ-coder2) on symbols (the contexts and decision bits) generated during all three coding passes, the bypass mode allows bypassing MQ-coder for the SPP and MRP after the four most significant bit-planes are coded. In other words, only those symbols generated in the CUP will be coded with the MQ-coder, and raw decision bits and sign bits will be coded during the SPP and MRP, if the bypass mode is selected.

7.3.1.4 JPEG2000 Bit-Plane Coding: Encoder and Decoder Algorithms As

we discussed earlier, the quantized wavelet coefficients in each subband are converted into sign-magnitude represented before the entropy encoding starts. For each input code-block, we can first initialize the two-dimensional arrays v and x, where the value of v[m,n] is the magnitude and x[m,n] is the sign information of the element at position (m, n) in the code-block. The number of bit-planes in the code-block to be encoded (P) is determined by searching the largest value in array v. Initially, all elements in two-dimensional arrays cr, o', and 7/ are set to 0’s.

The first bit-plane to be coded is the most significant bit-plane. As mentioned at the definition of bit-plane, the leading-zero bit-planes consisting entirely of zeros are ignored. A more (higher) significant bit-plane is always coded before coding a less (lower) significant bit-plane. If P = 0, we don’t need to do any coding and the output is empty. If P > 1, then we apply the cleanup pass only to the first bit-plane. For the remaining bit-planes, we first apply the significance propagation pass, then the magnitude refinement pass, and then the cleanup pass. Figure 7.6 shows the top-level flowchart of the fractional bit-plane coder.

The procedure of the decoder is essentially the same as for the encoder. For the sake of completeness, we also show the encoding and decoding procedures via the flowcharts as shown in Figures 7.7 and 7.8 respectively for P > 1.

7.3.2 Examples of BPC Encoder

In this section we present an example detailing all the operations step by step and the output generated by encoding a 4 x 4 code-block.

• Input of the encoder: An input 4x4 code-block is shown below:

CO 0 0 5

c? 7 to 1

-4 -1 -2 3

0 6 0 2

2The MQ-coder will be discussed in the next section.

178

CODING ALGORITHMS IN JPEG2000

End

Fig. 7.6 Top-level flowchart of fractional bit-plane coder for P > 0. • The magnitude array (v) is shown below:

3 0 0 5

3 7 2 1

4 1 2 3

0 6 0 2

• The sign array (x) is shown below:

0 0 0 0

1 0 0 0

1 1 1 0

0 0 0 0

• The three bit-planes are shown below as bit-planes of the magnitude array and v° respectively:

**70**> 71 72 73 74 75 76 .. 100 >> Next