From ef9917ecf141604063070cca5195bad4f58f015c Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 29 Jul 2013 17:53:03 +0400 Subject: [PATCH] used new device layer for cv::gpu::compare --- modules/cudaarithm/src/cuda/cmp_mat.cu | 231 ++++++++-------- modules/cudaarithm/src/cuda/cmp_scalar.cu | 291 ++++++++------------- modules/cudaarithm/src/element_operations.cpp | 142 +--------- .../include/opencv2/cudev/util/vec_traits.hpp | 2 +- 4 files changed, 241 insertions(+), 425 deletions(-) diff --git a/modules/cudaarithm/src/cuda/cmp_mat.cu b/modules/cudaarithm/src/cuda/cmp_mat.cu index cdbb963..3693fc2 100644 --- a/modules/cudaarithm/src/cuda/cmp_mat.cu +++ b/modules/cudaarithm/src/cuda/cmp_mat.cu @@ -40,30 +40,54 @@ // //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 arithm +#include "opencv2/cudev.hpp" + +using namespace cv::cudev; + +void cmpMat(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat&, double, Stream& stream, int cmpop); + +namespace { + template struct CmpOp : binary_function + { + __device__ __forceinline__ uchar operator()(T a, T b) const + { + Op op; + return -op(a, b); + } + }; + + template struct TransformPolicy : DefaultTransformPolicy + { + }; + template <> struct TransformPolicy : DefaultTransformPolicy + { + enum { + shift = 1 + }; + }; + + template