32
34
//#define VALIDATE_LSUM
33
35
//#define VALIDATE_PEAK
36
#define USE_UNDOCUMENTED
38
ACTION_SET_POINTS = 3,
39
ACTION_GET_POINTS = 4,
40
ACTION_COMPUTE_BASE = 10,
41
ACTION_COMPUTE_BASE_FRAGMENT = 2,
42
#endif /* VALIDAT_LSUM */
43
ACTION_SET_BASE_POINTS = 3,
44
ACTION_COMPUTE_BASE = 4,
41
47
ACTION_COMPUTE_FRAGMENT = 11,
48
ACTION_GET_CORRECTIONS = 15,
49
#endif /* VALIDATE_PEAK */
50
ACTION_SET_POINTS = 12,
52
ACTION_GET_POINTS = 14,
52
62
struct STProcessingState {
53
cufftComplex *cuda_base_buffer; // Stored FFT's of the template image
54
void *cuda_data_buffer; // Main computational buffer, temporary
55
cufftReal *cuda_temp_buffer; // Temporary buffer for FFT inputs, pre-zeroed
63
int stored; // flag indicating if we already have coordinates in coords stored
64
mxArray *coords; // Matlab array with current coordinates
65
float *points; // various information on control points
66
// base_x, base_y, data_x, data_y
67
// base_frac_x, base_frac_y
70
uint8_t *banlist; // control points banned from computations for various reasons
72
uint8_t *input_buffer; // Input Image buffer / Host
73
uint8_t *cuda_input_buffer; // Input Image buffer / Device
75
cufftReal *cuda_base_buffer; // Temporary buffer for FFT inputs, pre-zeroed
76
cufftReal *cuda_data_buffer; // Temporary buffer for FFT inputs, pre-zeroed
78
void *cuda_temp_buffer; // Main computational buffer, temporary
80
cufftComplex *cuda_fft_buffer; // Stored FFT's of the template image
56
82
cufftReal *cuda_result_buffer; // Temporary buffer for FFT outputs
57
83
float *cuda_final_buffer; // Ultimate output
58
uint8_t *cuda_input_buffer; // Input buffer
60
85
float *cuda_lsum_temp; // Temporary buffer for local sum comp.
71
float *data_x; // x coordinates of control points
72
float *data_y; // y coordinates of control points
73
uint8_t *input_buffer;
96
int fft_initialized; // Flag indicating if CUFFT plan is initialized
97
cufftHandle cufft_plan;
98
cufftHandle cufft_r2c_plan;
99
cufftHandle cufft_c2r_plan;
101
int cudpp_initialized; // Flag indicating if CUDPP plan is initialized
102
CUDPPHandle cudpp_plan;
104
int mode; // 1 - image mode, 0 - fragment mode
105
int base_mode; // 1 - image mode, 0 - fragment mode
107
float minx,miny,maxx,maxy; // Coordinates of actualy used rectangle of image
75
109
int ncp; // Number of control points
76
110
int ncp_alloc_size;
78
112
int corr_size; // CORR_SIZE
113
int precision; // PRECISION
80
115
int side_alloc_size; // allocation size for 1 side of fft
89
124
int lsum_aligned_size; // CUDA optimized lsum_temp_size
90
125
int lsum_short_aligned_size;// CUDA optimized lsum_temp_size - lsum_size - 1
92
int fft_initialized; // Flag indicating if CUFFT plan is initialized
93
cufftHandle cufft_plan;
94
cufftHandle cufft_r2c_plan;
95
cufftHandle cufft_c2r_plan;
97
int cudpp_initialized; // Flag indicating if CUDPP plan is initialized
98
CUDPPHandle cudpp_plan;
101
129
typedef struct STProcessingState TProcessingState;
133
#define EXTERN_C extern "C"
135
#define EXTERN_C extern
139
#ifdef USE_UNDOCUMENTED
140
EXTERN_C mxArray *mxCreateSharedDataCopy(const mxArray *pr);
141
#endif /* USE_UNDOCUMENTED */
103
143
#endif /* NORMXCORR_HW_H */