SDAA422 June 2026 TDA4VE-Q1
The Host Kernel defines the OpenVX user kernel that is exposed to the application. Unlike the Target Kernel, which performs the actual image processing, the Host Kernel is responsible for describing the kernel interface to the OpenVX framework. This includes defining the kernel name, parameter types, validation callback, initialization callback, and supported execution targets.
The Host Kernel implementation is located in the following source file.
vision_apps/kernels/custom_threshold/host/vx_custom_threshold_host.c
The primary function in this file is tivxAddKernelCustomThreshold(), which performs the complete registration of the custom kernel. The registration process consists of four main steps:
• Create the OpenVX user kernel.
• Define the required input and output parameters.
• Register the supported execution target.
• Finalize the kernel registration.
/* Create the OpenVX user kernel and associate the callback functions */
kernel = vxAddUserKernel(context, TIVX_KERNEL_CUSTOM_THRESHOLD_NAME, kernel_id,
tivxAddKernelCustomThresholdValidate, tivxAddKernelCustomThresholdInitialize, NULL);
/* Define the input image parameter */
vxAddParameterToKernel(kernel, 0, VX_INPUT, VX_TYPE_IMAGE, VX_PARAMETER_STATE_REQUIRED);
/* Define the input threshold value */
vxAddParameterToKernel(kernel, 1, VX_INPUT, VX_TYPE_SCALAR, VX_PARAMETER_STATE_REQUIRED);
/* Define the output image parameter */
vxAddParameterToKernel(kernel, 2, VX_OUTPUT, VX_TYPE_IMAGE, VX_PARAMETER_STATE_REQUIRED);
/* Register the kernel for execution on the A72 target */
tivxAddKernelTarget(kernel, TIVX_TARGET_MPU_0);
/* Complete the kernel registration */
vxFinalizeKernel(kernel);vxAddUserKernel() creates a new OpenVX user-defined kernel and associates it with the callback functions that will be invoked by the framework. In this example, the validation callback verifies that the supplied parameters satisfy the kernel requirements, while the initialization callback configures the valid image region before graph execution.
The three calls to vxAddParameterToKernel() define the kernel interface exposed to the application. The threshold example requires one input image, one scalar threshold value, and one output image. Each parameter is assigned an index that must match the parameter order used when the node is created.
The call to tivxAddKernelTarget() specifies that this kernel executes on the A72 core (TIVX_TARGET_MPU_0). Additional targets can be registered if multiple implementations are available.
Finally, vxFinalizeKernel() completes the registration process and makes the kernel available for graph verification and execution.
During graph verification, the OpenVX framework invokes the validation callback to verify the parameter configuration before the graph is executed. The validation callback checks that the input image format and scalar type match the kernel requirements. It also configures the metadata of the output image so that the framework can allocate the correct image object before graph execution. The simplified implementation is below.
/* Query the input image format */
vxQueryImage(input, VX_IMAGE_FORMAT, &format, sizeof(format));
/* Query the scalar type */
vxQueryScalar(threshold, VX_SCALAR_TYPE, &type, sizeof(type));
/* Configure the output image metadata */
vxSetMetaFormatAttribute(meta, VX_IMAGE_WIDTH, &width, sizeof(width));
vxSetMetaFormatAttribute(meta, VX_IMAGE_HEIGHT, &height, sizeof(height));
vxSetMetaFormatAttribute(meta, VX_IMAGE_FORMAT, &format, sizeof(format));The initialization callback is executed after successful validation and before graph execution begins. For this threshold example, the callback configures the valid rectangle so that the output image has the same valid region as the input image. Since the operation performs a one-to-one pixel transformation without changing the image dimensions, no additional initialization is required.