Bilinear algorithm, Bilinear algorithmic description, Bilinear algorithm -2 – Altera Video and Image Processing Suite User Manual

Page 223: Bilinear algorithmic description -2

Advertising
background image

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+0.5) w

in

/w

out

, (j+0.5) h

in

/h

out

).

The 0.5 values in this equation come from considering the coordinates of an image array to be on the lines

of a 2D grid, but the pixels to be equally spaced between the grid lines that is, at half values.
This equation gives an answer relative to the mid-point of the input pixel. You must subtract 0.5 to

translate from pixel positions to grid positions. However, this 0.5 would then be added again so that later

truncation performs rounding to the nearest integer. Therefore no change is required.
The calculation performed by the Scaler II is equivalent to the following integer calculation:

Bilinear Algorithm

Bilinear algorithm is of higher quality and more expensive than the nearest-neighbor algorithm.
If you use the bilinear algorithm, the jagged edges of the nearest-neighbor method are smoothed out.

However, this is at the expense of losing some sharpness on edges.
The bilinear algorithm uses four multipliers per channel in parallel. The size of each multiplier is either

the sum of the horizontal and vertical fraction bits plus two, or the input data bit width, whichever is

greater. For example, with four horizontal fraction bits, three vertical fraction bits, and eight-bit input

data, the multipliers are nine-bit.
With the same configuration but 10-bit input data, the multipliers are 10-bit. The function uses two line

buffers. As in nearest-neighbor mode, each of line buffers is the size of a clipped line from the input

image. The logic area is more than the nearest-neighbor method.

Bilinear Algorithmic Description

The algorithmic operations of the bilinear method can be modeled using a frame-based method.
To find a value for an output pixel located at (i, j), we first calculate the corresponding location on the

input:

The integer solutions

to these equations provide the location of the top-left corner of the four

input pixels to be summed.

The differences between in

i

, in

j

, and

are a measure of the error in how far the top-left input

pixel is from the real-valued position that we want to read from. Call these errors err

i

and err

j

. The

17-2

Bilinear Algorithm

UG-VIPSUITE

2015.05.04

Altera Corporation

Scaler II IP Core

Send Feedback

Advertising