| 681 | } |
| 682 | |
| 683 | void cv::gpu::GpuMat::create(int _rows, int _cols, int _type) |
| 684 | { |
| 685 | _type &= TYPE_MASK; |
| 686 | |
| 687 | if (rows == _rows && cols == _cols && type() == _type && data) |
| 688 | return; |
| 689 | |
| 690 | if (data) |
| 691 | release(); |
| 692 | |
| 693 | CV_DbgAssert(_rows >= 0 && _cols >= 0); |
| 694 | |
| 695 | if (_rows > 0 && _cols > 0) |
| 696 | { |
| 697 | flags = Mat::MAGIC_VAL + _type; |
| 698 | rows = _rows; |
| 699 | cols = _cols; |
| 700 | |
| 701 | size_t esz = elemSize(); |
| 702 | |
| 703 | void* devPtr = NULL; |
| 704 | gpuFuncTable()->mallocPitch(&devPtr, &step, esz * cols, rows); |
| 705 | |
| 706 | // Single row must be continuous |
| 707 | if (rows == 1) |
| 708 | step = esz * cols; |
| 709 | |
| 710 | if (esz * cols == step) |
| 711 | flags |= Mat::CONTINUOUS_FLAG; |
| 712 | |
| 713 | int64 _nettosize = static_cast<int64>(step) * rows; |
| 714 | size_t nettosize = static_cast<size_t>(_nettosize); |
| 715 | |
| 716 | datastart = data = static_cast<uchar*>(devPtr); |
| 717 | dataend = data + nettosize; |
| 718 | |
| 719 | refcount = static_cast<int*>(fastMalloc(sizeof(*refcount))); |
| 720 | *refcount = 1; |
| 721 | } |
| 722 | } |
| 723 | |
| 724 | void cv::gpu::GpuMat::release() |
| 725 | { |
no test coverage detected