const Npp32s* pLevels3[3];\r
int nValues3[3];\r
\r
+#if (CUDA_VERSION > 4020)\r
+ GpuMat d_pLevels;\r
+#endif\r
+\r
LevelsInit()\r
{\r
nValues3[0] = nValues3[1] = nValues3[2] = 256;\r
for (int i = 0; i < 256; ++i)\r
pLevels[i] = i;\r
+\r
+\r
+#if (CUDA_VERSION <= 4020)\r
pLevels3[0] = pLevels3[1] = pLevels3[2] = pLevels;\r
+#else\r
+ d_pLevels.upload(Mat(1, 256, CV_32S, pLevels));\r
+ pLevels3[0] = pLevels3[1] = pLevels3[2] = d_pLevels.ptr<Npp32s>();\r
+#endif\r
}\r
};\r
static LevelsInit lvls;\r
\r
if (src.type() == CV_8UC1)\r
{\r
+#if (CUDA_VERSION <= 4020)\r
nppSafeCall( nppiLUT_Linear_8u_C1R(src.ptr<Npp8u>(), static_cast<int>(src.step),\r
dst.ptr<Npp8u>(), static_cast<int>(dst.step), sz, nppLut.ptr<Npp32s>(), lvls.pLevels, 256) );\r
+#else\r
+ GpuMat d_nppLut(Mat(1, 256, CV_32S, nppLut.data));\r
+ nppSafeCall( nppiLUT_Linear_8u_C1R(src.ptr<Npp8u>(), static_cast<int>(src.step),\r
+ dst.ptr<Npp8u>(), static_cast<int>(dst.step), sz, d_nppLut.ptr<Npp32s>(), lvls.d_pLevels.ptr<Npp32s>(), 256) );\r
+#endif\r
}\r
else\r
{\r
- Mat nppLut3[3];\r
const Npp32s* pValues3[3];\r
+\r
+ Mat nppLut3[3];\r
if (nppLut.channels() == 1)\r
+ {\r
+#if (CUDA_VERSION <= 4020)\r
pValues3[0] = pValues3[1] = pValues3[2] = nppLut.ptr<Npp32s>();\r
+#else\r
+ GpuMat d_nppLut(Mat(1, 256, CV_32S, nppLut.data));\r
+ pValues3[0] = pValues3[1] = pValues3[2] = d_nppLut.ptr<Npp32s>();\r
+#endif\r
+ }\r
else\r
{\r
cv::split(nppLut, nppLut3);\r
+\r
+#if (CUDA_VERSION <= 4020)\r
pValues3[0] = nppLut3[0].ptr<Npp32s>();\r
pValues3[1] = nppLut3[1].ptr<Npp32s>();\r
pValues3[2] = nppLut3[2].ptr<Npp32s>();\r
+#else\r
+ GpuMat d_nppLut0(Mat(1, 256, CV_32S, nppLut3[0].data));\r
+ GpuMat d_nppLut1(Mat(1, 256, CV_32S, nppLut3[1].data));\r
+ GpuMat d_nppLut2(Mat(1, 256, CV_32S, nppLut3[2].data));\r
+\r
+ pValues3[0] = d_nppLut0.ptr<Npp32s>();\r
+ pValues3[1] = d_nppLut1.ptr<Npp32s>();\r
+ pValues3[2] = d_nppLut2.ptr<Npp32s>();\r
+#endif\r
}\r
+\r
nppSafeCall( nppiLUT_Linear_8u_C3R(src.ptr<Npp8u>(), static_cast<int>(src.step),\r
dst.ptr<Npp8u>(), static_cast<int>(dst.step), sz, pValues3, lvls.pLevels3, lvls.nValues3) );\r
}\r
////////////////////////////////////////////////////////////////////////////////\r
// Abs\r
\r
-PARAM_TEST_CASE(Abs, cv::gpu::DeviceInfo, cv::Size, MatType, UseRoi)\r
+PARAM_TEST_CASE(Abs, cv::gpu::DeviceInfo, cv::Size, MatDepth, UseRoi)\r
{\r
cv::gpu::DeviceInfo devInfo;\r
cv::Size size;\r
- int type;\r
+ int depth;\r
bool useRoi;\r
\r
virtual void SetUp()\r
{\r
devInfo = GET_PARAM(0);\r
size = GET_PARAM(1);\r
- type = GET_PARAM(2);\r
+ depth = GET_PARAM(2);\r
useRoi = GET_PARAM(3);\r
\r
cv::gpu::setDevice(devInfo.deviceID());\r
\r
TEST_P(Abs, Accuracy)\r
{\r
- cv::Mat src = randomMat(size, type);\r
+ cv::Mat src = randomMat(size, depth);\r
\r
- cv::gpu::GpuMat dst = createMat(size, type, useRoi);\r
+ cv::gpu::GpuMat dst = createMat(size, depth, useRoi);\r
cv::gpu::abs(loadMat(src, useRoi), dst);\r
\r
cv::Mat dst_gold = cv::abs(src);\r
INSTANTIATE_TEST_CASE_P(GPU_Core, Abs, testing::Combine(\r
ALL_DEVICES,\r
DIFFERENT_SIZES,\r
- testing::Values(MatType(CV_16SC1), MatType(CV_32FC1)),\r
+ testing::Values(MatDepth(CV_16S), MatDepth(CV_32F)),\r
WHOLE_SUBMAT));\r
\r
////////////////////////////////////////////////////////////////////////////////\r
// Sqr\r
\r
-PARAM_TEST_CASE(Sqr, cv::gpu::DeviceInfo, cv::Size, MatType, UseRoi)\r
+PARAM_TEST_CASE(Sqr, cv::gpu::DeviceInfo, cv::Size, MatDepth, UseRoi)\r
{\r
cv::gpu::DeviceInfo devInfo;\r
cv::Size size;\r
- int type;\r
+ int depth;\r
bool useRoi;\r
\r
virtual void SetUp()\r
{\r
devInfo = GET_PARAM(0);\r
size = GET_PARAM(1);\r
- type = GET_PARAM(2);\r
+ depth = GET_PARAM(2);\r
useRoi = GET_PARAM(3);\r
\r
cv::gpu::setDevice(devInfo.deviceID());\r
\r
TEST_P(Sqr, Accuracy)\r
{\r
- cv::Mat src = randomMat(size, type);\r
+ cv::Mat src = randomMat(size, depth, 0, depth == CV_8U ? 16 : 255);\r
\r
- cv::gpu::GpuMat dst = createMat(size, type, useRoi);\r
+ cv::gpu::GpuMat dst = createMat(size, depth, useRoi);\r
cv::gpu::sqr(loadMat(src, useRoi), dst);\r
\r
cv::Mat dst_gold;\r
INSTANTIATE_TEST_CASE_P(GPU_Core, Sqr, testing::Combine(\r
ALL_DEVICES,\r
DIFFERENT_SIZES,\r
- testing::Values(MatType(CV_8UC1),\r
- MatType(CV_16UC1),\r
- MatType(CV_16SC1),\r
- MatType(CV_32FC1)),\r
+ testing::Values(MatDepth(CV_8U),\r
+ MatDepth(CV_16U),\r
+ MatDepth(CV_16S),\r
+ MatDepth(CV_32F)),\r
WHOLE_SUBMAT));\r
\r
////////////////////////////////////////////////////////////////////////////////\r
funcs[src.depth()](src, dst);\r
}\r
\r
-PARAM_TEST_CASE(Sqrt, cv::gpu::DeviceInfo, cv::Size, MatType, UseRoi)\r
+PARAM_TEST_CASE(Sqrt, cv::gpu::DeviceInfo, cv::Size, MatDepth, UseRoi)\r
{\r
cv::gpu::DeviceInfo devInfo;\r
cv::Size size;\r
- int type;\r
+ int depth;\r
bool useRoi;\r
\r
virtual void SetUp()\r
{\r
devInfo = GET_PARAM(0);\r
size = GET_PARAM(1);\r
- type = GET_PARAM(2);\r
+ depth = GET_PARAM(2);\r
useRoi = GET_PARAM(3);\r
\r
cv::gpu::setDevice(devInfo.deviceID());\r
\r
TEST_P(Sqrt, Accuracy)\r
{\r
- cv::Mat src = randomMat(size, type);\r
+ cv::Mat src = randomMat(size, depth);\r
\r
- cv::gpu::GpuMat dst = createMat(size, type, useRoi);\r
+ cv::gpu::GpuMat dst = createMat(size, depth, useRoi);\r
cv::gpu::sqrt(loadMat(src, useRoi), dst);\r
\r
cv::Mat dst_gold;\r
sqrtGold(src, dst_gold);\r
\r
- EXPECT_MAT_NEAR(dst_gold, dst, 1e-5);\r
+ EXPECT_MAT_NEAR(dst_gold, dst, depth < CV_32F ? 1.0 : 1e-5);\r
}\r
\r
INSTANTIATE_TEST_CASE_P(GPU_Core, Sqrt, testing::Combine(\r
ALL_DEVICES,\r
DIFFERENT_SIZES,\r
- testing::Values(MatType(CV_8UC1),\r
- MatType(CV_16UC1),\r
- MatType(CV_16SC1),\r
- MatType(CV_32FC1)),\r
+ testing::Values(MatDepth(CV_8U),\r
+ MatDepth(CV_16U),\r
+ MatDepth(CV_16S),\r
+ MatDepth(CV_32F)),\r
WHOLE_SUBMAT));\r
\r
////////////////////////////////////////////////////////////////////////////////\r
funcs[src.depth()](src, dst);\r
}\r
\r
-PARAM_TEST_CASE(Log, cv::gpu::DeviceInfo, cv::Size, MatType, UseRoi)\r
+PARAM_TEST_CASE(Log, cv::gpu::DeviceInfo, cv::Size, MatDepth, UseRoi)\r
{\r
cv::gpu::DeviceInfo devInfo;\r
cv::Size size;\r
- int type;\r
+ int depth;\r
bool useRoi;\r
\r
virtual void SetUp()\r
{\r
devInfo = GET_PARAM(0);\r
size = GET_PARAM(1);\r
- type = GET_PARAM(2);\r
+ depth = GET_PARAM(2);\r
useRoi = GET_PARAM(3);\r
\r
cv::gpu::setDevice(devInfo.deviceID());\r
\r
TEST_P(Log, Accuracy)\r
{\r
- cv::Mat src = randomMat(size, type, 1.0, 255.0);\r
+ cv::Mat src = randomMat(size, depth, 1.0, 255.0);\r
\r
- cv::gpu::GpuMat dst = createMat(size, type, useRoi);\r
+ cv::gpu::GpuMat dst = createMat(size, depth, useRoi);\r
cv::gpu::log(loadMat(src, useRoi), dst);\r
\r
cv::Mat dst_gold;\r
logGold(src, dst_gold);\r
\r
- EXPECT_MAT_NEAR(dst_gold, dst, 1e-6);\r
+ EXPECT_MAT_NEAR(dst_gold, dst, depth < CV_32F ? 1.0 : 1e-6);\r
}\r
\r
INSTANTIATE_TEST_CASE_P(GPU_Core, Log, testing::Combine(\r
ALL_DEVICES,\r
DIFFERENT_SIZES,\r
- testing::Values(MatType(CV_8UC1),\r
- MatType(CV_16UC1),\r
- MatType(CV_16SC1),\r
- MatType(CV_32FC1)),\r
+ testing::Values(MatDepth(CV_8U),\r
+ MatDepth(CV_16U),\r
+ MatDepth(CV_16S),\r
+ MatDepth(CV_32F)),\r
WHOLE_SUBMAT));\r
\r
////////////////////////////////////////////////////////////////////////////////\r
funcs[src.depth()](src, dst);\r
}\r
\r
-PARAM_TEST_CASE(Exp, cv::gpu::DeviceInfo, cv::Size, MatType, UseRoi)\r
+PARAM_TEST_CASE(Exp, cv::gpu::DeviceInfo, cv::Size, MatDepth, UseRoi)\r
{\r
cv::gpu::DeviceInfo devInfo;\r
cv::Size size;\r
- int type;\r
+ int depth;\r
bool useRoi;\r
\r
virtual void SetUp()\r
{\r
devInfo = GET_PARAM(0);\r
size = GET_PARAM(1);\r
- type = GET_PARAM(2);\r
+ depth = GET_PARAM(2);\r
useRoi = GET_PARAM(3);\r
\r
cv::gpu::setDevice(devInfo.deviceID());\r
\r
TEST_P(Exp, Accuracy)\r
{\r
- cv::Mat src = randomMat(size, type, 0.0, 10.0);\r
+ cv::Mat src = randomMat(size, depth, 0.0, 10.0);\r
\r
- cv::gpu::GpuMat dst = createMat(size, type, useRoi);\r
+ cv::gpu::GpuMat dst = createMat(size, depth, useRoi);\r
cv::gpu::exp(loadMat(src, useRoi), dst);\r
\r
cv::Mat dst_gold;\r
expGold(src, dst_gold);\r
\r
- EXPECT_MAT_NEAR(dst_gold, dst, 1e-2);\r
+ EXPECT_MAT_NEAR(dst_gold, dst, depth < CV_32F ? 1.0 : 1e-2);\r
}\r
\r
INSTANTIATE_TEST_CASE_P(GPU_Core, Exp, testing::Combine(\r
ALL_DEVICES,\r
DIFFERENT_SIZES,\r
- testing::Values(MatType(CV_8UC1),\r
- MatType(CV_16UC1),\r
- MatType(CV_16SC1),\r
- MatType(CV_32FC1)),\r
+ testing::Values(MatDepth(CV_8U),\r
+ MatDepth(CV_16U),\r
+ MatDepth(CV_16S),\r
+ MatDepth(CV_32F)),\r
WHOLE_SUBMAT));\r
\r
////////////////////////////////////////////////////////////////////////////////\r