1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

add cuda::Stream constructor with cuda flags

This commit is contained in:
Dale Phurrough
2021-01-28 16:14:01 +01:00
parent 1363496c11
commit 34c3f0f495
4 changed files with 54 additions and 0 deletions
+19
View File
@@ -41,6 +41,7 @@
//M*/
#include "precomp.hpp"
#include <cstdint>
using namespace cv;
using namespace cv::cuda;
@@ -293,6 +294,7 @@ public:
Impl();
Impl(const Ptr<GpuMat::Allocator>& allocator);
Impl(const unsigned int cudaFlags);
explicit Impl(cudaStream_t stream);
~Impl();
@@ -312,6 +314,13 @@ cv::cuda::Stream::Impl::Impl(const Ptr<GpuMat::Allocator>& allocator) : stream(0
ownStream = true;
}
cv::cuda::Stream::Impl::Impl(const unsigned int cudaFlags) : stream(0), ownStream(false)
{
cudaSafeCall(cudaStreamCreateWithFlags(&stream, cudaFlags));
ownStream = true;
allocator = makePtr<StackAllocator>(stream);
}
cv::cuda::Stream::Impl::Impl(cudaStream_t stream_) : stream(stream_), ownStream(false)
{
allocator = makePtr<StackAllocator>(stream);
@@ -450,6 +459,16 @@ cv::cuda::Stream::Stream(const Ptr<GpuMat::Allocator>& allocator)
#endif
}
cv::cuda::Stream::Stream(const size_t cudaFlags)
{
#ifndef HAVE_CUDA
CV_UNUSED(cudaFlags);
throw_no_cuda();
#else
impl_ = makePtr<Impl>(cudaFlags & UINT_MAX);
#endif
}
bool cv::cuda::Stream::queryIfComplete() const
{
#ifndef HAVE_CUDA