Openholo  v1.0
Open Source Digital Holographic Library
ophGen.cpp File Reference
#include "ophGen.h"
#include <windows.h>
#include "sys.h"
#include "function.h"
#include <cuda_runtime.h>
#include <cufft.h>
#include "tinyxml2.h"
#include "PLYparser.h"
Include dependency graph for ophGen.cpp:

Go to the source code of this file.

Macros

#define for_i(itr, oper)   for(int i=0; i<itr; i++){ oper }
 

Functions

void cudaFFT (CUstream_st *stream, int nx, int ny, cufftDoubleComplex *in_filed, cufftDoubleComplex *output_field, int direction, bool bNormailized=false)
 Convert data from the spatial domain to the frequency domain using 2D FFT on GPU. More...
 
void cudaCropFringe (CUstream_st *stream, int nx, int ny, cufftDoubleComplex *in_field, cufftDoubleComplex *out_field, int cropx1, int cropx2, int cropy1, int cropy2)
 Crop input data according to x, y coordinates on GPU. More...
 
void cudaGetFringe (CUstream_st *stream, int pnx, int pny, cufftDoubleComplex *in_field, cufftDoubleComplex *out_field, int sig_locationx, int sig_locationy, Real ssx, Real ssy, Real ppx, Real ppy, Real PI)
 Encode the CGH according to a signal location parameter on the GPU. More...
 

Macro Definition Documentation

◆ for_i

#define for_i (   itr,
  oper 
)    for(int i=0; i<itr; i++){ oper }

Definition at line 380 of file ophGen.cpp.

Function Documentation

◆ cudaCropFringe()

void cudaCropFringe ( CUstream_st *  stream,
int  nx,
int  ny,
cufftDoubleComplex *  in_field,
cufftDoubleComplex *  out_field,
int  cropx1,
int  cropx2,
int  cropy1,
int  cropy2 
)

Crop input data according to x, y coordinates on GPU.

call CUDA Kernel - cropFringe.

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
cropx1: the start x-coordinate to crop.
cropx2: the end x-coordinate to crop.
cropy1: the start y-coordinate to crop.
cropy2: the end y-coordinate to crop.
See also
encoding_GPU

◆ cudaFFT()

void cudaFFT ( CUstream_st *  stream,
int  nx,
int  ny,
cufftDoubleComplex *  in_filed,
cufftDoubleComplex *  output_field,
int  direction,
bool  bNormailized = false 
)

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

◆ cudaGetFringe()

void cudaGetFringe ( CUstream_st *  stream,
int  pnx,
int  pny,
cufftDoubleComplex *  in_field,
cufftDoubleComplex *  out_field,
int  sig_locationx,
int  sig_locationy,
Real  ssx,
Real  ssy,
Real  ppx,
Real  ppy,
Real  PI 
)

Encode the CGH according to a signal location parameter on the GPU.

The variable, ((Real*)p_hologram) has the final result.

Parameters
stream: CUDA Stream
pnx: the number of column of the input data
pny: the number of row of the input data
in_field: input data
out_field: output data
sig_locationx: signal location of x-axis, left or right half
sig_locationy: signal location of y-axis, upper or lower half
ssx: pnx * ppx
ssy: pny * ppy
ppx: pixel pitch of x-axis
ppy: pixel pitch of y-axis
PI: Pi
See also
encoding_GPU