While bilinear interpolation may be applied in various applications, an image processing example is used here. In this case, function values correspond to pixel values in the range [0, 255]. Single precision, floating-point numerical format is assumed for interpolated pixel values and interpolation coordinates \((x_q,y_q)\).
A reference image is used to generate a lookup table which provides input to the AI Engine. An input image with resolution \(x_{res} \times y_{res}\) is assumed to have pixels defined on a grid with unit spacing. The \(x\) and \(y\) pixel coordinates may be combined using the equation \(I = x \times y_{res} + y\) to derive a LUT index \(I\), as shown in Figure 4.
Figure 4 - Image as a Lookup Table
For any query point, \((x_q,y_q)\), the floating point coordinates can be separated into integer and fractional parts, where \(x_q = x_{int}.x_{frac}\) and \(y_q = y_{int}.y_{frac}\). The integer parts are used to extract pixel values used in the interpolation equation. The four values required for interpolation are obtained from the LUT using the following relations:
An example of LUT indexing is shown in Figure 4 using the pixels marked with X. Once the four pixel values required for interpolation are obtained, the integer parts of the coordinates \((x_q,y_q)\) are no longer needed and can be assumed to be zero. This simplifies the interpolation equation to
or expressed as an inner product