• Aucun résultat trouvé

Fractional Bit-Plane Coding

Dans le document Standard for (Page 183-189)

In order to make it easy for readers to understand this complex algorithm, we first provide the definition of terms used to describe the algorithm, followed by the explanation of four basic coding operations and three coding pusses.

Then we provide a simple example to illuminate the detailed process of the BPC coder.

7.3.1.1 Definition of Terms

0 Code-Block (y): A code-block is a two-dimensional array that consists of integers (wavelet coefficients with or without quantization). Each code-block has width and height that specify its size. Each integer of the code-block can be either positive, zero, or negative. Each of the elements of a code-block are associated with u, a’, and q to indicate their coded states (see u , u’, and q for detailed descriptions).

0 Sign Array

(x): x

is a two-dimensional array representing the signs of the elements of a code-block. It has the exact same dimensions as the code-block. Each element x[m, n] represents the sign information of the corresponding element y[m, n] in the code-block as follows.

1 if y[m,n]

<

0 xb’nl =

{

0 otherwise

When referenced to x[m,n] during encoding or decoding, m or n may be out of range of a code-block, such as m = -1. This will happen when we are working on the boundary of the code-block. In those cases, x[m, n] is always set to equal zero.

0 Magnitude Array (w): w is a two-dimensional array of unsigned in- tegers. Dimension of this array is exactly the same as the dimension of the code-block. Each element of w represents the absolute value of the integer at the corresponding location in the code-block, that is, v[m, n] = Iy[m, n]l, where y[m, n] is the integer element at spatial loca- tion ( m , n ) in the code-block. The notation wp[m, n] is used to denote the Pth bit of w[m,n].

0 Bit-Plane: The magnitude array w can be conceptually viewed as a three-dimensional array, with the bit sequence of the integers in the third dimension. Each particular order of bits of every element of w

166 CODlNG ALGORITHMS IN JPEG2000

constitutes a single bit-plane. We can also view u as a one-dimensional array consisting of a number of bit-planes.

Example: Consider (2, 0) denotes a 2 x 1 array ‘u with only two elements. The two bit-planes for this array will be (1, 0) and (0, 0).

We say one bit-plane is more significant than the other if its bits are more significant than those of the other. Not all bit-planes of w are going to be coded because a bit sequence may have as many leading zeros as possible for a particular nonnegative value. We code only the most significant bit-plane containing at least one 1 and all the other subsequent less significant bit-planes, regardless of whether they have 1 or not. In other words, a bit-plane that entirely consists of 0 is ignored unless there is a higher significant bit-plane that contains at least one 1. We call those uncoded bit-planes “leading-zero bit-planes.” A nonnegative integer P is frequently used to refer to a bit-plane to be coded. We use up[m, n]

to represent the bit at spatial location ( m , n ) of the bit-plane P of the code-block.

0 Scan Pattern: Scan pattern defines the order of encoding or decoding the bit-planes of a code-block. The scan pattern of a code-block can be conceptually divided into sections (or stripes), each with four consecu- tive rows starting from the first row of a code-block. If the total number of rows of a code-block is not a multiple of 4, all the sections will have four consecutive rows except the very last section. The scan starts from the first section and down to the last section until all elements of a code- block are encoded or decoded. Each section is scanned from the first row of the first column. The next location to be scanned will be the next row on the same column. After a column in the section is completely coded, start scanning at the first row of the next column in the same section.

Continue the coding process until all columns in a section are coded.

This same process is then applied to the next adjacent section until all of them are coded. An example of scan pattern for a 5 x 10 code-block is shown in Figure 7.1. Figure 7.l(a) shows the regular mode of the scan pattern. The JPEG2000 Part 1 also specified another scanning mode, vertical causal mode. In vertical causal mode, every section (sometimes referred to as stripe), that is, 4 rows by N columns, will be considered as a standalone module. In other words, under the vertical causal mode, all the information of neighbors from the same code-block but different sections will not be used in the current section. Figure 7.l(b) shows the vertical causal mode for the same example shown in Figure 7.l(a).

State Variables u , (T’ and 7: Three two-dimensional “binary” arrays,

u , u’, and q, are created to indicate the coding states of each element in the code-block during the coding process. These arrays have the exact the same dimension as the code-block. Initially, each of the elements of

TIER-1 CODlNG /N PEG2000 167 conditions, but are never changed back to 0 until the entire code-block is encoded. On the other hand, the values of q[m, n] are reset to 0 right after completion of coding of each bit-plane. Interpretations of these three variables are as follows: operation (defined in the next section) has been applied to v[m,n];

otherwise, it is equal to zero.

- When q[m,n] = 1, it indicates that zero coding operation (defined in the next section) has been applied to d’[m,n] in the significant propagation pass; otherwise, it is equal to 0.

0 Preferred Neighborhood: An element y[m,n] in the code-block is said to be in a preferred neighborhood if at least one of its eight adjacent neighbors has u value equal to 1.

168 CODING ALGORITHMS IN JPEG2000

Zero Coding Tables: There are three zero coding tables for the pur- pose of zero coding operations as shown in Tables 7.1-7.3. The context information generated in zero coding operation is based on the values of the significance states (0) of the eight neighbors of the element being encoded. In Figure 7.2, we show the eight neighbors of an element (say X) used in these tables to form the “context.” For example, X is an element in the LL subband, and the two horizonal neighbors have sig- nificance state value of 1 (i.e.,

CH

= 2). The context value 8 will be used as shown in Table 7.1.

ppEJ

Fig. 7.2 Neighborhood for zero coding context generation.

Table 7.1 Zero Coding Context Table for Code-Blocks from LL and LH Subbands

Note: “x” in the table denotes “do not care.”

7.3.1.2 Coding Operations There are four possible coding operations used in EBCOT to generate the values of context (CX) and decision (D) as intermediate data before the BAC. CX is a nonnegative integer while D is a binary value, 0 or 1. There are nineteen different context values (0-18) used in these four coding operations. The index of the current bit-plane is assumed to be P . Exactly when or where these operations are applied is subject to current coding pass, the location of the current element, and the status of the state variables.

Zero Coding (ZC): For zero coding operation, the decision bit D is equal to w p [ m , n] and CX is selected from one of the three “zero coding context tables” related to the relevant subband (LH, HL or HH) the code-block belongs to. There are nine entries in each context table.

TIER-1 CODING IN JPEG2000 169

2 2 1 0

Table 7.2 Zero Coding Context Table for Code-Blocks from HL Subbands

0 2

0 1

0 0

I I I

1 0 1 0 1 0 1 0

2 2 1 0

Table 7.3 Zero Coding Context Table for Code-Blocks from HH Subbands

0 2

0 1

0 0

They are derived using the values of the significance states of the eight surrounding neighbors of the current coefficient bit, d [ m , n]. As shown in the tables, each entry depends on how many and which neighbors of u p [ m , n] are significant.

Sign Coding (SC): The D and CX for the sign coding are determined by a horizontal reference value H and a vertical reference value V . Sup- pose that the current scan location is (m, n ) ; the values of H and V are obtained by the following equations.

H = m i n [ l , m a x ( - l , o [ m , n - 11 x ( 1 - 2 x [ m , n - l ] ) + a [ m , n + l ] x ( 1 - 2 x [ m , n + l ] ) ) ] V = m i n [ l , m a x ( - l , o [ m - l , n ] x ( 1 - 2 ~ [ m - 1 , n ] ) + u [ m + 1 , n ] x (1 - 2 x [ m + l , n ] ) ) ]

The reference values of H and V indicate three possible situations as follows:

170 CODING ALGORITHMS IN JPEG2000

1. 0 indicates that both neighbors are insignificant, or both neighbors 2. 1 indicates that one or both neighbors are significant with positive 3. -1 indicates that one or both neighbors are significant with nega-

are significant but have opposite signs.

sign.

tive sign.

The neighbors mean the two adjacent horizontal locations of the current scan location for H and the two vertical locations of the current scan location for V . Significant at a location means the value of the state variable o at that location is 1 while insignificant means the value of 0 is 0.

As shown in Table 7.4, H and V are used together to determine the context (CX) and a binary value

2,

which in terms is used to calculate the value of D as D =

2

@ x[m, n], where @ represents an Exclusive-OR operation.

Table 7.4 Reference Table for Sign Coding

11 12 13

0 Magnitude Refinement Coding (MRC): For magnitude refinement coding, D at position (m, n ) in the Pth bit-plane is simply equal to the bit value wP[m,n]. The value of CX is determined by a’[rn,n] and the sum of its eight adjacent values of the state variable 0 is as follows:

- If d = 1 at the current position, which indicates that it is not the first magnitude refinement for this element, then CX = 16.

- When

d

= 0 at the current position and the sum of the values of o of its eight adjacent neighbors is also 0, then CX = 14.

- When CT’ = 0 at the current position and the sum of the values of

0 of its eight adjacent neighbors is greater than 0, then CX = 15.

In Table 9.5, we summarized the logic for generation of the context values (CX) as described above.

TIER-I CODING IN JPEG2000 171

a“m,n]

1

Table 7.5 Reference Table for Magnitude Refinement Coding a[m - 1, n]

+

a [ m + l , n ]

+

Dans le document Standard for (Page 183-189)