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
96ee8389
Commit
96ee8389
authored
Nov 10, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core(test): extend divideByZero test
to verify SIMD code path
parent
56eebb92
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
14 deletions
+66
-14
test_arithm.cpp
modules/core/test/test_arithm.cpp
+66
-14
No files found.
modules/core/test/test_arithm.cpp
View file @
96ee8389
...
@@ -2249,33 +2249,53 @@ void testDivideChecks(const Mat& dst)
...
@@ -2249,33 +2249,53 @@ void testDivideChecks(const Mat& dst)
{
{
for
(
int
x
=
0
;
x
<
dst
.
cols
;
x
++
)
for
(
int
x
=
0
;
x
<
dst
.
cols
;
x
++
)
{
{
if
(
x
==
2
)
if
(
(
x
%
4
)
==
2
)
{
{
EXPECT_EQ
(
0
,
dst
.
at
<
T
>
(
y
,
x
))
<<
"dst("
<<
y
<<
", "
<<
x
<<
") = "
<<
dst
.
at
<
T
>
(
y
,
x
);
EXPECT_EQ
(
0
,
dst
.
at
<
T
>
(
y
,
x
))
<<
"dst("
<<
y
<<
", "
<<
x
<<
") = "
<<
dst
.
at
<
T
>
(
y
,
x
);
}
}
else
{
EXPECT_TRUE
(
0
==
cvIsNaN
((
double
)
dst
.
at
<
T
>
(
y
,
x
)))
<<
"dst("
<<
y
<<
", "
<<
x
<<
") = "
<<
dst
.
at
<
T
>
(
y
,
x
);
EXPECT_TRUE
(
0
==
cvIsInf
((
double
)
dst
.
at
<
T
>
(
y
,
x
)))
<<
"dst("
<<
y
<<
", "
<<
x
<<
") = "
<<
dst
.
at
<
T
>
(
y
,
x
);
}
}
}
}
}
}
}
template
<
typename
T
>
static
inline
template
<
typename
T
,
bool
isUMat
>
static
inline
void
testDivide
(
bool
isUMat
,
double
scale
,
bool
largeSize
,
bool
tailProcessing
,
bool
roi
)
void
testDivide
()
{
{
Mat
src1
,
src2
;
Mat
src1
,
src2
;
testDivideInitData
<
T
>
(
src1
,
src2
);
testDivideInitData
<
T
>
(
src1
,
src2
);
ASSERT_FALSE
(
src1
.
empty
());
ASSERT_FALSE
(
src2
.
empty
());
ASSERT_FALSE
(
src1
.
empty
());
ASSERT_FALSE
(
src2
.
empty
());
if
(
largeSize
)
{
repeat
(
src1
.
clone
(),
1
,
8
,
src1
);
repeat
(
src2
.
clone
(),
1
,
8
,
src2
);
}
if
(
tailProcessing
)
{
src1
=
src1
(
Rect
(
0
,
0
,
src1
.
cols
-
1
,
src1
.
rows
));
src2
=
src2
(
Rect
(
0
,
0
,
src2
.
cols
-
1
,
src2
.
rows
));
}
if
(
!
roi
&&
tailProcessing
)
{
src1
=
src1
.
clone
();
src2
=
src2
.
clone
();
}
Mat
dst
;
Mat
dst
;
if
(
!
isUMat
)
if
(
!
isUMat
)
{
{
cv
::
divide
(
src1
,
src2
,
dst
);
cv
::
divide
(
src1
,
src2
,
dst
,
scale
);
}
}
else
else
{
{
UMat
usrc1
,
usrc2
,
udst
;
UMat
usrc1
,
usrc2
,
udst
;
src1
.
copyTo
(
usrc1
);
src1
.
copyTo
(
usrc1
);
src2
.
copyTo
(
usrc2
);
src2
.
copyTo
(
usrc2
);
cv
::
divide
(
usrc1
,
usrc2
,
udst
);
cv
::
divide
(
usrc1
,
usrc2
,
udst
,
scale
);
udst
.
copyTo
(
dst
);
udst
.
copyTo
(
dst
);
}
}
...
@@ -2289,14 +2309,46 @@ void testDivide()
...
@@ -2289,14 +2309,46 @@ void testDivide()
}
}
}
}
TEST
(
Core_DivideRules
,
type_32s
)
{
testDivide
<
int
,
false
>
();
}
typedef
tuple
<
bool
,
double
,
bool
,
bool
,
bool
>
DivideRulesParam
;
TEST
(
UMat_Core_DivideRules
,
type_32s
)
{
testDivide
<
int
,
true
>
();
}
typedef
testing
::
TestWithParam
<
DivideRulesParam
>
Core_DivideRules
;
TEST
(
Core_DivideRules
,
type_16s
)
{
testDivide
<
short
,
false
>
();
}
TEST
(
UMat_Core_DivideRules
,
type_16s
)
{
testDivide
<
short
,
true
>
();
}
TEST_P
(
Core_DivideRules
,
type_32s
)
TEST
(
Core_DivideRules
,
type_32f
)
{
testDivide
<
float
,
false
>
();
}
{
TEST
(
UMat_Core_DivideRules
,
type_32f
)
{
testDivide
<
float
,
true
>
();
}
DivideRulesParam
param
=
GetParam
();
TEST
(
Core_DivideRules
,
type_64f
)
{
testDivide
<
double
,
false
>
();
}
testDivide
<
int
>
(
get
<
0
>
(
param
),
get
<
1
>
(
param
),
get
<
2
>
(
param
),
get
<
3
>
(
param
),
get
<
4
>
(
param
));
TEST
(
UMat_Core_DivideRules
,
type_64f
)
{
testDivide
<
double
,
true
>
();
}
}
TEST_P
(
Core_DivideRules
,
type_16s
)
{
DivideRulesParam
param
=
GetParam
();
testDivide
<
short
>
(
get
<
0
>
(
param
),
get
<
1
>
(
param
),
get
<
2
>
(
param
),
get
<
3
>
(
param
),
get
<
4
>
(
param
));
}
TEST_P
(
Core_DivideRules
,
type_32f
)
{
DivideRulesParam
param
=
GetParam
();
testDivide
<
float
>
(
get
<
0
>
(
param
),
get
<
1
>
(
param
),
get
<
2
>
(
param
),
get
<
3
>
(
param
),
get
<
4
>
(
param
));
}
TEST_P
(
Core_DivideRules
,
type_64f
)
{
DivideRulesParam
param
=
GetParam
();
testDivide
<
double
>
(
get
<
0
>
(
param
),
get
<
1
>
(
param
),
get
<
2
>
(
param
),
get
<
3
>
(
param
),
get
<
4
>
(
param
));
}
INSTANTIATE_TEST_CASE_P
(
/* */
,
Core_DivideRules
,
testing
::
Combine
(
/* isMat */
testing
::
Values
(
false
),
/* scale */
testing
::
Values
(
1.0
,
5.0
),
/* largeSize */
testing
::
Bool
(),
/* tail */
testing
::
Bool
(),
/* roi */
testing
::
Bool
()
));
INSTANTIATE_TEST_CASE_P
(
UMat
,
Core_DivideRules
,
testing
::
Combine
(
/* isMat */
testing
::
Values
(
true
),
/* scale */
testing
::
Values
(
1.0
,
5.0
),
/* largeSize */
testing
::
Bool
(),
/* tail */
testing
::
Bool
(),
/* roi */
testing
::
Bool
()
));
TEST
(
Core_MinMaxIdx
,
rows_overflow
)
TEST
(
Core_MinMaxIdx
,
rows_overflow
)
...
...
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