The
process begins by comparing the values of INSEG
and OUTSEG to determine which is smaller. If OUTSEG
is smaller, there is sufficient current input
pixel available to complete an output pixel. If
INSEG is smaller, there is not sufficient current
input pixel left to complete the output pixel;
the current input pixel will be used up, and a
new input pixel must be fetched. There are only
these tow conditions: Either the current input
pixel will be use up without completing an output
pixel, or an output pixel will be completed without
using up the current input pixel. Equality of
INSEG and OUTSEG can be assigned to either condition.
If
OUTSEG is smaller than INSEG, an output pixel
will be completed. The current input pixel value
is multiplied by OUTSEG and added to the accumulator.
INSEG is decremented by the value of OUTSEG to
indicate that the OUTSEG portion of the input
pixel has been used; then OUTSEG is reinitialized
to INSFAC for the next output pixel. The contents
of the accumulator are scaled by SIZFAC, yielding
the value of the current output pixel. The accumulator
is zeroed, and the process returns to compare
the new values of INSEG and OUTSEG.
lf
INSEG is smaller than OUTSEG, an input pixel be
used up. The current input pixel value is multiplied
by INSEG and added to the accumulator. OUTSEG
is decremented by the value of INSEG to indicate
that the INSEG portion of the output pixel has
been satisfied; then INSEG is reinitialized to
1.0, and the next input pixel is fetched. The
process then returns to compare the new values
of INSEG and OUTSEG.
If
INSEG and OUTSEG are equal, the input pixel will
be used up and an output pixel will be completed,
but only one event at a time can occur. In this
case either event can be chosen to occur first,
and the other will occur next. If the choice is
to complete the output pixel, the pixel intensity
is scaled by OUTSEG and added to the accumulator.
OUTSEG is subtracted from INSEG, which goes to
zero, and OUTSEG is reinitialized to INSFAC. At
the next cycle of comparison OUTSEG is a nonzero
value and INSEG is zero. INSEG is smaller than
OUTSEG, so this cycle uses up the current input
pixel. Because INSEG is zero, the current pixel
value is multiplied by zero and added to the accumulator.
Then zero is subtracted from OUTSEG, effectively
performing a null computation or zero cycle. The
next input pixel is fetched, and INSEG is reinitialized
to 1.0. No matter which condition is chosen for
equality, the interpolation algorithm proceeds
correctly.
Figure
2. Example of Interpolation.
Figure
2 is an example of the interpolation algorithm.
A size factor of 0.75 will shrink the input line
by 3/4. The inverse size factor 1.33 indicates
that each output pixel should be composed of 1.33
input pixels. The top row represents the values
of input pixels; the bottom row represents the
calculated values of output pixels. The lines
between the rows indicate the spatial mapping
from input to output. Initial values are:
SIZFAC = 0.75
NSFAC = 1.33
INSEG = 1.0
OUTSEG = 1.33
Accumulator = O
