ocl: move program names into opencl_kernels.hpp

This commit is contained in:
Alexander Alekhin 2013-09-27 16:41:25 +04:00
parent e8d9ed8955
commit b00f79ac5f
35 changed files with 154 additions and 428 deletions

View File

@ -450,11 +450,11 @@ macro(ocv_glob_module_sources)
if(HAVE_OPENCL AND cl_kernels)
ocv_include_directories(${OPENCL_INCLUDE_DIRS})
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/kernels.cpp"
COMMAND ${CMAKE_COMMAND} -DCL_DIR="${CMAKE_CURRENT_SOURCE_DIR}/src/opencl" -DOUTPUT="${CMAKE_CURRENT_BINARY_DIR}/kernels.cpp" -P "${OpenCV_SOURCE_DIR}/cmake/cl2cpp.cmake"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels.cpp" "${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels.hpp"
COMMAND ${CMAKE_COMMAND} -DCL_DIR="${CMAKE_CURRENT_SOURCE_DIR}/src/opencl" -DOUTPUT="${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels.cpp" -P "${OpenCV_SOURCE_DIR}/cmake/cl2cpp.cmake"
DEPENDS ${cl_kernels} "${OpenCV_SOURCE_DIR}/cmake/cl2cpp.cmake")
source_group("Src\\OpenCL" FILES ${cl_kernels} "${CMAKE_CURRENT_BINARY_DIR}/kernels.cpp")
list(APPEND lib_srcs ${cl_kernels} "${CMAKE_CURRENT_BINARY_DIR}/kernels.cpp")
source_group("OpenCL" FILES ${cl_kernels} "${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels.cpp" "${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels.hpp")
list(APPEND lib_srcs ${cl_kernels} "${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels.cpp" "${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels.hpp")
endif()
source_group("Src" FILES ${lib_srcs} ${lib_int_hdrs})

View File

@ -1,6 +1,20 @@
file(GLOB cl_list "${CL_DIR}/*.cl" )
list(SORT cl_list)
file(WRITE ${OUTPUT} "// This file is auto-generated. Do not edit!
string(REPLACE ".cpp" ".hpp" OUTPUT_HPP "${OUTPUT}")
get_filename_component(OUTPUT_HPP_NAME "${OUTPUT_HPP}" NAME)
set(STR_CPP "// This file is auto-generated. Do not edit!
#include \"${OUTPUT_HPP_NAME}\"
namespace cv
{
namespace ocl
{
")
set(STR_HPP "// This file is auto-generated. Do not edit!
namespace cv
{
@ -29,7 +43,12 @@ foreach(cl ${cl_list})
string(REGEX REPLACE "\"$" "" lines "${lines}") # unneeded " at the eof
file(APPEND ${OUTPUT} "const char* ${cl_filename}=\"${lines};\n")
set(STR_CPP "${STR_CPP}const char* ${cl_filename}=\"${lines};\n")
set(STR_HPP "${STR_HPP}extern const char* ${cl_filename};\n")
endforeach()
file(APPEND ${OUTPUT} "}\n}\n")
set(STR_CPP "${STR_CPP}}\n}\n")
set(STR_HPP "${STR_HPP}}\n}\n")
file(WRITE ${OUTPUT} "${STR_CPP}")
file(WRITE ${OUTPUT_HPP} "${STR_HPP}")

View File

@ -43,27 +43,24 @@
//
//M*/
#include "precomp.hpp"
#include <cstdio>
#ifdef HAVE_OPENCV_OCL
#include <cstdio>
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *surf;
const char noImage2dOption [] = "-D DISABLE_IMAGE2D";
static bool use_image2d = false;
static void openCLExecuteKernelSURF(Context *clCxt , const char **source, string kernelName, size_t globalThreads[3],
size_t localThreads[3], vector< pair<size_t, const void *> > &args, int channels, int depth)
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, int depth)
{
char optBuf [100] = {0};
char * optBufPtr = optBuf;
@ -486,26 +483,26 @@ void SURF_OCL_Invoker::icvCalcLayerDetAndTrace_gpu(oclMat &det, oclMat &trace, i
Context *clCxt = det.clCxt;
string kernelName = "icvCalcLayerDetAndTrace";
vector< pair<size_t, const void *> > args;
std::vector< std::pair<size_t, const void *> > args;
if(sumTex)
{
args.push_back( make_pair( sizeof(cl_mem), (void *)&sumTex));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&sumTex));
}
else
{
args.push_back( make_pair( sizeof(cl_mem), (void *)&surf_.sum.data)); // if image2d is not supported
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&surf_.sum.data)); // if image2d is not supported
}
args.push_back( make_pair( sizeof(cl_mem), (void *)&det.data));
args.push_back( make_pair( sizeof(cl_mem), (void *)&trace.data));
args.push_back( make_pair( sizeof(cl_int), (void *)&det.step));
args.push_back( make_pair( sizeof(cl_int), (void *)&trace.step));
args.push_back( make_pair( sizeof(cl_int), (void *)&img_rows));
args.push_back( make_pair( sizeof(cl_int), (void *)&img_cols));
args.push_back( make_pair( sizeof(cl_int), (void *)&nOctaveLayers));
args.push_back( make_pair( sizeof(cl_int), (void *)&octave));
args.push_back( make_pair( sizeof(cl_int), (void *)&c_layer_rows));
args.push_back( make_pair( sizeof(cl_int), (void *)&surf_.sum.step));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&det.data));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&trace.data));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&det.step));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&trace.step));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&img_rows));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&img_cols));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&nOctaveLayers));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&octave));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&c_layer_rows));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&surf_.sum.step));
size_t localThreads[3] = {16, 16, 1};
size_t globalThreads[3] =
@ -524,35 +521,35 @@ void SURF_OCL_Invoker::icvFindMaximaInLayer_gpu(const oclMat &det, const oclMat
Context *clCxt = det.clCxt;
string kernelName = useMask ? "icvFindMaximaInLayer_withmask" : "icvFindMaximaInLayer";
vector< pair<size_t, const void *> > args;
std::vector< std::pair<size_t, const void *> > args;
args.push_back( make_pair( sizeof(cl_mem), (void *)&det.data));
args.push_back( make_pair( sizeof(cl_mem), (void *)&trace.data));
args.push_back( make_pair( sizeof(cl_mem), (void *)&maxPosBuffer.data));
args.push_back( make_pair( sizeof(cl_mem), (void *)&maxCounter.data));
args.push_back( make_pair( sizeof(cl_int), (void *)&counterOffset));
args.push_back( make_pair( sizeof(cl_int), (void *)&det.step));
args.push_back( make_pair( sizeof(cl_int), (void *)&trace.step));
args.push_back( make_pair( sizeof(cl_int), (void *)&img_rows));
args.push_back( make_pair( sizeof(cl_int), (void *)&img_cols));
args.push_back( make_pair( sizeof(cl_int), (void *)&nLayers));
args.push_back( make_pair( sizeof(cl_int), (void *)&octave));
args.push_back( make_pair( sizeof(cl_int), (void *)&layer_rows));
args.push_back( make_pair( sizeof(cl_int), (void *)&layer_cols));
args.push_back( make_pair( sizeof(cl_int), (void *)&maxCandidates));
args.push_back( make_pair( sizeof(cl_float), (void *)&surf_.hessianThreshold));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&det.data));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&trace.data));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&maxPosBuffer.data));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&maxCounter.data));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&counterOffset));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&det.step));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&trace.step));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&img_rows));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&img_cols));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&nLayers));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&octave));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&layer_rows));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&layer_cols));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&maxCandidates));
args.push_back( std::make_pair( sizeof(cl_float), (void *)&surf_.hessianThreshold));
if(useMask)
{
if(maskSumTex)
{
args.push_back( make_pair( sizeof(cl_mem), (void *)&maskSumTex));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&maskSumTex));
}
else
{
args.push_back( make_pair( sizeof(cl_mem), (void *)&surf_.maskSum.data));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&surf_.maskSum.data));
}
args.push_back( make_pair( sizeof(cl_mem), (void *)&surf_.maskSum.step));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&surf_.maskSum.step));
}
size_t localThreads[3] = {16, 16, 1};
size_t globalThreads[3] = {divUp(layer_cols - 2 * min_margin, localThreads[0] - 2) *localThreads[0],
@ -568,19 +565,19 @@ void SURF_OCL_Invoker::icvInterpolateKeypoint_gpu(const oclMat &det, const oclMa
{
Context *clCxt = det.clCxt;
string kernelName = "icvInterpolateKeypoint";
vector< pair<size_t, const void *> > args;
std::vector< std::pair<size_t, const void *> > args;
args.push_back( make_pair( sizeof(cl_mem), (void *)&det.data));
args.push_back( make_pair( sizeof(cl_mem), (void *)&maxPosBuffer.data));
args.push_back( make_pair( sizeof(cl_mem), (void *)&keypoints.data));
args.push_back( make_pair( sizeof(cl_mem), (void *)&counters_.data));
args.push_back( make_pair( sizeof(cl_int), (void *)&det.step));
args.push_back( make_pair( sizeof(cl_int), (void *)&keypoints.step));
args.push_back( make_pair( sizeof(cl_int), (void *)&img_rows));
args.push_back( make_pair( sizeof(cl_int), (void *)&img_cols));
args.push_back( make_pair( sizeof(cl_int), (void *)&octave));
args.push_back( make_pair( sizeof(cl_int), (void *)&layer_rows));
args.push_back( make_pair( sizeof(cl_int), (void *)&max_features));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&det.data));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&maxPosBuffer.data));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&keypoints.data));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&counters_.data));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&det.step));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&keypoints.step));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&img_rows));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&img_cols));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&octave));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&layer_rows));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&max_features));
size_t localThreads[3] = {3, 3, 3};
size_t globalThreads[3] = {maxCounter *localThreads[0], localThreads[1], 1};
@ -593,21 +590,21 @@ void SURF_OCL_Invoker::icvCalcOrientation_gpu(const oclMat &keypoints, int nFeat
Context *clCxt = counters.clCxt;
string kernelName = "icvCalcOrientation";
vector< pair<size_t, const void *> > args;
std::vector< std::pair<size_t, const void *> > args;
if(sumTex)
{
args.push_back( make_pair( sizeof(cl_mem), (void *)&sumTex));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&sumTex));
}
else
{
args.push_back( make_pair( sizeof(cl_mem), (void *)&surf_.sum.data)); // if image2d is not supported
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&surf_.sum.data)); // if image2d is not supported
}
args.push_back( make_pair( sizeof(cl_mem), (void *)&keypoints.data));
args.push_back( make_pair( sizeof(cl_int), (void *)&keypoints.step));
args.push_back( make_pair( sizeof(cl_int), (void *)&img_rows));
args.push_back( make_pair( sizeof(cl_int), (void *)&img_cols));
args.push_back( make_pair( sizeof(cl_int), (void *)&surf_.sum.step));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&keypoints.data));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&keypoints.step));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&img_rows));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&img_cols));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&surf_.sum.step));
size_t localThreads[3] = {32, 4, 1};
size_t globalThreads[3] = {nFeatures *localThreads[0], localThreads[1], 1};
@ -620,11 +617,11 @@ void SURF_OCL_Invoker::icvSetUpright_gpu(const oclMat &keypoints, int nFeatures)
Context *clCxt = counters.clCxt;
string kernelName = "icvSetUpright";
vector< pair<size_t, const void *> > args;
std::vector< std::pair<size_t, const void *> > args;
args.push_back( make_pair( sizeof(cl_mem), (void *)&keypoints.data));
args.push_back( make_pair( sizeof(cl_int), (void *)&keypoints.step));
args.push_back( make_pair( sizeof(cl_int), (void *)&nFeatures));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&keypoints.data));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&keypoints.step));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&nFeatures));
size_t localThreads[3] = {256, 1, 1};
size_t globalThreads[3] = {saturate_cast<size_t>(nFeatures), 1, 1};
@ -638,7 +635,7 @@ void SURF_OCL_Invoker::compute_descriptors_gpu(const oclMat &descriptors, const
// compute unnormalized descriptors, then normalize them - odd indexing since grid must be 2D
Context *clCxt = descriptors.clCxt;
string kernelName;
vector< pair<size_t, const void *> > args;
std::vector< std::pair<size_t, const void *> > args;
size_t localThreads[3] = {1, 1, 1};
size_t globalThreads[3] = {1, 1, 1};
@ -655,19 +652,19 @@ void SURF_OCL_Invoker::compute_descriptors_gpu(const oclMat &descriptors, const
args.clear();
if(imgTex)
{
args.push_back( make_pair( sizeof(cl_mem), (void *)&imgTex));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&imgTex));
}
else
{
args.push_back( make_pair( sizeof(cl_mem), (void *)&_img.data));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&_img.data));
}
args.push_back( make_pair( sizeof(cl_mem), (void *)&descriptors.data));
args.push_back( make_pair( sizeof(cl_mem), (void *)&keypoints.data));
args.push_back( make_pair( sizeof(cl_int), (void *)&descriptors.step));
args.push_back( make_pair( sizeof(cl_int), (void *)&keypoints.step));
args.push_back( make_pair( sizeof(cl_int), (void *)&_img.rows));
args.push_back( make_pair( sizeof(cl_int), (void *)&_img.cols));
args.push_back( make_pair( sizeof(cl_int), (void *)&_img.step));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&descriptors.data));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&keypoints.data));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&descriptors.step));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&keypoints.step));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&_img.rows));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&_img.cols));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&_img.step));
openCLExecuteKernelSURF(clCxt, &surf, kernelName, globalThreads, localThreads, args, -1, -1);
@ -680,8 +677,8 @@ void SURF_OCL_Invoker::compute_descriptors_gpu(const oclMat &descriptors, const
globalThreads[1] = localThreads[1];
args.clear();
args.push_back( make_pair( sizeof(cl_mem), (void *)&descriptors.data));
args.push_back( make_pair( sizeof(cl_int), (void *)&descriptors.step));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&descriptors.data));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&descriptors.step));
openCLExecuteKernelSURF(clCxt, &surf, kernelName, globalThreads, localThreads, args, -1, -1);
}
@ -698,19 +695,19 @@ void SURF_OCL_Invoker::compute_descriptors_gpu(const oclMat &descriptors, const
args.clear();
if(imgTex)
{
args.push_back( make_pair( sizeof(cl_mem), (void *)&imgTex));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&imgTex));
}
else
{
args.push_back( make_pair( sizeof(cl_mem), (void *)&_img.data));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&_img.data));
}
args.push_back( make_pair( sizeof(cl_mem), (void *)&descriptors.data));
args.push_back( make_pair( sizeof(cl_mem), (void *)&keypoints.data));
args.push_back( make_pair( sizeof(cl_int), (void *)&descriptors.step));
args.push_back( make_pair( sizeof(cl_int), (void *)&keypoints.step));
args.push_back( make_pair( sizeof(cl_int), (void *)&_img.rows));
args.push_back( make_pair( sizeof(cl_int), (void *)&_img.cols));
args.push_back( make_pair( sizeof(cl_int), (void *)&_img.step));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&descriptors.data));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&keypoints.data));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&descriptors.step));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&keypoints.step));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&_img.rows));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&_img.cols));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&_img.step));
openCLExecuteKernelSURF(clCxt, &surf, kernelName, globalThreads, localThreads, args, -1, -1);
@ -723,8 +720,8 @@ void SURF_OCL_Invoker::compute_descriptors_gpu(const oclMat &descriptors, const
globalThreads[1] = localThreads[1];
args.clear();
args.push_back( make_pair( sizeof(cl_mem), (void *)&descriptors.data));
args.push_back( make_pair( sizeof(cl_int), (void *)&descriptors.step));
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&descriptors.data));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&descriptors.step));
openCLExecuteKernelSURF(clCxt, &surf, kernelName, globalThreads, localThreads, args, -1, -1);
}

View File

@ -44,14 +44,15 @@
//M*/
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
namespace cv
{
namespace ocl
{
extern const char* bgfg_mog;
typedef struct _contant_struct
{
cl_float c_Tb;

View File

@ -44,20 +44,10 @@
//M*/
#include "precomp.hpp"
#include <iomanip>
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
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)

View File

@ -45,22 +45,10 @@
//M*/
#include "precomp.hpp"
#include "opencl_kernels.hpp"
#include <functional>
#include <iterator>
#include <vector>
using namespace cv;
using namespace cv::ocl;
using namespace std;
namespace cv
{
namespace ocl
{
////////////////////////////////////OpenCL kernel strings//////////////////////////
extern const char *brute_force_match;
}
}
static const int OPT_SIZE = 100;

View File

@ -44,19 +44,10 @@
//M*/
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *build_warps;
}
}
//////////////////////////////////////////////////////////////////////////////
// buildWarpPlaneMaps

View File

@ -44,19 +44,10 @@
//M*/
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *imgproc_canny;
}
}
cv::ocl::CannyBuf::CannyBuf(const oclMat &dx_, const oclMat &dy_) : dx(dx_), dy(dy_), counter(NULL)
{

View File

@ -45,6 +45,7 @@
//M*/
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
@ -57,14 +58,6 @@ using namespace cv::ocl;
#define FLT_EPSILON 1.192092896e-07F
#endif
namespace cv
{
namespace ocl
{
extern const char *cvt_color;
}
}
namespace
{
void RGB2Gray_caller(const oclMat &src, oclMat &dst, int bidx)

View File

@ -43,20 +43,11 @@
//
//M*/
#include <iomanip>
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
namespace cv
{
namespace ocl
{
extern const char *imgproc_columnsum;
}
}
void cv::ocl::columnSum(const oclMat &src, oclMat &dst)
{

View File

@ -42,12 +42,10 @@
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include <iomanip>
#include "precomp.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
#if !defined HAVE_CLAMDFFT
void cv::ocl::dft(const oclMat&, oclMat&, Size, int)

View File

@ -48,26 +48,11 @@
//M*/
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace std;
using namespace cv;
using namespace cv::ocl;
//helper routines
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *filtering_boxFilter;
extern const char *filter_sep_row;
extern const char *filter_sep_col;
extern const char *filtering_laplacian;
extern const char *filtering_morph;
extern const char *filtering_adaptive_bilateral;
}
}
namespace
{
inline void normalizeAnchor(int &anchor, int ksize)

View File

@ -43,7 +43,6 @@
//
//M*/
#include <iomanip>
#include "precomp.hpp"
namespace cv { namespace ocl {

View File

@ -42,23 +42,14 @@
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include <iomanip>
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
static bool use_cpu_sorter = true;
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *imgproc_gftt;
}
}
namespace
{
enum SortMethod

View File

@ -49,24 +49,10 @@
//M*/
#include "precomp.hpp"
#include <stdio.h>
#include <string>
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *haarobjectdetect;
extern const char *haarobjectdetectbackup;
extern const char *haarobjectdetect_scaled2;
}
}
/* these settings affect the quality of detection: change with care */
#define CV_ADJUST_FEATURES 1

View File

@ -44,9 +44,10 @@
//M*/
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
#define CELL_WIDTH 8
#define CELL_HEIGHT 8
@ -57,15 +58,6 @@ using namespace std;
static oclMat gauss_w_lut;
static bool hog_device_cpu;
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *objdetect_hog;
}
}
namespace cv
{
namespace ocl

View File

@ -54,34 +54,15 @@
//M*/
#include "precomp.hpp"
#include <iomanip>
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
namespace cv
{
namespace ocl
{
////////////////////////////////////OpenCL kernel strings//////////////////////////
extern const char *meanShift;
extern const char *imgproc_copymakeboder;
extern const char *imgproc_median;
extern const char *imgproc_threshold;
extern const char *imgproc_resize;
extern const char *imgproc_remap;
extern const char *imgproc_warpAffine;
extern const char *imgproc_warpPerspective;
extern const char *imgproc_integral_sum;
extern const char *imgproc_integral;
extern const char *imgproc_histogram;
extern const char *imgproc_bilateral;
extern const char *imgproc_calcHarris;
extern const char *imgproc_calcMinEigenVal;
extern const char *imgproc_convolve;
extern const char *imgproc_clahe;
////////////////////////////////////OpenCL call wrappers////////////////////////////
template <typename T> struct index_and_sizeof;

View File

@ -44,8 +44,8 @@
//M*/
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace std;
using namespace cv;
using namespace cv::ocl;
@ -53,9 +53,6 @@ namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *interpolate_frames;
namespace interpolate
{
//The following are ported from NPP_staging.cu

View File

@ -44,7 +44,6 @@
//M*/
#include "precomp.hpp"
using namespace std;
using namespace cv;
using namespace cv::ocl;
@ -132,4 +131,4 @@ CV_EXPORTS const oclMat& KalmanFilter::correct(const oclMat& measurement)
gemm(gain, temp5, 1, statePre, 1, statePost);
gemm(gain, temp2, -1, errorCovPre, 1, errorCovPost);
return statePost;
}
}

View File

@ -43,20 +43,11 @@
//
//M*/
#include <iomanip>
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace cv;
using namespace ocl;
namespace cv
{
namespace ocl
{
////////////////////////////////////OpenCL kernel strings//////////////////////////
extern const char *kmeans_kernel;
}
}
using namespace cv::ocl;
static void generateRandomCenter(const vector<Vec2f>& box, float* center, RNG& rng)
{

View File

@ -44,22 +44,11 @@
//M*/
#include <iomanip>
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
//helper routines
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *match_template;
}
}
namespace cv
{

View File

@ -46,30 +46,19 @@
//M*/
#include "precomp.hpp"
#define ALIGN 32
#define GPU_MATRIX_MALLOC_STEP(step) (((step) + ALIGN - 1) / ALIGN) * ALIGN
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
////////////////////////////////////////////////////////////////////////
//////////////////////////////// oclMat ////////////////////////////////
////////////////////////////////////////////////////////////////////////
#define ALIGN 32
#define GPU_MATRIX_MALLOC_STEP(step) (((step) + ALIGN - 1) / ALIGN) * ALIGN
// helper routines
namespace cv
{
namespace ocl
{
/////////////////////////// OpenCL kernel strings ///////////////////////////
extern const char *operator_copyToM;
extern const char *operator_convertTo;
extern const char *operator_setTo;
extern const char *operator_setToM;
extern const char *convertC3C4;
extern DevMemType gDeviceMemType;
extern DevMemRW gDeviceMemRW;
}

View File

@ -44,13 +44,12 @@
//
//M*/
#include "precomp.hpp"
#include <iostream>
#include "opencl_kernels.hpp"
namespace cv
{
namespace ocl
{
extern const char *moments;
// The function calculates center of gravity and the central second order moments
static void icvCompleteMomentState( CvMoments* moments )
{

View File

@ -43,8 +43,10 @@
//M*/
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace std;
using namespace cv;
using namespace cv::ocl;
// Auxiliray stuff
namespace

View File

@ -45,23 +45,14 @@
#include "precomp.hpp"
#include "opencl_kernels.hpp"
#include "opencv2/video/tracking.hpp"
using namespace std;
using namespace cv;
using namespace cv::ocl;
#define MIN_SIZE 32
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *optical_flow_farneback;
}
}
namespace cv {
namespace ocl {
namespace optflow_farneback

View File

@ -45,23 +45,10 @@
//
//M*/
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
using std::cout;
using std::endl;
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *pyr_down;
}
}
//////////////////////////////////////////////////////////////////////////////
/////////////////////// add subtract multiply divide /////////////////////////

View File

@ -45,21 +45,12 @@
//
//M*/
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace std;
using namespace cv;
using namespace cv::ocl;
namespace cv
{
namespace ocl
{
extern const char *pyrlk;
extern const char *pyrlk_no_image;
}
}
struct dim3
{
unsigned int x, y, z;

View File

@ -45,21 +45,19 @@
//
//M*/
/* Haar features calculation */
//#define EMU
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
/* Haar features calculation */
//#define EMU
namespace cv
{
namespace ocl
{
extern const char *pyr_up;
void pyrUp(const cv::ocl::oclMat &src, cv::ocl::oclMat &dst)
{
int depth = src.depth(), channels = src.channels(), oclChannels = src.oclchannels();

View File

@ -43,18 +43,16 @@
//
//M*/
#include <iomanip>
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
namespace cv
{
namespace ocl
{
extern const char * kernel_sort_by_key;
extern const char * kernel_stablesort_by_key;
extern const char * kernel_radix_sort_by_key;
void sortByKey(oclMat& keys, oclMat& vals, size_t vecSize, int method, bool isGreaterThan);
//TODO(pengx17): change this value depending on device other than a constant

View File

@ -44,29 +44,11 @@
//M*/
#include "precomp.hpp"
#include <vector>
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
using std::cout;
using std::endl;
////////////////////////////////////////////////////////////////////////
///////////////// oclMat merge and split ///////////////////////////////
////////////////////////////////////////////////////////////////////////
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *merge_mat;
extern const char *split_mat;
}
}
namespace cv
{
namespace ocl

View File

@ -45,51 +45,11 @@
//M*/
#include "precomp.hpp"
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
#if !defined (HAVE_OPENCL)
namespace cv
{
namespace ocl
{
void cv::ocl::StereoConstantSpaceBP::estimateRecommendedParams(int, int, int &, int &, int &, int &)
{
throw_nogpu();
}
cv::ocl::StereoConstantSpaceBP::StereoConstantSpaceBP(int, int, int, int, int)
{
throw_nogpu();
}
cv::ocl::StereoConstantSpaceBP::StereoConstantSpaceBP(int, int, int, int, float, float,
float, float, int, int)
{
throw_nogpu();
}
void cv::ocl::StereoConstantSpaceBP::operator()(const oclMat &, const oclMat &, oclMat &)
{
throw_nogpu();
}
}
}
#else /* !defined (HAVE_OPENCL) */
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *stereocsbp;
}
}
namespace cv
{
namespace ocl
@ -755,5 +715,3 @@ void cv::ocl::StereoConstantSpaceBP::operator()(const oclMat &left, const oclMat
operators[msg_type](*this, u, d, l, r, disp_selected_pyr, data_cost, data_cost_selected, temp, out,
left, right, disp);
}
#endif /* !defined (HAVE_OPENCL) */

View File

@ -46,23 +46,11 @@
//M*/
#include "precomp.hpp"
#include <vector>
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *stereobm;
}
}
namespace cv
{
namespace ocl

View File

@ -45,27 +45,11 @@
//M*/
#include "precomp.hpp"
#include <vector>
#include <cstdio>
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
using namespace std;
////////////////////////////////////////////////////////////////////////
///////////////// stereoBP /////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *stereobp;
}
}
namespace cv
{
namespace ocl

View File

@ -42,21 +42,12 @@
//
//M*/
#include "precomp.hpp"
using namespace std;
#include "opencl_kernels.hpp"
using namespace cv;
using namespace cv::ocl;
namespace cv
{
namespace ocl
{
///////////////////////////OpenCL kernel strings///////////////////////////
extern const char* tvl1flow;
}
}
cv::ocl::OpticalFlowDual_TVL1_OCL::OpticalFlowDual_TVL1_OCL()
{
tau = 0.25;

View File

@ -56,6 +56,7 @@ cv::Ptr<cv::superres::SuperResolution> cv::superres::createSuperResolution_BTVL1
}
#else
#include "opencl_kernels.hpp"
using namespace std;
using namespace cv;
@ -67,8 +68,6 @@ namespace cv
{
namespace ocl
{
extern const char* superres_btvl1;
float* btvWeights_ = NULL;
size_t btvWeights_size = 0;
}