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
5ee398bf
Commit
5ee398bf
authored
May 14, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multiple rows per work-item
parent
ab2749d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
12 deletions
+15
-12
convert.cl
modules/core/src/opencl/convert.cl
+11
-8
umatrix.cpp
modules/core/src/umatrix.cpp
+4
-4
No files found.
modules/core/src/opencl/convert.cl
View file @
5ee398bf
...
...
@@ -53,19 +53,22 @@
__kernel
void
convertTo
(
__global
const
uchar
*
srcptr,
int
src_step,
int
src_offset,
__global
uchar
*
dstptr,
int
dst_step,
int
dst_offset,
int
dst_rows,
int
dst_cols,
WT
alpha,
WT
beta
)
WT
alpha,
WT
beta
,
int
rowsPerWI
)
{
int
x
=
get_global_id
(
0
)
;
int
y
=
get_global_id
(
1
)
;
int
y
0
=
get_global_id
(
1
)
*
rowsPerWI
;
if
(
x
<
dst_cols
&&
y
<
dst_rows
)
if
(
x
<
dst_cols
)
{
int
src_index
=
mad24
(
y,
src_step,
mad24
(
x,
(
int
)
sizeof
(
srcT
)
,
src_offset
))
;
int
dst_index
=
mad24
(
y,
dst_step,
mad24
(
x,
(
int
)
sizeof
(
dstT
)
,
dst_offset
))
;
int
src_index
=
mad24
(
y
0
,
src_step,
mad24
(
x,
(
int
)
sizeof
(
srcT
)
,
src_offset
))
;
int
dst_index
=
mad24
(
y
0
,
dst_step,
mad24
(
x,
(
int
)
sizeof
(
dstT
)
,
dst_offset
))
;
__global
const
srcT
*
src
=
(
__global
const
srcT
*
)(
srcptr
+
src_index
)
;
__global
dstT
*
dst
=
(
__global
dstT
*
)(
dstptr
+
dst_index
)
;
for
(
int
y
=
y0,
y1
=
min
(
dst_rows,
y0
+
rowsPerWI
)
; y < y1; ++y, src_index += src_step, dst_index += dst_step)
{
__global
const
srcT
*
src
=
(
__global
const
srcT
*
)(
srcptr
+
src_index
)
;
__global
dstT
*
dst
=
(
__global
dstT
*
)(
dstptr
+
dst_index
)
;
dst[0]
=
convertToDT
(
mad
(
convertToWT
(
src[0]
)
,
alpha,
beta
))
;
dst[0]
=
convertToDT
(
fma
(
convertToWT
(
src[0]
)
,
alpha,
beta
))
;
}
}
}
modules/core/src/umatrix.cpp
View file @
5ee398bf
...
...
@@ -721,7 +721,7 @@ void UMat::convertTo(OutputArray _dst, int _type, double alpha, double beta) con
if
(
dims
<=
2
&&
cn
&&
_dst
.
isUMat
()
&&
ocl
::
useOpenCL
()
&&
((
needDouble
&&
doubleSupport
)
||
!
needDouble
)
)
{
int
wdepth
=
std
::
max
(
CV_32F
,
sdepth
);
int
wdepth
=
std
::
max
(
CV_32F
,
sdepth
)
,
rowsPerWI
=
4
;
char
cvt
[
2
][
40
];
ocl
::
Kernel
k
(
"convertTo"
,
ocl
::
core
::
convert_oclsrc
,
...
...
@@ -741,11 +741,11 @@ void UMat::convertTo(OutputArray _dst, int _type, double alpha, double beta) con
dstarg
=
ocl
::
KernelArg
::
WriteOnly
(
dst
,
cn
);
if
(
wdepth
==
CV_32F
)
k
.
args
(
srcarg
,
dstarg
,
alphaf
,
betaf
);
k
.
args
(
srcarg
,
dstarg
,
alphaf
,
betaf
,
rowsPerWI
);
else
k
.
args
(
srcarg
,
dstarg
,
alpha
,
beta
);
k
.
args
(
srcarg
,
dstarg
,
alpha
,
beta
,
rowsPerWI
);
size_t
globalsize
[
2
]
=
{
dst
.
cols
*
cn
,
dst
.
rows
};
size_t
globalsize
[
2
]
=
{
dst
.
cols
*
cn
,
(
dst
.
rows
+
rowsPerWI
-
1
)
/
rowsPerWI
};
if
(
k
.
run
(
2
,
globalsize
,
NULL
,
false
))
return
;
}
...
...
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