OpenCV 4.5.3(日本語機械翻訳)
intrin_forward.hpp
1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html
4
5 #ifndef CV__SIMD_FORWARD
6 #error "Need to pre-define forward width"
7 #endif
8
9 namespace cv
10{
11
13
14CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN
15
17 #if CV__SIMD_FORWARD == 1024
18 // [todo] 1024
19 #error "1024-long ops not implemented yet"
20 #elif CV__SIMD_FORWARD == 512
21 // 512
22 #define __CV_VX(fun) v512_##fun
23 #define __CV_V_UINT8 v_uint8x64
24 #define __CV_V_INT8 v_int8x64
25 #define __CV_V_UINT16 v_uint16x32
26 #define __CV_V_INT16 v_int16x32
27 #define __CV_V_UINT32 v_uint32x16
28 #define __CV_V_INT32 v_int32x16
29 #define __CV_V_UINT64 v_uint64x8
30 #define __CV_V_INT64 v_int64x8
31 #define __CV_V_FLOAT32 v_float32x16
32 #define __CV_V_FLOAT64 v_float64x8
33 struct v_uint8x64;
34 struct v_int8x64;
35 struct v_uint16x32;
36 struct v_int16x32;
37 struct v_uint32x16;
38 struct v_int32x16;
39 struct v_uint64x8;
40 struct v_int64x8;
41 struct v_float32x16;
42 struct v_float64x8;
43 #elif CV__SIMD_FORWARD == 256
44 // 256
45 #define __CV_VX(fun) v256_##fun
46 #define __CV_V_UINT8 v_uint8x32
47 #define __CV_V_INT8 v_int8x32
48 #define __CV_V_UINT16 v_uint16x16
49 #define __CV_V_INT16 v_int16x16
50 #define __CV_V_UINT32 v_uint32x8
51 #define __CV_V_INT32 v_int32x8
52 #define __CV_V_UINT64 v_uint64x4
53 #define __CV_V_INT64 v_int64x4
54 #define __CV_V_FLOAT32 v_float32x8
55 #define __CV_V_FLOAT64 v_float64x4
56 struct v_uint8x32;
57 struct v_int8x32;
58 struct v_uint16x16;
59 struct v_int16x16;
60 struct v_uint32x8;
61 struct v_int32x8;
62 struct v_uint64x4;
63 struct v_int64x4;
64 struct v_float32x8;
65 struct v_float64x4;
66 #else
67 // 128
68 #define __CV_VX(fun) v_##fun
69 #define __CV_V_UINT8 v_uint8x16
70 #define __CV_V_INT8 v_int8x16
71 #define __CV_V_UINT16 v_uint16x8
72 #define __CV_V_INT16 v_int16x8
73 #define __CV_V_UINT32 v_uint32x4
74 #define __CV_V_INT32 v_int32x4
75 #define __CV_V_UINT64 v_uint64x2
76 #define __CV_V_INT64 v_int64x2
77 #define __CV_V_FLOAT32 v_float32x4
78 #define __CV_V_FLOAT64 v_float64x2
79 struct v_uint8x16;
80 struct v_int8x16;
81 struct v_uint16x8;
82 struct v_int16x8;
83 struct v_uint32x4;
84 struct v_int32x4;
85 struct v_uint64x2;
86 struct v_int64x2;
87 struct v_float32x4;
88 struct v_float64x2;
89 #endif
90
93 // Expansion
94 void v_expand(const __CV_V_UINT8&, __CV_V_UINT16&, __CV_V_UINT16&);
95 void v_expand(const __CV_V_INT8&, __CV_V_INT16&, __CV_V_INT16&);
96 void v_expand(const __CV_V_UINT16&, __CV_V_UINT32&, __CV_V_UINT32&);
97 void v_expand(const __CV_V_INT16&, __CV_V_INT32&, __CV_V_INT32&);
98 void v_expand(const __CV_V_UINT32&, __CV_V_UINT64&, __CV_V_UINT64&);
99 void v_expand(const __CV_V_INT32&, __CV_V_INT64&, __CV_V_INT64&);
100 // Low Expansion
101__CV_V_UINT16 v_expand_low(const __CV_V_UINT8&);
102__CV_V_INT16 v_expand_low(const __CV_V_INT8&);
103__CV_V_UINT32 v_expand_low(const __CV_V_UINT16&);
104__CV_V_INT32 v_expand_low(const __CV_V_INT16&);
105__CV_V_UINT64 v_expand_low(const __CV_V_UINT32&);
106__CV_V_INT64 v_expand_low(const __CV_V_INT32&);
107 // High Expansion
108__CV_V_UINT16 v_expand_high(const __CV_V_UINT8&);
109__CV_V_INT16 v_expand_high(const __CV_V_INT8&);
110__CV_V_UINT32 v_expand_high(const __CV_V_UINT16&);
111__CV_V_INT32 v_expand_high(const __CV_V_INT16&);
112__CV_V_UINT64 v_expand_high(const __CV_V_UINT32&);
113__CV_V_INT64 v_expand_high(const __CV_V_INT32&);
114 // Load & Low Expansion
115__CV_V_UINT16 __CV_VX(load_expand)(const uchar*);
116__CV_V_INT16 __CV_VX(load_expand)(const schar*);
117__CV_V_UINT32 __CV_VX(load_expand)(const ushort*);
118__CV_V_INT32 __CV_VX(load_expand)(const short*);
119__CV_V_UINT64 __CV_VX(load_expand)(const uint*);
120__CV_V_INT64 __CV_VX(load_expand)(const int*);
121 // Load lower 8-bit and expand into 32-bit
122__CV_V_UINT32 __CV_VX(load_expand_q)(const uchar*);
123__CV_V_INT32 __CV_VX(load_expand_q)(const schar*);
124
125 // Saturating Pack
126__CV_V_UINT8 v_pack(const __CV_V_UINT16&, const __CV_V_UINT16&);
127__CV_V_INT8 v_pack(const __CV_V_INT16&, const __CV_V_INT16&);
128__CV_V_UINT16 v_pack(const __CV_V_UINT32&, const __CV_V_UINT32&);
129__CV_V_INT16 v_pack(const __CV_V_INT32&, const __CV_V_INT32&);
130 // Non-saturating Pack
131__CV_V_UINT32 v_pack(const __CV_V_UINT64&, const __CV_V_UINT64&);
132__CV_V_INT32 v_pack(const __CV_V_INT64&, const __CV_V_INT64&);
133 // Pack signed integers with unsigned saturation
134__CV_V_UINT8 v_pack_u(const __CV_V_INT16&, const __CV_V_INT16&);
135__CV_V_UINT16 v_pack_u(const __CV_V_INT32&, const __CV_V_INT32&);
136
139 // Non-saturating multiply
140 #if CV_VSX
141 template<typename Tvec>
142Tvec v_mul_wrap(const Tvec& a, const Tvec& b);
143 #else
144__CV_V_UINT8 v_mul_wrap(const __CV_V_UINT8&, const __CV_V_UINT8&);
145__CV_V_INT8 v_mul_wrap(const __CV_V_INT8&, const __CV_V_INT8&);
146__CV_V_UINT16 v_mul_wrap(const __CV_V_UINT16&, const __CV_V_UINT16&);
147__CV_V_INT16 v_mul_wrap(const __CV_V_INT16&, const __CV_V_INT16&);
148 #endif
149
150 // Multiply and expand
151 #if CV_VSX
152 template<typename Tvec, typename Twvec>
153 void v_mul_expand(const Tvec& a, const Tvec& b, Twvec& c, Twvec& d);
154 #else
155 void v_mul_expand(const __CV_V_UINT8&, const __CV_V_UINT8&, __CV_V_UINT16&, __CV_V_UINT16&);
156 void v_mul_expand(const __CV_V_INT8&, const __CV_V_INT8&, __CV_V_INT16&, __CV_V_INT16&);
157 void v_mul_expand(const __CV_V_UINT16&, const __CV_V_UINT16&, __CV_V_UINT32&, __CV_V_UINT32&);
158 void v_mul_expand(const __CV_V_INT16&, const __CV_V_INT16&, __CV_V_INT32&, __CV_V_INT32&);
159 void v_mul_expand(const __CV_V_UINT32&, const __CV_V_UINT32&, __CV_V_UINT64&, __CV_V_UINT64&);
160 void v_mul_expand(const __CV_V_INT32&, const __CV_V_INT32&, __CV_V_INT64&, __CV_V_INT64&);
161 #endif
162
163 // Conversions
164__CV_V_FLOAT32 v_cvt_f32(const __CV_V_INT32& a);
165__CV_V_FLOAT32 v_cvt_f32(const __CV_V_FLOAT64& a);
166__CV_V_FLOAT32 v_cvt_f32(const __CV_V_FLOAT64& a, const __CV_V_FLOAT64& b);
167__CV_V_FLOAT64 v_cvt_f64(const __CV_V_INT32& a);
168__CV_V_FLOAT64 v_cvt_f64_high(const __CV_V_INT32& a);
169__CV_V_FLOAT64 v_cvt_f64(const __CV_V_FLOAT32& a);
170__CV_V_FLOAT64 v_cvt_f64_high(const __CV_V_FLOAT32& a);
171__CV_V_FLOAT64 v_cvt_f64(const __CV_V_INT64& a);
172
174 #undef CV__SIMD_FORWARD
175 #undef __CV_VX
176 #undef __CV_V_UINT8
177 #undef __CV_V_INT8
178 #undef __CV_V_UINT16
179 #undef __CV_V_INT16
180 #undef __CV_V_UINT32
181 #undef __CV_V_INT32
182 #undef __CV_V_UINT64
183 #undef __CV_V_INT64
184 #undef __CV_V_FLOAT32
185 #undef __CV_V_FLOAT64
186
187CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END
188
190
191} // cv::
v_reg< schar, 16 > v_int8x16
Sixteen 8-bit signed integer values
Definition: intrin_cpp.hpp:490
v_reg< uchar, 16 > v_uint8x16
Sixteen 8-bit unsigned integer values
Definition: intrin_cpp.hpp:488
v_reg< int64, 2 > v_int64x2
Two 64-bit signed integer values
Definition: intrin_cpp.hpp:506
v_reg< ushort, 8 > v_uint16x8
Eight 16-bit unsigned integer values
Definition: intrin_cpp.hpp:492
v_reg< int, 4 > v_int32x4
Four 32-bit signed integer values
Definition: intrin_cpp.hpp:498
v_reg< unsigned, 4 > v_uint32x4
Four 32-bit unsigned integer values
Definition: intrin_cpp.hpp:496
CV_INLINE v_reg< double,(n/2)> v_cvt_f64_high(const v_reg< int, n > &a)
Convert to double high part of vector
Definition: intrin_cpp.hpp:2587
void v_mul_expand(const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b, v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > &c, v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > &d)
Multiply and expand
Definition: intrin_cpp.hpp:1219
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > v_expand_low(const v_reg< _Tp, n > &a)
Expand lower values to the wider pack type
Definition: intrin_cpp.hpp:1499
CV_INLINE v_reg< double, n/2 > v_cvt_f64(const v_reg< int, n > &a)
Convert lower half to double
Definition: intrin_cpp.hpp:2576
void v_expand(const v_reg< _Tp, n > &a, v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > &b0, v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > &b1)
Expand values to the wider pack type
Definition: intrin_cpp.hpp:1477
v_reg< uint64, 2 > v_uint64x2
Two 64-bit unsigned integer values
Definition: intrin_cpp.hpp:504
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > v_expand_high(const v_reg< _Tp, n > &a)
Expand higher values to the wider pack type
Definition: intrin_cpp.hpp:1518
v_reg< float, 4 > v_float32x4
Four 32-bit floating point values (single precision)
Definition: intrin_cpp.hpp:500
v_reg< float, n > v_cvt_f32(const v_reg< int, n > &a)
Convert to float
Definition: intrin_cpp.hpp:2537
v_reg< short, 8 > v_int16x8
Eight 16-bit signed integer values
Definition: intrin_cpp.hpp:494
v_reg< double, 2 > v_float64x2
Two 64-bit floating point values (double precision)
Definition: intrin_cpp.hpp:502
cv
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75