The OpenVX Specification  r31169
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Object: LUT

Detailed Description

Defines the Look-Up Table Interface.

A lookup table is an array that simplifies run-time computation by replacing computation with a simpler array indexing operation.

Typedefs

typedef struct _vx_lut * vx_lut
 The Look-Up Table (LUT) Object.
 

Enumerations

enum  vx_lut_attribute_e {
  VX_LUT_ATTRIBUTE_TYPE = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_LUT << 8)) + 0x0,
  VX_LUT_ATTRIBUTE_COUNT = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_LUT << 8)) + 0x1,
  VX_LUT_ATTRIBUTE_SIZE = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_LUT << 8)) + 0x2
}
 The Look-Up Table (LUT) attribute list. More...
 

Functions

vx_status VX_API_CALL vxAccessLUT (vx_lut lut, void **ptr, vx_enum usage)
 Grants access to a LUT table and increments the object reference count in case of success. More...
 
vx_status VX_API_CALL vxCommitLUT (vx_lut lut, const void *ptr)
 Commits the Lookup Table and decrements the object reference count in case of success. More...
 
vx_lut VX_API_CALL vxCreateLUT (vx_context context, vx_enum data_type, vx_size count)
 Creates LUT object of a given type. More...
 
vx_status VX_API_CALL vxQueryLUT (vx_lut lut, vx_enum attribute, void *ptr, vx_size size)
 Queries attributes from a LUT. More...
 
vx_status VX_API_CALL vxReleaseLUT (vx_lut *lut)
 Releases a reference to a LUT object. The object may not be garbage collected until its total reference count is zero. More...
 

Enumeration Type Documentation

The Look-Up Table (LUT) attribute list.

Enumerator
VX_LUT_ATTRIBUTE_TYPE 

Indicates the value type of the LUT. Use a vx_enum.

VX_LUT_ATTRIBUTE_COUNT 

Indicates the number of elements in the LUT. Use a vx_size.

VX_LUT_ATTRIBUTE_SIZE 

Indicates the total size of the LUT in bytes. Uses a vx_size.

Definition at line 842 of file vx_types.h.

Function Documentation

vx_lut VX_API_CALL vxCreateLUT ( vx_context  context,
vx_enum  data_type,
vx_size  count 
)

Creates LUT object of a given type.

Parameters
[in]contextThe reference to the context.
[in]data_typeThe type of data stored in the LUT.
[in]countThe number of entries desired.
Note
For OpenVX 1.0, count must be equal to 256 and data_type can only be VX_TYPE_UINT8.
Returns
An LUT reference vx_lut. Any possible errors preventing a successful creation should be checked using vxGetStatus.
vx_status VX_API_CALL vxReleaseLUT ( vx_lut lut)

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

Parameters
[in]lutThe pointer to the LUT to release.
Postcondition
After returning from this function the reference is zeroed.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSNo errors.
VX_ERROR_INVALID_REFERENCEIf lut is not a vx_lut.
vx_status VX_API_CALL vxQueryLUT ( vx_lut  lut,
vx_enum  attribute,
void *  ptr,
vx_size  size 
)

Queries attributes from a LUT.

Parameters
[in]lutThe LUT to query.
[in]attributeThe attribute to query. Use a vx_lut_attribute_e enumeration.
[out]ptrThe location at which to store the resulting value.
[in]sizeThe size in bytes of the container to which ptr points.
Returns
A vx_status_e enumeration.
vx_status VX_API_CALL vxAccessLUT ( vx_lut  lut,
void **  ptr,
vx_enum  usage 
)

Grants access to a LUT table and increments the object reference count in case of success.

There are several variations of call methodology:

  • If ptr is NULL (which means the current data of the LUT is not desired), the LUT reference count is incremented.
  • If ptr is not NULL but (*ptr) is NULL, (*ptr) will contain the address of the LUT data when the function returns and the reference count will be incremented. Whether the (*ptr) address is mapped or allocated is undefined. (*ptr) must be returned to vxCommitLUT.
  • If ptr is not NULL and (*ptr) is not NULL, the user is signalling the implementation to copy the LUT data into the location specified by (*ptr). Users must use vxQueryLUT with VX_LUT_ATTRIBUTE_SIZE to determine how much memory to allocate for the LUT data.

In any case, vxCommitLUT must be called after LUT access is complete.

Parameters
[in]lutThe LUT from which to get the data.
[in,out]ptrptr The user-supplied address to a pointer, via which the requested contents are returned.
  • If ptr is NULL, an error occurs.
  • If ptr is not NULL and (*ptr) is NULL, (*ptr) will be set to the address of a memory area managed by the OpenVX framework containing the requested data.
  • If both ptr and (*ptr) are not NULL, requested data will be copied to (*ptr) (optionally in case of write-only access).
[in]usageThis declares the intended usage of the pointer using the * vx_accessor_e enumeration.
Returns
A vx_status_e enumeration.
Postcondition
vxCommitLUT
vx_status VX_API_CALL vxCommitLUT ( vx_lut  lut,
const void *  ptr 
)

Commits the Lookup Table and decrements the object reference count in case of success.

Commits the data back to the LUT object and decrements the reference count. There are several variations of call methodology:

  • If a user should allocated their own memory for the LUT data copy, the user is obligated to free this memory.
  • If ptr is not NULL and the (*ptr) for vxAccessLUT was NULL, it is undefined whether the implementation will unmap or copy and free the memory.
    Parameters
    [in]lutThe LUT to modify.
    [in]ptrThe pointer provided or returned by vxAccessLUT. This cannot be NULL.
    Returns
    A vx_status_e enumeration.
    Precondition
    vxAccessLUT.