mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
format files to ANSI C style with coolformat
change the download channels to oclchannles() fix bugs of arithm functions perf fix of bilateral bug fix of split test case add build_warps functions
This commit is contained in:
+37
-34
@@ -51,48 +51,51 @@ using namespace cv::ocl;
|
||||
using namespace std;
|
||||
|
||||
#if !defined (HAVE_OPENCL)
|
||||
void cv::ocl::blendLinear(const oclMat& img1, const oclMat& img2, const oclMat& weights1, const oclMat& weights2,
|
||||
oclMat& result){throw_nogpu();}
|
||||
#else
|
||||
namespace cv
|
||||
void cv::ocl::blendLinear(const oclMat &img1, const oclMat &img2, const oclMat &weights1, const oclMat &weights2,
|
||||
oclMat &result)
|
||||
{
|
||||
namespace ocl
|
||||
{
|
||||
throw_nogpu();
|
||||
}
|
||||
#else
|
||||
namespace cv
|
||||
{
|
||||
namespace ocl
|
||||
{
|
||||
////////////////////////////////////OpenCL kernel strings//////////////////////////
|
||||
extern const char *blend_linear;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cv::ocl::blendLinear(const oclMat& img1, const oclMat& img2, const oclMat& weights1, const oclMat& weights2,
|
||||
oclMat& result)
|
||||
void cv::ocl::blendLinear(const oclMat &img1, const oclMat &img2, const oclMat &weights1, const oclMat &weights2,
|
||||
oclMat &result)
|
||||
{
|
||||
cv::ocl::Context *ctx = img1.clCxt;
|
||||
assert(ctx == img2.clCxt && ctx == weights1.clCxt && ctx == weights2.clCxt);
|
||||
int channels = img1.channels();
|
||||
int depth = img1.depth();
|
||||
int rows = img1.rows;
|
||||
int cols = img1.cols;
|
||||
int istep = img1.step1();
|
||||
int wstep = weights1.step1();
|
||||
size_t globalSize[] = {cols * channels, rows, 1};
|
||||
size_t localSize[] = {16, 16, 1};
|
||||
cv::ocl::Context *ctx = img1.clCxt;
|
||||
assert(ctx == img2.clCxt && ctx == weights1.clCxt && ctx == weights2.clCxt);
|
||||
int channels = img1.oclchannels();
|
||||
int depth = img1.depth();
|
||||
int rows = img1.rows;
|
||||
int cols = img1.cols;
|
||||
int istep = img1.step1();
|
||||
int wstep = weights1.step1();
|
||||
size_t globalSize[] = {cols * channels, rows, 1};
|
||||
size_t localSize[] = {16, 16, 1};
|
||||
|
||||
vector< pair<size_t, const void *> > args;
|
||||
vector< pair<size_t, const void *> > args;
|
||||
|
||||
if(globalSize[0]!=0)
|
||||
{
|
||||
args.push_back( make_pair( sizeof(cl_mem), (void *)&result.data ));
|
||||
args.push_back( make_pair( sizeof(cl_mem), (void *)&img1.data ));
|
||||
args.push_back( make_pair( sizeof(cl_mem), (void *)&img2.data ));
|
||||
args.push_back( make_pair( sizeof(cl_mem), (void *)&weights1.data ));
|
||||
args.push_back( make_pair( sizeof(cl_mem), (void *)&weights2.data ));
|
||||
args.push_back( make_pair( sizeof(cl_int), (void *)&rows ));
|
||||
args.push_back( make_pair( sizeof(cl_int), (void *)&cols ));
|
||||
args.push_back( make_pair( sizeof(cl_int), (void *)&istep ));
|
||||
args.push_back( make_pair( sizeof(cl_int), (void *)&wstep ));
|
||||
std::string kernelName = "BlendLinear";
|
||||
if(globalSize[0] != 0)
|
||||
{
|
||||
args.push_back( make_pair( sizeof(cl_mem), (void *)&result.data ));
|
||||
args.push_back( make_pair( sizeof(cl_mem), (void *)&img1.data ));
|
||||
args.push_back( make_pair( sizeof(cl_mem), (void *)&img2.data ));
|
||||
args.push_back( make_pair( sizeof(cl_mem), (void *)&weights1.data ));
|
||||
args.push_back( make_pair( sizeof(cl_mem), (void *)&weights2.data ));
|
||||
args.push_back( make_pair( sizeof(cl_int), (void *)&rows ));
|
||||
args.push_back( make_pair( sizeof(cl_int), (void *)&cols ));
|
||||
args.push_back( make_pair( sizeof(cl_int), (void *)&istep ));
|
||||
args.push_back( make_pair( sizeof(cl_int), (void *)&wstep ));
|
||||
std::string kernelName = "BlendLinear";
|
||||
|
||||
openCLExecuteKernel(ctx, &blend_linear, kernelName, globalSize, localSize, args, channels, depth);
|
||||
}
|
||||
openCLExecuteKernel(ctx, &blend_linear, kernelName, globalSize, localSize, args, channels, depth);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user