A newer version of this document is available. Customers should click here to go to the newest version.
20.1. Nearest Neighbor Algorithm
If you use the nearest-neighbor algorithm, jagged edges may be visible in the output image because no blending takes place. However, this algorithm requires no DSP blocks, and uses fewer logic elements than the other methods.
Scaling up and down requires one line buffer of the same size as the one line from the clipped input image—taking account of the number of color planes being processed.
For example, scaling up a 100-pixel wide image, which uses 8-bit data with 3 colors in sequence, requires 8 × 3 × 100 = 2,400 bits of memory. Similarly, if the 3 color planes are in parallel, the memory requirement is still 2,400 bits.
For each output pixel, the nearest-neighbor method picks the value of the nearest input pixel to the correct input position. Formally, to find a value for an output pixel located at (i, j), the nearest-neighbor method picks the value of the nearest input pixel to ((i × win )/wout + 0.5, (j × hin )/hout + 0.5)).
The 0.5 values in this equation are rounded to the nearest integer input pixel to provide the nearest neighbor pixel.
The calculation performed by the Scaler II is equivalent to the following integer calculation:
O(i,j) = F((2 × win × i + wout )/2 × wout , (2 × hin × j + hout )/2 × hout
Did you find the information on this page useful?