A fast coding mode decision method for VVC SCC
By designing a pattern classifier based on a convolutional neural network to predict the coding mode distribution of VVC SCC in parallel, the computational complexity problem caused by the difference in VVC SCC coding unit size is solved, and faster coding speed and more efficient video coding are achieved.
Patent Information
- Application Number
- CN202410131440.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-31
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-01-31
AI Technical Summary
The significant difference in coding unit (CU) size of VVC SCC makes it difficult for existing fast algorithms to achieve optimal performance on VVC SCC, resulting in increased computational complexity and encoding time.
Design a pattern classifier based on convolutional neural network to segment the video frame brightness component into CUs of different sizes, predict the coding mode distribution in parallel through the trained pattern classifier, sort and select the optimal coding mode, and skip impossible modes. Check to reduce computational complexity.
Significantly improves the encoding speed, reduces unnecessary mode checks, and reduces computational complexity. At the same time, it greatly reduces computational complexity while ensuring video quality, achieving faster encoding speed and higher efficiency.
Smart Images

Figure CN117915080B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of video coding, and in particular relates to a fast coding mode decision method suitable for VVC SCC. Background Art
[0002] With the rapid popularization of smart devices and networks, screen content applications have rapidly emerged, covering many fields such as screen sharing, remote collaboration, and online education. These emerging applications have posed more severe challenges to existing video coding technologies. In this context, the new generation of video coding standards actively incorporates screen content coding characteristics, highlighting its core position in the field of contemporary video applications.
[0003] Screen content, which is mostly computer-generated, exhibits unique characteristics: repetitive pattern elements, widely distributed flat color blocks, limited color range, and lack of sensor noise. Despite this, the traditional Advanced Video Coding (H.264 / AVC) and High Efficiency Video Coding (H.265 / HEVC) standards are not deeply optimized for these characteristics. In order to process screen content videos more efficiently, a joint collaboration team in the field of video coding has further developed the Screen Content Coding (SCC) extension technology based on HEVC. This innovative technology is specifically optimized for the typical characteristics of screen content, achieving the same video quality compared to the original HEVC standard. The delta bitrate is reduced by more than 50%. This remarkable result demonstrates the superiority and efficiency of SCC extension in the field of screen content video coding.
[0004] With the continuous evolution of technology, Versatile Video Coding (VVC) has made another technological breakthrough based on the SCC extension of HEVC. It not only introduces the Intra mode, but also adds two key coding modes: Intra Block Copy (IBC) and Palette Mode (PLT). These new tools significantly improve coding performance, but also put forward higher requirements on computing power.
[0005] VVC uses cutting-edge coding technologies such as Quadtree + Multi-Type Tree (QTMT). The application of these technologies undoubtedly increases the computational burden of the encoder because they require comprehensive mode searches for coding units (CUs) of different sizes. In this process, the encoder needs to calculate the Lagrangian cost (RD cost) for each mode m to select the best coding structure and mode.
[0006] These technological advances not only improve the efficiency and performance of video encoding, but also provide richer and higher-quality video content. However, at the same time, they also bring higher computing requirements and more complex encoding processes. This requires continuous exploration of new technologies and methods to achieve more efficient and optimized video encoding to meet the growing needs of video applications.
[0007] In recent years, significant breakthroughs have been made in the field of fast algorithms for SCC, and these methods can be mainly divided into two categories: feature-based fast algorithms and content-based fast algorithms. Since the correlation between content type and coding mode is not always stable, relying on content to predict candidate modes may not always achieve optimal performance. Similarly, since the correlation between features and coding modes is not always consistent, using features to predict candidate modes may not achieve optimal performance. On the other hand, these current methods are all designed specifically for HEVC SCC. However, given the significant difference in CU size between HEVC SCC and VVC SCC, current methods still face challenges in achieving optimal performance on VVC SCC. Summary of the invention
[0008] In order to solve the above technical problems, the present invention proposes a fast coding mode decision method applicable to VVC SCC, comprising:
[0009] S1: At the beginning of each frame encoding of the VTM encoder, the brightness component of the video frame is divided into four groups of CUs with sizes of 32x32, 32x16, 32x8, and 32x4;
[0010] S2: Design four convolutional neural network-based pattern classifiers for the four groups of CUs respectively, and design loss functions to train the convolutional neural network-based pattern classifiers;
[0011] S3: predict the coding mode distribution of each sub-block in parallel through the trained mode classifier to obtain the coding mode probability of each sub-block;
[0012] S4: Sort the coding mode probabilities of each sub-block, select the probabilities of the first n modes from large to small and calculate the probability and s of the first n modes. When the probability and s of the selected mode are greater than the set threshold T, stop selecting and get the optimal coding mode.
[0013] Beneficial effects of the present invention:
[0014] The present invention optimizes the complex partitioning structure of VVC and realizes fast mode prediction of coding unit (CU) by using convolutional neural network, which can effectively skip impossible modes and significantly reduce unnecessary mode checks, thereby greatly improving the encoding speed.
[0015] The success of this invention verifies the great potential of deep learning in the field of video coding. By combining deep learning and video coding, not only can faster encoding speed be achieved, but also the computational complexity can be greatly reduced while ensuring video quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 Schematic diagram of the distribution of modes of various sizes in the VVC of the present invention;
[0017] Figure 2 Schematic diagram of the structure of four pattern classifiers based on convolutional neural networks of the present invention. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] A fast coding mode decision method applicable to VVC SCC, comprising:
[0020] S1: At the beginning of each frame encoding of the VTM encoder, the brightness component of the video frame is divided into four groups of CUs with sizes of 32x32, 32x16, 32x8, and 32x4;
[0021] S2: Design four convolutional neural network-based pattern classifiers for the four groups of CUs respectively, and design loss functions to train the convolutional neural network-based pattern classifiers;
[0022] S3: predict the coding mode distribution of each sub-block in parallel through the trained mode classifier to obtain the coding mode probability of each sub-block;
[0023] S4: Sort the coding mode probabilities of each sub-block, select the probabilities of the first n modes from large to small and calculate the probability and s of the first n modes. When the probability and s of the selected mode are greater than the set threshold T, stop selecting and get the optimal coding mode.
[0024] In this embodiment, in order to predict candidate CMs and eliminate unlikely candidate CMs, the pattern distribution of various types of CUs is first observed. 13 test sequences are encoded under common test conditions (CTC) using VTM-17.0. These sequences include four types: A-class Robot; CC-class EBURainFruits and Kimono1; Mixed-class BasketballScreen, MissionControlClip2, and MissionControlClip3; and TGM-class Console, Desktop, FlyingGraphics, Map, Programming, SlideShow, and WebBrowsing. These sequences are encoded using QPs of 22, 27, 32, and 37 under the All_Intra (AI) configuration. Figure 1 The corresponding mode distribution of CUs of various sizes is detailed. Figure 1 It can be seen that the pattern distribution of CUs of various sizes is significantly different. In order to improve the prediction accuracy, different network structures are designed and trained specifically for CUs of different sizes. They can be divided into four groups, corresponding to the sizes of 32x32, 32x16, 32x8, and 32x4.
[0025] In this embodiment, four convolutional neural network-based pattern classifiers are designed for the four groups of sub-blocks, including:
[0026] The four convolutional neural network-based pattern classifiers all include multiple convolutional layers, one Flatten layer, and three fully connected layers, wherein the multiple convolutional layers have different structures for CUs of different size ratios; CUs of different sizes obtain a sufficient number of feature maps through multiple convolutional layers, flatten and fully connect the feature maps through the Flatten layer, and generate probabilities of three modes Intra, PLT, and IBC through three fully connected layers.
[0027] Specifically, the multi-layer convolutional layers have different structures for CUs of different sizes, including:
[0028] The multi-layer convolutional layer has different structures for CUs of different size ratios, including:
[0029] The multi-layer convolutional layer of the CU with a size of 32x32 consists of 2 layers of padded convolutional layers ConvP with a convolution kernel size of 3x3 and a step size of 1x1, and 5 layers of downsampling convolutional layers Conv with a convolution kernel size and a step size of 2x2; its structure is: ConvP1, Conv1, ConvP2, Conv2, Conv3, Conv4, Conv5, Conv6;
[0030] The multi-layer convolution layer of the CU of size 32x16 consists of 1 asymmetric convolution layer AsConv with a convolution kernel size of 5x1 and a step size of 1x1, 2 asymmetric convolution layers AsConv with a convolution kernel size of 3x1 and a step size of 1x1, and 4 downsampling convolution layers Conv with a convolution kernel size and a step size of 2x2; its structure is AsConv1, Conv1, AsConv2, Conv2, AsConv3, Conv3, Conv4;
[0031] The multi-layer convolution layer of the CU of size 32x8 consists of 2 layers of asymmetric convolution layers AsConv with a convolution kernel size of 5x1 and a stride of 1x1, 2 layers of asymmetric convolution layers AsConv with a convolution kernel size of 3x1 and a stride of 1x1, and 3 layers of downsampling convolution layers Conv with a convolution kernel size and a stride of 2x2; its structure is AsConv1, Conv1, AsConv2, AsConv3, Conv2, AsConv4, Conv3;
[0032] The multi-layer convolution layer of the CU of size 32x4 consists of 4 asymmetric convolution layers AsConv with a convolution kernel size of 5x1 and a step size of 1x1, and 2 downsampling convolution layers Conv with a convolution kernel size and a step size of 2x2; its structure is AsConv1, Conv1, AsConv2, AsConv3, AsConv4, and Conv2.
[0033] For CUs with a length-to-width ratio of 1, the length and width are equal and square CNNs are used exclusively to predict candidate CMs. Experimentation with these CUs is essential for accurate CM prediction. To ensure the accuracy of prediction, stride 1 is mainly used. However, this leads to an increase in the number of convolutional layers in the network, making the prediction process too complicated. To address these issues, some convolutional layers use stride = 1 while others use stride = 2 for prediction. Specifically, 3×3 convolution kernels with padding = 1 and stride = 1 are used to extract more features in the convolutional layers, denoted as ConvP. In addition, non-overlapping convolutions are performed in the convolutional layers using 2×2 convolution kernels with stride = 2, denoted as Conv. To minimize the loss in prediction, pooling layers are omitted for these CUs. For CUs with a length-to-width ratio other than 1, asymmetric convolutions with kernel sizes of 3x1 and 5x1 are added, and these kernels have stride = 1. The CNNs all use the brightness component as input features, and a sufficient number of feature maps are obtained by using a series of convolutional layers. Subsequently, these feature maps are flattened and fully connected. After this, 3 fully connected layers are applied to generate probabilities with the three modes (Intra, PLT, IBC), each layer is followed by a ReLU activation function and the last layer uses softmax.
[0034] AsConv: asymmetric convolution layer, the convolution kernel size is 5x1 or 3x1, and the step size is 1x1;
[0035] Conv: Downsampling convolution layer, the convolution kernel size is 2x2, and the step size is 2x2.
[0036] ConvP: Convolutional layer with padding, the convolution kernel size is 3x3, the stride is 1x1, and the padding is 1.
[0037] Flatten: Used to flatten the final output of the convolutional layer.
[0038] FC: Fully connected layer, uses the flattened features as input and predicts the probabilities of three modes (Intra, PLT, and IBC), with 256, 64, and 3 nodes respectively.
[0039] Figure 2 The network structure of CU is shown. The sizes of CU are 32×32, 32×16, 32×8 and 32×4 respectively. The other network structures are similar. For example, the 32x4 network has a length-to-width ratio of 8, a minimum length of 4, and is flattened after 6 convolutional layers. The first layer is AsConv1, with a convolution size of 5x1, 32 convolution kernels, and a step size of s=1x1. The details of the other 5 layers are shown in Figure 2 Then input the fully connected layer (FC1-FC3), the first layer FC1, 256 nodes, the other two layers details see Figure 2 , and finally output the probabilities of three modes (Intra, PLT, IBC).
[0040] In this embodiment, a loss function is designed to train a pattern classifier based on a convolutional neural network, including:
[0041]
[0042] Among them, L represents the loss function of the pattern classifier based on convolutional neural network, N represents the number of samples, M represents the number of CMs for each sample, pt represents the scaling factor, weight_cost n represents the penalty weight of RD cost, r ij Indicates the RD cost of the i-th CU selecting the j-th coding mode, r ib represents the RD cost of the best coding mode of the i-th CU, y ij Represents the label of each category, p ij Represents the predicted probability of each category.
[0043] In traditional classification tasks, the cross entropy function is usually chosen as the loss function. However, it does not consider the difference between the predicted value and the true value. Specifically, various CMs usually exhibit different RD costs, which significantly affects the coding efficiency. Directly applying the cross entropy function is not enough to solve this problem. Therefore, a new loss function is formulated.
[0044] Assuming that the mini-batch includes N samples and each sample contains three CMs, the corresponding basic cross entropy loss function can be expressed as:
[0045]
[0046] from Figure 1 As observed in , the distribution of CMs is highly imbalanced. To address this, a scaling factor is introduced that aims to automatically reduce the influence of easier examples during training. This approach quickly directs the model's attention to more challenging examples, facilitating accelerated learning on these instances. Subsequently, the cross entropy can be modified as follows:
[0047]
[0048] Here pt is the probability of the true class, which is used as a scaling factor. RD cost has a significant impact on coding efficiency. However, the above formula does not take into account the RD cost of CM. To solve this problem, RD cost is incorporated into the loss function. First, the penalty weight of RD cost is derived as:
[0049]
[0050] Here r ij represents the RD cost of the i-th CU selecting the j-th mode, r ib represents the RD cost of the best mode of the i-th CU. Multiplying the RD cost penalty weight by the equation, the overall loss function is:
[0051]
[0052] In this embodiment, the training sequences are encoded using QP values 22, 27, 32, and 37 to obtain the true labels. The batch size is set to 8192. The Adam optimizer is used throughout the training process, and 300 epochs are selected during the training process to obtain training models for all CU sizes.
[0053] Using the above network for prediction, we can obtain the probabilities of all three coding modes and arrange them in descending order according to their respective probability values. Let pi represent the probability of the i-th mode. The cumulative sum s of the probabilities of the first n modes is calculated as:
[0054]
[0055] Threshold selection: A smaller threshold will exclude more coding modes, resulting in a larger increase in BDBR, but faster encoding speed. A delicate balance needs to be found between BDBR and speed improvement. Usually, the best mode has a large spatial correlation, so we use the best mode of the adjacent area to make an adaptive threshold. First, calculate the brightness variance of the current area and the left, upper left, and upper areas:
[0056]
[0057] Among them, area represents the image area and area∈(current,left,left above,above), p hw represents the pixel value at the (h,w) position, represents the average value of the pixel value in the current area, H and W represent the height and width of the current area respectively. Therefore, the correlation degree of adjacent areas can be obtained:
[0058]
[0059] Among them, a∈A,A=(left,left above,above), then calculate the weight of each area:
[0060]
[0061] Next, calculate the proportion of the best mode in each area:
[0062]
[0063] Among them, Weight a Represents the weight of the adjacent region a, Relation a Indicates the degree of correlation of the adjacent area a, A represents all adjacent areas of the current area, A=(left,left above,above), a∈A, left represents the left area of the current area, left above represents the upper left area of the current area, above represents the upper area of the current area, Percent a,i represents the proportion of the i-th best mode in the adjacent region a, B represents the number of 4x4 blocks in the adjacent region a, and m b represents the coding mode of the bth 4×4 block, m i Represents the i-th mode of the current region.
[0064] Finally, the offset of the i-th mode threshold of the current region is calculated:
[0065]
[0066] Among them, Offset i Indicates the offset of the i-th mode threshold in the current area, Weight a Indicates the weight of the adjacent area a, Percent a,i represents the proportion of the i-th best mode in the adjacent region a, and A represents all adjacent regions of the current region.
[0067] Further get the final threshold T:
[0068]
[0069] Among them, T base It represents the theoretical optimal coding mode threshold. A smaller threshold will exclude more coding modes, resulting in a larger increase in BDBR, but a faster coding speed. Therefore, theoretically, T is taken as base =0.6;Offset i represents the offset of the i-th mode threshold of the current region; n represents the first n coding mode probabilities selected from the coding mode probability sorting.
[0070] when When , the pattern after the i-th encoding pattern is skipped during encoding.
[0071] In this embodiment, the proposed fast coding mode decision method is evaluated using VTM-17.0 on a server equipped with an AMD Ryzen9 7950x processor, 128GB DDR5 memory, and an RTX4090 GPU. In order to ensure the fairness of the evaluation, 13 test sequences of 4 types specified in CTC were selected. BDBR is used as the standard to evaluate the coding efficiency, and the time saving is represented by ΔT. The comparative data of coding performance and speed are recorded in detail in Table 1. At the same time, considering the practical application value of the method, the test results also include the inference time of the model used in this method.
[0072] Table 1
[0073]
[0074] Experimental results show that compared with the traditional VVC SCC, the present invention reduces the encoding time by 36% on average. This significant performance improvement means faster video processing speed, which can meet the needs of real-time or near real-time encoding. At the same time, the performance loss of the present invention is extremely low, only losing 0.95% of the This small loss of delta bit rate (BDBR) shows that the present invention improves the encoding speed while hardly sacrificing video quality.
[0075] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A fast coding mode decision method suitable for VVC SCC, characterized in that: include: S1: At the beginning of each frame encoding of the VTM encoder, the brightness component of the video frame is divided into four groups of CUs with sizes of 32x32, 32x16, 32x8, and 32x4; S2: Design four convolutional neural network-based pattern classifiers for the four groups of CUs respectively, and design loss functions to train the convolutional neural network-based pattern classifiers; S3: predict the coding mode distribution of each sub-block in parallel through the trained mode classifier to obtain the coding mode probability of each sub-block; The coding modes include: Intra, PLT, and IBC; S4: Sort the coding mode probabilities of each sub-block, select the probabilities of the first n modes from large to small, and calculate the probability and s of the first n modes. When the probability and s of the selected mode are greater than the set threshold T, stop selecting and obtain the optimal coding mode. The threshold value T includes: Determine the threshold T using the best mode of the adjacent area: First, calculate the weight of the adjacent area and the proportion of the best mode of the adjacent area, calculate the offset of the i-th mode threshold of the current area based on the weight of the adjacent area and the proportion of the best mode of the adjacent area, and obtain the final threshold T based on the offset of the i-th mode threshold of the current area; Calculate the weights of adjacent regions and the proportion of the best mode in adjacent regions, including: Weight of the region: The proportion of the best regional model: Among them, Weight a Represents the weight of the adjacent region a, Relation a Indicates the degree of correlation of the adjacent area a, A represents all adjacent areas of the current area, A=(left,left above,above), a∈A, left represents the left area of the current area, left above represents the upper left area of the current area, above represents the upper area of the current area, Percent a,i represents the proportion of the i-th best mode in the adjacent region a, B represents the number of 4x4 blocks in the adjacent region a, and m b represents the coding mode of the bth 4×4 block, m i Represents the i-th mode in the current region; The offset of the i-th mode threshold of the current area is calculated according to the weight of the adjacent area and the proportion of the best mode of the adjacent area, including: Among them, Offset i Indicates the offset of the i-th mode threshold of the current area; The final threshold T is obtained based on the offset of the i-th mode threshold of the current area, including: Among them, T base It represents the theoretical optimal coding mode threshold. A smaller threshold will exclude more coding modes, resulting in a larger increase in BDBR, but a faster coding speed. Therefore, theoretically, T is taken as base =0.6; n represents the first n coding mode probabilities selected from the coding mode probability ranking.
2. The fast coding mode decision method applicable to VVC SCC according to claim 1, characterized in that: Four convolutional neural network-based pattern classifiers are designed for the four groups of sub-blocks, including: The four convolutional neural network-based pattern classifiers all include multiple convolutional layers, one Flatten layer, and three fully connected layers, wherein the multiple convolutional layers have different structures for CUs of different size ratios; CUs of different sizes obtain a sufficient number of feature maps through multiple convolutional layers, flatten and fully connect the feature maps through the Flatten layer, and generate probabilities of three modes Intra, PLT, and IBC through three fully connected layers.
3. The fast coding mode decision method applicable to VVC SCC according to claim 2, characterized in that: The multi-layer convolutional layer has different structures for CUs of different size ratios, including: The multi-layer convolutional layer of the CU with a size of 32x32 consists of 2 layers of padded convolutional layers ConvP with a convolution kernel size of 3x3 and a step size of 1x1, and 5 layers of downsampling convolutional layers Conv with a convolution kernel size and a step size of 2x2; its structure is: ConvP1, Conv1, ConvP2, Conv2, Conv3, Conv4, Conv5, Conv6; The multi-layer convolution layer of the CU of size 32x16 consists of 1 asymmetric convolution layer AsConv with a convolution kernel size of 5x1 and a step size of 1x1, 2 asymmetric convolution layers AsConv with a convolution kernel size of 3x1 and a step size of 1x1, and 4 downsampling convolution layers Conv with a convolution kernel size and a step size of 2x2; its structure is AsConv1, Conv1, AsConv2, Conv2, AsConv3, Conv3, Conv4; The multi-layer convolution layer of the CU of size 32x8 consists of 2 layers of asymmetric convolution layers AsConv with a convolution kernel size of 5x1 and a stride of 1x1, 2 layers of asymmetric convolution layers AsConv with a convolution kernel size of 3x1 and a stride of 1x1, and 3 layers of downsampling convolution layers Conv with a convolution kernel size and a stride of 2x2; its structure is AsConv1, Conv1, AsConv2, AsConv3, Conv2, AsConv4, Conv3; The multi-layer convolution layer of the CU of size 32x4 consists of 4 asymmetric convolution layers AsConv with a convolution kernel size of 5x1 and a step size of 1x1, and 2 downsampling convolution layers Conv with a convolution kernel size and a step size of 2x2; its structure is AsConv1, Conv1, AsConv2, AsConv3, AsConv4, and Conv2.
4. The fast coding mode decision method applicable to VVC SCC according to claim 1, characterized in that: Design loss functions to train convolutional neural network-based pattern classifiers, including: Among them, L represents the loss function of the pattern classifier based on convolutional neural network, N represents the number of samples, M represents the number of CMs for each sample, pt represents the scaling factor, weight_cost n represents the penalty weight of RD cost, r ij Indicates the RD cost of the i-th CU selecting the j-th coding mode, r ib represents the RD cost of the best coding mode of the i-th CU, y ij Represents the label of each category, p ij Represents the predicted probability of each category.
5. The fast coding mode decision method applicable to VVC SCC according to claim 1, characterized in that: Calculate the probability and s of the first n patterns, include: Among them, s represents the sum of the probabilities of the first n patterns, and pi represents the probability of the i-th pattern.
