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
1f6b7197
Commit
1f6b7197
authored
Apr 15, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added ippisFlip to cv::sort
parent
26e8c621
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
10 deletions
+54
-10
perf_sort.cpp
modules/core/perf/perf_sort.cpp
+2
-2
matrix.cpp
modules/core/src/matrix.cpp
+52
-8
No files found.
modules/core/perf/perf_sort.cpp
View file @
1f6b7197
...
...
@@ -9,7 +9,7 @@ using std::tr1::make_tuple;
using
std
::
tr1
::
get
;
#define TYPICAL_MAT_SIZES_SORT TYPICAL_MAT_SIZES
#define TYPICAL_MAT_TYPES_SORT CV_8
S
C1, CV_16UC1, CV_32FC1
#define TYPICAL_MAT_TYPES_SORT CV_8
U
C1, CV_16UC1, CV_32FC1
#define SORT_TYPES SORT_EVERY_ROW | SORT_ASCENDING, SORT_EVERY_ROW | SORT_DESCENDING
#define TYPICAL_MATS_SORT testing::Combine( testing::Values(TYPICAL_MAT_SIZES_SORT), testing::Values(TYPICAL_MAT_TYPES_SORT), testing::Values(SORT_TYPES) )
...
...
@@ -48,5 +48,5 @@ PERF_TEST_P(sortIdxFixture, sorIdx, TYPICAL_MATS_SORT)
TEST_CYCLE
()
cv
::
sortIdx
(
a
,
b
,
flags
);
SANITY_CHECK
(
b
);
SANITY_CHECK
_NOTHING
(
);
}
modules/core/src/matrix.cpp
View file @
1f6b7197
...
...
@@ -3468,8 +3468,10 @@ namespace cv
{
#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
#define USE_IPP_SORT
typedef
IppStatus
(
CV_STDCALL
*
IppSortFunc
)(
void
*
,
int
);
typedef
IppSortFunc
IppFlipFunc
;
static
IppSortFunc
getSortFunc
(
int
depth
,
bool
sortDescending
)
{
...
...
@@ -3489,6 +3491,18 @@ static IppSortFunc getSortFunc(int depth, bool sortDescending)
depth
==
CV_64F
?
(
IppSortFunc
)
ippsSortDescend_64f_I
:
0
;
}
static
IppFlipFunc
getFlipFunc
(
int
depth
)
{
CV_SUPPRESS_DEPRECATED_START
return
depth
==
CV_8U
||
depth
==
CV_8S
?
(
IppFlipFunc
)
ippsFlip_8u_I
:
depth
==
CV_16U
||
depth
==
CV_16S
?
(
IppFlipFunc
)
ippsFlip_16u_I
:
depth
==
CV_32S
||
depth
==
CV_32F
?
(
IppFlipFunc
)
ippsFlip_32f_I
:
depth
==
CV_64F
?
(
IppFlipFunc
)
ippsFlip_64f_I
:
0
;
CV_SUPPRESS_DEPRECATED_END
}
#endif
template
<
typename
T
>
static
void
sort_
(
const
Mat
&
src
,
Mat
&
dst
,
int
flags
)
...
...
@@ -3509,8 +3523,10 @@ template<typename T> static void sort_( const Mat& src, Mat& dst, int flags )
}
bptr
=
(
T
*
)
buf
;
#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
IppSortFunc
ippFunc
=
getSortFunc
(
src
.
depth
(),
sortDescending
);
#ifdef USE_IPP_SORT
int
depth
=
src
.
depth
();
IppSortFunc
ippSortFunc
=
getSortFunc
(
depth
,
sortDescending
);
IppFlipFunc
ippFlipFunc
=
getFlipFunc
(
depth
);
#endif
for
(
i
=
0
;
i
<
n
;
i
++
)
...
...
@@ -3532,15 +3548,28 @@ template<typename T> static void sort_( const Mat& src, Mat& dst, int flags )
ptr
[
j
]
=
((
const
T
*
)(
src
.
data
+
src
.
step
*
j
))[
i
];
}
#if
IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
if
(
!
ipp
Func
||
ipp
Func
(
ptr
,
len
)
<
0
)
#if
def USE_IPP_SORT
if
(
!
ipp
SortFunc
||
ippSort
Func
(
ptr
,
len
)
<
0
)
#endif
{
#ifdef USE_IPP_SORT
setIppErrorStatus
();
#endif
std
::
sort
(
ptr
,
ptr
+
len
);
if
(
sortDescending
)
{
#ifdef USE_IPP_SORT
if
(
!
ippFlipFunc
||
ippFlipFunc
(
ptr
,
len
)
<
0
)
#endif
{
#ifdef USE_IPP_SORT
setIppErrorStatus
();
#endif
for
(
j
=
0
;
j
<
len
/
2
;
j
++
)
std
::
swap
(
ptr
[
j
],
ptr
[
len
-
1
-
j
]);
}
}
}
if
(
!
sortRows
)
for
(
j
=
0
;
j
<
len
;
j
++
)
...
...
@@ -3556,7 +3585,7 @@ public:
const
_Tp
*
arr
;
};
#if
IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
#if
def USE_IPP_SORT
typedef
IppStatus
(
CV_STDCALL
*
IppSortIndexFunc
)(
void
*
,
int
*
,
int
);
...
...
@@ -3603,8 +3632,10 @@ template<typename T> static void sortIdx_( const Mat& src, Mat& dst, int flags )
bptr
=
(
T
*
)
buf
;
_iptr
=
(
int
*
)
ibuf
;
#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
IppSortIndexFunc
ippFunc
=
getSortIndexFunc
(
src
.
depth
(),
sortDescending
);
#ifdef USE_IPP_SORT
int
depth
=
src
.
depth
();
IppSortIndexFunc
ippFunc
=
getSortIndexFunc
(
depth
,
sortDescending
);
IppFlipFunc
ippFlipFunc
=
getFlipFunc
(
depth
);
#endif
for
(
i
=
0
;
i
<
n
;
i
++
)
...
...
@@ -3625,15 +3656,28 @@ template<typename T> static void sortIdx_( const Mat& src, Mat& dst, int flags )
for
(
j
=
0
;
j
<
len
;
j
++
)
iptr
[
j
]
=
j
;
#if
IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
#if
def USE_IPP_SORT
if
(
sortRows
||
!
ippFunc
||
ippFunc
(
ptr
,
iptr
,
len
)
<
0
)
#endif
{
#ifdef USE_IPP_SORT
setIppErrorStatus
();
#endif
std
::
sort
(
iptr
,
iptr
+
len
,
LessThanIdx
<
T
>
(
ptr
)
);
if
(
sortDescending
)
{
#ifdef USE_IPP_SORT
if
(
!
ippFlipFunc
||
ippFlipFunc
(
iptr
,
len
)
<
0
)
#endif
{
#ifdef USE_IPP_SORT
setIppErrorStatus
();
#endif
for
(
j
=
0
;
j
<
len
/
2
;
j
++
)
std
::
swap
(
iptr
[
j
],
iptr
[
len
-
1
-
j
]);
}
}
}
if
(
!
sortRows
)
for
(
j
=
0
;
j
<
len
;
j
++
)
...
...
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