1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

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

This commit is contained in:
Vladislav Vinogradov
2013-05-30 13:11:32 +04:00
parent 1db4afac6a
commit 0489489322
+9 -3
View File
@@ -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;