MCPcopy Create free account
hub / github.com/CVCUDA/CV-CUDA / CreateHostVector

Method CreateHostVector

python/mod_cvcuda/nvcv/Image.cpp:713–732  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

711}
712
713std::shared_ptr<Image> Image::CreateHostVector(std::vector<py::buffer> buffers, nvcv::ImageFormat fmt, int rowAlign)
714{
715 std::vector<DLPackTensor> dlTensorList;
716
717 for (size_t i = 0; i < buffers.size(); ++i)
718 {
719 dlTensorList.emplace_back(buffers[i].request(), DLDevice{kDLCPU, 0});
720 }
721
722 nvcv::ImageDataStridedHost imgData = CreateNVCVImageDataHost(std::move(dlTensorList), fmt);
723
724 // We take this opportunity to remove all wrappers from cache.
725 // They aren't reusable anyway.
726 Image::Key key;
727 Cache::Instance().removeAllNotInUseMatching(key);
728
729 std::shared_ptr<Image> img(new Image(std::move(buffers), imgData, rowAlign));
730 Cache::Instance().add(*img);
731 return img;
732}
733
734Size2D Image::size() const
735{

Callers

nothing calls this directly

Calls 5

CreateNVCVImageDataHostFunction · 0.85
sizeMethod · 0.45
emplace_backMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected