TIOVX User Guide

Detailed Description

Utility APIs available for the application running on the host.

Functions

vx_status tivx_utils_expand_file_path (const char *inFilePath, char *outFilePath)
 Conditionally returns the absolute path of the 'inFilePath'. More...
 
uint32_t tivx_utils_simple_image_checksum (vx_image image, uint8_t plane_id, vx_rectangle_t rect)
 Returns a uint32_t of the sum of all words within a rect of an image's buffer. More...
 
uint32_t tivx_utils_user_data_object_checksum (vx_user_data_object user_data_object, uint32_t offset_byte, uint32_t num_bytes)
 Returns a uint32_t of the sum of all words within a range of the user data object buffer. More...
 
uint32_t tivx_utils_tensor_checksum (vx_tensor tensor_object, vx_size number_of_dimensions, vx_size *view_start, vx_size *view_end, vx_size *user_stride)
 Returns a uint32_t of the sum of all words within a range of the tensor buffer. More...
 
vx_status tivx_utils_bmp_file_read (const char *filename, vx_bool convert_to_gray_scale, tivx_utils_bmp_image_params_t *imageParams)
 Read data from BMP file. More...
 
vx_status tivx_utils_bmp_file_read_from_memory (const void *buf, uint32_t buf_size, vx_bool convert_to_gray_scale, tivx_utils_bmp_image_params_t *imageParams)
 Read data from BMP file. More...
 
void tivx_utils_bmp_file_read_release (void *png_file_context)
 Free memory allocated during bmp file read. More...
 
int32_t tivx_utils_bmp_file_write (const char *filename, uint32_t width, uint32_t height, uint32_t stride, vx_df_image df, void *data_ptr)
 Write data into BMP file. More...
 
vx_image tivx_utils_create_vximage_from_bmpfile (vx_context context, const char *filename, vx_bool convert_to_gray_scale)
 Create a image data object given BMP filename as input. More...
 
vx_status tivx_utils_save_vximage_to_bmpfile (const char *filename, vx_image image)
 Save data from image object to BMP file. More...
 
vx_status tivx_utils_load_vximage_from_bmpfile (vx_image image, char *filename, vx_bool convert_to_gray_scale)
 Load data from BMP file into a previously created vx_image object. More...
 
vx_status tivx_utils_graph_perf_print (vx_graph graph)
 Print graph performance information to stdout via 'printf'. More...
 
vx_status tivx_utils_graph_perf_export (FILE *fp, vx_graph graph)
 Writes graph information to .md file for integration into user guide. More...
 
vx_status tivx_utils_node_perf_print (vx_node node)
 Print node performance information to stdout via 'printf'. More...
 
vx_status tivx_utils_node_mem_print (vx_graph graph)
 Print node memory usage information to stdout via 'printf'. More...
 
vx_status tivx_utils_export_ref_for_ipc_xfer (const vx_reference ref, tivx_utils_ref_ipc_msg_t *ipcMsg)
 Export the internal handle information of a valid reference as a buffer descriptor along with meta information so that the information could be transferred over Linux/QNX IPC mechanism to a remote process. Only the following reference types are supported. More...
 
vx_status tivx_utils_import_ref_from_ipc_xfer (vx_context context, tivx_utils_ref_ipc_msg_t *ipcMsg, vx_reference *ref)
 Import the external handle information of a valid reference as a buffer descriptor along with meta information exchanged via Linux/ QNX IPC mechanism. Only the following reference types are supported. More...
 
vx_bool tivx_utils_compare_refs_from_ipc_xfer (tivx_utils_ref_ipc_msg_t *ipcMsg1, tivx_utils_ref_ipc_msg_t *ipcMsg2)
 Compare the external handle information of a valid reference with another external handle. More...
 

Function Documentation

◆ tivx_utils_expand_file_path()

vx_status tivx_utils_expand_file_path ( const char *  inFilePath,
char *  outFilePath 
)

Conditionally returns the absolute path of the 'inFilePath'.

Parameters
inFilePath[in] inFilePath
outFilePath[out] This shall contain the path to the inFilePath as follows:
  • If the 'inFilePath' contains reference to environment variable then it shall be expanded and an absolute file path is returned. If the environment variable is not defined then VX_FAILURE is returned. The content of 'outFilePath' will be undefined.
  • Otherwise, the 'inFilePath' is copied to 'outFilePath' as is. ex:- 1)- ${ENV_NAME} maps to /home/someone/test_dir inFilePath = "${ENV_NAME}/colors.bmp" outFilePath = "/home/someone/test_dir/colors.bmp" return VX_SUCCESS 2)- ${ENV_NAME} not defined inFilePath = "${ENV_NAME}/colors.bmp" outFilePath = not defined return VX_FAILURE 2)- inFilePath = "/some/dir/name/colors.bmp" outFilePath = "/some/dir/name/colors.bmp" return VX_SUCCESS NOTE: The length of 'outFilePath' will be truncated to TIOVX_UTILS_MAXPATHLENGTH-1;
Returns
- VX_SUCCESS and the content of 'outFilePath' will be valid
  • VX_FAILURE and the content of 'outFilePath' will be undefined

◆ tivx_utils_simple_image_checksum()

uint32_t tivx_utils_simple_image_checksum ( vx_image  image,
uint8_t  plane_id,
vx_rectangle_t  rect 
)

Returns a uint32_t of the sum of all words within a rect of an image's buffer.

If the buffer size contains a number of bytes not divisible by 4, the last 1, 2, or 3 bytes are rightshifted so that the last byte aligns with the LSB.

Parameters
image[in] input image
plane_id[in] plane number for multi plane image format
rect[in] rectangular region to generate the checksum for
Returns
sum of words in the specified region

◆ tivx_utils_user_data_object_checksum()

uint32_t tivx_utils_user_data_object_checksum ( vx_user_data_object  user_data_object,
uint32_t  offset_byte,
uint32_t  num_bytes 
)

Returns a uint32_t of the sum of all words within a range of the user data object buffer.

If the buffer size contains a number of bytes not divisible by 4, the last 1, 2, or 3 bytes are rightshifted so that the last byte aligns with the LSB.

Parameters
user_data_object[in] input user data object
offset_byte[in] starting offset (in bytes)
num_bytes[in] number of bytes to generate the checksum for
Returns
sum of words in the specified range

◆ tivx_utils_tensor_checksum()

uint32_t tivx_utils_tensor_checksum ( vx_tensor  tensor_object,
vx_size  number_of_dimensions,
vx_size view_start,
vx_size view_end,
vx_size user_stride 
)

Returns a uint32_t of the sum of all words within a range of the tensor buffer.

If the buffer size contains a number of bytes not divisible by 4, the last 1, 2, or 3 bytes are rightshifted so that the last byte aligns with the LSB.

Parameters
tensor_object[in] input tensor object
number_of_dimensions[in] number of tensor dimensions
view_start[in] starting offset for each dimension (in elements)
view_end[in] ending offset for each dimension (in elements)
user_stride[in] stride for each dimension (in bytes)
Returns
sum of words in the specified range

◆ tivx_utils_bmp_file_read()

vx_status tivx_utils_bmp_file_read ( const char *  filename,
vx_bool  convert_to_gray_scale,
tivx_utils_bmp_image_params_t *  imageParams 
)

Read data from BMP file.

Same as tivx_utils_png_file_read() but with .bmp file

◆ tivx_utils_bmp_file_read_from_memory()

vx_status tivx_utils_bmp_file_read_from_memory ( const void *  buf,
uint32_t  buf_size,
vx_bool  convert_to_gray_scale,
tivx_utils_bmp_image_params_t *  imageParams 
)

Read data from BMP file.

Same as tivx_utils_png_file_read() but with .bmp file

◆ tivx_utils_bmp_file_read_release()

void tivx_utils_bmp_file_read_release ( void *  png_file_context)

Free memory allocated during bmp file read.

Same as tivx_utils_png_file_read_release() but with .bmp file

◆ tivx_utils_bmp_file_write()

int32_t tivx_utils_bmp_file_write ( const char *  filename,
uint32_t  width,
uint32_t  height,
uint32_t  stride,
vx_df_image  df,
void *  data_ptr 
)

Write data into BMP file.

Same as tivx_utils_png_file_write() but with .bmp file

◆ tivx_utils_create_vximage_from_bmpfile()

vx_image tivx_utils_create_vximage_from_bmpfile ( vx_context  context,
const char *  filename,
vx_bool  convert_to_gray_scale 
)

Create a image data object given BMP filename as input.

Same as tivx_utils_create_vximage_from_pngfile() but with .bmp file

◆ tivx_utils_save_vximage_to_bmpfile()

vx_status tivx_utils_save_vximage_to_bmpfile ( const char *  filename,
vx_image  image 
)

Save data from image object to BMP file.

Same as tivx_utils_save_vximage_to_pngfile() but with .bmp file

◆ tivx_utils_load_vximage_from_bmpfile()

vx_status tivx_utils_load_vximage_from_bmpfile ( vx_image  image,
char *  filename,
vx_bool  convert_to_gray_scale 
)

Load data from BMP file into a previously created vx_image object.

Same as tivx_utils_load_vximage_from_pngfile() but with .bmp file

◆ tivx_utils_graph_perf_print()

vx_status tivx_utils_graph_perf_print ( vx_graph  graph)

Print graph performance information to stdout via 'printf'.

This also prints information of all nodes present within the graph

Parameters
[in]graphgraph handle
Returns
VX_SUCCESS on success, else failure

◆ tivx_utils_graph_perf_export()

vx_status tivx_utils_graph_perf_export ( FILE *  fp,
vx_graph  graph 
)

Writes graph information to .md file for integration into user guide.

Requires the file to be opened using appPerfStatsExportOpenFile and closed using appPerfStatsExportCloseFile

Parameters
[in]fpfile handle
[in]graphgraph handle
Returns
VX_SUCCESS on success, else failure

◆ tivx_utils_node_perf_print()

vx_status tivx_utils_node_perf_print ( vx_node  node)

Print node performance information to stdout via 'printf'.

Parameters
[in]nodenode handle
Returns
VX_SUCCESS on success, else failure

◆ tivx_utils_node_mem_print()

vx_status tivx_utils_node_mem_print ( vx_graph  graph)

Print node memory usage information to stdout via 'printf'.

Parameters
[in]graphgraph handle
Returns
VX_SUCCESS on success, else failure

◆ tivx_utils_export_ref_for_ipc_xfer()

vx_status tivx_utils_export_ref_for_ipc_xfer ( const vx_reference  ref,
tivx_utils_ref_ipc_msg_t *  ipcMsg 
)

Export the internal handle information of a valid reference as a buffer descriptor along with meta information so that the information could be transferred over Linux/QNX IPC mechanism to a remote process. Only the following reference types are supported.

  • VX_TYPE_IMAGE
  • VX_TYPE_TENSOR
  • VX_TYPE_USER_DATA_OBJECT
  • VX_TYPE_ARRAY
  • VX_TYPE_DISTRIBUTION
  • VX_TYPE_MATRIX
  • VX_TYPE_CONVOLUTION
  • TIVX_TYPE_RAW_IMAGE
  • TIVX_TYPE_PYRAMID
Parameters
[in]refA valid openVX reference whose information will be exported
[out]ipcMsgExported object information
Returns
VX_SUCCESS on success, else failure

◆ tivx_utils_import_ref_from_ipc_xfer()

vx_status tivx_utils_import_ref_from_ipc_xfer ( vx_context  context,
tivx_utils_ref_ipc_msg_t *  ipcMsg,
vx_reference ref 
)

Import the external handle information of a valid reference as a buffer descriptor along with meta information exchanged via Linux/ QNX IPC mechanism. Only the following reference types are supported.

  • VX_TYPE_IMAGE
  • VX_TYPE_TENSOR
  • VX_TYPE_USER_DATA_OBJECT
  • VX_TYPE_ARRAY
  • VX_TYPE_DISTRIBUTION
  • VX_TYPE_MATRIX
  • VX_TYPE_CONVOLUTION
  • TIVX_TYPE_RAW_IMAGE
  • TIVX_TYPE_PYRAMID
Parameters
[in]contextA valid openVX context
[in,out]ipcMsgExported object information
[in,out]refA valid openVX reference to import. If *ref is NULL, then a new object will be allocated with the imported handles and returned. If *ref is not NULL then the object will be used to import the handles.
Returns
VX_SUCCESS on success, else failure

◆ tivx_utils_compare_refs_from_ipc_xfer()

vx_bool tivx_utils_compare_refs_from_ipc_xfer ( tivx_utils_ref_ipc_msg_t *  ipcMsg1,
tivx_utils_ref_ipc_msg_t *  ipcMsg2 
)

Compare the external handle information of a valid reference with another external handle.

Parameters
[in,out]ipcMsg1Exported object information of the first reference
[in,out]ipcMsg1Exported object information of the second reference
Returns
vx_true_e if ipcMsg1 points to the same buffer as ipcMsg2, vx_false_e if it does not