6#ifdef OPENCV_HAL_INTRIN_HPP
9#if CV_SIMD128 || CV_SIMD128_CPP
11template<
typename _T>
struct Type2Vec128_Traits;
12#define CV_INTRIN_DEF_TYPE2VEC128_TRAITS(type_, vec_type_) \
13 template<> struct Type2Vec128_Traits<type_> \
15 typedef vec_type_ vec_type; \
18CV_INTRIN_DEF_TYPE2VEC128_TRAITS(
uchar, v_uint8x16);
19CV_INTRIN_DEF_TYPE2VEC128_TRAITS(
schar, v_int8x16);
20CV_INTRIN_DEF_TYPE2VEC128_TRAITS(
ushort, v_uint16x8);
21CV_INTRIN_DEF_TYPE2VEC128_TRAITS(
short, v_int16x8);
22CV_INTRIN_DEF_TYPE2VEC128_TRAITS(
unsigned, v_uint32x4);
23CV_INTRIN_DEF_TYPE2VEC128_TRAITS(
int, v_int32x4);
24CV_INTRIN_DEF_TYPE2VEC128_TRAITS(
float, v_float32x4);
25CV_INTRIN_DEF_TYPE2VEC128_TRAITS(
uint64, v_uint64x2);
26CV_INTRIN_DEF_TYPE2VEC128_TRAITS(
int64, v_int64x2);
28CV_INTRIN_DEF_TYPE2VEC128_TRAITS(
double, v_float64x2);
31template<
typename _T>
static inline
32typename Type2Vec128_Traits<_T>::vec_type v_setall(
const _T& a);
34template<>
inline Type2Vec128_Traits< uchar>::vec_type v_setall< uchar>(
const uchar& a) {
return v_setall_u8(a); }
35template<>
inline Type2Vec128_Traits< schar>::vec_type v_setall< schar>(
const schar& a) {
return v_setall_s8(a); }
36template<>
inline Type2Vec128_Traits<ushort>::vec_type v_setall<ushort>(
const ushort& a) {
return v_setall_u16(a); }
37template<>
inline Type2Vec128_Traits< short>::vec_type v_setall< short>(
const short& a) {
return v_setall_s16(a); }
38template<>
inline Type2Vec128_Traits< uint>::vec_type v_setall< uint>(
const uint& a) {
return v_setall_u32(a); }
39template<>
inline Type2Vec128_Traits< int>::vec_type v_setall< int>(
const int& a) {
return v_setall_s32(a); }
40template<>
inline Type2Vec128_Traits<uint64>::vec_type v_setall<uint64>(
const uint64& a) {
return v_setall_u64(a); }
41template<>
inline Type2Vec128_Traits< int64>::vec_type v_setall< int64>(
const int64& a) {
return v_setall_s64(a); }
42template<>
inline Type2Vec128_Traits< float>::vec_type v_setall< float>(
const float& a) {
return v_setall_f32(a); }
44template<>
inline Type2Vec128_Traits<double>::vec_type v_setall<double>(
const double& a) {
return v_setall_f64(a); }
52template<
typename _T>
struct Type2Vec256_Traits;
53#define CV_INTRIN_DEF_TYPE2VEC256_TRAITS(type_, vec_type_) \
54 template<> struct Type2Vec256_Traits<type_> \
56 typedef vec_type_ vec_type; \
59CV_INTRIN_DEF_TYPE2VEC256_TRAITS(
uchar, v_uint8x32);
60CV_INTRIN_DEF_TYPE2VEC256_TRAITS(
schar, v_int8x32);
61CV_INTRIN_DEF_TYPE2VEC256_TRAITS(
ushort, v_uint16x16);
62CV_INTRIN_DEF_TYPE2VEC256_TRAITS(
short, v_int16x16);
63CV_INTRIN_DEF_TYPE2VEC256_TRAITS(
unsigned, v_uint32x8);
64CV_INTRIN_DEF_TYPE2VEC256_TRAITS(
int, v_int32x8);
65CV_INTRIN_DEF_TYPE2VEC256_TRAITS(
float, v_float32x8);
66CV_INTRIN_DEF_TYPE2VEC256_TRAITS(
uint64, v_uint64x4);
67CV_INTRIN_DEF_TYPE2VEC256_TRAITS(
int64, v_int64x4);
69CV_INTRIN_DEF_TYPE2VEC256_TRAITS(
double, v_float64x4);
72template<
typename _T>
static inline
73typename Type2Vec256_Traits<_T>::vec_type v256_setall(
const _T& a);
75template<>
inline Type2Vec256_Traits< uchar>::vec_type v256_setall< uchar>(
const uchar& a) {
return v256_setall_u8(a); }
76template<>
inline Type2Vec256_Traits< schar>::vec_type v256_setall< schar>(
const schar& a) {
return v256_setall_s8(a); }
77template<>
inline Type2Vec256_Traits<ushort>::vec_type v256_setall<ushort>(
const ushort& a) {
return v256_setall_u16(a); }
78template<>
inline Type2Vec256_Traits< short>::vec_type v256_setall< short>(
const short& a) {
return v256_setall_s16(a); }
79template<>
inline Type2Vec256_Traits< uint>::vec_type v256_setall< uint>(
const uint& a) {
return v256_setall_u32(a); }
80template<>
inline Type2Vec256_Traits< int>::vec_type v256_setall< int>(
const int& a) {
return v256_setall_s32(a); }
81template<>
inline Type2Vec256_Traits<uint64>::vec_type v256_setall<uint64>(
const uint64& a) {
return v256_setall_u64(a); }
82template<>
inline Type2Vec256_Traits< int64>::vec_type v256_setall< int64>(
const int64& a) {
return v256_setall_s64(a); }
83template<>
inline Type2Vec256_Traits< float>::vec_type v256_setall< float>(
const float& a) {
return v256_setall_f32(a); }
85template<>
inline Type2Vec256_Traits<double>::vec_type v256_setall<double>(
const double& a) {
return v256_setall_f64(a); }
93template<
typename _T>
struct Type2Vec512_Traits;
94#define CV_INTRIN_DEF_TYPE2VEC512_TRAITS(type_, vec_type_) \
95 template<> struct Type2Vec512_Traits<type_> \
97 typedef vec_type_ vec_type; \
100CV_INTRIN_DEF_TYPE2VEC512_TRAITS(
uchar, v_uint8x64);
101CV_INTRIN_DEF_TYPE2VEC512_TRAITS(
schar, v_int8x64);
102CV_INTRIN_DEF_TYPE2VEC512_TRAITS(
ushort, v_uint16x32);
103CV_INTRIN_DEF_TYPE2VEC512_TRAITS(
short, v_int16x32);
104CV_INTRIN_DEF_TYPE2VEC512_TRAITS(
unsigned, v_uint32x16);
105CV_INTRIN_DEF_TYPE2VEC512_TRAITS(
int, v_int32x16);
106CV_INTRIN_DEF_TYPE2VEC512_TRAITS(
float, v_float32x16);
107CV_INTRIN_DEF_TYPE2VEC512_TRAITS(
uint64, v_uint64x8);
108CV_INTRIN_DEF_TYPE2VEC512_TRAITS(
int64, v_int64x8);
110CV_INTRIN_DEF_TYPE2VEC512_TRAITS(
double, v_float64x8);
113template<
typename _T>
static inline
114typename Type2Vec512_Traits<_T>::vec_type v512_setall(
const _T& a);
116template<>
inline Type2Vec512_Traits< uchar>::vec_type v512_setall< uchar>(
const uchar& a) {
return v512_setall_u8(a); }
117template<>
inline Type2Vec512_Traits< schar>::vec_type v512_setall< schar>(
const schar& a) {
return v512_setall_s8(a); }
118template<>
inline Type2Vec512_Traits<ushort>::vec_type v512_setall<ushort>(
const ushort& a) {
return v512_setall_u16(a); }
119template<>
inline Type2Vec512_Traits< short>::vec_type v512_setall< short>(
const short& a) {
return v512_setall_s16(a); }
120template<>
inline Type2Vec512_Traits< uint>::vec_type v512_setall< uint>(
const uint& a) {
return v512_setall_u32(a); }
121template<>
inline Type2Vec512_Traits< int>::vec_type v512_setall< int>(
const int& a) {
return v512_setall_s32(a); }
122template<>
inline Type2Vec512_Traits<uint64>::vec_type v512_setall<uint64>(
const uint64& a) {
return v512_setall_u64(a); }
123template<>
inline Type2Vec512_Traits< int64>::vec_type v512_setall< int64>(
const int64& a) {
return v512_setall_s64(a); }
124template<>
inline Type2Vec512_Traits< float>::vec_type v512_setall< float>(
const float& a) {
return v512_setall_f32(a); }
126template<>
inline Type2Vec512_Traits<double>::vec_type v512_setall<double>(
const double& a) {
return v512_setall_f64(a); }
132template<
typename _T>
struct Type2Vec_Traits;
133#define CV_INTRIN_DEF_TYPE2VEC_TRAITS(type_, vec_type_) \
134 template<> struct Type2Vec_Traits<type_> \
136 typedef vec_type_ vec_type; \
139CV_INTRIN_DEF_TYPE2VEC_TRAITS(
uchar, v_uint8);
140CV_INTRIN_DEF_TYPE2VEC_TRAITS(
schar, v_int8);
141CV_INTRIN_DEF_TYPE2VEC_TRAITS(
ushort, v_uint16);
142CV_INTRIN_DEF_TYPE2VEC_TRAITS(
short, v_int16);
143CV_INTRIN_DEF_TYPE2VEC_TRAITS(
unsigned, v_uint32);
144CV_INTRIN_DEF_TYPE2VEC_TRAITS(
int, v_int32);
145CV_INTRIN_DEF_TYPE2VEC_TRAITS(
float, v_float32);
146CV_INTRIN_DEF_TYPE2VEC_TRAITS(
uint64, v_uint64);
147CV_INTRIN_DEF_TYPE2VEC_TRAITS(
int64, v_int64);
148#if CV_SIMD_SCALABLE_64F
149CV_INTRIN_DEF_TYPE2VEC_TRAITS(
double, v_float64);
151template<
typename _T>
static inline
152typename Type2Vec_Traits<_T>::vec_type v_setall(
const _T& a);
154template<>
inline Type2Vec_Traits< uchar>::vec_type v_setall< uchar>(
const uchar& a) {
return v_setall_u8(a); }
155template<>
inline Type2Vec_Traits< schar>::vec_type v_setall< schar>(
const schar& a) {
return v_setall_s8(a); }
156template<>
inline Type2Vec_Traits<ushort>::vec_type v_setall<ushort>(
const ushort& a) {
return v_setall_u16(a); }
157template<>
inline Type2Vec_Traits< short>::vec_type v_setall< short>(
const short& a) {
return v_setall_s16(a); }
158template<>
inline Type2Vec_Traits< uint>::vec_type v_setall< uint>(
const uint& a) {
return v_setall_u32(a); }
159template<>
inline Type2Vec_Traits< int>::vec_type v_setall< int>(
const int& a) {
return v_setall_s32(a); }
160template<>
inline Type2Vec_Traits<uint64>::vec_type v_setall<uint64>(
const uint64& a) {
return v_setall_u64(a); }
161template<>
inline Type2Vec_Traits< int64>::vec_type v_setall< int64>(
const int64& a) {
return v_setall_s64(a); }
162template<>
inline Type2Vec_Traits< float>::vec_type v_setall< float>(
const float& a) {
return v_setall_f32(a); }
163#if CV_SIMD_SCALABLE_64F
164template<>
inline Type2Vec_Traits<double>::vec_type v_setall<double>(
const double& a) {
return v_setall_f64(a); }
170template<
typename _T>
static inline
171typename Type2Vec_Traits<_T>::vec_type vx_setall(
const _T& a) {
return v_setall(a); }
172#elif CV_SIMD_WIDTH == 16
173template<
typename _T>
static inline
174typename Type2Vec128_Traits<_T>::vec_type vx_setall(
const _T& a) {
return v_setall(a); }
175#elif CV_SIMD_WIDTH == 32
176template<
typename _T>
static inline
177typename Type2Vec256_Traits<_T>::vec_type vx_setall(
const _T& a) {
return v256_setall(a); }
178#elif CV_SIMD_WIDTH == 64
179template<
typename _T>
static inline
180typename Type2Vec512_Traits<_T>::vec_type vx_setall(
const _T& a) {
return v512_setall(a); }
182#error "Build configuration error, unsupported CV_SIMD_WIDTH"
signed char schar
Definition interface.h:48
uint32_t uint
Definition interface.h:42
unsigned char uchar
Definition interface.h:51
int64_t int64
Definition interface.h:61
unsigned short ushort
Definition interface.h:52
uint64_t uint64
Definition interface.h:62