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
ae4be413
Commit
ae4be413
authored
Jan 16, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added perf tests for cv::reduce
parent
63a5e39e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
1 deletion
+66
-1
perf_arithm.cpp
modules/core/perf/opencl/perf_arithm.cpp
+64
-0
matrix.cpp
modules/core/src/matrix.cpp
+1
-0
test_arithm.cpp
modules/core/test/ocl/test_arithm.cpp
+1
-1
No files found.
modules/core/perf/opencl/perf_arithm.cpp
View file @
ae4be413
...
...
@@ -912,6 +912,70 @@ OCL_PERF_TEST_P(PSNRFixture, PSNR,
SANITY_CHECK
(
psnr
,
1e-4
,
ERROR_RELATIVE
);
}
///////////// Reduce ////////////////////////
CV_ENUM
(
ReduceMinMaxOp
,
CV_REDUCE_MIN
,
CV_REDUCE_MAX
)
typedef
tuple
<
Size
,
std
::
pair
<
MatType
,
MatType
>
,
int
,
ReduceMinMaxOp
>
ReduceMinMaxParams
;
typedef
TestBaseWithParam
<
ReduceMinMaxParams
>
ReduceMinMaxFixture
;
OCL_PERF_TEST_P
(
ReduceMinMaxFixture
,
Reduce
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_PERF_ENUM
(
std
::
make_pair
<
MatType
,
MatType
>
(
CV_8UC1
,
CV_8UC1
),
std
::
make_pair
<
MatType
,
MatType
>
(
CV_32FC4
,
CV_32FC4
)),
OCL_PERF_ENUM
(
0
,
1
),
ReduceMinMaxOp
::
all
()))
{
const
ReduceMinMaxParams
params
=
GetParam
();
const
std
::
pair
<
MatType
,
MatType
>
types
=
get
<
1
>
(
params
);
const
int
stype
=
types
.
first
,
dtype
=
types
.
second
,
dim
=
get
<
2
>
(
params
),
op
=
get
<
3
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
),
dstSize
(
dim
==
0
?
srcSize
.
width
:
1
,
dim
==
0
?
1
:
srcSize
.
height
);
const
double
eps
=
CV_MAT_DEPTH
(
dtype
)
<=
CV_32S
?
1
:
1e-5
;
checkDeviceMaxMemoryAllocSize
(
srcSize
,
stype
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
dtype
);
UMat
src
(
srcSize
,
stype
),
dst
(
dstSize
,
dtype
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
OCL_TEST_CYCLE
()
cv
::
reduce
(
src
,
dst
,
dim
,
op
,
dtype
);
SANITY_CHECK
(
dst
,
eps
);
}
CV_ENUM
(
ReduceAccOp
,
CV_REDUCE_SUM
,
CV_REDUCE_AVG
)
typedef
tuple
<
Size
,
std
::
pair
<
MatType
,
MatType
>
,
int
,
ReduceAccOp
>
ReduceAccParams
;
typedef
TestBaseWithParam
<
ReduceAccParams
>
ReduceAccFixture
;
OCL_PERF_TEST_P
(
ReduceAccFixture
,
Reduce
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_PERF_ENUM
(
std
::
make_pair
<
MatType
,
MatType
>
(
CV_8UC4
,
CV_32SC4
),
std
::
make_pair
<
MatType
,
MatType
>
(
CV_32FC1
,
CV_32FC1
)),
OCL_PERF_ENUM
(
0
,
1
),
ReduceAccOp
::
all
()))
{
const
ReduceAccParams
params
=
GetParam
();
const
std
::
pair
<
MatType
,
MatType
>
types
=
get
<
1
>
(
params
);
const
int
stype
=
types
.
first
,
dtype
=
types
.
second
,
dim
=
get
<
2
>
(
params
),
op
=
get
<
3
>
(
params
);
const
Size
srcSize
=
get
<
0
>
(
params
),
dstSize
(
dim
==
0
?
srcSize
.
width
:
1
,
dim
==
0
?
1
:
srcSize
.
height
);
const
double
eps
=
CV_MAT_DEPTH
(
dtype
)
<=
CV_32S
?
1
:
3e-4
;
checkDeviceMaxMemoryAllocSize
(
srcSize
,
stype
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
dtype
);
UMat
src
(
srcSize
,
stype
),
dst
(
dstSize
,
dtype
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
OCL_TEST_CYCLE
()
cv
::
reduce
(
src
,
dst
,
dim
,
op
,
dtype
);
SANITY_CHECK
(
dst
,
eps
);
}
}
}
// namespace cvtest::ocl
#endif // HAVE_OPENCL
modules/core/src/matrix.cpp
View file @
ae4be413
...
...
@@ -3036,6 +3036,7 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype)
int
stype
=
_src
.
type
(),
sdepth
=
CV_MAT_DEPTH
(
stype
),
cn
=
CV_MAT_CN
(
stype
);
if
(
dtype
<
0
)
dtype
=
_dst
.
fixedType
()
?
_dst
.
type
()
:
stype
;
dtype
=
CV_MAKETYPE
(
dtype
>=
0
?
dtype
:
stype
,
cn
);
int
ddepth
=
CV_MAT_DEPTH
(
dtype
);
CV_Assert
(
cn
==
CV_MAT_CN
(
dtype
)
);
...
...
modules/core/test/ocl/test_arithm.cpp
View file @
ae4be413
...
...
@@ -1615,7 +1615,7 @@ OCL_TEST_P(ReduceSum, Mat)
OCL_OFF
(
cv
::
reduce
(
src_roi
,
dst_roi
,
dim
,
CV_REDUCE_SUM
,
dtype
));
OCL_ON
(
cv
::
reduce
(
usrc_roi
,
udst_roi
,
dim
,
CV_REDUCE_SUM
,
dtype
));
double
eps
=
ddepth
<=
CV_32S
?
1
:
5e-5
;
double
eps
=
ddepth
<=
CV_32S
?
1
:
1e-4
;
OCL_EXPECT_MATS_NEAR
(
dst
,
eps
)
}
}
...
...
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