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
b72b256f
Commit
b72b256f
authored
Apr 05, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cv::pow (added ippiSqr_32f_C1R for power=2)
parent
b56b9c43
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
23 deletions
+39
-23
mathfuncs.cpp
modules/core/src/mathfuncs.cpp
+39
-23
No files found.
modules/core/src/mathfuncs.cpp
View file @
b72b256f
...
...
@@ -240,7 +240,7 @@ static void Magnitude_32f(const float* x, const float* y, float* mag, int len)
{
#ifdef HAVE_IPP
IppStatus
status
=
ippsMagnitude_32f
(
x
,
y
,
mag
,
len
);
if
(
status
==
ippStsNoErr
)
if
(
status
>=
0
)
return
;
#endif
...
...
@@ -272,7 +272,7 @@ static void Magnitude_64f(const double* x, const double* y, double* mag, int len
{
#ifdef HAVE_IPP
IppStatus
status
=
ippsMagnitude_64f
(
x
,
y
,
mag
,
len
);
if
(
status
==
ippStsNoErr
)
if
(
status
>=
0
)
return
;
#endif
...
...
@@ -303,6 +303,11 @@ static void Magnitude_64f(const double* x, const double* y, double* mag, int len
static
void
InvSqrt_32f
(
const
float
*
src
,
float
*
dst
,
int
len
)
{
#ifdef HAVE_IPP
if
(
ippsInvSqrt_32f_A21
(
src
,
dst
,
len
)
>=
0
)
return
;
#endif
int
i
=
0
;
#if CV_SSE
...
...
@@ -346,6 +351,10 @@ static void InvSqrt_64f(const double* src, double* dst, int len)
static
void
Sqrt_32f
(
const
float
*
src
,
float
*
dst
,
int
len
)
{
#ifdef HAVE_IPP
if
(
ippsSqrt_32f_A21
(
src
,
dst
,
len
)
>=
0
)
return
;
#endif
int
i
=
0
;
#if CV_SSE
...
...
@@ -375,6 +384,11 @@ static void Sqrt_32f(const float* src, float* dst, int len)
static
void
Sqrt_64f
(
const
double
*
src
,
double
*
dst
,
int
len
)
{
#ifdef HAVE_IPP
if
(
ippsSqrt_64f_A50
(
src
,
dst
,
len
)
>=
0
)
return
;
#endif
int
i
=
0
;
#if CV_SSE2
...
...
@@ -2147,6 +2161,29 @@ void pow( InputArray _src, double power, OutputArray _dst )
_src
.
copyTo
(
_dst
);
return
;
case
2
:
#ifdef HAVE_IPP
if
(
depth
==
CV_32F
&&
!
same
&&
(
(
_src
.
dims
()
<=
2
&&
!
ocl
::
useOpenCL
())
||
(
_src
.
dims
()
>
2
&&
_src
.
isContinuous
()
&&
_dst
.
isContinuous
())
))
{
Mat
src
=
_src
.
getMat
();
_dst
.
create
(
src
.
dims
,
src
.
size
,
type
);
Mat
dst
=
_dst
.
getMat
();
Size
size
=
src
.
size
();
int
srcstep
=
(
int
)
src
.
step
,
dststep
=
(
int
)
dst
.
step
,
esz
=
CV_ELEM_SIZE
(
type
);
if
(
src
.
isContinuous
()
&&
dst
.
isContinuous
())
{
size
.
width
=
(
int
)
src
.
total
();
size
.
height
=
1
;
srcstep
=
dststep
=
(
int
)
src
.
total
()
*
esz
;
}
size
.
width
*=
cn
;
IppStatus
status
=
ippiSqr_32f_C1R
((
const
Ipp32f
*
)
src
.
data
,
srcstep
,
(
Ipp32f
*
)
dst
.
data
,
dststep
,
ippiSize
(
size
.
width
,
size
.
height
));
if
(
status
>=
0
)
return
;
}
#endif
if
(
same
)
multiply
(
_dst
,
_dst
,
_dst
);
else
...
...
@@ -2187,27 +2224,6 @@ void pow( InputArray _src, double power, OutputArray _dst )
}
else
if
(
fabs
(
fabs
(
power
)
-
0.5
)
<
DBL_EPSILON
)
{
#ifdef HAVE_IPP
if
(
power
>
0
&&
(
src
.
dims
<=
2
||
(
src
.
isContinuous
()
&&
dst
.
isContinuous
())))
// power is 0.5
{
Size
size
=
src
.
size
();
int
srcstep
=
(
int
)
src
.
step
,
dststep
=
(
int
)
dst
.
step
,
esz
=
src
.
elemSize
();
if
(
src
.
isContinuous
()
&&
dst
.
isContinuous
())
{
srcstep
=
dststep
=
(
int
)
src
.
total
()
*
esz
;
size
.
width
=
(
int
)
src
.
total
();
size
.
height
=
1
;
}
size
.
width
*=
cn
;
IppStatus
status
=
ippiSqrt_32f_C1R
((
const
Ipp32f
*
)
src
.
data
,
srcstep
,
(
Ipp32f
*
)
dst
.
data
,
dststep
,
ippiSize
(
size
.
width
,
size
.
height
));
if
(
status
==
ippStsNoErr
)
return
;
}
#endif
MathFunc
func
=
power
<
0
?
(
depth
==
CV_32F
?
(
MathFunc
)
InvSqrt_32f
:
(
MathFunc
)
InvSqrt_64f
)
:
(
depth
==
CV_32F
?
(
MathFunc
)
Sqrt_32f
:
(
MathFunc
)
Sqrt_64f
);
...
...
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