The OpenVX Specification  dba1aa3
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_TYPE = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_LUT << 8)) + 0x0,
  VX_LUT_COUNT = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_LUT << 8)) + 0x1,
  VX_LUT_SIZE = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_LUT << 8)) + 0x2,
  VX_LUT_OFFSET = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_LUT << 8)) + 0x3
}
 The Look-Up Table (LUT) attribute list. More...
 

Functions

vx_status VX_API_CALL vxCopyLUT (vx_lut lut, void *user_ptr, vx_enum usage, vx_enum user_mem_type)
 Allows the application to copy from/into a LUT object. More...
 
vx_lut VX_API_CALL vxCreateLUT (vx_context context, vx_enum data_type, vx_size count)
 Creates LUT object of a given type. The value of VX_LUT_OFFSET is equal to 0 for data_type = VX_TYPE_UINT8, and (vx_uint32)(count/2) for VX_TYPE_INT16. More...
 
vx_lut VX_API_CALL vxCreateVirtualLUT (vx_graph graph, vx_enum data_type, vx_size count)
 Creates an opaque reference to a LUT object with no direct user access. More...
 
vx_status VX_API_CALL vxMapLUT (vx_lut lut, vx_map_id *map_id, void **ptr, vx_enum usage, vx_enum mem_type, vx_bitfield flags)
 Allows the application to get direct access to LUT object. 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...
 
vx_status VX_API_CALL vxUnmapLUT (vx_lut lut, vx_map_id map_id)
 Unmap and commit potential changes to LUT object that was previously mapped. Unmapping a LUT invalidates the memory location from which the LUT data could be accessed by the application. Accessing this memory location after the unmap function completes has an undefined behavior. More...
 

Enumeration Type Documentation

The Look-Up Table (LUT) attribute list.

Enumerator
VX_LUT_TYPE 

Indicates the value type of the LUT. Read-only. Use a vx_enum.

VX_LUT_COUNT 

Indicates the number of elements in the LUT. Read-only. Use a vx_size.

VX_LUT_SIZE 

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

VX_LUT_OFFSET 

Indicates the index of the input value = 0. Read-only. Uses a vx_uint32.

Definition at line 1020 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. The value of VX_LUT_OFFSET is equal to 0 for data_type = VX_TYPE_UINT8, and (vx_uint32)(count/2) for VX_TYPE_INT16.

Parameters
[in]contextThe reference to the context.
[in]data_typeThe type of data stored in the LUT.
[in]countThe number of entries desired.
Note
data_type can only be VX_TYPE_UINT8 or VX_TYPE_INT16. If data_type is VX_TYPE_UINT8, count should be not greater than 256. If data_type is VX_TYPE_INT16, count should not be greater than 65536.
Returns
An LUT reference vx_lut. Any possible errors preventing a successful creation should be checked using vxGetStatus.
vx_lut VX_API_CALL vxCreateVirtualLUT ( vx_graph  graph,
vx_enum  data_type,
vx_size  count 
)

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

Parameters
[in]graphThe reference to the parent graph.
[in]data_typeThe type of data stored in the LUT.
[in]countThe number of entries desired.
See also
vxCreateLUT
Note
data_type can only be VX_TYPE_UINT8 or VX_TYPE_INT16. If data_type is VX_TYPE_UINT8, count should be not greater than 256. If data_type is VX_TYPE_INT16, count should not be greater than 65536.
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; any other value indicates failure.
VX_ERROR_INVALID_REFERENCElut is not a valid vx_lut reference.
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.
Return values
VX_SUCCESSNo errors; any other value indicates failure.
VX_ERROR_INVALID_REFERENCElut is not a valid vx_lut reference.
vx_status VX_API_CALL vxCopyLUT ( vx_lut  lut,
void *  user_ptr,
vx_enum  usage,
vx_enum  user_mem_type 
)

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

Parameters
[in]lutThe reference to the LUT object that is the source or the destination of the copy.
[in]user_ptrThe 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 LUT object if the copy was requested in write mode. In the user memory, the LUT is represented as a array with elements of the type corresponding to VX_LUT_TYPE, and with a number of elements equal to the value returned via VX_LUT_COUNT. The accessible memory must be large enough to contain this array: accessible memory in bytes >= sizeof(data_element) * count.
[in]usageThis declares the effect of the copy with regard to the LUT 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 LUT object into the user memory.
  • VX_WRITE_ONLY means that data are copied into the LUT object from the user memory.
[in]user_mem_typeA 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_SUCCESSNo errors; any other value indicates failure.
VX_ERROR_INVALID_REFERENCElut is not a valid vx_lut reference.
VX_ERROR_INVALID_PARAMETERSAn other parameter is incorrect.
vx_status VX_API_CALL vxMapLUT ( vx_lut  lut,
vx_map_id map_id,
void **  ptr,
vx_enum  usage,
vx_enum  mem_type,
vx_bitfield  flags 
)

Allows the application to get direct access to LUT object.

Parameters
[in]lutThe reference to the LUT object to map.
[out]map_idThe address of a vx_map_id variable where the function returns a map identifier.
  • (*map_id) must eventually be provided as the map_id parameter of a call to vxUnmapLUT.
[out]ptrThe address of a pointer that the function sets to the address where the requested data can be accessed. In the mapped memory area, the LUT data are structured as an array with elements of the type corresponding to VX_LUT_TYPE, with a number of elements equal to the value returned via VX_LUT_COUNT. Accessing the memory out of the bound of this array is forbidden and has an undefined behavior. The returned (*ptr) address is only valid between the call to the function and the corresponding call to vxUnmapLUT.
[in]usageThis declares the access mode for the LUT, using the vx_accessor_e enumeration.
  • VX_READ_ONLY: after the function call, the content of the memory location pointed by (*ptr) contains the LUT data. Writing into this memory location is forbidden and its behavior is undefined.
  • VX_READ_AND_WRITE: after the function call, the content of the memory location pointed by (*ptr) contains the LUT data; writing into this memory is allowed only for the location of entries and will result in a modification of the affected entries in the LUT object once the LUT is unmapped.
  • VX_WRITE_ONLY: after the function call, the memory location pointed by(*ptr) contains undefined data; writing each entry of LUT is required prior to unmapping. Entries not written by the application before unmap will become undefined after unmap, even if they were well defined before map.
[in]mem_typeA vx_memory_type_e enumeration that specifies the type of the memory where the LUT is requested to be mapped.
[in]flagsAn integer that allows passing options to the map operation. Use 0 for this option.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSNo errors; any other value indicates failure.
VX_ERROR_INVALID_REFERENCElut is not a valid vx_lut reference.
VX_ERROR_INVALID_PARAMETERSAn other parameter is incorrect.
Postcondition
vxUnmapLUT with same (*map_id) value.
vx_status VX_API_CALL vxUnmapLUT ( vx_lut  lut,
vx_map_id  map_id 
)

Unmap and commit potential changes to LUT object that was previously mapped. Unmapping a LUT invalidates the memory location from which the LUT data could be accessed by the application. Accessing this memory location after the unmap function completes has an undefined behavior.

Parameters
[in]lutThe reference to the LUT object to unmap.
[out]map_idThe unique map identifier that was returned when calling vxMapLUT .
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSNo errors; any other value indicates failure.
VX_ERROR_INVALID_REFERENCElut is not a valid vx_lut reference.
VX_ERROR_INVALID_PARAMETERSAn other parameter is incorrect.
Precondition
vxMapLUT returning the same map_id value