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

Method Create

python/mod_cvcuda/nvcv/ImageBatch.cpp:41–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41std::shared_ptr<ImageBatchVarShape> ImageBatchVarShape::Create(int capacity)
42{
43 std::vector<std::shared_ptr<CacheItem>> vcont = Cache::Instance().fetch(Key{capacity});
44
45 // None found?
46 if (vcont.empty())
47 {
48 std::shared_ptr<ImageBatchVarShape> batch(new ImageBatchVarShape(capacity));
49 Cache::Instance().add(*batch);
50 return batch;
51 }
52 else
53 {
54 // Get the first one
55 auto batch = std::static_pointer_cast<ImageBatchVarShape>(vcont[0]);
56 Image::Key key;
57 batch->clear(); // make sure it's in pristine state
58 return batch;
59 }
60}
61
62std::shared_ptr<ImageBatchVarShape> ImageBatchVarShape::WrapExternalBufferVector(std::vector<py::object> buffers,
63 nvcv::ImageFormat fmt)

Callers

nothing calls this directly

Calls 4

fetchMethod · 0.45
emptyMethod · 0.45
addMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected