Operator Library: Arithmetics
The operator RND performs a right shift with rounding and clipping to the output bit width. The number of bits to round is specified with parameter bits2Round.
Round half away from zero is the implemented rounding method. Color components are rounded separately.
Examples
-
Input = 4 Bit unsigned, Input Value = 7, bits2Round = 2
Output = 2 Bit unsigned, Output Value = 2
-
Input = 5 Bit signed, Input Value = -13, bits2Round = 2
Output = 3 Bit signed, Output Value = -3
-
Input = 4 Bit unsigned, Input Value = 15, bits2Round = 2
Output = 2 Bit unsigned, Output Value = 3 Note: The output has been clipped to the maximum possible value.
bits2Round | |
---|---|
Type | static parameter |
Default | 0 |
Range |
[0, BitWidth(I)-1] for unsigned (BitWidth(I) - bits2Round > 1) for signed |
This parameter defines by how many bits the input is shifted to the right. |
The use of operator RND is shown in the following examples:
-
A binarization example for local adaptive thresholding. A kernel size of 8 by 8 pixel is used.
-
'Bayer 3x3 Demosacing with White Balancing'
Examples - The example shows the demosaicing of a Bayer RAW pattern using a 3x3 filter. Moreover, a white balancing for color correction is added.
-
'Bayer 5x5 Demosacing with White Balancing'
Examples - The example shows the demosaicing of a Bayer RAW pattern using a 5x5 filter. Moreover, a white balancing for color correction is added.