The OpenVX Specification  r28647
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Convert Bit depth

Detailed Description

Converts image bit depth.

This kernel converts an image from some source bit-depth to another bit-depth as described by the table below. If the input value is unsigned the shift must be in zeros. If the input value is signed, the shift used must be an arithmetic shift. The columns in the table below are the output types and the rows are the input types. The API version on which conversion is supported is also listed. (An X denotes an invalid operation.)

I/O U8 U16 S16 U32 S32
U8 X 1.0
U16 X X
S16 1.0 X X
U32 X X
S32 X X

Down-conversions with VX_CONVERT_POLICY_WRAP follow this equation:

output(x,y) = ((uint8)(input(x,y) >> shift));

Down-conversions with VX_CONVERT_POLICY_SATURATE follow this equation:

int16 value = input(x,y) >> shift;
value = value < 0 ? 0 : value;
value = value > 255 ? 255 : value;
output(x,y) = (uint8)value;

Up-conversions ignore the policy and perform this operation:

output(x,y) = ((int16)input(x,y)) << shift;

The valid values for 'shift' are as specified below, all other values produce undefined behavior.

0 <= shift < 8;

Functions

vx_node vxConvertDepthNode (vx_graph graph, vx_image input, vx_image output, vx_enum policy, vx_scalar shift)
 [Graph] Creates a bit-depth conversion node. More...
 
vx_status vxuConvertDepth (vx_context context, vx_image input, vx_image output, vx_enum policy, vx_int32 shift)
 [Immediate] Converts the input images bit-depth into the output image. More...
 

Function Documentation

vx_node vxConvertDepthNode ( vx_graph  graph,
vx_image  input,
vx_image  output,
vx_enum  policy,
vx_scalar  shift 
)

[Graph] Creates a bit-depth conversion node.

Parameters
[in]graphThe reference to the graph.
[in]inputThe input image.
[out]outputThe output image.
[in]policyA scalar containing a VX_TYPE_ENUM of the vx_convert_policy_e enumeration.
[in]shiftA scalar containing a VX_TYPE_INT32 of the shift value.
Returns
vx_node.
Return values
0Node could not be created.
*Node handle.
vx_status vxuConvertDepth ( vx_context  context,
vx_image  input,
vx_image  output,
vx_enum  policy,
vx_int32  shift 
)

[Immediate] Converts the input images bit-depth into the output image.

Parameters
[in]contextThe reference to the overall context.
[in]inputThe input image.
[out]outputThe output image.
[in]policyA vx_convert_policy_e enumeration.
[in]shiftThe shift value.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSSuccess
*An error occurred. See vx_status_e..