mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 21:20:18 +08:00
revise perf
This commit is contained in:
parent
324cafdda6
commit
14bd6402be
@ -48,7 +48,7 @@
|
|||||||
///////////// Lut ////////////////////////
|
///////////// Lut ////////////////////////
|
||||||
PERFTEST(lut)
|
PERFTEST(lut)
|
||||||
{
|
{
|
||||||
Mat src, lut, dst;
|
Mat src, lut, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_lut, d_dst;
|
ocl::oclMat d_src, d_lut, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_8UC3};
|
int all_type[] = {CV_8UC1, CV_8UC3};
|
||||||
@ -77,11 +77,6 @@ PERFTEST(lut)
|
|||||||
ocl::LUT(d_src, d_lut, d_dst);
|
ocl::LUT(d_src, d_lut, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::LUT(d_src, d_lut, d_dst);
|
ocl::LUT(d_src, d_lut, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -90,9 +85,10 @@ PERFTEST(lut)
|
|||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
d_lut.upload(lut);
|
d_lut.upload(lut);
|
||||||
ocl::LUT(d_src, d_lut, d_dst);
|
ocl::LUT(d_src, d_lut, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -101,7 +97,7 @@ PERFTEST(lut)
|
|||||||
///////////// Exp ////////////////////////
|
///////////// Exp ////////////////////////
|
||||||
PERFTEST(Exp)
|
PERFTEST(Exp)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
||||||
@ -121,11 +117,6 @@ PERFTEST(Exp)
|
|||||||
ocl::exp(d_src, d_dst);
|
ocl::exp(d_src, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 2));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::exp(d_src, d_dst);
|
ocl::exp(d_src, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -133,15 +124,17 @@ PERFTEST(Exp)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::exp(d_src, d_dst);
|
ocl::exp(d_src, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////// LOG ////////////////////////
|
///////////// LOG ////////////////////////
|
||||||
PERFTEST(Log)
|
PERFTEST(Log)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
||||||
@ -161,11 +154,6 @@ PERFTEST(Log)
|
|||||||
ocl::log(d_src, d_dst);
|
ocl::log(d_src, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 1));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::log(d_src, d_dst);
|
ocl::log(d_src, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -173,15 +161,17 @@ PERFTEST(Log)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::log(d_src, d_dst);
|
ocl::log(d_src, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////// Add ////////////////////////
|
///////////// Add ////////////////////////
|
||||||
PERFTEST(Add)
|
PERFTEST(Add)
|
||||||
{
|
{
|
||||||
Mat src1, src2, dst;
|
Mat src1, src2, dst, ocl_dst;
|
||||||
ocl::oclMat d_src1, d_src2, d_dst;
|
ocl::oclMat d_src1, d_src2, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_32FC1};
|
int all_type[] = {CV_8UC1, CV_32FC1};
|
||||||
@ -201,6 +191,7 @@ PERFTEST(Add)
|
|||||||
CPU_ON;
|
CPU_ON;
|
||||||
add(src1, src2, dst);
|
add(src1, src2, dst);
|
||||||
CPU_OFF;
|
CPU_OFF;
|
||||||
|
|
||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
|
|
||||||
@ -208,11 +199,6 @@ PERFTEST(Add)
|
|||||||
ocl::add(d_src1, d_src2, d_dst);
|
ocl::add(d_src1, d_src2, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 0.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::add(d_src1, d_src2, d_dst);
|
ocl::add(d_src1, d_src2, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -221,8 +207,10 @@ PERFTEST(Add)
|
|||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
ocl::add(d_src1, d_src2, d_dst);
|
ocl::add(d_src1, d_src2, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -231,7 +219,7 @@ PERFTEST(Add)
|
|||||||
///////////// Mul ////////////////////////
|
///////////// Mul ////////////////////////
|
||||||
PERFTEST(Mul)
|
PERFTEST(Mul)
|
||||||
{
|
{
|
||||||
Mat src1, src2, dst;
|
Mat src1, src2, dst, ocl_dst;
|
||||||
ocl::oclMat d_src1, d_src2, d_dst;
|
ocl::oclMat d_src1, d_src2, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_8UC4};
|
int all_type[] = {CV_8UC1, CV_8UC4};
|
||||||
@ -260,11 +248,6 @@ PERFTEST(Mul)
|
|||||||
ocl::multiply(d_src1, d_src2, d_dst);
|
ocl::multiply(d_src1, d_src2, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 0.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::multiply(d_src1, d_src2, d_dst);
|
ocl::multiply(d_src1, d_src2, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -273,8 +256,10 @@ PERFTEST(Mul)
|
|||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
ocl::multiply(d_src1, d_src2, d_dst);
|
ocl::multiply(d_src1, d_src2, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -283,7 +268,7 @@ PERFTEST(Mul)
|
|||||||
///////////// Div ////////////////////////
|
///////////// Div ////////////////////////
|
||||||
PERFTEST(Div)
|
PERFTEST(Div)
|
||||||
{
|
{
|
||||||
Mat src1, src2, dst;
|
Mat src1, src2, dst, ocl_dst;
|
||||||
ocl::oclMat d_src1, d_src2, d_dst;
|
ocl::oclMat d_src1, d_src2, d_dst;
|
||||||
int all_type[] = {CV_8UC1, CV_8UC4};
|
int all_type[] = {CV_8UC1, CV_8UC4};
|
||||||
std::string type_name[] = {"CV_8UC1", "CV_8UC4"};
|
std::string type_name[] = {"CV_8UC1", "CV_8UC4"};
|
||||||
@ -304,6 +289,7 @@ PERFTEST(Div)
|
|||||||
CPU_ON;
|
CPU_ON;
|
||||||
divide(src1, src2, dst);
|
divide(src1, src2, dst);
|
||||||
CPU_OFF;
|
CPU_OFF;
|
||||||
|
|
||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
|
|
||||||
@ -311,11 +297,6 @@ PERFTEST(Div)
|
|||||||
ocl::divide(d_src1, d_src2, d_dst);
|
ocl::divide(d_src1, d_src2, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 1));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::divide(d_src1, d_src2, d_dst);
|
ocl::divide(d_src1, d_src2, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -324,8 +305,10 @@ PERFTEST(Div)
|
|||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
ocl::divide(d_src1, d_src2, d_dst);
|
ocl::divide(d_src1, d_src2, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -334,7 +317,7 @@ PERFTEST(Div)
|
|||||||
///////////// Absdiff ////////////////////////
|
///////////// Absdiff ////////////////////////
|
||||||
PERFTEST(Absdiff)
|
PERFTEST(Absdiff)
|
||||||
{
|
{
|
||||||
Mat src1, src2, dst;
|
Mat src1, src2, dst, ocl_dst;
|
||||||
ocl::oclMat d_src1, d_src2, d_dst;
|
ocl::oclMat d_src1, d_src2, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_8UC4};
|
int all_type[] = {CV_8UC1, CV_8UC4};
|
||||||
@ -355,6 +338,7 @@ PERFTEST(Absdiff)
|
|||||||
CPU_ON;
|
CPU_ON;
|
||||||
absdiff(src1, src2, dst);
|
absdiff(src1, src2, dst);
|
||||||
CPU_OFF;
|
CPU_OFF;
|
||||||
|
|
||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
|
|
||||||
@ -362,11 +346,6 @@ PERFTEST(Absdiff)
|
|||||||
ocl::absdiff(d_src1, d_src2, d_dst);
|
ocl::absdiff(d_src1, d_src2, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 0.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::absdiff(d_src1, d_src2, d_dst);
|
ocl::absdiff(d_src1, d_src2, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -375,8 +354,10 @@ PERFTEST(Absdiff)
|
|||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
ocl::absdiff(d_src1, d_src2, d_dst);
|
ocl::absdiff(d_src1, d_src2, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -385,7 +366,7 @@ PERFTEST(Absdiff)
|
|||||||
///////////// CartToPolar ////////////////////////
|
///////////// CartToPolar ////////////////////////
|
||||||
PERFTEST(CartToPolar)
|
PERFTEST(CartToPolar)
|
||||||
{
|
{
|
||||||
Mat src1, src2, dst, dst1;
|
Mat src1, src2, dst, dst1, ocl_dst, ocl_dst1;
|
||||||
ocl::oclMat d_src1, d_src2, d_dst, d_dst1;
|
ocl::oclMat d_src1, d_src2, d_dst, d_dst1;
|
||||||
|
|
||||||
int all_type[] = {CV_32FC1};
|
int all_type[] = {CV_32FC1};
|
||||||
@ -408,6 +389,7 @@ PERFTEST(CartToPolar)
|
|||||||
CPU_ON;
|
CPU_ON;
|
||||||
cartToPolar(src1, src2, dst, dst1, 1);
|
cartToPolar(src1, src2, dst, dst1, 1);
|
||||||
CPU_OFF;
|
CPU_OFF;
|
||||||
|
|
||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
|
|
||||||
@ -415,14 +397,6 @@ PERFTEST(CartToPolar)
|
|||||||
ocl::cartToPolar(d_src1, d_src2, d_dst, d_dst1, 1);
|
ocl::cartToPolar(d_src1, d_src2, d_dst, d_dst1, 1);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst1;
|
|
||||||
d_dst1.download(ocl_mat_dst1);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst1, dst1, 0.5)&&ExpectedMatNear(ocl_mat_dst, dst, 0.5));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::cartToPolar(d_src1, d_src2, d_dst, d_dst1, 1);
|
ocl::cartToPolar(d_src1, d_src2, d_dst, d_dst1, 1);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -431,9 +405,15 @@ PERFTEST(CartToPolar)
|
|||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
ocl::cartToPolar(d_src1, d_src2, d_dst, d_dst1, 1);
|
ocl::cartToPolar(d_src1, d_src2, d_dst, d_dst1, 1);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
d_dst1.download(dst1);
|
d_dst1.download(ocl_dst1);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
double diff1 = checkNorm(ocl_dst1, dst1);
|
||||||
|
double diff2 = checkNorm(ocl_dst, dst);
|
||||||
|
double max_diff = max(diff1, diff2);
|
||||||
|
TestSystem::instance().setAccurate(max_diff<=.5?1:0, max_diff);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -442,7 +422,7 @@ PERFTEST(CartToPolar)
|
|||||||
///////////// PolarToCart ////////////////////////
|
///////////// PolarToCart ////////////////////////
|
||||||
PERFTEST(PolarToCart)
|
PERFTEST(PolarToCart)
|
||||||
{
|
{
|
||||||
Mat src1, src2, dst, dst1;
|
Mat src1, src2, dst, dst1, ocl_dst, ocl_dst1;
|
||||||
ocl::oclMat d_src1, d_src2, d_dst, d_dst1;
|
ocl::oclMat d_src1, d_src2, d_dst, d_dst1;
|
||||||
|
|
||||||
int all_type[] = {CV_32FC1};
|
int all_type[] = {CV_32FC1};
|
||||||
@ -472,14 +452,6 @@ PERFTEST(PolarToCart)
|
|||||||
ocl::polarToCart(d_src1, d_src2, d_dst, d_dst1, 1);
|
ocl::polarToCart(d_src1, d_src2, d_dst, d_dst1, 1);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst1;
|
|
||||||
d_dst1.download(ocl_mat_dst1);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst1, dst1, 0.5)&&ExpectedMatNear(ocl_mat_dst, dst, 0.5));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::polarToCart(d_src1, d_src2, d_dst, d_dst1, 1);
|
ocl::polarToCart(d_src1, d_src2, d_dst, d_dst1, 1);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -488,9 +460,15 @@ PERFTEST(PolarToCart)
|
|||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
ocl::polarToCart(d_src1, d_src2, d_dst, d_dst1, 1);
|
ocl::polarToCart(d_src1, d_src2, d_dst, d_dst1, 1);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
d_dst1.download(dst1);
|
d_dst1.download(ocl_dst1);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
double diff1 = checkNorm(ocl_dst1, dst1);
|
||||||
|
double diff2 = checkNorm(ocl_dst, dst);
|
||||||
|
double max_diff = max(diff1, diff2);
|
||||||
|
TestSystem::instance().setAccurate(max_diff<=.5?1:0, max_diff);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -499,7 +477,7 @@ PERFTEST(PolarToCart)
|
|||||||
///////////// Magnitude ////////////////////////
|
///////////// Magnitude ////////////////////////
|
||||||
PERFTEST(magnitude)
|
PERFTEST(magnitude)
|
||||||
{
|
{
|
||||||
Mat x, y, mag;
|
Mat x, y, mag, ocl_mag;
|
||||||
ocl::oclMat d_x, d_y, d_mag;
|
ocl::oclMat d_x, d_y, d_mag;
|
||||||
|
|
||||||
int all_type[] = {CV_32FC1};
|
int all_type[] = {CV_32FC1};
|
||||||
@ -526,11 +504,6 @@ PERFTEST(magnitude)
|
|||||||
ocl::magnitude(d_x, d_y, d_mag);
|
ocl::magnitude(d_x, d_y, d_mag);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_mag.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, mag, 1e-5));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::magnitude(d_x, d_y, d_mag);
|
ocl::magnitude(d_x, d_y, d_mag);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -539,8 +512,10 @@ PERFTEST(magnitude)
|
|||||||
d_x.upload(x);
|
d_x.upload(x);
|
||||||
d_y.upload(y);
|
d_y.upload(y);
|
||||||
ocl::magnitude(d_x, d_y, d_mag);
|
ocl::magnitude(d_x, d_y, d_mag);
|
||||||
d_mag.download(mag);
|
d_mag.download(ocl_mag);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_mag, mag, 1e-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -549,7 +524,7 @@ PERFTEST(magnitude)
|
|||||||
///////////// Transpose ////////////////////////
|
///////////// Transpose ////////////////////////
|
||||||
PERFTEST(Transpose)
|
PERFTEST(Transpose)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_8UC4};
|
int all_type[] = {CV_8UC1, CV_8UC4};
|
||||||
@ -575,11 +550,6 @@ PERFTEST(Transpose)
|
|||||||
ocl::transpose(d_src, d_dst);
|
ocl::transpose(d_src, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 1e-5));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::transpose(d_src, d_dst);
|
ocl::transpose(d_src, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -587,8 +557,10 @@ PERFTEST(Transpose)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::transpose(d_src, d_dst);
|
ocl::transpose(d_src, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1e-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -597,7 +569,7 @@ PERFTEST(Transpose)
|
|||||||
///////////// Flip ////////////////////////
|
///////////// Flip ////////////////////////
|
||||||
PERFTEST(Flip)
|
PERFTEST(Flip)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_8UC4};
|
int all_type[] = {CV_8UC1, CV_8UC4};
|
||||||
@ -623,11 +595,6 @@ PERFTEST(Flip)
|
|||||||
ocl::flip(d_src, d_dst, 0);
|
ocl::flip(d_src, d_dst, 0);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 1e-5));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::flip(d_src, d_dst, 0);
|
ocl::flip(d_src, d_dst, 0);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -635,8 +602,10 @@ PERFTEST(Flip)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::flip(d_src, d_dst, 0);
|
ocl::flip(d_src, d_dst, 0);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1e-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -671,7 +640,10 @@ PERFTEST(minMax)
|
|||||||
ocl::minMax(d_src, &min_val_, &max_val_);
|
ocl::minMax(d_src, &min_val_, &max_val_);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(EeceptDoubleEQ<double>(max_val_, max_val)&&EeceptDoubleEQ<double>(min_val_, min_val));
|
if(EeceptDoubleEQ<double>(max_val_, max_val) && EeceptDoubleEQ<double>(min_val_, min_val))
|
||||||
|
TestSystem::instance().setAccurate(1, max(fabs(max_val_-max_val), fabs(min_val_-min_val)));
|
||||||
|
else
|
||||||
|
TestSystem::instance().setAccurate(0, max(fabs(max_val_-max_val), fabs(min_val_-min_val)));
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::minMax(d_src, &min_val, &max_val);
|
ocl::minMax(d_src, &min_val, &max_val);
|
||||||
@ -724,8 +696,6 @@ PERFTEST(minMaxLoc)
|
|||||||
minlocVal_ = src.at<unsigned char>(min_loc_);
|
minlocVal_ = src.at<unsigned char>(min_loc_);
|
||||||
maxlocVal = src.at<unsigned char>(max_loc);
|
maxlocVal = src.at<unsigned char>(max_loc);
|
||||||
maxlocVal_ = src.at<unsigned char>(max_loc_);
|
maxlocVal_ = src.at<unsigned char>(max_loc_);
|
||||||
error0 = ::abs(src.at<unsigned char>(min_loc_) - src.at<unsigned char>(min_loc));
|
|
||||||
error1 = ::abs(src.at<unsigned char>(max_loc_) - src.at<unsigned char>(max_loc));
|
|
||||||
}
|
}
|
||||||
if(src.depth() == 1)
|
if(src.depth() == 1)
|
||||||
{
|
{
|
||||||
@ -733,8 +703,6 @@ PERFTEST(minMaxLoc)
|
|||||||
minlocVal_ = src.at<signed char>(min_loc_);
|
minlocVal_ = src.at<signed char>(min_loc_);
|
||||||
maxlocVal = src.at<signed char>(max_loc);
|
maxlocVal = src.at<signed char>(max_loc);
|
||||||
maxlocVal_ = src.at<signed char>(max_loc_);
|
maxlocVal_ = src.at<signed char>(max_loc_);
|
||||||
error0 = ::abs(src.at<signed char>(min_loc_) - src.at<signed char>(min_loc));
|
|
||||||
error1 = ::abs(src.at<signed char>(max_loc_) - src.at<signed char>(max_loc));
|
|
||||||
}
|
}
|
||||||
if(src.depth() == 2)
|
if(src.depth() == 2)
|
||||||
{
|
{
|
||||||
@ -742,8 +710,6 @@ PERFTEST(minMaxLoc)
|
|||||||
minlocVal_ = src.at<unsigned short>(min_loc_);
|
minlocVal_ = src.at<unsigned short>(min_loc_);
|
||||||
maxlocVal = src.at<unsigned short>(max_loc);
|
maxlocVal = src.at<unsigned short>(max_loc);
|
||||||
maxlocVal_ = src.at<unsigned short>(max_loc_);
|
maxlocVal_ = src.at<unsigned short>(max_loc_);
|
||||||
error0 = ::abs(src.at<unsigned short>(min_loc_) - src.at<unsigned short>(min_loc));
|
|
||||||
error1 = ::abs(src.at<unsigned short>(max_loc_) - src.at<unsigned short>(max_loc));
|
|
||||||
}
|
}
|
||||||
if(src.depth() == 3)
|
if(src.depth() == 3)
|
||||||
{
|
{
|
||||||
@ -751,8 +717,6 @@ PERFTEST(minMaxLoc)
|
|||||||
minlocVal_ = src.at<signed short>(min_loc_);
|
minlocVal_ = src.at<signed short>(min_loc_);
|
||||||
maxlocVal = src.at<signed short>(max_loc);
|
maxlocVal = src.at<signed short>(max_loc);
|
||||||
maxlocVal_ = src.at<signed short>(max_loc_);
|
maxlocVal_ = src.at<signed short>(max_loc_);
|
||||||
error0 = ::abs(src.at<signed short>(min_loc_) - src.at<signed short>(min_loc));
|
|
||||||
error1 = ::abs(src.at<signed short>(max_loc_) - src.at<signed short>(max_loc));
|
|
||||||
}
|
}
|
||||||
if(src.depth() == 4)
|
if(src.depth() == 4)
|
||||||
{
|
{
|
||||||
@ -760,8 +724,6 @@ PERFTEST(minMaxLoc)
|
|||||||
minlocVal_ = src.at<int>(min_loc_);
|
minlocVal_ = src.at<int>(min_loc_);
|
||||||
maxlocVal = src.at<int>(max_loc);
|
maxlocVal = src.at<int>(max_loc);
|
||||||
maxlocVal_ = src.at<int>(max_loc_);
|
maxlocVal_ = src.at<int>(max_loc_);
|
||||||
error0 = ::abs(src.at<int>(min_loc_) - src.at<int>(min_loc));
|
|
||||||
error1 = ::abs(src.at<int>(max_loc_) - src.at<int>(max_loc));
|
|
||||||
}
|
}
|
||||||
if(src.depth() == 5)
|
if(src.depth() == 5)
|
||||||
{
|
{
|
||||||
@ -769,8 +731,6 @@ PERFTEST(minMaxLoc)
|
|||||||
minlocVal_ = src.at<float>(min_loc_);
|
minlocVal_ = src.at<float>(min_loc_);
|
||||||
maxlocVal = src.at<float>(max_loc);
|
maxlocVal = src.at<float>(max_loc);
|
||||||
maxlocVal_ = src.at<float>(max_loc_);
|
maxlocVal_ = src.at<float>(max_loc_);
|
||||||
error0 = ::abs(src.at<float>(min_loc_) - src.at<float>(min_loc));
|
|
||||||
error1 = ::abs(src.at<float>(max_loc_) - src.at<float>(max_loc));
|
|
||||||
}
|
}
|
||||||
if(src.depth() == 6)
|
if(src.depth() == 6)
|
||||||
{
|
{
|
||||||
@ -778,16 +738,16 @@ PERFTEST(minMaxLoc)
|
|||||||
minlocVal_ = src.at<double>(min_loc_);
|
minlocVal_ = src.at<double>(min_loc_);
|
||||||
maxlocVal = src.at<double>(max_loc);
|
maxlocVal = src.at<double>(max_loc);
|
||||||
maxlocVal_ = src.at<double>(max_loc_);
|
maxlocVal_ = src.at<double>(max_loc_);
|
||||||
error0 = ::abs(src.at<double>(min_loc_) - src.at<double>(min_loc));
|
|
||||||
error1 = ::abs(src.at<double>(max_loc_) - src.at<double>(max_loc));
|
|
||||||
}
|
}
|
||||||
|
error0 = ::abs(minlocVal_ - minlocVal);
|
||||||
TestSystem::instance().setAccurate(EeceptDoubleEQ<double>(error1, 0.0)
|
error1 = ::abs(maxlocVal_ - maxlocVal);
|
||||||
&&EeceptDoubleEQ<double>(error0, 0.0)
|
if( EeceptDoubleEQ<double>(maxlocVal_, maxlocVal)
|
||||||
&&EeceptDoubleEQ<double>(maxlocVal_, maxlocVal)
|
|
||||||
&&EeceptDoubleEQ<double>(minlocVal_, minlocVal)
|
&&EeceptDoubleEQ<double>(minlocVal_, minlocVal)
|
||||||
&&EeceptDoubleEQ<double>(max_val_, max_val)
|
&&EeceptDoubleEQ<double>(max_val_, max_val)
|
||||||
&&EeceptDoubleEQ<double>(min_val_, min_val));
|
&&EeceptDoubleEQ<double>(min_val_, min_val))
|
||||||
|
TestSystem::instance().setAccurate(1, 0.);
|
||||||
|
else
|
||||||
|
TestSystem::instance().setAccurate(0, max(error0, error1));
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::minMaxLoc(d_src, &min_val, &max_val, &min_loc, &max_loc);
|
ocl::minMaxLoc(d_src, &min_val, &max_val, &min_loc, &max_loc);
|
||||||
@ -831,11 +791,13 @@ PERFTEST(Sum)
|
|||||||
gpures = ocl::sum(d_src);
|
gpures = ocl::sum(d_src);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExceptDoubleNear(cpures[3], gpures[3], 0.1)
|
vector<double> diffs(4);
|
||||||
&&ExceptDoubleNear(cpures[2], gpures[2], 0.1)
|
diffs[3] = fabs(cpures[3] - gpures[3]);
|
||||||
&&ExceptDoubleNear(cpures[1], gpures[1], 0.1)
|
diffs[2] = fabs(cpures[2] - gpures[2]);
|
||||||
&&ExceptDoubleNear(cpures[0], gpures[0], 0.1));
|
diffs[1] = fabs(cpures[1] - gpures[1]);
|
||||||
|
diffs[0] = fabs(cpures[0] - gpures[0]);
|
||||||
|
double max_diff = *max_element(diffs.begin(), diffs.end());
|
||||||
|
TestSystem::instance().setAccurate(max_diff<0.1?1:0, max_diff);
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
gpures = ocl::sum(d_src);
|
gpures = ocl::sum(d_src);
|
||||||
@ -879,7 +841,11 @@ PERFTEST(countNonZero)
|
|||||||
gpures = ocl::countNonZero(d_src);
|
gpures = ocl::countNonZero(d_src);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate((EeceptDoubleEQ<double>((double)cpures, (double)gpures)));
|
int diff = abs(cpures - gpures);
|
||||||
|
if(diff == 0)
|
||||||
|
TestSystem::instance().setAccurate(1, 0);
|
||||||
|
else
|
||||||
|
TestSystem::instance().setAccurate(0, diff);
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::countNonZero(d_src);
|
ocl::countNonZero(d_src);
|
||||||
@ -897,7 +863,7 @@ PERFTEST(countNonZero)
|
|||||||
///////////// Phase ////////////////////////
|
///////////// Phase ////////////////////////
|
||||||
PERFTEST(Phase)
|
PERFTEST(Phase)
|
||||||
{
|
{
|
||||||
Mat src1, src2, dst;
|
Mat src1, src2, dst, ocl_dst;
|
||||||
ocl::oclMat d_src1, d_src2, d_dst;
|
ocl::oclMat d_src1, d_src2, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_32FC1};
|
int all_type[] = {CV_32FC1};
|
||||||
@ -913,12 +879,12 @@ PERFTEST(Phase)
|
|||||||
gen(src2, size, size, all_type[j], 0, 256);
|
gen(src2, size, size, all_type[j], 0, 256);
|
||||||
gen(dst, size, size, all_type[j], 0, 256);
|
gen(dst, size, size, all_type[j], 0, 256);
|
||||||
|
|
||||||
|
|
||||||
phase(src1, src2, dst, 1);
|
phase(src1, src2, dst, 1);
|
||||||
|
|
||||||
CPU_ON;
|
CPU_ON;
|
||||||
phase(src1, src2, dst, 1);
|
phase(src1, src2, dst, 1);
|
||||||
CPU_OFF;
|
CPU_OFF;
|
||||||
|
|
||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
|
|
||||||
@ -926,11 +892,6 @@ PERFTEST(Phase)
|
|||||||
ocl::phase(d_src1, d_src2, d_dst, 1);
|
ocl::phase(d_src1, d_src2, d_dst, 1);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 1e-2));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::phase(d_src1, d_src2, d_dst, 1);
|
ocl::phase(d_src1, d_src2, d_dst, 1);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -939,8 +900,10 @@ PERFTEST(Phase)
|
|||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
ocl::phase(d_src1, d_src2, d_dst, 1);
|
ocl::phase(d_src1, d_src2, d_dst, 1);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1e-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -949,7 +912,7 @@ PERFTEST(Phase)
|
|||||||
///////////// bitwise_and////////////////////////
|
///////////// bitwise_and////////////////////////
|
||||||
PERFTEST(bitwise_and)
|
PERFTEST(bitwise_and)
|
||||||
{
|
{
|
||||||
Mat src1, src2, dst;
|
Mat src1, src2, dst, ocl_dst;
|
||||||
ocl::oclMat d_src1, d_src2, d_dst;
|
ocl::oclMat d_src1, d_src2, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_32SC1};
|
int all_type[] = {CV_8UC1, CV_32SC1};
|
||||||
@ -965,7 +928,6 @@ PERFTEST(bitwise_and)
|
|||||||
gen(src2, size, size, all_type[j], 0, 256);
|
gen(src2, size, size, all_type[j], 0, 256);
|
||||||
gen(dst, size, size, all_type[j], 0, 256);
|
gen(dst, size, size, all_type[j], 0, 256);
|
||||||
|
|
||||||
|
|
||||||
bitwise_and(src1, src2, dst);
|
bitwise_and(src1, src2, dst);
|
||||||
|
|
||||||
CPU_ON;
|
CPU_ON;
|
||||||
@ -978,11 +940,6 @@ PERFTEST(bitwise_and)
|
|||||||
ocl::bitwise_and(d_src1, d_src2, d_dst);
|
ocl::bitwise_and(d_src1, d_src2, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 0.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::bitwise_and(d_src1, d_src2, d_dst);
|
ocl::bitwise_and(d_src1, d_src2, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -991,8 +948,10 @@ PERFTEST(bitwise_and)
|
|||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
ocl::bitwise_and(d_src1, d_src2, d_dst);
|
ocl::bitwise_and(d_src1, d_src2, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1001,7 +960,7 @@ PERFTEST(bitwise_and)
|
|||||||
///////////// bitwise_not////////////////////////
|
///////////// bitwise_not////////////////////////
|
||||||
PERFTEST(bitwise_not)
|
PERFTEST(bitwise_not)
|
||||||
{
|
{
|
||||||
Mat src1, dst;
|
Mat src1, dst, ocl_dst;
|
||||||
ocl::oclMat d_src1, d_dst;
|
ocl::oclMat d_src1, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_32SC1};
|
int all_type[] = {CV_8UC1, CV_32SC1};
|
||||||
@ -1016,7 +975,6 @@ PERFTEST(bitwise_not)
|
|||||||
gen(src1, size, size, all_type[j], 0, 256);
|
gen(src1, size, size, all_type[j], 0, 256);
|
||||||
gen(dst, size, size, all_type[j], 0, 256);
|
gen(dst, size, size, all_type[j], 0, 256);
|
||||||
|
|
||||||
|
|
||||||
bitwise_not(src1, dst);
|
bitwise_not(src1, dst);
|
||||||
|
|
||||||
CPU_ON;
|
CPU_ON;
|
||||||
@ -1028,11 +986,6 @@ PERFTEST(bitwise_not)
|
|||||||
ocl::bitwise_not(d_src1, d_dst);
|
ocl::bitwise_not(d_src1, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 0.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::bitwise_not(d_src1, d_dst);
|
ocl::bitwise_not(d_src1, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -1040,8 +993,10 @@ PERFTEST(bitwise_not)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
ocl::bitwise_not(d_src1, d_dst);
|
ocl::bitwise_not(d_src1, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1050,7 +1005,7 @@ PERFTEST(bitwise_not)
|
|||||||
///////////// compare////////////////////////
|
///////////// compare////////////////////////
|
||||||
PERFTEST(compare)
|
PERFTEST(compare)
|
||||||
{
|
{
|
||||||
Mat src1, src2, dst;
|
Mat src1, src2, dst, ocl_dst;
|
||||||
ocl::oclMat d_src1, d_src2, d_dst;
|
ocl::oclMat d_src1, d_src2, d_dst;
|
||||||
|
|
||||||
int CMP_EQ = 0;
|
int CMP_EQ = 0;
|
||||||
@ -1067,12 +1022,12 @@ PERFTEST(compare)
|
|||||||
gen(src2, size, size, all_type[j], 0, 256);
|
gen(src2, size, size, all_type[j], 0, 256);
|
||||||
gen(dst, size, size, all_type[j], 0, 256);
|
gen(dst, size, size, all_type[j], 0, 256);
|
||||||
|
|
||||||
|
|
||||||
compare(src1, src2, dst, CMP_EQ);
|
compare(src1, src2, dst, CMP_EQ);
|
||||||
|
|
||||||
CPU_ON;
|
CPU_ON;
|
||||||
compare(src1, src2, dst, CMP_EQ);
|
compare(src1, src2, dst, CMP_EQ);
|
||||||
CPU_OFF;
|
CPU_OFF;
|
||||||
|
|
||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
|
|
||||||
@ -1080,11 +1035,6 @@ PERFTEST(compare)
|
|||||||
ocl::compare(d_src1, d_src2, d_dst, CMP_EQ);
|
ocl::compare(d_src1, d_src2, d_dst, CMP_EQ);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 0.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::compare(d_src1, d_src2, d_dst, CMP_EQ);
|
ocl::compare(d_src1, d_src2, d_dst, CMP_EQ);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -1093,8 +1043,10 @@ PERFTEST(compare)
|
|||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
ocl::compare(d_src1, d_src2, d_dst, CMP_EQ);
|
ocl::compare(d_src1, d_src2, d_dst, CMP_EQ);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1103,7 +1055,7 @@ PERFTEST(compare)
|
|||||||
///////////// pow ////////////////////////
|
///////////// pow ////////////////////////
|
||||||
PERFTEST(pow)
|
PERFTEST(pow)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_32FC1};
|
int all_type[] = {CV_32FC1};
|
||||||
@ -1129,11 +1081,6 @@ PERFTEST(pow)
|
|||||||
ocl::pow(d_src, -2.0, d_dst);
|
ocl::pow(d_src, -2.0, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 1.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::pow(d_src, -2.0, d_dst);
|
ocl::pow(d_src, -2.0, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -1141,8 +1088,10 @@ PERFTEST(pow)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::pow(d_src, -2.0, d_dst);
|
ocl::pow(d_src, -2.0, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1151,7 +1100,7 @@ PERFTEST(pow)
|
|||||||
///////////// MagnitudeSqr////////////////////////
|
///////////// MagnitudeSqr////////////////////////
|
||||||
PERFTEST(MagnitudeSqr)
|
PERFTEST(MagnitudeSqr)
|
||||||
{
|
{
|
||||||
Mat src1, src2, dst;
|
Mat src1, src2, dst, ocl_dst;
|
||||||
ocl::oclMat d_src1, d_src2, d_dst;
|
ocl::oclMat d_src1, d_src2, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_32FC1};
|
int all_type[] = {CV_32FC1};
|
||||||
@ -1167,31 +1116,17 @@ PERFTEST(MagnitudeSqr)
|
|||||||
gen(src2, size, size, all_type[t], 0, 256);
|
gen(src2, size, size, all_type[t], 0, 256);
|
||||||
gen(dst, size, size, all_type[t], 0, 256);
|
gen(dst, size, size, all_type[t], 0, 256);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < src1.rows; ++i)
|
|
||||||
|
|
||||||
for (int j = 0; j < src1.cols; ++j)
|
|
||||||
{
|
|
||||||
float val1 = src1.at<float>(i, j);
|
|
||||||
float val2 = src2.at<float>(i, j);
|
|
||||||
|
|
||||||
((float *)(dst.data))[i * dst.step / 4 + j] = val1 * val1 + val2 * val2;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
CPU_ON;
|
CPU_ON;
|
||||||
|
|
||||||
for (int i = 0; i < src1.rows; ++i)
|
for (int i = 0; i < src1.rows; ++i)
|
||||||
for (int j = 0; j < src1.cols; ++j)
|
for (int j = 0; j < src1.cols; ++j)
|
||||||
{
|
{
|
||||||
float val1 = src1.at<float>(i, j);
|
float val1 = src1.at<float>(i, j);
|
||||||
float val2 = src2.at<float>(i, j);
|
float val2 = src2.at<float>(i, j);
|
||||||
|
|
||||||
((float *)(dst.data))[i * dst.step / 4 + j] = val1 * val1 + val2 * val2;
|
((float *)(dst.data))[i * dst.step / 4 + j] = val1 * val1 + val2 * val2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CPU_OFF;
|
CPU_OFF;
|
||||||
|
|
||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
|
|
||||||
@ -1199,11 +1134,6 @@ PERFTEST(MagnitudeSqr)
|
|||||||
ocl::magnitudeSqr(d_src1, d_src2, d_dst);
|
ocl::magnitudeSqr(d_src1, d_src2, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 1.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::magnitudeSqr(d_src1, d_src2, d_dst);
|
ocl::magnitudeSqr(d_src1, d_src2, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -1212,8 +1142,10 @@ PERFTEST(MagnitudeSqr)
|
|||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
ocl::magnitudeSqr(d_src1, d_src2, d_dst);
|
ocl::magnitudeSqr(d_src1, d_src2, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1222,7 +1154,7 @@ PERFTEST(MagnitudeSqr)
|
|||||||
///////////// AddWeighted////////////////////////
|
///////////// AddWeighted////////////////////////
|
||||||
PERFTEST(AddWeighted)
|
PERFTEST(AddWeighted)
|
||||||
{
|
{
|
||||||
Mat src1, src2, dst;
|
Mat src1, src2, dst, ocl_dst;
|
||||||
ocl::oclMat d_src1, d_src2, d_dst;
|
ocl::oclMat d_src1, d_src2, d_dst;
|
||||||
|
|
||||||
double alpha = 2.0, beta = 1.0, gama = 3.0;
|
double alpha = 2.0, beta = 1.0, gama = 3.0;
|
||||||
@ -1252,11 +1184,6 @@ PERFTEST(AddWeighted)
|
|||||||
ocl::addWeighted(d_src1, alpha, d_src2, beta, gama, d_dst);
|
ocl::addWeighted(d_src1, alpha, d_src2, beta, gama, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat_dst;
|
|
||||||
d_dst.download(ocl_mat_dst);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat_dst, dst, 1e-5));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::addWeighted(d_src1, alpha, d_src2, beta, gama, d_dst);
|
ocl::addWeighted(d_src1, alpha, d_src2, beta, gama, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -1265,8 +1192,10 @@ PERFTEST(AddWeighted)
|
|||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
ocl::addWeighted(d_src1, alpha, d_src2, beta, gama, d_dst);
|
ocl::addWeighted(d_src1, alpha, d_src2, beta, gama, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1e-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ void blendLinearGold(const cv::Mat &img1, const cv::Mat &img2, const cv::Mat &we
|
|||||||
}
|
}
|
||||||
PERFTEST(blend)
|
PERFTEST(blend)
|
||||||
{
|
{
|
||||||
Mat src1, src2, weights1, weights2, dst;
|
Mat src1, src2, weights1, weights2, dst, ocl_dst;
|
||||||
ocl::oclMat d_src1, d_src2, d_weights1, d_weights2, d_dst;
|
ocl::oclMat d_src1, d_src2, d_weights1, d_weights2, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_8UC4};
|
int all_type[] = {CV_8UC1, CV_8UC4};
|
||||||
@ -103,10 +103,6 @@ PERFTEST(blend)
|
|||||||
ocl::blendLinear(d_src1, d_src2, d_weights1, d_weights2, d_dst);
|
ocl::blendLinear(d_src1, d_src2, d_weights1, d_weights2, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat;
|
|
||||||
d_dst.download(ocl_mat);
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, ocl_mat, 1.f));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::blendLinear(d_src1, d_src2, d_weights1, d_weights2, d_dst);
|
ocl::blendLinear(d_src1, d_src2, d_weights1, d_weights2, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -117,8 +113,10 @@ PERFTEST(blend)
|
|||||||
d_weights1.upload(weights1);
|
d_weights1.upload(weights1);
|
||||||
d_weights2.upload(weights2);
|
d_weights2.upload(weights2);
|
||||||
ocl::blendLinear(d_src1, d_src2, d_weights1, d_weights2, d_dst);
|
ocl::blendLinear(d_src1, d_src2, d_weights1, d_weights2, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 1.f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -88,9 +88,6 @@ PERFTEST(BruteForceMatcher)
|
|||||||
d_matcher.matchSingle(d_query, d_train, d_trainIdx, d_distance);
|
d_matcher.matchSingle(d_query, d_train, d_trainIdx, d_distance);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
d_matcher.match(d_query, d_train, d_matches[0]);
|
|
||||||
TestSystem::instance().setAccurate(AssertEQ<size_t>(d_matches[0].size(), matches[0].size()));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
d_matcher.matchSingle(d_query, d_train, d_trainIdx, d_distance);
|
d_matcher.matchSingle(d_query, d_train, d_trainIdx, d_distance);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -101,6 +98,12 @@ PERFTEST(BruteForceMatcher)
|
|||||||
d_matcher.match(d_query, d_train, matches[0]);
|
d_matcher.match(d_query, d_train, matches[0]);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
int diff = abs((int)d_matches[0].size() - (int)matches[0].size());
|
||||||
|
if(diff == 0)
|
||||||
|
TestSystem::instance().setAccurate(1, 0);
|
||||||
|
else
|
||||||
|
TestSystem::instance().setAccurate(0, diff);
|
||||||
|
|
||||||
SUBTEST << size << "; knnMatch";
|
SUBTEST << size << "; knnMatch";
|
||||||
|
|
||||||
matcher.knnMatch(query, train, matches, 2);
|
matcher.knnMatch(query, train, matches, 2);
|
||||||
@ -123,7 +126,11 @@ PERFTEST(BruteForceMatcher)
|
|||||||
d_matcher.knnMatch(d_query, d_train, d_matches, 2);
|
d_matcher.knnMatch(d_query, d_train, d_matches, 2);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(AssertEQ<size_t>(d_matches[0].size(), matches[0].size()));
|
diff = abs((int)d_matches[0].size() - (int)matches[0].size());
|
||||||
|
if(diff == 0)
|
||||||
|
TestSystem::instance().setAccurate(1, 0);
|
||||||
|
else
|
||||||
|
TestSystem::instance().setAccurate(0, diff);
|
||||||
|
|
||||||
SUBTEST << size << "; radiusMatch";
|
SUBTEST << size << "; radiusMatch";
|
||||||
|
|
||||||
@ -151,6 +158,10 @@ PERFTEST(BruteForceMatcher)
|
|||||||
d_matcher.radiusMatch(d_query, d_train, d_matches, max_distance);
|
d_matcher.radiusMatch(d_query, d_train, d_matches, max_distance);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(AssertEQ<size_t>(d_matches[0].size(), matches[0].size()));
|
diff = abs((int)d_matches[0].size() - (int)matches[0].size());
|
||||||
|
if(diff == 0)
|
||||||
|
TestSystem::instance().setAccurate(1, 0);
|
||||||
|
else
|
||||||
|
TestSystem::instance().setAccurate(0, diff);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -57,7 +57,7 @@ PERFTEST(Canny)
|
|||||||
|
|
||||||
SUBTEST << img.cols << 'x' << img.rows << "; aloeL.jpg" << "; edges" << "; CV_8UC1";
|
SUBTEST << img.cols << 'x' << img.rows << "; aloeL.jpg" << "; edges" << "; CV_8UC1";
|
||||||
|
|
||||||
Mat edges(img.size(), CV_8UC1);
|
Mat edges(img.size(), CV_8UC1), ocl_edges;
|
||||||
|
|
||||||
CPU_ON;
|
CPU_ON;
|
||||||
Canny(img, edges, 50.0, 100.0);
|
Canny(img, edges, 50.0, 100.0);
|
||||||
@ -71,8 +71,6 @@ PERFTEST(Canny)
|
|||||||
ocl::Canny(d_img, d_buf, d_edges, 50.0, 100.0);
|
ocl::Canny(d_img, d_buf, d_edges, 50.0, 100.0);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExceptedMatSimilar(edges, d_edges, 2e-2));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::Canny(d_img, d_buf, d_edges, 50.0, 100.0);
|
ocl::Canny(d_img, d_buf, d_edges, 50.0, 100.0);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -80,6 +78,8 @@ PERFTEST(Canny)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_img.upload(img);
|
d_img.upload(img);
|
||||||
ocl::Canny(d_img, d_buf, d_edges, 50.0, 100.0);
|
ocl::Canny(d_img, d_buf, d_edges, 50.0, 100.0);
|
||||||
d_edges.download(edges);
|
d_edges.download(ocl_edges);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExceptedMatSimilar(edges, ocl_edges, 2e-2);
|
||||||
}
|
}
|
@ -48,7 +48,7 @@
|
|||||||
///////////// cvtColor////////////////////////
|
///////////// cvtColor////////////////////////
|
||||||
PERFTEST(cvtColor)
|
PERFTEST(cvtColor)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC4};
|
int all_type[] = {CV_8UC4};
|
||||||
@ -73,10 +73,6 @@ PERFTEST(cvtColor)
|
|||||||
ocl::cvtColor(d_src, d_dst, CV_RGBA2GRAY, 4);
|
ocl::cvtColor(d_src, d_dst, CV_RGBA2GRAY, 4);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat;
|
|
||||||
d_dst.download(ocl_mat);
|
|
||||||
TestSystem::instance().setAccurate(ExceptedMatSimilar(dst, ocl_mat, 1e-5));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::cvtColor(d_src, d_dst, CV_RGBA2GRAY, 4);
|
ocl::cvtColor(d_src, d_dst, CV_RGBA2GRAY, 4);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -84,8 +80,10 @@ PERFTEST(cvtColor)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::cvtColor(d_src, d_dst, CV_RGBA2GRAY, 4);
|
ocl::cvtColor(d_src, d_dst, CV_RGBA2GRAY, 4);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExceptedMatSimilar(dst, ocl_dst, 1e-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
///////////// columnSum////////////////////////
|
///////////// columnSum////////////////////////
|
||||||
PERFTEST(columnSum)
|
PERFTEST(columnSum)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
||||||
@ -63,23 +63,16 @@ PERFTEST(columnSum)
|
|||||||
dst.at<float>(0, j) = src.at<float>(0, j);
|
dst.at<float>(0, j) = src.at<float>(0, j);
|
||||||
|
|
||||||
for (int i = 1; i < src.rows; ++i)
|
for (int i = 1; i < src.rows; ++i)
|
||||||
{for (int j = 0; j < src.cols; ++j)
|
for (int j = 0; j < src.cols; ++j)
|
||||||
{
|
|
||||||
dst.at<float>(i, j) = dst.at<float>(i - 1 , j) + src.at<float>(i , j);
|
dst.at<float>(i, j) = dst.at<float>(i - 1 , j) + src.at<float>(i , j);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CPU_OFF;
|
CPU_OFF;
|
||||||
|
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
|
|
||||||
WARMUP_ON;
|
WARMUP_ON;
|
||||||
ocl::columnSum(d_src, d_dst);
|
ocl::columnSum(d_src, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat;
|
|
||||||
d_dst.download(ocl_mat);
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, ocl_mat, 5e-1));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::columnSum(d_src, d_dst);
|
ocl::columnSum(d_src, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -87,7 +80,9 @@ PERFTEST(columnSum)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::columnSum(d_src, d_dst);
|
ocl::columnSum(d_src, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 5e-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -48,7 +48,7 @@
|
|||||||
///////////// dft ////////////////////////
|
///////////// dft ////////////////////////
|
||||||
PERFTEST(dft)
|
PERFTEST(dft)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_32FC2};
|
int all_type[] = {CV_32FC2};
|
||||||
@ -74,8 +74,6 @@ PERFTEST(dft)
|
|||||||
ocl::dft(d_src, d_dst, Size(size, size));
|
ocl::dft(d_src, d_dst, Size(size, size));
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), src.size().area() * 1e-4));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::dft(d_src, d_dst, Size(size, size));
|
ocl::dft(d_src, d_dst, Size(size, size));
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -83,8 +81,10 @@ PERFTEST(dft)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::dft(d_src, d_dst, Size(size, size));
|
ocl::dft(d_src, d_dst, Size(size, size));
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, src.size().area() * 1e-4);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
///////////// Blur////////////////////////
|
///////////// Blur////////////////////////
|
||||||
PERFTEST(Blur)
|
PERFTEST(Blur)
|
||||||
{
|
{
|
||||||
Mat src1, dst;
|
Mat src1, dst, ocl_dst;
|
||||||
ocl::oclMat d_src1, d_dst;
|
ocl::oclMat d_src1, d_dst;
|
||||||
|
|
||||||
Size ksize = Size(3, 3);
|
Size ksize = Size(3, 3);
|
||||||
@ -65,7 +65,6 @@ PERFTEST(Blur)
|
|||||||
gen(src1, size, size, all_type[j], 0, 256);
|
gen(src1, size, size, all_type[j], 0, 256);
|
||||||
gen(dst, size, size, all_type[j], 0, 256);
|
gen(dst, size, size, all_type[j], 0, 256);
|
||||||
|
|
||||||
|
|
||||||
blur(src1, dst, ksize, Point(-1, -1), bordertype);
|
blur(src1, dst, ksize, Point(-1, -1), bordertype);
|
||||||
|
|
||||||
CPU_ON;
|
CPU_ON;
|
||||||
@ -78,8 +77,6 @@ PERFTEST(Blur)
|
|||||||
ocl::blur(d_src1, d_dst, ksize, Point(-1, -1), bordertype);
|
ocl::blur(d_src1, d_dst, ksize, Point(-1, -1), bordertype);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(cv::Mat(d_dst), dst, 1.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::blur(d_src1, d_dst, ksize, Point(-1, -1), bordertype);
|
ocl::blur(d_src1, d_dst, ksize, Point(-1, -1), bordertype);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -87,8 +84,10 @@ PERFTEST(Blur)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
ocl::blur(d_src1, d_dst, ksize, Point(-1, -1), bordertype);
|
ocl::blur(d_src1, d_dst, ksize, Point(-1, -1), bordertype);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -96,7 +95,7 @@ PERFTEST(Blur)
|
|||||||
///////////// Laplacian////////////////////////
|
///////////// Laplacian////////////////////////
|
||||||
PERFTEST(Laplacian)
|
PERFTEST(Laplacian)
|
||||||
{
|
{
|
||||||
Mat src1, dst;
|
Mat src1, dst, ocl_dst;
|
||||||
ocl::oclMat d_src1, d_dst;
|
ocl::oclMat d_src1, d_dst;
|
||||||
|
|
||||||
int ksize = 3;
|
int ksize = 3;
|
||||||
@ -112,7 +111,6 @@ PERFTEST(Laplacian)
|
|||||||
gen(src1, size, size, all_type[j], 0, 256);
|
gen(src1, size, size, all_type[j], 0, 256);
|
||||||
gen(dst, size, size, all_type[j], 0, 256);
|
gen(dst, size, size, all_type[j], 0, 256);
|
||||||
|
|
||||||
|
|
||||||
Laplacian(src1, dst, -1, ksize, 1);
|
Laplacian(src1, dst, -1, ksize, 1);
|
||||||
|
|
||||||
CPU_ON;
|
CPU_ON;
|
||||||
@ -125,8 +123,6 @@ PERFTEST(Laplacian)
|
|||||||
ocl::Laplacian(d_src1, d_dst, -1, ksize, 1);
|
ocl::Laplacian(d_src1, d_dst, -1, ksize, 1);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(cv::Mat(d_dst), dst, 1e-5));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::Laplacian(d_src1, d_dst, -1, ksize, 1);
|
ocl::Laplacian(d_src1, d_dst, -1, ksize, 1);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -134,8 +130,10 @@ PERFTEST(Laplacian)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src1.upload(src1);
|
d_src1.upload(src1);
|
||||||
ocl::Laplacian(d_src1, d_dst, -1, ksize, 1);
|
ocl::Laplacian(d_src1, d_dst, -1, ksize, 1);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1e-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -144,7 +142,7 @@ PERFTEST(Laplacian)
|
|||||||
///////////// Erode ////////////////////
|
///////////// Erode ////////////////////
|
||||||
PERFTEST(Erode)
|
PERFTEST(Erode)
|
||||||
{
|
{
|
||||||
Mat src, dst, ker;
|
Mat src, dst, ker, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4};
|
int all_type[] = {CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4};
|
||||||
@ -171,8 +169,6 @@ PERFTEST(Erode)
|
|||||||
ocl::erode(d_src, d_dst, ker);
|
ocl::erode(d_src, d_dst, ker);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(cv::Mat(d_dst), dst, 1e-5));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::erode(d_src, d_dst, ker);
|
ocl::erode(d_src, d_dst, ker);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -180,8 +176,10 @@ PERFTEST(Erode)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::erode(d_src, d_dst, ker);
|
ocl::erode(d_src, d_dst, ker);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1e-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -190,7 +188,7 @@ PERFTEST(Erode)
|
|||||||
///////////// Sobel ////////////////////////
|
///////////// Sobel ////////////////////////
|
||||||
PERFTEST(Sobel)
|
PERFTEST(Sobel)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
int dx = 1;
|
int dx = 1;
|
||||||
@ -218,8 +216,6 @@ PERFTEST(Sobel)
|
|||||||
ocl::Sobel(d_src, d_dst, -1, dx, dy);
|
ocl::Sobel(d_src, d_dst, -1, dx, dy);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(cv::Mat(d_dst), dst, 1));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::Sobel(d_src, d_dst, -1, dx, dy);
|
ocl::Sobel(d_src, d_dst, -1, dx, dy);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -227,8 +223,10 @@ PERFTEST(Sobel)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::Sobel(d_src, d_dst, -1, dx, dy);
|
ocl::Sobel(d_src, d_dst, -1, dx, dy);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -236,7 +234,7 @@ PERFTEST(Sobel)
|
|||||||
///////////// Scharr ////////////////////////
|
///////////// Scharr ////////////////////////
|
||||||
PERFTEST(Scharr)
|
PERFTEST(Scharr)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
int dx = 1;
|
int dx = 1;
|
||||||
@ -264,8 +262,6 @@ PERFTEST(Scharr)
|
|||||||
ocl::Scharr(d_src, d_dst, -1, dx, dy);
|
ocl::Scharr(d_src, d_dst, -1, dx, dy);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(cv::Mat(d_dst), dst, 1));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::Scharr(d_src, d_dst, -1, dx, dy);
|
ocl::Scharr(d_src, d_dst, -1, dx, dy);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -273,8 +269,10 @@ PERFTEST(Scharr)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::Scharr(d_src, d_dst, -1, dx, dy);
|
ocl::Scharr(d_src, d_dst, -1, dx, dy);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -283,7 +281,7 @@ PERFTEST(Scharr)
|
|||||||
///////////// GaussianBlur ////////////////////////
|
///////////// GaussianBlur ////////////////////////
|
||||||
PERFTEST(GaussianBlur)
|
PERFTEST(GaussianBlur)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
int all_type[] = {CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4};
|
int all_type[] = {CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4};
|
||||||
std::string type_name[] = {"CV_8UC1", "CV_8UC4", "CV_32FC1", "CV_32FC4"};
|
std::string type_name[] = {"CV_8UC1", "CV_8UC4", "CV_32FC1", "CV_32FC4"};
|
||||||
|
|
||||||
@ -311,9 +309,6 @@ PERFTEST(GaussianBlur)
|
|||||||
ocl::GaussianBlur(d_src, d_dst, Size(9, 9), 0);
|
ocl::GaussianBlur(d_src, d_dst, Size(9, 9), 0);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(cv::Mat(d_dst), dst, 1.0));
|
|
||||||
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::GaussianBlur(d_src, d_dst, Size(9, 9), 0);
|
ocl::GaussianBlur(d_src, d_dst, Size(9, 9), 0);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -321,8 +316,10 @@ PERFTEST(GaussianBlur)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::GaussianBlur(d_src, d_dst, Size(9, 9), 0);
|
ocl::GaussianBlur(d_src, d_dst, Size(9, 9), 0);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -349,7 +346,7 @@ PERFTEST(filter2D)
|
|||||||
Mat kernel;
|
Mat kernel;
|
||||||
gen(kernel, ksize, ksize, CV_32FC1, 0.0, 1.0);
|
gen(kernel, ksize, ksize, CV_32FC1, 0.0, 1.0);
|
||||||
|
|
||||||
Mat dst(src);
|
Mat dst, ocl_dst;
|
||||||
dst.setTo(0);
|
dst.setTo(0);
|
||||||
cv::filter2D(src, dst, -1, kernel);
|
cv::filter2D(src, dst, -1, kernel);
|
||||||
|
|
||||||
@ -357,17 +354,12 @@ PERFTEST(filter2D)
|
|||||||
cv::filter2D(src, dst, -1, kernel);
|
cv::filter2D(src, dst, -1, kernel);
|
||||||
CPU_OFF;
|
CPU_OFF;
|
||||||
|
|
||||||
ocl::oclMat d_src(src);
|
ocl::oclMat d_src(src), d_dst;
|
||||||
ocl::oclMat d_dst(d_src);
|
|
||||||
d_dst.setTo(0);
|
|
||||||
|
|
||||||
WARMUP_ON;
|
WARMUP_ON;
|
||||||
ocl::filter2D(d_src, d_dst, -1, kernel);
|
ocl::filter2D(d_src, d_dst, -1, kernel);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(cv::Mat(d_dst), dst, 1e-5));
|
|
||||||
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::filter2D(d_src, d_dst, -1, kernel);
|
ocl::filter2D(d_src, d_dst, -1, kernel);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -375,8 +367,10 @@ PERFTEST(filter2D)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::filter2D(d_src, d_dst, -1, kernel);
|
ocl::filter2D(d_src, d_dst, -1, kernel);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, 1e-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
///////////// gemm ////////////////////////
|
///////////// gemm ////////////////////////
|
||||||
PERFTEST(gemm)
|
PERFTEST(gemm)
|
||||||
{
|
{
|
||||||
Mat src1, src2, src3, dst;
|
Mat src1, src2, src3, dst, ocl_dst;
|
||||||
ocl::oclMat d_src1, d_src2, d_src3, d_dst;
|
ocl::oclMat d_src1, d_src2, d_src3, d_dst;
|
||||||
|
|
||||||
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
||||||
@ -72,7 +72,6 @@ PERFTEST(gemm)
|
|||||||
WARMUP_ON;
|
WARMUP_ON;
|
||||||
ocl::gemm(d_src1, d_src2, 1.0, d_src3, 1.0, d_dst);
|
ocl::gemm(d_src1, d_src2, 1.0, d_src3, 1.0, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(cv::Mat(d_dst), dst, src1.cols * src1.rows * 1e-4));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::gemm(d_src1, d_src2, 1.0, d_src3, 1.0, d_dst);
|
ocl::gemm(d_src1, d_src2, 1.0, d_src3, 1.0, d_dst);
|
||||||
@ -83,7 +82,9 @@ PERFTEST(gemm)
|
|||||||
d_src2.upload(src2);
|
d_src2.upload(src2);
|
||||||
d_src3.upload(src3);
|
d_src3.upload(src3);
|
||||||
ocl::gemm(d_src1, d_src2, 1.0, d_src3, 1.0, d_dst);
|
ocl::gemm(d_src1, d_src2, 1.0, d_src3, 1.0, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(ocl_dst, dst, src1.cols * src1.rows * 1e-4);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -123,8 +123,10 @@ PERFTEST(Haar)
|
|||||||
1.1, 2, 0 | CV_HAAR_SCALE_IMAGE, Size(30, 30));
|
1.1, 2, 0 | CV_HAAR_SCALE_IMAGE, Size(30, 30));
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
//Testing whether the expected is equal to the actual.
|
if(faces.size() == oclfaces.size())
|
||||||
TestSystem::instance().setAccurate(ExpectedEQ<vector<Rect>::size_type, vector<Rect>::size_type>(faces.size(), oclfaces.size()));
|
TestSystem::instance().setAccurate(1, 0);
|
||||||
|
else
|
||||||
|
TestSystem::instance().setAccurate(0, abs((int)faces.size() - (int)oclfaces.size()));
|
||||||
|
|
||||||
faces.clear();
|
faces.clear();
|
||||||
|
|
||||||
|
@ -146,10 +146,8 @@ PERFTEST(HOG)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::Mat ocl_mat;
|
cv::Mat gpu_rst(d_comp), cpu_rst(comp);
|
||||||
ocl_mat = cv::Mat(d_comp);
|
TestSystem::instance().ExpectedMatNear(gpu_rst, cpu_rst, 3);
|
||||||
ocl_mat.convertTo(ocl_mat, cv::Mat(comp).type());
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(ocl_mat, cv::Mat(comp), 3));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl_hog.detectMultiScale(d_src, found_locations);
|
ocl_hog.detectMultiScale(d_src, found_locations);
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
///////////// equalizeHist ////////////////////////
|
///////////// equalizeHist ////////////////////////
|
||||||
PERFTEST(equalizeHist)
|
PERFTEST(equalizeHist)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
int all_type[] = {CV_8UC1};
|
int all_type[] = {CV_8UC1};
|
||||||
std::string type_name[] = {"CV_8UC1"};
|
std::string type_name[] = {"CV_8UC1"};
|
||||||
|
|
||||||
@ -75,9 +75,6 @@ PERFTEST(equalizeHist)
|
|||||||
ocl::equalizeHist(d_src, d_dst);
|
ocl::equalizeHist(d_src, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), 1.1));
|
|
||||||
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::equalizeHist(d_src, d_dst);
|
ocl::equalizeHist(d_src, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -85,8 +82,10 @@ PERFTEST(equalizeHist)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::equalizeHist(d_src, d_dst);
|
ocl::equalizeHist(d_src, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 1.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -94,7 +93,7 @@ PERFTEST(equalizeHist)
|
|||||||
/////////// CopyMakeBorder //////////////////////
|
/////////// CopyMakeBorder //////////////////////
|
||||||
PERFTEST(CopyMakeBorder)
|
PERFTEST(CopyMakeBorder)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_dst;
|
ocl::oclMat d_dst;
|
||||||
|
|
||||||
int bordertype = BORDER_CONSTANT;
|
int bordertype = BORDER_CONSTANT;
|
||||||
@ -122,9 +121,6 @@ PERFTEST(CopyMakeBorder)
|
|||||||
ocl::copyMakeBorder(d_src, d_dst, 7, 5, 5, 7, bordertype, cv::Scalar(1.0));
|
ocl::copyMakeBorder(d_src, d_dst, 7, 5, 5, 7, bordertype, cv::Scalar(1.0));
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), 0.0));
|
|
||||||
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::copyMakeBorder(d_src, d_dst, 7, 5, 5, 7, bordertype, cv::Scalar(1.0));
|
ocl::copyMakeBorder(d_src, d_dst, 7, 5, 5, 7, bordertype, cv::Scalar(1.0));
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -132,8 +128,10 @@ PERFTEST(CopyMakeBorder)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::copyMakeBorder(d_src, d_dst, 7, 5, 5, 7, bordertype, cv::Scalar(1.0));
|
ocl::copyMakeBorder(d_src, d_dst, 7, 5, 5, 7, bordertype, cv::Scalar(1.0));
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -141,7 +139,7 @@ PERFTEST(CopyMakeBorder)
|
|||||||
///////////// cornerMinEigenVal ////////////////////////
|
///////////// cornerMinEigenVal ////////////////////////
|
||||||
PERFTEST(cornerMinEigenVal)
|
PERFTEST(cornerMinEigenVal)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_dst;
|
ocl::oclMat d_dst;
|
||||||
|
|
||||||
int blockSize = 7, apertureSize = 1 + 2 * (rand() % 4);
|
int blockSize = 7, apertureSize = 1 + 2 * (rand() % 4);
|
||||||
@ -155,7 +153,6 @@ PERFTEST(cornerMinEigenVal)
|
|||||||
{
|
{
|
||||||
SUBTEST << size << 'x' << size << "; " << type_name[j] ;
|
SUBTEST << size << 'x' << size << "; " << type_name[j] ;
|
||||||
|
|
||||||
|
|
||||||
gen(src, size, size, all_type[j], 0, 256);
|
gen(src, size, size, all_type[j], 0, 256);
|
||||||
|
|
||||||
cornerMinEigenVal(src, dst, blockSize, apertureSize, borderType);
|
cornerMinEigenVal(src, dst, blockSize, apertureSize, borderType);
|
||||||
@ -170,9 +167,6 @@ PERFTEST(cornerMinEigenVal)
|
|||||||
ocl::cornerMinEigenVal(d_src, d_dst, blockSize, apertureSize, borderType);
|
ocl::cornerMinEigenVal(d_src, d_dst, blockSize, apertureSize, borderType);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), 1.0));
|
|
||||||
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::cornerMinEigenVal(d_src, d_dst, blockSize, apertureSize, borderType);
|
ocl::cornerMinEigenVal(d_src, d_dst, blockSize, apertureSize, borderType);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -180,8 +174,10 @@ PERFTEST(cornerMinEigenVal)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::cornerMinEigenVal(d_src, d_dst, blockSize, apertureSize, borderType);
|
ocl::cornerMinEigenVal(d_src, d_dst, blockSize, apertureSize, borderType);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -189,7 +185,7 @@ PERFTEST(cornerMinEigenVal)
|
|||||||
///////////// cornerHarris ////////////////////////
|
///////////// cornerHarris ////////////////////////
|
||||||
PERFTEST(cornerHarris)
|
PERFTEST(cornerHarris)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_32FC1};
|
int all_type[] = {CV_8UC1, CV_32FC1};
|
||||||
@ -215,8 +211,6 @@ PERFTEST(cornerHarris)
|
|||||||
ocl::cornerHarris(d_src, d_dst, 5, 7, 0.1, BORDER_REFLECT);
|
ocl::cornerHarris(d_src, d_dst, 5, 7, 0.1, BORDER_REFLECT);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), 1.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::cornerHarris(d_src, d_dst, 5, 7, 0.1, BORDER_REFLECT);
|
ocl::cornerHarris(d_src, d_dst, 5, 7, 0.1, BORDER_REFLECT);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -224,8 +218,10 @@ PERFTEST(cornerHarris)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::cornerHarris(d_src, d_dst, 5, 7, 0.1, BORDER_REFLECT);
|
ocl::cornerHarris(d_src, d_dst, 5, 7, 0.1, BORDER_REFLECT);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -234,7 +230,7 @@ PERFTEST(cornerHarris)
|
|||||||
///////////// integral ////////////////////////
|
///////////// integral ////////////////////////
|
||||||
PERFTEST(integral)
|
PERFTEST(integral)
|
||||||
{
|
{
|
||||||
Mat src, sum;
|
Mat src, sum, ocl_sum;
|
||||||
ocl::oclMat d_src, d_sum, d_buf;
|
ocl::oclMat d_src, d_sum, d_buf;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1};
|
int all_type[] = {CV_8UC1};
|
||||||
@ -260,12 +256,6 @@ PERFTEST(integral)
|
|||||||
ocl::integral(d_src, d_sum);
|
ocl::integral(d_src, d_sum);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat;
|
|
||||||
d_sum.download(ocl_mat);
|
|
||||||
if(sum.type() == ocl_mat.type()) //we won't test accuracy when cpu function overlow
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(sum, ocl_mat, 0.0));
|
|
||||||
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::integral(d_src, d_sum);
|
ocl::integral(d_src, d_sum);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -273,8 +263,12 @@ PERFTEST(integral)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::integral(d_src, d_sum);
|
ocl::integral(d_src, d_sum);
|
||||||
d_sum.download(sum);
|
d_sum.download(ocl_sum);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
if(sum.type() == ocl_sum.type()) //we won't test accuracy when cpu function overlow
|
||||||
|
TestSystem::instance().ExpectedMatNear(sum, ocl_sum, 0.0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -282,7 +276,7 @@ PERFTEST(integral)
|
|||||||
///////////// WarpAffine ////////////////////////
|
///////////// WarpAffine ////////////////////////
|
||||||
PERFTEST(WarpAffine)
|
PERFTEST(WarpAffine)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
static const double coeffs[2][3] =
|
static const double coeffs[2][3] =
|
||||||
@ -319,8 +313,6 @@ PERFTEST(WarpAffine)
|
|||||||
ocl::warpAffine(d_src, d_dst, M, size1, interpolation);
|
ocl::warpAffine(d_src, d_dst, M, size1, interpolation);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), 1.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::warpAffine(d_src, d_dst, M, size1, interpolation);
|
ocl::warpAffine(d_src, d_dst, M, size1, interpolation);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -328,8 +320,10 @@ PERFTEST(WarpAffine)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::warpAffine(d_src, d_dst, M, size1, interpolation);
|
ocl::warpAffine(d_src, d_dst, M, size1, interpolation);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -337,7 +331,7 @@ PERFTEST(WarpAffine)
|
|||||||
///////////// WarpPerspective ////////////////////////
|
///////////// WarpPerspective ////////////////////////
|
||||||
PERFTEST(WarpPerspective)
|
PERFTEST(WarpPerspective)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
static const double coeffs[3][3] =
|
static const double coeffs[3][3] =
|
||||||
@ -374,8 +368,6 @@ PERFTEST(WarpPerspective)
|
|||||||
ocl::warpPerspective(d_src, d_dst, M, size1, interpolation);
|
ocl::warpPerspective(d_src, d_dst, M, size1, interpolation);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), 1.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::warpPerspective(d_src, d_dst, M, size1, interpolation);
|
ocl::warpPerspective(d_src, d_dst, M, size1, interpolation);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -383,8 +375,10 @@ PERFTEST(WarpPerspective)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::warpPerspective(d_src, d_dst, M, size1, interpolation);
|
ocl::warpPerspective(d_src, d_dst, M, size1, interpolation);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -393,7 +387,7 @@ PERFTEST(WarpPerspective)
|
|||||||
///////////// resize ////////////////////////
|
///////////// resize ////////////////////////
|
||||||
PERFTEST(resize)
|
PERFTEST(resize)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
|
|
||||||
@ -420,9 +414,6 @@ PERFTEST(resize)
|
|||||||
ocl::resize(d_src, d_dst, Size(), 2.0, 2.0);
|
ocl::resize(d_src, d_dst, Size(), 2.0, 2.0);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), 1.0));
|
|
||||||
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::resize(d_src, d_dst, Size(), 2.0, 2.0);
|
ocl::resize(d_src, d_dst, Size(), 2.0, 2.0);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -430,8 +421,10 @@ PERFTEST(resize)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::resize(d_src, d_dst, Size(), 2.0, 2.0);
|
ocl::resize(d_src, d_dst, Size(), 2.0, 2.0);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -456,8 +449,6 @@ PERFTEST(resize)
|
|||||||
ocl::resize(d_src, d_dst, Size(), 0.5, 0.5);
|
ocl::resize(d_src, d_dst, Size(), 0.5, 0.5);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), 1.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::resize(d_src, d_dst, Size(), 0.5, 0.5);
|
ocl::resize(d_src, d_dst, Size(), 0.5, 0.5);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -465,8 +456,10 @@ PERFTEST(resize)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::resize(d_src, d_dst, Size(), 0.5, 0.5);
|
ocl::resize(d_src, d_dst, Size(), 0.5, 0.5);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -474,10 +467,9 @@ PERFTEST(resize)
|
|||||||
///////////// threshold////////////////////////
|
///////////// threshold////////////////////////
|
||||||
PERFTEST(threshold)
|
PERFTEST(threshold)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
|
|
||||||
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
||||||
{
|
{
|
||||||
SUBTEST << size << 'x' << size << "; 8UC1; THRESH_BINARY";
|
SUBTEST << size << 'x' << size << "; 8UC1; THRESH_BINARY";
|
||||||
@ -496,9 +488,6 @@ PERFTEST(threshold)
|
|||||||
ocl::threshold(d_src, d_dst, 50.0, 0.0, THRESH_BINARY);
|
ocl::threshold(d_src, d_dst, 50.0, 0.0, THRESH_BINARY);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), 1.0));
|
|
||||||
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::threshold(d_src, d_dst, 50.0, 0.0, THRESH_BINARY);
|
ocl::threshold(d_src, d_dst, 50.0, 0.0, THRESH_BINARY);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -506,9 +495,10 @@ PERFTEST(threshold)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::threshold(d_src, d_dst, 50.0, 0.0, THRESH_BINARY);
|
ocl::threshold(d_src, d_dst, 50.0, 0.0, THRESH_BINARY);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
||||||
@ -529,8 +519,6 @@ PERFTEST(threshold)
|
|||||||
ocl::threshold(d_src, d_dst, 50.0, 0.0, THRESH_TRUNC);
|
ocl::threshold(d_src, d_dst, 50.0, 0.0, THRESH_TRUNC);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), 1.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::threshold(d_src, d_dst, 50.0, 0.0, THRESH_TRUNC);
|
ocl::threshold(d_src, d_dst, 50.0, 0.0, THRESH_TRUNC);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -538,8 +526,10 @@ PERFTEST(threshold)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::threshold(d_src, d_dst, 50.0, 0.0, THRESH_TRUNC);
|
ocl::threshold(d_src, d_dst, 50.0, 0.0, THRESH_TRUNC);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
///////////// meanShiftFiltering////////////////////////
|
///////////// meanShiftFiltering////////////////////////
|
||||||
@ -726,7 +716,7 @@ void meanShiftFiltering_(const Mat &src_roi, Mat &dst_roi, int sp, int sr, cv::T
|
|||||||
PERFTEST(meanShiftFiltering)
|
PERFTEST(meanShiftFiltering)
|
||||||
{
|
{
|
||||||
int sp = 5, sr = 6;
|
int sp = 5, sr = 6;
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
|
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
@ -753,11 +743,6 @@ PERFTEST(meanShiftFiltering)
|
|||||||
ocl::meanShiftFiltering(d_src, d_dst, sp, sr, crit);
|
ocl::meanShiftFiltering(d_src, d_dst, sp, sr, crit);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
cv::Mat ocl_mat;
|
|
||||||
d_dst.download(ocl_mat);
|
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, ocl_mat, 0.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::meanShiftFiltering(d_src, d_dst, sp, sr);
|
ocl::meanShiftFiltering(d_src, d_dst, sp, sr);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -765,8 +750,10 @@ PERFTEST(meanShiftFiltering)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::meanShiftFiltering(d_src, d_dst, sp, sr);
|
ocl::meanShiftFiltering(d_src, d_dst, sp, sr);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
///////////// meanShiftProc////////////////////////
|
///////////// meanShiftProc////////////////////////
|
||||||
@ -1010,8 +997,9 @@ void meanShiftProc_(const Mat &src_roi, Mat &dst_roi, Mat &dstCoor_roi, int sp,
|
|||||||
}
|
}
|
||||||
PERFTEST(meanShiftProc)
|
PERFTEST(meanShiftProc)
|
||||||
{
|
{
|
||||||
Mat src, dst, dstCoor_roi;
|
Mat src;
|
||||||
ocl::oclMat d_src, d_dst, d_dstCoor_roi;
|
vector<Mat> dst(2), ocl_dst(2);
|
||||||
|
ocl::oclMat d_src, d_dst, d_dstCoor;
|
||||||
|
|
||||||
TermCriteria crit(TermCriteria::COUNT + TermCriteria::EPS, 5, 1);
|
TermCriteria crit(TermCriteria::COUNT + TermCriteria::EPS, 5, 1);
|
||||||
|
|
||||||
@ -1020,42 +1008,41 @@ PERFTEST(meanShiftProc)
|
|||||||
SUBTEST << size << 'x' << size << "; 8UC4 and CV_16SC2 ";
|
SUBTEST << size << 'x' << size << "; 8UC4 and CV_16SC2 ";
|
||||||
|
|
||||||
gen(src, size, size, CV_8UC4, Scalar::all(0), Scalar::all(256));
|
gen(src, size, size, CV_8UC4, Scalar::all(0), Scalar::all(256));
|
||||||
gen(dst, size, size, CV_8UC4, Scalar::all(0), Scalar::all(256));
|
gen(dst[0], size, size, CV_8UC4, Scalar::all(0), Scalar::all(256));
|
||||||
gen(dstCoor_roi, size, size, CV_16SC2, Scalar::all(0), Scalar::all(256));
|
gen(dst[1], size, size, CV_16SC2, Scalar::all(0), Scalar::all(256));
|
||||||
|
|
||||||
meanShiftProc_(src, dst, dstCoor_roi, 5, 6, crit);
|
meanShiftProc_(src, dst[0], dst[1], 5, 6, crit);
|
||||||
|
|
||||||
CPU_ON;
|
CPU_ON;
|
||||||
meanShiftProc_(src, dst, dstCoor_roi, 5, 6, crit);
|
meanShiftProc_(src, dst[0], dst[1], 5, 6, crit);
|
||||||
CPU_OFF;
|
CPU_OFF;
|
||||||
|
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
|
|
||||||
WARMUP_ON;
|
WARMUP_ON;
|
||||||
ocl::meanShiftProc(d_src, d_dst, d_dstCoor_roi, 5, 6, crit);
|
ocl::meanShiftProc(d_src, d_dst, d_dstCoor, 5, 6, crit);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dstCoor_roi, cv::Mat(d_dstCoor_roi), 0.0)
|
|
||||||
&&ExpectedMatNear(dst, cv::Mat(d_dst), 0.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::meanShiftProc(d_src, d_dst, d_dstCoor_roi, 5, 6, crit);
|
ocl::meanShiftProc(d_src, d_dst, d_dstCoor, 5, 6, crit);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
|
|
||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::meanShiftProc(d_src, d_dst, d_dstCoor_roi, 5, 6, crit);
|
ocl::meanShiftProc(d_src, d_dst, d_dstCoor, 5, 6, crit);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst[0]);
|
||||||
d_dstCoor_roi.download(dstCoor_roi);
|
d_dstCoor.download(ocl_dst[1]);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
vector<double> eps(2, 0.);
|
||||||
|
TestSystem::instance().ExpectMatsNear(dst, ocl_dst, eps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////// remap////////////////////////
|
///////////// remap////////////////////////
|
||||||
PERFTEST(remap)
|
PERFTEST(remap)
|
||||||
{
|
{
|
||||||
Mat src, dst, xmap, ymap;
|
Mat src, dst, xmap, ymap, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst, d_xmap, d_ymap;
|
ocl::oclMat d_src, d_dst, d_xmap, d_ymap;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_8UC4};
|
int all_type[] = {CV_8UC1, CV_8UC4};
|
||||||
@ -1088,7 +1075,6 @@ PERFTEST(remap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
remap(src, dst, xmap, ymap, interpolation, borderMode);
|
remap(src, dst, xmap, ymap, interpolation, borderMode);
|
||||||
|
|
||||||
CPU_ON;
|
CPU_ON;
|
||||||
@ -1104,12 +1090,6 @@ PERFTEST(remap)
|
|||||||
ocl::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);
|
ocl::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
if(interpolation == 0)
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), 1.0));
|
|
||||||
else
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), 2.0));
|
|
||||||
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);
|
ocl::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -1117,8 +1097,10 @@ PERFTEST(remap)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);
|
ocl::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -56,11 +56,9 @@
|
|||||||
PERFTEST(matchTemplate)
|
PERFTEST(matchTemplate)
|
||||||
{
|
{
|
||||||
//InitMatchTemplate();
|
//InitMatchTemplate();
|
||||||
|
Mat src, templ, dst, ocl_dst;
|
||||||
Mat src, templ, dst;
|
|
||||||
int templ_size = 5;
|
int templ_size = 5;
|
||||||
|
|
||||||
|
|
||||||
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
||||||
{
|
{
|
||||||
int all_type[] = {CV_32FC1, CV_32FC4};
|
int all_type[] = {CV_32FC1, CV_32FC4};
|
||||||
@ -82,16 +80,12 @@ PERFTEST(matchTemplate)
|
|||||||
matchTemplate(src, templ, dst, CV_TM_CCORR);
|
matchTemplate(src, templ, dst, CV_TM_CCORR);
|
||||||
CPU_OFF;
|
CPU_OFF;
|
||||||
|
|
||||||
ocl::oclMat d_src(src), d_templ, d_dst;
|
ocl::oclMat d_src(src), d_templ(templ), d_dst;
|
||||||
|
|
||||||
d_templ.upload(templ);
|
|
||||||
|
|
||||||
WARMUP_ON;
|
WARMUP_ON;
|
||||||
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR);
|
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), templ.rows * templ.cols * 1e-1));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR);
|
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -100,8 +94,10 @@ PERFTEST(matchTemplate)
|
|||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
d_templ.upload(templ);
|
d_templ.upload(templ);
|
||||||
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR);
|
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, templ.rows * templ.cols * 1e-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,8 +127,6 @@ PERFTEST(matchTemplate)
|
|||||||
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR_NORMED);
|
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR_NORMED);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), templ.rows * templ.cols * 1e-1));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR_NORMED);
|
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR_NORMED);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -141,8 +135,10 @@ PERFTEST(matchTemplate)
|
|||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
d_templ.upload(templ);
|
d_templ.upload(templ);
|
||||||
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR_NORMED);
|
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR_NORMED);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, templ.rows * templ.cols * 1e-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
///////////// ConvertTo////////////////////////
|
///////////// ConvertTo////////////////////////
|
||||||
PERFTEST(ConvertTo)
|
PERFTEST(ConvertTo)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_8UC4};
|
int all_type[] = {CV_8UC1, CV_8UC4};
|
||||||
@ -77,9 +77,6 @@ PERFTEST(ConvertTo)
|
|||||||
d_src.convertTo(d_dst, CV_32FC1);
|
d_src.convertTo(d_dst, CV_32FC1);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), 0.0));
|
|
||||||
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
d_src.convertTo(d_dst, CV_32FC1);
|
d_src.convertTo(d_dst, CV_32FC1);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -87,8 +84,10 @@ PERFTEST(ConvertTo)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
d_src.convertTo(d_dst, CV_32FC1);
|
d_src.convertTo(d_dst, CV_32FC1);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -96,7 +95,7 @@ PERFTEST(ConvertTo)
|
|||||||
///////////// copyTo////////////////////////
|
///////////// copyTo////////////////////////
|
||||||
PERFTEST(copyTo)
|
PERFTEST(copyTo)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src, d_dst;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_8UC4};
|
int all_type[] = {CV_8UC1, CV_8UC4};
|
||||||
@ -125,9 +124,6 @@ PERFTEST(copyTo)
|
|||||||
d_src.copyTo(d_dst);
|
d_src.copyTo(d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), 0.0));
|
|
||||||
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
d_src.copyTo(d_dst);
|
d_src.copyTo(d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -135,8 +131,10 @@ PERFTEST(copyTo)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
d_src.copyTo(d_dst);
|
d_src.copyTo(d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -144,9 +142,9 @@ PERFTEST(copyTo)
|
|||||||
///////////// setTo////////////////////////
|
///////////// setTo////////////////////////
|
||||||
PERFTEST(setTo)
|
PERFTEST(setTo)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, ocl_src;
|
||||||
Scalar val(1, 2, 3, 4);
|
Scalar val(1, 2, 3, 4);
|
||||||
ocl::oclMat d_src, d_dst;
|
ocl::oclMat d_src;
|
||||||
|
|
||||||
int all_type[] = {CV_8UC1, CV_8UC4};
|
int all_type[] = {CV_8UC1, CV_8UC4};
|
||||||
std::string type_name[] = {"CV_8UC1", "CV_8UC4"};
|
std::string type_name[] = {"CV_8UC1", "CV_8UC4"};
|
||||||
@ -171,10 +169,10 @@ PERFTEST(setTo)
|
|||||||
d_src.setTo(val);
|
d_src.setTo(val);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(src, cv::Mat(d_src), 1.0));
|
d_src.download(ocl_src);
|
||||||
|
TestSystem::instance().ExpectedMatNear(src, ocl_src, 1.0);
|
||||||
|
|
||||||
|
GPU_ON;;
|
||||||
GPU_ON;
|
|
||||||
d_src.setTo(val);
|
d_src.setTo(val);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
|
|
||||||
|
@ -48,39 +48,40 @@
|
|||||||
///////////// norm////////////////////////
|
///////////// norm////////////////////////
|
||||||
PERFTEST(norm)
|
PERFTEST(norm)
|
||||||
{
|
{
|
||||||
Mat src, buf;
|
Mat src1, src2, ocl_src1;
|
||||||
ocl::oclMat d_src, d_buf;
|
ocl::oclMat d_src1, d_src2;
|
||||||
|
|
||||||
|
|
||||||
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
|
||||||
{
|
{
|
||||||
SUBTEST << size << 'x' << size << "; CV_8UC1; NORM_INF";
|
SUBTEST << size << 'x' << size << "; CV_8UC1; NORM_INF";
|
||||||
|
|
||||||
gen(src, size, size, CV_8UC1, Scalar::all(0), Scalar::all(1));
|
gen(src1, size, size, CV_8UC1, Scalar::all(0), Scalar::all(1));
|
||||||
gen(buf, size, size, CV_8UC1, Scalar::all(0), Scalar::all(1));
|
gen(src2, size, size, CV_8UC1, Scalar::all(0), Scalar::all(1));
|
||||||
|
|
||||||
norm(src, NORM_INF);
|
norm(src1, src2, NORM_INF);
|
||||||
|
|
||||||
CPU_ON;
|
CPU_ON;
|
||||||
norm(src, NORM_INF);
|
norm(src1, src2, NORM_INF);
|
||||||
CPU_OFF;
|
CPU_OFF;
|
||||||
|
|
||||||
d_src.upload(src);
|
d_src1.upload(src1);
|
||||||
d_buf.upload(buf);
|
d_src2.upload(src2);
|
||||||
|
|
||||||
WARMUP_ON;
|
WARMUP_ON;
|
||||||
ocl::norm(d_src, d_buf, NORM_INF);
|
ocl::norm(d_src1, d_src2, NORM_INF);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(src, cv::Mat(d_buf), .5));
|
d_src1.download(ocl_src1);
|
||||||
|
TestSystem::instance().ExpectedMatNear(src1, ocl_src1, .5);
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::norm(d_src, d_buf, NORM_INF);
|
ocl::norm(d_src1, d_src2, NORM_INF);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
|
|
||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src1.upload(src1);
|
||||||
ocl::norm(d_src, d_buf, NORM_INF);
|
d_src2.upload(src2);
|
||||||
|
ocl::norm(d_src1, d_src2, NORM_INF);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -48,7 +48,7 @@
|
|||||||
///////////// pyrDown //////////////////////
|
///////////// pyrDown //////////////////////
|
||||||
PERFTEST(pyrDown)
|
PERFTEST(pyrDown)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
int all_type[] = {CV_8UC1, CV_8UC4};
|
int all_type[] = {CV_8UC1, CV_8UC4};
|
||||||
std::string type_name[] = {"CV_8UC1", "CV_8UC4"};
|
std::string type_name[] = {"CV_8UC1", "CV_8UC4"};
|
||||||
|
|
||||||
@ -73,9 +73,6 @@ PERFTEST(pyrDown)
|
|||||||
ocl::pyrDown(d_src, d_dst);
|
ocl::pyrDown(d_src, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), dst.depth() == CV_32F ? 1e-4f : 1.0f));
|
|
||||||
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::pyrDown(d_src, d_dst);
|
ocl::pyrDown(d_src, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -83,8 +80,10 @@ PERFTEST(pyrDown)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::pyrDown(d_src, d_dst);
|
ocl::pyrDown(d_src, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, dst.depth() == CV_32F ? 1e-4f : 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -82,8 +82,8 @@ PERFTEST(PyrLKOpticalFlow)
|
|||||||
SUBTEST << frame0.cols << "x" << frame0.rows << "; color; " << points << " points";
|
SUBTEST << frame0.cols << "x" << frame0.rows << "; color; " << points << " points";
|
||||||
else
|
else
|
||||||
SUBTEST << frame0.cols << "x" << frame0.rows << "; gray; " << points << " points";
|
SUBTEST << frame0.cols << "x" << frame0.rows << "; gray; " << points << " points";
|
||||||
Mat nextPts_cpu;
|
Mat ocl_nextPts;
|
||||||
Mat status_cpu;
|
Mat ocl_status;
|
||||||
|
|
||||||
vector<Point2f> pts;
|
vector<Point2f> pts;
|
||||||
goodFeaturesToTrack(i == 0 ? gray_frame : frame0, pts, points, 0.01, 0.0);
|
goodFeaturesToTrack(i == 0 ? gray_frame : frame0, pts, points, 0.01, 0.0);
|
||||||
@ -116,12 +116,6 @@ PERFTEST(PyrLKOpticalFlow)
|
|||||||
d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_status, &d_err);
|
d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_status, &d_err);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
std::vector<cv::Point2f> ocl_nextPts(d_nextPts.cols);
|
|
||||||
std::vector<unsigned char> ocl_status(d_status.cols);
|
|
||||||
TestSystem::instance().setAccurate(AssertEQ<size_t>(nextPts.size(), ocl_nextPts.size()));
|
|
||||||
TestSystem::instance().setAccurate(AssertEQ<size_t>(status.size(), ocl_status.size()));
|
|
||||||
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_status, &d_err);
|
d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_status, &d_err);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -133,16 +127,31 @@ PERFTEST(PyrLKOpticalFlow)
|
|||||||
d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_status, &d_err);
|
d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_status, &d_err);
|
||||||
|
|
||||||
if (!d_nextPts.empty())
|
if (!d_nextPts.empty())
|
||||||
{
|
d_nextPts.download(ocl_nextPts);
|
||||||
d_nextPts.download(nextPts_cpu);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!d_status.empty())
|
if (!d_status.empty())
|
||||||
{
|
d_status.download(ocl_status);
|
||||||
d_status.download(status_cpu);
|
|
||||||
}
|
|
||||||
|
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
size_t mismatch = 0;
|
||||||
|
for (int i = 0; i < (int)nextPts.size(); ++i)
|
||||||
|
{
|
||||||
|
if(status[i] != ocl_status.at<unsigned char>(0, i)){
|
||||||
|
mismatch++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(status[i]){
|
||||||
|
Point2f gpu_rst = ocl_nextPts.at<Point2f>(0, i);
|
||||||
|
Point2f cpu_rst = nextPts[i];
|
||||||
|
if(fabs(gpu_rst.x - cpu_rst.x) >= 1. || fabs(gpu_rst.y - cpu_rst.y) >= 1.)
|
||||||
|
mismatch++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double ratio = (double)mismatch / (double)nextPts.size();
|
||||||
|
if(ratio < .02)
|
||||||
|
TestSystem::instance().setAccurate(1, ratio);
|
||||||
|
else
|
||||||
|
TestSystem::instance().setAccurate(0, ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
///////////// pyrUp ////////////////////////
|
///////////// pyrUp ////////////////////////
|
||||||
PERFTEST(pyrUp)
|
PERFTEST(pyrUp)
|
||||||
{
|
{
|
||||||
Mat src, dst;
|
Mat src, dst, ocl_dst;
|
||||||
int all_type[] = {CV_8UC1, CV_8UC4};
|
int all_type[] = {CV_8UC1, CV_8UC4};
|
||||||
std::string type_name[] = {"CV_8UC1", "CV_8UC4"};
|
std::string type_name[] = {"CV_8UC1", "CV_8UC4"};
|
||||||
|
|
||||||
@ -73,8 +73,6 @@ PERFTEST(pyrUp)
|
|||||||
ocl::pyrUp(d_src, d_dst);
|
ocl::pyrUp(d_src, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(dst, cv::Mat(d_dst), (src.depth() == CV_32F ? 1e-4f : 1.0)));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::pyrUp(d_src, d_dst);
|
ocl::pyrUp(d_src, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -82,8 +80,10 @@ PERFTEST(pyrUp)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::pyrUp(d_src, d_dst);
|
ocl::pyrUp(d_src, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, (src.depth() == CV_32F ? 1e-4f : 1.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -48,7 +48,7 @@
|
|||||||
///////////// Merge////////////////////////
|
///////////// Merge////////////////////////
|
||||||
PERFTEST(Merge)
|
PERFTEST(Merge)
|
||||||
{
|
{
|
||||||
Mat dst;
|
Mat dst, ocl_dst;
|
||||||
ocl::oclMat d_dst;
|
ocl::oclMat d_dst;
|
||||||
|
|
||||||
int channels = 4;
|
int channels = 4;
|
||||||
@ -85,22 +85,20 @@ PERFTEST(Merge)
|
|||||||
ocl::merge(d_src, d_dst);
|
ocl::merge(d_src, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
TestSystem::instance().setAccurate(ExpectedMatNear(cv::Mat(dst), cv::Mat(d_dst), 0.0));
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::merge(d_src, d_dst);
|
ocl::merge(d_src, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
|
|
||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
|
|
||||||
for (int i = 0; i < channels; ++i)
|
for (int i = 0; i < channels; ++i)
|
||||||
{
|
{
|
||||||
d_src[i] = ocl::oclMat(size1, CV_8U, cv::Scalar::all(i));
|
d_src[i] = ocl::oclMat(size1, all_type[j], cv::Scalar::all(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
ocl::merge(d_src, d_dst);
|
ocl::merge(d_src, d_dst);
|
||||||
d_dst.download(dst);
|
d_dst.download(ocl_dst);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
TestSystem::instance().ExpectedMatNear(dst, ocl_dst, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -122,7 +120,7 @@ PERFTEST(Split)
|
|||||||
|
|
||||||
Mat src(size1, CV_MAKE_TYPE(all_type[j], 4), cv::Scalar(1, 2, 3, 4));
|
Mat src(size1, CV_MAKE_TYPE(all_type[j], 4), cv::Scalar(1, 2, 3, 4));
|
||||||
|
|
||||||
std::vector<cv::Mat> dst;
|
std::vector<cv::Mat> dst, ocl_dst(4);
|
||||||
|
|
||||||
split(src, dst);
|
split(src, dst);
|
||||||
|
|
||||||
@ -137,21 +135,6 @@ PERFTEST(Split)
|
|||||||
ocl::split(d_src, d_dst);
|
ocl::split(d_src, d_dst);
|
||||||
WARMUP_OFF;
|
WARMUP_OFF;
|
||||||
|
|
||||||
if(d_dst.size() == dst.size())
|
|
||||||
{
|
|
||||||
TestSystem::instance().setAccurate(1);
|
|
||||||
for(size_t i = 0; i < dst.size(); i++)
|
|
||||||
{
|
|
||||||
if(ExpectedMatNear(dst[i], cv::Mat(d_dst[i]), 0.0) == 0)
|
|
||||||
{
|
|
||||||
TestSystem::instance().setAccurate(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else
|
|
||||||
TestSystem::instance().setAccurate(0);
|
|
||||||
|
|
||||||
|
|
||||||
GPU_ON;
|
GPU_ON;
|
||||||
ocl::split(d_src, d_dst);
|
ocl::split(d_src, d_dst);
|
||||||
GPU_OFF;
|
GPU_OFF;
|
||||||
@ -159,7 +142,12 @@ PERFTEST(Split)
|
|||||||
GPU_FULL_ON;
|
GPU_FULL_ON;
|
||||||
d_src.upload(src);
|
d_src.upload(src);
|
||||||
ocl::split(d_src, d_dst);
|
ocl::split(d_src, d_dst);
|
||||||
|
for(size_t i = 0; i < dst.size(); i++)
|
||||||
|
d_dst[i].download(ocl_dst[i]);
|
||||||
GPU_FULL_OFF;
|
GPU_FULL_OFF;
|
||||||
|
|
||||||
|
vector<double> eps(4, 0.);
|
||||||
|
TestSystem::instance().ExpectMatsNear(dst, ocl_dst, eps);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,6 @@ void TestSystem::finishCurrentSubtest()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_accurate = is_accurate_;
|
|
||||||
double cpu_time = cpu_elapsed_ / getTickFrequency() * 1000.0;
|
double cpu_time = cpu_elapsed_ / getTickFrequency() * 1000.0;
|
||||||
double gpu_time = gpu_elapsed_ / getTickFrequency() * 1000.0;
|
double gpu_time = gpu_elapsed_ / getTickFrequency() * 1000.0;
|
||||||
double gpu_full_time = gpu_full_elapsed_ / getTickFrequency() * 1000.0;
|
double gpu_full_time = gpu_full_elapsed_ / getTickFrequency() * 1000.0;
|
||||||
@ -171,8 +170,8 @@ void TestSystem::finishCurrentSubtest()
|
|||||||
deviation = std::sqrt(sum / gpu_times_.size());
|
deviation = std::sqrt(sum / gpu_times_.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
printMetrics(is_accurate, cpu_time, gpu_time, gpu_full_time, speedup, fullspeedup);
|
printMetrics(is_accurate_, cpu_time, gpu_time, gpu_full_time, speedup, fullspeedup);
|
||||||
writeMetrics(is_accurate, cpu_time, gpu_time, gpu_full_time, speedup, fullspeedup, gpu_min, gpu_max, deviation);
|
writeMetrics(cpu_time, gpu_time, gpu_full_time, speedup, fullspeedup, gpu_min, gpu_max, deviation);
|
||||||
|
|
||||||
num_subtests_called_++;
|
num_subtests_called_++;
|
||||||
resetCurrentSubtest();
|
resetCurrentSubtest();
|
||||||
@ -219,7 +218,7 @@ void TestSystem::writeHeading()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(record_, "NAME,DESCRIPTION,ACCURACY,CPU (ms),GPU (ms),SPEEDUP,GPUTOTAL (ms),TOTALSPEEDUP,GPU Min (ms),GPU Max (ms), Standard deviation (ms)\n");
|
fprintf(record_, "NAME,DESCRIPTION,ACCURACY,DIFFERENCE,CPU (ms),GPU (ms),SPEEDUP,GPUTOTAL (ms),TOTALSPEEDUP,GPU Min (ms),GPU Max (ms), Standard deviation (ms)\n");
|
||||||
|
|
||||||
fflush(record_);
|
fflush(record_);
|
||||||
}
|
}
|
||||||
@ -392,7 +391,7 @@ void TestSystem::printMetrics(int is_accurate, double cpu_time, double gpu_time,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestSystem::writeMetrics(int is_accurate, double cpu_time, double gpu_time, double gpu_full_time, double speedup, double fullspeedup, double gpu_min, double gpu_max, double std_dev)
|
void TestSystem::writeMetrics(double cpu_time, double gpu_time, double gpu_full_time, double speedup, double fullspeedup, double gpu_min, double gpu_max, double std_dev)
|
||||||
{
|
{
|
||||||
if (!record_)
|
if (!record_)
|
||||||
{
|
{
|
||||||
@ -402,21 +401,24 @@ void TestSystem::writeMetrics(int is_accurate, double cpu_time, double gpu_time,
|
|||||||
|
|
||||||
string _is_accurate_;
|
string _is_accurate_;
|
||||||
|
|
||||||
if(is_accurate == 1)
|
if(is_accurate_ == 1)
|
||||||
_is_accurate_ = "Pass";
|
_is_accurate_ = "Pass";
|
||||||
else if(is_accurate == 0)
|
else if(is_accurate_ == 0)
|
||||||
_is_accurate_ = "Fail";
|
_is_accurate_ = "Fail";
|
||||||
else if(is_accurate == -1)
|
else if(is_accurate_ == -1)
|
||||||
_is_accurate_ = " ";
|
_is_accurate_ = " ";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout<<"is_accurate errer: "<<is_accurate<<"\n";
|
std::cout<<"is_accurate errer: "<<is_accurate_<<"\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(record_, "%s,%s,%s,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\n", itname_changed_ ? itname_.c_str() : "",
|
fprintf(record_, "%s,%s,%s,%.2f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\n",
|
||||||
|
itname_changed_ ? itname_.c_str() : "",
|
||||||
cur_subtest_description_.str().c_str(),
|
cur_subtest_description_.str().c_str(),
|
||||||
_is_accurate_.c_str(), cpu_time, gpu_time, speedup, gpu_full_time, fullspeedup,
|
_is_accurate_.c_str(),
|
||||||
|
accurate_diff_,
|
||||||
|
cpu_time, gpu_time, speedup, gpu_full_time, fullspeedup,
|
||||||
gpu_min, gpu_max, std_dev);
|
gpu_min, gpu_max, std_dev);
|
||||||
|
|
||||||
if (itname_changed_)
|
if (itname_changed_)
|
||||||
@ -629,7 +631,7 @@ double checkSimilarity(const Mat &m1, const Mat &m2)
|
|||||||
return std::abs(diff.at<float>(0, 0) - 1.f);
|
return std::abs(diff.at<float>(0, 0) - 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
int ExpectedMatNear(cv::Mat dst, cv::Mat cpu_dst, double eps)
|
int ExpectedMatNear(cv::Mat dst, cv::Mat cpu_dst, double eps)
|
||||||
{
|
{
|
||||||
assert(dst.type() == cpu_dst.type());
|
assert(dst.type() == cpu_dst.type());
|
||||||
@ -647,7 +649,7 @@ int ExceptDoubleNear(double val1, double val2, double abs_error)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
int ExceptedMatSimilar(cv::Mat dst, cv::Mat cpu_dst, double eps)
|
int ExceptedMatSimilar(cv::Mat dst, cv::Mat cpu_dst, double eps)
|
||||||
{
|
{
|
||||||
assert(dst.type() == cpu_dst.type());
|
assert(dst.type() == cpu_dst.type());
|
||||||
@ -656,6 +658,7 @@ int ExceptedMatSimilar(cv::Mat dst, cv::Mat cpu_dst, double eps)
|
|||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -313,9 +313,46 @@ public:
|
|||||||
itname_changed_ = true;
|
itname_changed_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAccurate(int is_accurate = -1)
|
void setAccurate(int accurate, double diff)
|
||||||
{
|
{
|
||||||
is_accurate_ = is_accurate;
|
is_accurate_ = accurate;
|
||||||
|
accurate_diff_ = diff;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExpectMatsNear(vector<Mat>& dst, vector<Mat>& cpu_dst, vector<double>& eps)
|
||||||
|
{
|
||||||
|
assert(dst.size() == cpu_dst.size());
|
||||||
|
assert(cpu_dst.size() == eps.size());
|
||||||
|
is_accurate_ = 1;
|
||||||
|
for(size_t i=0; i<dst.size(); i++)
|
||||||
|
{
|
||||||
|
double cur_diff = checkNorm(dst[i], cpu_dst[i]);
|
||||||
|
accurate_diff_ = max(accurate_diff_, cur_diff);
|
||||||
|
if(cur_diff > eps[i])
|
||||||
|
is_accurate_ = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExpectedMatNear(cv::Mat& dst, cv::Mat& cpu_dst, double eps)
|
||||||
|
{
|
||||||
|
assert(dst.type() == cpu_dst.type());
|
||||||
|
assert(dst.size() == cpu_dst.size());
|
||||||
|
accurate_diff_ = checkNorm(dst, cpu_dst);
|
||||||
|
if(accurate_diff_ <= eps)
|
||||||
|
is_accurate_ = 1;
|
||||||
|
else
|
||||||
|
is_accurate_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExceptedMatSimilar(cv::Mat& dst, cv::Mat& cpu_dst, double eps)
|
||||||
|
{
|
||||||
|
assert(dst.type() == cpu_dst.type());
|
||||||
|
assert(dst.size() == cpu_dst.size());
|
||||||
|
accurate_diff_ = checkSimilarity(cpu_dst, dst);
|
||||||
|
if(accurate_diff_ <= eps)
|
||||||
|
is_accurate_ = 1;
|
||||||
|
else
|
||||||
|
is_accurate_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::stringstream &getCurSubtestDescription()
|
std::stringstream &getCurSubtestDescription()
|
||||||
@ -333,7 +370,7 @@ private:
|
|||||||
num_iters_(10), cpu_num_iters_(2),
|
num_iters_(10), cpu_num_iters_(2),
|
||||||
gpu_warmup_iters_(1), cur_iter_idx_(0), cur_warmup_idx_(0),
|
gpu_warmup_iters_(1), cur_iter_idx_(0), cur_warmup_idx_(0),
|
||||||
record_(0), recordname_("performance"), itname_changed_(true),
|
record_(0), recordname_("performance"), itname_changed_(true),
|
||||||
is_accurate_(-1)
|
is_accurate_(-1), accurate_diff_(0.)
|
||||||
{
|
{
|
||||||
cpu_times_.reserve(num_iters_);
|
cpu_times_.reserve(num_iters_);
|
||||||
gpu_times_.reserve(num_iters_);
|
gpu_times_.reserve(num_iters_);
|
||||||
@ -354,6 +391,7 @@ private:
|
|||||||
gpu_times_.clear();
|
gpu_times_.clear();
|
||||||
gpu_full_times_.clear();
|
gpu_full_times_.clear();
|
||||||
is_accurate_ = -1;
|
is_accurate_ = -1;
|
||||||
|
accurate_diff_ = 0.;
|
||||||
}
|
}
|
||||||
|
|
||||||
double meanTime(const std::vector<int64> &samples);
|
double meanTime(const std::vector<int64> &samples);
|
||||||
@ -364,7 +402,7 @@ private:
|
|||||||
|
|
||||||
void writeHeading();
|
void writeHeading();
|
||||||
void writeSummary();
|
void writeSummary();
|
||||||
void writeMetrics(int is_accurate, double cpu_time, double gpu_time = 0.0f, double gpu_full_time = 0.0f,
|
void writeMetrics(double cpu_time, double gpu_time = 0.0f, double gpu_full_time = 0.0f,
|
||||||
double speedup = 0.0f, double fullspeedup = 0.0f,
|
double speedup = 0.0f, double fullspeedup = 0.0f,
|
||||||
double gpu_min = 0.0f, double gpu_max = 0.0f, double std_dev = 0.0f);
|
double gpu_min = 0.0f, double gpu_max = 0.0f, double std_dev = 0.0f);
|
||||||
|
|
||||||
@ -416,6 +454,7 @@ private:
|
|||||||
bool itname_changed_;
|
bool itname_changed_;
|
||||||
|
|
||||||
int is_accurate_;
|
int is_accurate_;
|
||||||
|
double accurate_diff_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user