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
ea645891
Commit
ea645891
authored
Oct 29, 2013
by
Andrey Pavlenko
Committed by
OpenCV Buildbot
Oct 29, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1687 from bitwangyaoyao:2.4_fix
parents
f4b8babb
632452cd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
10 deletions
+37
-10
perf_brute_force_matcher.cpp
modules/ocl/perf/perf_brute_force_matcher.cpp
+7
-7
brute_force_match.cl
modules/ocl/src/opencl/brute_force_match.cl
+30
-3
No files found.
modules/ocl/perf/perf_brute_force_matcher.cpp
View file @
ea645891
...
...
@@ -53,8 +53,8 @@ using namespace perf;
typedef
TestBaseWithParam
<
Size
>
BruteForceMatcherFixture
;
PERF_TEST_P
(
BruteForceMatcherFixture
,
DISABLED_
match
,
OCL_BFMATCHER_TYPICAL_MAT_SIZES
)
// TODO too big difference between implementations
PERF_TEST_P
(
BruteForceMatcherFixture
,
match
,
OCL_BFMATCHER_TYPICAL_MAT_SIZES
)
{
const
Size
srcSize
=
GetParam
();
...
...
@@ -82,14 +82,14 @@ PERF_TEST_P(BruteForceMatcherFixture, DISABLED_match,
oclMatcher
.
matchDownload
(
oclTrainIdx
,
oclDistance
,
matches
);
SANITY_CHECK_MATCHES
(
matches
);
SANITY_CHECK_MATCHES
(
matches
,
1e-5
);
}
else
OCL_PERF_ELSE
}
PERF_TEST_P
(
BruteForceMatcherFixture
,
DISABLED_
knnMatch
,
OCL_BFMATCHER_TYPICAL_MAT_SIZES
)
// TODO too big difference between implementations
PERF_TEST_P
(
BruteForceMatcherFixture
,
knnMatch
,
OCL_BFMATCHER_TYPICAL_MAT_SIZES
)
{
const
Size
srcSize
=
GetParam
();
...
...
@@ -123,8 +123,8 @@ PERF_TEST_P(BruteForceMatcherFixture, DISABLED_knnMatch,
oclMatcher
.
knnMatchDownload
(
oclTrainIdx
,
oclDistance
,
matches
);
std
::
vector
<
DMatch
>
&
matches0
=
matches
[
0
],
&
matches1
=
matches
[
1
];
SANITY_CHECK_MATCHES
(
matches0
);
SANITY_CHECK_MATCHES
(
matches1
);
SANITY_CHECK_MATCHES
(
matches0
,
1e-5
);
SANITY_CHECK_MATCHES
(
matches1
,
1e-5
);
}
else
OCL_PERF_ELSE
...
...
modules/ocl/src/opencl/brute_force_match.cl
View file @
ea645891
...
...
@@ -17,6 +17,7 @@
//
@Authors
//
Nathan,
liujun@multicorewareinc.com
//
Peng
Xiao,
pengxiao@outlook.com
//
Baichuan
Su,
baichuan@multicorewareinc.com
//
//
Redistribution
and
use
in
source
and
binary
forms,
with
or
without
modification,
//
are
permitted
provided
that
the
following
conditions
are
met:
...
...
@@ -112,6 +113,24 @@ result_type reduce_block(
return
DIST_RES
(
result
)
;
}
result_type
reduce_block_match
(
__local
value_type
*s_query,
__local
value_type
*s_train,
int
lidx,
int
lidy
)
{
result_type
result
=
0
;
#
pragma
unroll
for
(
int
j
=
0
; j < BLOCK_SIZE ; j++)
{
result
+=
DIST
(
s_query[lidy
*
BLOCK_SIZE
+
j],
s_train[j
*
BLOCK_SIZE
+
lidx]
)
;
}
return
(
result
)
;
}
result_type
reduce_multi_block
(
__local
value_type
*s_query,
__local
value_type
*s_train,
...
...
@@ -128,7 +147,7 @@ result_type reduce_multi_block(
s_query[lidy
*
MAX_DESC_LEN
+
block_index
*
BLOCK_SIZE
+
j],
s_train[j
*
BLOCK_SIZE
+
lidx]
)
;
}
return
DIST_RES
(
result
)
;
return
result
;
}
/*
2dim
launch,
global
size:
dim0
is
(
query
rows
+
BLOCK_SIZE
-
1
)
/
BLOCK_SIZE
*
BLOCK_SIZE,
dim1
is
BLOCK_SIZE
...
...
@@ -187,6 +206,8 @@ __kernel void BruteForceMatch_UnrollMatch(
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
}
result
=
DIST_RES
(
result
)
;
int
trainIdx
=
t
*
BLOCK_SIZE
+
lidx
;
if
(
queryIdx
<
query_rows
&&
trainIdx
<
train_rows
&&
result
<
myBestDistance/*
&&
mask
(
queryIdx,
trainIdx
)
*/
)
...
...
@@ -272,11 +293,13 @@ __kernel void BruteForceMatch_Match(
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
result
+=
reduce_block
(
s_query,
s_train,
lidx,
lidy
)
;
result
+=
reduce_block
_match
(
s_query,
s_train,
lidx,
lidy
)
;
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
}
result
=
DIST_RES
(
result
)
;
const
int
trainIdx
=
t
*
BLOCK_SIZE
+
lidx
;
if
(
queryIdx
<
query_rows
&&
trainIdx
<
train_rows
&&
result
<
myBestDistance
/*&&
mask
(
queryIdx,
trainIdx
)
*/
)
...
...
@@ -493,6 +516,8 @@ __kernel void BruteForceMatch_knnUnrollMatch(
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
}
result
=
DIST_RES
(
result
)
;
const
int
trainIdx
=
t
*
BLOCK_SIZE
+
lidx
;
if
(
queryIdx
<
query_rows
&&
trainIdx
<
train_rows
)
...
...
@@ -631,11 +656,13 @@ __kernel void BruteForceMatch_knnMatch(
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
result
+=
reduce_block
(
s_query,
s_train,
lidx,
lidy
)
;
result
+=
reduce_block
_match
(
s_query,
s_train,
lidx,
lidy
)
;
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
}
result
=
DIST_RES
(
result
)
;
const
int
trainIdx
=
t
*
BLOCK_SIZE
+
lidx
;
if
(
queryIdx
<
query_rows
&&
trainIdx
<
train_rows
/*&&
mask
(
queryIdx,
trainIdx
)
*/
)
...
...
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