The OpenVX Specification  dba1aa3
Control Flow

Detailed Description

Defines the predicated execution model of OpenVX.

These features allow for conditional graph flow in OpenVX, via support for a variety of operations between two scalars. The supported scalar data types VX_TYPE_BOOL, VX_TYPE_INT8, VX_TYPE_UINT8, VX_TYPE_INT16, VX_TYPE_UINT16, VX_TYPE_INT32, VX_TYPE_UINT32, VX_TYPE_SIZE, VX_TYPE_FLOAT32 are supported.
Summary of logical operations:

Scalar Operation Equation Data Types
VX_SCALAR_OP_AND output = (a&b) bool = bool op bool
VX_SCALAR_OP_OR output = (a|b) bool = bool op bool
VX_SCALAR_OP_XOR output = (a^b) bool = bool op bool
VX_SCALAR_OP_NAND output = !(a&b) bool = bool op bool

Summary of comparison operations:

Scalar Operation Equation Data Types
VX_SCALAR_OP_EQUAL output = (a == b) bool = num op num
VX_SCALAR_OP_NOTEQUAL output = (a != b) bool = num op num
VX_SCALAR_OP_LESS output = (a < b) bool = num op num
VX_SCALAR_OP_LESSEQ output = (a <= b) bool = num op num
VX_SCALAR_OP_GREATER output = (a > b) bool = num op num
VX_SCALAR_OP_GREATEREQ output = (a >= b) bool = num op num

Summary of arithmetic operations:

Scalar Operation Equation Data Types
VX_SCALAR_OP_ADD output = (a+b) num = num op num
VX_SCALAR_OP_SUBTRACT output = (a-b) num = num op num
VX_SCALAR_OP_MULTIPLY output = (a*b) num = num op num
VX_SCALAR_OP_DIVIDE output = (a/b) num = num op num
VX_SCALAR_OP_MODULUS output = (ab) num = num op num
VX_SCALAR_OP_MIN output = min(a,b) num = num op num
VX_SCALAR_OP_MAX output = max(a,b) num = num op num

Please note that in the above tables:

Functions

vx_node VX_API_CALL vxScalarOperationNode (vx_graph graph, vx_enum scalar_operation, vx_scalar a, vx_scalar b, vx_scalar output)
 [Graph] Creates a scalar operation node. More...
 
vx_node VX_API_CALL vxSelectNode (vx_graph graph, vx_scalar condition, vx_reference true_value, vx_reference false_value, vx_reference output)
 [Graph] Selects one of two data objects depending on the the value of a condition (boolean scalar), and copies its data into another data object. More...
 

Function Documentation

vx_node VX_API_CALL vxScalarOperationNode ( vx_graph  graph,
vx_enum  scalar_operation,
vx_scalar  a,
vx_scalar  b,
vx_scalar  output 
)

[Graph] Creates a scalar operation node.

Parameters
[in]graphThe reference to the graph.
[in]scalar_operationA VX_TYPE_ENUM of the vx_scalar_operation_e enumeration.
[in]aFirst scalar operand.
[in]bSecond scalar operand.
[out]outputResult of the scalar operation.
Returns
vx_node.
Return values
vx_nodeA node reference. Any possible errors preventing a successful creation should be checked using vxGetStatus
vx_node VX_API_CALL vxSelectNode ( vx_graph  graph,
vx_scalar  condition,
vx_reference  true_value,
vx_reference  false_value,
vx_reference  output 
)

[Graph] Selects one of two data objects depending on the the value of a condition (boolean scalar), and copies its data into another data object.

This node supports predicated execution flow within a graph. All the data objects passed to this kernel shall have the same object type and meta data. It is important to note that an implementation may optimize away the select and copy when virtual data objects are used.
If there is a kernel node that contribute only into virtual data objects during the graph execution due to certain data path being eliminated by not taken argument of select node, then the OpenVX implementation guarantees that there will not be any side effects to graph execution and node state.
If the path to a select node contains non-virtual objects, user nodes, or nodes with completion callbacks, then that path may not be "optimized out" because the callback must be executed and the non-virtual objects must be modified.

Parameters
[in]graphThe reference to the graph.
[in]conditionVX_TYPE_BOOL predicate variable.
[in]true_valueData object for true.
[in]false_valueData object for false.
[out]outputOutput data object.
Returns
vx_node.
Return values
vx_nodeA node reference. Any possible errors preventing a successful creation should be checked using vxGetStatus