Bilinear Interpolation
-
float16_t riscv_bilinear_interp_f16(const riscv_bilinear_interp_instance_f16 *S, float16_t X, float16_t Y)
-
float32_t riscv_bilinear_interp_f32(const riscv_bilinear_interp_instance_f32 *S, float32_t X, float32_t Y)
-
q15_t riscv_bilinear_interp_q15(riscv_bilinear_interp_instance_q15 *S, q31_t X, q31_t Y)
-
q31_t riscv_bilinear_interp_q31(riscv_bilinear_interp_instance_q31 *S, q31_t X, q31_t Y)
-
q7_t riscv_bilinear_interp_q7(riscv_bilinear_interp_instance_q7 *S, q31_t X, q31_t Y)
- group BilinearInterpolate
Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid. The underlying function
f(x, y)
is sampled on a regular grid and the interpolation process determines values between the grid points. Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension. Bilinear interpolation is often used in image processing to rescale images. The NMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.Algorithm end of LinearInterpolate group
The instance structure used by the bilinear interpolation functions describes a two dimensional data table. For floating-point, the instance structure is defined as:
where
numRows
specifies the number of rows in the table;numCols
specifies the number of columns in the table; andpData
points to an array of sizenumRows*numCols
values. The data tablepTable
is organized in row order and the supplied data values fall on integer indexes. That is, table element (x,y) is located atpTable[x + y*numCols]
where x and y are integers.Let
(x, y)
specify the desired interpolation point. Then define:The interpolated output point is computed as: Note that the coordinates (x, y) contain integer and fractional components. The integer components specify which portion of the table to use while the fractional components control the interpolation processor.
if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
Functions
-
float16_t riscv_bilinear_interp_f16(const riscv_bilinear_interp_instance_f16 *S, float16_t X, float16_t Y)
Floating-point bilinear interpolation.
- Parameters
S – [inout] points to an instance of the interpolation structure.
X – [in] interpolation coordinate.
Y – [in] interpolation coordinate.
- Returns
out interpolated value.
-
float32_t riscv_bilinear_interp_f32(const riscv_bilinear_interp_instance_f32 *S, float32_t X, float32_t Y)
Floating-point bilinear interpolation.
- Parameters
S – [inout] points to an instance of the interpolation structure.
X – [in] interpolation coordinate.
Y – [in] interpolation coordinate.
- Returns
out interpolated value.
-
q15_t riscv_bilinear_interp_q15(riscv_bilinear_interp_instance_q15 *S, q31_t X, q31_t Y)
Q15 bilinear interpolation.
- Parameters
S – [inout] points to an instance of the interpolation structure.
X – [in] interpolation coordinate in 12.20 format.
Y – [in] interpolation coordinate in 12.20 format.
- Returns
out interpolated value.
-
q31_t riscv_bilinear_interp_q31(riscv_bilinear_interp_instance_q31 *S, q31_t X, q31_t Y)
Q31 bilinear interpolation.
- Parameters
S – [inout] points to an instance of the interpolation structure.
X – [in] interpolation coordinate in 12.20 format.
Y – [in] interpolation coordinate in 12.20 format.
- Returns
out interpolated value.
-
q7_t riscv_bilinear_interp_q7(riscv_bilinear_interp_instance_q7 *S, q31_t X, q31_t Y)
Q7 bilinear interpolation.
- Parameters
S – [inout] points to an instance of the interpolation structure.
X – [in] interpolation coordinate in 12.20 format.
Y – [in] interpolation coordinate in 12.20 format.
- Returns
out interpolated value.