add cv::gpu::StreamAccessor::wrapStream method
it allows to import existed CUDA stream to OpenCV
This commit is contained in:
@@ -44,6 +44,8 @@
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
#include "opencv2/gpu/stream_accessor.hpp"
|
||||
|
||||
using namespace cvtest;
|
||||
|
||||
#if CUDART_VERSION >= 5000
|
||||
@@ -125,6 +127,25 @@ GPU_TEST_P(Async, Convert)
|
||||
stream.waitForCompletion();
|
||||
}
|
||||
|
||||
GPU_TEST_P(Async, WrapStream)
|
||||
{
|
||||
cudaStream_t cuda_stream = NULL;
|
||||
ASSERT_EQ(cudaSuccess, cudaStreamCreate(&cuda_stream));
|
||||
|
||||
cv::gpu::Stream stream = cv::gpu::StreamAccessor::wrapStream(cuda_stream);
|
||||
|
||||
stream.enqueueUpload(src, d_src);
|
||||
stream.enqueueConvert(d_src, d_dst, CV_32S);
|
||||
stream.enqueueDownload(d_dst, dst);
|
||||
|
||||
Async* test = this;
|
||||
stream.enqueueHostCallback(checkConvert, test);
|
||||
|
||||
stream.waitForCompletion();
|
||||
|
||||
ASSERT_EQ(cudaSuccess, cudaStreamDestroy(cuda_stream));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_Stream, Async, ALL_DEVICES);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user