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
132416eb
Commit
132416eb
authored
Jul 21, 2015
by
Yan Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
It is unnecessary to use fma() if no scaling.
Signed-off-by:
Yan Wang
<
yan.wang@linux.intel.com
>
parent
dac071ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
convert.cl
modules/core/src/opencl/convert.cl
+8
-1
umatrix.cpp
modules/core/src/umatrix.cpp
+4
-2
No files found.
modules/core/src/opencl/convert.cl
View file @
132416eb
...
...
@@ -53,7 +53,10 @@
__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,
int
rowsPerWI
)
#
ifndef
NO_SCALE
WT
alpha,
WT
beta,
#
endif
int
rowsPerWI
)
{
int
x
=
get_global_id
(
0
)
;
int
y0
=
get_global_id
(
1
)
*
rowsPerWI
;
...
...
@@ -68,7 +71,11 @@ __kernel void convertTo(__global const uchar * srcptr, int src_step, int src_off
__global
const
srcT
*
src
=
(
__global
const
srcT
*
)(
srcptr
+
src_index
)
;
__global
dstT
*
dst
=
(
__global
dstT
*
)(
dstptr
+
dst_index
)
;
#
ifdef
NO_SCALE
dst[0]
=
convertToDT
(
src[0]
)
;
#
else
dst[0]
=
convertToDT
(
fma
(
convertToWT
(
src[0]
)
,
alpha,
beta
))
;
#
endif
}
}
}
modules/core/src/umatrix.cpp
View file @
132416eb
...
...
@@ -746,7 +746,7 @@ void UMat::convertTo(OutputArray _dst, int _type, double alpha, double beta) con
ocl
::
typeToStr
(
sdepth
),
ocl
::
typeToStr
(
wdepth
),
ocl
::
typeToStr
(
ddepth
),
ocl
::
convertTypeStr
(
sdepth
,
wdepth
,
1
,
cvt
[
0
]),
ocl
::
convertTypeStr
(
wdepth
,
ddepth
,
1
,
cvt
[
1
]),
doubleSupport
?
" -D DOUBLE_SUPPORT"
:
""
));
doubleSupport
?
" -D DOUBLE_SUPPORT"
:
""
,
noScale
?
" -D NO_SCALE"
:
""
));
if
(
!
k
.
empty
())
{
UMat
src
=
*
this
;
...
...
@@ -757,7 +757,9 @@ void UMat::convertTo(OutputArray _dst, int _type, double alpha, double beta) con
ocl
::
KernelArg
srcarg
=
ocl
::
KernelArg
::
ReadOnlyNoSize
(
src
),
dstarg
=
ocl
::
KernelArg
::
WriteOnly
(
dst
,
cn
);
if
(
wdepth
==
CV_32F
)
if
(
noScale
)
k
.
args
(
srcarg
,
dstarg
,
rowsPerWI
);
else
if
(
wdepth
==
CV_32F
)
k
.
args
(
srcarg
,
dstarg
,
alphaf
,
betaf
,
rowsPerWI
);
else
k
.
args
(
srcarg
,
dstarg
,
alpha
,
beta
,
rowsPerWI
);
...
...
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