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
885cef76
Commit
885cef76
authored
Feb 07, 2011
by
Ethan Rublee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fix to pop count based hamming distance. Being consistent with type.
parent
7b1c2655
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
brief.cpp
modules/features2d/src/brief.cpp
+3
-3
No files found.
modules/features2d/src/brief.cpp
View file @
885cef76
...
...
@@ -146,15 +146,15 @@ Hamming::ResultType Hamming::operator()(const unsigned char* a, const unsigned c
const
size_t
end
=
size
-
modulo
;
for
(
i
=
0
;
i
<
end
;
i
+=
sizeof
(
pop_t
))
{
size
_t
a2
=
*
reinterpret_cast
<
const
pop_t
*>
(
a
+
i
);
size
_t
b2
=
*
reinterpret_cast
<
const
pop_t
*>
(
b
+
i
);
pop
_t
a2
=
*
reinterpret_cast
<
const
pop_t
*>
(
a
+
i
);
pop
_t
b2
=
*
reinterpret_cast
<
const
pop_t
*>
(
b
+
i
);
result
+=
__builtin_popcountl
(
a2
^
b2
);
}
if
(
modulo
)
{
//in the case where size is not divisible by sizeof(size_t)
//need to mask of the bits at the end
size
_t
a2
=
0
,
b2
=
0
;
pop
_t
a2
=
0
,
b2
=
0
;
memcpy
(
&
a2
,
a
+
end
,
modulo
);
memcpy
(
&
b2
,
b
+
end
,
modulo
);
//std::cout << std::hex << (a2^b2) << std::endl;
...
...
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