From 29f0f84e1aa0921f6313821d9089bb383a13ac2e Mon Sep 17 00:00:00 2001 From: cudawarped <12133430+cudawarped@users.noreply.github.com> Date: Sat, 30 Aug 2025 09:07:57 +0300 Subject: [PATCH 1/2] libcufft_static_nocallback.a has been removed. Fallback to dynamically linking to cufft because libcufft_static.a requires seperable compilation. --- modules/cudaarithm/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cudaarithm/CMakeLists.txt b/modules/cudaarithm/CMakeLists.txt index b1aacd68696..fa9c9194163 100644 --- a/modules/cudaarithm/CMakeLists.txt +++ b/modules/cudaarithm/CMakeLists.txt @@ -9,7 +9,7 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-d set(extra_dependencies "") set(optional_dependencies "") if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE) - if(UNIX AND NOT BUILD_SHARED_LIBS AND CUDA_VERSION_STRING VERSION_GREATER_EQUAL 9.2 AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.23) + if(UNIX AND NOT BUILD_SHARED_LIBS AND CUDA_VERSION_STRING VERSION_GREATER_EQUAL 9.2 AND CUDA_VERSION_STRING VERSION_LESS 13.0 AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.23) set(CUDA_FFT_LIB_EXT "_static_nocallback") endif() list(APPEND extra_dependencies CUDA::cudart_static CUDA::nppial${CUDA_LIB_EXT} CUDA::nppc${CUDA_LIB_EXT} CUDA::nppitc${CUDA_LIB_EXT} CUDA::nppig${CUDA_LIB_EXT} CUDA::nppist${CUDA_LIB_EXT} CUDA::nppidei${CUDA_LIB_EXT}) From 1e67ec20e42aa1fa5e0c89c238c7c2e30884fc8c Mon Sep 17 00:00:00 2001 From: cudawarped <12133430+cudawarped@users.noreply.github.com> Date: Sat, 23 Aug 2025 09:24:27 +0300 Subject: [PATCH 2/2] cuda: add compatibility layer for depreciated vector types --- modules/cudaarithm/src/cuda/absdiff_scalar.cu | 4 +++- modules/cudaarithm/src/cuda/add_scalar.cu | 16 +++++++++------- modules/cudaarithm/src/cuda/div_scalar.cu | 16 +++++++++------- modules/cudaarithm/src/cuda/mul_scalar.cu | 16 +++++++++------- modules/cudaarithm/src/cuda/sub_scalar.cu | 17 ++++++++++------- .../cudalegacy/src/cuda/NCVPixelOperations.hpp | 15 +++++++++------ modules/cudalegacy/src/cuda/NCVPyramid.cu | 6 +++--- .../opencv2/cudev/util/detail/type_traits.hpp | 3 +++ .../include/opencv2/cudev/util/vec_math.hpp | 3 +++ .../include/opencv2/cudev/util/vec_traits.hpp | 8 +++++++- 10 files changed, 65 insertions(+), 39 deletions(-) diff --git a/modules/cudaarithm/src/cuda/absdiff_scalar.cu b/modules/cudaarithm/src/cuda/absdiff_scalar.cu index 0955e40c8b1..2a559daaed3 100644 --- a/modules/cudaarithm/src/cuda/absdiff_scalar.cu +++ b/modules/cudaarithm/src/cuda/absdiff_scalar.cu @@ -49,6 +49,7 @@ #else #include "opencv2/cudev.hpp" +#include "opencv2/core/cuda/cuda_compat.hpp" using namespace cv::cudev; @@ -56,6 +57,7 @@ void absDiffScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const G namespace { + using cv::cuda::device::compat::double4Compat; template struct AbsDiffScalarOp : unary_function { ScalarType val; @@ -114,7 +116,7 @@ void absDiffScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const G absDiffScalarImpl, absDiffScalarImpl, absDiffScalarImpl, absDiffScalarImpl }, { - absDiffScalarImpl, absDiffScalarImpl, absDiffScalarImpl, absDiffScalarImpl + absDiffScalarImpl, absDiffScalarImpl, absDiffScalarImpl, absDiffScalarImpl } }; diff --git a/modules/cudaarithm/src/cuda/add_scalar.cu b/modules/cudaarithm/src/cuda/add_scalar.cu index 92838a2a57d..af608a13d7d 100644 --- a/modules/cudaarithm/src/cuda/add_scalar.cu +++ b/modules/cudaarithm/src/cuda/add_scalar.cu @@ -49,6 +49,7 @@ #else #include "opencv2/cudev.hpp" +#include "opencv2/core/cuda/cuda_compat.hpp" using namespace cv::cudev; @@ -56,6 +57,7 @@ void addScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa namespace { + using cv::cuda::device::compat::double4Compat; template struct AddScalarOp : unary_function { ScalarType val; @@ -105,7 +107,7 @@ void addScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, - {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl} + {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl} }, { {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, @@ -114,7 +116,7 @@ void addScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, - {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl} + {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl} }, { {0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/}, @@ -123,7 +125,7 @@ void addScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, - {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl} + {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl} }, { {0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/}, @@ -132,7 +134,7 @@ void addScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, - {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl} + {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl} }, { {0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/}, @@ -141,7 +143,7 @@ void addScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa {0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/}, {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, - {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl} + {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl} }, { {0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/}, @@ -150,7 +152,7 @@ void addScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa {0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/}, {0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/}, {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl}, - {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl} + {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl} }, { {0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/}, @@ -159,7 +161,7 @@ void addScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa {0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/}, {0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/}, {0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/, 0 /*addScalarImpl*/}, - {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl} + {addScalarImpl, addScalarImpl, addScalarImpl, addScalarImpl} } }; diff --git a/modules/cudaarithm/src/cuda/div_scalar.cu b/modules/cudaarithm/src/cuda/div_scalar.cu index 97ada834104..eb10efef150 100644 --- a/modules/cudaarithm/src/cuda/div_scalar.cu +++ b/modules/cudaarithm/src/cuda/div_scalar.cu @@ -49,6 +49,7 @@ #else #include "opencv2/cudev.hpp" +#include "opencv2/core/cuda/cuda_compat.hpp" using namespace cv::cudev; @@ -56,6 +57,7 @@ void divScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G namespace { + using cv::cuda::device::compat::double4Compat; template struct SafeDiv; template struct SafeDiv { @@ -170,7 +172,7 @@ void divScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, - {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl} + {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl} }, { {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, @@ -179,7 +181,7 @@ void divScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, - {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl} + {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl} }, { {0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/}, @@ -188,7 +190,7 @@ void divScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, - {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl} + {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl} }, { {0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/}, @@ -197,7 +199,7 @@ void divScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, - {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl} + {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl} }, { {0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/}, @@ -206,7 +208,7 @@ void divScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G {0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/}, {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, - {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl} + {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl} }, { {0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/}, @@ -215,7 +217,7 @@ void divScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G {0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/}, {0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/}, {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl}, - {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl} + {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl} }, { {0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/}, @@ -224,7 +226,7 @@ void divScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G {0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/}, {0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/}, {0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/, 0 /*divScalarImpl*/}, - {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl} + {divScalarImpl, divScalarImpl, divScalarImpl, divScalarImpl} } }; diff --git a/modules/cudaarithm/src/cuda/mul_scalar.cu b/modules/cudaarithm/src/cuda/mul_scalar.cu index f27ef26ddd7..c599aa03182 100644 --- a/modules/cudaarithm/src/cuda/mul_scalar.cu +++ b/modules/cudaarithm/src/cuda/mul_scalar.cu @@ -49,6 +49,7 @@ #else #include "opencv2/cudev.hpp" +#include "opencv2/core/cuda/cuda_compat.hpp" using namespace cv::cudev; @@ -56,6 +57,7 @@ void mulScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa namespace { + using cv::cuda::device::compat::double4Compat; template struct MulScalarOp : unary_function { ScalarType val; @@ -102,7 +104,7 @@ void mulScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, - {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl} + {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl} }, { {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, @@ -111,7 +113,7 @@ void mulScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, - {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl} + {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl} }, { {0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/}, @@ -120,7 +122,7 @@ void mulScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, - {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl} + {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl} }, { {0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/}, @@ -129,7 +131,7 @@ void mulScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, - {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl} + {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl} }, { {0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/}, @@ -138,7 +140,7 @@ void mulScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa {0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/}, {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, - {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl} + {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl} }, { {0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/}, @@ -147,7 +149,7 @@ void mulScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa {0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/}, {0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/}, {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl}, - {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl} + {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl} }, { {0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/}, @@ -156,7 +158,7 @@ void mulScalar(const GpuMat& src, cv::Scalar val, bool, GpuMat& dst, const GpuMa {0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/}, {0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/}, {0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/, 0 /*mulScalarImpl*/}, - {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl} + {mulScalarImpl, mulScalarImpl, mulScalarImpl, mulScalarImpl} } }; diff --git a/modules/cudaarithm/src/cuda/sub_scalar.cu b/modules/cudaarithm/src/cuda/sub_scalar.cu index c4eeec01482..3d9c118fa34 100644 --- a/modules/cudaarithm/src/cuda/sub_scalar.cu +++ b/modules/cudaarithm/src/cuda/sub_scalar.cu @@ -49,6 +49,7 @@ #else #include "opencv2/cudev.hpp" +#include "opencv2/core/cuda/cuda_compat.hpp" using namespace cv::cudev; @@ -56,6 +57,8 @@ void subScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G namespace { + using cv::cuda::device::compat::double4Compat; + template struct SubScalarOp : unary_function { ScalarType val; @@ -128,7 +131,7 @@ void subScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, - {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl} + {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl} }, { {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, @@ -137,7 +140,7 @@ void subScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, - {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl} + {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl} }, { {0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/}, @@ -146,7 +149,7 @@ void subScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, - {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl} + {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl} }, { {0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/}, @@ -155,7 +158,7 @@ void subScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, - {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl} + {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl} }, { {0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/}, @@ -164,7 +167,7 @@ void subScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G {0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/}, {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, - {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl} + {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl} }, { {0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/}, @@ -173,7 +176,7 @@ void subScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G {0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/}, {0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/}, {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl}, - {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl} + {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl} }, { {0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/}, @@ -182,7 +185,7 @@ void subScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G {0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/}, {0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/}, {0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/, 0 /*subScalarImpl*/}, - {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl} + {subScalarImpl, subScalarImpl, subScalarImpl, subScalarImpl} } }; diff --git a/modules/cudalegacy/src/cuda/NCVPixelOperations.hpp b/modules/cudalegacy/src/cuda/NCVPixelOperations.hpp index fcebf576d98..b6e9e5defbc 100644 --- a/modules/cudalegacy/src/cuda/NCVPixelOperations.hpp +++ b/modules/cudalegacy/src/cuda/NCVPixelOperations.hpp @@ -46,6 +46,9 @@ #include #include #include "opencv2/cudalegacy/NCV.hpp" +#include "opencv2/core/cuda/cuda_compat.hpp" +using cv::cuda::device::compat::double4Compat; +using cv::cuda::device::compat::make_double4_compat; template inline __host__ __device__ TBase _pixMaxVal(); template<> inline __host__ __device__ Ncv8u _pixMaxVal() {return UCHAR_MAX;} @@ -101,7 +104,7 @@ template<> struct TConvBase2Vec {typedef float3 TVec;}; template<> struct TConvBase2Vec {typedef float4 TVec;}; template<> struct TConvBase2Vec {typedef double1 TVec;}; template<> struct TConvBase2Vec {typedef double3 TVec;}; -template<> struct TConvBase2Vec {typedef double4 TVec;}; +template<> struct TConvBase2Vec {typedef double4Compat TVec;}; //TODO: consider using CUDA intrinsics to avoid branching template inline __host__ __device__ void _TDemoteClampZ(Tin &a, Ncv8u &out) {out = (Ncv8u)CLAMP_0_255(a);} @@ -130,7 +133,7 @@ template<> inline __host__ __device__ float3 _pixMakeZero() {return make template<> inline __host__ __device__ float4 _pixMakeZero() {return make_float4(0.f,0.f,0.f,0.f);} template<> inline __host__ __device__ double1 _pixMakeZero() {return make_double1(0.);} template<> inline __host__ __device__ double3 _pixMakeZero() {return make_double3(0.,0.,0.);} -template<> inline __host__ __device__ double4 _pixMakeZero() {return make_double4(0.,0.,0.,0.);} +template<> inline __host__ __device__ double4Compat _pixMakeZero() {return make_double4_compat(0.,0.,0.,0.);} static inline __host__ __device__ uchar1 _pixMake(Ncv8u x) {return make_uchar1(x);} static inline __host__ __device__ uchar3 _pixMake(Ncv8u x, Ncv8u y, Ncv8u z) {return make_uchar3(x,y,z);} @@ -146,7 +149,7 @@ static inline __host__ __device__ float3 _pixMake(Ncv32f x, Ncv32f y, Ncv32f z) static inline __host__ __device__ float4 _pixMake(Ncv32f x, Ncv32f y, Ncv32f z, Ncv32f w) {return make_float4(x,y,z,w);} static inline __host__ __device__ double1 _pixMake(Ncv64f x) {return make_double1(x);} static inline __host__ __device__ double3 _pixMake(Ncv64f x, Ncv64f y, Ncv64f z) {return make_double3(x,y,z);} -static inline __host__ __device__ double4 _pixMake(Ncv64f x, Ncv64f y, Ncv64f z, Ncv64f w) {return make_double4(x,y,z,w);} +static inline __host__ __device__ double4Compat _pixMake(Ncv64f x, Ncv64f y, Ncv64f z, Ncv64f w) {return make_double4_compat(x,y,z,w);} template struct __pixDemoteClampZ_CN {static __host__ __device__ Tout _pixDemoteClampZ_CN(Tin &pix);}; @@ -329,13 +332,13 @@ template static __host__ __device__ Tout _pixDist(T template struct TAccPixWeighted; template<> struct TAccPixWeighted {typedef double1 type;}; template<> struct TAccPixWeighted {typedef double3 type;}; -template<> struct TAccPixWeighted {typedef double4 type;}; +template<> struct TAccPixWeighted {typedef double4Compat type;}; template<> struct TAccPixWeighted {typedef double1 type;}; template<> struct TAccPixWeighted {typedef double3 type;}; -template<> struct TAccPixWeighted {typedef double4 type;}; +template<> struct TAccPixWeighted {typedef double4Compat type;}; template<> struct TAccPixWeighted {typedef double1 type;}; template<> struct TAccPixWeighted {typedef double3 type;}; -template<> struct TAccPixWeighted {typedef double4 type;}; +template<> struct TAccPixWeighted {typedef double4Compat type;}; template struct TAccPixDist {}; template<> struct TAccPixDist {typedef Ncv32u type;}; diff --git a/modules/cudalegacy/src/cuda/NCVPyramid.cu b/modules/cudalegacy/src/cuda/NCVPyramid.cu index c37b1a9e1dc..2bf36aeddfd 100644 --- a/modules/cudalegacy/src/cuda/NCVPyramid.cu +++ b/modules/cudalegacy/src/cuda/NCVPyramid.cu @@ -129,10 +129,10 @@ static __host__ __device__ float4 _average4_CN(const float4 &p00, const float4 & return out; }}; -template<> struct __average4_CN { -static __host__ __device__ double4 _average4_CN(const double4 &p00, const double4 &p01, const double4 &p10, const double4 &p11) +template<> struct __average4_CN { +static __host__ __device__ double4Compat _average4_CN(const double4Compat&p00, const double4Compat&p01, const double4Compat&p10, const double4Compat&p11) { - double4 out; + double4Compat out; out.x = (p00.x + p01.x + p10.x + p11.x) / 4; out.y = (p00.y + p01.y + p10.y + p11.y) / 4; out.z = (p00.z + p01.z + p10.z + p11.z) / 4; diff --git a/modules/cudev/include/opencv2/cudev/util/detail/type_traits.hpp b/modules/cudev/include/opencv2/cudev/util/detail/type_traits.hpp index 91e47362f94..d43d93c0f97 100644 --- a/modules/cudev/include/opencv2/cudev/util/detail/type_traits.hpp +++ b/modules/cudev/include/opencv2/cudev/util/detail/type_traits.hpp @@ -47,11 +47,14 @@ #define OPENCV_CUDEV_UTIL_TYPE_TRAITS_DETAIL_HPP #include "../../common.hpp" +#include "opencv2/core/cuda/cuda_compat.hpp" namespace cv { namespace cudev { namespace type_traits_detail { + using cv::cuda::device::compat::double4; + template struct IsSignedIntergral { enum {value = 0}; }; template <> struct IsSignedIntergral { enum {value = 1}; }; template <> struct IsSignedIntergral { enum {value = 1}; }; diff --git a/modules/cudev/include/opencv2/cudev/util/vec_math.hpp b/modules/cudev/include/opencv2/cudev/util/vec_math.hpp index f6d8d2cda41..de389041f07 100644 --- a/modules/cudev/include/opencv2/cudev/util/vec_math.hpp +++ b/modules/cudev/include/opencv2/cudev/util/vec_math.hpp @@ -48,9 +48,12 @@ #include "vec_traits.hpp" #include "saturate_cast.hpp" +#include "opencv2/core/cuda/cuda_compat.hpp" namespace cv { namespace cudev { + using cv::cuda::device::compat::double4; + //! @addtogroup cudev //! @{ diff --git a/modules/cudev/include/opencv2/cudev/util/vec_traits.hpp b/modules/cudev/include/opencv2/cudev/util/vec_traits.hpp index bff3744ef7a..6b65c3edd68 100644 --- a/modules/cudev/include/opencv2/cudev/util/vec_traits.hpp +++ b/modules/cudev/include/opencv2/cudev/util/vec_traits.hpp @@ -47,8 +47,14 @@ #define OPENCV_CUDEV_UTIL_VEC_TRAITS_HPP #include "../common.hpp" +#include "opencv2/core/cuda/cuda_compat.hpp" -namespace cv { namespace cudev { +namespace cv { + + using cv::cuda::device::compat::double4; + using cv::cuda::device::compat::make_double4; + + namespace cudev { //! @addtogroup cudev //! @{