/normxcorr/trunk

To get this branch, use:
bzr branch http://suren.me/webbzr/normxcorr/trunk

« back to all changes in this revision

Viewing changes to dict_hw/src/normxcorr_hw.h

  • Committer: Suren A. Chilingaryan
  • Date: 2010-04-25 04:39:54 UTC
  • Revision ID: csa@dside.dyndns.org-20100425043954-v7xm2bzohickyl9z
Multi-GPU support

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 
11
11
#include "dict_image.h"
12
12
 
 
13
#define DICT_SUPPORT_THREADS
 
14
 
13
15
#define TRANSPOSE_SIZE 64       // should equal to CPU cache line size
14
16
 
15
17
#define BLOCK_SIZE_1D           64
25
27
#define CUDA_EXTRA_MEMORY       67108864        // 64MB
26
28
//#define USE_SSE
27
29
 
 
30
#ifdef DICT_SUPPORT_THREADS
 
31
# include "hw_sched.h"
 
32
#endif /* DICT_SUPPORT_THREADS */
 
33
 
 
34
 
28
35
struct STProcessingState {
29
36
    int stored;                         // flag indicating if we already have coordinates in coords stored
30
37
 
31
38
    unsigned char *banlist;             // control points banned from computations for various reasons
32
39
 
33
40
 
34
 
    float *points;                      // various information on control points
35
 
                                        //      base_x, base_y, data_x, data_y
36
 
                                        //      base_frac_x, base_frac_y
37
 
                                        //      move_x, move_y
 
41
    float *points;                      // various information on control points, reference to DICTContext
 
42
    int points_alloc_size;              // equal to ncp_alloc_size of DICTContext
38
43
 
39
44
 
40
45
    float *cuda_points;                 // Various information on control points:
62
67
    float *cuda_lsum_temp;              // Temporary buffer for local sum comp, first two pre-zeroed
63
68
    
64
69
    
65
 
    float *res_x;                       // External points buffer
66
 
    float *res_y;                       // External points buffer
 
70
    float *res_x;                       // External points buffer, reference to DICTContext
 
71
    float *res_y;                       // External points buffer, reference to DICTContext
67
72
    
68
73
 
69
74
    int fft_initialized;                // Flag indicating if CUFFT plan is initialized
74
79
    int cudpp_initialized;              // Flag indicating if CUDPP plan is initialized
75
80
    CUDPPHandle cudpp_plan;
76
81
 
77
 
    DICTImageType image_type;
78
 
    void *image_buf;            // Temporary buffer for images (specific-format)
79
 
    unsigned char *image;       // Reduced format
80
 
    unsigned char *base_image;  // Stored base image
81
 
 
 
82
    int status;                 // Error code, 0 if operable
 
83
    
82
84
    int width;                  // Images width
83
85
    int height;                 // Images height
84
86
 
114
116
    int side_blocks_power;      // Indicates if amount of side blocks is power of 2
115
117
    int base_blocks_power;      // Indicates if amount of base blocks is power of 2
116
118
 
 
119
};
 
120
 
 
121
typedef struct STProcessingState TProcessingState;
 
122
typedef struct STProcessingState *ProcessingState;
 
123
 
 
124
 
 
125
struct STDICTContext {
 
126
    int ncp;
 
127
    int ncp_alloc_size;
 
128
    int ncp_per_device;
 
129
 
 
130
    int width;                  // Images width
 
131
    int height;                 // Images height
 
132
    
 
133
    int use_threads;            // Run in multithreaded mode
 
134
 
 
135
    DICTImageType image_type;
 
136
    void *image_buf;            // Temporary buffer for images (specific-format)
 
137
    unsigned char *image;       // Reduced format
 
138
    unsigned char *base_image;  // Stored base image
 
139
 
 
140
    float *points;                      // various information on control points
 
141
                                        //      base_x, base_y, data_x, data_y
 
142
                                        //      base_frac_x, base_frac_y
 
143
                                        //      move_x, move_y
 
144
 
 
145
    float *res_x;                       // External points buffer
 
146
    float *res_y;                       // External points buffer
 
147
 
 
148
 
 
149
        // Here are starting non-zeroed parameters, so the matlab_mode should be first
 
150
    int matlab_mode;            // 2D stored transposed (i.e. by columns)
 
151
 
 
152
#ifdef DICT_SUPPORT_THREADS
 
153
    HWSched sched;
 
154
#endif /* DICT_SUPPORT_THREADS */
 
155
 
 
156
    ProcessingState *pstates;
 
157
    
 
158
        // Just parameters to be passed to thread functions
 
159
    int res_do_copy;
 
160
    const unsigned char *param_img;
 
161
 
117
162
#ifdef DICT_HW_MEASURE_TIMINGS
118
163
    int time[24];               // Timing counters (SHOULD BE LAST in struct!!!): 
119
164
                                //  0- 3: hardware, init, set_base_points, set_cur_points
122
167
                                // 16   :get_results
123
168
#endif /* DICT_HW_MEASURE_TIMINGS */
124
169
};
125
 
 
126
 
typedef struct STProcessingState TProcessingState;
 
170
typedef struct STDICTContext TDICTContext;
127
171
 
128
172
 
129
173