NVIDIA DeepStream SDK API Reference

9.1 Release
sources/includes/nvll_osd.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef __NVLL_OSD_H__
19 #define __NVLL_OSD_H__
20 
21 #include "nvll_osd_api.h"
22 
23 #include "nvbufsurface.h"
24 #include "cuosd.h"
25 #include <cairo.h>
26 #include <unordered_map>
27 #include "time.h"
28 #include <cuda_runtime.h>
29 
30 #ifdef __cplusplus
31 extern "C"
32 {
33 #endif
34 
35 typedef struct _NvOSDFdMap
36 {
37  void *mapping;
38  cairo_surface_t *surface;
39  cairo_t *cairo_context;
40  int dmabuf_fd;
41  int size;
43 }NvOSDFdMap;
44 
45 typedef struct _NvOSD_Ctx {
47  void * in_buf;
54  unsigned int map_cnt;
55  std::unordered_map <int, void *> *map_list;
56  struct timeval t1, t2, prev_t1;
57  int frameNum;
59  double elapsedTime;
60  double totalReadTime;
61  double fps;
62  double avg_fps;
63  double display_fps;
64  void * conv_buf;
67  float *mask_buf;
68  unsigned int mask_buf_size;
69  unsigned int mask_buf_offset;
70  cudaStream_t stream { nullptr };
72 } NvOSD_Ctx;
73 
74 int CopytoHostMem(void *nvosd_ctx, void *cuDevPtr);
75 
76 int CopytoDeviceMem(void *nvosd_ctx, void *cuDevPtr);
77 
78 /* Mask the region using VIC */
80 
82 
83 /* frame green, cyan, blue, yellow, red, black, white */
84 /* TODO: Get predetermined clr from app */
85 //int COLORS[8] = {0xff00ff, 0x00ff00, 0xff00ff, 0x0000ff, 0xffff000, 0xff0000, 0x000000, 0xffffff};
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
92 #endif
cudaStream_t
struct CUstream_st * cudaStream_t
Forward declaration of cudaStream_t.
Definition: sources/includes/nvbufsurftransform.h:35
_NvOSDFdMap::surface
cairo_surface_t * surface
Definition: sources/includes/nvll_osd.h:38
_NvOSD_Ctx::display_fps
double display_fps
Definition: sources/includes/nvll_osd.h:63
_NvOSD_RectParams
Holds the box parameters of the box to be overlayed.
Definition: sources/includes/nvll_osd_struct.h:145
NvOSDFdMap
struct _NvOSDFdMap NvOSDFdMap
_NvOSD_Ctx::mask_buf_offset
unsigned int mask_buf_offset
Definition: sources/includes/nvll_osd.h:69
_NvOSD_Ctx::enable_clock
int enable_clock
Definition: sources/includes/nvll_osd.h:46
_NvOSD_Ctx::fps
double fps
Definition: sources/includes/nvll_osd.h:61
color_compare
bool color_compare(NvOSD_RectParams lhs, NvOSD_RectParams rhs)
nvll_osd_api.h
NvBufSurface
Holds information about batched buffers.
Definition: sources/includes/nvbufsurface.h:597
_NvOSD_Ctx::frame_width
int frame_width
Definition: sources/includes/nvll_osd.h:48
_NvOSD_Ctx
Definition: sources/includes/nvll_osd.h:45
_NvOSD_Ctx::params
NvBufSurfacePlaneParams * params
Definition: sources/includes/nvll_osd.h:50
_NvOSDFdMap
Definition: sources/includes/nvll_osd.h:35
_NvOSD_Ctx::avg_fps
double avg_fps
Definition: sources/includes/nvll_osd.h:62
nvbufsurface.h
cuOSDContext
Definition: sources/libs/nvll_osd/cuosd.h:21
_NvOSD_Ctx::map_list
std::unordered_map< int, void * > * map_list
Definition: sources/includes/nvll_osd.h:55
NvBufSurfaceParams
Hold the information of single buffer in the batch.
Definition: sources/includes/nvbufsurface.h:562
_NvOSD_Ctx::elapsedTime
double elapsedTime
Definition: sources/includes/nvll_osd.h:59
_NvOSD_Ctx::mask_buf_size
unsigned int mask_buf_size
Definition: sources/includes/nvll_osd.h:68
_NvOSD_Ctx::nvosd_map
NvOSDFdMap * nvosd_map
Definition: sources/includes/nvll_osd.h:65
_NvOSD_Ctx::frameNum
int frameNum
Definition: sources/includes/nvll_osd.h:57
_NvOSD_Ctx::conv_buf
void * conv_buf
Definition: sources/includes/nvll_osd.h:64
_NvOSD_Ctx::prev_t1
struct timeval t1 t2 prev_t1
Definition: sources/includes/nvll_osd.h:56
_NvOSD_Ctx::num_classes
int num_classes
Definition: sources/includes/nvll_osd.h:66
_NvOSD_Ctx::map_cnt
unsigned int map_cnt
Definition: sources/includes/nvll_osd.h:54
CopytoHostMem
int CopytoHostMem(void *nvosd_ctx, void *cuDevPtr)
_NvOSD_Ctx::stream
cudaStream_t stream
Definition: sources/includes/nvll_osd.h:70
_NvOSD_Ctx::frame_height
int frame_height
Definition: sources/includes/nvll_osd.h:49
NvOSD_Ctx
struct _NvOSD_Ctx NvOSD_Ctx
_NvOSD_Ctx::is_integrated
int is_integrated
Definition: sources/includes/nvll_osd.h:58
_NvOSDFdMap::mapping
void * mapping
Definition: sources/includes/nvll_osd.h:37
_NvOSD_TextParams
Holds parameters of text to be overlayed.
Definition: sources/includes/nvll_osd_struct.h:120
_NvOSD_Ctx::cuosd_context
cuOSDContext_t cuosd_context
Definition: sources/includes/nvll_osd.h:71
_NvOSDFdMap::size
int size
Definition: sources/includes/nvll_osd.h:41
NvBufSurfacePlaneParams
Holds plane wise parameters of a buffer.
Definition: sources/includes/nvbufsurface.h:407
_NvOSDFdMap::dmabuf_fd
int dmabuf_fd
Definition: sources/includes/nvll_osd.h:40
_NvOSD_Ctx::mask_buf
float * mask_buf
Definition: sources/includes/nvll_osd.h:67
_NvOSDFdMap::cairo_context
cairo_t * cairo_context
Definition: sources/includes/nvll_osd.h:39
_NvOSD_Ctx::solid_rect_params_list
NvOSD_RectParams * solid_rect_params_list
Definition: sources/includes/nvll_osd.h:52
set_cairo_context
NvOSDFdMap * set_cairo_context(NvOSD_Ctx *ctx, NvBufSurfaceParams *buf_ptr, NvBufSurface *nvbuf_surf)
_NvOSDFdMap::surf
NvBufSurface * surf
Definition: sources/includes/nvll_osd.h:42
_NvOSD_Ctx::clk_params
NvOSD_TextParams clk_params
Definition: sources/includes/nvll_osd.h:51
_NvOSD_Ctx::in_buf
void * in_buf
Definition: sources/includes/nvll_osd.h:47
CopytoDeviceMem
int CopytoDeviceMem(void *nvosd_ctx, void *cuDevPtr)
_NvOSD_Ctx::alpha_rect_params_list
NvOSD_RectParams * alpha_rect_params_list
Definition: sources/includes/nvll_osd.h:53
_NvOSD_Ctx::totalReadTime
double totalReadTime
Definition: sources/includes/nvll_osd.h:60