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
d08b1636
Commit
d08b1636
authored
Sep 18, 2013
by
Andrey Pavlenko
Committed by
OpenCV Buildbot
Sep 18, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1468 from alalek:fix_alignSize_usage
parents
6fae07ba
f1b5cbc8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
core.hpp
modules/core/include/opencv2/core/core.hpp
+1
-0
initialization.cpp
modules/ocl/src/initialization.cpp
+13
-3
No files found.
modules/core/include/opencv2/core/core.hpp
View file @
d08b1636
...
...
@@ -339,6 +339,7 @@ template<typename _Tp> static inline _Tp* alignPtr(_Tp* ptr, int n=(int)sizeof(_
*/
static
inline
size_t
alignSize
(
size_t
sz
,
int
n
)
{
assert
((
n
&
(
n
-
1
))
==
0
);
// n is a power of 2
return
(
sz
+
n
-
1
)
&
-
n
;
}
...
...
modules/ocl/src/initialization.cpp
View file @
d08b1636
...
...
@@ -679,6 +679,16 @@ namespace cv
CV_Assert
(
localThreads
[
0
]
*
localThreads
[
1
]
*
localThreads
[
2
]
<=
clCxt
->
impl
->
maxWorkGroupSize
);
}
static
inline
size_t
roundUp
(
size_t
sz
,
size_t
n
)
{
// we don't assume that n is a power of 2 (see alignSize)
// equal to divUp(sz, n) * n
size_t
t
=
sz
+
n
-
1
;
size_t
rem
=
t
%
n
;
size_t
result
=
t
-
rem
;
return
result
;
}
#ifdef PRINT_KERNEL_RUN_TIME
static
double
total_execute_time
=
0
;
static
double
total_kernel_time
=
0
;
...
...
@@ -702,9 +712,9 @@ namespace cv
if
(
localThreads
!=
NULL
)
{
globalThreads
[
0
]
=
alignSize
(
globalThreads
[
0
],
localThreads
[
0
]);
globalThreads
[
1
]
=
alignSize
(
globalThreads
[
1
],
localThreads
[
1
]);
globalThreads
[
2
]
=
alignSize
(
globalThreads
[
2
],
localThreads
[
2
]);
globalThreads
[
0
]
=
roundUp
(
globalThreads
[
0
],
localThreads
[
0
]);
globalThreads
[
1
]
=
roundUp
(
globalThreads
[
1
],
localThreads
[
1
]);
globalThreads
[
2
]
=
roundUp
(
globalThreads
[
2
],
localThreads
[
2
]);
cv
::
ocl
::
openCLVerifyKernel
(
clCxt
,
kernel
,
localThreads
);
}
...
...
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