NVIDIA DeepStream SDK API Reference

9.1 Release
sources/includes/nvll_osd_int.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2019-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 #include <stdio.h>
19 #include <stdlib.h>
20 #include <string.h>
21 #include <pango/pangocairo.h>
22 #include <math.h>
23 #include "nvll_osd.h"
24 
25 inline bool CHECK_(int e, int iLine, const char *szFile) {
26  if (e != cudaSuccess) {
27  //cout << "CUDA runtime error " << e << " at line " << iLine << " in file " << szFile;
28  exit (-1);
29  return false;
30  }
31  return true;
32 }
33 
34 #define clip_rect(ctx, left, top, right, bottom) \
35 { \
36  if(left < 0) \
37  { \
38  left = 0; \
39  } \
40  if(top < 0) \
41  { \
42  top = 0; \
43  } \
44  if(right > ctx->frame_width) \
45  { \
46  right = ctx->frame_width; \
47  } \
48  if(bottom > ctx->frame_height) \
49  { \
50  bottom = ctx->frame_height; \
51  } \
52 }
53 
54 #define ck(call) CHECK_(call, __LINE__, __FILE__)
55 
56 void nvll_osd_resize_segment_masks_bg(NvOSD_Ctx *ctx, NvOSDFdMap *nvosd_map, NvOSD_RectParams *rect_params, NvOSD_MaskParams *mask_params, void** mask_argb32);
57 void nvll_osd_draw_segment_masks_bg(NvOSD_Ctx *ctx, NvOSDFdMap *nvosd_map, NvOSD_RectParams *rect_params, NvOSD_MaskParams *mask_params, void* mask_argb32);
58 void nvll_osd_draw_bounding_rectangles(NvOSD_Ctx *ctx, NvOSDFdMap *nvosd_map, NvOSD_RectParams *rect_params);
59 void nvll_osd_draw_mask_regions(NvOSD_Ctx *ctx, NvOSDFdMap *nvosd_map, NvOSD_RectParams *rect_params);
60 void nvll_osd_rect_with_border_bg(NvOSD_Ctx *ctx, NvOSDFdMap *nvosd_map, NvOSD_RectParams *rect_params);
61 
63  NvOSD_ArrowParams *arrow_params_list);
64 
65 int nvll_osd_draw_segment_masks_cpu(void *nvosd_ctx, NvOSD_FrameSegmentMaskParams *frame_mask_params);
66 int nvll_osd_draw_segment_masks_gpu(void *nvosd_ctx, NvOSD_FrameSegmentMaskParams *frame_mask_params);
67 
68 int nvll_osd_blur_rectangles_gpu(void *nvosd_ctx, NvOSD_FrameRectParams *frame_rect_params);
69 int nvll_osd_draw_rectangles_cpu(void *nvosd_ctx, NvOSD_FrameRectParams *frame_rect_params);
70 int nvll_osd_draw_rectangles_gpu(void *nvosd_ctx, NvOSD_FrameRectParams *frame_rect_params);
71 
72 int nvll_osd_draw_arrows_cpu(void *nvosd_ctx, NvOSD_FrameArrowParams *frame_arrow_params);
73 int nvll_osd_draw_arrows_gpu(void *nvosd_ctx, NvOSD_FrameArrowParams *frame_arrow_params);
74 
75 int nvll_osd_draw_circles_cpu(void *nvosd_ctx, NvOSD_FrameCircleParams *frame_circle_params);
76 int nvll_osd_draw_circles_gpu(void *nvosd_ctx, NvOSD_FrameCircleParams *frame_circle_params);
77 
78 int nvll_osd_draw_lines_cpu(void *nvosd_ctx, NvOSD_FrameLineParams *frame_line_params);
79 int nvll_osd_draw_lines_gpu(void *nvosd_ctx, NvOSD_FrameLineParams *frame_line_params);
80 
81 int nvll_osd_put_text_cpu(void *nvosd_ctx, NvOSD_FrameTextParams *frame_text_params);
82 int nvll_osd_put_text_gpu(void *nvosd_ctx, NvOSD_FrameTextParams *frame_text_params);
83 int nvll_osd_gpu_apply(void *nvosd_ctx, NvBufSurfaceParams *buf_ptr, NvBufSurface *surf);
_NvOSD_RectParams
Holds the box parameters of the box to be overlayed.
Definition: sources/includes/nvll_osd_struct.h:145
nvll_osd_draw_mask_regions
void nvll_osd_draw_mask_regions(NvOSD_Ctx *ctx, NvOSDFdMap *nvosd_map, NvOSD_RectParams *rect_params)
nvll_osd_draw_lines_cpu
int nvll_osd_draw_lines_cpu(void *nvosd_ctx, NvOSD_FrameLineParams *frame_line_params)
_NvOSD_MaskParams
Holds the mask parameters of the segment to be overlayed.
Definition: sources/includes/nvll_osd_struct.h:177
nvll_osd_draw_arrows_gpu
int nvll_osd_draw_arrows_gpu(void *nvosd_ctx, NvOSD_FrameArrowParams *frame_arrow_params)
nvll_osd_draw_segment_masks_gpu
int nvll_osd_draw_segment_masks_gpu(void *nvosd_ctx, NvOSD_FrameSegmentMaskParams *frame_mask_params)
nvll_osd_put_text_cpu
int nvll_osd_put_text_cpu(void *nvosd_ctx, NvOSD_FrameTextParams *frame_text_params)
nvll_osd_draw_arrows_cpu
int nvll_osd_draw_arrows_cpu(void *nvosd_ctx, NvOSD_FrameArrowParams *frame_arrow_params)
NvBufSurface
Holds information about batched buffers.
Definition: sources/includes/nvbufsurface.h:597
nvll_osd_rect_with_border_bg
void nvll_osd_rect_with_border_bg(NvOSD_Ctx *ctx, NvOSDFdMap *nvosd_map, NvOSD_RectParams *rect_params)
_NvOSD_FrameRectParams
Holds information about the rectangles in a frame.
Definition: sources/includes/nvll_osd_api.h:76
nvll_osd_draw_segment_masks_bg
void nvll_osd_draw_segment_masks_bg(NvOSD_Ctx *ctx, NvOSDFdMap *nvosd_map, NvOSD_RectParams *rect_params, NvOSD_MaskParams *mask_params, void *mask_argb32)
_NvOSD_Ctx
Definition: sources/includes/nvll_osd.h:45
_NvOSDFdMap
Definition: sources/includes/nvll_osd.h:35
_NvOSD_ArrowParams
Holds arrow parameters to be overlaid.
Definition: sources/includes/nvll_osd_struct.h:207
nvll_osd_resize_segment_masks_bg
void nvll_osd_resize_segment_masks_bg(NvOSD_Ctx *ctx, NvOSDFdMap *nvosd_map, NvOSD_RectParams *rect_params, NvOSD_MaskParams *mask_params, void **mask_argb32)
nvll_osd_draw_rectangles_cpu
int nvll_osd_draw_rectangles_cpu(void *nvosd_ctx, NvOSD_FrameRectParams *frame_rect_params)
NvBufSurfaceParams
Hold the information of single buffer in the batch.
Definition: sources/includes/nvbufsurface.h:562
nvll_osd_draw_rectangles_gpu
int nvll_osd_draw_rectangles_gpu(void *nvosd_ctx, NvOSD_FrameRectParams *frame_rect_params)
_NvOSD_FrameCircleParams
Holds information about the circles in a frame.
Definition: sources/includes/nvll_osd_api.h:144
nvll_osd_draw_circles_cpu
int nvll_osd_draw_circles_cpu(void *nvosd_ctx, NvOSD_FrameCircleParams *frame_circle_params)
nvll_osd_draw_circles_gpu
int nvll_osd_draw_circles_gpu(void *nvosd_ctx, NvOSD_FrameCircleParams *frame_circle_params)
nvll_osd_gpu_apply
int nvll_osd_gpu_apply(void *nvosd_ctx, NvBufSurfaceParams *buf_ptr, NvBufSurface *surf)
CHECK_
bool CHECK_(int e, int iLine, const char *szFile)
Definition: sources/includes/nvll_osd_int.h:25
_NvOSD_FrameTextParams
Holds information about the text in a frame.
Definition: sources/includes/nvll_osd_api.h:60
nvll_osd_blur_rectangles_gpu
int nvll_osd_blur_rectangles_gpu(void *nvosd_ctx, NvOSD_FrameRectParams *frame_rect_params)
nvll_osd_construct_draw_arrows_cpu
void nvll_osd_construct_draw_arrows_cpu(NvOSD_Ctx *ctx, NvOSDFdMap *nvosd_map, NvOSD_ArrowParams *arrow_params_list)
_NvOSD_FrameArrowParams
Holds information about the arrows in a frame.
Definition: sources/includes/nvll_osd_api.h:128
_NvOSD_FrameSegmentMaskParams
Holds information about the rectangles in a frame.
Definition: sources/includes/nvll_osd_api.h:94
nvll_osd_draw_bounding_rectangles
void nvll_osd_draw_bounding_rectangles(NvOSD_Ctx *ctx, NvOSDFdMap *nvosd_map, NvOSD_RectParams *rect_params)
nvll_osd.h
nvll_osd_draw_lines_gpu
int nvll_osd_draw_lines_gpu(void *nvosd_ctx, NvOSD_FrameLineParams *frame_line_params)
nvll_osd_put_text_gpu
int nvll_osd_put_text_gpu(void *nvosd_ctx, NvOSD_FrameTextParams *frame_text_params)
nvll_osd_draw_segment_masks_cpu
int nvll_osd_draw_segment_masks_cpu(void *nvosd_ctx, NvOSD_FrameSegmentMaskParams *frame_mask_params)
_NvOSD_FrameLineParams
Holds information about the lines in a frame.
Definition: sources/includes/nvll_osd_api.h:112