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
1eca49f4
Commit
1eca49f4
authored
May 03, 2013
by
peng xiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ocl: Enable backward binary portability for setTo function.
parent
355bc691
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
19 deletions
+11
-19
matrix_operations.cpp
modules/ocl/src/matrix_operations.cpp
+7
-11
mcwutil.cpp
modules/ocl/src/mcwutil.cpp
+4
-8
No files found.
modules/ocl/src/matrix_operations.cpp
View file @
1eca49f4
...
...
@@ -593,11 +593,16 @@ static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, stri
CV_Error
(
CV_StsUnsupportedFormat
,
"unknown depth"
);
}
#ifdef CL_VERSION_1_2
if
(
dst
.
offset
==
0
&&
dst
.
cols
==
dst
.
wholecols
)
//this enables backwards portability to
//run on OpenCL 1.1 platform if library binaries are compiled with OpenCL 1.2 support
if
(
Context
::
getContext
()
->
supportsFeature
(
Context
::
CL_VER_1_2
)
&&
dst
.
offset
==
0
&&
dst
.
cols
==
dst
.
wholecols
)
{
clEnqueueFillBuffer
((
cl_command_queue
)
dst
.
clCxt
->
oclCommandQueue
(),
(
cl_mem
)
dst
.
data
,
args
[
0
].
second
,
args
[
0
].
first
,
0
,
dst
.
step
*
dst
.
rows
,
0
,
NULL
,
NULL
);
clEnqueueFillBuffer
((
cl_command_queue
)
dst
.
clCxt
->
oclCommandQueue
(),
(
cl_mem
)
dst
.
data
,
args
[
0
].
second
,
args
[
0
].
first
,
0
,
dst
.
step
*
dst
.
rows
,
0
,
NULL
,
NULL
);
}
else
#endif
{
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
)
,
(
void
*
)
&
dst
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_int
)
,
(
void
*
)
&
dst
.
cols
));
...
...
@@ -607,15 +612,6 @@ static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, stri
openCLExecuteKernel
(
dst
.
clCxt
,
&
operator_setTo
,
kernelName
,
globalThreads
,
localThreads
,
args
,
-
1
,
-
1
,
compile_option
);
}
#else
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
)
,
(
void
*
)
&
dst
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_int
)
,
(
void
*
)
&
dst
.
cols
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_int
)
,
(
void
*
)
&
dst
.
rows
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_int
)
,
(
void
*
)
&
step_in_pixel
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_int
)
,
(
void
*
)
&
offset_in_pixel
));
openCLExecuteKernel
(
dst
.
clCxt
,
&
operator_setTo
,
kernelName
,
globalThreads
,
localThreads
,
args
,
-
1
,
-
1
,
compile_option
);
#endif
}
static
void
set_to_withmask_run
(
const
oclMat
&
dst
,
const
Scalar
&
scalar
,
const
oclMat
&
mask
,
string
kernelName
)
...
...
modules/ocl/src/mcwutil.cpp
View file @
1eca49f4
...
...
@@ -45,10 +45,6 @@
#include "precomp.hpp"
#ifndef CL_VERSION_1_2
#define CL_VERSION_1_2 0
#endif
using
namespace
std
;
namespace
cv
...
...
@@ -162,9 +158,11 @@ namespace cv
CV_Error
(
-
1
,
"Image forma is not supported"
);
break
;
}
#ifdef CL_VERSION_1_2
//this enables backwards portability to
//run on OpenCL 1.1 platform if library binaries are compiled with OpenCL 1.2 support
if
(
Context
::
getContext
()
->
supportsFeature
(
Context
::
CL_VER_1_2
))
{
#if CL_VERSION_1_2
cl_image_desc
desc
;
desc
.
image_type
=
CL_MEM_OBJECT_IMAGE2D
;
desc
.
image_width
=
mat
.
cols
;
...
...
@@ -177,11 +175,9 @@ namespace cv
desc
.
num_mip_levels
=
0
;
desc
.
num_samples
=
0
;
texture
=
clCreateImage
((
cl_context
)
mat
.
clCxt
->
oclContext
(),
CL_MEM_READ_WRITE
,
&
format
,
&
desc
,
NULL
,
&
err
);
#else
CV_Error
(
CV_StsBadFunc
,
"Non-deprecated image creation API call is not supported."
);
#endif
}
else
#endif
{
texture
=
clCreateImage2D
(
(
cl_context
)
mat
.
clCxt
->
oclContext
(),
...
...
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