Openholo  v4.2
Open Source Digital Holographic Library
ophGen.cpp File Reference
#include "ophGen.h"
#include "sys.h"
#include "function.h"
#include <cuda_runtime_api.h>
#include <cufft.h>
#include <omp.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include "ImgControl.h"
#include "tinyxml2.h"
#include "PLYparser.h"
Include dependency graph for ophGen.cpp:

Go to the source code of this file.

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...
 

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