The OpenVX Specification  r28647
 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 vxAccessLUT (vx_lut lut, void **ptr, vx_enum usage)
 Gets direct access to the LUT table data. More...
 
vx_status vxCommitLUT (vx_lut lut, void *ptr)
 Commits the Lookup Table. More...
 
vx_lut vxCreateLUT (vx_context context, vx_enum data_type, vx_size count)
 Creates LUT object of a given type. More...
 
vx_status vxQueryLUT (vx_lut lut, vx_enum attribute, void *ptr, vx_size size)
 Queries attributes from a LUT. More...
 
vx_status 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 808 of file vx_types.h.

Function Documentation

vx_lut 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
vx_lut
vx_status 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 graph is not a vx_graph.
vx_status 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 of the container to which ptr points.
Returns
A vx_status_e enumeration.
vx_status vxAccessLUT ( vx_lut  lut,
void **  ptr,
vx_enum  usage 
)

Gets direct access to the LUT table data.

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]ptrThe address of the location to store the pointer to the LUT memory.
[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 vxCommitLUT ( vx_lut  lut,
void *  ptr 
)

Commits the Lookup Table.

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 used with vxAccessLUT. This cannot be NULL.
    Returns
    A vx_status_e enumeration.
    Precondition
    vxAccessLUT.