Commit c6e74119 authored by marina.kolpakova's avatar marina.kolpakova

fix device pointer alignmen in sft-based integral integration

parent ed6885dd
...@@ -548,12 +548,16 @@ void cv::gpu::integralBuffered(const GpuMat& src, GpuMat& sum, GpuMat& buffer, S ...@@ -548,12 +548,16 @@ void cv::gpu::integralBuffered(const GpuMat& src, GpuMat& sum, GpuMat& buffer, S
cudaStream_t stream = StreamAccessor::getStream(s); cudaStream_t stream = StreamAccessor::getStream(s);
DeviceInfo info; DeviceInfo info;
cv::Size whole;
cv::Point offset;
if (info.supports(WARP_SHUFFLE_FUNCTIONS)) src.locateROI(whole, offset);
if (info.supports(WARP_SHUFFLE_FUNCTIONS) )
{ {
GpuMat srcAlligned; GpuMat srcAlligned;
if (src.cols % 16 == 0 && src.rows % 8 == 0) if (src.cols % 16 == 0 && src.rows % 8 == 0 && offset.x % 16 == 0 && offset.y % 8 == 0)
srcAlligned = src; srcAlligned = src;
else else
{ {
...@@ -575,19 +579,18 @@ void cv::gpu::integralBuffered(const GpuMat& src, GpuMat& sum, GpuMat& buffer, S ...@@ -575,19 +579,18 @@ void cv::gpu::integralBuffered(const GpuMat& src, GpuMat& sum, GpuMat& buffer, S
srcAlligned = buffer; srcAlligned = buffer;
} }
sum.create(srcAlligned.rows + 1, srcAlligned.cols + 1, CV_32SC1); sum.create(srcAlligned.rows + 1, srcAlligned.cols + 4, CV_32SC1);
if (s) if (s)
s.enqueueMemSet(sum, Scalar::all(0)); s.enqueueMemSet(sum, Scalar::all(0));
else else
sum.setTo(Scalar::all(0)); sum.setTo(Scalar::all(0));
GpuMat inner = sum(Rect(1, 1, srcAlligned.cols, srcAlligned.rows)); GpuMat inner = sum(Rect(4, 1, srcAlligned.cols, srcAlligned.rows));
cv::gpu::device::imgproc::shfl_integral_gpu(srcAlligned, inner, stream); cv::gpu::device::imgproc::shfl_integral_gpu(srcAlligned, inner, stream);
if (srcAlligned.data != src.data) sum = sum(Rect(3, 0, src.cols + 1, src.rows + 1));
sum = sum(Rect(0, 0, src.cols + 1, src.rows + 1));
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment