Openholo  v1.0
Open Source Digital Holographic Library
ophDepthMap_GPU.h File Reference

Openholo Point Cloud based CGH generation with CUDA GPGPU. More...

#include "ophDepthMap.h"
#include <cuda_runtime.h>
#include <cufft.h>
Include dependency graph for ophDepthMap_GPU.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __DEBUG_LOG_GPU_SPEC_
 
#define HANDLE_ERROR(err)   (HandleError( err, __FILE__, __LINE__ ))
 
#define HANDLE_NULL(a)
 

Functions

void cudaFFT (CUstream_st *stream, int nx, int ny, cufftDoubleComplex *in_filed, cufftDoubleComplex *output_field, int direction)
 Convert data from the spatial domain to the frequency domain using 2D FFT on GPU. More...
 
void cudaDepthHoloKernel (CUstream_st *stream, int pnx, int pny, cufftDoubleComplex *u_o_gpu_, unsigned char *img_src_gpu, unsigned char *dimg_src_gpu, Real *depth_index_gpu, int dtr, Real rand_phase_val_a, Real rand_phase_val_b, Real carrier_phase_delay_a, Real carrier_phase_delay_b, int flag_change_depth_quan, unsigned int default_depth_quan)
 Find each depth plane of the input image and apply carrier phase delay to it on GPU. More...
 
void cudaPropagation_AngularSpKernel (CUstream_st *stream_, int pnx, int pny, cufftDoubleComplex *input_d, cufftDoubleComplex *u_complex, Real ppx, Real ppy, Real ssx, Real ssy, Real lambda, Real params_k, Real propagation_dist)
 Angular spectrum propagation method for GPU implementation. More...
 
void cudaChangeDepthQuanKernel (CUstream_st *stream_, int pnx, int pny, Real *depth_index_gpu, unsigned char *dimg_src_gpu, int dtr, Real d1, Real d2, Real params_num_of_depth, Real params_far_depthmap, Real params_near_depthmap)
 Quantize depth map on the GPU, only when the number of depth quantization is not the default value (i.e. FLAG_CHANGE_DEPTH_QUANTIZATION == 1 ). More...
 

Variables

cufftDoubleComplex * u_o_gpu_
 
cufftDoubleComplex * u_complex_gpu_
 
cufftDoubleComplex * k_temp_d_
 
cudaStream_t stream_
 

Detailed Description

Openholo Point Cloud based CGH generation with CUDA GPGPU.

Author
Hyeong-Hak Ahn
Date
2018/09

Definition in file ophDepthMap_GPU.h.

Macro Definition Documentation

◆ __DEBUG_LOG_GPU_SPEC_

#define __DEBUG_LOG_GPU_SPEC_

Definition at line 58 of file ophDepthMap_GPU.h.

◆ HANDLE_ERROR

#define HANDLE_ERROR (   err)    (HandleError( err, __FILE__, __LINE__ ))

Definition at line 72 of file ophDepthMap_GPU.h.

◆ HANDLE_NULL

#define HANDLE_NULL (   a)
Value:
{if (a == NULL) { \
printf( "Host memory failed in %s at line %d\n", \
__FILE__, __LINE__ ); \
exit( EXIT_FAILURE );}}

Definition at line 75 of file ophDepthMap_GPU.h.

Function Documentation

◆ cudaChangeDepthQuanKernel()

void cudaChangeDepthQuanKernel ( CUstream_st *  stream_,
int  pnx,
int  pny,
Real depth_index_gpu,
unsigned char *  dimg_src_gpu,
int  dtr,
Real  d1,
Real  d2,
Real  params_num_of_depth,
Real  params_far_depthmap,
Real  params_near_depthmap 
)

Quantize depth map on the GPU, only when the number of depth quantization is not the default value (i.e. FLAG_CHANGE_DEPTH_QUANTIZATION == 1 ).

Calculate the value of 'depth_index_gpu'.

Parameters
stream: CUDA Stream
pnx: the number of column of the input data
pny: the number of row of the input data
depth_index_gpu: output variable
dimg_src_gpu: input depth map data
dtr: the current working depth level
d1: the starting physical point of each depth level
d2: the ending physical point of each depth level
params_num_of_depth: the number of depth level
params_far_depthmap: NEAR_OF_DEPTH_MAP at config file
params_near_depthmap: FAR_OF_DEPTH_MAP at config file
See also
change_depth_quan_GPU

◆ cudaDepthHoloKernel()

void cudaDepthHoloKernel ( CUstream_st *  stream,
int  pnx,
int  pny,
cufftDoubleComplex *  u_o_gpu_,
unsigned char *  img_src_gpu,
unsigned char *  dimg_src_gpu,
Real depth_index_gpu,
int  dtr,
Real  rand_phase_val_a,
Real  rand_phase_val_b,
Real  carrier_phase_delay_a,
Real  carrier_phase_delay_b,
int  flag_change_depth_quan,
unsigned int  default_depth_quan 
)

Find each depth plane of the input image and apply carrier phase delay to it on GPU.

call CUDA Kernel - depth_sources_kernel.

Parameters
stream: CUDA Stream
nx: the number of column of the input data
ny: the number of row of the input data
u_o_gpu_: output variable
img_src_gpu: input image data
dimg_src_gpu: input depth map data
depth_index_gpu: input quantized depth map data
dtr: current working depth level
rand_phase_val_a: the Real part of the random phase value
rand_phase_val_b: the imaginary part of the random phase value
carrier_phase_delay_a: the Real part of the carrier phase delay
carrier_phase_delay_b: the imaginary part of the carrier phase delay
flag_change_depth_quan: if true, change the depth quantization from the default value.
default_depth_quan: default value of the depth quantization - 256
See also
calc_Holo_GPU

◆ cudaFFT()

void cudaFFT ( CUstream_st *  stream,
int  nx,
int  ny,
cufftDoubleComplex *  in_filed,
cufftDoubleComplex *  output_field,
int  direction 
)

Convert data from the spatial domain to the frequency domain using 2D FFT on GPU.

call CUDA Kernel - fftShift and CUFFT Library.

Parameters
stream: CUDA Stream
nx: the number of column of the input data
ny: the number of row of the input data
in_field: input complex data variable
output_field: output complex data variable
direction: If direction == -1, forward FFT, if type == 1, inverse FFT.
bNomarlized: If bNomarlized == true, normalize the result after FFT.
See also
propagation_AngularSpectrum_GPU, encoding_GPU

◆ cudaPropagation_AngularSpKernel()

void cudaPropagation_AngularSpKernel ( CUstream_st *  stream_,
int  pnx,
int  pny,
cufftDoubleComplex *  input_d,
cufftDoubleComplex *  u_complex,
Real  ppx,
Real  ppy,
Real  ssx,
Real  ssy,
Real  lambda,
Real  params_k,
Real  propagation_dist 
)

Angular spectrum propagation method for GPU implementation.

The propagation results of all depth levels are accumulated in the variable 'u_complex_gpu_'.

Parameters
stream: CUDA Stream
pnx: the number of column of the input data
pny: the number of row of the input data
input_d: input data
u_complex: output data
ppx: pixel pitch of x-axis
ppy: pixel pitch of y-axis
ssx: pnx * ppx
ssy: pny * ppy
lambda: wavelength
params_k: 2 * PI / lambda
propagation_dist: the distance from the object to the hologram plane
See also
propagation_AngularSpectrum_GPU

Variable Documentation

◆ k_temp_d_

cufftDoubleComplex* k_temp_d_

Definition at line 81 of file ophDepthMap_GPU.h.

◆ stream_

cudaStream_t stream_

Definition at line 83 of file ophDepthMap_GPU.h.

◆ u_complex_gpu_

cufftDoubleComplex* u_complex_gpu_

Definition at line 80 of file ophDepthMap_GPU.h.

◆ u_o_gpu_

cufftDoubleComplex* u_o_gpu_

Definition at line 79 of file ophDepthMap_GPU.h.