/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and // any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages // (including, but not limited to, procurement of substitute goods or services; // loss of use, data, or profits; or business interruption) however caused // and on any theory of liability, whether in contract, strict liability, // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // //M*/ #ifndef OPENCV_CUDA_FUNCTIONAL_HPP #define OPENCV_CUDA_FUNCTIONAL_HPP #include #include "saturate_cast.hpp" #include "vec_traits.hpp" #include "type_traits.hpp" /** @file * @deprecated Use @ref cudev instead. */ //! @cond IGNORED namespace cv { namespace cuda { namespace device { // Function Objects template struct unary_function { typedef Argument argument_type; typedef Result result_type; }; template struct binary_function { typedef Argument1 first_argument_type; typedef Argument2 second_argument_type; typedef Result result_type; }; // Arithmetic Operations template struct plus : binary_function { __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a + b; } __host__ __device__ __forceinline__ plus() {} __host__ __device__ __forceinline__ plus(const plus&) {} }; template struct minus : binary_function { __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a - b; } __host__ __device__ __forceinline__ minus() {} __host__ __device__ __forceinline__ minus(const minus&) {} }; template struct multiplies : binary_function { __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a * b; } __host__ __device__ __forceinline__ multiplies() {} __host__ __device__ __forceinline__ multiplies(const multiplies&) {} }; template struct divides : binary_function { __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a / b; } __host__ __device__ __forceinline__ divides() {} __host__ __device__ __forceinline__ divides(const divides&) {} }; template struct modulus : binary_function { __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a % b; } __host__ __device__ __forceinline__ modulus() {} __host__ __device__ __forceinline__ modulus(const modulus&) {} }; template struct negate : unary_function { __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a) const { return -a; } __host__ __device__ __forceinline__ negate() {} __host__ __device__ __forceinline__ negate(const negate&) {} }; // Comparison Operations template struct equal_to : binary_function { __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a == b; } __host__ __device__ __forceinline__ equal_to() {} __host__ __device__ __forceinline__ equal_to(const equal_to&) {} }; template struct not_equal_to : binary_function { __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a != b; } __host__ __device__ __forceinline__ not_equal_to() {} __host__ __device__ __forceinline__ not_equal_to(const not_equal_to&) {} }; template struct greater : binary_function { __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a > b; } __host__ __device__ __forceinline__ greater() {} __host__ __device__ __forceinline__ greater(const greater&) {} }; template struct less : binary_function { __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a < b; } __host__ __device__ __forceinline__ less() {} __host__ __device__ __forceinline__ less(const less&) {} }; template struct greater_equal : binary_function { __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a >= b; } __host__ __device__ __forceinline__ greater_equal() {} __host__ __device__ __forceinline__ greater_equal(const greater_equal&) {} }; template struct less_equal : binary_function { __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a <= b; } __host__ __device__ __forceinline__ less_equal() {} __host__ __device__ __forceinline__ less_equal(const less_equal&) {} }; // Logical Operations template struct logical_and : binary_function { __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a && b; } __host__ __device__ __forceinline__ logical_and() {} __host__ __device__ __forceinline__ logical_and(const logical_and&) {} }; template struct logical_or : binary_function { __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a || b; } __host__ __device__ __forceinline__ logical_or() {} __host__ __device__ __forceinline__ logical_or(const logical_or&) {} }; template struct logical_not : unary_function { __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a) const { return !a; } __host__ __device__ __forceinline__ logical_not() {} __host__ __device__ __forceinline__ logical_not(const logical_not&) {} }; // Bitwise Operations template struct bit_and : binary_function { __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a & b; } __host__ __device__ __forceinline__ bit_and() {} __host__ __device__ __forceinline__ bit_and(const bit_and&) {} }; template struct bit_or : binary_function { __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a | b; } __host__ __device__ __forceinline__ bit_or() {} __host__ __device__ __forceinline__ bit_or(const bit_or&) {} }; template struct bit_xor : binary_function { __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, typename TypeTraits::ParameterType b) const { return a ^ b; } __host__ __device__ __forceinline__ bit_xor() {} __host__ __device__ __forceinline__ bit_xor(const bit_xor&) {} }; template struct bit_not : unary_function { __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType v) const { return ~v; } __host__ __device__ __forceinline__ bit_not() {} __host__ __device__ __forceinline__ bit_not(const bit_not&) {} }; // Generalized Identity Operations template struct identity : unary_function { __device__ __forceinline__ typename TypeTraits::ParameterType operator()(typename TypeTraits::ParameterType x) const { return x; } __host__ __device__ __forceinline__ identity() {} __host__ __device__ __forceinline__ identity(const identity&) {} }; template struct project1st : binary_function { __device__ __forceinline__ typename TypeTraits::ParameterType operator()(typename TypeTraits::ParameterType lhs, typename TypeTraits::ParameterType rhs) const { return lhs; } __host__ __device__ __forceinline__ project1st() {} __host__ __device__ __forceinline__ project1st(const project1st&) {} }; template struct project2nd : binary_function { __device__ __forceinline__ typename TypeTraits::ParameterType operator()(typename TypeTraits::ParameterType lhs, typename TypeTraits::ParameterType rhs) const { return rhs; } __host__ __device__ __forceinline__ project2nd() {} __host__ __device__ __forceinline__ project2nd(const project2nd&) {} }; // Min/Max Operations #define OPENCV_CUDA_IMPLEMENT_MINMAX(name, type, op) \ template <> struct name : binary_function \ { \ __device__ __forceinline__ type operator()(type lhs, type rhs) const {return op(lhs, rhs);} \ __host__ __device__ __forceinline__ name() {}\ __host__ __device__ __forceinline__ name(const name&) {}\ }; template struct maximum : binary_function { __device__ __forceinline__ T operator()(typename TypeTraits::ParameterType lhs, typename TypeTraits::ParameterType rhs) const { return max(lhs, rhs); } __host__ __device__ __forceinline__ maximum() {} __host__ __device__ __forceinline__ maximum(const maximum&) {} }; OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, uchar, ::max) OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, schar, ::max) OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, char, ::max) OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, ushort, ::max) OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, short, ::max) OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, int, ::max) OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, uint, ::max) OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, float, ::fmax) OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, double, ::fmax) template struct minimum : binary_function { __device__ __forceinline__ T operator()(typename TypeTraits::ParameterType lhs, typename TypeTraits::ParameterType rhs) const { return min(lhs, rhs); } __host__ __device__ __forceinline__ minimum() {} __host__ __device__ __forceinline__ minimum(const minimum&) {} }; OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, uchar, ::min) OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, schar, ::min) OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, char, ::min) OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, ushort, ::min) OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, short, ::min) OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, int, ::min) OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, uint, ::min) OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, float, ::fmin) OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, double, ::fmin) #undef OPENCV_CUDA_IMPLEMENT_MINMAX // Math functions template struct abs_func : unary_function { __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType x) const { return abs(x); } __host__ __device__ __forceinline__ abs_func() {} __host__ __device__ __forceinline__ abs_func(const abs_func&) {} }; template <> struct abs_func : unary_function { __device__ __forceinline__ unsigned char operator ()(unsigned char x) const { return x; } __host__ __device__ __forceinline__ abs_func() {} __host__ __device__ __forceinline__ abs_func(const abs_func&) {} }; template <> struct abs_func : unary_function { __device__ __forceinline__ signed char operator ()(signed char x) const { return ::abs((int)x); } __host__ __device__ __forceinline__ abs_func() {} __host__ __device__ __forceinline__ abs_func(const abs_func&) {} }; template <> struct abs_func : unary_function { __device__ __forceinline__ char operator ()(char x) const { return ::abs((int)x); } __host__ __device__ __forceinline__ abs_func() {} __host__ __device__ __forceinline__ abs_func(const abs_func&) {} }; template <> struct abs_func : unary_function { __device__ __forceinline__ unsigned short operator ()(unsigned short x) const { return x; } __host__ __device__ __forceinline__ abs_func() {} __host__ __device__ __forceinline__ abs_func(const abs_func&) {} }; template <> struct abs_func : unary_function { __device__ __forceinline__ short operator ()(short x) const { return ::abs((int)x); } __host__ __device__ __forceinline__ abs_func() {} __host__ __device__ __forceinline__ abs_func(const abs_func&) {} }; template <> struct abs_func : unary_function { __device__ __forceinline__ unsigned int operator ()(unsigned int x) const { return x; } __host__ __device__ __forceinline__ abs_func() {} __host__ __device__ __forceinline__ abs_func(const abs_func&) {} }; template <> struct abs_func : unary_function { __device__ __forceinline__ int operator ()(int x) const { return ::abs(x); } __host__ __device__ __forceinline__ abs_func() {} __host__ __device__ __forceinline__ abs_func(const abs_func&) {} }; template <> struct abs_func : unary_function { __device__ __forceinline__ float operator ()(float x) const { return ::fabsf(x); } __host__ __device__ __forceinline__ abs_func() {} __host__ __device__ __forceinline__ abs_func(const abs_func&) {} }; template <> struct abs_func : unary_function { __device__ __forceinline__ double operator ()(double x) const { return ::fabs(x); } __host__ __device__ __forceinline__ abs_func() {} __host__ __device__ __forceinline__ abs_func(const abs_func&) {} }; #define OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(name, func) \ template struct name ## _func : unary_function \ { \ __device__ __forceinline__ float operator ()(typename TypeTraits::ParameterType v) const \ { \ return func ## f(v); \ } \ __host__ __device__ __forceinline__ name ## _func() {} \ __host__ __device__ __forceinline__ name ## _func(const name ## _func&) {} \ }; \ template <> struct name ## _func : unary_function \ { \ __device__ __forceinline__ double operator ()(double v) const \ { \ return func(v); \ } \ __host__ __device__ __forceinline__ name ## _func() {} \ __host__ __device__ __forceinline__ name ## _func(const name ## _func&) {} \ }; #define OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR(name, func) \ template struct name ## _func : binary_function \ { \ __device__ __forceinline__ float operator ()(typename TypeTraits::ParameterType v1, typename TypeTraits::ParameterType v2) const \ { \ return func ## f(v1, v2); \ } \ __host__ __device__ __forceinline__ name ## _func() {} \ __host__ __device__ __forceinline__ name ## _func(const name ## _func&) {} \ }; \ template <> struct name ## _func : binary_function \ { \ __device__ __forceinline__ double operator ()(double v1, double v2) const \ { \ return func(v1, v2); \ } \ __host__ __device__ __forceinline__ name ## _func() {} \ __host__ __device__ __forceinline__ name ## _func(const name ## _func&) {} \ }; OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(sqrt, ::sqrt) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(exp, ::exp) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(exp2, ::exp2) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(exp10, ::exp10) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(log, ::log) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(log2, ::log2) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(log10, ::log10) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(sin, ::sin) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(cos, ::cos) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(tan, ::tan) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(asin, ::asin) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(acos, ::acos) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(atan, ::atan) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(sinh, ::sinh) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(cosh, ::cosh) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(tanh, ::tanh) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(asinh, ::asinh) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(acosh, ::acosh) OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(atanh, ::atanh) OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR(hypot, ::hypot) OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR(atan2, ::atan2) OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR(pow, ::pow) #undef OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR #undef OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR_NO_DOUBLE #undef OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR template struct hypot_sqr_func : binary_function { __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType src1, typename TypeTraits::ParameterType src2) const { return src1 * src1 + src2 * src2; } __host__ __device__ __forceinline__ hypot_sqr_func() {} __host__ __device__ __forceinline__ hypot_sqr_func(const hypot_sqr_func&) {} }; // Saturate Cast Functor template struct saturate_cast_func : unary_function { __device__ __forceinline__ D operator ()(typename TypeTraits::ParameterType v) const { return saturate_cast(v); } __host__ __device__ __forceinline__ saturate_cast_func() {} __host__ __device__ __forceinline__ saturate_cast_func(const saturate_cast_func&) {} }; // Threshold Functors template struct thresh_binary_func : unary_function { __host__ __device__ __forceinline__ thresh_binary_func(T thresh_, T maxVal_) : thresh(thresh_), maxVal(maxVal_) {} __device__ __forceinline__ T operator()(typename TypeTraits::ParameterType src) const { return (src > thresh) * maxVal; } __host__ __device__ __forceinline__ thresh_binary_func() {} __host__ __device__ __forceinline__ thresh_binary_func(const thresh_binary_func& other) : thresh(other.thresh), maxVal(other.maxVal) {} T thresh; T maxVal; }; template struct thresh_binary_inv_func : unary_function { __host__ __device__ __forceinline__ thresh_binary_inv_func(T thresh_, T maxVal_) : thresh(thresh_), maxVal(maxVal_) {} __device__ __forceinline__ T operator()(typename TypeTraits::ParameterType src) const { return (src <= thresh) * maxVal; } __host__ __device__ __forceinline__ thresh_binary_inv_func() {} __host__ __device__ __forceinline__ thresh_binary_inv_func(const thresh_binary_inv_func& other) : thresh(other.thresh), maxVal(other.maxVal) {} T thresh; T maxVal; }; template struct thresh_trunc_func : unary_function { explicit __host__ __device__ __forceinline__ thresh_trunc_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {CV_UNUSED(maxVal_);} __device__ __forceinline__ T operator()(typename TypeTraits::ParameterType src) const { return minimum()(src, thresh); } __host__ __device__ __forceinline__ thresh_trunc_func() {} __host__ __device__ __forceinline__ thresh_trunc_func(const thresh_trunc_func& other) : thresh(other.thresh) {} T thresh; }; template struct thresh_to_zero_func : unary_function { explicit __host__ __device__ __forceinline__ thresh_to_zero_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {CV_UNUSED(maxVal_);} __device__ __forceinline__ T operator()(typename TypeTraits::ParameterType src) const { return (src > thresh) * src; } __host__ __device__ __forceinline__ thresh_to_zero_func() {} __host__ __device__ __forceinline__ thresh_to_zero_func(const thresh_to_zero_func& other) : thresh(other.thresh) {} T thresh; }; template struct thresh_to_zero_inv_func : unary_function { explicit __host__ __device__ __forceinline__ thresh_to_zero_inv_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {CV_UNUSED(maxVal_);} __device__ __forceinline__ T operator()(typename TypeTraits::ParameterType src) const { return (src <= thresh) * src; } __host__ __device__ __forceinline__ thresh_to_zero_inv_func() {} __host__ __device__ __forceinline__ thresh_to_zero_inv_func(const thresh_to_zero_inv_func& other) : thresh(other.thresh) {} T thresh; }; // Function Object Adaptors template struct unary_negate : unary_function { explicit __host__ __device__ __forceinline__ unary_negate(const Predicate& p) : pred(p) {} __device__ __forceinline__ bool operator()(typename TypeTraits::ParameterType x) const { return !pred(x); } __host__ __device__ __forceinline__ unary_negate() {} __host__ __device__ __forceinline__ unary_negate(const unary_negate& other) : pred(other.pred) {} Predicate pred; }; template __host__ __device__ __forceinline__ unary_negate not1(const Predicate& pred) { return unary_negate(pred); } template struct binary_negate : binary_function { explicit __host__ __device__ __forceinline__ binary_negate(const Predicate& p) : pred(p) {} __device__ __forceinline__ bool operator()(typename TypeTraits::ParameterType x, typename TypeTraits::ParameterType y) const { return !pred(x,y); } __host__ __device__ __forceinline__ binary_negate() {} __host__ __device__ __forceinline__ binary_negate(const binary_negate& other) : pred(other.pred) {} Predicate pred; }; template __host__ __device__ __forceinline__ binary_negate not2(const BinaryPredicate& pred) { return binary_negate(pred); } template struct binder1st : unary_function { __host__ __device__ __forceinline__ binder1st(const Op& op_, const typename Op::first_argument_type& arg1_) : op(op_), arg1(arg1_) {} __device__ __forceinline__ typename Op::result_type operator ()(typename TypeTraits::ParameterType a) const { return op(arg1, a); } __host__ __device__ __forceinline__ binder1st() {} __host__ __device__ __forceinline__ binder1st(const binder1st& other) : op(other.op), arg1(other.arg1) {} Op op; typename Op::first_argument_type arg1; }; template __host__ __device__ __forceinline__ binder1st bind1st(const Op& op, const T& x) { return binder1st(op, typename Op::first_argument_type(x)); } template struct binder2nd : unary_function { __host__ __device__ __forceinline__ binder2nd(const Op& op_, const typename Op::second_argument_type& arg2_) : op(op_), arg2(arg2_) {} __forceinline__ __device__ typename Op::result_type operator ()(typename TypeTraits::ParameterType a) const { return op(a, arg2); } __host__ __device__ __forceinline__ binder2nd() {} __host__ __device__ __forceinline__ binder2nd(const binder2nd& other) : op(other.op), arg2(other.arg2) {} Op op; typename Op::second_argument_type arg2; }; template __host__ __device__ __forceinline__ binder2nd bind2nd(const Op& op, const T& x) { return binder2nd(op, typename Op::second_argument_type(x)); } // Functor Traits template struct IsUnaryFunction { typedef char Yes; struct No {Yes a[2];}; template static Yes check(unary_function); static No check(...); static F makeF(); enum { value = (sizeof(check(makeF())) == sizeof(Yes)) }; }; template struct IsBinaryFunction { typedef char Yes; struct No {Yes a[2];}; template static Yes check(binary_function); static No check(...); static F makeF(); enum { value = (sizeof(check(makeF())) == sizeof(Yes)) }; }; namespace functional_detail { template struct UnOpShift { enum { shift = 1 }; }; template struct UnOpShift { enum { shift = 4 }; }; template struct UnOpShift { enum { shift = 2 }; }; template struct DefaultUnaryShift { enum { shift = UnOpShift::shift }; }; template struct BinOpShift { enum { shift = 1 }; }; template struct BinOpShift { enum { shift = 4 }; }; template struct BinOpShift { enum { shift = 2 }; }; template struct DefaultBinaryShift { enum { shift = BinOpShift::shift }; }; template ::value> struct ShiftDispatcher; template struct ShiftDispatcher { enum { shift = DefaultUnaryShift::shift }; }; template struct ShiftDispatcher { enum { shift = DefaultBinaryShift::shift }; }; } template struct DefaultTransformShift { enum { shift = functional_detail::ShiftDispatcher::shift }; }; template struct DefaultTransformFunctorTraits { enum { simple_block_dim_x = 16 }; enum { simple_block_dim_y = 16 }; enum { smart_block_dim_x = 16 }; enum { smart_block_dim_y = 16 }; enum { smart_shift = DefaultTransformShift::shift }; }; template struct TransformFunctorTraits : DefaultTransformFunctorTraits {}; #define OPENCV_CUDA_TRANSFORM_FUNCTOR_TRAITS(type) \ template <> struct TransformFunctorTraits< type > : DefaultTransformFunctorTraits< type > }}} // namespace cv { namespace cuda { namespace cudev //! @endcond #endif // OPENCV_CUDA_FUNCTIONAL_HPP