\r
return dst;\r
}\r
+\r
+ __device__ __forceinline__ RGB2RGB()\r
+ : unary_function<typename TypeVec<T, scn>::vec_type, typename TypeVec<T, dcn>::vec_type>(){}\r
+ __device__ __forceinline__ RGB2RGB(const RGB2RGB& other_)\r
+ :unary_function<typename TypeVec<T, scn>::vec_type, typename TypeVec<T, dcn>::vec_type>(){}\r
};\r
\r
template <> struct RGB2RGB<uchar, 4, 4, 2> : unary_function<uint, uint>\r
\r
return dst;\r
}\r
+\r
+ __device__ __forceinline__ RGB2RGB():unary_function<uint, uint>(){}\r
+ __device__ __forceinline__ RGB2RGB(const RGB2RGB& other_):unary_function<uint, uint>(){}\r
};\r
}\r
\r
{\r
return RGB2RGB5x5Converter<green_bits, bidx>::cvt(src);\r
}\r
+ __device__ __forceinline__ RGB2RGB5x5():unary_function<uchar3, ushort>(){}\r
+ __device__ __forceinline__ RGB2RGB5x5(const RGB2RGB5x5& other_):unary_function<uchar3, ushort>(){}\r
};\r
template<int bidx, int green_bits> struct RGB2RGB5x5<4, bidx,green_bits> : unary_function<uint, ushort>\r
{\r
{\r
return RGB2RGB5x5Converter<green_bits, bidx>::cvt(src);\r
}\r
+ __device__ __forceinline__ RGB2RGB5x5():unary_function<uint, ushort>(){}\r
+ __device__ __forceinline__ RGB2RGB5x5(const RGB2RGB5x5& other_):unary_function<uint, ushort>(){}\r
+\r
};\r
}\r
\r
RGB5x52RGBConverter<green_bits, bidx>::cvt(src, dst);\r
return dst;\r
}\r
+ __device__ __forceinline__ RGB5x52RGB():unary_function<ushort, uchar3>(){}\r
+ __device__ __forceinline__ RGB5x52RGB(const RGB5x52RGB& other_):unary_function<ushort, uchar3>(){}\r
+\r
};\r
+\r
template <int bidx, int green_bits> struct RGB5x52RGB<4, bidx, green_bits> : unary_function<ushort, uint>\r
{\r
__device__ __forceinline__ uint operator()(ushort src) const\r
RGB5x52RGBConverter<green_bits, bidx>::cvt(src, dst);\r
return dst;\r
}\r
+ __device__ __forceinline__ RGB5x52RGB():unary_function<ushort, uint>(){}\r
+ __device__ __forceinline__ RGB5x52RGB(const RGB5x52RGB& other_):unary_function<ushort, uint>(){}\r
};\r
}\r
\r
\r
return dst;\r
}\r
+ __device__ __forceinline__ Gray2RGB():unary_function<T, typename TypeVec<T, dcn>::vec_type>(){}\r
+ __device__ __forceinline__ Gray2RGB(const Gray2RGB& other_):unary_function<T, typename TypeVec<T, dcn>::vec_type>(){}\r
};\r
template <> struct Gray2RGB<uchar, 4> : unary_function<uchar, uint>\r
{\r
\r
return dst;\r
}\r
+ __device__ __forceinline__ Gray2RGB():unary_function<uchar, uint>(){}\r
+ __device__ __forceinline__ Gray2RGB(const Gray2RGB& other_):unary_function<uchar, uint>(){}\r
};\r
}\r
\r
{\r
return Gray2RGB5x5Converter<green_bits>::cvt(src);\r
}\r
+ __device__ __forceinline__ Gray2RGB5x5():unary_function<uchar, ushort>(){}\r
+ __device__ __forceinline__ Gray2RGB5x5(const Gray2RGB5x5& other_):unary_function<uchar, ushort>(){}\r
};\r
}\r
\r
RGB2YUVConvert<bidx>(&src.x, dst);\r
return dst;\r
}\r
+ __device__ __forceinline__ RGB2YUV():unary_function<typename TypeVec<T, scn>::vec_type, typename TypeVec<T, dcn>::vec_type>(){}\r
+ __device__ __forceinline__ RGB2YUV(const RGB2YUV& other_):unary_function<typename TypeVec<T, scn>::vec_type, typename TypeVec<T, dcn>::vec_type>(){}\r
};\r
}\r
\r
\r
return dst;\r
}\r
+ __device__ __forceinline__ YUV2RGB():unary_function<typename TypeVec<T, scn>::vec_type, typename TypeVec<T, dcn>::vec_type>(){}\r
+ __device__ __forceinline__ YUV2RGB(const YUV2RGB& other_):unary_function<typename TypeVec<T, scn>::vec_type, typename TypeVec<T, dcn>::vec_type>(){}\r
};\r
+\r
template <int bidx> struct YUV2RGB<uchar, 4, 4, bidx> : unary_function<uint, uint>\r
{\r
__device__ __forceinline__ uint operator ()(uint src) const\r
RGB2YCrCbConvert<bidx>(&src.x, dst);\r
return dst;\r
}\r
+ __device__ __forceinline__ RGB2YCrCb():unary_function<typename TypeVec<T, scn>::vec_type, typename TypeVec<T, dcn>::vec_type>(){}\r
+ __device__ __forceinline__ RGB2YCrCb(const RGB2YCrCb& other_):unary_function<typename TypeVec<T, scn>::vec_type, typename TypeVec<T, dcn>::vec_type>(){}\r
};\r
+\r
template <int bidx> struct RGB2YCrCb<uchar, 4, 4, bidx> : unary_function<uint, uint>\r
{\r
__device__ __forceinline__ uint operator ()(uint src) const\r
\r
return dst;\r
}\r
+ __device__ __forceinline__ YCrCb2RGB():unary_function<typename TypeVec<T, scn>::vec_type, typename TypeVec<T, dcn>::vec_type>(){}\r
+ __device__ __forceinline__ YCrCb2RGB(const YCrCb2RGB& other_):unary_function<typename TypeVec<T, scn>::vec_type, typename TypeVec<T, dcn>::vec_type>(){}\r
};\r
+\r
template <int bidx> struct YCrCb2RGB<uchar, 4, 4, bidx> : unary_function<uint, uint>\r
{\r
__device__ __forceinline__ uint operator ()(uint src) const\r
{\r
return HLS2RGBConvert<bidx, hr>(src);\r
}\r
+\r
};\r
}\r
\r
using thrust::binary_function;\r
\r
// Arithmetic Operations\r
-\r
template <typename T> struct plus : binary_function<T, T, T>\r
{\r
- __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a + b;\r
}\r
+ __device__ __forceinline__ plus(const plus& other):binary_function<T,T,T>(){}\r
+ __device__ __forceinline__ plus():binary_function<T,T,T>(){}\r
};\r
+\r
template <typename T> struct minus : binary_function<T, T, T>\r
{\r
- __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a - b;\r
}\r
+ __device__ __forceinline__ minus(const minus& other):binary_function<T,T,T>(){}\r
+ __device__ __forceinline__ minus():binary_function<T,T,T>(){}\r
};\r
+\r
template <typename T> struct multiplies : binary_function<T, T, T>\r
{\r
- __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a * b;\r
}\r
+ __device__ __forceinline__ multiplies(const multiplies& other):binary_function<T,T,T>(){}\r
+ __device__ __forceinline__ multiplies():binary_function<T,T,T>(){}\r
};\r
+\r
template <typename T> struct divides : binary_function<T, T, T>\r
{\r
- __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a / b;\r
}\r
+ __device__ __forceinline__ divides(const divides& other):binary_function<T,T,T>(){}\r
+ __device__ __forceinline__ divides():binary_function<T,T,T>(){}\r
};\r
+\r
template <typename T> struct modulus : binary_function<T, T, T>\r
{\r
- __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a % b;\r
}\r
+ __device__ __forceinline__ modulus(const modulus& other):binary_function<T,T,T>(){}\r
+ __device__ __forceinline__ modulus():binary_function<T,T,T>(){}\r
};\r
+\r
template <typename T> struct negate : unary_function<T, T>\r
{\r
__device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a) const\r
{\r
return -a;\r
}\r
+ __device__ __forceinline__ negate(const negate& other):unary_function<T,T>(){}\r
+ __device__ __forceinline__ negate():unary_function<T,T>(){}\r
};\r
\r
// Comparison Operations\r
-\r
template <typename T> struct equal_to : binary_function<T, T, bool>\r
{\r
- __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a == b;\r
}\r
+ __device__ __forceinline__ equal_to(const equal_to& other):binary_function<T,T,bool>(){}\r
+ __device__ __forceinline__ equal_to():binary_function<T,T,bool>(){}\r
};\r
+\r
template <typename T> struct not_equal_to : binary_function<T, T, bool>\r
{\r
- __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a != b;\r
}\r
+ __device__ __forceinline__ not_equal_to(const not_equal_to& other):binary_function<T,T,bool>(){}\r
+ __device__ __forceinline__ not_equal_to():binary_function<T,T,bool>(){}\r
};\r
+\r
template <typename T> struct greater : binary_function<T, T, bool>\r
{\r
- __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a > b;\r
}\r
+ __device__ __forceinline__ greater(const greater& other):binary_function<T,T,bool>(){}\r
+ __device__ __forceinline__ greater():binary_function<T,T,bool>(){}\r
};\r
+\r
template <typename T> struct less : binary_function<T, T, bool>\r
{\r
- __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a < b;\r
}\r
+ __device__ __forceinline__ less(const less& other):binary_function<T,T,bool>(){}\r
+ __device__ __forceinline__ less():binary_function<T,T,bool>(){}\r
};\r
+\r
template <typename T> struct greater_equal : binary_function<T, T, bool>\r
{\r
- __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a >= b;\r
}\r
+ __device__ __forceinline__ greater_equal(const greater_equal& other):binary_function<T,T,bool>(){}\r
+ __device__ __forceinline__ greater_equal():binary_function<T,T,bool>(){}\r
};\r
+\r
template <typename T> struct less_equal : binary_function<T, T, bool>\r
{\r
- __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a <= b;\r
}\r
+ __device__ __forceinline__ less_equal(const less_equal& other):binary_function<T,T,bool>(){}\r
+ __device__ __forceinline__ less_equal():binary_function<T,T,bool>(){}\r
};\r
\r
// Logical Operations\r
-\r
template <typename T> struct logical_and : binary_function<T, T, bool>\r
{\r
- __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a && b;\r
}\r
+ __device__ __forceinline__ logical_and(const logical_and& other):binary_function<T,T,bool>(){}\r
+ __device__ __forceinline__ logical_and():binary_function<T,T,bool>(){}\r
};\r
+\r
template <typename T> struct logical_or : binary_function<T, T, bool>\r
{\r
- __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a || b;\r
}\r
+ __device__ __forceinline__ logical_or(const logical_or& other):binary_function<T,T,bool>(){}\r
+ __device__ __forceinline__ logical_or():binary_function<T,T,bool>(){}\r
};\r
+\r
template <typename T> struct logical_not : unary_function<T, bool>\r
{\r
__device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a) const\r
{\r
return !a;\r
}\r
+ __device__ __forceinline__ logical_not(const logical_not& other):unary_function<T,bool>(){}\r
+ __device__ __forceinline__ logical_not():unary_function<T,bool>(){}\r
};\r
\r
// Bitwise Operations\r
-\r
template <typename T> struct bit_and : binary_function<T, T, T>\r
{\r
- __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a & b;\r
}\r
+ __device__ __forceinline__ bit_and(const bit_and& other):binary_function<T,T,T>(){}\r
+ __device__ __forceinline__ bit_and():binary_function<T,T,T>(){}\r
};\r
+\r
template <typename T> struct bit_or : binary_function<T, T, T>\r
{\r
- __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a | b;\r
}\r
+ __device__ __forceinline__ bit_or(const bit_or& other):binary_function<T,T,T>(){}\r
+ __device__ __forceinline__ bit_or():binary_function<T,T,T>(){}\r
};\r
+\r
template <typename T> struct bit_xor : binary_function<T, T, T>\r
{\r
- __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a, typename TypeTraits<T>::ParameterType b) const\r
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,\r
+ typename TypeTraits<T>::ParameterType b) const\r
{\r
return a ^ b;\r
}\r
+ __device__ __forceinline__ bit_xor(const bit_xor& other):binary_function<T,T,T>(){}\r
+ __device__ __forceinline__ bit_xor():binary_function<T,T,T>(){}\r
};\r
+\r
template <typename T> struct bit_not : unary_function<T, T>\r
{\r
__device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType v) const \r
{\r
return ~v;\r
}\r
+ __device__ __forceinline__ bit_not(const bit_not& other):unary_function<T,T>(){}\r
+ __device__ __forceinline__ bit_not():unary_function<T,T>(){}\r
};\r
\r
// Generalized Identity Operations\r
-\r
template <typename T> struct identity : unary_function<T, T>\r
{\r
__device__ __forceinline__ typename TypeTraits<T>::ParameterType operator()(typename TypeTraits<T>::ParameterType x) const \r
{\r
return x;\r
}\r
+ __device__ __forceinline__ identity(const identity& other):unary_function<T,T>(){}\r
+ __device__ __forceinline__ identity():unary_function<T,T>(){}\r
};\r
\r
template <typename T1, typename T2> struct project1st : binary_function<T1, T2, T1>\r
{\r
return lhs;\r
}\r
+ __device__ __forceinline__ project1st(const project1st& other):binary_function<T1,T2,T1>(){}\r
+ __device__ __forceinline__ project1st():binary_function<T1,T2,T1>(){}\r
};\r
+\r
template <typename T1, typename T2> struct project2nd : binary_function<T1, T2, T2>\r
{\r
__device__ __forceinline__ typename TypeTraits<T2>::ParameterType operator()(typename TypeTraits<T1>::ParameterType lhs, typename TypeTraits<T2>::ParameterType rhs) const \r
{\r
return rhs;\r
}\r
+ __device__ __forceinline__ project2nd(const project2nd& other):binary_function<T1,T2,T2>(){}\r
+ __device__ __forceinline__ project2nd():binary_function<T1,T2,T2>(){}\r
};\r
\r
// Min/Max Operations\r
template <> struct name<type> : binary_function<type, type, type> \\r
{ \\r
__device__ __forceinline__ type operator()(type lhs, type rhs) const {return op(lhs, rhs);} \\r
+ __device__ __forceinline__ name(const name& other):binary_function<type, type, type>(){}\\r
+ __device__ __forceinline__ name():binary_function<type, type, type>(){}\\r
};\r
\r
template <typename T> struct maximum : binary_function<T, T, T>\r
{\r
return lhs < rhs ? rhs : lhs;\r
}\r
+ __device__ __forceinline__ maximum(const maximum& other):binary_function<T, T, T>(){}\r
+ __device__ __forceinline__ maximum():binary_function<T, T, T>(){}\r
};\r
\r
OPENCV_GPU_IMPLEMENT_MINMAX(maximum, uchar, ::max)\r
{\r
return lhs < rhs ? lhs : rhs;\r
}\r
+ __device__ __forceinline__ minimum(const minimum& other):binary_function<T, T, T>(){}\r
+ __device__ __forceinline__ minimum():binary_function<T, T, T>(){}\r
};\r
\r
OPENCV_GPU_IMPLEMENT_MINMAX(minimum, uchar, ::min)\r
#undef OPENCV_GPU_IMPLEMENT_MINMAX\r
\r
// Math functions\r
-\r
+///bound=========================================\r
#define OPENCV_GPU_IMPLEMENT_UN_FUNCTOR(name, func) \\r
template <typename T> struct name ## _func : unary_function<T, float> \\r
{ \\r
};\r
\r
// Saturate Cast Functor\r
-\r
template <typename T, typename D> struct saturate_cast_func : unary_function<T, D>\r
{\r
__device__ __forceinline__ D operator ()(typename TypeTraits<T>::ParameterType v) const\r
{\r
return saturate_cast<D>(v);\r
}\r
+ __device__ __forceinline__ saturate_cast_func(const saturate_cast_func& other):unary_function<T, D>(){}\r
+ __device__ __forceinline__ saturate_cast_func():unary_function<T, D>(){}\r
};\r
\r
// Threshold Functors\r
-\r
template <typename T> struct thresh_binary_func : unary_function<T, T>\r
{\r
__host__ __device__ __forceinline__ thresh_binary_func(T thresh_, T maxVal_) : thresh(thresh_), maxVal(maxVal_) {}\r
{\r
return (src > thresh) * maxVal;\r
}\r
+ __device__ __forceinline__ thresh_binary_func(const thresh_binary_func& other)\r
+ : unary_function<T, T>(), thresh(other.thresh), maxVal(other.maxVal){}\r
+\r
+ __device__ __forceinline__ thresh_binary_func():unary_function<T, T>(){}\r
\r
const T thresh;\r
const T maxVal;\r
};\r
+\r
template <typename T> struct thresh_binary_inv_func : unary_function<T, T>\r
{\r
__host__ __device__ __forceinline__ thresh_binary_inv_func(T thresh_, T maxVal_) : thresh(thresh_), maxVal(maxVal_) {}\r
{\r
return (src <= thresh) * maxVal;\r
}\r
+ __device__ __forceinline__ thresh_binary_inv_func(const thresh_binary_inv_func& other)\r
+ : unary_function<T, T>(), thresh(other.thresh), maxVal(other.maxVal){}\r
+\r
+ __device__ __forceinline__ thresh_binary_inv_func():unary_function<T, T>(){}\r
\r
const T thresh;\r
const T maxVal;\r
};\r
+\r
template <typename T> struct thresh_trunc_func : unary_function<T, T>\r
{\r
explicit __host__ __device__ __forceinline__ thresh_trunc_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {}\r
return minimum<T>()(src, thresh);\r
}\r
\r
+ __device__ __forceinline__ thresh_trunc_func(const thresh_trunc_func& other)\r
+ : unary_function<T, T>(), thresh(other.thresh){}\r
+\r
+ __device__ __forceinline__ thresh_trunc_func():unary_function<T, T>(){}\r
+\r
const T thresh;\r
};\r
+\r
template <typename T> struct thresh_to_zero_func : unary_function<T, T>\r
{\r
explicit __host__ __device__ __forceinline__ thresh_to_zero_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {}\r
{\r
return (src > thresh) * src;\r
}\r
+ __device__ __forceinline__ thresh_to_zero_func(const thresh_to_zero_func& other)\r
+ : unary_function<T, T>(), thresh(other.thresh){}\r
+\r
+ __device__ __forceinline__ thresh_to_zero_func():unary_function<T, T>(){}\r
\r
const T thresh;\r
};\r
+\r
template <typename T> struct thresh_to_zero_inv_func : unary_function<T, T>\r
{\r
explicit __host__ __device__ __forceinline__ thresh_to_zero_inv_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {}\r
{\r
return (src <= thresh) * src;\r
}\r
+ __device__ __forceinline__ thresh_to_zero_inv_func(const thresh_to_zero_inv_func& other)\r
+ : unary_function<T, T>(), thresh(other.thresh){}\r
+\r
+ __device__ __forceinline__ thresh_to_zero_inv_func():unary_function<T, T>(){}\r
\r
const T thresh;\r
};\r
-\r
+//bound!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ============>\r
// Function Object Adaptors\r
-\r
template <typename Predicate> struct unary_negate : unary_function<typename Predicate::argument_type, bool>\r
{\r
explicit __host__ __device__ __forceinline__ unary_negate(const Predicate& p) : pred(p) {}\r