# Frequency-Based Adaptive Interpolation Filter in Intra Prediction
## 2 Previous Works  
### An Overview of Reference Sample Filtering for Video Coding Standards  
In intra prediction, a prediction block is generated using the reference samples from adjacent blocks. During the prediction process, filtering is applied to remove discontinuities in the reference samples and to generate accurate prediction sample values. There are two types of reference sample smoothing on integer samples in HEVC [17], whether to use a strong reference filter or a weak reference filter. The filter is determined by the block size and the continuity of the reference samples. HEVC interpolation filters use a 2-tap linear interpolation filter to generate a fractional position sample value [18]. In VVC, reference sample smoothing is applied in the integer-slope mode and interpolation filtering is applied in the fractional-slope mode [9; 10; 12]. Figure 1 shows the integer-slope modes and fractional-slope modes in the VVC intra prediction modes. Outof 87 intra prediction modes, the vertical and horizontal modes do not use filters when generating the prediction samples. Planar and \(-14\), \(-12\), \(-10\), \(-6\), \(2\), \(34\), \(66\), \(72\), \(76\), \(78\), or \(80\) modes corresponding to multiple 45 degrees angles with an integer slope use [1; 2; 1] reference sample filter without interpolation filter. The other fractional-slope modes generate fractional reference samples of the current prediction samples by applying an interpolation filter to integer position reference samples. In this case, 4-tap interpolation filters are used for the luma samples to generate fractional positioned samples. There are two interpolation filters in VVC: 4-tap DCT-IF and 4-tap SIF [19; 20; 21]. The 4-tap DCT-IF coefficients in VVC are derived from the DCT-II in Equation (1) and IDCT-II (Inverse DCT-II) in Equation (2). \[X(k)=\sqrt{\frac{2}{N}}\sum_{n=0}^{N-1}c_{k}x(n)\cos\frac{(n+1/2)\pi k}{N} \tag{1}\]  
\[x(n)=\sqrt{\frac{2}{N}}\sum_{k=0}^{N-1}c_{k}X(k)\cos\frac{(n+1/2)\pi k}{N} \tag{2}\]  
\[c_{k}=\left\{ \begin{array}{cc}\frac{1}{\sqrt{2}},&k=0\\ 1,&k=1,2,\ldots,N-1\end{array} \right.\]  
where \(X(k)\) is the N-point of DCT-II and \(x(n)\) is its inverse transform. The DCT-IF coefficients [1] in Table 1 were obtained from Equations (1) and (2). The 4-tap SIF is derived from a convolution of [1; 2; 1] filter and a \(1/32\) linear interpolation on the reference samples as shown in Table 2 [1]. Tables 1 and 2 show the 4-tap DCT-IF coefficients and the 4-tap SIF coefficients, respectively. In Tables 1 and 2, the index \(I\) represents the position of the integer pixel. In VVC, the CU size and directional mode in Equations (3) and (4) are used to select a 4-tap DCT-IF or 4-tap SIF for fractional reference samples interpolation. \[nTbS=(\ Log2\ (W)+Log2\ (H))\gg 1 \tag{3}\]  
Figure 1: Angular intra prediction modes in VVC. \[minDistVerHor=Min\bigg{(} \begin{array}{c}Abs(\;predModelIntra-50\;),\\ Abs(\;predModelIntra-18\;)\end{array} \bigg{)} \tag{4}\]  
where \(W\) and \(H\) are the width and height of CU. \(nT\)_DS_ is determined at Equation (3) according to \(W\) and \(H\). _predModelIntra_ represents the prediction mode of the current CU, and _minDistVerHor_ is determined as the minimum difference value between the prediction mode of the current CU and the vertical mode 50 or between the prediction mode of the current CU and the horizontal mode 18. The filter is selected using \(nT\)_DS_ and _minDistVerHor_ of the CU calculated by Equations (3) and (4). If the _minDistVerHor_ is greater than the _intraHorVerDistThres[nTbS]_ in each \(nT\)_DS_ in Table 3, a 4-tap SIF is used, otherwise, a 4-tap DCT-IF is used. If an MRL or ISP is used in the CU, only the 4-tap DCT-IF is applied for the CU reference samples.