**3. Decoder**

8 Lithography / Book 2

changes unless oblique lines are used. We encode the intensity stream as in Algorithm 3. Note that in the algorithm *ρ* is the length of the intensity stream which is determined at the end of

6: **else if** (*x*, *y*) is a horizontal edge pixel with corners at (*x* − 1, *y*) and (*x* + *α*, *y*) **then**

17: **else if** (*x*, *y*) is a vertical edge pixel with corners at (*x*, *y* − 1) and (*x*, *y* + *β*) **then**

If the current pixel corresponds to a corner (Lines 4-5), the intensity is represented as is. If the current pixel corresponds to a horizontal edge pixel (Lines 6-16) which starts from the left pixel, check the run of that intensity. If the horizontal edge pixel has constant pixel intensity throughout the entire edge, represent the intensity value followed by an end symbol *�* and skip to the ending corner pixel (Lines 7-10). Otherwise, write the entire edge intensity as is (Lines 11-15). Similarly, if the current pixel corresponds to a vertical edge (Lines 17-29) which starts from the upper pixel determine whether or not the pixel intensities are fixed throughout the vertical edge. If they are constant then represent the intensity value followed by the end

the encoding process.

1: Initialize *ρ* = 0. 2: **for** *y* = 1 **to** *R* **do** 3: **for** *x* = 1 **to** *C* **do**

**Algorithm 3** Intensity Stream Encoding

4: **if** (*x*, *y*) is a corner pixel **then** 5: *ρ* = *ρ* + 1, OUT(*ρ*) = IN(*x*, *y*).

12: **for** *i* = *x* **to** *x* + *α* − 1 **do** 13: *ρ* = *ρ* + 1, OUT(*ρ*) = IN(*i*, *y*)

19: *ρ* = *ρ* + 1, OUT(*ρ*) = IN(*x*, *y*). 20: *ρ* = *ρ* + 1, OUT(*ρ*) = *�*. 21: **for** *j* = *y* **to** *y* + *β* − 1 **do**

25: *ρ* = *ρ* + 1, OUT(*ρ*) = IN(*x*, *y*)

28: *ρ* = *ρ* + 1, OUT(*ρ*) = IN(*x*, *y*).

10: *x* = *x* + *α* − 1.

22: IN(*x*, *j*) = 0 23: **end for** 24: **else**

26: **end if**

29: **end if** 30: **end for** 31: **end for**

11: **else**

14: **end for** 15: *x* = *i*. 16: **end if**

8: *ρ* = *ρ* + 1, OUT(*ρ*) = IN(*x*, *y*). 9: *ρ* = *ρ* + 1, OUT(*ρ*) = *�*.

**Input:** Binary layer image BIN ∈ {0, 1}*C*·*<sup>R</sup>* **Output:** Intensity stream OUT ∈ {0, ··· nLv <sup>−</sup> <sup>1</sup>}*<sup>ρ</sup>*

**Input:** Gray layer image IN ∈ {0, ··· , nLv <sup>−</sup> <sup>1</sup>}*C*·*<sup>R</sup>*

7: **if** IN(*i*, *y*) has the same value for *i* ∈ [*x*, *x* + *α*) **then**

18: **if** IN(*x*, *j*) has the same value for *j* ∈ [*y*, *y* + *β*) **then**

27: **else if** IN(*x*, *y*) *>* 0 and (*x*, *y*) is a vertical edge pixel **then**

The decoder consists of an intensity stream decoder and a corner stream decoder as in Figure 8. The intensity stream decoder is actually an entropy decoder which can be decomposed into a Huffman decoder and an LZ77 decoder. The corner stream decoder consists of an entropy decoder which consists of an arithmetic decoder, a run length decoder, an end-of-block decoder, and a corner transform decoder which reconstructs the polygons from the entropy decoder output. The corner transform decoder utilizes the output of corner stream entropy decoder to reconstruct the polygon outlines and uses the output of the intensity stream decoder to reconstruct the polygon pixel intensity.

The entire process works on a row-by-row fashion. Since each part of the decoding procedure (arithmetic decoding, run length decoding, end-of-block decoding, inverse corner transformation, LZ77 decoding, and Huffman decoding) is simple and works with restricted decoder memory, the entire decoder can be implemented in hardware. Note that the most complex part will be the arithmetic decoder which is widely implemented in microcircuits [Peon et al. (1997)], and the other parts are comprised of simple branch, copy, and computation operations as we will see in the following subsection.

#### **3.1 Intensity stream decoder**

Decompressing the intensity stream is straightforward. We apply LZ77 and Huffman decoding to obtain the -coded intensity stream. As we have mentioned in Section 2.4, the decoder requires 2,048 bytes of memory to decode the LZ77 and Huffman codes. The -coded intensity stream is passed on to the corner transform decoder for the final reconstruction. Note that the decoder does not decompress the entire compressed intensity stream at once but rather decompresses some number of -coded intensity symbols at the request of the corner transform decoder. The detailed decompression of the -coded intensity stream will be discussed at the end of the next subsection.

### **3.2 Corner stream decoder - corner transform decoder**

As we have mentioned earlier, the corner stream decoder consists of an entropy decoder and a corner transform decoder. The entropy decoder reverses the procedure of the entropy encoder of Section 2.3. It first reconstructs the run length and end-of-block encoded stream using the

**Algorithm 4** Inverse Corner Transformation - Part I

Algorithm for Electron Beam Direct Write Lithography Systems

2: Initialize BIN(*x*, *y*) = 0 and OUT(*x*, *y*) = *O*, ∀*x*, *y*.

9: **if** CNR(*x* − 1) = 0 and CNR(*x* + 1) = 0 **then**

11: **else if** CNR(*x* − 1) = 0 or CNR(*x* + 1) = 0 **then**

The second part of the algorithm is shown in Algorithm 5. Note that line 18 of Algorithm 4 and line 1 of Algorithm 5 should be removed when they are implemented; we inserted them to make the loops complete in each part. Lines 5-22 handle the processing of a transitional corner. If BUFF(*x*) = 0, then the transitional corner starts (or ends) a new horizontal edge at row *y*. Since the entire algorithm is designed to output the result of the previous row *y* − 1, we store that horizontal edge in CNR to process it during Algorithm 4. If instead BUFF(*x*) = 1, then the transitional corner starts (or ends) the removal of the pre-existing horizontal edge from the buffer; i.e., the corresponding horizontal edge on the previous row was actually the

<sup>105</sup> Transform-Based Lossless Image Compression

Similarly, lines 23-33 determine whether the corresponding empty corner pixel is a vertical edge pixel or an interior pixel of a polygon. Finally, note that the output OUT is always processed as a function of row *y* − 1, the data that is stored in BUFF and CNR, and row *y* of IN. Since the buffers treat the inter-row dependencies the entire algorithm can be applied

We next utilize the intensity stream to reconstruct the polygon pixel intensities. As we have mentioned earlier, the pixels in the interior of each polygon have full intensity and the pixels not within any polygon are empty (not filled). We use Algorithm 6 to reconstruct the intensity stream of the polygon boundaries. Note that the corner map CNR is the output of the inverse corner transform. In this algorithm, buffer BUFF is used to handle the vertical edge

Algorithm 6 is similar to the previous algorithm in that it utilizes a row buffer to handle the information that has been processed in the previous row. Lines 5-6 deal with the interior polygon pixels, lines 7-9 deal with corner pixels, lines 10-20 reconstruct the horizontal edges,

**Input:** Corner image IN ∈ {0, 1}*C*·*<sup>R</sup>*

3: **for** *y* = 1 **to** *R* **do** 4: **for** *x* = 1 **to** *C* **do** 5: **if** BUFF(*x*) = 1 **then** 6: BIN(*x*, *y*) = 1

8: **if** CNR(*x*) = 1 **then**

10: OUT(*x*, *y* − 1) = *V*.

12: OUT(*x*, *y* − 1) = *C*.

14: OUT(*x*, *y* − 1) = *H*.

7: **end if**

13: **else**

15: **end if** 16: **end if** 17: **end for** 18: **end for**

horizontal boundary.

in a row-by-row fashion.

reconstruction.

**Output:** Binary layer image BIN ∈ {0, 1}*C*·*<sup>R</sup>* **Output:** Corner map OUT ∈ {*O*, *<sup>I</sup>*, *<sup>C</sup>*, *<sup>H</sup>*, *<sup>V</sup>*}*C*·*<sup>R</sup>* **Intermediate:** Buffer for image layer BUFF ∈ {0, 1}*<sup>R</sup>* **Intermediate:** Buffer for corner map CNR ∈ {0, 1}*<sup>R</sup>*

1: Initialize BUFF(*x*) = CNR(*x*) = 0, ∀*x*.

Fig. 8. Decoder Overview: Note that the decompressed corner stream is input into the image reconstructor in a row-by-row fashion and the intensity stream is actually -coded as in Section 2.4.

arithmetic decoder. Then, depending on the symbol, runs of zeroes (symbols 0*M*, ··· ,(*M* − 1)*M*), runs of EOBs (symbols 0*N*, ··· ,(*N* − 1)*N*), or the corners (symbol 1) are reconstructed. Finally, the output of the entropy decoder is a binary corner image. In this section we will focus on the operation of the corner transform decoder and why it can run in a row-by-row fashion. This feature makes our approach well-suited to the restricted memory available to an EBDW writer. In our corner transform decoder we use a row buffer BUFF to hold the status of the previous (decoded) row. It stores a binary representation of the status of each pixel and therefore consumes *width* bits of memory. "0" denotes 'no transition' while "1" denotes the 'transition' which delineates the starting/ending point of a vertical line. Moreover, since we need the polygon boundaries - corners and horizontal/vertical edge pixels - we use another row buffer CNR to hold the boundary status of the previous row. This also requires *width* bits of memory.

Since the algorithm is long, we have split its description into two parts, namely Algorithms 4 and 5. The input to the algorithm is the corner image, and the algorithm outputs the binary layer image and the corner map which shows whether a pixel in the binary layer image is outside all polygons (*O*), inside a polygon boundary (*I*), a corner (*C*), a horizontal edge pixel (*H*), or a vertical edge pixel (*V*) which will be used to reconstruct the pixel intensity along with the intensity stream decoder.

The first part of the algorithm, illustrated in Algorithm 4, shows how the buffers are used to pass previous row information to the current row so that the decoding process could be applied in a row-by-row fashion. Lines 5-7 process the binary image buffer BUFF. If the buffer is filled then the corresponding pixel is part of a vertical edge and it is filled. Lines 8-15 process the corner map buffer CNR. If the corresponding CNR pixel does not form a run, then the corresponding pixel above it was a vertical edge pixel (Line 10). The starting and ending points of the runs of 1s are interpreted as the corners (Line 12) and the other pixels in between are translated as horizontal edge pixels (Line 14).

**Algorithm 4** Inverse Corner Transformation - Part I

10 Lithography / Book 2

Fig. 8. Decoder Overview: Note that the decompressed corner stream is input into the image reconstructor in a row-by-row fashion and the intensity stream is actually -coded as in

arithmetic decoder. Then, depending on the symbol, runs of zeroes (symbols 0*M*, ··· ,(*M* − 1)*M*), runs of EOBs (symbols 0*N*, ··· ,(*N* − 1)*N*), or the corners (symbol 1) are reconstructed. Finally, the output of the entropy decoder is a binary corner image. In this section we will focus on the operation of the corner transform decoder and why it can run in a row-by-row fashion. This feature makes our approach well-suited to the restricted memory available to an EBDW writer. In our corner transform decoder we use a row buffer BUFF to hold the status of the previous (decoded) row. It stores a binary representation of the status of each pixel and therefore consumes *width* bits of memory. "0" denotes 'no transition' while "1" denotes the 'transition' which delineates the starting/ending point of a vertical line. Moreover, since we need the polygon boundaries - corners and horizontal/vertical edge pixels - we use another row buffer CNR to hold the boundary status of the previous row. This also requires *width* bits

Since the algorithm is long, we have split its description into two parts, namely Algorithms 4 and 5. The input to the algorithm is the corner image, and the algorithm outputs the binary layer image and the corner map which shows whether a pixel in the binary layer image is outside all polygons (*O*), inside a polygon boundary (*I*), a corner (*C*), a horizontal edge pixel (*H*), or a vertical edge pixel (*V*) which will be used to reconstruct the pixel intensity along

The first part of the algorithm, illustrated in Algorithm 4, shows how the buffers are used to pass previous row information to the current row so that the decoding process could be applied in a row-by-row fashion. Lines 5-7 process the binary image buffer BUFF. If the buffer is filled then the corresponding pixel is part of a vertical edge and it is filled. Lines 8-15 process the corner map buffer CNR. If the corresponding CNR pixel does not form a run, then the corresponding pixel above it was a vertical edge pixel (Line 10). The starting and ending points of the runs of 1s are interpreted as the corners (Line 12) and the other pixels in between

Section 2.4.

of memory.

with the intensity stream decoder.

are translated as horizontal edge pixels (Line 14).

**Input:** Corner image IN ∈ {0, 1}*C*·*<sup>R</sup>* **Output:** Binary layer image BIN ∈ {0, 1}*C*·*<sup>R</sup>* **Output:** Corner map OUT ∈ {*O*, *<sup>I</sup>*, *<sup>C</sup>*, *<sup>H</sup>*, *<sup>V</sup>*}*C*·*<sup>R</sup>* **Intermediate:** Buffer for image layer BUFF ∈ {0, 1}*<sup>R</sup>* **Intermediate:** Buffer for corner map CNR ∈ {0, 1}*<sup>R</sup>* 1: Initialize BUFF(*x*) = CNR(*x*) = 0, ∀*x*. 2: Initialize BIN(*x*, *y*) = 0 and OUT(*x*, *y*) = *O*, ∀*x*, *y*. 3: **for** *y* = 1 **to** *R* **do** 4: **for** *x* = 1 **to** *C* **do** 5: **if** BUFF(*x*) = 1 **then** 6: BIN(*x*, *y*) = 1 7: **end if** 8: **if** CNR(*x*) = 1 **then** 9: **if** CNR(*x* − 1) = 0 and CNR(*x* + 1) = 0 **then** 10: OUT(*x*, *y* − 1) = *V*. 11: **else if** CNR(*x* − 1) = 0 or CNR(*x* + 1) = 0 **then** 12: OUT(*x*, *y* − 1) = *C*. 13: **else** 14: OUT(*x*, *y* − 1) = *H*. 15: **end if** 16: **end if** 17: **end for** 18: **end for**

The second part of the algorithm is shown in Algorithm 5. Note that line 18 of Algorithm 4 and line 1 of Algorithm 5 should be removed when they are implemented; we inserted them to make the loops complete in each part. Lines 5-22 handle the processing of a transitional corner. If BUFF(*x*) = 0, then the transitional corner starts (or ends) a new horizontal edge at row *y*. Since the entire algorithm is designed to output the result of the previous row *y* − 1, we store that horizontal edge in CNR to process it during Algorithm 4. If instead BUFF(*x*) = 1, then the transitional corner starts (or ends) the removal of the pre-existing horizontal edge from the buffer; i.e., the corresponding horizontal edge on the previous row was actually the horizontal boundary.

Similarly, lines 23-33 determine whether the corresponding empty corner pixel is a vertical edge pixel or an interior pixel of a polygon. Finally, note that the output OUT is always processed as a function of row *y* − 1, the data that is stored in BUFF and CNR, and row *y* of IN. Since the buffers treat the inter-row dependencies the entire algorithm can be applied in a row-by-row fashion.

We next utilize the intensity stream to reconstruct the polygon pixel intensities. As we have mentioned earlier, the pixels in the interior of each polygon have full intensity and the pixels not within any polygon are empty (not filled). We use Algorithm 6 to reconstruct the intensity stream of the polygon boundaries. Note that the corner map CNR is the output of the inverse corner transform. In this algorithm, buffer BUFF is used to handle the vertical edge reconstruction.

Algorithm 6 is similar to the previous algorithm in that it utilizes a row buffer to handle the information that has been processed in the previous row. Lines 5-6 deal with the interior polygon pixels, lines 7-9 deal with corner pixels, lines 10-20 reconstruct the horizontal edges,

**Algorithm 6** Intensity Stream Decoding

2: Initialize OUT(*x*, *y*) = 0, ∀*x*, *y*.

10: **else if** CNR(*x*, *y*) = *H* **then** 11: **if** IN(*t* + 1) = *�* **then** 12: **while** CNR(*x*, *y*) = *H* **do** 13: OUT(*ρ*) = IN(*t*), *x* = *x* + 1.

17: **while** CNR(*x*, *y*) = *H* **do** 18: OUT(*ρ*) = IN(*t*), *t* = *t* + 1.

21: **else if** CNR(*x*, *y*) = *V* **then** 22: **if** BUFF(*x*) = 0 **then** 23: **if** IN(*t* + 1) = *�* **then** 24: OUT(*x*, *y*) = IN(*t*). 25: Set BUFF(*x*) = IN(*t*).

31: OUT(*x*, *y*) = BUFF(*x*).

28: OUT(*x*, *y*) = IN(*t*), *t* = *t* + 1.

We tested the algorithm on a memory circuit which has 13 layers, uses 500 nm lithography technology, and has repeated memory cell structure. The circuit was rasterized on a 1nm grid and then regrouped with block size 250 × 250. The intensity for each block was quantized using 32 levels. The resulting 5-bit gray level image rasterized on a 250nm grid satisfies the minimum edge spacing of 8nm. For this circuit our algorithm *CornerGray* runs on the entire

1: Initialize *t* = 1.

3: **for** *y* = 1 **to** *R* **do** 4: **for** *x* = 1 **to** *C* **do** 5: **if** CNR(*x*, *y*) = *I* **then** 6: OUT(*x*, *y*) = nLv. 7: **else if** CNR(*x*, *y*) = *C* **then** 8: OUT(*x*, *y*) = IN(*x*, *y*), *t* = *t* + 1.

9: BUFF(*x*) = 0.

14: **end while** 15: *t* = *t* + 2. 16: **else**

19: **end while** 20: **end if**

26: *t* = *t* + 2.

**4. Experimental results**

27: **else**

29: **end if** 30: **else**

32: **end if** 33: **end if** 34: **end for** 35: **end for**

**Input:** Intensity stream IN ∈ {0, ··· nLv <sup>−</sup> <sup>1</sup>}*<sup>ρ</sup>* **Input:** Corner map CNR ∈ {*O*, *<sup>I</sup>*, *<sup>C</sup>*, *<sup>H</sup>*, *<sup>V</sup>*}*C*·*<sup>R</sup>*

**Output:** Gray layer image OUT ∈ {0, ··· , nLv <sup>−</sup> <sup>1</sup>}*C*·*<sup>R</sup>* **Intermediate:** Intensity buffer BUFF ∈ {0, ··· , nLv <sup>−</sup> <sup>1</sup>}*<sup>C</sup>*

Algorithm for Electron Beam Direct Write Lithography Systems

<sup>107</sup> Transform-Based Lossless Image Compression


**Algorithm 5** Inverse Corner Transformation - Part II

and lines 21-33 reconstruct the vertical edges. Because the intensity buffer BUFF requires a full row, *width* × bits per pixel bits are required for this process. Since the decoder requires two *width*-bit buffers for corner reconstruction and one *width* × bits per pixel-bit buffer for intensity decoding, the total decoder memory requirement is *width* × (2 + bits per pixel). However, when bits per pixel is at least 3 the decoder memory requirement is less than that of *Block C4* which is 2 × bits per pixel × *width*.

#### **Algorithm 6** Intensity Stream Decoding

12 Lithography / Book 2

and lines 21-33 reconstruct the vertical edges. Because the intensity buffer BUFF requires a full

Since the decoder requires two *width*-bit buffers for corner reconstruction and one *width* × bits per pixel-bit buffer for intensity decoding, the total decoder memory requirement is *width* × (2 + bits per pixel). However, when bits per pixel is at least 3 the decoder memory requirement is less than that of *Block C4* which is 2 × bits per pixel × *width*.

row, *width* × bits per pixel bits are required for this process.

Fill, BUFF(*x*) = BUFF(*x*)

Fill, *x* = *x* + 1

**Algorithm 5** Inverse Corner Transformation - Part II

Run *α* means BIN(*x*, *y*) = BIN(*x*, *y*)

3: Initialize CNR(*x*) = 0, ∀*x*. 4: **for** *x* = 1 **to** *C* **do** 5: **if** IN(*x*, *y*) = 1 **then** 6: Fill = Fill 1 7: **if** BUFF(*x*) = 0 **then**

9: **while** IN(*x*, *y*) = 0 **do**

1: **for** *y* = 1 **to** *R* **do** 2: Fill = 0.

8: Run *α*

13: **else**

15: Run *α*

18: Run *α* 19: **end while**

21: **end if**

26: Run *α*

29: Run *α* 30: **end while**

32: **end if** 33: **end if** 34: **end for** 35: **end for**

23: **else**

10: CNR(*x*) = 1 11: Run *α* 12: **end while**

14: OUT(*x*, *y* − 1) = *C*.

16: **while** IN(*x*, *y*) = 0 **do** 17: OUT(*x*, *y* − 1) = *H*

20: OUT(*x* − 1, *y* − 1) = *C*.

27: **while** BUFF(*x*) = 1 **do** 28: OUT(*x*, *y* − 1) = *I*

31: OUT(*x* − 1, *y* − 1) = *V*

22: Fill = Fill 1

24: **if** BUFF(*x*) = 1 **then** 25: OUT(*x*, *y* − 1) = *V* **Input:** Intensity stream IN ∈ {0, ··· nLv <sup>−</sup> <sup>1</sup>}*<sup>ρ</sup>* **Input:** Corner map CNR ∈ {*O*, *<sup>I</sup>*, *<sup>C</sup>*, *<sup>H</sup>*, *<sup>V</sup>*}*C*·*<sup>R</sup>* **Output:** Gray layer image OUT ∈ {0, ··· , nLv <sup>−</sup> <sup>1</sup>}*C*·*<sup>R</sup>* **Intermediate:** Intensity buffer BUFF ∈ {0, ··· , nLv <sup>−</sup> <sup>1</sup>}*<sup>C</sup>* 1: Initialize *t* = 1. 2: Initialize OUT(*x*, *y*) = 0, ∀*x*, *y*. 3: **for** *y* = 1 **to** *R* **do** 4: **for** *x* = 1 **to** *C* **do** 5: **if** CNR(*x*, *y*) = *I* **then** 6: OUT(*x*, *y*) = nLv. 7: **else if** CNR(*x*, *y*) = *C* **then** 8: OUT(*x*, *y*) = IN(*x*, *y*), *t* = *t* + 1. 9: BUFF(*x*) = 0. 10: **else if** CNR(*x*, *y*) = *H* **then** 11: **if** IN(*t* + 1) = *�* **then** 12: **while** CNR(*x*, *y*) = *H* **do** 13: OUT(*ρ*) = IN(*t*), *x* = *x* + 1. 14: **end while** 15: *t* = *t* + 2. 16: **else** 17: **while** CNR(*x*, *y*) = *H* **do** 18: OUT(*ρ*) = IN(*t*), *t* = *t* + 1. 19: **end while** 20: **end if** 21: **else if** CNR(*x*, *y*) = *V* **then** 22: **if** BUFF(*x*) = 0 **then** 23: **if** IN(*t* + 1) = *�* **then** 24: OUT(*x*, *y*) = IN(*t*). 25: Set BUFF(*x*) = IN(*t*). 26: *t* = *t* + 2. 27: **else** 28: OUT(*x*, *y*) = IN(*t*), *t* = *t* + 1. 29: **end if** 30: **else** 31: OUT(*x*, *y*) = BUFF(*x*). 32: **end if** 33: **end if** 34: **end for** 35: **end for**
