From b7899c3d5c80b7e82fce5cfbbb0573383dd04179 Mon Sep 17 00:00:00 2001 From: Elena Gvozdeva Date: Fri, 8 Aug 2014 11:09:10 +0400 Subject: [PATCH] small fix for ocl_resize --- modules/imgproc/src/imgwarp.cpp | 5 +++-- modules/imgproc/test/ocl/test_warp.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index 907fa44..b261988 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -2074,7 +2074,8 @@ static bool ocl_resize( InputArray _src, OutputArray _dst, Size dsize, // datatypes because the observed error is low. bool useSampler = (interpolation == INTER_LINEAR && ocl::Device::getDefault().imageSupport() && ocl::Image2D::canCreateAlias(src) && depth <= 4 && - ocl::Image2D::isFormatSupported(depth, cn, true)); + ocl::Image2D::isFormatSupported(depth, cn, true) && + src.offset==0); if (useSampler) { int wdepth = std::max(depth, CV_32S); @@ -2380,7 +2381,7 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, inv_scale_y = (double)dsize.height/ssize.height; } - CV_OCL_RUN(_src.dims() <= 2 && _dst.isUMat(), + CV_OCL_RUN(_src.dims() <= 2 && _dst.isUMat() && _src.cols() > 10 && _src.rows() > 10, ocl_resize(_src, _dst, dsize, inv_scale_x, inv_scale_y, interpolation)) Mat src = _src.getMat(); diff --git a/modules/imgproc/test/ocl/test_warp.cpp b/modules/imgproc/test/ocl/test_warp.cpp index 0bcc330..3067aba 100644 --- a/modules/imgproc/test/ocl/test_warp.cpp +++ b/modules/imgproc/test/ocl/test_warp.cpp @@ -182,7 +182,7 @@ PARAM_TEST_CASE(Resize, MatType, double, double, Interpolation, bool, int) { CV_Assert(fx > 0 && fy > 0); - Size srcRoiSize = randomSize(1, MAX_VALUE), dstRoiSize; + Size srcRoiSize = randomSize(10, MAX_VALUE), dstRoiSize; // Make sure the width is a multiple of the requested value, and no more srcRoiSize.width += widthMultiple - 1 - (srcRoiSize.width - 1) % widthMultiple; dstRoiSize.width = cvRound(srcRoiSize.width * fx); @@ -215,7 +215,7 @@ OCL_TEST_P(Resize, Mat) for (int j = 0; j < test_loop_times; j++) { int depth = CV_MAT_DEPTH(type); - double eps = depth <= CV_32S ? 1 : 1e-2; + double eps = depth <= CV_32S ? 1 : 5e-2; random_roi(); -- 2.7.4