get rid of cuda.h usage
authorVladislav Vinogradov <vlad.vinogradov@itseez.com>
Tue, 25 Nov 2014 15:29:56 +0000 (18:29 +0300)
committerAlexander Smorkalov <alexander.smorkalov@itseez.com>
Sun, 19 Apr 2015 10:29:45 +0000 (13:29 +0300)
(cherry picked from commit eeb997261d1d22e8c69af777c86e21cce2d04f87)

modules/gpu/src/color.cpp
modules/gpu/src/cu_safe_call.cpp
modules/gpu/src/cu_safe_call.h
modules/gpu/src/cudastream.cpp
modules/gpu/src/graphcuts.cpp
modules/gpu/src/matrix_reductions.cpp
modules/gpu/src/precomp.hpp
modules/gpu/test/test_color.cpp
modules/gpu/test/test_precomp.hpp
modules/gpu/test/test_stream.cpp

index 864c475..66a1ad6 100644 (file)
@@ -1577,7 +1577,7 @@ namespace
 
     void rgba_to_mbgra(const GpuMat& src, GpuMat& dst, int, Stream& st)
     {
-    #if (CUDA_VERSION < 5000)
+    #if (CUDART_VERSION < 5000)
         (void)src;
         (void)dst;
         (void)st;
@@ -1947,7 +1947,7 @@ void cv::gpu::swapChannels(GpuMat& image, const int dstOrder[4], Stream& s)
 
 void cv::gpu::gammaCorrection(const GpuMat& src, GpuMat& dst, bool forward, Stream& stream)
 {
-#if (CUDA_VERSION < 5000)
+#if (CUDART_VERSION < 5000)
     (void)src;
     (void)dst;
     (void)forward;
index 1385e3b..7d786a1 100644 (file)
@@ -42,7 +42,7 @@
 
 #include "cu_safe_call.h"
 
-#ifdef HAVE_CUDA
+#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
 
 namespace
 {
index 49cf696..40f11c8 100644 (file)
@@ -45,7 +45,7 @@
 
 #include "precomp.hpp"
 
-#ifdef HAVE_CUDA
+#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
 
 namespace cv { namespace gpu {
     namespace detail
index f9fbe82..efc5956 100644 (file)
@@ -270,7 +270,7 @@ void cv::gpu::Stream::enqueueConvert(const GpuMat& src, GpuMat& dst, int dtype,
     convertTo(src, dst, alpha, beta, stream);
 }
 
-#if CUDA_VERSION >= 5000
+#if CUDART_VERSION >= 5000
 
 namespace
 {
@@ -293,7 +293,7 @@ namespace
 
 void cv::gpu::Stream::enqueueHostCallback(StreamCallback callback, void* userData)
 {
-#if CUDA_VERSION >= 5000
+#if CUDART_VERSION >= 5000
     CallbackData* data = new CallbackData;
     data->callback = callback;
     data->userData = userData;
index b8c0d4f..1f00aa9 100644 (file)
@@ -144,7 +144,7 @@ namespace
 
 void cv::gpu::graphcut(GpuMat& terminals, GpuMat& leftTransp, GpuMat& rightTransp, GpuMat& top, GpuMat& bottom, GpuMat& labels, GpuMat& buf, Stream& s)
 {
-#if (CUDA_VERSION < 5000)
+#if (CUDART_VERSION < 5000)
     CV_Assert(terminals.type() == CV_32S);
 #else
     CV_Assert(terminals.type() == CV_32S || terminals.type() == CV_32F);
@@ -181,7 +181,7 @@ void cv::gpu::graphcut(GpuMat& terminals, GpuMat& leftTransp, GpuMat& rightTrans
 
     NppiGraphcutStateHandler state(sznpp, buf.ptr<Npp8u>(), nppiGraphcutInitAlloc);
 
-#if (CUDA_VERSION < 5000)
+#if (CUDART_VERSION < 5000)
     nppSafeCall( nppiGraphcut_32s8u(terminals.ptr<Npp32s>(), leftTransp.ptr<Npp32s>(), rightTransp.ptr<Npp32s>(), top.ptr<Npp32s>(), bottom.ptr<Npp32s>(),
         static_cast<int>(terminals.step), static_cast<int>(leftTransp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) );
 #else
@@ -204,7 +204,7 @@ void cv::gpu::graphcut(GpuMat& terminals, GpuMat& leftTransp, GpuMat& rightTrans
 void cv::gpu::graphcut(GpuMat& terminals, GpuMat& leftTransp, GpuMat& rightTransp, GpuMat& top, GpuMat& topLeft, GpuMat& topRight,
               GpuMat& bottom, GpuMat& bottomLeft, GpuMat& bottomRight, GpuMat& labels, GpuMat& buf, Stream& s)
 {
-#if (CUDA_VERSION < 5000)
+#if (CUDART_VERSION < 5000)
     CV_Assert(terminals.type() == CV_32S);
 #else
     CV_Assert(terminals.type() == CV_32S || terminals.type() == CV_32F);
@@ -253,7 +253,7 @@ void cv::gpu::graphcut(GpuMat& terminals, GpuMat& leftTransp, GpuMat& rightTrans
 
     NppiGraphcutStateHandler state(sznpp, buf.ptr<Npp8u>(), nppiGraphcut8InitAlloc);
 
-#if (CUDA_VERSION < 5000)
+#if (CUDART_VERSION < 5000)
     nppSafeCall( nppiGraphcut8_32s8u(terminals.ptr<Npp32s>(), leftTransp.ptr<Npp32s>(), rightTransp.ptr<Npp32s>(),
         top.ptr<Npp32s>(), topLeft.ptr<Npp32s>(), topRight.ptr<Npp32s>(),
         bottom.ptr<Npp32s>(), bottomLeft.ptr<Npp32s>(), bottomRight.ptr<Npp32s>(),
index 056e5ef..4e09246 100644 (file)
@@ -132,7 +132,7 @@ void cv::gpu::meanStdDev(const GpuMat& src, Scalar& mean, Scalar& stddev, GpuMat
     DeviceBuffer dbuf(2);
 
     int bufSize;
-#if (CUDA_VERSION <= 4020)
+#if (CUDART_VERSION <= 4020)
     nppSafeCall( nppiMeanStdDev8uC1RGetBufferHostSize(sz, &bufSize) );
 #else
     nppSafeCall( nppiMeanStdDevGetBufferHostSize_8u_C1R(sz, &bufSize) );
@@ -187,7 +187,7 @@ double cv::gpu::norm(const GpuMat& src1, const GpuMat& src2, int normType)
     CV_Assert(src1.size() == src2.size() && src1.type() == src2.type());
     CV_Assert(normType == NORM_INF || normType == NORM_L1 || normType == NORM_L2);
 
-#if CUDA_VERSION < 5050
+#if CUDART_VERSION < 5050
     typedef NppStatus (*func_t)(const Npp8u* pSrc1, int nSrcStep1, const Npp8u* pSrc2, int nSrcStep2, NppiSize oSizeROI, Npp64f* pRetVal);
 
     static const func_t funcs[] = {nppiNormDiff_Inf_8u_C1R, nppiNormDiff_L1_8u_C1R, nppiNormDiff_L2_8u_C1R};
@@ -212,7 +212,7 @@ double cv::gpu::norm(const GpuMat& src1, const GpuMat& src2, int normType)
 
     DeviceBuffer dbuf;
 
-#if CUDA_VERSION < 5050
+#if CUDART_VERSION < 5050
     nppSafeCall( funcs[funcIdx](src1.ptr<Npp8u>(), static_cast<int>(src1.step), src2.ptr<Npp8u>(), static_cast<int>(src2.step), sz, dbuf) );
 #else
     int bufSize;
index d3a4467..785783b 100644 (file)
@@ -82,8 +82,6 @@
 #define OPENCV_GPU_UNUSED(x) (void)x
 
 #ifdef HAVE_CUDA
-
-    #include <cuda.h>
     #include <cuda_runtime.h>
     #include <npp.h>
 
@@ -96,6 +94,7 @@
     #endif
 
     #ifdef HAVE_NVCUVID
+        #include <cuda.h>
         #include <nvcuvid.h>
 
         #ifdef WIN32
index 321785f..5720e0c 100644 (file)
@@ -2048,7 +2048,7 @@ GPU_TEST_P(CvtColor, Luv2LRGBA)
     EXPECT_MAT_NEAR(dst_gold, dst, depth == CV_8U ? 1 : 1e-4);
 }
 
-#if defined (CUDA_VERSION) && (CUDA_VERSION >= 5000)
+#if defined (CUDART_VERSION) && (CUDART_VERSION >= 5000)
 
 GPU_TEST_P(CvtColor, RGBA2mRGBA)
 {
@@ -2066,7 +2066,7 @@ GPU_TEST_P(CvtColor, RGBA2mRGBA)
     EXPECT_MAT_NEAR(dst_gold, dst, 1);
 }
 
-#endif // defined (CUDA_VERSION) && (CUDA_VERSION >= 5000)
+#endif // defined (CUDART_VERSION) && (CUDART_VERSION >= 5000)
 
 GPU_TEST_P(CvtColor, BayerBG2BGR)
 {
index 11a71e4..b1fb012 100644 (file)
@@ -67,7 +67,6 @@
 #include "cvconfig.h"
 
 #ifdef HAVE_CUDA
-    #include <cuda.h>
     #include <cuda_runtime.h>
 
     #include "opencv2/ts/ts.hpp"
index a86d8ff..a34a4e8 100644 (file)
@@ -46,7 +46,7 @@
 
 using namespace cvtest;
 
-#if CUDA_VERSION >= 5000
+#if CUDART_VERSION >= 5000
 
 struct Async : testing::TestWithParam<cv::gpu::DeviceInfo>
 {