• 沒有找到結果。

Boundary Pixel Scanning SA-DCT (BPS-SA-DCT)

Chapter 3 The Proposed Texture Coding Technique for Arbitrarily

3.1 Boundary Pixel Scanning SA-DCT (BPS-SA-DCT)

scanning process is described as follows.

In general, the pixels on the border of a boundary block will have the same or similar gray levels. Therefore, the scanning operation is performed along the border of the object in a layer by layer fashion. The boundary pixels located on the outermost layer of the object are put on the first column of the re-ordered block. The pixels on the second outermost layer are put on the second column, and so on. After all pixels in a boundary block have been scanned, the pixels located on the same layer along the border will be aligned into the same column of the re-ordered block.

In fact, the scanning operation can be performed on the top side, bottom side, left side, or right side. In the case of left-side scanning, each row is scanned from left to right. The first object pixel in each row is shifted horizontally to the first column and the second object pixel is shifted to the second column, etc. In the case of right-side scanning, each row is scanned from right to left. Similarly, each column is scanned from top to bottom or from bottom to top in the case of top-side or bottom-side scanning, respectively. Fig. 3.1 shows one example of these four types of scanning for a boundary block. Note that the pixels labeled with the same index value are put on the same column.

(a) 29

32 31 16 32 103 149 143

30 33 37 15 16 89 153 148

39 34 42 26 18 77 147 151

48 43 48 34 25 75 139 148

34 87 136 142

108 139 133

118 142 131

117 144 133

Index Value Reordered Result

(b) 5

5 5

6 6 6

7 7 7

8 8 8

103 149 143

89 153 148

77 147 151

75 139 148

1

4 3 2 1

48 43 48 34 34 117

39 34 42 26 25 118

30 33 37 15 18 108

29 32 31 16 16 87 1

1 1 1 1 1 1 1

2 2 2 2 2 2 2 2

3 3 3 3 3 3 3 3

4 4 4 4 4 4 4 4

5

29 32 31 16 32

30 33 37 15 16

39 34 42 26 18

48 43 48 34 25

34 87 136 142

108 139 133

118 142 131

117 144 133

Index Value Reordered Result

(c) 4

4 4 4 5 8 8 8

3 3 3 3 4 7 7 7

2 2 2 2 3 6 6 6

1 1 1 1 2 5 5 5

4 4

3 3

2 2

1 1

144 133

142 131

139 133

136 142

32 75 139 148

77 147 151

89 153 148

103 149 143

Fig. 3.1 (a) Original boundary block (b) Left-side scanning (c) Right-side scanning (d) Top-side scanning (e) Bottom-side scanning.

Index Value Reordered Result (d)

1 2 3 4 5 6 7 8

1 2 3 4 5 6 7 8

1 2 3 4 5 6 7 8

1 2 3 4 5 6 7 8

1 2 3 4

1 2 3

1 2 3

1 2 3

29 30 39 48 34 108 118 117

32 33 34 43 87 139 142 144

31 37 42 48 136 133 131 133

16 15 26 34 142

32 16 18 25

103 89 77 75

149 153 147 139

143 148 151 148

8 7 6 5 4 3 2 1

8 7 6 5 4 3 2 1

8 7 6 5 4 3 2 1

8 7 6 5 4 3 2 1

4 3 2 1

3 2 1

3 2 1

3 2 1

143 148 151 148 142 133 131 133

149 153 147 139 136 139 142 144

103 89 77 75 87 108 118 117

32 16 18 25 34

16 15 26 34

31 37 42 48

32 33 34 43

29 30 39 48

Index Value Reordered Result

(e)

Fig. 3.1 (Continued)

The scanning algorithm consists of two steps: index value assignment and object pixel re-ordering. The first step assigns an index value to every object pixel according to the scanning sequence. The second step will re-order the object pixels such that object pixels with the same index value will be aligned into the same column. The detailed algorithms for these four types of scanning are listed as follows.

Algorithm3.1 Left-Side Scanning

Given: An binary alpha map B ( r , c ) with B ( r , c ) = 1 for object pixel and B ( r , c) = 0 for transparent pixel. Let BO( ; ) and BR( ; ) denote the original and re-ordered block, respectively.

Step 1: for r = 1 to N index = 1 ; for c = 1 to N

if ( B ( r , c ) = = 1 ) I ( r , c ) = index ; index + + ; else

I ( r , c ) = 0 ; Step 2: for r = 1 to N

for c = 1 to N

if ( i = I ( r , c ) 0 )

BR ( r , i ) = BO ( r , c ) ;

Algorithm3.2 Right-Side Scanning

Given: an binary alpha map B ( r , c ) with B ( r , c ) = 1 for object pixel and B ( r , c) = 0 for transparent pixel. Let BO( ; ) and BR( ; ) denote the original and re-ordered block , respectively.

Step 1: for r = 1 to N index = 1 ; for c = N to 1

if ( B ( r , c ) = = 1 ) I ( r , c ) = index ; index + + ; else

I ( r , c ) = 0 ; Step 2: for r = 1 to N

for c = N to 1

if ( i = I ( r , c ) 0 )

BR ( r , i ) = BO ( r , c ) ;

Algorithm3.3 Top-Side Scanning

Given: an binary alpha map B ( r , c ) with B ( r , c ) = 1 for object pixel and B ( r , c) = 0 for transparent pixel. Let BO( ; ) and BR( ; ) denote the original and re-ordered block, respectively.

Step 1: for c = 1 to N index = 1 ; for r = 1 to N

if ( B ( r , c ) = = 1 ) I ( r , c ) = index ; index + + ; else

I ( r , c ) = 0 ; Step 2: for c = 1 to N

for r = 1 to N

if ( i = I ( r , c ) 0 )

BR ( c , i ) = BO ( r , c ) ;

Algorithm3.4 Bottom-Side Scanning

Given: an binary alpha map B ( r , c ) with B ( r , c ) = 1 for object pixel and B ( r , c) = 0 for transparent pixel. Let BO( ; ) and BR( ; ) denote the original and re-ordered block, respectively.

Step 1: for c = 1 to N index = 1 ; for r = N to 1

if ( B ( r , c ) = = 1 ) I ( r , c ) = index ; index + + ; else

I ( r , c ) = 0 ; Step 2: for c = 1 to N

for r = N to 1

if ( i = I ( r , c ) 0 )

BR ( c , i ) = BO ( r , c ) ;

After all the object pixels in a boundary block have been scanned and re-ordered, SA-DCT is applied to the re-ordered block. 1-D SA-DCT is first performed on every column and then on every row.

For coding all boundary blocks, no specific type of scanning will get the best coding performance. That is, some blocks directly coded by SA-DCT will performs best, while others may get better performance if they are re-ordered and then coded by SA-DCT. Therefore, to encode a boundary block there are five types of coding modes:

SA-DCT, Left-Side Scanning SA-DCT (LS-SA-DCT), Right-Side SA-DCT (RS-SA-DCT), Top-Side Scanning SA-DCT (TS-SA-DCT), and Bottom-Side Scanning SA-DCT (BS-SA-DCT). To distinguish these five coding modes, an extra code is needed to indicate the coding mode for each boundary block. Table 3.1 shows the extra codes for these five coding modes. To encode a boundary block, we first apply SA-DCT to the original block and then the initial result in terms of bit rate as well as the PSNR value will be derived. Initially, the default coding mode is the SA-DCT mode. Each type of scanning operation is applied and SA-DCT is performed to get its corresponding result. These coding modes are implemented in the following order: LS-SA-DCT, RS-SA-DCT, TS-SA-DCT, and BS-SA-DCT. If the reordered block performs best in terms of bit rate as well as the PSNR value, this type of coding mode is selected as the final coding mode for the boundary block.

Table 3.1

Coding mode Code

SA-DCT 0

LS- SA-DCT 100

RS- SA-DCT 101

TS- SA-DCT 110

BS- SA-DCT 111

The detailed steps for coding a boundary block is described as follows:

Step 1) Apply SA-DCT to the original block BO( ; ) and get the initial peak signal to noise ratio, PSNR, and bit rate, BR.

Step 2) Apply SA-DCT to the re-ordered block BL( ; ) corresponding to the left-side scanning and compute the peak signal to noise ratio, PSNRLS, and bit rate, BRLS. If PSNRLS ≥ PSNR and BRLS ≤ BR, LS-SA-DCT is chosen as the current coding mode and the values of PSNR and BR are updated accordingly.

Step 3) Apply SA-DCT to the re-ordered block BR( ; ) corresponding to the right-side scanning and compute the peak signal to noise ratio, PSNRRS, and bit rate, BR RS. If PSNRRS ≥ PSNR and BR RS ≤ BR, RS-SA-DCT is chosen as the current coding mode and the values of PSNR and BR are updated accordingly.

Step 4) Apply SA-DCT to the re-ordered block BT( ; ) corresponding to the top-side scanning and compute the peak signal to noise ratio, PSNRTS, and bit rate, BR TS. If PSNRTS ≥ PSNR and BR TS ≤ BR, TS-SA-DCT is chosen as the current coding mode and the values of PSNR and BR are updated accordingly.

Step 5) Apply SA-DCT to the re-ordered block BB( ; ) corresponding to the bottom-side scanning and compute the peak signal to noise ratio, PSNRBS, and bit rate, BRBS. If PSNRBS ≥ PSNR and BR BS ≤ BR, BS-SA-DCT is chosen as the current coding mode and the values of PSNR and BR are updated accordingly.

Table 3.2 shows the coding results for the boundary block shown in Fig. 3.1(a).

From this table, we set that BS-SA-DCT outperforms other coding modes in terms of PSNR as well as bit rate.

Table 3.2

SA-DCT LS-SA-DCT RS-SA-DCT TS-SA-DCT BS-SA-DCT

Bit number 124 124 117 147 77

PSNR 31.823 31.823 31.401 30.201 35.723

In the decoder, inverse SA-DCT is first conducted. According to the shape information and the extra code indicating the coding mode, the decoded gray levels are re-distributed to the original pixel locations.

3.2 Boundary Pixel Scanning and Boundary Block Grouping

相關文件