The OpenVX Specification  a73e458
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 [R00040]. If the input value is unsigned the shift must be in zeros [R00041]. If the input value is signed, the shift used must be an arithmetic shift [R00042]. 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

Conversion Type

The table below identifies the conversion types for the allowed bith depth conversions.

FromTo Conversion Type
U8 S16 Up-conversion
S16 U8 Down-conversion

Convert Policy

Down-conversions with VX_CONVERT_POLICY_WRAP follow this equation [R00043]:

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

Down-conversions with VX_CONVERT_POLICY_SATURATE follow this equation [R00044]:

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 [R00045]:

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

The valid values for 'shift' are as specified below [R00046], all other values produce implementation-dependant behavior.

0 <= shift < 8;


vx_node VX_API_CALL vxConvertDepthNode (vx_graph graph, vx_image input, vx_image output, vx_enum policy, vx_scalar shift)
 [Graph] Creates a bit-depth conversion node. More...

Function Documentation

◆ vxConvertDepthNode()

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

[Graph] Creates a bit-depth conversion node.

[in]graphThe reference to the graph [R00332].
[in]inputThe input image [R00333].
[out]outputThe output image [R00334].
[in]policyUse a The Conversion Policy Enumeration. value [R00335].
[in]shiftA scalar containing a VX_TYPE_INT32 of the shift value [R00336].
vx_node [R00337].
Return values
vx_nodeA node reference. Any possible errors preventing a successful creation should be checked using vxGetStatus