:stem:

Within a mip level, ename:VK_FILTER_CUBIC_IMG filtering computes a weighted
average of 16 (for 2D), or 4 (for 1D) texel values, using the weights
computed during texel selection.

Catmull-Rom Spine interpolation of four points is defined by the equation:

[latexmath]
++++++++++++++++++++++++
\begin{aligned}
cinterp(\tau_0, \tau_1, \tau_2, \tau_3, \omega) =
\frac{1}{2}
\begin{bmatrix}1 & \omega & \omega^2 & \omega^3 \end{bmatrix}
\times
\begin{bmatrix}
 0 &  2 &  0 &  0 \\
-1 &  0 &  1 &  0 \\
 2 & -5 &  4 &  1 \\
-1 &  3 & -3 &  1
\end{bmatrix}
\times
\begin{bmatrix}
\tau_0 \\
\tau_1 \\
\tau_2 \\
\tau_3
\end{bmatrix}
\end{aligned}
++++++++++++++++++++++++

Using the values calculated in texel selection, this equation is applied to
the four points in 1D images.
For 2D images, the this equation is evaluated first for each row, and the
result is then fed back into the equation and interpolated again:

  :: [eq]#{tau}~1D~[level] = cinterp({tau}~i0~[level], {tau}~i1~[level],
     {tau}~i2~[level], {tau}~i3~[level], {alpha})#

  :: [eq]#{tau}~j0~[level] = cinterp({tau}~i0j0~[level], {tau}~i1j0~[level],
     {tau}~i2j0~[level], {tau}~i3j0~[level], {alpha})#
  :: [eq]#{tau}~j1~[level] = cinterp({tau}~i0j1~[level], {tau}~i1j1~[level],
     {tau}~i2j1~[level], {tau}~i3j1~[level], {alpha})#
  :: [eq]#{tau}~j2~[level] = cinterp({tau}~i0j2~[level], {tau}~i1j2~[level],
     {tau}~i2j2~[level], {tau}~i3j2~[level], {alpha})#
  :: [eq]#{tau}~j3~[level] = cinterp({tau}~i0j3~[level], {tau}~i1j3~[level],
     {tau}~i2j3~[level], {tau}~i3j3~[level], {alpha})#
  :: [eq]#{tau}~2D~[level] = cinterp({tau}~j0~[level], {tau}~j1~[level],
     {tau}~j2~[level], {tau}~j3~[level], {beta})#

[latexmath]
++++++++++++++++++++++++
\begin{aligned}
\tau[level] &=
  \begin{cases}
     \tau_{2D}[level], & \text{for 2D image} \\
     \tau_{1D}[level], & \text{for 1D image}
   \end{cases}
\end{aligned}
++++++++++++++++++++++++
