NVIDIA DeepStream SDK API Reference

6.4 Release
gstnvdspreprocess_allocator.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef __GSTNVDSPREPROCESSALLOCATOR_H__
24 #define __GSTNVDSPREPROCESSALLOCATOR_H__
25 
26 #include <cuda_runtime_api.h>
27 #include <gst/gst.h>
28 #include <vector>
29 #include "cudaEGL.h"
30 #include "nvbufsurface.h"
31 
42 typedef struct
43 {
47  std::vector<CUgraphicsResource> cuda_resources;
49  std::vector<CUeglFrame> egl_frames;
53  std::vector<void *> frame_memory_ptrs;
55 
65 
69 typedef struct {
71  guint width;
73  guint height;
77  guint batch_size;
81 
92 GstAllocator *gst_nvdspreprocess_allocator_new (GstNvDsPreProcessVideoBufferAllocatorInfo *info, size_t raw_buf_size,
93  guint gpu_id, gboolean debug_tensor);
94 
95 #endif
gst_nvdspreprocess_allocator_new
GstAllocator * gst_nvdspreprocess_allocator_new(GstNvDsPreProcessVideoBufferAllocatorInfo *info, size_t raw_buf_size, guint gpu_id, gboolean debug_tensor)
Create a new GstNvDsPreProcessAllocator with the given parameters.
gst_nvdspreprocess_buffer_get_memory
GstNvDsPreProcessMemory * gst_nvdspreprocess_buffer_get_memory(GstBuffer *buffer)
Get GstNvDsPreProcessMemory structure associated with buffer allocated using GstNvDsPreProcessAllocat...
GstNvDsPreProcessMemory::egl_frames
std::vector< CUeglFrame > egl_frames
Vector of CUDA eglFrames created by mapping the above cuda resources.
Definition: gstnvdspreprocess_allocator.h:49
NvBufSurface
Holds information about batched buffers.
Definition: nvbufsurface.h:503
GstNvDsPreProcessMemory::surf
NvBufSurface * surf
surface corresponding to memory allocated
Definition: gstnvdspreprocess_allocator.h:45
GstNvDsPreProcessVideoBufferAllocatorInfo
structure containing video buffer allocator info
Definition: gstnvdspreprocess_allocator.h:69
GstNvDsPreProcessVideoBufferAllocatorInfo::memory_type
NvBufSurfaceMemType memory_type
memory type of buffer
Definition: gstnvdspreprocess_allocator.h:79
GstNvDsPreProcessVideoBufferAllocatorInfo::batch_size
guint batch_size
batch size
Definition: gstnvdspreprocess_allocator.h:77
NvBufSurfaceMemType
NvBufSurfaceMemType
Specifies memory types for NvBufSurface.
Definition: nvbufsurface.h:300
GstNvDsPreProcessMemory::cuda_resources
std::vector< CUgraphicsResource > cuda_resources
Vector of cuda resources created by registering the above egl images in CUDA.
Definition: gstnvdspreprocess_allocator.h:47
GstNvDsPreProcessMemory::frame_memory_ptrs
std::vector< void * > frame_memory_ptrs
Vector of pointer to individual frame memories in the batch memory.
Definition: gstnvdspreprocess_allocator.h:53
GstBuffer
struct _GstBuffer GstBuffer
Definition: idatatype.h:19
GstNvDsPreProcessVideoBufferAllocatorInfo::width
guint width
video buffer width
Definition: gstnvdspreprocess_allocator.h:71
GstNvDsPreProcessMemory
This file describes the custom memory allocator for the Gstreamer TensorRT plugin.
Definition: gstnvdspreprocess_allocator.h:42
nvbufsurface.h
GstNvDsPreProcessMemory::dev_memory_ptr
void * dev_memory_ptr
Pointer to the memory allocated for the batch of frames (DGPU).
Definition: gstnvdspreprocess_allocator.h:51
GstNvDsPreProcessVideoBufferAllocatorInfo::height
guint height
video buffer height
Definition: gstnvdspreprocess_allocator.h:73
GstNvDsPreProcessVideoBufferAllocatorInfo::color_format
NvBufSurfaceColorFormat color_format
color format
Definition: gstnvdspreprocess_allocator.h:75
NvBufSurfaceColorFormat
NvBufSurfaceColorFormat
Defines color formats for NvBufSurface.
Definition: nvbufsurface.h:103