Merge pull request #3523 from jet47:fix-cuda-buffer-pool

This commit is contained in:
Vadim Pisarevsky
2014-12-24 11:20:27 +00:00
4 changed files with 481 additions and 478 deletions

View File

@@ -490,6 +490,7 @@ private:
friend struct StreamAccessor;
friend class BufferPool;
friend class DefaultDeviceInitializer;
};
class CV_EXPORTS Event

View File

@@ -92,26 +92,6 @@ static inline void throw_no_cuda() { CV_Error(cv::Error::StsNotImplemented, "The
namespace cv { namespace cuda
{
class MemoryStack;
class CV_EXPORTS StackAllocator : public GpuMat::Allocator
{
public:
explicit StackAllocator(cudaStream_t stream);
~StackAllocator();
bool allocate(GpuMat* mat, int rows, int cols, size_t elemSize);
void free(GpuMat* mat);
private:
StackAllocator(const StackAllocator&);
StackAllocator& operator =(const StackAllocator&);
cudaStream_t stream_;
MemoryStack* memStack_;
size_t alignment_;
};
class CV_EXPORTS BufferPool
{
public:
@@ -120,6 +100,8 @@ namespace cv { namespace cuda
GpuMat getBuffer(int rows, int cols, int type);
GpuMat getBuffer(Size size, int type) { return getBuffer(size.height, size.width, type); }
GpuMat::Allocator* getAllocator() const { return allocator_; }
private:
GpuMat::Allocator* allocator_;
};