Commit fa11f04a authored by Andrey Pavlenko's avatar Andrey Pavlenko Committed by OpenCV Buildbot

Merge pull request #1605 from alalek:ocl_fixes

parents c0265c60 3b0823db
......@@ -55,20 +55,11 @@ namespace cv
{
namespace ocl
{
static const char noImage2dOption[] = "-D DISABLE_IMAGE2D";
static bool use_image2d = false;
static void openCLExecuteKernelSURF(Context *clCxt, const cv::ocl::ProgramEntry* source, string kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, int depth)
{
char optBuf [100] = {0};
char * optBufPtr = optBuf;
if( !use_image2d )
{
strcat(optBufPtr, noImage2dOption);
optBufPtr += strlen(noImage2dOption);
}
cl_kernel kernel;
kernel = openCLGetKernelFromSource(clCxt, source, kernelName, optBufPtr);
size_t wave_size = queryWaveFrontSize(kernel);
......@@ -149,13 +140,10 @@ public:
counters.setTo(Scalar::all(0));
integral(img, surf_.sum);
use_image2d = support_image2d();
if(use_image2d)
{
bindImgTex(img, imgTex);
bindImgTex(surf_.sum, sumTex);
finish();
}
bindImgTex(img, imgTex);
bindImgTex(surf_.sum, sumTex);
finish();
maskSumTex = 0;
......
......@@ -187,9 +187,9 @@ namespace cv
return Context::getContext()->getOpenCLCommandQueuePtr();
}
bool CV_EXPORTS supportsFeature(FEATURE_TYPE featureType);
CV_EXPORTS bool supportsFeature(FEATURE_TYPE featureType);
void CV_EXPORTS finish();
CV_EXPORTS void finish();
enum BINARY_CACHE_MODE
{
......@@ -1739,7 +1739,7 @@ namespace cv
// output -
// keys = {1, 2, 3} (CV_8UC1)
// values = {6,2, 10,5, 4,3} (CV_8UC2)
void CV_EXPORTS sortByKey(oclMat& keys, oclMat& values, int method, bool isGreaterThan = false);
CV_EXPORTS void sortByKey(oclMat& keys, oclMat& values, int method, bool isGreaterThan = false);
/*!Base class for MOG and MOG2!*/
class CV_EXPORTS BackgroundSubtractor
{
......@@ -1938,6 +1938,7 @@ namespace cv
private:
oclMat samples_ocl;
};
/*!*************** SVM *************!*/
class CV_EXPORTS CvSVM_OCL : public CvSVM
{
......@@ -1957,6 +1958,7 @@ namespace cv
void create_kernel();
void create_solver();
};
/*!*************** END *************!*/
}
}
......
......@@ -77,6 +77,8 @@ inline cl_command_queue getClCommandQueue(const Context *ctx)
return *(cl_command_queue*)(ctx->getOpenCLCommandQueuePtr());
}
CV_EXPORTS cv::Mutex& getInitializationMutex();
enum openCLMemcpyKind
{
clMemcpyHostToDevice = 0,
......@@ -84,39 +86,39 @@ enum openCLMemcpyKind
clMemcpyDeviceToDevice
};
///////////////////////////OpenCL call wrappers////////////////////////////
void CV_EXPORTS openCLMallocPitch(Context *clCxt, void **dev_ptr, size_t *pitch,
CV_EXPORTS void openCLMallocPitch(Context *clCxt, void **dev_ptr, size_t *pitch,
size_t widthInBytes, size_t height);
void CV_EXPORTS openCLMallocPitchEx(Context *clCxt, void **dev_ptr, size_t *pitch,
CV_EXPORTS void openCLMallocPitchEx(Context *clCxt, void **dev_ptr, size_t *pitch,
size_t widthInBytes, size_t height, DevMemRW rw_type, DevMemType mem_type);
void CV_EXPORTS openCLMemcpy2D(Context *clCxt, void *dst, size_t dpitch,
CV_EXPORTS void openCLMemcpy2D(Context *clCxt, void *dst, size_t dpitch,
const void *src, size_t spitch,
size_t width, size_t height, openCLMemcpyKind kind, int channels = -1);
void CV_EXPORTS openCLCopyBuffer2D(Context *clCxt, void *dst, size_t dpitch, int dst_offset,
CV_EXPORTS void openCLCopyBuffer2D(Context *clCxt, void *dst, size_t dpitch, int dst_offset,
const void *src, size_t spitch,
size_t width, size_t height, int src_offset);
void CV_EXPORTS openCLFree(void *devPtr);
cl_mem CV_EXPORTS openCLCreateBuffer(Context *clCxt, size_t flag, size_t size);
void CV_EXPORTS openCLReadBuffer(Context *clCxt, cl_mem dst_buffer, void *host_buffer, size_t size);
cl_kernel CV_EXPORTS openCLGetKernelFromSource(const Context *clCxt,
CV_EXPORTS void openCLFree(void *devPtr);
CV_EXPORTS cl_mem openCLCreateBuffer(Context *clCxt, size_t flag, size_t size);
CV_EXPORTS void openCLReadBuffer(Context *clCxt, cl_mem dst_buffer, void *host_buffer, size_t size);
CV_EXPORTS cl_kernel openCLGetKernelFromSource(const Context *clCxt,
const cv::ocl::ProgramEntry* source, std::string kernelName);
cl_kernel CV_EXPORTS openCLGetKernelFromSource(const Context *clCxt,
CV_EXPORTS cl_kernel openCLGetKernelFromSource(const Context *clCxt,
const cv::ocl::ProgramEntry* source, std::string kernelName, const char *build_options);
void CV_EXPORTS openCLVerifyKernel(const Context *clCxt, cl_kernel kernel, size_t *localThreads);
void CV_EXPORTS openCLExecuteKernel(Context *clCxt , const cv::ocl::ProgramEntry* source, string kernelName, std::vector< std::pair<size_t, const void *> > &args,
CV_EXPORTS void openCLVerifyKernel(const Context *clCxt, cl_kernel kernel, size_t *localThreads);
CV_EXPORTS void openCLExecuteKernel(Context *clCxt , const cv::ocl::ProgramEntry* source, string kernelName, std::vector< std::pair<size_t, const void *> > &args,
int globalcols , int globalrows, size_t blockSize = 16, int kernel_expand_depth = -1, int kernel_expand_channel = -1);
void CV_EXPORTS openCLExecuteKernel_(Context *clCxt, const cv::ocl::ProgramEntry* source, std::string kernelName,
CV_EXPORTS void openCLExecuteKernel_(Context *clCxt, const cv::ocl::ProgramEntry* source, std::string kernelName,
size_t globalThreads[3], size_t localThreads[3],
std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, const char *build_options);
void CV_EXPORTS openCLExecuteKernel(Context *clCxt, const cv::ocl::ProgramEntry* source, std::string kernelName, size_t globalThreads[3],
CV_EXPORTS void openCLExecuteKernel(Context *clCxt, const cv::ocl::ProgramEntry* source, std::string kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, int depth);
void CV_EXPORTS openCLExecuteKernel(Context *clCxt, const cv::ocl::ProgramEntry* source, std::string kernelName, size_t globalThreads[3],
CV_EXPORTS void openCLExecuteKernel(Context *clCxt, const cv::ocl::ProgramEntry* source, std::string kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels,
int depth, const char *build_options);
cl_mem CV_EXPORTS load_constant(cl_context context, cl_command_queue command_queue, const void *value,
CV_EXPORTS cl_mem load_constant(cl_context context, cl_command_queue command_queue, const void *value,
const size_t size);
cl_mem CV_EXPORTS openCLMalloc(cl_context clCxt, size_t size, cl_mem_flags flags, void *host_ptr);
CV_EXPORTS cl_mem openCLMalloc(cl_context clCxt, size_t size, cl_mem_flags flags, void *host_ptr);
enum FLUSH_MODE
{
......@@ -125,9 +127,9 @@ enum FLUSH_MODE
DISABLE
};
void CV_EXPORTS openCLExecuteKernel2(Context *clCxt, const cv::ocl::ProgramEntry* source, std::string kernelName, size_t globalThreads[3],
CV_EXPORTS void openCLExecuteKernel2(Context *clCxt, const cv::ocl::ProgramEntry* source, std::string kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, FLUSH_MODE finish_mode = DISABLE);
void CV_EXPORTS openCLExecuteKernel2(Context *clCxt, const cv::ocl::ProgramEntry* source, std::string kernelName, size_t globalThreads[3],
CV_EXPORTS void openCLExecuteKernel2(Context *clCxt, const cv::ocl::ProgramEntry* source, std::string kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels,
int depth, char *build_options, FLUSH_MODE finish_mode = DISABLE);
......@@ -135,8 +137,8 @@ void CV_EXPORTS openCLExecuteKernel2(Context *clCxt, const cv::ocl::ProgramEntry
// note:
// 1. there is no memory management. User need to explicitly release the resource
// 2. for faster clamping, there is no buffer padding for the constructed texture
cl_mem CV_EXPORTS bindTexture(const oclMat &mat);
void CV_EXPORTS releaseTexture(cl_mem& texture);
CV_EXPORTS cl_mem bindTexture(const oclMat &mat);
CV_EXPORTS void releaseTexture(cl_mem& texture);
//Represents an image texture object
class CV_EXPORTS TextureCL
......@@ -163,15 +165,11 @@ private:
// bind oclMat to OpenCL image textures and retunrs an TextureCL object
// note:
// for faster clamping, there is no buffer padding for the constructed texture
Ptr<TextureCL> CV_EXPORTS bindTexturePtr(const oclMat &mat);
// returns whether the current context supports image2d_t format or not
bool CV_EXPORTS support_image2d(Context *clCxt = Context::getContext());
bool CV_EXPORTS isCpuDevice();
CV_EXPORTS Ptr<TextureCL> bindTexturePtr(const oclMat &mat);
size_t CV_EXPORTS queryWaveFrontSize(cl_kernel kernel);
CV_EXPORTS bool isCpuDevice();
CV_EXPORTS size_t queryWaveFrontSize(cl_kernel kernel);
inline size_t divUp(size_t total, size_t grain)
......
......@@ -55,6 +55,21 @@
namespace cv {
namespace ocl {
struct __Module
{
__Module();
~__Module();
cv::Mutex initializationMutex;
cv::Mutex currentContextMutex;
};
static __Module __module;
cv::Mutex& getInitializationMutex()
{
return __module.initializationMutex;
}
struct PlatformInfoImpl
{
cl_platform_id platform_id;
......@@ -312,7 +327,6 @@ not_found:
return false;
}
static cv::Mutex __initializedMutex;
static bool __initialized = false;
static int initializeOpenCLDevices()
{
......@@ -499,7 +513,6 @@ private:
ContextImpl& operator=(const ContextImpl&); // disabled
};
static cv::Mutex currentContextMutex;
static ContextImpl* currentContext = NULL;
Context* Context::getContext()
......@@ -508,7 +521,7 @@ Context* Context::getContext()
{
if (!__initialized || !__deviceSelected)
{
cv::AutoLock lock(__initializedMutex);
cv::AutoLock lock(getInitializationMutex());
if (!__initialized)
{
if (initializeOpenCLDevices() == 0)
......@@ -604,7 +617,7 @@ void ContextImpl::cleanupContext(void)
fft_teardown();
clBlasTeardown();
cv::AutoLock lock(currentContextMutex);
cv::AutoLock lock(__module.currentContextMutex);
if (currentContext)
delete currentContext;
currentContext = NULL;
......@@ -615,7 +628,7 @@ void ContextImpl::setContext(const DeviceInfo* deviceInfo)
CV_Assert(deviceInfo->_id >= 0 && deviceInfo->_id < (int)global_devices.size());
{
cv::AutoLock lock(currentContextMutex);
cv::AutoLock lock(__module.currentContextMutex);
if (currentContext)
{
if (currentContext->deviceInfo._id == deviceInfo->_id)
......@@ -640,7 +653,7 @@ void ContextImpl::setContext(const DeviceInfo* deviceInfo)
ContextImpl* old = NULL;
{
cv::AutoLock lock(currentContextMutex);
cv::AutoLock lock(__module.currentContextMutex);
old = currentContext;
currentContext = ctx;
}
......@@ -724,20 +737,19 @@ bool supportsFeature(FEATURE_TYPE featureType)
return Context::getContext()->supportsFeature(featureType);
}
struct __Module
__Module::__Module()
{
/* moved to Context::getContext(): initializeOpenCLDevices(); */
}
__Module::~__Module()
{
__Module() { /* moved to Context::getContext(): initializeOpenCLDevices(); */ }
~__Module()
{
#if defined(WIN32) && defined(CVAPI_EXPORTS)
// nothing, see DllMain
// nothing, see DllMain
#else
ContextImpl::cleanupContext();
ContextImpl::cleanupContext();
#endif
}
};
static __Module __module;
}
} // namespace ocl
} // namespace cv
......
......@@ -448,26 +448,30 @@ cl_program ProgramCache::getProgram(const Context *ctx, const cv::ocl::ProgramEn
{
stringstream src_sign;
src_sign << source->name;
src_sign << getClContext(ctx);
if (NULL != build_options)
if (source->name)
{
src_sign << "_" << build_options;
}
src_sign << source->name;
src_sign << getClContext(ctx);
if (NULL != build_options)
{
src_sign << "_" << build_options;
}
{
cv::AutoLock lockCache(mutexCache);
cl_program program = ProgramCache::getProgramCache()->progLookup(src_sign.str());
if (!!program)
{
clRetainProgram(program);
return program;
cv::AutoLock lockCache(mutexCache);
cl_program program = ProgramCache::getProgramCache()->progLookup(src_sign.str());
if (!!program)
{
clRetainProgram(program);
return program;
}
}
}
cv::AutoLock lockCache(mutexFiles);
// second check
if (source->name)
{
cv::AutoLock lockCache(mutexCache);
cl_program program = ProgramCache::getProgramCache()->progLookup(src_sign.str());
......@@ -493,6 +497,7 @@ cl_program ProgramCache::getProgram(const Context *ctx, const cv::ocl::ProgramEn
cl_program program = programFileCache.getOrBuildProgram(ctx, source, all_build_options);
//Cache the binary for future use if build_options is null
if (source->name)
{
cv::AutoLock lockCache(mutexCache);
this->addProgram(src_sign.str(), program);
......
......@@ -90,8 +90,7 @@ namespace cv
protected:
PlanCache();
~PlanCache();
friend class auto_ptr<PlanCache>;
static auto_ptr<PlanCache> planCache;
static PlanCache* planCache;
bool started;
vector<FftPlan *> planStore;
......@@ -102,9 +101,9 @@ namespace cv
static PlanCache* getPlanCache()
{
if( NULL == planCache.get())
planCache.reset(new PlanCache());
return planCache.get();
if (NULL == planCache)
planCache = new PlanCache();
return planCache;
}
// return a baked plan->
// if there is one matched plan, return it
......@@ -118,7 +117,7 @@ namespace cv
};
}
}
auto_ptr<PlanCache> PlanCache::planCache;
PlanCache* PlanCache::planCache = NULL;
void cv::ocl::fft_setup()
{
......@@ -138,13 +137,13 @@ void cv::ocl::fft_teardown()
{
return;
}
delete pCache.setupData;
for(size_t i = 0; i < pCache.planStore.size(); i ++)
{
delete pCache.planStore[i];
}
pCache.planStore.clear();
openCLSafeCall( clAmdFftTeardown( ) );
delete pCache.setupData; pCache.setupData = NULL;
pCache.started = false;
}
......
......@@ -76,13 +76,12 @@ void cv::ocl::clBlasTeardown()
using namespace cv;
static bool clBlasInitialized = false;
static Mutex cs;
void cv::ocl::clBlasSetup()
{
if(!clBlasInitialized)
{
AutoLock al(cs);
AutoLock lock(getInitializationMutex());
if(!clBlasInitialized)
{
openCLSafeCall(clAmdBlasSetup());
......@@ -93,7 +92,7 @@ void cv::ocl::clBlasSetup()
void cv::ocl::clBlasTeardown()
{
AutoLock al(cs);
AutoLock lock(getInitializationMutex());
if(clBlasInitialized)
{
clAmdBlasTeardown();
......
......@@ -202,8 +202,6 @@ void cv::ocl::GoodFeaturesToTrackDetector_OCL::operator ()(const oclMat& image,
CV_Assert(qualityLevel > 0 && minDistance >= 0 && maxCorners >= 0);
CV_Assert(mask.empty() || (mask.type() == CV_8UC1 && mask.size() == image.size()));
CV_DbgAssert(support_image2d());
ensureSizeIsEnough(image.size(), CV_32F, eig_);
if (useHarrisDetector)
......
......@@ -216,41 +216,11 @@ namespace cv
{
return Ptr<TextureCL>(new TextureCL(bindTexture(mat), mat.rows, mat.cols, mat.type()));
}
void releaseTexture(cl_mem& texture)
{
openCLFree(texture);
}
bool support_image2d(Context *clCxt)
{
const cv::ocl::ProgramEntry _kernel = {"test_func", "__kernel void test_func(image2d_t img) {}", NULL};
static bool _isTested = false;
static bool _support = false;
if(_isTested)
{
return _support;
}
try
{
cv::ocl::openCLGetKernelFromSource(clCxt, &_kernel, "test_func");
cv::ocl::finish();
_support = true;
}
catch (const cv::Exception& e)
{
if(e.code == -217)
{
_support = false;
}
else
{
// throw e once again
throw e;
}
}
_isTested = true;
return _support;
}
}//namespace ocl
}//namespace cv
This diff is collapsed.
......@@ -82,18 +82,16 @@ static void lkSparse_run(oclMat &I, oclMat &J,
int level, dim3 patch, Size winSize, int iters)
{
Context *clCxt = I.clCxt;
int elemCntPerRow = I.step / I.elemSize();
string kernelName = "lkSparse";
bool isImageSupported = support_image2d();
size_t localThreads[3] = { 8, isImageSupported ? 8 : 32, 1 };
size_t globalThreads[3] = { 8 * ptcount, isImageSupported ? 8 : 32, 1};
size_t localThreads[3] = { 8, 8, 1 };
size_t globalThreads[3] = { 8 * ptcount, 8, 1};
int cn = I.oclchannels();
char calcErr = level==0?1:0;
vector<pair<size_t , const void *> > args;
cl_mem ITex = isImageSupported ? bindTexture(I) : (cl_mem)I.data;
cl_mem JTex = isImageSupported ? bindTexture(J) : (cl_mem)J.data;
cl_mem ITex = bindTexture(I);
cl_mem JTex = bindTexture(J);
args.push_back( make_pair( sizeof(cl_mem), (void *)&ITex ));
args.push_back( make_pair( sizeof(cl_mem), (void *)&JTex ));
......@@ -106,8 +104,6 @@ static void lkSparse_run(oclMat &I, oclMat &J,
args.push_back( make_pair( sizeof(cl_int), (void *)&level ));
args.push_back( make_pair( sizeof(cl_int), (void *)&I.rows ));
args.push_back( make_pair( sizeof(cl_int), (void *)&I.cols ));
if (!isImageSupported)
args.push_back( make_pair( sizeof(cl_int), (void *)&elemCntPerRow ) );
args.push_back( make_pair( sizeof(cl_int), (void *)&patch.x ));
args.push_back( make_pair( sizeof(cl_int), (void *)&patch.y ));
args.push_back( make_pair( sizeof(cl_int), (void *)&cn ));
......@@ -120,32 +116,23 @@ static void lkSparse_run(oclMat &I, oclMat &J,
if (is_cpu)
{
openCLExecuteKernel(clCxt, &pyrlk, kernelName, globalThreads, localThreads, args, I.oclchannels(), I.depth(), (char*)" -D CPU");
releaseTexture(ITex);
releaseTexture(JTex);
}
else
{
if(isImageSupported)
{
stringstream idxStr;
idxStr << kernelName << "_C" << I.oclchannels() << "_D" << I.depth();
cl_kernel kernel = openCLGetKernelFromSource(clCxt, &pyrlk, idxStr.str());
int wave_size = (int)queryWaveFrontSize(kernel);
openCLSafeCall(clReleaseKernel(kernel));
static char opt[32] = {0};
sprintf(opt, "-D WAVE_SIZE=%d", wave_size);
openCLExecuteKernel(clCxt, &pyrlk, kernelName, globalThreads, localThreads,
args, I.oclchannels(), I.depth(), opt);
releaseTexture(ITex);
releaseTexture(JTex);
}
else
{
openCLExecuteKernel(clCxt, &pyrlk_no_image, kernelName, globalThreads, localThreads, args, I.oclchannels(), I.depth());
}
stringstream idxStr;
idxStr << kernelName << "_C" << I.oclchannels() << "_D" << I.depth();
cl_kernel kernel = openCLGetKernelFromSource(clCxt, &pyrlk, idxStr.str());
int wave_size = (int)queryWaveFrontSize(kernel);
openCLSafeCall(clReleaseKernel(kernel));
static char opt[32] = {0};
sprintf(opt, "-D WAVE_SIZE=%d", wave_size);
openCLExecuteKernel(clCxt, &pyrlk, kernelName, globalThreads, localThreads,
args, I.oclchannels(), I.depth(), opt);
}
releaseTexture(ITex);
releaseTexture(JTex);
}
void cv::ocl::PyrLKOpticalFlow::sparse(const oclMat &prevImg, const oclMat &nextImg, const oclMat &prevPts, oclMat &nextPts, oclMat &status, oclMat *err)
......@@ -226,37 +213,19 @@ static void lkDense_run(oclMat &I, oclMat &J, oclMat &u, oclMat &v,
oclMat &prevU, oclMat &prevV, oclMat *err, Size winSize, int iters)
{
Context *clCxt = I.clCxt;
bool isImageSupported = support_image2d();
int elemCntPerRow = I.step / I.elemSize();
string kernelName = "lkDense";
size_t localThreads[3] = { 16, 16, 1 };
size_t globalThreads[3] = { I.cols, I.rows, 1};
bool calcErr;
if (err)
{
calcErr = true;
}
else
{
calcErr = false;
}
cl_char calcErr = err ? 1 : 0;
cl_mem ITex;
cl_mem JTex;
if (isImageSupported)
{
ITex = bindTexture(I);
JTex = bindTexture(J);
}
else
{
ITex = (cl_mem)I.data;
JTex = (cl_mem)J.data;
}
ITex = bindTexture(I);
JTex = bindTexture(J);
vector<pair<size_t , const void *> > args;
......@@ -273,28 +242,15 @@ static void lkDense_run(oclMat &I, oclMat &J, oclMat &u, oclMat &v,
args.push_back( make_pair( sizeof(cl_int), (void *)&prevV.step ));
args.push_back( make_pair( sizeof(cl_int), (void *)&I.rows ));
args.push_back( make_pair( sizeof(cl_int), (void *)&I.cols ));
//args.push_back( make_pair( sizeof(cl_mem), (void *)&(*err).data ));
//args.push_back( make_pair( sizeof(cl_int), (void *)&(*err).step ));
if (!isImageSupported)
{
args.push_back( make_pair( sizeof(cl_int), (void *)&elemCntPerRow ) );
}
args.push_back( make_pair( sizeof(cl_int), (void *)&winSize.width ));
args.push_back( make_pair( sizeof(cl_int), (void *)&winSize.height ));
args.push_back( make_pair( sizeof(cl_int), (void *)&iters ));
args.push_back( make_pair( sizeof(cl_char), (void *)&calcErr ));
if (isImageSupported)
{
openCLExecuteKernel(clCxt, &pyrlk, kernelName, globalThreads, localThreads, args, I.oclchannels(), I.depth());
openCLExecuteKernel(clCxt, &pyrlk, kernelName, globalThreads, localThreads, args, I.oclchannels(), I.depth());
releaseTexture(ITex);
releaseTexture(JTex);
}
else
{
openCLExecuteKernel(clCxt, &pyrlk_no_image, kernelName, globalThreads, localThreads, args, I.oclchannels(), I.depth());
}
releaseTexture(ITex);
releaseTexture(JTex);
}
void cv::ocl::PyrLKOpticalFlow::dense(const oclMat &prevImg, const oclMat &nextImg, oclMat &u, oclMat &v, oclMat *err)
......
......@@ -411,9 +411,6 @@ void ocl_tvl1flow::estimateU(oclMat &I1wx, oclMat &I1wy, oclMat &grad,
void ocl_tvl1flow::warpBackward(const oclMat &I0, const oclMat &I1, oclMat &I1x, oclMat &I1y, oclMat &u1, oclMat &u2, oclMat &I1w, oclMat &I1wx, oclMat &I1wy, oclMat &grad, oclMat &rho)
{
Context* clCxt = I0.clCxt;
const bool isImgSupported = support_image2d(clCxt);
CV_Assert(isImgSupported);
int u1ElementSize = u1.elemSize();
int u1Step = u1.step/u1ElementSize;
......
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