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
d3835962
Commit
d3835962
authored
Sep 19, 2012
by
yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some optimizations to ocl::blend
parent
bbe41842
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
blend.cpp
modules/ocl/src/blend.cpp
+2
-2
blend_linear.cl
modules/ocl/src/kernels/blend_linear.cl
+8
-8
No files found.
modules/ocl/src/blend.cpp
View file @
d3835962
...
...
@@ -72,8 +72,8 @@ void cv::ocl::blendLinear(const oclMat& img1, const oclMat& img2, const oclMat&
int
depth
=
img1
.
depth
();
int
rows
=
img1
.
rows
;
int
cols
=
img1
.
cols
;
int
istep
=
img1
.
step
;
int
wstep
=
weights1
.
step
;
int
istep
=
img1
.
step
1
()
;
int
wstep
=
weights1
.
step
1
()
;
size_t
globalSize
[]
=
{
cols
*
channels
,
rows
,
1
};
size_t
localSize
[]
=
{
16
,
16
,
1
};
...
...
modules/ocl/src/kernels/blend_linear.cl
View file @
d3835962
...
...
@@ -58,8 +58,8 @@ __kernel void BlendLinear_C1_D0(
int
idy
=
get_global_id
(
1
)
;
if
(
idx
<
cols
&&
idy
<
rows
)
{
int
pos
=
idy
*
istep
+
idx
;
int
wpos
=
idy
*
(
wstep
/sizeof
(
float
))
+
idx
;
int
pos
=
mad24
(
idy,istep,idx
)
;
int
wpos
=
mad24
(
idy,wstep,idx
)
;
float
w1
=
weight1[wpos]
;
float
w2
=
weight2[wpos]
;
dst[pos]
=
(
img1[pos]
*
w1
+
img2[pos]
*
w2
)
/
(
w1
+
w2
+
1e-5f
)
;
...
...
@@ -85,8 +85,8 @@ __kernel void BlendLinear_C4_D0(
int
y
=
idy
;
if
(
x
<
cols
&&
y
<
rows
)
{
int
pos
=
idy
*
istep
+
idx
;
int
wpos
=
idy
*
(
wstep
/sizeof
(
float
))
+
x
;
int
pos
=
mad24
(
idy,istep,idx
)
;
int
wpos
=
mad24
(
idy,wstep,x
)
;
float
w1
=
weight1[wpos]
;
float
w2
=
weight2[wpos]
;
dst[pos]
=
(
img1[pos]
*
w1
+
img2[pos]
*
w2
)
/
(
w1
+
w2
+
1e-5f
)
;
...
...
@@ -109,8 +109,8 @@ __kernel void BlendLinear_C1_D5(
int
idy
=
get_global_id
(
1
)
;
if
(
idx
<
cols
&&
idy
<
rows
)
{
int
pos
=
idy
*
(
istep
/
sizeof
(
float
))
+
idx
;
int
wpos
=
idy
*
(
wstep
/sizeof
(
float
))
+
idx
;
int
pos
=
mad24
(
idy,istep,idx
)
;
int
wpos
=
mad24
(
idy,wstep,idx
)
;
float
w1
=
weight1[wpos]
;
float
w2
=
weight2[wpos]
;
dst[pos]
=
(
img1[pos]
*
w1
+
img2[pos]
*
w2
)
/
(
w1
+
w2
+
1e-5f
)
;
...
...
@@ -135,8 +135,8 @@ __kernel void BlendLinear_C4_D5(
int
y
=
idy
;
if
(
x
<
cols
&&
y
<
rows
)
{
int
pos
=
idy
*
(
istep
/
sizeof
(
float
))
+
idx
;
int
wpos
=
idy
*
(
wstep
/sizeof
(
float
))
+
x
;
int
pos
=
mad24
(
idy,istep,idx
)
;
int
wpos
=
mad24
(
idy,wstep,x
)
;
float
w1
=
weight1[wpos]
;
float
w2
=
weight2[wpos]
;
dst[pos]
=
(
img1[pos]
*
w1
+
img2[pos]
*
w2
)
/
(
w1
+
w2
+
1e-5f
)
;
...
...
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