mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
core cuda changes
This commit is contained in:
@@ -158,6 +158,10 @@ public:
|
||||
//! decreases reference counter, deallocate the data when reference counter reaches 0
|
||||
CV_WRAP void release();
|
||||
|
||||
//! allocates or reuses underlying storage to fit the requested 2D size and type (no-op if already compatible)
|
||||
void fit(int rows, int cols, int type);
|
||||
void fit(Size size, int type);
|
||||
|
||||
//! swaps with other smart pointer
|
||||
CV_WRAP void swap(GpuMat& mat);
|
||||
|
||||
@@ -394,7 +398,7 @@ struct CV_EXPORTS_W GpuData
|
||||
class CV_EXPORTS_W GpuMatND
|
||||
{
|
||||
public:
|
||||
using SizeArray = std::vector<int>;
|
||||
using SizeArray = MatShape;
|
||||
using StepArray = std::vector<size_t>;
|
||||
using IndexArray = std::vector<int>;
|
||||
|
||||
@@ -409,7 +413,7 @@ public:
|
||||
@param type Array type. Use CV_8UC1, ..., CV_16FC4 to create 1-4 channel matrices, or
|
||||
CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
|
||||
*/
|
||||
GpuMatND(SizeArray size, int type);
|
||||
GpuMatND(const MatShape& shape, int type);
|
||||
|
||||
/** @overload
|
||||
@param size Array of integers specifying an n-dimensional array shape.
|
||||
@@ -424,7 +428,7 @@ public:
|
||||
(if specified, the last step must be equal to the element size, otherwise it will be added as such).
|
||||
If not specified, the matrix is assumed to be continuous.
|
||||
*/
|
||||
GpuMatND(SizeArray size, int type, void* data, StepArray step = StepArray());
|
||||
GpuMatND(const MatShape& shape, int type, void* data, StepArray step = StepArray());
|
||||
|
||||
/** @brief Allocates GPU memory.
|
||||
Suppose there is some GPU memory already allocated. In that case, this method may choose to reuse that
|
||||
@@ -433,12 +437,19 @@ public:
|
||||
(i.e., isSubmatrix() is false). In other words, this method guarantees that the GPU memory allocated by
|
||||
this method is always continuous and is not a sub-region of another GpuMatND.
|
||||
*/
|
||||
void create(SizeArray size, int type);
|
||||
void create(const MatShape& shape, int type);
|
||||
|
||||
void release();
|
||||
|
||||
void swap(GpuMatND& m) noexcept;
|
||||
|
||||
/** @brief Allocates or reuses underlying storage to fit the requested n-D size and type.
|
||||
- No-op if already compatible (sufficient capacity, continuous, not a submatrix, not external, no ROI).
|
||||
- Reallocates otherwise.
|
||||
Mirrors 2D GpuMat::fit semantics for multi-dimensional tensors.
|
||||
*/
|
||||
void fit(const MatShape& shape, int type);
|
||||
|
||||
/** @brief Creates a full copy of the array and the underlying data.
|
||||
The method creates a full copy of the array. It mimics the behavior of Mat::clone(), i.e.
|
||||
the original step is not taken into account. So, the array copy is a continuous array
|
||||
@@ -538,7 +549,7 @@ public:
|
||||
|
||||
private:
|
||||
//! internal use
|
||||
void setFields(SizeArray size, int type, StepArray step = StepArray());
|
||||
void setFields(MatShape size, int type, StepArray step = StepArray());
|
||||
|
||||
public:
|
||||
/*! includes several bit-fields:
|
||||
@@ -553,7 +564,7 @@ public:
|
||||
int dims;
|
||||
|
||||
//! shape of this array
|
||||
SizeArray size;
|
||||
MatShape size;
|
||||
|
||||
/*! step values
|
||||
Their semantics is identical to the semantics of step for Mat.
|
||||
@@ -580,6 +591,11 @@ private:
|
||||
size_t offset;
|
||||
};
|
||||
|
||||
// Provide namespace-level aliases for nested array types used in bindings
|
||||
using SizeArray = GpuMatND::SizeArray;
|
||||
using StepArray = GpuMatND::StepArray;
|
||||
using IndexArray = GpuMatND::IndexArray;
|
||||
|
||||
/** @brief Creates a continuous matrix.
|
||||
|
||||
@param rows Row count.
|
||||
|
||||
@@ -418,10 +418,10 @@ GpuMatND::GpuMatND() :
|
||||
}
|
||||
|
||||
inline
|
||||
GpuMatND::GpuMatND(SizeArray _size, int _type) :
|
||||
GpuMatND::GpuMatND(const MatShape& _shape, int _type) :
|
||||
flags(0), dims(0), data(nullptr), offset(0)
|
||||
{
|
||||
create(std::move(_size), _type);
|
||||
create(_shape, _type);
|
||||
}
|
||||
|
||||
inline
|
||||
|
||||
Reference in New Issue
Block a user