
Philips Semiconductors
Image Co-Processor
File: icp.fm5, modified 7/26/99
PRELIMINARY INFORMATION
13-13
than 1/3, you will spend more time reading and writing
SDRAM than filtering.
13.5.8
Implementation Overview: Vertical
Scaling and Filtering
vertical scaling algorithm implementation. Blocks of pix-
els are loaded sequentially into five input block buffers,
one for each of the 5 terms of the 5-tap filter. Each block
of pixels is transferred sequentially to the 5-tap filter. The
filter does scaling and filtering of the data and puts the re-
sulting pixels in the output buffer. Completed pixels in the
output buffer are written back to SDRAM.
In the vertical scaling case, five separate blocks of pixels,
one for each line, are required because the pixels are
stored in horizontal sequence in the SDRAM. The Y
Counter steps through the 64 horizontal pixels of the five
input blocks and writes the resulting pixels into the output
block. Four of the five blocks are used on the next pass,
so that one block of pixels in generates one block of pix-
els out except for end conditions. The image is pro-
cessed in 64-pixel columns. Since the image to be fil-
tered will not generally start or end on a block boundary,
the number of horizontal pixels for the first and last col-
umns will be less than 64 in these cases. Also, the data
in the columns must be aligned vertically. This results in
the requirement that the line to line address offset value
must be a multiple of 64 bytes. Note that only the address
offset value is modulo 64; the image to be filtered can
start and stop anywhere. Block alignment is not required.
Vertical scaling and filtering processes five 64-pixel input
line segments to generate one 64-pixel output segment.
When input lines Yn-2 to Yn+2 have been processed to
generate one 64-pixel output segment for output line Yn,
five new input segments are needed for the next output
line segment in the 64-pixel column, Yn+1. If the vertical
scale factor is 1.0 (no scaling), line segments Yn-1 to
Yn+2 are reused, a new block for Yn+3 is loaded and the
block for line Yn-2 is discarded.
To load Yn+3, the MCU adds the Y offset value to the
block address (upper 26 bits) of the Y Counter, and the
Y Counter selects the next Y block to be read from
SDRAM. The Y Counter points to the line block address
for last Y block loaded, and the Y offset value is the ad-
dress difference between the start of one line and the
start of the next, X0Y0 to X0Y1. The line offset is always
an integral number of SDRAM blocks. The line offset val-
ue must be added to the current line address to get the
next line address.
Up and down scaling use the U Counter and U Increment
value. The U Counter is used to detect how many lines
must be read (0 to 5) to generate the next output line and
to generate the vertical offset fraction for the 5-tap filter
for output lines that fall between the input lines. The U
Counter is set to its starting value (typically zero) at the
start of the column, and the U Increment value is added
to the U Counter for each output line segment generated
in the column. For a scaling factor of 1.0, the U Increment
value is 1.0, and each line processed will generate a re-
quest for one block. If the scaling factor is 1/2, the incre-
ment value will be two, corresponding to moving down
two lines. In this case, twice the line offset is added to the
Y Counter value.
For up scaling by a factor of 2.0, the Y increment value is
0.5. This means you generate two output lines for each
input line. The U Counter increments as 0.0, 0.5, 1.0, 1.5,
Input Pixels: Y
Output Pixels: Y’
12
345
6
Y’=F(Y3,Y2,Y1,Y2,Y3)
Y’=F(Y2,Y1Y2,Y3,Y4)
Y’=F(Y1,Y2,Y3,Y4,Y5)
Y’=F(Y2,Y3,Y4,Y5,Y6)
Y’=F(Y3,Y4,Y5,Y6,Y5)
2N: Y’=F(Y4,Y5,Y6,Y5,Y4)
(3)
(2)
(5) (4)
Mirrored Pixels
Figure 13-12. Horizontal Pixel Mirroring
SDRAM Bus
Filter Action
Read X0
Write Xa
Read X1
Filter X1 => Xb
Filter X0 => Xa
Read X2
Write Xb
Filter X2 => Xc
Read X3
Figure 13-13. SDRAM and Horizontal Filter Block Timing