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
3e586f42
Commit
3e586f42
authored
Nov 30, 2013
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added cv::pow to T-API
parent
997ec608
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
mathfuncs.cpp
modules/core/src/mathfuncs.cpp
+31
-0
arithm.cl
modules/core/src/opencl/arithm.cl
+4
-1
No files found.
modules/core/src/mathfuncs.cpp
View file @
3e586f42
...
...
@@ -1955,9 +1955,40 @@ static IPowFunc ipowTab[] =
(
IPowFunc
)
iPow32s
,
(
IPowFunc
)
iPow32f
,
(
IPowFunc
)
iPow64f
,
0
};
static
bool
ocl_pow
(
InputArray
_src
,
double
power
,
OutputArray
_dst
)
{
int
type
=
_src
.
type
(),
depth
=
CV_MAT_DEPTH
(
type
),
cn
=
CV_MAT_CN
(
type
);
bool
doubleSupport
=
ocl
::
Device
::
getDefault
().
doubleFPConfig
()
>
0
;
if
(
!
(
_src
.
dims
()
<=
2
&&
(
depth
==
CV_32F
||
depth
==
CV_64F
))
||
(
depth
==
CV_64F
&&
!
doubleSupport
)
)
return
false
;
UMat
src
=
_src
.
getUMat
();
_dst
.
create
(
src
.
size
(),
type
);
UMat
dst
=
_dst
.
getUMat
();
ocl
::
Kernel
k
(
"KF"
,
ocl
::
core
::
arithm_oclsrc
,
format
(
"-D dstT=%s -D OP_POW -D UNARY_OP%s"
,
ocl
::
typeToStr
(
CV_MAKE_TYPE
(
depth
,
1
)),
doubleSupport
?
"-D DOUBLE_SUPPORT"
:
""
));
ocl
::
KernelArg
srcarg
=
ocl
::
KernelArg
::
ReadOnlyNoSize
(
src
),
dstarg
=
ocl
::
KernelArg
::
WriteOnly
(
dst
,
cn
);
if
(
depth
==
CV_32F
)
k
.
args
(
srcarg
,
dstarg
,
(
float
)
power
);
else
k
.
args
(
srcarg
,
dstarg
,
power
);
size_t
globalsize
[
2
]
=
{
dst
.
cols
*
cn
,
dst
.
rows
};
return
k
.
run
(
2
,
globalsize
,
NULL
,
false
);
}
void
pow
(
InputArray
_src
,
double
power
,
OutputArray
_dst
)
{
if
(
ocl
::
useOpenCL
()
&&
_dst
.
isUMat
()
&&
ocl_pow
(
_src
,
power
,
_dst
))
return
;
Mat
src
=
_src
.
getMat
();
int
type
=
src
.
type
(),
depth
=
src
.
depth
(),
cn
=
src
.
channels
();
...
...
modules/core/src/opencl/arithm.cl
View file @
3e586f42
...
...
@@ -171,6 +171,9 @@
#elif defined OP_EXP
#define PROCESS_ELEM dstelem = exp(srcelem1)
#elif defined OP_POW
#define PROCESS_ELEM dstelem = pow(srcelem1, srcelem2)
#elif defined OP_SQRT
#define PROCESS_ELEM dstelem = sqrt(srcelem1)
...
...
@@ -198,7 +201,7 @@ dstelem = v > (dstT)(0) ? log(v) : log(-v)
#undef srcelem2
#if defined OP_AND || defined OP_OR || defined OP_XOR || defined OP_ADD || defined OP_SAT_ADD || \
defined OP_SUB || defined OP_SAT_SUB || defined OP_RSUB || defined OP_SAT_RSUB || \
defined OP_ABSDIFF || defined OP_CMP || defined OP_MIN || defined OP_MAX
defined OP_ABSDIFF || defined OP_CMP || defined OP_MIN || defined OP_MAX
|| defined OP_POW
#undef EXTRA_PARAMS
#define EXTRA_PARAMS , workT srcelem2
#endif
...
...
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