Openholo  v4.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_api.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.

Classes

struct  DMKernelConfig
 

Macros

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

Typedefs

typedef struct DMKernelConfig DMKernelConfig
 

Functions

void cudaDepthHoloKernel (CUstream_st *stream, int nx, int ny, cufftDoubleComplex *u_o_gpu_, unsigned char *img_src_gpu, unsigned char *dimg_src_gpu, Real *depth_index_gpu, int dtr, cuDoubleComplex rand_phase_val, cuDoubleComplex carrier_phase_delay, int flag_change_depth_quan, unsigned int default_depth_quan, const unsigned int &mode)
 Convert data from the spatial domain to the frequency domain using 2D FFT on GPU. More...
 
void cudaPropagation_AngularSpKernel (const int &nBlocks, const int &nThreads, CUstream_st *stream_, cufftDoubleComplex *input_d, cufftDoubleComplex *u_complex, const DMKernelConfig *cuda_config, 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. change_depth_quantization == 1 ). More...
 

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.

Typedef Documentation

◆ DMKernelConfig

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. 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  nx,
int  ny,
cufftDoubleComplex *  u_o_gpu_,
unsigned char *  img_src_gpu,
unsigned char *  dimg_src_gpu,
Real depth_index_gpu,
int  dtr,
cuDoubleComplex  rand_phase_val,
cuDoubleComplex  carrier_phase_delay,
int  flag_change_depth_quan,
unsigned int  default_depth_quan,
const unsigned int &  mode 
)

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.
See also
propagation_AngularSpectrum_GPU, encoding_GPU 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: the random phase value
carrier_phase_delay: 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
mode: float/double precision, use fastmath
See also
calc_Holo_GPU

◆ cudaPropagation_AngularSpKernel()

void cudaPropagation_AngularSpKernel ( const int &  nBlocks,
const int &  nThreads,
CUstream_st *  stream_,
cufftDoubleComplex *  input_d,
cufftDoubleComplex *  u_complex,
const DMKernelConfig cuda_config,
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
nBlcoks: the number of blocks
nThreads: the number of threads per block
stream: CUDA Stream
nx: the number of column of the input data
ny: 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