NVIDIA DeepStream SDK API Reference

9.0 Release
sources/libs/nvll_osd/cuda/cuosd_kernel.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2023-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 CUOSD_KERNEL_H
14 #define CUOSD_KERNEL_H
15 
16 enum class ImageFormat : int {
17  None = 0,
18  RGB = 1,
19  RGBA = 2,
20  BlockLinearNV12 = 3,
21  PitchLinearNV12 = 4
22 };
23 
24 enum class CommandType : int {
25  None = 0,
26  Circle = 1,
27  Rectangle = 2,
28  Text = 3,
29  Segment = 4,
30  PolyFill = 5,
31  RGBASource = 6,
32  NV12Source = 7,
33  BoxBlur = 8
34 };
35 
36 struct TextLocation{
38  int text_x;
39  int text_w, text_h;
40 };
41 
42 // cuOSDContextCommand includes basic attributes for color and bounding box coordinate
45  unsigned char c0, c1, c2, c3;
46  int bounding_left = 0;
47  int bounding_top = 0;
48  int bounding_right = 0;
49  int bounding_bottom = 0;
50 };
51 
52 // CircleCommand:
53 // cx, cy: center point coordinate of the circle
54 // thickness: border width in case > 0, -1 stands for fill mode
57 
58  CircleCommand(int cx, int cy, int radius, int thickness, unsigned char c0, unsigned char c1, unsigned char c2, unsigned char c3);
59 };
60 
61 // RectangleCommand:
62 // ax1, ..., dy1: 4 outer corner points coordinate of the rectangle
63 // ax2, ..., dy2: 4 inner corner points coordinate of the rectangle
64 // a1 ------ d1
65 // | a2---d2 |
66 // | | | |
67 // | b2---c2 |
68 // b1 ------ c1
69 // thickness: border width in case > 0, -1 stands for fill mode
71  int thickness = -1;
72  bool interpolation = false;
73  float ax1, ay1, bx1, by1, cx1, cy1, dx1, dy1;
74  float ax2, ay2, bx2, by2, cx2, cy2, dx2, dy2;
75 
77 };
78 
80  int kernel_size = 7;
81  float* d_seg;
83 
85 };
86 
87 // TextCommand:
88 // text_line_size && ilocation are inner attribute for text memory management
91  int ilocation;
92 
93  TextCommand() = default;
94  TextCommand(int text_line_size, int ilocation, unsigned char c0, unsigned char c1, unsigned char c2, unsigned char c3);
95 };
96 
97 // SegmentCommand:
98 // scale_x: seg mask w / outer rect w
99 // scale_y: seg mask h / outer rect h
101  float* d_seg;
103  float scale_x, scale_y;
105 
106  SegmentCommand();
107 };
108 
109 // PolyFillCommand:
111  int* d_pts;
112  int n_pts;
113 
114  PolyFillCommand();
115 };
116 
117 // RGBASourceCommand:
118 // d_src: device pointer for incoming rgba source image
120  void* d_src;
122  float scale_x, scale_y;
123 
125 };
126 
127 // NV12SourceCommand:
128 // d_src0: device pointer for Y plane of incoming nv12 source image
129 // d_src1: device pointer for UV plane of incoming nv12 source image
130 // block_linear: input device pointers are block linear or pitch linear
132  void* d_src0;
133  void* d_src1;
135  float scale_x, scale_y;
137 
139 };
140 
142  void* image_data0, void* image_data1, int width, int stride, int height, ImageFormat format,
143  const TextLocation* text_location, const unsigned char* text_bitmap, int text_bitmap_width, const int* line_location_base,
144  const unsigned char* commands, const int* commands_offset, int num_commands,
145  int bounding_left, int bounding_top, int bounding_right, int bounding_bottom,
146  bool have_rotatebox, const unsigned char* blur_commands, int num_blur_commands,
147  void* stream
148 );
149 
150 #endif // CUOSD_KERNEL_H
RGBASourceCommand::scale_x
float scale_x
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:122
SegmentCommand::seg_threshold
float seg_threshold
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:104
BoxBlurCommand
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:79
CommandType::NV12Source
@ NV12Source
cuOSDImageFormat::RGB
@ RGB
PolyFillCommand::d_pts
int * d_pts
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:111
cuOSDContextCommand::bounding_bottom
int bounding_bottom
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:49
cuOSDContextCommand::bounding_right
int bounding_right
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:48
CommandType::None
@ None
TextLocation
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:36
TextLocation::text_x
int text_x
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:38
CircleCommand
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:55
RGBASourceCommand::src_stride
int src_stride
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:121
NV12SourceCommand::scale_y
float scale_y
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:135
RectangleCommand::cy1
float cy1
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:73
RectangleCommand::cx2
float cx2
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:74
CommandType
CommandType
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:24
SegmentCommand::scale_x
float scale_x
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:103
cuOSDClockFormat::None
@ None
CircleCommand::radius
int radius
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:56
RGBASourceCommand::RGBASourceCommand
RGBASourceCommand()
cuOSDContextCommand::c3
unsigned char c3
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:45
PolyFillCommand::n_pts
int n_pts
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:112
CircleCommand::CircleCommand
CircleCommand(int cx, int cy, int radius, int thickness, unsigned char c0, unsigned char c1, unsigned char c2, unsigned char c3)
cuOSDContextCommand::c0
unsigned char c0
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:45
RGBASourceCommand
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:119
RectangleCommand::ax1
float ax1
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:73
TextCommand
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:89
RectangleCommand::dx2
float dx2
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:74
NV12SourceCommand::src_width
int src_width
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:134
RectangleCommand::ax2
float ax2
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:74
RectangleCommand::interpolation
bool interpolation
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:72
cuOSDContextCommand
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:43
BoxBlurCommand::BoxBlurCommand
BoxBlurCommand()
CommandType::Segment
@ Segment
cuOSDContextCommand::bounding_left
int bounding_left
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:46
CommandType::PolyFill
@ PolyFill
RectangleCommand::dx1
float dx1
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:73
NV12SourceCommand::src_height
int src_height
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:134
CircleCommand::thickness
int thickness
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:56
RectangleCommand::by1
float by1
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:73
CommandType::Circle
@ Circle
RGBASourceCommand::scale_y
float scale_y
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:122
cuOSDContextCommand::type
CommandType type
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:44
NV12SourceCommand::scale_x
float scale_x
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:135
RectangleCommand::RectangleCommand
RectangleCommand()
cuOSDContextCommand::bounding_top
int bounding_top
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:47
CommandType::BoxBlur
@ BoxBlur
NV12SourceCommand::block_linear
bool block_linear
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:136
CircleCommand::cx
int cx
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:56
TextCommand::text_line_size
int text_line_size
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:90
BoxBlurCommand::seg_width
int seg_width
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:82
ImageFormat
ImageFormat
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:16
NV12SourceCommand::NV12SourceCommand
NV12SourceCommand()
RectangleCommand::bx1
float bx1
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:73
TextLocation::image_x
int image_x
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:37
TextLocation::text_h
int text_h
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:39
cuosd_launch_kernel
void cuosd_launch_kernel(void *image_data0, void *image_data1, int width, int stride, int height, ImageFormat format, const TextLocation *text_location, const unsigned char *text_bitmap, int text_bitmap_width, const int *line_location_base, const unsigned char *commands, const int *commands_offset, int num_commands, int bounding_left, int bounding_top, int bounding_right, int bounding_bottom, bool have_rotatebox, const unsigned char *blur_commands, int num_blur_commands, void *stream)
TextLocation::image_y
int image_y
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:37
SegmentCommand::SegmentCommand
SegmentCommand()
TextLocation::text_w
int text_w
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:39
NV12SourceCommand
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:131
SegmentCommand::seg_height
int seg_height
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:102
SegmentCommand::seg_width
int seg_width
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:102
BoxBlurCommand::kernel_size
int kernel_size
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:80
RectangleCommand
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:70
cuOSDContextCommand::c2
unsigned char c2
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:45
NV12SourceCommand::d_src0
void * d_src0
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:132
CircleCommand::cy
int cy
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:56
TextCommand::ilocation
int ilocation
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:91
RectangleCommand::by2
float by2
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:74
TextCommand::TextCommand
TextCommand()=default
RectangleCommand::cx1
float cx1
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:73
CommandType::RGBASource
@ RGBASource
PolyFillCommand
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:110
RectangleCommand::dy1
float dy1
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:73
BoxBlurCommand::d_seg
float * d_seg
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:81
NV12SourceCommand::src_stride
int src_stride
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:134
RectangleCommand::thickness
int thickness
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:71
SegmentCommand::scale_y
float scale_y
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:103
cuOSDImageFormat::BlockLinearNV12
@ BlockLinearNV12
RGBASourceCommand::src_height
int src_height
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:121
NV12SourceCommand::d_src1
void * d_src1
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:133
RectangleCommand::cy2
float cy2
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:74
SegmentCommand::d_seg
float * d_seg
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:101
PolyFillCommand::PolyFillCommand
PolyFillCommand()
cuOSDContextCommand::c1
unsigned char c1
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:45
RGBASourceCommand::d_src
void * d_src
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:120
RectangleCommand::dy2
float dy2
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:74
SegmentCommand
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:100
cuOSDImageFormat::PitchLinearNV12
@ PitchLinearNV12
RectangleCommand::ay2
float ay2
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:74
CommandType::Text
@ Text
BoxBlurCommand::seg_height
int seg_height
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:82
cuOSDImageFormat::RGBA
@ RGBA
RGBASourceCommand::src_width
int src_width
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:121
RectangleCommand::ay1
float ay1
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:73
CommandType::Rectangle
@ Rectangle
RectangleCommand::bx2
float bx2
Definition: sources/libs/nvll_osd/cuda/cuosd_kernel.h:74
ds3d::v2xinfer::format
static std::string format(const char *fmt,...)
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_preprocess/tensor.hpp:26