Result of output data type conversion, Result of output data type conversion -3 – Altera Video and Image Processing Suite User Manual
Page 143

If the channels are in sequence,
din_0
is first, then
din_1
, and
din_2
. If the channels are in parallel,
din_0
occupies the least significant bits of the word,
din_1
the middle bits, and
din_2
the most significant bits.
For example, if there are 8 bits per sample and one of the predefined conversions inputs B’G’R’,
din_0
carries B’ in bits 0–7,
din_1
carries G’ in bits 8–15, and
din_2
carries R’ in bits 16–23.
Note: Predefined conversions only support unsigned input and output data. If you select signed input or
output data, the predefined conversion produces incorrect results. When using a predefined
conversion, the precision of the constants must still be defined. Predefined conversions are based
on the input bits per pixel per color plane. If using different input and output bits per pixel per
color plane, you must scale the results by the correct number of binary places to compensate.
Result of Output Data Type Conversion
After the calculation, the fixed point type of the results must be converted to the integer data type of the
output.
This conversion is performed in four stages, in the following order:
1. Result scaling—You can choose to scale up the results, increasing their range. This is useful to quickly
increase the color depth of the output.
• The available options are a shift of the binary point right –16 to +16 places.
• This is implemented as a simple shift operation so it does not require multipliers.
2. Removal of fractional bits—If any fractional bits exist, you can choose to remove them:
• Truncate to integer—Fractional bits are removed from the data. This is equivalent to rounding
towards negative infinity.
• Round-half up—Round up to the nearest integer. If the fractional bits equal 0.5, rounding is
towards positive infinity.
• Round-half even. Round to the nearest integer. If the fractional bits equal 0.5, rounding is towards
the nearest even integer.
3. Conversion from signed to unsigned—If any negative numbers can exist in the results and the output
type is unsigned, you can choose how they are converted:
• Saturate to the minimum output value (constraining to range).
• Replace negative numbers with their absolute positive value.
4. Constrain to range—logic that saturates the results to the minimum and maximum output values is
automatically added:
• if any of the results are beyond the range specified by the output data type (output guard bands)
• if the unspecified the minimum and maximum values allowed by the output bits per pixel
UG-VIPSUITE
2015.05.04
Result of Output Data Type Conversion
10-3
Color Space Conversion IP Cores
Altera Corporation