Fix OpenCL build warnings

pull/337/head
Andrey Kamaev 12 years ago
parent b445f4b01d
commit 9509dfd1de
  1. 2
      modules/ocl/CMakeLists.txt
  2. 11
      modules/ocl/include/opencv2/ocl/ocl.hpp
  3. 10
      modules/ocl/perf/main.cpp
  4. 4
      modules/ocl/perf/perf_arithm.cpp
  5. 18
      modules/ocl/perf/perf_haar.cpp
  6. 7
      modules/ocl/perf/perf_imgproc.cpp
  7. 9
      modules/ocl/perf/precomp.hpp
  8. 12
      modules/ocl/perf/utility.hpp
  9. 60
      modules/ocl/src/arithm.cpp
  10. 2
      modules/ocl/src/brute_force_matcher.cpp
  11. 45
      modules/ocl/src/filtering.cpp
  12. 1480
      modules/ocl/src/haar.cpp
  13. 50
      modules/ocl/src/imgproc.cpp
  14. 14
      modules/ocl/src/initialization.cpp
  15. 2
      modules/ocl/src/interpolate_frames.cpp
  16. 2
      modules/ocl/src/match_template.cpp
  17. 14
      modules/ocl/src/matrix_operations.cpp
  18. 2
      modules/ocl/src/mcwutil.cpp
  19. 2
      modules/ocl/src/precomp.hpp
  20. 2
      modules/ocl/src/pyrdown.cpp
  21. 136
      modules/ocl/src/pyrlk.cpp
  22. 186
      modules/ocl/src/split_merge.cpp
  23. 2
      modules/ocl/src/surf.cpp
  24. 9
      modules/ocl/test/precomp.hpp
  25. 6
      modules/ocl/test/test_arithm.cpp
  26. 2
      modules/ocl/test/test_blend.cpp
  27. 4
      modules/ocl/test/test_color.cpp
  28. 18
      modules/ocl/test/test_haar.cpp
  29. 7
      modules/ocl/test/test_imgproc.cpp
  30. 4
      modules/ocl/test/test_match_template.cpp
  31. 12
      modules/ocl/test/utility.hpp

@ -39,6 +39,8 @@ if (HAVE_OPENCL)
endif() endif()
endif() endif()
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow)
ocv_set_module_sources(HEADERS ${lib_hdrs} SOURCES ${lib_int_hdrs} ${lib_srcs} ${kernels_cpp}) ocv_set_module_sources(HEADERS ${lib_hdrs} SOURCES ${lib_int_hdrs} ${lib_srcs} ${kernels_cpp})
ocv_create_module(${ocl_link_libs}) ocv_create_module(${ocl_link_libs})

@ -1738,12 +1738,13 @@ namespace cv
} }
} }
#if _MSC_VER >= 1200 #if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( push) # pragma warning( push)
#pragma warning( disable: 4267) # pragma warning( disable: 4267)
#endif #endif
#include "opencv2/ocl/matrix_operations.hpp" #include "opencv2/ocl/matrix_operations.hpp"
#if _MSC_VER >= 1200 #if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( pop) # pragma warning( pop)
#endif #endif
#endif /* __OPENCV_GPU_HPP__ */ #endif /* __OPENCV_GPU_HPP__ */

@ -113,15 +113,15 @@ int main(int argc, char **argv)
print_info(); print_info();
int flag = CVCL_DEVICE_TYPE_GPU; // int flag = CVCL_DEVICE_TYPE_GPU;
if(type == "cpu") // if(type == "cpu")
{ // {
flag = CVCL_DEVICE_TYPE_CPU; // flag = CVCL_DEVICE_TYPE_CPU;
} // }
std::vector<cv::ocl::Info> oclinfo; std::vector<cv::ocl::Info> oclinfo;
int devnums = getDevice(oclinfo); int devnums = getDevice(oclinfo);
if(devnums <= device || device < 0) if(devnums <= device || device < 0)

@ -2597,13 +2597,13 @@ TEST_P(Sum, MAT)
Has_roi(k); Has_roi(k);
t0 = (double)cvGetTickCount();//cpu start t0 = (double)cvGetTickCount();//cpu start
Scalar cpures = cv::sum(mat1_roi); cv::sum(mat1_roi);
t0 = (double)cvGetTickCount() - t0;//cpu end t0 = (double)cvGetTickCount() - t0;//cpu end
t1 = (double)cvGetTickCount();//gpu start1 t1 = (double)cvGetTickCount();//gpu start1
gmat1 = mat1_roi; gmat1 = mat1_roi;
t2 = (double)cvGetTickCount(); //kernel t2 = (double)cvGetTickCount(); //kernel
Scalar gpures = cv::ocl::sum(gmat1); cv::ocl::sum(gmat1);
t2 = (double)cvGetTickCount() - t2;//kernel t2 = (double)cvGetTickCount() - t2;//kernel
t1 = (double)cvGetTickCount() - t1;//gpu end1 t1 = (double)cvGetTickCount() - t1;//gpu end1
if(j == 0) if(j == 0)

@ -109,15 +109,15 @@ TEST_F(Haar, FaceDetect)
double t = 0; double t = 0;
vector<Rect> faces, oclfaces; vector<Rect> faces, oclfaces;
const static Scalar colors[] = { CV_RGB(0, 0, 255), // const static Scalar colors[] = { CV_RGB(0, 0, 255),
CV_RGB(0, 128, 255), // CV_RGB(0, 128, 255),
CV_RGB(0, 255, 255), // CV_RGB(0, 255, 255),
CV_RGB(0, 255, 0), // CV_RGB(0, 255, 0),
CV_RGB(255, 128, 0), // CV_RGB(255, 128, 0),
CV_RGB(255, 255, 0), // CV_RGB(255, 255, 0),
CV_RGB(255, 0, 0), // CV_RGB(255, 0, 0),
CV_RGB(255, 0, 255) // CV_RGB(255, 0, 255)
} ; // } ;
Mat gray, smallImg(cvRound (img.rows / scale), cvRound(img.cols / scale), CV_8UC1 ); Mat gray, smallImg(cvRound (img.rows / scale), cvRound(img.cols / scale), CV_8UC1 );
MemStorage storage(cvCreateMemStorage(0)); MemStorage storage(cvCreateMemStorage(0));

@ -379,7 +379,7 @@ TEST_P(bilateralFilter, Mat)
} }
else else
{ {
for(int i = 0; i < sizeof(bordertype) / sizeof(int); i++) for(size_t i = 0; i < sizeof(bordertype) / sizeof(int); i++)
{ {
cout << borderstr[i] << endl; cout << borderstr[i] << endl;
#ifndef PRINT_KERNEL_RUN_TIME #ifndef PRINT_KERNEL_RUN_TIME
@ -397,7 +397,7 @@ TEST_P(bilateralFilter, Mat)
for(int j = 0; j < LOOP_TIMES + 1; j ++) for(int j = 0; j < LOOP_TIMES + 1; j ++)
{ {
Has_roi(k); Has_roi(k);
if(((bordertype[i] != cv::BORDER_CONSTANT) && (bordertype[i] != cv::BORDER_REPLICATE)) && (mat1_roi.cols <= radius) || (mat1_roi.cols <= radius) || (mat1_roi.rows <= radius) || (mat1_roi.rows <= radius)) if(((bordertype[i] != cv::BORDER_CONSTANT) && (bordertype[i] != cv::BORDER_REPLICATE) && (mat1_roi.cols <= radius)) || (mat1_roi.cols <= radius) || (mat1_roi.rows <= radius) || (mat1_roi.rows <= radius))
{ {
continue; continue;
} }
@ -482,7 +482,7 @@ TEST_P(CopyMakeBorder, Mat)
} }
else else
{ {
for(int i = 0; i < sizeof(bordertype) / sizeof(int); i++) for(size_t i = 0; i < sizeof(bordertype) / sizeof(int); i++)
{ {
#ifndef PRINT_KERNEL_RUN_TIME #ifndef PRINT_KERNEL_RUN_TIME
double totalcputick = 0; double totalcputick = 0;
@ -1133,7 +1133,6 @@ PARAM_TEST_CASE(Remap, MatType, MatType, MatType, int, int)
cv::RNG &rng = TS::ptr()->get_rng(); cv::RNG &rng = TS::ptr()->get_rng();
cv::Size srcSize = cv::Size(MWIDTH, MHEIGHT); cv::Size srcSize = cv::Size(MWIDTH, MHEIGHT);
cv::Size dstSize = cv::Size(MWIDTH, MHEIGHT);
cv::Size map1Size = cv::Size(MWIDTH, MHEIGHT); cv::Size map1Size = cv::Size(MWIDTH, MHEIGHT);
double min = 5, max = 16; double min = 5, max = 16;

@ -38,6 +38,15 @@
// the use of this software, even if advised of the possibility of such damage. // the use of this software, even if advised of the possibility of such damage.
// //
//M*/ //M*/
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wmissing-declarations"
# if defined __clang__ || defined __APPLE__
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
# pragma GCC diagnostic ignored "-Wextra"
# endif
#endif
#ifndef __OPENCV_TEST_PRECOMP_HPP__ #ifndef __OPENCV_TEST_PRECOMP_HPP__
#define __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__

@ -84,12 +84,12 @@ double checkSimilarity(const cv::Mat &m1, const cv::Mat &m2);
EXPECT_LE(checkNorm(cv::Mat(mat)), eps) \ EXPECT_LE(checkNorm(cv::Mat(mat)), eps) \
} }
//#define EXPECT_MAT_NEAR(mat1, mat2, eps) \ /*#define EXPECT_MAT_NEAR(mat1, mat2, eps) \
//{ \ { \
// ASSERT_EQ(mat1.type(), mat2.type()); \ ASSERT_EQ(mat1.type(), mat2.type()); \
// ASSERT_EQ(mat1.size(), mat2.size()); \ ASSERT_EQ(mat1.size(), mat2.size()); \
// EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps); \ EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps); \
//} }*/
#define EXPECT_MAT_NEAR(mat1, mat2, eps,s) \ #define EXPECT_MAT_NEAR(mat1, mat2, eps,s) \
{ \ { \

@ -362,11 +362,11 @@ void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, string
openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, -1, depth); openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, -1, depth);
} }
void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, string kernelName, const char **kernelString) static void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, string kernelName, const char **kernelString)
{ {
arithmetic_run<char>(src1, src2, dst, kernelName, kernelString, (void *)NULL); arithmetic_run<char>(src1, src2, dst, kernelName, kernelString, (void *)NULL);
} }
void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString) static void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString)
{ {
if(src1.clCxt -> impl -> double_support == 0 && src1.type() == CV_64F) if(src1.clCxt -> impl -> double_support == 0 && src1.type() == CV_64F)
{ {
@ -476,7 +476,9 @@ void arithmetic_scalar_run(const oclMat &src1, const Scalar &src2, oclMat &dst,
//CV_Assert(src1.depth() != CV_8S); //CV_Assert(src1.depth() != CV_8S);
if(mask.data) if(mask.data)
{
CV_Assert(mask.type() == CV_8U && src1.rows == mask.rows && src1.cols == mask.cols); CV_Assert(mask.type() == CV_8U && src1.rows == mask.rows && src1.cols == mask.cols);
}
Context *clCxt = src1.clCxt; Context *clCxt = src1.clCxt;
int channels = dst.oclchannels(); int channels = dst.oclchannels();
@ -530,7 +532,7 @@ void arithmetic_scalar_run(const oclMat &src1, const Scalar &src2, oclMat &dst,
openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, channels, depth); openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, channels, depth);
} }
void arithmetic_scalar_run(const oclMat &src, oclMat &dst, string kernelName, const char **kernelString, double scalar) static void arithmetic_scalar_run(const oclMat &src, oclMat &dst, string kernelName, const char **kernelString, double scalar)
{ {
if(src.clCxt -> impl -> double_support == 0 && src.type() == CV_64F) if(src.clCxt -> impl -> double_support == 0 && src.type() == CV_64F)
{ {
@ -590,7 +592,7 @@ void arithmetic_scalar_run(const oclMat &src, oclMat &dst, string kernelName, co
typedef void (*ArithmeticFuncS)(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString, int isMatSubScalar); typedef void (*ArithmeticFuncS)(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString, int isMatSubScalar);
void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString, int isMatSubScalar) static void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString, int isMatSubScalar)
{ {
static ArithmeticFuncS tab[8] = static ArithmeticFuncS tab[8] =
{ {
@ -608,7 +610,7 @@ void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, cons
cv::ocl::error("Unsupported arithmetic operation", __FILE__, __LINE__); cv::ocl::error("Unsupported arithmetic operation", __FILE__, __LINE__);
func(src1, src2, dst, mask, kernelName, kernelString, isMatSubScalar); func(src1, src2, dst, mask, kernelName, kernelString, isMatSubScalar);
} }
void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString) static void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString)
{ {
arithmetic_scalar(src1, src2, dst, mask, kernelName, kernelString, 0); arithmetic_scalar(src1, src2, dst, mask, kernelName, kernelString, 0);
} }
@ -660,7 +662,7 @@ void cv::ocl::absdiff(const oclMat &src1, const Scalar &src2, oclMat &dst)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
///////////////////////////////// compare /////////////////////////////////// ///////////////////////////////// compare ///////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void compare_run(const oclMat &src1, const oclMat &src2, oclMat &dst, string kernelName, const char **kernelString) static void compare_run(const oclMat &src1, const oclMat &src2, oclMat &dst, string kernelName, const char **kernelString)
{ {
dst.create(src1.size(), CV_8UC1); dst.create(src1.size(), CV_8UC1);
CV_Assert(src1.oclchannels() == 1); CV_Assert(src1.oclchannels() == 1);
@ -739,7 +741,7 @@ void cv::ocl::compare(const oclMat &src1, const oclMat &src2, oclMat &dst , int
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//type = 0 sum,type = 1 absSum,type = 2 sqrSum //type = 0 sum,type = 1 absSum,type = 2 sqrSum
void arithmetic_sum_buffer_run(const oclMat &src, cl_mem &dst, int vlen , int groupnum, int type = 0) static void arithmetic_sum_buffer_run(const oclMat &src, cl_mem &dst, int vlen , int groupnum, int type = 0)
{ {
vector<pair<size_t , const void *> > args; vector<pair<size_t , const void *> > args;
int all_cols = src.step / (vlen * src.elemSize1()); int all_cols = src.step / (vlen * src.elemSize1());
@ -872,7 +874,7 @@ void cv::ocl::meanStdDev(const oclMat &src, Scalar &mean, Scalar &stddev)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//////////////////////////////////// minMax ///////////////////////////////// //////////////////////////////////// minMax /////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void arithmetic_minMax_run(const oclMat &src, const oclMat &mask, cl_mem &dst, int vlen , int groupnum, string kernelName) static void arithmetic_minMax_run(const oclMat &src, const oclMat &mask, cl_mem &dst, int vlen , int groupnum, string kernelName)
{ {
vector<pair<size_t , const void *> > args; vector<pair<size_t , const void *> > args;
int all_cols = src.step / (vlen * src.elemSize1()); int all_cols = src.step / (vlen * src.elemSize1());
@ -909,7 +911,7 @@ void arithmetic_minMax_run(const oclMat &src, const oclMat &mask, cl_mem &dst, i
} }
void arithmetic_minMax_mask_run(const oclMat &src, const oclMat &mask, cl_mem &dst, int vlen, int groupnum, string kernelName) static void arithmetic_minMax_mask_run(const oclMat &src, const oclMat &mask, cl_mem &dst, int vlen, int groupnum, string kernelName)
{ {
vector<pair<size_t , const void *> > args; vector<pair<size_t , const void *> > args;
size_t gt[3] = {groupnum * 256, 1, 1}, lt[3] = {256, 1, 1}; size_t gt[3] = {groupnum * 256, 1, 1}, lt[3] = {256, 1, 1};
@ -1063,7 +1065,7 @@ double cv::ocl::norm(const oclMat &src1, const oclMat &src2, int normType)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////// flip ////////////////////////////////////// ////////////////////////////////// flip //////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void arithmetic_flip_rows_run(const oclMat &src, oclMat &dst, string kernelName) static void arithmetic_flip_rows_run(const oclMat &src, oclMat &dst, string kernelName)
{ {
if(src.clCxt -> impl -> double_support == 0 && src.type() == CV_64F) if(src.clCxt -> impl -> double_support == 0 && src.type() == CV_64F)
{ {
@ -1112,7 +1114,7 @@ void arithmetic_flip_rows_run(const oclMat &src, oclMat &dst, string kernelName)
openCLExecuteKernel(clCxt, &arithm_flip, kernelName, globalThreads, localThreads, args, -1, depth); openCLExecuteKernel(clCxt, &arithm_flip, kernelName, globalThreads, localThreads, args, -1, depth);
} }
void arithmetic_flip_cols_run(const oclMat &src, oclMat &dst, string kernelName, bool isVertical) static void arithmetic_flip_cols_run(const oclMat &src, oclMat &dst, string kernelName, bool isVertical)
{ {
if(src.clCxt -> impl -> double_support == 0 && src.type() == CV_64F) if(src.clCxt -> impl -> double_support == 0 && src.type() == CV_64F)
{ {
@ -1183,7 +1185,7 @@ void cv::ocl::flip(const oclMat &src, oclMat &dst, int flipCode)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////// LUT ////////////////////////////////////// ////////////////////////////////// LUT //////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void arithmetic_lut_run(const oclMat &src1, const oclMat &src2, oclMat &dst, string kernelName) static void arithmetic_lut_run(const oclMat &src1, const oclMat &src2, oclMat &dst, string kernelName)
{ {
Context *clCxt = src1.clCxt; Context *clCxt = src1.clCxt;
int channels = src1.oclchannels(); int channels = src1.oclchannels();
@ -1284,7 +1286,7 @@ void cv::ocl::LUT(const oclMat &src, const oclMat &lut, oclMat &dst)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//////////////////////////////// exp log ///////////////////////////////////// //////////////////////////////// exp log /////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void arithmetic_exp_log_run(const oclMat &src, oclMat &dst, string kernelName, const char **kernelString) static void arithmetic_exp_log_run(const oclMat &src, oclMat &dst, string kernelName, const char **kernelString)
{ {
dst.create(src.size(), src.type()); dst.create(src.size(), src.type());
CV_Assert(src.cols == dst.cols && CV_Assert(src.cols == dst.cols &&
@ -1333,7 +1335,7 @@ void cv::ocl::log(const oclMat &src, oclMat &dst)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////// magnitude phase /////////////////////////////// ////////////////////////////// magnitude phase ///////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void arithmetic_magnitude_phase_run(const oclMat &src1, const oclMat &src2, oclMat &dst, string kernelName) static void arithmetic_magnitude_phase_run(const oclMat &src1, const oclMat &src2, oclMat &dst, string kernelName)
{ {
if(src1.clCxt -> impl -> double_support == 0 && src1.type() == CV_64F) if(src1.clCxt -> impl -> double_support == 0 && src1.type() == CV_64F)
{ {
@ -1381,7 +1383,7 @@ void cv::ocl::magnitude(const oclMat &src1, const oclMat &src2, oclMat &dst)
arithmetic_magnitude_phase_run(src1, src2, dst, "arithm_magnitude"); arithmetic_magnitude_phase_run(src1, src2, dst, "arithm_magnitude");
} }
void arithmetic_phase_run(const oclMat &src1, const oclMat &src2, oclMat &dst, string kernelName, const char **kernelString) static void arithmetic_phase_run(const oclMat &src1, const oclMat &src2, oclMat &dst, string kernelName, const char **kernelString)
{ {
if(src1.clCxt -> impl -> double_support == 0 && src1.type() == CV_64F) if(src1.clCxt -> impl -> double_support == 0 && src1.type() == CV_64F)
{ {
@ -1444,7 +1446,7 @@ void cv::ocl::phase(const oclMat &x, const oclMat &y, oclMat &Angle , bool angle
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////// cartToPolar /////////////////////////////// ////////////////////////////////// cartToPolar ///////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void arithmetic_cartToPolar_run(const oclMat &src1, const oclMat &src2, oclMat &dst_mag, oclMat &dst_cart, static void arithmetic_cartToPolar_run(const oclMat &src1, const oclMat &src2, oclMat &dst_mag, oclMat &dst_cart,
string kernelName, bool angleInDegrees) string kernelName, bool angleInDegrees)
{ {
if(src1.clCxt -> impl -> double_support == 0 && src1.type() == CV_64F) if(src1.clCxt -> impl -> double_support == 0 && src1.type() == CV_64F)
@ -1499,7 +1501,7 @@ void cv::ocl::cartToPolar(const oclMat &x, const oclMat &y, oclMat &mag, oclMat
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////// polarToCart /////////////////////////////// ////////////////////////////////// polarToCart ///////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void arithmetic_ptc_run(const oclMat &src1, const oclMat &src2, oclMat &dst1, oclMat &dst2, bool angleInDegrees, static void arithmetic_ptc_run(const oclMat &src1, const oclMat &src2, oclMat &dst1, oclMat &dst2, bool angleInDegrees,
string kernelName) string kernelName)
{ {
if(src1.clCxt -> impl -> double_support == 0 && src1.type() == CV_64F) if(src1.clCxt -> impl -> double_support == 0 && src1.type() == CV_64F)
@ -1564,7 +1566,7 @@ void cv::ocl::polarToCart(const oclMat &magnitude, const oclMat &angle, oclMat &
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
/////////////////////////////////// minMaxLoc //////////////////////////////// /////////////////////////////////// minMaxLoc ////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void arithmetic_minMaxLoc_run(const oclMat &src, cl_mem &dst, int vlen , int groupnum) static void arithmetic_minMaxLoc_run(const oclMat &src, cl_mem &dst, int vlen , int groupnum)
{ {
vector<pair<size_t , const void *> > args; vector<pair<size_t , const void *> > args;
int all_cols = src.step / (vlen * src.elemSize1()); int all_cols = src.step / (vlen * src.elemSize1());
@ -1588,7 +1590,7 @@ void arithmetic_minMaxLoc_run(const oclMat &src, cl_mem &dst, int vlen , int gro
openCLExecuteKernel(src.clCxt, &arithm_minMaxLoc, "arithm_op_minMaxLoc", gt, lt, args, -1, -1, build_options); openCLExecuteKernel(src.clCxt, &arithm_minMaxLoc, "arithm_op_minMaxLoc", gt, lt, args, -1, -1, build_options);
} }
void arithmetic_minMaxLoc_mask_run(const oclMat &src, const oclMat &mask, cl_mem &dst, int vlen, int groupnum) static void arithmetic_minMaxLoc_mask_run(const oclMat &src, const oclMat &mask, cl_mem &dst, int vlen, int groupnum)
{ {
vector<pair<size_t , const void *> > args; vector<pair<size_t , const void *> > args;
size_t gt[3] = {groupnum * 256, 1, 1}, lt[3] = {256, 1, 1}; size_t gt[3] = {groupnum * 256, 1, 1}, lt[3] = {256, 1, 1};
@ -1702,7 +1704,7 @@ void cv::ocl::minMaxLoc(const oclMat &src, double *minVal, double *maxVal,
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
///////////////////////////// countNonZero /////////////////////////////////// ///////////////////////////// countNonZero ///////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void arithmetic_countNonZero_run(const oclMat &src, cl_mem &dst, int vlen , int groupnum, string kernelName) static void arithmetic_countNonZero_run(const oclMat &src, cl_mem &dst, int vlen , int groupnum, string kernelName)
{ {
vector<pair<size_t , const void *> > args; vector<pair<size_t , const void *> > args;
int all_cols = src.step / (vlen * src.elemSize1()); int all_cols = src.step / (vlen * src.elemSize1());
@ -1759,7 +1761,7 @@ int cv::ocl::countNonZero(const oclMat &src)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////bitwise_op//////////////////////////////////// ////////////////////////////////bitwise_op////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void bitwise_run(const oclMat &src1, oclMat &dst, string kernelName, const char **kernelString) static void bitwise_run(const oclMat &src1, oclMat &dst, string kernelName, const char **kernelString)
{ {
dst.create(src1.size(), src1.type()); dst.create(src1.size(), src1.type());
@ -1853,11 +1855,11 @@ void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, string ker
openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, -1, depth); openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, -1, depth);
} }
void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, string kernelName, const char **kernelString) static void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, string kernelName, const char **kernelString)
{ {
bitwise_run<char>(src1, src2, dst, kernelName, kernelString, (void *)NULL); bitwise_run<char>(src1, src2, dst, kernelName, kernelString, (void *)NULL);
} }
void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString) static void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString)
{ {
dst.create(src1.size(), src1.type()); dst.create(src1.size(), src1.type());
CV_Assert(src1.cols == src2.cols && src2.cols == dst.cols && CV_Assert(src1.cols == src2.cols && src2.cols == dst.cols &&
@ -1919,7 +1921,9 @@ void bitwise_scalar_run(const oclMat &src1, const Scalar &src2, oclMat &dst, con
if(mask.data) if(mask.data)
{
CV_Assert(mask.type() == CV_8U && src1.rows == mask.rows && src1.cols == mask.cols); CV_Assert(mask.type() == CV_8U && src1.rows == mask.rows && src1.cols == mask.cols);
}
Context *clCxt = src1.clCxt; Context *clCxt = src1.clCxt;
int channels = dst.oclchannels(); int channels = dst.oclchannels();
@ -1977,7 +1981,7 @@ void bitwise_scalar_run(const oclMat &src1, const Scalar &src2, oclMat &dst, con
typedef void (*BitwiseFuncS)(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString, int isMatSubScalar); typedef void (*BitwiseFuncS)(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString, int isMatSubScalar);
void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString, int isMatSubScalar) static void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString, int isMatSubScalar)
{ {
static BitwiseFuncS tab[8] = static BitwiseFuncS tab[8] =
{ {
@ -2007,7 +2011,7 @@ void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const o
cv::ocl::error("Unsupported arithmetic operation", __FILE__, __LINE__); cv::ocl::error("Unsupported arithmetic operation", __FILE__, __LINE__);
func(src1, src2, dst, mask, kernelName, kernelString, isMatSubScalar); func(src1, src2, dst, mask, kernelName, kernelString, isMatSubScalar);
} }
void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString) static void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, string kernelName, const char **kernelString)
{ {
bitwise_scalar(src1, src2, dst, mask, kernelName, kernelString, 0); bitwise_scalar(src1, src2, dst, mask, kernelName, kernelString, 0);
} }
@ -2153,7 +2157,7 @@ cv::ocl::oclMat cv::ocl::operator ^ (const oclMat &src1, const oclMat &src2)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#define TILE_DIM (32) #define TILE_DIM (32)
#define BLOCK_ROWS (256/TILE_DIM) #define BLOCK_ROWS (256/TILE_DIM)
void transpose_run(const oclMat &src, oclMat &dst, string kernelName) static void transpose_run(const oclMat &src, oclMat &dst, string kernelName)
{ {
if(src.clCxt -> impl -> double_support == 0 && src.type() == CV_64F) if(src.clCxt -> impl -> double_support == 0 && src.type() == CV_64F)
{ {
@ -2368,7 +2372,7 @@ void cv::ocl::magnitudeSqr(const oclMat &src1, oclMat &dst)
openCLExecuteKernel(clCxt, &arithm_magnitudeSqr, "magnitudeSqr", globalThreads, localThreads, args, 2, depth); openCLExecuteKernel(clCxt, &arithm_magnitudeSqr, "magnitudeSqr", globalThreads, localThreads, args, 2, depth);
} }
void arithmetic_pow_run(const oclMat &src1, double p, oclMat &dst, string kernelName, const char **kernelString) static void arithmetic_pow_run(const oclMat &src1, double p, oclMat &dst, string kernelName, const char **kernelString)
{ {
CV_Assert(src1.cols == dst.cols && src1.rows == dst.rows); CV_Assert(src1.cols == dst.cols && src1.rows == dst.rows);
CV_Assert(src1.type() == dst.type()); CV_Assert(src1.type() == dst.type());
@ -2417,7 +2421,7 @@ void cv::ocl::pow(const oclMat &x, double p, oclMat &y)
return; return;
} }
CV_Assert(x.type() == y.type() && x.size() == y.size() && x.depth() == CV_32F || x.depth() == CV_64F); CV_Assert((x.type() == y.type() && x.size() == y.size() && x.depth() == CV_32F) || x.depth() == CV_64F);
y.create(x.size(), x.type()); y.create(x.size(), x.type());
string kernelName = "arithm_pow"; string kernelName = "arithm_pow";

@ -821,7 +821,7 @@ void findKnnMatch(int k, const oclMat &trainIdx, const oclMat &distance, const o
} }
} }
void findKnnMatchDispatcher(int k, const oclMat &trainIdx, const oclMat &distance, const oclMat &allDist, int distType) static void findKnnMatchDispatcher(int k, const oclMat &trainIdx, const oclMat &distance, const oclMat &allDist, int distType)
{ {
findKnnMatch<256>(k, trainIdx, distance, allDist, distType); findKnnMatch<256>(k, trainIdx, distance, allDist, distType);
} }

@ -332,7 +332,7 @@ public:
**Extend this if necessary later. **Extend this if necessary later.
**Note that the kernel need to be further refined. **Note that the kernel need to be further refined.
*/ */
void GPUErode(const oclMat &src, oclMat &dst, oclMat &mat_kernel, Size &ksize, const Point anchor) static void GPUErode(const oclMat &src, oclMat &dst, oclMat &mat_kernel, Size &ksize, const Point anchor)
{ {
//Normalize the result by default //Normalize the result by default
//float alpha = ksize.height * ksize.width; //float alpha = ksize.height * ksize.width;
@ -388,7 +388,7 @@ void GPUErode(const oclMat &src, oclMat &dst, oclMat &mat_kernel, Size &ksize, c
} }
char compile_option[128]; char compile_option[128];
sprintf(compile_option, "-D RADIUSX=%d -D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D ERODE %s", anchor.x, anchor.y, localThreads[0], localThreads[1], s); sprintf(compile_option, "-D RADIUSX=%d -D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D ERODE %s", anchor.x, anchor.y, (int)localThreads[0], (int)localThreads[1], s);
vector< pair<size_t, const void *> > args; vector< pair<size_t, const void *> > args;
args.push_back(make_pair(sizeof(cl_mem), (void *)&src.data)); args.push_back(make_pair(sizeof(cl_mem), (void *)&src.data));
args.push_back(make_pair(sizeof(cl_mem), (void *)&dst.data)); args.push_back(make_pair(sizeof(cl_mem), (void *)&dst.data));
@ -407,7 +407,7 @@ void GPUErode(const oclMat &src, oclMat &dst, oclMat &mat_kernel, Size &ksize, c
//! data type supported: CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4 //! data type supported: CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4
void GPUDilate(const oclMat &src, oclMat &dst, oclMat &mat_kernel, Size &ksize, const Point anchor) static void GPUDilate(const oclMat &src, oclMat &dst, oclMat &mat_kernel, Size &ksize, const Point anchor)
{ {
//Normalize the result by default //Normalize the result by default
//float alpha = ksize.height * ksize.width; //float alpha = ksize.height * ksize.width;
@ -463,7 +463,7 @@ void GPUDilate(const oclMat &src, oclMat &dst, oclMat &mat_kernel, Size &ksize,
} }
char compile_option[128]; char compile_option[128];
sprintf(compile_option, "-D RADIUSX=%d -D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D DILATE %s", anchor.x, anchor.y, localThreads[0], localThreads[1], s); sprintf(compile_option, "-D RADIUSX=%d -D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D DILATE %s", anchor.x, anchor.y, (int)localThreads[0], (int)localThreads[1], s);
vector< pair<size_t, const void *> > args; vector< pair<size_t, const void *> > args;
args.push_back(make_pair(sizeof(cl_mem), (void *)&src.data)); args.push_back(make_pair(sizeof(cl_mem), (void *)&src.data));
args.push_back(make_pair(sizeof(cl_mem), (void *)&dst.data)); args.push_back(make_pair(sizeof(cl_mem), (void *)&dst.data));
@ -691,7 +691,7 @@ public:
}; };
} }
void GPUFilter2D(const oclMat &src, oclMat &dst, oclMat &mat_kernel, static void GPUFilter2D(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
Size &ksize, const Point anchor, const int borderType) Size &ksize, const Point anchor, const int borderType)
{ {
CV_Assert(src.clCxt == dst.clCxt); CV_Assert(src.clCxt == dst.clCxt);
@ -850,7 +850,7 @@ Ptr<FilterEngine_GPU> cv::ocl::createSeparableFilter_GPU(const Ptr<BaseRowFilter
**support four border types: BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT, BORDER_REFLECT_101 **support four border types: BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT, BORDER_REFLECT_101
*/ */
void GPUFilterBox_8u_C1R(const oclMat &src, oclMat &dst, static void GPUFilterBox_8u_C1R(const oclMat &src, oclMat &dst,
Size &ksize, const Point anchor, const int borderType) Size &ksize, const Point anchor, const int borderType)
{ {
//Normalize the result by default //Normalize the result by default
@ -912,7 +912,7 @@ void GPUFilterBox_8u_C1R(const oclMat &src, oclMat &dst,
openCLExecuteKernel(clCxt, &filtering_boxFilter, kernelName, globalThreads, localThreads, args, -1, -1, build_options); openCLExecuteKernel(clCxt, &filtering_boxFilter, kernelName, globalThreads, localThreads, args, -1, -1, build_options);
} }
void GPUFilterBox_8u_C4R(const oclMat &src, oclMat &dst, static void GPUFilterBox_8u_C4R(const oclMat &src, oclMat &dst,
Size &ksize, const Point anchor, const int borderType) Size &ksize, const Point anchor, const int borderType)
{ {
//Normalize the result by default //Normalize the result by default
@ -974,7 +974,7 @@ void GPUFilterBox_8u_C4R(const oclMat &src, oclMat &dst,
openCLExecuteKernel(clCxt, &filtering_boxFilter, kernelName, globalThreads, localThreads, args, -1, -1, build_options); openCLExecuteKernel(clCxt, &filtering_boxFilter, kernelName, globalThreads, localThreads, args, -1, -1, build_options);
} }
void GPUFilterBox_32F_C1R(const oclMat &src, oclMat &dst, static void GPUFilterBox_32F_C1R(const oclMat &src, oclMat &dst,
Size &ksize, const Point anchor, const int borderType) Size &ksize, const Point anchor, const int borderType)
{ {
//Normalize the result by default //Normalize the result by default
@ -1037,7 +1037,7 @@ void GPUFilterBox_32F_C1R(const oclMat &src, oclMat &dst,
openCLExecuteKernel(clCxt, &filtering_boxFilter, kernelName, globalThreads, localThreads, args, -1, -1, build_options); openCLExecuteKernel(clCxt, &filtering_boxFilter, kernelName, globalThreads, localThreads, args, -1, -1, build_options);
} }
void GPUFilterBox_32F_C4R(const oclMat &src, oclMat &dst, static void GPUFilterBox_32F_C4R(const oclMat &src, oclMat &dst,
Size &ksize, const Point anchor, const int borderType) Size &ksize, const Point anchor, const int borderType)
{ {
//Normalize the result by default //Normalize the result by default
@ -1218,7 +1218,7 @@ void linearRowFilter_gpu(const oclMat &src, const oclMat &dst, oclMat mat_kernel
} }
char compile_option[128]; char compile_option[128];
sprintf(compile_option, "-D RADIUSX=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s", anchor, localThreads[0], localThreads[1], channels, btype); sprintf(compile_option, "-D RADIUSX=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s", anchor, (int)localThreads[0], (int)localThreads[1], channels, btype);
size_t globalThreads[3]; size_t globalThreads[3];
globalThreads[1] = (dst.rows + localThreads[1] - 1) / localThreads[1] * localThreads[1]; globalThreads[1] = (dst.rows + localThreads[1] - 1) / localThreads[1] * localThreads[1];
@ -1251,12 +1251,12 @@ void linearRowFilter_gpu(const oclMat &src, const oclMat &dst, oclMat mat_kernel
CV_Assert(src.oclchannels() == dst.oclchannels()); CV_Assert(src.oclchannels() == dst.oclchannels());
CV_Assert(ksize == (anchor << 1) + 1); CV_Assert(ksize == (anchor << 1) + 1);
int src_pix_per_row, dst_pix_per_row; int src_pix_per_row, dst_pix_per_row;
int src_offset_x, src_offset_y, dst_offset_in_pixel; int src_offset_x, src_offset_y;//, dst_offset_in_pixel;
src_pix_per_row = src.step / src.elemSize(); src_pix_per_row = src.step / src.elemSize();
src_offset_x = (src.offset % src.step) / src.elemSize(); src_offset_x = (src.offset % src.step) / src.elemSize();
src_offset_y = src.offset / src.step; src_offset_y = src.offset / src.step;
dst_pix_per_row = dst.step / dst.elemSize(); dst_pix_per_row = dst.step / dst.elemSize();
dst_offset_in_pixel = dst.offset / dst.elemSize(); //dst_offset_in_pixel = dst.offset / dst.elemSize();
int ridusy = (dst.rows - src.rows) >> 1; int ridusy = (dst.rows - src.rows) >> 1;
vector<pair<size_t , const void *> > args; vector<pair<size_t , const void *> > args;
args.push_back(make_pair(sizeof(cl_mem), &src.data)); args.push_back(make_pair(sizeof(cl_mem), &src.data));
@ -1363,18 +1363,18 @@ void linearColumnFilter_gpu(const oclMat &src, const oclMat &dst, oclMat mat_ker
case 1: case 1:
globalThreads[0] = (dst.cols + localThreads[0] - 1) / localThreads[0] * localThreads[0]; globalThreads[0] = (dst.cols + localThreads[0] - 1) / localThreads[0] * localThreads[0];
sprintf(compile_option, "-D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s -D GENTYPE_SRC=%s -D GENTYPE_DST=%s -D convert_to_DST=%s", sprintf(compile_option, "-D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s -D GENTYPE_SRC=%s -D GENTYPE_DST=%s -D convert_to_DST=%s",
anchor, localThreads[0], localThreads[1], channels, btype, "float", "uchar", "convert_uchar_sat"); anchor, (int)localThreads[0], (int)localThreads[1], channels, btype, "float", "uchar", "convert_uchar_sat");
break; break;
case 2: case 2:
globalThreads[0] = ((dst.cols + 1) / 2 + localThreads[0] - 1) / localThreads[0] * localThreads[0]; globalThreads[0] = ((dst.cols + 1) / 2 + localThreads[0] - 1) / localThreads[0] * localThreads[0];
sprintf(compile_option, "-D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s -D GENTYPE_SRC=%s -D GENTYPE_DST=%s -D convert_to_DST=%s", sprintf(compile_option, "-D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s -D GENTYPE_SRC=%s -D GENTYPE_DST=%s -D convert_to_DST=%s",
anchor, localThreads[0], localThreads[1], channels, btype, "float2", "uchar2", "convert_uchar2_sat"); anchor, (int)localThreads[0], (int)localThreads[1], channels, btype, "float2", "uchar2", "convert_uchar2_sat");
break; break;
case 3: case 3:
case 4: case 4:
globalThreads[0] = (dst.cols + localThreads[0] - 1) / localThreads[0] * localThreads[0]; globalThreads[0] = (dst.cols + localThreads[0] - 1) / localThreads[0] * localThreads[0];
sprintf(compile_option, "-D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s -D GENTYPE_SRC=%s -D GENTYPE_DST=%s -D convert_to_DST=%s", sprintf(compile_option, "-D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s -D GENTYPE_SRC=%s -D GENTYPE_DST=%s -D convert_to_DST=%s",
anchor, localThreads[0], localThreads[1], channels, btype, "float4", "uchar4", "convert_uchar4_sat"); anchor, (int)localThreads[0], (int)localThreads[1], channels, btype, "float4", "uchar4", "convert_uchar4_sat");
break; break;
} }
} }
@ -1386,21 +1386,21 @@ void linearColumnFilter_gpu(const oclMat &src, const oclMat &dst, oclMat mat_ker
{ {
case CV_32SC1: case CV_32SC1:
sprintf(compile_option, "-D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s -D GENTYPE_SRC=%s -D GENTYPE_DST=%s -D convert_to_DST=%s", sprintf(compile_option, "-D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s -D GENTYPE_SRC=%s -D GENTYPE_DST=%s -D convert_to_DST=%s",
anchor, localThreads[0], localThreads[1], channels, btype, "float", "int", "convert_int_sat"); anchor, (int)localThreads[0], (int)localThreads[1], channels, btype, "float", "int", "convert_int_sat");
break; break;
case CV_32SC3: case CV_32SC3:
case CV_32SC4: case CV_32SC4:
sprintf(compile_option, "-D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s -D GENTYPE_SRC=%s -D GENTYPE_DST=%s -D convert_to_DST=%s", sprintf(compile_option, "-D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s -D GENTYPE_SRC=%s -D GENTYPE_DST=%s -D convert_to_DST=%s",
anchor, localThreads[0], localThreads[1], channels, btype, "float4", "int4", "convert_int4_sat"); anchor, (int)localThreads[0], (int)localThreads[1], channels, btype, "float4", "int4", "convert_int4_sat");
break; break;
case CV_32FC1: case CV_32FC1:
sprintf(compile_option, "-D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s -D GENTYPE_SRC=%s -D GENTYPE_DST=%s -D convert_to_DST=%s", sprintf(compile_option, "-D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s -D GENTYPE_SRC=%s -D GENTYPE_DST=%s -D convert_to_DST=%s",
anchor, localThreads[0], localThreads[1], channels, btype, "float", "float", ""); anchor, (int)localThreads[0], (int)localThreads[1], channels, btype, "float", "float", "");
break; break;
case CV_32FC3: case CV_32FC3:
case CV_32FC4: case CV_32FC4:
sprintf(compile_option, "-D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s -D GENTYPE_SRC=%s -D GENTYPE_DST=%s -D convert_to_DST=%s", sprintf(compile_option, "-D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s -D GENTYPE_SRC=%s -D GENTYPE_DST=%s -D convert_to_DST=%s",
anchor, localThreads[0], localThreads[1], channels, btype, "float4", "float4", ""); anchor, (int)localThreads[0], (int)localThreads[1], channels, btype, "float4", "float4", "");
break; break;
} }
} }
@ -1411,10 +1411,11 @@ void linearColumnFilter_gpu(const oclMat &src, const oclMat &dst, oclMat mat_ker
CV_Assert(src.oclchannels() == dst.oclchannels()); CV_Assert(src.oclchannels() == dst.oclchannels());
CV_Assert(ksize == (anchor << 1) + 1); CV_Assert(ksize == (anchor << 1) + 1);
int src_pix_per_row, dst_pix_per_row; int src_pix_per_row, dst_pix_per_row;
int src_offset_x, src_offset_y, dst_offset_in_pixel; //int src_offset_x, src_offset_y;
int dst_offset_in_pixel;
src_pix_per_row = src.step / src.elemSize(); src_pix_per_row = src.step / src.elemSize();
src_offset_x = (src.offset % src.step) / src.elemSize(); //src_offset_x = (src.offset % src.step) / src.elemSize();
src_offset_y = src.offset / src.step; //src_offset_y = src.offset / src.step;
dst_pix_per_row = dst.step / dst.elemSize(); dst_pix_per_row = dst.step / dst.elemSize();
dst_offset_in_pixel = dst.offset / dst.elemSize(); dst_offset_in_pixel = dst.offset / dst.elemSize();

File diff suppressed because it is too large Load Diff

@ -171,7 +171,7 @@ namespace cv
typedef void (*gpuThresh_t)(const oclMat &src, oclMat &dst, double thresh, double maxVal, int type); typedef void (*gpuThresh_t)(const oclMat &src, oclMat &dst, double thresh, double maxVal, int type);
void threshold_8u(const oclMat &src, oclMat &dst, double thresh, double maxVal, int type) static void threshold_8u(const oclMat &src, oclMat &dst, double thresh, double maxVal, int type)
{ {
CV_Assert( (src.cols == dst.cols) && (src.rows == dst.rows) ); CV_Assert( (src.cols == dst.cols) && (src.rows == dst.rows) );
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
@ -202,7 +202,7 @@ namespace cv
openCLExecuteKernel(clCxt, &imgproc_threshold, kernelName, globalThreads, localThreads, args, src.oclchannels(), src.depth()); openCLExecuteKernel(clCxt, &imgproc_threshold, kernelName, globalThreads, localThreads, args, src.oclchannels(), src.depth());
} }
void threshold_32f(const oclMat &src, oclMat &dst, double thresh, double maxVal, int type) static void threshold_32f(const oclMat &src, oclMat &dst, double thresh, double maxVal, int type)
{ {
CV_Assert( (src.cols == dst.cols) && (src.rows == dst.rows) ); CV_Assert( (src.cols == dst.cols) && (src.rows == dst.rows) );
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
@ -388,7 +388,7 @@ namespace cv
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
// resize // resize
void resize_gpu( const oclMat &src, oclMat &dst, double fx, double fy, int interpolation) static void resize_gpu( const oclMat &src, oclMat &dst, double fx, double fy, int interpolation)
{ {
CV_Assert( (src.channels() == dst.channels()) ); CV_Assert( (src.channels() == dst.channels()) );
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
@ -593,7 +593,7 @@ namespace cv
int dstOffset = dst.offset / dst.elemSize(); int dstOffset = dst.offset / dst.elemSize();
int __bordertype[] = {cv::BORDER_CONSTANT, cv::BORDER_REPLICATE, BORDER_REFLECT, BORDER_WRAP, BORDER_REFLECT_101}; int __bordertype[] = {cv::BORDER_CONSTANT, cv::BORDER_REPLICATE, BORDER_REFLECT, BORDER_WRAP, BORDER_REFLECT_101};
const char *borderstr[] = {"BORDER_CONSTANT", "BORDER_REPLICATE", "BORDER_REFLECT", "BORDER_WRAP", "BORDER_REFLECT_101"}; const char *borderstr[] = {"BORDER_CONSTANT", "BORDER_REPLICATE", "BORDER_REFLECT", "BORDER_WRAP", "BORDER_REFLECT_101"};
int bordertype_index; size_t bordertype_index;
for(bordertype_index = 0; bordertype_index < sizeof(__bordertype) / sizeof(int); bordertype_index++) for(bordertype_index = 0; bordertype_index < sizeof(__bordertype) / sizeof(int); bordertype_index++)
{ {
if(__bordertype[bordertype_index] == bordertype) if(__bordertype[bordertype_index] == bordertype)
@ -826,9 +826,9 @@ namespace cv
{ {
#define Sd(y,x) (Sd[y*3+x]) #define Sd(y,x) (Sd[y*3+x])
#define Dd(y,x) (Dd[y*3+x]) #define Dd(y,x) (Dd[y*3+x])
#define det3(m) (m(0,0)*(m(1,1)*m(2,2) - m(1,2)*m(2,1)) - \ #define det3(m) (m(0,0)*(m(1,1)*m(2,2) - m(1,2)*m(2,1)) - \
m(0,1)*(m(1,0)*m(2,2) - m(1,2)*m(2,0)) + \ m(0,1)*(m(1,0)*m(2,2) - m(1,2)*m(2,0)) + \
m(0,2)*(m(1,0)*m(2,1) - m(1,1)*m(2,0))) m(0,2)*(m(1,0)*m(2,1) - m(1,1)*m(2,0)))
double *Sd = M; double *Sd = M;
double *Dd = M; double *Dd = M;
double d = det3(Sd); double d = det3(Sd);
@ -1018,12 +1018,19 @@ namespace cv
int warpInd = (flags & WARP_INVERSE_MAP) >> 4; int warpInd = (flags & WARP_INVERSE_MAP) >> 4;
F coeffs[2][3]; F coeffs[2][3];
Mat coeffsMat(2, 3, CV_64F, (void *)coeffs);
double coeffsM[2*3];
Mat coeffsMat(2, 3, CV_64F, (void *)coeffsM);
M.convertTo(coeffsMat, coeffsMat.type()); M.convertTo(coeffsMat, coeffsMat.type());
if(!warpInd) if(!warpInd)
{ {
convert_coeffs((F *)(&coeffs[0][0])); convert_coeffs(coeffsM);
} }
for(int i = 0; i < 2; ++i)
for(int j = 0; j < 3; ++j)
coeffs[i][j] = coeffsM[i*3+j];
warpAffine_gpu(src, dst, coeffs, interpolation); warpAffine_gpu(src, dst, coeffs, interpolation);
} }
@ -1041,13 +1048,19 @@ namespace cv
int warpInd = (flags & WARP_INVERSE_MAP) >> 4; int warpInd = (flags & WARP_INVERSE_MAP) >> 4;
double coeffs[3][3]; double coeffs[3][3];
Mat coeffsMat(3, 3, CV_64F, (void *)coeffs);
double coeffsM[3*3];
Mat coeffsMat(3, 3, CV_64F, (void *)coeffsM);
M.convertTo(coeffsMat, coeffsMat.type()); M.convertTo(coeffsMat, coeffsMat.type());
if(!warpInd) if(!warpInd)
{ {
invert((double *)(&coeffs[0][0])); invert(coeffsM);
} }
for(int i = 0; i < 3; ++i)
for(int j = 0; j < 3; ++j)
coeffs[i][j] = coeffsM[i*3+j];
warpPerspective_gpu(src, dst, coeffs, interpolation); warpPerspective_gpu(src, dst, coeffs, interpolation);
} }
@ -1144,7 +1157,7 @@ namespace cv
} }
/////////////////////// corner ////////////////////////////// /////////////////////// corner //////////////////////////////
void extractCovData(const oclMat &src, oclMat &Dx, oclMat &Dy, static void extractCovData(const oclMat &src, oclMat &Dx, oclMat &Dy,
int blockSize, int ksize, int borderType) int blockSize, int ksize, int borderType)
{ {
CV_Assert(src.type() == CV_8UC1 || src.type() == CV_32FC1); CV_Assert(src.type() == CV_8UC1 || src.type() == CV_32FC1);
@ -1174,7 +1187,7 @@ namespace cv
CV_Assert(Dx.offset == 0 && Dy.offset == 0); CV_Assert(Dx.offset == 0 && Dy.offset == 0);
} }
void corner_ocl(const char *src_str, string kernelName, int block_size, float k, oclMat &Dx, oclMat &Dy, static void corner_ocl(const char *src_str, string kernelName, int block_size, float k, oclMat &Dx, oclMat &Dy,
oclMat &dst, int border_type) oclMat &dst, int border_type)
{ {
char borderType[30]; char borderType[30];
@ -1258,7 +1271,7 @@ namespace cv
corner_ocl(imgproc_calcMinEigenVal, "calcMinEigenVal", blockSize, 0, Dx, Dy, dst, borderType); corner_ocl(imgproc_calcMinEigenVal, "calcMinEigenVal", blockSize, 0, Dx, Dy, dst, borderType);
} }
/////////////////////////////////// MeanShiftfiltering /////////////////////////////////////////////// /////////////////////////////////// MeanShiftfiltering ///////////////////////////////////////////////
void meanShiftFiltering_gpu(const oclMat &src, oclMat dst, int sp, int sr, int maxIter, float eps) static void meanShiftFiltering_gpu(const oclMat &src, oclMat dst, int sp, int sr, int maxIter, float eps)
{ {
CV_Assert( (src.cols == dst.cols) && (src.rows == dst.rows) ); CV_Assert( (src.cols == dst.cols) && (src.rows == dst.rows) );
CV_Assert( !(dst.step & 0x3) ); CV_Assert( !(dst.step & 0x3) );
@ -1321,7 +1334,7 @@ namespace cv
} }
void meanShiftProc_gpu(const oclMat &src, oclMat dstr, oclMat dstsp, int sp, int sr, int maxIter, float eps) static void meanShiftProc_gpu(const oclMat &src, oclMat dstr, oclMat dstsp, int sp, int sr, int maxIter, float eps)
{ {
//sanity checks //sanity checks
CV_Assert( (src.cols == dstr.cols) && (src.rows == dstr.rows) && CV_Assert( (src.cols == dstr.cols) && (src.rows == dstr.rows) &&
@ -1398,7 +1411,7 @@ namespace cv
const int HISTOGRAM256_BIN_COUNT = 256; const int HISTOGRAM256_BIN_COUNT = 256;
} }
///////////////////////////////calcHist///////////////////////////////////////////////////////////////// ///////////////////////////////calcHist/////////////////////////////////////////////////////////////////
void calc_sub_hist(const oclMat &mat_src, const oclMat &mat_sub_hist) static void calc_sub_hist(const oclMat &mat_src, const oclMat &mat_sub_hist)
{ {
using namespace histograms; using namespace histograms;
@ -1477,7 +1490,7 @@ namespace cv
openCLExecuteKernel(clCxt, &imgproc_histogram, kernelName, globalThreads, localThreads, args, -1, depth); openCLExecuteKernel(clCxt, &imgproc_histogram, kernelName, globalThreads, localThreads, args, -1, depth);
} }
} }
void merge_sub_hist(const oclMat &sub_hist, oclMat &mat_hist) static void merge_sub_hist(const oclMat &sub_hist, oclMat &mat_hist)
{ {
using namespace histograms; using namespace histograms;
@ -1535,7 +1548,6 @@ namespace cv
{ {
int cn = src.channels(); int cn = src.channels();
int i, j, maxk, radius; int i, j, maxk, radius;
Size size = src.size();
CV_Assert( (src.channels() == 1 || src.channels() == 3) && CV_Assert( (src.channels() == 1 || src.channels() == 3) &&
src.type() == dst.type() && src.size() == dst.size() && src.type() == dst.type() && src.size() == dst.size() &&
@ -1632,7 +1644,7 @@ inline int divUp(int total, int grain)
{ {
return (total + grain - 1) / grain; return (total + grain - 1) / grain;
} }
void convolve_run(const oclMat &src, const oclMat &temp1, oclMat &dst, string kernelName, const char **kernelString) static void convolve_run(const oclMat &src, const oclMat &temp1, oclMat &dst, string kernelName, const char **kernelString)
{ {
CV_Assert(src.depth() == CV_32FC1); CV_Assert(src.depth() == CV_32FC1);
CV_Assert(temp1.depth() == CV_32F); CV_Assert(temp1.depth() == CV_32F);

@ -237,23 +237,13 @@ namespace cv
int getDevice(std::vector<Info> &oclinfo, int devicetype) int getDevice(std::vector<Info> &oclinfo, int devicetype)
{ {
cl_device_type _devicetype;
switch(devicetype) switch(devicetype)
{ {
case CVCL_DEVICE_TYPE_DEFAULT: case CVCL_DEVICE_TYPE_DEFAULT:
_devicetype = CL_DEVICE_TYPE_DEFAULT;
break;
case CVCL_DEVICE_TYPE_CPU: case CVCL_DEVICE_TYPE_CPU:
_devicetype = CL_DEVICE_TYPE_CPU;
break;
case CVCL_DEVICE_TYPE_GPU: case CVCL_DEVICE_TYPE_GPU:
_devicetype = CL_DEVICE_TYPE_GPU;
break;
case CVCL_DEVICE_TYPE_ACCELERATOR: case CVCL_DEVICE_TYPE_ACCELERATOR:
_devicetype = CL_DEVICE_TYPE_ACCELERATOR;
break;
case CVCL_DEVICE_TYPE_ALL: case CVCL_DEVICE_TYPE_ALL:
_devicetype = CL_DEVICE_TYPE_ALL;
break; break;
default: default:
CV_Error(CV_GpuApiCallError, "Unkown device type"); CV_Error(CV_GpuApiCallError, "Unkown device type");
@ -336,7 +326,7 @@ namespace cv
size_t extends_size; size_t extends_size;
openCLSafeCall(clGetDeviceInfo(oclinfo.impl->devices[devnum], CL_DEVICE_EXTENSIONS, openCLSafeCall(clGetDeviceInfo(oclinfo.impl->devices[devnum], CL_DEVICE_EXTENSIONS,
EXT_LEN, (void *)extends_set, &extends_size)); EXT_LEN, (void *)extends_set, &extends_size));
CV_Assert(extends_size < EXT_LEN); CV_Assert(extends_size < (size_t)EXT_LEN);
extends_set[EXT_LEN - 1] = 0; extends_set[EXT_LEN - 1] = 0;
memset(oclinfo.impl->extra_options, 0, 512); memset(oclinfo.impl->extra_options, 0, 512);
oclinfo.impl->double_support = 0; oclinfo.impl->double_support = 0;
@ -592,7 +582,7 @@ namespace cv
size_t binarySize = ftell(fp); size_t binarySize = ftell(fp);
fseek(fp, 0, SEEK_SET); fseek(fp, 0, SEEK_SET);
char *binary = new char[binarySize]; char *binary = new char[binarySize];
fread(binary, binarySize, 1, fp); CV_Assert(1 == fread(binary, binarySize, 1, fp));
fclose(fp); fclose(fp);
cl_int status = 0; cl_int status = 0;
program = clCreateProgramWithBinary(clCxt->impl->clContext, program = clCreateProgramWithBinary(clCxt->impl->clContext,

@ -282,7 +282,7 @@ void interpolate::bindImgTex(const oclMat &img, cl_mem &texture)
openCLFree(texture); openCLFree(texture);
} }
#if CL_VERSION_1_2 #ifdef CL_VERSION_1_2
cl_image_desc desc; cl_image_desc desc;
desc.image_type = CL_MEM_OBJECT_IMAGE2D; desc.image_type = CL_MEM_OBJECT_IMAGE2D;
desc.image_width = img.step / img.elemSize(); desc.image_width = img.step / img.elemSize();

@ -99,7 +99,7 @@ namespace cv
// Evaluates optimal template's area threshold. If // Evaluates optimal template's area threshold. If
// template's area is less than the threshold, we use naive match // template's area is less than the threshold, we use naive match
// template version, otherwise FFT-based (if available) // template version, otherwise FFT-based (if available)
int getTemplateThreshold(int method, int depth) static int getTemplateThreshold(int method, int depth)
{ {
switch (method) switch (method)
{ {

@ -126,7 +126,7 @@ namespace cv
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// convert_C3C4 // convert_C3C4
void convert_C3C4(const cl_mem &src, oclMat &dst) static void convert_C3C4(const cl_mem &src, oclMat &dst)
{ {
int dstStep_in_pixel = dst.step1() / dst.oclchannels(); int dstStep_in_pixel = dst.step1() / dst.oclchannels();
int pixel_end = dst.wholecols * dst.wholerows - 1; int pixel_end = dst.wholecols * dst.wholerows - 1;
@ -174,7 +174,7 @@ void convert_C3C4(const cl_mem &src, oclMat &dst)
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// convert_C4C3 // convert_C4C3
void convert_C4C3(const oclMat &src, cl_mem &dst) static void convert_C4C3(const oclMat &src, cl_mem &dst)
{ {
int srcStep_in_pixel = src.step1() / src.oclchannels(); int srcStep_in_pixel = src.step1() / src.oclchannels();
int pixel_end = src.wholecols * src.wholerows - 1; int pixel_end = src.wholecols * src.wholerows - 1;
@ -336,7 +336,7 @@ inline int divUp(int total, int grain)
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
////////////////////////////////// CopyTo ///////////////////////////////// ////////////////////////////////// CopyTo /////////////////////////////////
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void copy_to_with_mask(const oclMat &src, oclMat &dst, const oclMat &mask, string kernelName) static void copy_to_with_mask(const oclMat &src, oclMat &dst, const oclMat &mask, string kernelName)
{ {
CV_DbgAssert( dst.rows == mask.rows && dst.cols == mask.cols && CV_DbgAssert( dst.rows == mask.rows && dst.cols == mask.cols &&
src.rows == dst.rows && src.cols == dst.cols src.rows == dst.rows && src.cols == dst.cols
@ -401,7 +401,7 @@ void cv::ocl::oclMat::copyTo( oclMat &mat, const oclMat &mask) const
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
//////////////////////////////// ConvertTo //////////////////////////////// //////////////////////////////// ConvertTo ////////////////////////////////
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void convert_run(const oclMat &src, oclMat &dst, double alpha, double beta) static void convert_run(const oclMat &src, oclMat &dst, double alpha, double beta)
{ {
string kernelName = "convert_to_S"; string kernelName = "convert_to_S";
stringstream idxStr; stringstream idxStr;
@ -472,7 +472,7 @@ oclMat &cv::ocl::oclMat::operator = (const Scalar &s)
setTo(s); setTo(s);
return *this; return *this;
} }
void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, string kernelName) static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, string kernelName)
{ {
vector<pair<size_t , const void *> > args; vector<pair<size_t , const void *> > args;
@ -642,7 +642,7 @@ void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, string kern
default: default:
CV_Error(CV_StsUnsupportedFormat, "unknown depth"); CV_Error(CV_StsUnsupportedFormat, "unknown depth");
} }
#if CL_VERSION_1_2 #ifdef CL_VERSION_1_2
if(dst.offset == 0 && dst.cols == dst.wholecols) if(dst.offset == 0 && dst.cols == dst.wholecols)
{ {
clEnqueueFillBuffer(dst.clCxt->impl->clCmdQueue, (cl_mem)dst.data, args[0].second, args[0].first, 0, dst.step * dst.rows, 0, NULL, NULL); clEnqueueFillBuffer(dst.clCxt->impl->clCmdQueue, (cl_mem)dst.data, args[0].second, args[0].first, 0, dst.step * dst.rows, 0, NULL, NULL);
@ -668,7 +668,7 @@ void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, string kern
#endif #endif
} }
void set_to_withmask_run(const oclMat &dst, const Scalar &scalar, const oclMat &mask, string kernelName) static void set_to_withmask_run(const oclMat &dst, const Scalar &scalar, const oclMat &mask, string kernelName)
{ {
CV_DbgAssert( dst.rows == mask.rows && dst.cols == mask.cols); CV_DbgAssert( dst.rows == mask.rows && dst.cols == mask.cols);
vector<pair<size_t , const void *> > args; vector<pair<size_t , const void *> > args;

@ -62,7 +62,7 @@ namespace cv
} }
// provide additional methods for the user to interact with the command queue after a task is fired // provide additional methods for the user to interact with the command queue after a task is fired
void openCLExecuteKernel_2(Context *clCxt , const char **source, string kernelName, size_t globalThreads[3], static void openCLExecuteKernel_2(Context *clCxt , const char **source, string kernelName, size_t globalThreads[3],
size_t localThreads[3], vector< pair<size_t, const void *> > &args, int channels, size_t localThreads[3], vector< pair<size_t, const void *> > &args, int channels,
int depth, char *build_options, FLUSH_MODE finish_mode) int depth, char *build_options, FLUSH_MODE finish_mode)
{ {

@ -46,7 +46,7 @@
#ifndef __OPENCV_PRECOMP_H__ #ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__ #define __OPENCV_PRECOMP_H__
#if _MSC_VER >= 1200 #if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4267 4324 4244 4251 4710 4711 4514 4996 ) #pragma warning( disable: 4267 4324 4244 4251 4710 4711 4514 4996 )
#endif #endif

@ -66,7 +66,7 @@ namespace cv
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
/////////////////////// add subtract multiply divide ///////////////////////// /////////////////////// add subtract multiply divide /////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void pyrdown_run(const oclMat &src, const oclMat &dst) static void pyrdown_run(const oclMat &src, const oclMat &dst)
{ {
CV_Assert(src.type() == dst.type()); CV_Assert(src.type() == dst.type());

@ -115,7 +115,7 @@ inline int divUp(int total, int grain)
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
//////////////////////////////// ConvertTo //////////////////////////////// //////////////////////////////// ConvertTo ////////////////////////////////
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void convert_run_cus(const oclMat &src, oclMat &dst, double alpha, double beta) static void convert_run_cus(const oclMat &src, oclMat &dst, double alpha, double beta)
{ {
string kernelName = "convert_to_S"; string kernelName = "convert_to_S";
stringstream idxStr; stringstream idxStr;
@ -186,7 +186,7 @@ void convertTo( const oclMat &src, oclMat &dst, int rtype, double alpha, double
// setTo(s); // setTo(s);
// return *this; // return *this;
//} //}
void set_to_withoutmask_run_cus(const oclMat &dst, const Scalar &scalar, string kernelName) static void set_to_withoutmask_run_cus(const oclMat &dst, const Scalar &scalar, string kernelName)
{ {
vector<pair<size_t , const void *> > args; vector<pair<size_t , const void *> > args;
@ -356,7 +356,7 @@ void set_to_withoutmask_run_cus(const oclMat &dst, const Scalar &scalar, string
default: default:
CV_Error(CV_StsUnsupportedFormat, "unknown depth"); CV_Error(CV_StsUnsupportedFormat, "unknown depth");
} }
#if CL_VERSION_1_2 #ifdef CL_VERSION_1_2
if(dst.offset == 0 && dst.cols == dst.wholecols) if(dst.offset == 0 && dst.cols == dst.wholecols)
{ {
clEnqueueFillBuffer(dst.clCxt->impl->clCmdQueue, (cl_mem)dst.data, args[0].second, args[0].first, 0, dst.step * dst.rows, 0, NULL, NULL); clEnqueueFillBuffer(dst.clCxt->impl->clCmdQueue, (cl_mem)dst.data, args[0].second, args[0].first, 0, dst.step * dst.rows, 0, NULL, NULL);
@ -382,7 +382,7 @@ void set_to_withoutmask_run_cus(const oclMat &dst, const Scalar &scalar, string
#endif #endif
} }
oclMat &setTo(oclMat &src, const Scalar &scalar) static oclMat &setTo(oclMat &src, const Scalar &scalar)
{ {
CV_Assert( src.depth() >= 0 && src.depth() <= 6 ); CV_Assert( src.depth() >= 0 && src.depth() <= 6 );
CV_DbgAssert( !src.empty()); CV_DbgAssert( !src.empty());
@ -402,48 +402,48 @@ oclMat &setTo(oclMat &src, const Scalar &scalar)
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
////////////////////////////////// CopyTo ///////////////////////////////// ////////////////////////////////// CopyTo /////////////////////////////////
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void copy_to_with_mask_cus(const oclMat &src, oclMat &dst, const oclMat &mask, string kernelName) // static void copy_to_with_mask_cus(const oclMat &src, oclMat &dst, const oclMat &mask, string kernelName)
{ // {
CV_DbgAssert( dst.rows == mask.rows && dst.cols == mask.cols && // CV_DbgAssert( dst.rows == mask.rows && dst.cols == mask.cols &&
src.rows == dst.rows && src.cols == dst.cols // src.rows == dst.rows && src.cols == dst.cols
&& mask.type() == CV_8UC1); // && mask.type() == CV_8UC1);
vector<pair<size_t , const void *> > args; // vector<pair<size_t , const void *> > args;
std::string string_types[4][7] = {{"uchar", "char", "ushort", "short", "int", "float", "double"}, // std::string string_types[4][7] = {{"uchar", "char", "ushort", "short", "int", "float", "double"},
{"uchar2", "char2", "ushort2", "short2", "int2", "float2", "double2"}, // {"uchar2", "char2", "ushort2", "short2", "int2", "float2", "double2"},
{"uchar3", "char3", "ushort3", "short3", "int3", "float3", "double3"}, // {"uchar3", "char3", "ushort3", "short3", "int3", "float3", "double3"},
{"uchar4", "char4", "ushort4", "short4", "int4", "float4", "double4"} // {"uchar4", "char4", "ushort4", "short4", "int4", "float4", "double4"}
}; // };
char compile_option[32]; // char compile_option[32];
sprintf(compile_option, "-D GENTYPE=%s", string_types[dst.oclchannels() - 1][dst.depth()].c_str()); // sprintf(compile_option, "-D GENTYPE=%s", string_types[dst.oclchannels() - 1][dst.depth()].c_str());
size_t localThreads[3] = {16, 16, 1}; // size_t localThreads[3] = {16, 16, 1};
size_t globalThreads[3]; // size_t globalThreads[3];
globalThreads[0] = divUp(dst.cols, localThreads[0]) * localThreads[0]; // globalThreads[0] = divUp(dst.cols, localThreads[0]) * localThreads[0];
globalThreads[1] = divUp(dst.rows, localThreads[1]) * localThreads[1]; // globalThreads[1] = divUp(dst.rows, localThreads[1]) * localThreads[1];
globalThreads[2] = 1; // globalThreads[2] = 1;
int dststep_in_pixel = dst.step / dst.elemSize(), dstoffset_in_pixel = dst.offset / dst.elemSize(); // int dststep_in_pixel = dst.step / dst.elemSize(), dstoffset_in_pixel = dst.offset / dst.elemSize();
int srcstep_in_pixel = src.step / src.elemSize(), srcoffset_in_pixel = src.offset / src.elemSize(); // int srcstep_in_pixel = src.step / src.elemSize(), srcoffset_in_pixel = src.offset / src.elemSize();
args.push_back( make_pair( sizeof(cl_mem) , (void *)&src.data )); // args.push_back( make_pair( sizeof(cl_mem) , (void *)&src.data ));
args.push_back( make_pair( sizeof(cl_mem) , (void *)&dst.data )); // args.push_back( make_pair( sizeof(cl_mem) , (void *)&dst.data ));
args.push_back( make_pair( sizeof(cl_mem) , (void *)&mask.data )); // args.push_back( make_pair( sizeof(cl_mem) , (void *)&mask.data ));
args.push_back( make_pair( sizeof(cl_int) , (void *)&src.cols )); // args.push_back( make_pair( sizeof(cl_int) , (void *)&src.cols ));
args.push_back( make_pair( sizeof(cl_int) , (void *)&src.rows )); // args.push_back( make_pair( sizeof(cl_int) , (void *)&src.rows ));
args.push_back( make_pair( sizeof(cl_int) , (void *)&srcstep_in_pixel )); // args.push_back( make_pair( sizeof(cl_int) , (void *)&srcstep_in_pixel ));
args.push_back( make_pair( sizeof(cl_int) , (void *)&srcoffset_in_pixel )); // args.push_back( make_pair( sizeof(cl_int) , (void *)&srcoffset_in_pixel ));
args.push_back( make_pair( sizeof(cl_int) , (void *)&dststep_in_pixel )); // args.push_back( make_pair( sizeof(cl_int) , (void *)&dststep_in_pixel ));
args.push_back( make_pair( sizeof(cl_int) , (void *)&dstoffset_in_pixel )); // args.push_back( make_pair( sizeof(cl_int) , (void *)&dstoffset_in_pixel ));
args.push_back( make_pair( sizeof(cl_int) , (void *)&mask.step )); // args.push_back( make_pair( sizeof(cl_int) , (void *)&mask.step ));
args.push_back( make_pair( sizeof(cl_int) , (void *)&mask.offset )); // args.push_back( make_pair( sizeof(cl_int) , (void *)&mask.offset ));
openCLExecuteKernel2(dst.clCxt , &operator_copyToM, kernelName, globalThreads, // openCLExecuteKernel2(dst.clCxt , &operator_copyToM, kernelName, globalThreads,
localThreads, args, -1, -1, compile_option, CLFLUSH); // localThreads, args, -1, -1, compile_option, CLFLUSH);
} // }
void copyTo(const oclMat &src, oclMat &m ) static void copyTo(const oclMat &src, oclMat &m )
{ {
CV_DbgAssert(!src.empty()); CV_DbgAssert(!src.empty());
m.create(src.size(), src.type()); m.create(src.size(), src.type());
@ -451,20 +451,20 @@ void copyTo(const oclMat &src, oclMat &m )
src.data, src.step, src.cols * src.elemSize(), src.rows, src.offset); src.data, src.step, src.cols * src.elemSize(), src.rows, src.offset);
} }
void copyTo(const oclMat &src, oclMat &mat, const oclMat &mask) // static void copyTo(const oclMat &src, oclMat &mat, const oclMat &mask)
{ // {
if (mask.empty()) // if (mask.empty())
{ // {
copyTo(src, mat); // copyTo(src, mat);
} // }
else // else
{ // {
mat.create(src.size(), src.type()); // mat.create(src.size(), src.type());
copy_to_with_mask_cus(src, mat, mask, "copy_to_with_mask"); // copy_to_with_mask_cus(src, mat, mask, "copy_to_with_mask");
} // }
} // }
void arithmetic_run(const oclMat &src1, oclMat &dst, string kernelName, const char **kernelString, void *_scalar) static void arithmetic_run(const oclMat &src1, oclMat &dst, string kernelName, const char **kernelString, void *_scalar)
{ {
if(src1.clCxt -> impl -> double_support == 0 && src1.type() == CV_64F) if(src1.clCxt -> impl -> double_support == 0 && src1.type() == CV_64F)
{ {
@ -529,12 +529,12 @@ void arithmetic_run(const oclMat &src1, oclMat &dst, string kernelName, const ch
openCLExecuteKernel2(clCxt, kernelString, kernelName, globalThreads, localThreads, args, -1, src1.depth(), CLFLUSH); openCLExecuteKernel2(clCxt, kernelString, kernelName, globalThreads, localThreads, args, -1, src1.depth(), CLFLUSH);
} }
void multiply_cus(const oclMat &src1, oclMat &dst, float scalar) static void multiply_cus(const oclMat &src1, oclMat &dst, float scalar)
{ {
arithmetic_run(src1, dst, "arithm_muls", &arithm_mul, (void *)(&scalar)); arithmetic_run(src1, dst, "arithm_muls", &arithm_mul, (void *)(&scalar));
} }
void pyrdown_run_cus(const oclMat &src, const oclMat &dst) static void pyrdown_run_cus(const oclMat &src, const oclMat &dst)
{ {
CV_Assert(src.type() == dst.type()); CV_Assert(src.type() == dst.type());
@ -559,7 +559,7 @@ void pyrdown_run_cus(const oclMat &src, const oclMat &dst)
openCLExecuteKernel2(clCxt, &pyr_down, kernelName, globalThreads, localThreads, args, src.oclchannels(), src.depth(), CLFLUSH); openCLExecuteKernel2(clCxt, &pyr_down, kernelName, globalThreads, localThreads, args, src.oclchannels(), src.depth(), CLFLUSH);
} }
void pyrDown_cus(const oclMat &src, oclMat &dst) static void pyrDown_cus(const oclMat &src, oclMat &dst)
{ {
CV_Assert(src.depth() <= CV_32F && src.channels() <= 4); CV_Assert(src.depth() <= CV_32F && src.channels() <= 4);
@ -673,7 +673,7 @@ void pyrDown_cus(const oclMat &src, oclMat &dst)
// //} // //}
//} //}
cl_mem bindTexture(const oclMat &mat, int depth, int channels) static cl_mem bindTexture(const oclMat &mat, int depth, int channels)
{ {
cl_mem texture; cl_mem texture;
cl_image_format format; cl_image_format format;
@ -698,7 +698,7 @@ cl_mem bindTexture(const oclMat &mat, int depth, int channels)
{ {
format.image_channel_order = CL_RGBA; format.image_channel_order = CL_RGBA;
} }
#if CL_VERSION_1_2 #ifdef CL_VERSION_1_2
cl_image_desc desc; cl_image_desc desc;
desc.image_type = CL_MEM_OBJECT_IMAGE2D; desc.image_type = CL_MEM_OBJECT_IMAGE2D;
desc.image_width = mat.step / mat.elemSize(); desc.image_width = mat.step / mat.elemSize();
@ -730,12 +730,12 @@ cl_mem bindTexture(const oclMat &mat, int depth, int channels)
return texture; return texture;
} }
void releaseTexture(cl_mem texture) static void releaseTexture(cl_mem texture)
{ {
openCLFree(texture); openCLFree(texture);
} }
void lkSparse_run(oclMat &I, oclMat &J, static void lkSparse_run(oclMat &I, oclMat &J,
const oclMat &prevPts, oclMat &nextPts, oclMat &status, oclMat& err, bool /*GET_MIN_EIGENVALS*/, int ptcount, const oclMat &prevPts, oclMat &nextPts, oclMat &status, oclMat& err, bool /*GET_MIN_EIGENVALS*/, int ptcount,
int level, /*dim3 block, */dim3 patch, Size winSize, int iters) int level, /*dim3 block, */dim3 patch, Size winSize, int iters)
{ {
@ -915,7 +915,7 @@ void cv::ocl::PyrLKOpticalFlow::sparse(const oclMat &prevImg, const oclMat &next
delete err; delete err;
} }
void lkDense_run(oclMat &I, oclMat &J, oclMat &u, oclMat &v, static void lkDense_run(oclMat &I, oclMat &J, oclMat &u, oclMat &v,
oclMat &prevU, oclMat &prevV, oclMat *err, Size winSize, int iters) oclMat &prevU, oclMat &prevV, oclMat *err, Size winSize, int iters)
{ {
Context *clCxt = I.clCxt; Context *clCxt = I.clCxt;

@ -111,52 +111,52 @@ namespace cv
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
////////////////////merge////////////////////////////////////////////////// ////////////////////merge//////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
void merge_vector_run_no_roi(const oclMat *mat_src, size_t n, oclMat &mat_dst) // static void merge_vector_run_no_roi(const oclMat *mat_src, size_t n, oclMat &mat_dst)
{ // {
Context *clCxt = mat_dst.clCxt; // Context *clCxt = mat_dst.clCxt;
int channels = mat_dst.oclchannels(); // int channels = mat_dst.oclchannels();
int depth = mat_dst.depth(); // int depth = mat_dst.depth();
string kernelName = "merge_vector"; // string kernelName = "merge_vector";
int indexes[4][7] = {{0, 0, 0, 0, 0, 0, 0}, // int indexes[4][7] = {{0, 0, 0, 0, 0, 0, 0},
{4, 4, 2, 2, 1, 1, 1}, // {4, 4, 2, 2, 1, 1, 1},
{4, 4, 2, 2 , 1, 1, 1}, // {4, 4, 2, 2 , 1, 1, 1},
{4, 4, 2, 2, 1, 1, 1} // {4, 4, 2, 2, 1, 1, 1}
}; // };
size_t index = indexes[channels - 1][mat_dst.depth()]; // size_t index = indexes[channels - 1][mat_dst.depth()];
int cols = divUp(mat_dst.cols, index); // int cols = divUp(mat_dst.cols, index);
size_t localThreads[3] = { 64, 4, 1 }; // size_t localThreads[3] = { 64, 4, 1 };
size_t globalThreads[3] = { divUp(cols, localThreads[0]) *localThreads[0], // size_t globalThreads[3] = { divUp(cols, localThreads[0]) *localThreads[0],
divUp(mat_dst.rows, localThreads[1]) *localThreads[1], // divUp(mat_dst.rows, localThreads[1]) *localThreads[1],
1 // 1
}; // };
vector<pair<size_t , const void *> > args; // vector<pair<size_t , const void *> > args;
args.push_back( make_pair( sizeof(cl_int), (void *)&mat_dst.rows)); // args.push_back( make_pair( sizeof(cl_int), (void *)&mat_dst.rows));
args.push_back( make_pair( sizeof(cl_int), (void *)&cols)); // args.push_back( make_pair( sizeof(cl_int), (void *)&cols));
args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_dst.data)); // args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_dst.data));
args.push_back( make_pair( sizeof(cl_int), (void *)&mat_dst.step)); // args.push_back( make_pair( sizeof(cl_int), (void *)&mat_dst.step));
args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_src[0].data)); // args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_src[0].data));
args.push_back( make_pair( sizeof(cl_int), (void *)&mat_src[0].step)); // args.push_back( make_pair( sizeof(cl_int), (void *)&mat_src[0].step));
args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_src[1].data)); // args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_src[1].data));
args.push_back( make_pair( sizeof(cl_int), (void *)&mat_src[1].step)); // args.push_back( make_pair( sizeof(cl_int), (void *)&mat_src[1].step));
if(n >= 3) // if(n >= 3)
{ // {
args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_src[2].data)); // args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_src[2].data));
args.push_back( make_pair( sizeof(cl_int), (void *)&mat_src[2].step)); // args.push_back( make_pair( sizeof(cl_int), (void *)&mat_src[2].step));
} // }
if(n >= 4) // if(n >= 4)
{ // {
args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_src[3].data)); // args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_src[3].data));
args.push_back( make_pair( sizeof(cl_int), (void *)&mat_src[3].step)); // args.push_back( make_pair( sizeof(cl_int), (void *)&mat_src[3].step));
} // }
openCLExecuteKernel(clCxt, &merge_mat, kernelName, globalThreads, localThreads, args, channels, depth); // openCLExecuteKernel(clCxt, &merge_mat, kernelName, globalThreads, localThreads, args, channels, depth);
} // }
void merge_vector_run(const oclMat *mat_src, size_t n, oclMat &mat_dst) static void merge_vector_run(const oclMat *mat_src, size_t n, oclMat &mat_dst)
{ {
if(mat_dst.clCxt -> impl -> double_support == 0 && mat_dst.type() == CV_64F) if(mat_dst.clCxt -> impl -> double_support == 0 && mat_dst.type() == CV_64F)
{ {
@ -228,7 +228,7 @@ namespace cv
openCLExecuteKernel(clCxt, &merge_mat, kernelName, globalThreads, localThreads, args, channels, depth); openCLExecuteKernel(clCxt, &merge_mat, kernelName, globalThreads, localThreads, args, channels, depth);
} }
void merge(const oclMat *mat_src, size_t n, oclMat &mat_dst) static void merge(const oclMat *mat_src, size_t n, oclMat &mat_dst)
{ {
CV_Assert(mat_src); CV_Assert(mat_src);
CV_Assert(n > 0); CV_Assert(n > 0);
@ -260,51 +260,51 @@ namespace cv
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////split///////////////////////////////////////////////////////////// //////////////////////////////////////split/////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
void split_vector_run_no_roi(const oclMat &mat_src, oclMat *mat_dst) // static void split_vector_run_no_roi(const oclMat &mat_src, oclMat *mat_dst)
{ // {
Context *clCxt = mat_src.clCxt; // Context *clCxt = mat_src.clCxt;
int channels = mat_src.oclchannels(); // int channels = mat_src.oclchannels();
int depth = mat_src.depth(); // int depth = mat_src.depth();
string kernelName = "split_vector"; // string kernelName = "split_vector";
int indexes[4][7] = {{0, 0, 0, 0, 0, 0, 0}, // int indexes[4][7] = {{0, 0, 0, 0, 0, 0, 0},
{8, 8, 8, 8, 4, 4, 2}, // {8, 8, 8, 8, 4, 4, 2},
{8, 8, 8, 8 , 4, 4, 4}, // {8, 8, 8, 8 , 4, 4, 4},
{4, 4, 2, 2, 1, 1, 1} // {4, 4, 2, 2, 1, 1, 1}
}; // };
size_t index = indexes[channels - 1][mat_dst[0].depth()]; // size_t index = indexes[channels - 1][mat_dst[0].depth()];
int cols = divUp(mat_src.cols, index); // int cols = divUp(mat_src.cols, index);
size_t localThreads[3] = { 64, 4, 1 }; // size_t localThreads[3] = { 64, 4, 1 };
size_t globalThreads[3] = { divUp(cols, localThreads[0]) *localThreads[0], // size_t globalThreads[3] = { divUp(cols, localThreads[0]) *localThreads[0],
divUp(mat_src.rows, localThreads[1]) *localThreads[1], // divUp(mat_src.rows, localThreads[1]) *localThreads[1],
1 // 1
}; // };
vector<pair<size_t , const void *> > args; // vector<pair<size_t , const void *> > args;
args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_src.data)); // args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_src.data));
args.push_back( make_pair( sizeof(cl_int), (void *)&mat_src.step)); // args.push_back( make_pair( sizeof(cl_int), (void *)&mat_src.step));
args.push_back( make_pair( sizeof(cl_int), (void *)&mat_src.rows)); // args.push_back( make_pair( sizeof(cl_int), (void *)&mat_src.rows));
args.push_back( make_pair( sizeof(cl_int), (void *)&cols)); // args.push_back( make_pair( sizeof(cl_int), (void *)&cols));
args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_dst[0].data)); // args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_dst[0].data));
args.push_back( make_pair( sizeof(cl_int), (void *)&mat_dst[0].step)); // args.push_back( make_pair( sizeof(cl_int), (void *)&mat_dst[0].step));
args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_dst[1].data)); // args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_dst[1].data));
args.push_back( make_pair( sizeof(cl_int), (void *)&mat_dst[1].step)); // args.push_back( make_pair( sizeof(cl_int), (void *)&mat_dst[1].step));
if(channels >= 3) // if(channels >= 3)
{ // {
args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_dst[2].data)); // args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_dst[2].data));
args.push_back( make_pair( sizeof(cl_int), (void *)&mat_dst[2].step)); // args.push_back( make_pair( sizeof(cl_int), (void *)&mat_dst[2].step));
} // }
if(channels >= 4) // if(channels >= 4)
{ // {
args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_dst[3].data)); // args.push_back( make_pair( sizeof(cl_mem), (void *)&mat_dst[3].data));
args.push_back( make_pair( sizeof(cl_int), (void *)&mat_dst[3].step)); // args.push_back( make_pair( sizeof(cl_int), (void *)&mat_dst[3].step));
} // }
openCLExecuteKernel(clCxt, &split_mat, kernelName, globalThreads, localThreads, args, channels, depth); // openCLExecuteKernel(clCxt, &split_mat, kernelName, globalThreads, localThreads, args, channels, depth);
} // }
void split_vector_run(const oclMat &mat_src, oclMat *mat_dst) static void split_vector_run(const oclMat &mat_src, oclMat *mat_dst)
{ {
if(mat_src.clCxt -> impl -> double_support == 0 && mat_src.type() == CV_64F) if(mat_src.clCxt -> impl -> double_support == 0 && mat_src.type() == CV_64F)
@ -374,7 +374,7 @@ namespace cv
openCLExecuteKernel(clCxt, &split_mat, kernelName, globalThreads, localThreads, args, channels, depth); openCLExecuteKernel(clCxt, &split_mat, kernelName, globalThreads, localThreads, args, channels, depth);
} }
void split(const oclMat &mat_src, oclMat *mat_dst) static void split(const oclMat &mat_src, oclMat *mat_dst)
{ {
CV_Assert(mat_dst); CV_Assert(mat_dst);

@ -536,7 +536,7 @@ void SURF_OCL_Invoker::bindImgTex(const oclMat &img, cl_mem &texture)
openCLFree(texture); openCLFree(texture);
} }
#if CL_VERSION_1_2 #ifdef CL_VERSION_1_2
cl_image_desc desc; cl_image_desc desc;
desc.image_type = CL_MEM_OBJECT_IMAGE2D; desc.image_type = CL_MEM_OBJECT_IMAGE2D;
desc.image_width = img.step / img.elemSize(); desc.image_width = img.step / img.elemSize();

@ -38,6 +38,15 @@
// the use of this software, even if advised of the possibility of such damage. // the use of this software, even if advised of the possibility of such damage.
// //
//M*/ //M*/
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wmissing-declarations"
# if defined __clang__ || defined __APPLE__
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
# pragma GCC diagnostic ignored "-Wextra"
# endif
#endif
#ifndef __OPENCV_TEST_PRECOMP_HPP__ #ifndef __OPENCV_TEST_PRECOMP_HPP__
#define __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__

@ -1449,8 +1449,8 @@ TEST_P(MagnitudeSqr, Mat)
for(int j = 0; j < LOOP_TIMES; j++) for(int j = 0; j < LOOP_TIMES; j++)
{ {
// random_roi(); // random_roi();
int64 start, end; // int64 start, end;
start = cv::getTickCount(); // start = cv::getTickCount();
for(int i = 0; i < mat1.rows; ++i) for(int i = 0; i < mat1.rows; ++i)
for(int j = 0; j < mat1.cols; ++j) for(int j = 0; j < mat1.cols; ++j)
{ {
@ -1465,7 +1465,7 @@ TEST_P(MagnitudeSqr, Mat)
// ((float *)(dst.data))[i*dst.step/4 +j]= val1 * val1 +val2 * val2; // ((float *)(dst.data))[i*dst.step/4 +j]= val1 * val1 +val2 * val2;
} }
end = cv::getTickCount(); // end = cv::getTickCount();

@ -74,7 +74,7 @@ TEST_P(Blend, Accuracy)
else else
blendLinearGold<float>(img1, img2, weights1, weights2, result_gold); blendLinearGold<float>(img1, img2, weights1, weights2, result_gold);
EXPECT_MAT_NEAR(result_gold, result, CV_MAT_DEPTH(type) == CV_8U ? 1 : 1e-5f, NULL) EXPECT_MAT_NEAR(result_gold, result, CV_MAT_DEPTH(type) == CV_8U ? 1.f : 1e-5f, 0);
} }
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, Blend, Combine( INSTANTIATE_TEST_CASE_P(GPU_ImgProc, Blend, Combine(

@ -181,13 +181,13 @@ INSTANTIATE_TEST_CASE_P(OCL_ImgProc, CvtColor, testing::Combine(
INSTANTIATE_TEST_CASE_P(OCL_ImgProc, CvtColor_YUV420, testing::Combine( INSTANTIATE_TEST_CASE_P(OCL_ImgProc, CvtColor_YUV420, testing::Combine(
testing::Values(cv::Size(128, 45), cv::Size(46, 132), cv::Size(1024, 1023)), testing::Values(cv::Size(128, 45), cv::Size(46, 132), cv::Size(1024, 1023)),
testing::Values(CV_YUV2RGBA_NV12, CV_YUV2BGRA_NV12, CV_YUV2RGB_NV12, CV_YUV2BGR_NV12) testing::Values((int)CV_YUV2RGBA_NV12, (int)CV_YUV2BGRA_NV12, (int)CV_YUV2RGB_NV12, (int)CV_YUV2BGR_NV12)
)); ));
INSTANTIATE_TEST_CASE_P(OCL_ImgProc, CvtColor_Gray2RGB, testing::Combine( INSTANTIATE_TEST_CASE_P(OCL_ImgProc, CvtColor_Gray2RGB, testing::Combine(
DIFFERENT_SIZES, DIFFERENT_SIZES,
testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F)), testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F)),
testing::Values(CV_GRAY2BGR, CV_GRAY2BGRA, CV_GRAY2RGB, CV_GRAY2RGBA) testing::Values((int)CV_GRAY2BGR, (int)CV_GRAY2BGRA, (int)CV_GRAY2RGB, (int)CV_GRAY2RGBA)
)); ));
} }
#endif #endif

@ -109,15 +109,15 @@ TEST_F(Haar, FaceDetect)
//double t = 0; //double t = 0;
vector<Rect> faces, oclfaces; vector<Rect> faces, oclfaces;
const static Scalar colors[] = { CV_RGB(0, 0, 255), // const static Scalar colors[] = { CV_RGB(0, 0, 255),
CV_RGB(0, 128, 255), // CV_RGB(0, 128, 255),
CV_RGB(0, 255, 255), // CV_RGB(0, 255, 255),
CV_RGB(0, 255, 0), // CV_RGB(0, 255, 0),
CV_RGB(255, 128, 0), // CV_RGB(255, 128, 0),
CV_RGB(255, 255, 0), // CV_RGB(255, 255, 0),
CV_RGB(255, 0, 0), // CV_RGB(255, 0, 0),
CV_RGB(255, 0, 255) // CV_RGB(255, 0, 255)
} ; // } ;
Mat gray, smallImg(cvRound (img.rows / scale), cvRound(img.cols / scale), CV_8UC1 ); Mat gray, smallImg(cvRound (img.rows / scale), cvRound(img.cols / scale), CV_8UC1 );
MemStorage storage(cvCreateMemStorage(0)); MemStorage storage(cvCreateMemStorage(0));

@ -498,11 +498,11 @@ TEST_P(bilateralFilter, Mat)
} }
else else
{ {
for(int i = 0; i < sizeof(bordertype) / sizeof(int); i++) for(size_t i = 0; i < sizeof(bordertype) / sizeof(int); i++)
for(int j = 0; j < LOOP_TIMES; j++) for(int j = 0; j < LOOP_TIMES; j++)
{ {
random_roi(); random_roi();
if(((bordertype[i] != cv::BORDER_CONSTANT) && (bordertype[i] != cv::BORDER_REPLICATE)) && (mat1_roi.cols <= radius) || (mat1_roi.cols <= radius) || (mat1_roi.rows <= radius) || (mat1_roi.rows <= radius)) if(((bordertype[i] != cv::BORDER_CONSTANT) && (bordertype[i] != cv::BORDER_REPLICATE) && (mat1_roi.cols <= radius)) || (mat1_roi.cols <= radius) || (mat1_roi.rows <= radius) || (mat1_roi.rows <= radius))
{ {
continue; continue;
} }
@ -563,7 +563,7 @@ TEST_P(CopyMakeBorder, Mat)
} }
else else
{ {
for(int i = 0; i < sizeof(bordertype) / sizeof(int); i++) for(size_t i = 0; i < sizeof(bordertype) / sizeof(int); i++)
for(int j = 0; j < LOOP_TIMES; j++) for(int j = 0; j < LOOP_TIMES; j++)
{ {
random_roi(); random_roi();
@ -911,7 +911,6 @@ PARAM_TEST_CASE(Remap, MatType, MatType, MatType, int, int)
cv::RNG &rng = TS::ptr()->get_rng(); cv::RNG &rng = TS::ptr()->get_rng();
cv::Size srcSize = cv::Size(MWIDTH, MHEIGHT); cv::Size srcSize = cv::Size(MWIDTH, MHEIGHT);
cv::Size dstSize = cv::Size(MWIDTH, MHEIGHT);
cv::Size map1Size = cv::Size(MWIDTH, MHEIGHT); cv::Size map1Size = cv::Size(MWIDTH, MHEIGHT);
double min = 5, max = 16; double min = 5, max = 16;

@ -100,7 +100,7 @@ TEST_P(MatchTemplate8U, Accuracy)
EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1, sss); EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1, sss);
#if PERF_TEST #ifdef PERF_TEST
{ {
P_TEST_FULL( {}, {cv::ocl::matchTemplate(ocl_image, ocl_templ, dst, method);}, {}); P_TEST_FULL( {}, {cv::ocl::matchTemplate(ocl_image, ocl_templ, dst, method);}, {});
P_TEST_FULL( {}, {cv::matchTemplate(image, templ, dst_gold, method);}, {}); P_TEST_FULL( {}, {cv::matchTemplate(image, templ, dst_gold, method);}, {});
@ -145,7 +145,7 @@ TEST_P(MatchTemplate32F, Accuracy)
EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1, sss); EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1, sss);
#if PERF_TEST #ifdef PERF_TEST
{ {
std::cout << "Method: " << TEMPLATE_METHOD_NAMES[method] << std::endl; std::cout << "Method: " << TEMPLATE_METHOD_NAMES[method] << std::endl;
std::cout << "Image Size: (" << size.width << ", " << size.height << ")" << std::endl; std::cout << "Image Size: (" << size.width << ", " << size.height << ")" << std::endl;

@ -76,12 +76,12 @@ double checkSimilarity(const cv::Mat &m1, const cv::Mat &m2);
EXPECT_LE(checkNorm(cv::Mat(mat)), eps) \ EXPECT_LE(checkNorm(cv::Mat(mat)), eps) \
} }
//#define EXPECT_MAT_NEAR(mat1, mat2, eps) \ /*#define EXPECT_MAT_NEAR(mat1, mat2, eps) \
//{ \ { \
// ASSERT_EQ(mat1.type(), mat2.type()); \ ASSERT_EQ(mat1.type(), mat2.type()); \
// ASSERT_EQ(mat1.size(), mat2.size()); \ ASSERT_EQ(mat1.size(), mat2.size()); \
// EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps); \ EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps); \
//} }*/
#define EXPECT_MAT_NEAR(mat1, mat2, eps,s) \ #define EXPECT_MAT_NEAR(mat1, mat2, eps,s) \
{ \ { \

Loading…
Cancel
Save