mirror of https://github.com/opencv/opencv.git
Merge pull request #2022 from asmorkalov:ocv_dynamic_cuda
commit
f22d9a232d
27 changed files with 1487 additions and 1079 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,15 @@ |
||||
if(NOT DYNAMIC_CUDA_SUPPORT) |
||||
ocv_module_disable(dynamicuda) |
||||
endif() |
||||
|
||||
set(the_description "Dynamic CUDA linkage") |
||||
|
||||
add_definitions(-DUSE_CUDA) |
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef) |
||||
ocv_module_include_directories("${OpenCV_SOURCE_DIR}/modules/gpu/include") |
||||
set(OPENCV_MODULE_TYPE SHARED) |
||||
if (BUILD_FAT_JAVA_LIB) |
||||
ocv_define_module(dynamicuda opencv_java PRIVATE_REQUIRED ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY}) |
||||
else() |
||||
ocv_define_module(dynamicuda opencv_core PRIVATE_REQUIRED ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY}) |
||||
endif() |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,55 @@ |
||||
#include "cvconfig.h" |
||||
#include "opencv2/core/core.hpp" |
||||
#include "opencv2/core/gpumat.hpp" |
||||
|
||||
#include <stdio.h> |
||||
#include <iostream> |
||||
|
||||
#ifdef HAVE_CUDA |
||||
#include <cuda_runtime.h> |
||||
#include <npp.h> |
||||
|
||||
#define CUDART_MINIMUM_REQUIRED_VERSION 4020 |
||||
#define NPP_MINIMUM_REQUIRED_VERSION 4200 |
||||
|
||||
#if (CUDART_VERSION < CUDART_MINIMUM_REQUIRED_VERSION) |
||||
#error "Insufficient Cuda Runtime library version, please update it." |
||||
#endif |
||||
|
||||
#if (NPP_VERSION_MAJOR * 1000 + NPP_VERSION_MINOR * 100 + NPP_VERSION_BUILD < NPP_MINIMUM_REQUIRED_VERSION) |
||||
#error "Insufficient NPP version, please update it." |
||||
#endif |
||||
#endif |
||||
|
||||
using namespace std; |
||||
using namespace cv; |
||||
using namespace cv::gpu; |
||||
|
||||
#define throw_nogpu CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support") |
||||
|
||||
#include "opencv2/dynamicuda/dynamicuda.hpp" |
||||
|
||||
#ifdef HAVE_CUDA |
||||
static CudaDeviceInfoFuncTable deviceInfoTable; |
||||
static CudaFuncTable gpuTable; |
||||
#else |
||||
static EmptyDeviceInfoFuncTable deviceInfoTable; |
||||
static EmptyFuncTable gpuTable; |
||||
#endif |
||||
|
||||
extern "C" { |
||||
|
||||
DeviceInfoFuncTable* deviceInfoFactory(); |
||||
GpuFuncTable* gpuFactory(); |
||||
|
||||
DeviceInfoFuncTable* deviceInfoFactory() |
||||
{ |
||||
return (DeviceInfoFuncTable*)&deviceInfoTable; |
||||
} |
||||
|
||||
GpuFuncTable* gpuFactory() |
||||
{ |
||||
return (GpuFuncTable*)&gpuTable; |
||||
} |
||||
|
||||
} |
@ -1,2 +1,6 @@ |
||||
set(the_description "Images stitching") |
||||
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_objdetect OPTIONAL opencv_gpu opencv_nonfree) |
||||
if (ENABLE_DYNAMIC_CUDA) |
||||
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_objdetect OPTIONAL opencv_nonfree) |
||||
else() |
||||
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_objdetect OPTIONAL opencv_gpu opencv_nonfree) |
||||
endif() |
@ -1,2 +1,6 @@ |
||||
set(the_description "Video stabilization") |
||||
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_photo opencv_calib3d opencv_highgui OPTIONAL opencv_gpu) |
||||
if(ENABLE_DYNAMIC_CUDA) |
||||
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_photo opencv_calib3d opencv_highgui) |
||||
else() |
||||
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_photo opencv_calib3d opencv_highgui OPTIONAL opencv_gpu) |
||||
endif() |
||||
|
Loading…
Reference in new issue