The OpenVX Specification  r28647
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Pixel-wise Multiplication

Detailed Description

Performs element-wise multiplication between two images and a scalar value.

Pixel-wise multiplication is performed between the pixel values in two VX_DF_IMAGE_U8 or VX_DF_IMAGE_S16 images and a scalar floating-point number scale. The output image can be VX_DF_IMAGE_U8 only if both source images are VX_DF_IMAGE_U8 and the output image is explicitly set to VX_DF_IMAGE_U8. It is otherwise VX_DF_IMAGE_S16. If one of the input images is of type VX_DF_IMAGE_S16, all values are converted to VX_DF_IMAGE_S16.

The scale with a value of \( {1}/{2^n} \), where n is an integer and \( 0 \le n \le 15 \), and 1/255 (0x1.010102p-8 C99 float hex) must be supported. The support for other values of scale is not prohibited. Furthermore, for scale with a value of 1/255 the rounding policy of VX_ROUND_POLICY_TO_NEAREST_EVEN must be supported whereas for the scale with value of \( {1}/{2^n} \) the rounding policy of VX_ROUND_POLICY_TO_ZERO must be supported. The support of other rounding modes for any values of scale is not prohibited.

The rounding policy VX_ROUND_POLICY_TO_ZERO for this function is defined as:

\[ reference(x,y,scale) = truncate(((int32_t)in1(x,y)) * ((int32_t)in2(x,y)) * (double)scale) \]

The rounding policy VX_ROUND_POLICY_TO_NEAREST_EVEN for this function is defined as:

\[ reference(x,y,scale) = round_to_nearest_even(((int32_t)in1(x,y)) * ((int32_t)in2(x,y)) * (double)scale) \]

The overflow handling is controlled by an overflow-policy parameter. For each pixel value in the two input images:

\[ out(x,y) = in_1(x,y) in_2(x,y) scale \]

Functions

vx_node vxMultiplyNode (vx_graph graph, vx_image in1, vx_image in2, vx_scalar scale, vx_enum overflow_policy, vx_enum rounding_policy, vx_image out)
 [Graph] Creates an pixelwise-multiplication node. More...
 
vx_status vxuMultiply (vx_context context, vx_image in1, vx_image in2, vx_float32 scale, vx_enum overflow_policy, vx_enum rounding_policy, vx_image out)
 [Immediate] Performs elementwise multiplications on pixel values in the input images and a scale. More...
 

Function Documentation

vx_node vxMultiplyNode ( vx_graph  graph,
vx_image  in1,
vx_image  in2,
vx_scalar  scale,
vx_enum  overflow_policy,
vx_enum  rounding_policy,
vx_image  out 
)

[Graph] Creates an pixelwise-multiplication node.

Parameters
[in]graphThe reference to the graph.
[in]in1An input image, VX_DF_IMAGE_U8 or VX_DF_IMAGE_S16.
[in]in2An input image, VX_DF_IMAGE_U8 or VX_DF_IMAGE_S16.
[in]scaleA non-negative VX_TYPE_FLOAT32 multiplied to each product before overflow handling.
[in]overflow_policyA VX_TYPE_ENUM of the vx_convert_policy_e enumeration.
[in]rounding_policyA VX_TYPE_ENUM of the vx_round_policy_e enumeration.
[out]outThe output image, a VX_DF_IMAGE_U8 or VX_DF_IMAGE_S16 image.
Returns
vx_node.
Return values
0Node could not be created.
*Node handle.
vx_status vxuMultiply ( vx_context  context,
vx_image  in1,
vx_image  in2,
vx_float32  scale,
vx_enum  overflow_policy,
vx_enum  rounding_policy,
vx_image  out 
)

[Immediate] Performs elementwise multiplications on pixel values in the input images and a scale.

Parameters
[in]contextThe reference to the overall context.
[in]in1A VX_DF_IMAGE_U8 or VX_DF_IMAGE_S16 input image.
[in]in2A VX_DF_IMAGE_U8 or VX_DF_IMAGE_S16 input image.
[in]scaleThe scale value.
[in]overflow_policyA vx_convert_policy_e enumeration.
[in]rounding_policyA vx_round_policy_e enumeration.
[out]outThe output image in VX_DF_IMAGE_U8 or VX_DF_IMAGE_S16 format.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSSuccess
*An error occurred. See vx_status_e.