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:
Summary of comparison operations:
Summary of arithmetic operations:
Please note that in the above tables:
- bool denotes a scalar of data type
VX_TYPE_BOOL
- num denotes supported scalar data types are
VX_TYPE_INT8
, VX_TYPE_UINT8
, VX_TYPE_INT16
, VX_TYPE_UINT16
, VX_TYPE_INT32
, VX_TYPE_UINT32
, VX_TYPE_SIZE
, and VX_TYPE_FLOAT32
.
- The
VX_SCALAR_OP_MODULUS
operation supports integer operands.
- The results of
VX_SCALAR_OP_DIVIDE
and VX_SCALAR_OP_MODULUS
operations with the second argument as zero, must be defined by the implementation.
- For arithmetic and comparison operations with mixed input data types, the results will be mathematically accurate without the side effects of internal data representations.
- If the operation result can not be stored in output data type without data and/or precision loss, the following rules shall be applied:
- If the operation result is integer and output is floating-point, the operation result is promoted to floating-point.
- If the operation result is floating-point and output is an integer, the operation result is converted to integer with rounding policy
VX_ROUND_POLICY_TO_ZERO
and conversion policy VX_CONVERT_POLICY_SATURATE
.
- If both operation result and output are integers, the result is converted to output data type with
VX_CONVERT_POLICY_WRAP
conversion policy.
[Graph] Creates a scalar operation node.
- Parameters
-
[in] | graph | The reference to the graph. |
[in] | scalar_operation | A VX_TYPE_ENUM of the vx_scalar_operation_e enumeration. |
[in] | a | First scalar operand. |
[in] | b | Second scalar operand. |
[out] | output | Result of the scalar operation. |
- Returns
vx_node
.
- Return values
-
vx_node | A node reference. Any possible errors preventing a successful creation should be checked using vxGetStatus |
[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] | graph | The reference to the graph. |
[in] | condition | VX_TYPE_BOOL predicate variable. |
[in] | true_value | Data object for true. |
[in] | false_value | Data object for false. |
[out] | output | Output data object. |
- Returns
vx_node
.
- Return values
-
vx_node | A node reference. Any possible errors preventing a successful creation should be checked using vxGetStatus |