TIOVX User Guide
|
Utility APIs available for the application running on the host.
Functions | |
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_png_file_read (char *filename, vx_bool convert_to_gray_scale, uint32_t *width, uint32_t *height, uint32_t *stride, vx_df_image *df, void **data_ptr, void **png_file_context) |
Read data from PNG file. More... | |
void | tivx_utils_png_file_read_release (void *png_file_context) |
Free memory allocated during png_file_read. More... | |
int32_t | tivx_utils_png_file_write (char *filename, uint32_t width, uint32_t height, uint32_t stride, vx_df_image df, void *data_ptr) |
Write data into PNG file. More... | |
vx_image | tivx_utils_create_vximage_from_pngfile (vx_context context, char *filename, vx_bool convert_to_gray_scale) |
Create a image data object given PNG filename as input. More... | |
vx_status | tivx_utils_save_vximage_to_pngfile (char *filename, vx_image image) |
Save data from image object to PNG file. More... | |
vx_status | tivx_utils_load_vximage_from_pngfile (vx_image image, char *filename, vx_bool convert_to_gray_scale) |
Load data from PNG file into a previously created vx_image object. 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 PNG 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... | |
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.
image | [in] input image |
plane_id | [in] plane number for multi plane image format |
rect | [in] rectangular region to generate the checksum for |
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.
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 |
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.
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) |
vx_status tivx_utils_png_file_read | ( | char * | filename, |
vx_bool | convert_to_gray_scale, | ||
uint32_t * | width, | ||
uint32_t * | height, | ||
uint32_t * | stride, | ||
vx_df_image * | df, | ||
void ** | data_ptr, | ||
void ** | png_file_context | ||
) |
Read data from PNG file.
'png_file_context' holds the PNG file context including internally allcoated memory/resource information
When data from 'data_ptr' is copied by the user application, the 'png_file_context' MUST be released via png_file_read_release() in order to free any memory/resources allocated during png_file_read()
filename | [in] PNG file name. MUST have .png or .PNG extension |
convert_to_gray_scale | [in] TRUE: convert to gray scale after reading, FALSE: keep RGB format after reading |
df | [out] Data format of PNG file, will be VX_DF_IMAGE_U8 or VX_DF_IMAGE_RGB |
width | [out] Width of image in pixels |
height | [out] Height of image in lines |
stride | [out] Horizontal stride of image in units of bytes |
data_ptr | [in/out] Data buffer into which the PNG dara is read. Allocated by this API internally when data_ptr = NULL, else memory is allocated by user |
png_file_context | [out] PNG file context for this file |
void tivx_utils_png_file_read_release | ( | void * | png_file_context | ) |
Free memory allocated during png_file_read.
MUST be called by application after its done using the pixel data returned png_file_read() The 'png_file_context' returned by the function png_file_read() must be used as input to this API.
'data_ptr' returned by png_file_read() MUST not be used after png_file_read_release() is called.
png_file_context | [in] PNG file context returned during png_file_read() |
int32_t tivx_utils_png_file_write | ( | char * | filename, |
uint32_t | width, | ||
uint32_t | height, | ||
uint32_t | stride, | ||
vx_df_image | df, | ||
void * | data_ptr | ||
) |
Write data into PNG file.
filename | [in] PNG file name. MUST have .png or .PNG extension |
width | [in] Width of image in pixels |
height | [in] Height of image in lines |
stride | [in] Stride of image in units of bytes |
df | [in] Data format of data written into PNG file, MUST be VX_DF_IMAGE_U8 or VX_DF_IMAGE_RGB |
data_ptr | [in] Data buffer from where the data is to written to PNG file |
vx_image tivx_utils_create_vximage_from_pngfile | ( | vx_context | context, |
char * | filename, | ||
vx_bool | convert_to_gray_scale | ||
) |
Create a image data object given PNG filename as input.
context | [in] OpenVX context within which the image object will get created |
filename | [in] filename, MUST have extension of .png |
convert_to_gray_scale | [in] vx_true_e: Converts RGB values in BMP file to 8b grayscale value and copies them to image object vx_false_e: Retains RGB values from BMP file and copies them to image object NOTE: convert_to_gray_scale NOT supported as of NOW |
Save data from image object to PNG file.
filename | [in] filename, MUST have extension of .png |
image | [in] Image data object. Image data format MUST be VX_DF_IMAGE_RGB or VX_DF_IMAGE_U8 |
vx_status tivx_utils_load_vximage_from_pngfile | ( | vx_image | image, |
char * | filename, | ||
vx_bool | convert_to_gray_scale | ||
) |
Load data from PNG file into a previously created vx_image object.
This function is same as create_vximage_from_pngfile(). Only difference is that the vx_image object is created outside this function.
This function queries the vx_image object to make sure its attributes match the attributes of the PNG file from which data needs to be loaded into the image object. In case of mismatch data is not loaded and error is returned.
image | [in] Previouly created image object |
filename | [in] filename, MUST have extension of .png |
convert_to_gray_scale | [in] vx_true_e: Converts RGB values in BMP file to 8b grayscale value and copies them to image object vx_false_e: Retains RGB values from BMP file and copies them to image object NOTE: convert_to_gray_scale NOT supported as of NOW |
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
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
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
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
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
Save data from image object to PNG file.
Same as tivx_utils_save_vximage_to_pngfile() but with .bmp file
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
Print graph performance information to stdout via 'printf'.
This also prints information of all nodes present within the graph
[in] | graph | graph handle |
Writes graph information to .md file for integration into user guide.
Requires the file to be opened using appPerfStatsExportOpenFile and closed using appPerfStatsExportCloseFile
[in] | fp | file handle |
[in] | graph | graph handle |