NVIDIA DeepStream SDK API Reference

8.0 Release
includes/nvll_osd.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
13 #ifndef __NVLL_OSD_H__
14 #define __NVLL_OSD_H__
15 
16 #include "nvll_osd_api.h"
17 
18 #include "nvbufsurface.h"
19 #include "cuosd.h"
20 #include <cairo.h>
21 #include <unordered_map>
22 #include "time.h"
23 #include <cuda_runtime.h>
24 
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #endif
29 
30 typedef struct _NvOSDFdMap
31 {
32  void *mapping;
33  cairo_surface_t *surface;
34  cairo_t *cairo_context;
35  int dmabuf_fd;
36  int size;
38 }NvOSDFdMap;
39 
40 typedef struct _NvOSD_Ctx {
42  void * in_buf;
49  unsigned int map_cnt;
50  std::unordered_map <int, void *> *map_list;
51  struct timeval t1, t2, prev_t1;
52  int frameNum;
54  double elapsedTime;
55  double totalReadTime;
56  double fps;
57  double avg_fps;
58  double display_fps;
59  void * conv_buf;
62  float *mask_buf;
63  unsigned int mask_buf_size;
64  unsigned int mask_buf_offset;
65  cudaStream_t stream { nullptr };
67 } NvOSD_Ctx;
68 
69 int CopytoHostMem(void *nvosd_ctx, void *cuDevPtr);
70 
71 int CopytoDeviceMem(void *nvosd_ctx, void *cuDevPtr);
72 
73 /* Mask the region using VIC */
75 
77 
78 /* frame green, cyan, blue, yellow, red, black, white */
79 /* TODO: Get predetermined clr from app */
80 //int COLORS[8] = {0xff00ff, 0x00ff00, 0xff00ff, 0x0000ff, 0xffff000, 0xff0000, 0x000000, 0xffffff};
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
87 #endif
_NvOSDFdMap::surface
cairo_surface_t * surface
Definition: includes/nvll_osd.h:33
_NvOSD_Ctx::display_fps
double display_fps
Definition: includes/nvll_osd.h:58
_NvOSD_RectParams
Holds the box parameters of the box to be overlayed.
Definition: nvll_osd_struct.h:140
_NvOSD_Ctx::mask_buf_offset
unsigned int mask_buf_offset
Definition: includes/nvll_osd.h:64
_NvOSD_Ctx::enable_clock
int enable_clock
Definition: includes/nvll_osd.h:41
CopytoDeviceMem
int CopytoDeviceMem(void *nvosd_ctx, void *cuDevPtr)
nvll_osd_api.h
_NvOSD_Ctx::fps
double fps
Definition: includes/nvll_osd.h:56
NvBufSurface
Holds information about batched buffers.
Definition: nvbufsurface.h:577
_NvOSD_Ctx::frame_width
int frame_width
Definition: includes/nvll_osd.h:43
_NvOSD_Ctx
Definition: includes/nvll_osd.h:40
_NvOSD_Ctx::params
NvBufSurfacePlaneParams * params
Definition: includes/nvll_osd.h:45
_NvOSDFdMap
Definition: includes/nvll_osd.h:30
_NvOSD_Ctx::avg_fps
double avg_fps
Definition: includes/nvll_osd.h:57
cuOSDContext
Definition: cuosd.h:16
_NvOSD_Ctx::map_list
std::unordered_map< int, void * > * map_list
Definition: includes/nvll_osd.h:50
NvBufSurfaceParams
Hold the information of single buffer in the batch.
Definition: nvbufsurface.h:542
_NvOSD_Ctx::elapsedTime
double elapsedTime
Definition: includes/nvll_osd.h:54
_NvOSD_Ctx::mask_buf_size
unsigned int mask_buf_size
Definition: includes/nvll_osd.h:63
cudaStream_t
struct CUstream_st * cudaStream_t
Forward declaration of cudaStream_t.
Definition: nvbufsurftransform.h:35
NvOSDFdMap
struct _NvOSDFdMap NvOSDFdMap
_NvOSD_Ctx::nvosd_map
NvOSDFdMap * nvosd_map
Definition: includes/nvll_osd.h:60
set_cairo_context
NvOSDFdMap * set_cairo_context(NvOSD_Ctx *ctx, NvBufSurfaceParams *buf_ptr, NvBufSurface *nvbuf_surf)
_NvOSD_Ctx::frameNum
int frameNum
Definition: includes/nvll_osd.h:52
_NvOSD_Ctx::conv_buf
void * conv_buf
Definition: includes/nvll_osd.h:59
_NvOSD_Ctx::prev_t1
struct timeval t1 t2 prev_t1
Definition: includes/nvll_osd.h:51
_NvOSD_Ctx::num_classes
int num_classes
Definition: includes/nvll_osd.h:61
_NvOSD_Ctx::map_cnt
unsigned int map_cnt
Definition: includes/nvll_osd.h:49
_NvOSD_Ctx::stream
cudaStream_t stream
Definition: includes/nvll_osd.h:65
_NvOSD_Ctx::frame_height
int frame_height
Definition: includes/nvll_osd.h:44
_NvOSD_Ctx::is_integrated
int is_integrated
Definition: includes/nvll_osd.h:53
_NvOSDFdMap::mapping
void * mapping
Definition: includes/nvll_osd.h:32
_NvOSD_TextParams
Holds parameters of text to be overlayed.
Definition: nvll_osd_struct.h:115
color_compare
bool color_compare(NvOSD_RectParams lhs, NvOSD_RectParams rhs)
cuosd.h
_NvOSD_Ctx::cuosd_context
cuOSDContext_t cuosd_context
Definition: includes/nvll_osd.h:66
_NvOSDFdMap::size
int size
Definition: includes/nvll_osd.h:36
NvBufSurfacePlaneParams
Holds plane wise parameters of a buffer.
Definition: nvbufsurface.h:387
_NvOSDFdMap::dmabuf_fd
int dmabuf_fd
Definition: includes/nvll_osd.h:35
_NvOSD_Ctx::mask_buf
float * mask_buf
Definition: includes/nvll_osd.h:62
_NvOSDFdMap::cairo_context
cairo_t * cairo_context
Definition: includes/nvll_osd.h:34
_NvOSD_Ctx::solid_rect_params_list
NvOSD_RectParams * solid_rect_params_list
Definition: includes/nvll_osd.h:47
NvOSD_Ctx
struct _NvOSD_Ctx NvOSD_Ctx
_NvOSDFdMap::surf
NvBufSurface * surf
Definition: includes/nvll_osd.h:37
nvbufsurface.h
_NvOSD_Ctx::clk_params
NvOSD_TextParams clk_params
Definition: includes/nvll_osd.h:46
_NvOSD_Ctx::in_buf
void * in_buf
Definition: includes/nvll_osd.h:42
_NvOSD_Ctx::alpha_rect_params_list
NvOSD_RectParams * alpha_rect_params_list
Definition: includes/nvll_osd.h:48
CopytoHostMem
int CopytoHostMem(void *nvosd_ctx, void *cuDevPtr)
_NvOSD_Ctx::totalReadTime
double totalReadTime
Definition: includes/nvll_osd.h:55