ocl: move program names into opencl_kernels.hpp
authorAlexander Alekhin <alexander.alekhin@itseez.com>
Fri, 27 Sep 2013 12:41:25 +0000 (16:41 +0400)
committerAlexander Alekhin <alexander.alekhin@itseez.com>
Thu, 3 Oct 2013 15:50:14 +0000 (19:50 +0400)
35 files changed:
cmake/OpenCVModule.cmake
cmake/cl2cpp.cmake
modules/nonfree/src/surf.ocl.cpp
modules/ocl/src/bgfg_mog.cpp
modules/ocl/src/blend.cpp
modules/ocl/src/brute_force_matcher.cpp
modules/ocl/src/build_warps.cpp
modules/ocl/src/canny.cpp
modules/ocl/src/color.cpp
modules/ocl/src/columnsum.cpp
modules/ocl/src/fft.cpp
modules/ocl/src/filtering.cpp
modules/ocl/src/gemm.cpp
modules/ocl/src/gftt.cpp
modules/ocl/src/haar.cpp
modules/ocl/src/hog.cpp
modules/ocl/src/imgproc.cpp
modules/ocl/src/interpolate_frames.cpp
modules/ocl/src/kalman.cpp
modules/ocl/src/kmeans.cpp
modules/ocl/src/match_template.cpp
modules/ocl/src/matrix_operations.cpp
modules/ocl/src/moments.cpp
modules/ocl/src/mssegmentation.cpp
modules/ocl/src/optical_flow_farneback.cpp
modules/ocl/src/pyrdown.cpp
modules/ocl/src/pyrlk.cpp
modules/ocl/src/pyrup.cpp
modules/ocl/src/sort_by_key.cpp
modules/ocl/src/split_merge.cpp
modules/ocl/src/stereo_csbp.cpp
modules/ocl/src/stereobm.cpp
modules/ocl/src/stereobp.cpp
modules/ocl/src/tvl1flow.cpp
modules/superres/src/btv_l1_ocl.cpp

index 1d87bc1..4ed8cf0 100644 (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})
index 1e932ea..0733a42 100644 (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}")
index 59eab70..d6f72bc 100644 (file)
 //
 //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;
-
-    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));
+    std::vector< std::pair<size_t, const void *> > args;
+
+    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;
-
-    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));
+    std::vector< std::pair<size_t, const void *> > args;
+
+    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);
     }
index cb0dee8..064fef8 100644 (file)
 //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;
index ec73c86..58b91d8 100644 (file)
 //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)
index 0273ed5..c348db8 100644 (file)
 //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;
 
index c4a0929..4c400a2 100644 (file)
 //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
index a25c197..9fc6f65 100644 (file)
 //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)
 {
index 493dbc3..4430650 100644 (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)
index 1d6939f..46ff73d 100644 (file)
 //
 //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)
 {
index c0785ac..e39a444 100644 (file)
 // 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)
index caaf53d..758923f 100644 (file)
 //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)
index 687f26f..837fd1f 100644 (file)
@@ -43,7 +43,6 @@
 //
 //M*/
 
-#include <iomanip>
 #include "precomp.hpp"
 
 namespace cv { namespace ocl {
index 29a96ae..e24c0a5 100644 (file)
 // 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
index e3e73b3..aac3785 100644 (file)
 //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
index 563172b..2d2de9a 100644 (file)
 //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
@@ -61,15 +62,6 @@ namespace cv
 {
     namespace ocl
     {
-        ///////////////////////////OpenCL kernel strings///////////////////////////
-        extern const char *objdetect_hog;
-    }
-}
-
-namespace cv
-{
-    namespace ocl
-    {
         namespace device
         {
             namespace hog
index 0949605..b4d2b70 100644 (file)
 //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;
index 43b7660..54063cd 100644 (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
index 8a5b0d4..6f82434 100644 (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;
-}
\ No newline at end of file
+}
index 4de42fc..06ed8b3 100644 (file)
 //
 //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)
 {
index 7c0a7ac..ba84043 100644 (file)
 //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
 {
index d247a14..80b2f7d 100644 (file)
 //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;
     }
index 24e8b3e..377af28 100644 (file)
 //
 //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 )
 {
index 300265b..248f134 100644 (file)
 //M*/
 
 #include "precomp.hpp"
+#include "opencl_kernels.hpp"
 
-using namespace std;
+using namespace cv;
+using namespace cv::ocl;
 
 // Auxiliray stuff
 namespace
index 618a637..05a850b 100644 (file)
 
 
 #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
index 89df73e..6071fc5 100644 (file)
 //
 //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 /////////////////////////
index a69015d..8e8692e 100644 (file)
 //
 //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;
index 01df30c..0253481 100644 (file)
 //
 //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();
index 0025f0d..c2ab004 100644 (file)
 //
 //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
index fb8d05a..9c9639f 100644 (file)
 //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
index c8334cc..f9e8644 100644 (file)
 //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) */
index 8195346..716a2f1 100644 (file)
 //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
index 5bc93aa..ef7fff4 100644 (file)
 //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
index c9a3f7a..bbeecb4 100644 (file)
 //
 //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;
index 5aecca0..432d236 100644 (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;
     }