added enqueueHostCallback method to gpu::Stream

This commit is contained in:
Vladislav Vinogradov
2013-02-13 15:51:27 +04:00
parent ce2fd7fec9
commit a828b60765
4 changed files with 485 additions and 196 deletions

View File

@@ -145,43 +145,49 @@ public:
~Stream();
Stream(const Stream&);
Stream& operator=(const Stream&);
Stream& operator =(const Stream&);
bool queryIfComplete();
void waitForCompletion();
//! downloads asynchronously.
//! downloads asynchronously
// Warning! cv::Mat must point to page locked memory (i.e. to CudaMem data or to its subMat)
void enqueueDownload(const GpuMat& src, CudaMem& dst);
void enqueueDownload(const GpuMat& src, Mat& dst);
//! uploads asynchronously.
//! uploads asynchronously
// Warning! cv::Mat must point to page locked memory (i.e. to CudaMem data or to its ROI)
void enqueueUpload(const CudaMem& src, GpuMat& dst);
void enqueueUpload(const Mat& src, GpuMat& dst);
//! copy asynchronously
void enqueueCopy(const GpuMat& src, GpuMat& dst);
//! memory set asynchronously
void enqueueMemSet(GpuMat& src, Scalar val);
void enqueueMemSet(GpuMat& src, Scalar val, const GpuMat& mask);
// converts matrix type, ex from float to uchar depending on type
void enqueueConvert(const GpuMat& src, GpuMat& dst, int type, double a = 1, double b = 0);
//! converts matrix type, ex from float to uchar depending on type
void enqueueConvert(const GpuMat& src, GpuMat& dst, int dtype, double a = 1, double b = 0);
//! adds a callback to be called on the host after all currently enqueued items in the stream have completed
typedef void (*StreamCallback)(Stream& stream, int status, void* userData);
void enqueueHostCallback(StreamCallback callback, void* userData);
static Stream& Null();
operator bool() const;
private:
struct Impl;
explicit Stream(Impl* impl);
void create();
void release();
struct Impl;
Impl *impl;
friend struct StreamAccessor;
explicit Stream(Impl* impl);
};