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
74defefd
Commit
74defefd
authored
Jan 26, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8076 from tomoaki0705:brushupAvxPopcount
parents
776c8c5c
820fdbff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
stat.cpp
modules/core/src/stat.cpp
+18
-8
No files found.
modules/core/src/stat.cpp
View file @
74defefd
...
...
@@ -4261,7 +4261,9 @@ int normHamming(const uchar* a, int n)
_r0
=
_mm256_add_epi32
(
_r0
,
_mm256_shuffle_epi32
(
_r0
,
2
));
result
=
_mm256_extract_epi32_
(
_mm256_add_epi32
(
_r0
,
_mm256_permute2x128_si256
(
_r0
,
_r0
,
1
)),
0
);
}
#elif CV_POPCNT
#endif // CV_AVX2
#if CV_POPCNT
if
(
checkHardwareSupport
(
CV_CPU_POPCNT
))
{
# if defined CV_POPCNT_U64
...
...
@@ -4275,7 +4277,9 @@ int normHamming(const uchar* a, int n)
result
+=
CV_POPCNT_U32
(
*
(
uint
*
)(
a
+
i
));
}
}
#elif CV_SIMD128
#endif // CV_POPCNT
#if CV_SIMD128
if
(
hasSIMD128
())
{
v_uint32x4
t
=
v_setzero_u32
();
...
...
@@ -4283,9 +4287,10 @@ int normHamming(const uchar* a, int n)
{
t
+=
v_popcount
(
v_load
(
a
+
i
));
}
result
=
v_reduce_sum
(
t
);
result
+
=
v_reduce_sum
(
t
);
}
#endif
#endif // CV_SIMD128
for
(;
i
<=
n
-
4
;
i
+=
4
)
{
result
+=
popCountTable
[
a
[
i
]]
+
popCountTable
[
a
[
i
+
1
]]
+
...
...
@@ -4327,7 +4332,9 @@ int normHamming(const uchar* a, const uchar* b, int n)
_r0
=
_mm256_add_epi32
(
_r0
,
_mm256_shuffle_epi32
(
_r0
,
2
));
result
=
_mm256_extract_epi32_
(
_mm256_add_epi32
(
_r0
,
_mm256_permute2x128_si256
(
_r0
,
_r0
,
1
)),
0
);
}
#elif CV_POPCNT
#endif // CV_AVX2
#if CV_POPCNT
if
(
checkHardwareSupport
(
CV_CPU_POPCNT
))
{
# if defined CV_POPCNT_U64
...
...
@@ -4341,7 +4348,9 @@ int normHamming(const uchar* a, const uchar* b, int n)
result
+=
CV_POPCNT_U32
(
*
(
uint
*
)(
a
+
i
)
^
*
(
uint
*
)(
b
+
i
));
}
}
#elif CV_SIMD128
#endif // CV_POPCNT
#if CV_SIMD128
if
(
hasSIMD128
())
{
v_uint32x4
t
=
v_setzero_u32
();
...
...
@@ -4349,9 +4358,10 @@ int normHamming(const uchar* a, const uchar* b, int n)
{
t
+=
v_popcount
(
v_load
(
a
+
i
)
^
v_load
(
b
+
i
));
}
result
=
v_reduce_sum
(
t
);
result
+
=
v_reduce_sum
(
t
);
}
#endif
#endif // CV_SIMD128
for
(;
i
<=
n
-
4
;
i
+=
4
)
{
result
+=
popCountTable
[
a
[
i
]
^
b
[
i
]]
+
popCountTable
[
a
[
i
+
1
]
^
b
[
i
+
1
]]
+
...
...
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