|
|
|
@ -67,7 +67,7 @@ namespace cv { namespace gpu { namespace device |
|
|
|
|
template<typename T, typename D> |
|
|
|
|
void comp_data_gpu(const PtrStepSzb& left, const PtrStepSzb& right, const PtrStepSzb& data, cudaStream_t stream); |
|
|
|
|
template<typename T> |
|
|
|
|
void data_step_down_gpu(int dst_cols, int dst_rows, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream); |
|
|
|
|
void data_step_down_gpu(int dst_cols, int dst_rows, int src_cols, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream); |
|
|
|
|
template <typename T> |
|
|
|
|
void level_up_messages_gpu(int dst_idx, int dst_cols, int dst_rows, int src_rows, PtrStepSzb* mus, PtrStepSzb* mds, PtrStepSzb* mls, PtrStepSzb* mrs, cudaStream_t stream); |
|
|
|
|
template <typename T> |
|
|
|
@ -158,7 +158,7 @@ namespace |
|
|
|
|
|
|
|
|
|
init(stream); |
|
|
|
|
|
|
|
|
|
datas[0].create(rows * rthis.ndisp, cols, rthis.msg_type); |
|
|
|
|
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, datas[0]); |
|
|
|
|
|
|
|
|
|
comp_data_callers[rthis.msg_type == CV_32F][left.channels()](left, right, datas[0], StreamAccessor::getStream(stream)); |
|
|
|
|
|
|
|
|
@ -187,10 +187,10 @@ namespace |
|
|
|
|
private: |
|
|
|
|
void init(Stream& stream) |
|
|
|
|
{ |
|
|
|
|
u.create(rows * rthis.ndisp, cols, rthis.msg_type); |
|
|
|
|
d.create(rows * rthis.ndisp, cols, rthis.msg_type); |
|
|
|
|
l.create(rows * rthis.ndisp, cols, rthis.msg_type); |
|
|
|
|
r.create(rows * rthis.ndisp, cols, rthis.msg_type); |
|
|
|
|
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, u); |
|
|
|
|
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, d); |
|
|
|
|
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, l); |
|
|
|
|
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, r); |
|
|
|
|
|
|
|
|
|
if (rthis.levels & 1) |
|
|
|
|
{ |
|
|
|
@ -213,13 +213,13 @@ namespace |
|
|
|
|
|
|
|
|
|
if (rthis.levels > 1) |
|
|
|
|
{ |
|
|
|
|
int less_rows = rows / 2; |
|
|
|
|
int less_cols = cols / 2; |
|
|
|
|
int less_rows = (rows + 1) / 2; |
|
|
|
|
int less_cols = (cols + 1) / 2; |
|
|
|
|
|
|
|
|
|
u2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type); |
|
|
|
|
d2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type); |
|
|
|
|
l2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type); |
|
|
|
|
r2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type); |
|
|
|
|
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, u2); |
|
|
|
|
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, d2); |
|
|
|
|
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, l2); |
|
|
|
|
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, r2); |
|
|
|
|
|
|
|
|
|
if ((rthis.levels & 1) == 0) |
|
|
|
|
{ |
|
|
|
@ -253,7 +253,7 @@ namespace |
|
|
|
|
|
|
|
|
|
void calcBP(GpuMat& disp, Stream& stream) |
|
|
|
|
{ |
|
|
|
|
typedef void (*data_step_down_t)(int dst_cols, int dst_rows, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream); |
|
|
|
|
typedef void (*data_step_down_t)(int dst_cols, int dst_rows, int src_cols, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream); |
|
|
|
|
static const data_step_down_t data_step_down_callers[2] = |
|
|
|
|
{ |
|
|
|
|
data_step_down_gpu<short>, data_step_down_gpu<float> |
|
|
|
@ -283,12 +283,12 @@ namespace |
|
|
|
|
|
|
|
|
|
for (int i = 1; i < rthis.levels; ++i) |
|
|
|
|
{ |
|
|
|
|
cols_all[i] = cols_all[i-1] / 2; |
|
|
|
|
rows_all[i] = rows_all[i-1] / 2; |
|
|
|
|
cols_all[i] = (cols_all[i-1] + 1) / 2; |
|
|
|
|
rows_all[i] = (rows_all[i-1] + 1) / 2; |
|
|
|
|
|
|
|
|
|
datas[i].create(rows_all[i] * rthis.ndisp, cols_all[i], rthis.msg_type); |
|
|
|
|
createContinuous(rows_all[i] * rthis.ndisp, cols_all[i], rthis.msg_type, datas[i]); |
|
|
|
|
|
|
|
|
|
data_step_down_callers[funcIdx](cols_all[i], rows_all[i], rows_all[i-1], datas[i-1], datas[i], cudaStream); |
|
|
|
|
data_step_down_callers[funcIdx](cols_all[i], rows_all[i], cols_all[i-1], rows_all[i-1], datas[i-1], datas[i], cudaStream); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
PtrStepSzb mus[] = {u, u2}; |
|
|
|
|