|
|
|
@ -248,7 +248,7 @@ __kernel void get_first_k_initial_local_1(__global float *data_cost_selected_, _ |
|
|
|
|
/////////////////////////////////////////////////////////////// |
|
|
|
|
/////////////////////// init data cost //////////////////////// |
|
|
|
|
/////////////////////////////////////////////////////////////// |
|
|
|
|
float compute_3(__global uchar* left, __global uchar* right, |
|
|
|
|
inline float compute_3(__global uchar* left, __global uchar* right, |
|
|
|
|
float cdata_weight, float cmax_data_term) |
|
|
|
|
{ |
|
|
|
|
float tb = 0.114f * abs((int)left[0] - right[0]); |
|
|
|
@ -257,17 +257,21 @@ float compute_3(__global uchar* left, __global uchar* right, |
|
|
|
|
|
|
|
|
|
return fmin(cdata_weight * (tr + tg + tb), cdata_weight * cmax_data_term); |
|
|
|
|
} |
|
|
|
|
float compute_1(__global uchar* left, __global uchar* right, |
|
|
|
|
inline float compute_1(__global uchar* left, __global uchar* right, |
|
|
|
|
float cdata_weight, float cmax_data_term) |
|
|
|
|
{ |
|
|
|
|
return fmin(cdata_weight * abs((int)*left - (int)*right), cdata_weight * cmax_data_term); |
|
|
|
|
} |
|
|
|
|
short round_short(float v){ |
|
|
|
|
|
|
|
|
|
inline short round_short(float v) |
|
|
|
|
{ |
|
|
|
|
return convert_short_sat_rte(v); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
|
///////////////////////////////////init_data_cost/////////////////////////////////////////////// |
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
|
|
|
|
|
|
__kernel void init_data_cost_0(__global short *ctemp, __global uchar *cleft, __global uchar *cright, |
|
|
|
|
int h, int w, int level, int channels, |
|
|
|
|
int cmsg_step1, float cdata_weight, float cmax_data_term, int cdisp_step1, |
|
|
|
@ -993,7 +997,8 @@ __kernel void compute_data_cost_reduce_1(__global const float *selected_disp_pyr |
|
|
|
|
/////////////////////////////////////////////////////////////// |
|
|
|
|
//////////////////////// init message ///////////////////////// |
|
|
|
|
/////////////////////////////////////////////////////////////// |
|
|
|
|
void get_first_k_element_increase_0(__global short* u_new, __global short *d_new, __global short *l_new, |
|
|
|
|
|
|
|
|
|
static void get_first_k_element_increase_0(__global short* u_new, __global short *d_new, __global short *l_new, |
|
|
|
|
__global short *r_new, __global const short *u_cur, __global const short *d_cur, |
|
|
|
|
__global const short *l_cur, __global const short *r_cur, |
|
|
|
|
__global short *data_cost_selected, __global short *disparity_selected_new, |
|
|
|
@ -1027,7 +1032,8 @@ void get_first_k_element_increase_0(__global short* u_new, __global short *d_new |
|
|
|
|
data_cost_new[id * cdisp_step1] = SHRT_MAX; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
void get_first_k_element_increase_1(__global float *u_new, __global float *d_new, __global float *l_new, |
|
|
|
|
|
|
|
|
|
static void get_first_k_element_increase_1(__global float *u_new, __global float *d_new, __global float *l_new, |
|
|
|
|
__global float *r_new, __global const float *u_cur, __global const float *d_cur, |
|
|
|
|
__global const float *l_cur, __global const float *r_cur, |
|
|
|
|
__global float *data_cost_selected, __global float *disparity_selected_new, |
|
|
|
@ -1190,7 +1196,8 @@ __kernel void init_message_1(__global float *u_new_, __global float *d_new_, __g |
|
|
|
|
/////////////////////////////////////////////////////////////// |
|
|
|
|
//////////////////// calc all iterations ///////////////////// |
|
|
|
|
/////////////////////////////////////////////////////////////// |
|
|
|
|
void message_per_pixel_0(__global const short *data, __global short *msg_dst, __global const short *msg1, |
|
|
|
|
|
|
|
|
|
static void message_per_pixel_0(__global const short *data, __global short *msg_dst, __global const short *msg1, |
|
|
|
|
__global const short *msg2, __global const short *msg3, |
|
|
|
|
__global const short *dst_disp, __global const short *src_disp, |
|
|
|
|
int nr_plane, __global short *temp, |
|
|
|
@ -1226,7 +1233,8 @@ void message_per_pixel_0(__global const short *data, __global short *msg_dst, __ |
|
|
|
|
for(int d = 0; d < nr_plane; d++) |
|
|
|
|
msg_dst[d * cdisp_step1] = convert_short_sat_rte(temp[d * cdisp_step1] - sum); |
|
|
|
|
} |
|
|
|
|
void message_per_pixel_1(__global const float *data, __global float *msg_dst, __global const float *msg1, |
|
|
|
|
|
|
|
|
|
static void message_per_pixel_1(__global const float *data, __global float *msg_dst, __global const float *msg1, |
|
|
|
|
__global const float *msg2, __global const float *msg3, |
|
|
|
|
__global const float *dst_disp, __global const float *src_disp, |
|
|
|
|
int nr_plane, __global float *temp, |
|
|
|
@ -1262,6 +1270,7 @@ void message_per_pixel_1(__global const float *data, __global float *msg_dst, __ |
|
|
|
|
for(int d = 0; d < nr_plane; d++) |
|
|
|
|
msg_dst[d * cdisp_step1] = temp[d * cdisp_step1] - sum; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
__kernel void compute_message_0(__global short *u_, __global short *d_, __global short *l_, __global short *r_, |
|
|
|
|
__global const short *data_cost_selected, __global const short *selected_disp_pyr_cur, |
|
|
|
|
__global short *ctemp, int h, int w, int nr_plane, int i, |
|
|
|
@ -1293,6 +1302,7 @@ __kernel void compute_message_0(__global short *u_, __global short *d_, __global |
|
|
|
|
cmax_disc_term, cdisp_step1, cdisc_single_jump); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
__kernel void compute_message_1(__global float *u_, __global float *d_, __global float *l_, __global float *r_, |
|
|
|
|
__global const float *data_cost_selected, __global const float *selected_disp_pyr_cur, |
|
|
|
|
__global float *ctemp, int h, int w, int nr_plane, int i, |
|
|
|
@ -1327,6 +1337,7 @@ __kernel void compute_message_1(__global float *u_, __global float *d_, __global |
|
|
|
|
/////////////////////////////////////////////////////////////// |
|
|
|
|
/////////////////////////// output //////////////////////////// |
|
|
|
|
/////////////////////////////////////////////////////////////// |
|
|
|
|
|
|
|
|
|
__kernel void compute_disp_0(__global const short *u_, __global const short *d_, __global const short *l_, |
|
|
|
|
__global const short *r_, __global const short * data_cost_selected, |
|
|
|
|
__global const short *disp_selected_pyr, |
|
|
|
@ -1364,6 +1375,7 @@ __kernel void compute_disp_0(__global const short *u_, __global const short *d_, |
|
|
|
|
disp[res_step * y + x] = best; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
__kernel void compute_disp_1(__global const float *u_, __global const float *d_, __global const float *l_, |
|
|
|
|
__global const float *r_, __global const float *data_cost_selected, |
|
|
|
|
__global const float *disp_selected_pyr, |
|
|
|
|