more strict checks outside ROI
This commit is contained in:
parent
9d87f9c974
commit
5566d31468
@ -1306,9 +1306,10 @@ namespace cv {
|
||||
|
||||
static bool ocl_LUT(InputArray _src, InputArray _lut, OutputArray _dst)
|
||||
{
|
||||
int dcn = _dst.channels(), lcn = _lut.channels(), dtype = _dst.type();
|
||||
int dtype = _dst.type(), lcn = _lut.channels(), dcn = CV_MAT_CN(dtype), ddepth = CV_MAT_DEPTH(dtype);
|
||||
bool doubleSupport = ocl::Device::getDefault().doubleFPConfig() > 0;
|
||||
|
||||
if (_src.dims() > 2)
|
||||
if (_src.dims() > 2 || (!doubleSupport && ddepth == CV_64F))
|
||||
return false;
|
||||
|
||||
UMat src = _src.getUMat(), lut = _lut.getUMat();
|
||||
@ -1316,8 +1317,9 @@ static bool ocl_LUT(InputArray _src, InputArray _lut, OutputArray _dst)
|
||||
UMat dst = _dst.getUMat();
|
||||
|
||||
ocl::Kernel k("LUT", ocl::core::lut_oclsrc,
|
||||
format("-D dcn=%d -D lcn=%d -D srcT=%s -D dstT=%s", dcn, lcn,
|
||||
ocl::typeToStr(src.depth()), ocl::typeToStr(dst.depth())));
|
||||
format("-D dcn=%d -D lcn=%d -D srcT=%s -D dstT=%s%s", dcn, lcn,
|
||||
ocl::typeToStr(src.depth()), ocl::typeToStr(ddepth),
|
||||
doubleSupport ? " -D DOUBLE_SUPPORT" : ""));
|
||||
k.args(ocl::KernelArg::ReadOnlyNoSize(src), ocl::KernelArg::ReadOnlyNoSize(lut),
|
||||
ocl::KernelArg::WriteOnly(dst));
|
||||
|
||||
|
@ -92,8 +92,7 @@ PARAM_TEST_CASE(Lut, MatDepth, MatDepth, Channels, bool, bool)
|
||||
|
||||
void Near(double threshold = 0.)
|
||||
{
|
||||
EXPECT_MAT_NEAR(dst, udst, threshold);
|
||||
EXPECT_MAT_NEAR(dst_roi, udst_roi, threshold);
|
||||
OCL_EXPECT_MATS_NEAR(dst, threshold)
|
||||
}
|
||||
};
|
||||
|
||||
@ -165,14 +164,12 @@ PARAM_TEST_CASE(ArithmTestBase, MatDepth, Channels, bool)
|
||||
|
||||
void Near(double threshold = 0.)
|
||||
{
|
||||
EXPECT_MAT_NEAR(dst1, udst1, threshold);
|
||||
EXPECT_MAT_NEAR(dst1_roi, udst1_roi, threshold);
|
||||
OCL_EXPECT_MATS_NEAR(dst1, threshold)
|
||||
}
|
||||
|
||||
void Near1(double threshold = 0.)
|
||||
{
|
||||
EXPECT_MAT_NEAR(dst2, udst2, threshold);
|
||||
EXPECT_MAT_NEAR(dst2_roi, udst2_roi, threshold);
|
||||
OCL_EXPECT_MATS_NEAR(dst2, threshold)
|
||||
}
|
||||
};
|
||||
|
||||
@ -532,8 +529,7 @@ OCL_TEST_P(Transpose, SquareInplace)
|
||||
OCL_OFF(cv::transpose(src1_roi, src1_roi));
|
||||
OCL_ON(cv::transpose(usrc1_roi, usrc1_roi));
|
||||
|
||||
EXPECT_MAT_NEAR(src1, usrc1, 0.0);
|
||||
EXPECT_MAT_NEAR(src1_roi, usrc1_roi, 0.0);
|
||||
OCL_EXPECT_MATS_NEAR(src1, 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,8 +113,7 @@ PARAM_TEST_CASE(MergeTestBase, MatDepth, Channels, bool)
|
||||
|
||||
void Near(double threshold = 0.)
|
||||
{
|
||||
EXPECT_MAT_NEAR(dst, udst, threshold);
|
||||
EXPECT_MAT_NEAR(dst_roi, udst_roi, threshold);
|
||||
OCL_EXPECT_MATS_NEAR(dst, threshold);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -86,8 +86,7 @@ PARAM_TEST_CASE(CvtColor, MatDepth, bool)
|
||||
|
||||
void Near(double threshold)
|
||||
{
|
||||
EXPECT_MAT_NEAR(dst_roi, udst_roi, threshold);
|
||||
EXPECT_MAT_NEAR(dst, udst, threshold);
|
||||
OCL_EXPECT_MATS_NEAR(dst, threshold)
|
||||
}
|
||||
|
||||
void performTest(int channelsIn, int channelsOut, int code, double threshold = 1e-3)
|
||||
|
@ -97,15 +97,9 @@ PARAM_TEST_CASE(ImgprocTestBase, MatType,
|
||||
void Near(double threshold = 0.0, bool relative = false)
|
||||
{
|
||||
if (relative)
|
||||
{
|
||||
EXPECT_MAT_NEAR_RELATIVE(dst, udst, threshold);
|
||||
EXPECT_MAT_NEAR_RELATIVE(dst_roi, udst_roi, threshold);
|
||||
}
|
||||
OCL_EXPECT_MATS_NEAR_RELATIVE(dst, threshold)
|
||||
else
|
||||
{
|
||||
EXPECT_MAT_NEAR(dst, udst, threshold);
|
||||
EXPECT_MAT_NEAR(dst_roi, udst_roi, threshold);
|
||||
}
|
||||
OCL_EXPECT_MATS_NEAR(dst, threshold)
|
||||
}
|
||||
};
|
||||
|
||||
@ -158,10 +152,9 @@ PARAM_TEST_CASE(CopyMakeBorder, MatDepth, // depth
|
||||
UMAT_UPLOAD_OUTPUT_PARAMETER(dst)
|
||||
}
|
||||
|
||||
void Near(double threshold = 0.0)
|
||||
void Near()
|
||||
{
|
||||
EXPECT_MAT_NEAR(dst, udst, threshold);
|
||||
EXPECT_MAT_NEAR(dst_roi, udst_roi, threshold);
|
||||
OCL_EXPECT_MATS_NEAR(dst, 0)
|
||||
}
|
||||
};
|
||||
|
||||
@ -305,15 +298,9 @@ struct Integral :
|
||||
void Near2(double threshold = 0.0, bool relative = false)
|
||||
{
|
||||
if (relative)
|
||||
{
|
||||
EXPECT_MAT_NEAR_RELATIVE(dst2, udst2, threshold);
|
||||
EXPECT_MAT_NEAR_RELATIVE(dst2_roi, udst2_roi, threshold);
|
||||
}
|
||||
OCL_EXPECT_MATS_NEAR_RELATIVE(dst2, threshold)
|
||||
else
|
||||
{
|
||||
EXPECT_MAT_NEAR(dst2, udst2, threshold);
|
||||
EXPECT_MAT_NEAR(dst2_roi, udst2_roi, threshold);
|
||||
}
|
||||
OCL_EXPECT_MATS_NEAR(dst2, threshold)
|
||||
}
|
||||
};
|
||||
|
||||
@ -412,8 +399,7 @@ PARAM_TEST_CASE(CLAHETest, Size, double, bool)
|
||||
|
||||
void Near(double threshold = 0.0)
|
||||
{
|
||||
EXPECT_MAT_NEAR(dst, udst, threshold);
|
||||
EXPECT_MAT_NEAR(dst_roi, udst_roi, threshold);
|
||||
OCL_EXPECT_MATS_NEAR(dst, threshold)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -104,8 +104,7 @@ PARAM_TEST_CASE(WarpTestBase, MatType, Interpolation, bool, bool)
|
||||
|
||||
void Near(double threshold = 0.0)
|
||||
{
|
||||
EXPECT_MAT_NEAR(dst, udst, threshold);
|
||||
EXPECT_MAT_NEAR(dst_roi, udst_roi, threshold);
|
||||
OCL_EXPECT_MATS_NEAR(dst, threshold)
|
||||
}
|
||||
};
|
||||
|
||||
@ -203,8 +202,7 @@ PARAM_TEST_CASE(Resize, MatType, double, double, Interpolation, bool)
|
||||
|
||||
void Near(double threshold = 0.0)
|
||||
{
|
||||
EXPECT_MAT_NEAR(dst_roi, udst_roi, threshold);
|
||||
EXPECT_MAT_NEAR(dst, udst, threshold);
|
||||
OCL_EXPECT_MATS_NEAR(dst, threshold)
|
||||
}
|
||||
};
|
||||
|
||||
@ -280,8 +278,7 @@ PARAM_TEST_CASE(Remap, MatDepth, Channels, std::pair<MatType, MatType>, BorderTy
|
||||
|
||||
void Near(double threshold = 0.0)
|
||||
{
|
||||
EXPECT_MAT_NEAR(dst, udst, threshold);
|
||||
EXPECT_MAT_NEAR(dst_roi, udst_roi, threshold);
|
||||
OCL_EXPECT_MATS_NEAR(dst, threshold)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -110,6 +110,26 @@ extern int test_loop_times;
|
||||
<< cv::format("Size: %d x %d", mat1.size().width, mat1.size().height) << std::endl; \
|
||||
}
|
||||
|
||||
#define OCL_EXPECT_MATS_NEAR(name, eps) \
|
||||
{ \
|
||||
EXPECT_MAT_NEAR(name ## _roi, u ## name ## _roi, eps); \
|
||||
int nextValue = rng.next(); \
|
||||
RNG dataRng1(nextValue), dataRng2(nextValue); \
|
||||
dataRng1.fill(name ## _roi, RNG::UNIFORM, Scalar::all(-MAX_VALUE), Scalar::all(MAX_VALUE)); \
|
||||
dataRng2.fill(u ## name ## _roi, RNG::UNIFORM, Scalar::all(-MAX_VALUE), Scalar::all(MAX_VALUE)); \
|
||||
EXPECT_MAT_NEAR(name, u ## name, 0/*FLT_EPSILON*/); \
|
||||
}
|
||||
|
||||
#define OCL_EXPECT_MATS_NEAR_RELATIVE(name, eps) \
|
||||
{ \
|
||||
EXPECT_MAT_NEAR_RELATIVE(name ## _roi, u ## name ## _roi, eps); \
|
||||
int nextValue = rng.next(); \
|
||||
RNG dataRng1(nextValue), dataRng2(nextValue); \
|
||||
dataRng1.fill(name ## _roi, RNG::UNIFORM, Scalar::all(-MAX_VALUE), Scalar::all(MAX_VALUE)); \
|
||||
dataRng2.fill(u ## name ## _roi, RNG::UNIFORM, Scalar::all(-MAX_VALUE), Scalar::all(MAX_VALUE)); \
|
||||
EXPECT_MAT_NEAR_RELATIVE(name, u ## name, 0/*FLT_EPSILON*/); \
|
||||
}
|
||||
|
||||
#define EXPECT_MAT_SIMILAR(mat1, mat2, eps) \
|
||||
{ \
|
||||
ASSERT_EQ(mat1.type(), mat2.type()); \
|
||||
@ -302,7 +322,7 @@ IMPLEMENT_PARAM_CLASS(Channels, int)
|
||||
#define OCL_OFF(fn) cv::ocl::setUseOpenCL(false); fn
|
||||
#define OCL_ON(fn) cv::ocl::setUseOpenCL(true); fn
|
||||
|
||||
#define OCL_ALL_DEPTHS Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F)
|
||||
#define OCL_ALL_DEPTHS Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F)
|
||||
#define OCL_ALL_CHANNELS Values(1, 2, 3, 4)
|
||||
|
||||
CV_ENUM(Interpolation, INTER_NEAREST, INTER_LINEAR, INTER_CUBIC, INTER_AREA)
|
||||
|
Loading…
x
Reference in New Issue
Block a user