
TM1100 Preliminary Data Book
Philips Semiconductors
13-8
PRELIMINARY INFORMATION
File: icp.fm5, modified 7/26/99
diagram of the input to output pixel relationship and the
output fractional X and Y subpixel offset is shown in
Output Scaling Calculation Method
The output pixel distance in H and V in the ICP is calcu-
lated to high precision (16 bit fraction) even though the
output resolution is fixed at 1/32 of the input grid. Each
output pixel’s location relative to the input pixel grid in
memory is given by:
X location of output pixel = X0 of input line + Output
pixel number / X Scale Factor
Y location of output pixel = Y0 of input window
+ Output line number / Y Scale Factor
The X and Y locations may not be integer values, de-
pending on the scale factor. The resulting X and Y pixel
locations can be separated into an integer and a fraction-
al part. The integer part of the X and Y location selects
the pixel and line number closest to the output pixel, re-
spectively. The fractional part gives the fractional dis-
tance of the output pixel to the next X and Y input pixel
values. These fractional parts are the dX and dY values
The output pixel’s value can be calculated by interpola-
tion between these two pixels, or by 5-tap filtering using
the 5 nearest pixels rather than the 2 nearest pixels. In-
terpolation or filtering uses the fractional position values,
X and Y, to select the appropriate filter coefficients. In
the ICP, these values are limited to 5 bits for a resolution
of 1/32, even though the actual position value has much
higher resolution. The ICP uses fractional values that are
centered around the center pixel with a range of -16/32
to +15/32.
To perform scaling, you must generate the X and Y loca-
tions of the output pixel relative to the input pixel grid, in-
cluding both the integer part to locate the adjacent pixels
and the fractional part to choose the filter coefficients
which generate the output value from the adjacent pixels.
This could be done by generating the output pixel X and
Y numbers and dividing each by its associated scale fac-
tor. Since dividing is expensive in hardware and time, the
ICP effectively multiplies the X and Y pixel numbers by
the inverse of the X and Y scaling factors, respectively.
The ICP does this by incrementing the X and Y input pix-
el counters by X and Y increment values that are the in-
verse of the X and Y scale factors, respectively. If you are
at output pixel Xn, you have added the inverse of the
scale factor to the X input location n times, equivalent to
multiplying n by the inverse of the scale factor.
The ICP uses a 16-bit integer and a16-bit fractional value
for the X and Y increment values. This allows a fractional
value resolution of 1/64K. This high resolution of the cal-
culated prevents an accumulation of error as you incre-
ment along the line. Since you will add the increment val-
ue 1024 times in a 1024 pixel line, any error in an
individual calculation will be multiplied by 1024.
Only the most significant 5 bits of the fractional value are
used by the filter coefficient RAMs. However, the X and
Y Counters are incremented by the high resolution X and
Y increment values. The result of this truncation is a
worst case error of approximately 1.5% in amplitude rel-
ative to arbitrary pixel output positions.
The error caused by discrete (1/32) resolution can be re-
duced to exactly zero if the output image size is adjusted
to have a repeating pattern that fits on these 1/32 bound-
aries. For zero error, this implies that the scaling factor
must be of the form of B/A, where B (the output pixel
count factor) is a sub-multiple of 32 [i.e. 1, 2, 4, 8, 16, 32],
and A (the input pixel count factor) is an integer deter-
mined by the nearest acceptable scale factor for a given
B. In the 640 to 1024 conversion case, the B/A ratio was
8/5, meeting this requirement.
The integer values, if accumulated, would be equal to the
total number of input pixels when scaling is complete.
The integer values for each pixel define the number of
pixels to read from memory and shift in to generate the
next output pixel. For example, a scaling factor of 1.0 will
result in one pixel shifted in for each output pixel gener-
ated. Upscaling will have integer increment values of
less than one. This means that the integer value will 0 for
some pixels and 1 for others. For example, upscaling by
2.0 will result in integer values of 1 half the time and 0 for
the other half, depending on the carry out from the frac-
tional increment.
Pixel Shift Bypassing for Large Down Scaling
Down scaling will have integer increment values of great-
er than one. In this case, the integer value indicates the
number of pixels to read to get filter pixels for the next
output pixels. There are two ways to read and shift in the
pixels in the down scaling case: shift all and shift bypass.
In the shift all mode (the default mode) all five pixels are
shifted for each input value read and shifted in. The shift
all mode uses the five input pixels nearest the output pix-
el, independent of scaling factor. In the shift bypass
case, only the last pixel is shifted in. For example, in a
down scaling of 10, nine pixels are read, and the 10th
pixel is shifted in to the filter. The shift bypass mode is
used for large down scaling, i.e. down scaling factors of
2.0 or greater. The shift bypass mode is selected by set-
ting the GETB bit in the parameter table. The shift by-
Figure 13-9. ICP 1/32 Output Resolution
1
2
Input Pixels
Output Pixels
dY
dX