## 2 Computer Generated Phase-Only Hologram with Error Diffusion Method  
Error diffusion algorithm [21; 22; 23; 24] is a non-iterative and high-quality method for calculating a phase-only hologram from an object image on computer. The working principles of phase-only hologram calculation with error diffusion method are described below. To start with, \(O(x,y)\) denotes the object image and a complex Fresnel hologram \(H(x,y)\) can be calculated based on the Fresnel diffraction formulas illustrated by Equations (1) and (2).  
\[f(x,y;z)=\frac{exp(i\frac{2\pi z}{\lambda})}{i\lambda z}exp\left[i\frac{\pi \left(x^{2}+y^{2}\right)}{\lambda z}\right] \tag{1}\]  
\[H\left(x,y\right)=O\left(x,y\right)*f(x,y;z) \tag{2}\]  
where \(f(x,y;z)\) denotes the impulse function for Fresnel transform, \(\lambda\) denotes the wavelength of illumination light and \(z\) denotes the distance between the object image plane and hologram plane. As shown in Figure 2, a Fresnel zone plate can be generated at the hologram plane for each object point with a Fresnel impulse function. The final calculated hologram is a superposition of the Fresnel zone plates from all the points (or pixels) in the object image. More detailed explanation about the Fresnel hologram calculation can be found in [13; 14; 15; 16; 17].  
The complex hologram \(H(x,y)\) can be converted to a phase-only hologram \(P(x,y)\) with error diffusion algorithm [21; 22; 23; 24] to achieve high-quality holographic display on a phase-only spatial light modulator. In the error diffusion method, the complex value of each hologram pixel is forced to be unity amplitude and the resulting complex error is diffused to neighboring pixel values. The following operations (Equations (3)-(8)) are performed on each individual holographic pixel sequentially in row-by-row and column-by-column scanning manner, as illustrated in Figure 3.  
\[E\left(x_{j},y_{j}\right)=H\left(x_{j},y_{j}\right)-P\left(x_{j},y_{j}\right) \tag{3}\]  
\[H\left(x_{j},y_{j}+1\right)\gets H\left(x_{j},y_{j}+1\right)+w_{1}E\left( x_{j},y_{j}\right) \tag{4}\]  
Figure 2: Fresnel light filed propagation from one object point.  
\[H\left(x_{j}+1,y_{j}-1\right) \gets H\left(x_{j}+1,y_{j}-1\right)+w_{2}E\left(x_{j},y_{j}\right) \tag{5}\] \[H\left(x_{j}+1,y_{j}\right) \gets H\left(x_{j}+1,y_{j}\right)+w_{3}E\left(x_{j},y_{j}\right)\] (6) \[H\left(x_{j}+1,y_{j}+1\right) \gets H\left(x_{j}+1,y_{j}+1\right)+w_{4}E\left(x_{j},y_{j}\right)\] (7) \[P\left(x_{j},y_{j}\right) =\mathit{Phase}\left[H\left(x_{j},y_{j}\right)\right] \tag{8}\]  
where \(P(x_{j},y_{j})\) denotes the phase-only pixel value at position \((x_{j},y_{j})\) after the complex pixel value \(H(x_{j},y_{j})\) is phase truncated (the magnitude is forced to be unity), \(E(x_{j},y_{j})\) denotes the complex error and four different weighting coefficients, \(w_{1}=7/16\), \(w_{2}=3/16\), \(w_{3}=5/16\) and \(w_{4}=1/16\), are imposed on four different directions, as shown in Figure 3.  
After each pixel in a complex hologram is processed, the entire hologram will become a phase-only type hologram. More details about the error diffusion methods for phase-only hologram generation can be found in [21; 22; 23; 24]. In practice, bi-directional error diffusion, a slightly modified version of the above unidirectional error diffusion, can yield slightly better performance [21].