gpu module: refactored devmem2d.hpp (atomic bomb)
This commit is contained in:
@@ -63,16 +63,16 @@ namespace cv { namespace gpu { namespace bp
|
||||
{
|
||||
void load_constants(int ndisp, float max_data_term, float data_weight, float max_disc_term, float disc_single_jump);
|
||||
template<typename T, typename D>
|
||||
void comp_data_gpu(const DevMem2D& left, const DevMem2D& right, const DevMem2D& data, cudaStream_t stream);
|
||||
void comp_data_gpu(const DevMem2Db& left, const DevMem2Db& right, const DevMem2Db& data, cudaStream_t stream);
|
||||
template<typename T>
|
||||
void data_step_down_gpu(int dst_cols, int dst_rows, int src_rows, const DevMem2D& src, const DevMem2D& dst, cudaStream_t stream);
|
||||
void data_step_down_gpu(int dst_cols, int dst_rows, int src_rows, const DevMem2Db& src, const DevMem2Db& dst, cudaStream_t stream);
|
||||
template <typename T>
|
||||
void level_up_messages_gpu(int dst_idx, int dst_cols, int dst_rows, int src_rows, DevMem2D* mus, DevMem2D* mds, DevMem2D* mls, DevMem2D* mrs, cudaStream_t stream);
|
||||
void level_up_messages_gpu(int dst_idx, int dst_cols, int dst_rows, int src_rows, DevMem2Db* mus, DevMem2Db* mds, DevMem2Db* mls, DevMem2Db* mrs, cudaStream_t stream);
|
||||
template <typename T>
|
||||
void calc_all_iterations_gpu(int cols, int rows, int iters, const DevMem2D& u, const DevMem2D& d,
|
||||
const DevMem2D& l, const DevMem2D& r, const DevMem2D& data, cudaStream_t stream);
|
||||
void calc_all_iterations_gpu(int cols, int rows, int iters, const DevMem2Db& u, const DevMem2Db& d,
|
||||
const DevMem2Db& l, const DevMem2Db& r, const DevMem2Db& data, cudaStream_t stream);
|
||||
template <typename T>
|
||||
void output_gpu(const DevMem2D& u, const DevMem2D& d, const DevMem2D& l, const DevMem2D& r, const DevMem2D& data,
|
||||
void output_gpu(const DevMem2Db& u, const DevMem2Db& d, const DevMem2Db& l, const DevMem2Db& r, const DevMem2Db& data,
|
||||
const DevMem2D_<short>& disp, cudaStream_t stream);
|
||||
}}}
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace
|
||||
|
||||
void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disp, Stream& stream)
|
||||
{
|
||||
typedef void (*comp_data_t)(const DevMem2D& left, const DevMem2D& right, const DevMem2D& data, cudaStream_t stream);
|
||||
typedef void (*comp_data_t)(const DevMem2Db& left, const DevMem2Db& right, const DevMem2Db& data, cudaStream_t stream);
|
||||
static const comp_data_t comp_data_callers[2][5] =
|
||||
{
|
||||
{0, bp::comp_data_gpu<unsigned char, short>, 0, bp::comp_data_gpu<uchar3, short>, bp::comp_data_gpu<uchar4, short>},
|
||||
@@ -251,25 +251,25 @@ namespace
|
||||
{
|
||||
using namespace cv::gpu::bp;
|
||||
|
||||
typedef void (*data_step_down_t)(int dst_cols, int dst_rows, int src_rows, const DevMem2D& src, const DevMem2D& dst, cudaStream_t stream);
|
||||
typedef void (*data_step_down_t)(int dst_cols, int dst_rows, int src_rows, const DevMem2Db& src, const DevMem2Db& 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>
|
||||
};
|
||||
|
||||
typedef void (*level_up_messages_t)(int dst_idx, int dst_cols, int dst_rows, int src_rows, DevMem2D* mus, DevMem2D* mds, DevMem2D* mls, DevMem2D* mrs, cudaStream_t stream);
|
||||
typedef void (*level_up_messages_t)(int dst_idx, int dst_cols, int dst_rows, int src_rows, DevMem2Db* mus, DevMem2Db* mds, DevMem2Db* mls, DevMem2Db* mrs, cudaStream_t stream);
|
||||
static const level_up_messages_t level_up_messages_callers[2] =
|
||||
{
|
||||
level_up_messages_gpu<short>, level_up_messages_gpu<float>
|
||||
};
|
||||
|
||||
typedef void (*calc_all_iterations_t)(int cols, int rows, int iters, const DevMem2D& u, const DevMem2D& d, const DevMem2D& l, const DevMem2D& r, const DevMem2D& data, cudaStream_t stream);
|
||||
typedef void (*calc_all_iterations_t)(int cols, int rows, int iters, const DevMem2Db& u, const DevMem2Db& d, const DevMem2Db& l, const DevMem2Db& r, const DevMem2Db& data, cudaStream_t stream);
|
||||
static const calc_all_iterations_t calc_all_iterations_callers[2] =
|
||||
{
|
||||
calc_all_iterations_gpu<short>, calc_all_iterations_gpu<float>
|
||||
};
|
||||
|
||||
typedef void (*output_t)(const DevMem2D& u, const DevMem2D& d, const DevMem2D& l, const DevMem2D& r, const DevMem2D& data, const DevMem2D_<short>& disp, cudaStream_t stream);
|
||||
typedef void (*output_t)(const DevMem2Db& u, const DevMem2Db& d, const DevMem2Db& l, const DevMem2Db& r, const DevMem2Db& data, const DevMem2D_<short>& disp, cudaStream_t stream);
|
||||
static const output_t output_callers[2] =
|
||||
{
|
||||
output_gpu<short>, output_gpu<float>
|
||||
@@ -289,10 +289,10 @@ namespace
|
||||
data_step_down_callers[funcIdx](cols_all[i], rows_all[i], rows_all[i-1], datas[i-1], datas[i], cudaStream);
|
||||
}
|
||||
|
||||
DevMem2D mus[] = {u, u2};
|
||||
DevMem2D mds[] = {d, d2};
|
||||
DevMem2D mrs[] = {r, r2};
|
||||
DevMem2D mls[] = {l, l2};
|
||||
DevMem2Db mus[] = {u, u2};
|
||||
DevMem2Db mds[] = {d, d2};
|
||||
DevMem2Db mrs[] = {r, r2};
|
||||
DevMem2Db mls[] = {l, l2};
|
||||
|
||||
int mem_idx = (rthis.levels & 1) ? 0 : 1;
|
||||
|
||||
|
Reference in New Issue
Block a user