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
cd4b748b
Commit
cd4b748b
authored
Mar 23, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11064 from tomoaki0705:fixCudaStreamAsync
parents
fdd83e50
f4e5d777
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
6 deletions
+27
-6
private.cuda.hpp
modules/core/include/opencv2/core/private.cuda.hpp
+4
-2
reductions.cpp
modules/cudaarithm/src/reductions.cpp
+5
-3
histogram.cpp
modules/cudaimgproc/src/histogram.cpp
+1
-1
test_histogram.cpp
modules/cudaimgproc/test/test_histogram.cpp
+17
-0
No files found.
modules/core/include/opencv2/core/private.cuda.hpp
View file @
cd4b748b
...
...
@@ -108,6 +108,8 @@ static inline void throw_no_cuda() { CV_Error(cv::Error::GpuNotSupported, "The l
#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"
);
}
namespace
cv
{
namespace
cuda
...
...
@@ -139,13 +141,13 @@ namespace cv { namespace cuda
inline
explicit
NppStreamHandler
(
Stream
&
newStream
)
{
oldStream
=
nppGetStream
();
nppS
etStream
(
StreamAccessor
::
getStream
(
newStream
));
nppS
afeSetStream
(
oldStream
,
StreamAccessor
::
getStream
(
newStream
));
}
inline
explicit
NppStreamHandler
(
cudaStream_t
newStream
)
{
oldStream
=
nppGetStream
();
nppS
etStream
(
newStream
);
nppS
afeSetStream
(
oldStream
,
newStream
);
}
inline
~
NppStreamHandler
()
...
...
modules/cudaarithm/src/reductions.cpp
View file @
cd4b748b
...
...
@@ -137,11 +137,12 @@ void cv::cuda::meanStdDev(InputArray _src, OutputArray _dst, Stream& stream)
if
(
!
deviceSupports
(
FEATURE_SET_COMPUTE_13
))
CV_Error
(
cv
::
Error
::
StsNotImplemented
,
"Not sufficient compute capebility"
);
const
GpuMat
src
=
getInputMat
(
_src
,
stream
);
GpuMat
src
=
getInputMat
(
_src
,
stream
);
CV_Assert
(
src
.
type
()
==
CV_8UC1
);
GpuMat
dst
=
getOutputMat
(
_dst
,
1
,
2
,
CV_64FC1
,
stream
);
_dst
.
create
(
1
,
2
,
CV_64FC1
);
GpuMat
dst
=
_dst
.
getGpuMat
();
NppiSize
sz
;
sz
.
width
=
src
.
cols
;
...
...
@@ -157,7 +158,8 @@ void cv::cuda::meanStdDev(InputArray _src, OutputArray _dst, Stream& stream)
BufferPool
pool
(
stream
);
GpuMat
buf
=
pool
.
getBuffer
(
1
,
bufSize
,
CV_8UC1
);
NppStreamHandler
h
(
StreamAccessor
::
getStream
(
stream
));
// detail: https://github.com/opencv/opencv/issues/11063
//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
)
);
...
...
modules/cudaimgproc/src/histogram.cpp
View file @
cd4b748b
...
...
@@ -107,7 +107,7 @@ namespace hist
void
cv
::
cuda
::
equalizeHist
(
InputArray
_src
,
OutputArray
_dst
,
Stream
&
_stream
)
{
GpuMat
src
=
_src
.
getGpuMat
(
);
GpuMat
src
=
getInputMat
(
_src
,
_stream
);
CV_Assert
(
src
.
type
()
==
CV_8UC1
);
...
...
modules/cudaimgproc/test/test_histogram.cpp
View file @
cd4b748b
...
...
@@ -194,6 +194,23 @@ PARAM_TEST_CASE(EqualizeHist, cv::cuda::DeviceInfo, cv::Size)
}
};
CUDA_TEST_P
(
EqualizeHist
,
Async
)
{
cv
::
Mat
src
=
randomMat
(
size
,
CV_8UC1
);
cv
::
cuda
::
Stream
stream
;
cv
::
cuda
::
GpuMat
dst
;
cv
::
cuda
::
equalizeHist
(
loadMat
(
src
),
dst
,
stream
);
stream
.
waitForCompletion
();
cv
::
Mat
dst_gold
;
cv
::
equalizeHist
(
src
,
dst_gold
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst
,
3.0
);
}
CUDA_TEST_P
(
EqualizeHist
,
Accuracy
)
{
cv
::
Mat
src
=
randomMat
(
size
,
CV_8UC1
);
...
...
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