NVIDIA DeepStream SDK API Reference

9.1 Release
9.1/sources/libs/nvdsinferserver/infer_proto_utils.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 #ifndef __NVDSINFER_SERVER_PROTO_UTILS_H__
19 #define __NVDSINFER_SERVER_PROTO_UTILS_H__
20 
21 #include <dlfcn.h>
22 #include <stdarg.h>
23 #include <string.h>
24 #include <unistd.h>
25 #include <cassert>
26 #include <condition_variable>
27 #include <mutex>
28 #include <sstream>
29 #include <stdexcept>
30 #include <string>
31 
32 #include "nvbufsurftransform.h"
33 #include <infer_datatypes.h>
34 
35 #pragma GCC diagnostic push
36 #if __GNUC__ >= 8
37 #pragma GCC diagnostic ignored "-Wrestrict"
38 #endif
39 #include "nvdsinferserver_config.pb.h"
40 #include "nvdsinferserver_plugin.pb.h"
41 #pragma GCC diagnostic pop
42 
43 namespace ic = nvdsinferserver::config;
44 
45 namespace nvdsinferserver {
46 
47 InferDataType dataTypeFromDsProto(ic::TensorDataType dt);
48 
49 InferTensorOrder tensorOrderFromDsProto(ic::TensorOrder o);
50 InferMediaFormat mediaFormatFromDsProto(ic::MediaFormat f);
52 
55 
56 bool validateProtoConfig(ic::InferenceConfig& c, const std::string& path);
57 bool compareModelRepo(
58  const ic::TritonModelRepo& repoA, const ic::TritonModelRepo& repoB);
59 
60 inline bool
61 hasTriton(const ic::BackendParams& params)
62 {
63  return params.has_triton() || params.has_trt_is();
64 }
65 inline const ic::TritonParams&
66 getTritonParam(const ic::BackendParams& params)
67 {
68  if (params.has_triton()) {
69  return params.triton();
70  } else {
71  assert(params.has_trt_is());
72  return params.trt_is();
73  }
74 }
75 inline ic::TritonParams*
76 mutableTriton(ic::BackendParams& params)
77 {
78  if (params.has_triton()) {
79  return params.mutable_triton();
80  } else {
81  assert(params.has_trt_is());
82  return params.mutable_trt_is();
83  }
84 }
85 
86 } // namespace nvdsinferserver
87 
88 #endif
nvdsinferserver
This is a header file for pre-processing cuda kernels with normalization and mean subtraction require...
Definition: sources/gst-plugins/gst-nvinferserver/gstnvinferserver_impl.h:69
nvdsinferserver::mutableTriton
ic::TritonParams * mutableTriton(ic::BackendParams &params)
Definition: sources/libs/nvdsinferserver/infer_proto_utils.h:76
nvdsinferserver::InferDataType
InferDataType
Datatype of the tensor buffer.
Definition: sources/includes/nvdsinferserver/infer_datatypes.h:88
nvdsinferserver::InferMediaFormat
InferMediaFormat
Image formats.
Definition: sources/includes/nvdsinferserver/infer_datatypes.h:134
nvdsinferserver::validateProtoConfig
bool validateProtoConfig(ic::InferenceConfig &c, const std::string &path)
nvdsinferserver::InferTensorOrder
InferTensorOrder
The type of tensor order.
Definition: sources/includes/nvdsinferserver/infer_datatypes.h:46
nvdsinferserver::dataTypeFromDsProto
InferDataType dataTypeFromDsProto(ic::TensorDataType dt)
nvdsinferserver::mediaFormatFromDsProto
InferMediaFormat mediaFormatFromDsProto(ic::MediaFormat f)
NvBufSurfTransform_Compute
NvBufSurfTransform_Compute
Specifies compute devices used by NvBufSurfTransform.
Definition: sources/includes/nvbufsurftransform.h:46
MemoryType
MemoryType
Definition: sources/gst-plugins/gst-nvdsudp/gstnvdsudpcommon.h:54
nvdsinferserver::computeHWFromDsProto
NvBufSurfTransform_Compute computeHWFromDsProto(ic::FrameScalingHW h)
nvdsinferserver::tensorOrderFromDsProto
InferTensorOrder tensorOrderFromDsProto(ic::TensorOrder o)
nvdsinferserver::getTritonParam
const ic::TritonParams & getTritonParam(const ic::BackendParams &params)
Definition: sources/libs/nvdsinferserver/infer_proto_utils.h:66
nvdsinferserver::scalingFilterFromDsProto
NvBufSurfTransform_Inter scalingFilterFromDsProto(uint32_t filter)
nvdsinferserver::InferMemType
InferMemType
The memory types of inference buffers.
Definition: sources/includes/nvdsinferserver/infer_datatypes.h:61
nvdsinferserver::compareModelRepo
bool compareModelRepo(const ic::TritonModelRepo &repoA, const ic::TritonModelRepo &repoB)
NvBufSurfTransform_Inter
NvBufSurfTransform_Inter
Specifies video interpolation methods.
Definition: sources/includes/nvbufsurftransform.h:85
nvdsinferserver::memTypeFromDsProto
InferMemType memTypeFromDsProto(ic::MemoryType t)
nvdsinferserver::hasTriton
bool hasTriton(const ic::BackendParams &params)
Definition: sources/libs/nvdsinferserver/infer_proto_utils.h:61