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
8e93c19d
Commit
8e93c19d
authored
Dec 26, 2013
by
Pierre-Emmanuel Viel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a heap issue with static on Windows
parent
e85bacff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
lsh_table.h
modules/flann/include/opencv2/flann/lsh_table.h
+13
-7
No files found.
modules/flann/include/opencv2/flann/lsh_table.h
View file @
8e93c19d
...
@@ -348,21 +348,27 @@ inline LshTable<unsigned char>::LshTable(unsigned int feature_size, unsigned int
...
@@ -348,21 +348,27 @@ inline LshTable<unsigned char>::LshTable(unsigned int feature_size, unsigned int
mask_
=
std
::
vector
<
size_t
>
((
size_t
)
ceil
((
float
)(
feature_size
*
sizeof
(
char
))
/
(
float
)
sizeof
(
size_t
)),
0
);
mask_
=
std
::
vector
<
size_t
>
((
size_t
)
ceil
((
float
)(
feature_size
*
sizeof
(
char
))
/
(
float
)
sizeof
(
size_t
)),
0
);
// A bit brutal but fast to code
// A bit brutal but fast to code
static
std
::
vector
<
size_t
>
indices
(
feature_size
*
CHAR_BIT
)
;
static
std
::
vector
<
size_t
>
*
indices
=
NULL
;
//Ensure the Nth bit will be selected only once among the different LshTables
//Ensure the Nth bit will be selected only once among the different LshTables
//to avoid having two different tables with signatures sharing many dimensions/many bits
//to avoid having two different tables with signatures sharing many dimensions/many bits
if
(
(
indices
.
size
()
==
feature_size
*
CHAR_BIT
)
||
(
indices
.
size
()
<
key_size_
)
)
if
(
indices
==
NULL
)
{
{
indices
.
resize
(
feature_size
*
CHAR_BIT
);
indices
=
new
std
::
vector
<
size_t
>
(
feature_size
*
CHAR_BIT
);
for
(
size_t
i
=
0
;
i
<
feature_size
*
CHAR_BIT
;
++
i
)
indices
[
i
]
=
i
;
}
std
::
random_shuffle
(
indices
.
begin
(),
indices
.
end
());
else
if
(
indices
->
size
()
<
key_size_
)
{
indices
->
resize
(
feature_size
*
CHAR_BIT
);
for
(
size_t
i
=
0
;
i
<
feature_size
*
CHAR_BIT
;
++
i
)
{
(
*
indices
)[
i
]
=
i
;
}
std
::
random_shuffle
(
indices
->
begin
(),
indices
->
end
());
}
}
// Generate a random set of order of subsignature_size_ bits
// Generate a random set of order of subsignature_size_ bits
for
(
unsigned
int
i
=
0
;
i
<
key_size_
;
++
i
)
{
for
(
unsigned
int
i
=
0
;
i
<
key_size_
;
++
i
)
{
size_t
index
=
indices
[
0
];
size_t
index
=
(
*
indices
)
[
0
];
indices
.
erase
(
indices
.
begin
()
);
indices
->
erase
(
indices
->
begin
()
);
// Set that bit in the mask
// Set that bit in the mask
size_t
divisor
=
CHAR_BIT
*
sizeof
(
size_t
);
size_t
divisor
=
CHAR_BIT
*
sizeof
(
size_t
);
...
...
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