TIOVX User Guide
tivx.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (c) 2017-2025 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 VX_EXT_TI_H_
64 #define VX_EXT_TI_H_
65 
66 #include <VX/vx.h>
67 #include <VX/vx_khr_pipelining.h>
70 #include <TI/tivx_debug.h>
71 #include <TI/tivx_log_rt.h>
72 #include <TI/tivx_kernels.h>
73 #include <TI/tivx_nodes.h>
74 #include <TI/tivx_mem.h>
75 #include <TI/tivx_tensor.h>
76 #include <TI/tivx_ext_raw_image.h>
77 #include <TI/tivx_ext_super_node.h>
78 #include <TI/tivx_soc.h>
79 #include <TI/tivx_log_stats.h>
81 
82 #ifdef __cplusplus
83 extern "C" {
84 #endif
85 
96 #define TIVX_TARGET_MAX_NAME (64u)
97 
106 #define TIVX_TARGET_HOST "HOST"
107 
113 #define TIVX_CONFIG_PATH_LENGTH (512u)
114 
123 #define TIVX_CONTROL_CMD_SEND_TO_ALL_REPLICATED_NODES ((uint32_t)-1)
124 
125 /*
126  * Super node configuration resources
127  */
131 #define TIVX_GRAPH_MAX_SUPER_NODES (8u)
132 
136 #define TIVX_MAX_DSP_BAM_USER_PLUGINS (8u)
137 
141 #define TIVX_SUPER_NODE_MAX_NODES (16u)
142 
146 #define TIVX_SUPER_NODE_MAX_EDGES (16u)
147 
151 #define TIVX_SUPER_NODE_MAX_OBJECTS (16u)
152 
153 /*
154  * The following parameters are publicly included to retain functionality
155  * within the boundary test cases.
156  */
162 #define TIVX_PYRAMID_MAX_LEVELS_ORB (17u)
163 
167 #define TIVX_MAX_KERNEL_ID (VX_KERNEL_MASK)
168 
172 #define TIVX_MAX_LIBRARY_ID (VX_LIBRARY(VX_LIBRARY_MASK))
173 
174 #if 0
175 /* The below enums are provided here in a commented out location in order
176  * to track the value of the enums and ensure that there are no conflicting
177  * values. The location of the actual definition of these values are also
178  * provided.
179  */
180 /* This enum can be found in include/TI/tivx_ext_raw_image.h */
181 #define TIVX_ENUM_RAW_IMAGE_BUFFER_ACCESS (vx_enum)0x0
182 
183 /* This enum can be found in include/TI/tivx_ext_raw_image.h */
184 #define TIVX_ENUM_RAW_IMAGE_PIXEL_CONTAINER (vx_enum)0x1
185 
186 /* This enum can be found in source/include/tivx_event_queue.h */
187 #define TIVX_ENUM_EVENT_QUEUE (vx_enum)0x2
188 #endif
189 
194 typedef enum _tivx_graph_attribute_extensions_e {
195 
198 
200 
205 typedef enum _tivx_node_attribute_extensions_e {
206 
209 
219 
227 
229 
234 typedef enum _tivx_reference_attribute_extensions_e {
235 
238 
241 
251 
256 typedef enum _tivx_kernel_attribute_extensions_e {
257 
265 
267 
272 typedef enum _tivx_context_attribute_extensions_e {
273 
280 
287 
289 
294 typedef enum _tivx_image_attribute_extensions_e {
295 
301 
319 
321 
326 typedef enum _tivx_tensor_attribute_extensions_e {
327 
333 
335 
336 
341 typedef enum _tivx_df_image_e {
342 
346  TIVX_DF_IMAGE_P12 = VX_DF_IMAGE('P','0','1','2'),
347 
352 
356  TIVX_DF_IMAGE_RGB565 = VX_DF_IMAGE('R','5','6','5'),
357 
362  TIVX_DF_IMAGE_BGRX = VX_DF_IMAGE('B','G','R','A'),
364 
368 typedef enum _tivx_status_e {
373 
374  /* add new codes here */
375 
376 } tivx_status_e;
377 
389 void tivxInit(void);
390 
402 void tivxDeInit(void);
403 
415 void tivxHostInit(void);
416 
428 void tivxHostDeInit(void);
429 
448 VX_API_ENTRY vx_status VX_API_CALL tivxAddKernelTarget(vx_kernel kernel, const char *target_name);
449 
462 VX_API_ENTRY vx_status VX_API_CALL tivxSetKernelSinkDepth(vx_kernel kernel, uint32_t num_sink_bufs);
463 
482 VX_API_ENTRY vx_status VX_API_CALL tivxRegisterModule(const char *name, vx_publish_kernels_f publish, vx_unpublish_kernels_f unpublish);
483 
495 VX_API_ENTRY vx_status VX_API_CALL tivxUnRegisterModule(const char *name);
496 
505 
506 
510 #ifndef dimof
511 #define dimof(x) (sizeof(x)/sizeof(x[0]))
512 #endif
513 
528  vx_enum kernelenum,
529  vx_reference params[],
530  vx_uint32 num);
531 
546  vx_kernel kernel,
547  vx_reference params[],
548  vx_uint32 num);
549 
564  const char *kernel_name,
565  vx_reference params[],
566  vx_uint32 num);
567 
580 
590 
602 vx_bool tivxIsTargetEnabled(const char target_name[]);
603 
611 uint64_t tivxPlatformGetTimeInUsecs(void);
612 
631 
654 
664 
702  uint32_t replicate_nodex_idx, uint32_t node_cmd_id,
703  vx_reference ref[], uint32_t num_refs);
704 
745  uint32_t replicate_nodex_idx, uint32_t node_cmd_id,
746  vx_reference ref[], uint32_t num_refs, uint32_t timeout);
747 
763 vx_node tivxGraphGetNode(vx_graph graph, uint32_t idx);
764 
774 VX_API_ENTRY vx_status VX_API_CALL tivxSetNodeTileSize(vx_node node, vx_uint32 block_width, vx_uint32 block_height);
775 
786 VX_API_ENTRY vx_status VX_API_CALL tivxSetReferenceAttribute(vx_reference ref, vx_enum attribute, const void *ptr, vx_size size);
787 
800 
884 VX_API_ENTRY vx_status VX_API_CALL tivxReferenceImportHandle(vx_reference ref, const void *addr[], const uint32_t size[], uint32_t num_entries);
885 
962 VX_API_ENTRY vx_status VX_API_CALL tivxReferenceExportHandle(const vx_reference ref, void *addr[], uint32_t size[], uint32_t max_num_entries, uint32_t *num_entries);
963 
964 
976 
977 
978 #ifdef __cplusplus
979 }
980 #endif
981 
982 #endif
983 
vx_bool
void tivxHostInit(void)
Function to initialize OpenVX HOST side functionality.
tivx_tensor_attribute_extensions_e
TI attribute extensions for the tensor object.
Definition: tivx.h:326
Returns the target string corresponding to the node.
Definition: tivx.h:208
vx_node tivxGraphGetNode(vx_graph graph, uint32_t idx)
This API is used to get a reference to a node within a graph at a given index within the graph...
VX_API_ENTRY vx_bool VX_API_CALL tivxIsReferenceMetaFormatEqual(vx_reference ref1, vx_reference ref2)
Check for equivalence between the meta formats of two reference objects.
tivx_graph_attribute_extensions_e
TI attribute extensions for the graph object.
Definition: tivx.h:194
VX_API_ENTRY vx_status VX_API_CALL tivxSetReferenceAttribute(vx_reference ref, vx_enum attribute, const void *ptr, vx_size size)
Sets reference attributes for the below enums: TIVX_REFERENCE_TIMESTAMP.
uint64_t tivxPlatformGetTimeInUsecs(void)
Get the time in micro seconds.
VX_TYPE_REFERENCE
VX_API_ENTRY vx_status VX_API_CALL tivxReferenceExportHandle(const vx_reference ref, void *addr[], uint32_t size[], uint32_t max_num_entries, uint32_t *num_entries)
Exports the handles from a reference object.
tivx_kernel_attribute_extensions_e
TI attribute extensions for the kernel object.
Definition: tivx.h:256
Query the imagepatch addressing structure from a vx_image. Read-Only. Can be read at initialization a...
Definition: tivx.h:300
size_t vx_size
VX_API_ENTRY vx_status VX_API_CALL tivxReferenceImportHandle(vx_reference ref, const void *addr[], const uint32_t size[], uint32_t num_entries)
Updates a reference object with the supplied handles (pointers to memory).
Query the context number of user kernel ID&#39;s. Read-Only. Can be read at initialization as well as at ...
Definition: tivx.h:279
Implementation of an additional create function for the Object Array data object that takes a list of...
void tivxInit(void)
Function to initialize OpenVX framework.
int32_t vx_enum
vx_node tivxCreateNodeByKernelRef(vx_graph graph, vx_kernel kernel, vx_reference params[], vx_uint32 num)
Utility function to create a node given parameter references and kernel reference.
Interface to Tensor APIs (modeled after OpenVX 1.2 tensor support)
int32_t vx_int32
tivx_image_attribute_extensions_e
TI attribute extensions for the image object.
Definition: tivx.h:294
Query the strides from a vx_tensor object. Read-Only. Can be read at initialization as well as at run...
Definition: tivx.h:332
The OpenVX Bidirectional Parameters extension API.
vx_bool tivxIsTargetEnabled(const char target_name[])
Utility function to know if target is enabled or not.
The TI Raw Image extension.
VX_ID_TI
vx_enum vx_status
tivx_df_image_e
Based on the VX_DF_IMAGE definition.
Definition: tivx.h:341
struct _vx_context * vx_context
Indicates the base for the TIVX error codes. Used for bounds checks only.
Definition: tivx.h:372
Returns a boolean indicating whether or not a reference is invalid.
Definition: tivx.h:240
vx_reference tivxGetReferenceParent(vx_reference child_ref)
Utility function to extract the parent reference from an element.
struct _vx_reference * vx_reference
The OpenVX Pipelining, Streaming and Batch Processing extension API.
VX_API_ENTRY vx_status VX_API_CALL tivxAddKernelTarget(vx_kernel kernel, const char *target_name)
Associate a target with a kernel.
vx_node tivxCreateNodeByKernelName(vx_graph graph, const char *kernel_name, vx_reference params[], vx_uint32 num)
Utility function to create a node given parameter references and kernel name.
A single plane of packed 12-bit data.
Definition: tivx.h:346
vx_status(* vx_publish_kernels_f)(vx_context context)
void tivxDeInit(void)
Function to de-initialize OpenVX framework.
The Internal Debugging API.
vx_status VX_API_CALL tivxGetNodeParameterNumBufByIndex(vx_node node, vx_uint32 idx, vx_uint32 *num_buf)
Get number of buffers to allocate at output of a node parameter.
The TI Super Node extension.
VX_TYPE_CONTEXT
#define VX_ATTRIBUTE_BASE(vendor, object)
Returns the timestamp in micro-seconds corresponding to the given reference.
Definition: tivx.h:237
vx_status VX_API_CALL tivxNodeSendCommandTimed(vx_node node, uint32_t replicate_nodex_idx, uint32_t node_cmd_id, vx_reference ref[], uint32_t num_refs, uint32_t timeout)
Send node specific Control command.
Query the context number of user library ID&#39;s. Read-Only. Can be read at initialization as well as at...
Definition: tivx.h:286
VX_API_ENTRY vx_status VX_API_CALL tivxSetKernelSinkDepth(vx_kernel kernel, uint32_t num_sink_bufs)
Set the number of sink buffers.
Interface to Memory allocation and deallocation APIs.
The list of supported kernels in the TIOVX.
VX_TYPE_KERNEL
Query the reference to see if the associated buffer has been allocated. Note that this is only applic...
Definition: tivx.h:249
struct _vx_kernel * vx_kernel
tivx_status_e
The enumeration of all TIVX operational error codes.
Definition: tivx.h:368
VX_API_ENTRY vx_reference VX_API_CALL tivxCreateReferenceFromExemplar(vx_context context, vx_reference exemplar)
Create reference from a exemplar object.
vx_status VX_API_CALL tivxSetGraphPipelineDepth(vx_graph graph, vx_uint32 pipeline_depth)
Indicates to the implementation the depth of the graph pipeline.
a NV12 frame of packed 12-bit data.
Definition: tivx.h:351
Set/Query the node level timeout parameter. Read-Write. Can be written at initialization as well as a...
Definition: tivx.h:218
#define VX_DF_IMAGE(a, b, c, d)
vx_status VX_API_CALL tivxNodeSendCommand(vx_node node, uint32_t replicate_nodex_idx, uint32_t node_cmd_id, vx_reference ref[], uint32_t num_refs)
Send node specific Control command.
A single plane of 32-bit pixel as 4 interleaved 8-bit units of B then G then R data, then a don&#39;t care byte. This uses the BT709 full range by default.
Definition: tivx.h:362
VX_TYPE_IMAGE
Query the node to see if it has timed out. Read-Only. Can be read at initialization as well as at run...
Definition: tivx.h:226
void tivxHostDeInit(void)
Function to de-initialize OpenVX HOST side functionality.
vx_enum tivxGetSelfCpuId(void)
Return CPU ID of the CPU on which this API is called.
VX_TYPE_NODE
uint32_t vx_uint32
tivx_reference_attribute_extensions_e
TI attribute extensions for the reference object.
Definition: tivx.h:234
Interface to TI run-time logging APIs.
vx_node tivxCreateNodeByKernelEnum(vx_graph graph, vx_enum kernelenum, vx_reference params[], vx_uint32 num)
Utility function to create a node given parameter references and kernel enum.
Returns the graph stream executions. Read-only. Use a vx_uint32 parameter.
Definition: tivx.h:197
VX_API_ENTRY vx_status VX_API_CALL tivxSetNodeTileSize(vx_node node, vx_uint32 block_width, vx_uint32 block_height)
Sets the tile size for a given node in a graph. This is only valid for BAM-enabled kernels on C66 DSP...
Parameter allowing an application to query or set the stride Y alignment of a vx_image. By default, this value will be set to TIVX_DEFAULT_STRIDE_Y_ALIGN. Care must be taken to understand the requirements of the hardware which is consuming or producing the vx_image. Hardware which is being used via an OpenVX node has verification time errors thrown if the alignment is not in accordance with the requirements of the hardware, but alignment requirements of other hardware which is outside the scope of TIOVX (i.e., codecs) must be understood by the application developer and taken into consideration when creating the image consumed by that hardware. (For instance, the default value was originally chosen since this is a requirement of codec used on TI Jacinto devices) Read-Write. Can be read at any time, but only written to prior to the allocation of the buffer. Cannot be applied to subimages or images with subimages. If attempting to modify as a part of an object array, the exemplar itself shall be set rather than the elements of the object array Use a vx_uint32 parameter.
Definition: tivx.h:318
tivx_node_attribute_extensions_e
TI attribute extensions for the node object.
Definition: tivx.h:205
vx_status VX_API_CALL tivxSetNodeParameterNumBufByIndex(vx_node node, vx_uint32 idx, vx_uint32 num_buf)
Set number of buffers to allocate at output of a node parameter.
struct _vx_graph * vx_graph
VX_API_ENTRY vx_status VX_API_CALL tivxRegisterModule(const char *name, vx_publish_kernels_f publish, vx_unpublish_kernels_f unpublish)
Register publish and unpublish functions against a module name.
A single plane of packed 16-bit RGB565 data.
Definition: tivx.h:356
VX_API_ENTRY vx_status VX_API_CALL tivxUnRegisterModule(const char *name)
UnRegister publish and unpublish functions if previously registered.
struct _vx_node * vx_node
Set/Query the kernel level timeout parameter. Read-Write. Can be written at initialization as well as...
Definition: tivx.h:264
vx_bool tivxIsReferenceVirtual(vx_reference ref)
Utility function to check if the given reference is virtual or not.
vx_status(* VX_API_CALL)(vx_reference *ref)
Callback type used to register release callbacks from object derived from references.
Definition: vx_reference.h:56
tivx_context_attribute_extensions_e
TI attribute extensions for the context object.
Definition: tivx.h:272
The OpenVX User Data Object extension API.
VX_TYPE_GRAPH