Commit fd4a6f0a authored by yao's avatar yao

make the sparse method give correct results on CPU ocl

Add CL_CPU to supportsFeature check
simplify the logic of pyrlk
parent 656594ad
......@@ -155,7 +155,7 @@ namespace cv
static Context* getContext();
static void setContext(Info &oclinfo);
enum {CL_DOUBLE, CL_UNIFIED_MEM};
enum {CL_DOUBLE, CL_UNIFIED_MEM, CL_CPU};
bool supportsFeature(int ftype);
size_t computeUnits();
void* oclContext();
......
......@@ -979,6 +979,12 @@ namespace cv
return impl->double_support == 1;
case CL_UNIFIED_MEM:
return impl->unified_memory == 1;
case CL_CPU:
cl_device_type devicetype;
clGetDeviceInfo(impl->devices[impl->devnum],
CL_DEVICE_TYPE, sizeof(cl_device_type),
&devicetype, NULL);
return devicetype == CVCL_DEVICE_TYPE_CPU;
default:
return false;
}
......
......@@ -394,7 +394,7 @@ void cv::ocl::oclMat::convertTo( oclMat &dst, int rtype, double alpha, double be
if( rtype < 0 )
rtype = type();
else
rtype = CV_MAKETYPE(CV_MAT_DEPTH(rtype), channels());
rtype = CV_MAKETYPE(CV_MAT_DEPTH(rtype), oclchannels());
//int scn = channels();
int sdepth = depth(), ddepth = CV_MAT_DEPTH(rtype);
......
This diff is collapsed.
This diff is collapsed.
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