Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
ecb8fb96
Commit
ecb8fb96
authored
Oct 28, 2016
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7572 from tomoaki0705:featureUniversalStereoSgbm
parents
7f2ac764
b823c8e9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
16 deletions
+70
-16
stereosgbm.cpp
modules/calib3d/src/stereosgbm.cpp
+0
-0
intrin_neon.hpp
modules/core/include/opencv2/core/hal/intrin_neon.hpp
+27
-15
intrin_sse.hpp
modules/core/include/opencv2/core/hal/intrin_sse.hpp
+40
-0
test_intrin.cpp
modules/core/test/test_intrin.cpp
+3
-1
No files found.
modules/calib3d/src/stereosgbm.cpp
View file @
ecb8fb96
This diff is collapsed.
Click to expand it.
modules/core/include/opencv2/core/hal/intrin_neon.hpp
View file @
ecb8fb96
...
...
@@ -782,25 +782,37 @@ inline void v_store_f16(short* ptr, v_float16x4& a)
{
vst1_f16
(
ptr
,
a
.
val
);
}
#endif
#define OPENCV_HAL_IMPL_NEON_REDUCE_OP_
4(_Tpvec, scalartype, func, scalar_func
) \
#define OPENCV_HAL_IMPL_NEON_REDUCE_OP_
8(_Tpvec, _Tpnvec, scalartype, func, vectorfunc, suffix
) \
inline scalartype v_reduce_##func(const _Tpvec& a) \
{ \
scalartype CV_DECL_ALIGNED(16) buf[4]; \
v_store_aligned(buf, a); \
scalartype s0 = scalar_func(buf[0], buf[1]); \
scalartype s1 = scalar_func(buf[2], buf[3]); \
return scalar_func(s0, s1); \
_Tpnvec##_t a0 = vp##vectorfunc##_##suffix(vget_low_##suffix(a.val), vget_high_##suffix(a.val)); \
a0 = vp##vectorfunc##_##suffix(a0, a0); \
return (scalartype)vget_lane_##suffix(vp##vectorfunc##_##suffix(a0, a0),0); \
}
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_uint32x4
,
unsigned
,
sum
,
OPENCV_HAL_ADD
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_uint32x4
,
unsigned
,
max
,
std
::
max
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_uint32x4
,
unsigned
,
min
,
std
::
min
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_int32x4
,
int
,
sum
,
OPENCV_HAL_ADD
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_int32x4
,
int
,
max
,
std
::
max
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_int32x4
,
int
,
min
,
std
::
min
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_float32x4
,
float
,
sum
,
OPENCV_HAL_ADD
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_float32x4
,
float
,
max
,
std
::
max
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_float32x4
,
float
,
min
,
std
::
min
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_8
(
v_uint16x8
,
uint16x4
,
unsigned
short
,
sum
,
add
,
u16
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_8
(
v_uint16x8
,
uint16x4
,
unsigned
short
,
max
,
max
,
u16
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_8
(
v_uint16x8
,
uint16x4
,
unsigned
short
,
min
,
min
,
u16
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_8
(
v_int16x8
,
int16x4
,
short
,
sum
,
add
,
s16
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_8
(
v_int16x8
,
int16x4
,
short
,
max
,
max
,
s16
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_8
(
v_int16x8
,
int16x4
,
short
,
min
,
min
,
s16
)
#define OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(_Tpvec, _Tpnvec, scalartype, func, vectorfunc, suffix) \
inline scalartype v_reduce_##func(const _Tpvec& a) \
{ \
_Tpnvec##_t a0 = vp##vectorfunc##_##suffix(vget_low_##suffix(a.val), vget_high_##suffix(a.val)); \
return (scalartype)vget_lane_##suffix(vp##vectorfunc##_##suffix(a0, vget_high_##suffix(a.val)),0); \
}
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_uint32x4
,
uint32x2
,
unsigned
,
sum
,
add
,
u32
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_uint32x4
,
uint32x2
,
unsigned
,
max
,
max
,
u32
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_uint32x4
,
uint32x2
,
unsigned
,
min
,
min
,
u32
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_int32x4
,
int32x2
,
int
,
sum
,
add
,
s32
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_int32x4
,
int32x2
,
int
,
max
,
max
,
s32
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_int32x4
,
int32x2
,
int
,
min
,
min
,
s32
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_float32x4
,
float32x2
,
float
,
sum
,
add
,
f32
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_float32x4
,
float32x2
,
float
,
max
,
max
,
f32
)
OPENCV_HAL_IMPL_NEON_REDUCE_OP_4
(
v_float32x4
,
float32x2
,
float
,
min
,
min
,
f32
)
inline
int
v_signmask
(
const
v_uint8x16
&
a
)
{
...
...
modules/core/include/opencv2/core/hal/intrin_sse.hpp
View file @
ecb8fb96
...
...
@@ -1060,6 +1060,46 @@ inline void v_store_f16(short* ptr, v_float16x4& a)
{
_mm_storel_epi64
((
__m128i
*
)
ptr
,
a
.
val
);
}
#endif
#define OPENCV_HAL_IMPL_SSE_REDUCE_OP_8(_Tpvec, scalartype, func, suffix, sbit) \
inline scalartype v_reduce_##func(const v_##_Tpvec& a) \
{ \
__m128i val = a.val; \
val = _mm_##func##_##suffix(val, _mm_srli_si128(val,8)); \
val = _mm_##func##_##suffix(val, _mm_srli_si128(val,4)); \
val = _mm_##func##_##suffix(val, _mm_srli_si128(val,2)); \
return (scalartype)_mm_cvtsi128_si32(val); \
} \
inline unsigned scalartype v_reduce_##func(const v_u##_Tpvec& a) \
{ \
__m128i val = a.val; \
__m128i smask = _mm_set1_epi16(sbit); \
val = _mm_xor_si128(val, smask); \
val = _mm_##func##_##suffix(val, _mm_srli_si128(val,8)); \
val = _mm_##func##_##suffix(val, _mm_srli_si128(val,4)); \
val = _mm_##func##_##suffix(val, _mm_srli_si128(val,2)); \
return (unsigned scalartype)(_mm_cvtsi128_si32(val) ^ sbit); \
}
#define OPENCV_HAL_IMPL_SSE_REDUCE_OP_8_SUM(_Tpvec, scalartype, suffix) \
inline scalartype v_reduce_sum(const v_##_Tpvec& a) \
{ \
__m128i val = a.val; \
val = _mm_adds_epi##suffix(val, _mm_srli_si128(val, 8)); \
val = _mm_adds_epi##suffix(val, _mm_srli_si128(val, 4)); \
val = _mm_adds_epi##suffix(val, _mm_srli_si128(val, 2)); \
return (scalartype)_mm_cvtsi128_si32(val); \
} \
inline unsigned scalartype v_reduce_sum(const v_u##_Tpvec& a) \
{ \
__m128i val = a.val; \
val = _mm_adds_epu##suffix(val, _mm_srli_si128(val, 8)); \
val = _mm_adds_epu##suffix(val, _mm_srli_si128(val, 4)); \
val = _mm_adds_epu##suffix(val, _mm_srli_si128(val, 2)); \
return (unsigned scalartype)_mm_cvtsi128_si32(val); \
}
OPENCV_HAL_IMPL_SSE_REDUCE_OP_8
(
int16x8
,
short
,
max
,
epi16
,
(
short
)
-
32768
)
OPENCV_HAL_IMPL_SSE_REDUCE_OP_8
(
int16x8
,
short
,
min
,
epi16
,
(
short
)
-
32768
)
OPENCV_HAL_IMPL_SSE_REDUCE_OP_8_SUM
(
int16x8
,
short
,
16
)
#define OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(_Tpvec, scalartype, func, scalar_func) \
inline scalartype v_reduce_##func(const _Tpvec& a) \
{ \
...
...
modules/core/test/test_intrin.cpp
View file @
ecb8fb96
...
...
@@ -449,7 +449,7 @@ template<typename R> struct TheTest
R
a
=
dataA
;
EXPECT_EQ
((
LaneType
)
1
,
v_reduce_min
(
a
));
EXPECT_EQ
((
LaneType
)
R
::
nlanes
,
v_reduce_max
(
a
));
EXPECT_EQ
((
LaneType
)(
1
+
R
::
nlanes
)
*
2
,
v_reduce_sum
(
a
));
EXPECT_EQ
((
LaneType
)(
(
1
+
R
::
nlanes
)
*
R
::
nlanes
/
2
)
,
v_reduce_sum
(
a
));
return
*
this
;
}
...
...
@@ -842,6 +842,7 @@ TEST(hal_intrin, uint16x8) {
.
test_logic
()
.
test_min_max
()
.
test_absdiff
()
.
test_reduce
()
.
test_mask
()
.
test_pack
<
1
>
().
test_pack
<
2
>
().
test_pack
<
7
>
().
test_pack
<
16
>
()
.
test_pack_u
<
1
>
().
test_pack_u
<
2
>
().
test_pack_u
<
7
>
().
test_pack_u
<
16
>
()
...
...
@@ -867,6 +868,7 @@ TEST(hal_intrin, int16x8) {
.
test_min_max
()
.
test_absdiff
()
.
test_abs
()
.
test_reduce
()
.
test_mask
()
.
test_pack
<
1
>
().
test_pack
<
2
>
().
test_pack
<
7
>
().
test_pack
<
16
>
()
.
test_unpack
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment