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

Method exportData

src/nvcv/src/priv/ImageBatchVarShape.cpp:215–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213}
214
215void ImageBatchVarShape::exportData(CUstream stream, NVCVImageBatchData &data) const
216{
217 data.numImages = m_numImages;
218 data.bufferType = NVCV_IMAGE_BATCH_VARSHAPE_BUFFER_STRIDED_CUDA;
219
220 NVCVImageBatchVarShapeBufferStrided &buf = data.buffer.varShapeStrided;
221 buf.imageList = m_devImagesBuffer;
222 buf.formatList = m_devFormatsBuffer;
223 buf.hostFormatList = m_hostFormatsBuffer;
224
225 NVCV_ASSERT(m_dirtyStartingFromIndex <= m_numImages);
226
227 if (m_dirtyStartingFromIndex < m_numImages)
228 {
229 NVCV_CHECK_THROW(cudaStreamWaitEvent(stream, m_evPostFence));
230
231 NVCV_CHECK_THROW(cudaMemcpyAsync(
232 m_devImagesBuffer + m_dirtyStartingFromIndex, m_hostImagesBuffer + m_dirtyStartingFromIndex,
233 (m_numImages - m_dirtyStartingFromIndex) * sizeof(*m_devImagesBuffer), cudaMemcpyHostToDevice, stream));
234
235 NVCV_CHECK_THROW(cudaMemcpyAsync(
236 m_devFormatsBuffer + m_dirtyStartingFromIndex, m_hostFormatsBuffer + m_dirtyStartingFromIndex,
237 (m_numImages - m_dirtyStartingFromIndex) * sizeof(*m_devFormatsBuffer), cudaMemcpyHostToDevice, stream));
238
239 // Signal that we finished reading from m_hostBuffer
240 NVCV_CHECK_THROW(cudaEventRecord(m_evPostFence, stream));
241
242 // up to m_numImages, we're all good
243 m_dirtyStartingFromIndex = m_numImages;
244 }
245
246 doUpdateCache();
247
248 NVCV_ASSERT(m_cacheMaxSize);
249 buf.maxWidth = m_cacheMaxSize->w;
250 buf.maxHeight = m_cacheMaxSize->h;
251
252 NVCV_ASSERT(m_cacheUniqueFormat);
253 buf.uniqueFormat = m_cacheUniqueFormat->value();
254}
255
256void ImageBatchVarShape::pushImages(const NVCVImageHandle *images, int32_t numImages)
257{

Callers 1

doPushImageMethod · 0.45

Calls 1

valueMethod · 0.45

Tested by

no test coverage detected