double look‑up table method for fast light propagation ... · lobaz / double look‑up table...
TRANSCRIPT
DEPARTMENT OFCOMPUTER SCIENCE AND ENGINEERING
CENTREOF COMPUTER GRAPHICSAND VISUALIZATION
PLZEŇCZECH REPUBLIC
http://graphics.zcu.cz
FACULTYOF APPLIED SCIENCESUNIVERSITYOF WEST BOHEMIA
Petr Lobaz
University of West Bohemia Pilsen, Czech Republic [email protected]
Double look‑up table method for fast light propagation calculations
Lobaz / Double look‑up table method for fast light propagation calculations 2 / 16
The problem
Radially symmetric functions in holography
• Rayleigh‑Sommerfeld convolution kernel
KRS(x, y; z0) = – 12π
j 2πλ –
1r
exp(j2πr / λ)
r z0
r
r= x2 + y2 + z02
• free space transfer function (angular spectrum kernel)
• lens phase shift function
• … re
im x
y
Lobaz / Double look‑up table method for fast light propagation calculations 3 / 16
Radially symmetric functions in holography
• require complicated elementary functions evaluation (sin, cos, sqrt, …)
• sometimes hard to calculate (e.g. filtered kernels)• highly oscillatory ⇒ require high precision arithmetic
The problem
correctcalculation
Example:Rayleigh-Sommerfeldkernel
λ=500 nmz0=2.1 m
singleprecision
Lobaz / Double look‑up table method for fast light propagation calculations 4 / 16
Function evaluation should be
• fast and precise, easy to parallelize• easy to implement on GPU or in hardware
GPU features
Many simple cores optimized for• single precision arithmetic• independent per‑pixel operations• linear code execution (no branching)• computer graphics calculations (texture look‑up)• fast cache memory access
The wish list
Lobaz / Double look‑up table method for fast light propagation calculations 5 / 16
Two-step calculation
Example: Rayleigh‑Sommerfeld convolution kernel
1. ρ(x, y)= x2 + y2
2. KRS(ρ; z0) = – 12π
j 2πλ –
1r
exp(j2πr / λ)
r z0
r
r= ρ2 + z02
Proposed method
Precalculate ρ(x, y) and KRS(ρ; z0) to look‑up tables rhoLUT and waveLUT (double look‑up table method)
D‑LUT principle
Lobaz / Double look‑up table method for fast light propagation calculations 6 / 16
D‑LUT principle
input: (�, �; �0) output: �RS(�; �0) = �RS(�, �; �0)
rhoLUT
�min � �max�min
�
�max
�min
�maxwaveLUT
�RS()
�min � �max�min
�
�max
re
im
|�| |�| �
�0
Lobaz / Double look‑up table method for fast light propagation calculations 7 / 16
Definition and usage of the rhoLUT
• rhoLUT[m, n] = (mΔρ)2 + (nΔρ)2
ρ(x, y)≈rhoLUT[x / Δρ, y / Δρ]
– use nearest‑neighbour or bilinear interpolation for noninteger x / Δρ, y / Δρ
• sampling distance Δρ small ⇒ higher precision, larger table• nearest‑neighbour interpolation ⇒ faster, less precise ⇒ requires smaller Δρ
rhoLUT properties
Lobaz / Double look‑up table method for fast light propagation calculations 8 / 16
• error of r = ρ2 + z02 should be small
• example: error of r for bilinear interp. in the rhoLUT
rhoLUT properties
x [mm]0
3
3
y
∆� = 100 �m2.67 nm
0
0.50
1.00
1.50
2.00
2.50
x [�m]0
200
200
y
∆� = 100 �m
00 2 4 6 8 10 x [m]
123
[nm
]
�0 = 0.5 m�(��( , �), �0) – �(�( , �), �0) for � = ∆� / 2 ∆� = 100 �m
x [mm]0
3
3
y
∆� = 100 �m2.67 nm
0
0.50
1.00
1.50
2.00
2.50
x [�m]0
200
200
y
∆� = 100 �m
00 2 4 6 8 10 x [m]
123
[nm
]
�0 = 0.5 m�(��( , �), �0) – �(�( , �), �0) for � = ∆� / 2 ∆� = 100 �m
x [mm]0
3
3
y
∆� = 100 �m2.67 nm
0
0.50
1.00
1.50
2.00
2.50
x [�m]0
200
200
y
∆� = 100 �m
00 2 4 6 8 10 x [m]
123
[nm
]
�0 = 0.5 m�(��( , �), �0) – �(�( , �), �0) for � = ∆� / 2 ∆� = 100 �m
Lobaz / Double look‑up table method for fast light propagation calculations 9 / 16
Selection of Δρ• estimate of the maximum error
maxRError(Δρ; z0) = 1.2 ρBilinear
Δρ2
, Δρ2
2
+ z02
1/2
–
1.2 ρExact
Δρ2
, Δρ2
2
+ z02
1/2
(factor1.2resultsfromdeepererroranalysis)
rhoLUT properties
Lobaz / Double look‑up table method for fast light propagation calculations 10 / 16
Selection of Δρ• maxRError looks like a line in a log‑log graph
for wide range of Δρ, z0 and acceptable error values
rhoLUT properties
10–610–14
10–12
10–10
10–8
10–6
10–4
10–2
1 �0 = 0.001 m
max
REr
ror(
∆�,
�0)
[m]
10–5 10–4 10–3 10–2 10–1
∆� [m]
�0 = 0.01 m�0 = 0.1 m�0 = 1 m�0 = 10 m
Lobaz / Double look‑up table method for fast light propagation calculations 11 / 16
rhoLUT properties
Selection of Δρ• linear approximation in the log‑log graph leads to
Δρ ≈exp
1κ log
maxRError(z0)ξ1 exp(ξ0)
(where κ ≈ 1.9998, ξ0 ≈ –1.9886, ξ1 ≈ –0.9999)
Example
propagation area 50 × 50 mm2, z0 = 1 m• maxRError = λ / 100 ⇒ rhoLUT size 264 × 264• maxRError = λ / 10 ⇒ rhoLUT size 84 × 84
Lobaz / Double look‑up table method for fast light propagation calculations 12 / 16
Definition and usage of the waveLUT
• waveLUT[q; z0] = KRS(qΔw; z0)
KRS(ρ; z0)≈waveLUT[ρ / Δw; z0]
– use nearest‑neighbour or linear interpolation for noninteger ρ / Δw
• Δw should be small enough to capture oscillations of KRS(ρ; z0)
• calculate maximum local frequency of KRS(ρ; z0)• set Δw ≤ 1 / (8 × maximum local frequency)
waveLUT properties
Lobaz / Double look‑up table method for fast light propagation calculations 13 / 16
Accuracy
• look‑up tables precalculated in double precision• measured error according to theoretical analysis• no problems with single precision calculations
Look-up tables sizes
• example values for typical scenario in computer generated holography (hologram size ≈ 5 × 5 cm, resolution 1 μm ⇒ hologram size 2.5 GB)
• rhoLUT size ≈ 500 × 500 samples (≈ 1 MB)• waveLUT size ≈ 250 000 × Z samples (≈ 2Z MB)
Results
Lobaz / Double look‑up table method for fast light propagation calculations 14 / 16
Results
CPU implemenation speed
• 10× to 200× faster than direct calculation for complicated filtered propagation kernels in realistic scenarios (just with waveLUT, ρ calculated directly)
• 1.7× faster than direct calculation for simple propagation kernel (just with waveLUT, ρ calculated directly)
• careful rhoLUT implementation 1.2–1.4× faster than calculating ρ directly
Lobaz / Double look‑up table method for fast light propagation calculations 15 / 16
GPU implemenation
• look‑up tables precalculated on CPU in double precision
• incorporation of texture look‑up and built‑in texture interpolation
• no problems with GPU accuracy• execution speed not yet fully tested
Work in progress (almost done)
• careful testing of GPU performance• angular spectrum propagation method
Results
DEPARTMENT OFCOMPUTER SCIENCE AND ENGINEERING
CENTREOF COMPUTER GRAPHICSAND VISUALIZATION
PLZEŇCZECH REPUBLIC
http://graphics.zcu.cz
FACULTYOF APPLIED SCIENCESUNIVERSITYOF WEST BOHEMIA
Thank you for your attention!
Feel free to ask me for the manuscript of the full text and scripts for detailed error analysis.
(Petr Lobaz / [email protected])
Double look‑up table method for fast light propagation calculations