diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e98a7f19c..a952826395 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,12 +124,12 @@ OCV_OPTION(WITH_GSTREAMER_1_X "Include Gstreamer 1.x support" OFF OCV_OPTION(WITH_GTK "Include GTK support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_IPP "Include Intel IPP support" OFF IF (MSVC OR X86 OR X86_64) ) OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) ) -OCV_OPTION(WITH_JPEG "Include JPEG support" ON IF (NOT IOS) ) +OCV_OPTION(WITH_JPEG "Include JPEG support" ON) OCV_OPTION(WITH_WEBP "Include WebP support" ON IF (NOT IOS) ) OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ON IF (NOT IOS) ) OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID AND NOT APPLE) ) OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF IF (NOT ANDROID AND NOT IOS) ) -OCV_OPTION(WITH_PNG "Include PNG support" ON IF (NOT IOS) ) +OCV_OPTION(WITH_PNG "Include PNG support" ON) OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" ON IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_GIGEAPI "Include Smartek GigE support" ON IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF IF (NOT ANDROID AND NOT IOS) ) @@ -143,9 +143,9 @@ OCV_OPTION(WITH_VIDEOINPUT "Build HighGUI with DirectShow support" ON OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF (NOT ANDROID AND NOT APPLE) ) OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_CLP "Include Clp support (EPL)" OFF) -OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" OFF IF (NOT ANDROID AND NOT IOS) ) -OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" OFF IF (NOT ANDROID AND NOT IOS) ) -OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" OFF IF (NOT ANDROID AND NOT IOS) ) +OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" ON IF (NOT ANDROID AND NOT IOS) ) +OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON IF (NOT ANDROID AND NOT IOS) ) +OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON IF (NOT ANDROID AND NOT IOS) ) # OpenCV build components diff --git a/cmake/OpenCVDetectOpenCL.cmake b/cmake/OpenCVDetectOpenCL.cmake index 76f76ebc12..eafecd93cc 100644 --- a/cmake/OpenCVDetectOpenCL.cmake +++ b/cmake/OpenCVDetectOpenCL.cmake @@ -43,7 +43,7 @@ if(OPENCL_FOUND) set(OPENCL_LIBRARIES ${OPENCL_LIBRARY}) if (X86_64) - set(CLAMD_POSSIBLE_LIB_SUFFIXES lib32/import) + set(CLAMD_POSSIBLE_LIB_SUFFIXES lib64/import) elseif (X86) set(CLAMD_POSSIBLE_LIB_SUFFIXES lib32/import) endif() diff --git a/cmake/OpenCVExtraTargets.cmake b/cmake/OpenCVExtraTargets.cmake index 936e3a2635..b4d339155a 100644 --- a/cmake/OpenCVExtraTargets.cmake +++ b/cmake/OpenCVExtraTargets.cmake @@ -13,57 +13,7 @@ endif() # ---------------------------------------------------------------------------- -# Source package, for "make package_source" -# ---------------------------------------------------------------------------- -if(BUILD_PACKAGE) - set(TARBALL_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VERSION}") - if (NOT WIN32) - if(APPLE) - set(TAR_CMD gnutar) - else() - set(TAR_CMD tar) - endif() - set(TAR_TRANSFORM "\"s,^,${TARBALL_NAME}/,\"") - add_custom_target(package_source - #TODO: maybe we should not remove dll's - COMMAND ${TAR_CMD} --transform ${TAR_TRANSFORM} -cjpf ${CMAKE_CURRENT_BINARY_DIR}/${TARBALL_NAME}.tar.bz2 --exclude=".svn" --exclude=".git" --exclude="*.pyc" --exclude="*.vcproj" --exclude="*/lib/*" --exclude="*.dll" ./ - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - else() - add_custom_target(package_source - COMMAND zip -9 -r ${CMAKE_CURRENT_BINARY_DIR}/${TARBALL_NAME}.zip . -x '*/.svn/*' '*/.git/*' '*.vcproj' '*.pyc' - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - endif() - if(ENABLE_SOLUTION_FOLDERS) - set_target_properties(package_source PROPERTIES FOLDER "extra") - endif() -endif() - - -# ---------------------------------------------------------------------------- -# performance tests, for "make perf" -# ---------------------------------------------------------------------------- -if(BUILD_PERF_TESTS AND PYTHON_EXECUTABLE) - if(CMAKE_VERSION VERSION_GREATER "2.8.2") - add_custom_target(perf - ${PYTHON_EXECUTABLE} "${OpenCV_SOURCE_DIR}/modules/ts/misc/run.py" --configuration $ "${CMAKE_BINARY_DIR}" - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" - DEPENDS "${OpenCV_SOURCE_DIR}/modules/ts/misc/run.py" - ) - else() - add_custom_target(perf - ${PYTHON_EXECUTABLE} "${OpenCV_SOURCE_DIR}/modules/ts/misc/run.py" "${CMAKE_BINARY_DIR}" - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" - DEPENDS "${OpenCV_SOURCE_DIR}/modules/ts/misc/run.py" - ) - endif() - if(ENABLE_SOLUTION_FOLDERS) - set_target_properties(perf PROPERTIES FOLDER "extra") - endif() -endif() - - -# ---------------------------------------------------------------------------- -# spefial targets to build all OpenCV modules +# target building all OpenCV modules # ---------------------------------------------------------------------------- add_custom_target(opencv_modules) if(ENABLE_SOLUTION_FOLDERS) @@ -72,7 +22,7 @@ endif() # ---------------------------------------------------------------------------- -# spefial targets to build all tests +# targets building all tests # ---------------------------------------------------------------------------- if(BUILD_TESTS) add_custom_target(opencv_tests) diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake index 501f8ff3e8..fa90b515b2 100644 --- a/cmake/OpenCVFindLibsGrfmt.cmake +++ b/cmake/OpenCVFindLibsGrfmt.cmake @@ -67,7 +67,7 @@ if(NOT TIFF_VERSION_STRING AND TIFF_INCLUDE_DIR) endif() # --- libjpeg (optional) --- -if(WITH_JPEG) +if(WITH_JPEG AND NOT IOS) if(BUILD_JPEG) ocv_clear_vars(JPEG_FOUND) else() @@ -145,7 +145,7 @@ if(NOT JASPER_VERSION_STRING) endif() # --- libpng (optional, should be searched after zlib) --- -if(WITH_PNG) +if(WITH_PNG AND NOT IOS) if(BUILD_PNG) ocv_clear_vars(PNG_FOUND) else() diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index 6edcba7114..6d18e47f6d 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -654,9 +654,6 @@ function(ocv_add_perf_tests) ocv_add_precompiled_headers(${the_target}) - if (PYTHON_EXECUTABLE) - add_dependencies(perf ${the_target}) - endif() else(OCV_DEPENDENCIES_FOUND) # TODO: warn about unsatisfied dependencies endif(OCV_DEPENDENCIES_FOUND) diff --git a/cmake/cl2cpp.cmake b/cmake/cl2cpp.cmake index ca17c61b43..4f18e9e643 100644 --- a/cmake/cl2cpp.cmake +++ b/cmake/cl2cpp.cmake @@ -18,6 +18,7 @@ foreach(cl ${cl_list}) string(REPLACE "\t" " " lines "${lines}") string(REGEX REPLACE "/\\*([^*]/|\\*[^/]|[^*/])*\\*/" "" lines "${lines}") # multiline comments + string(REGEX REPLACE "/\\*([^\n])*\\*/" "" lines "${lines}") # single-line comments string(REGEX REPLACE "[ ]*//[^\n]*\n" "\n" lines "${lines}") # single-line comments string(REGEX REPLACE "\n[ ]*(\n[ ]*)*" "\n" lines "${lines}") # empty lines & leading whitespace string(REGEX REPLACE "^\n" "" lines "${lines}") # leading new line diff --git a/doc/tutorials/introduction/table_of_content_introduction/images/visual_studio_image_watch.png b/doc/tutorials/introduction/table_of_content_introduction/images/visual_studio_image_watch.png new file mode 100755 index 0000000000..e693344df8 Binary files /dev/null and b/doc/tutorials/introduction/table_of_content_introduction/images/visual_studio_image_watch.png differ diff --git a/doc/tutorials/introduction/table_of_content_introduction/table_of_content_introduction.rst b/doc/tutorials/introduction/table_of_content_introduction/table_of_content_introduction.rst index 5e91a5392c..2238b87878 100644 --- a/doc/tutorials/introduction/table_of_content_introduction/table_of_content_introduction.rst +++ b/doc/tutorials/introduction/table_of_content_introduction/table_of_content_introduction.rst @@ -103,6 +103,21 @@ world of the OpenCV. :height: 90pt :width: 90pt + =========== ====================================================== + |WinVSVis| **Title:** :ref:`Windows_Visual_Studio_Image_Watch` + + *Compatibility:* >= OpenCV 2.4 + + *Author:* Wolf Kienzle + + You will learn how to visualize OpenCV matrices and images within Visual Studio 2012. + + =========== ====================================================== + + .. |WinVSVis| image:: images/visual_studio_image_watch.png + :height: 90pt + :width: 90pt + * **Desktop Java** .. tabularcolumns:: m{100pt} m{300pt} @@ -278,6 +293,7 @@ world of the OpenCV. ../linux_eclipse/linux_eclipse ../windows_install/windows_install ../windows_visual_studio_Opencv/windows_visual_studio_Opencv + ../windows_visual_studio_image_watch/windows_visual_studio_image_watch ../desktop_java/java_dev_intro ../android_binary_package/android_dev_intro ../android_binary_package/O4A_SDK diff --git a/doc/tutorials/introduction/windows_visual_studio_image_watch/images/breakpoint.png b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/breakpoint.png new file mode 100755 index 0000000000..2597a8deb8 Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/breakpoint.png differ diff --git a/doc/tutorials/introduction/windows_visual_studio_image_watch/images/edges_zoom.png b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/edges_zoom.png new file mode 100755 index 0000000000..8c76959988 Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/edges_zoom.png differ diff --git a/doc/tutorials/introduction/windows_visual_studio_image_watch/images/help_button.jpg b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/help_button.jpg new file mode 100644 index 0000000000..38aa809d5b Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/help_button.jpg differ diff --git a/doc/tutorials/introduction/windows_visual_studio_image_watch/images/input_zoom.png b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/input_zoom.png new file mode 100755 index 0000000000..d4e2df7fb0 Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/input_zoom.png differ diff --git a/doc/tutorials/introduction/windows_visual_studio_image_watch/images/toolwindow.jpg b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/toolwindow.jpg new file mode 100644 index 0000000000..cd60c00b2d Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/toolwindow.jpg differ diff --git a/doc/tutorials/introduction/windows_visual_studio_image_watch/images/viewer.jpg b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/viewer.jpg new file mode 100644 index 0000000000..95f4b81a58 Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/viewer.jpg differ diff --git a/doc/tutorials/introduction/windows_visual_studio_image_watch/images/viewer_context_menu.png b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/viewer_context_menu.png new file mode 100755 index 0000000000..902f23a3dc Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/viewer_context_menu.png differ diff --git a/doc/tutorials/introduction/windows_visual_studio_image_watch/images/visual_studio_image_watch.png b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/visual_studio_image_watch.png new file mode 100755 index 0000000000..e693344df8 Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/visual_studio_image_watch.png differ diff --git a/doc/tutorials/introduction/windows_visual_studio_image_watch/images/vs_locals.png b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/vs_locals.png new file mode 100755 index 0000000000..0df403467a Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_image_watch/images/vs_locals.png differ diff --git a/doc/tutorials/introduction/windows_visual_studio_image_watch/windows_visual_studio_image_watch.rst b/doc/tutorials/introduction/windows_visual_studio_image_watch/windows_visual_studio_image_watch.rst new file mode 100644 index 0000000000..91b411682d --- /dev/null +++ b/doc/tutorials/introduction/windows_visual_studio_image_watch/windows_visual_studio_image_watch.rst @@ -0,0 +1,144 @@ +.. _Windows_Visual_Studio_Image_Watch: + +Image Watch: viewing in-memory images in the Visual Studio debugger +******************************************************************* + +Image Watch is a plug-in for Microsoft Visual Studio that lets you to visualize in-memory images (*cv::Mat* or *IplImage\_* objects, for example) while debugging an application. This can be helpful for tracking down bugs, or for simply understanding what a given piece of code is doing. + +Prerequisites +============= + +This tutorial assumes that you have the following available: + +#. Visual Studio 2012 Professional (or better) with Update 1 installed. Update 1 can be downloaded `here `_. + +#. An OpenCV installation on your Windows machine (Tutorial: :ref:`Windows_Installation`). + +#. Ability to create and build OpenCV projects in Visual Studio (Tutorial: :ref:`Windows_Visual_Studio_How_To`). + +Installation +============ + +`Download `_ the Image Watch installer. The installer comes in a single file with extension .vsix (*Visual Studio Extension*). To launch it, simply double-click on the .vsix file in Windows Explorer. When the installer has finished, make sure to restart Visual Studio to complete the installation. + +Example +======== + +Image Watch works with any existing project that uses OpenCV image objects (for example, *cv::Mat*). In this example, we use a minimal test program that loads an image from a file and runs an edge detector. To build the program, create a console application project in Visual Studio, name it "image-watch-demo", and insert the source code below. + +.. code-block:: c++ + + // Test application for the Visual Studio Image Watch Debugger extension + + #include // std::cout + #include // cv::Mat + #include // cv::imread() + #include // cv::Canny() + + using namespace std; + using namespace cv; + + void help() + { + cout + << "----------------------------------------------------" << endl + << "This is a test program for the Image Watch Debugger " << endl + << "plug-in for Visual Studio. The program loads an " << endl + << "image from a file and runs the Canny edge detector. " << endl + << "No output is displayed or written to disk." + << endl + << "Usage:" << endl + << "image-watch-demo inputimage" << endl + << "----------------------------------------------------" << endl + << endl; + } + + int main(int argc, char *argv[]) + { + help(); + + if (argc != 2) + { + cout << "Wrong number of parameters" << endl; + return -1; + } + + cout << "Loading input image: " << argv[1] << endl; + Mat input; + input = imread(argv[1], CV_LOAD_IMAGE_COLOR); + + cout << "Detecting edges in input image" << endl; + Mat edges; + Canny(input, edges, 10, 100); + + return 0; + } + +Make sure your active solution configuration (:menuselection:`Build --> Configuration Manager`) is set to a debug build (usually called "Debug"). This should disable compiler optimizations so that viewing variables in the debugger can work reliably. + +Build your solution (:menuselection:`Build --> Build Solution`, or press *F7*). + +Now set a breakpoint on the source line that says + +.. code-block:: c++ + + Mat edges; + +To set the breakpoint, right-click on the source line and select :menuselection:`Breakpoints --> Insert Breakpoint` from the context menu. + +Launch the program in the debugger (:menuselection:`Debug --> Start Debugging`, or hit *F5*). When the breakpoint is hit, the program is paused and Visual Studio displays a yellow instruction pointer at the breakpoint: + +.. image:: images/breakpoint.png + +Now you can inspect the state of you program. For example, you can bring up the *Locals* window (:menuselection:`Debug --> Windows --> Locals`), which will show the names and values of the variables in the current scope: + +.. image:: images/vs_locals.png + +Note that the built-in *Locals* window will display text only. This is where the Image Watch plug-in comes in. Image Watch is like another *Locals* window, but with an image viewer built into it. To bring up Image Watch, select :menuselection:`View --> Other Windows --> Image Watch`. Like Visual Studio's *Locals* window, Image Watch can dock to the Visual Studio IDE. Also, Visual Studio will remember whether you had Image Watch open, and where it was located between debugging sessions. This means you only have to do this once--the next time you start debugging, Image Watch will be back where you left it. Here's what the docked Image Watch window looks like at our breakpoint: + +.. image:: images/toolwindow.jpg + :height: 320pt + +The radio button at the top left (*Locals/Watch*) selects what is shown in the *Image List* below: *Locals* lists all OpenCV image objects in the current scope (this list is automatically populated). *Watch* shows image expressions that have been pinned for continuous inspection (not described here, see `Image Watch documentation `_ for details). The image list shows basic information such as width, height, number of channels, and, if available, a thumbnail. In our example, the image list contains our two local image variables, *input* and *edges*. + +If an image has a thumbnail, left-clicking on that image will select it for detailed viewing in the *Image Viewer* on the right. The viewer lets you pan (drag mouse) and zoom (mouse wheel). It also displays the pixel coordinate and value at the current mouse position. + +.. image:: images/viewer.jpg + :height: 160pt + +Note that the second image in the list, *edges*, is shown as "invalid". This indicates that some data members of this image object have corrupt or invalid values (for example, a negative image width). This is expected at this point in the program, since the C++ constructor for *edges* has not run yet, and so its members have undefined values (in debug mode they are usually filled with "0xCD" bytes). + +From here you can single-step through your code (:menuselection:`Debug->Step Over`, or press *F10*) and watch the pixels change: if you step once, over the *Mat edges;* statement, the *edges* image will change from "invalid" to "empty", which means that it is now in a valid state (default constructed), even though it has not been initialized yet (using *cv::Mat::create()*, for example). If you make one more step over the *cv::Canny()* call, you will see a thumbnail of the edge image appear in the image list. + +Now assume you want to do a visual sanity check of the *cv::Canny()* implementation. Bring the *edges* image into the viewer by selecting it in the *Image List* and zoom into a region with a clearly defined edge: + +.. image:: images/edges_zoom.png + :height: 160pt + +Right-click on the *Image Viewer* to bring up the view context menu and enable :menuselection:`Link Views` (a check box next to the menu item indicates whether the option is enabled). + +.. image:: images/viewer_context_menu.png + :height: 120pt + +The :menuselection:`Link Views` feature keeps the view region fixed when flipping between images of the same size. To see how this works, select the input image from the image list--you should now see the corresponding zoomed-in region in the input image: + +.. image:: images/input_zoom.png + :height: 160pt + +You may also switch back and forth between viewing input and edges with your up/down cursor keys. That way you can easily verify that the detected edges line up nicely with the data in the input image. + +More ... +==================== + +Image watch has a number of more advanced features, such as + +#. pinning images to a *Watch* list for inspection across scopes or between debugging sessions + +#. clamping, thresholding, or diff'ing images directly inside the Watch window + +#. comparing an in-memory image against a reference image from a file + +Please refer to the online `Image Watch Documentation `_ for details--you also can get to the documentation page by clicking on the *Help* link in the Image Watch window: + +.. image:: images/help_button.jpg + :height: 80pt diff --git a/ios/build_framework.py b/ios/build_framework.py index 3f0e85f725..ceef4b71d7 100755 --- a/ios/build_framework.py +++ b/ios/build_framework.py @@ -103,10 +103,10 @@ def put_framework_together(srcroot, dstroot): # TODO ... # make symbolic links - os.symlink(dstdir + "/Headers", "Headers") - os.symlink(dstdir + "/Resources", "Resources") - os.symlink(dstdir + "/opencv2", "opencv2") os.symlink("A", "Versions/Current") + os.symlink("Versions/Current/Headers", "Headers") + os.symlink("Versions/Current/Resources", "Resources") + os.symlink("Versions/Current/opencv2", "opencv2") def build_framework(srcroot, dstroot): diff --git a/modules/core/include/opencv2/core/cuda_devptrs.hpp b/modules/core/include/opencv2/core/cuda_devptrs.hpp index 26fc2403f9..5af5ab88f5 100644 --- a/modules/core/include/opencv2/core/cuda_devptrs.hpp +++ b/modules/core/include/opencv2/core/cuda_devptrs.hpp @@ -22,7 +22,7 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. diff --git a/modules/core/include/opencv2/core/gpumat.hpp b/modules/core/include/opencv2/core/gpumat.hpp index 54ba4e67fd..d0c729c948 100644 --- a/modules/core/include/opencv2/core/gpumat.hpp +++ b/modules/core/include/opencv2/core/gpumat.hpp @@ -22,7 +22,7 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. diff --git a/modules/core/include/opencv2/core/opengl.hpp b/modules/core/include/opencv2/core/opengl.hpp index 1643d39e0c..2e428bc0c4 100644 --- a/modules/core/include/opencv2/core/opengl.hpp +++ b/modules/core/include/opencv2/core/opengl.hpp @@ -22,7 +22,7 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp index ef3458151f..dd059c3403 100644 --- a/modules/core/include/opencv2/core/operations.hpp +++ b/modules/core/include/opencv2/core/operations.hpp @@ -2863,6 +2863,9 @@ CV_EXPORTS FileStorage& operator << (FileStorage& fs, const String& str); static inline FileStorage& operator << (FileStorage& fs, const char* str) { return (fs << String(str)); } +static inline FileStorage& operator << (FileStorage& fs, char* value) +{ return (fs << String(value)); } + inline FileNode::FileNode() : fs(0), node(0) {} inline FileNode::FileNode(const CvFileStorage* _fs, const CvFileNode* _node) : fs(_fs), node(_node) {} diff --git a/modules/core/include/opencv2/core/stream_accessor.hpp b/modules/core/include/opencv2/core/stream_accessor.hpp index 9748bef80c..9b87470e75 100644 --- a/modules/core/include/opencv2/core/stream_accessor.hpp +++ b/modules/core/include/opencv2/core/stream_accessor.hpp @@ -22,7 +22,7 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. @@ -61,4 +61,4 @@ namespace cv } } -#endif /* __OPENCV_CUDA_STREAM_ACCESSOR_HPP__ */ \ No newline at end of file +#endif /* __OPENCV_CUDA_STREAM_ACCESSOR_HPP__ */ diff --git a/modules/core/src/cuda/matrix_operations.cu b/modules/core/src/cuda/matrix_operations.cu index 60aa073406..c9b12de104 100644 --- a/modules/core/src/cuda/matrix_operations.cu +++ b/modules/core/src/cuda/matrix_operations.cu @@ -40,7 +40,6 @@ // //M*/ - #include "opencv2/gpu/device/saturate_cast.hpp" #include "opencv2/gpu/device/transform.hpp" #include "opencv2/gpu/device/functional.hpp" diff --git a/modules/core/src/gl_core_3_1.cpp b/modules/core/src/gl_core_3_1.cpp index 86744c50a6..48fe24b0c6 100644 --- a/modules/core/src/gl_core_3_1.cpp +++ b/modules/core/src/gl_core_3_1.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include #include "cvconfig.h" #include "opencv2/core.hpp" diff --git a/modules/core/src/gl_core_3_1.hpp b/modules/core/src/gl_core_3_1.hpp index 50dbee66c7..f86390169e 100644 --- a/modules/core/src/gl_core_3_1.hpp +++ b/modules/core/src/gl_core_3_1.hpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef OPENGL_NOLOAD_STYLE_HPP #define OPENGL_NOLOAD_STYLE_HPP diff --git a/modules/core/test/test_io.cpp b/modules/core/test/test_io.cpp index 3c9b324f06..64517af981 100644 --- a/modules/core/test/test_io.cpp +++ b/modules/core/test/test_io.cpp @@ -469,4 +469,14 @@ TEST(Core_globbing, accurasy) { ASSERT_NE(std::find(lenas.begin(), lenas.end(), pngLenas[i]), lenas.end()); } -} \ No newline at end of file +} + +TEST(Core_InputOutput, FileStorage) +{ + std::string file = cv::tempfile(".xml"); + cv::FileStorage f(file, cv::FileStorage::WRITE); + + char arr[66]; + sprintf(arr, "sprintf is hell %d", 666); + EXPECT_NO_THROW(f << arr); +} diff --git a/modules/gpu/CMakeLists.txt b/modules/gpu/CMakeLists.txt index 9db4e5f094..3d613cd4dd 100644 --- a/modules/gpu/CMakeLists.txt +++ b/modules/gpu/CMakeLists.txt @@ -28,7 +28,7 @@ if(HAVE_CUDA) source_group("Src\\NVidia" FILES ${ncv_files}) ocv_include_directories("src/nvidia" "src/nvidia/core" "src/nvidia/NPP_staging" ${CUDA_INCLUDE_DIRS}) - ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations /wd4211 /wd4201 /wd4100 /wd4505 /wd4408) + ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations -Wshadow -Wunused-parameter /wd4211 /wd4201 /wd4100 /wd4505 /wd4408) string(REPLACE "-Wsign-promo" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") #set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;") diff --git a/modules/gpu/include/opencv2/gpu.hpp b/modules/gpu/include/opencv2/gpu.hpp index 51e1c5f8da..88703fed02 100644 --- a/modules/gpu/include/opencv2/gpu.hpp +++ b/modules/gpu/include/opencv2/gpu.hpp @@ -22,7 +22,7 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. @@ -921,6 +921,14 @@ CV_EXPORTS void equalizeHist(const GpuMat& src, GpuMat& dst, Stream& stream = St CV_EXPORTS void equalizeHist(const GpuMat& src, GpuMat& dst, GpuMat& hist, Stream& stream = Stream::Null()); CV_EXPORTS void equalizeHist(const GpuMat& src, GpuMat& dst, GpuMat& hist, GpuMat& buf, Stream& stream = Stream::Null()); +class CV_EXPORTS CLAHE : public cv::CLAHE +{ +public: + using cv::CLAHE::apply; + virtual void apply(InputArray src, OutputArray dst, Stream& stream) = 0; +}; +CV_EXPORTS Ptr createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8)); + //////////////////////////////// StereoBM_GPU //////////////////////////////// class CV_EXPORTS StereoBM_GPU diff --git a/modules/gpu/include/opencv2/gpu/device/border_interpolate.hpp b/modules/gpu/include/opencv2/gpu/device/border_interpolate.hpp index 2343ccab2a..2ec97435eb 100644 --- a/modules/gpu/include/opencv2/gpu/device/border_interpolate.hpp +++ b/modules/gpu/include/opencv2/gpu/device/border_interpolate.hpp @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/include/opencv2/gpu/device/color.hpp b/modules/gpu/include/opencv2/gpu/device/color.hpp index 53d3d6b086..c087d179b8 100644 --- a/modules/gpu/include/opencv2/gpu/device/color.hpp +++ b/modules/gpu/include/opencv2/gpu/device/color.hpp @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/include/opencv2/gpu/device/datamov_utils.hpp b/modules/gpu/include/opencv2/gpu/device/datamov_utils.hpp index e05a22477c..a3f62fba98 100644 --- a/modules/gpu/include/opencv2/gpu/device/datamov_utils.hpp +++ b/modules/gpu/include/opencv2/gpu/device/datamov_utils.hpp @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/include/opencv2/gpu/device/detail/color_detail.hpp b/modules/gpu/include/opencv2/gpu/device/detail/color_detail.hpp index 0d9c08620d..d02027f244 100644 --- a/modules/gpu/include/opencv2/gpu/device/detail/color_detail.hpp +++ b/modules/gpu/include/opencv2/gpu/device/detail/color_detail.hpp @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/include/opencv2/gpu/device/emulation.hpp b/modules/gpu/include/opencv2/gpu/device/emulation.hpp index b6fba230e7..bf47bc5f1e 100644 --- a/modules/gpu/include/opencv2/gpu/device/emulation.hpp +++ b/modules/gpu/include/opencv2/gpu/device/emulation.hpp @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/include/opencv2/gpu/device/funcattrib.hpp b/modules/gpu/include/opencv2/gpu/device/funcattrib.hpp index 05df4d10b4..2ed7980205 100644 --- a/modules/gpu/include/opencv2/gpu/device/funcattrib.hpp +++ b/modules/gpu/include/opencv2/gpu/device/funcattrib.hpp @@ -40,7 +40,6 @@ // //M*/ - #ifndef __OPENCV_GPU_DEVICE_FUNCATTRIB_HPP_ #define __OPENCV_GPU_DEVICE_FUNCATTRIB_HPP_ @@ -69,4 +68,4 @@ namespace cv { namespace gpu { namespace device } }}} // namespace cv { namespace gpu { namespace device -#endif /* __OPENCV_GPU_DEVICE_FUNCATTRIB_HPP_ */ \ No newline at end of file +#endif /* __OPENCV_GPU_DEVICE_FUNCATTRIB_HPP_ */ diff --git a/modules/gpu/include/opencv2/gpu/device/scan.hpp b/modules/gpu/include/opencv2/gpu/device/scan.hpp index f6dc6937fb..3d8da16f84 100644 --- a/modules/gpu/include/opencv2/gpu/device/scan.hpp +++ b/modules/gpu/include/opencv2/gpu/device/scan.hpp @@ -43,7 +43,10 @@ #ifndef __OPENCV_GPU_SCAN_HPP__ #define __OPENCV_GPU_SCAN_HPP__ -#include "common.hpp" +#include "opencv2/gpu/device/common.hpp" +#include "opencv2/gpu/device/utility.hpp" +#include "opencv2/gpu/device/warp.hpp" +#include "opencv2/gpu/device/warp_shuffle.hpp" namespace cv { namespace gpu { namespace device { @@ -166,6 +169,82 @@ namespace cv { namespace gpu { namespace device static const int warp_log = 5; static const int warp_mask = 31; }; + + template + __device__ T warpScanInclusive(T idata, volatile T* s_Data, unsigned int tid) + { + #if __CUDA_ARCH__ >= 300 + const unsigned int laneId = cv::gpu::device::Warp::laneId(); + + // scan on shuffl functions + #pragma unroll + for (int i = 1; i <= (OPENCV_GPU_WARP_SIZE / 2); i *= 2) + { + const T n = cv::gpu::device::shfl_up(idata, i); + if (laneId >= i) + idata += n; + } + + return idata; + #else + unsigned int pos = 2 * tid - (tid & (OPENCV_GPU_WARP_SIZE - 1)); + s_Data[pos] = 0; + pos += OPENCV_GPU_WARP_SIZE; + s_Data[pos] = idata; + + s_Data[pos] += s_Data[pos - 1]; + s_Data[pos] += s_Data[pos - 2]; + s_Data[pos] += s_Data[pos - 4]; + s_Data[pos] += s_Data[pos - 8]; + s_Data[pos] += s_Data[pos - 16]; + + return s_Data[pos]; + #endif + } + + template + __device__ __forceinline__ T warpScanExclusive(T idata, volatile T* s_Data, unsigned int tid) + { + return warpScanInclusive(idata, s_Data, tid) - idata; + } + + template + __device__ T blockScanInclusive(T idata, volatile T* s_Data, unsigned int tid) + { + if (tiNumScanThreads > OPENCV_GPU_WARP_SIZE) + { + //Bottom-level inclusive warp scan + T warpResult = warpScanInclusive(idata, s_Data, tid); + + //Save top elements of each warp for exclusive warp scan + //sync to wait for warp scans to complete (because s_Data is being overwritten) + __syncthreads(); + if ((tid & (OPENCV_GPU_WARP_SIZE - 1)) == (OPENCV_GPU_WARP_SIZE - 1)) + { + s_Data[tid >> OPENCV_GPU_LOG_WARP_SIZE] = warpResult; + } + + //wait for warp scans to complete + __syncthreads(); + + if (tid < (tiNumScanThreads / OPENCV_GPU_WARP_SIZE) ) + { + //grab top warp elements + T val = s_Data[tid]; + //calculate exclusive scan and write back to shared memory + s_Data[tid] = warpScanExclusive(val, s_Data, tid); + } + + //return updated warp scans with exclusive scan results + __syncthreads(); + + return warpResult + s_Data[tid >> OPENCV_GPU_LOG_WARP_SIZE]; + } + else + { + return warpScanInclusive(idata, s_Data, tid); + } + } }}} #endif // __OPENCV_GPU_SCAN_HPP__ diff --git a/modules/gpu/include/opencv2/gpu/device/simd_functions.hpp b/modules/gpu/include/opencv2/gpu/device/simd_functions.hpp index 55b1f247ff..b0377e533e 100644 --- a/modules/gpu/include/opencv2/gpu/device/simd_functions.hpp +++ b/modules/gpu/include/opencv2/gpu/device/simd_functions.hpp @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2010-2013, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/include/opencv2/gpu/device/warp_reduce.hpp b/modules/gpu/include/opencv2/gpu/device/warp_reduce.hpp index 7ac85b095d..d4e64c4615 100644 --- a/modules/gpu/include/opencv2/gpu/device/warp_reduce.hpp +++ b/modules/gpu/include/opencv2/gpu/device/warp_reduce.hpp @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages @@ -40,7 +40,6 @@ // //M*/ - #ifndef OPENCV_GPU_WARP_REDUCE_HPP__ #define OPENCV_GPU_WARP_REDUCE_HPP__ @@ -66,4 +65,4 @@ namespace cv { namespace gpu { namespace device } }}} // namespace cv { namespace gpu { namespace device { -#endif /* OPENCV_GPU_WARP_REDUCE_HPP__ */ \ No newline at end of file +#endif /* OPENCV_GPU_WARP_REDUCE_HPP__ */ diff --git a/modules/gpu/include/opencv2/gpu/devmem2d.hpp b/modules/gpu/include/opencv2/gpu/devmem2d.hpp index fc2d2f2757..18dfcd8acb 100644 --- a/modules/gpu/include/opencv2/gpu/devmem2d.hpp +++ b/modules/gpu/include/opencv2/gpu/devmem2d.hpp @@ -22,7 +22,7 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. diff --git a/modules/gpu/include/opencv2/gpu/gpu.hpp b/modules/gpu/include/opencv2/gpu/gpu.hpp index 159f4b9682..e044ad1e8a 100644 --- a/modules/gpu/include/opencv2/gpu/gpu.hpp +++ b/modules/gpu/include/opencv2/gpu/gpu.hpp @@ -45,4 +45,4 @@ #error this is a compatibility header which should not be used inside the OpenCV library #endif -#include "opencv2/gpu.hpp" \ No newline at end of file +#include "opencv2/gpu.hpp" diff --git a/modules/gpu/include/opencv2/gpu/gpumat.hpp b/modules/gpu/include/opencv2/gpu/gpumat.hpp index 0033cbe961..840398b573 100644 --- a/modules/gpu/include/opencv2/gpu/gpumat.hpp +++ b/modules/gpu/include/opencv2/gpu/gpumat.hpp @@ -22,7 +22,7 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. diff --git a/modules/gpu/perf/perf_calib3d.cpp b/modules/gpu/perf/perf_calib3d.cpp index f9a1d51509..725f49c531 100644 --- a/modules/gpu/perf/perf_calib3d.cpp +++ b/modules/gpu/perf/perf_calib3d.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" using namespace std; diff --git a/modules/gpu/perf/perf_core.cpp b/modules/gpu/perf/perf_core.cpp index 70bb8f24f1..3461880379 100644 --- a/modules/gpu/perf/perf_core.cpp +++ b/modules/gpu/perf/perf_core.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" using namespace std; diff --git a/modules/gpu/perf/perf_denoising.cpp b/modules/gpu/perf/perf_denoising.cpp index 9701225685..1e33601d60 100644 --- a/modules/gpu/perf/perf_denoising.cpp +++ b/modules/gpu/perf/perf_denoising.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" using namespace std; diff --git a/modules/gpu/perf/perf_features2d.cpp b/modules/gpu/perf/perf_features2d.cpp index e5a6ef3c89..feee3a939e 100644 --- a/modules/gpu/perf/perf_features2d.cpp +++ b/modules/gpu/perf/perf_features2d.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" using namespace std; diff --git a/modules/gpu/perf/perf_filters.cpp b/modules/gpu/perf/perf_filters.cpp index a343d10570..84d9cc4663 100644 --- a/modules/gpu/perf/perf_filters.cpp +++ b/modules/gpu/perf/perf_filters.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" using namespace std; diff --git a/modules/gpu/perf/perf_imgproc.cpp b/modules/gpu/perf/perf_imgproc.cpp index 84cb0e200f..eff2bfcf2e 100644 --- a/modules/gpu/perf/perf_imgproc.cpp +++ b/modules/gpu/perf/perf_imgproc.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" using namespace std; @@ -558,6 +600,39 @@ PERF_TEST_P(Sz, ImgProc_EqualizeHist, } } +DEF_PARAM_TEST(Sz_ClipLimit, cv::Size, double); + +PERF_TEST_P(Sz_ClipLimit, ImgProc_CLAHE, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(0.0, 40.0))) +{ + const cv::Size size = GET_PARAM(0); + const double clipLimit = GET_PARAM(1); + + cv::Mat src(size, CV_8UC1); + declare.in(src, WARMUP_RNG); + + if (PERF_RUN_GPU()) + { + cv::Ptr clahe = cv::gpu::createCLAHE(clipLimit); + cv::gpu::GpuMat d_src(src); + cv::gpu::GpuMat dst; + + TEST_CYCLE() clahe->apply(d_src, dst); + + GPU_SANITY_CHECK(dst); + } + else + { + cv::Ptr clahe = cv::createCLAHE(clipLimit); + cv::Mat dst; + + TEST_CYCLE() clahe->apply(src, dst); + + CPU_SANITY_CHECK(dst); + } +} + ////////////////////////////////////////////////////////////////////// // ColumnSum diff --git a/modules/gpu/perf/perf_labeling.cpp b/modules/gpu/perf/perf_labeling.cpp index cbc9ff0a2f..0484da9d59 100644 --- a/modules/gpu/perf/perf_labeling.cpp +++ b/modules/gpu/perf/perf_labeling.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" using namespace std; diff --git a/modules/gpu/perf/perf_main.cpp b/modules/gpu/perf/perf_main.cpp index 07c1b519cc..a7ac1ccce8 100644 --- a/modules/gpu/perf/perf_main.cpp +++ b/modules/gpu/perf/perf_main.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" using namespace perf; diff --git a/modules/gpu/perf/perf_matop.cpp b/modules/gpu/perf/perf_matop.cpp index f2803f0f2c..f80ba1b087 100644 --- a/modules/gpu/perf/perf_matop.cpp +++ b/modules/gpu/perf/perf_matop.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" using namespace std; diff --git a/modules/gpu/perf/perf_objdetect.cpp b/modules/gpu/perf/perf_objdetect.cpp index 4f8e56853f..1516d6b99b 100644 --- a/modules/gpu/perf/perf_objdetect.cpp +++ b/modules/gpu/perf/perf_objdetect.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" using namespace std; diff --git a/modules/gpu/perf/perf_precomp.cpp b/modules/gpu/perf/perf_precomp.cpp index 8552ac3d42..81f16e8f14 100644 --- a/modules/gpu/perf/perf_precomp.cpp +++ b/modules/gpu/perf/perf_precomp.cpp @@ -1 +1,43 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" diff --git a/modules/gpu/perf/perf_precomp.hpp b/modules/gpu/perf/perf_precomp.hpp index 322cac094d..8a9eb78ae7 100644 --- a/modules/gpu/perf/perf_precomp.hpp +++ b/modules/gpu/perf/perf_precomp.hpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifdef __GNUC__ # pragma GCC diagnostic ignored "-Wmissing-declarations" # if defined __clang__ || defined __APPLE__ diff --git a/modules/gpu/perf/perf_video.cpp b/modules/gpu/perf/perf_video.cpp index a723d91193..046bc27f5d 100644 --- a/modules/gpu/perf/perf_video.cpp +++ b/modules/gpu/perf/perf_video.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" using namespace std; diff --git a/modules/gpu/perf4au/main.cpp b/modules/gpu/perf4au/main.cpp index 162a15b2f7..47a6c4e257 100644 --- a/modules/gpu/perf4au/main.cpp +++ b/modules/gpu/perf4au/main.cpp @@ -1,4 +1,47 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include + #ifdef HAVE_CVCONFIG_H #include "cvconfig.h" #endif diff --git a/modules/gpu/src/arithm.cpp b/modules/gpu/src/arithm.cpp index 47a29881fc..ad0b894d93 100644 --- a/modules/gpu/src/arithm.cpp +++ b/modules/gpu/src/arithm.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/bilateral_filter.cpp b/modules/gpu/src/bilateral_filter.cpp index 6aa0f525d3..c60954dcfc 100644 --- a/modules/gpu/src/bilateral_filter.cpp +++ b/modules/gpu/src/bilateral_filter.cpp @@ -22,7 +22,7 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. diff --git a/modules/gpu/src/blend.cpp b/modules/gpu/src/blend.cpp index df73afad69..1f4cf7d30d 100644 --- a/modules/gpu/src/blend.cpp +++ b/modules/gpu/src/blend.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/brute_force_matcher.cpp b/modules/gpu/src/brute_force_matcher.cpp index 4276f75a9e..b57b13fabb 100644 --- a/modules/gpu/src/brute_force_matcher.cpp +++ b/modules/gpu/src/brute_force_matcher.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cascadeclassifier.cpp b/modules/gpu/src/cascadeclassifier.cpp index fa969f2e80..10108e9064 100644 --- a/modules/gpu/src/cascadeclassifier.cpp +++ b/modules/gpu/src/cascadeclassifier.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cu_safe_call.cpp b/modules/gpu/src/cu_safe_call.cpp index 9b8c1d9161..9251e4dd6b 100644 --- a/modules/gpu/src/cu_safe_call.cpp +++ b/modules/gpu/src/cu_safe_call.cpp @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/cu_safe_call.h b/modules/gpu/src/cu_safe_call.h index c52e81deac..d186fa5288 100644 --- a/modules/gpu/src/cu_safe_call.h +++ b/modules/gpu/src/cu_safe_call.h @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/cuda/NV12ToARGB.cu b/modules/gpu/src/cuda/NV12ToARGB.cu index 8ad6cfdfae..99aeba6fd8 100644 --- a/modules/gpu/src/cuda/NV12ToARGB.cu +++ b/modules/gpu/src/cuda/NV12ToARGB.cu @@ -41,23 +41,12 @@ //M*/ /* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * Please refer to the NVIDIA end user license agreement (EULA) associated - * with this source code for terms and conditions that govern your use of - * this software. Any use, reproduction, disclosure, or distribution of - * this software and related documentation outside the terms of the EULA - * is strictly prohibited. + * NV12ToARGB color space conversion CUDA kernel * + * This sample uses CUDA to perform a simple NV12 (YUV 4:2:0 planar) + * source and converts to output in ARGB format */ -/* - NV12ToARGB color space conversion CUDA kernel - - This sample uses CUDA to perform a simple NV12 (YUV 4:2:0 planar) - source and converts to output in ARGB format -*/ - #if !defined CUDA_DISABLER #include "opencv2/gpu/device/common.hpp" @@ -209,4 +198,4 @@ namespace cv { namespace gpu { namespace device { } }}} -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/src/cuda/bf_knnmatch.cu b/modules/gpu/src/cuda/bf_knnmatch.cu index 49bc1dfcd2..66e37d088a 100644 --- a/modules/gpu/src/cuda/bf_knnmatch.cu +++ b/modules/gpu/src/cuda/bf_knnmatch.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/bf_match.cu b/modules/gpu/src/cuda/bf_match.cu index 5e64e31bd9..f7bdcdc0f1 100644 --- a/modules/gpu/src/cuda/bf_match.cu +++ b/modules/gpu/src/cuda/bf_match.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/bf_radius_match.cu b/modules/gpu/src/cuda/bf_radius_match.cu index 19ee94e331..44cd2b55f9 100644 --- a/modules/gpu/src/cuda/bf_radius_match.cu +++ b/modules/gpu/src/cuda/bf_radius_match.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/bgfg_gmg.cu b/modules/gpu/src/cuda/bgfg_gmg.cu index 8e2fd3b38b..f0f78c9331 100644 --- a/modules/gpu/src/cuda/bgfg_gmg.cu +++ b/modules/gpu/src/cuda/bgfg_gmg.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages @@ -255,4 +255,4 @@ namespace cv { namespace gpu { namespace device { }}} -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/src/cuda/bgfg_mog.cu b/modules/gpu/src/cuda/bgfg_mog.cu index d99ffc498a..89ad5ff0b5 100644 --- a/modules/gpu/src/cuda/bgfg_mog.cu +++ b/modules/gpu/src/cuda/bgfg_mog.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/bilateral_filter.cu b/modules/gpu/src/cuda/bilateral_filter.cu index 14b23d1ae1..2a3e672534 100644 --- a/modules/gpu/src/cuda/bilateral_filter.cu +++ b/modules/gpu/src/cuda/bilateral_filter.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -29,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/blend.cu b/modules/gpu/src/cuda/blend.cu index 590e02b4be..5cfcb51681 100644 --- a/modules/gpu/src/cuda/blend.cu +++ b/modules/gpu/src/cuda/blend.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/ccomponetns.cu b/modules/gpu/src/cuda/ccomponetns.cu index 0533522bed..7f3d4ae338 100644 --- a/modules/gpu/src/cuda/ccomponetns.cu +++ b/modules/gpu/src/cuda/ccomponetns.cu @@ -1,31 +1,31 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. // // -// License Agreement -// For Open Source Computer Vision Library +// License Agreement +// For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. // -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. // -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and // any express or implied warranties, including, but not limited to, the implied @@ -37,6 +37,7 @@ // and on any theory of liability, whether in contract, strict liability, // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. +// //M*/ #if !defined CUDA_DISABLER diff --git a/modules/gpu/src/cuda/clahe.cu b/modules/gpu/src/cuda/clahe.cu new file mode 100644 index 0000000000..a0c30d5826 --- /dev/null +++ b/modules/gpu/src/cuda/clahe.cu @@ -0,0 +1,186 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + +#if !defined CUDA_DISABLER + +#include "opencv2/gpu/device/common.hpp" +#include "opencv2/gpu/device/functional.hpp" +#include "opencv2/gpu/device/emulation.hpp" +#include "opencv2/gpu/device/scan.hpp" +#include "opencv2/gpu/device/reduce.hpp" +#include "opencv2/gpu/device/saturate_cast.hpp" + +using namespace cv::gpu; +using namespace cv::gpu::device; + +namespace clahe +{ + __global__ void calcLutKernel(const PtrStepb src, PtrStepb lut, + const int2 tileSize, const int tilesX, + const int clipLimit, const float lutScale) + { + __shared__ int smem[512]; + + const int tx = blockIdx.x; + const int ty = blockIdx.y; + const unsigned int tid = threadIdx.y * blockDim.x + threadIdx.x; + + smem[tid] = 0; + __syncthreads(); + + for (int i = threadIdx.y; i < tileSize.y; i += blockDim.y) + { + const uchar* srcPtr = src.ptr(ty * tileSize.y + i) + tx * tileSize.x; + for (int j = threadIdx.x; j < tileSize.x; j += blockDim.x) + { + const int data = srcPtr[j]; + Emulation::smem::atomicAdd(&smem[data], 1); + } + } + + __syncthreads(); + + int tHistVal = smem[tid]; + + __syncthreads(); + + if (clipLimit > 0) + { + // clip histogram bar + + int clipped = 0; + if (tHistVal > clipLimit) + { + clipped = tHistVal - clipLimit; + tHistVal = clipLimit; + } + + // find number of overall clipped samples + + reduce<256>(smem, clipped, tid, plus()); + + // broadcast evaluated value + + __shared__ int totalClipped; + + if (tid == 0) + totalClipped = clipped; + __syncthreads(); + + // redistribute clipped samples evenly + + int redistBatch = totalClipped / 256; + tHistVal += redistBatch; + + int residual = totalClipped - redistBatch * 256; + if (tid < residual) + ++tHistVal; + } + + const int lutVal = blockScanInclusive<256>(tHistVal, smem, tid); + + lut(ty * tilesX + tx, tid) = saturate_cast(__float2int_rn(lutScale * lutVal)); + } + + void calcLut(PtrStepSzb src, PtrStepb lut, int tilesX, int tilesY, int2 tileSize, int clipLimit, float lutScale, cudaStream_t stream) + { + const dim3 block(32, 8); + const dim3 grid(tilesX, tilesY); + + calcLutKernel<<>>(src, lut, tileSize, tilesX, clipLimit, lutScale); + + cudaSafeCall( cudaGetLastError() ); + + if (stream == 0) + cudaSafeCall( cudaDeviceSynchronize() ); + } + + __global__ void tranformKernel(const PtrStepSzb src, PtrStepb dst, const PtrStepb lut, const int2 tileSize, const int tilesX, const int tilesY) + { + const int x = blockIdx.x * blockDim.x + threadIdx.x; + const int y = blockIdx.y * blockDim.y + threadIdx.y; + + if (x >= src.cols || y >= src.rows) + return; + + const float tyf = (static_cast(y) / tileSize.y) - 0.5f; + int ty1 = __float2int_rd(tyf); + int ty2 = ty1 + 1; + const float ya = tyf - ty1; + ty1 = ::max(ty1, 0); + ty2 = ::min(ty2, tilesY - 1); + + const float txf = (static_cast(x) / tileSize.x) - 0.5f; + int tx1 = __float2int_rd(txf); + int tx2 = tx1 + 1; + const float xa = txf - tx1; + tx1 = ::max(tx1, 0); + tx2 = ::min(tx2, tilesX - 1); + + const int srcVal = src(y, x); + + float res = 0; + + res += lut(ty1 * tilesX + tx1, srcVal) * ((1.0f - xa) * (1.0f - ya)); + res += lut(ty1 * tilesX + tx2, srcVal) * ((xa) * (1.0f - ya)); + res += lut(ty2 * tilesX + tx1, srcVal) * ((1.0f - xa) * (ya)); + res += lut(ty2 * tilesX + tx2, srcVal) * ((xa) * (ya)); + + dst(y, x) = saturate_cast(res); + } + + void transform(PtrStepSzb src, PtrStepSzb dst, PtrStepb lut, int tilesX, int tilesY, int2 tileSize, cudaStream_t stream) + { + const dim3 block(32, 8); + const dim3 grid(divUp(src.cols, block.x), divUp(src.rows, block.y)); + + cudaSafeCall( cudaFuncSetCacheConfig(tranformKernel, cudaFuncCachePreferL1) ); + + tranformKernel<<>>(src, dst, lut, tileSize, tilesX, tilesY); + cudaSafeCall( cudaGetLastError() ); + + if (stream == 0) + cudaSafeCall( cudaDeviceSynchronize() ); + } +} + +#endif // CUDA_DISABLER diff --git a/modules/gpu/src/cuda/column_filter.0.cu b/modules/gpu/src/cuda/column_filter.0.cu index c35c6ee64d..339fb80707 100644 --- a/modules/gpu/src/cuda/column_filter.0.cu +++ b/modules/gpu/src/cuda/column_filter.0.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.1.cu b/modules/gpu/src/cuda/column_filter.1.cu index 9a2d6a0427..53914a2159 100644 --- a/modules/gpu/src/cuda/column_filter.1.cu +++ b/modules/gpu/src/cuda/column_filter.1.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.10.cu b/modules/gpu/src/cuda/column_filter.10.cu index 41e35bc1c6..b71e25207e 100644 --- a/modules/gpu/src/cuda/column_filter.10.cu +++ b/modules/gpu/src/cuda/column_filter.10.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.11.cu b/modules/gpu/src/cuda/column_filter.11.cu index 981208a68b..ccfbf8e773 100644 --- a/modules/gpu/src/cuda/column_filter.11.cu +++ b/modules/gpu/src/cuda/column_filter.11.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.12.cu b/modules/gpu/src/cuda/column_filter.12.cu index 13d2e60023..a38f93b531 100644 --- a/modules/gpu/src/cuda/column_filter.12.cu +++ b/modules/gpu/src/cuda/column_filter.12.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.13.cu b/modules/gpu/src/cuda/column_filter.13.cu index 09f6484af4..40eec7a83f 100644 --- a/modules/gpu/src/cuda/column_filter.13.cu +++ b/modules/gpu/src/cuda/column_filter.13.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.14.cu b/modules/gpu/src/cuda/column_filter.14.cu index 901ab03011..08151ac6d0 100644 --- a/modules/gpu/src/cuda/column_filter.14.cu +++ b/modules/gpu/src/cuda/column_filter.14.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.2.cu b/modules/gpu/src/cuda/column_filter.2.cu index 05ee01c763..a615944cb9 100644 --- a/modules/gpu/src/cuda/column_filter.2.cu +++ b/modules/gpu/src/cuda/column_filter.2.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.3.cu b/modules/gpu/src/cuda/column_filter.3.cu index 1bf49219f9..7304565b96 100644 --- a/modules/gpu/src/cuda/column_filter.3.cu +++ b/modules/gpu/src/cuda/column_filter.3.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.4.cu b/modules/gpu/src/cuda/column_filter.4.cu index bec7a085a0..8c9db6985b 100644 --- a/modules/gpu/src/cuda/column_filter.4.cu +++ b/modules/gpu/src/cuda/column_filter.4.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.5.cu b/modules/gpu/src/cuda/column_filter.5.cu index 8194ee39aa..a192660306 100644 --- a/modules/gpu/src/cuda/column_filter.5.cu +++ b/modules/gpu/src/cuda/column_filter.5.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.6.cu b/modules/gpu/src/cuda/column_filter.6.cu index d8fc49be68..f4f7c4ffb9 100644 --- a/modules/gpu/src/cuda/column_filter.6.cu +++ b/modules/gpu/src/cuda/column_filter.6.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.7.cu b/modules/gpu/src/cuda/column_filter.7.cu index 534bd821ef..9f94bed9d9 100644 --- a/modules/gpu/src/cuda/column_filter.7.cu +++ b/modules/gpu/src/cuda/column_filter.7.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.8.cu b/modules/gpu/src/cuda/column_filter.8.cu index 38e70e772e..0a63a1dd43 100644 --- a/modules/gpu/src/cuda/column_filter.8.cu +++ b/modules/gpu/src/cuda/column_filter.8.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.9.cu b/modules/gpu/src/cuda/column_filter.9.cu index 5b58345820..758d9289d9 100644 --- a/modules/gpu/src/cuda/column_filter.9.cu +++ b/modules/gpu/src/cuda/column_filter.9.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/column_filter.h b/modules/gpu/src/cuda/column_filter.h index 52b9103393..46e3583153 100644 --- a/modules/gpu/src/cuda/column_filter.h +++ b/modules/gpu/src/cuda/column_filter.h @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/fast.cu b/modules/gpu/src/cuda/fast.cu index 831cb92b60..9bf1f7ad93 100644 --- a/modules/gpu/src/cuda/fast.cu +++ b/modules/gpu/src/cuda/fast.cu @@ -38,11 +38,6 @@ // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // -// Copyright (c) 2010, Paul Furgale, Chi Hay Tong -// -// The original code was written by Paul Furgale and Chi Hay Tong -// and later optimized and prepared for integration into OpenCV by Itseez. -// //M*/ #if !defined CUDA_DISABLER @@ -387,4 +382,4 @@ namespace cv { namespace gpu { namespace device }}} -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/src/cuda/fgd_bgfg.cu b/modules/gpu/src/cuda/fgd_bgfg.cu index a14da0f854..9ecf890e91 100644 --- a/modules/gpu/src/cuda/fgd_bgfg.cu +++ b/modules/gpu/src/cuda/fgd_bgfg.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/fgd_bgfg_common.hpp b/modules/gpu/src/cuda/fgd_bgfg_common.hpp index 986952e439..a8fda7bb68 100644 --- a/modules/gpu/src/cuda/fgd_bgfg_common.hpp +++ b/modules/gpu/src/cuda/fgd_bgfg_common.hpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef __FGD_BGFG_COMMON_HPP__ #define __FGD_BGFG_COMMON_HPP__ diff --git a/modules/gpu/src/cuda/gftt.cu b/modules/gpu/src/cuda/gftt.cu index cae217e394..b5c3edb2d2 100644 --- a/modules/gpu/src/cuda/gftt.cu +++ b/modules/gpu/src/cuda/gftt.cu @@ -38,11 +38,6 @@ // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // -// Copyright (c) 2010, Paul Furgale, Chi Hay Tong -// -// The original code was written by Paul Furgale and Chi Hay Tong -// and later optimized and prepared for integration into OpenCV by Itseez. -// //M*/ #if !defined CUDA_DISABLER diff --git a/modules/gpu/src/cuda/global_motion.cu b/modules/gpu/src/cuda/global_motion.cu index b62ca2c9fd..bad6fd5a22 100644 --- a/modules/gpu/src/cuda/global_motion.cu +++ b/modules/gpu/src/cuda/global_motion.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -29,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/hist.cu b/modules/gpu/src/cuda/hist.cu index 9dd14182be..8b8a1e8c63 100644 --- a/modules/gpu/src/cuda/hist.cu +++ b/modules/gpu/src/cuda/hist.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -29,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/hough.cu b/modules/gpu/src/cuda/hough.cu index 695a47def4..faec89b95c 100644 --- a/modules/gpu/src/cuda/hough.cu +++ b/modules/gpu/src/cuda/hough.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/integral_image.cu b/modules/gpu/src/cuda/integral_image.cu index 73cefa9a0b..6b32750008 100644 --- a/modules/gpu/src/cuda/integral_image.cu +++ b/modules/gpu/src/cuda/integral_image.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages @@ -469,4 +469,4 @@ namespace cv { namespace gpu { namespace device } }}} -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/src/cuda/lbp.cu b/modules/gpu/src/cuda/lbp.cu index a09aa1e79b..06e7303353 100644 --- a/modules/gpu/src/cuda/lbp.cu +++ b/modules/gpu/src/cuda/lbp.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/lbp.hpp b/modules/gpu/src/cuda/lbp.hpp index dd663d9cc5..792a96a51e 100644 --- a/modules/gpu/src/cuda/lbp.hpp +++ b/modules/gpu/src/cuda/lbp.hpp @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/nlm.cu b/modules/gpu/src/cuda/nlm.cu index cd3f0b5c3a..922cba7e5a 100644 --- a/modules/gpu/src/cuda/nlm.cu +++ b/modules/gpu/src/cuda/nlm.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -29,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/optflowbm.cu b/modules/gpu/src/cuda/optflowbm.cu index baf8dfb362..774b68d003 100644 --- a/modules/gpu/src/cuda/optflowbm.cu +++ b/modules/gpu/src/cuda/optflowbm.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/orb.cu b/modules/gpu/src/cuda/orb.cu index 95706dfa39..723bf28ffb 100644 --- a/modules/gpu/src/cuda/orb.cu +++ b/modules/gpu/src/cuda/orb.cu @@ -38,11 +38,6 @@ // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // -// Copyright (c) 2010, Paul Furgale, Chi Hay Tong -// -// The original code was written by Paul Furgale and Chi Hay Tong -// and later optimized and prepared for integration into OpenCV by Itseez. -// //M*/ #if !defined CUDA_DISABLER diff --git a/modules/gpu/src/cuda/pyr_down.cu b/modules/gpu/src/cuda/pyr_down.cu index 35c24e4b8a..e6ef64721e 100644 --- a/modules/gpu/src/cuda/pyr_down.cu +++ b/modules/gpu/src/cuda/pyr_down.cu @@ -225,4 +225,4 @@ namespace cv { namespace gpu { namespace device }}} // namespace cv { namespace gpu { namespace device -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/src/cuda/pyrlk.cu b/modules/gpu/src/cuda/pyrlk.cu index 8d746143c8..8ef728b03b 100644 --- a/modules/gpu/src/cuda/pyrlk.cu +++ b/modules/gpu/src/cuda/pyrlk.cu @@ -38,11 +38,6 @@ // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // -// Copyright (c) 2010, Paul Furgale, Chi Hay Tong -// -// The original code was written by Paul Furgale and Chi Hay Tong -// and later optimized and prepared for integration into OpenCV by Itseez. -// //M*/ #if !defined CUDA_DISABLER diff --git a/modules/gpu/src/cuda/rgb_to_yv12.cu b/modules/gpu/src/cuda/rgb_to_yv12.cu index 5fd0217dc9..e38368ab80 100644 --- a/modules/gpu/src/cuda/rgb_to_yv12.cu +++ b/modules/gpu/src/cuda/rgb_to_yv12.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages @@ -172,4 +172,4 @@ namespace cv { namespace gpu { namespace device } }}} -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/src/cuda/row_filter.0.cu b/modules/gpu/src/cuda/row_filter.0.cu index a1a8f36cad..a4b4239844 100644 --- a/modules/gpu/src/cuda/row_filter.0.cu +++ b/modules/gpu/src/cuda/row_filter.0.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.1.cu b/modules/gpu/src/cuda/row_filter.1.cu index ab2248e1b2..ac4724f8c1 100644 --- a/modules/gpu/src/cuda/row_filter.1.cu +++ b/modules/gpu/src/cuda/row_filter.1.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.10.cu b/modules/gpu/src/cuda/row_filter.10.cu index 4509fe4a72..7d93ee31ac 100644 --- a/modules/gpu/src/cuda/row_filter.10.cu +++ b/modules/gpu/src/cuda/row_filter.10.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.11.cu b/modules/gpu/src/cuda/row_filter.11.cu index 839b56c7c0..31bccc48b6 100644 --- a/modules/gpu/src/cuda/row_filter.11.cu +++ b/modules/gpu/src/cuda/row_filter.11.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.12.cu b/modules/gpu/src/cuda/row_filter.12.cu index c4879dbe4c..7be543f6b2 100644 --- a/modules/gpu/src/cuda/row_filter.12.cu +++ b/modules/gpu/src/cuda/row_filter.12.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.13.cu b/modules/gpu/src/cuda/row_filter.13.cu index c5da957a58..bd700b1bb2 100644 --- a/modules/gpu/src/cuda/row_filter.13.cu +++ b/modules/gpu/src/cuda/row_filter.13.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.14.cu b/modules/gpu/src/cuda/row_filter.14.cu index d8ccb9a2ed..97df2f128a 100644 --- a/modules/gpu/src/cuda/row_filter.14.cu +++ b/modules/gpu/src/cuda/row_filter.14.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.2.cu b/modules/gpu/src/cuda/row_filter.2.cu index 5aa2e2b80a..d630b6fc52 100644 --- a/modules/gpu/src/cuda/row_filter.2.cu +++ b/modules/gpu/src/cuda/row_filter.2.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.3.cu b/modules/gpu/src/cuda/row_filter.3.cu index 9d131a959d..fe84666954 100644 --- a/modules/gpu/src/cuda/row_filter.3.cu +++ b/modules/gpu/src/cuda/row_filter.3.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.4.cu b/modules/gpu/src/cuda/row_filter.4.cu index 0aae534ce7..050f7af04e 100644 --- a/modules/gpu/src/cuda/row_filter.4.cu +++ b/modules/gpu/src/cuda/row_filter.4.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.5.cu b/modules/gpu/src/cuda/row_filter.5.cu index dd1f2be135..975aea4a10 100644 --- a/modules/gpu/src/cuda/row_filter.5.cu +++ b/modules/gpu/src/cuda/row_filter.5.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.6.cu b/modules/gpu/src/cuda/row_filter.6.cu index 548069d363..d5894452b1 100644 --- a/modules/gpu/src/cuda/row_filter.6.cu +++ b/modules/gpu/src/cuda/row_filter.6.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.7.cu b/modules/gpu/src/cuda/row_filter.7.cu index 8c5c09ed93..ac3fcc14b2 100644 --- a/modules/gpu/src/cuda/row_filter.7.cu +++ b/modules/gpu/src/cuda/row_filter.7.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.8.cu b/modules/gpu/src/cuda/row_filter.8.cu index 77e4ed63f6..b899e87a7a 100644 --- a/modules/gpu/src/cuda/row_filter.8.cu +++ b/modules/gpu/src/cuda/row_filter.8.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.9.cu b/modules/gpu/src/cuda/row_filter.9.cu index 954944b007..516dd8fe7c 100644 --- a/modules/gpu/src/cuda/row_filter.9.cu +++ b/modules/gpu/src/cuda/row_filter.9.cu @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/row_filter.h b/modules/gpu/src/cuda/row_filter.h index f2da684cc1..933f900293 100644 --- a/modules/gpu/src/cuda/row_filter.h +++ b/modules/gpu/src/cuda/row_filter.h @@ -12,7 +12,6 @@ // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 1993-2011, NVIDIA Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/cuda/split_merge.cu b/modules/gpu/src/cuda/split_merge.cu index 9c5eada646..dad787da9d 100644 --- a/modules/gpu/src/cuda/split_merge.cu +++ b/modules/gpu/src/cuda/split_merge.cu @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/stereobp.cu b/modules/gpu/src/cuda/stereobp.cu index 59e9f2087b..f696b629ba 100644 --- a/modules/gpu/src/cuda/stereobp.cu +++ b/modules/gpu/src/cuda/stereobp.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuda/texture_binder.hpp b/modules/gpu/src/cuda/texture_binder.hpp index 391eb9a190..801a6d2702 100644 --- a/modules/gpu/src/cuda/texture_binder.hpp +++ b/modules/gpu/src/cuda/texture_binder.hpp @@ -89,4 +89,4 @@ namespace cv } } -#endif /* OPENCV_GPU_TEXTURE_BINDER_HPP_*/ \ No newline at end of file +#endif /* OPENCV_GPU_TEXTURE_BINDER_HPP_*/ diff --git a/modules/gpu/src/cuda/tvl1flow.cu b/modules/gpu/src/cuda/tvl1flow.cu index 27694ad269..a2b934bf75 100644 --- a/modules/gpu/src/cuda/tvl1flow.cu +++ b/modules/gpu/src/cuda/tvl1flow.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/cuvid_video_source.cpp b/modules/gpu/src/cuvid_video_source.cpp index 38091e6c20..8f072fb967 100644 --- a/modules/gpu/src/cuvid_video_source.cpp +++ b/modules/gpu/src/cuvid_video_source.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "cuvid_video_source.h" #include "cu_safe_call.h" diff --git a/modules/gpu/src/cuvid_video_source.h b/modules/gpu/src/cuvid_video_source.h index a541df72df..1bf4849027 100644 --- a/modules/gpu/src/cuvid_video_source.h +++ b/modules/gpu/src/cuvid_video_source.h @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/denoising.cpp b/modules/gpu/src/denoising.cpp index 74c1a56686..995b809d3e 100644 --- a/modules/gpu/src/denoising.cpp +++ b/modules/gpu/src/denoising.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/element_operations.cpp b/modules/gpu/src/element_operations.cpp index 2c83967edd..afce5bbc7f 100644 --- a/modules/gpu/src/element_operations.cpp +++ b/modules/gpu/src/element_operations.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/error.cpp b/modules/gpu/src/error.cpp index 128b23b500..25d73afb7c 100644 --- a/modules/gpu/src/error.cpp +++ b/modules/gpu/src/error.cpp @@ -39,7 +39,6 @@ // the use of this software, even if advised of the possibility of such damage. // //M*/ - #include "precomp.hpp" using namespace cv; diff --git a/modules/gpu/src/fast.cpp b/modules/gpu/src/fast.cpp index e44b9e1644..01ddb75eae 100644 --- a/modules/gpu/src/fast.cpp +++ b/modules/gpu/src/fast.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/ffmpeg_video_source.cpp b/modules/gpu/src/ffmpeg_video_source.cpp index 9118cc320e..ff51a8f3d3 100644 --- a/modules/gpu/src/ffmpeg_video_source.cpp +++ b/modules/gpu/src/ffmpeg_video_source.cpp @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/ffmpeg_video_source.h b/modules/gpu/src/ffmpeg_video_source.h index 3795dfd2e0..a2ba40cccb 100644 --- a/modules/gpu/src/ffmpeg_video_source.h +++ b/modules/gpu/src/ffmpeg_video_source.h @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/frame_queue.cpp b/modules/gpu/src/frame_queue.cpp index 0d93918732..a8b9cff0bf 100644 --- a/modules/gpu/src/frame_queue.cpp +++ b/modules/gpu/src/frame_queue.cpp @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/frame_queue.h b/modules/gpu/src/frame_queue.h index 00c44a4015..e408b0dd06 100644 --- a/modules/gpu/src/frame_queue.h +++ b/modules/gpu/src/frame_queue.h @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/gftt.cpp b/modules/gpu/src/gftt.cpp index 2c50ed69d2..76aee561b5 100644 --- a/modules/gpu/src/gftt.cpp +++ b/modules/gpu/src/gftt.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/global_motion.cpp b/modules/gpu/src/global_motion.cpp index 36c917744e..f7da2e884a 100644 --- a/modules/gpu/src/global_motion.cpp +++ b/modules/gpu/src/global_motion.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/graphcuts.cpp b/modules/gpu/src/graphcuts.cpp index 49230e65a9..b8c0d4ff9f 100644 --- a/modules/gpu/src/graphcuts.cpp +++ b/modules/gpu/src/graphcuts.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/hog.cpp b/modules/gpu/src/hog.cpp index a3af032a1b..03ca0a5cdc 100644 --- a/modules/gpu/src/hog.cpp +++ b/modules/gpu/src/hog.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/imgproc.cpp b/modules/gpu/src/imgproc.cpp index 63342231d0..916dde0c7f 100644 --- a/modules/gpu/src/imgproc.cpp +++ b/modules/gpu/src/imgproc.cpp @@ -91,6 +91,7 @@ void cv::gpu::Canny(const GpuMat&, const GpuMat&, GpuMat&, double, double, bool) void cv::gpu::Canny(const GpuMat&, const GpuMat&, CannyBuf&, GpuMat&, double, double, bool) { throw_nogpu(); } void cv::gpu::CannyBuf::create(const Size&, int) { throw_nogpu(); } void cv::gpu::CannyBuf::release() { throw_nogpu(); } +cv::Ptr cv::gpu::createCLAHE(double, cv::Size) { throw_nogpu(); return cv::Ptr(); } #else /* !defined (HAVE_CUDA) */ @@ -1542,4 +1543,136 @@ void cv::gpu::Canny(const GpuMat& dx, const GpuMat& dy, CannyBuf& buf, GpuMat& d CannyCaller(dx, dy, buf, dst, static_cast(low_thresh), static_cast(high_thresh)); } +//////////////////////////////////////////////////////////////////////// +// CLAHE + +namespace clahe +{ + void calcLut(PtrStepSzb src, PtrStepb lut, int tilesX, int tilesY, int2 tileSize, int clipLimit, float lutScale, cudaStream_t stream); + void transform(PtrStepSzb src, PtrStepSzb dst, PtrStepb lut, int tilesX, int tilesY, int2 tileSize, cudaStream_t stream); +} + +namespace +{ + class CLAHE_Impl : public cv::gpu::CLAHE + { + public: + CLAHE_Impl(double clipLimit = 40.0, int tilesX = 8, int tilesY = 8); + + cv::AlgorithmInfo* info() const; + + void apply(cv::InputArray src, cv::OutputArray dst); + void apply(InputArray src, OutputArray dst, Stream& stream); + + void setClipLimit(double clipLimit); + double getClipLimit() const; + + void setTilesGridSize(cv::Size tileGridSize); + cv::Size getTilesGridSize() const; + + void collectGarbage(); + + private: + double clipLimit_; + int tilesX_; + int tilesY_; + + GpuMat srcExt_; + GpuMat lut_; + }; + + CLAHE_Impl::CLAHE_Impl(double clipLimit, int tilesX, int tilesY) : + clipLimit_(clipLimit), tilesX_(tilesX), tilesY_(tilesY) + { + } + + CV_INIT_ALGORITHM(CLAHE_Impl, "CLAHE_GPU", + obj.info()->addParam(obj, "clipLimit", obj.clipLimit_); + obj.info()->addParam(obj, "tilesX", obj.tilesX_); + obj.info()->addParam(obj, "tilesY", obj.tilesY_)) + + void CLAHE_Impl::apply(cv::InputArray _src, cv::OutputArray _dst) + { + apply(_src, _dst, Stream::Null()); + } + + void CLAHE_Impl::apply(InputArray _src, OutputArray _dst, Stream& s) + { + GpuMat src = _src.getGpuMat(); + + CV_Assert( src.type() == CV_8UC1 ); + + _dst.create( src.size(), src.type() ); + GpuMat dst = _dst.getGpuMat(); + + const int histSize = 256; + + ensureSizeIsEnough(tilesX_ * tilesY_, histSize, CV_8UC1, lut_); + + cudaStream_t stream = StreamAccessor::getStream(s); + + cv::Size tileSize; + GpuMat srcForLut; + + if (src.cols % tilesX_ == 0 && src.rows % tilesY_ == 0) + { + tileSize = cv::Size(src.cols / tilesX_, src.rows / tilesY_); + srcForLut = src; + } + else + { + cv::gpu::copyMakeBorder(src, srcExt_, 0, tilesY_ - (src.rows % tilesY_), 0, tilesX_ - (src.cols % tilesX_), cv::BORDER_REFLECT_101, cv::Scalar(), s); + + tileSize = cv::Size(srcExt_.cols / tilesX_, srcExt_.rows / tilesY_); + srcForLut = srcExt_; + } + + const int tileSizeTotal = tileSize.area(); + const float lutScale = static_cast(histSize - 1) / tileSizeTotal; + + int clipLimit = 0; + if (clipLimit_ > 0.0) + { + clipLimit = static_cast(clipLimit_ * tileSizeTotal / histSize); + clipLimit = std::max(clipLimit, 1); + } + + clahe::calcLut(srcForLut, lut_, tilesX_, tilesY_, make_int2(tileSize.width, tileSize.height), clipLimit, lutScale, stream); + + clahe::transform(src, dst, lut_, tilesX_, tilesY_, make_int2(tileSize.width, tileSize.height), stream); + } + + void CLAHE_Impl::setClipLimit(double clipLimit) + { + clipLimit_ = clipLimit; + } + + double CLAHE_Impl::getClipLimit() const + { + return clipLimit_; + } + + void CLAHE_Impl::setTilesGridSize(cv::Size tileGridSize) + { + tilesX_ = tileGridSize.width; + tilesY_ = tileGridSize.height; + } + + cv::Size CLAHE_Impl::getTilesGridSize() const + { + return cv::Size(tilesX_, tilesY_); + } + + void CLAHE_Impl::collectGarbage() + { + srcExt_.release(); + lut_.release(); + } +} + +cv::Ptr cv::gpu::createCLAHE(double clipLimit, cv::Size tileGridSize) +{ + return new CLAHE_Impl(clipLimit, tileGridSize.width, tileGridSize.height); +} + #endif /* !defined (HAVE_CUDA) */ diff --git a/modules/gpu/src/matrix_reductions.cpp b/modules/gpu/src/matrix_reductions.cpp index 23906f95e9..eb9d42aa8e 100644 --- a/modules/gpu/src/matrix_reductions.cpp +++ b/modules/gpu/src/matrix_reductions.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/mssegmentation.cpp b/modules/gpu/src/mssegmentation.cpp index a0bce6ad07..54aef05637 100644 --- a/modules/gpu/src/mssegmentation.cpp +++ b/modules/gpu/src/mssegmentation.cpp @@ -39,7 +39,6 @@ // the use of this software, even if advised of the possibility of such damage. // //M*/ - #include "precomp.hpp" #if !defined HAVE_CUDA || defined(CUDA_DISABLER) diff --git a/modules/gpu/src/nvidia/NCVBroxOpticalFlow.cu b/modules/gpu/src/nvidia/NCVBroxOpticalFlow.cu index 5d1b46c448..c4a270afdd 100644 --- a/modules/gpu/src/nvidia/NCVBroxOpticalFlow.cu +++ b/modules/gpu/src/nvidia/NCVBroxOpticalFlow.cu @@ -1,6 +1,6 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, @@ -10,7 +10,8 @@ // License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -1163,4 +1164,4 @@ NCVStatus NCVBroxOpticalFlow(const NCVBroxOpticalFlowDescriptor desc, return NCV_SUCCESS; } -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/src/nvidia/NCVBroxOpticalFlow.hpp b/modules/gpu/src/nvidia/NCVBroxOpticalFlow.hpp index dde2c41b52..139f7bea8c 100644 --- a/modules/gpu/src/nvidia/NCVBroxOpticalFlow.hpp +++ b/modules/gpu/src/nvidia/NCVBroxOpticalFlow.hpp @@ -1,6 +1,6 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, @@ -10,7 +10,8 @@ // License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/nvidia/NCVHaarObjectDetection.cu b/modules/gpu/src/nvidia/NCVHaarObjectDetection.cu index 38f0a65d9f..c137b2a1ef 100644 --- a/modules/gpu/src/nvidia/NCVHaarObjectDetection.cu +++ b/modules/gpu/src/nvidia/NCVHaarObjectDetection.cu @@ -1,6 +1,6 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, @@ -10,7 +10,8 @@ // License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/nvidia/NCVHaarObjectDetection.hpp b/modules/gpu/src/nvidia/NCVHaarObjectDetection.hpp index d66a52c880..bbda61fecd 100644 --- a/modules/gpu/src/nvidia/NCVHaarObjectDetection.hpp +++ b/modules/gpu/src/nvidia/NCVHaarObjectDetection.hpp @@ -1,6 +1,6 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, @@ -10,7 +10,8 @@ // License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/nvidia/NPP_staging/NPP_staging.cu b/modules/gpu/src/nvidia/NPP_staging/NPP_staging.cu index f4ec9aace6..525feb68b7 100644 --- a/modules/gpu/src/nvidia/NPP_staging/NPP_staging.cu +++ b/modules/gpu/src/nvidia/NPP_staging/NPP_staging.cu @@ -1,6 +1,6 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, @@ -10,7 +10,8 @@ // License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/nvidia/NPP_staging/NPP_staging.hpp b/modules/gpu/src/nvidia/NPP_staging/NPP_staging.hpp index 54c9ff5b92..073448e17c 100644 --- a/modules/gpu/src/nvidia/NPP_staging/NPP_staging.hpp +++ b/modules/gpu/src/nvidia/NPP_staging/NPP_staging.hpp @@ -1,6 +1,6 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, @@ -10,7 +10,8 @@ // License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/nvidia/core/NCV.cu b/modules/gpu/src/nvidia/core/NCV.cu index 791a793ef6..718b4faabd 100644 --- a/modules/gpu/src/nvidia/core/NCV.cu +++ b/modules/gpu/src/nvidia/core/NCV.cu @@ -1,6 +1,6 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, @@ -10,7 +10,8 @@ // License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -39,7 +40,6 @@ // //M*/ - #include #include #include "NCV.hpp" diff --git a/modules/gpu/src/nvidia/core/NCV.hpp b/modules/gpu/src/nvidia/core/NCV.hpp index 1a2d6ecaa6..e029e1fc38 100644 --- a/modules/gpu/src/nvidia/core/NCV.hpp +++ b/modules/gpu/src/nvidia/core/NCV.hpp @@ -1,6 +1,6 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, @@ -10,7 +10,8 @@ // License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/nvidia/core/NCVAlg.hpp b/modules/gpu/src/nvidia/core/NCVAlg.hpp index a1614720cc..3a0a282204 100644 --- a/modules/gpu/src/nvidia/core/NCVAlg.hpp +++ b/modules/gpu/src/nvidia/core/NCVAlg.hpp @@ -1,6 +1,6 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, @@ -10,7 +10,8 @@ // License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/nvidia/core/NCVColorConversion.hpp b/modules/gpu/src/nvidia/core/NCVColorConversion.hpp index f208cf06f6..c1293f2b34 100644 --- a/modules/gpu/src/nvidia/core/NCVColorConversion.hpp +++ b/modules/gpu/src/nvidia/core/NCVColorConversion.hpp @@ -1,6 +1,6 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, @@ -10,7 +10,8 @@ // License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp b/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp index de78cf9deb..ec2f16ebb7 100644 --- a/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp +++ b/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp @@ -1,6 +1,6 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, @@ -10,7 +10,8 @@ // License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/nvidia/core/NCVPyramid.cu b/modules/gpu/src/nvidia/core/NCVPyramid.cu index a3d8954786..3cb3a33f45 100644 --- a/modules/gpu/src/nvidia/core/NCVPyramid.cu +++ b/modules/gpu/src/nvidia/core/NCVPyramid.cu @@ -1,6 +1,6 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, @@ -10,7 +10,8 @@ // License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -602,4 +603,4 @@ template class NCVImagePyramid; #endif //_WIN32 -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/src/nvidia/core/NCVPyramid.hpp b/modules/gpu/src/nvidia/core/NCVPyramid.hpp index 8660ab24ea..183428afa6 100644 --- a/modules/gpu/src/nvidia/core/NCVPyramid.hpp +++ b/modules/gpu/src/nvidia/core/NCVPyramid.hpp @@ -1,6 +1,6 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, @@ -10,7 +10,8 @@ // License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -39,7 +40,6 @@ // //M*/ - #ifndef _ncvpyramid_hpp_ #define _ncvpyramid_hpp_ diff --git a/modules/gpu/src/nvidia/core/NCVRuntimeTemplates.hpp b/modules/gpu/src/nvidia/core/NCVRuntimeTemplates.hpp index 7b248a8324..33f001991b 100644 --- a/modules/gpu/src/nvidia/core/NCVRuntimeTemplates.hpp +++ b/modules/gpu/src/nvidia/core/NCVRuntimeTemplates.hpp @@ -1,6 +1,6 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, @@ -10,7 +10,8 @@ // License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/gpu/src/optical_flow.cpp b/modules/gpu/src/optical_flow.cpp index 2982003f46..a06bbac264 100644 --- a/modules/gpu/src/optical_flow.cpp +++ b/modules/gpu/src/optical_flow.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/optical_flow_farneback.cpp b/modules/gpu/src/optical_flow_farneback.cpp index bc36a75e5e..349ca0c5ec 100644 --- a/modules/gpu/src/optical_flow_farneback.cpp +++ b/modules/gpu/src/optical_flow_farneback.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/orb.cpp b/modules/gpu/src/orb.cpp index 95ac048833..f59e545c49 100644 --- a/modules/gpu/src/orb.cpp +++ b/modules/gpu/src/orb.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/precomp.cpp b/modules/gpu/src/precomp.cpp index 8e0d0db19f..c955cfceb3 100644 --- a/modules/gpu/src/precomp.cpp +++ b/modules/gpu/src/precomp.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/src/precomp.hpp b/modules/gpu/src/precomp.hpp index 966f95d4fc..b7ef329ca1 100644 --- a/modules/gpu/src/precomp.hpp +++ b/modules/gpu/src/precomp.hpp @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/pyrlk.cpp b/modules/gpu/src/pyrlk.cpp index dac6f0bd9b..0bad5b8dcf 100644 --- a/modules/gpu/src/pyrlk.cpp +++ b/modules/gpu/src/pyrlk.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/speckle_filtering.cpp b/modules/gpu/src/speckle_filtering.cpp index 571cbf657b..85b6c47c77 100644 --- a/modules/gpu/src/speckle_filtering.cpp +++ b/modules/gpu/src/speckle_filtering.cpp @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/split_merge.cpp b/modules/gpu/src/split_merge.cpp index 20631e0ec7..61a928cc0a 100644 --- a/modules/gpu/src/split_merge.cpp +++ b/modules/gpu/src/split_merge.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/stereobm.cpp b/modules/gpu/src/stereobm.cpp index 43a5af17d7..e633bf0ad4 100644 --- a/modules/gpu/src/stereobm.cpp +++ b/modules/gpu/src/stereobm.cpp @@ -22,7 +22,7 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. diff --git a/modules/gpu/src/stereobp.cpp b/modules/gpu/src/stereobp.cpp index 210158d071..2a472e283d 100644 --- a/modules/gpu/src/stereobp.cpp +++ b/modules/gpu/src/stereobp.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/src/stereocsbp.cpp b/modules/gpu/src/stereocsbp.cpp index 4fc6d04001..f3e55be4da 100644 --- a/modules/gpu/src/stereocsbp.cpp +++ b/modules/gpu/src/stereocsbp.cpp @@ -22,7 +22,7 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. diff --git a/modules/gpu/src/thread_wrappers.cpp b/modules/gpu/src/thread_wrappers.cpp index f8099aca91..e8ee19e54f 100644 --- a/modules/gpu/src/thread_wrappers.cpp +++ b/modules/gpu/src/thread_wrappers.cpp @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/thread_wrappers.h b/modules/gpu/src/thread_wrappers.h index 78e675216c..da811737d8 100644 --- a/modules/gpu/src/thread_wrappers.h +++ b/modules/gpu/src/thread_wrappers.h @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/tvl1flow.cpp b/modules/gpu/src/tvl1flow.cpp index c6aa4be865..4fe67c097a 100644 --- a/modules/gpu/src/tvl1flow.cpp +++ b/modules/gpu/src/tvl1flow.cpp @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/video_decoder.cpp b/modules/gpu/src/video_decoder.cpp index c1e8f86a4c..fe897895d6 100644 --- a/modules/gpu/src/video_decoder.cpp +++ b/modules/gpu/src/video_decoder.cpp @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/video_decoder.h b/modules/gpu/src/video_decoder.h index 634643b889..81bbef0e36 100644 --- a/modules/gpu/src/video_decoder.h +++ b/modules/gpu/src/video_decoder.h @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/video_parser.cpp b/modules/gpu/src/video_parser.cpp index 70187fcb2f..f20da8e9b5 100644 --- a/modules/gpu/src/video_parser.cpp +++ b/modules/gpu/src/video_parser.cpp @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/video_parser.h b/modules/gpu/src/video_parser.h index 44a53710bf..15700664b3 100644 --- a/modules/gpu/src/video_parser.h +++ b/modules/gpu/src/video_parser.h @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/src/video_reader.cpp b/modules/gpu/src/video_reader.cpp index 036845d4b5..118eb9569a 100644 --- a/modules/gpu/src/video_reader.cpp +++ b/modules/gpu/src/video_reader.cpp @@ -7,7 +7,7 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. diff --git a/modules/gpu/test/interpolation.hpp b/modules/gpu/test/interpolation.hpp index 9ad08b1652..7a00143e1d 100644 --- a/modules/gpu/test/interpolation.hpp +++ b/modules/gpu/test/interpolation.hpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/main.cpp b/modules/gpu/test/main.cpp index dfb556931d..cbb66d2963 100644 --- a/modules/gpu/test/main.cpp +++ b/modules/gpu/test/main.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/main_test_nvidia.h b/modules/gpu/test/main_test_nvidia.h index 173cbdbce1..9a3ae1e06a 100644 --- a/modules/gpu/test/main_test_nvidia.h +++ b/modules/gpu/test/main_test_nvidia.h @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef __main_test_nvidia_h__ #define __main_test_nvidia_h__ diff --git a/modules/gpu/test/nvidia/NCVAutoTestLister.hpp b/modules/gpu/test/nvidia/NCVAutoTestLister.hpp index 48ad754940..6ac5bc0cf6 100644 --- a/modules/gpu/test/nvidia/NCVAutoTestLister.hpp +++ b/modules/gpu/test/nvidia/NCVAutoTestLister.hpp @@ -1,13 +1,45 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef _ncvautotestlister_hpp_ #define _ncvautotestlister_hpp_ diff --git a/modules/gpu/test/nvidia/NCVTest.hpp b/modules/gpu/test/nvidia/NCVTest.hpp index d2289eea02..22958e565d 100644 --- a/modules/gpu/test/nvidia/NCVTest.hpp +++ b/modules/gpu/test/nvidia/NCVTest.hpp @@ -1,13 +1,45 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef _ncvtest_hpp_ #define _ncvtest_hpp_ diff --git a/modules/gpu/test/nvidia/NCVTestSourceProvider.hpp b/modules/gpu/test/nvidia/NCVTestSourceProvider.hpp index 0ae104c96c..df245bb827 100644 --- a/modules/gpu/test/nvidia/NCVTestSourceProvider.hpp +++ b/modules/gpu/test/nvidia/NCVTestSourceProvider.hpp @@ -1,13 +1,45 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef _ncvtestsourceprovider_hpp_ #define _ncvtestsourceprovider_hpp_ diff --git a/modules/gpu/test/nvidia/TestCompact.cpp b/modules/gpu/test/nvidia/TestCompact.cpp index 273b56b501..9154101079 100644 --- a/modules/gpu/test/nvidia/TestCompact.cpp +++ b/modules/gpu/test/nvidia/TestCompact.cpp @@ -1,13 +1,44 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ #if !defined CUDA_DISABLER @@ -130,4 +161,4 @@ bool TestCompact::deinit() return true; } -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/test/nvidia/TestCompact.h b/modules/gpu/test/nvidia/TestCompact.h index 8bb178428e..256cdf4cf9 100644 --- a/modules/gpu/test/nvidia/TestCompact.h +++ b/modules/gpu/test/nvidia/TestCompact.h @@ -1,13 +1,45 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef _testhypothesescompact_h_ #define _testhypothesescompact_h_ diff --git a/modules/gpu/test/nvidia/TestDrawRects.cpp b/modules/gpu/test/nvidia/TestDrawRects.cpp index 1525772fcd..3da458694a 100644 --- a/modules/gpu/test/nvidia/TestDrawRects.cpp +++ b/modules/gpu/test/nvidia/TestDrawRects.cpp @@ -1,13 +1,44 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ #if !defined CUDA_DISABLER @@ -165,4 +196,4 @@ bool TestDrawRects::deinit() template class TestDrawRects; template class TestDrawRects; -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/test/nvidia/TestDrawRects.h b/modules/gpu/test/nvidia/TestDrawRects.h index 79aa1b51bf..b64c133d50 100644 --- a/modules/gpu/test/nvidia/TestDrawRects.h +++ b/modules/gpu/test/nvidia/TestDrawRects.h @@ -1,13 +1,45 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef _testdrawrects_h_ #define _testdrawrects_h_ diff --git a/modules/gpu/test/nvidia/TestHaarCascadeApplication.cpp b/modules/gpu/test/nvidia/TestHaarCascadeApplication.cpp index 4867189606..01a9637b8d 100644 --- a/modules/gpu/test/nvidia/TestHaarCascadeApplication.cpp +++ b/modules/gpu/test/nvidia/TestHaarCascadeApplication.cpp @@ -1,13 +1,44 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ #if !defined CUDA_DISABLER diff --git a/modules/gpu/test/nvidia/TestHaarCascadeApplication.h b/modules/gpu/test/nvidia/TestHaarCascadeApplication.h index efc25cb591..eaa4371745 100644 --- a/modules/gpu/test/nvidia/TestHaarCascadeApplication.h +++ b/modules/gpu/test/nvidia/TestHaarCascadeApplication.h @@ -1,13 +1,45 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef _testhaarcascadeapplication_h_ #define _testhaarcascadeapplication_h_ diff --git a/modules/gpu/test/nvidia/TestHaarCascadeLoader.cpp b/modules/gpu/test/nvidia/TestHaarCascadeLoader.cpp index 099596de0c..42552295d2 100644 --- a/modules/gpu/test/nvidia/TestHaarCascadeLoader.cpp +++ b/modules/gpu/test/nvidia/TestHaarCascadeLoader.cpp @@ -1,13 +1,44 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ #if !defined CUDA_DISABLER @@ -124,4 +155,4 @@ bool TestHaarCascadeLoader::deinit() return true; } -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/test/nvidia/TestHaarCascadeLoader.h b/modules/gpu/test/nvidia/TestHaarCascadeLoader.h index 44054d3484..86c6324635 100644 --- a/modules/gpu/test/nvidia/TestHaarCascadeLoader.h +++ b/modules/gpu/test/nvidia/TestHaarCascadeLoader.h @@ -1,13 +1,45 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef _testhaarcascadeloader_h_ #define _testhaarcascadeloader_h_ diff --git a/modules/gpu/test/nvidia/TestHypothesesFilter.cpp b/modules/gpu/test/nvidia/TestHypothesesFilter.cpp index 7899cd98c1..f71a5f72d0 100644 --- a/modules/gpu/test/nvidia/TestHypothesesFilter.cpp +++ b/modules/gpu/test/nvidia/TestHypothesesFilter.cpp @@ -1,13 +1,44 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ #if !defined CUDA_DISABLER @@ -177,4 +208,4 @@ bool TestHypothesesFilter::deinit() return true; } -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/test/nvidia/TestHypothesesFilter.h b/modules/gpu/test/nvidia/TestHypothesesFilter.h index 2084b3bd4b..f190785fe7 100644 --- a/modules/gpu/test/nvidia/TestHypothesesFilter.h +++ b/modules/gpu/test/nvidia/TestHypothesesFilter.h @@ -1,13 +1,45 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef _testhypothesesfilter_h_ #define _testhypothesesfilter_h_ diff --git a/modules/gpu/test/nvidia/TestHypothesesGrow.cpp b/modules/gpu/test/nvidia/TestHypothesesGrow.cpp index 685c50056f..5cb81ddf49 100644 --- a/modules/gpu/test/nvidia/TestHypothesesGrow.cpp +++ b/modules/gpu/test/nvidia/TestHypothesesGrow.cpp @@ -1,13 +1,44 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ #if !defined CUDA_DISABLER @@ -135,4 +166,4 @@ bool TestHypothesesGrow::deinit() return true; } -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/test/nvidia/TestHypothesesGrow.h b/modules/gpu/test/nvidia/TestHypothesesGrow.h index d2f2fdaace..51e879f697 100644 --- a/modules/gpu/test/nvidia/TestHypothesesGrow.h +++ b/modules/gpu/test/nvidia/TestHypothesesGrow.h @@ -1,13 +1,45 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef _testhypothesesgrow_h_ #define _testhypothesesgrow_h_ diff --git a/modules/gpu/test/nvidia/TestIntegralImage.cpp b/modules/gpu/test/nvidia/TestIntegralImage.cpp index 4944e14f99..a0820a8216 100644 --- a/modules/gpu/test/nvidia/TestIntegralImage.cpp +++ b/modules/gpu/test/nvidia/TestIntegralImage.cpp @@ -1,13 +1,44 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ #if !defined CUDA_DISABLER @@ -186,4 +217,4 @@ bool TestIntegralImage::deinit() template class TestIntegralImage; template class TestIntegralImage; -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/test/nvidia/TestIntegralImage.h b/modules/gpu/test/nvidia/TestIntegralImage.h index 4dba575fe9..c4f58ba146 100644 --- a/modules/gpu/test/nvidia/TestIntegralImage.h +++ b/modules/gpu/test/nvidia/TestIntegralImage.h @@ -1,13 +1,45 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef _testintegralimage_h_ #define _testintegralimage_h_ diff --git a/modules/gpu/test/nvidia/TestIntegralImageSquared.cpp b/modules/gpu/test/nvidia/TestIntegralImageSquared.cpp index 6366fc4ce2..4f4e45d406 100644 --- a/modules/gpu/test/nvidia/TestIntegralImageSquared.cpp +++ b/modules/gpu/test/nvidia/TestIntegralImageSquared.cpp @@ -1,13 +1,44 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ #if !defined CUDA_DISABLER @@ -118,4 +149,4 @@ bool TestIntegralImageSquared::deinit() return true; } -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/test/nvidia/TestIntegralImageSquared.h b/modules/gpu/test/nvidia/TestIntegralImageSquared.h index 8d20d732db..20e5ca8df3 100644 --- a/modules/gpu/test/nvidia/TestIntegralImageSquared.h +++ b/modules/gpu/test/nvidia/TestIntegralImageSquared.h @@ -1,13 +1,45 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef _testintegralimagesquared_h_ #define _testintegralimagesquared_h_ diff --git a/modules/gpu/test/nvidia/TestRectStdDev.cpp b/modules/gpu/test/nvidia/TestRectStdDev.cpp index 3a31b0d0c0..c019b0ee3c 100644 --- a/modules/gpu/test/nvidia/TestRectStdDev.cpp +++ b/modules/gpu/test/nvidia/TestRectStdDev.cpp @@ -1,13 +1,44 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ #if !defined CUDA_DISABLER @@ -181,4 +212,4 @@ bool TestRectStdDev::deinit() return true; } -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/test/nvidia/TestRectStdDev.h b/modules/gpu/test/nvidia/TestRectStdDev.h index d1f2e759e4..e22fbe87c7 100644 --- a/modules/gpu/test/nvidia/TestRectStdDev.h +++ b/modules/gpu/test/nvidia/TestRectStdDev.h @@ -1,13 +1,45 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef _testrectstddev_h_ #define _testrectstddev_h_ diff --git a/modules/gpu/test/nvidia/TestResize.cpp b/modules/gpu/test/nvidia/TestResize.cpp index cb68a18e68..83443c88b8 100644 --- a/modules/gpu/test/nvidia/TestResize.cpp +++ b/modules/gpu/test/nvidia/TestResize.cpp @@ -1,13 +1,44 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ #if !defined CUDA_DISABLER @@ -162,4 +193,4 @@ bool TestResize::deinit() template class TestResize; template class TestResize; -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/test/nvidia/TestResize.h b/modules/gpu/test/nvidia/TestResize.h index ee6eb617e8..b2b28a83ff 100644 --- a/modules/gpu/test/nvidia/TestResize.h +++ b/modules/gpu/test/nvidia/TestResize.h @@ -1,13 +1,45 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef _testresize_h_ #define _testresize_h_ diff --git a/modules/gpu/test/nvidia/TestTranspose.cpp b/modules/gpu/test/nvidia/TestTranspose.cpp index 74e96b1338..5f71da4f8f 100644 --- a/modules/gpu/test/nvidia/TestTranspose.cpp +++ b/modules/gpu/test/nvidia/TestTranspose.cpp @@ -1,13 +1,44 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ #if !defined CUDA_DISABLER @@ -149,4 +180,4 @@ bool TestTranspose::deinit() template class TestTranspose; template class TestTranspose; -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/test/nvidia/TestTranspose.h b/modules/gpu/test/nvidia/TestTranspose.h index 2f8ccf41c2..c83306fd1c 100644 --- a/modules/gpu/test/nvidia/TestTranspose.h +++ b/modules/gpu/test/nvidia/TestTranspose.h @@ -1,13 +1,45 @@ -/* - * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual - * property and proprietary rights in and to this software and - * related documentation and any modifications thereto. - * Any use, reproduction, disclosure, or distribution of this - * software and related documentation without an express license - * agreement from NVIDIA Corporation is strictly prohibited. - */ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef _testtranspose_h_ #define _testtranspose_h_ diff --git a/modules/gpu/test/nvidia/main_nvidia.cpp b/modules/gpu/test/nvidia/main_nvidia.cpp index 4bb3652414..2e36fbec94 100644 --- a/modules/gpu/test/nvidia/main_nvidia.cpp +++ b/modules/gpu/test/nvidia/main_nvidia.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #if defined _MSC_VER && _MSC_VER >= 1200 # pragma warning (disable : 4408 4201 4100) #endif diff --git a/modules/gpu/test/test_bgfg.cpp b/modules/gpu/test/test_bgfg.cpp index f17a1e65ba..3ed9360d40 100644 --- a/modules/gpu/test/test_bgfg.cpp +++ b/modules/gpu/test/test_bgfg.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_calib3d.cpp b/modules/gpu/test/test_calib3d.cpp index 5a83662e6e..5de3d34df1 100644 --- a/modules/gpu/test/test_calib3d.cpp +++ b/modules/gpu/test/test_calib3d.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_color.cpp b/modules/gpu/test/test_color.cpp index 112a749c61..4bd53c9194 100644 --- a/modules/gpu/test/test_color.cpp +++ b/modules/gpu/test/test_color.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_copy_make_border.cpp b/modules/gpu/test/test_copy_make_border.cpp index 99c565b38a..24a75c0235 100644 --- a/modules/gpu/test/test_copy_make_border.cpp +++ b/modules/gpu/test/test_copy_make_border.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_core.cpp b/modules/gpu/test/test_core.cpp index af86efc8ba..d02c3c2686 100644 --- a/modules/gpu/test/test_core.cpp +++ b/modules/gpu/test/test_core.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_denoising.cpp b/modules/gpu/test/test_denoising.cpp index df84817f84..e480cf4680 100644 --- a/modules/gpu/test/test_denoising.cpp +++ b/modules/gpu/test/test_denoising.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_features2d.cpp b/modules/gpu/test/test_features2d.cpp index 01741d8c6f..a7d80f98d8 100644 --- a/modules/gpu/test/test_features2d.cpp +++ b/modules/gpu/test/test_features2d.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_filters.cpp b/modules/gpu/test/test_filters.cpp index b854da07ae..f1fd3814f3 100644 --- a/modules/gpu/test/test_filters.cpp +++ b/modules/gpu/test/test_filters.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_global_motion.cpp b/modules/gpu/test/test_global_motion.cpp index 48fc428cee..a156f93107 100644 --- a/modules/gpu/test/test_global_motion.cpp +++ b/modules/gpu/test/test_global_motion.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_gpumat.cpp b/modules/gpu/test/test_gpumat.cpp index a5c38da4f4..c7a0cabcbc 100644 --- a/modules/gpu/test/test_gpumat.cpp +++ b/modules/gpu/test/test_gpumat.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/test/test_hough.cpp b/modules/gpu/test/test_hough.cpp index e4d5ad6cf5..f876a7a2b0 100644 --- a/modules/gpu/test/test_hough.cpp +++ b/modules/gpu/test/test_hough.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_imgproc.cpp b/modules/gpu/test/test_imgproc.cpp index ca64edf178..925ca9d7ef 100644 --- a/modules/gpu/test/test_imgproc.cpp +++ b/modules/gpu/test/test_imgproc.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and @@ -216,6 +217,50 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, EqualizeHist, testing::Combine( ALL_DEVICES, DIFFERENT_SIZES)); +/////////////////////////////////////////////////////////////////////////////////////////////////////// +// CLAHE + +namespace +{ + IMPLEMENT_PARAM_CLASS(ClipLimit, double) +} + +PARAM_TEST_CASE(CLAHE, cv::gpu::DeviceInfo, cv::Size, ClipLimit) +{ + cv::gpu::DeviceInfo devInfo; + cv::Size size; + double clipLimit; + + virtual void SetUp() + { + devInfo = GET_PARAM(0); + size = GET_PARAM(1); + clipLimit = GET_PARAM(2); + + cv::gpu::setDevice(devInfo.deviceID()); + } +}; + +GPU_TEST_P(CLAHE, Accuracy) +{ + cv::Mat src = randomMat(size, CV_8UC1); + + cv::Ptr clahe = cv::gpu::createCLAHE(clipLimit); + cv::gpu::GpuMat dst; + clahe->apply(loadMat(src), dst); + + cv::Ptr clahe_gold = cv::createCLAHE(clipLimit); + cv::Mat dst_gold; + clahe_gold->apply(src, dst_gold); + + ASSERT_MAT_NEAR(dst_gold, dst, 1.0); +} + +INSTANTIATE_TEST_CASE_P(GPU_ImgProc, CLAHE, testing::Combine( + ALL_DEVICES, + DIFFERENT_SIZES, + testing::Values(0.0, 40.0))); + //////////////////////////////////////////////////////////////////////// // ColumnSum diff --git a/modules/gpu/test/test_labeling.cpp b/modules/gpu/test/test_labeling.cpp index b4fd08a26f..2e85cc3d05 100644 --- a/modules/gpu/test/test_labeling.cpp +++ b/modules/gpu/test/test_labeling.cpp @@ -1,31 +1,31 @@ /*M/////////////////////////////////////////////////////////////////////////////////////// // -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. // // -// License Agreement -// For Open Source Computer Vision Library +// License Agreement +// For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. // -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. // -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and // any express or implied warranties, including, but not limited to, the implied @@ -37,6 +37,7 @@ // and on any theory of liability, whether in contract, strict liability, // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. +// //M*/ #include "test_precomp.hpp" diff --git a/modules/gpu/test/test_nvidia.cpp b/modules/gpu/test/test_nvidia.cpp index 53ed8c2235..d713b41bdb 100644 --- a/modules/gpu/test/test_nvidia.cpp +++ b/modules/gpu/test/test_nvidia.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_objdetect.cpp b/modules/gpu/test/test_objdetect.cpp index cc66d6a313..aaeaa54e66 100644 --- a/modules/gpu/test/test_objdetect.cpp +++ b/modules/gpu/test/test_objdetect.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_opengl.cpp b/modules/gpu/test/test_opengl.cpp index c6aa945ac9..8c0f64a937 100644 --- a/modules/gpu/test/test_opengl.cpp +++ b/modules/gpu/test/test_opengl.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_optflow.cpp b/modules/gpu/test/test_optflow.cpp index ee60a432f4..595e46cbb5 100644 --- a/modules/gpu/test/test_optflow.cpp +++ b/modules/gpu/test/test_optflow.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_precomp.cpp b/modules/gpu/test/test_precomp.cpp index 8121ae405b..0fb6521809 100644 --- a/modules/gpu/test/test_precomp.cpp +++ b/modules/gpu/test/test_precomp.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_precomp.hpp b/modules/gpu/test/test_precomp.hpp index 0d16472dc0..79fa4a5d20 100644 --- a/modules/gpu/test/test_precomp.hpp +++ b/modules/gpu/test/test_precomp.hpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_pyramids.cpp b/modules/gpu/test/test_pyramids.cpp index 43665966ec..6b0540fc10 100644 --- a/modules/gpu/test/test_pyramids.cpp +++ b/modules/gpu/test/test_pyramids.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_remap.cpp b/modules/gpu/test/test_remap.cpp index 13c8a59b7b..eb4b9ece85 100644 --- a/modules/gpu/test/test_remap.cpp +++ b/modules/gpu/test/test_remap.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_resize.cpp b/modules/gpu/test/test_resize.cpp index 729dcc3208..593c891e6a 100644 --- a/modules/gpu/test/test_resize.cpp +++ b/modules/gpu/test/test_resize.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_stream.cpp b/modules/gpu/test/test_stream.cpp index c17f97847a..a34a4e8409 100644 --- a/modules/gpu/test/test_stream.cpp +++ b/modules/gpu/test/test_stream.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/gpu/test/test_threshold.cpp b/modules/gpu/test/test_threshold.cpp index e56975e873..25a7a476a9 100644 --- a/modules/gpu/test/test_threshold.cpp +++ b/modules/gpu/test/test_threshold.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_video.cpp b/modules/gpu/test/test_video.cpp index b9502814a1..f28cd3cf4a 100644 --- a/modules/gpu/test/test_video.cpp +++ b/modules/gpu/test/test_video.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_warp_affine.cpp b/modules/gpu/test/test_warp_affine.cpp index 892c5b7c62..43bf0f6d9e 100644 --- a/modules/gpu/test/test_warp_affine.cpp +++ b/modules/gpu/test/test_warp_affine.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/gpu/test/test_warp_perspective.cpp b/modules/gpu/test/test_warp_perspective.cpp index d421d94fc2..d225e58b66 100644 --- a/modules/gpu/test/test_warp_perspective.cpp +++ b/modules/gpu/test/test_warp_perspective.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/imgproc/include/opencv2/imgproc.hpp b/modules/imgproc/include/opencv2/imgproc.hpp index df456b5cd0..10a5d53c65 100644 --- a/modules/imgproc/include/opencv2/imgproc.hpp +++ b/modules/imgproc/include/opencv2/imgproc.hpp @@ -753,6 +753,21 @@ CV_EXPORTS double compareHist( const SparseMat& H1, const SparseMat& H2, int met //! normalizes the grayscale image brightness and contrast by normalizing its histogram CV_EXPORTS_W void equalizeHist( InputArray src, OutputArray dst ); +class CV_EXPORTS CLAHE : public Algorithm +{ +public: + virtual void apply(InputArray src, OutputArray dst) = 0; + + virtual void setClipLimit(double clipLimit) = 0; + virtual double getClipLimit() const = 0; + + virtual void setTilesGridSize(Size tileGridSize) = 0; + virtual Size getTilesGridSize() const = 0; + + virtual void collectGarbage() = 0; +}; +CV_EXPORTS Ptr createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8)); + CV_EXPORTS float EMD( InputArray signature1, InputArray signature2, int distType, InputArray cost=noArray(), float* lowerBound=0, OutputArray flow=noArray() ); diff --git a/modules/imgproc/include/opencv2/imgproc/imgproc.hpp b/modules/imgproc/include/opencv2/imgproc/imgproc.hpp index 841e9ec207..4175bd0bc0 100644 --- a/modules/imgproc/include/opencv2/imgproc/imgproc.hpp +++ b/modules/imgproc/include/opencv2/imgproc/imgproc.hpp @@ -45,4 +45,4 @@ #error this is a compatibility header which should not be used inside the OpenCV library #endif -#include "opencv2/imgproc.hpp" \ No newline at end of file +#include "opencv2/imgproc.hpp" diff --git a/modules/imgproc/perf/perf_histogram.cpp b/modules/imgproc/perf/perf_histogram.cpp index 3b320633ae..92db3be34a 100644 --- a/modules/imgproc/perf/perf_histogram.cpp +++ b/modules/imgproc/perf/perf_histogram.cpp @@ -115,3 +115,25 @@ PERF_TEST_P(MatSize, equalizeHist, SANITY_CHECK(destination); } + +typedef tr1::tuple Sz_ClipLimit_t; +typedef TestBaseWithParam Sz_ClipLimit; + +PERF_TEST_P(Sz_ClipLimit, CLAHE, + testing::Combine(testing::Values(::perf::szVGA, ::perf::sz720p, ::perf::sz1080p), + testing::Values(0.0, 40.0)) + ) +{ + const Size size = get<0>(GetParam()); + const double clipLimit = get<1>(GetParam()); + + Mat src(size, CV_8UC1); + declare.in(src, WARMUP_RNG); + + Ptr clahe = createCLAHE(clipLimit); + Mat dst; + + TEST_CYCLE() clahe->apply(src, dst); + + SANITY_CHECK(dst); +} diff --git a/modules/imgproc/src/histogram.cpp b/modules/imgproc/src/histogram.cpp index 8b8f05cd74..a31f62499e 100644 --- a/modules/imgproc/src/histogram.cpp +++ b/modules/imgproc/src/histogram.cpp @@ -2604,7 +2604,7 @@ cvCopyHist( const CvHistogram* src, CvHistogram** _dst ) int size1[CV_MAX_DIM]; bool is_sparse = CV_IS_SPARSE_MAT(src->bins); int dims1 = cvGetDims( src->bins, size1 ); - + if( dst && (is_sparse == CV_IS_SPARSE_MAT(dst->bins))) { int size2[CV_MAX_DIM]; @@ -2613,14 +2613,14 @@ cvCopyHist( const CvHistogram* src, CvHistogram** _dst ) if( dims1 == dims2 ) { int i; - + for( i = 0; i < dims1; i++ ) { if( size1[i] != size2[i] ) break; } - - eq = (i == dims1); + + eq = (i == dims1); } } @@ -2635,19 +2635,19 @@ cvCopyHist( const CvHistogram* src, CvHistogram** _dst ) { float* ranges[CV_MAX_DIM]; float** thresh = 0; - + if( CV_IS_UNIFORM_HIST( src )) { for( int i = 0; i < dims1; i++ ) ranges[i] = (float*)src->thresh[i]; - + thresh = ranges; } else { thresh = src->thresh2; } - + cvSetHistBinRanges( dst, thresh, CV_IS_UNIFORM_HIST(src)); } @@ -3188,6 +3188,300 @@ void cv::equalizeHist( InputArray _src, OutputArray _dst ) lutBody(heightRange); } +// ---------------------------------------------------------------------- +// CLAHE + +namespace +{ + class CLAHE_CalcLut_Body : public cv::ParallelLoopBody + { + public: + CLAHE_CalcLut_Body(const cv::Mat& src, cv::Mat& lut, cv::Size tileSize, int tilesX, int tilesY, int clipLimit, float lutScale) : + src_(src), lut_(lut), tileSize_(tileSize), tilesX_(tilesX), tilesY_(tilesY), clipLimit_(clipLimit), lutScale_(lutScale) + { + } + + void operator ()(const cv::Range& range) const; + + private: + cv::Mat src_; + mutable cv::Mat lut_; + + cv::Size tileSize_; + int tilesX_; + int tilesY_; + int clipLimit_; + float lutScale_; + }; + + void CLAHE_CalcLut_Body::operator ()(const cv::Range& range) const + { + const int histSize = 256; + + uchar* tileLut = lut_.ptr(range.start); + const size_t lut_step = lut_.step; + + for (int k = range.start; k < range.end; ++k, tileLut += lut_step) + { + const int ty = k / tilesX_; + const int tx = k % tilesX_; + + // retrieve tile submatrix + + cv::Rect tileROI; + tileROI.x = tx * tileSize_.width; + tileROI.y = ty * tileSize_.height; + tileROI.width = tileSize_.width; + tileROI.height = tileSize_.height; + + const cv::Mat tile = src_(tileROI); + + // calc histogram + + int tileHist[histSize] = {0, }; + + int height = tileROI.height; + const size_t sstep = tile.step; + for (const uchar* ptr = tile.ptr(0); height--; ptr += sstep) + { + int x = 0; + for (; x <= tileROI.width - 4; x += 4) + { + int t0 = ptr[x], t1 = ptr[x+1]; + tileHist[t0]++; tileHist[t1]++; + t0 = ptr[x+2]; t1 = ptr[x+3]; + tileHist[t0]++; tileHist[t1]++; + } + + for (; x < tileROI.width; ++x) + tileHist[ptr[x]]++; + } + + // clip histogram + + if (clipLimit_ > 0) + { + // how many pixels were clipped + int clipped = 0; + for (int i = 0; i < histSize; ++i) + { + if (tileHist[i] > clipLimit_) + { + clipped += tileHist[i] - clipLimit_; + tileHist[i] = clipLimit_; + } + } + + // redistribute clipped pixels + int redistBatch = clipped / histSize; + int residual = clipped - redistBatch * histSize; + + for (int i = 0; i < histSize; ++i) + tileHist[i] += redistBatch; + + for (int i = 0; i < residual; ++i) + tileHist[i]++; + } + + // calc Lut + + int sum = 0; + for (int i = 0; i < histSize; ++i) + { + sum += tileHist[i]; + tileLut[i] = cv::saturate_cast(sum * lutScale_); + } + } + } + + class CLAHE_Interpolation_Body : public cv::ParallelLoopBody + { + public: + CLAHE_Interpolation_Body(const cv::Mat& src, cv::Mat& dst, const cv::Mat& lut, cv::Size tileSize, int tilesX, int tilesY) : + src_(src), dst_(dst), lut_(lut), tileSize_(tileSize), tilesX_(tilesX), tilesY_(tilesY) + { + } + + void operator ()(const cv::Range& range) const; + + private: + cv::Mat src_; + mutable cv::Mat dst_; + cv::Mat lut_; + + cv::Size tileSize_; + int tilesX_; + int tilesY_; + }; + + void CLAHE_Interpolation_Body::operator ()(const cv::Range& range) const + { + const size_t lut_step = lut_.step; + + for (int y = range.start; y < range.end; ++y) + { + const uchar* srcRow = src_.ptr(y); + uchar* dstRow = dst_.ptr(y); + + const float tyf = (static_cast(y) / tileSize_.height) - 0.5f; + + int ty1 = cvFloor(tyf); + int ty2 = ty1 + 1; + + const float ya = tyf - ty1; + + ty1 = std::max(ty1, 0); + ty2 = std::min(ty2, tilesY_ - 1); + + const uchar* lutPlane1 = lut_.ptr(ty1 * tilesX_); + const uchar* lutPlane2 = lut_.ptr(ty2 * tilesX_); + + for (int x = 0; x < src_.cols; ++x) + { + const float txf = (static_cast(x) / tileSize_.width) - 0.5f; + + int tx1 = cvFloor(txf); + int tx2 = tx1 + 1; + + const float xa = txf - tx1; + + tx1 = std::max(tx1, 0); + tx2 = std::min(tx2, tilesX_ - 1); + + const int srcVal = srcRow[x]; + + const size_t ind1 = tx1 * lut_step + srcVal; + const size_t ind2 = tx2 * lut_step + srcVal; + + float res = 0; + + res += lutPlane1[ind1] * ((1.0f - xa) * (1.0f - ya)); + res += lutPlane1[ind2] * ((xa) * (1.0f - ya)); + res += lutPlane2[ind1] * ((1.0f - xa) * (ya)); + res += lutPlane2[ind2] * ((xa) * (ya)); + + dstRow[x] = cv::saturate_cast(res); + } + } + } + + class CLAHE_Impl : public cv::CLAHE + { + public: + CLAHE_Impl(double clipLimit = 40.0, int tilesX = 8, int tilesY = 8); + + cv::AlgorithmInfo* info() const; + + void apply(cv::InputArray src, cv::OutputArray dst); + + void setClipLimit(double clipLimit); + double getClipLimit() const; + + void setTilesGridSize(cv::Size tileGridSize); + cv::Size getTilesGridSize() const; + + void collectGarbage(); + + private: + double clipLimit_; + int tilesX_; + int tilesY_; + + cv::Mat srcExt_; + cv::Mat lut_; + }; + + CLAHE_Impl::CLAHE_Impl(double clipLimit, int tilesX, int tilesY) : + clipLimit_(clipLimit), tilesX_(tilesX), tilesY_(tilesY) + { + } + + CV_INIT_ALGORITHM(CLAHE_Impl, "CLAHE", + obj.info()->addParam(obj, "clipLimit", obj.clipLimit_); + obj.info()->addParam(obj, "tilesX", obj.tilesX_); + obj.info()->addParam(obj, "tilesY", obj.tilesY_)) + + void CLAHE_Impl::apply(cv::InputArray _src, cv::OutputArray _dst) + { + cv::Mat src = _src.getMat(); + + CV_Assert( src.type() == CV_8UC1 ); + + _dst.create( src.size(), src.type() ); + cv::Mat dst = _dst.getMat(); + + const int histSize = 256; + + lut_.create(tilesX_ * tilesY_, histSize, CV_8UC1); + + cv::Size tileSize; + cv::Mat srcForLut; + + if (src.cols % tilesX_ == 0 && src.rows % tilesY_ == 0) + { + tileSize = cv::Size(src.cols / tilesX_, src.rows / tilesY_); + srcForLut = src; + } + else + { + cv::copyMakeBorder(src, srcExt_, 0, tilesY_ - (src.rows % tilesY_), 0, tilesX_ - (src.cols % tilesX_), cv::BORDER_REFLECT_101); + + tileSize = cv::Size(srcExt_.cols / tilesX_, srcExt_.rows / tilesY_); + srcForLut = srcExt_; + } + + const int tileSizeTotal = tileSize.area(); + const float lutScale = static_cast(histSize - 1) / tileSizeTotal; + + int clipLimit = 0; + if (clipLimit_ > 0.0) + { + clipLimit = static_cast(clipLimit_ * tileSizeTotal / histSize); + clipLimit = std::max(clipLimit, 1); + } + + CLAHE_CalcLut_Body calcLutBody(srcForLut, lut_, tileSize, tilesX_, tilesY_, clipLimit, lutScale); + cv::parallel_for_(cv::Range(0, tilesX_ * tilesY_), calcLutBody); + + CLAHE_Interpolation_Body interpolationBody(src, dst, lut_, tileSize, tilesX_, tilesY_); + cv::parallel_for_(cv::Range(0, src.rows), interpolationBody); + } + + void CLAHE_Impl::setClipLimit(double clipLimit) + { + clipLimit_ = clipLimit; + } + + double CLAHE_Impl::getClipLimit() const + { + return clipLimit_; + } + + void CLAHE_Impl::setTilesGridSize(cv::Size tileGridSize) + { + tilesX_ = tileGridSize.width; + tilesY_ = tileGridSize.height; + } + + cv::Size CLAHE_Impl::getTilesGridSize() const + { + return cv::Size(tilesX_, tilesY_); + } + + void CLAHE_Impl::collectGarbage() + { + srcExt_.release(); + lut_.release(); + } +} + +cv::Ptr cv::createCLAHE(double clipLimit, cv::Size tileGridSize) +{ + return new CLAHE_Impl(clipLimit, tileGridSize.width, tileGridSize.height); +} + +// ---------------------------------------------------------------------- + /* Implementation of RTTI and Generic Functions for CvHistogram */ #define CV_TYPE_NAME_HIST "opencv-hist" @@ -3339,4 +3633,3 @@ CvType hist_type( CV_TYPE_NAME_HIST, icvIsHist, (CvReleaseFunc)cvReleaseHist, icvReadHist, icvWriteHist, (CvCloneFunc)icvCloneHist ); /* End of file. */ - diff --git a/modules/java/generator/src/cpp/features2d_manual.hpp b/modules/java/generator/src/cpp/features2d_manual.hpp index 266bec46e2..d735d9e228 100644 --- a/modules/java/generator/src/cpp/features2d_manual.hpp +++ b/modules/java/generator/src/cpp/features2d_manual.hpp @@ -260,8 +260,8 @@ class CV_EXPORTS_AS(DescriptorExtractor) javaDescriptorExtractor : public Descri public: #if 0 //DO NOT REMOVE! The block is required for sources parser - CV_WRAP void compute( const Mat& image, std::vector& keypoints, Mat& descriptors ) const; - CV_WRAP void compute( const std::vector& images, std::vector >& keypoints, CV_OUT std::vector& descriptors ) const; + CV_WRAP void compute( const Mat& image, CV_IN_OUT std::vector& keypoints, Mat& descriptors ) const; + CV_WRAP void compute( const std::vector& images, CV_IN_OUT std::vector >& keypoints, CV_OUT std::vector& descriptors ) const; CV_WRAP virtual int descriptorSize() const; CV_WRAP virtual int descriptorType() const; diff --git a/modules/java/test/CMakeLists.txt b/modules/java/test/CMakeLists.txt index 8f3021991d..122aae22a0 100644 --- a/modules/java/test/CMakeLists.txt +++ b/modules/java/test/CMakeLists.txt @@ -75,3 +75,7 @@ add_custom_command(OUTPUT "${opencv_test_java_bin_dir}/build/jar/opencv-test.jar add_custom_target(${PROJECT_NAME} ALL SOURCES "${opencv_test_java_bin_dir}/build/jar/opencv-test.jar") add_dependencies(${PROJECT_NAME} ${the_module}) + +if(ENABLE_SOLUTION_FOLDERS) + set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "tests accuracy") +endif() diff --git a/modules/ml/src/svm.cpp b/modules/ml/src/svm.cpp index 47fc6c3547..7884ef5ee6 100644 --- a/modules/ml/src/svm.cpp +++ b/modules/ml/src/svm.cpp @@ -1600,25 +1600,28 @@ void CvSVM::optimize_linear_svm() return; int var_count = get_var_count(); - int sample_size = (int)(var_count*sizeof(sv[0][0])); + cv::AutoBuffer vbuf(var_count); + double* v = vbuf; float** new_sv = (float**)cvMemStorageAlloc(storage, df_count*sizeof(new_sv[0])); for( i = 0; i < df_count; i++ ) { - new_sv[i] = (float*)cvMemStorageAlloc(storage, sample_size); + new_sv[i] = (float*)cvMemStorageAlloc(storage, var_count*sizeof(new_sv[i][0])); float* dst = new_sv[i]; - memset(dst, 0, sample_size); + memset(v, 0, var_count*sizeof(v[0])); int j, k, sv_count = df[i].sv_count; for( j = 0; j < sv_count; j++ ) { - const float* src = class_count > 1 ? sv[df[i].sv_index[j]] : sv[j]; + const float* src = class_count > 1 && df[i].sv_index ? sv[df[i].sv_index[j]] : sv[j]; double a = df[i].alpha[j]; for( k = 0; k < var_count; k++ ) - dst[k] = (float)(dst[k] + src[k]*a); + v[k] += src[k]*a; } + for( k = 0; k < var_count; k++ ) + dst[k] = (float)v[k]; df[i].sv_count = 1; df[i].alpha[0] = 1.; - if( class_count > 1 ) + if( class_count > 1 && df[i].sv_index ) df[i].sv_index[0] = i; } @@ -2619,7 +2622,8 @@ void CvSVM::read( CvFileStorage* fs, CvFileNode* svm_node ) CV_NEXT_SEQ_ELEM( df_node->data.seq->elem_size, reader ); } - optimize_linear_svm(); + if( cvReadIntByName(fs, svm_node, "optimize_linear", 1) != 0 ) + optimize_linear_svm(); create_kernel(); __END__; diff --git a/modules/ml/test/test_mltests2.cpp b/modules/ml/test/test_mltests2.cpp index d577662a0e..42400867f8 100644 --- a/modules/ml/test/test_mltests2.cpp +++ b/modules/ml/test/test_mltests2.cpp @@ -769,7 +769,11 @@ void CV_MLBaseTest::load( const char* filename ) else if( !modelName.compare(CV_KNEAREST) ) knearest->load( filename ); else if( !modelName.compare(CV_SVM) ) + { + delete svm; + svm = new CvSVM; svm->load( filename ); + } else if( !modelName.compare(CV_ANN) ) ann->load( filename ); else if( !modelName.compare(CV_DTREE) ) diff --git a/modules/ml/test/test_save_load.cpp b/modules/ml/test/test_save_load.cpp index 889b98b62b..9fd31b9f24 100644 --- a/modules/ml/test/test_save_load.cpp +++ b/modules/ml/test/test_save_load.cpp @@ -82,32 +82,53 @@ int CV_SLMLTest::validate_test_results( int testCaseIdx ) int code = cvtest::TS::OK; // 1. compare files - ifstream f1( fname1.c_str() ), f2( fname2.c_str() ); - string s1, s2; - int lineIdx = 0; - CV_Assert( f1.is_open() && f2.is_open() ); - for( ; !f1.eof() && !f2.eof(); lineIdx++ ) + FILE *fs1 = fopen(fname1.c_str(), "rb"), *fs2 = fopen(fname2.c_str(), "rb"); + size_t sz1 = 0, sz2 = 0; + if( !fs1 || !fs2 ) + code = cvtest::TS::FAIL_MISSING_TEST_DATA; + if( code >= 0 ) { - getline( f1, s1 ); - getline( f2, s2 ); - if( s1.compare(s2) ) + fseek(fs1, 0, SEEK_END); fseek(fs2, 0, SEEK_END); + sz1 = ftell(fs1); + sz2 = ftell(fs2); + fseek(fs1, 0, SEEK_SET); fseek(fs2, 0, SEEK_SET); + } + + if( sz1 != sz2 ) + code = cvtest::TS::FAIL_INVALID_OUTPUT; + + if( code >= 0 ) + { + const int BUFSZ = 1024; + uchar buf1[BUFSZ], buf2[BUFSZ]; + for( size_t pos = 0; pos < sz1; ) { - ts->printf( cvtest::TS::LOG, "first and second saved files differ in %n-line; first %n line: %s; second %n-line: %s", - lineIdx, lineIdx, s1.c_str(), lineIdx, s2.c_str() ); - code = cvtest::TS::FAIL_INVALID_OUTPUT; + size_t r1 = fread(buf1, 1, BUFSZ, fs1); + size_t r2 = fread(buf2, 1, BUFSZ, fs2); + if( r1 != r2 || memcmp(buf1, buf2, r1) != 0 ) + { + ts->printf( cvtest::TS::LOG, + "in test case %d first (%s) and second (%s) saved files differ in %d-th kb\n", + testCaseIdx, fname1.c_str(), fname2.c_str(), + (int)pos ); + code = cvtest::TS::FAIL_INVALID_OUTPUT; + break; + } + pos += r1; } } - if( !f1.eof() || !f2.eof() ) - { - ts->printf( cvtest::TS::LOG, "in test case %d first and second saved files differ in %n-line; first %n line: %s; second %n-line: %s", - testCaseIdx, lineIdx, lineIdx, s1.c_str(), lineIdx, s2.c_str() ); - code = cvtest::TS::FAIL_INVALID_OUTPUT; - } - f1.close(); - f2.close(); + + if(fs1) + fclose(fs1); + if(fs2) + fclose(fs2); + // delete temporary files - remove( fname1.c_str() ); - remove( fname2.c_str() ); + if( code >= 0 ) + { + remove( fname1.c_str() ); + remove( fname2.c_str() ); + } // 2. compare responses CV_Assert( test_resps1.size() == test_resps2.size() ); @@ -133,4 +154,32 @@ TEST(ML_Boost, save_load) { CV_SLMLTest test( CV_BOOST ); test.safe_run(); } TEST(ML_RTrees, save_load) { CV_SLMLTest test( CV_RTREES ); test.safe_run(); } TEST(ML_ERTrees, save_load) { CV_SLMLTest test( CV_ERTREES ); test.safe_run(); } + +TEST(DISABLED_ML_SVM, linear_save_load) +{ + CvSVM svm1, svm2, svm3; + svm1.load("SVM45_X_38-1.xml"); + svm2.load("SVM45_X_38-2.xml"); + string tname = tempfile("a.xml"); + svm2.save(tname.c_str()); + svm3.load(tname.c_str()); + + ASSERT_EQ(svm1.get_var_count(), svm2.get_var_count()); + ASSERT_EQ(svm1.get_var_count(), svm3.get_var_count()); + + int m = 10000, n = svm1.get_var_count(); + Mat samples(m, n, CV_32F), r1, r2, r3; + randu(samples, 0., 1.); + + svm1.predict(samples, r1); + svm2.predict(samples, r2); + svm3.predict(samples, r3); + + double eps = 1e-4; + EXPECT_LE(norm(r1, r2, NORM_INF), eps); + EXPECT_LE(norm(r1, r3, NORM_INF), eps); + + remove(tname.c_str()); +} + /* End of file. */ diff --git a/modules/nonfree/include/opencv2/nonfree/gpu.hpp b/modules/nonfree/include/opencv2/nonfree/gpu.hpp index 823c3778e8..aa0c9cba0b 100644 --- a/modules/nonfree/include/opencv2/nonfree/gpu.hpp +++ b/modules/nonfree/include/opencv2/nonfree/gpu.hpp @@ -22,7 +22,7 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. diff --git a/modules/nonfree/perf/perf_gpu.cpp b/modules/nonfree/perf/perf_gpu.cpp index e4c4bf40e8..eeaf5a7f66 100644 --- a/modules/nonfree/perf/perf_gpu.cpp +++ b/modules/nonfree/perf/perf_gpu.cpp @@ -1,5 +1,51 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" +#if defined(HAVE_OPENCV_GPU) && defined(HAVE_CUDA) + +#include "opencv2/ts/gpu_perf.hpp" + using namespace std; using namespace testing; using namespace perf; @@ -16,8 +62,6 @@ using namespace perf; # define BUILD_WITH_VIDEO_INPUT_SUPPORT 0 #endif -#if defined(HAVE_OPENCV_GPU) && defined(HAVE_CUDA) - ////////////////////////////////////////////////////////////////////// // SURF diff --git a/modules/nonfree/perf/perf_precomp.hpp b/modules/nonfree/perf/perf_precomp.hpp index 90b50331ee..bf093baed2 100644 --- a/modules/nonfree/perf/perf_precomp.hpp +++ b/modules/nonfree/perf/perf_precomp.hpp @@ -14,6 +14,7 @@ #include "opencv2/highgui.hpp" #include "opencv2/opencv_modules.hpp" + #ifdef HAVE_OPENCV_OCL # include "opencv2/nonfree/ocl.hpp" #endif diff --git a/modules/nonfree/src/cuda/surf.cu b/modules/nonfree/src/cuda/surf.cu index b82e2c3863..3f34cc745e 100644 --- a/modules/nonfree/src/cuda/surf.cu +++ b/modules/nonfree/src/cuda/surf.cu @@ -38,11 +38,6 @@ // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // -// Copyright (c) 2010, Paul Furgale, Chi Hay Tong -// -// The original code was written by Paul Furgale and Chi Hay Tong -// and later optimized and prepared for integration into OpenCV by Itseez. -// //M*/ #if !defined CUDA_DISABLER diff --git a/modules/nonfree/src/cuda/vibe.cu b/modules/nonfree/src/cuda/vibe.cu index ff489eeab9..6d4653f2a6 100644 --- a/modules/nonfree/src/cuda/vibe.cu +++ b/modules/nonfree/src/cuda/vibe.cu @@ -28,7 +28,7 @@ // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/nonfree/src/opencl/surf.cl b/modules/nonfree/src/opencl/surf.cl index e917864d73..1975713654 100644 --- a/modules/nonfree/src/opencl/surf.cl +++ b/modules/nonfree/src/opencl/surf.cl @@ -747,21 +747,42 @@ void reduce_32_sum(volatile __local float * data, volatile float* partial_reduc #define op(A, B) (*A)+(B) data[tid] = *partial_reduction; barrier(CLK_LOCAL_MEM_FENCE); - +#ifndef WAVE_SIZE +#define WAVE_SIZE 1 +#endif if (tid < 16) + { data[tid] = *partial_reduction = op(partial_reduction, data[tid + 16]); +#if WAVE_SIZE < 16 + } barrier(CLK_LOCAL_MEM_FENCE); if (tid < 8) + { +#endif data[tid] = *partial_reduction = op(partial_reduction, data[tid + 8 ]); +#if WAVE_SIZE < 8 + } barrier(CLK_LOCAL_MEM_FENCE); if (tid < 4) + { +#endif data[tid] = *partial_reduction = op(partial_reduction, data[tid + 4 ]); +#if WAVE_SIZE < 4 + } barrier(CLK_LOCAL_MEM_FENCE); if (tid < 2) + { +#endif data[tid] = *partial_reduction = op(partial_reduction, data[tid + 2 ]); +#if WAVE_SIZE < 2 + } barrier(CLK_LOCAL_MEM_FENCE); if (tid < 1) + { +#endif data[tid] = *partial_reduction = op(partial_reduction, data[tid + 1 ]); + } +#undef WAVE_SIZE #undef op } @@ -1087,44 +1108,67 @@ void reduce_sum25( int tid ) { +#ifndef WAVE_SIZE +#define WAVE_SIZE 1 +#endif // first step is to reduce from 25 to 16 - if (tid < 9) // use 9 threads + if (tid < 9) { sdata1[tid] += sdata1[tid + 16]; sdata2[tid] += sdata2[tid + 16]; sdata3[tid] += sdata3[tid + 16]; sdata4[tid] += sdata4[tid + 16]; +#if WAVE_SIZE < 16 } - - // sum (reduce) from 16 to 1 (unrolled - aligned to a half-warp) + barrier(CLK_LOCAL_MEM_FENCE); if (tid < 8) { +#endif sdata1[tid] += sdata1[tid + 8]; - sdata1[tid] += sdata1[tid + 4]; - sdata1[tid] += sdata1[tid + 2]; - sdata1[tid] += sdata1[tid + 1]; sdata2[tid] += sdata2[tid + 8]; - sdata2[tid] += sdata2[tid + 4]; - sdata2[tid] += sdata2[tid + 2]; - sdata2[tid] += sdata2[tid + 1]; sdata3[tid] += sdata3[tid + 8]; - sdata3[tid] += sdata3[tid + 4]; - sdata3[tid] += sdata3[tid + 2]; - sdata3[tid] += sdata3[tid + 1]; sdata4[tid] += sdata4[tid + 8]; +#if WAVE_SIZE < 8 + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 4) + { +#endif + sdata1[tid] += sdata1[tid + 4]; + sdata2[tid] += sdata2[tid + 4]; + sdata3[tid] += sdata3[tid + 4]; sdata4[tid] += sdata4[tid + 4]; +#if WAVE_SIZE < 4 + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 2) + { +#endif + sdata1[tid] += sdata1[tid + 2]; + sdata2[tid] += sdata2[tid + 2]; + sdata3[tid] += sdata3[tid + 2]; sdata4[tid] += sdata4[tid + 2]; +#if WAVE_SIZE < 2 + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 1) + { +#endif + sdata1[tid] += sdata1[tid + 1]; + sdata2[tid] += sdata2[tid + 1]; + sdata3[tid] += sdata3[tid + 1]; sdata4[tid] += sdata4[tid + 1]; } +#undef WAVE_SIZE } __kernel void compute_descriptors64( IMAGE_INT8 imgTex, - volatile __global float * descriptors, + __global float * descriptors, __global const float * keypoints, int descriptors_step, int keypoints_step, @@ -1158,14 +1202,13 @@ __kernel sdyabs[tid] = fabs(sdy[tid]); // |dy| array } barrier(CLK_LOCAL_MEM_FENCE); - if (tid < 25) - { + reduce_sum25(sdx, sdy, sdxabs, sdyabs, tid); - } + barrier(CLK_LOCAL_MEM_FENCE); if (tid < 25) { - volatile __global float* descriptors_block = descriptors + descriptors_step * get_group_id(0) + (get_group_id(1) << 2); + __global float* descriptors_block = descriptors + descriptors_step * get_group_id(0) + (get_group_id(1) << 2); // write dx, dy, |dx|, |dy| if (tid == 0) @@ -1180,7 +1223,7 @@ __kernel __kernel void compute_descriptors128( IMAGE_INT8 imgTex, - __global volatile float * descriptors, + __global float * descriptors, __global float * keypoints, int descriptors_step, int keypoints_step, @@ -1229,13 +1272,15 @@ __kernel sd2[tid] = sdx[tid]; sdabs2[tid] = fabs(sdx[tid]); } - //barrier(CLK_LOCAL_MEM_FENCE); + } + barrier(CLK_LOCAL_MEM_FENCE); reduce_sum25(sd1, sd2, sdabs1, sdabs2, tid); - //barrier(CLK_LOCAL_MEM_FENCE); - - volatile __global float* descriptors_block = descriptors + descriptors_step * get_group_id(0) + (get_group_id(1) << 3); + barrier(CLK_LOCAL_MEM_FENCE); + __global float* descriptors_block = descriptors + descriptors_step * get_group_id(0) + (get_group_id(1) << 3); + if (tid < 25) + { // write dx (dy >= 0), |dx| (dy >= 0), dx (dy < 0), |dx| (dy < 0) if (tid == 0) { @@ -1259,11 +1304,14 @@ __kernel sd2[tid] = sdy[tid]; sdabs2[tid] = fabs(sdy[tid]); } - //barrier(CLK_LOCAL_MEM_FENCE); + } + barrier(CLK_LOCAL_MEM_FENCE); reduce_sum25(sd1, sd2, sdabs1, sdabs2, tid); - //barrier(CLK_LOCAL_MEM_FENCE); + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 25) + { // write dy (dx >= 0), |dy| (dx >= 0), dy (dx < 0), |dy| (dx < 0) if (tid == 0) { @@ -1274,6 +1322,103 @@ __kernel } } } +void reduce_sum128(volatile __local float* smem, int tid) +{ +#ifndef WAVE_SIZE +#define WAVE_SIZE 1 +#endif + if (tid < 64) + { + smem[tid] += smem[tid + 64]; +#if WAVE_SIZE < 64 + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 32) + { +#endif + smem[tid] += smem[tid + 32]; +#if WAVE_SIZE < 32 + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 16) + { +#endif + smem[tid] += smem[tid + 16]; +#if WAVE_SIZE < 16 + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 8) + { +#endif + smem[tid] += smem[tid + 8]; +#if WAVE_SIZE < 8 + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 4) + { +#endif + smem[tid] += smem[tid + 4]; +#if WAVE_SIZE < 4 + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 2) + { +#endif + smem[tid] += smem[tid + 2]; +#if WAVE_SIZE < 2 + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 1) + { +#endif + smem[tid] += smem[tid + 1]; + } +} +void reduce_sum64(volatile __local float* smem, int tid) +{ +#ifndef WAVE_SIZE +#define WAVE_SIZE 1 +#endif + if (tid < 32) + { + smem[tid] += smem[tid + 32]; +#if WAVE_SIZE < 32 + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 16) + { +#endif + smem[tid] += smem[tid + 16]; +#if WAVE_SIZE < 16 + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 8) + { +#endif + smem[tid] += smem[tid + 8]; +#if WAVE_SIZE < 8 + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 4) + { +#endif + smem[tid] += smem[tid + 4]; +#if WAVE_SIZE < 4 + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 2) + { +#endif + smem[tid] += smem[tid + 2]; +#if WAVE_SIZE < 2 + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 1) + { +#endif + smem[tid] += smem[tid + 1]; + } +} __kernel void normalize_descriptors128(__global float * descriptors, int descriptors_step) @@ -1288,22 +1433,10 @@ __kernel sqDesc[get_local_id(0)] = lookup * lookup; barrier(CLK_LOCAL_MEM_FENCE); - if (get_local_id(0) < 64) - sqDesc[get_local_id(0)] += sqDesc[get_local_id(0) + 64]; + reduce_sum128(sqDesc, get_local_id(0)); barrier(CLK_LOCAL_MEM_FENCE); - // reduction to get total - if (get_local_id(0) < 32) - { - volatile __local float* smem = sqDesc; - smem[get_local_id(0)] += smem[get_local_id(0) + 32]; - smem[get_local_id(0)] += smem[get_local_id(0) + 16]; - smem[get_local_id(0)] += smem[get_local_id(0) + 8]; - smem[get_local_id(0)] += smem[get_local_id(0) + 4]; - smem[get_local_id(0)] += smem[get_local_id(0) + 2]; - smem[get_local_id(0)] += smem[get_local_id(0) + 1]; - } // compute length (square root) volatile __local float len; @@ -1329,18 +1462,9 @@ __kernel sqDesc[get_local_id(0)] = lookup * lookup; barrier(CLK_LOCAL_MEM_FENCE); - // reduction to get total - if (get_local_id(0) < 32) - { - volatile __local float* smem = sqDesc; - smem[get_local_id(0)] += smem[get_local_id(0) + 32]; - smem[get_local_id(0)] += smem[get_local_id(0) + 16]; - smem[get_local_id(0)] += smem[get_local_id(0) + 8]; - smem[get_local_id(0)] += smem[get_local_id(0) + 4]; - smem[get_local_id(0)] += smem[get_local_id(0) + 2]; - smem[get_local_id(0)] += smem[get_local_id(0) + 1]; - } + reduce_sum64(sqDesc, get_local_id(0)); + barrier(CLK_LOCAL_MEM_FENCE); // compute length (square root) volatile __local float len; diff --git a/modules/nonfree/src/surf.ocl.cpp b/modules/nonfree/src/surf.ocl.cpp index b08f9ec7bf..893ddc32de 100644 --- a/modules/nonfree/src/surf.ocl.cpp +++ b/modules/nonfree/src/surf.ocl.cpp @@ -43,6 +43,7 @@ // //M*/ #include "precomp.hpp" +#include #ifdef HAVE_OPENCV_OCL @@ -56,19 +57,29 @@ namespace cv ///////////////////////////OpenCL kernel strings/////////////////////////// extern const char *surf; - const char* noImage2dOption = "-D DISABLE_IMAGE2D"; + const char noImage2dOption [] = "-D DISABLE_IMAGE2D"; + static char SURF_OPTIONS [1024] = ""; + static bool USE_IMAGE2d = false; static void openCLExecuteKernelSURF(Context *clCxt , const char **source, String kernelName, size_t globalThreads[3], - size_t localThreads[3], std::vector< std::pair > &args, int channels, int depth) + size_t localThreads[3], std::vector< std::pair > &args, int channels, int depth) { - if(support_image2d()) + char * pSURF_OPTIONS = SURF_OPTIONS; + static bool OPTION_INIT = false; + if(!OPTION_INIT) { - openCLExecuteKernel(clCxt, source, kernelName, globalThreads, localThreads, args, channels, depth); - } - else - { - openCLExecuteKernel(clCxt, source, kernelName, globalThreads, localThreads, args, channels, depth, noImage2dOption); + if( !USE_IMAGE2d ) + { + strcat(pSURF_OPTIONS, noImage2dOption); + pSURF_OPTIONS += strlen(noImage2dOption); + } + + size_t wave_size = 0; + queryDeviceInfo(WAVEFRONT_SIZE, &wave_size); + std::sprintf(pSURF_OPTIONS, " -D WAVE_SIZE=%d", static_cast(wave_size)); + OPTION_INIT = true; } + openCLExecuteKernel(clCxt, source, kernelName, globalThreads, localThreads, args, channels, depth, SURF_OPTIONS); } } } @@ -151,8 +162,20 @@ public: integral(img, surf_.sum); if(support_image2d()) { - bindImgTex(img, imgTex); - bindImgTex(surf_.sum, sumTex); + try + { + bindImgTex(img, imgTex); + bindImgTex(surf_.sum, sumTex); + USE_IMAGE2d = true; + } + catch (const cv::Exception& e) + { + USE_IMAGE2d = false; + if(e.code != CL_IMAGE_FORMAT_NOT_SUPPORTED && e.code != -217) + { + throw e; + } + } } maskSumTex = 0; diff --git a/modules/nonfree/src/surf_gpu.cpp b/modules/nonfree/src/surf_gpu.cpp index f86c001be2..a5f7389c34 100644 --- a/modules/nonfree/src/surf_gpu.cpp +++ b/modules/nonfree/src/surf_gpu.cpp @@ -22,13 +22,13 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and -// any express or bpied warranties, including, but not limited to, the bpied +// any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages diff --git a/modules/nonfree/test/test_gpu.cpp b/modules/nonfree/test/test_gpu.cpp index 2993cf5676..ece82f316e 100644 --- a/modules/nonfree/test/test_gpu.cpp +++ b/modules/nonfree/test/test_gpu.cpp @@ -7,10 +7,11 @@ // copy or use the software. // // -// Intel License Agreement +// License Agreement // For Open Source Computer Vision Library // -// Copyright (C) 2000, Intel Corporation, all rights reserved. +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -23,7 +24,7 @@ // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // -// * The name of Intel Corporation may not be used to endorse or promote products +// * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and diff --git a/modules/ocl/include/opencv2/ocl/private/util.hpp b/modules/ocl/include/opencv2/ocl/private/util.hpp index aacb69345c..83992b1fd7 100644 --- a/modules/ocl/include/opencv2/ocl/private/util.hpp +++ b/modules/ocl/include/opencv2/ocl/private/util.hpp @@ -123,6 +123,16 @@ namespace cv // returns whether the current context supports image2d_t format or not bool CV_EXPORTS support_image2d(Context *clCxt = Context::getContext()); + // the enums are used to query device information + // currently only support wavefront size queries + enum DEVICE_INFO + { + WAVEFRONT_SIZE, //in AMD speak + WARP_SIZE = WAVEFRONT_SIZE //in nvidia speak + }; + //info should have been pre-allocated + void CV_EXPORTS queryDeviceInfo(DEVICE_INFO info_type, void* info); + }//namespace ocl }//namespace cv diff --git a/modules/ocl/src/brute_force_matcher.cpp b/modules/ocl/src/brute_force_matcher.cpp index a1ac374dae..5e566de92c 100644 --- a/modules/ocl/src/brute_force_matcher.cpp +++ b/modules/ocl/src/brute_force_matcher.cpp @@ -44,6 +44,7 @@ //M*/ #include "precomp.hpp" + #include #include #include @@ -59,10 +60,11 @@ namespace cv } } -template < int BLOCK_SIZE, int MAX_DESC_LEN, typename T/*, typename Mask*/ > +template < int BLOCK_SIZE, int MAX_DESC_LEN/*, typename Mask*/ > void matchUnrolledCached(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &trainIdx, const oclMat &distance, int distType) { + assert(query.type() == CV_32F); cv::ocl::Context *ctx = query.clCxt; size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; @@ -90,20 +92,21 @@ void matchUnrolledCached(const oclMat &query, const oclMat &train, const oclMat String kernelName = "BruteForceMatch_UnrollMatch"; - openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); + openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, query.depth()); } } -template < int BLOCK_SIZE, int MAX_DESC_LEN, typename T/*, typename Mask*/ > +template < int BLOCK_SIZE, int MAX_DESC_LEN/*, typename Mask*/ > void matchUnrolledCached(const oclMat /*query*/, const oclMat * /*trains*/, int /*n*/, const oclMat /*mask*/, const oclMat &/*bestTrainIdx*/, const oclMat & /*bestImgIdx*/, const oclMat & /*bestDistance*/, int /*distType*/) { } -template < int BLOCK_SIZE, typename T/*, typename Mask*/ > +template < int BLOCK_SIZE/*, typename Mask*/ > void match(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &trainIdx, const oclMat &distance, int distType) { + assert(query.type() == CV_32F); cv::ocl::Context *ctx = query.clCxt; size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; @@ -129,21 +132,22 @@ void match(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, String kernelName = "BruteForceMatch_Match"; - openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); + openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, query.depth()); } } -template < int BLOCK_SIZE, typename T/*, typename Mask*/ > +template < int BLOCK_SIZE/*, typename Mask*/ > void match(const oclMat /*query*/, const oclMat * /*trains*/, int /*n*/, const oclMat /*mask*/, const oclMat &/*bestTrainIdx*/, const oclMat & /*bestImgIdx*/, const oclMat & /*bestDistance*/, int /*distType*/) { } //radius_matchUnrolledCached -template < int BLOCK_SIZE, int MAX_DESC_LEN, typename T/*, typename Mask*/ > +template < int BLOCK_SIZE, int MAX_DESC_LEN/*, typename Mask*/ > void matchUnrolledCached(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &/*mask*/, const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches, int distType) { + assert(query.type() == CV_32F); cv::ocl::Context *ctx = query.clCxt; size_t globalSize[] = {(train.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, (query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; @@ -175,15 +179,16 @@ void matchUnrolledCached(const oclMat &query, const oclMat &train, float maxDist String kernelName = "BruteForceMatch_RadiusUnrollMatch"; - openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); + openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, query.depth()); } } //radius_match -template < int BLOCK_SIZE, typename T/*, typename Mask*/ > +template < int BLOCK_SIZE/*, typename Mask*/ > void radius_match(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &/*mask*/, const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches, int distType) { + assert(query.type() == CV_32F); cv::ocl::Context *ctx = query.clCxt; size_t globalSize[] = {(train.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, (query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; @@ -213,263 +218,70 @@ void radius_match(const oclMat &query, const oclMat &train, float maxDistance, c String kernelName = "BruteForceMatch_RadiusMatch"; - openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); - //float *dis = (float *)clEnqueueMapBuffer(ctx->impl->clCmdQueue, (cl_mem)distance.data, CL_TRUE, CL_MAP_READ, 0, 8, 0, NULL, NULL, NULL); - //printf("%f, %f\n", dis[0], dis[1]); + openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, query.depth()); } } -// with mask -template < typename T/*, typename Mask*/ > -void matchDispatcher(const oclMat &query, const oclMat &train, const oclMat &mask, +static void matchDispatcher(const oclMat &query, const oclMat &train, const oclMat &mask, const oclMat &trainIdx, const oclMat &distance, int distType) { + const oclMat zeroMask; + const oclMat &tempMask = mask.data ? mask : zeroMask; if (query.cols <= 64) { - matchUnrolledCached<16, 64, T>(query, train, mask, trainIdx, distance, distType); + matchUnrolledCached<16, 64>(query, train, tempMask, trainIdx, distance, distType); } else if (query.cols <= 128) { - matchUnrolledCached<16, 128, T>(query, train, mask, trainIdx, distance, distType); + matchUnrolledCached<16, 128>(query, train, tempMask, trainIdx, distance, distType); } - /*else if (query.cols <= 256) - { - matchUnrolled<16, 256, Dist>(query, train, mask, trainIdx, distance, stream); - } - else if (query.cols <= 512) - { - matchUnrolled<16, 512, Dist>(query, train, mask, trainIdx, distance, stream); - } - else if (query.cols <= 1024) - { - matchUnrolled<16, 1024, Dist>(query, train, mask, trainIdx, distance, stream); - }*/ else { - match<16, T>(query, train, mask, trainIdx, distance, distType); + match<16>(query, train, tempMask, trainIdx, distance, distType); } } -// without mask -template < typename T/*, typename Mask*/ > -void matchDispatcher(const oclMat &query, const oclMat &train, const oclMat &trainIdx, const oclMat &distance, int distType) -{ - oclMat mask; - if (query.cols <= 64) - { - matchUnrolledCached<16, 64, T>(query, train, mask, trainIdx, distance, distType); - } - else if (query.cols <= 128) - { - matchUnrolledCached<16, 128, T>(query, train, mask, trainIdx, distance, distType); - } - /*else if (query.cols <= 256) - { - matchUnrolled<16, 256, Dist>(query, trains, n, mask, trainIdx, imgIdx, distance); - } - else if (query.cols <= 512) - { - matchUnrolled<16, 512, Dist>(query, trains, n, mask, trainIdx, imgIdx, distance); - } - else if (query.cols <= 1024) - { - matchUnrolled<16, 1024, Dist>(query, trains, n, mask, trainIdx, imgIdx, distance); - }*/ - else - { - match<16, T>(query, train, mask, trainIdx, distance, distType); - } -} - -template < typename T/*, typename Mask*/ > -void matchDispatcher(const oclMat &query, const oclMat *trains, int n, const oclMat &mask, +static void matchDispatcher(const oclMat &query, const oclMat *trains, int n, const oclMat &mask, const oclMat &trainIdx, const oclMat &imgIdx, const oclMat &distance, int distType) { + const oclMat zeroMask; + const oclMat &tempMask = mask.data ? mask : zeroMask; if (query.cols <= 64) { - matchUnrolledCached<16, 64, T>(query, trains, n, mask, trainIdx, imgIdx, distance, distType); + matchUnrolledCached<16, 64>(query, trains, n, tempMask, trainIdx, imgIdx, distance, distType); } else if (query.cols <= 128) { - matchUnrolledCached<16, 128, T>(query, trains, n, mask, trainIdx, imgIdx, distance, distType); + matchUnrolledCached<16, 128>(query, trains, n, tempMask, trainIdx, imgIdx, distance, distType); } - /*else if (query.cols <= 256) - { - matchUnrolled<16, 256, Dist>(query, trains, n, mask, trainIdx, imgIdx, distance, stream); - } - else if (query.cols <= 512) - { - matchUnrolled<16, 512, Dist>(query, trains, n, mask, trainIdx, imgIdx, distance, stream); - } - else if (query.cols <= 1024) - { - matchUnrolled<16, 1024, Dist>(query, trains, n, mask, trainIdx, imgIdx, distance, stream); - }*/ else { - match<16, T>(query, trains, n, mask, trainIdx, imgIdx, distance, distType); - } -} - -template < typename T/*, typename Mask*/ > -void matchDispatcher(const oclMat &query, const oclMat *trains, int n, const oclMat &trainIdx, - const oclMat &imgIdx, const oclMat &distance, int distType) -{ - oclMat mask; - if (query.cols <= 64) - { - matchUnrolledCached<16, 64, T>(query, trains, n, mask, trainIdx, imgIdx, distance, distType); - } - else if (query.cols <= 128) - { - matchUnrolledCached<16, 128, T>(query, trains, n, mask, trainIdx, imgIdx, distance, distType); - } - /*else if (query.cols <= 256) - { - matchUnrolled<16, 256, Dist>(query, trains, n, mask, trainIdx, imgIdx, distance, stream); - } - else if (query.cols <= 512) - { - matchUnrolled<16, 512, Dist>(query, trains, n, mask, trainIdx, imgIdx, distance, stream); - } - else if (query.cols <= 1024) - { - matchUnrolled<16, 1024, Dist>(query, trains, n, mask, trainIdx, imgIdx, distance, stream); - }*/ - else - { - match<16, T>(query, trains, n, mask, trainIdx, imgIdx, distance, distType); + match<16>(query, trains, n, tempMask, trainIdx, imgIdx, distance, distType); } } //radius matchDispatcher -// with mask -template < typename T/*, typename Mask*/ > -void matchDispatcher(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &mask, +static void matchDispatcher(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &mask, const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches, int distType) { + const oclMat zeroMask; + const oclMat &tempMask = mask.data ? mask : zeroMask; if (query.cols <= 64) { - matchUnrolledCached<16, 64, T>(query, train, maxDistance, mask, trainIdx, distance, nMatches, distType); + matchUnrolledCached<16, 64>(query, train, maxDistance, tempMask, trainIdx, distance, nMatches, distType); } else if (query.cols <= 128) { - matchUnrolledCached<16, 128, T>(query, train, maxDistance, mask, trainIdx, distance, nMatches, distType); + matchUnrolledCached<16, 128>(query, train, maxDistance, tempMask, trainIdx, distance, nMatches, distType); } - /*else if (query.cols <= 256) - { - matchUnrolled<16, 256, Dist>(query, train, maxDistance, mask, trainIdx, distance, nMatches, stream); - } - else if (query.cols <= 512) - { - matchUnrolled<16, 512, Dist>(query, train, maxDistance, mask, trainIdx, distance, nMatches, stream); - } - else if (query.cols <= 1024) - { - matchUnrolled<16, 1024, Dist>(query, train, maxDistance, mask, trainIdx, distance, nMatches, stream); - }*/ else { - radius_match<16, T>(query, train, maxDistance, mask, trainIdx, distance, nMatches, distType); - } -} - -// without mask -template < typename T/*, typename Mask*/ > -void matchDispatcher(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &trainIdx, - const oclMat &distance, const oclMat &nMatches, int distType) -{ - oclMat mask; - if (query.cols <= 64) - { - matchUnrolledCached<16, 64, T>(query, train, maxDistance, mask, trainIdx, distance, nMatches, distType); - } - else if (query.cols <= 128) - { - matchUnrolledCached<16, 128, T>(query, train, maxDistance, mask, trainIdx, distance, nMatches, distType); - } - /*else if (query.cols <= 256) - { - matchUnrolled<16, 256, Dist>(query, train, maxDistance, mask, trainIdx, distance, nMatches, stream); - } - else if (query.cols <= 512) - { - matchUnrolled<16, 512, Dist>(query, train, maxDistance, mask, trainIdx, distance, nMatches, stream); - } - else if (query.cols <= 1024) - { - matchUnrolled<16, 1024, Dist>(query, train, maxDistance, mask, trainIdx, distance, nMatches, stream); - }*/ - else - { - radius_match<16, T>(query, train, maxDistance, mask, trainIdx, distance, nMatches, distType); - } -} - -template < typename T/*, typename Mask*/ > -void matchDispatcher(const oclMat &query, const oclMat &train, int n, float maxDistance, const oclMat &mask, - const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches, int distType) -{ - if (query.cols <= 64) - { - matchUnrolledCached<16, 64, T>(query, train, n, maxDistance, mask, trainIdx, distance, nMatches, distType); - } - else if (query.cols <= 128) - { - matchUnrolledCached<16, 128, T>(query, train, n, maxDistance, mask, trainIdx, distance, nMatches, distType); - } - /*else if (query.cols <= 256) - { - matchUnrolled<16, 256, Dist>(query, trains, n, maxDistance, masks, trainIdx, imgIdx, distance, nMatches, stream); - } - else if (query.cols <= 512) - { - matchUnrolled<16, 512, Dist>(query, trains, n, maxDistance, masks, trainIdx, imgIdx, distance, nMatches, stream); - } - else if (query.cols <= 1024) - { - matchUnrolled<16, 1024, Dist>(query, trains, n, maxDistance, masks, trainIdx, imgIdx, distance, nMatches, stream); - }*/ - else - { - match<16, T>(query, train, n, maxDistance, mask, trainIdx, distance, nMatches, distType); - } -} - -// without mask -template < typename T/*, typename Mask*/ > -void matchDispatcher(const oclMat &query, const oclMat &train, int n, float maxDistance, const oclMat &trainIdx, - const oclMat &distance, const oclMat &nMatches, int distType) -{ - oclMat mask; - if (query.cols <= 64) - { - matchUnrolledCached<16, 64, T>(query, train, n, maxDistance, mask, trainIdx, distance, nMatches, distType); - } - else if (query.cols <= 128) - { - matchUnrolledCached<16, 128, T>(query, train, n, maxDistance, mask, trainIdx, distance, nMatches, distType); - } - /*else if (query.cols <= 256) - { - matchUnrolled<16, 256, Dist>(query, trains, n, maxDistance, masks, trainIdx, imgIdx, distance, nMatches, stream); - } - else if (query.cols <= 512) - { - matchUnrolled<16, 512, Dist>(query, trains, n, maxDistance, masks, trainIdx, imgIdx, distance, nMatches, stream); - } - else if (query.cols <= 1024) - { - matchUnrolled<16, 1024, Dist>(query, trains, n, maxDistance, masks, trainIdx, imgIdx, distance, nMatches, stream); - }*/ - else - { - match<16, T>(query, train, n, maxDistance, mask, trainIdx, distance, nMatches, distType); + radius_match<16>(query, train, maxDistance, tempMask, trainIdx, distance, nMatches, distType); } } //knn match Dispatcher -template < int BLOCK_SIZE, int MAX_DESC_LEN, typename T/*, typename Mask*/ > +template < int BLOCK_SIZE, int MAX_DESC_LEN/*, typename Mask*/ > void knn_matchUnrolledCached(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &trainIdx, const oclMat &distance, int distType) { @@ -500,11 +312,11 @@ void knn_matchUnrolledCached(const oclMat &query, const oclMat &train, const ocl String kernelName = "BruteForceMatch_knnUnrollMatch"; - openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); + openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, query.depth()); } } -template < int BLOCK_SIZE, typename T/*, typename Mask*/ > +template < int BLOCK_SIZE/*, typename Mask*/ > void knn_match(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &trainIdx, const oclMat &distance, int distType) { @@ -533,11 +345,11 @@ void knn_match(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, String kernelName = "BruteForceMatch_knnMatch"; - openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); + openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, query.depth()); } } -template < int BLOCK_SIZE, int MAX_DESC_LEN, typename T/*, typename Mask*/ > +template < int BLOCK_SIZE, int MAX_DESC_LEN/*, typename Mask*/ > void calcDistanceUnrolled(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &allDist, int distType) { cv::ocl::Context *ctx = query.clCxt; @@ -566,11 +378,11 @@ void calcDistanceUnrolled(const oclMat &query, const oclMat &train, const oclMat String kernelName = "BruteForceMatch_calcDistanceUnrolled"; - openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); + openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, query.depth()); } } -template < int BLOCK_SIZE, typename T/*, typename Mask*/ > +template < int BLOCK_SIZE/*, typename Mask*/ > void calcDistance(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &allDist, int distType) { cv::ocl::Context *ctx = query.clCxt; @@ -597,69 +409,43 @@ void calcDistance(const oclMat &query, const oclMat &train, const oclMat &/*mask String kernelName = "BruteForceMatch_calcDistance"; - openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); + openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, query.depth()); } } /////////////////////////////////////////////////////////////////////////////// // Calc Distance dispatcher -template < typename T/*, typename Mask*/ > -void calcDistanceDispatcher(const oclMat &query, const oclMat &train, const oclMat &mask, +static void calcDistanceDispatcher(const oclMat &query, const oclMat &train, const oclMat &mask, const oclMat &allDist, int distType) { if (query.cols <= 64) { - calcDistanceUnrolled<16, 64, T>(query, train, mask, allDist, distType); + calcDistanceUnrolled<16, 64>(query, train, mask, allDist, distType); } else if (query.cols <= 128) { - calcDistanceUnrolled<16, 128, T>(query, train, mask, allDist, distType); + calcDistanceUnrolled<16, 128>(query, train, mask, allDist, distType); } - /*else if (query.cols <= 256) - { - calcDistanceUnrolled<16, 256, Dist>(query, train, mask, allDist, stream); - } - else if (query.cols <= 512) - { - calcDistanceUnrolled<16, 512, Dist>(query, train, mask, allDist, stream); - } - else if (query.cols <= 1024) - { - calcDistanceUnrolled<16, 1024, Dist>(query, train, mask, allDist, stream); - }*/ else { - calcDistance<16, T>(query, train, mask, allDist, distType); + calcDistance<16>(query, train, mask, allDist, distType); } } -template < typename T/*, typename Mask*/ > -void match2Dispatcher(const oclMat &query, const oclMat &train, const oclMat &mask, +static void match2Dispatcher(const oclMat &query, const oclMat &train, const oclMat &mask, const oclMat &trainIdx, const oclMat &distance, int distType) { if (query.cols <= 64) { - knn_matchUnrolledCached<16, 64, T>(query, train, mask, trainIdx, distance, distType); + knn_matchUnrolledCached<16, 64>(query, train, mask, trainIdx, distance, distType); } else if (query.cols <= 128) { - knn_matchUnrolledCached<16, 128, T>(query, train, mask, trainIdx, distance, distType); + knn_matchUnrolledCached<16, 128>(query, train, mask, trainIdx, distance, distType); } - /*else if (query.cols <= 256) - { - matchUnrolled<16, 256, Dist>(query, train, mask, static_cast< DevMem2D_ >(trainIdx), static_cast< DevMem2D_ > (distance), stream); - } - else if (query.cols <= 512) - { - matchUnrolled<16, 512, Dist>(query, train, mask, static_cast< DevMem2D_ >(trainIdx), static_cast< DevMem2D_ > (distance), stream); - } - else if (query.cols <= 1024) - { - matchUnrolled<16, 1024, Dist>(query, train, mask, static_cast< DevMem2D_ >(trainIdx), static_cast< DevMem2D_ > (distance), stream); - }*/ else { - knn_match<16, T>(query, train, mask, trainIdx, distance, distType); + knn_match<16>(query, train, mask, trainIdx, distance, distType); } } @@ -685,7 +471,7 @@ void findKnnMatch(int k, const oclMat &trainIdx, const oclMat &distance, const o //args.push_back( std::make_pair( sizeof(cl_int), (void *)&train.cols )); //args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step )); - openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); + openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, trainIdx.depth(), -1); } } @@ -694,206 +480,22 @@ static void findKnnMatchDispatcher(int k, const oclMat &trainIdx, const oclMat & findKnnMatch<256>(k, trainIdx, distance, allDist, distType); } -//with mask -template < typename T/*, typename Mask*/ > -void kmatchDispatcher(const oclMat &query, const oclMat &train, int k, const oclMat &mask, +static void kmatchDispatcher(const oclMat &query, const oclMat &train, int k, const oclMat &mask, const oclMat &trainIdx, const oclMat &distance, const oclMat &allDist, int distType) { + const oclMat zeroMask; + const oclMat &tempMask = mask.data ? mask : zeroMask; if (k == 2) { - match2Dispatcher(query, train, mask, trainIdx, distance, distType); + match2Dispatcher(query, train, tempMask, trainIdx, distance, distType); } else { - calcDistanceDispatcher(query, train, mask, allDist, distType); + calcDistanceDispatcher(query, train, tempMask, allDist, distType); findKnnMatchDispatcher(k, trainIdx, distance, allDist, distType); } } -//without mask -template < typename T/*, typename Mask*/ > -void kmatchDispatcher(const oclMat &query, const oclMat &train, int k, - const oclMat &trainIdx, const oclMat &distance, const oclMat &allDist, int distType) -{ - oclMat mask; - if (k == 2) - { - match2Dispatcher(query, train, mask, trainIdx, distance, distType); - } - else - { - calcDistanceDispatcher(query, train, mask, allDist, distType); - findKnnMatchDispatcher(k, trainIdx, distance, allDist, distType); - } -} - - - -template -void ocl_matchL1_gpu(const oclMat &query, const oclMat &train, const oclMat &mask, - const oclMat &trainIdx, const oclMat &distance) -{ - int distType = 0; - if (mask.data) - { - matchDispatcher(query, train, mask, trainIdx, distance, distType); - } - else - { - matchDispatcher< T >(query, train, trainIdx, distance, distType); - } -} - -template -void ocl_matchL1_gpu(const oclMat &query, const oclMat &trains, const oclMat &masks, - const oclMat &trainIdx, const oclMat &imgIdx, const oclMat &distance) -{ - int distType = 0; - - if (masks.data) - { - matchDispatcher(query, (const oclMat *)trains.ptr(), trains.cols, masks, trainIdx, imgIdx, distance, distType); - } - else - { - matchDispatcher(query, (const oclMat *)trains.ptr(), trains.cols, trainIdx, imgIdx, distance, distType); - } -} - -template -void ocl_matchL2_gpu(const oclMat &query, const oclMat &train, const oclMat &mask, - const oclMat &trainIdx, const oclMat &distance) -{ - int distType = 1; - if (mask.data) - { - matchDispatcher(query, train, mask, trainIdx, distance, distType); - } - else - { - matchDispatcher(query, train, trainIdx, distance, distType); - } -} - -template -void ocl_matchL2_gpu(const oclMat &query, const oclMat &trains, const oclMat &masks, - const oclMat &trainIdx, const oclMat &imgIdx, const oclMat &distance) -{ - int distType = 1; - if (masks.data) - { - matchDispatcher(query, (const oclMat *)trains.ptr(), trains.cols, masks, trainIdx, imgIdx, distance, distType); - } - else - { - matchDispatcher(query, (const oclMat *)trains.ptr(), trains.cols, trainIdx, imgIdx, distance, distType); - } -} - -template -void ocl_matchHamming_gpu(const oclMat &query, const oclMat &train, const oclMat &mask, - const oclMat &trainIdx, const oclMat &distance) -{ - int distType = 2; - if (mask.data) - { - matchDispatcher(query, train, mask, trainIdx, distance, distType); - } - else - { - matchDispatcher< T >(query, train, trainIdx, distance, distType); - } -} - -template -void ocl_matchHamming_gpu(const oclMat &query, const oclMat &trains, const oclMat &masks, - const oclMat &trainIdx, const oclMat &imgIdx, const oclMat &distance) -{ - int distType = 2; - if (masks.data) - { - matchDispatcher(query, (const oclMat *)trains.ptr(), trains.cols, masks, trainIdx, imgIdx, distance, distType); - } - else - { - matchDispatcher(query, (const oclMat *)trains.ptr(), trains.cols, trainIdx, imgIdx, distance, distType); - } -} - -// knn caller -template -void ocl_matchL1_gpu(const oclMat &query, const oclMat &train, int k, const oclMat &mask, - const oclMat &trainIdx, const oclMat &distance, const oclMat &allDist) -{ - int distType = 0; - - if (mask.data) - kmatchDispatcher(query, train, k, mask, trainIdx, distance, allDist, distType); - else - kmatchDispatcher(query, train, k, trainIdx, distance, allDist, distType); -} - -template -void ocl_matchL2_gpu(const oclMat &query, const oclMat &train, int k, const oclMat &mask, - const oclMat &trainIdx, const oclMat &distance, const oclMat &allDist) -{ - int distType = 1; - - if (mask.data) - kmatchDispatcher(query, train, k, mask, trainIdx, distance, allDist, distType); - else - kmatchDispatcher(query, train, k, trainIdx, distance, allDist, distType); -} - -template -void ocl_matchHamming_gpu(const oclMat &query, const oclMat &train, int k, const oclMat &mask, - const oclMat &trainIdx, const oclMat &distance, const oclMat &allDist) -{ - int distType = 2; - - if (mask.data) - kmatchDispatcher(query, train, k, mask, trainIdx, distance, allDist, distType); - else - kmatchDispatcher(query, train, k, trainIdx, distance, allDist, distType); -} - -//radius caller -template -void ocl_matchL1_gpu(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &mask, - const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches) -{ - int distType = 0; - - if (mask.data) - matchDispatcher(query, train, maxDistance, mask, trainIdx, distance, nMatches, distType); - else - matchDispatcher(query, train, maxDistance, trainIdx, distance, nMatches, distType); -} - -template -void ocl_matchL2_gpu(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &mask, - const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches) -{ - int distType = 1; - - if (mask.data) - matchDispatcher(query, train, maxDistance, mask, trainIdx, distance, nMatches, distType); - else - matchDispatcher(query, train, maxDistance, trainIdx, distance, nMatches, distType); -} - -template -void ocl_matchHamming_gpu(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &mask, - const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches) -{ - int distType = 2; - - if (mask.data) - matchDispatcher(query, train, maxDistance, mask, trainIdx, distance, nMatches, distType); - else - matchDispatcher(query, train, maxDistance, trainIdx, distance, nMatches, distType); -} - cv::ocl::BruteForceMatcher_OCL_base::BruteForceMatcher_OCL_base(DistType distType_) : distType(distType_) { } @@ -929,37 +531,27 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchSingle(const oclMat &query, const if (query.empty() || train.empty()) return; - typedef void (*caller_t)(const oclMat & query, const oclMat & train, const oclMat & mask, - const oclMat & trainIdx, const oclMat & distance); + // match1 doesn't support signed char type, match2 only support float, hamming support uchar, ushort and int + int callType = query.depth(); + char cvFuncName[] = "singleMatch"; + if (callType != 5) + CV_ERROR(CV_UNSUPPORTED_FORMAT_ERR, "BruteForceMatch OpenCL only support float type query!\n"); - static const caller_t callers[3][6] = + if ((distType == 0 && callType == 1 ) || (distType == 1 && callType != 5) || (distType == 2 && (callType != 0 + || callType != 2 || callType != 4))) { - { - ocl_matchL1_gpu, 0/*ocl_matchL1_gpu*/, - ocl_matchL1_gpu, ocl_matchL1_gpu, - ocl_matchL1_gpu, ocl_matchL1_gpu - }, - { - 0/*ocl_matchL2_gpu*/, 0/*ocl_matchL2_gpu*/, - 0/*ocl_matchL2_gpu*/, 0/*ocl_matchL2_gpu*/, - 0/*ocl_matchL2_gpu*/, ocl_matchL2_gpu - }, - { - ocl_matchHamming_gpu, 0/*ocl_matchHamming_gpu*/, - ocl_matchHamming_gpu, 0/*ocl_matchHamming_gpu*/, - ocl_matchHamming_gpu, 0/*ocl_matchHamming_gpu*/ - } - }; + CV_ERROR(CV_UNSUPPORTED_DEPTH_ERR, "BruteForceMatch OpenCL only support float type query!\n"); + } CV_Assert(query.channels() == 1 && query.depth() < CV_64F); CV_Assert(train.cols == query.cols && train.type() == query.type()); - const int nQuery = query.rows; - trainIdx.create(1, nQuery, CV_32S); - distance.create(1, nQuery, CV_32F); + trainIdx.create(1, query.rows, CV_32S); + distance.create(1, query.rows, CV_32F); - caller_t func = callers[distType][query.depth()]; - func(query, train, mask, trainIdx, distance); + matchDispatcher(query, train, mask, trainIdx, distance, distType); +exit: + return; } void cv::ocl::BruteForceMatcher_OCL_base::matchDownload(const oclMat &trainIdx, const oclMat &distance, std::vector &matches) @@ -1061,40 +653,27 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchCollection(const oclMat &query, c if (query.empty() || trainCollection.empty()) return; - typedef void (*caller_t)(const oclMat & query, const oclMat & trains, const oclMat & masks, - const oclMat & trainIdx, const oclMat & imgIdx, const oclMat & distance); + // match1 doesn't support signed char type, match2 only support float, hamming support uchar, ushort and int + int callType = query.depth(); + char cvFuncName[] = "matchCollection"; + if (callType != 5) + CV_ERROR(CV_UNSUPPORTED_FORMAT_ERR, "BruteForceMatch OpenCL only support float type query!\n"); - static const caller_t callers[3][6] = + if ((distType == 0 && callType == 1 ) || (distType == 1 && callType != 5) || (distType == 2 && (callType != 0 + || callType != 2 || callType != 4))) { - { - ocl_matchL1_gpu, 0/*matchL1_gpu*/, - ocl_matchL1_gpu, ocl_matchL1_gpu, - ocl_matchL1_gpu, ocl_matchL1_gpu - }, - { - 0/*matchL2_gpu*/, 0/*matchL2_gpu*/, - 0/*matchL2_gpu*/, 0/*matchL2_gpu*/, - 0/*matchL2_gpu*/, ocl_matchL2_gpu - }, - { - ocl_matchHamming_gpu, 0/*matchHamming_gpu*/, - ocl_matchHamming_gpu, 0/*matchHamming_gpu*/, - ocl_matchHamming_gpu, 0/*matchHamming_gpu*/ - } - }; + CV_ERROR(CV_UNSUPPORTED_DEPTH_ERR, "BruteForceMatch OpenCL only support float type query!\n"); + } CV_Assert(query.channels() == 1 && query.depth() < CV_64F); - const int nQuery = query.rows; + trainIdx.create(1, query.rows, CV_32S); + imgIdx.create(1, query.rows, CV_32S); + distance.create(1, query.rows, CV_32F); - trainIdx.create(1, nQuery, CV_32S); - imgIdx.create(1, nQuery, CV_32S); - distance.create(1, nQuery, CV_32F); - - caller_t func = callers[distType][query.depth()]; - CV_Assert(func != 0); - - func(query, trainCollection, masks, trainIdx, imgIdx, distance); + matchDispatcher(query, (const oclMat *)trainCollection.ptr(), trainCollection.cols, masks, trainIdx, imgIdx, distance, distType); +exit: + return; } void cv::ocl::BruteForceMatcher_OCL_base::matchDownload(const oclMat &trainIdx, const oclMat &imgIdx, const oclMat &distance, std::vector &matches) @@ -1163,52 +742,39 @@ void cv::ocl::BruteForceMatcher_OCL_base::knnMatchSingle(const oclMat &query, co if (query.empty() || train.empty()) return; - typedef void (*caller_t)(const oclMat & query, const oclMat & train, int k, const oclMat & mask, - const oclMat & trainIdx, const oclMat & distance, const oclMat & allDist); + // match1 doesn't support signed char type, match2 only support float, hamming support uchar, ushort and int + int callType = query.depth(); - static const caller_t callers[3][6] = + char cvFuncName[] = "knnMatchSingle"; + if (callType != 5) + CV_ERROR(CV_UNSUPPORTED_FORMAT_ERR, "BruteForceMatch OpenCL only support float type query!\n"); + + if ((distType == 0 && callType == 1 ) || (distType == 1 && callType != 5) || (distType == 2 && (callType != 0 + || callType != 2 || callType != 4))) { - { - ocl_matchL1_gpu, 0/*ocl_matchL1_gpu*/, - ocl_matchL1_gpu, ocl_matchL1_gpu, - ocl_matchL1_gpu, ocl_matchL1_gpu - }, - { - 0/*ocl_matchL2_gpu*/, 0/*ocl_matchL2_gpu*/, - 0/*ocl_matchL2_gpu*/, 0/*ocl_matchL2_gpu*/, - 0/*ocl_matchL2_gpu*/, ocl_matchL2_gpu - }, - { - ocl_matchHamming_gpu, 0/*ocl_matchHamming_gpu*/, - ocl_matchHamming_gpu, 0/*ocl_matchHamming_gpu*/, - ocl_matchHamming_gpu, 0/*ocl_matchHamming_gpu*/ - } - }; + CV_ERROR(CV_UNSUPPORTED_DEPTH_ERR, "BruteForceMatch OpenCL only support float type query!\n"); + } CV_Assert(query.channels() == 1 && query.depth() < CV_64F); CV_Assert(train.type() == query.type() && train.cols == query.cols); - const int nQuery = query.rows; - const int nTrain = train.rows; - if (k == 2) { - trainIdx.create(1, nQuery, CV_32SC2); - distance.create(1, nQuery, CV_32FC2); + trainIdx.create(1, query.rows, CV_32SC2); + distance.create(1, query.rows, CV_32FC2); } else { - trainIdx.create(nQuery, k, CV_32S); - distance.create(nQuery, k, CV_32F); - allDist.create(nQuery, nTrain, CV_32FC1); + trainIdx.create(query.rows, k, CV_32S); + distance.create(query.rows, k, CV_32F); + allDist.create(query.rows, train.rows, CV_32FC1); } trainIdx.setTo(Scalar::all(-1)); - caller_t func = callers[distType][query.depth()]; - CV_Assert(func != 0); - - func(query, train, k, mask, trainIdx, distance, allDist); + kmatchDispatcher(query, train, k, mask, trainIdx, distance, allDist, distType); +exit: + return; } void cv::ocl::BruteForceMatcher_OCL_base::knnMatchDownload(const oclMat &trainIdx, const oclMat &distance, std::vector< std::vector > &matches, bool compactResult) @@ -1393,8 +959,6 @@ namespace void cv::ocl::BruteForceMatcher_OCL_base::knnMatch(const oclMat &query, std::vector< std::vector > &matches, int k, const std::vector &masks, bool compactResult) { - - if (k == 2) { oclMat trainCollection; @@ -1454,50 +1018,34 @@ void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchSingle(const oclMat &query, if (query.empty() || train.empty()) return; - typedef void (*caller_t)(const oclMat & query, const oclMat & train, float maxDistance, const oclMat & mask, - const oclMat & trainIdx, const oclMat & distance, const oclMat & nMatches); + // match1 doesn't support signed char type, match2 only support float, hamming support uchar, ushort and int + int callType = query.depth(); + char cvFuncName[] = "radiusMatchSingle"; + if (callType != 5) + CV_ERROR(CV_UNSUPPORTED_FORMAT_ERR, "BruteForceMatch OpenCL only support float type query!\n"); - //#if 0 - static const caller_t callers[3][6] = + if ((distType == 0 && callType == 1 ) || (distType == 1 && callType != 5) || (distType == 2 && (callType != 0 + || callType != 2 || callType != 4))) { - { - ocl_matchL1_gpu, 0/*ocl_matchL1_gpu*/, - ocl_matchL1_gpu, ocl_matchL1_gpu, - ocl_matchL1_gpu, ocl_matchL1_gpu - }, - { - 0/*ocl_matchL2_gpu*/, 0/*ocl_matchL2_gpu*/, - 0/*ocl_matchL2_gpu*/, 0/*ocl_matchL2_gpu*/, - 0/*ocl_matchL2_gpu*/, ocl_matchL2_gpu - }, - { - ocl_matchHamming_gpu, 0/*ocl_matchHamming_gpu*/, - ocl_matchHamming_gpu, 0/*ocl_matchHamming_gpu*/, - ocl_matchHamming_gpu, 0/*ocl_matchHamming_gpu*/ - } - }; - //#endif - - const int nQuery = query.rows; - const int nTrain = train.rows; + CV_ERROR(CV_UNSUPPORTED_DEPTH_ERR, "BruteForceMatch OpenCL only support float type query!\n"); + } CV_Assert(query.channels() == 1 && query.depth() < CV_64F); CV_Assert(train.type() == query.type() && train.cols == query.cols); - CV_Assert(trainIdx.empty() || (trainIdx.rows == nQuery && trainIdx.size() == distance.size())); + CV_Assert(trainIdx.empty() || (trainIdx.rows == query.rows && trainIdx.size() == distance.size())); - nMatches.create(1, nQuery, CV_32SC1); + nMatches.create(1, query.rows, CV_32SC1); if (trainIdx.empty()) { - trainIdx.create(nQuery, std::max((nTrain / 100), 10), CV_32SC1); - distance.create(nQuery, std::max((nTrain / 100), 10), CV_32FC1); + trainIdx.create(query.rows, std::max((train.rows/ 100), 10), CV_32SC1); + distance.create(query.rows, std::max((train.rows/ 100), 10), CV_32FC1); } nMatches.setTo(Scalar::all(0)); - caller_t func = callers[distType][query.depth()]; - //CV_Assert(func != 0); - //func(query, train, maxDistance, mask, trainIdx, distance, nMatches, cc, StreamAccessor::getStream(stream)); - func(query, train, maxDistance, mask, trainIdx, distance, nMatches); + matchDispatcher(query, train, maxDistance, mask, trainIdx, distance, nMatches, distType); +exit: + return; } void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchDownload(const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches, diff --git a/modules/ocl/src/canny.cpp b/modules/ocl/src/canny.cpp index 2177ac1e6f..9381416950 100644 --- a/modules/ocl/src/canny.cpp +++ b/modules/ocl/src/canny.cpp @@ -97,7 +97,7 @@ void cv::ocl::CannyBuf::create(const Size &image_size, int apperture_size) { openCLFree(counter); } - counter = clCreateBuffer( (cl_context)getoclContext(), CL_MEM_COPY_HOST_PTR, sizeof(int), counter_i, &err ); + counter = clCreateBuffer( *((cl_context*)getoclContext()), CL_MEM_COPY_HOST_PTR, sizeof(int), counter_i, &err ); openCLSafeCall(err); } @@ -353,7 +353,7 @@ void canny::edgesHysteresisLocal_gpu(oclMat &map, oclMat &st1, void *counter, in void canny::edgesHysteresisGlobal_gpu(oclMat &map, oclMat &st1, oclMat &st2, void *counter, int rows, int cols) { unsigned int count; - openCLSafeCall(clEnqueueReadBuffer((cl_command_queue)getoclCommandQueue(), (cl_mem)counter, 1, 0, sizeof(float), &count, 0, NULL, NULL)); + openCLSafeCall(clEnqueueReadBuffer(*(cl_command_queue*)getoclCommandQueue(), (cl_mem)counter, 1, 0, sizeof(float), &count, 0, NULL, NULL)); Context *clCxt = map.clCxt; String kernelName = "edgesHysteresisGlobal"; std::vector< std::pair > args; @@ -363,7 +363,7 @@ void canny::edgesHysteresisGlobal_gpu(oclMat &map, oclMat &st1, oclMat &st2, voi int count_i[1] = {0}; while(count > 0) { - openCLSafeCall(clEnqueueWriteBuffer((cl_command_queue)getoclCommandQueue(), (cl_mem)counter, 1, 0, sizeof(int), &count_i, 0, NULL, NULL)); + openCLSafeCall(clEnqueueWriteBuffer(*(cl_command_queue*)getoclCommandQueue(), (cl_mem)counter, 1, 0, sizeof(int), &count_i, 0, NULL, NULL)); args.clear(); size_t globalThreads[3] = {std::min(count, 65535u) * 128, DIVUP(count, 65535), 1}; @@ -378,7 +378,7 @@ void canny::edgesHysteresisGlobal_gpu(oclMat &map, oclMat &st1, oclMat &st2, voi args.push_back( std::make_pair( sizeof(cl_int), (void *)&map.offset)); openCLExecuteKernel2(clCxt, &imgproc_canny, kernelName, globalThreads, localThreads, args, -1, -1, DISABLE); - openCLSafeCall(clEnqueueReadBuffer((cl_command_queue)getoclCommandQueue(), (cl_mem)counter, 1, 0, sizeof(int), &count, 0, NULL, NULL)); + openCLSafeCall(clEnqueueReadBuffer(*(cl_command_queue*)getoclCommandQueue(), (cl_mem)counter, 1, 0, sizeof(int), &count, 0, NULL, NULL)); std::swap(st1, st2); } #undef DIVUP diff --git a/modules/ocl/src/haar.cpp b/modules/ocl/src/haar.cpp index 6b8016a76b..181dc73590 100644 --- a/modules/ocl/src/haar.cpp +++ b/modules/ocl/src/haar.cpp @@ -950,8 +950,8 @@ CvSeq *cv::ocl::OclCascadeClassifier::oclHaarDetectObjects( oclMat &gimg, CvMemS //int flag = 0; oclMat gimg1(gimg.rows, gimg.cols, CV_8UC1); - oclMat gsum(totalheight, gimg.cols + 1, CV_32SC1); - oclMat gsqsum(totalheight, gimg.cols + 1, CV_32FC1); + oclMat gsum(totalheight + 4, gimg.cols + 1, CV_32SC1); + oclMat gsqsum(totalheight + 4, gimg.cols + 1, CV_32FC1); //cl_mem cascadebuffer; cl_mem stagebuffer; diff --git a/modules/ocl/src/initialization.cpp b/modules/ocl/src/initialization.cpp index 36f6869cc9..c89a3a2184 100644 --- a/modules/ocl/src/initialization.cpp +++ b/modules/ocl/src/initialization.cpp @@ -350,6 +350,51 @@ namespace cv { return &(Context::getContext()->impl->clCmdQueue); } + + void queryDeviceInfo(DEVICE_INFO info_type, void* info) + { + static Info::Impl* impl = Context::getContext()->impl; + switch(info_type) + { + case WAVEFRONT_SIZE: + { +#ifdef CL_DEVICE_WAVEFRONT_WIDTH_AMD + try + { + openCLSafeCall(clGetDeviceInfo(Context::getContext()->impl->devices[0], + CL_DEVICE_WAVEFRONT_WIDTH_AMD, sizeof(size_t), info, 0)); + } + catch(const cv::Exception&) +#elif defined (CL_DEVICE_WARP_SIZE_NV) + const int EXT_LEN = 4096 + 1 ; + char extends_set[EXT_LEN]; + size_t extends_size; + openCLSafeCall(clGetDeviceInfo(impl->devices[impl->devnum], CL_DEVICE_EXTENSIONS, EXT_LEN, (void *)extends_set, &extends_size)); + extends_set[EXT_LEN - 1] = 0; + if(std::string(extends_set).find("cl_nv_device_attribute_query") != std::string::npos) + { + openCLSafeCall(clGetDeviceInfo(Context::getContext()->impl->devices[0], + CL_DEVICE_WARP_SIZE_NV, sizeof(size_t), info, 0)); + } + else +#endif + { + // if no way left for us to query the warp size, we can get it from kernel group info + static const char * _kernel_string = "__kernel void test_func() {}"; + cl_kernel kernel; + kernel = openCLGetKernelFromSource(Context::getContext(), &_kernel_string, "test_func"); + openCLSafeCall(clGetKernelWorkGroupInfo(kernel, impl->devices[impl->devnum], + CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, sizeof(size_t), info, NULL)); + } + + } + break; + default: + CV_Error(-1, "Invalid device info type"); + break; + } + } + void openCLReadBuffer(Context *clCxt, cl_mem dst_buffer, void *host_buffer, size_t size) { cl_int status; diff --git a/modules/ocl/src/match_template.cpp b/modules/ocl/src/match_template.cpp index 8eba678e1c..40c5443011 100644 --- a/modules/ocl/src/match_template.cpp +++ b/modules/ocl/src/match_template.cpp @@ -70,6 +70,9 @@ namespace cv void matchTemplate_SQDIFF_NORMED( const oclMat &image, const oclMat &templ, oclMat &result, MatchTemplateBuf &buf); + void convolve_32F( + const oclMat &image, const oclMat &templ, oclMat &result, MatchTemplateBuf &buf); + void matchTemplate_CCORR( const oclMat &image, const oclMat &templ, oclMat &result, MatchTemplateBuf &buf); @@ -89,41 +92,65 @@ namespace cv void matchTemplateNaive_CCORR( const oclMat &image, const oclMat &templ, oclMat &result, int cn); + void extractFirstChannel_32F( + const oclMat &image, oclMat &result); + // Evaluates optimal template's area threshold. If // template's area is less than the threshold, we use naive match // template version, otherwise FFT-based (if available) - static int getTemplateThreshold(int method, int depth) + static bool useNaive(int , int , Size ) { - switch (method) - { - case CV_TM_CCORR: - if (depth == CV_32F) return 250; - if (depth == CV_8U) return 300; - break; - case CV_TM_SQDIFF: - if (depth == CV_32F) return 0x7fffffff; // do naive SQDIFF for CV_32F - if (depth == CV_8U) return 300; - break; - } - CV_Error(CV_StsBadArg, "getTemplateThreshold: unsupported match template mode"); - return 0; + // FIXME! + // always use naive until convolve is imported + return true; } ////////////////////////////////////////////////////////////////////// // SQDIFF void matchTemplate_SQDIFF( - const oclMat &image, const oclMat &templ, oclMat &result, MatchTemplateBuf &) + const oclMat &image, const oclMat &templ, oclMat &result, MatchTemplateBuf & buf) { result.create(image.rows - templ.rows + 1, image.cols - templ.cols + 1, CV_32F); - if (templ.size().area() < getTemplateThreshold(CV_TM_SQDIFF, image.depth())) + if (useNaive(CV_TM_SQDIFF, image.depth(), templ.size())) { matchTemplateNaive_SQDIFF(image, templ, result, image.oclchannels()); return; } else { - // TODO - CV_Error(CV_StsBadArg, "Not supported yet for this size template"); + buf.image_sqsums.resize(1); + + // TODO, add double support for ocl::integral + // use CPU integral temporarily + Mat sums, sqsums; + cv::integral(Mat(image.reshape(1)), sums, sqsums); + buf.image_sqsums[0] = sqsums; + + unsigned long long templ_sqsum = (unsigned long long)sqrSum(templ.reshape(1))[0]; + matchTemplate_CCORR(image, templ, result, buf); + + //port CUDA's matchTemplatePrepared_SQDIFF_8U + Context *clCxt = image.clCxt; + String kernelName = "matchTemplate_Prepared_SQDIFF"; + std::vector< std::pair > args; + + args.push_back( std::make_pair( sizeof(cl_mem), (void *)&buf.image_sqsums[0].data)); + args.push_back( std::make_pair( sizeof(cl_mem), (void *)&result.data)); + args.push_back( std::make_pair( sizeof(cl_ulong), (void *)&templ_sqsum)); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.rows)); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.cols)); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&templ.rows)); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&templ.cols)); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&buf.image_sqsums[0].offset)); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&buf.image_sqsums[0].step)); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.offset)); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.step)); + + size_t globalThreads[3] = {result.cols, result.rows, 1}; + size_t localThreads[3] = {16, 16, 1}; + + const char * build_opt = image.oclchannels() == 4 ? "-D CN4" : ""; + openCLExecuteKernel(clCxt, &match_template, kernelName, globalThreads, localThreads, args, 1, CV_8U, build_opt); } } @@ -133,7 +160,6 @@ namespace cv matchTemplate_CCORR(image, templ, result, buf); buf.image_sums.resize(1); - integral(image.reshape(1), buf.image_sums[0]); unsigned long long templ_sqsum = (unsigned long long)sqrSum(templ.reshape(1))[0]; @@ -155,7 +181,7 @@ namespace cv args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.step)); size_t globalThreads[3] = {result.cols, result.rows, 1}; - size_t localThreads[3] = {32, 8, 1}; + size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &match_template, kernelName, globalThreads, localThreads, args, 1, CV_8U); } @@ -190,33 +216,39 @@ namespace cv args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.step)); size_t globalThreads[3] = {result.cols, result.rows, 1}; - size_t localThreads[3] = {32, 8, 1}; + size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &match_template, kernelName, globalThreads, localThreads, args, image.oclchannels(), image.depth()); } ////////////////////////////////////////////////////////////////////// // CCORR + void convolve_32F( + const oclMat &, const oclMat &, oclMat &, MatchTemplateBuf &) + { + CV_Error(-1, "convolve is not fully implemented yet"); + } + void matchTemplate_CCORR( const oclMat &image, const oclMat &templ, oclMat &result, MatchTemplateBuf &buf) { result.create(image.rows - templ.rows + 1, image.cols - templ.cols + 1, CV_32F); - if (templ.size().area() < getTemplateThreshold(CV_TM_SQDIFF, image.depth())) + if (useNaive(CV_TM_CCORR, image.depth(), templ.size())) { matchTemplateNaive_CCORR(image, templ, result, image.oclchannels()); return; } else { - CV_Error(CV_StsBadArg, "Not supported yet for this size template"); if(image.depth() == CV_8U && templ.depth() == CV_8U) { image.convertTo(buf.imagef, CV_32F); templ.convertTo(buf.templf, CV_32F); + convolve_32F(buf.imagef, buf.templf, result, buf); + } + else + { + convolve_32F(image, templ, result, buf); } - CV_Assert(image.oclchannels() == 1); - oclMat o_result(image.size(), CV_MAKETYPE(CV_32F, image.oclchannels())); - filter2D(buf.imagef, o_result, CV_32F, buf.templf, Point(0, 0)); - result = o_result(Rect(0, 0, image.rows - templ.rows + 1, image.cols - templ.cols + 1)); } } @@ -248,7 +280,7 @@ namespace cv args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.step)); size_t globalThreads[3] = {result.cols, result.rows, 1}; - size_t localThreads[3] = {32, 8, 1}; + size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &match_template, kernelName, globalThreads, localThreads, args, 1, CV_8U); } @@ -283,7 +315,7 @@ namespace cv args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.step)); size_t globalThreads[3] = {result.cols, result.rows, 1}; - size_t localThreads[3] = {32, 8, 1}; + size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &match_template, kernelName, globalThreads, localThreads, args, image.oclchannels(), image.depth()); } ////////////////////////////////////////////////////////////////////// @@ -300,7 +332,7 @@ namespace cv kernelName = "matchTemplate_Prepared_CCOFF"; size_t globalThreads[3] = {result.cols, result.rows, 1}; - size_t localThreads[3] = {32, 8, 1}; + size_t localThreads[3] = {16, 16, 1}; std::vector< std::pair > args; args.push_back( std::make_pair( sizeof(cl_mem), (void *)&result.data) ); @@ -312,22 +344,22 @@ namespace cv args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.cols) ); args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.offset)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.step)); + Vec4f templ_sum = Vec4f::all(0); // to be continued in the following section if(image.oclchannels() == 1) { buf.image_sums.resize(1); integral(image, buf.image_sums[0]); - float templ_sum = 0; - templ_sum = (float)sum(templ)[0] / templ.size().area(); + templ_sum[0] = (float)sum(templ)[0] / templ.size().area(); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&buf.image_sums[0].data) ); args.push_back( std::make_pair( sizeof(cl_int), (void *)&buf.image_sums[0].offset) ); args.push_back( std::make_pair( sizeof(cl_int), (void *)&buf.image_sums[0].step) ); - args.push_back( std::make_pair( sizeof(cl_float), (void *)&templ_sum) ); + args.push_back( std::make_pair( sizeof(cl_float), (void *)&templ_sum[0]) ); } else { - Vec4f templ_sum = Vec4f::all(0); + split(image, buf.images); templ_sum = sum(templ) / templ.size().area(); buf.image_sums.resize(buf.images.size()); @@ -373,7 +405,7 @@ namespace cv kernelName = "matchTemplate_Prepared_CCOFF_NORMED"; size_t globalThreads[3] = {result.cols, result.rows, 1}; - size_t localThreads[3] = {32, 8, 1}; + size_t localThreads[3] = {16, 16, 1}; std::vector< std::pair > args; args.push_back( std::make_pair( sizeof(cl_mem), (void *)&result.data) ); @@ -386,20 +418,22 @@ namespace cv args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.offset)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.step)); args.push_back( std::make_pair( sizeof(cl_float), (void *)&scale) ); + + Vec4f templ_sum = Vec4f::all(0); + Vec4f templ_sqsum = Vec4f::all(0); // to be continued in the following section if(image.oclchannels() == 1) { buf.image_sums.resize(1); buf.image_sqsums.resize(1); integral(image, buf.image_sums[0], buf.image_sqsums[0]); - float templ_sum = 0; - float templ_sqsum = 0; - templ_sum = (float)sum(templ)[0]; - templ_sqsum = sqrSum(templ)[0]; + templ_sum[0] = (float)sum(templ)[0]; - templ_sqsum -= scale * templ_sum * templ_sum; - templ_sum *= scale; + templ_sqsum[0] = sqrSum(templ)[0]; + + templ_sqsum[0] -= scale * templ_sum[0] * templ_sum[0]; + templ_sum[0] *= scale; args.push_back( std::make_pair( sizeof(cl_mem), (void *)&buf.image_sums[0].data) ); args.push_back( std::make_pair( sizeof(cl_int), (void *)&buf.image_sums[0].offset) ); @@ -407,13 +441,11 @@ namespace cv args.push_back( std::make_pair( sizeof(cl_mem), (void *)&buf.image_sqsums[0].data) ); args.push_back( std::make_pair( sizeof(cl_int), (void *)&buf.image_sqsums[0].offset) ); args.push_back( std::make_pair( sizeof(cl_int), (void *)&buf.image_sqsums[0].step) ); - args.push_back( std::make_pair( sizeof(cl_float), (void *)&templ_sum) ); - args.push_back( std::make_pair( sizeof(cl_float), (void *)&templ_sqsum) ); + args.push_back( std::make_pair( sizeof(cl_float), (void *)&templ_sum[0]) ); + args.push_back( std::make_pair( sizeof(cl_float), (void *)&templ_sqsum[0]) ); } else { - Vec4f templ_sum = Vec4f::all(0); - Vec4f templ_sqsum = Vec4f::all(0); split(image, buf.images); templ_sum = sum(templ); @@ -464,7 +496,27 @@ namespace cv } openCLExecuteKernel(clCxt, &match_template, kernelName, globalThreads, localThreads, args, image.oclchannels(), image.depth()); } + void extractFirstChannel_32F(const oclMat &image, oclMat &result) + { + Context *clCxt = image.clCxt; + String kernelName; + kernelName = "extractFirstChannel"; + size_t globalThreads[3] = {result.cols, result.rows, 1}; + size_t localThreads[3] = {16, 16, 1}; + + std::vector< std::pair > args; + args.push_back( std::make_pair( sizeof(cl_mem), (void *)&image.data) ); + args.push_back( std::make_pair( sizeof(cl_mem), (void *)&result.data) ); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.rows) ); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.cols) ); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&image.offset)); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.offset)); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&image.step)); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&result.step)); + + openCLExecuteKernel(clCxt, &match_template, kernelName, globalThreads, localThreads, args, -1, -1); + } }/*ocl*/ } /*cv*/ diff --git a/modules/ocl/src/moments.cpp b/modules/ocl/src/moments.cpp index d7df6fd558..68fe3ce098 100644 --- a/modules/ocl/src/moments.cpp +++ b/modules/ocl/src/moments.cpp @@ -277,16 +277,7 @@ static void ocl_cvMoments( const void* array, CvMoments* mom, int binary ) blocky = size.height/TILE_SIZE; else blocky = size.height/TILE_SIZE + 1; - cv::ocl::oclMat dst_m00(blocky, blockx, CV_64FC1); - cv::ocl::oclMat dst_m10(blocky, blockx, CV_64FC1); - cv::ocl::oclMat dst_m01(blocky, blockx, CV_64FC1); - cv::ocl::oclMat dst_m20(blocky, blockx, CV_64FC1); - cv::ocl::oclMat dst_m11(blocky, blockx, CV_64FC1); - cv::ocl::oclMat dst_m02(blocky, blockx, CV_64FC1); - cv::ocl::oclMat dst_m30(blocky, blockx, CV_64FC1); - cv::ocl::oclMat dst_m21(blocky, blockx, CV_64FC1); - cv::ocl::oclMat dst_m12(blocky, blockx, CV_64FC1); - cv::ocl::oclMat dst_m03(blocky, blockx, CV_64FC1); + cv::ocl::oclMat dst_m(blocky * 10, blockx, CV_64FC1); cl_mem sum = openCLCreateBuffer(src.clCxt,CL_MEM_READ_WRITE,10*sizeof(double)); int tile_width = std::min(size.width,TILE_SIZE); int tile_height = std::min(size.height,TILE_SIZE); @@ -299,25 +290,17 @@ static void ocl_cvMoments( const void* array, CvMoments* mom, int binary ) args.push_back( std::make_pair( sizeof(cl_int) , (void *)&src.step )); args.push_back( std::make_pair( sizeof(cl_int) , (void *)&tileSize.width )); args.push_back( std::make_pair( sizeof(cl_int) , (void *)&tileSize.height )); - args.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m00.data )); - args.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m10.data )); - args.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m01.data )); - args.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m20.data )); - args.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m11.data )); - args.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m02.data )); - args.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m30.data )); - args.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m21.data )); - args.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m12.data )); - args.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m03.data )); - args.push_back( std::make_pair( sizeof(cl_int) , (void *)&dst_m00.cols )); - args.push_back( std::make_pair( sizeof(cl_int) , (void *)&dst_m00.step )); + args.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m.data )); + args.push_back( std::make_pair( sizeof(cl_int) , (void *)&dst_m.cols )); + args.push_back( std::make_pair( sizeof(cl_int) , (void *)&dst_m.step )); + args.push_back( std::make_pair( sizeof(cl_int) , (void *)&blocky )); args.push_back( std::make_pair( sizeof(cl_int) , (void *)&type )); args.push_back( std::make_pair( sizeof(cl_int) , (void *)&depth )); args.push_back( std::make_pair( sizeof(cl_int) , (void *)&cn )); args.push_back( std::make_pair( sizeof(cl_int) , (void *)&coi )); args.push_back( std::make_pair( sizeof(cl_int) , (void *)&binary )); args.push_back( std::make_pair( sizeof(cl_int) , (void *)&TILE_SIZE )); - openCLExecuteKernel(dst_m00.clCxt, &moments, "CvMoments", globalThreads, localThreads, args, -1, depth); + openCLExecuteKernel(dst_m.clCxt, &moments, "CvMoments", globalThreads, localThreads, args, -1, depth); size_t localThreadss[3] = { 128, 1, 1}; size_t globalThreadss[3] = { 128, 1, 1}; @@ -327,20 +310,12 @@ static void ocl_cvMoments( const void* array, CvMoments* mom, int binary ) args_sum.push_back( std::make_pair( sizeof(cl_int) , (void *)&tile_width )); args_sum.push_back( std::make_pair( sizeof(cl_int) , (void *)&TILE_SIZE )); args_sum.push_back( std::make_pair( sizeof(cl_mem) , (void *)&sum )); - args_sum.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m00.data )); - args_sum.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m10.data )); - args_sum.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m01.data )); - args_sum.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m20.data )); - args_sum.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m11.data )); - args_sum.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m02.data )); - args_sum.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m30.data )); - args_sum.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m21.data )); - args_sum.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m12.data )); - args_sum.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m03.data )); - openCLExecuteKernel(dst_m00.clCxt, &moments, "dst_sum", globalThreadss, localThreadss, args_sum, -1, -1); + args_sum.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst_m.data )); + args_sum.push_back( std::make_pair( sizeof(cl_int) , (void *)&dst_m.step )); + openCLExecuteKernel(dst_m.clCxt, &moments, "dst_sum", globalThreadss, localThreadss, args_sum, -1, -1); double* dstsum = new double[10]; memset(dstsum,0,10*sizeof(double)); - openCLReadBuffer(dst_m00.clCxt,sum,(void *)dstsum,10*sizeof(double)); + openCLReadBuffer(dst_m.clCxt,sum,(void *)dstsum,10*sizeof(double)); mom->m00 = dstsum[0]; mom->m10 = dstsum[1]; mom->m01 = dstsum[2]; @@ -351,6 +326,7 @@ static void ocl_cvMoments( const void* array, CvMoments* mom, int binary ) mom->m21 = dstsum[7]; mom->m12 = dstsum[8]; mom->m03 = dstsum[9]; + delete [] dstsum; icvCompleteMomentState( mom ); } diff --git a/modules/ocl/src/opencl/brute_force_match.cl b/modules/ocl/src/opencl/brute_force_match.cl index 0730ac5ac7..e76fb1d21e 100644 --- a/modules/ocl/src/opencl/brute_force_match.cl +++ b/modules/ocl/src/opencl/brute_force_match.cl @@ -5,19 +5,93 @@ int bit1Count(float x) { int c = 0; int ix = (int)x; - for (int i = 0 ; i < 32 ; i++) { c += ix & 0x1; ix >>= 1; } - return (float)c; } + +float reduce_block(__local float *s_query, + __local float *s_train, + int block_size, + int lidx, + int lidy, + int distType + ) +{ + /* there are threee types in the reducer. the first is L1Dist, which to sum the abs(v1, v2), the second is L2Dist, which to + sum the (v1 - v2) * (v1 - v2), the third is humming, which to popc(v1 ^ v2), popc is to count the bits are set to 1*/ + float result = 0; + switch(distType) + { + case 0: + for (int j = 0 ; j < block_size ; j++) + { + result += fabs(s_query[lidy * block_size + j] - s_train[j * block_size + lidx]); + } + break; + case 1: + for (int j = 0 ; j < block_size ; j++) + { + float qr = s_query[lidy * block_size + j] - s_train[j * block_size + lidx]; + result += qr * qr; + } + break; + case 2: + for (int j = 0 ; j < block_size ; j++) + { + result += bit1Count((uint)s_query[lidy * block_size + j] ^ (uint)s_train[(uint)j * block_size + lidx]); + } + break; + } + return result; +} + +float reduce_multi_block(__local float *s_query, + __local float *s_train, + int max_desc_len, + int block_size, + int block_index, + int lidx, + int lidy, + int distType + ) +{ + /* there are threee types in the reducer. the first is L1Dist, which to sum the abs(v1, v2), the second is L2Dist, which to + sum the (v1 - v2) * (v1 - v2), the third is humming, which to popc(v1 ^ v2), popc is to count the bits are set to 1*/ + float result = 0; + switch(distType) + { + case 0: + for (int j = 0 ; j < block_size ; j++) + { + result += fabs(s_query[lidy * max_desc_len + block_index * block_size + j] - s_train[j * block_size + lidx]); + } + break; + case 1: + for (int j = 0 ; j < block_size ; j++) + { + float qr = s_query[lidy * max_desc_len + block_index * block_size + j] - s_train[j * block_size + lidx]; + result += qr * qr; + } + break; + case 2: + for (int j = 0 ; j < block_size ; j++) + { + //result += popcount((uint)s_query[lidy * max_desc_len + block_index * block_size + j] ^ (uint)s_train[j * block_size + lidx]); + result += bit1Count((uint)s_query[lidy * max_desc_len + block_index * block_size + j] ^ (uint)s_train[j * block_size + lidx]); + } + break; + } + return result; +} + /* 2dim launch, global size: dim0 is (query rows + block_size - 1) / block_size * block_size, dim1 is block_size local size: dim0 is block_size, dim1 is block_size. */ -__kernel void BruteForceMatch_UnrollMatch( +__kernel void BruteForceMatch_UnrollMatch_D5( __global float *query, __global float *train, //__global float *mask, @@ -42,7 +116,6 @@ __kernel void BruteForceMatch_UnrollMatch( __local float *s_train = sharebuffer + block_size * max_desc_len; int queryIdx = groupidx * block_size + lidy; - // load the query into local memory. for (int i = 0 ; i < max_desc_len / block_size; i ++) { @@ -55,11 +128,9 @@ __kernel void BruteForceMatch_UnrollMatch( // loopUnrolledCached to find the best trainIdx and best distance. volatile int imgIdx = 0; - for (int t = 0 ; t < (train_rows + block_size - 1) / block_size ; t++) { float result = 0; - for (int i = 0 ; i < max_desc_len / block_size ; i++) { //load a block_size * block_size block into local train. @@ -69,38 +140,7 @@ __kernel void BruteForceMatch_UnrollMatch( //synchronize to make sure each elem for reduceIteration in share memory is written already. barrier(CLK_LOCAL_MEM_FENCE); - /* there are threee types in the reducer. the first is L1Dist, which to sum the abs(v1, v2), the second is L2Dist, which to - sum the (v1 - v2) * (v1 - v2), the third is humming, which to popc(v1 ^ v2), popc is to count the bits are set to 1*/ - - switch (distType) - { - case 0: - - for (int j = 0 ; j < block_size ; j++) - { - result += fabs(s_query[lidy * max_desc_len + i * block_size + j] - s_train[j * block_size + lidx]); - } - - break; - case 1: - - for (int j = 0 ; j < block_size ; j++) - { - float qr = s_query[lidy * max_desc_len + i * block_size + j] - s_train[j * block_size + lidx]; - result += qr * qr; - } - - break; - case 2: - - for (int j = 0 ; j < block_size ; j++) - { - //result += popcount((uint)s_query[lidy * max_desc_len + i * block_size + j] ^ (uint)s_train[j * block_size + lidx]); - result += bit1Count((uint)s_query[lidy * max_desc_len + i * block_size + j] ^(uint)s_train[j * block_size + lidx]); - } - - break; - } + result += reduce_multi_block(s_query, s_train, max_desc_len, block_size, i, lidx, lidy, distType); barrier(CLK_LOCAL_MEM_FENCE); } @@ -116,8 +156,8 @@ __kernel void BruteForceMatch_UnrollMatch( } barrier(CLK_LOCAL_MEM_FENCE); - __local float *s_distance = (__local float *)(sharebuffer); - __local int *s_trainIdx = (__local int *)(sharebuffer + block_size * block_size); + __local float *s_distance = (__local float*)(sharebuffer); + __local int* s_trainIdx = (__local int *)(sharebuffer + block_size * block_size); //find BestMatch s_distance += lidy * block_size; @@ -144,7 +184,7 @@ __kernel void BruteForceMatch_UnrollMatch( } } -__kernel void BruteForceMatch_Match( +__kernel void BruteForceMatch_Match_D5( __global float *query, __global float *train, //__global float *mask, @@ -177,7 +217,6 @@ __kernel void BruteForceMatch_Match( { //Dist dist; float result = 0; - for (int i = 0 ; i < (query_cols + block_size - 1) / block_size ; i++) { const int loadx = lidx + i * block_size; @@ -193,38 +232,7 @@ __kernel void BruteForceMatch_Match( barrier(CLK_LOCAL_MEM_FENCE); - /* there are threee types in the reducer. the first is L1Dist, which to sum the abs(v1, v2), the second is L2Dist, which to - sum the (v1 - v2) * (v1 - v2), the third is humming, which to popc(v1 ^ v2), popc is to count the bits are set to 1*/ - - switch (distType) - { - case 0: - - for (int j = 0 ; j < block_size ; j++) - { - result += fabs(s_query[lidy * block_size + j] - s_train[j * block_size + lidx]); - } - - break; - case 1: - - for (int j = 0 ; j < block_size ; j++) - { - float qr = s_query[lidy * block_size + j] - s_train[j * block_size + lidx]; - result += qr * qr; - } - - break; - case 2: - - for (int j = 0 ; j < block_size ; j++) - { - //result += popcount((uint)s_query[lidy * block_size + j] ^ (uint)s_train[j * block_size + lidx]); - result += bit1Count((uint)s_query[lidy * block_size + j] ^(uint)s_train[(uint)j * block_size + lidx]); - } - - break; - } + result += reduce_block(s_query, s_train, block_size, lidx, lidy, distType); barrier(CLK_LOCAL_MEM_FENCE); } @@ -270,7 +278,7 @@ __kernel void BruteForceMatch_Match( } //radius_unrollmatch -__kernel void BruteForceMatch_RadiusUnrollMatch( +__kernel void BruteForceMatch_RadiusUnrollMatch_D5( __global float *query, __global float *train, float maxDistance, @@ -303,7 +311,6 @@ __kernel void BruteForceMatch_RadiusUnrollMatch( __local float *s_train = sharebuffer + block_size * block_size; float result = 0; - for (int i = 0 ; i < max_desc_len / block_size ; ++i) { //load a block_size * block_size block into local train. @@ -315,37 +322,7 @@ __kernel void BruteForceMatch_RadiusUnrollMatch( //synchronize to make sure each elem for reduceIteration in share memory is written already. barrier(CLK_LOCAL_MEM_FENCE); - /* there are three types in the reducer. the first is L1Dist, which to sum the abs(v1, v2), the second is L2Dist, which to - sum the (v1 - v2) * (v1 - v2), the third is humming, which to popc(v1 ^ v2), popc is to count the bits are set to 1*/ - - switch (distType) - { - case 0: - - for (int j = 0 ; j < block_size ; ++j) - { - result += fabs(s_query[lidy * block_size + j] - s_train[j * block_size + lidx]); - } - - break; - case 1: - - for (int j = 0 ; j < block_size ; ++j) - { - float qr = s_query[lidy * block_size + j] - s_train[j * block_size + lidx]; - result += qr * qr; - } - - break; - case 2: - - for (int j = 0 ; j < block_size ; ++j) - { - result += bit1Count((uint)s_query[lidy * block_size + j] ^(uint)s_train[j * block_size + lidx]); - } - - break; - } + result += reduce_block(s_query, s_train, block_size, lidx, lidy, distType); barrier(CLK_LOCAL_MEM_FENCE); } @@ -354,7 +331,7 @@ __kernel void BruteForceMatch_RadiusUnrollMatch( { unsigned int ind = atom_inc(nMatches + queryIdx/*, (unsigned int) -1*/); - if (ind < bestTrainIdx_cols) + if(ind < bestTrainIdx_cols) { //bestImgIdx = imgIdx; bestTrainIdx[queryIdx * (ostep / sizeof(int)) + ind] = trainIdx; @@ -364,7 +341,7 @@ __kernel void BruteForceMatch_RadiusUnrollMatch( } //radius_match -__kernel void BruteForceMatch_RadiusMatch( +__kernel void BruteForceMatch_RadiusMatch_D5( __global float *query, __global float *train, float maxDistance, @@ -396,7 +373,6 @@ __kernel void BruteForceMatch_RadiusMatch( __local float *s_train = sharebuffer + block_size * block_size; float result = 0; - for (int i = 0 ; i < (query_cols + block_size - 1) / block_size ; ++i) { //load a block_size * block_size block into local train. @@ -408,46 +384,16 @@ __kernel void BruteForceMatch_RadiusMatch( //synchronize to make sure each elem for reduceIteration in share memory is written already. barrier(CLK_LOCAL_MEM_FENCE); - /* there are three types in the reducer. the first is L1Dist, which to sum the abs(v1, v2), the second is L2Dist, which to - sum the (v1 - v2) * (v1 - v2), the third is humming, which to popc(v1 ^ v2), popc is to count the bits are set to 1*/ - - switch (distType) - { - case 0: - - for (int j = 0 ; j < block_size ; ++j) - { - result += fabs(s_query[lidy * block_size + j] - s_train[j * block_size + lidx]); - } - - break; - case 1: - - for (int j = 0 ; j < block_size ; ++j) - { - float qr = s_query[lidy * block_size + j] - s_train[j * block_size + lidx]; - result += qr * qr; - } - - break; - case 2: - - for (int j = 0 ; j < block_size ; ++j) - { - result += bit1Count((uint)s_query[lidy * block_size + j] ^(uint)s_train[j * block_size + lidx]); - } - - break; - } + result += reduce_block(s_query, s_train, block_size, lidx, lidy, distType); barrier(CLK_LOCAL_MEM_FENCE); } if (queryIdx < query_rows && trainIdx < train_rows && result < maxDistance/* && mask(queryIdx, trainIdx)*/) { - unsigned int ind = atom_inc(nMatches + queryIdx/*, (unsigned int) -1*/); + unsigned int ind = atom_inc(nMatches + queryIdx); - if (ind < bestTrainIdx_cols) + if(ind < bestTrainIdx_cols) { //bestImgIdx = imgIdx; bestTrainIdx[queryIdx * (ostep / sizeof(int)) + ind] = trainIdx; @@ -457,7 +403,7 @@ __kernel void BruteForceMatch_RadiusMatch( } -__kernel void BruteForceMatch_knnUnrollMatch( +__kernel void BruteForceMatch_knnUnrollMatch_D5( __global float *query, __global float *train, //__global float *mask, @@ -496,11 +442,9 @@ __kernel void BruteForceMatch_knnUnrollMatch( //loopUnrolledCached volatile int imgIdx = 0; - for (int t = 0 ; t < (train_rows + block_size - 1) / block_size ; t++) { float result = 0; - for (int i = 0 ; i < max_desc_len / block_size ; i++) { const int loadX = lidx + i * block_size; @@ -511,38 +455,7 @@ __kernel void BruteForceMatch_knnUnrollMatch( //synchronize to make sure each elem for reduceIteration in share memory is written already. barrier(CLK_LOCAL_MEM_FENCE); - /* there are threee types in the reducer. the first is L1Dist, which to sum the abs(v1, v2), the second is L2Dist, which to - sum the (v1 - v2) * (v1 - v2), the third is humming, which to popc(v1 ^ v2), popc is to count the bits are set to 1*/ - - switch (distType) - { - case 0: - - for (int j = 0 ; j < block_size ; j++) - { - result += fabs(s_query[lidy * max_desc_len + i * block_size + j] - s_train[j * block_size + lidx]); - } - - break; - case 1: - - for (int j = 0 ; j < block_size ; j++) - { - float qr = s_query[lidy * max_desc_len + i * block_size + j] - s_train[j * block_size + lidx]; - result += qr * qr; - } - - break; - case 2: - - for (int j = 0 ; j < block_size ; j++) - { - //result += popcount((uint)s_query[lidy * max_desc_len + i * block_size + j] ^ (uint)s_train[j * block_size + lidx]); - result += bit1Count((uint)s_query[lidy * max_desc_len + i * block_size + j] ^(uint)s_train[j * block_size + lidx]); - } - - break; - } + result += reduce_multi_block(s_query, s_train, max_desc_len, block_size, i, lidx, lidy, distType); barrier(CLK_LOCAL_MEM_FENCE); } @@ -589,7 +502,6 @@ __kernel void BruteForceMatch_knnUnrollMatch( for (int i = 0 ; i < block_size ; i++) { float val = s_distance[i]; - if (val < bestDistance1) { bestDistance2 = bestDistance1; @@ -640,7 +552,7 @@ __kernel void BruteForceMatch_knnUnrollMatch( } } -__kernel void BruteForceMatch_knnMatch( +__kernel void BruteForceMatch_knnMatch_D5( __global float *query, __global float *train, //__global float *mask, @@ -673,8 +585,7 @@ __kernel void BruteForceMatch_knnMatch( for (int t = 0 ; t < (train_rows + block_size - 1) / block_size ; t++) { float result = 0.0f; - - for (int i = 0 ; i < (query_cols + block_size - 1) / block_size ; i++) + for (int i = 0 ; i < (query_cols + block_size -1) / block_size ; i++) { const int loadx = lidx + i * block_size; //load query and train into local memory @@ -689,38 +600,7 @@ __kernel void BruteForceMatch_knnMatch( barrier(CLK_LOCAL_MEM_FENCE); - /* there are threee types in the reducer. the first is L1Dist, which to sum the abs(v1, v2), the second is L2Dist, which to - sum the (v1 - v2) * (v1 - v2), the third is humming, which to popc(v1 ^ v2), popc is to count the bits are set to 1*/ - - switch (distType) - { - case 0: - - for (int j = 0 ; j < block_size ; j++) - { - result += fabs(s_query[lidy * block_size + j] - s_train[j * block_size + lidx]); - } - - break; - case 1: - - for (int j = 0 ; j < block_size ; j++) - { - float qr = s_query[lidy * block_size + j] - s_train[j * block_size + lidx]; - result += qr * qr; - } - - break; - case 2: - - for (int j = 0 ; j < block_size ; j++) - { - //result += popcount((uint)s_query[lidy * block_size + j] ^ (uint)s_train[j * block_size + lidx]); - result += bit1Count((uint)s_query[lidy * block_size + j] ^(uint)s_train[(uint)j * block_size + lidx]); - } - - break; - } + result += reduce_block(s_query, s_train, block_size, lidx, lidy, distType); barrier(CLK_LOCAL_MEM_FENCE); } @@ -767,7 +647,6 @@ __kernel void BruteForceMatch_knnMatch( for (int i = 0 ; i < block_size ; i++) { float val = s_distance[i]; - if (val < bestDistance1) { bestDistance2 = bestDistance1; @@ -818,7 +697,7 @@ __kernel void BruteForceMatch_knnMatch( } } -kernel void BruteForceMatch_calcDistanceUnrolled( +kernel void BruteForceMatch_calcDistanceUnrolled_D5( __global float *query, __global float *train, //__global float *mask, @@ -836,7 +715,7 @@ kernel void BruteForceMatch_calcDistanceUnrolled( /* Todo */ } -kernel void BruteForceMatch_calcDistance( +kernel void BruteForceMatch_calcDistance_D5( __global float *query, __global float *train, //__global float *mask, @@ -853,7 +732,7 @@ kernel void BruteForceMatch_calcDistance( /* Todo */ } -kernel void BruteForceMatch_findBestMatch( +kernel void BruteForceMatch_findBestMatch_D5( __global float *allDist, __global int *bestTrainIdx, __global float *bestDistance, diff --git a/modules/ocl/src/opencl/haarobjectdetect.cl b/modules/ocl/src/opencl/haarobjectdetect.cl index 2fa0906b41..a41103a851 100644 --- a/modules/ocl/src/opencl/haarobjectdetect.cl +++ b/modules/ocl/src/opencl/haarobjectdetect.cl @@ -211,10 +211,14 @@ __kernel void __attribute__((reqd_work_group_size(8,8,1)))gpuRunHaarClassifierCa int4 data = *(__global int4*)&sum[glb_off]; int lcl_off = mad24(lcl_y, readwidth, lcl_x<<2); +#if OFF lcldata[lcl_off] = data.x; lcldata[lcl_off+1] = data.y; lcldata[lcl_off+2] = data.z; lcldata[lcl_off+3] = data.w; +#else + vstore4(data, 0, &lcldata[lcl_off]); +#endif } lcloutindex[lcl_id] = 0; diff --git a/modules/ocl/src/opencl/match_template.cl b/modules/ocl/src/opencl/match_template.cl index 3133e62371..857f891c38 100644 --- a/modules/ocl/src/opencl/match_template.cl +++ b/modules/ocl/src/opencl/match_template.cl @@ -45,22 +45,28 @@ #pragma OPENCL EXTENSION cl_amd_printf : enable -#if defined (__ATI__) -#pragma OPENCL EXTENSION cl_amd_fp64:enable +#if defined (DOUBLE_SUPPORT) -#elif defined (__NVIDIA__) +#ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64:enable +#elif defined (cl_amd_fp64) +#pragma OPENCL EXTENSION cl_amd_fp64:enable #endif -#if !defined(USE_SQR_INTEGRAL) && (defined (__ATI__) || defined (__NVIDIA__)) #define TYPE_IMAGE_SQSUM double #else -#define TYPE_IMAGE_SQSUM ulong +#define TYPE_IMAGE_SQSUM float +#endif + +#ifndef CN4 +#define CN4 1 +#else +#define CN4 4 #endif ////////////////////////////////////////////////// // utilities -#define SQSUMS_PTR(ox, oy) mad24(gidy + oy, img_sqsums_step, gidx + img_sqsums_offset + ox) +#define SQSUMS_PTR(ox, oy) mad24(gidy + oy, img_sqsums_step, (gidx + img_sqsums_offset + ox) * CN4) #define SUMS_PTR(ox, oy) mad24(gidy + oy, img_sums_step, gidx + img_sums_offset + ox) // normAcc* are accurate normalization routines which make GPU matchTemplate // consistent with CPU one @@ -95,7 +101,7 @@ float normAcc_SQDIFF(float num, float denum) __kernel void normalizeKernel_C1_D0 ( - __global const TYPE_IMAGE_SQSUM * img_sqsums, + __global const float * img_sqsums, __global float * res, ulong tpl_sqsum, int res_rows, @@ -119,8 +125,8 @@ void normalizeKernel_C1_D0 if(gidx < res_cols && gidy < res_rows) { float image_sqsum_ = (float)( - (img_sqsums[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums[SQSUMS_PTR(tpl_cols, 0)]) - - (img_sqsums[SQSUMS_PTR(0, tpl_rows)] - img_sqsums[SQSUMS_PTR(0, 0)])); + (img_sqsums[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums[SQSUMS_PTR(tpl_cols, 0)]) - + (img_sqsums[SQSUMS_PTR(0, tpl_rows)] - img_sqsums[SQSUMS_PTR(0, 0)])); res[res_idx] = normAcc(res[res_idx], sqrt(image_sqsum_ * tpl_sqsum)); } } @@ -152,8 +158,8 @@ void matchTemplate_Prepared_SQDIFF_C1_D0 if(gidx < res_cols && gidy < res_rows) { float image_sqsum_ = (float)( - (img_sqsums[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums[SQSUMS_PTR(tpl_cols, 0)]) - - (img_sqsums[SQSUMS_PTR(0, tpl_rows)] - img_sqsums[SQSUMS_PTR(0, 0)])); + (img_sqsums[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums[SQSUMS_PTR(tpl_cols, 0)]) - + (img_sqsums[SQSUMS_PTR(0, tpl_rows)] - img_sqsums[SQSUMS_PTR(0, 0)])); res[res_idx] = image_sqsum_ - 2.f * res[res_idx] + tpl_sqsum; } } @@ -161,7 +167,7 @@ void matchTemplate_Prepared_SQDIFF_C1_D0 __kernel void matchTemplate_Prepared_SQDIFF_NORMED_C1_D0 ( - __global const TYPE_IMAGE_SQSUM * img_sqsums, + __global const float * img_sqsums, __global float * res, ulong tpl_sqsum, int res_rows, @@ -185,10 +191,10 @@ void matchTemplate_Prepared_SQDIFF_NORMED_C1_D0 if(gidx < res_cols && gidy < res_rows) { float image_sqsum_ = (float)( - (img_sqsums[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums[SQSUMS_PTR(tpl_cols, 0)]) - - (img_sqsums[SQSUMS_PTR(0, tpl_rows)] - img_sqsums[SQSUMS_PTR(0, 0)])); + (img_sqsums[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums[SQSUMS_PTR(tpl_cols, 0)]) - + (img_sqsums[SQSUMS_PTR(0, tpl_rows)] - img_sqsums[SQSUMS_PTR(0, 0)])); res[res_idx] = normAcc_SQDIFF(image_sqsum_ - 2.f * res[res_idx] + tpl_sqsum, - sqrt(image_sqsum_ * tpl_sqsum)); + sqrt(image_sqsum_ * tpl_sqsum)); } } @@ -628,8 +634,8 @@ void matchTemplate_Prepared_CCOFF_C1_D0 if(gidx < res_cols && gidy < res_rows) { float sum = (float)( - (img_sums[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums[SUMS_PTR(tpl_cols, 0)]) - - (img_sums[SUMS_PTR(0, tpl_rows)] - img_sums[SUMS_PTR(0, 0)])); + (img_sums[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums[SUMS_PTR(tpl_cols, 0)]) + - (img_sums[SUMS_PTR(0, tpl_rows)] - img_sums[SUMS_PTR(0, 0)])); res[res_idx] -= sum * tpl_sum; } } @@ -671,17 +677,17 @@ void matchTemplate_Prepared_CCOFF_C4_D0 { float ccorr = res[res_idx]; ccorr -= tpl_sum_c0*(float)( - (img_sums_c0[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c0[SUMS_PTR(tpl_cols, 0)]) - - (img_sums_c0[SUMS_PTR(0, tpl_rows)] - img_sums_c0[SUMS_PTR(0, 0)])); + (img_sums_c0[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c0[SUMS_PTR(tpl_cols, 0)]) + - (img_sums_c0[SUMS_PTR(0, tpl_rows)] - img_sums_c0[SUMS_PTR(0, 0)])); ccorr -= tpl_sum_c1*(float)( - (img_sums_c1[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c1[SUMS_PTR(tpl_cols, 0)]) - - (img_sums_c1[SUMS_PTR(0, tpl_rows)] - img_sums_c1[SUMS_PTR(0, 0)])); + (img_sums_c1[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c1[SUMS_PTR(tpl_cols, 0)]) + - (img_sums_c1[SUMS_PTR(0, tpl_rows)] - img_sums_c1[SUMS_PTR(0, 0)])); ccorr -= tpl_sum_c2*(float)( - (img_sums_c2[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c2[SUMS_PTR(tpl_cols, 0)]) - - (img_sums_c2[SUMS_PTR(0, tpl_rows)] - img_sums_c2[SUMS_PTR(0, 0)])); + (img_sums_c2[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c2[SUMS_PTR(tpl_cols, 0)]) + - (img_sums_c2[SUMS_PTR(0, tpl_rows)] - img_sums_c2[SUMS_PTR(0, 0)])); ccorr -= tpl_sum_c3*(float)( - (img_sums_c3[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c3[SUMS_PTR(tpl_cols, 0)]) - - (img_sums_c3[SUMS_PTR(0, tpl_rows)] - img_sums_c3[SUMS_PTR(0, 0)])); + (img_sums_c3[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c3[SUMS_PTR(tpl_cols, 0)]) + - (img_sums_c3[SUMS_PTR(0, tpl_rows)] - img_sums_c3[SUMS_PTR(0, 0)])); res[res_idx] = ccorr; } } @@ -702,7 +708,7 @@ void matchTemplate_Prepared_CCOFF_NORMED_C1_D0 __global const uint * img_sums, int img_sums_offset, int img_sums_step, - __global const TYPE_IMAGE_SQSUM * img_sqsums, + __global const float * img_sqsums, int img_sqsums_offset, int img_sqsums_step, float tpl_sum, @@ -725,12 +731,12 @@ void matchTemplate_Prepared_CCOFF_NORMED_C1_D0 if(gidx < res_cols && gidy < res_rows) { float image_sum_ = (float)( - (img_sums[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums[SUMS_PTR(tpl_cols, 0)]) - - (img_sums[SUMS_PTR(0, tpl_rows)] - img_sums[SUMS_PTR(0, 0)])); + (img_sums[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums[SUMS_PTR(tpl_cols, 0)]) + - (img_sums[SUMS_PTR(0, tpl_rows)] - img_sums[SUMS_PTR(0, 0)])); float image_sqsum_ = (float)( - (img_sqsums[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums[SQSUMS_PTR(tpl_cols, 0)]) - - (img_sqsums[SQSUMS_PTR(0, tpl_rows)] - img_sqsums[SQSUMS_PTR(0, 0)])); + (img_sqsums[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums[SQSUMS_PTR(tpl_cols, 0)]) - + (img_sqsums[SQSUMS_PTR(0, tpl_rows)] - img_sqsums[SQSUMS_PTR(0, 0)])); res[res_idx] = normAcc(res[res_idx] - image_sum_ * tpl_sum, sqrt(tpl_sqsum * (image_sqsum_ - weight * image_sum_ * image_sum_))); } @@ -754,10 +760,10 @@ void matchTemplate_Prepared_CCOFF_NORMED_C4_D0 __global const uint * img_sums_c3, int img_sums_offset, int img_sums_step, - __global const TYPE_IMAGE_SQSUM * img_sqsums_c0, - __global const TYPE_IMAGE_SQSUM * img_sqsums_c1, - __global const TYPE_IMAGE_SQSUM * img_sqsums_c2, - __global const TYPE_IMAGE_SQSUM * img_sqsums_c3, + __global const float * img_sqsums_c0, + __global const float * img_sqsums_c1, + __global const float * img_sqsums_c2, + __global const float * img_sqsums_c3, int img_sqsums_offset, int img_sqsums_step, float tpl_sum_c0, @@ -782,42 +788,71 @@ void matchTemplate_Prepared_CCOFF_NORMED_C4_D0 if(gidx < res_cols && gidy < res_rows) { float image_sum_c0 = (float)( - (img_sums_c0[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c0[SUMS_PTR(tpl_cols, 0)]) - - (img_sums_c0[SUMS_PTR(0, tpl_rows)] - img_sums_c0[SUMS_PTR(0, 0)])); + (img_sums_c0[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c0[SUMS_PTR(tpl_cols, 0)]) + - (img_sums_c0[SUMS_PTR(0, tpl_rows)] - img_sums_c0[SUMS_PTR(0, 0)])); float image_sum_c1 = (float)( - (img_sums_c1[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c1[SUMS_PTR(tpl_cols, 0)]) - - (img_sums_c1[SUMS_PTR(0, tpl_rows)] - img_sums_c1[SUMS_PTR(0, 0)])); + (img_sums_c1[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c1[SUMS_PTR(tpl_cols, 0)]) + - (img_sums_c1[SUMS_PTR(0, tpl_rows)] - img_sums_c1[SUMS_PTR(0, 0)])); float image_sum_c2 = (float)( - (img_sums_c2[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c2[SUMS_PTR(tpl_cols, 0)]) - - (img_sums_c2[SUMS_PTR(0, tpl_rows)] - img_sums_c2[SUMS_PTR(0, 0)])); + (img_sums_c2[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c2[SUMS_PTR(tpl_cols, 0)]) + - (img_sums_c2[SUMS_PTR(0, tpl_rows)] - img_sums_c2[SUMS_PTR(0, 0)])); float image_sum_c3 = (float)( - (img_sums_c3[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c3[SUMS_PTR(tpl_cols, 0)]) - - (img_sums_c3[SUMS_PTR(0, tpl_rows)] - img_sums_c3[SUMS_PTR(0, 0)])); + (img_sums_c3[SUMS_PTR(tpl_cols, tpl_rows)] - img_sums_c3[SUMS_PTR(tpl_cols, 0)]) + - (img_sums_c3[SUMS_PTR(0, tpl_rows)] - img_sums_c3[SUMS_PTR(0, 0)])); float image_sqsum_c0 = (float)( - (img_sqsums_c0[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums_c0[SQSUMS_PTR(tpl_cols, 0)]) - - (img_sqsums_c0[SQSUMS_PTR(0, tpl_rows)] - img_sqsums_c0[SQSUMS_PTR(0, 0)])); + (img_sqsums_c0[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums_c0[SQSUMS_PTR(tpl_cols, 0)]) - + (img_sqsums_c0[SQSUMS_PTR(0, tpl_rows)] - img_sqsums_c0[SQSUMS_PTR(0, 0)])); float image_sqsum_c1 = (float)( - (img_sqsums_c1[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums_c1[SQSUMS_PTR(tpl_cols, 0)]) - - (img_sqsums_c1[SQSUMS_PTR(0, tpl_rows)] - img_sqsums_c1[SQSUMS_PTR(0, 0)])); + (img_sqsums_c1[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums_c1[SQSUMS_PTR(tpl_cols, 0)]) - + (img_sqsums_c1[SQSUMS_PTR(0, tpl_rows)] - img_sqsums_c1[SQSUMS_PTR(0, 0)])); float image_sqsum_c2 = (float)( - (img_sqsums_c2[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums_c2[SQSUMS_PTR(tpl_cols, 0)]) - - (img_sqsums_c2[SQSUMS_PTR(0, tpl_rows)] - img_sqsums_c2[SQSUMS_PTR(0, 0)])); + (img_sqsums_c2[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums_c2[SQSUMS_PTR(tpl_cols, 0)]) - + (img_sqsums_c2[SQSUMS_PTR(0, tpl_rows)] - img_sqsums_c2[SQSUMS_PTR(0, 0)])); float image_sqsum_c3 = (float)( - (img_sqsums_c3[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums_c3[SQSUMS_PTR(tpl_cols, 0)]) - - (img_sqsums_c3[SQSUMS_PTR(0, tpl_rows)] - img_sqsums_c3[SQSUMS_PTR(0, 0)])); + (img_sqsums_c3[SQSUMS_PTR(tpl_cols, tpl_rows)] - img_sqsums_c3[SQSUMS_PTR(tpl_cols, 0)]) - + (img_sqsums_c3[SQSUMS_PTR(0, tpl_rows)] - img_sqsums_c3[SQSUMS_PTR(0, 0)])); float num = res[res_idx] - - image_sum_c0 * tpl_sum_c0 - - image_sum_c1 * tpl_sum_c1 - - image_sum_c2 * tpl_sum_c2 - - image_sum_c3 * tpl_sum_c3; + image_sum_c0 * tpl_sum_c0 - + image_sum_c1 * tpl_sum_c1 - + image_sum_c2 * tpl_sum_c2 - + image_sum_c3 * tpl_sum_c3; float denum = sqrt( tpl_sqsum * ( - image_sqsum_c0 - weight * image_sum_c0 * image_sum_c0 + - image_sqsum_c1 - weight * image_sum_c1 * image_sum_c1 + - image_sqsum_c2 - weight * image_sum_c2 * image_sum_c2 + - image_sqsum_c3 - weight * image_sum_c0 * image_sum_c3) - ); + image_sqsum_c0 - weight * image_sum_c0 * image_sum_c0 + + image_sqsum_c1 - weight * image_sum_c1 * image_sum_c1 + + image_sqsum_c2 - weight * image_sum_c2 * image_sum_c2 + + image_sqsum_c3 - weight * image_sum_c0 * image_sum_c3) + ); res[res_idx] = normAcc(num, denum); } } + +////////////////////////////////////////////////////////////////////// +// extractFirstChannel +__kernel +void extractFirstChannel +( + const __global float4* img, + __global float* res, + int rows, + int cols, + int img_offset, + int res_offset, + int img_step, + int res_step +) +{ + img_step /= sizeof(float4); + res_step /= sizeof(float); + img_offset /= sizeof(float4); + res_offset /= sizeof(float); + img += img_offset; + res += res_offset; + int gidx = get_global_id(0); + int gidy = get_global_id(1); + if(gidx < cols && gidy < rows) + { + res[gidx + gidy * res_step] = img[gidx + gidy * img_step].x; + } +} diff --git a/modules/ocl/src/opencl/moments.cl b/modules/ocl/src/opencl/moments.cl index fae5ad109a..cee88a05e7 100644 --- a/modules/ocl/src/opencl/moments.cl +++ b/modules/ocl/src/opencl/moments.cl @@ -6,25 +6,27 @@ #pragma OPENCL EXTENSION cl_amd_fp64:enable #endif typedef double T; +typedef double F; +typedef double4 F4; +#define convert_F4 convert_double4 #else -typedef float double; -typedef float4 double4; +typedef float F; +typedef float4 F4; typedef long T; -#define convert_double4 convert_float4 +#define convert_F4 convert_float4 #endif -//#pragma OPENCL EXTENSION cl_amd_printf:enable -//#if defined (DOUBLE_SUPPORT) -#define DST_ROW_A00 0 -#define DST_ROW_A10 1 -#define DST_ROW_A01 2 -#define DST_ROW_A20 3 -#define DST_ROW_A11 4 -#define DST_ROW_A02 5 -#define DST_ROW_A30 6 -#define DST_ROW_A21 7 -#define DST_ROW_A12 8 -#define DST_ROW_A03 9 + +#define DST_ROW_00 0 +#define DST_ROW_10 1 +#define DST_ROW_01 2 +#define DST_ROW_20 3 +#define DST_ROW_11 4 +#define DST_ROW_02 5 +#define DST_ROW_30 6 +#define DST_ROW_21 7 +#define DST_ROW_12 8 +#define DST_ROW_03 9 __kernel void icvContourMoments(int contour_total, __global float* reader_oclmat_data, @@ -60,36 +62,76 @@ __kernel void icvContourMoments(int contour_total, yii_1 = yi_1 + yi; dst_step /= sizeof(T); - *( dst_a + DST_ROW_A00 * dst_step + idx) = dxy; - *( dst_a + DST_ROW_A10 * dst_step + idx) = dxy * xii_1; - *( dst_a + DST_ROW_A01 * dst_step + idx) = dxy * yii_1; - *( dst_a + DST_ROW_A20 * dst_step + idx) = dxy * (xi_1 * xii_1 + xi2); - *( dst_a + DST_ROW_A11 * dst_step + idx) = dxy * (xi_1 * (yii_1 + yi_1) + xi * (yii_1 + yi)); - *( dst_a + DST_ROW_A02 * dst_step + idx) = dxy * (yi_1 * yii_1 + yi2); - *( dst_a + DST_ROW_A30 * dst_step + idx) = dxy * xii_1 * (xi_12 + xi2); - *( dst_a + DST_ROW_A03 * dst_step + idx) = dxy * yii_1 * (yi_12 + yi2); - *( dst_a + DST_ROW_A21 * dst_step + idx) = + *( dst_a + DST_ROW_00 * dst_step + idx) = dxy; + *( dst_a + DST_ROW_10 * dst_step + idx) = dxy * xii_1; + *( dst_a + DST_ROW_01 * dst_step + idx) = dxy * yii_1; + *( dst_a + DST_ROW_20 * dst_step + idx) = dxy * (xi_1 * xii_1 + xi2); + *( dst_a + DST_ROW_11 * dst_step + idx) = dxy * (xi_1 * (yii_1 + yi_1) + xi * (yii_1 + yi)); + *( dst_a + DST_ROW_02 * dst_step + idx) = dxy * (yi_1 * yii_1 + yi2); + *( dst_a + DST_ROW_30 * dst_step + idx) = dxy * xii_1 * (xi_12 + xi2); + *( dst_a + DST_ROW_03 * dst_step + idx) = dxy * yii_1 * (yi_12 + yi2); + *( dst_a + DST_ROW_21 * dst_step + idx) = dxy * (xi_12 * (3 * yi_1 + yi) + 2 * xi * xi_1 * yii_1 + xi2 * (yi_1 + 3 * yi)); - *( dst_a + DST_ROW_A12 * dst_step + idx) = + *( dst_a + DST_ROW_12 * dst_step + idx) = dxy * (yi_12 * (3 * xi_1 + xi) + 2 * yi * yi_1 * xii_1 + yi2 * (xi_1 + 3 * xi)); } -//#endif -//#if defined (DOUBLE_SUPPORT) +__kernel void dst_sum(int src_rows, int src_cols, int tile_height, int tile_width, int TILE_SIZE, + __global F* sum, __global F* dst_m, int dst_step) +{ + int gidy = get_global_id(0); + int gidx = get_global_id(1); + int block_y = src_rows/tile_height; + int block_x = src_cols/tile_width; + int block_num; + + if(src_rows > TILE_SIZE && src_rows % TILE_SIZE != 0) + block_y ++; + if(src_cols > TILE_SIZE && src_cols % TILE_SIZE != 0) + block_x ++; + block_num = block_y * block_x; + __local F dst_sum[10][128]; + if(gidy<128-block_num) + for(int i=0; i<10; i++) + dst_sum[i][gidy+block_num]=0; + barrier(CLK_LOCAL_MEM_FENCE); + + dst_step /= sizeof(F); + if(gidy0; lsize>>=1) + { + if(gidy TILE_SIZE && src_rows % TILE_SIZE != 0) - block_y ++; - if(src_cols > TILE_SIZE && src_cols % TILE_SIZE != 0) - block_x ++; - block_num = block_y * block_x; - __local double dst_sum[10][128]; - if(gidy<128-block_num) - for(int i=0; i<10; i++) - dst_sum[i][gidy+block_num]=0; - barrier(CLK_LOCAL_MEM_FENCE); - if(gidy0; lsize>>=1) - { - if(gidy= TILE_SIZE/2&&lidy > bheight-1&&lidy < tileSize_height) { - m[9][lidy-bheight] = ((double)py) * sy; // m03 - m[8][lidy-bheight] = ((double)x1.s0) * sy; // m12 - m[7][lidy-bheight] = ((double)x2.s0) * lidy; // m21 - m[6][lidy-bheight] = x3.s0; // m30 - m[5][lidy-bheight] = x0.s0 * sy; // m02 - m[4][lidy-bheight] = x1.s0 * lidy; // m11 - m[3][lidy-bheight] = x2.s0; // m20 - m[2][lidy-bheight] = py; // m01 - m[1][lidy-bheight] = x1.s0; // m10 - m[0][lidy-bheight] = x0.s0; // m00 - } - else if(lidy < bheight) - { - lm[9] = ((double)py) * sy; // m03 - lm[8] = ((double)x1.s0) * sy; // m12 - lm[7] = ((double)x2.s0) * lidy; // m21 - lm[6] = x3.s0; // m30 - lm[5] = x0.s0 * sy; // m02 - lm[4] = x1.s0 * lidy; // m11 - lm[3] = x2.s0; // m20 - lm[2] = py; // m01 - lm[1] = x1.s0; // m10 - lm[0] = x0.s0; // m00 - } - barrier(CLK_LOCAL_MEM_FENCE); - for( int j = TILE_SIZE/2; j >= 1; j = j/2 ) - { - if(lidy < j) - for( int i = 0; i < 10; i++ ) - lm[i] = lm[i] + m[i][lidy]; - barrier(CLK_LOCAL_MEM_FENCE); - if(lidy >= j/2&&lidy < j) - for( int i = 0; i < 10; i++ ) - m[i][lidy-j/2] = lm[i]; - barrier(CLK_LOCAL_MEM_FENCE); - } - if(lidy == 0&&lidx == 0) - { - for(int mt = 0; mt < 10; mt++ ) - mom[mt] = (double)lm[mt]; - - if(binary) - { - double s = 1./255; - for( int mt = 0; mt < 10; mt++ ) - mom[mt] *= s; - } - - double xm = x * mom[0], ym = y * mom[0]; - - // accumulate moments computed in each tile - - // + m00 ( = m00' ) - dst_m00[wgidy*dst_cols+wgidx]= mom[0]; - - // + m10 ( = m10' + x*m00' ) - dst_m10[wgidy*dst_cols+wgidx] = mom[1] + xm; - - // + m01 ( = m01' + y*m00' ) - dst_m01[wgidy*dst_cols+wgidx] = mom[2] + ym; - - // + m20 ( = m20' + 2*x*m10' + x*x*m00' ) - dst_m20[wgidy*dst_cols+wgidx] = mom[3] + x * (mom[1] * 2 + xm); - - // + m11 ( = m11' + x*m01' + y*m10' + x*y*m00' ) - dst_m11[wgidy*dst_cols+wgidx] = mom[4] + x * (mom[2] + ym) + y * mom[1]; - - // + m02 ( = m02' + 2*y*m01' + y*y*m00' ) - dst_m02[wgidy*dst_cols+wgidx]= mom[5] + y * (mom[2] * 2 + ym); - - // + m30 ( = m30' + 3*x*m20' + 3*x*x*m10' + x*x*x*m00' ) - dst_m30[wgidy*dst_cols+wgidx]= mom[6] + x * (3. * mom[3] + x * (3. * mom[1] + xm)); - - // + m21 ( = m21' + x*(2*m11' + 2*y*m10' + x*m01' + x*y*m00') + y*m20') - dst_m21[wgidy*dst_cols+wgidx] = mom[7] + x * (2 * (mom[4] + y * mom[1]) + x * (mom[2] + ym)) + y * mom[3]; - - // + m12 ( = m12' + y*(2*m11' + 2*x*m01' + y*m10' + x*y*m00') + x*m02') - dst_m12[wgidy*dst_cols+wgidx] = mom[8] + y * (2 * (mom[4] + x * mom[2]) + y * (mom[1] + xm)) + x * mom[5]; - - // + m03 ( = m03' + 3*y*m02' + 3*y*y*m01' + y*y*y*m00' ) - dst_m03[wgidy*dst_cols+wgidx]= mom[9] + y * (3. * mom[5] + y * (3. * mom[2] + ym)); - }*/ -} -//#endif -//#if defined (DOUBLE_SUPPORT) -__kernel void CvMoments_D6(__global double* src_data, int src_rows, int src_cols, int src_step, int tileSize_width, int tileSize_height, - __global double* dst_m00, - __global double* dst_m10, - __global double* dst_m01, - __global double* dst_m20, - __global double* dst_m11, - __global double* dst_m02, - __global double* dst_m30, - __global double* dst_m21, - __global double* dst_m12, - __global double* dst_m03, - int dst_cols, int dst_step, - int type, int depth, int cn, int coi, int binary, const int TILE_SIZE) -{ - double tmp_coi[4]; // get the coi data - double4 tmp[64]; - int VLEN_D = 4; // length of vetor - int gidy = get_global_id(0); - int gidx = get_global_id(1); - int wgidy = get_group_id(0); - int wgidx = get_group_id(1); - int lidy = get_local_id(0); - int lidx = get_local_id(1); - int y = wgidy*TILE_SIZE; // real Y index of pixel - int x = wgidx*TILE_SIZE; // real X index of pixel - int kcn = (cn==2)?2:4; - int rstep = min(src_step/8, TILE_SIZE); - tileSize_height = min(TILE_SIZE, src_rows - y); - tileSize_width = min(TILE_SIZE, src_cols - x); - - if(tileSize_width < TILE_SIZE) - for(int i = tileSize_width; i < rstep; i++ ) - *((__global double*)src_data+(y+lidy)*src_step/8+x+i) = 0; - if( coi > 0 ) - for(int i=0; i < tileSize_width; i+=VLEN_D) - { - for(int j=0; j<4; j++) - tmp_coi[j] = *(src_data+(y+lidy)*src_step/8+(x+i+j)*kcn+coi-1); - tmp[i/VLEN_D] = (double4)(tmp_coi[0],tmp_coi[1],tmp_coi[2],tmp_coi[3]); - } - else - for(int i=0; i < tileSize_width; i+=VLEN_D) - tmp[i/VLEN_D] = (double4)(*(src_data+(y+lidy)*src_step/8+x+i),*(src_data+(y+lidy)*src_step/8+x+i+1),*(src_data+(y+lidy)*src_step/8+x+i+2),*(src_data+(y+lidy)*src_step/8+x+i+3)); - double4 zero = (double4)(0); - double4 full = (double4)(255); - if( binary ) - for(int i=0; i < tileSize_width; i+=VLEN_D) - tmp[i/VLEN_D] = (tmp[i/VLEN_D]!=zero)?full:zero; - double mom[10]; - __local double m[10][128]; - if(lidy == 0) - for(int i=0; i<10; i++) - for(int j=0; j<128; j++) - m[i][j]=0; - barrier(CLK_LOCAL_MEM_FENCE); - double lm[10] = {0}; - double4 x0 = (double4)(0); - double4 x1 = (double4)(0); - double4 x2 = (double4)(0); - double4 x3 = (double4)(0); - for( int xt = 0 ; xt < tileSize_width; xt+=VLEN_D ) - { - double4 v_xt = (double4)(xt, xt+1, xt+2, xt+3); - double4 p = tmp[xt/VLEN_D]; - double4 xp = v_xt * p, xxp = xp * v_xt; - x0 += p; - x1 += xp; - x2 += xxp; - x3 += xxp *v_xt; - } - x0.s0 += x0.s1 + x0.s2 + x0.s3; - x1.s0 += x1.s1 + x1.s2 + x1.s3; - x2.s0 += x2.s1 + x2.s2 + x2.s3; - x3.s0 += x3.s1 + x3.s2 + x3.s3; - - double py = lidy * x0.s0, sy = lidy*lidy; - int bheight = min(tileSize_height, TILE_SIZE/2); - if(bheight >= TILE_SIZE/2&&lidy > bheight-1&&lidy < tileSize_height) - { - m[9][lidy-bheight] = ((double)py) * sy; // m03 - m[8][lidy-bheight] = ((double)x1.s0) * sy; // m12 - m[7][lidy-bheight] = ((double)x2.s0) * lidy; // m21 + m[9][lidy-bheight] = ((F)py) * sy; // m03 + m[8][lidy-bheight] = ((F)x1.s0) * sy; // m12 + m[7][lidy-bheight] = ((F)x2.s0) * lidy; // m21 m[6][lidy-bheight] = x3.s0; // m30 m[5][lidy-bheight] = x0.s0 * sy; // m02 m[4][lidy-bheight] = x1.s0 * lidy; // m11 @@ -881,9 +675,9 @@ __kernel void CvMoments_D6(__global double* src_data, int src_rows, int src_col else if(lidy < bheight) { - lm[9] = ((double)py) * sy; // m03 - lm[8] = ((double)x1.s0) * sy; // m12 - lm[7] = ((double)x2.s0) * lidy; // m21 + lm[9] = ((F)py) * sy; // m03 + lm[8] = ((F)x1.s0) * sy; // m12 + lm[7] = ((F)x2.s0) * lidy; // m21 lm[6] = x3.s0; // m30 lm[5] = x0.s0 * sy; // m02 lm[4] = x1.s0 * lidy; // m11 @@ -907,47 +701,202 @@ __kernel void CvMoments_D6(__global double* src_data, int src_rows, int src_col if(lidy == 0&&lidx == 0) { for( int mt = 0; mt < 10; mt++ ) - mom[mt] = (double)lm[mt]; + mom[mt] = (F)lm[mt]; if(binary) { - double s = 1./255; + F s = 1./255; for( int mt = 0; mt < 10; mt++ ) mom[mt] *= s; } - double xm = x * mom[0], ym = y * mom[0]; + F xm = x * mom[0], ym = y * mom[0]; // accumulate moments computed in each tile + dst_step /= sizeof(F); // + m00 ( = m00' ) - dst_m00[wgidy*dst_cols+wgidx] = mom[0]; + *(dst_m + mad24(DST_ROW_00 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[0]; // + m10 ( = m10' + x*m00' ) - dst_m10[wgidy*dst_cols+wgidx] = mom[1] + xm; + *(dst_m + mad24(DST_ROW_10 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[1] + xm; // + m01 ( = m01' + y*m00' ) - dst_m01[wgidy*dst_cols+wgidx] = mom[2] + ym; + *(dst_m + mad24(DST_ROW_01 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[2] + ym; // + m20 ( = m20' + 2*x*m10' + x*x*m00' ) - dst_m20[wgidy*dst_cols+wgidx] = mom[3] + x * (mom[1] * 2 + xm); + *(dst_m + mad24(DST_ROW_20 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[3] + x * (mom[1] * 2 + xm); // + m11 ( = m11' + x*m01' + y*m10' + x*y*m00' ) - dst_m11[wgidy*dst_cols+wgidx] = mom[4] + x * (mom[2] + ym) + y * mom[1]; + *(dst_m + mad24(DST_ROW_11 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[4] + x * (mom[2] + ym) + y * mom[1]; // + m02 ( = m02' + 2*y*m01' + y*y*m00' ) - dst_m02[wgidy*dst_cols+wgidx] = mom[5] + y * (mom[2] * 2 + ym); + *(dst_m + mad24(DST_ROW_02 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[5] + y * (mom[2] * 2 + ym); // + m30 ( = m30' + 3*x*m20' + 3*x*x*m10' + x*x*x*m00' ) - dst_m30[wgidy*dst_cols+wgidx] = mom[6] + x * (3. * mom[3] + x * (3. * mom[1] + xm)); + *(dst_m + mad24(DST_ROW_30 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[6] + x * (3. * mom[3] + x * (3. * mom[1] + xm)); // + m21 ( = m21' + x*(2*m11' + 2*y*m10' + x*m01' + x*y*m00') + y*m20') - dst_m21[wgidy*dst_cols+wgidx] = mom[7] + x * (2 * (mom[4] + y * mom[1]) + x * (mom[2] + ym)) + y * mom[3]; + *(dst_m + mad24(DST_ROW_21 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[7] + x * (2 * (mom[4] + y * mom[1]) + x * (mom[2] + ym)) + y * mom[3]; // + m12 ( = m12' + y*(2*m11' + 2*x*m01' + y*m10' + x*y*m00') + x*m02') - dst_m12[wgidy*dst_cols+wgidx] = mom[8] + y * (2 * (mom[4] + x * mom[2]) + y * (mom[1] + xm)) + x * mom[5]; + *(dst_m + mad24(DST_ROW_12 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[8] + y * (2 * (mom[4] + x * mom[2]) + y * (mom[1] + xm)) + x * mom[5]; // + m03 ( = m03' + 3*y*m02' + 3*y*y*m01' + y*y*y*m00' ) - dst_m03[wgidy*dst_cols+wgidx] = mom[9] + y * (3. * mom[5] + y * (3. * mom[2] + ym)); + *(dst_m + mad24(DST_ROW_03 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[9] + y * (3. * mom[5] + y * (3. * mom[2] + ym)); + } +} + +__kernel void CvMoments_D6(__global F* src_data, int src_rows, int src_cols, int src_step, int tileSize_width, int tileSize_height, + __global F* dst_m, + int dst_cols, int dst_step, int blocky, + int type, int depth, int cn, int coi, int binary, const int TILE_SIZE) +{ + F tmp_coi[4]; // get the coi data + F4 tmp[64]; + int VLEN_D = 4; // length of vetor + int gidy = get_global_id(0); + int gidx = get_global_id(1); + int wgidy = get_group_id(0); + int wgidx = get_group_id(1); + int lidy = get_local_id(0); + int lidx = get_local_id(1); + int y = wgidy*TILE_SIZE; // real Y index of pixel + int x = wgidx*TILE_SIZE; // real X index of pixel + int kcn = (cn==2)?2:4; + int rstep = min(src_step/8, TILE_SIZE); + tileSize_height = min(TILE_SIZE, src_rows - y); + tileSize_width = min(TILE_SIZE, src_cols - x); + + if(tileSize_width < TILE_SIZE) + for(int i = tileSize_width; i < rstep; i++ ) + *((__global F*)src_data+(y+lidy)*src_step/8+x+i) = 0; + if( coi > 0 ) + for(int i=0; i < tileSize_width; i+=VLEN_D) + { + for(int j=0; j<4; j++) + tmp_coi[j] = *(src_data+(y+lidy)*src_step/8+(x+i+j)*kcn+coi-1); + tmp[i/VLEN_D] = (F4)(tmp_coi[0],tmp_coi[1],tmp_coi[2],tmp_coi[3]); + } + else + for(int i=0; i < tileSize_width; i+=VLEN_D) + tmp[i/VLEN_D] = (F4)(*(src_data+(y+lidy)*src_step/8+x+i),*(src_data+(y+lidy)*src_step/8+x+i+1),*(src_data+(y+lidy)*src_step/8+x+i+2),*(src_data+(y+lidy)*src_step/8+x+i+3)); + F4 zero = (F4)(0); + F4 full = (F4)(255); + if( binary ) + for(int i=0; i < tileSize_width; i+=VLEN_D) + tmp[i/VLEN_D] = (tmp[i/VLEN_D]!=zero)?full:zero; + F mom[10]; + __local F m[10][128]; + if(lidy == 0) + for(int i=0; i<10; i++) + for(int j=0; j<128; j++) + m[i][j]=0; + barrier(CLK_LOCAL_MEM_FENCE); + F lm[10] = {0}; + F4 x0 = (F4)(0); + F4 x1 = (F4)(0); + F4 x2 = (F4)(0); + F4 x3 = (F4)(0); + for( int xt = 0 ; xt < tileSize_width; xt+=VLEN_D ) + { + F4 v_xt = (F4)(xt, xt+1, xt+2, xt+3); + F4 p = tmp[xt/VLEN_D]; + F4 xp = v_xt * p, xxp = xp * v_xt; + x0 += p; + x1 += xp; + x2 += xxp; + x3 += xxp *v_xt; + } + x0.s0 += x0.s1 + x0.s2 + x0.s3; + x1.s0 += x1.s1 + x1.s2 + x1.s3; + x2.s0 += x2.s1 + x2.s2 + x2.s3; + x3.s0 += x3.s1 + x3.s2 + x3.s3; + + F py = lidy * x0.s0, sy = lidy*lidy; + int bheight = min(tileSize_height, TILE_SIZE/2); + if(bheight >= TILE_SIZE/2&&lidy > bheight-1&&lidy < tileSize_height) + { + m[9][lidy-bheight] = ((F)py) * sy; // m03 + m[8][lidy-bheight] = ((F)x1.s0) * sy; // m12 + m[7][lidy-bheight] = ((F)x2.s0) * lidy; // m21 + m[6][lidy-bheight] = x3.s0; // m30 + m[5][lidy-bheight] = x0.s0 * sy; // m02 + m[4][lidy-bheight] = x1.s0 * lidy; // m11 + m[3][lidy-bheight] = x2.s0; // m20 + m[2][lidy-bheight] = py; // m01 + m[1][lidy-bheight] = x1.s0; // m10 + m[0][lidy-bheight] = x0.s0; // m00 + } + + else if(lidy < bheight) + { + lm[9] = ((F)py) * sy; // m03 + lm[8] = ((F)x1.s0) * sy; // m12 + lm[7] = ((F)x2.s0) * lidy; // m21 + lm[6] = x3.s0; // m30 + lm[5] = x0.s0 * sy; // m02 + lm[4] = x1.s0 * lidy; // m11 + lm[3] = x2.s0; // m20 + lm[2] = py; // m01 + lm[1] = x1.s0; // m10 + lm[0] = x0.s0; // m00 + } + barrier(CLK_LOCAL_MEM_FENCE); + for( int j = TILE_SIZE/2; j >= 1; j = j/2 ) + { + if(lidy < j) + for( int i = 0; i < 10; i++ ) + lm[i] = lm[i] + m[i][lidy]; + barrier(CLK_LOCAL_MEM_FENCE); + if(lidy >= j/2&&lidy < j) + for( int i = 0; i < 10; i++ ) + m[i][lidy-j/2] = lm[i]; + barrier(CLK_LOCAL_MEM_FENCE); + } + if(lidy == 0&&lidx == 0) + { + for( int mt = 0; mt < 10; mt++ ) + mom[mt] = (F)lm[mt]; + if(binary) + { + F s = 1./255; + for( int mt = 0; mt < 10; mt++ ) + mom[mt] *= s; + } + + F xm = x * mom[0], ym = y * mom[0]; + + // accumulate moments computed in each tile + dst_step /= sizeof(F); + + // + m00 ( = m00' ) + *(dst_m + mad24(DST_ROW_00 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[0]; + + // + m10 ( = m10' + x*m00' ) + *(dst_m + mad24(DST_ROW_10 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[1] + xm; + + // + m01 ( = m01' + y*m00' ) + *(dst_m + mad24(DST_ROW_01 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[2] + ym; + + // + m20 ( = m20' + 2*x*m10' + x*x*m00' ) + *(dst_m + mad24(DST_ROW_20 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[3] + x * (mom[1] * 2 + xm); + + // + m11 ( = m11' + x*m01' + y*m10' + x*y*m00' ) + *(dst_m + mad24(DST_ROW_11 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[4] + x * (mom[2] + ym) + y * mom[1]; + + // + m02 ( = m02' + 2*y*m01' + y*y*m00' ) + *(dst_m + mad24(DST_ROW_02 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[5] + y * (mom[2] * 2 + ym); + + // + m30 ( = m30' + 3*x*m20' + 3*x*x*m10' + x*x*x*m00' ) + *(dst_m + mad24(DST_ROW_30 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[6] + x * (3. * mom[3] + x * (3. * mom[1] + xm)); + + // + m21 ( = m21' + x*(2*m11' + 2*y*m10' + x*m01' + x*y*m00') + y*m20') + *(dst_m + mad24(DST_ROW_21 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[7] + x * (2 * (mom[4] + y * mom[1]) + x * (mom[2] + ym)) + y * mom[3]; + + // + m12 ( = m12' + y*(2*m11' + 2*x*m01' + y*m10' + x*y*m00') + x*m02') + *(dst_m + mad24(DST_ROW_12 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[8] + y * (2 * (mom[4] + x * mom[2]) + y * (mom[1] + xm)) + x * mom[5]; + + // + m03 ( = m03' + 3*y*m02' + 3*y*y*m01' + y*y*y*m00' ) + *(dst_m + mad24(DST_ROW_03 * blocky, dst_step, mad24(wgidy, dst_cols, wgidx))) = mom[9] + y * (3. * mom[5] + y * (3. * mom[2] + ym)); } } -//#endif diff --git a/modules/ocl/src/opencl/pyr_up.cl b/modules/ocl/src/opencl/pyr_up.cl index d603ad6bce..0b7f0c9025 100644 --- a/modules/ocl/src/opencl/pyr_up.cl +++ b/modules/ocl/src/opencl/pyr_up.cl @@ -16,6 +16,8 @@ // // @Authors // Zhang Chunpeng chunpeng@multicorewareinc.com +// Dachuan Zhao, dachuan@multicorewareinc.com +// Yao Wang, yao@multicorewareinc.com // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -53,20 +55,22 @@ uchar get_valid_uchar(uchar data) ////////////////////////// CV_8UC1 ////////////////////////////////// /////////////////////////////////////////////////////////////////////// __kernel void pyrUp_C1_D0(__global uchar* src,__global uchar* dst, - int srcRows,int dstRows,int srcCols,int dstCols, - int srcOffset,int dstOffset,int srcStep,int dstStep) + int srcRows,int dstRows,int srcCols,int dstCols, + int srcOffset,int dstOffset,int srcStep,int dstStep) { const int x = get_global_id(0); const int y = get_global_id(1); - __local float s_srcPatch[10][10]; __local float s_dstPatch[20][16]; + const int tidx = get_local_id(0); + const int tidy = get_local_id(1); + const int lsizex = get_local_size(0); + const int lsizey = get_local_size(1); - - if( get_local_id(0) < 10 && get_local_id(1) < 10 ) + if( tidx < 10 && tidy < 10 ) { - int srcx = (int)(get_group_id(0) * get_local_size(0) / 2 + get_local_id(0)) - 1; - int srcy = (int)(get_group_id(1) * get_local_size(1) / 2 + get_local_id(1)) - 1; + int srcx = mad24((int)get_group_id(0), (lsizex>>1), tidx) - 1; + int srcy = mad24((int)get_group_id(1), (lsizey>>1), tidy) - 1; srcx = abs(srcx); srcx = min(srcCols - 1,srcx); @@ -74,25 +78,24 @@ __kernel void pyrUp_C1_D0(__global uchar* src,__global uchar* dst, srcy = abs(srcy); srcy = min(srcRows -1 ,srcy); - s_srcPatch[get_local_id(1)][get_local_id(0)] = (float)(src[srcx + srcy * srcStep]); + s_srcPatch[tidy][tidx] = (float)(src[srcx + srcy * srcStep]); } barrier(CLK_LOCAL_MEM_FENCE); float sum = 0; - const int evenFlag = (int)((get_local_id(0) & 1) == 0); - const int oddFlag = (int)((get_local_id(0) & 1) != 0); - const bool eveny = ((get_local_id(1) & 1) == 0); - const int tidx = get_local_id(0); + const int evenFlag = (int)((tidx & 1) == 0); + const int oddFlag = (int)((tidx & 1) != 0); + const bool eveny = ((tidy & 1) == 0); if(eveny) { - sum = sum + (evenFlag * 0.0625f) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx - 2) >> 1)]; - sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx - 1) >> 1)]; - sum = sum + (evenFlag * 0.375f ) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx ) >> 1)]; - sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx + 1) >> 1)]; - sum = sum + (evenFlag * 0.0625f) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx + 2) >> 1)]; + sum = (evenFlag * 0.0625f) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx - 1) >> 1)]; + sum = sum + (evenFlag * 0.375f ) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx + 1) >> 1)]; + sum = sum + (evenFlag * 0.0625f) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx + 2) >> 1)]; } s_dstPatch[2 + get_local_id(1)][get_local_id(0)] = sum; @@ -103,42 +106,40 @@ __kernel void pyrUp_C1_D0(__global uchar* src,__global uchar* dst, if (eveny) { - sum = sum + (evenFlag * 0.0625f) * s_srcPatch[0][1 + ((tidx - 2) >> 1)]; - sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[0][1 + ((tidx - 1) >> 1)]; - sum = sum + (evenFlag * 0.375f ) * s_srcPatch[0][1 + ((tidx ) >> 1)]; - sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[0][1 + ((tidx + 1) >> 1)]; - sum = sum + (evenFlag * 0.0625f) * s_srcPatch[0][1 + ((tidx + 2) >> 1)]; - } + sum = (evenFlag * 0.0625f) * s_srcPatch[lsizey - 16][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[lsizey - 16][1 + ((tidx - 1) >> 1)]; + sum = sum + (evenFlag * 0.375f ) * s_srcPatch[lsizey - 16][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[lsizey - 16][1 + ((tidx + 1) >> 1)]; + sum = sum + (evenFlag * 0.0625f) * s_srcPatch[lsizey - 16][1 + ((tidx + 2) >> 1)]; + } - s_dstPatch[get_local_id(1)][get_local_id(0)] = sum; - } + s_dstPatch[get_local_id(1)][get_local_id(0)] = sum; + } - if (get_local_id(1) > 13) - { + if (get_local_id(1) > 13) + { sum = 0; if (eveny) { - sum = sum + (evenFlag * 0.0625f) * s_srcPatch[9][1 + ((tidx - 2) >> 1)]; - sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[9][1 + ((tidx - 1) >> 1)]; - sum = sum + (evenFlag * 0.375f ) * s_srcPatch[9][1 + ((tidx ) >> 1)]; - sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[9][1 + ((tidx + 1) >> 1)]; + sum = (evenFlag * 0.0625f) * s_srcPatch[lsizey - 7][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[lsizey - 7][1 + ((tidx - 1) >> 1)]; + sum = sum + (evenFlag * 0.375f ) * s_srcPatch[lsizey - 7][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[lsizey - 7][1 + ((tidx + 1) >> 1)]; sum = sum + (evenFlag * 0.0625f) * s_srcPatch[9][1 + ((tidx + 2) >> 1)]; } - s_dstPatch[4 + get_local_id(1)][get_local_id(0)] = sum; - } + s_dstPatch[4 + tidy][tidx] = sum; + } barrier(CLK_LOCAL_MEM_FENCE); sum = 0; - const int tidy = get_local_id(1); - - sum = sum + 0.0625f * s_dstPatch[2 + tidy - 2][get_local_id(0)]; - sum = sum + 0.25f * s_dstPatch[2 + tidy - 1][get_local_id(0)]; - sum = sum + 0.375f * s_dstPatch[2 + tidy ][get_local_id(0)]; - sum = sum + 0.25f * s_dstPatch[2 + tidy + 1][get_local_id(0)]; - sum = sum + 0.0625f * s_dstPatch[2 + tidy + 2][get_local_id(0)]; + sum = 0.0625f * s_dstPatch[2 + tidy - 2][tidx]; + sum = sum + 0.25f * s_dstPatch[2 + tidy - 1][tidx]; + sum = sum + 0.375f * s_dstPatch[2 + tidy ][tidx]; + sum = sum + 0.25f * s_dstPatch[2 + tidy + 1][tidx]; + sum = sum + 0.0625f * s_dstPatch[2 + tidy + 2][tidx]; if ((x < dstCols) && (y < dstRows)) dst[x + y * dstStep] = (float)(4.0f * sum); @@ -149,8 +150,8 @@ __kernel void pyrUp_C1_D0(__global uchar* src,__global uchar* dst, ////////////////////////// CV_16UC1 ///////////////////////////////// /////////////////////////////////////////////////////////////////////// __kernel void pyrUp_C1_D2(__global ushort* src,__global ushort* dst, - int srcRows,int dstRows,int srcCols,int dstCols, - int srcOffset,int dstOffset,int srcStep,int dstStep) + int srcRows,int dstRows,int srcCols,int dstCols, + int srcOffset,int dstOffset,int srcStep,int dstStep) { const int x = get_global_id(0); const int y = get_global_id(1); @@ -210,13 +211,13 @@ __kernel void pyrUp_C1_D2(__global ushort* src,__global ushort* dst, sum = sum + (evenFlag * 0.375f ) * s_srcPatch[0][1 + ((tidx ) >> 1)]; sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[0][1 + ((tidx + 1) >> 1)]; sum = sum + (evenFlag * 0.0625f) * s_srcPatch[0][1 + ((tidx + 2) >> 1)]; - } + } - s_dstPatch[get_local_id(1)][get_local_id(0)] = sum; - } + s_dstPatch[get_local_id(1)][get_local_id(0)] = sum; + } - if (get_local_id(1) > 13) - { + if (get_local_id(1) > 13) + { sum = 0; if (eveny) @@ -228,7 +229,7 @@ __kernel void pyrUp_C1_D2(__global ushort* src,__global ushort* dst, sum = sum + (evenFlag * 0.0625f) * s_srcPatch[9][1 + ((tidx + 2) >> 1)]; } s_dstPatch[4 + get_local_id(1)][get_local_id(0)] = sum; - } + } barrier(CLK_LOCAL_MEM_FENCE); @@ -251,12 +252,15 @@ __kernel void pyrUp_C1_D2(__global ushort* src,__global ushort* dst, ////////////////////////// CV_32FC1 ///////////////////////////////// /////////////////////////////////////////////////////////////////////// __kernel void pyrUp_C1_D5(__global float* src,__global float* dst, - int srcRows,int dstRows,int srcCols,int dstCols, - int srcOffset,int dstOffset,int srcStep,int dstStep) + int srcRows,int dstRows,int srcCols,int dstCols, + int srcOffset,int dstOffset,int srcStep,int dstStep) { const int x = get_global_id(0); const int y = get_global_id(1); - + const int tidx = get_local_id(0); + const int tidy = get_local_id(1); + const int lsizex = get_local_size(0); + const int lsizey = get_local_size(1); __local float s_srcPatch[10][10]; __local float s_dstPatch[20][16]; @@ -266,10 +270,10 @@ __kernel void pyrUp_C1_D5(__global float* src,__global float* dst, dstStep = dstStep >> 2; - if( get_local_id(0) < 10 && get_local_id(1) < 10 ) + if( tidx < 10 && tidy < 10 ) { - int srcx = (int)(get_group_id(0) * get_local_size(0) / 2 + get_local_id(0)) - 1; - int srcy = (int)(get_group_id(1) * get_local_size(1) / 2 + get_local_id(1)) - 1; + int srcx = mad24((int)get_group_id(0), lsizex>>1, tidx) - 1; + int srcy = mad24((int)get_group_id(1), lsizey>>1, tidy) - 1; srcx = abs(srcx); srcx = min(srcCols - 1,srcx); @@ -277,71 +281,67 @@ __kernel void pyrUp_C1_D5(__global float* src,__global float* dst, srcy = abs(srcy); srcy = min(srcRows -1 ,srcy); - s_srcPatch[get_local_id(1)][get_local_id(0)] = (float)(src[srcx + srcy * srcStep]); + s_srcPatch[tidy][tidx] = (float)(src[srcx + srcy * srcStep]); } barrier(CLK_LOCAL_MEM_FENCE); float sum = 0; - const int evenFlag = (int)((get_local_id(0) & 1) == 0); - const int oddFlag = (int)((get_local_id(0) & 1) != 0); - const bool eveny = ((get_local_id(1) & 1) == 0); - const int tidx = get_local_id(0); + const int evenFlag = (int)((tidx & 1) == 0); + const int oddFlag = (int)((tidx & 1) != 0); + const bool eveny = ((tidy & 1) == 0); + if(eveny) { - sum = sum + (evenFlag * 0.0625f) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx - 2) >> 1)]; - sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx - 1) >> 1)]; - sum = sum + (evenFlag * 0.375f ) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx ) >> 1)]; - sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx + 1) >> 1)]; - sum = sum + (evenFlag * 0.0625f) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx + 2) >> 1)]; + sum = sum + (evenFlag * 0.0625f) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx - 1) >> 1)]; + sum = sum + (evenFlag * 0.375f ) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx + 1) >> 1)]; + sum = sum + (evenFlag * 0.0625f) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx + 2) >> 1)]; } - s_dstPatch[2 + get_local_id(1)][get_local_id(0)] = sum; + s_dstPatch[2 + tidy][tidx] = sum; - if (get_local_id(1) < 2) + if (tidy < 2) { sum = 0; if (eveny) { - sum = sum + (evenFlag * 0.0625f) * s_srcPatch[0][1 + ((tidx - 2) >> 1)]; - sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[0][1 + ((tidx - 1) >> 1)]; - sum = sum + (evenFlag * 0.375f ) * s_srcPatch[0][1 + ((tidx ) >> 1)]; - sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[0][1 + ((tidx + 1) >> 1)]; - sum = sum + (evenFlag * 0.0625f) * s_srcPatch[0][1 + ((tidx + 2) >> 1)]; - } + sum = sum + (evenFlag * 0.0625f) * s_srcPatch[lsizey - 16][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[lsizey - 16][1 + ((tidx - 1) >> 1)]; + sum = sum + (evenFlag * 0.375f ) * s_srcPatch[lsizey - 16][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[lsizey - 16][1 + ((tidx + 1) >> 1)]; + sum = sum + (evenFlag * 0.0625f) * s_srcPatch[lsizey - 16][1 + ((tidx + 2) >> 1)]; + } - s_dstPatch[get_local_id(1)][get_local_id(0)] = sum; - } + s_dstPatch[tidy][tidx] = sum; + } - if (get_local_id(1) > 13) - { + if (tidy > 13) + { sum = 0; if (eveny) { - sum = sum + (evenFlag * 0.0625f) * s_srcPatch[9][1 + ((tidx - 2) >> 1)]; - sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[9][1 + ((tidx - 1) >> 1)]; - sum = sum + (evenFlag * 0.375f ) * s_srcPatch[9][1 + ((tidx ) >> 1)]; - sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[9][1 + ((tidx + 1) >> 1)]; - sum = sum + (evenFlag * 0.0625f) * s_srcPatch[9][1 + ((tidx + 2) >> 1)]; + sum = sum + (evenFlag * 0.0625f) * s_srcPatch[lsizey - 7][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[lsizey - 7][1 + ((tidx - 1) >> 1)]; + sum = sum + (evenFlag * 0.375f ) * s_srcPatch[lsizey - 7][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * 0.25f ) * s_srcPatch[lsizey - 7][1 + ((tidx + 1) >> 1)]; + sum = sum + (evenFlag * 0.0625f) * s_srcPatch[lsizey - 7][1 + ((tidx + 2) >> 1)]; } - s_dstPatch[4 + get_local_id(1)][get_local_id(0)] = sum; - } + s_dstPatch[4 + tidy][tidx] = sum; + } barrier(CLK_LOCAL_MEM_FENCE); - sum = 0; - - const int tidy = get_local_id(1); - - sum = sum + 0.0625f * s_dstPatch[2 + tidy - 2][get_local_id(0)]; - sum = sum + 0.25f * s_dstPatch[2 + tidy - 1][get_local_id(0)]; - sum = sum + 0.375f * s_dstPatch[2 + tidy ][get_local_id(0)]; - sum = sum + 0.25f * s_dstPatch[2 + tidy + 1][get_local_id(0)]; - sum = sum + 0.0625f * s_dstPatch[2 + tidy + 2][get_local_id(0)]; + sum = 0.0625f * s_dstPatch[2 + tidy - 2][tidx]; + sum = sum + 0.25f * s_dstPatch[2 + tidy - 1][tidx]; + sum = sum + 0.375f * s_dstPatch[2 + tidy ][tidx]; + sum = sum + 0.25f * s_dstPatch[2 + tidy + 1][tidx]; + sum = sum + 0.0625f * s_dstPatch[2 + tidy + 2][tidx]; if ((x < dstCols) && (y < dstRows)) dst[x + y * dstStep] = (float)(4.0f * sum); @@ -376,37 +376,16 @@ uchar4 convert_float4_to_uchar4(float4 data) return u4Data; } -float4 int_x_float4(int leftOpr,float4 rightOpr) -{ - float4 result = {0,0,0,0}; - - result.x = rightOpr.x * leftOpr; - result.y = rightOpr.y * leftOpr; - result.z = rightOpr.z * leftOpr; - result.w = rightOpr.w * leftOpr; - - return result; -} - -float4 float4_x_float4(float4 leftOpr,float4 rightOpr) -{ - float4 result; - - result.x = leftOpr.x * rightOpr.x; - result.y = leftOpr.y * rightOpr.y; - result.z = leftOpr.z * rightOpr.z; - result.w = leftOpr.w * rightOpr.w; - - return result; -} - __kernel void pyrUp_C4_D0(__global uchar4* src,__global uchar4* dst, - int srcRows,int dstRows,int srcCols,int dstCols, - int srcOffset,int dstOffset,int srcStep,int dstStep) + int srcRows,int dstRows,int srcCols,int dstCols, + int srcOffset,int dstOffset,int srcStep,int dstStep) { const int x = get_global_id(0); const int y = get_global_id(1); - + const int tidx = get_local_id(0); + const int tidy = get_local_id(1); + const int lsizex = get_local_size(0); + const int lsizey = get_local_size(1); __local float4 s_srcPatch[10][10]; __local float4 s_dstPatch[20][16]; @@ -416,10 +395,10 @@ __kernel void pyrUp_C4_D0(__global uchar4* src,__global uchar4* dst, dstStep >>= 2; - if( get_local_id(0) < 10 && get_local_id(1) < 10 ) + if( tidx < 10 && tidy < 10 ) { - int srcx = (int)(get_group_id(0) * get_local_size(0) / 2 + get_local_id(0)) - 1; - int srcy = (int)(get_group_id(1) * get_local_size(1) / 2 + get_local_id(1)) - 1; + int srcx = mad24((int)get_group_id(0), lsizex>>1, tidx) - 1; + int srcy = mad24((int)get_group_id(1), lsizey>>1, tidy) - 1; srcx = abs(srcx); srcx = min(srcCols - 1,srcx); @@ -427,17 +406,16 @@ __kernel void pyrUp_C4_D0(__global uchar4* src,__global uchar4* dst, srcy = abs(srcy); srcy = min(srcRows -1 ,srcy); - s_srcPatch[get_local_id(1)][get_local_id(0)] = covert_uchar4_to_float4(src[srcx + srcy * srcStep]); + s_srcPatch[tidy][tidx] = covert_uchar4_to_float4(src[srcx + srcy * srcStep]); } barrier(CLK_LOCAL_MEM_FENCE); float4 sum = (float4)(0,0,0,0); - const int evenFlag = (int)((get_local_id(0) & 1) == 0); - const int oddFlag = (int)((get_local_id(0) & 1) != 0); - const bool eveny = ((get_local_id(1) & 1) == 0); - const int tidx = get_local_id(0); + const int evenFlag = (int)((tidx & 1) == 0); + const int oddFlag = (int)((tidx & 1) != 0); + const bool eveny = ((tidy & 1) == 0); float4 co1 = (float4)(0.375f, 0.375f, 0.375f, 0.375f); float4 co2 = (float4)(0.25f, 0.25f, 0.25f, 0.25f); @@ -446,63 +424,59 @@ __kernel void pyrUp_C4_D0(__global uchar4* src,__global uchar4* dst, if(eveny) { - sum = sum + float4_x_float4(int_x_float4( evenFlag, co3 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx - 2) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx - 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( evenFlag, co1 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx ) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx + 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( evenFlag, co3 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx + 2) >> 1)]); + sum = sum + ( evenFlag * co3) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * co2 ) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx - 1) >> 1)]; + sum = sum + ( evenFlag * co1) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * co2 ) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx + 1) >> 1)]; + sum = sum + ( evenFlag * co3) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx + 2) >> 1)]; } - s_dstPatch[2 + get_local_id(1)][get_local_id(0)] = sum; + s_dstPatch[2 + tidy][tidx] = sum; - if (get_local_id(1) < 2) + if (tidy < 2) { sum = 0; if (eveny) { - sum = sum + float4_x_float4(int_x_float4(evenFlag , co3) , s_srcPatch[0][1 + ((tidx - 2) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2 ) , s_srcPatch[0][1 + ((tidx - 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4(evenFlag , co1 ) , s_srcPatch[0][1 + ((tidx ) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2 ) , s_srcPatch[0][1 + ((tidx + 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4(evenFlag , co3) , s_srcPatch[0][1 + ((tidx + 2) >> 1)]); - } + sum = sum + (evenFlag * co3) * s_srcPatch[lsizey-16][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * co2) * s_srcPatch[lsizey-16][1 + ((tidx - 1) >> 1)]; + sum = sum + (evenFlag * co1) * s_srcPatch[lsizey-16][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * co2) * s_srcPatch[lsizey-16][1 + ((tidx + 1) >> 1)]; + sum = sum + (evenFlag * co3) * s_srcPatch[lsizey-16][1 + ((tidx + 2) >> 1)]; + } - s_dstPatch[get_local_id(1)][get_local_id(0)] = sum; - } + s_dstPatch[tidy][tidx] = sum; + } - if (get_local_id(1) > 13) - { + if (tidy > 13) + { sum = 0; if (eveny) { - sum = sum + float4_x_float4(int_x_float4(evenFlag , co3) , s_srcPatch[9][1 + ((tidx - 2) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2) , s_srcPatch[9][1 + ((tidx - 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4(evenFlag , co1) , s_srcPatch[9][1 + ((tidx ) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2) , s_srcPatch[9][1 + ((tidx + 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4(evenFlag , co3) , s_srcPatch[9][1 + ((tidx + 2) >> 1)]); + sum = sum + (evenFlag * co3) * s_srcPatch[lsizey-7][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * co2) * s_srcPatch[lsizey-7][1 + ((tidx - 1) >> 1)]; + sum = sum + (evenFlag * co1) * s_srcPatch[lsizey-7][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * co2) * s_srcPatch[lsizey-7][1 + ((tidx + 1) >> 1)]; + sum = sum + (evenFlag * co3) * s_srcPatch[lsizey-7][1 + ((tidx + 2) >> 1)]; } - s_dstPatch[4 + get_local_id(1)][get_local_id(0)] = sum; - } + s_dstPatch[4 + tidy][tidx] = sum; + } barrier(CLK_LOCAL_MEM_FENCE); - sum = 0; - - const int tidy = get_local_id(1); - - sum = sum + float4_x_float4(co3 , s_dstPatch[2 + tidy - 2][get_local_id(0)]); - sum = sum + float4_x_float4(co2 , s_dstPatch[2 + tidy - 1][get_local_id(0)]); - sum = sum + float4_x_float4(co1 , s_dstPatch[2 + tidy ][get_local_id(0)]); - sum = sum + float4_x_float4(co2 , s_dstPatch[2 + tidy + 1][get_local_id(0)]); - sum = sum + float4_x_float4(co3 , s_dstPatch[2 + tidy + 2][get_local_id(0)]); + sum = co3 * s_dstPatch[2 + tidy - 2][tidx]; + sum = sum + co2 * s_dstPatch[2 + tidy - 1][tidx]; + sum = sum + co1 * s_dstPatch[2 + tidy ][tidx]; + sum = sum + co2 * s_dstPatch[2 + tidy + 1][tidx]; + sum = sum + co3 * s_dstPatch[2 + tidy + 2][tidx]; if ((x < dstCols) && (y < dstRows)) { - dst[x + y * dstStep] = convert_float4_to_uchar4(int_x_float4(4.0f,sum)); + dst[x + y * dstStep] = convert_float4_to_uchar4(4.0f * sum); } } /////////////////////////////////////////////////////////////////////// @@ -535,8 +509,8 @@ ushort4 convert_float4_to_ushort4(float4 data) __kernel void pyrUp_C4_D2(__global ushort4* src,__global ushort4* dst, - int srcRows,int dstRows,int srcCols,int dstCols, - int srcOffset,int dstOffset,int srcStep,int dstStep) + int srcRows,int dstRows,int srcCols,int dstCols, + int srcOffset,int dstOffset,int srcStep,int dstStep) { const int x = get_global_id(0); const int y = get_global_id(1); @@ -580,11 +554,11 @@ __kernel void pyrUp_C4_D2(__global ushort4* src,__global ushort4* dst, if(eveny) { - sum = sum + float4_x_float4(int_x_float4( evenFlag, co3 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx - 2) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx - 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( evenFlag, co1 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx ) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx + 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( evenFlag, co3 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx + 2) >> 1)]); + sum = sum + ( evenFlag* co3 ) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * co2 ) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx - 1) >> 1)]; + sum = sum + ( evenFlag* co1 ) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * co2 ) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx + 1) >> 1)]; + sum = sum + ( evenFlag* co3 ) * s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx + 2) >> 1)]; } @@ -596,31 +570,31 @@ __kernel void pyrUp_C4_D2(__global ushort4* src,__global ushort4* dst, if (eveny) { - sum = sum + float4_x_float4(int_x_float4(evenFlag , co3) , s_srcPatch[0][1 + ((tidx - 2) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2 ) , s_srcPatch[0][1 + ((tidx - 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4(evenFlag , co1 ) , s_srcPatch[0][1 + ((tidx ) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2 ) , s_srcPatch[0][1 + ((tidx + 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4(evenFlag , co3) , s_srcPatch[0][1 + ((tidx + 2) >> 1)]); - } + sum = sum + (evenFlag * co3) * s_srcPatch[0][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * co2 ) * s_srcPatch[0][1 + ((tidx - 1) >> 1)]; + sum = sum + (evenFlag * co1 ) * s_srcPatch[0][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * co2 ) * s_srcPatch[0][1 + ((tidx + 1) >> 1)]; + sum = sum + (evenFlag * co3) * s_srcPatch[0][1 + ((tidx + 2) >> 1)]; + } - s_dstPatch[get_local_id(1)][get_local_id(0)] = sum; - } + s_dstPatch[get_local_id(1)][get_local_id(0)] = sum; + } - if (get_local_id(1) > 13) - { + if (get_local_id(1) > 13) + { sum = 0; if (eveny) { - sum = sum + float4_x_float4(int_x_float4(evenFlag , co3) , s_srcPatch[9][1 + ((tidx - 2) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2) , s_srcPatch[9][1 + ((tidx - 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4(evenFlag , co1) , s_srcPatch[9][1 + ((tidx ) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2) , s_srcPatch[9][1 + ((tidx + 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4(evenFlag , co3) , s_srcPatch[9][1 + ((tidx + 2) >> 1)]); + sum = sum + (evenFlag * co3) * s_srcPatch[9][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * co2) * s_srcPatch[9][1 + ((tidx - 1) >> 1)]; + sum = sum + (evenFlag * co1) * s_srcPatch[9][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * co2) * s_srcPatch[9][1 + ((tidx + 1) >> 1)]; + sum = sum + (evenFlag * co3) * s_srcPatch[9][1 + ((tidx + 2) >> 1)]; } s_dstPatch[4 + get_local_id(1)][get_local_id(0)] = sum; - } + } barrier(CLK_LOCAL_MEM_FENCE); @@ -628,15 +602,15 @@ __kernel void pyrUp_C4_D2(__global ushort4* src,__global ushort4* dst, const int tidy = get_local_id(1); - sum = sum + float4_x_float4(co3 , s_dstPatch[2 + tidy - 2][get_local_id(0)]); - sum = sum + float4_x_float4(co2 , s_dstPatch[2 + tidy - 1][get_local_id(0)]); - sum = sum + float4_x_float4(co1 , s_dstPatch[2 + tidy ][get_local_id(0)]); - sum = sum + float4_x_float4(co2 , s_dstPatch[2 + tidy + 1][get_local_id(0)]); - sum = sum + float4_x_float4(co3 , s_dstPatch[2 + tidy + 2][get_local_id(0)]); + sum = sum + co3 * s_dstPatch[2 + tidy - 2][get_local_id(0)]; + sum = sum + co2 * s_dstPatch[2 + tidy - 1][get_local_id(0)]; + sum = sum + co1 * s_dstPatch[2 + tidy ][get_local_id(0)]; + sum = sum + co2 * s_dstPatch[2 + tidy + 1][get_local_id(0)]; + sum = sum + co3 * s_dstPatch[2 + tidy + 2][get_local_id(0)]; if ((x < dstCols) && (y < dstRows)) { - dst[x + y * dstStep] = convert_float4_to_ushort4(int_x_float4(4.0f,sum)); + dst[x + y * dstStep] = convert_float4_to_ushort4(4.0f * sum); } } @@ -644,12 +618,15 @@ __kernel void pyrUp_C4_D2(__global ushort4* src,__global ushort4* dst, ////////////////////////// CV_32FC4 ////////////////////////////////// /////////////////////////////////////////////////////////////////////// __kernel void pyrUp_C4_D5(__global float4* src,__global float4* dst, - int srcRows,int dstRows,int srcCols,int dstCols, - int srcOffset,int dstOffset,int srcStep,int dstStep) + int srcRows,int dstRows,int srcCols,int dstCols, + int srcOffset,int dstOffset,int srcStep,int dstStep) { const int x = get_global_id(0); const int y = get_global_id(1); - + const int tidx = get_local_id(0); + const int tidy = get_local_id(1); + const int lsizex = get_local_size(0); + const int lsizey = get_local_size(1); __local float4 s_srcPatch[10][10]; __local float4 s_dstPatch[20][16]; @@ -659,10 +636,10 @@ __kernel void pyrUp_C4_D5(__global float4* src,__global float4* dst, dstStep >>= 4; - if( get_local_id(0) < 10 && get_local_id(1) < 10 ) + if( tidx < 10 && tidy < 10 ) { - int srcx = (int)(get_group_id(0) * get_local_size(0) / 2 + get_local_id(0)) - 1; - int srcy = (int)(get_group_id(1) * get_local_size(1) / 2 + get_local_id(1)) - 1; + int srcx = (int)(get_group_id(0) * get_local_size(0) / 2 + tidx) - 1; + int srcy = (int)(get_group_id(1) * get_local_size(1) / 2 + tidy) - 1; srcx = abs(srcx); srcx = min(srcCols - 1,srcx); @@ -670,17 +647,16 @@ __kernel void pyrUp_C4_D5(__global float4* src,__global float4* dst, srcy = abs(srcy); srcy = min(srcRows -1 ,srcy); - s_srcPatch[get_local_id(1)][get_local_id(0)] = (float4)(src[srcx + srcy * srcStep]); + s_srcPatch[tidy][tidx] = (float4)(src[srcx + srcy * srcStep]); } barrier(CLK_LOCAL_MEM_FENCE); float4 sum = (float4)(0,0,0,0); - const int evenFlag = (int)((get_local_id(0) & 1) == 0); - const int oddFlag = (int)((get_local_id(0) & 1) != 0); - const bool eveny = ((get_local_id(1) & 1) == 0); - const int tidx = get_local_id(0); + const int evenFlag = (int)((tidx & 1) == 0); + const int oddFlag = (int)((tidx & 1) != 0); + const bool eveny = ((tidy & 1) == 0); float4 co1 = (float4)(0.375f, 0.375f, 0.375f, 0.375f); float4 co2 = (float4)(0.25f, 0.25f, 0.25f, 0.25f); @@ -689,59 +665,55 @@ __kernel void pyrUp_C4_D5(__global float4* src,__global float4* dst, if(eveny) { - sum = sum + float4_x_float4(int_x_float4( evenFlag, co3 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx - 2) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx - 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( evenFlag, co1 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx ) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx + 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( evenFlag, co3 ) , s_srcPatch[1 + (get_local_id(1) >> 1)][1 + ((tidx + 2) >> 1)]); + sum = sum + ( evenFlag* co3 ) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * co2 ) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx - 1) >> 1)]; + sum = sum + ( evenFlag* co1 ) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * co2 ) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx + 1) >> 1)]; + sum = sum + ( evenFlag* co3 ) * s_srcPatch[1 + (tidy >> 1)][1 + ((tidx + 2) >> 1)]; } - s_dstPatch[2 + get_local_id(1)][get_local_id(0)] = sum; + s_dstPatch[2 + tidy][tidx] = sum; - if (get_local_id(1) < 2) + if (tidy < 2) { sum = 0; if (eveny) { - sum = sum + float4_x_float4(int_x_float4(evenFlag , co3) , s_srcPatch[0][1 + ((tidx - 2) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2 ) , s_srcPatch[0][1 + ((tidx - 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4(evenFlag , co1 ) , s_srcPatch[0][1 + ((tidx ) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2 ) , s_srcPatch[0][1 + ((tidx + 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4(evenFlag , co3) , s_srcPatch[0][1 + ((tidx + 2) >> 1)]); - } + sum = sum + (evenFlag * co3) * s_srcPatch[lsizey-16][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * co2 ) * s_srcPatch[lsizey-16][1 + ((tidx - 1) >> 1)]; + sum = sum + (evenFlag * co1 ) * s_srcPatch[lsizey-16][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * co2 ) * s_srcPatch[lsizey-16][1 + ((tidx + 1) >> 1)]; + sum = sum + (evenFlag * co3) * s_srcPatch[lsizey-16][1 + ((tidx + 2) >> 1)]; + } - s_dstPatch[get_local_id(1)][get_local_id(0)] = sum; - } + s_dstPatch[tidy][tidx] = sum; + } - if (get_local_id(1) > 13) - { + if (tidy > 13) + { sum = 0; if (eveny) { - sum = sum + float4_x_float4(int_x_float4(evenFlag , co3) , s_srcPatch[9][1 + ((tidx - 2) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2) , s_srcPatch[9][1 + ((tidx - 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4(evenFlag , co1) , s_srcPatch[9][1 + ((tidx ) >> 1)]); - sum = sum + float4_x_float4(int_x_float4( oddFlag , co2) , s_srcPatch[9][1 + ((tidx + 1) >> 1)]); - sum = sum + float4_x_float4(int_x_float4(evenFlag , co3) , s_srcPatch[9][1 + ((tidx + 2) >> 1)]); + sum = sum + (evenFlag * co3) * s_srcPatch[lsizey-7][1 + ((tidx - 2) >> 1)]; + sum = sum + ( oddFlag * co2) * s_srcPatch[lsizey-7][1 + ((tidx - 1) >> 1)]; + sum = sum + (evenFlag * co1) * s_srcPatch[lsizey-7][1 + ((tidx ) >> 1)]; + sum = sum + ( oddFlag * co2) * s_srcPatch[lsizey-7][1 + ((tidx + 1) >> 1)]; + sum = sum + (evenFlag * co3) * s_srcPatch[lsizey-7][1 + ((tidx + 2) >> 1)]; } - s_dstPatch[4 + get_local_id(1)][get_local_id(0)] = sum; - } + s_dstPatch[4 + tidy][tidx] = sum; + } barrier(CLK_LOCAL_MEM_FENCE); - sum = 0; - - const int tidy = get_local_id(1); - - sum = sum + float4_x_float4(co3 , s_dstPatch[2 + tidy - 2][get_local_id(0)]); - sum = sum + float4_x_float4(co2 , s_dstPatch[2 + tidy - 1][get_local_id(0)]); - sum = sum + float4_x_float4(co1 , s_dstPatch[2 + tidy ][get_local_id(0)]); - sum = sum + float4_x_float4(co2 , s_dstPatch[2 + tidy + 1][get_local_id(0)]); - sum = sum + float4_x_float4(co3 , s_dstPatch[2 + tidy + 2][get_local_id(0)]); + sum = co3 * s_dstPatch[2 + tidy - 2][tidx]; + sum = sum + co2 * s_dstPatch[2 + tidy - 1][tidx]; + sum = sum + co1 * s_dstPatch[2 + tidy ][tidx]; + sum = sum + co2 * s_dstPatch[2 + tidy + 1][tidx]; + sum = sum + co3 * s_dstPatch[2 + tidy + 2][tidx]; if ((x < dstCols) && (y < dstRows)) { diff --git a/modules/ocl/src/opencl/stereobm.cl b/modules/ocl/src/opencl/stereobm.cl index 954283987b..99177c7bd0 100644 --- a/modules/ocl/src/opencl/stereobm.cl +++ b/modules/ocl/src/opencl/stereobm.cl @@ -323,7 +323,7 @@ float sobel(__global unsigned char *input, int x, int y, int rows, int cols) float conv = 0; int y1 = y==0? 0 : y-1; int x1 = x==0? 0 : x-1; - if(x < cols && y < rows) + if(x < cols && y < rows && x > 0 && y > 0) { conv = (float)input[(y1) * cols + (x1)] * (-1) + (float)input[(y1) * cols + (x+1)] * (1) + (float)input[(y) * cols + (x1)] * (-2) + (float)input[(y) * cols + (x+1)] * (2) + diff --git a/modules/ocl/test/test_brute_force_matcher.cpp b/modules/ocl/test/test_brute_force_matcher.cpp index bdf1f8a4af..424781fe0a 100644 --- a/modules/ocl/test/test_brute_force_matcher.cpp +++ b/modules/ocl/test/test_brute_force_matcher.cpp @@ -110,7 +110,7 @@ namespace } }; - TEST_P(BruteForceMatcher, DISABLED_Match_Single) + TEST_P(BruteForceMatcher, Match_Single) { cv::ocl::BruteForceMatcher_OCL_base matcher(distType); @@ -130,7 +130,7 @@ namespace ASSERT_EQ(0, badCount); } - TEST_P(BruteForceMatcher, DISABLED_KnnMatch_2_Single) + TEST_P(BruteForceMatcher, KnnMatch_2_Single) { const int knn = 2; diff --git a/modules/ocl/test/test_match_template.cpp b/modules/ocl/test/test_match_template.cpp index 2fc6a10f5a..5da7f01cd8 100644 --- a/modules/ocl/test/test_match_template.cpp +++ b/modules/ocl/test/test_match_template.cpp @@ -75,7 +75,7 @@ PARAM_TEST_CASE(MatchTemplate8U, cv::Size, TemplateSize, Channels, TemplateMetho } }; -TEST_P(MatchTemplate8U, DISABLED_Accuracy) +TEST_P(MatchTemplate8U, Accuracy) { std::cout << "Method: " << TEMPLATE_METHOD_NAMES[method] << std::endl; @@ -138,18 +138,18 @@ TEST_P(MatchTemplate32F, Accuracy) EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1, sss); } -INSTANTIATE_TEST_CASE_P(GPU_ImgProc, MatchTemplate8U, +INSTANTIATE_TEST_CASE_P(OCL_ImgProc, MatchTemplate8U, testing::Combine( MTEMP_SIZES, - testing::Values(TemplateSize(cv::Size(5, 5)), TemplateSize(cv::Size(16, 16))/*, TemplateSize(cv::Size(30, 30))*/), + testing::Values(TemplateSize(cv::Size(5, 5)), TemplateSize(cv::Size(16, 16)), TemplateSize(cv::Size(30, 30))), testing::Values(Channels(1), Channels(3), Channels(4)), ALL_TEMPLATE_METHODS ) ); -INSTANTIATE_TEST_CASE_P(GPU_ImgProc, MatchTemplate32F, testing::Combine( +INSTANTIATE_TEST_CASE_P(OCL_ImgProc, MatchTemplate32F, testing::Combine( MTEMP_SIZES, - testing::Values(TemplateSize(cv::Size(5, 5)), TemplateSize(cv::Size(16, 16))/*, TemplateSize(cv::Size(30, 30))*/), + testing::Values(TemplateSize(cv::Size(5, 5)), TemplateSize(cv::Size(16, 16)), TemplateSize(cv::Size(30, 30))), testing::Values(Channels(1), Channels(3), Channels(4)), testing::Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_CCORR)))); #endif diff --git a/modules/superres/include/opencv2/superres.hpp b/modules/superres/include/opencv2/superres.hpp index 46168229ec..b85d0c1bd1 100644 --- a/modules/superres/include/opencv2/superres.hpp +++ b/modules/superres/include/opencv2/superres.hpp @@ -11,7 +11,7 @@ // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/superres/include/opencv2/superres/optical_flow.hpp b/modules/superres/include/opencv2/superres/optical_flow.hpp index cd0bb31c72..2717380a70 100644 --- a/modules/superres/include/opencv2/superres/optical_flow.hpp +++ b/modules/superres/include/opencv2/superres/optical_flow.hpp @@ -11,7 +11,7 @@ // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/superres/perf/perf_main.cpp b/modules/superres/perf/perf_main.cpp index 80575d89f0..adc69e6e8b 100644 --- a/modules/superres/perf/perf_main.cpp +++ b/modules/superres/perf/perf_main.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" using namespace perf; diff --git a/modules/superres/perf/perf_precomp.cpp b/modules/superres/perf/perf_precomp.cpp index 8552ac3d42..81f16e8f14 100644 --- a/modules/superres/perf/perf_precomp.cpp +++ b/modules/superres/perf/perf_precomp.cpp @@ -1 +1,43 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" diff --git a/modules/superres/perf/perf_precomp.hpp b/modules/superres/perf/perf_precomp.hpp index 27dfd18080..0c41001252 100644 --- a/modules/superres/perf/perf_precomp.hpp +++ b/modules/superres/perf/perf_precomp.hpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifdef __GNUC__ # pragma GCC diagnostic ignored "-Wmissing-declarations" # if defined __clang__ || defined __APPLE__ diff --git a/modules/superres/perf/perf_superres.cpp b/modules/superres/perf/perf_superres.cpp index eec01a7853..8651b55325 100644 --- a/modules/superres/perf/perf_superres.cpp +++ b/modules/superres/perf/perf_superres.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "perf_precomp.hpp" using namespace std; diff --git a/modules/superres/src/btv_l1.cpp b/modules/superres/src/btv_l1.cpp index ed5acaf43b..178e434ade 100644 --- a/modules/superres/src/btv_l1.cpp +++ b/modules/superres/src/btv_l1.cpp @@ -11,7 +11,7 @@ // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/superres/src/btv_l1_gpu.cpp b/modules/superres/src/btv_l1_gpu.cpp index 5a24588676..fffcb23fae 100644 --- a/modules/superres/src/btv_l1_gpu.cpp +++ b/modules/superres/src/btv_l1_gpu.cpp @@ -11,7 +11,7 @@ // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/superres/src/cuda/btv_l1_gpu.cu b/modules/superres/src/cuda/btv_l1_gpu.cu index 772e11d4fe..b27671aa0d 100644 --- a/modules/superres/src/cuda/btv_l1_gpu.cu +++ b/modules/superres/src/cuda/btv_l1_gpu.cu @@ -11,7 +11,7 @@ // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/superres/src/frame_source.cpp b/modules/superres/src/frame_source.cpp index 83460dcefc..7a753eab06 100644 --- a/modules/superres/src/frame_source.cpp +++ b/modules/superres/src/frame_source.cpp @@ -11,7 +11,7 @@ // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -39,7 +39,6 @@ // the use of this software, even if advised of the possibility of such damage. // //M*/ - #include "precomp.hpp" using namespace cv; diff --git a/modules/superres/src/input_array_utility.cpp b/modules/superres/src/input_array_utility.cpp index 5220cb4980..9655d8d9d2 100644 --- a/modules/superres/src/input_array_utility.cpp +++ b/modules/superres/src/input_array_utility.cpp @@ -11,7 +11,7 @@ // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/superres/src/input_array_utility.hpp b/modules/superres/src/input_array_utility.hpp index 95dc821748..c8141234df 100644 --- a/modules/superres/src/input_array_utility.hpp +++ b/modules/superres/src/input_array_utility.hpp @@ -11,7 +11,7 @@ // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/superres/src/optical_flow.cpp b/modules/superres/src/optical_flow.cpp index 21d29244f4..def0d9d767 100644 --- a/modules/superres/src/optical_flow.cpp +++ b/modules/superres/src/optical_flow.cpp @@ -11,7 +11,7 @@ // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/superres/src/precomp.cpp b/modules/superres/src/precomp.cpp index 111385282e..3c01a2596d 100644 --- a/modules/superres/src/precomp.cpp +++ b/modules/superres/src/precomp.cpp @@ -11,7 +11,7 @@ // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/superres/src/precomp.hpp b/modules/superres/src/precomp.hpp index 8aa132efe9..86d9a28112 100644 --- a/modules/superres/src/precomp.hpp +++ b/modules/superres/src/precomp.hpp @@ -11,7 +11,7 @@ // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/superres/src/ring_buffer.hpp b/modules/superres/src/ring_buffer.hpp index 3c51d7a26d..a0c0c04b5e 100644 --- a/modules/superres/src/ring_buffer.hpp +++ b/modules/superres/src/ring_buffer.hpp @@ -11,7 +11,7 @@ // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/superres/src/super_resolution.cpp b/modules/superres/src/super_resolution.cpp index fbaa08075b..031a59b295 100644 --- a/modules/superres/src/super_resolution.cpp +++ b/modules/superres/src/super_resolution.cpp @@ -11,7 +11,7 @@ // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, diff --git a/modules/superres/test/test_main.cpp b/modules/superres/test/test_main.cpp index 146e262850..b1998b9320 100644 --- a/modules/superres/test/test_main.cpp +++ b/modules/superres/test/test_main.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "test_precomp.hpp" CV_TEST_MAIN("superres") diff --git a/modules/superres/test/test_precomp.cpp b/modules/superres/test/test_precomp.cpp index 5956e13e3e..0fb6521809 100644 --- a/modules/superres/test/test_precomp.cpp +++ b/modules/superres/test/test_precomp.cpp @@ -1 +1,43 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "test_precomp.hpp" diff --git a/modules/superres/test/test_precomp.hpp b/modules/superres/test/test_precomp.hpp index e770a9e8c7..e9418c7b0b 100644 --- a/modules/superres/test/test_precomp.hpp +++ b/modules/superres/test/test_precomp.hpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifdef __GNUC__ # pragma GCC diagnostic ignored "-Wmissing-declarations" # if defined __clang__ || defined __APPLE__ diff --git a/modules/superres/test/test_superres.cpp b/modules/superres/test/test_superres.cpp index 44d6a7a2a0..b4a546c621 100644 --- a/modules/superres/test/test_superres.cpp +++ b/modules/superres/test/test_superres.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "test_precomp.hpp" class AllignedFrameSource : public cv::superres::FrameSource diff --git a/modules/ts/include/opencv2/ts/gpu_perf.hpp b/modules/ts/include/opencv2/ts/gpu_perf.hpp index 330ca6ccee..dea4869ccd 100644 --- a/modules/ts/include/opencv2/ts/gpu_perf.hpp +++ b/modules/ts/include/opencv2/ts/gpu_perf.hpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef __OPENCV_GPU_PERF_UTILITY_HPP__ #define __OPENCV_GPU_PERF_UTILITY_HPP__ diff --git a/modules/ts/include/opencv2/ts/gpu_test.hpp b/modules/ts/include/opencv2/ts/gpu_test.hpp index 5ec050ff2c..bb6ee6fd97 100644 --- a/modules/ts/include/opencv2/ts/gpu_test.hpp +++ b/modules/ts/include/opencv2/ts/gpu_test.hpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #ifndef __OPENCV_GPU_TEST_UTILITY_HPP__ #define __OPENCV_GPU_TEST_UTILITY_HPP__ diff --git a/modules/ts/src/gpu_perf.cpp b/modules/ts/src/gpu_perf.cpp index 99d74b1330..6c094666c8 100644 --- a/modules/ts/src/gpu_perf.cpp +++ b/modules/ts/src/gpu_perf.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "opencv2/ts/gpu_perf.hpp" #include "opencv2/core/gpumat.hpp" diff --git a/modules/ts/src/gpu_test.cpp b/modules/ts/src/gpu_test.cpp index 2ac9467b44..6f839c341c 100644 --- a/modules/ts/src/gpu_test.cpp +++ b/modules/ts/src/gpu_test.cpp @@ -1,3 +1,45 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + #include "opencv2/ts/gpu_test.hpp" #include diff --git a/modules/world/CMakeLists.txt b/modules/world/CMakeLists.txt index a75037cfc7..f18635e620 100644 --- a/modules/world/CMakeLists.txt +++ b/modules/world/CMakeLists.txt @@ -80,6 +80,35 @@ foreach(m ${OPENCV_MODULE_${the_module}_DEPS}) endforeach() endforeach() + +macro(ios_include_3party_libs) + foreach(l ${ARGN}) + add_dependencies(${the_module} ${l}) + string(REGEX REPLACE "" "${l}" objpath1 "${CMAKE_BINARY_DIR}/3rdparty/${l}/${objpath0}") + file(GLOB sources ${CMAKE_SOURCE_DIR}/3rdparty/${l}/*.c) + foreach(srcname ${sources}) + if(IS_ABSOLUTE "${srcname}") + file(RELATIVE_PATH srcname "${CMAKE_SOURCE_DIR}/3rdparty/${l}" "${srcname}") + endif() + + string(REPLACE ".." "__" srcname "${srcname}") + get_filename_component(srcname_we ${srcname} NAME_WE) + string(REGEX REPLACE "${srcname_we}" objpath2 "${objpath1}") + string(REGEX REPLACE "${srcname}" objpath3 "${objpath2}") + + list(APPEND objlist "\"${objpath3}\"") + endforeach() # (srcname ${sources}) + endforeach() +endmacro() + +if(IOS AND WITH_PNG) + ios_include_3party_libs(zlib libpng) +endif() + +if(IOS AND WITH_JPEG) + ios_include_3party_libs(libjpeg) +endif() + string(REPLACE ";" " " objlist "${objlist}") if(have_cfg) diff --git a/samples/cpp/CMakeLists.txt b/samples/cpp/CMakeLists.txt index f3a38b80b8..c7f63bf726 100644 --- a/samples/cpp/CMakeLists.txt +++ b/samples/cpp/CMakeLists.txt @@ -32,9 +32,11 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) if("${srcs}" MATCHES "tutorial_code") set(sample_kind tutorial) set(sample_KIND TUTORIAL) + set(sample_folder "samples//tutorials") else() set(sample_kind example) set(sample_KIND EXAMPLE) + set(sample_folder "samples//cpp") endif() set(the_target "${sample_kind}_${name}") @@ -50,7 +52,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) PROJECT_LABEL "(${sample_KIND}) ${name}") if(ENABLE_SOLUTION_FOLDERS) - set_target_properties(${the_target} PROPERTIES FOLDER "${sample_kind}s//cpp") + set_target_properties(${the_target} PROPERTIES FOLDER "${sample_folder}") endif() if(WIN32) @@ -58,7 +60,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG") endif() install(TARGETS ${the_target} - RUNTIME DESTINATION "${sample_kind}s/cpp" COMPONENT main) + RUNTIME DESTINATION "${sample_folder}" COMPONENT main) endif() ENDMACRO()