From 5522f43b18422e6280b415f5a03173862affb056 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 26 Aug 2013 10:33:17 +0400 Subject: [PATCH] used new device layer for cv::gpu::threshold --- modules/cudaarithm/src/cuda/threshold.cu | 142 +++++++++++------- modules/cudaarithm/src/element_operations.cpp | 69 --------- 2 files changed, 88 insertions(+), 123 deletions(-) diff --git a/modules/cudaarithm/src/cuda/threshold.cu b/modules/cudaarithm/src/cuda/threshold.cu index 7bb20bf7e..21665cbe7 100644 --- a/modules/cudaarithm/src/cuda/threshold.cu +++ b/modules/cudaarithm/src/cuda/threshold.cu @@ -40,75 +40,109 @@ // //M*/ -#if !defined CUDA_DISABLER +#include "opencv2/opencv_modules.hpp" -#include "opencv2/core/cuda/common.hpp" -#include "opencv2/core/cuda/functional.hpp" -#include "opencv2/core/cuda/transform.hpp" -#include "opencv2/core/cuda/saturate_cast.hpp" -#include "opencv2/core/cuda/simd_functions.hpp" +#ifndef HAVE_OPENCV_CUDEV -#include "arithm_func_traits.hpp" +#error "opencv_cudev is required" -using namespace cv::cuda; -using namespace cv::cuda::device; +#else -namespace cv { namespace cuda { namespace device +#include "opencv2/cudaarithm.hpp" +#include "opencv2/cudev.hpp" +#include "opencv2/core/private.cuda.hpp" + +using namespace cv::cudev; + +namespace { - template struct TransformFunctorTraits< thresh_binary_func > : arithm::ArithmFuncTraits + template struct TransformPolicy : DefaultTransformPolicy { }; - - template struct TransformFunctorTraits< thresh_binary_inv_func > : arithm::ArithmFuncTraits + template <> struct TransformPolicy : DefaultTransformPolicy { + enum { + shift = 1 + }; }; - template struct TransformFunctorTraits< thresh_trunc_func > : arithm::ArithmFuncTraits - { - }; - - template struct TransformFunctorTraits< thresh_to_zero_func > : arithm::ArithmFuncTraits - { - }; - - template struct TransformFunctorTraits< thresh_to_zero_inv_func > : arithm::ArithmFuncTraits - { - }; -}}} - -namespace arithm -{ - template