# An Analytic Transform Kernel Derivation Method for Video Codecs
## 2 Proposed Common Sparse Unified Matrix
### Proposed Grouped DST-7 Matrix  
To derive the full DST-7 and DCT-8 matrices with less memory, a grouped DST-7 matrix is proposed. The proposed grouped DST-7 matrix is based on the principle of storing only a few selected rows of different block-sized DST-7 transform kernels. The rows selected from the original kernel matrix are used to generate the group of elements of the respective block size DST-7 transform kernel with the help of the permutation matrix (**G**) comprising \(-1\), \(0\), or \(1\). The matrix **G** is multiplied by the selected rows, resulting in a full block-sized DST-7 transform kernel. The matrices **P**, **Q**, **R**, and **S** in Figure 1 indicate the rows for the derivation of 32, 16, 8, and 4-point DST-7 transform kernels, respectively, and they are only stored for DST-7 and DCT-8 kernel derivation, leading to a significant reduction in memory storage. The grouped DST-7 matrix is defined as a 14 \(\times\) 64 matrix of the lower part, as shown in Figure 1, and the total memory allocation is required for only 280 elements with 8-bit precision, which significantly reduces the memory sizes of the current DST-7 in VVC with 1360 elements each with 8-bit precision. To derive the full-size 32-point DST-7 transform kernel, only six-row vectors from the 32-point DST-7 are selected, that is, **P** = [\(\mathbf{S}_{7,0}\)\(\mathbf{S}_{7,1}\)\(\mathbf{S}_{7,2}\)\(\mathbf{S}_{7,3}\)\(\mathbf{S}_{7,5}\)\(\mathbf{S}_{7,6}\)]T and can be base vectors for each group of DST-7 matrix in the proposed method. Similarly, for the derivation of full-size 16, 8, and 4-point DST-7 transform kernels, **Q** with four rows, **R** with two rows, and **S** with two rows, that is, **Q** = [\(\mathbf{S}_{7,0}\)\(\mathbf{S}_{7,1}\)\(\mathbf{S}_{7,2}\)\(\mathbf{S}_{7,5}\)]T, **R** = [\(\mathbf{S}_{7,0}\)\(\mathbf{S}_{7,1}\)]T, and **S** = [\(\mathbf{S}_{7,0}\)\(\mathbf{S}_{7,1}\)]T, are selected from 16, 8, and 4-point DST-7, respectively and are regarded as the base vectors. Note that \(\mathbf{S}_{7,~{}i}\) represents the \(i\)-th row of DST-7. Using a few selected rows and **G**, the full-size DST-7 transform kernel can be derived by retrieving the row vectors of each group. Figure 6 shows an illustration of kernel derivation using a grouped 32-point DST-7 matrix. As shown in Figure 6, the row vectors of **P** in the grouped DST-7 matrix are used to derive the row vectors of the DST-7 kernel in each group. Figure 5: Illustration of the proposed DCT-2 transform kernel. Figure 7 shows the details of the derivation process of the kernel for each group. The 0-th group is taken as an example, and the other groups follow the same process using different row vectors of matrix **P**. In Figure 7, \(\left[\mathbf{S}_{\gamma,(i,j)}\right]_{N}\) denotes the \(j\)-th row vector of the \(i\)-th group for the \(N\)-point DST-7. In the proposed method, matrix **P** comprises only the 0-th row vectors of the \(i\)-th group of the \(N\)-point DST-7. First, the 0-th row vector \(\left[\mathbf{S}_{\gamma,(i,0)}\right]_{N}\) from **P** is obtained from the \(i\)-th group of DST-7. Subsequently, the absolute values of \(e_{l}\) and \(e_{f}\), which are the last (the rightmost) and first (the leftmost) elements in the row vector, are compared. If these two absolute values are identical, the row vector can be one row of the DST-7 kernel with the same index as stored in **P**. Otherwise, the row vector is multiplied by **G** and a comparison of \(e_{l}\) and \(e_{f}\) in the resulting row vector is performed as in the previous step. If the first element in each row is a negative value, then the sign of every element in each row is altered. It should be noted that **G** is designed such that the absolute value of the first element in the previous row equals the absolute value of the last element of the next row vector after multiplying with **G**. This process is repeated until the end of the last row vector of the current group.