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,
96
LINUX_CAM
,
97
H264_VID
,
98
RAW_IMG
,
99
NUM_INPUT_SOURCES
100
}
InputSource
;
101
102
typedef
enum
{
103
RTOS_DISPLAY
= 0,
104
LINUX_DISPLAY
,
105
H264_ENCODE
,
106
IMG_DIR
,
107
NUM_OUTPUT_SINKS
108
}
OutputSink
;
109
110
/*
111
* Input Information
112
*/
113
typedef
struct
{
114
/* Unique input name */
115
char
name[
DEFAULT_CHAR_ARRAY_SIZE
];
116
117
/* Input source. Ex: RTOS_CAM, LINUX_CAM, RAW_IMG etc. */
118
InputSource
source
;
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]. */
145
char
format[
DEFAULT_CHAR_ARRAY_SIZE
];
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 */
154
bool
ldc_enabled
;
155
156
/* Device path for LINUX_CAM. */
157
char
device[
DEFAULT_CHAR_ARRAY_SIZE
];
158
159
/* Subdev path for LINUX_CAM. */
160
char
subdev[
DEFAULT_CHAR_ARRAY_SIZE
];
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. */
199
float
viz_threshold
;
200
201
/* Alpha value for blending segmentation map. */
202
float
alpha
;
203
204
/* Normalized detection */
205
bool
norm_detect
;
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 */
217
uint32_t
num_label_offset
;
218
219
/* Label Index Offset */
220
int32_t
label_index_offset
;
221
222
}
PostProcInfo
;
223
224
225
/*
226
* Model Information
227
*/
228
typedef
struct
{
229
/* Unique model name */
230
char
name[
DEFAULT_CHAR_ARRAY_SIZE
];
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 */
242
PreProcInfo
pre_proc_info
;
243
244
/* Post Proc Information */
245
PostProcInfo
post_proc_info
;
246
247
}
ModelInfo
;
248
249
/*
250
* Output Information
251
*/
252
typedef
struct
{
253
/* Unique output name */
254
char
name[
DEFAULT_CHAR_ARRAY_SIZE
];
255
256
/* Name of the source. Ex: RTOS_DISPLAY, LINUX_DISPLAY etc. */
257
OutputSink
sink
;
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 */
281
bool
overlay_perf
;
282
283
/* Background title */
284
char
title[
DEFAULT_CHAR_ARRAY_SIZE
];
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. */
316
ModelInfo
model_info
;
317
318
/* Output Information. */
319
OutputInfo
output_info
;
320
321
/* Mosaic Information. */
322
MosaicInfo
mosaic_info[32];
323
324
/* Max width amongst provided mosaic info. */
325
uint32_t
max_mosaic_width
;
326
327
/* Max height amongst provided mosaic info. */
328
uint32_t
max_mosaic_height
;
329
}
SubflowInfo
;
330
331
/*
332
* Flow Information
333
*/
334
typedef
struct
{
335
/* Input information. */
336
InputInfo
input_info
;
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
PostProcInfo::label_index_offset
int32_t label_index_offset
Definition:
info.h:220
MosaicInfo::width
uint32_t width
Definition:
info.h:298
MosaicInfo::height
uint32_t height
Definition:
info.h:301
NUM_INPUT_SOURCES
Definition:
info.h:99
PreProcInfo::crop_height
uint32_t crop_height
Definition:
info.h:175
InputInfo::ldc_enabled
bool ldc_enabled
Definition:
info.h:154
MAX_SUBFLOW
#define MAX_SUBFLOW
Definition:
info.h:89
MAX_RAW_IMG
#define MAX_RAW_IMG
Definition:
info.h:92
CmdArgs::verbose
bool verbose
Definition:
info.h:353
InputInfo::num_raw_img
uint32_t num_raw_img
Definition:
info.h:139
OutputInfo::connector
uint32_t connector
Definition:
info.h:272
InputInfo::framerate
float framerate
Definition:
info.h:133
IMG_DIR
Definition:
info.h:106
InputInfo::num_channels
uint32_t num_channels
Definition:
info.h:163
H264_VID
Definition:
info.h:97
OutputInfo::overlay_perf
bool overlay_perf
Definition:
info.h:281
FlowInfo
Definition:
info.h:334
OutputInfo::crtc
uint32_t crtc
Definition:
info.h:269
MAX_CHAR_ARRAY_SIZE
#define MAX_CHAR_ARRAY_SIZE
Definition:
info.h:87
MosaicInfo::pos_x
uint32_t pos_x
Definition:
info.h:292
InputSource
InputSource
Definition:
info.h:94
MosaicInfo
Definition:
info.h:290
SubflowInfo
Definition:
info.h:308
PreProcInfo::resize_height
uint32_t resize_height
Definition:
info.h:181
OutputInfo::width
uint32_t width
Definition:
info.h:263
MosaicInfo::pos_y
uint32_t pos_y
Definition:
info.h:295
InputInfo::source
InputSource source
Definition:
info.h:118
SubflowInfo::num_channels
uint32_t num_channels
Definition:
info.h:313
ModelInfo::post_proc_info
PostProcInfo post_proc_info
Definition:
info.h:245
SubflowInfo::model_info
ModelInfo model_info
Definition:
info.h:316
NUM_OUTPUT_SINKS
Definition:
info.h:107
RTOS_CAM
Definition:
info.h:95
InputInfo::channel_mask
uint32_t channel_mask
Definition:
info.h:151
InputInfo::width
uint32_t width
Definition:
info.h:124
SubflowInfo::max_mosaic_width
uint32_t max_mosaic_width
Definition:
info.h:325
OutputInfo
Definition:
info.h:252
OutputSink
OutputSink
Definition:
info.h:102
PostProcInfo
Definition:
info.h:194
ModelInfo
Definition:
info.h:228
InputInfo::height
uint32_t height
Definition:
info.h:127
ModelInfo::pre_proc_info
PreProcInfo pre_proc_info
Definition:
info.h:242
PostProcInfo::num_label_offset
uint32_t num_label_offset
Definition:
info.h:217
SubflowInfo::has_model
bool has_model
Definition:
info.h:310
OutputInfo::sink
OutputSink sink
Definition:
info.h:257
PreProcInfo
Definition:
info.h:170
CmdArgs::dump_dot
bool dump_dot
Definition:
info.h:356
OutputInfo::framerate
float framerate
Definition:
info.h:278
PreProcInfo::resize_width
uint32_t resize_width
Definition:
info.h:178
PostProcInfo::top_n
uint32_t top_n
Definition:
info.h:196
SubflowInfo::max_mosaic_height
uint32_t max_mosaic_height
Definition:
info.h:328
H264_ENCODE
Definition:
info.h:105
PostProcInfo::alpha
float alpha
Definition:
info.h:202
PreProcInfo::tensor_format
uint8_t tensor_format
Definition:
info.h:184
PostProcInfo::viz_threshold
float viz_threshold
Definition:
info.h:199
RTOS_DISPLAY
Definition:
info.h:103
DEFAULT_CHAR_ARRAY_SIZE
#define DEFAULT_CHAR_ARRAY_SIZE
Definition:
info.h:85
RAW_IMG
Definition:
info.h:98
CmdArgs
Definition:
info.h:348
OutputInfo::height
uint32_t height
Definition:
info.h:266
FlowInfo::input_info
InputInfo input_info
Definition:
info.h:336
PostProcInfo::norm_detect
bool norm_detect
Definition:
info.h:205
PreProcInfo::crop_width
uint32_t crop_width
Definition:
info.h:172
InputInfo::loop
bool loop
Definition:
info.h:130
FlowInfo::num_subflows
uint32_t num_subflows
Definition:
info.h:342
LINUX_DISPLAY
Definition:
info.h:104
LINUX_CAM
Definition:
info.h:96
SubflowInfo::output_info
OutputInfo output_info
Definition:
info.h:319
InputInfo
Definition:
info.h:113
apps
include
info.h
generated by
1.8.14