Commit 1b6639aa authored by yao's avatar yao

A little optimization on ocl/pyrdown, ocl/canny

parent 907a9101
......@@ -66,7 +66,7 @@ namespace cv
}
}
cv::ocl::CannyBuf::CannyBuf(const oclMat& dx_, const oclMat& dy_) : dx(dx_), dy(dy_)
cv::ocl::CannyBuf::CannyBuf(const oclMat& dx_, const oclMat& dy_) : dx(dx_), dy(dy_), counter(NULL)
{
CV_Assert(dx_.type() == CV_32SC1 && dy_.type() == CV_32SC1 && dx_.size() == dy_.size());
......@@ -102,6 +102,10 @@ void cv::ocl::CannyBuf::create(const Size& image_size, int apperture_size)
float counter_f [1] = { 0 };
int err = 0;
if(counter)
{
openCLFree(counter);
}
counter = clCreateBuffer( Context::getContext()->impl->clContext, CL_MEM_COPY_HOST_PTR, sizeof(float), counter_f, &err );
openCLSafeCall(err);
}
......@@ -322,15 +326,11 @@ void canny::calcMap_gpu(oclMat& dx, oclMat& dy, oclMat& mag, oclMat& map, int ro
args.push_back( make_pair( sizeof(cl_int), (void *)&map.step));
args.push_back( make_pair( sizeof(cl_int), (void *)&map.offset));
#if CALCMAP_FIXED
size_t globalThreads[3] = {cols, rows, 1};
string kernelName = "calcMap";
size_t localThreads[3] = {16, 16, 1};
#else
size_t globalThreads[3] = {cols, rows, 1};
string kernelName = "calcMap_2";
size_t localThreads[3] = {256, 1, 1};
#endif
openCLExecuteKernel(clCxt, &imgproc_canny, kernelName, globalThreads, localThreads, args, -1, -1);
}
......
This diff is collapsed.
......@@ -103,6 +103,6 @@ TEST_P(Canny, Accuracy)
EXPECT_MAT_SIMILAR(edges_gold, edges, 1e-2);
}
INSTANTIATE_TEST_CASE_P(ocl_ImgProc, Canny, testing::Combine(
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, Canny, testing::Combine(
testing::Values(AppertureSize(3), AppertureSize(5)),
testing::Values(L2gradient(false), L2gradient(true))));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment