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
e5ea0181
Commit
e5ea0181
authored
May 09, 2013
by
peng xiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let surf.ocl use the new queryDeviceInfo interface.
parent
bfa0f023
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
20 deletions
+16
-20
surf.ocl.cpp
modules/nonfree/src/surf.ocl.cpp
+15
-19
util.hpp
modules/ocl/include/opencv2/ocl/private/util.hpp
+1
-1
No files found.
modules/nonfree/src/surf.ocl.cpp
View file @
e5ea0181
...
...
@@ -59,32 +59,28 @@ namespace cv
const
char
noImage2dOption
[]
=
"-D DISABLE_IMAGE2D"
;
static
char
SURF_OPTIONS
[
1024
]
=
""
;
static
bool
USE_IMAGE2d
=
false
;
static
bool
use_image2d
=
false
;
static
void
openCLExecuteKernelSURF
(
Context
*
clCxt
,
const
char
**
source
,
String
kernelName
,
size_t
globalThreads
[
3
],
size_t
localThreads
[
3
],
std
::
vector
<
std
::
pair
<
size_t
,
const
void
*>
>
&
args
,
int
channels
,
int
depth
)
{
char
*
pSURF_OPTIONS
=
SURF_OPTIONS
;
static
bool
OPTION_INIT
=
false
;
if
(
!
OPTION_INIT
)
char
optBuf
[
100
]
=
{
0
}
;
char
*
optBufPtr
=
optBuf
;
if
(
!
use_image2d
)
{
if
(
!
USE_IMAGE2d
)
{
strcat
(
pSURF_OPTIONS
,
noImage2dOption
);
pSURF_OPTIONS
+=
strlen
(
noImage2dOption
);
}
size_t
wave_size
=
0
;
queryDeviceInfo
(
WAVEFRONT_SIZE
,
&
wave_size
);
std
::
sprintf
(
pSURF_OPTIONS
,
"-D WAVE_SIZE=%d"
,
static_cast
<
int
>
(
wave_size
));
OPTION_INIT
=
true
;
strcat
(
optBufPtr
,
noImage2dOption
);
optBufPtr
+=
strlen
(
noImage2dOption
);
}
openCLExecuteKernel
(
clCxt
,
source
,
kernelName
,
globalThreads
,
localThreads
,
args
,
channels
,
depth
,
SURF_OPTIONS
);
cl_kernel
kernel
;
kernel
=
openCLGetKernelFromSource
(
clCxt
,
source
,
kernelName
,
optBufPtr
);
size_t
wave_size
=
queryDeviceInfo
<
WAVEFRONT_SIZE
,
size_t
>
(
kernel
);
CV_Assert
(
clReleaseKernel
(
kernel
)
==
CL_SUCCESS
);
sprintf
(
optBufPtr
,
"-D WAVE_SIZE=%d"
,
static_cast
<
int
>
(
wave_size
));
openCLExecuteKernel
(
clCxt
,
source
,
kernelName
,
globalThreads
,
localThreads
,
args
,
channels
,
depth
,
optBufPtr
);
}
}
}
static
inline
size_t
divUp
(
size_t
total
,
size_t
grain
)
{
return
(
total
+
grain
-
1
)
/
grain
;
...
...
@@ -166,11 +162,11 @@ public:
{
bindImgTex
(
img
,
imgTex
);
bindImgTex
(
surf_
.
sum
,
sumTex
);
USE_IMAGE
2d
=
true
;
use_image
2d
=
true
;
}
catch
(
const
cv
::
Exception
&
e
)
{
USE_IMAGE
2d
=
false
;
use_image
2d
=
false
;
if
(
e
.
code
!=
CL_IMAGE_FORMAT_NOT_SUPPORTED
&&
e
.
code
!=
-
217
)
{
throw
e
;
...
...
modules/ocl/include/opencv2/ocl/private/util.hpp
View file @
e5ea0181
...
...
@@ -128,7 +128,7 @@ namespace cv
enum
DEVICE_INFO
{
WAVEFRONT_SIZE
,
IS_CPU_DEVICE
//supports
IS_CPU_DEVICE
};
template
<
DEVICE_INFO
_it
,
typename
_ty
>
_ty
queryDeviceInfo
(
cl_kernel
kernel
=
NULL
);
...
...
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