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
cf86f88c
Commit
cf86f88c
authored
Jun 14, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8911 from alalek:fix_vsum4
parents
12a1c127
e23b59da
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
intrin_sse.hpp
modules/core/include/opencv2/core/hal/intrin_sse.hpp
+6
-0
test_intrin.cpp
modules/core/test/test_intrin.cpp
+18
-0
No files found.
modules/core/include/opencv2/core/hal/intrin_sse.hpp
View file @
cf86f88c
...
...
@@ -1129,9 +1129,15 @@ OPENCV_HAL_IMPL_SSE_REDUCE_OP_4_SUM(v_float32x4, float, __m128, ps, _mm_castps_s
inline
v_float32x4
v_reduce_sum4
(
const
v_float32x4
&
a
,
const
v_float32x4
&
b
,
const
v_float32x4
&
c
,
const
v_float32x4
&
d
)
{
#if CV_SSE3
__m128
ab
=
_mm_hadd_ps
(
a
.
val
,
b
.
val
);
__m128
cd
=
_mm_hadd_ps
(
c
.
val
,
d
.
val
);
return
v_float32x4
(
_mm_hadd_ps
(
ab
,
cd
));
#else
__m128
ac
=
_mm_add_ps
(
_mm_unpacklo_ps
(
a
.
val
,
c
.
val
),
_mm_unpackhi_ps
(
a
.
val
,
c
.
val
));
__m128
bd
=
_mm_add_ps
(
_mm_unpacklo_ps
(
b
.
val
,
d
.
val
),
_mm_unpackhi_ps
(
b
.
val
,
d
.
val
));
return
v_float32x4
(
_mm_add_ps
(
_mm_unpacklo_ps
(
ac
,
bd
),
_mm_unpackhi_ps
(
ac
,
bd
)));
#endif
}
OPENCV_HAL_IMPL_SSE_REDUCE_OP_4
(
v_uint32x4
,
unsigned
,
max
,
std
::
max
)
...
...
modules/core/test/test_intrin.cpp
View file @
cf86f88c
...
...
@@ -741,6 +741,23 @@ template<typename R> struct TheTest
return
*
this
;
}
TheTest
&
test_reduce_sum4
()
{
R
a
(
0.1
f
,
0.02
f
,
0.003
f
,
0.0004
f
);
R
b
(
1
,
20
,
300
,
4000
);
R
c
(
10
,
2
,
0.3
f
,
0.04
f
);
R
d
(
1
,
2
,
3
,
4
);
R
sum
=
v_reduce_sum4
(
a
,
b
,
c
,
d
);
Data
<
R
>
res
=
sum
;
EXPECT_EQ
(
0.1234
f
,
res
[
0
]);
EXPECT_EQ
(
4321.0
f
,
res
[
1
]);
EXPECT_EQ
(
12.34
f
,
res
[
2
]);
EXPECT_EQ
(
10.0
f
,
res
[
3
]);
return
*
this
;
}
TheTest
&
test_loadstore_fp16
()
{
#if CV_FP16 && CV_SIMD128
...
...
@@ -986,6 +1003,7 @@ TEST(hal_intrin, float32x4) {
.
test_float_cvt64
()
.
test_matmul
()
.
test_transpose
()
.
test_reduce_sum4
()
;
}
...
...
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