# An Analytic Transform Kernel Derivation Method for Video Codecs
## 1 Introduction  
Various standardization works for video compression have been performed, including H.261, H.262, H.263 [1], H.264/advanced video coding [2], and H.265/ high-efficiency video coding (HEVC) [3]. Recently, the standardization process of versatile video coding (VVC) [4], which aims to provide a significant improvement in compression performance over the existing HEVC standard and aid the deployment of higher quality video services and emerging applications, such as 360\({}^{\circ}\) omnidirectional immersive multimedia and high-dynamic-range video, has been standardized. In the standardization of VVC, discrete cosine transform-2 (DCT-2), discrete sine transform-7 (DST-7), and DCT-8 are regarded as three vital primary transform kernels [5, 6, 7, 8, 9], which can also be termed as the multipletransform set (MTS) [10; 11]. The benefits of MTS are usually to enlarge transform sets when necessary, that is, reduced distortion in the R-D trade-off as complex residuals exploit the multiple transforms and reduce transform sets when necessary. This means reduced bitrate in the R-D trade-off by avoiding wasting bits signaling the transforms when necessary [12]. Similarly, DST-7 approximates the optimal transform better than DCT-2 along the prediction direction, that is, for intra prediction residuals [11]. Along with these three transform kernels, DST-4 and DCT-4 can also be regarded as the replacement of DST-7 and DCT-8, respectively, because they exhibit similar kernel behavior and show better coding efficiency for smaller resolution sequences [13]. The used transform kernel elements are derived based on the following mathematical equations. DCT-2  
\[[C_{2}]_{n,k}=\sqrt{\frac{2}{N}}\varepsilon_{k}cos\bigg{(}\frac{\pi(2n+1)k}{2N} \bigg{)} \tag{1}\]  
where \(\varepsilon_{k}=\left\{ \begin{array}{c}\frac{1}{\sqrt{2}}\ k=0\\ 1\ otherwise\end{array} \right.\)  
DCT-4  
\[[C_{4}]_{n,k}=\sqrt{\frac{2}{N}}cos\bigg{(}\frac{\pi(2n+1)(2k+1)}{4N}\bigg{)} \tag{2}\]  
DCT-8  
\[[C_{8}]_{n,k}=\frac{2}{\sqrt{2(N-1)}}cos\bigg{(}\frac{\pi(2n+1)(2k+1)}{4N-2} \bigg{)} \tag{3}\]  
DST-4  
\[[S_{8}]_{n,k}=\sqrt{\frac{2}{2N}}\varepsilon_{k}sin\bigg{(}\frac{\pi(2n+1)(k+1 )}{2N}\bigg{)} \tag{4}\]  
where, \(\varepsilon_{k}=\left\{ \begin{array}{c}\frac{1}{\sqrt{2}}\ k=N-1\\ 1\ otherwise\end{array} \right.\)  
DST-7  
\[[S_{7}]_{n,k}=\frac{2}{\sqrt{2N+1}}sin\bigg{(}\frac{\pi(2k+1)(n+1)}{2N+1} \bigg{)} \tag{5}\]  
where \(N\) represents the block size. Several design aspects of HEVC transform coding are inherited in the VVC codec. In addition to the conventional DCT-2, alternate transform types like DST-7 and DCT-8 are also adopted in the VVC, which is generally referred to as primary transform because it is first applied to the predicted residual pixels and named as contrast meaning of the secondary transform [14] in VVC. The size of DCT-2 ranges from 4-point to 64-point, whereas that of DST-7 and DCT-8 ranges from 4-point to 32-point. The kernels elements defined in VVC are composed of 8-bit signed integer values. The additional integer transform kernels defined in VVC are derived by scaling the floating-point transform kernel with 64 \(\sqrt{N}\), where \(N\) represents the transform size [14]. For the alignment of the worst-case multiplications per coefficients with HEVC, for 64-point DCT-2 and 32-point DST-7/DCT-8, only the first 32 and 16 low-frequency coefficients are kept, and the higher frequency coefficients are zeroed out respectively, which is also considered in the last coefficient position coding and the coefficient group scanning [15]. All the kernels elements are stored in the reference software VTM-3.0 in an 8-bit representation. A single 64-point DCT-2 kernel matrix is newly defined in VCC, and other sizes of DCT-2 are kept unchanged with HEVC. Other individual sets of 4-, 8-, 16-, and 32-point DST-7 and DCT-8 kernel matrices are also stored in the reference software [16], adding together to the storage of 8180 elements which is a prime concern for the memory.