The OpenVX Specification  dba1aa3
Object: Scalar

Detailed Description

Defines the Scalar Object interface.

Typedefs

typedef struct _vx_scalar * vx_scalar
An opaque reference to a scalar. More...

Enumerations

enum  vx_scalar_attribute_e { VX_SCALAR_TYPE = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_SCALAR << 8)) + 0x0 }
The scalar attributes list. More...

enum  vx_scalar_operation_e {
VX_SCALAR_OP_AND = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0x0,
VX_SCALAR_OP_OR = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0x1,
VX_SCALAR_OP_XOR = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0x2,
VX_SCALAR_OP_NAND = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0x3,
VX_SCALAR_OP_EQUAL = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0x4,
VX_SCALAR_OP_NOTEQUAL = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0x5,
VX_SCALAR_OP_LESS = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0x6,
VX_SCALAR_OP_LESSEQ = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0x7,
VX_SCALAR_OP_GREATER = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0x8,
VX_SCALAR_OP_GREATEREQ = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0x9,
VX_SCALAR_OP_ADD = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0xA,
VX_SCALAR_OP_SUBTRACT = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0xB,
VX_SCALAR_OP_MULTIPLY = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0xC,
VX_SCALAR_OP_DIVIDE = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0xD,
VX_SCALAR_OP_MODULUS = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0xE,
VX_SCALAR_OP_MIN = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0xF,
VX_SCALAR_OP_MAX = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_SCALAR_OPERATION << 12)) + 0x10
}
A type of operation in which both operands are scalars. More...

Functions

vx_status VX_API_CALL vxCopyScalar (vx_scalar scalar, void *user_ptr, vx_enum usage, vx_enum user_mem_type)
Allows the application to copy from/into a scalar object. More...

vx_status VX_API_CALL vxCopyScalarWithSize (vx_scalar scalar, vx_size size, void *user_ptr, vx_enum usage, vx_enum user_mem_type)
Allows the application to copy from/into a scalar object with size. More...

vx_scalar VX_API_CALL vxCreateScalar (vx_context context, vx_enum data_type, const void *ptr)
Creates a reference to a scalar object. Also see Node Parameters. More...

vx_scalar VX_API_CALL vxCreateScalarWithSize (vx_context context, vx_enum data_type, const void *ptr, vx_size size)
Creates a reference to a scalar object. Also see Node Parameters. More...

vx_scalar VX_API_CALL vxCreateVirtualScalar (vx_graph graph, vx_enum data_type)
Creates an opaque reference to a scalar object with no direct user access. More...

vx_status VX_API_CALL vxQueryScalar (vx_scalar scalar, vx_enum attribute, void *ptr, vx_size size)
Queries attributes from a scalar. More...

vx_status VX_API_CALL vxReleaseScalar (vx_scalar *scalar)
Releases a reference to a scalar object. The object may not be garbage collected until its total reference count is zero. More...

Typedef Documentation

 typedef struct _vx_scalar* vx_scalar

An opaque reference to a scalar.

A scalar can be up to 64 bits wide.

vxCreateScalar

Definition at line 172 of file vx_types.h.

Enumeration Type Documentation

The scalar attributes list.

Enumerator
VX_SCALAR_TYPE

Queries the type of atomic that is contained in the scalar. Read-only. Use a vx_enum parameter.

Definition at line 971 of file vx_types.h.

A type of operation in which both operands are scalars.

Object: Scalar
Enumerator
VX_SCALAR_OP_AND

logical and.

VX_SCALAR_OP_OR

logical or.

VX_SCALAR_OP_XOR

logical exclusive or.

VX_SCALAR_OP_NAND

logical nand.

VX_SCALAR_OP_EQUAL

comparison (equal).

VX_SCALAR_OP_NOTEQUAL

comparison (not equal).

VX_SCALAR_OP_LESS

comparison (less than).

VX_SCALAR_OP_LESSEQ

comparison (less than or equal to).

VX_SCALAR_OP_GREATER

comparison (greater than).

VX_SCALAR_OP_GREATEREQ

comparison (greater than or equal to).

VX_SCALAR_OP_SUBTRACT

arithmetic subtraction.

VX_SCALAR_OP_MULTIPLY

arithmetic multiplication.

VX_SCALAR_OP_DIVIDE

arithmetic division.

VX_SCALAR_OP_MODULUS

arithmetic (modulo operator).

VX_SCALAR_OP_MIN

minimum of two scalars.

VX_SCALAR_OP_MAX

maximum of two scalars.

Definition at line 980 of file vx_types.h.

Function Documentation

 vx_scalar VX_API_CALL vxCreateScalar ( vx_context context, vx_enum data_type, const void * ptr )

Creates a reference to a scalar object. Also see Node Parameters.

Parameters
 [in] context The reference to the system context. [in] data_type The type of data to hold. Must be greater than VX_TYPE_INVALID and less than or equal to VX_TYPE_VENDOR_STRUCT_END. Or must be a vx_enum returned from vxRegisterUserStruct. [in] ptr The pointer to the initial value of the scalar.
Returns
A scalar reference vx_scalar. Any possible errors preventing a successful creation should be checked using vxGetStatus.
 vx_scalar VX_API_CALL vxCreateScalarWithSize ( vx_context context, vx_enum data_type, const void * ptr, vx_size size )

Creates a reference to a scalar object. Also see Node Parameters.

Parameters
 [in] context The reference to the system context. [in] data_type The type of data to hold. Must be greater than VX_TYPE_INVALID and less than or equal to VX_TYPE_VENDOR_STRUCT_END. Or must be a vx_enum returned from vxRegisterUserStruct. [in] ptr The pointer to the initial value of the scalar. [in] size Size of data at ptr in bytes.
Returns
A scalar reference vx_scalar. Any possible errors preventing a successful creation should be checked using vxGetStatus.
 vx_scalar VX_API_CALL vxCreateVirtualScalar ( vx_graph graph, vx_enum data_type )

Creates an opaque reference to a scalar object with no direct user access.

Parameters
 [in] graph The reference to the parent graph. [in] data_type The type of data to hold. Must be greater than VX_TYPE_INVALID and less than or equal to VX_TYPE_VENDOR_STRUCT_END. Or must be a vx_enum returned from vxRegisterUserStruct.
vxCreateScalar
Returns
A scalar reference vx_scalar. Any possible errors preventing a successful creation should be checked using vxGetStatus.
 vx_status VX_API_CALL vxReleaseScalar ( vx_scalar * scalar )

Releases a reference to a scalar object. The object may not be garbage collected until its total reference count is zero.

Parameters
 [in] scalar The pointer to the scalar to release.
Postcondition
After returning from this function the reference is zeroed.
Returns
A vx_status_e enumeration.
Return values
 VX_SUCCESS No errors; any other value indicates failure. VX_ERROR_INVALID_REFERENCE scalar is not a valid vx_scalar reference.
 vx_status VX_API_CALL vxQueryScalar ( vx_scalar scalar, vx_enum attribute, void * ptr, vx_size size )

Queries attributes from a scalar.

Parameters
 [in] scalar The scalar object. [in] attribute The enumeration to query. Use a vx_scalar_attribute_e enumeration. [out] ptr The location at which to store the resulting value. [in] size The size of the container to which ptr points.
Returns
A vx_status_e enumeration.
Return values
 VX_SUCCESS No errors; any other value indicates failure. VX_ERROR_INVALID_REFERENCE scalar is not a valid vx_scalar reference.
 vx_status VX_API_CALL vxCopyScalar ( vx_scalar scalar, void * user_ptr, vx_enum usage, vx_enum user_mem_type )

Allows the application to copy from/into a scalar object.

Parameters
 [in] scalar The reference to the scalar object that is the source or the destination of the copy. [in] user_ptr The address of the memory location where to store the requested data if the copy was requested in read mode, or from where to get the data to store into the scalar object if the copy was requested in write mode. In the user memory, the scalar is a variable of the type corresponding to VX_SCALAR_TYPE. The accessible memory must be large enough to contain this variable. [in] usage This declares the effect of the copy with regard to the scalar object using the vx_accessor_e enumeration. Only VX_READ_ONLY and VX_WRITE_ONLY are supported: VX_READ_ONLY means that data are copied from the scalar object into the user memory. VX_WRITE_ONLY means that data are copied into the scalar object from the user memory. [in] user_mem_type A vx_memory_type_e enumeration that specifies the memory type of the memory referenced by the user_addr.
Returns
A vx_status_e enumeration.
Return values
 VX_SUCCESS No errors; any other value indicates failure. VX_ERROR_INVALID_REFERENCE scalar is not a valid vx_scalar reference. VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
 vx_status VX_API_CALL vxCopyScalarWithSize ( vx_scalar scalar, vx_size size, void * user_ptr, vx_enum usage, vx_enum user_mem_type )

Allows the application to copy from/into a scalar object with size.

Parameters
 [in] scalar The reference to the scalar object that is the source or the destination of the copy. [in] size The size in bytes of the container to which user_ptr points. [in] user_ptr The address of the memory location where to store the requested data if the copy was requested in read mode, or from where to get the data to store into the scalar object if the copy was requested in write mode. In the user memory, the scalar is a variable of the type corresponding to VX_SCALAR_TYPE. The accessible memory must be large enough to contain this variable. [in] usage This declares the effect of the copy with regard to the scalar object using the vx_accessor_e enumeration. Only VX_READ_ONLY and VX_WRITE_ONLY are supported: VX_READ_ONLY means that data are copied from the scalar object into the user memory. VX_WRITE_ONLY means that data are copied into the scalar object from the user memory. [in] user_mem_type A vx_memory_type_e enumeration that specifies the memory type of the memory referenced by the user_addr.
Returns
A vx_status_e enumeration.
Return values
 VX_ERROR_INVALID_REFERENCE The scalar reference is not actually a scalar reference. VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.