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 | 130 ++++++++++++++++---------- modules/cudaarithm/src/element_operations.cpp | 69 -------------- 2 files changed, 82 insertions(+), 117 deletions(-) diff --git a/modules/cudaarithm/src/cuda/threshold.cu b/modules/cudaarithm/src/cuda/threshold.cu index 7bb20bf..21665cb 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 -{ - template struct TransformFunctorTraits< thresh_binary_func > : arithm::ArithmFuncTraits - { - }; +#include "opencv2/cudaarithm.hpp" +#include "opencv2/cudev.hpp" +#include "opencv2/core/private.cuda.hpp" - template struct TransformFunctorTraits< thresh_binary_inv_func > : arithm::ArithmFuncTraits - { - }; +using namespace cv::cudev; - template struct TransformFunctorTraits< thresh_trunc_func > : arithm::ArithmFuncTraits +namespace +{ + template struct TransformPolicy : DefaultTransformPolicy { }; - - template struct TransformFunctorTraits< thresh_to_zero_func > : arithm::ArithmFuncTraits + template <> struct TransformPolicy : DefaultTransformPolicy { + enum { + shift = 1 + }; }; - template struct TransformFunctorTraits< thresh_to_zero_inv_func > : arithm::ArithmFuncTraits + template + void thresholdImpl(const GpuMat& src, GpuMat& dst, double thresh, double maxVal, int type, Stream& stream) { - }; -}}} + const T thresh_ = static_cast(thresh); + const T maxVal_ = static_cast(maxVal); -namespace arithm -{ - template