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
e9bc7374
Commit
e9bc7374
authored
Apr 09, 2014
by
Andrey Pavlenko
Committed by
OpenCV Buildbot
Apr 09, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2584 from akarsakov:ipp_threshold
parents
e6d6a3a8
35494f81
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
4 deletions
+65
-4
thresh.cpp
modules/imgproc/src/thresh.cpp
+65
-4
No files found.
modules/imgproc/src/thresh.cpp
View file @
e9bc7374
...
...
@@ -53,11 +53,14 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
uchar
tab
[
256
];
Size
roi
=
_src
.
size
();
roi
.
width
*=
_src
.
channels
();
size_t
src_step
=
_src
.
step
;
size_t
dst_step
=
_dst
.
step
;
if
(
_src
.
isContinuous
()
&&
_dst
.
isContinuous
()
)
{
roi
.
width
*=
roi
.
height
;
roi
.
height
=
1
;
src_step
=
dst_step
=
roi
.
width
;
}
#ifdef HAVE_TEGRA_OPTIMIZATION
...
...
@@ -65,6 +68,25 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
return
;
#endif
#ifdef HAVE_IPP
IppiSize
sz
=
{
roi
.
width
,
roi
.
height
};
switch
(
type
)
{
case
THRESH_TRUNC
:
if
(
0
<=
ippiThreshold_GT_8u_C1R
(
_src
.
data
,
(
int
)
src_step
,
_dst
.
data
,
(
int
)
dst_step
,
sz
,
thresh
))
return
;
break
;
case
THRESH_TOZERO
:
if
(
0
<=
ippiThreshold_LTVal_8u_C1R
(
_src
.
data
,
(
int
)
src_step
,
_dst
.
data
,
(
int
)
dst_step
,
sz
,
thresh
+
1
,
0
))
return
;
break
;
case
THRESH_TOZERO_INV
:
if
(
0
<=
ippiThreshold_GTVal_8u_C1R
(
_src
.
data
,
(
int
)
src_step
,
_dst
.
data
,
(
int
)
dst_step
,
sz
,
thresh
,
0
))
return
;
break
;
}
#endif
switch
(
type
)
{
case
THRESH_BINARY
:
...
...
@@ -112,8 +134,8 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
for
(
i
=
0
;
i
<
roi
.
height
;
i
++
)
{
const
uchar
*
src
=
(
const
uchar
*
)(
_src
.
data
+
_src
.
step
*
i
);
uchar
*
dst
=
(
uchar
*
)(
_dst
.
data
+
_dst
.
step
*
i
);
const
uchar
*
src
=
(
const
uchar
*
)(
_src
.
data
+
src_
step
*
i
);
uchar
*
dst
=
(
uchar
*
)(
_dst
.
data
+
dst_
step
*
i
);
switch
(
type
)
{
...
...
@@ -231,8 +253,8 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
{
for
(
i
=
0
;
i
<
roi
.
height
;
i
++
)
{
const
uchar
*
src
=
(
const
uchar
*
)(
_src
.
data
+
_src
.
step
*
i
);
uchar
*
dst
=
(
uchar
*
)(
_dst
.
data
+
_dst
.
step
*
i
);
const
uchar
*
src
=
(
const
uchar
*
)(
_src
.
data
+
src_
step
*
i
);
uchar
*
dst
=
(
uchar
*
)(
_dst
.
data
+
dst_
step
*
i
);
j
=
j_scalar
;
#if CV_ENABLE_UNROLLED
for
(
;
j
<=
roi
.
width
-
4
;
j
+=
4
)
...
...
@@ -276,6 +298,7 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type )
{
roi
.
width
*=
roi
.
height
;
roi
.
height
=
1
;
src_step
=
dst_step
=
roi
.
width
;
}
#ifdef HAVE_TEGRA_OPTIMIZATION
...
...
@@ -283,6 +306,25 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type )
return
;
#endif
#ifdef HAVE_IPP
IppiSize
sz
=
{
roi
.
width
,
roi
.
height
};
switch
(
type
)
{
case
THRESH_TRUNC
:
if
(
0
<=
ippiThreshold_GT_16s_C1R
(
src
,
(
int
)
src_step
*
sizeof
(
src
[
0
]),
dst
,
(
int
)
dst_step
*
sizeof
(
dst
[
0
]),
sz
,
thresh
))
return
;
break
;
case
THRESH_TOZERO
:
if
(
0
<=
ippiThreshold_LTVal_16s_C1R
(
src
,
(
int
)
src_step
*
sizeof
(
src
[
0
]),
dst
,
(
int
)
dst_step
*
sizeof
(
dst
[
0
]),
sz
,
thresh
+
1
,
0
))
return
;
break
;
case
THRESH_TOZERO_INV
:
if
(
0
<=
ippiThreshold_GTVal_16s_C1R
(
src
,
(
int
)
src_step
*
sizeof
(
src
[
0
]),
dst
,
(
int
)
dst_step
*
sizeof
(
dst
[
0
]),
sz
,
thresh
,
0
))
return
;
break
;
}
#endif
switch
(
type
)
{
case
THRESH_BINARY
:
...
...
@@ -455,6 +497,25 @@ thresh_32f( const Mat& _src, Mat& _dst, float thresh, float maxval, int type )
return
;
#endif
#ifdef HAVE_IPP
IppiSize
sz
=
{
roi
.
width
,
roi
.
height
};
switch
(
type
)
{
case
THRESH_TRUNC
:
if
(
0
<=
ippiThreshold_GT_32f_C1R
(
src
,
(
int
)
src_step
*
sizeof
(
src
[
0
]),
dst
,
(
int
)
dst_step
*
sizeof
(
dst
[
0
]),
sz
,
thresh
))
return
;
break
;
case
THRESH_TOZERO
:
if
(
0
<=
ippiThreshold_LTVal_32f_C1R
(
src
,
(
int
)
src_step
*
sizeof
(
src
[
0
]),
dst
,
(
int
)
dst_step
*
sizeof
(
dst
[
0
]),
sz
,
thresh
+
FLT_EPSILON
,
0
))
return
;
break
;
case
THRESH_TOZERO_INV
:
if
(
0
<=
ippiThreshold_GTVal_32f_C1R
(
src
,
(
int
)
src_step
*
sizeof
(
src
[
0
]),
dst
,
(
int
)
dst_step
*
sizeof
(
dst
[
0
]),
sz
,
thresh
,
0
))
return
;
break
;
}
#endif
switch
(
type
)
{
case
THRESH_BINARY
:
...
...
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