46
46
#include " NCV.hpp"
47
47
48
48
template <typename TBase> inline __host__ __device__ TBase _pixMaxVal ();
49
- template <> static inline __host__ __device__ Ncv8u _pixMaxVal<Ncv8u>() {return UCHAR_MAX;}
50
- template <> static inline __host__ __device__ Ncv16u _pixMaxVal<Ncv16u>() {return USHRT_MAX;}
51
- template <> static inline __host__ __device__ Ncv32u _pixMaxVal<Ncv32u>() {return UINT_MAX;}
52
- template <> static inline __host__ __device__ Ncv8s _pixMaxVal<Ncv8s>() {return CHAR_MAX ;}
53
- template <> static inline __host__ __device__ Ncv16s _pixMaxVal<Ncv16s>() {return SHRT_MAX;}
54
- template <> static inline __host__ __device__ Ncv32s _pixMaxVal<Ncv32s>() {return INT_MAX;}
55
- template <> static inline __host__ __device__ Ncv32f _pixMaxVal<Ncv32f>() {return FLT_MAX;}
56
- template <> static inline __host__ __device__ Ncv64f _pixMaxVal<Ncv64f>() {return DBL_MAX;}
49
+ template <> inline __host__ __device__ Ncv8u _pixMaxVal<Ncv8u>() {return UCHAR_MAX;}
50
+ template <> inline __host__ __device__ Ncv16u _pixMaxVal<Ncv16u>() {return USHRT_MAX;}
51
+ template <> inline __host__ __device__ Ncv32u _pixMaxVal<Ncv32u>() {return UINT_MAX;}
52
+ template <> inline __host__ __device__ Ncv8s _pixMaxVal<Ncv8s>() {return SCHAR_MAX ;}
53
+ template <> inline __host__ __device__ Ncv16s _pixMaxVal<Ncv16s>() {return SHRT_MAX;}
54
+ template <> inline __host__ __device__ Ncv32s _pixMaxVal<Ncv32s>() {return INT_MAX;}
55
+ template <> inline __host__ __device__ Ncv32f _pixMaxVal<Ncv32f>() {return FLT_MAX;}
56
+ template <> inline __host__ __device__ Ncv64f _pixMaxVal<Ncv64f>() {return DBL_MAX;}
57
57
58
58
template <typename TBase> inline __host__ __device__ TBase _pixMinVal ();
59
- template <> static inline __host__ __device__ Ncv8u _pixMinVal<Ncv8u>() {return 0 ;}
60
- template <> static inline __host__ __device__ Ncv16u _pixMinVal<Ncv16u>() {return 0 ;}
61
- template <> static inline __host__ __device__ Ncv32u _pixMinVal<Ncv32u>() {return 0 ;}
62
- template <> static inline __host__ __device__ Ncv8s _pixMinVal<Ncv8s>() {return CHAR_MIN ;}
63
- template <> static inline __host__ __device__ Ncv16s _pixMinVal<Ncv16s>() {return SHRT_MIN;}
64
- template <> static inline __host__ __device__ Ncv32s _pixMinVal<Ncv32s>() {return INT_MIN;}
65
- template <> static inline __host__ __device__ Ncv32f _pixMinVal<Ncv32f>() {return FLT_MIN;}
66
- template <> static inline __host__ __device__ Ncv64f _pixMinVal<Ncv64f>() {return DBL_MIN;}
59
+ template <> inline __host__ __device__ Ncv8u _pixMinVal<Ncv8u>() {return 0 ;}
60
+ template <> inline __host__ __device__ Ncv16u _pixMinVal<Ncv16u>() {return 0 ;}
61
+ template <> inline __host__ __device__ Ncv32u _pixMinVal<Ncv32u>() {return 0 ;}
62
+ template <> inline __host__ __device__ Ncv8s _pixMinVal<Ncv8s>() {return SCHAR_MIN ;}
63
+ template <> inline __host__ __device__ Ncv16s _pixMinVal<Ncv16s>() {return SHRT_MIN;}
64
+ template <> inline __host__ __device__ Ncv32s _pixMinVal<Ncv32s>() {return INT_MIN;}
65
+ template <> inline __host__ __device__ Ncv32f _pixMinVal<Ncv32f>() {return FLT_MIN;}
66
+ template <> inline __host__ __device__ Ncv64f _pixMinVal<Ncv64f>() {return DBL_MIN;}
67
67
68
68
template <typename Tvec> struct TConvVec2Base ;
69
- template <> struct TConvVec2Base <uchar1> {typedef Ncv8u TBase;};
70
- template <> struct TConvVec2Base <uchar3> {typedef Ncv8u TBase;};
71
- template <> struct TConvVec2Base <uchar4> {typedef Ncv8u TBase;};
69
+ template <> struct TConvVec2Base <uchar1> {typedef Ncv8u TBase;};
70
+ template <> struct TConvVec2Base <uchar3> {typedef Ncv8u TBase;};
71
+ template <> struct TConvVec2Base <uchar4> {typedef Ncv8u TBase;};
72
72
template <> struct TConvVec2Base <ushort1> {typedef Ncv16u TBase;};
73
73
template <> struct TConvVec2Base <ushort3> {typedef Ncv16u TBase;};
74
74
template <> struct TConvVec2Base <ushort4> {typedef Ncv16u TBase;};
75
- template <> struct TConvVec2Base <uint1> {typedef Ncv32u TBase;};
76
- template <> struct TConvVec2Base <uint3> {typedef Ncv32u TBase;};
77
- template <> struct TConvVec2Base <uint4> {typedef Ncv32u TBase;};
78
- template <> struct TConvVec2Base <float1> {typedef Ncv32f TBase;};
79
- template <> struct TConvVec2Base <float3> {typedef Ncv32f TBase;};
80
- template <> struct TConvVec2Base <float4> {typedef Ncv32f TBase;};
75
+ template <> struct TConvVec2Base <uint1> {typedef Ncv32u TBase;};
76
+ template <> struct TConvVec2Base <uint3> {typedef Ncv32u TBase;};
77
+ template <> struct TConvVec2Base <uint4> {typedef Ncv32u TBase;};
78
+ template <> struct TConvVec2Base <float1> {typedef Ncv32f TBase;};
79
+ template <> struct TConvVec2Base <float3> {typedef Ncv32f TBase;};
80
+ template <> struct TConvVec2Base <float4> {typedef Ncv32f TBase;};
81
81
template <> struct TConvVec2Base <double1> {typedef Ncv64f TBase;};
82
82
template <> struct TConvVec2Base <double3> {typedef Ncv64f TBase;};
83
83
template <> struct TConvVec2Base <double4> {typedef Ncv64f TBase;};
84
84
85
85
#define NC (T ) (sizeof (T) / sizeof (TConvVec2Base<T>::TBase))
86
86
87
87
template <typename TBase, Ncv32u NC> struct TConvBase2Vec ;
88
- template <> struct TConvBase2Vec <Ncv8u, 1 > {typedef uchar1 TVec;};
89
- template <> struct TConvBase2Vec <Ncv8u, 3 > {typedef uchar3 TVec;};
90
- template <> struct TConvBase2Vec <Ncv8u, 4 > {typedef uchar4 TVec;};
88
+ template <> struct TConvBase2Vec <Ncv8u, 1 > {typedef uchar1 TVec;};
89
+ template <> struct TConvBase2Vec <Ncv8u, 3 > {typedef uchar3 TVec;};
90
+ template <> struct TConvBase2Vec <Ncv8u, 4 > {typedef uchar4 TVec;};
91
91
template <> struct TConvBase2Vec <Ncv16u, 1 > {typedef ushort1 TVec;};
92
92
template <> struct TConvBase2Vec <Ncv16u, 3 > {typedef ushort3 TVec;};
93
93
template <> struct TConvBase2Vec <Ncv16u, 4 > {typedef ushort4 TVec;};
@@ -114,21 +114,21 @@ template<typename Tin> static inline __host__ __device__ void _TDemoteClampNN(Ti
114
114
template <typename Tin> static inline __host__ __device__ void _TDemoteClampNN (Tin &a, Ncv32f &out) {out = (Ncv32f)a;}
115
115
116
116
template <typename Tout> inline Tout _pixMakeZero ();
117
- template <> static inline __host__ __device__ uchar1 _pixMakeZero<uchar1>() {return make_uchar1 (0 );}
118
- template <> static inline __host__ __device__ uchar3 _pixMakeZero<uchar3>() {return make_uchar3 (0 ,0 ,0 );}
119
- template <> static inline __host__ __device__ uchar4 _pixMakeZero<uchar4>() {return make_uchar4 (0 ,0 ,0 ,0 );}
120
- template <> static inline __host__ __device__ ushort1 _pixMakeZero<ushort1>() {return make_ushort1 (0 );}
121
- template <> static inline __host__ __device__ ushort3 _pixMakeZero<ushort3>() {return make_ushort3 (0 ,0 ,0 );}
122
- template <> static inline __host__ __device__ ushort4 _pixMakeZero<ushort4>() {return make_ushort4 (0 ,0 ,0 ,0 );}
123
- template <> static inline __host__ __device__ uint1 _pixMakeZero<uint1>() {return make_uint1 (0 );}
124
- template <> static inline __host__ __device__ uint3 _pixMakeZero<uint3>() {return make_uint3 (0 ,0 ,0 );}
125
- template <> static inline __host__ __device__ uint4 _pixMakeZero<uint4>() {return make_uint4 (0 ,0 ,0 ,0 );}
126
- template <> static inline __host__ __device__ float1 _pixMakeZero<float1>() {return make_float1 (0 .f );}
127
- template <> static inline __host__ __device__ float3 _pixMakeZero<float3>() {return make_float3 (0 .f ,0 .f ,0 .f );}
128
- template <> static inline __host__ __device__ float4 _pixMakeZero<float4>() {return make_float4 (0 .f ,0 .f ,0 .f ,0 .f );}
129
- template <> static inline __host__ __device__ double1 _pixMakeZero<double1>() {return make_double1 (0 .);}
130
- template <> static inline __host__ __device__ double3 _pixMakeZero<double3>() {return make_double3 (0 .,0 .,0 .);}
131
- template <> static inline __host__ __device__ double4 _pixMakeZero<double4>() {return make_double4 (0 .,0 .,0 .,0 .);}
117
+ template <> inline __host__ __device__ uchar1 _pixMakeZero<uchar1>() {return make_uchar1 (0 );}
118
+ template <> inline __host__ __device__ uchar3 _pixMakeZero<uchar3>() {return make_uchar3 (0 ,0 ,0 );}
119
+ template <> inline __host__ __device__ uchar4 _pixMakeZero<uchar4>() {return make_uchar4 (0 ,0 ,0 ,0 );}
120
+ template <> inline __host__ __device__ ushort1 _pixMakeZero<ushort1>() {return make_ushort1 (0 );}
121
+ template <> inline __host__ __device__ ushort3 _pixMakeZero<ushort3>() {return make_ushort3 (0 ,0 ,0 );}
122
+ template <> inline __host__ __device__ ushort4 _pixMakeZero<ushort4>() {return make_ushort4 (0 ,0 ,0 ,0 );}
123
+ template <> inline __host__ __device__ uint1 _pixMakeZero<uint1>() {return make_uint1 (0 );}
124
+ template <> inline __host__ __device__ uint3 _pixMakeZero<uint3>() {return make_uint3 (0 ,0 ,0 );}
125
+ template <> inline __host__ __device__ uint4 _pixMakeZero<uint4>() {return make_uint4 (0 ,0 ,0 ,0 );}
126
+ template <> inline __host__ __device__ float1 _pixMakeZero<float1>() {return make_float1 (0 .f );}
127
+ template <> inline __host__ __device__ float3 _pixMakeZero<float3>() {return make_float3 (0 .f ,0 .f ,0 .f );}
128
+ template <> inline __host__ __device__ float4 _pixMakeZero<float4>() {return make_float4 (0 .f ,0 .f ,0 .f ,0 .f );}
129
+ template <> inline __host__ __device__ double1 _pixMakeZero<double1>() {return make_double1 (0 .);}
130
+ template <> inline __host__ __device__ double3 _pixMakeZero<double3>() {return make_double3 (0 .,0 .,0 .);}
131
+ template <> inline __host__ __device__ double4 _pixMakeZero<double4>() {return make_double4 (0 .,0 .,0 .,0 .);}
132
132
133
133
static inline __host__ __device__ uchar1 _pixMake (Ncv8u x) {return make_uchar1 (x);}
134
134
static inline __host__ __device__ uchar3 _pixMake (Ncv8u x, Ncv8u y, Ncv8u z) {return make_uchar3 (x,y,z);}
0 commit comments