next up previous
Next: 4 New Algorithm: PMIC Up: PATTERN MATCHING IMAGE COMPRESSION Previous: 2 Review of PMIC

3 Review of DPCM

In the following, xi,j = xm stands for the color value of the pixel currently in position (i,j) = m in the $N\times N$ pixels original image, and $\hat{x}_{i,j} = \hat{x}_m$ is the color value of the ``predicted'' (reconstructed) pixel of the reconstructed image. As seen in [11] and accordingly to Fig. 2, the configuration of the 2-D predictor is as following:


  
Figure 2: DPCM predictor configuration.
\begin{figure}
 \centerline{
 
\psfig {file=DPCM_predictor_config.epsi,width=4in,angle=-90}
}\end{figure}

 
 \begin{displaymath}
\hat{x}_m= 0.75A - 0.50B + 0.75C.\end{displaymath} (2)

where xm= xi,j, $A = \hat{x}_{i,j-1}$, $B = \hat{x}_{i-1,j-1}$, and $C = \hat{x}_{i-1,j}$.

In the above, em stands for the error value between the original and the reconstructed pixels:

\begin{displaymath}
e_m = x_m- \hat{x}_m.\end{displaymath} (3)

Finally, $e^{\star}_m$ is the quantized value of em, as described in [11] from which Table 1 is drawn. Then:

Algorithm PREDICTION
Input: xi,j = xm, $\hat{x}_{i,j-1} = A$, $\hat{x}_{i-1,j-1} = B$, and $\hat{x}_{i-1,j} = C$ (see Fig. 2).
Output: $e^{\star}_m$.
Method: We compute a first $\hat{x}_m$, then em and $e^{\star}_m$. Eventually, we update the value of $\hat{x}_m$.


begin
		 Compute $\hat{x}_m$ accordingly to Eq. 2
		 Clip $\hat{x}_m$ to the range [0,255]
		 Compute $e_m := x_m - \hat{x}_m$ 
		 Compute $e^{\star}_m:= Quantize (e_m)$ 
		 Upgrade $\hat{x}_m$ by computing $\hat{x}_m$ := $\hat{x}_m+ e^{\star}_m$ 
		 Clip $\hat{x}_m$ to the range [0,255] 
end


   
Table 1: 8-level Lloyd-Max quantizer for the ``Lena'' image.
i $(d_i,d_{i+1}) \rightarrow r_i$ Probability Huffman Code
  (-255,-16) $\rightarrow$ -20 0.025 111111
1 (-16,-8) $\rightarrow$ -11 0.047 11110
2 (-8,-4) $\rightarrow$ -6 0.145 110
3 (-4,0) $\rightarrow$ -2 0.278 00
4 (0,4) $\rightarrow$ 2 0.283 10
5 (4,8) $\rightarrow$ 6 0.151 01
6 (8,16) $\rightarrow$ 11 0.049 1110
7 (16,255) $\rightarrow$ 20 0.022 111110


In fact, we add an offset of 128 to $e^{\star}_m$, making all of the error values positive (for an 8-bit original) so that they can be printed on a output device. The error image for a perfectly reconstructed image is thus uniform gray field with a code value of 128.


  
Figure 3: DPCM block diagram.
\begin{figure}

\psfig {file=DPCM_block_diagram.epsi,width=5in,angle=-90}\end{figure}

The DPCM algorithm is summarized in Figure 3. We observe that it applies to every pixel of the image. That leads to the following algorithm:

Algorithm PREDICTION_LOOP
Input: xi,j = xm, for all $(0\leq i\leq N-1)$ and $(0\leq
j\leq N-1)$.
Output: $e^{\star}_m$, for all $(0\leq i\leq N-1)$ and $(0\leq
j\leq N-1)$.
Method: We use PREDICTION to compute $e^{\star}_m$ for each pixel.


begin
		 Initialize $\hat{x}_m= x_m$ and $e^{\star}_m= x_m$ for all $(0\leq i\leq N-1)$ and j=0.
		 for j=1 to N-1 do
		 		 for i=0 to N-1 do
		 		 		 Call PREDICTION on xi,j = xm, $\hat{x}_{i,j-1} = A$, $\hat{x}_{i-1,j-1} = B$, and
		 		 		 $\hat{x}_{i-1,j} = C$ (see Fig. 2).
		 		 doend
		  doend 
end

From Figure  3 one concludes that the prediction (reconstructed pixel) $\hat{x}_m$ for the transmitter is exactly the same as the one used by the receiver. They both need, and only need, the quantized difference $e^{\star}_m$. The transmitter puts this difference in a file, whereas the receiver reads this difference from the file.

Finally, $e^{\star}_m$, which is the quantized difference for each pixel, and the whole picture (formed with these quantized differences) is compressed with Huffman code.


next up previous
Next: 4 New Algorithm: PMIC Up: PATTERN MATCHING IMAGE COMPRESSION Previous: 2 Review of PMIC
Denis Arnaud
11/19/1997