Openholo  v4.2
Open Source Digital Holographic Library
ophPCKernel.cl
Go to the documentation of this file.
1 
2 extern const char *pKernel[] =
3 {
4 "typedef struct cl_complex\n"
5 "{\n"
6 " double real;\n"
7 " double imag;\n"
8 "} Complex;\n"
9 "\n"
10 "\n"
11 "typedef struct KernelConst_NotEncodedRS\n"
12 "{\n"
13 " int n_points; /// number of point cloud\n"
14 " int n_colors; /// number of colors per point cloud\n"
15 " int n_streams; /// number of streams\n"
16 "\n"
17 " double scale_X; /// Scaling factor of x coordinate of point cloud\n"
18 " double scale_Y; /// Scaling factor of y coordinate of point cloud\n"
19 " double scale_Z; /// Scaling factor of z coordinate of point cloud\n"
20 "\n"
21 " double offset_depth; /// Offset value of point cloud in z direction\n"
22 "\n"
23 " int pn_X; /// Number of pixel of SLM in x direction\n"
24 " int pn_Y; /// Number of pixel of SLM in y direction\n"
25 "\n"
26 " double pp_X; /// Pixel pitch of SLM in x direction\n"
27 " double pp_Y; /// Pixel pitch of SLM in y direction\n"
28 "\n"
29 " double half_ss_X; /// (pixel_x * nx) / 2\n"
30 " double half_ss_Y; /// (pixel_y * ny) / 2\n"
31 "\n"
32 " double k; /// Wave Number = (2 * PI) / lambda;\n"
33 " double lambda; /// Wave Length\n"
34 "\n"
35 " double det_tx; /// tx / sqrt(1 - tx^2), tx = lambda / (2 * pp_X)\n"
36 " double det_ty; /// ty / sqrt(1 - ty^2), ty = lambda / (2 * pp_Y)\n"
37 "} KernelConfig;\n"
38 "\n"
39 "\n"
40 "__kernel void clKernel_diffractNotEncodedRS(\n"
41 " __global Complex *output, \n"
42 " __global double *a, \n"
43 " __global double *b, \n"
44 " __global KernelConfig *config, \n"
45 " const unsigned int cnt) \n"
46 "{\n"
47 " uint width = get_global_size(0); \n"
48 " uint row = get_global_id(1); \n"
49 " uint col = get_global_id(0); \n"
50 " uint idx = width * row + col; \n"
51 " if(idx < cnt) { \n"
52 " double xxx = -config->half_ss_X + (col - 1) * config->pp_X; \n"
53 " double yyy = -config->half_ss_Y + (config->pn_Y - row) * config->pp_Y; \n"
54 " double pcx = a[3 * 0 + 0] * config->scale_X; \n"
55 " double pcy = a[3 * 0 + 1] * config->scale_Y; \n"
56 " output[idx].real = a[idx]; \n"
57 " output[idx].imag = b[idx]; \n"
58 " } \n"
59 "}\n"
60 };