added BufferPool class

This commit is contained in:
Vladislav Vinogradov
2013-10-07 18:25:55 +04:00
parent 988ab79acb
commit 5ea8085220
6 changed files with 60 additions and 34 deletions

View File

@@ -66,6 +66,7 @@ class cv::cuda::Stream::Impl
{
public:
cudaStream_t stream;
Ptr<StackAllocator> stackAllocator_;
Impl();
Impl(cudaStream_t stream);
@@ -73,17 +74,26 @@ public:
~Impl();
};
cv::cuda::BufferPool::BufferPool(Stream& stream) : allocator_(stream.impl_->stackAllocator_.get())
{
}
cv::cuda::Stream::Impl::Impl() : stream(0)
{
cudaSafeCall( cudaStreamCreate(&stream) );
stackAllocator_ = makePtr<StackAllocator>(stream);
}
cv::cuda::Stream::Impl::Impl(cudaStream_t stream_) : stream(stream_)
{
stackAllocator_ = makePtr<StackAllocator>(stream);
}
cv::cuda::Stream::Impl::~Impl()
{
stackAllocator_.release();
if (stream)
cudaStreamDestroy(stream);
}