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
6c253510
Commit
6c253510
authored
Mar 15, 2018
by
Tomoaki Teshima
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make the asynchronous call to NPP safe
* Stop calling nppSetStream
parent
2dff9f4c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
private.cuda.hpp
modules/core/include/opencv2/core/private.cuda.hpp
+4
-2
reductions.cpp
modules/cudaarithm/src/reductions.cpp
+0
-2
No files found.
modules/core/include/opencv2/core/private.cuda.hpp
View file @
6c253510
...
@@ -108,6 +108,8 @@ static inline void throw_no_cuda() { CV_Error(cv::Error::GpuNotSupported, "The l
...
@@ -108,6 +108,8 @@ static inline void throw_no_cuda() { CV_Error(cv::Error::GpuNotSupported, "The l
#else // HAVE_CUDA
#else // HAVE_CUDA
#define nppSafeSetStream(oldStream, newStream) { if(oldStream != newStream) { cudaStreamSynchronize(oldStream); nppSetStream(newStream); } }
static
inline
void
throw_no_cuda
()
{
CV_Error
(
cv
::
Error
::
StsNotImplemented
,
"The called functionality is disabled for current build or platform"
);
}
static
inline
void
throw_no_cuda
()
{
CV_Error
(
cv
::
Error
::
StsNotImplemented
,
"The called functionality is disabled for current build or platform"
);
}
namespace
cv
{
namespace
cuda
namespace
cv
{
namespace
cuda
...
@@ -139,13 +141,13 @@ namespace cv { namespace cuda
...
@@ -139,13 +141,13 @@ namespace cv { namespace cuda
inline
explicit
NppStreamHandler
(
Stream
&
newStream
)
inline
explicit
NppStreamHandler
(
Stream
&
newStream
)
{
{
oldStream
=
nppGetStream
();
oldStream
=
nppGetStream
();
nppS
etStream
(
StreamAccessor
::
getStream
(
newStream
));
nppS
afeSetStream
(
oldStream
,
StreamAccessor
::
getStream
(
newStream
));
}
}
inline
explicit
NppStreamHandler
(
cudaStream_t
newStream
)
inline
explicit
NppStreamHandler
(
cudaStream_t
newStream
)
{
{
oldStream
=
nppGetStream
();
oldStream
=
nppGetStream
();
nppS
etStream
(
newStream
);
nppS
afeSetStream
(
oldStream
,
newStream
);
}
}
inline
~
NppStreamHandler
()
inline
~
NppStreamHandler
()
...
...
modules/cudaarithm/src/reductions.cpp
View file @
6c253510
...
@@ -157,8 +157,6 @@ void cv::cuda::meanStdDev(InputArray _src, OutputArray _dst, Stream& stream)
...
@@ -157,8 +157,6 @@ void cv::cuda::meanStdDev(InputArray _src, OutputArray _dst, Stream& stream)
BufferPool
pool
(
stream
);
BufferPool
pool
(
stream
);
GpuMat
buf
=
pool
.
getBuffer
(
1
,
bufSize
,
CV_8UC1
);
GpuMat
buf
=
pool
.
getBuffer
(
1
,
bufSize
,
CV_8UC1
);
NppStreamHandler
h
(
StreamAccessor
::
getStream
(
stream
));
nppSafeCall
(
nppiMean_StdDev_8u_C1R
(
src
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src
.
step
),
sz
,
buf
.
ptr
<
Npp8u
>
(),
dst
.
ptr
<
Npp64f
>
(),
dst
.
ptr
<
Npp64f
>
()
+
1
)
);
nppSafeCall
(
nppiMean_StdDev_8u_C1R
(
src
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src
.
step
),
sz
,
buf
.
ptr
<
Npp8u
>
(),
dst
.
ptr
<
Npp64f
>
(),
dst
.
ptr
<
Npp64f
>
()
+
1
)
);
syncOutput
(
dst
,
_dst
,
stream
);
syncOutput
(
dst
,
_dst
,
stream
);
...
...
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