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
ba451350
Commit
ba451350
authored
Mar 04, 2014
by
Andrey Pavlenko
Committed by
OpenCV Buildbot
Mar 04, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2429 from ilya-lavrenov:master_compatible_tests
parents
b5248dbf
767b28f2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
576 additions
and
373 deletions
+576
-373
perf_arithm.cpp
modules/ocl/perf/perf_arithm.cpp
+0
-0
perf_bgfg.cpp
modules/ocl/perf/perf_bgfg.cpp
+10
-14
perf_blend.cpp
modules/ocl/perf/perf_blend.cpp
+3
-3
perf_brute_force_matcher.cpp
modules/ocl/perf/perf_brute_force_matcher.cpp
+28
-30
perf_canny.cpp
modules/ocl/perf/perf_canny.cpp
+14
-5
perf_color.cpp
modules/ocl/perf/perf_color.cpp
+25
-25
perf_fft.cpp
modules/ocl/perf/perf_fft.cpp
+13
-7
perf_filters.cpp
modules/ocl/perf/perf_filters.cpp
+0
-0
perf_gemm.cpp
modules/ocl/perf/perf_gemm.cpp
+16
-7
perf_gftt.cpp
modules/ocl/perf/perf_gftt.cpp
+14
-14
perf_haar.cpp
modules/ocl/perf/perf_haar.cpp
+12
-14
perf_hog.cpp
modules/ocl/perf/perf_hog.cpp
+4
-2
perf_imgproc.cpp
modules/ocl/perf/perf_imgproc.cpp
+42
-57
perf_imgwarp.cpp
modules/ocl/perf/perf_imgwarp.cpp
+44
-56
perf_kalman.cpp
modules/ocl/perf/perf_kalman.cpp
+2
-2
perf_match_template.cpp
modules/ocl/perf/perf_match_template.cpp
+8
-7
perf_matrix_operation.cpp
modules/ocl/perf/perf_matrix_operation.cpp
+12
-18
perf_ml.cpp
modules/ocl/perf/perf_ml.cpp
+8
-6
perf_moments.cpp
modules/ocl/perf/perf_moments.cpp
+9
-11
perf_opticalflow.cpp
modules/ocl/perf/perf_opticalflow.cpp
+13
-42
perf_precomp.hpp
modules/ocl/perf/perf_precomp.hpp
+39
-2
perf_pyramid.cpp
modules/ocl/perf/perf_pyramid.cpp
+8
-10
perf_split_merge.cpp
modules/ocl/perf/perf_split_merge.cpp
+50
-29
perf_stat.cpp
modules/ocl/perf/perf_stat.cpp
+202
-12
No files found.
modules/ocl/perf/perf_arithm.cpp
View file @
ba451350
This diff is collapsed.
Click to expand it.
modules/ocl/perf/perf_bgfg.cpp
View file @
ba451350
...
@@ -165,11 +165,11 @@ PERF_TEST_P(VideoMOGFixture, MOG,
...
@@ -165,11 +165,11 @@ PERF_TEST_P(VideoMOGFixture, MOG,
///////////// MOG2 ////////////////////////
///////////// MOG2 ////////////////////////
typedef
tuple
<
string
,
int
>
VideoMOG2ParamType
;
typedef
tuple
<
string
,
int
>
VideoMOG2ParamType
;
typedef
TestBaseWithParam
<
VideoMOG2ParamType
>
VideoMOG2Fixture
;
typedef
TestBaseWithParam
<
VideoMOG2ParamType
>
MOG2_Apply
;
PERF_TEST_P
(
VideoMOG2Fixture
,
DISABLED_MOG2
,
// TODO Disabled: random hungs on buildslave
OCL_PERF_TEST_P
(
MOG2_Apply
,
Mog2
,
::
testing
::
Combine
(
::
testing
::
Values
(
"gpu/video/768x576.avi"
,
"gpu/video/1920x1080.avi"
),
testing
::
Combine
(
testing
::
Values
(
"gpu/video/768x576.avi"
,
"gpu/video/1920x1080.avi"
),
::
testing
::
Values
(
1
,
3
)))
testing
::
Values
(
1
,
3
)))
{
{
VideoMOG2ParamType
params
=
GetParam
();
VideoMOG2ParamType
params
=
GetParam
();
...
@@ -195,10 +195,8 @@ PERF_TEST_P(VideoMOG2Fixture, DISABLED_MOG2, // TODO Disabled: random hungs on b
...
@@ -195,10 +195,8 @@ PERF_TEST_P(VideoMOG2Fixture, DISABLED_MOG2, // TODO Disabled: random hungs on b
foreground
.
release
();
foreground
.
release
();
for
(
int
i
=
0
;
i
<
nFrame
;
i
++
)
for
(
int
i
=
0
;
i
<
nFrame
;
i
++
)
{
mog2
(
frame_buffer
[
i
],
foreground
);
mog2
(
frame_buffer
[
i
],
foreground
);
}
}
}
SANITY_CHECK
(
foreground
);
SANITY_CHECK
(
foreground
);
}
}
else
if
(
RUN_OCL_IMPL
)
else
if
(
RUN_OCL_IMPL
)
...
@@ -210,10 +208,8 @@ PERF_TEST_P(VideoMOG2Fixture, DISABLED_MOG2, // TODO Disabled: random hungs on b
...
@@ -210,10 +208,8 @@ PERF_TEST_P(VideoMOG2Fixture, DISABLED_MOG2, // TODO Disabled: random hungs on b
cv
::
ocl
::
MOG2
d_mog2
;
cv
::
ocl
::
MOG2
d_mog2
;
foreground_d
.
release
();
foreground_d
.
release
();
for
(
int
i
=
0
;
i
<
nFrame
;
i
++
)
for
(
int
i
=
0
;
i
<
nFrame
;
i
++
)
{
d_mog2
(
frame_buffer_ocl
[
i
],
foreground_d
);
d_mog2
(
frame_buffer_ocl
[
i
],
foreground_d
);
}
}
}
foreground_d
.
download
(
foreground
);
foreground_d
.
download
(
foreground
);
SANITY_CHECK
(
foreground
);
SANITY_CHECK
(
foreground
);
}
}
...
@@ -223,11 +219,11 @@ PERF_TEST_P(VideoMOG2Fixture, DISABLED_MOG2, // TODO Disabled: random hungs on b
...
@@ -223,11 +219,11 @@ PERF_TEST_P(VideoMOG2Fixture, DISABLED_MOG2, // TODO Disabled: random hungs on b
///////////// MOG2_GetBackgroundImage //////////////////
///////////// MOG2_GetBackgroundImage //////////////////
typedef
TestBaseWithParam
<
VideoMOG2ParamType
>
Video_MOG2
GetBackgroundImage
;
typedef
TestBaseWithParam
<
VideoMOG2ParamType
>
MOG2_
GetBackgroundImage
;
PERF_TEST_P
(
Video_MOG2GetBackgroundImage
,
MOG
2
,
OCL_PERF_TEST_P
(
MOG2_GetBackgroundImage
,
Mog
2
,
::
testing
::
Combine
(
::
testing
::
Values
(
"gpu/video/768x576.avi"
,
"gpu/video/1920x1080.avi"
),
testing
::
Combine
(
testing
::
Values
(
"gpu/video/768x576.avi"
,
"gpu/video/1920x1080.avi"
),
::
testing
::
Values
(
3
)))
testing
::
Values
(
3
)))
{
{
VideoMOG2ParamType
params
=
GetParam
();
VideoMOG2ParamType
params
=
GetParam
();
...
@@ -248,7 +244,7 @@ PERF_TEST_P(Video_MOG2GetBackgroundImage, MOG2,
...
@@ -248,7 +244,7 @@ PERF_TEST_P(Video_MOG2GetBackgroundImage, MOG2,
cv
::
ocl
::
oclMat
foreground_d
;
cv
::
ocl
::
oclMat
foreground_d
;
cv
::
ocl
::
oclMat
background_d
;
cv
::
ocl
::
oclMat
background_d
;
if
(
RUN_PLAIN_IMPL
)
if
(
RUN_PLAIN_IMPL
)
{
{
TEST_CYCLE
()
TEST_CYCLE
()
{
{
...
@@ -264,7 +260,7 @@ PERF_TEST_P(Video_MOG2GetBackgroundImage, MOG2,
...
@@ -264,7 +260,7 @@ PERF_TEST_P(Video_MOG2GetBackgroundImage, MOG2,
}
}
SANITY_CHECK
(
background
);
SANITY_CHECK
(
background
);
}
}
else
if
(
RUN_OCL_IMPL
)
else
if
(
RUN_OCL_IMPL
)
{
{
prepareData
(
frame_buffer
,
frame_buffer_ocl
);
prepareData
(
frame_buffer
,
frame_buffer_ocl
);
CV_Assert
((
int
)(
frame_buffer_ocl
.
size
())
==
nFrame
);
CV_Assert
((
int
)(
frame_buffer_ocl
.
size
())
==
nFrame
);
...
...
modules/ocl/perf/perf_blend.cpp
View file @
ba451350
...
@@ -88,10 +88,10 @@ typedef void (*blendFunction)(const Mat &img1, const Mat &img2,
...
@@ -88,10 +88,10 @@ typedef void (*blendFunction)(const Mat &img1, const Mat &img2,
const
Mat
&
weights1
,
const
Mat
&
weights2
,
const
Mat
&
weights1
,
const
Mat
&
weights2
,
Mat
&
result_gold
);
Mat
&
result_gold
);
typedef
Size_MatType
b
lendLinearFixture
;
typedef
Size_MatType
B
lendLinearFixture
;
PERF_TEST_P
(
blendLinearFixture
,
blendLinear
,
::
testing
::
Combine
(
OCL_PERF_TEST_P
(
BlendLinearFixture
,
BlendLinear
,
OCL_TYPICAL_MAT_SIZES
,
testing
::
Values
(
CV_8UC1
,
CV_8UC3
,
CV_32FC1
)))
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_PERF_ENUM
(
CV_32FC1
,
CV_32FC4
)))
{
{
Size_MatType_t
params
=
GetParam
();
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
...
...
modules/ocl/perf/perf_brute_force_matcher.cpp
View file @
ba451350
...
@@ -46,21 +46,23 @@
...
@@ -46,21 +46,23 @@
#include "perf_precomp.hpp"
#include "perf_precomp.hpp"
using
namespace
perf
;
using
namespace
perf
;
using
std
::
tr1
::
get
;
#define OCL_BFMATCHER_TYPICAL_MAT_SIZES ::testing::Values(cv::Size(128, 500), cv::Size(128, 1000), cv::Size(128, 2000))
//////////////////// BruteForceMatch /////////////////
//////////////////// BruteForceMatch /////////////////
typedef
TestBaseWithParam
<
Size
>
BruteForceMatcherFixture
;
typedef
Size_MatType
BruteForceMatcherFixture
;
PERF_TEST_P
(
BruteForceMatcherFixture
,
match
,
OCL_PERF_TEST_P
(
BruteForceMatcherFixture
,
Match
,
OCL_BFMATCHER_TYPICAL_MAT_SIZES
)
::
testing
::
Combine
(
OCL_PERF_ENUM
(
OCL_SIZE_1
,
OCL_SIZE_2
,
OCL_SIZE_3
),
OCL_PERF_ENUM
(
MatType
(
CV_32FC1
))))
{
{
const
Size
srcSize
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
vector
<
DMatch
>
matches
;
vector
<
DMatch
>
matches
;
Mat
query
(
srcSize
,
CV_32F
),
train
(
srcSize
,
CV_32F
);
Mat
query
(
srcSize
,
type
),
train
(
srcSize
,
type
);
declare
.
in
(
query
,
train
)
.
time
(
srcSize
.
height
==
2000
?
9
:
4
)
;
declare
.
in
(
query
,
train
);
randu
(
query
,
0.0
f
,
1.0
f
);
randu
(
query
,
0.0
f
,
1.0
f
);
randu
(
train
,
0.0
f
,
1.0
f
);
randu
(
train
,
0.0
f
,
1.0
f
);
...
@@ -75,12 +77,9 @@ PERF_TEST_P(BruteForceMatcherFixture, match,
...
@@ -75,12 +77,9 @@ PERF_TEST_P(BruteForceMatcherFixture, match,
{
{
ocl
::
BruteForceMatcher_OCL_base
oclMatcher
(
ocl
::
BruteForceMatcher_OCL_base
::
L2Dist
);
ocl
::
BruteForceMatcher_OCL_base
oclMatcher
(
ocl
::
BruteForceMatcher_OCL_base
::
L2Dist
);
ocl
::
oclMat
oclQuery
(
query
),
oclTrain
(
train
);
ocl
::
oclMat
oclQuery
(
query
),
oclTrain
(
train
);
ocl
::
oclMat
oclTrainIdx
,
oclDistance
;
OCL_TEST_CYCLE
()
OCL_TEST_CYCLE
()
oclMatcher
.
matchSingle
(
oclQuery
,
oclTrain
,
oclTrainIdx
,
oclDistance
);
oclMatcher
.
match
(
oclQuery
,
oclTrain
,
matches
);
oclMatcher
.
matchDownload
(
oclTrainIdx
,
oclDistance
,
matches
);
SANITY_CHECK_MATCHES
(
matches
,
1e-5
);
SANITY_CHECK_MATCHES
(
matches
,
1e-5
);
}
}
...
@@ -88,19 +87,20 @@ PERF_TEST_P(BruteForceMatcherFixture, match,
...
@@ -88,19 +87,20 @@ PERF_TEST_P(BruteForceMatcherFixture, match,
OCL_PERF_ELSE
OCL_PERF_ELSE
}
}
PERF_TEST_P
(
BruteForceMatcherFixture
,
knnMatch
,
OCL_PERF_TEST_P
(
BruteForceMatcherFixture
,
KnnMatch
,
OCL_BFMATCHER_TYPICAL_MAT_SIZES
)
::
testing
::
Combine
(
OCL_PERF_ENUM
(
OCL_SIZE_1
,
OCL_SIZE_2
,
OCL_SIZE_3
),
OCL_PERF_ENUM
(
MatType
(
CV_32FC1
))))
{
{
const
Size
srcSize
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
vector
<
vector
<
DMatch
>
>
matches
(
2
);
vector
<
vector
<
DMatch
>
>
matches
(
2
);
Mat
query
(
srcSize
,
CV_32F
),
train
(
srcSize
,
CV_32F
);
Mat
query
(
srcSize
,
type
),
train
(
srcSize
,
type
);
randu
(
query
,
0.0
f
,
1.0
f
);
randu
(
query
,
0.0
f
,
1.0
f
);
randu
(
train
,
0.0
f
,
1.0
f
);
randu
(
train
,
0.0
f
,
1.0
f
);
declare
.
in
(
query
,
train
);
declare
.
in
(
query
,
train
);
if
(
srcSize
.
height
==
2000
)
declare
.
time
(
9
);
if
(
RUN_PLAIN_IMPL
)
if
(
RUN_PLAIN_IMPL
)
{
{
...
@@ -115,10 +115,10 @@ PERF_TEST_P(BruteForceMatcherFixture, knnMatch,
...
@@ -115,10 +115,10 @@ PERF_TEST_P(BruteForceMatcherFixture, knnMatch,
{
{
ocl
::
BruteForceMatcher_OCL_base
oclMatcher
(
ocl
::
BruteForceMatcher_OCL_base
::
L2Dist
);
ocl
::
BruteForceMatcher_OCL_base
oclMatcher
(
ocl
::
BruteForceMatcher_OCL_base
::
L2Dist
);
ocl
::
oclMat
oclQuery
(
query
),
oclTrain
(
train
);
ocl
::
oclMat
oclQuery
(
query
),
oclTrain
(
train
);
ocl
::
oclMat
oclTrainIdx
,
oclDistance
,
oclAllDist
;
ocl
::
oclMat
oclTrainIdx
,
oclDistance
;
OCL_TEST_CYCLE
()
OCL_TEST_CYCLE
()
oclMatcher
.
knnMatch
Single
(
oclQuery
,
oclTrain
,
oclTrainIdx
,
oclDistance
,
oclAllDist
,
2
);
oclMatcher
.
knnMatch
(
oclQuery
,
oclTrain
,
matches
,
2
);
oclMatcher
.
knnMatchDownload
(
oclTrainIdx
,
oclDistance
,
matches
);
oclMatcher
.
knnMatchDownload
(
oclTrainIdx
,
oclDistance
,
matches
);
...
@@ -130,22 +130,22 @@ PERF_TEST_P(BruteForceMatcherFixture, knnMatch,
...
@@ -130,22 +130,22 @@ PERF_TEST_P(BruteForceMatcherFixture, knnMatch,
OCL_PERF_ELSE
OCL_PERF_ELSE
}
}
PERF_TEST_P
(
BruteForceMatcherFixture
,
radiusMatch
,
OCL_PERF_TEST_P
(
BruteForceMatcherFixture
,
RadiusMatch
,
OCL_BFMATCHER_TYPICAL_MAT_SIZES
)
::
testing
::
Combine
(
OCL_PERF_ENUM
(
OCL_SIZE_1
,
OCL_SIZE_2
,
OCL_SIZE_3
),
OCL_PERF_ENUM
(
MatType
(
CV_32FC1
))))
{
{
const
Size
srcSize
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
const
float
max_distance
=
2.0
f
;
const
float
max_distance
=
2.0
f
;
vector
<
vector
<
DMatch
>
>
matches
(
2
);
vector
<
vector
<
DMatch
>
>
matches
(
2
);
Mat
query
(
srcSize
,
CV_32F
),
train
(
srcSize
,
CV_32F
);
Mat
query
(
srcSize
,
type
),
train
(
srcSize
,
type
);
declare
.
in
(
query
,
train
);
declare
.
in
(
query
,
train
);
randu
(
query
,
0.0
f
,
1.0
f
);
randu
(
query
,
0.0
f
,
1.0
f
);
randu
(
train
,
0.0
f
,
1.0
f
);
randu
(
train
,
0.0
f
,
1.0
f
);
if
(
srcSize
.
height
==
2000
)
declare
.
time
(
9.15
);
if
(
RUN_PLAIN_IMPL
)
if
(
RUN_PLAIN_IMPL
)
{
{
cv
::
BFMatcher
matcher
(
NORM_L2
);
cv
::
BFMatcher
matcher
(
NORM_L2
);
...
@@ -162,7 +162,7 @@ PERF_TEST_P(BruteForceMatcherFixture, radiusMatch,
...
@@ -162,7 +162,7 @@ PERF_TEST_P(BruteForceMatcherFixture, radiusMatch,
ocl
::
oclMat
oclTrainIdx
,
oclDistance
,
oclNMatches
;
ocl
::
oclMat
oclTrainIdx
,
oclDistance
,
oclNMatches
;
OCL_TEST_CYCLE
()
OCL_TEST_CYCLE
()
oclMatcher
.
radiusMatch
Single
(
oclQuery
,
oclTrain
,
oclTrainIdx
,
oclDistance
,
oclNM
atches
,
max_distance
);
oclMatcher
.
radiusMatch
(
oclQuery
,
oclTrain
,
m
atches
,
max_distance
);
oclMatcher
.
radiusMatchDownload
(
oclTrainIdx
,
oclDistance
,
oclNMatches
,
matches
);
oclMatcher
.
radiusMatchDownload
(
oclTrainIdx
,
oclDistance
,
oclNMatches
,
matches
);
...
@@ -173,5 +173,3 @@ PERF_TEST_P(BruteForceMatcherFixture, radiusMatch,
...
@@ -173,5 +173,3 @@ PERF_TEST_P(BruteForceMatcherFixture, radiusMatch,
else
else
OCL_PERF_ELSE
OCL_PERF_ELSE
}
}
#undef OCL_BFMATCHER_TYPICAL_MAT_SIZES
modules/ocl/perf/perf_canny.cpp
View file @
ba451350
...
@@ -46,11 +46,21 @@
...
@@ -46,11 +46,21 @@
#include "perf_precomp.hpp"
#include "perf_precomp.hpp"
using
namespace
perf
;
using
namespace
perf
;
using
std
::
tr1
::
tuple
;
using
std
::
tr1
::
get
;
///////////// Canny ////////////////////////
///////////// Canny ////////////////////////
PERF_TEST
(
CannyFixture
,
Canny
)
typedef
tuple
<
int
,
bool
>
CannyParams
;
typedef
TestBaseWithParam
<
CannyParams
>
CannyFixture
;
OCL_PERF_TEST_P
(
CannyFixture
,
Canny
,
::
testing
::
Combine
(
OCL_PERF_ENUM
(
3
,
5
),
testing
::
Bool
()))
{
{
const
CannyParams
params
=
GetParam
();
int
apertureSize
=
get
<
0
>
(
params
);
bool
L2Grad
=
get
<
1
>
(
params
);
Mat
img
=
imread
(
getDataPath
(
"gpu/stereobm/aloe-L.png"
),
cv
::
IMREAD_GRAYSCALE
),
Mat
img
=
imread
(
getDataPath
(
"gpu/stereobm/aloe-L.png"
),
cv
::
IMREAD_GRAYSCALE
),
edges
(
img
.
size
(),
CV_8UC1
);
edges
(
img
.
size
(),
CV_8UC1
);
ASSERT_TRUE
(
!
img
.
empty
())
<<
"can't open aloe-L.png"
;
ASSERT_TRUE
(
!
img
.
empty
())
<<
"can't open aloe-L.png"
;
...
@@ -61,16 +71,15 @@ PERF_TEST(CannyFixture, Canny)
...
@@ -61,16 +71,15 @@ PERF_TEST(CannyFixture, Canny)
{
{
ocl
::
oclMat
oclImg
(
img
),
oclEdges
(
img
.
size
(),
CV_8UC1
);
ocl
::
oclMat
oclImg
(
img
),
oclEdges
(
img
.
size
(),
CV_8UC1
);
OCL_TEST_CYCLE
()
ocl
::
Canny
(
oclImg
,
oclEdges
,
50.0
,
100.0
);
OCL_TEST_CYCLE
()
ocl
::
Canny
(
oclImg
,
oclEdges
,
50.0
,
100.0
,
apertureSize
,
L2Grad
);
oclEdges
.
download
(
edges
);
oclEdges
.
download
(
edges
);
}
}
else
if
(
RUN_PLAIN_IMPL
)
else
if
(
RUN_PLAIN_IMPL
)
{
{
TEST_CYCLE
()
Canny
(
img
,
edges
,
50.0
,
100.0
);
TEST_CYCLE
()
Canny
(
img
,
edges
,
50.0
,
100.0
,
apertureSize
,
L2Grad
);
}
}
else
else
OCL_PERF_ELSE
OCL_PERF_ELSE
int
value
=
0
;
SANITY_CHECK_NOTHING
();
SANITY_CHECK
(
value
);
}
}
modules/ocl/perf/perf_color.cpp
View file @
ba451350
...
@@ -52,36 +52,36 @@ using std::tr1::make_tuple;
...
@@ -52,36 +52,36 @@ using std::tr1::make_tuple;
///////////// cvtColor////////////////////////
///////////// cvtColor////////////////////////
CV_ENUM
(
ConversionTypes
,
C
V_RGB2GRAY
,
CV_RGB2BGR
,
CV_RGB2YUV
,
CV_YUV2RGB
,
CV
_RGB2YCrCb
,
CV_ENUM
(
ConversionTypes
,
C
OLOR_RGB2GRAY
,
COLOR_RGB2BGR
,
COLOR_RGB2YUV
,
COLOR_YUV2RGB
,
COLOR
_RGB2YCrCb
,
C
V_YCrCb2RGB
,
CV_RGB2XYZ
,
CV_XYZ2RGB
,
CV_RGB2HSV
,
CV_HSV2RGB
,
CV
_RGB2HLS
,
C
OLOR_YCrCb2RGB
,
COLOR_RGB2XYZ
,
COLOR_XYZ2RGB
,
COLOR_RGB2HSV
,
COLOR_HSV2RGB
,
COLOR
_RGB2HLS
,
C
V_HLS2RGB
,
CV_BGR5652BGR
,
CV_BGR2BGR565
,
CV_RGBA2mRGBA
,
CV_mRGBA2RGBA
,
CV
_YUV2RGB_NV12
)
C
OLOR_HLS2RGB
,
COLOR_BGR5652BGR
,
COLOR_BGR2BGR565
,
COLOR_RGBA2mRGBA
,
COLOR_mRGBA2RGBA
,
COLOR
_YUV2RGB_NV12
)
typedef
tuple
<
Size
,
tuple
<
ConversionTypes
,
int
,
int
>
>
c
vtColorParams
;
typedef
tuple
<
Size
,
tuple
<
ConversionTypes
,
int
,
int
>
>
C
vtColorParams
;
typedef
TestBaseWithParam
<
cvtColorParams
>
c
vtColorFixture
;
typedef
TestBaseWithParam
<
CvtColorParams
>
C
vtColorFixture
;
PERF_TEST_P
(
cvtColorFixture
,
c
vtColor
,
testing
::
Combine
(
OCL_PERF_TEST_P
(
CvtColorFixture
,
C
vtColor
,
testing
::
Combine
(
testing
::
Values
(
Size
(
1000
,
1002
),
Size
(
2000
,
2004
),
Size
(
4000
,
4008
))
,
OCL_TEST_SIZES
,
testing
::
Values
(
testing
::
Values
(
make_tuple
(
ConversionTypes
(
C
V
_RGB2GRAY
),
3
,
1
),
make_tuple
(
ConversionTypes
(
C
OLOR
_RGB2GRAY
),
3
,
1
),
make_tuple
(
ConversionTypes
(
C
V
_RGB2BGR
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
OLOR
_RGB2BGR
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
V
_RGB2YUV
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
OLOR
_RGB2YUV
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
V
_YUV2RGB
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
OLOR
_YUV2RGB
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
V
_RGB2YCrCb
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
OLOR
_RGB2YCrCb
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
V
_YCrCb2RGB
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
OLOR
_YCrCb2RGB
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
V
_RGB2XYZ
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
OLOR
_RGB2XYZ
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
V
_XYZ2RGB
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
OLOR
_XYZ2RGB
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
V
_RGB2HSV
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
OLOR
_RGB2HSV
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
V
_HSV2RGB
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
OLOR
_HSV2RGB
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
V
_RGB2HLS
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
OLOR
_RGB2HLS
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
V
_HLS2RGB
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
OLOR
_HLS2RGB
),
3
,
3
),
make_tuple
(
ConversionTypes
(
C
V
_BGR5652BGR
),
2
,
3
),
make_tuple
(
ConversionTypes
(
C
OLOR
_BGR5652BGR
),
2
,
3
),
make_tuple
(
ConversionTypes
(
C
V
_BGR2BGR565
),
3
,
2
),
make_tuple
(
ConversionTypes
(
C
OLOR
_BGR2BGR565
),
3
,
2
),
make_tuple
(
ConversionTypes
(
C
V
_RGBA2mRGBA
),
4
,
4
),
make_tuple
(
ConversionTypes
(
C
OLOR
_RGBA2mRGBA
),
4
,
4
),
make_tuple
(
ConversionTypes
(
C
V
_mRGBA2RGBA
),
4
,
4
),
make_tuple
(
ConversionTypes
(
C
OLOR
_mRGBA2RGBA
),
4
,
4
),
make_tuple
(
ConversionTypes
(
C
V
_YUV2RGB_NV12
),
1
,
3
)
make_tuple
(
ConversionTypes
(
C
OLOR
_YUV2RGB_NV12
),
1
,
3
)
)))
)))
{
{
c
vtColorParams
params
=
GetParam
();
C
vtColorParams
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
const
tuple
<
int
,
int
,
int
>
conversionParams
=
get
<
1
>
(
params
);
const
tuple
<
int
,
int
,
int
>
conversionParams
=
get
<
1
>
(
params
);
const
int
code
=
get
<
0
>
(
conversionParams
),
scn
=
get
<
1
>
(
conversionParams
),
const
int
code
=
get
<
0
>
(
conversionParams
),
scn
=
get
<
1
>
(
conversionParams
),
...
...
modules/ocl/perf/perf_fft.cpp
View file @
ba451350
...
@@ -47,6 +47,8 @@
...
@@ -47,6 +47,8 @@
#include "perf_precomp.hpp"
#include "perf_precomp.hpp"
using
namespace
perf
;
using
namespace
perf
;
using
std
::
tr1
::
tuple
;
using
std
::
tr1
::
get
;
///////////// dft ////////////////////////
///////////// dft ////////////////////////
...
@@ -54,22 +56,26 @@ typedef TestBaseWithParam<Size> dftFixture;
...
@@ -54,22 +56,26 @@ typedef TestBaseWithParam<Size> dftFixture;
#ifdef HAVE_CLAMDFFT
#ifdef HAVE_CLAMDFFT
PERF_TEST_P
(
dftFixture
,
dft
,
OCL_TYPICAL_MAT_SIZES
)
typedef
tuple
<
Size
,
int
>
DftParams
;
typedef
TestBaseWithParam
<
DftParams
>
DftFixture
;
OCL_PERF_TEST_P
(
DftFixture
,
Dft
,
::
testing
::
Combine
(
testing
::
Values
(
OCL_SIZE_1
,
OCL_SIZE_2
,
OCL_SIZE_3
),
::
testing
::
Values
((
int
)
DFT_ROWS
,
(
int
)
DFT_SCALE
,
(
int
)
DFT_INVERSE
,
(
int
)
DFT_INVERSE
|
DFT_SCALE
,
(
int
)
DFT_ROWS
|
DFT_INVERSE
)))
{
{
const
Size
srcSize
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
flags
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
CV_32FC2
),
dst
;
Mat
src
(
srcSize
,
CV_32FC2
),
dst
;
randu
(
src
,
0.0
f
,
1.0
f
);
randu
(
src
,
0.0
f
,
1.0
f
);
declare
.
in
(
src
);
declare
.
in
(
src
);
if
(
srcSize
==
OCL_SIZE_4000
)
declare
.
time
(
7.4
);
if
(
RUN_OCL_IMPL
)
if
(
RUN_OCL_IMPL
)
{
{
ocl
::
oclMat
oclSrc
(
src
),
oclDst
;
ocl
::
oclMat
oclSrc
(
src
),
oclDst
;
OCL_TEST_CYCLE
()
cv
::
ocl
::
dft
(
oclSrc
,
oclDst
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
dft
(
oclSrc
,
oclDst
,
Size
(),
flags
|
DFT_COMPLEX_OUTPUT
);
oclDst
.
download
(
dst
);
oclDst
.
download
(
dst
);
...
@@ -77,7 +83,7 @@ PERF_TEST_P(dftFixture, dft, OCL_TYPICAL_MAT_SIZES)
...
@@ -77,7 +83,7 @@ PERF_TEST_P(dftFixture, dft, OCL_TYPICAL_MAT_SIZES)
}
}
else
if
(
RUN_PLAIN_IMPL
)
else
if
(
RUN_PLAIN_IMPL
)
{
{
TEST_CYCLE
()
cv
::
dft
(
src
,
dst
);
TEST_CYCLE
()
cv
::
dft
(
src
,
dst
,
flags
|
DFT_COMPLEX_OUTPUT
);
SANITY_CHECK
(
dst
);
SANITY_CHECK
(
dst
);
}
}
...
...
modules/ocl/perf/perf_filters.cpp
View file @
ba451350
This diff is collapsed.
Click to expand it.
modules/ocl/perf/perf_gemm.cpp
View file @
ba451350
...
@@ -46,30 +46,39 @@
...
@@ -46,30 +46,39 @@
#include "perf_precomp.hpp"
#include "perf_precomp.hpp"
using
namespace
perf
;
using
namespace
perf
;
using
std
::
tr1
::
get
;
using
std
::
tr1
::
tuple
;
///////////// gemm ////////////////////////
///////////// gemm ////////////////////////
typedef
TestBaseWithParam
<
Size
>
gemmFixture
;
#ifdef HAVE_CLAMDBLAS
#ifdef HAVE_CLAMDBLAS
PERF_TEST_P
(
gemmFixture
,
gemm
,
::
testing
::
Values
(
OCL_SIZE_1000
,
OCL_SIZE_2000
))
typedef
tuple
<
Size
,
int
>
GemmParams
;
typedef
TestBaseWithParam
<
GemmParams
>
GemmFixture
;
OCL_PERF_TEST_P
(
GemmFixture
,
Gemm
,
::
testing
::
Combine
(
::
testing
::
Values
(
Size
(
1000
,
1000
),
Size
(
1500
,
1500
)),
::
testing
::
Values
((
int
)
cv
::
GEMM_1_T
,
(
int
)
cv
::
GEMM_1_T
|
(
int
)
cv
::
GEMM_2_T
)))
{
{
const
Size
srcSize
=
GetParam
();
const
GemmParams
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src1
(
srcSize
,
CV_32FC1
),
src2
(
srcSize
,
CV_32FC1
),
Mat
src1
(
srcSize
,
CV_32FC1
),
src2
(
srcSize
,
CV_32FC1
),
src3
(
srcSize
,
CV_32FC1
),
dst
(
srcSize
,
CV_32FC1
);
src3
(
srcSize
,
CV_32FC1
),
dst
(
srcSize
,
CV_32FC1
);
declare
.
in
(
src1
,
src2
,
src3
).
out
(
dst
).
time
(
srcSize
==
OCL_SIZE_2000
?
65
:
8
);
randu
(
src1
,
-
10.0
f
,
10.0
f
);
randu
(
src1
,
-
10.0
f
,
10.0
f
);
randu
(
src2
,
-
10.0
f
,
10.0
f
);
randu
(
src2
,
-
10.0
f
,
10.0
f
);
randu
(
src3
,
-
10.0
f
,
10.0
f
);
randu
(
src3
,
-
10.0
f
,
10.0
f
);
declare
.
in
(
src1
,
src2
,
src3
).
out
(
dst
);
if
(
RUN_OCL_IMPL
)
if
(
RUN_OCL_IMPL
)
{
{
ocl
::
oclMat
oclSrc1
(
src1
),
oclSrc2
(
src2
),
ocl
::
oclMat
oclSrc1
(
src1
),
oclSrc2
(
src2
),
oclSrc3
(
src3
),
oclDst
(
srcSize
,
CV_32FC1
);
oclSrc3
(
src3
),
oclDst
(
srcSize
,
CV_32FC1
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
gemm
(
oclSrc1
,
oclSrc2
,
1.0
,
oclSrc3
,
1.0
,
oclDst
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
gemm
(
oclSrc1
,
oclSrc2
,
1.0
,
oclSrc3
,
1.0
,
oclDst
,
type
);
oclDst
.
download
(
dst
);
oclDst
.
download
(
dst
);
...
@@ -77,7 +86,7 @@ PERF_TEST_P(gemmFixture, gemm, ::testing::Values(OCL_SIZE_1000, OCL_SIZE_2000))
...
@@ -77,7 +86,7 @@ PERF_TEST_P(gemmFixture, gemm, ::testing::Values(OCL_SIZE_1000, OCL_SIZE_2000))
}
}
else
if
(
RUN_PLAIN_IMPL
)
else
if
(
RUN_PLAIN_IMPL
)
{
{
TEST_CYCLE
()
cv
::
gemm
(
src1
,
src2
,
1.0
,
src3
,
1.0
,
dst
);
TEST_CYCLE
()
cv
::
gemm
(
src1
,
src2
,
1.0
,
src3
,
1.0
,
dst
,
type
);
SANITY_CHECK
(
dst
,
0.01
);
SANITY_CHECK
(
dst
,
0.01
);
}
}
...
...
modules/ocl/perf/perf_gftt.cpp
View file @
ba451350
...
@@ -52,22 +52,21 @@ using std::tr1::get;
...
@@ -52,22 +52,21 @@ using std::tr1::get;
///////////// GoodFeaturesToTrack ////////////////////////
///////////// GoodFeaturesToTrack ////////////////////////
typedef
tuple
<
string
,
double
>
GoodFeaturesToTrackParams
;
typedef
tuple
<
String
,
double
,
bool
>
GoodFeaturesToTrackParams
;
typedef
TestBaseWithParam
<
GoodFeaturesToTrackParams
>
GoodFeaturesToTrackFixture
;
typedef
TestBaseWithParam
<
GoodFeaturesToTrackParams
>
GoodFeaturesToTrackFixture
;
PERF_TEST_P
(
GoodFeaturesToTrackFixture
,
GoodFeaturesToTrack
,
OCL_PERF_TEST_P
(
GoodFeaturesToTrackFixture
,
GoodFeaturesToTrack
,
::
testing
::
Combine
(
::
testing
::
Values
(
string
(
"gpu/opticalflow/rubberwhale1.png"
),
::
testing
::
Combine
(
OCL_PERF_ENUM
(
String
(
"gpu/opticalflow/rubberwhale1.png"
)),
string
(
"gpu/stereobm/aloe-L.png"
)),
OCL_PERF_ENUM
(
0.0
,
3.0
),
testing
::
Bool
()))
::
testing
::
Range
(
0.0
,
4.0
,
3.0
)))
{
{
const
GoodFeaturesToTrackParams
params
=
GetParam
();
const
String
fileName
=
get
<
0
>
(
params
);
const
double
minDistance
=
get
<
1
>
(
params
),
qualityLevel
=
0.01
;
const
bool
harrisDetector
=
get
<
2
>
(
params
);
const
int
maxCorners
=
1000
;
const
GoodFeaturesToTrackParams
param
=
GetParam
();
Mat
frame
=
imread
(
getDataPath
(
fileName
),
IMREAD_GRAYSCALE
);
const
string
fileName
=
getDataPath
(
get
<
0
>
(
param
));
ASSERT_FALSE
(
frame
.
empty
())
<<
"no input image"
;
const
int
maxCorners
=
2000
;
const
double
qualityLevel
=
0.01
,
minDistance
=
get
<
1
>
(
param
);
Mat
frame
=
imread
(
fileName
,
IMREAD_GRAYSCALE
);
ASSERT_TRUE
(
!
frame
.
empty
())
<<
"no input image"
;
vector
<
Point2f
>
pts_gold
;
vector
<
Point2f
>
pts_gold
;
declare
.
in
(
frame
);
declare
.
in
(
frame
);
...
@@ -75,7 +74,8 @@ PERF_TEST_P(GoodFeaturesToTrackFixture, GoodFeaturesToTrack,
...
@@ -75,7 +74,8 @@ PERF_TEST_P(GoodFeaturesToTrackFixture, GoodFeaturesToTrack,
if
(
RUN_OCL_IMPL
)
if
(
RUN_OCL_IMPL
)
{
{
ocl
::
oclMat
oclFrame
(
frame
),
pts_oclmat
;
ocl
::
oclMat
oclFrame
(
frame
),
pts_oclmat
;
ocl
::
GoodFeaturesToTrackDetector_OCL
detector
(
maxCorners
,
qualityLevel
,
minDistance
);
ocl
::
GoodFeaturesToTrackDetector_OCL
detector
(
maxCorners
,
qualityLevel
,
minDistance
,
3
,
harrisDetector
);
OCL_TEST_CYCLE
()
detector
(
oclFrame
,
pts_oclmat
);
OCL_TEST_CYCLE
()
detector
(
oclFrame
,
pts_oclmat
);
...
@@ -86,7 +86,7 @@ PERF_TEST_P(GoodFeaturesToTrackFixture, GoodFeaturesToTrack,
...
@@ -86,7 +86,7 @@ PERF_TEST_P(GoodFeaturesToTrackFixture, GoodFeaturesToTrack,
else
if
(
RUN_PLAIN_IMPL
)
else
if
(
RUN_PLAIN_IMPL
)
{
{
TEST_CYCLE
()
cv
::
goodFeaturesToTrack
(
frame
,
pts_gold
,
TEST_CYCLE
()
cv
::
goodFeaturesToTrack
(
frame
,
pts_gold
,
maxCorners
,
qualityLevel
,
minDistance
);
maxCorners
,
qualityLevel
,
minDistance
,
noArray
(),
3
,
harrisDetector
);
SANITY_CHECK
(
pts_gold
);
SANITY_CHECK
(
pts_gold
);
}
}
...
...
modules/ocl/perf/perf_haar.cpp
View file @
ba451350
...
@@ -46,8 +46,13 @@
...
@@ -46,8 +46,13 @@
#include "perf_precomp.hpp"
#include "perf_precomp.hpp"
using
namespace
perf
;
using
namespace
perf
;
using
namespace
std
;
using
namespace
cv
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
get
;
///////////// Haar ////////////////////////
///////////// Haar ////////////////////////
PERF_TEST
(
HaarFixture
,
Haar
)
PERF_TEST
(
HaarFixture
,
Haar
)
{
{
vector
<
Rect
>
faces
;
vector
<
Rect
>
faces
;
...
@@ -84,23 +89,16 @@ PERF_TEST(HaarFixture, Haar)
...
@@ -84,23 +89,16 @@ PERF_TEST(HaarFixture, Haar)
OCL_PERF_ELSE
OCL_PERF_ELSE
}
}
using
namespace
std
;
typedef
std
::
tr1
::
tuple
<
std
::
string
,
std
::
string
,
int
>
Cascade_Image_MinSize_t
;
using
namespace
cv
;
typedef
perf
::
TestBaseWithParam
<
Cascade_Image_MinSize_t
>
Cascade_Image_MinSize
;
using
namespace
perf
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
get
;
typedef
std
::
tr1
::
tuple
<
std
::
string
,
std
::
string
,
int
>
OCL_Cascade_Image_MinSize_t
;
typedef
perf
::
TestBaseWithParam
<
OCL_Cascade_Image_MinSize_t
>
OCL_Cascade_Image_MinSize
;
PERF_TEST_P
(
OCL_Cascade_Image_MinSize
,
CascadeClassifier
,
OCL_PERF_TEST_P
(
Cascade_Image_MinSize
,
DISABLED_CascadeClassifier
,
testing
::
Combine
(
testing
::
Combine
(
testing
::
Values
(
string
(
"cv/cascadeandhog/cascades/haarcascade_frontalface_alt.xml"
),
testing
::
Values
(
string
(
"cv/cascadeandhog/cascades/haarcascade_frontalface_alt.xml"
),
string
(
"cv/cascadeandhog/cascades/haarcascade_frontalface_alt2.xml"
)
),
string
(
"cv/cascadeandhog/cascades/haarcascade_frontalface_alt2.xml"
)
),
testing
::
Values
(
string
(
"cv/shared/lena.png"
),
testing
::
Values
(
string
(
"cv/shared/lena.png"
),
string
(
"cv/cascadeandhog/images/bttf301.png"
)
/*,
string
(
"cv/cascadeandhog/images/bttf301.png"
)
/*,
string("cv/cascadeandhog/images/class57.png")*/
),
string("cv/cascadeandhog/images/class57.png")*/
),
testing
::
Values
(
30
,
64
,
90
)
)
)
testing
::
Values
(
30
,
64
,
90
))
)
{
{
const
string
cascasePath
=
get
<
0
>
(
GetParam
());
const
string
cascasePath
=
get
<
0
>
(
GetParam
());
const
string
imagePath
=
get
<
1
>
(
GetParam
());
const
string
imagePath
=
get
<
1
>
(
GetParam
());
...
@@ -109,7 +107,7 @@ PERF_TEST_P( OCL_Cascade_Image_MinSize, CascadeClassifier,
...
@@ -109,7 +107,7 @@ PERF_TEST_P( OCL_Cascade_Image_MinSize, CascadeClassifier,
vector
<
Rect
>
faces
;
vector
<
Rect
>
faces
;
Mat
img
=
imread
(
getDataPath
(
imagePath
),
IMREAD_GRAYSCALE
);
Mat
img
=
imread
(
getDataPath
(
imagePath
),
IMREAD_GRAYSCALE
);
ASSERT_
TRUE
(
!
img
.
empty
())
<<
"Can't load source image: "
<<
getDataPath
(
imagePath
);
ASSERT_
FALSE
(
img
.
empty
())
<<
"Can't load source image: "
<<
getDataPath
(
imagePath
);
equalizeHist
(
img
,
img
);
equalizeHist
(
img
,
img
);
declare
.
in
(
img
);
declare
.
in
(
img
);
...
...
modules/ocl/perf/perf_hog.cpp
View file @
ba451350
...
@@ -43,7 +43,9 @@
...
@@ -43,7 +43,9 @@
// the use of this software, even if advised of the possibility of such damage.
// the use of this software, even if advised of the possibility of such damage.
//
//
//M*/
//M*/
#include "perf_precomp.hpp"
#include "perf_precomp.hpp"
#include <functional>
using
namespace
perf
;
using
namespace
perf
;
...
@@ -66,13 +68,13 @@ struct RectLess :
...
@@ -66,13 +68,13 @@ struct RectLess :
}
}
};
};
PERF_TEST
(
HOGFixture
,
HOG
)
OCL_
PERF_TEST
(
HOGFixture
,
HOG
)
{
{
Mat
src
=
imread
(
getDataPath
(
"gpu/hog/road.png"
),
cv
::
IMREAD_GRAYSCALE
);
Mat
src
=
imread
(
getDataPath
(
"gpu/hog/road.png"
),
cv
::
IMREAD_GRAYSCALE
);
ASSERT_TRUE
(
!
src
.
empty
())
<<
"can't open input image road.png"
;
ASSERT_TRUE
(
!
src
.
empty
())
<<
"can't open input image road.png"
;
vector
<
cv
::
Rect
>
found_locations
;
vector
<
cv
::
Rect
>
found_locations
;
declare
.
in
(
src
)
.
time
(
5
)
;
declare
.
in
(
src
);
if
(
RUN_PLAIN_IMPL
)
if
(
RUN_PLAIN_IMPL
)
{
{
...
...
modules/ocl/perf/perf_imgproc.cpp
View file @
ba451350
...
@@ -51,9 +51,9 @@ using std::tr1::get;
...
@@ -51,9 +51,9 @@ using std::tr1::get;
///////////// equalizeHist ////////////////////////
///////////// equalizeHist ////////////////////////
typedef
TestBaseWithParam
<
Size
>
e
qualizeHistFixture
;
typedef
TestBaseWithParam
<
Size
>
E
qualizeHistFixture
;
PERF_TEST_P
(
equalizeHistFixture
,
equalizeHist
,
OCL_TYPICAL_MA
T_SIZES
)
OCL_PERF_TEST_P
(
EqualizeHistFixture
,
EqualizeHist
,
OCL_TES
T_SIZES
)
{
{
const
Size
srcSize
=
GetParam
();
const
Size
srcSize
=
GetParam
();
const
double
eps
=
1
+
DBL_EPSILON
;
const
double
eps
=
1
+
DBL_EPSILON
;
...
@@ -83,16 +83,13 @@ PERF_TEST_P(equalizeHistFixture, equalizeHist, OCL_TYPICAL_MAT_SIZES)
...
@@ -83,16 +83,13 @@ PERF_TEST_P(equalizeHistFixture, equalizeHist, OCL_TYPICAL_MAT_SIZES)
/////////// CopyMakeBorder //////////////////////
/////////// CopyMakeBorder //////////////////////
CV_ENUM
(
Border
,
BORDER_CONSTANT
,
BORDER_REPLICATE
,
BORDER_REFLECT
,
CV_ENUM
(
Border
,
BORDER_CONSTANT
,
BORDER_REPLICATE
,
BORDER_REFLECT
,
BORDER_WRAP
,
BORDER_REFLECT_101
)
BORDER_WRAP
,
BORDER_REFLECT_101
)
typedef
tuple
<
Size
,
MatType
,
Border
>
CopyMakeBorderParamType
;
typedef
tuple
<
Size
,
MatType
,
Border
>
CopyMakeBorderParamType
;
typedef
TestBaseWithParam
<
CopyMakeBorderParamType
>
CopyMakeBorderFixture
;
typedef
TestBaseWithParam
<
CopyMakeBorderParamType
>
CopyMakeBorderFixture
;
PERF_TEST_P
(
CopyMakeBorderFixture
,
CopyMakeBorder
,
OCL_PERF_TEST_P
(
CopyMakeBorderFixture
,
CopyMakeBorder
,
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
,
Border
::
all
()))
OCL_PERF_ENUM
(
CV_8UC1
,
CV_8UC4
),
Border
::
all
()))
{
{
const
CopyMakeBorderParamType
params
=
GetParam
();
const
CopyMakeBorderParamType
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
...
@@ -125,11 +122,10 @@ PERF_TEST_P(CopyMakeBorderFixture, CopyMakeBorder,
...
@@ -125,11 +122,10 @@ PERF_TEST_P(CopyMakeBorderFixture, CopyMakeBorder,
///////////// cornerMinEigenVal ////////////////////////
///////////// cornerMinEigenVal ////////////////////////
typedef
Size_MatType
c
ornerMinEigenValFixture
;
typedef
Size_MatType
C
ornerMinEigenValFixture
;
PERF_TEST_P
(
cornerMinEigenValFixture
,
cornerMinEigenVal
,
OCL_PERF_TEST_P
(
CornerMinEigenValFixture
,
CornerMinEigenVal
,
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_32FC1
)))
OCL_PERF_ENUM
(
CV_8UC1
,
CV_32FC1
)))
{
{
const
Size_MatType_t
params
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
...
@@ -137,8 +133,7 @@ PERF_TEST_P(cornerMinEigenValFixture, cornerMinEigenVal,
...
@@ -137,8 +133,7 @@ PERF_TEST_P(cornerMinEigenValFixture, cornerMinEigenVal,
const
int
blockSize
=
7
,
apertureSize
=
1
+
2
*
3
;
const
int
blockSize
=
7
,
apertureSize
=
1
+
2
*
3
;
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
CV_32FC1
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
CV_32FC1
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
)
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
.
time
(
srcSize
==
OCL_SIZE_4000
?
20
:
srcSize
==
OCL_SIZE_2000
?
5
:
3
);
const
int
depth
=
CV_MAT_DEPTH
(
type
);
const
int
depth
=
CV_MAT_DEPTH
(
type
);
const
ERROR_TYPE
errorType
=
depth
==
CV_8U
?
ERROR_ABSOLUTE
:
ERROR_RELATIVE
;
const
ERROR_TYPE
errorType
=
depth
==
CV_8U
?
ERROR_ABSOLUTE
:
ERROR_RELATIVE
;
...
@@ -165,11 +160,10 @@ PERF_TEST_P(cornerMinEigenValFixture, cornerMinEigenVal,
...
@@ -165,11 +160,10 @@ PERF_TEST_P(cornerMinEigenValFixture, cornerMinEigenVal,
///////////// cornerHarris ////////////////////////
///////////// cornerHarris ////////////////////////
typedef
Size_MatType
c
ornerHarrisFixture
;
typedef
Size_MatType
C
ornerHarrisFixture
;
PERF_TEST_P
(
cornerHarrisFixture
,
cornerHarris
,
OCL_PERF_TEST_P
(
CornerHarrisFixture
,
CornerHarris
,
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_32FC1
)))
OCL_PERF_ENUM
(
CV_8UC1
,
CV_32FC1
)))
{
{
const
Size_MatType_t
params
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
...
@@ -177,8 +171,7 @@ PERF_TEST_P(cornerHarrisFixture, cornerHarris,
...
@@ -177,8 +171,7 @@ PERF_TEST_P(cornerHarrisFixture, cornerHarris,
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
CV_32FC1
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
CV_32FC1
);
randu
(
src
,
0
,
1
);
randu
(
src
,
0
,
1
);
declare
.
in
(
src
).
out
(
dst
)
declare
.
in
(
src
).
out
(
dst
);
.
time
(
srcSize
==
OCL_SIZE_4000
?
20
:
srcSize
==
OCL_SIZE_2000
?
5
:
3
);
if
(
RUN_OCL_IMPL
)
if
(
RUN_OCL_IMPL
)
{
{
...
@@ -202,11 +195,14 @@ PERF_TEST_P(cornerHarrisFixture, cornerHarris,
...
@@ -202,11 +195,14 @@ PERF_TEST_P(cornerHarrisFixture, cornerHarris,
///////////// integral ////////////////////////
///////////// integral ////////////////////////
typedef
TestBaseWithParam
<
Size
>
integralFixture
;
typedef
tuple
<
Size
,
MatDepth
>
IntegralParams
;
typedef
TestBaseWithParam
<
IntegralParams
>
IntegralFixture
;
PERF_TEST_P
(
integralFixture
,
integral
,
OCL_TYPICAL_MAT_SIZES
)
OCL_PERF_TEST_P
(
IntegralFixture
,
Integral1
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_PERF_ENUM
(
CV_32S
,
CV_32F
))
)
{
{
const
Size
srcSize
=
GetParam
();
const
IntegralParams
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
sdepth
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
CV_8UC1
),
dst
;
Mat
src
(
srcSize
,
CV_8UC1
),
dst
;
declare
.
in
(
src
,
WARMUP_RNG
);
declare
.
in
(
src
,
WARMUP_RNG
);
...
@@ -215,17 +211,17 @@ PERF_TEST_P(integralFixture, integral, OCL_TYPICAL_MAT_SIZES)
...
@@ -215,17 +211,17 @@ PERF_TEST_P(integralFixture, integral, OCL_TYPICAL_MAT_SIZES)
{
{
ocl
::
oclMat
oclSrc
(
src
),
oclDst
;
ocl
::
oclMat
oclSrc
(
src
),
oclDst
;
OCL_TEST_CYCLE
()
cv
::
ocl
::
integral
(
oclSrc
,
oclDst
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
integral
(
oclSrc
,
oclDst
,
sdepth
);
oclDst
.
download
(
dst
);
oclDst
.
download
(
dst
);
SANITY_CHECK
(
dst
);
SANITY_CHECK
(
dst
,
1e-6
,
ERROR_RELATIVE
);
}
}
else
if
(
RUN_PLAIN_IMPL
)
else
if
(
RUN_PLAIN_IMPL
)
{
{
TEST_CYCLE
()
cv
::
integral
(
src
,
dst
);
TEST_CYCLE
()
cv
::
integral
(
src
,
dst
,
sdepth
);
SANITY_CHECK
(
dst
);
SANITY_CHECK
(
dst
,
1e-6
,
ERROR_RELATIVE
);
}
}
else
else
OCL_PERF_ELSE
OCL_PERF_ELSE
...
@@ -233,15 +229,13 @@ PERF_TEST_P(integralFixture, integral, OCL_TYPICAL_MAT_SIZES)
...
@@ -233,15 +229,13 @@ PERF_TEST_P(integralFixture, integral, OCL_TYPICAL_MAT_SIZES)
///////////// threshold////////////////////////
///////////// threshold////////////////////////
CV_ENUM
(
ThreshType
,
THRESH_BINARY
,
THRESH_TOZERO_INV
)
CV_ENUM
(
ThreshType
,
THRESH_BINARY
,
THRESH_
BINARY_INV
,
THRESH_TRUNC
,
THRESH_
TOZERO_INV
)
typedef
tuple
<
Size
,
MatType
,
ThreshType
>
ThreshParams
;
typedef
tuple
<
Size
,
MatType
,
ThreshType
>
ThreshParams
;
typedef
TestBaseWithParam
<
ThreshParams
>
ThreshFixture
;
typedef
TestBaseWithParam
<
ThreshParams
>
ThreshFixture
;
PERF_TEST_P
(
ThreshFixture
,
threshold
,
OCL_PERF_TEST_P
(
ThreshFixture
,
Threshold
,
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
,
ThreshType
::
all
()))
OCL_PERF_ENUM
(
CV_8UC1
,
CV_8UC4
,
CV_16SC1
,
CV_16SC4
,
CV_32FC1
),
ThreshType
::
all
()))
{
{
const
ThreshParams
params
=
GetParam
();
const
ThreshParams
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
...
@@ -463,9 +457,9 @@ static void meanShiftFiltering_(const Mat &src_roi, Mat &dst_roi, int sp, int sr
...
@@ -463,9 +457,9 @@ static void meanShiftFiltering_(const Mat &src_roi, Mat &dst_roi, int sp, int sr
}
}
}
}
typedef
TestBaseWithParam
<
Size
>
m
eanShiftFilteringFixture
;
typedef
TestBaseWithParam
<
Size
>
M
eanShiftFilteringFixture
;
PERF_TEST_P
(
meanShiftFilteringFixture
,
m
eanShiftFiltering
,
PERF_TEST_P
(
MeanShiftFilteringFixture
,
M
eanShiftFiltering
,
OCL_TYPICAL_MAT_SIZES
)
OCL_TYPICAL_MAT_SIZES
)
{
{
const
Size
srcSize
=
GetParam
();
const
Size
srcSize
=
GetParam
();
...
@@ -473,9 +467,7 @@ PERF_TEST_P(meanShiftFilteringFixture, meanShiftFiltering,
...
@@ -473,9 +467,7 @@ PERF_TEST_P(meanShiftFilteringFixture, meanShiftFiltering,
cv
::
TermCriteria
crit
(
cv
::
TermCriteria
::
COUNT
+
cv
::
TermCriteria
::
EPS
,
5
,
1
);
cv
::
TermCriteria
crit
(
cv
::
TermCriteria
::
COUNT
+
cv
::
TermCriteria
::
EPS
,
5
,
1
);
Mat
src
(
srcSize
,
CV_8UC4
),
dst
(
srcSize
,
CV_8UC4
);
Mat
src
(
srcSize
,
CV_8UC4
),
dst
(
srcSize
,
CV_8UC4
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
)
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
.
time
(
srcSize
==
OCL_SIZE_4000
?
56
:
srcSize
==
OCL_SIZE_2000
?
15
:
3.8
);
if
(
RUN_PLAIN_IMPL
)
if
(
RUN_PLAIN_IMPL
)
{
{
...
@@ -556,9 +548,9 @@ static void meanShiftProc_(const Mat &src_roi, Mat &dst_roi, Mat &dstCoor_roi, i
...
@@ -556,9 +548,9 @@ static void meanShiftProc_(const Mat &src_roi, Mat &dst_roi, Mat &dstCoor_roi, i
}
}
typedef
TestBaseWithParam
<
Size
>
m
eanShiftProcFixture
;
typedef
TestBaseWithParam
<
Size
>
M
eanShiftProcFixture
;
PERF_TEST_P
(
meanShiftProcFixture
,
m
eanShiftProc
,
PERF_TEST_P
(
MeanShiftProcFixture
,
M
eanShiftProc
,
OCL_TYPICAL_MAT_SIZES
)
OCL_TYPICAL_MAT_SIZES
)
{
{
const
Size
srcSize
=
GetParam
();
const
Size
srcSize
=
GetParam
();
...
@@ -566,9 +558,7 @@ PERF_TEST_P(meanShiftProcFixture, meanShiftProc,
...
@@ -566,9 +558,7 @@ PERF_TEST_P(meanShiftProcFixture, meanShiftProc,
Mat
src
(
srcSize
,
CV_8UC4
),
dst1
(
srcSize
,
CV_8UC4
),
Mat
src
(
srcSize
,
CV_8UC4
),
dst1
(
srcSize
,
CV_8UC4
),
dst2
(
srcSize
,
CV_16SC2
);
dst2
(
srcSize
,
CV_16SC2
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst1
,
dst2
)
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst1
,
dst2
);
.
time
(
srcSize
==
OCL_SIZE_4000
?
56
:
srcSize
==
OCL_SIZE_2000
?
15
:
3.8
);;
if
(
RUN_PLAIN_IMPL
)
if
(
RUN_PLAIN_IMPL
)
{
{
...
@@ -598,7 +588,7 @@ PERF_TEST_P(meanShiftProcFixture, meanShiftProc,
...
@@ -598,7 +588,7 @@ PERF_TEST_P(meanShiftProcFixture, meanShiftProc,
typedef
TestBaseWithParam
<
Size
>
CLAHEFixture
;
typedef
TestBaseWithParam
<
Size
>
CLAHEFixture
;
PERF_TEST_P
(
CLAHEFixture
,
CLAHE
,
OCL_TYPICAL_MA
T_SIZES
)
OCL_PERF_TEST_P
(
CLAHEFixture
,
CLAHE
,
OCL_TES
T_SIZES
)
{
{
const
Size
srcSize
=
GetParam
();
const
Size
srcSize
=
GetParam
();
const
string
impl
=
getSelectedImpl
();
const
string
impl
=
getSelectedImpl
();
...
@@ -607,9 +597,6 @@ PERF_TEST_P(CLAHEFixture, CLAHE, OCL_TYPICAL_MAT_SIZES)
...
@@ -607,9 +597,6 @@ PERF_TEST_P(CLAHEFixture, CLAHE, OCL_TYPICAL_MAT_SIZES)
const
double
clipLimit
=
40.0
;
const
double
clipLimit
=
40.0
;
declare
.
in
(
src
,
WARMUP_RNG
);
declare
.
in
(
src
,
WARMUP_RNG
);
if
(
srcSize
==
OCL_SIZE_4000
)
declare
.
time
(
11
);
if
(
RUN_OCL_IMPL
)
if
(
RUN_OCL_IMPL
)
{
{
ocl
::
oclMat
oclSrc
(
src
),
oclDst
;
ocl
::
oclMat
oclSrc
(
src
),
oclDst
;
...
@@ -632,9 +619,9 @@ PERF_TEST_P(CLAHEFixture, CLAHE, OCL_TYPICAL_MAT_SIZES)
...
@@ -632,9 +619,9 @@ PERF_TEST_P(CLAHEFixture, CLAHE, OCL_TYPICAL_MAT_SIZES)
OCL_PERF_ELSE
OCL_PERF_ELSE
}
}
/////////////
c
olumnSum////////////////////////
/////////////
C
olumnSum////////////////////////
typedef
TestBaseWithParam
<
Size
>
c
olumnSumFixture
;
typedef
TestBaseWithParam
<
Size
>
C
olumnSumFixture
;
static
void
columnSumPerfTest
(
const
Mat
&
src
,
Mat
&
dst
)
static
void
columnSumPerfTest
(
const
Mat
&
src
,
Mat
&
dst
)
{
{
...
@@ -646,16 +633,13 @@ static void columnSumPerfTest(const Mat & src, Mat & dst)
...
@@ -646,16 +633,13 @@ static void columnSumPerfTest(const Mat & src, Mat & dst)
dst
.
at
<
float
>
(
i
,
j
)
=
dst
.
at
<
float
>
(
i
-
1
,
j
)
+
src
.
at
<
float
>
(
i
,
j
);
dst
.
at
<
float
>
(
i
,
j
)
=
dst
.
at
<
float
>
(
i
-
1
,
j
)
+
src
.
at
<
float
>
(
i
,
j
);
}
}
PERF_TEST_P
(
columnSumFixture
,
c
olumnSum
,
OCL_TYPICAL_MAT_SIZES
)
PERF_TEST_P
(
ColumnSumFixture
,
C
olumnSum
,
OCL_TYPICAL_MAT_SIZES
)
{
{
const
Size
srcSize
=
GetParam
();
const
Size
srcSize
=
GetParam
();
Mat
src
(
srcSize
,
CV_32FC1
),
dst
(
srcSize
,
CV_32FC1
);
Mat
src
(
srcSize
,
CV_32FC1
),
dst
(
srcSize
,
CV_32FC1
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
if
(
srcSize
==
OCL_SIZE_4000
)
declare
.
time
(
5
);
if
(
RUN_OCL_IMPL
)
if
(
RUN_OCL_IMPL
)
{
{
ocl
::
oclMat
oclSrc
(
src
),
oclDst
(
srcSize
,
CV_32FC1
);
ocl
::
oclMat
oclSrc
(
src
),
oclDst
(
srcSize
,
CV_32FC1
);
...
@@ -680,8 +664,8 @@ PERF_TEST_P(columnSumFixture, columnSum, OCL_TYPICAL_MAT_SIZES)
...
@@ -680,8 +664,8 @@ PERF_TEST_P(columnSumFixture, columnSum, OCL_TYPICAL_MAT_SIZES)
CV_ENUM
(
DistType
,
NORM_L1
,
NORM_L2SQR
)
CV_ENUM
(
DistType
,
NORM_L1
,
NORM_L2SQR
)
typedef
tuple
<
Size
,
DistType
>
distanceToCentersParameter
s
;
typedef
tuple
<
Size
,
DistType
>
DistanceToCentersParam
s
;
typedef
TestBaseWithParam
<
distanceToCentersParameters
>
d
istanceToCentersFixture
;
typedef
TestBaseWithParam
<
DistanceToCentersParams
>
D
istanceToCentersFixture
;
static
void
distanceToCentersPerfTest
(
Mat
&
src
,
Mat
&
centers
,
Mat
&
dists
,
Mat
&
labels
,
int
distType
)
static
void
distanceToCentersPerfTest
(
Mat
&
src
,
Mat
&
centers
,
Mat
&
dists
,
Mat
&
labels
,
int
distType
)
{
{
...
@@ -706,10 +690,11 @@ static void distanceToCentersPerfTest(Mat& src, Mat& centers, Mat& dists, Mat& l
...
@@ -706,10 +690,11 @@ static void distanceToCentersPerfTest(Mat& src, Mat& centers, Mat& dists, Mat& l
Mat
(
labels_v
).
copyTo
(
labels
);
Mat
(
labels_v
).
copyTo
(
labels
);
}
}
PERF_TEST_P
(
distanceToCentersFixture
,
d
istanceToCenters
,
::
testing
::
Combine
(
::
testing
::
Values
(
cv
::
Size
(
256
,
256
),
cv
::
Size
(
512
,
512
)),
DistType
::
all
())
)
PERF_TEST_P
(
DistanceToCentersFixture
,
D
istanceToCenters
,
::
testing
::
Combine
(
::
testing
::
Values
(
cv
::
Size
(
256
,
256
),
cv
::
Size
(
512
,
512
)),
DistType
::
all
())
)
{
{
Size
size
=
get
<
0
>
(
GetParam
());
const
DistanceToCentersParams
params
=
GetParam
();
int
distType
=
get
<
1
>
(
GetParam
());
Size
size
=
get
<
0
>
(
params
);
int
distType
=
get
<
1
>
(
params
);
Mat
src
(
size
,
CV_32FC1
),
centers
(
size
,
CV_32FC1
);
Mat
src
(
size
,
CV_32FC1
),
centers
(
size
,
CV_32FC1
);
Mat
dists
(
src
.
rows
,
1
,
CV_32FC1
),
labels
(
src
.
rows
,
1
,
CV_32SC1
);
Mat
dists
(
src
.
rows
,
1
,
CV_32FC1
),
labels
(
src
.
rows
,
1
,
CV_32SC1
);
...
...
modules/ocl/perf/perf_imgwarp.cpp
View file @
ba451350
...
@@ -51,11 +51,13 @@ using std::tr1::get;
...
@@ -51,11 +51,13 @@ using std::tr1::get;
///////////// WarpAffine ////////////////////////
///////////// WarpAffine ////////////////////////
typedef
Size_MatType
WarpAffineFixture
;
CV_ENUM
(
InterType
,
INTER_NEAREST
,
INTER_LINEAR
)
PERF_TEST_P
(
WarpAffineFixture
,
WarpAffine
,
typedef
tuple
<
Size
,
MatType
,
InterType
>
WarpAffineParams
;
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
typedef
TestBaseWithParam
<
WarpAffineParams
>
WarpAffineFixture
;
OCL_PERF_ENUM
(
CV_8UC1
,
CV_8UC4
)))
OCL_PERF_TEST_P
(
WarpAffineFixture
,
WarpAffine
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES_134
,
InterType
::
all
()))
{
{
static
const
double
coeffs
[
2
][
3
]
=
static
const
double
coeffs
[
2
][
3
]
=
{
{
...
@@ -63,11 +65,12 @@ PERF_TEST_P(WarpAffineFixture, WarpAffine,
...
@@ -63,11 +65,12 @@ PERF_TEST_P(WarpAffineFixture, WarpAffine,
{
sin
(
CV_PI
/
6
),
cos
(
CV_PI
/
6
),
-
100.0
}
{
sin
(
CV_PI
/
6
),
cos
(
CV_PI
/
6
),
-
100.0
}
};
};
Mat
M
(
2
,
3
,
CV_64F
,
(
void
*
)
coeffs
);
Mat
M
(
2
,
3
,
CV_64F
,
(
void
*
)
coeffs
);
const
int
interpolation
=
INTER_NEAREST
;
const
Size_MatType_t
params
=
GetParam
();
const
WarpAffineParams
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
const
int
type
=
get
<
1
>
(
params
),
interpolation
=
get
<
2
>
(
params
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
...
@@ -80,13 +83,13 @@ PERF_TEST_P(WarpAffineFixture, WarpAffine,
...
@@ -80,13 +83,13 @@ PERF_TEST_P(WarpAffineFixture, WarpAffine,
oclDst
.
download
(
dst
);
oclDst
.
download
(
dst
);
SANITY_CHECK
(
dst
);
SANITY_CHECK
(
dst
,
5e-4
);
}
}
else
if
(
RUN_PLAIN_IMPL
)
else
if
(
RUN_PLAIN_IMPL
)
{
{
TEST_CYCLE
()
cv
::
warpAffine
(
src
,
dst
,
M
,
srcSize
,
interpolation
);
TEST_CYCLE
()
cv
::
warpAffine
(
src
,
dst
,
M
,
srcSize
,
interpolation
);
SANITY_CHECK
(
dst
);
SANITY_CHECK
(
dst
,
5e-4
);
}
}
else
else
OCL_PERF_ELSE
OCL_PERF_ELSE
...
@@ -94,11 +97,11 @@ PERF_TEST_P(WarpAffineFixture, WarpAffine,
...
@@ -94,11 +97,11 @@ PERF_TEST_P(WarpAffineFixture, WarpAffine,
///////////// WarpPerspective ////////////////////////
///////////// WarpPerspective ////////////////////////
typedef
Size_MatType
WarpPerspectiveFixture
;
typedef
WarpAffineParams
WarpPerspectiveParams
;
typedef
TestBaseWithParam
<
WarpPerspectiveParams
>
WarpPerspectiveFixture
;
PERF_TEST_P
(
WarpPerspectiveFixture
,
WarpPerspective
,
OCL_PERF_TEST_P
(
WarpPerspectiveFixture
,
WarpPerspective
,
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES_134
,
InterType
::
all
()))
OCL_PERF_ENUM
(
CV_8UC1
,
CV_8UC4
)))
{
{
static
const
double
coeffs
[
3
][
3
]
=
static
const
double
coeffs
[
3
][
3
]
=
{
{
...
@@ -107,15 +110,15 @@ PERF_TEST_P(WarpPerspectiveFixture, WarpPerspective,
...
@@ -107,15 +110,15 @@ PERF_TEST_P(WarpPerspectiveFixture, WarpPerspective,
{
0.0
,
0.0
,
1.0
}
{
0.0
,
0.0
,
1.0
}
};
};
Mat
M
(
3
,
3
,
CV_64F
,
(
void
*
)
coeffs
);
Mat
M
(
3
,
3
,
CV_64F
,
(
void
*
)
coeffs
);
const
int
interpolation
=
INTER_LINEAR
;
const
Size_MatType_t
params
=
GetParam
();
const
WarpPerspectiveParams
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
const
int
type
=
get
<
1
>
(
params
),
interpolation
=
get
<
2
>
(
params
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
)
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
.
time
(
srcSize
==
OCL_SIZE_4000
?
18
:
srcSize
==
OCL_SIZE_2000
?
5
:
2
);
if
(
RUN_OCL_IMPL
)
if
(
RUN_OCL_IMPL
)
{
{
...
@@ -125,32 +128,28 @@ PERF_TEST_P(WarpPerspectiveFixture, WarpPerspective,
...
@@ -125,32 +128,28 @@ PERF_TEST_P(WarpPerspectiveFixture, WarpPerspective,
oclDst
.
download
(
dst
);
oclDst
.
download
(
dst
);
SANITY_CHECK
(
dst
);
SANITY_CHECK
(
dst
,
5e-4
);
}
}
else
if
(
RUN_PLAIN_IMPL
)
else
if
(
RUN_PLAIN_IMPL
)
{
{
TEST_CYCLE
()
cv
::
warpPerspective
(
src
,
dst
,
M
,
srcSize
,
interpolation
);
TEST_CYCLE
()
cv
::
warpPerspective
(
src
,
dst
,
M
,
srcSize
,
interpolation
);
SANITY_CHECK
(
dst
);
SANITY_CHECK
(
dst
,
5e-4
);
}
}
else
else
OCL_PERF_ELSE
OCL_PERF_ELSE
}
}
/////////////
r
esize ////////////////////////
/////////////
R
esize ////////////////////////
CV_ENUM
(
resizeInterType
,
INTER_NEAREST
,
INTER_LINEAR
)
typedef
tuple
<
Size
,
MatType
,
InterType
,
double
>
ResizeParams
;
typedef
TestBaseWithParam
<
ResizeParams
>
ResizeFixture
;
typedef
tuple
<
Size
,
MatType
,
resizeInterType
,
double
>
resizeParams
;
OCL_PERF_TEST_P
(
ResizeFixture
,
Resize
,
typedef
TestBaseWithParam
<
resizeParams
>
resizeFixture
;
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES_134
,
InterType
::
all
(),
::
testing
::
Values
(
0.5
,
2.0
)))
PERF_TEST_P
(
resizeFixture
,
resize
,
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_8UC4
),
resizeInterType
::
all
(),
::
testing
::
Values
(
0.5
,
2.0
)))
{
{
const
r
esizeParams
params
=
GetParam
();
const
R
esizeParams
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
),
interType
=
get
<
2
>
(
params
);
const
int
type
=
get
<
1
>
(
params
),
interType
=
get
<
2
>
(
params
);
double
scale
=
get
<
3
>
(
params
);
double
scale
=
get
<
3
>
(
params
);
...
@@ -162,8 +161,6 @@ PERF_TEST_P(resizeFixture, resize,
...
@@ -162,8 +161,6 @@ PERF_TEST_P(resizeFixture, resize,
Mat
src
(
srcSize
,
type
),
dst
;
Mat
src
(
srcSize
,
type
),
dst
;
dst
.
create
(
dstSize
,
type
);
dst
.
create
(
dstSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
if
(
interType
==
INTER_LINEAR
&&
type
==
CV_8UC4
&&
OCL_SIZE_4000
==
srcSize
)
declare
.
time
(
11
);
if
(
RUN_OCL_IMPL
)
if
(
RUN_OCL_IMPL
)
{
{
...
@@ -185,15 +182,13 @@ PERF_TEST_P(resizeFixture, resize,
...
@@ -185,15 +182,13 @@ PERF_TEST_P(resizeFixture, resize,
OCL_PERF_ELSE
OCL_PERF_ELSE
}
}
typedef
tuple
<
Size
,
MatType
,
double
>
r
esizeAreaParams
;
typedef
tuple
<
Size
,
MatType
,
double
>
R
esizeAreaParams
;
typedef
TestBaseWithParam
<
resizeAreaParams
>
r
esizeAreaFixture
;
typedef
TestBaseWithParam
<
ResizeAreaParams
>
R
esizeAreaFixture
;
PERF_TEST_P
(
resizeAreaFixture
,
resize
,
OCL_PERF_TEST_P
(
ResizeAreaFixture
,
Resize
,
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES_134
,
::
testing
::
Values
(
0.3
,
0.5
,
0.6
)))
OCL_PERF_ENUM
(
CV_8UC1
,
CV_8UC4
,
CV_32FC1
,
CV_32FC4
),
::
testing
::
Values
(
0.3
,
0.5
,
0.6
)))
{
{
const
r
esizeAreaParams
params
=
GetParam
();
const
R
esizeAreaParams
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
double
scale
=
get
<
2
>
(
params
);
double
scale
=
get
<
2
>
(
params
);
...
@@ -225,28 +220,21 @@ PERF_TEST_P(resizeAreaFixture, resize,
...
@@ -225,28 +220,21 @@ PERF_TEST_P(resizeAreaFixture, resize,
OCL_PERF_ELSE
OCL_PERF_ELSE
}
}
///////////// remap////////////////////////
///////////// Remap ////////////////////////
CV_ENUM
(
RemapInterType
,
INTER_NEAREST
,
INTER_LINEAR
)
typedef
tuple
<
Size
,
MatType
,
RemapInterType
>
r
emapParams
;
typedef
tuple
<
Size
,
MatType
,
InterType
>
R
emapParams
;
typedef
TestBaseWithParam
<
remapParams
>
r
emapFixture
;
typedef
TestBaseWithParam
<
RemapParams
>
R
emapFixture
;
PERF_TEST_P
(
remapFixture
,
remap
,
OCL_PERF_TEST_P
(
RemapFixture
,
Remap
,
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
,
InterType
::
all
()))
OCL_PERF_ENUM
(
CV_8UC1
,
CV_8UC4
),
RemapInterType
::
all
()))
{
{
const
r
emapParams
params
=
GetParam
();
const
R
emapParams
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
),
interpolation
=
get
<
2
>
(
params
);
const
int
type
=
get
<
1
>
(
params
),
interpolation
=
get
<
2
>
(
params
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
if
(
srcSize
==
OCL_SIZE_4000
&&
interpolation
==
INTER_LINEAR
)
declare
.
time
(
9
);
Mat
xmap
,
ymap
;
Mat
xmap
,
ymap
;
xmap
.
create
(
srcSize
,
CV_32FC1
);
xmap
.
create
(
srcSize
,
CV_32FC1
);
ymap
.
create
(
srcSize
,
CV_32FC1
);
ymap
.
create
(
srcSize
,
CV_32FC1
);
...
@@ -287,7 +275,7 @@ PERF_TEST_P(remapFixture, remap,
...
@@ -287,7 +275,7 @@ PERF_TEST_P(remapFixture, remap,
}
}
/////////////
b
uildWarpPerspectiveMaps ////////////////////////
/////////////
B
uildWarpPerspectiveMaps ////////////////////////
static
void
buildWarpPerspectiveMaps
(
const
Mat
&
M
,
bool
inverse
,
Size
dsize
,
Mat
&
xmap
,
Mat
&
ymap
)
static
void
buildWarpPerspectiveMaps
(
const
Mat
&
M
,
bool
inverse
,
Size
dsize
,
Mat
&
xmap
,
Mat
&
ymap
)
{
{
...
@@ -323,9 +311,9 @@ static void buildWarpPerspectiveMaps(const Mat &M, bool inverse, Size dsize, Mat
...
@@ -323,9 +311,9 @@ static void buildWarpPerspectiveMaps(const Mat &M, bool inverse, Size dsize, Mat
}
}
}
}
typedef
TestBaseWithParam
<
Size
>
b
uildWarpPerspectiveMapsFixture
;
typedef
TestBaseWithParam
<
Size
>
B
uildWarpPerspectiveMapsFixture
;
PERF_TEST_P
(
b
uildWarpPerspectiveMapsFixture
,
Inverse
,
OCL_TYPICAL_MAT_SIZES
)
PERF_TEST_P
(
B
uildWarpPerspectiveMapsFixture
,
Inverse
,
OCL_TYPICAL_MAT_SIZES
)
{
{
static
const
double
coeffs
[
3
][
3
]
=
static
const
double
coeffs
[
3
][
3
]
=
{
{
...
...
modules/ocl/perf/perf_kalman.cpp
View file @
ba451350
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
#include "perf_precomp.hpp"
#include "perf_precomp.hpp"
#ifdef HAVE_CLAMDBLAS
//
#ifdef HAVE_CLAMDBLAS
using
namespace
perf
;
using
namespace
perf
;
using
namespace
std
;
using
namespace
std
;
...
@@ -100,4 +100,4 @@ PERF_TEST_P(KalmanFilterFixture, KalmanFilter,
...
@@ -100,4 +100,4 @@ PERF_TEST_P(KalmanFilterFixture, KalmanFilter,
SANITY_CHECK
(
statePre_
);
SANITY_CHECK
(
statePre_
);
}
}
#endif // HAVE_CLAMDBLAS
//
#endif // HAVE_CLAMDBLAS
modules/ocl/perf/perf_match_template.cpp
View file @
ba451350
...
@@ -43,6 +43,7 @@
...
@@ -43,6 +43,7 @@
// the use of this software, even if advised of the possibility of such damage.
// the use of this software, even if advised of the possibility of such damage.
//
//
//M*/
//M*/
#include "perf_precomp.hpp"
#include "perf_precomp.hpp"
using
namespace
perf
;
using
namespace
perf
;
...
@@ -53,8 +54,8 @@ using std::tr1::get;
...
@@ -53,8 +54,8 @@ using std::tr1::get;
typedef
Size_MatType
CV_TM_CCORRFixture
;
typedef
Size_MatType
CV_TM_CCORRFixture
;
PERF_TEST_P
(
CV_TM_CCORRFixture
,
matchTemplate
,
OCL_
PERF_TEST_P
(
CV_TM_CCORRFixture
,
matchTemplate
,
::
testing
::
Combine
(
::
testing
::
Values
(
OCL_SIZE_1000
,
OCL_SIZE_2000
),
::
testing
::
Combine
(
::
testing
::
Values
(
Size
(
1000
,
1000
),
Size
(
2000
,
2000
)
),
OCL_PERF_ENUM
(
CV_32FC1
,
CV_32FC4
)))
OCL_PERF_ENUM
(
CV_32FC1
,
CV_32FC4
)))
{
{
const
Size_MatType_t
params
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
...
@@ -66,7 +67,7 @@ PERF_TEST_P(CV_TM_CCORRFixture, matchTemplate,
...
@@ -66,7 +67,7 @@ PERF_TEST_P(CV_TM_CCORRFixture, matchTemplate,
Mat
dst
(
dstSize
,
CV_32F
);
Mat
dst
(
dstSize
,
CV_32F
);
randu
(
src
,
0.0
f
,
1.0
f
);
randu
(
src
,
0.0
f
,
1.0
f
);
randu
(
templ
,
0.0
f
,
1.0
f
);
randu
(
templ
,
0.0
f
,
1.0
f
);
declare
.
time
(
srcSize
==
OCL_SIZE_2000
?
20
:
6
).
in
(
src
,
templ
).
out
(
dst
);
declare
.
in
(
src
,
templ
).
out
(
dst
);
if
(
RUN_OCL_IMPL
)
if
(
RUN_OCL_IMPL
)
{
{
...
@@ -90,15 +91,15 @@ PERF_TEST_P(CV_TM_CCORRFixture, matchTemplate,
...
@@ -90,15 +91,15 @@ PERF_TEST_P(CV_TM_CCORRFixture, matchTemplate,
typedef
TestBaseWithParam
<
Size
>
CV_TM_CCORR_NORMEDFixture
;
typedef
TestBaseWithParam
<
Size
>
CV_TM_CCORR_NORMEDFixture
;
PERF_TEST_P
(
CV_TM_CCORR_NORMEDFixture
,
matchTemplate
,
OCL_TYPICAL_MAT_SIZES
)
OCL_PERF_TEST_P
(
CV_TM_CCORR_NORMEDFixture
,
matchTemplate
,
::
testing
::
Values
(
Size
(
1000
,
1000
),
Size
(
2000
,
2000
),
Size
(
4000
,
4000
)))
{
{
const
Size
srcSize
=
GetParam
(),
templSize
(
5
,
5
);
const
Size
srcSize
=
GetParam
(),
templSize
(
5
,
5
);
Mat
src
(
srcSize
,
CV_8UC1
),
templ
(
templSize
,
CV_8UC1
),
dst
;
Mat
src
(
srcSize
,
CV_8UC1
),
templ
(
templSize
,
CV_8UC1
),
dst
;
const
Size
dstSize
(
src
.
cols
-
templ
.
cols
+
1
,
src
.
rows
-
templ
.
rows
+
1
);
const
Size
dstSize
(
src
.
cols
-
templ
.
cols
+
1
,
src
.
rows
-
templ
.
rows
+
1
);
dst
.
create
(
dstSize
,
CV_8UC1
);
dst
.
create
(
dstSize
,
CV_8UC1
);
declare
.
in
(
src
,
templ
,
WARMUP_RNG
).
out
(
dst
)
declare
.
in
(
src
,
templ
,
WARMUP_RNG
).
out
(
dst
);
.
time
(
srcSize
==
OCL_SIZE_2000
?
10
:
srcSize
==
OCL_SIZE_4000
?
23
:
2
);
if
(
RUN_OCL_IMPL
)
if
(
RUN_OCL_IMPL
)
{
{
...
@@ -125,7 +126,7 @@ CV_ENUM(MethodType, TM_SQDIFF, TM_SQDIFF_NORMED, TM_CCORR, TM_CCORR_NORMED, TM_C
...
@@ -125,7 +126,7 @@ CV_ENUM(MethodType, TM_SQDIFF, TM_SQDIFF_NORMED, TM_CCORR, TM_CCORR_NORMED, TM_C
typedef
std
::
tr1
::
tuple
<
Size
,
Size
,
MethodType
>
ImgSize_TmplSize_Method_t
;
typedef
std
::
tr1
::
tuple
<
Size
,
Size
,
MethodType
>
ImgSize_TmplSize_Method_t
;
typedef
TestBaseWithParam
<
ImgSize_TmplSize_Method_t
>
ImgSize_TmplSize_Method
;
typedef
TestBaseWithParam
<
ImgSize_TmplSize_Method_t
>
ImgSize_TmplSize_Method
;
PERF_TEST_P
(
ImgSize_TmplSize_Method
,
MatchTemplate
,
OCL_
PERF_TEST_P
(
ImgSize_TmplSize_Method
,
MatchTemplate
,
::
testing
::
Combine
(
::
testing
::
Combine
(
testing
::
Values
(
szSmall128
,
cv
::
Size
(
320
,
240
),
testing
::
Values
(
szSmall128
,
cv
::
Size
(
320
,
240
),
cv
::
Size
(
640
,
480
),
cv
::
Size
(
800
,
600
),
cv
::
Size
(
640
,
480
),
cv
::
Size
(
800
,
600
),
...
...
modules/ocl/perf/perf_matrix_operation.cpp
View file @
ba451350
...
@@ -53,9 +53,7 @@ using std::tr1::get;
...
@@ -53,9 +53,7 @@ using std::tr1::get;
typedef
Size_MatType
ConvertToFixture
;
typedef
Size_MatType
ConvertToFixture
;
PERF_TEST_P
(
ConvertToFixture
,
ConvertTo
,
OCL_PERF_TEST_P
(
ConvertToFixture
,
ConvertTo
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
))
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_8UC4
)))
{
{
const
Size_MatType_t
params
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
...
@@ -92,11 +90,9 @@ PERF_TEST_P(ConvertToFixture, ConvertTo,
...
@@ -92,11 +90,9 @@ PERF_TEST_P(ConvertToFixture, ConvertTo,
///////////// copyTo////////////////////////
///////////// copyTo////////////////////////
typedef
Size_MatType
c
opyToFixture
;
typedef
Size_MatType
C
opyToFixture
;
PERF_TEST_P
(
copyToFixture
,
copyTo
,
OCL_PERF_TEST_P
(
CopyToFixture
,
CopyTo
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
))
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_8UC4
)))
{
{
const
Size_MatType_t
params
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
...
@@ -127,11 +123,9 @@ PERF_TEST_P(copyToFixture, copyTo,
...
@@ -127,11 +123,9 @@ PERF_TEST_P(copyToFixture, copyTo,
///////////// setTo////////////////////////
///////////// setTo////////////////////////
typedef
Size_MatType
s
etToFixture
;
typedef
Size_MatType
S
etToFixture
;
PERF_TEST_P
(
setToFixture
,
setTo
,
OCL_PERF_TEST_P
(
SetToFixture
,
SetTo
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
))
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_8UC4
)))
{
{
const
Size_MatType_t
params
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
...
@@ -164,16 +158,16 @@ PERF_TEST_P(setToFixture, setTo,
...
@@ -164,16 +158,16 @@ PERF_TEST_P(setToFixture, setTo,
/////////////////// upload ///////////////////////////
/////////////////// upload ///////////////////////////
typedef tuple<Size, MatDepth, int>
u
ploadParams;
typedef tuple<Size, MatDepth, int>
U
ploadParams;
typedef TestBaseWithParam<uploadParams>
u
ploadFixture;
typedef TestBaseWithParam<uploadParams>
U
ploadFixture;
PERF_TEST_P(
uploadFixture, u
pload,
PERF_TEST_P(
UploadFixture, U
pload,
testing::Combine(
testing::Combine(
OCL_TYPICAL_MAT_SIZES,
OCL_TYPICAL_MAT_SIZES,
testing::Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F),
testing::Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F),
testing::Range(1, 5)))
testing::Range(1, 5)))
{
{
const
u
ploadParams params = GetParam();
const
U
ploadParams params = GetParam();
const Size srcSize = get<0>(params);
const Size srcSize = get<0>(params);
const int depth = get<1>(params), cn = get<2>(params);
const int depth = get<1>(params), cn = get<2>(params);
const int type = CV_MAKE_TYPE(depth, cn);
const int type = CV_MAKE_TYPE(depth, cn);
...
@@ -201,15 +195,15 @@ PERF_TEST_P(uploadFixture, upload,
...
@@ -201,15 +195,15 @@ PERF_TEST_P(uploadFixture, upload,
/////////////////// download ///////////////////////////
/////////////////// download ///////////////////////////
typedef TestBaseWithParam<uploadParams>
d
ownloadFixture;
typedef TestBaseWithParam<uploadParams>
D
ownloadFixture;
PERF_TEST_P(
downloadFixture, d
ownload,
PERF_TEST_P(
DownloadFixture, D
ownload,
testing::Combine(
testing::Combine(
OCL_TYPICAL_MAT_SIZES,
OCL_TYPICAL_MAT_SIZES,
testing::Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F),
testing::Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F),
testing::Range(1, 5)))
testing::Range(1, 5)))
{
{
const
u
ploadParams params = GetParam();
const
U
ploadParams params = GetParam();
const Size srcSize = get<0>(params);
const Size srcSize = get<0>(params);
const int depth = get<1>(params), cn = get<2>(params);
const int depth = get<1>(params), cn = get<2>(params);
const int type = CV_MAKE_TYPE(depth, cn);
const int type = CV_MAKE_TYPE(depth, cn);
...
...
modules/ocl/perf/perf_ml.cpp
View file @
ba451350
...
@@ -55,7 +55,7 @@ static void genData(Mat& trainData, Size size, Mat& trainLabel = Mat().setTo(Sca
...
@@ -55,7 +55,7 @@ static void genData(Mat& trainData, Size size, Mat& trainLabel = Mat().setTo(Sca
trainData
.
create
(
size
,
CV_32FC1
);
trainData
.
create
(
size
,
CV_32FC1
);
randu
(
trainData
,
1.0
,
100.0
);
randu
(
trainData
,
1.0
,
100.0
);
if
(
nClasses
!=
0
)
if
(
nClasses
!=
0
)
{
{
trainLabel
.
create
(
size
.
height
,
1
,
CV_8UC1
);
trainLabel
.
create
(
size
.
height
,
1
,
CV_8UC1
);
randu
(
trainLabel
,
0
,
nClasses
-
1
);
randu
(
trainLabel
,
0
,
nClasses
-
1
);
...
@@ -82,7 +82,7 @@ PERF_TEST_P(KNNFixture, KNN,
...
@@ -82,7 +82,7 @@ PERF_TEST_P(KNNFixture, KNN,
genData
(
testData
,
size
);
genData
(
testData
,
size
);
Mat
best_label
;
Mat
best_label
;
if
(
RUN_PLAIN_IMPL
)
if
(
RUN_PLAIN_IMPL
)
{
{
TEST_CYCLE
()
TEST_CYCLE
()
{
{
...
@@ -90,7 +90,8 @@ PERF_TEST_P(KNNFixture, KNN,
...
@@ -90,7 +90,8 @@ PERF_TEST_P(KNNFixture, KNN,
knn_cpu
.
train
(
trainData
,
trainLabels
);
knn_cpu
.
train
(
trainData
,
trainLabels
);
knn_cpu
.
find_nearest
(
testData
,
k
,
&
best_label
);
knn_cpu
.
find_nearest
(
testData
,
k
,
&
best_label
);
}
}
}
else
if
(
RUN_OCL_IMPL
)
}
else
if
(
RUN_OCL_IMPL
)
{
{
cv
::
ocl
::
oclMat
best_label_ocl
;
cv
::
ocl
::
oclMat
best_label_ocl
;
cv
::
ocl
::
oclMat
testdata
;
cv
::
ocl
::
oclMat
testdata
;
...
@@ -103,7 +104,8 @@ PERF_TEST_P(KNNFixture, KNN,
...
@@ -103,7 +104,8 @@ PERF_TEST_P(KNNFixture, KNN,
knn_ocl
.
find_nearest
(
testdata
,
k
,
best_label_ocl
);
knn_ocl
.
find_nearest
(
testdata
,
k
,
best_label_ocl
);
}
}
best_label_ocl
.
download
(
best_label
);
best_label_ocl
.
download
(
best_label
);
}
else
}
else
OCL_PERF_ELSE
OCL_PERF_ELSE
SANITY_CHECK
(
best_label
);
SANITY_CHECK
(
best_label
);
}
}
...
@@ -188,7 +190,7 @@ PERF_TEST_P(SVMFixture, DISABLED_SVM,
...
@@ -188,7 +190,7 @@ PERF_TEST_P(SVMFixture, DISABLED_SVM,
CvMat
samples_
=
samples
;
CvMat
samples_
=
samples
;
CvMat
results_
=
results
;
CvMat
results_
=
results
;
if
(
RUN_PLAIN_IMPL
)
if
(
RUN_PLAIN_IMPL
)
{
{
CvSVM
svm
;
CvSVM
svm
;
svm
.
train
(
trainData
,
labels
,
Mat
(),
Mat
(),
params
);
svm
.
train
(
trainData
,
labels
,
Mat
(),
Mat
(),
params
);
...
@@ -197,7 +199,7 @@ PERF_TEST_P(SVMFixture, DISABLED_SVM,
...
@@ -197,7 +199,7 @@ PERF_TEST_P(SVMFixture, DISABLED_SVM,
svm
.
predict
(
&
samples_
,
&
results_
);
svm
.
predict
(
&
samples_
,
&
results_
);
}
}
}
}
else
if
(
RUN_OCL_IMPL
)
else
if
(
RUN_OCL_IMPL
)
{
{
CvSVM_OCL
svm
;
CvSVM_OCL
svm
;
svm
.
train
(
trainData
,
labels
,
Mat
(),
Mat
(),
params
);
svm
.
train
(
trainData
,
labels
,
Mat
(),
Mat
(),
params
);
...
...
modules/ocl/perf/perf_moments.cpp
View file @
ba451350
...
@@ -55,22 +55,19 @@ using namespace cvtest;
...
@@ -55,22 +55,19 @@ using namespace cvtest;
using
namespace
testing
;
using
namespace
testing
;
using
namespace
std
;
using
namespace
std
;
///////////// Moments ////////////////////////
///////////// Moments ////////////////////////
//*! performance of image
typedef
tuple
<
Size
,
MatType
,
bool
>
MomentsParamType
;
typedef
TestBaseWithParam
<
MomentsParamType
>
MomentsFixture
;
PERF_TEST_P
(
MomentsFixture
,
Moments
,
typedef
tuple
<
Size
,
bool
>
MomentsParams
;
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
typedef
TestBaseWithParam
<
MomentsParams
>
MomentsFixture
;
OCL_PERF_ENUM
(
CV_8UC1
,
CV_16SC1
,
CV_16UC1
,
CV_32FC1
),
::
testing
::
Bool
()))
OCL_PERF_TEST_P
(
MomentsFixture
,
Moments
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
::
testing
::
Bool
()))
{
{
const
MomentsParam
Type
params
=
GetParam
();
const
MomentsParam
s
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
const
bool
binaryImage
=
get
<
1
>
(
params
);
const
bool
binaryImage
=
get
<
2
>
(
params
);
Mat
src
(
srcSize
,
type
),
dst
(
7
,
1
,
CV_64F
);
Mat
src
(
srcSize
,
CV_8UC1
),
dst
(
7
,
1
,
CV_64F
);
randu
(
src
,
0
,
255
);
randu
(
src
,
0
,
255
);
cv
::
Moments
mom
;
cv
::
Moments
mom
;
...
@@ -85,6 +82,7 @@ PERF_TEST_P(MomentsFixture, Moments,
...
@@ -85,6 +82,7 @@ PERF_TEST_P(MomentsFixture, Moments,
}
}
else
else
OCL_PERF_ELSE
OCL_PERF_ELSE
cv
::
HuMoments
(
mom
,
dst
);
cv
::
HuMoments
(
mom
,
dst
);
SANITY_CHECK
(
dst
,
2e-1
);
SANITY_CHECK
(
dst
,
2e-1
);
}
}
modules/ocl/perf/perf_opticalflow.cpp
View file @
ba451350
...
@@ -52,55 +52,27 @@ using std::tr1::get;
...
@@ -52,55 +52,27 @@ using std::tr1::get;
using
std
::
tr1
::
tuple
;
using
std
::
tr1
::
tuple
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
make_tuple
;
CV_ENUM
(
LoadMode
,
IMREAD_GRAYSCALE
,
IMREAD_COLOR
)
typedef
TestBaseWithParam
<
tuple
<
int
>
>
PyrLKOpticalFlowFixture
;
typedef
tuple
<
int
,
tuple
<
string
,
string
,
LoadMode
>
>
PyrLKOpticalFlowParamType
;
OCL_PERF_TEST_P
(
PyrLKOpticalFlowFixture
,
typedef
TestBaseWithParam
<
PyrLKOpticalFlowParamType
>
PyrLKOpticalFlowFixture
;
PyrLKOpticalFlow
,
::
testing
::
Values
(
1000
,
2000
,
4000
))
PERF_TEST_P
(
PyrLKOpticalFlowFixture
,
PyrLKOpticalFlow
,
::
testing
::
Combine
(
::
testing
::
Values
(
1000
,
2000
,
4000
),
::
testing
::
Values
(
make_tuple
<
string
,
string
,
LoadMode
>
(
string
(
"gpu/opticalflow/rubberwhale1.png"
),
string
(
"gpu/opticalflow/rubberwhale2.png"
),
LoadMode
(
IMREAD_COLOR
)
),
make_tuple
<
string
,
string
,
LoadMode
>
(
string
(
"gpu/stereobm/aloe-L.png"
),
string
(
"gpu/stereobm/aloe-R.png"
),
LoadMode
(
IMREAD_GRAYSCALE
)
)
)
)
)
{
{
PyrLKOpticalFlowParamType
params
=
GetParam
();
const
int
pointsCount
=
get
<
0
>
(
GetParam
());
tuple
<
string
,
string
,
LoadMode
>
fileParam
=
get
<
1
>
(
params
);
const
int
pointsCount
=
get
<
0
>
(
params
);
const
string
fileName0
=
"gpu/opticalflow/rubberwhale1.png"
,
const
int
openMode
=
static_cast
<
int
>
(
get
<
2
>
(
fileParam
));
fileName1
=
"gpu/opticalflow/rubberwhale2.png"
;
const
string
fileName0
=
get
<
0
>
(
fileParam
),
fileName1
=
get
<
1
>
(
fileParam
);
Mat
frame0
=
imread
(
getDataPath
(
fileName0
),
cv
::
IMREAD_GRAYSCALE
);
Mat
frame0
=
imread
(
getDataPath
(
fileName0
),
openMode
);
Mat
frame1
=
imread
(
getDataPath
(
fileName1
),
cv
::
IMREAD_GRAYSCALE
);
Mat
frame1
=
imread
(
getDataPath
(
fileName1
),
openMode
);
declare
.
in
(
frame0
,
frame1
);
declare
.
in
(
frame0
,
frame1
);
ASSERT_FALSE
(
frame0
.
empty
())
<<
"can't load "
<<
fileName0
;
ASSERT_FALSE
(
frame0
.
empty
())
<<
"can't load "
<<
fileName0
;
ASSERT_FALSE
(
frame1
.
empty
())
<<
"can't load "
<<
fileName1
;
ASSERT_FALSE
(
frame1
.
empty
())
<<
"can't load "
<<
fileName1
;
Mat
grayFrame
;
if
(
openMode
==
IMREAD_COLOR
)
cvtColor
(
frame0
,
grayFrame
,
COLOR_BGR2GRAY
);
else
grayFrame
=
frame0
;
vector
<
Point2f
>
pts
,
nextPts
;
vector
<
Point2f
>
pts
,
nextPts
;
vector
<
unsigned
char
>
status
;
vector
<
unsigned
char
>
status
;
vector
<
float
>
err
;
vector
<
float
>
err
;
goodFeaturesToTrack
(
grayFrame
,
pts
,
pointsCount
,
0.01
,
0.0
);
goodFeaturesToTrack
(
frame0
,
pts
,
pointsCount
,
0.01
,
0.0
);
Mat
ptsMat
(
1
,
static_cast
<
int
>
(
pts
.
size
()),
CV_32FC2
,
(
void
*
)
&
pts
[
0
]);
Mat
ptsMat
(
1
,
static_cast
<
int
>
(
pts
.
size
()),
CV_32FC2
,
(
void
*
)
&
pts
[
0
]);
if
(
RUN_PLAIN_IMPL
)
if
(
RUN_PLAIN_IMPL
)
...
@@ -136,7 +108,7 @@ PERF_TEST(tvl1flowFixture, tvl1flow)
...
@@ -136,7 +108,7 @@ PERF_TEST(tvl1flowFixture, tvl1flow)
const
Size
srcSize
=
frame0
.
size
();
const
Size
srcSize
=
frame0
.
size
();
const
double
eps
=
1.2
;
const
double
eps
=
1.2
;
Mat
flow
(
srcSize
,
CV_32FC2
),
flow1
(
srcSize
,
CV_32FC1
),
flow2
(
srcSize
,
CV_32FC1
);
Mat
flow
(
srcSize
,
CV_32FC2
),
flow1
(
srcSize
,
CV_32FC1
),
flow2
(
srcSize
,
CV_32FC1
);
declare
.
in
(
frame0
,
frame1
).
out
(
flow1
,
flow2
)
.
time
(
159
)
;
declare
.
in
(
frame0
,
frame1
).
out
(
flow1
,
flow2
);
if
(
RUN_PLAIN_IMPL
)
if
(
RUN_PLAIN_IMPL
)
{
{
...
@@ -178,12 +150,11 @@ CV_ENUM(farneFlagType, 0, OPTFLOW_FARNEBACK_GAUSSIAN)
...
@@ -178,12 +150,11 @@ CV_ENUM(farneFlagType, 0, OPTFLOW_FARNEBACK_GAUSSIAN)
typedef
tuple
<
tuple
<
int
,
double
>
,
farneFlagType
,
bool
>
FarnebackOpticalFlowParams
;
typedef
tuple
<
tuple
<
int
,
double
>
,
farneFlagType
,
bool
>
FarnebackOpticalFlowParams
;
typedef
TestBaseWithParam
<
FarnebackOpticalFlowParams
>
FarnebackOpticalFlowFixture
;
typedef
TestBaseWithParam
<
FarnebackOpticalFlowParams
>
FarnebackOpticalFlowFixture
;
PERF_TEST_P
(
FarnebackOpticalFlowFixture
,
FarnebackOpticalFlow
,
OCL_
PERF_TEST_P
(
FarnebackOpticalFlowFixture
,
FarnebackOpticalFlow
,
::
testing
::
Combine
(
::
testing
::
Combine
(
::
testing
::
Values
(
make_tuple
<
int
,
double
>
(
5
,
1.1
),
::
testing
::
Values
(
make_tuple
<
int
,
double
>
(
5
,
1.1
),
make_tuple
<
int
,
double
>
(
7
,
1.5
)),
make_tuple
<
int
,
double
>
(
7
,
1.5
)),
farneFlagType
::
all
(),
farneFlagType
::
all
(),
::
testing
::
Bool
()))
::
testing
::
Bool
()))
{
{
Mat
frame0
=
imread
(
getDataPath
(
"gpu/opticalflow/rubberwhale1.png"
),
cv
::
IMREAD_GRAYSCALE
);
Mat
frame0
=
imread
(
getDataPath
(
"gpu/opticalflow/rubberwhale1.png"
),
cv
::
IMREAD_GRAYSCALE
);
ASSERT_FALSE
(
frame0
.
empty
())
<<
"can't load rubberwhale1.png"
;
ASSERT_FALSE
(
frame0
.
empty
())
<<
"can't load rubberwhale1.png"
;
...
...
modules/ocl/perf/perf_precomp.hpp
View file @
ba451350
...
@@ -70,8 +70,7 @@
...
@@ -70,8 +70,7 @@
#include "opencv2/ocl/ocl.hpp"
#include "opencv2/ocl/ocl.hpp"
#include "opencv2/ts/ts.hpp"
#include "opencv2/ts/ts.hpp"
using
namespace
std
;
// TODO remove it
using
namespace
cv
;
#define OCL_SIZE_1000 Size(1000, 1000)
#define OCL_SIZE_1000 Size(1000, 1000)
#define OCL_SIZE_2000 Size(2000, 2000)
#define OCL_SIZE_2000 Size(2000, 2000)
...
@@ -79,6 +78,19 @@ using namespace cv;
...
@@ -79,6 +78,19 @@ using namespace cv;
#define OCL_TYPICAL_MAT_SIZES ::testing::Values(OCL_SIZE_1000, OCL_SIZE_2000, OCL_SIZE_4000)
#define OCL_TYPICAL_MAT_SIZES ::testing::Values(OCL_SIZE_1000, OCL_SIZE_2000, OCL_SIZE_4000)
using
namespace
std
;
using
namespace
cv
;
#define OCL_SIZE_1 szVGA
#define OCL_SIZE_2 sz720p
#define OCL_SIZE_3 sz1080p
#define OCL_SIZE_4 sz2160p
#define OCL_TEST_SIZES ::testing::Values(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3, OCL_SIZE_4)
#define OCL_TEST_TYPES ::testing::Values(CV_8UC1, CV_32FC1, CV_8UC4, CV_32FC4)
#define OCL_TEST_TYPES_14 OCL_TEST_TYPES
#define OCL_TEST_TYPES_134 ::testing::Values(CV_8UC1, CV_32FC1, CV_8UC3, CV_32FC3, CV_8UC4, CV_32FC4)
#define OCL_PERF_ENUM(type, ...) ::testing::Values(type, ## __VA_ARGS__ )
#define OCL_PERF_ENUM(type, ...) ::testing::Values(type, ## __VA_ARGS__ )
#define IMPL_OCL "ocl"
#define IMPL_OCL "ocl"
...
@@ -103,6 +115,31 @@ using namespace cv;
...
@@ -103,6 +115,31 @@ using namespace cv;
CV_TEST_FAIL_NO_IMPL();
CV_TEST_FAIL_NO_IMPL();
#endif
#endif
#define OCL_PERF_TEST(fixture, name) \
class OCL##_##fixture##_##name : \
public ::perf::TestBase \
{ \
public: \
OCL##_##fixture##_##name() { } \
protected: \
virtual void PerfTestBody(); \
}; \
TEST_F(OCL##_##fixture##_##name, name) { RunPerfTestBody(); } \
void OCL##_##fixture##_##name::PerfTestBody()
#define OCL_PERF_TEST_P(fixture, name, params) \
class OCL##_##fixture##_##name : \
public fixture \
{ \
public: \
OCL##_##fixture##_##name() { } \
protected: \
virtual void PerfTestBody(); \
}; \
TEST_P(OCL##_##fixture##_##name, name) { RunPerfTestBody(); } \
INSTANTIATE_TEST_CASE_P(
/*none*/
, OCL##_##fixture##_##name, params); \
void OCL##_##fixture##_##name::PerfTestBody()
#define OCL_TEST_CYCLE_N(n) for(declare.iterations(n); startTimer(), next(); cv::ocl::finish(), stopTimer())
#define OCL_TEST_CYCLE_N(n) for(declare.iterations(n); startTimer(), next(); cv::ocl::finish(), stopTimer())
#define OCL_TEST_CYCLE() for(; startTimer(), next(); cv::ocl::finish(), stopTimer())
#define OCL_TEST_CYCLE() for(; startTimer(), next(); cv::ocl::finish(), stopTimer())
#define OCL_TEST_CYCLE_MULTIRUN(runsNum) for(declare.runs(runsNum); startTimer(), next(); stopTimer()) for(int r = 0; r < runsNum; cv::ocl::finish(), ++r)
#define OCL_TEST_CYCLE_MULTIRUN(runsNum) for(declare.runs(runsNum); startTimer(), next(); stopTimer()) for(int r = 0; r < runsNum; cv::ocl::finish(), ++r)
...
...
modules/ocl/perf/perf_pyramid.cpp
View file @
ba451350
...
@@ -51,11 +51,10 @@ using std::tr1::get;
...
@@ -51,11 +51,10 @@ using std::tr1::get;
///////////// pyrDown //////////////////////
///////////// pyrDown //////////////////////
typedef
Size_MatType
p
yrDownFixture
;
typedef
Size_MatType
P
yrDownFixture
;
PERF_TEST_P
(
pyrDownFixture
,
pyrDown
,
OCL_PERF_TEST_P
(
PyrDownFixture
,
PyrDown
,
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
))
OCL_PERF_ENUM
(
CV_8UC1
,
CV_8UC4
)))
{
{
const
Size_MatType_t
params
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
...
@@ -77,7 +76,7 @@ PERF_TEST_P(pyrDownFixture, pyrDown,
...
@@ -77,7 +76,7 @@ PERF_TEST_P(pyrDownFixture, pyrDown,
oclDst
.
download
(
dst
);
oclDst
.
download
(
dst
);
SANITY_CHECK
(
dst
);
SANITY_CHECK
(
dst
,
5e-4
);
}
}
else
if
(
RUN_PLAIN_IMPL
)
else
if
(
RUN_PLAIN_IMPL
)
{
{
...
@@ -91,11 +90,10 @@ PERF_TEST_P(pyrDownFixture, pyrDown,
...
@@ -91,11 +90,10 @@ PERF_TEST_P(pyrDownFixture, pyrDown,
///////////// pyrUp ////////////////////////
///////////// pyrUp ////////////////////////
typedef
Size_MatType
p
yrUpFixture
;
typedef
Size_MatType
P
yrUpFixture
;
PERF_TEST_P
(
pyrUpFixture
,
pyrUp
,
OCL_PERF_TEST_P
(
PyrUpFixture
,
PyrUp
,
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
))
OCL_PERF_ENUM
(
CV_8UC1
,
CV_8UC4
)))
{
{
const
Size_MatType_t
params
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
...
@@ -117,7 +115,7 @@ PERF_TEST_P(pyrUpFixture, pyrUp,
...
@@ -117,7 +115,7 @@ PERF_TEST_P(pyrUpFixture, pyrUp,
oclDst
.
download
(
dst
);
oclDst
.
download
(
dst
);
SANITY_CHECK
(
dst
);
SANITY_CHECK
(
dst
,
5e-4
);
}
}
else
if
(
RUN_PLAIN_IMPL
)
else
if
(
RUN_PLAIN_IMPL
)
{
{
...
...
modules/ocl/perf/perf_split_merge.cpp
View file @
ba451350
...
@@ -51,21 +51,22 @@ using std::tr1::get;
...
@@ -51,21 +51,22 @@ using std::tr1::get;
///////////// Merge////////////////////////
///////////// Merge////////////////////////
typedef
Size_MatType
MergeFixture
;
typedef
tuple
<
Size
,
MatDepth
,
int
>
MergeParams
;
typedef
TestBaseWithParam
<
MergeParams
>
MergeFixture
;
PERF_TEST_P
(
MergeFixture
,
Merge
,
OCL_
PERF_TEST_P
(
MergeFixture
,
Merge
,
::
testing
::
Combine
(
::
testing
::
Values
(
OCL_SIZE_1000
,
OCL_SIZE_2000
),
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_PERF_ENUM
(
CV_8U
,
CV_32F
),
OCL_PERF_ENUM
(
CV_8U
,
CV_32F
)))
OCL_PERF_ENUM
(
2
,
3
)))
{
{
const
Size_MatType_t
params
=
GetParam
();
const
MergeParams
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
depth
=
get
<
1
>
(
params
),
c
hannels
=
3
;
const
int
depth
=
get
<
1
>
(
params
),
c
n
=
get
<
2
>
(
params
),
const
int
dstType
=
CV_MAKE_TYPE
(
depth
,
channels
);
dtype
=
CV_MAKE_TYPE
(
depth
,
cn
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
d
stT
ype
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
d
t
ype
);
Mat
dst
(
srcSize
,
d
stT
ype
);
Mat
dst
(
srcSize
,
d
t
ype
);
vector
<
Mat
>
src
(
c
hannels
);
vector
<
Mat
>
src
(
c
n
);
for
(
vector
<
Mat
>::
iterator
i
=
src
.
begin
(),
end
=
src
.
end
();
i
!=
end
;
++
i
)
for
(
vector
<
Mat
>::
iterator
i
=
src
.
begin
(),
end
=
src
.
end
();
i
!=
end
;
++
i
)
{
{
i
->
create
(
srcSize
,
CV_MAKE_TYPE
(
depth
,
1
));
i
->
create
(
srcSize
,
CV_MAKE_TYPE
(
depth
,
1
));
...
@@ -75,7 +76,7 @@ PERF_TEST_P(MergeFixture, Merge,
...
@@ -75,7 +76,7 @@ PERF_TEST_P(MergeFixture, Merge,
if
(
RUN_OCL_IMPL
)
if
(
RUN_OCL_IMPL
)
{
{
ocl
::
oclMat
oclDst
(
srcSize
,
d
stT
ype
);
ocl
::
oclMat
oclDst
(
srcSize
,
d
t
ype
);
vector
<
ocl
::
oclMat
>
oclSrc
(
src
.
size
());
vector
<
ocl
::
oclMat
>
oclSrc
(
src
.
size
());
for
(
vector
<
ocl
::
oclMat
>::
size_type
i
=
0
,
end
=
src
.
size
();
i
<
end
;
++
i
)
for
(
vector
<
ocl
::
oclMat
>::
size_type
i
=
0
,
end
=
src
.
size
();
i
<
end
;
++
i
)
oclSrc
[
i
]
=
src
[
i
];
oclSrc
[
i
]
=
src
[
i
];
...
@@ -98,49 +99,69 @@ PERF_TEST_P(MergeFixture, Merge,
...
@@ -98,49 +99,69 @@ PERF_TEST_P(MergeFixture, Merge,
///////////// Split////////////////////////
///////////// Split////////////////////////
typedef
Size_MatType
SplitFixture
;
typedef
MergeParams
SplitParams
;
typedef
TestBaseWithParam
<
SplitParams
>
SplitFixture
;
PERF_TEST_P
(
SplitFixture
,
Split
,
OCL_
PERF_TEST_P
(
SplitFixture
,
Split
,
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_PERF_ENUM
(
CV_8U
,
CV_32F
)
,
OCL_PERF_ENUM
(
CV_8U
,
CV_32F
)))
OCL_PERF_ENUM
(
2
,
3
)))
{
{
const
S
ize_MatType_t
params
=
GetParam
();
const
S
plitParams
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
depth
=
get
<
1
>
(
params
),
c
hannels
=
3
;
const
int
depth
=
get
<
1
>
(
params
),
c
n
=
get
<
2
>
(
params
)
;
const
int
type
=
CV_MAKE_TYPE
(
depth
,
c
hannels
);
const
int
type
=
CV_MAKE_TYPE
(
depth
,
c
n
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
Mat
src
(
srcSize
,
type
);
Mat
src
(
srcSize
,
type
);
Mat
dst0
,
dst1
,
dst2
;
declare
.
in
(
src
,
WARMUP_RNG
);
declare
.
in
(
src
,
WARMUP_RNG
);
ASSERT_TRUE
(
cn
==
3
||
cn
==
2
);
if
(
RUN_OCL_IMPL
)
if
(
RUN_OCL_IMPL
)
{
{
ocl
::
oclMat
oclSrc
(
src
);
ocl
::
oclMat
oclSrc
(
src
);
vector
<
ocl
::
oclMat
>
oclDst
(
channels
,
ocl
::
oclMat
(
srcSize
,
CV_MAKE_TYPE
(
depth
,
1
)));
vector
<
ocl
::
oclMat
>
oclDst
(
cn
);
oclDst
[
0
]
=
ocl
::
oclMat
(
srcSize
,
depth
);
oclDst
[
1
]
=
ocl
::
oclMat
(
srcSize
,
depth
);
if
(
cn
==
3
)
oclDst
[
2
]
=
ocl
::
oclMat
(
srcSize
,
depth
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
split
(
oclSrc
,
oclDst
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
split
(
oclSrc
,
oclDst
);
ASSERT_EQ
(
3
,
channels
);
Mat
dst0
,
dst1
,
dst2
;
oclDst
[
0
].
download
(
dst0
);
oclDst
[
0
].
download
(
dst0
);
oclDst
[
1
].
download
(
dst1
);
oclDst
[
1
].
download
(
dst1
);
if
(
cn
==
3
)
oclDst
[
2
].
download
(
dst2
);
oclDst
[
2
].
download
(
dst2
);
SANITY_CHECK
(
dst0
);
SANITY_CHECK
(
dst1
);
SANITY_CHECK
(
dst2
);
}
}
else
if
(
RUN_PLAIN_IMPL
)
else
if
(
RUN_PLAIN_IMPL
)
{
{
vector
<
Mat
>
dst
(
channels
,
Mat
(
srcSize
,
CV_MAKE_TYPE
(
depth
,
1
)));
vector
<
Mat
>
dst
(
cn
);
dst
[
0
]
=
Mat
(
srcSize
,
depth
);
dst
[
1
]
=
Mat
(
srcSize
,
depth
);
if
(
cn
==
3
)
dst
[
2
]
=
Mat
(
srcSize
,
depth
);
TEST_CYCLE
()
cv
::
split
(
src
,
dst
);
TEST_CYCLE
()
cv
::
split
(
src
,
dst
);
ASSERT_EQ
(
3
,
channels
);
dst0
=
dst
[
0
];
Mat
&
dst0
=
dst
[
0
],
&
dst1
=
dst
[
1
],
&
dst2
=
dst
[
2
];
dst1
=
dst
[
1
];
if
(
cn
==
3
)
dst2
=
dst
[
2
];
}
else
OCL_PERF_ELSE
if
(
cn
==
2
)
{
SANITY_CHECK
(
dst0
);
SANITY_CHECK
(
dst1
);
}
else
if
(
cn
==
3
)
{
SANITY_CHECK
(
dst0
);
SANITY_CHECK
(
dst0
);
SANITY_CHECK
(
dst1
);
SANITY_CHECK
(
dst1
);
SANITY_CHECK
(
dst2
);
SANITY_CHECK
(
dst2
);
}
}
else
OCL_PERF_ELSE
}
}
modules/ocl/perf/perf_
norm
.cpp
→
modules/ocl/perf/perf_
stat
.cpp
View file @
ba451350
...
@@ -49,20 +49,210 @@ using namespace perf;
...
@@ -49,20 +49,210 @@ using namespace perf;
using
std
::
tr1
::
tuple
;
using
std
::
tr1
::
tuple
;
using
std
::
tr1
::
get
;
using
std
::
tr1
::
get
;
///////////// norm////////////////////////
typedef
tuple
<
Size
,
MatType
>
normParams
;
///////////// MinMax ////////////////////////
typedef
TestBaseWithParam
<
normParams
>
normFixture
;
typedef
Size_MatType
MinMaxFixture
;
PERF_TEST_P
(
normFixture
,
norm
,
testing
::
Combine
(
PERF_TEST_P
(
MinMaxFixture
,
MinMax
,
OCL_TYPICAL_MAT_SIZES
,
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_32FC1
)))
OCL_PERF_ENUM
(
CV_8UC1
,
CV_32FC1
)))
{
{
const
normParams
params
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
);
double
min_val
=
std
::
numeric_limits
<
double
>::
max
(),
max_val
=
std
::
numeric_limits
<
double
>::
min
();
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
minMax
(
oclSrc
,
&
min_val
,
&
max_val
);
ASSERT_GE
(
max_val
,
min_val
);
SANITY_CHECK
(
min_val
);
SANITY_CHECK
(
max_val
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
Point
min_loc
,
max_loc
;
TEST_CYCLE
()
cv
::
minMaxLoc
(
src
,
&
min_val
,
&
max_val
,
&
min_loc
,
&
max_loc
);
ASSERT_GE
(
max_val
,
min_val
);
SANITY_CHECK
(
min_val
);
SANITY_CHECK
(
max_val
);
}
else
OCL_PERF_ELSE
}
///////////// MinMaxLoc ////////////////////////
typedef
Size_MatType
MinMaxLocFixture
;
OCL_PERF_TEST_P
(
MinMaxLocFixture
,
MinMaxLoc
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_32FC1
)))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
randu
(
src
,
0
,
1
);
declare
.
in
(
src
);
double
min_val
=
0.0
,
max_val
=
0.0
;
Point
min_loc
,
max_loc
;
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
minMaxLoc
(
oclSrc
,
&
min_val
,
&
max_val
,
&
min_loc
,
&
max_loc
);
ASSERT_GE
(
max_val
,
min_val
);
SANITY_CHECK
(
min_val
);
SANITY_CHECK
(
max_val
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
TEST_CYCLE
()
cv
::
minMaxLoc
(
src
,
&
min_val
,
&
max_val
,
&
min_loc
,
&
max_loc
);
ASSERT_GE
(
max_val
,
min_val
);
SANITY_CHECK
(
min_val
);
SANITY_CHECK
(
max_val
);
}
else
OCL_PERF_ELSE
}
///////////// Sum ////////////////////////
typedef
Size_MatType
SumFixture
;
OCL_PERF_TEST_P
(
SumFixture
,
Sum
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
Scalar
result
;
randu
(
src
,
0
,
60
);
declare
.
in
(
src
);
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
result
=
cv
::
ocl
::
sum
(
oclSrc
);
SANITY_CHECK
(
result
,
1e-6
,
ERROR_RELATIVE
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
TEST_CYCLE
()
result
=
cv
::
sum
(
src
);
SANITY_CHECK
(
result
,
1e-6
,
ERROR_RELATIVE
);
}
else
OCL_PERF_ELSE
}
///////////// countNonZero ////////////////////////
typedef
Size_MatType
CountNonZeroFixture
;
OCL_PERF_TEST_P
(
CountNonZeroFixture
,
CountNonZero
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_32FC1
)))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
int
result
=
0
;
randu
(
src
,
0
,
256
);
declare
.
in
(
src
);
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
result
=
cv
::
ocl
::
countNonZero
(
oclSrc
);
SANITY_CHECK
(
result
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
TEST_CYCLE
()
result
=
cv
::
countNonZero
(
src
);
SANITY_CHECK
(
result
);
}
else
OCL_PERF_ELSE
}
///////////// meanStdDev ////////////////////////
typedef
Size_MatType
MeanStdDevFixture
;
OCL_PERF_TEST_P
(
MeanStdDevFixture
,
MeanStdDev
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
Scalar
mean
,
stddev
;
randu
(
src
,
0
,
256
);
declare
.
in
(
src
);
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
meanStdDev
(
oclSrc
,
mean
,
stddev
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
TEST_CYCLE
()
cv
::
meanStdDev
(
src
,
mean
,
stddev
);
}
else
OCL_PERF_ELSE
SANITY_CHECK_NOTHING
();
// SANITY_CHECK(mean, 1e-6, ERROR_RELATIVE);
// SANITY_CHECK(stddev, 1e-6, ERROR_RELATIVE);
}
///////////// norm////////////////////////
CV_ENUM
(
NormType
,
NORM_INF
,
NORM_L1
,
NORM_L2
)
typedef
std
::
tr1
::
tuple
<
Size
,
MatType
,
NormType
>
NormParams
;
typedef
TestBaseWithParam
<
NormParams
>
NormFixture
;
OCL_PERF_TEST_P
(
NormFixture
,
Norm
,
::
testing
::
Combine
(
OCL_PERF_ENUM
(
OCL_SIZE_1
,
OCL_SIZE_2
,
OCL_SIZE_3
),
OCL_TEST_TYPES
,
NormType
::
all
()))
{
const
NormParams
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
double
value
=
0.0
;
const
int
normType
=
get
<
2
>
(
params
);
const
double
eps
=
CV_MAT_DEPTH
(
type
)
==
CV_8U
?
DBL_EPSILON
:
1e-3
;
perf
::
ERROR_TYPE
errorType
=
type
!=
NORM_INF
?
ERROR_RELATIVE
:
ERROR_ABSOLUTE
;
double
eps
=
1e-5
,
value
;
Mat
src1
(
srcSize
,
type
),
src2
(
srcSize
,
type
);
Mat
src1
(
srcSize
,
type
),
src2
(
srcSize
,
type
);
declare
.
in
(
src1
,
src2
,
WARMUP_RNG
);
declare
.
in
(
src1
,
src2
,
WARMUP_RNG
);
...
@@ -71,15 +261,15 @@ PERF_TEST_P(normFixture, norm, testing::Combine(
...
@@ -71,15 +261,15 @@ PERF_TEST_P(normFixture, norm, testing::Combine(
{
{
ocl
::
oclMat
oclSrc1
(
src1
),
oclSrc2
(
src2
);
ocl
::
oclMat
oclSrc1
(
src1
),
oclSrc2
(
src2
);
OCL_TEST_CYCLE
()
value
=
cv
::
ocl
::
norm
(
oclSrc1
,
oclSrc2
,
NORM_INF
);
OCL_TEST_CYCLE
()
value
=
cv
::
ocl
::
norm
(
oclSrc1
,
oclSrc2
,
normType
);
SANITY_CHECK
(
value
,
eps
);
SANITY_CHECK
(
value
,
eps
,
errorType
);
}
}
else
if
(
RUN_PLAIN_IMPL
)
else
if
(
RUN_PLAIN_IMPL
)
{
{
TEST_CYCLE
()
value
=
cv
::
norm
(
src1
,
src2
,
NORM_INF
);
TEST_CYCLE
()
value
=
cv
::
norm
(
src1
,
src2
,
normType
);
SANITY_CHECK
(
value
);
SANITY_CHECK
(
value
,
eps
,
errorType
);
}
}
else
else
OCL_PERF_ELSE
OCL_PERF_ELSE
...
...
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