EdgeAI TIOVX Apps Guide
info.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2024 Texas Instruments Incorporated
4  *
5  * All rights reserved not granted herein.
6  *
7  * Limited License.
8  *
9  * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10  * license under copyrights and patents it now or hereafter owns or controls to make,
11  * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12  * terms herein. With respect to the foregoing patent license, such license is granted
13  * solely to the extent that any such patent is necessary to Utilize the software alone.
14  * The patent license shall not apply to any combinations which include this software,
15  * other than combinations with devices manufactured by or for TI ("TI Devices").
16  * No hardware patent is licensed hereunder.
17  *
18  * Redistributions must preserve existing copyright notices and reproduce this license
19  * (including the above copyright notice and the disclaimer and (if applicable) source
20  * code license limitations below) in the documentation and/or other materials provided
21  * with the distribution
22  *
23  * Redistribution and use in binary form, without modification, are permitted provided
24  * that the following conditions are met:
25  *
26  * * No reverse engineering, decompilation, or disassembly of this software is
27  * permitted with respect to any software provided in binary form.
28  *
29  * * any redistribution and use are licensed by TI for use only with TI Devices.
30  *
31  * * Nothing shall obligate TI to provide you with source code for the software
32  * licensed and provided to you in object code.
33  *
34  * If software source code is provided to you, modification and redistribution of the
35  * source code are permitted provided that the following conditions are met:
36  *
37  * * any redistribution and use of the source code, including any resulting derivative
38  * works, are licensed by TI for use only with TI Devices.
39  *
40  * * any redistribution and use of any object code compiled from the source code
41  * and any resulting derivative works, are licensed by TI for use only with TI Devices.
42  *
43  * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44  *
45  * may be used to endorse or promote products derived from this software without
46  * specific prior written permission.
47  *
48  * DISCLAIMER.
49  *
50  * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53  * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59  * OF THE POSSIBILITY OF SUCH DAMAGE.
60  *
61  */
62 
63 #ifndef _TIOVX_APPS_INFO
64 #define _TIOVX_APPS_INFO
65 
66 
67 #include <stdint.h>
68 #include <string.h>
69 #include <stdbool.h>
70 
71 
72 #ifdef TIOVX_APPS_DEBUG
73 #define TIOVX_APPS_PRINTF(f_, ...) printf("[TIOVX_APPS][DEBUG] %d: %s: " f_, __LINE__, __func__, ##__VA_ARGS__)
74 #else
75 #define TIOVX_APPS_PRINTF(f_, ...)
76 #endif
77 
78 #define TIOVX_APPS_ERROR(f_, ...) printf("[TIOVX_APPS][ERROR] %d: %s: " f_, __LINE__, __func__, ##__VA_ARGS__)
79 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
84 
85 #define DEFAULT_CHAR_ARRAY_SIZE (64)
86 
87 #define MAX_CHAR_ARRAY_SIZE (128)
88 #define MAX_FLOWS (32)
89 #define MAX_SUBFLOW (32)
90 #define MAX_MOSAIC_INPUT (32)
91 
92 #define MAX_RAW_IMG (100)
93 
94 typedef enum {
95  RTOS_CAM = 0,
100 } InputSource;
101 
102 typedef enum {
108 } OutputSink;
109 
110 /*
111  * Input Information
112  */
113 typedef struct {
114  /* Unique input name */
116 
117  /* Input source. Ex: RTOS_CAM, LINUX_CAM, RAW_IMG etc. */
119 
120  /* Source name */
121  char source_name[DEFAULT_CHAR_ARRAY_SIZE];
122 
123  /* Width of the input. */
124  uint32_t width;
125 
126  /* Height of the input. */
127  uint32_t height;
128 
129  /* Loop raw img input */
130  bool loop;
131 
132  /* Frame rate for raw img input. */
133  float framerate;
134 
135  /* Directory containg raw img. */
136  char raw_img_paths[MAX_RAW_IMG][MAX_CHAR_ARRAY_SIZE];
137 
138  /* Number of total raw img */
139  uint32_t num_raw_img;
140 
141  /* Video file path */
142  char video_path[MAX_CHAR_ARRAY_SIZE];
143 
144  /* Input format [Does not matter in case of RTOS_CAM]. */
146 
147  /* Name of the camera to be used for RTOS_CAM. */
148  char sensor_name[DEFAULT_CHAR_ARRAY_SIZE];
149 
150  /* Channe mask for RTOS_CAM. */
151  uint32_t channel_mask;
152 
153  /* Enable LDC */
155 
156  /* Device path for LINUX_CAM. */
158 
159  /* Subdev path for LINUX_CAM. */
161 
162  /* Number of channels of the input */
163  uint32_t num_channels;
164 
165 } InputInfo;
166 
167 /*
168  * Pre Proc Information
169  */
170 typedef struct {
171  /* Crop width */
172  uint32_t crop_width;
173 
174  /* Crop height */
175  uint32_t crop_height;
176 
177  /* Resize width */
178  uint32_t resize_width;
179 
180  /* Resize height */
181  uint32_t resize_height;
182 
183  /* Tensor format */
184  uint8_t tensor_format;
185 
186  float mean[3];
187 
188  float scale[3];
189 } PreProcInfo;
190 
191 /*
192  * Post Proc Information
193  */
194 typedef struct {
195  /* TopN overlay for image classification. */
196  uint32_t top_n;
197 
198  /* Vizualisation threshold for object detection. */
200 
201  /* Alpha value for blending segmentation map. */
202  float alpha;
203 
204  /* Normalized detection */
206 
207  /* Task type. */
208  char task_type[DEFAULT_CHAR_ARRAY_SIZE];
209 
210  /* Formatter */
211  int32_t formatter[6];
212 
213  /* Label Offset */
214  int32_t label_offset[1000];
215 
216  /* Number of label Offset */
218 
219  /* Label Index Offset */
221 
222 } PostProcInfo;
223 
224 
225 /*
226  * Model Information
227  */
228 typedef struct {
229  /* Unique model name */
231 
232  /* Path of model directory. */
233  char model_path[MAX_CHAR_ARRAY_SIZE];
234 
235  /* Path of model io_config. */
236  char io_config_path[MAX_CHAR_ARRAY_SIZE];
237 
238  /* Path of model network. */
239  char network_path[MAX_CHAR_ARRAY_SIZE];
240 
241  /* Pre Proc Information */
243 
244  /* Post Proc Information */
246 
247 } ModelInfo;
248 
249 /*
250  * Output Information
251  */
252 typedef struct {
253  /* Unique output name */
255 
256  /* Name of the source. Ex: RTOS_DISPLAY, LINUX_DISPLAY etc. */
258 
259  /* Sink name */
260  char sink_name[DEFAULT_CHAR_ARRAY_SIZE];
261 
262  /* Width of the output. */
263  uint32_t width;
264 
265  /* Height of the output. */
266  uint32_t height;
267 
268  /* CRTC for kms display */
269  uint32_t crtc;
270 
271  /* Connector for kms display */
272  uint32_t connector;
273 
274  /* Output directory for saving image/videos */
275  char output_path[MAX_CHAR_ARRAY_SIZE];
276 
277  /* Framerate for saving image */
278  float framerate;
279 
280  /* Apply performance overlay */
282 
283  /* Background title */
285 } OutputInfo;
286 
287 /*
288  * Mosaic Information
289  */
290 typedef struct {
291  /* X pos of the window. */
292  uint32_t pos_x;
293 
294  /* Y pos of the window. */
295  uint32_t pos_y;
296 
297  /* Width of the window. */
298  uint32_t width;
299 
300  /* Height of the window. */
301  uint32_t height;
302 } MosaicInfo;
303 
304 
305 /*
306  * Subflow Information
307  */
308 typedef struct {
309  /* Is this subflow used for deep learning*/
310  bool has_model;
311 
312  /* Number of channels */
313  uint32_t num_channels;
314 
315  /* Model Information. */
317 
318  /* Output Information. */
320 
321  /* Mosaic Information. */
322  MosaicInfo mosaic_info[32];
323 
324  /* Max width amongst provided mosaic info. */
326 
327  /* Max height amongst provided mosaic info. */
329 } SubflowInfo;
330 
331 /*
332  * Flow Information
333  */
334 typedef struct {
335  /* Input information. */
337 
338  /* Array of Subflow Informations. */
339  SubflowInfo subflow_infos[MAX_SUBFLOW];
340 
341  /* Number of subflows for the particular input. */
342  uint32_t num_subflows;
343 } FlowInfo;
344 
345 /*
346  * Command Line Arguments
347  */
348 typedef struct {
349  /* Path to config file. */
350  char config_file[64];
351 
352  /* Verbose. */
353  bool verbose;
354 
355  /* Dump graph as dot */
356  bool dump_dot;
357 } CmdArgs;
358 
359 #ifdef __cplusplus
360 }
361 #endif
362 
363 #endif
int32_t label_index_offset
Definition: info.h:220
uint32_t width
Definition: info.h:298
uint32_t height
Definition: info.h:301
Definition: info.h:99
uint32_t crop_height
Definition: info.h:175
bool ldc_enabled
Definition: info.h:154
#define MAX_SUBFLOW
Definition: info.h:89
#define MAX_RAW_IMG
Definition: info.h:92
bool verbose
Definition: info.h:353
uint32_t num_raw_img
Definition: info.h:139
uint32_t connector
Definition: info.h:272
float framerate
Definition: info.h:133
Definition: info.h:106
uint32_t num_channels
Definition: info.h:163
Definition: info.h:97
bool overlay_perf
Definition: info.h:281
Definition: info.h:334
uint32_t crtc
Definition: info.h:269
#define MAX_CHAR_ARRAY_SIZE
Definition: info.h:87
uint32_t pos_x
Definition: info.h:292
InputSource
Definition: info.h:94
Definition: info.h:290
Definition: info.h:308
uint32_t resize_height
Definition: info.h:181
uint32_t width
Definition: info.h:263
uint32_t pos_y
Definition: info.h:295
InputSource source
Definition: info.h:118
uint32_t num_channels
Definition: info.h:313
PostProcInfo post_proc_info
Definition: info.h:245
ModelInfo model_info
Definition: info.h:316
Definition: info.h:107
Definition: info.h:95
uint32_t channel_mask
Definition: info.h:151
uint32_t width
Definition: info.h:124
uint32_t max_mosaic_width
Definition: info.h:325
Definition: info.h:252
OutputSink
Definition: info.h:102
Definition: info.h:194
Definition: info.h:228
uint32_t height
Definition: info.h:127
PreProcInfo pre_proc_info
Definition: info.h:242
uint32_t num_label_offset
Definition: info.h:217
bool has_model
Definition: info.h:310
OutputSink sink
Definition: info.h:257
Definition: info.h:170
bool dump_dot
Definition: info.h:356
float framerate
Definition: info.h:278
uint32_t resize_width
Definition: info.h:178
uint32_t top_n
Definition: info.h:196
uint32_t max_mosaic_height
Definition: info.h:328
Definition: info.h:105
float alpha
Definition: info.h:202
uint8_t tensor_format
Definition: info.h:184
float viz_threshold
Definition: info.h:199
Definition: info.h:103
#define DEFAULT_CHAR_ARRAY_SIZE
Definition: info.h:85
Definition: info.h:98
Definition: info.h:348
uint32_t height
Definition: info.h:266
InputInfo input_info
Definition: info.h:336
bool norm_detect
Definition: info.h:205
uint32_t crop_width
Definition: info.h:172
bool loop
Definition: info.h:130
uint32_t num_subflows
Definition: info.h:342
Definition: info.h:104
Definition: info.h:96
OutputInfo output_info
Definition: info.h:319
Definition: info.h:113