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
321782b9
Commit
321782b9
authored
Jan 27, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added macro with ability of returning values
parent
06acf709
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
15 deletions
+21
-15
ocl_defs.hpp
modules/core/include/opencv2/core/opencl/ocl_defs.hpp
+7
-5
stat.cpp
modules/core/src/stat.cpp
+14
-10
No files found.
modules/core/include/opencv2/core/opencl/ocl_defs.hpp
View file @
321782b9
...
...
@@ -8,13 +8,13 @@
#ifdef HAVE_OPENCL
#ifdef CV_OPENCL_RUN_VERBOSE
#define CV_OCL_RUN
(condition, func)
\
#define CV_OCL_RUN
_(condition, func, ...)
\
{ \
if (cv::ocl::useOpenCL() && (condition) && func) \
{ \
printf("%s: OpenCL implementation is running\n", CV_Func); \
fflush(stdout); \
return
;
\
return
__VA_ARGS__;
\
} \
else \
{ \
...
...
@@ -23,11 +23,13 @@
} \
}
#else
#define CV_OCL_RUN
(condition, func)
\
#define CV_OCL_RUN
_(condition, func, ...)
\
if (cv::ocl::useOpenCL() && (condition) && func) \
return;
return
__VA_ARGS__
;
#endif
#else
#define CV_OCL_RUN
(condition, func
)
#define CV_OCL_RUN
_(condition, func, retval
)
#endif
#define CV_OCL_RUN(condition, func) CV_OCL_RUN_(condition, func)
modules/core/src/stat.cpp
View file @
321782b9
...
...
@@ -475,7 +475,7 @@ static bool ocl_sum( InputArray _src, Scalar & res, int sum_op, InputArray _mask
int
type
=
_src
.
type
(),
depth
=
CV_MAT_DEPTH
(
type
),
cn
=
CV_MAT_CN
(
type
);
bool
doubleSupport
=
ocl
::
Device
::
getDefault
().
doubleFPConfig
()
>
0
;
if
(
(
!
doubleSupport
&&
depth
==
CV_64F
)
||
cn
>
4
||
cn
==
3
||
_src
.
dims
()
>
2
)
if
(
(
!
doubleSupport
&&
depth
==
CV_64F
)
||
cn
>
4
||
cn
==
3
)
return
false
;
int
dbsize
=
ocl
::
Device
::
getDefault
().
maxComputeUnits
();
...
...
@@ -533,8 +533,9 @@ cv::Scalar cv::sum( InputArray _src )
{
#ifdef HAVE_OPENCL
Scalar
_res
;
if
(
ocl
::
useOpenCL
()
&&
_src
.
isUMat
()
&&
ocl_sum
(
_src
,
_res
,
OCL_OP_SUM
))
return
_res
;
CV_OCL_RUN_
(
_src
.
isUMat
()
&&
_src
.
dims
()
<=
2
,
ocl_sum
(
_src
,
_res
,
OCL_OP_SUM
),
_res
)
#endif
Mat
src
=
_src
.
getMat
();
...
...
@@ -674,8 +675,9 @@ int cv::countNonZero( InputArray _src )
#ifdef HAVE_OPENCL
int
res
=
-
1
;
if
(
ocl
::
useOpenCL
()
&&
_src
.
isUMat
()
&&
ocl_countNonZero
(
_src
,
res
))
return
res
;
CV_OCL_RUN_
(
_src
.
isUMat
()
&&
_src
.
dims
()
<=
2
,
ocl_countNonZero
(
_src
,
res
),
res
)
#endif
Mat
src
=
_src
.
getMat
();
...
...
@@ -1985,8 +1987,9 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
#ifdef HAVE_OPENCL
double
_result
=
0
;
if
(
ocl
::
useOpenCL
()
&&
_src
.
isUMat
()
&&
_src
.
dims
()
<=
2
&&
ocl_norm
(
_src
,
normType
,
_mask
,
_result
))
return
_result
;
CV_OCL_RUN_
(
_src
.
isUMat
()
&&
_src
.
dims
()
<=
2
,
ocl_norm
(
_src
,
normType
,
_mask
,
_result
),
_result
)
#endif
Mat
src
=
_src
.
getMat
(),
mask
=
_mask
.
getMat
();
...
...
@@ -2320,9 +2323,10 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
#ifdef HAVE_OPENCL
double
_result
=
0
;
if
(
ocl
::
useOpenCL
()
&&
_mask
.
empty
()
&&
_src1
.
isUMat
()
&&
_src2
.
isUMat
()
&&
_src1
.
dims
()
<=
2
&&
_src2
.
dims
()
<=
2
&&
ocl_norm
(
_src1
,
_src2
,
normType
,
_result
))
return
_result
;
CV_OCL_RUN_
(
_mask
.
empty
()
&&
_src1
.
isUMat
()
&&
_src2
.
isUMat
()
&&
_src1
.
dims
()
<=
2
&&
_src2
.
dims
()
<=
2
,
ocl_norm
(
_src1
,
_src2
,
normType
,
_result
),
_result
)
#endif
if
(
normType
&
CV_RELATIVE
)
...
...
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