added synchronization after NPP calls

This commit is contained in:
Vladislav Vinogradov
2011-01-24 10:32:57 +00:00
parent 8abdb3721f
commit 811ba31897
7 changed files with 88 additions and 0 deletions

View File

@@ -286,6 +286,8 @@ void cv::gpu::resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx, doub
nppSafeCall( nppiResize_8u_C4R(src.ptr<Npp8u>(), srcsz, src.step, srcrect,
dst.ptr<Npp8u>(), dst.step, dstsz, fx, fy, npp_inter[interpolation]) );
}
cudaSafeCall( cudaThreadSynchronize() );
}
////////////////////////////////////////////////////////////////////////
@@ -338,6 +340,8 @@ void cv::gpu::copyMakeBorder(const GpuMat& src, GpuMat& dst, int top, int bottom
default:
CV_Assert(!"Unsupported source type");
}
cudaSafeCall( cudaThreadSynchronize() );
}
////////////////////////////////////////////////////////////////////////
@@ -406,6 +410,8 @@ namespace
default:
CV_Assert(!"Unsupported source type");
}
cudaSafeCall( cudaThreadSynchronize() );
}
}
@@ -531,6 +537,8 @@ void cv::gpu::rotate(const GpuMat& src, GpuMat& dst, Size dsize, double angle, d
nppSafeCall( nppiRotate_8u_C4R(src.ptr<Npp8u>(), srcsz, src.step, srcroi,
dst.ptr<Npp8u>(), dst.step, dstroi, angle, xShift, yShift, npp_inter[interpolation]) );
}
cudaSafeCall( cudaThreadSynchronize() );
}
////////////////////////////////////////////////////////////////////////
@@ -554,6 +562,8 @@ void cv::gpu::integral(const GpuMat& src, GpuMat& sum)
nppSafeCall( nppiStIntegral_8u32u_C1R(const_cast<NppSt8u*>(src.ptr<NppSt8u>()), src.step,
sum.ptr<NppSt32u>(), sum.step, roiSize, buffer.ptr<NppSt8u>(), bufSize) );
cudaSafeCall( cudaThreadSynchronize() );
}
void cv::gpu::integral(const GpuMat& src, GpuMat& sum, GpuMat& sqsum)
@@ -571,6 +581,8 @@ void cv::gpu::integral(const GpuMat& src, GpuMat& sum, GpuMat& sqsum)
nppSafeCall( nppiSqrIntegral_8u32s32f_C1R(const_cast<Npp8u*>(src.ptr<Npp8u>()), src.step, sum.ptr<Npp32s>(),
sum.step, sqsum.ptr<Npp32f>(), sqsum.step, sz, 0, 0.0f, h) );
cudaSafeCall( cudaThreadSynchronize() );
}
//////////////////////////////////////////////////////////////////////////////
@@ -593,6 +605,8 @@ void cv::gpu::sqrIntegral(const GpuMat& src, GpuMat& sqsum)
const_cast<NppSt8u*>(src.ptr<NppSt8u>(0)), src.step,
sqsum.ptr<NppSt64u>(0), sqsum.step, roiSize,
buf.ptr<NppSt8u>(0), bufSize));
cudaSafeCall( cudaThreadSynchronize() );
}
//////////////////////////////////////////////////////////////////////////////
@@ -629,6 +643,8 @@ void cv::gpu::rectStdDev(const GpuMat& src, const GpuMat& sqr, GpuMat& dst, cons
nppSafeCall( nppiRectStdDev_32s32f_C1R(src.ptr<Npp32s>(), src.step, sqr.ptr<Npp32f>(), sqr.step,
dst.ptr<Npp32f>(), dst.step, sz, nppRect) );
cudaSafeCall( cudaThreadSynchronize() );
}
////////////////////////////////////////////////////////////////////////
@@ -659,6 +675,8 @@ void cv::gpu::Canny(const GpuMat& image, GpuMat& edges, double threshold1, doubl
nppSafeCall( nppiCanny_32f8u_C1R(srcDx.ptr<Npp32f>(), srcDx.step, srcDy.ptr<Npp32f>(), srcDy.step,
edges.ptr<Npp8u>(), edges.step, sz, (Npp32f)threshold1, (Npp32f)threshold2, buf.ptr<Npp8u>()) );
cudaSafeCall( cudaThreadSynchronize() );
}
////////////////////////////////////////////////////////////////////////
@@ -711,6 +729,8 @@ namespace
buffer.create(1, buf_size, CV_8U);
nppSafeCall( func(src.ptr<src_t>(), src.step, sz, hist.ptr<Npp32s>(), levels,
lowerLevel, upperLevel, buffer.ptr<Npp8u>()) );
cudaSafeCall( cudaThreadSynchronize() );
}
};
template<int SDEPTH, typename NppHistogramEvenFuncC4<SDEPTH>::func_ptr func, get_buf_size_c4_t get_buf_size>
@@ -738,6 +758,8 @@ namespace
get_buf_size(sz, levels, &buf_size);
buffer.create(1, buf_size, CV_8U);
nppSafeCall( func(src.ptr<src_t>(), src.step, sz, pHist, levels, lowerLevel, upperLevel, buffer.ptr<Npp8u>()) );
cudaSafeCall( cudaThreadSynchronize() );
}
};
@@ -801,6 +823,8 @@ namespace
get_buf_size(sz, levels.cols, &buf_size);
buffer.create(1, buf_size, CV_8U);
nppSafeCall( func(src.ptr<src_t>(), src.step, sz, hist.ptr<Npp32s>(), levels.ptr<level_t>(), levels.cols, buffer.ptr<Npp8u>()) );
cudaSafeCall( cudaThreadSynchronize() );
}
};
template<int SDEPTH, typename NppHistogramRangeFuncC4<SDEPTH>::func_ptr func, get_buf_size_c4_t get_buf_size>
@@ -836,6 +860,8 @@ namespace
get_buf_size(sz, nLevels, &buf_size);
buffer.create(1, buf_size, CV_8U);
nppSafeCall( func(src.ptr<src_t>(), src.step, sz, pHist, pLevels, nLevels, buffer.ptr<Npp8u>()) );
cudaSafeCall( cudaThreadSynchronize() );
}
};
}