SDAA422 June   2026 TDA4VE-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2Understanding OpenVX Kernel Architecture
    1. 2.1 OpenVX Node Execution Flow
    2. 2.2 Host and Target Kernels
    3. 2.3 A72 Target Execution Model
  6. 3Creating a Custom Kernel Package
    1. 3.1 Package Structure
    2. 3.2 Defining the Kernel Interface
  7. 4Developing a Custom OpenVX Node for the A72 Core: A Threshold Example
    1. 4.1 Implementing the Host Kernel
    2. 4.2 Implementing the A72 Target Kernel
    3. 4.3 Accessing Image Buffers on the A72 Core
    4. 4.4 Implementing the Threshold Algorithm
    5. 4.5 Registering the Kernel Package
  8. 5Integrating the Custom Node into vision_apps
    1. 5.1 Implementing the app_custom_threshold Example
    2. 5.2 Example Execution Log
  9. 6Summary
  10. 7References

Defining the Kernel Interface

The public interface of the custom threshold package is divided into three header files under include/TI.

1) Aggregate Package Header

The tivx_custom_threshold.h header provides a single include point for applications using the package.

#include <TI/tivx.h>
#include <TI/tivx_custom_threshold_kernels.h>
#include <TI/tivx_custom_threshold_nodes.h>

Applications can include this header to access both the kernel package management APIs and the public node creation API.

2) Kernel Definitions and Package APIs

The tivx_custom_threshold_kernels.h header defines the module name and the unique kernel name used by both the Host and Target Kernel implementations.

#define TIVX_MODULE_NAME_CUSTOM_THRESHOLD "custom_threshold"
#define TIVX_KERNEL_CUSTOM_THRESHOLD_NAME "com.ti.custom.threshold"

The module name identifies the kernel package during module registration and loading. The kernel name identifies the custom threshold kernel when the Host Kernel, Target Kernel, and application create or locate the corresponding OpenVX node.

The numerical user kernel ID is not fixed in the public header. Instead, it is allocated at runtime by the Host Kernel using vxAllocateUserKernelId(). This avoids assigning a hard-coded kernel enumeration value and allows the OpenVX context to provide an available user kernel ID.

The same header also defines the parameter indices shared by the Host Kernel, Target Kernel, and node creation API.

enum{
    TIVX_KERNEL_CUSTOM_THRESHOLD_INPUT_IDX = 0,
    TIVX_KERNEL_CUSTOM_THRESHOLD_THRESHOLD_IDX,
    TIVX_KERNEL_CUSTOM_THRESHOLD_OUTPUT_IDX,
    TIVX_KERNEL_CUSTOM_THRESHOLD_MAX_PARAMS
};

Table 3-2 Custom Threshold Node Parameters
IndexParameterDirectionOpenVX typeDescription
TIVX_KERNEL_CUSTOM_THRESHOLD_INPUT_IDXInput image

Input

VX_TYPE_IMAGEU8 grayscale source image

TIVX_KERNEL_CUSTOM_THRESHOLD_THRESHOLD_IDX

Threshold value

Input

VX_TYPE_SCALAR

U8 scalar used for pixel comparison

TIVX_KERNEL_CUSTOM_THRESHOLD_OUTPUT_IDX

Output image

Output

VX_TYPE_IMAGE

U8 binary output image

TIVX_KERNEL_CUSTOM_THRESHOLD_MAX_PARAMS

Parameter count

-

-

Total number of node parameters

The kernel package header also declares the APIs used to load and unload the custom kernels.

void tivxCustomThresholdLoadKernels(vx_context context);
void tivxCustomThresholdUnLoadKernels(vx_context context);

These functions coordinate the Host Kernel module and A72 Target Kernel registration. The application calls the load function after creating the OpenVX context and calls the unload function before releasing the context.

The A72 Target Kernel registration functions are also declared in the public interface.

void tivxRegisterCustomThresholdTargetA72Kernels(void);
void tivxUnRegisterCustomThresholdTargetA72Kernels(void);

These functions register and unregister the Target Kernel implementation associated with TIVX_TARGET_MPU_0.

3) Public Node Creation API

The tivx_custom_threshold_nodes.h header declares the helper function used by an application to instantiate the custom threshold node.

VX_API_ENTRY vx_node VX_API_CALL
tivxCustomThresholdNode(
    vx_graph graph,
    vx_image input,
    vx_scalar threshold,
    vx_image output);

This function accepts the OpenVX graph and the three node parameters and returns a vx_node object. Internally, the implementation creates the node using the kernel name TIVX_KERNEL_CUSTOM_THRESHOLD_NAME and associates the input image, threshold scalar, and output image with their corresponding parameter indices.