提交 04894893 编写于 作者: V Vladislav Vinogradov

used cudaMalloc for 1-row or 1-column matrix instead of cudaMallocPitch

上级 1db4afac
......@@ -678,11 +678,17 @@ void cv::gpu::GpuMat::create(int _rows, int _cols, int _type)
size_t esz = elemSize();
void* devPtr;
cudaSafeCall( cudaMallocPitch(&devPtr, &step, esz * cols, rows) );
// Single row must be continuous
if (rows == 1)
if (rows > 1 && cols > 1)
{
cudaSafeCall( cudaMallocPitch(&devPtr, &step, esz * cols, rows) );
}
else
{
// Single row or single column must be continuous
cudaSafeCall( cudaMalloc(&devPtr, esz * cols * rows) );
step = esz * cols;
}
if (esz * cols == step)
flags |= Mat::CONTINUOUS_FLAG;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册