1#[repr(C)]
4#[derive(Debug, Copy, Clone)]
5pub struct nn_context {
6 _unused: [u8; 0],
7}
8#[doc = " @struct NNContext\n\n DeepViewRT Context. Refer to the DeepviewRT User Manual for details."]
9pub type NNContext = nn_context;
10#[repr(C)]
11#[derive(Debug, Copy, Clone)]
12pub struct nn_tensor {
13 _unused: [u8; 0],
14}
15#[doc = " @struct NNTensor\n\n DeepViewRT Tensor objects. Refer to the DeepViewRT User Manual for details."]
16pub type NNTensor = nn_tensor;
17#[doc = " @struct NNModel\n\n DeepviewRT Model (RTM). Refer to the DeepViewRT User Manual for details."]
18pub type NNModel = ::std::os::raw::c_void;
19#[doc = " Successfull operation, no error."]
20pub const VAALError_VAAL_SUCCESS: VAALError = 0;
21#[doc = " Internal error without a specific error code, catch-all error."]
22pub const VAALError_VAAL_ERROR_INTERNAL: VAALError = 1;
23#[doc = " The provided handle is invalid. This error is typically used by NNEngine\n when interfacing with another API"]
24pub const VAALError_VAAL_ERROR_INVALID_HANDLE: VAALError = 2;
25#[doc = " Out of memory error, returned if a call to malloc returns NULL or similar\n error."]
26pub const VAALError_VAAL_ERROR_OUT_OF_MEMORY: VAALError = 3;
27#[doc = " Out of resources errors are similar to out of memory though sometimes\n treated separately by underlying plugins."]
28pub const VAALError_VAAL_ERROR_OUT_OF_RESOURCES: VAALError = 4;
29#[doc = " Signals an API has not been implemented.."]
30pub const VAALError_VAAL_ERROR_NOT_IMPLEMENTED: VAALError = 5;
31#[doc = " A required parameter was missing or NULL or simply invalid."]
32pub const VAALError_VAAL_ERROR_INVALID_PARAMETER: VAALError = 6;
33#[doc = " When attempting to run an operation where the input/output tensors are\n of different types and the operation does not support automatic type\n conversions."]
34pub const VAALError_VAAL_ERROR_TYPE_MISMATCH: VAALError = 7;
35#[doc = " When attempting to run an operation and the input/output tensors have\n invalid or unsupported shape combinations. Some operations require the\n shapes to be the same while others, such as arithmetic broadcasting\n operations, will support various shape combinations but if the provided\n pairs are invalid then the shape mismatch is returned."]
36pub const VAALError_VAAL_ERROR_SHAPE_MISMATCH: VAALError = 8;
37#[doc = " The tensor's shape is invalid for the given operation. It differs from\n the shape mismatch in that the shape is invalid on its own and not\n relative to another related tensor. An example would be a shape with\n more than one -1 dimension."]
38pub const VAALError_VAAL_ERROR_INVALID_SHAPE: VAALError = 9;
39#[doc = " The requested ordering was invalid."]
40pub const VAALError_VAAL_ERROR_INVALID_ORDER: VAALError = 10;
41#[doc = " The requested axis for an operation was invalid or unsupported."]
42pub const VAALError_VAAL_ERROR_INVALID_AXIS: VAALError = 11;
43#[doc = " A required resource was missing or the reference invalid."]
44pub const VAALError_VAAL_ERROR_MISSING_RESOURCE: VAALError = 12;
45#[doc = " The requested engine is invalid."]
46pub const VAALError_VAAL_ERROR_INVALID_ENGINE: VAALError = 13;
47#[doc = " The tensor has no data or the data is not currently accessible."]
48pub const VAALError_VAAL_ERROR_TENSOR_NO_DATA: VAALError = 14;
49#[doc = " The internal kernel or subroutine required to complete an operation using\n the engine plugin was missing. An example would be OpenCL or OpenVX\n operation where the kernel implementation cannot be located."]
50pub const VAALError_VAAL_ERROR_KERNEL_MISSING: VAALError = 15;
51#[doc = " The operation does not support the tensor's type."]
52pub const VAALError_VAAL_ERROR_TENSOR_TYPE_UNSUPPORTED: VAALError = 16;
53#[doc = " For operations which can operate on an array of inputs, the provided list\n of inputs was too large."]
54pub const VAALError_VAAL_ERROR_TOO_MANY_INPUTS: VAALError = 17;
55#[doc = " A system error occured when interfacing with an operating system\n function. On some systems errno might be updated with the underlying\n error code."]
56pub const VAALError_VAAL_ERROR_SYSTEM_ERROR: VAALError = 18;
57#[doc = " When working with a model a reference was made to a layer which did not\n exist."]
58pub const VAALError_VAAL_ERROR_INVALID_LAYER: VAALError = 19;
59#[doc = " The model is invalid or corrupted."]
60pub const VAALError_VAAL_ERROR_MODEL_INVALID: VAALError = 20;
61#[doc = " An operation referenced a model but the model was not provided."]
62pub const VAALError_VAAL_ERROR_MODEL_MISSING: VAALError = 21;
63#[doc = " The string was too large."]
64pub const VAALError_VAAL_ERROR_STRING_TOO_LARGE: VAALError = 22;
65#[doc = " The quantization parameters are invalid."]
66pub const VAALError_VAAL_ERROR_INVALID_QUANT: VAALError = 23;
67#[doc = " Failed to generate graph representation of model."]
68pub const VAALError_VAAL_ERROR_MODEL_GRAPH_FAILED: VAALError = 24;
69#[doc = " Failed to verify graph generateed from model."]
70pub const VAALError_VAAL_ERROR_GRAPH_VERIFY_FAILED: VAALError = 25;
71#[doc = " Unknown decoder was provided or failed to detect decoder."]
72pub const VAALError_VAAL_ERROR_UNKNOWN_DECODER: VAALError = 65536;
73#[doc = " Attempted to write to read-only parameter."]
74pub const VAALError_VAAL_ERROR_PARAMETER_READ_ONLY: VAALError = 65537;
75#[doc = " Lookup of named parameter was not found."]
76pub const VAALError_VAAL_ERROR_PARAMETER_NOT_FOUND: VAALError = 65538;
77#[doc = " Attempted an operation which is unsupported on the current platform."]
78pub const VAALError_VAAL_ERROR_PLATFORM_UNSUPPORTED: VAALError = 65539;
79#[doc = " Library has not been initialized for use, this should happen\n automatically but can be done manually using vaal_init()."]
80pub const VAALError_VAAL_ERROR_LIBRARY_UNINITIALIZED: VAALError = 65540;
81#[doc = " Enumeration of all errors provided by VAAL. Most functions will return a\n VAALError with VAAL_SUCCESS being zero. A common usage pattern for client\n code is to check for err using `if (err) ...` as any error condition will\n return non-zero."]
82pub type VAALError = ::std::os::raw::c_uint;
83#[doc = " The VAAL_RAW type is untyped and left to the caller to handle."]
84pub const VAALType_VAAL_RAW: VAALType = 0;
85#[doc = " The VAAL_PTR is a standard void* pointer."]
86pub const VAALType_VAAL_PTR: VAALType = 1;
87#[doc = " The VAAL_FUNC is a function pointer."]
88pub const VAALType_VAAL_FUNC: VAALType = 2;
89#[doc = " The VAAL_STR type is a standard NULL-terminated C-string."]
90pub const VAALType_VAAL_STR: VAALType = 3;
91#[doc = " The VAAL_I8 type maps to a C int8_t"]
92pub const VAALType_VAAL_I8: VAALType = 4;
93#[doc = " The VAAL_U8 type maps to a C uint8_t"]
94pub const VAALType_VAAL_U8: VAALType = 5;
95#[doc = " The VAAL_I16 type maps to a C int16_t"]
96pub const VAALType_VAAL_I16: VAALType = 6;
97#[doc = " The VAAL_U16 type maps to a C uint16_t"]
98pub const VAALType_VAAL_U16: VAALType = 7;
99#[doc = " The VAAL_I32 type maps to a C int32_t"]
100pub const VAALType_VAAL_I32: VAALType = 8;
101#[doc = " The VAAL_U32 type maps to a C uint32_t"]
102pub const VAALType_VAAL_U32: VAALType = 9;
103#[doc = " The VAAL_I64 type maps to a C int64_t"]
104pub const VAALType_VAAL_I64: VAALType = 10;
105#[doc = " The VAAL_U64 type maps to a C uint64_t"]
106pub const VAALType_VAAL_U64: VAALType = 11;
107#[doc = " The VAAL_F16 type is currently unsupported but would map to either an ARM\n __fp16 or C11 (GCC extension) _Float16 type."]
108pub const VAALType_VAAL_F16: VAALType = 12;
109#[doc = " The VAAL_F32 type maps to a C float"]
110pub const VAALType_VAAL_F32: VAALType = 13;
111#[doc = " The VAAL_F64 type maps to a C double"]
112pub const VAALType_VAAL_F64: VAALType = 14;
113#[doc = " VAAL datatype definitions are used for identifying type information of the\n context parameters."]
114pub type VAALType = ::std::os::raw::c_uint;
115#[doc = " Common bounding box structure used by all decoders. The box is defined by\n the minimum and maximum coordinates of the x,y points as normalized values.\n Normalized values are in the range 0..1 and can be multiplied by the size of\n an image to de-normalize back to actual pixel locations.\n\n The label is an index which can be used to access the textual label from the\n model or a labels file.\n\n The score's definition is model-specific but generally it is a sigmoid\n processed value."]
116#[repr(C)]
117#[derive(Debug, Copy, Clone)]
118pub struct VAALBox {
119 #[doc = " left-most normalized coordinate of the bounding box."]
120 pub xmin: f32,
121 #[doc = " top-most normalized coordinate of the bounding box."]
122 pub ymin: f32,
123 #[doc = " right-most normalized coordinate of the bounding box."]
124 pub xmax: f32,
125 #[doc = " bottom-most normalized coordinate of the bounding box."]
126 pub ymax: f32,
127 #[doc = " model-specific score for this detection, higher implies more confidence."]
128 pub score: f32,
129 #[doc = " label index for this detection, text representation can be retrived using\n @ref VAALContext::vaal_label()"]
130 pub label: ::std::os::raw::c_int,
131}
132#[test]
133fn bindgen_test_layout_VAALBox() {
134 const UNINIT: ::std::mem::MaybeUninit<VAALBox> = ::std::mem::MaybeUninit::uninit();
135 let ptr = UNINIT.as_ptr();
136 assert_eq!(
137 ::std::mem::size_of::<VAALBox>(),
138 24usize,
139 concat!("Size of: ", stringify!(VAALBox))
140 );
141 assert_eq!(
142 ::std::mem::align_of::<VAALBox>(),
143 4usize,
144 concat!("Alignment of ", stringify!(VAALBox))
145 );
146 assert_eq!(
147 unsafe { ::std::ptr::addr_of!((*ptr).xmin) as usize - ptr as usize },
148 0usize,
149 concat!(
150 "Offset of field: ",
151 stringify!(VAALBox),
152 "::",
153 stringify!(xmin)
154 )
155 );
156 assert_eq!(
157 unsafe { ::std::ptr::addr_of!((*ptr).ymin) as usize - ptr as usize },
158 4usize,
159 concat!(
160 "Offset of field: ",
161 stringify!(VAALBox),
162 "::",
163 stringify!(ymin)
164 )
165 );
166 assert_eq!(
167 unsafe { ::std::ptr::addr_of!((*ptr).xmax) as usize - ptr as usize },
168 8usize,
169 concat!(
170 "Offset of field: ",
171 stringify!(VAALBox),
172 "::",
173 stringify!(xmax)
174 )
175 );
176 assert_eq!(
177 unsafe { ::std::ptr::addr_of!((*ptr).ymax) as usize - ptr as usize },
178 12usize,
179 concat!(
180 "Offset of field: ",
181 stringify!(VAALBox),
182 "::",
183 stringify!(ymax)
184 )
185 );
186 assert_eq!(
187 unsafe { ::std::ptr::addr_of!((*ptr).score) as usize - ptr as usize },
188 16usize,
189 concat!(
190 "Offset of field: ",
191 stringify!(VAALBox),
192 "::",
193 stringify!(score)
194 )
195 );
196 assert_eq!(
197 unsafe { ::std::ptr::addr_of!((*ptr).label) as usize - ptr as usize },
198 20usize,
199 concat!(
200 "Offset of field: ",
201 stringify!(VAALBox),
202 "::",
203 stringify!(label)
204 )
205 );
206}
207#[doc = " @struct VAALEuler\n"]
208#[repr(C)]
209#[derive(Debug, Copy, Clone)]
210pub struct VAALEuler {
211 pub yaw: f32,
212 pub pitch: f32,
213 pub roll: f32,
214}
215#[test]
216fn bindgen_test_layout_VAALEuler() {
217 const UNINIT: ::std::mem::MaybeUninit<VAALEuler> = ::std::mem::MaybeUninit::uninit();
218 let ptr = UNINIT.as_ptr();
219 assert_eq!(
220 ::std::mem::size_of::<VAALEuler>(),
221 12usize,
222 concat!("Size of: ", stringify!(VAALEuler))
223 );
224 assert_eq!(
225 ::std::mem::align_of::<VAALEuler>(),
226 4usize,
227 concat!("Alignment of ", stringify!(VAALEuler))
228 );
229 assert_eq!(
230 unsafe { ::std::ptr::addr_of!((*ptr).yaw) as usize - ptr as usize },
231 0usize,
232 concat!(
233 "Offset of field: ",
234 stringify!(VAALEuler),
235 "::",
236 stringify!(yaw)
237 )
238 );
239 assert_eq!(
240 unsafe { ::std::ptr::addr_of!((*ptr).pitch) as usize - ptr as usize },
241 4usize,
242 concat!(
243 "Offset of field: ",
244 stringify!(VAALEuler),
245 "::",
246 stringify!(pitch)
247 )
248 );
249 assert_eq!(
250 unsafe { ::std::ptr::addr_of!((*ptr).roll) as usize - ptr as usize },
251 8usize,
252 concat!(
253 "Offset of field: ",
254 stringify!(VAALEuler),
255 "::",
256 stringify!(roll)
257 )
258 );
259}
260#[doc = " @struct VAALKeypoint\n"]
261#[repr(C)]
262#[derive(Debug, Copy, Clone)]
263pub struct VAALKeypoint {
264 pub x: f32,
265 pub y: f32,
266 pub score: f32,
267}
268#[test]
269fn bindgen_test_layout_VAALKeypoint() {
270 const UNINIT: ::std::mem::MaybeUninit<VAALKeypoint> = ::std::mem::MaybeUninit::uninit();
271 let ptr = UNINIT.as_ptr();
272 assert_eq!(
273 ::std::mem::size_of::<VAALKeypoint>(),
274 12usize,
275 concat!("Size of: ", stringify!(VAALKeypoint))
276 );
277 assert_eq!(
278 ::std::mem::align_of::<VAALKeypoint>(),
279 4usize,
280 concat!("Alignment of ", stringify!(VAALKeypoint))
281 );
282 assert_eq!(
283 unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
284 0usize,
285 concat!(
286 "Offset of field: ",
287 stringify!(VAALKeypoint),
288 "::",
289 stringify!(x)
290 )
291 );
292 assert_eq!(
293 unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize },
294 4usize,
295 concat!(
296 "Offset of field: ",
297 stringify!(VAALKeypoint),
298 "::",
299 stringify!(y)
300 )
301 );
302 assert_eq!(
303 unsafe { ::std::ptr::addr_of!((*ptr).score) as usize - ptr as usize },
304 8usize,
305 concat!(
306 "Offset of field: ",
307 stringify!(VAALKeypoint),
308 "::",
309 stringify!(score)
310 )
311 );
312}
313#[repr(C)]
314#[derive(Debug, Copy, Clone)]
315pub struct vaal_context {
316 _unused: [u8; 0],
317}
318#[doc = " @struct VAALContext\n\n Context object for VAAL to manage internal model data structures. The\n VAALContext manages the DeepViewRT NNContext as well as parameters related\n to model post-processing.\n\n Models typically require further post-processing before the outputs are\n ready to be interpreted. What post-processing is required varies greatly\n between various model architectures. A common post-processing step is the\n decoder which is responsible for translating an internal model representation\n into one which represents the problem space.\n\n For detection models the post-processing includes the box decoding step which\n can either be integrated into the model or run as a separate step using the\n model's outputs followed by sorting and non-maximum supression \"NMS\" which is\n tasked with cleaning the bounding box output.\n\n For classification models the post-processing is typically implemented by\n finding within an output vector the index of the maximum value \"argmax\" where\n the index has meaning. For example, the index into the labels with which the\n classifier was trained. The value itself can also be interpreted as a weak\n confidence metric in cases where a softmax or sigmoid was applied to the\n vector."]
319pub type VAALContext = vaal_context;
320extern "C" {
321 #[doc = " DeepView VAAL library version as MAJOR.MINOR.PATCH. The library returns\n a string encoding the version and also optionally sets the provided\n arguments.\n\n @return library version string\n\n @since 1.0"]
322 pub fn vaal_version(
323 major: *mut ::std::os::raw::c_int,
324 minor: *mut ::std::os::raw::c_int,
325 patch: *mut ::std::os::raw::c_int,
326 extra: *mut *const ::std::os::raw::c_char,
327 ) -> *const ::std::os::raw::c_char;
328}
329extern "C" {
330 #[doc = " DeepView VAAL string encoding of error enum\n\n @return error string\n\n @since 1.0"]
331 pub fn vaal_strerror(error: VAALError) -> *const ::std::os::raw::c_char;
332}
333extern "C" {
334 #[doc = " Returns the size of the @ref VAALType in bytes. Note that VAAL parameters\n can be arrays of types, so a full buffer would be length * vaal_type_sizeof.\n\n @returns element size of the @ref VAALType.\n\n @since 1.1"]
335 pub fn vaal_type_sizeof(type_: VAALType) -> usize;
336}
337extern "C" {
338 #[doc = " Returns the string name for the @ref VAALType.\n\n @param type to be returned as a string name.\n\n @returns string representation of the type.\n\n @since 1.1"]
339 pub fn vaal_type_name(type_: VAALType) -> *const ::std::os::raw::c_char;
340}
341extern "C" {
342 #[doc = " Returns the current monotonic time in nanoseconds.\n\n @return monotonic time as nanoseconds\n\n @since 1.0"]
343 pub fn vaal_clock_now() -> i64;
344}
345extern "C" {
346 #[doc = " Creates a VAALContext for the provided device. A context can manage a single\n model but many contexts can be created within an application. If device is\n NULL then the default DeepViewRT engine will be used which evaluates models\n on the CPU.\n\n The device string can be further extended to specify device details such as\n using \"gpu:1\" to use the second GPU instead of the default one. Refer to the\n VAAL_DEVICE documentation for details on the extended parameters.\n\n Supported devices:\n - @ref VAAL_DEVICE_CPU\n - @ref VAAL_DEVICE_GPU\n - @ref VAAL_DEVICE_NPU\n\n @param device\n\n @return VAALContext\n\n @since 1.0"]
347 pub fn vaal_context_create(device: *const ::std::os::raw::c_char) -> *mut VAALContext;
348}
349extern "C" {
350 #[doc = " Releases the VAALContext unloading models and releasing any data structures\n under the control of the context.\n\n\n @since 1.0"]
351 pub fn vaal_context_release(context: *mut VAALContext);
352}
353extern "C" {
354 #[doc = " Retrieves the DeepViewRT NNContext associated with the VAALContext. This can\n be used to further query the underlying NNEngine, NNModel, and other\n DeepViewRT API.\n\n @param context\n\n @return NNContext\n\n @since 1.0"]
355 pub fn vaal_context_deepviewrt(context: *mut VAALContext) -> *mut NNContext;
356}
357extern "C" {
358 #[doc = " Retrieves the cache tensor associated with VAAL context.\n Cache is used for post-processing and CPU inference\n\n @param context\n\n @return NNTensor\n\n @since 1.0"]
359 pub fn vaal_context_cache(context: *mut VAALContext) -> *mut NNTensor;
360}
361extern "C" {
362 #[doc = " Retrieves the dictionary data struct associated with the VAALContext.\n\n @param context\n\n @return NNContext\n @private\n @since 1.0"]
363 pub fn vaal_context_dict(context: *mut VAALContext) -> *mut ::std::os::raw::c_void;
364}
365extern "C" {
366 #[doc = " Retrieves the model associated with the VAALContext.\n\n @param context\n\n @return NNContext\n\n @since 1.0"]
367 pub fn vaal_context_model(context: *const VAALContext) -> *const ::std::os::raw::c_void;
368}
369extern "C" {
370 #[doc = " Queries the number of available parameters in the current context. The count\n can be used along with @vaal_parameter_name() to query the names of the\n parameters.\n\n You should have a model loaded using @ref vaal_load_model before calling this\n function to ensure all available parameters are provided.\n\n The available parameters vary depending on model and target harwdware as\n documented in the VAAL User's Manual (TODO: need to document parameters).\n\n @return number of currently available parameters for the context.\n\n @since 1.1"]
371 pub fn vaal_parameter_count(context: *mut VAALContext) -> usize;
372}
373extern "C" {
374 #[doc = " Queries the names of parameters according to the index. Note the indices\n are not deterministic and will vary depending on the state of the context.\n This function is meant to be used to lookup currently available parameter\n names.\n\n @return VAALError\n\n @since 1.1"]
375 pub fn vaal_parameter_name(
376 context: *mut VAALContext,
377 index: usize,
378 name: *mut ::std::os::raw::c_char,
379 max_name: usize,
380 name_length: *mut usize,
381 ) -> VAALError;
382}
383extern "C" {
384 #[doc = " Queries the parameter for information about the type, length, and mutability.\n\n @param context\n @param name Parameter name as found using @ref vaal_parameter_query\n @param type Optional pointer to receive the parameter data type.\n @param length Optional pointer to receive the length of the parameter. The\n length is measured in number of elements. The total length can\n be calculated by multiplying with @ref vaal_type_sizeof().\n @param readonly Optional pointer to receive the mutability of the parameter.\n If readonly=1 then the parameter is immutable and attempts to\n set a new value will return the error code\n @ref VAAL_ERROR_PARAMETER_READ_ONLY.\n\n @return VAALType\n\n @since 1.1"]
385 pub fn vaal_parameter_info(
386 context: *mut VAALContext,
387 name: *const ::std::os::raw::c_char,
388 type_: *mut VAALType,
389 length: *mut usize,
390 readonly: *mut ::std::os::raw::c_int,
391 ) -> VAALError;
392}
393extern "C" {
394 #[doc = " Reads the current value as a string for the parameter into the user provided\n string buffer. It can be called with max_value of 0 or value of NULL to\n query the required storage size. If length is non-NULL then the total size\n of the string representation will be stored, even if the actual result was\n truncated.\n\n @param context\n @param name Parameter name as found using @ref vaal_parameter_query\n @param value Buffer to receive the string representation of the value\n @param max_value Size of the value buffer\n @param length Total length of the string representation of the value\n\n @return VAALError\n\n @since 1.0"]
395 pub fn vaal_parameter_gets(
396 context: *mut VAALContext,
397 name: *const ::std::os::raw::c_char,
398 value: *mut ::std::os::raw::c_char,
399 max_value: usize,
400 length: *mut usize,
401 ) -> VAALError;
402}
403extern "C" {
404 #[doc = " Writes the provided value into the parameter. The value is provided as a\n string representation.\n\n @param context\n @param name Parameter name as found using @ref vaal_parameter_query\n @param value String representation of the new value for the parameter\n @param length Optional length of string, if left out will use strlen(value)+1\n\n @return VAALError\n\n @since 1.0"]
405 pub fn vaal_parameter_sets(
406 context: *mut VAALContext,
407 name: *const ::std::os::raw::c_char,
408 value: *const ::std::os::raw::c_char,
409 length: usize,
410 ) -> VAALError;
411}
412extern "C" {
413 #[doc = " Read the float values for a given \"name\" key in the context. It can be a\n scalar value or an array.\n\n @param context\n @param name Parameter name as found using @ref vaal_parameter_query\n @param values pointer to the returned float value(s)\n @param max_values length of the values array\n @param num_values number of actual values in the parameter\n\n @return VAALError\n\n @since 1.0"]
414 pub fn vaal_parameter_getf(
415 context: *mut VAALContext,
416 name: *const ::std::os::raw::c_char,
417 values: *mut f32,
418 max_values: usize,
419 num_values: *mut usize,
420 ) -> VAALError;
421}
422extern "C" {
423 #[doc = " Writes the provided value into the parameter. The value is provided as a\n float array representation.\n\n @param context\n @param name Parameter name as found using @ref vaal_parameter_query\n @param values address of the first float value\n @param num_values length of the input float array\n\n @return VAALError\n\n @since 1.0"]
424 pub fn vaal_parameter_setf(
425 context: *mut VAALContext,
426 name: *const ::std::os::raw::c_char,
427 values: *const f32,
428 num_values: usize,
429 ) -> VAALError;
430}
431extern "C" {
432 #[doc = " Read the int values for a given \"name\" key in the context. It can be a\n scalar or an array.\n\n @param context\n @param name Parameter name as found using @ref vaal_parameter_query\n @param values pointer to the returned int values\n @param max_values size of the values array\n @param num_values number of actual values in the parameter\n\n @return VAALError\n\n @since 1.0"]
433 pub fn vaal_parameter_geti(
434 context: *mut VAALContext,
435 name: *const ::std::os::raw::c_char,
436 values: *mut i32,
437 max_values: usize,
438 num_values: *mut usize,
439 ) -> VAALError;
440}
441extern "C" {
442 #[doc = " Writes the provided value into the parameter. The value is provided as a\n int array representation.\n\n @param context\n @param name Parameter name as found using @ref vaal_parameter_query\n @param value address of the first int value\n @param len length of the input int array\n\n @return VAALError\n\n @since 1.0"]
443 pub fn vaal_parameter_seti(
444 context: *mut VAALContext,
445 name: *const ::std::os::raw::c_char,
446 values: *const i32,
447 num_values: usize,
448 ) -> VAALError;
449}
450extern "C" {
451 #[doc = " Read the int values for a given \"name\" key in the context. It can be a\n scalar or an array.\n\n @param context\n @param name Parameter name as found using @ref vaal_parameter_query\n @param values pointer to the returned uint32_t values\n @param max_salues length of the values array\n @param num_values number of actual values in the parameter\n\n @return VAALError\n\n @since 1.0"]
452 pub fn vaal_parameter_getu(
453 context: *mut VAALContext,
454 name: *const ::std::os::raw::c_char,
455 values: *mut u32,
456 max_values: usize,
457 num_values: *mut usize,
458 ) -> VAALError;
459}
460extern "C" {
461 #[doc = " Writes the provided value into the parameter. The value is provided as a\n uint32_t array representation.\n\n @param context\n @param name Parameter name as found using @ref vaal_parameter_query\n @param value address of the first int value\n @param len length of the input array\n\n @return VAALError\n\n @since 1.0"]
462 pub fn vaal_parameter_setu(
463 context: *mut VAALContext,
464 name: *const ::std::os::raw::c_char,
465 values: *const u32,
466 num_values: usize,
467 ) -> VAALError;
468}
469extern "C" {
470 #[doc = " Writes the function pointer into the context under a given key.\n\n @param context\n @param name Parameter name as found using @ref vaal_parameter_query\n @param cb_ptr function pointer\n\n @return VAALError\n\n @since 1.0"]
471 pub fn vaal_parameter_set_func(
472 context: *mut VAALContext,
473 name: *const ::std::os::raw::c_char,
474 cb_ptr: *mut ::std::os::raw::c_void,
475 ) -> VAALError;
476}
477extern "C" {
478 #[doc = " Get the raw memory address of values given a key\n\n @param context\n @param name Parameter name as found using @ref vaal_parameter_query\n @param ptr Pointer to a void* which will receive the raw pointer to the data.\n @param length Optional pointer to size_t to receive the size of the data\n pointed to by ptr.\n\n @return VAALError\n\n @since 1.0"]
479 pub fn vaal_parameter_get_raw(
480 context: *mut VAALContext,
481 name: *const ::std::os::raw::c_char,
482 ptr: *mut *mut ::std::os::raw::c_void,
483 length: *mut usize,
484 ) -> VAALError;
485}
486extern "C" {
487 #[doc = " Loads a model into the context. This function extends the DeepViewRT model\n loading API to add model parameters and enabling input/output acceleration.\n\n This function is a convenience around @ref vaal_load_model() to load the\n model from file into memory then calling the direct from memory function.\n\n This function will also attempt to detect the model's post-processing\n requirements such as the box decoder and assign default post-processing\n parameters. These parameters can be adjusted using the various parameter set\n and get functions.\n\n @param context The @ref VAALContext which will own this model.\n @param filename the path to the DeepViewRT (RTM) model file.\n\n @return VAALError\n\n @since 1.1"]
488 pub fn vaal_load_model_file(
489 context: *mut VAALContext,
490 filename: *const ::std::os::raw::c_char,
491 ) -> VAALError;
492}
493extern "C" {
494 #[doc = " Loads a model into the context. This function extends the DeepViewRT model\n loading API to add model parameters and enabling input/output acceleration.\n\n This function will also attempt to detect the model's post-processing\n requirements such as the box decoder and assign default post-processing\n parameters. These parameters can be adjusted using the various parameter set\n and get functions.\n\n @param context The @ref VAALContext which will own this model.\n @param memory_size the size of the model blob.\n @param memory pointer to the start of the model blob (RTM file).\n\n @return VAALError\n\n @since 1.1"]
495 pub fn vaal_load_model(
496 context: *mut VAALContext,
497 memory_size: usize,
498 memory: *const ::std::os::raw::c_void,
499 ) -> VAALError;
500}
501extern "C" {
502 #[doc = " Unloads the model from the current context.\n\n @param context The @ref VAALContext from which to unload the model.\n\n @return VAALError\n\n @since 1.1"]
503 pub fn vaal_unload_model(context: *mut VAALContext) -> VAALError;
504}
505extern "C" {
506 #[doc = " Runs the model loaded by the VAALContext.\n\n @param context The @ref VAALContext with a loaded model to run.\n\n @return VAALError\n\n @since 1.0"]
507 pub fn vaal_run_model(context: *mut VAALContext) -> VAALError;
508}
509extern "C" {
510 #[doc = " Loads a video frame from virtual memory into the tensor, handling any\n required conversions (such as casting to floating point, if required). The\n frame must have a stride calculated from with and a known fourcc code, for\n example YUYV would need stride to be width*2 whereas NV12 would required\n stride to be width. For planar formats each plane must be packed\n sequentially, so for NV12 the UV planes must follow immediately after the Y\n plane.\n\n @param context VAALContext which owns the model into which the video frame\n will be loaded.\n @param tensor optional DeepViewRT tensor to receive the video frame. If NULL\n the model's first input tensor will be used.\n @param memory the virtual memory location of the frame.\n @param fourcc the fourcc code for the video frame which will be used to\n convert to the model's expected format (assumed to be RGB).\n @param width the width of the source frame, it will be resized to the target\n tensor's width.\n @param height the height of the source frame, it will be resized to the\n target tensor's height.\n @param roi optional roi which will cause the input frame to be cropped before\n resizing.\n @param proc mask of image pre-processing to apply on load.\n\n @return VAALError\n\n @since 1.1"]
511 pub fn vaal_load_frame_memory(
512 context: *mut VAALContext,
513 tensor: *mut NNTensor,
514 memory: *const ::std::os::raw::c_void,
515 fourcc: u32,
516 width: i32,
517 height: i32,
518 roi: *const i32,
519 proc_: u32,
520 ) -> VAALError;
521}
522extern "C" {
523 #[doc = " Loads a video frame from physical memory into the tensor, handling any\n required conversions (such as casting to floating point, if required). The\n frame must have a stride calculated from with and a known fourcc code, for\n example YUYV would need stride to be width*2 whereas NV12 would required\n stride to be width. For planar formats each plane must be packed\n sequentially, so for NV12 the UV planes must follow immediately after the Y\n plane.\n\n @param context VAALContext which owns the model into which the video frame\n will be loaded.\n @param tensor optional DeepViewRT tensor to receive the video frame. If NULL\n the model's first input tensor will be used.\n @param memory the virtual memory location of the frame.\n @param fourcc the fourcc code for the video frame which will be used to\n convert to the model's expected format (assumed to be RGB).\n @param width the width of the source frame, it will be resized to the target\n tensor's width.\n @param height the height of the source frame, it will be resized to the\n target tensor's height.\n @param roi optional roi which will cause the input frame to be cropped before\n resizing.\n @param proc mask of image pre-processing to apply on load.\n\n @return VAALError\n\n @since 1.1"]
524 pub fn vaal_load_frame_physical(
525 context: *mut VAALContext,
526 tensor: *mut NNTensor,
527 physical: u64,
528 fourcc: u32,
529 width: i32,
530 height: i32,
531 roi: *const i32,
532 proc_: u32,
533 ) -> VAALError;
534}
535extern "C" {
536 #[doc = " Loads a video frame from a dmabuf video buffer into the tensor, handling any\n required conversions (such as casting to floating point, if required). The\n frame must have a stride calculated from with and a known fourcc code, for\n example YUYV would need stride to be width*2 whereas NV12 would required\n stride to be width. For planar formats each plane must be packed\n sequentially, so for NV12 the UV planes must follow immediately after the Y\n plane.\n\n @param context VAALContext which owns the model into which the video frame\n will be loaded.\n @param tensor optional DeepViewRT tensor to receive the video frame. If NULL\n the model's first input tensor will be used.\n @param dmabuf file descriptor to a dmabuf holding the video frame.\n @param fourcc the fourcc code for the video frame which will be used to\n convert to the model's expected format (assumed to be RGB).\n @param width the width of the source frame, it will be resized to the target\n tensor's width.\n @param height the height of the source frame, it will be resized to the\n target tensor's height.\n @param roi optional roi which will cause the input frame to be cropped before\n resizing.\n @param proc mask of image pre-processing to apply on load.\n\n @return VAALError\n\n @since 1.1"]
537 pub fn vaal_load_frame_dmabuf(
538 context: *mut VAALContext,
539 tensor: *mut NNTensor,
540 dmabuf: ::std::os::raw::c_int,
541 fourcc: u32,
542 width: i32,
543 height: i32,
544 roi: *const i32,
545 proc_: u32,
546 ) -> VAALError;
547}
548extern "C" {
549 #[doc = " Convenience around the @ref vaal_load_frame_memory() function which will\n first decode the image into a raw buffer. Once the image has been decoded it\n will be sent to the load_frame function for further processing.\n\n To load an image directly from file see @ref vaal_load_image_file() instead.\n\n The following image formats are supported.\n\n - JPEG\n - PNG\n - BMP\n - TIFF\n\n @param context VAALContext which owns the model into which the video frame\n will be loaded.\n @param tensor optional DeepViewRT tensor to receive the video frame. If NULL\n the model's first input tensor will be used.\n @param image buffer to encoded image.\n @param len size of the image buffer.\n @param roi optional roi which will cause the input frame to be cropped before\n resizing.\n @param proc mask of image pre-processing to apply on load.\n\n @return VAALError\n\n @since 1.1"]
550 pub fn vaal_load_image(
551 context: *mut VAALContext,
552 tensor: *mut NNTensor,
553 image: *const u8,
554 len: usize,
555 roi: *const i32,
556 proc_: u32,
557 ) -> VAALError;
558}
559extern "C" {
560 #[doc = " Convenience around the @ref vaal_load_image() function which first loads the\n image from a file.\n\n @param context VAALContext which owns the model into which the video frame\n will be loaded.\n @param tensor optional DeepViewRT tensor to receive the video frame. If NULL\n the model's first input tensor will be used.\n @param filename path to image to be loaded.\n @param roi optional roi which will cause the input frame to be cropped before\n resizing.\n @param proc mask of image pre-processing to apply on load.\n\n @return VAALError\n\n @since 1.0"]
561 pub fn vaal_load_image_file(
562 context: *mut VAALContext,
563 tensor: *mut NNTensor,
564 filename: *const ::std::os::raw::c_char,
565 roi: *const i32,
566 proc_: u32,
567 ) -> VAALError;
568}
569extern "C" {
570 #[doc = " Returns the text value for the label. If the label is not available in the\n model then NULL will be returned.\n\n @param context The VAALContext owning the model from which we want labels.\n @param label The label index to be translated to a string.\n\n @return label string or NULL.\n\n @since 1.1"]
571 pub fn vaal_label(
572 context: *mut VAALContext,
573 label: ::std::os::raw::c_int,
574 ) -> *const ::std::os::raw::c_char;
575}
576extern "C" {
577 #[doc = " Handles post-processing the model's output and reading the bounding boxes\n into the user provided array of boxes, up to @param max_boxes. The function\n can be called with max_boxes set to 0 to cause the function to return the\n number of boxes detected, doing so causes the post-processing function to\n avoid storing the box results into @param boxes and ignoring @param max_boxes\n for early stopping.\n\n @param context The VAALContext which owns the model from which we want boxes.\n @param boxes An array of boxes which will received the decoded results.\n @param max_boxes The size of @param boxes limits the maximum number of boxes.\n @param num_boxes The number of boxes detected.\n\n @return VAALError\n\n @since 1.0"]
578 pub fn vaal_boxes(
579 context: *mut VAALContext,
580 boxes: *mut VAALBox,
581 max_boxes: usize,
582 num_boxes: *mut usize,
583 ) -> VAALError;
584}
585extern "C" {
586 #[doc = " @brief Handles post-processing of the model's outputs and reading the\n keypoints into the user provided array of keypoints, up to @param\n max_keypoints.\n\n @param context The VAALContext which owns the model from which we want\n keypoints.\n @param keypoints An array of keypoints which will receive the decoded\n results.\n @param max_keypoints The size of @param keypoints limits the maximum number\n of keypoints.\n @param num_keypoints The number of keypoints detected.\n\n @return VAALError\n\n @since 1.4"]
587 pub fn vaal_keypoints(
588 context: *mut VAALContext,
589 keypoints: *mut VAALKeypoint,
590 max_keypoints: usize,
591 num_keypoints: *mut usize,
592 ) -> VAALError;
593}
594extern "C" {
595 #[doc = " @brief Handles post-processing of the model's outputs and reading the euler\n angles into the user provided array of orientations. This function currently\n will only return a single set of euler angles, but will be extended in the\n future to have the same capability as other post-processing functions.\n\n @param context The VAALContext which owns the model from which we want euler\n angles.\n @param orientations An array of orientations which will receive the decoded\n results.\n @param num_orientations The number of orientations detected. (Will always be\n 1 currently)\n\n @return VAALError\n\n @since 1.4"]
596 pub fn vaal_euler(
597 context: *mut VAALContext,
598 orientations: *mut VAALEuler,
599 num_orientations: *mut usize,
600 ) -> VAALError;
601}
602extern "C" {
603 #[doc = " Access the DeepViewRT NNTensor objects for the model's output. The function\n supports multiple outputs which are selected using the index parameter. To\n confirm the number of outputs you may use the @ref vaal_output_count()\n function and to read the names of the outputs as defined in the model file\n you may use @ref vaal_output_name().\n\n An output will fail to be found if there's no model loaded, the context is\n not valid, or the index is out of range. It is also possible the model has\n no outputs identified. In these cases the function will return NULL.\n\n @param context The VAALContext which owns the model from which we want to\n retrieve output tensors.\n @param index The output layer index.\n\n @return NNTensor or NULL if the output cannot be found, see notes.\n\n @since 1.1"]
604 pub fn vaal_output_tensor(
605 context: *mut VAALContext,
606 index: ::std::os::raw::c_int,
607 ) -> *mut NNTensor;
608}
609extern "C" {
610 #[doc = " Returns the number of tensor outputs defined by the current model. If the\n context is invalid, has no model loaded, or the model does not identify any\n outputs then the function will return 0.\n\n @param context The VAALContext which owns the model from which we want to\n count the number of outputs.\n\n @return The number of outputs defined by the model.\n\n @since 1.1"]
611 pub fn vaal_output_count(context: *mut VAALContext) -> ::std::os::raw::c_int;
612}
613extern "C" {
614 #[doc = " Returns the layer name from the model which corresponds to the output at the\n provided index. If the context is invalid, has no model loaded, or the index\n is out of range then the function will return NULL.\n\n @param context The VAALContext which owns the model from which we want to get\n the output name.\n @param index the output layer index.\n\n @return The name of the layer in the model which owns the output tensor.\n\n @since 1.1"]
615 pub fn vaal_output_name(
616 context: *mut VAALContext,
617 index: ::std::os::raw::c_int,
618 ) -> *const ::std::os::raw::c_char;
619}
620extern "C" {
621 #[doc = " CenterNet decoder.\n\n @return VAALError\n\n @since 1.0"]
622 pub fn vaal_postprocessing_centernet(
623 heatmap_tensor: *mut NNTensor,
624 regression_tensor: *mut NNTensor,
625 size_tensor: *mut NNTensor,
626 cache: *mut NNTensor,
627 decode_out: *mut NNTensor,
628 ) -> VAALError;
629}
630extern "C" {
631 #[doc = " YOLO decoder.\n\n @return VAALError\n\n @since 1.0"]
632 pub fn vaal_postprocessing_centernet_sigmoid(
633 heatmap_tensor: *mut NNTensor,
634 regression_tensor: *mut NNTensor,
635 size_tensor: *mut NNTensor,
636 cache_tensor: *mut NNTensor,
637 decode_out: *mut NNTensor,
638 ) -> VAALError;
639}
640extern "C" {
641 pub fn vaal_postprocessing_yolo(
642 feature_tensors: *mut *mut NNTensor,
643 input_shape: ::std::os::raw::c_int,
644 yolo_model_idx: ::std::os::raw::c_int,
645 cache: *mut NNTensor,
646 score_threshold: f32,
647 iou_threshold: f32,
648 max_output_size_per_class: ::std::os::raw::c_int,
649 bbx_out_tensor: *mut NNTensor,
650 bbx_out_dim_tensor: *mut NNTensor,
651 ) -> VAALError;
652}
653extern "C" {
654 pub fn vaal_postprocessing_nms(
655 scores_tensor: *mut NNTensor,
656 boxes_tensor: *mut NNTensor,
657 cache_tensor: *mut NNTensor,
658 score_threshold: f32,
659 iou_threshold: f32,
660 max_output_size_per_class: ::std::os::raw::c_int,
661 bbx_out_tensor: *mut NNTensor,
662 bbx_out_dim_tensor: *mut NNTensor,
663 ) -> VAALError;
664}
665extern "C" {
666 pub fn vaal_facedet_decode(
667 priors: *mut NNTensor,
668 loc: *mut NNTensor,
669 iou: *mut NNTensor,
670 conf: *mut NNTensor,
671 scores: *mut NNTensor,
672 boxes: *mut NNTensor,
673 ) -> VAALError;
674}
675extern "C" {
676 #[doc = " Box NMS.\n\n @return VAALError\n\n @since 1.0"]
677 pub fn vaal_postprocessing_ssd_standard_bbx(
678 score_tensor: *mut NNTensor,
679 trans: *mut NNTensor,
680 anchors: *mut NNTensor,
681 cache: *mut NNTensor,
682 score_threshold: f32,
683 iou_threshold: f32,
684 max_output_size: i32,
685 bbx_out_tensor: *mut NNTensor,
686 bbx_out_dim_tensor: *mut NNTensor,
687 ) -> VAALError;
688}
689extern "C" {
690 pub fn vaal_remap_detection_tensors(
691 mode: *mut NNModel,
692 context: *mut NNContext,
693 detection_tensors: *mut *mut NNTensor,
694 ) -> VAALError;
695}
696extern "C" {
697 pub fn vaal_set_class_filter(
698 decode_out: *mut NNTensor,
699 class_idx_array: *mut ::std::os::raw::c_int,
700 len: ::std::os::raw::c_int,
701 ) -> VAALError;
702}
703extern "C" {
704 pub fn vaal_set_nms_type(
705 decode_out: *mut NNTensor,
706 nms_type_in: ::std::os::raw::c_int,
707 ) -> VAALError;
708}
709extern "C" {
710 pub fn vaal_check_model_string(idx: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char;
711}
712extern "C" {
713 pub fn vaal_set_detection_model_type(
714 model: *mut NNModel,
715 context: *mut NNContext,
716 model_type_id: ::std::os::raw::c_int,
717 );
718}
719pub const vaal_model_type_model_type_none: vaal_model_type = 0;
720pub const vaal_model_type_model_type_people_detection: vaal_model_type = 10;
721pub const vaal_model_type_model_type_face_detection: vaal_model_type = 20;
722pub const vaal_model_type_model_type_head_pose: vaal_model_type = 30;
723pub const vaal_model_type_model_type_human_pose: vaal_model_type = 40;
724pub type vaal_model_type = ::std::os::raw::c_uint;
725extern "C" {
726 #[doc = " @brief Returns the model path that VAAL will search for models requested.\n\n @return const char*\n\n @since 1.4"]
727 pub fn vaal_model_path() -> *const ::std::os::raw::c_char;
728}
729extern "C" {
730 #[doc = " @brief Creates a VAALContext that is using the specified engine and attempts\n to load a model that is of the provided model type. Must call\n vaal_context_release on returned context, to avoid memory leak.\n\n @param engine The engine that this context should use ('cpu', 'gpu', 'npu')\n\n @param m_type The type of model to load into this context\n\n @return VAALContext* A fully initialized context, which will be loaded with\n the specified model type if it was found.\n\n @since 1.4"]
731 pub fn vaal_model_probe(
732 engine: *const ::std::os::raw::c_char,
733 m_type: vaal_model_type,
734 ) -> *mut VAALContext;
735}