NVIDIA DeepStream SDK API Reference

9.1 Release
sources/gst-plugins/gst-nvdewarper/gstnvdewarper.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 
26 #ifndef __GST_NVDEWARPER_H__
27 #define __GST_NVDEWARPER_H__
28 
29 #include <gst/gst.h>
30 #include <gst/video/gstvideometa.h>
31 #include <gst/video/video.h>
32 #include <gst/base/gstbasetransform.h>
33 
34 #include <cuda.h>
35 #include <npp.h>
36 
37 #include "nv_aisle_csvparser.hpp"
38 #include "nv_spot_csvparser.hpp"
39 #include "gstnvdsmeta.h"
40 #include "nvds_dewarper_meta.h"
41 #include "nvbufsurface.h"
42 #include "nvbufsurftransform.h"
43 
44 using namespace nvaisle_csv;
45 using namespace nvspot_csv;
46 
47 #define DISTORTION_SIZE 5
48 #define FOCAL_LENGTH_SIZE 2
49 #define ROTATION_MATRIX_SIZE 9
51 G_BEGIN_DECLS
52 
57 #define GST_TYPE_NVDEWARPER \
58  (gst_nvdewarper_get_type())
59 #define GST_NVDEWARPER(obj) \
60  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NVDEWARPER,Gstnvdewarper))
61 #define GST_NVDEWARPER_CLASS(klass) \
62  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NVDEWARPER,GstnvdewarperClass))
63 #define GST_IS_NVDEWARPER(obj) \
64  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NVDEWARPER))
65 #define GST_IS_NVDEWARPER_CLASS(klass) \
66  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NVDEWARPER))
67 
77 typedef struct _NvDewarperParams
78 {
81  gfloat top_angle;
82  gfloat bottom_angle;
83  gfloat pitch;
84  gfloat roll;
85  gfloat yaw;
86  gfloat dewarpFocalLength[FOCAL_LENGTH_SIZE];
87  char rot_axes[4];
91  gfloat control;
93  guint dewarpWidth;
94  guint dewarpHeight;
95  guint dewarpPitch;
97  guint addressMode;
98  guchar *surface;
99  guint isValid;
102  guint id;
105  gdouble distortion[DISTORTION_SIZE];
106  gfloat src_x0;
107  gfloat src_y0;
108  gfloat srcFov;
109  gfloat rot_matrix[ROTATION_MATRIX_SIZE];
112  gfloat dstFocalLength[FOCAL_LENGTH_SIZE];
113  gfloat dstPrincipalPoint[2];
115 
117 typedef struct _NvDewarperPriv
118 {
119  std::vector<NvDewarperParams> vecDewarpSurface;
121 
126 {
127  GstBaseTransform element;
129  GstCaps *sinkcaps;
130  GstCaps *srccaps;
132  guint input_width;
133  guint input_height;
134  guint output_width;
138  guint gpu_id;
140  gchar* config_file;
144  GstBufferPool *pool;
152 
155  GstVideoFormat input_fmt;
156  GstVideoFormat output_fmt;
160  guint frame_num;
162  guint dump_frames;
163  void *aisle_output;
164  void *spot_output;
165  void *output;
167  gboolean silent;
173  guint source_id;
175  guint aisleCSVInit;
176  guint spotCSVInit;
179  guint spot_surf_index[MAX_DEWARPED_VIEWS];
180  guint aisle_surf_index[MAX_DEWARPED_VIEWS];
181  guint surface_index[MAX_DEWARPED_VIEWS];
182  guint surface_type[MAX_DEWARPED_VIEWS];
187 };
188 
191 {
192  GstBaseTransformClass parent_class;
193 };
194 
195 GType gst_nvdewarper_get_type (void);
196 
197 G_END_DECLS
198 
199 #endif /* __GST_NVDEWARPER_H__ */
_Gstnvdewarper::spotCSVInit
guint spotCSVInit
Boolean indicating whether the spot surface is initialized from CSV data.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:176
cudaStream_t
struct CUstream_st * cudaStream_t
Forward declaration of cudaStream_t.
Definition: sources/includes/nvbufsurftransform.h:35
_Gstnvdewarper::interpolation_method
NvBufSurfTransform_Inter interpolation_method
Interpolation method for scaling.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:154
_NvDewarperPriv
Data structure contaning dewarping parameters for all the output surfaces.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:117
_Gstnvdewarper::config_file
gchar * config_file
String contaning path and name of configuration file.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:140
NvDewarperParams
struct _NvDewarperParams NvDewarperParams
Holds all the configuration parameters required for dewarping a surface.
nvaisle_csv::AisleCSVParser
Class for parsing of Aisle CSV data.
Definition: sources/includes/nv_aisle_csvparser.hpp:95
_Gstnvdewarper::input_width
guint input_width
Input frame width.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:132
_Gstnvdewarper::srccaps
GstCaps * srccaps
Source pad caps.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:130
DISTORTION_SIZE
#define DISTORTION_SIZE
Maximum number of distortion coefficients.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:47
_Gstnvdewarper::out_gst_buf
GstBuffer * out_gst_buf
Pointer to the output buffer.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:184
_NvDewarperParams::rot_matrix_valid
guint rot_matrix_valid
Boolean indicating if the values in "rot_matrix" are valid.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:110
_Gstnvdewarper::gpu_id
guint gpu_id
ID of the GPU this element uses for dewarping/scaling.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:138
_Gstnvdewarper::num_spot_views
guint num_spot_views
Number of spot views.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:177
_Gstnvdewarper::aisle_output
void * aisle_output
Placeholder for aisle output host memory pointer.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:163
_Gstnvdewarper::spotCSVParser
SpotCSVParser * spotCSVParser
CSV parsed structure for spot calibration.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:171
_Gstnvdewarper::aisleCSVParser
AisleCSVParser * aisleCSVParser
CSV parsed structure for aisle calibration.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:170
_NvDewarperParams::roll
gfloat roll
The roll angle, in degrees.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:84
_NvDewarperParams::src_y0
gfloat src_y0
source principal point in Y direction
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:107
nvaisle_csv
Definition: sources/includes/nv_aisle_csvparser.hpp:36
_Gstnvdewarper::aisleCSVInit
guint aisleCSVInit
Boolean indicating whether the aisle surface is initialized from CSV data.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:175
_Gstnvdewarper::silent
gboolean silent
Boolean indicating swtiching on/off of verbose output.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:167
_Gstnvdewarper::spot_output
void * spot_output
Placeholder for spot output host memory pointer.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:164
_Gstnvdewarper::input_fmt
GstVideoFormat input_fmt
Input stream format derived from sink caps.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:155
_NvDewarperParams::dewarpWidth
guint dewarpWidth
Dewarped Surface width.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:93
gst_nvdewarper_get_type
GType gst_nvdewarper_get_type(void)
_Gstnvdewarper::output_height
guint output_height
Output frame height.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:135
_GstnvdewarperClass::parent_class
GstBaseTransformClass parent_class
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:192
_Gstnvdewarper::output_fmt
GstVideoFormat output_fmt
Output stream format derived from src caps.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:156
_NvDewarperParams::top_angle
gfloat top_angle
The top view angle, in degrees.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:81
_NvDewarperParams::dewarpPitch
guint dewarpPitch
Dewarped Surface pitch.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:95
MAX_DEWARPED_VIEWS
#define MAX_DEWARPED_VIEWS
Maximum number of dewarped surfaces per frame supported.
Definition: sources/includes/nvds_dewarper_meta.h:49
_Gstnvdewarper::priv
NvDewarperPriv * priv
Pointer to private data structure contaning dewarping parameters for all the output surfaces.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:186
_NvDewarperParams
Holds all the configuration parameters required for dewarping a surface.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:77
_Gstnvdewarper::source_id
guint source_id
Source ID of the input source.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:173
_Gstnvdewarper::num_output_buffers
guint num_output_buffers
Number of Output Buffers to be allocated by buffer pool.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:174
_Gstnvdewarper::output
void * output
Host memory pointer for output buffer.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:165
_NvDewarperParams::surface
guchar * surface
Pointer to Cuda Surface used for Projection.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:98
_Gstnvdewarper::input_feature
gint input_feature
Input memory feature can take values MEM_FEATURE_NVMM/MEM_FEATURE_RAW based on input memory type caps...
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:148
NvDewarperPriv
struct _NvDewarperPriv NvDewarperPriv
Data structure contaning dewarping parameters for all the output surfaces.
_NvDewarperParams::projection_type
guint projection_type
Projection type of type NvDsSurfaceType.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:79
_Gstnvdewarper::frame_num
guint frame_num
Number of the frame in the stream that was last processed.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:160
_NvDewarperParams::id
guint id
Surface id.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:102
_NvDewarperParams::surface_index
guint surface_index
Surface index.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:103
_Gstnvdewarper::element
GstBaseTransform element
Should be the first member when extending from GstBaseTransform.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:127
_Gstnvdewarper::spot_calibrationfile_set
gboolean spot_calibrationfile_set
Boolean indicating whether the spot calibration file is specified.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:168
NvBufSurfaceMemType
NvBufSurfaceMemType
Specifies memory types for NvBufSurface.
Definition: sources/includes/nvbufsurface.h:350
_Gstnvdewarper::sinkcaps
GstCaps * sinkcaps
Sink pad caps.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:129
_NvDewarperParams::addressMode
guint addressMode
Cuda Texture Address Mode.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:97
nvspot_csv::SpotCSVParser
Class for parsing of Spot CSV data.
Definition: sources/includes/nv_spot_csvparser.hpp:86
_NvDewarperParams::srcFov
gfloat srcFov
Source field of view.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:108
_Gstnvdewarper::input_height
guint input_height
Input frame height.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:133
_NvDewarperPriv::vecDewarpSurface
std::vector< NvDewarperParams > vecDewarpSurface
Array of surface parameters of type "NvDewarperParams".
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:119
_Gstnvdewarper::num_aisle_views
guint num_aisle_views
Number of aisle views.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:178
_Gstnvdewarper::aisle_calibrationfile_set
gboolean aisle_calibrationfile_set
Boolean indicating whether the aisle calibration file is specified.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:169
_Gstnvdewarper::spot_calibration_file
gchar * spot_calibration_file
String contaning path and name of spot calibration file.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:141
_Gstnvdewarper::output_width
guint output_width
Output frame width.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:134
_NvDewarperParams::bottom_angle
gfloat bottom_angle
The bottom view angle, in degrees.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:82
_Gstnvdewarper::pool
GstBufferPool * pool
Internal buffer pool for output buffers
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:144
NvBufSurfTransform_Inter
NvBufSurfTransform_Inter
Specifies video interpolation methods.
Definition: sources/includes/nvbufsurftransform.h:85
nvspot_csv
Definition: sources/includes/nv_spot_csvparser.hpp:35
_NvDewarperParams::dewarpHeight
guint dewarpHeight
Dewarped Surface height.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:94
_Gstnvdewarper::stream
cudaStream_t stream
Cuda Stream to launch operations on.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:158
_Gstnvdewarper::aisle_calibration_file
gchar * aisle_calibration_file
String contaning path and name of aisle calibration file.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:142
_Gstnvdewarper::num_batch_buffers
guint num_batch_buffers
Number of batch buffers.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:137
_NvDewarperParams::yaw
gfloat yaw
The yaw angle, in degrees.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:85
_Gstnvdewarper::cuda_mem_type
NvBufSurfaceMemType cuda_mem_type
Cuda surface memory type set by "nvbuf-memory-type".
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:153
FOCAL_LENGTH_SIZE
#define FOCAL_LENGTH_SIZE
Focal length array size : two values for X & Y direction.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:48
ROTATION_MATRIX_SIZE
#define ROTATION_MATRIX_SIZE
Standard rotation matrix size.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:49
_NvDewarperParams::pitch
gfloat pitch
The pitch angle, in degrees.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:83
_NvDewarperParams::src_x0
gfloat src_x0
source principal point in X direction
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:106
_NvDewarperParams::control
gfloat control
Projection-specific controls for Panini, Stereographic and Pushbroom projections.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:91
_Gstnvdewarper::dump_frames
guint dump_frames
Number of dewarped output frames to be dumped in a *.rgba file.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:162
_Gstnvdewarper
Gstnvdewarper element structure.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:125
GstBuffer
struct _GstBuffer GstBuffer
Definition: sources/includes/ds3d/common/idatatype.h:24
_Gstnvdewarper::output_feature
gint output_feature
Output memory feature can take values MEM_FEATURE_NVMM/MEM_FEATURE_RAW based on output memory type ca...
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:151
_NvDewarperParams::isValid
guint isValid
Boolean indicating if the surface parameters structure is valid.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:99
_GstnvdewarperClass
GStreamer boilerplate.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:190