\r
if (info.supports(WARP_SHUFFLE_FUNCTIONS))\r
{\r
- GpuMat src16;\r
+ GpuMat srcAlligned;\r
\r
- if (src.cols % 16 == 0)\r
- src16 = src;\r
+ if (src.cols % 16 == 0 && src.rows % 8 == 0)\r
+ srcAlligned = src;\r
else\r
{\r
- ensureSizeIsEnough(src.rows, ((src.cols + 15) / 16) * 16, src.type(), buffer);\r
+ ensureSizeIsEnough(((src.rows + 7) / 8) * 8, ((src.cols + 15) / 16) * 16, src.type(), buffer);\r
\r
GpuMat inner = buffer(Rect(0, 0, src.cols, src.rows));\r
\r
src.copyTo(inner);\r
}\r
\r
- src16 = buffer;\r
+ srcAlligned = buffer;\r
}\r
\r
- sum.create(src16.rows + 1, src16.cols + 1, CV_32SC1);\r
+ sum.create(srcAlligned.rows + 1, srcAlligned.cols + 1, CV_32SC1);\r
\r
if (s)\r
s.enqueueMemSet(sum, Scalar::all(0));\r
else\r
sum.setTo(Scalar::all(0));\r
\r
- GpuMat inner = sum(Rect(1, 1, src16.cols, src16.rows));\r
+ GpuMat inner = sum(Rect(1, 1, srcAlligned.cols, srcAlligned.rows));\r
\r
- cv::gpu::device::imgproc::shfl_integral_gpu(src16, inner, stream);\r
+ cv::gpu::device::imgproc::shfl_integral_gpu(srcAlligned, inner, stream);\r
\r
- if (src16.cols != src.cols)\r
+ if (srcAlligned.data != src.data)\r
sum = sum(Rect(0, 0, src.cols + 1, src.rows + 1));\r
}\r
else\r