Video processing method and apparatus, computer device, storage medium, and program product
The prediction mode list is rearranged by using the adaptive angle weighting mode (DAWP), which solves the problem of large bit overhead of prediction mode index in video coding and decoding, and improves the efficiency of video coding and decoding.
Patent Information
- Application Number
- PCT/CN2025/081124
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-19
- Filing Date
- 2025-03-06
- Publication Date
- 2025-09-25
AI Technical Summary
In existing video coding and decoding technologies, the huge number of prediction modes leads to excessive bit overhead when encoding and decoding prediction mode indexes, resulting in low video coding and decoding efficiency.
By rearranging the prediction mode list, especially the adaptive angle weighting mode (DAWP), the prediction mode with a high probability of being used by the current block has a smaller index value in the list, and a corresponding entropy coding method is designed to reduce the coding bit overhead and decoding information amount of the prediction mode index.
Improves video encoding and decoding efficiency by reducing the amount of encoding and decoding information of the prediction mode index, thereby improving the efficiency of video encoding and decoding.
Smart Images

Figure CN2025081124_25092025_PF_FP_ABST
Abstract
Description
Video processing method, device, computer equipment, storage medium, and program product
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 19, 2024, with application number 202410320693.6 and application name “Video processing method, device and computer equipment, storage medium, program product”, all contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computer technology, in particular to the field of video coding and decoding technology, and specifically to a video processing method, a video processing apparatus, a computer device, a computer-readable storage medium, and a computer program product. Background Art
[0003] In the current field of video coding and decoding technology, different prediction modes are supported for predicting the current block in the video (the current block can be understood as the unit currently being encoded or decoded) to obtain the predicted value of the current block. During the video coding and decoding process, the index of the prediction mode needs to be encoded and decoded. The number of prediction modes supported by current video coding and decoding technology is huge. The huge number of prediction modes results in a large bit overhead when encoding the indexes of these prediction modes during the encoding stage, resulting in low video encoding efficiency. The huge number of prediction modes also requires a large number of bits to be decoded when decoding the indexes of these prediction modes during the decoding stage, resulting in low video decoding efficiency. Summary of the Invention
[0004] The embodiments of the present application provide a video processing method, apparatus, computer equipment, storage medium, and program product, which can improve the efficiency of video encoding and decoding.
[0005] In one aspect, an embodiment of the present application provides a video processing method, the video processing method comprising:
[0006] Parsing the coding mode indication information of the current block in the video stream;
[0007] Parsing prediction mode indication information of a current block in a video stream, where the prediction mode indication information includes a prediction mode index of the current block;
[0008] If the coding mode indication information indicates that the coding mode of the current block is the rearranged coding mode, rearrange the prediction mode list to obtain a rearranged prediction mode list;
[0009] determining a prediction mode of the current block in the reordered prediction mode list according to the prediction mode index of the current block;
[0010] The current block is predicted according to the prediction mode of the current block to obtain a prediction value of the current block; the prediction value of the current block is used to reconstruct a decoded image block of the current block.
[0011] In an embodiment of the present application, when the encoding mode of the current block is the rearranged encoding mode, by rearranging the prediction mode list, less information can be parsed when parsing the prediction mode index of the current block in the video code stream, thereby improving the decoding efficiency of the prediction mode index of the current block, thereby improving the video decoding efficiency.
[0012] Accordingly, an embodiment of the present application provides a video processing device, which includes:
[0013] A parsing unit, configured to parse the coding mode indication information of the current block in the video stream;
[0014] The parsing unit is further configured to parse prediction mode indication information of a current block in the video stream, where the prediction mode indication information includes a prediction mode index of the current block;
[0015] a processing unit configured to, if the coding mode indication information indicates that the coding mode of the current block is the rearranged coding mode, rearrange the prediction mode list to obtain a rearranged prediction mode list;
[0016] The processing unit is further configured to determine a prediction mode of the current block in the reordered prediction mode list according to the prediction mode index of the current block;
[0017] The processing unit is further configured to predict the current block according to the prediction mode of the current block to obtain a prediction value of the current block; the prediction value of the current block is used to reconstruct a decoded image block of the current block.
[0018] On the other hand, an embodiment of the present application provides a video processing method, which includes:
[0019] Obtaining the coding mode indication information of the current block;
[0020] If the coding mode indication information indicates that the coding mode of the current block is the rearranged coding mode, rearrange the prediction mode list to obtain a rearranged prediction mode list;
[0021] Determining prediction mode indication information of the current block according to a prediction mode index corresponding to the prediction mode of the current block in the reordered prediction mode list; the prediction mode of the current block is used to predict the current block;
[0022] The coding mode indication information and the prediction mode indication information are encoded into the video bit stream.
[0023] In an embodiment of the present application, when the encoding mode of the current block is the rearranged encoding mode, by rearranging the prediction mode list, less information can be encoded when encoding the prediction mode index of the current block into the video code stream, thereby improving the encoding efficiency of the prediction mode index of the current block, thereby improving the video encoding efficiency.
[0024] Accordingly, an embodiment of the present application provides a video processing device, which includes:
[0025] An acquiring unit, configured to acquire coding mode indication information of a current block;
[0026] a processing unit configured to, if the coding mode indication information indicates that the coding mode of the current block is the rearranged coding mode, rearrange the prediction mode list to obtain a rearranged prediction mode list;
[0027] The processing unit is further configured to determine prediction mode indication information of the current block according to a prediction mode index corresponding to the prediction mode of the current block in the reordered prediction mode list; the prediction mode of the current block is used to predict the current block;
[0028] The processing unit is further configured to encode the coding mode indication information and the prediction mode indication information into the video code stream.
[0029] Accordingly, an embodiment of the present application provides a computer device, comprising:
[0030] a processor suitable for implementing a computer program;
[0031] A computer-readable storage medium storing a computer program; the computer-readable storage medium further storing a video stream generated by the computer program, wherein the computer program is suitable for being loaded by a processor and executing the aforementioned video processing method to decode the video stream; or, the computer program is suitable for being loaded by a processor and executing the aforementioned video processing method to generate a video stream, and storing the video stream in the computer-readable storage medium.
[0032] Accordingly, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program; the computer-readable storage medium also stores a video stream formed by the computer program, and when the computer program is read and executed by a processor of a computer device, the computer device executes the above-mentioned video processing method to decode the video stream; or, when the computer program is read and executed by the processor of the computer device, the computer device executes the above-mentioned video processing method to generate a video stream and store the video stream in the computer-readable storage medium.
[0033] Accordingly, an embodiment of the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the above-mentioned video processing method.
[0034] Accordingly, an embodiment of the present application provides a method for processing a video stream, wherein the video stream is decoded based on the above-mentioned video processing method, or the video stream is generated according to the above-mentioned video processing method.
[0035] In an embodiment of the present application, by rearranging the prediction mode list, less information can be encoded and decoded when encoding and decoding the prediction mode index of the current block, thereby improving the encoding and decoding efficiency of the prediction mode index of the current block, thereby improving the video encoding and decoding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] FIG1 is a flowchart of a video encoder provided in an embodiment of the present application;
[0037] FIG2 is a schematic diagram of a block division structure provided in an embodiment of the present application;
[0038] FIG3 is a schematic diagram of a block partitioning process provided by an embodiment of the present application;
[0039] FIG4 is a schematic diagram of an intra-frame angle prediction mode provided by an embodiment of the present application;
[0040] FIG5 is a schematic diagram of a prediction method for intra-frame angle prediction provided by an embodiment of the present application;
[0041] FIG6 is a schematic diagram of an inter-frame prediction provided by an embodiment of the present application;
[0042] FIG7 is a schematic diagram of an angle-weighted prediction provided by an embodiment of the present application;
[0043] FIG8 is a schematic diagram of angles supported by an angle weighting mode provided in an embodiment of the present application;
[0044] FIG9 is a schematic diagram of a reference weight configuration provided in an embodiment of the present application;
[0045] FIG10 is a schematic diagram of angle partitioning in an angle weighting mode provided in an embodiment of the present application;
[0046] FIG11 is a schematic diagram of the architecture of a video processing system provided in an embodiment of the present application;
[0047] FIG12 is a flow chart of a video processing method provided in an embodiment of the present application;
[0048] FIG13a is a schematic diagram of a current block template provided in an embodiment of the present application;
[0049] FIG13b is a flow chart of another video processing method provided in an embodiment of the present application;
[0050] FIG14 is a schematic structural diagram of a video processing device provided in an embodiment of the present application;
[0051] FIG15 is a schematic structural diagram of another video processing device provided in an embodiment of the present application;
[0052] FIG16 is a schematic structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] The following is an introduction to the technical terms involved in this application:
[0054] 1. Video encoding:
[0055] Video consists of one or more frames. A frame is an image, and each frame contains a portion of the video signal. Video is a signal that can be captured by a camera or generated by a computer. Due to the different statistical properties associated with these different acquisition methods, the compression encoding methods used for video may also differ.
[0056] Among mainstream video coding technologies, HEVC (High Efficiency Video Coding, an international video coding standard HEVC / H.265), VVC (Versatile Video Coding, an international video coding standard VVC / H.266), and AVS3 (Audio Video Coding Standard 3, China's national video coding standard) all use a hybrid coding framework that allows the following operations and processing on videos:
[0057] 1. Block Partition Structure: According to the size of the current input frame (i.e., the video frame being encoded or decoded), the current frame can be divided into several non-overlapping processing units, and each processing unit will perform similar compression operations. This processing unit is called CTU (Coding Tree Unit) or LCU (Largest Coding Unit). The CTU can be further divided into more refined parts to obtain one or more basic coding units, called CUs (Coding Units or Coding Blocks). Each CU is the most basic element in a coding and decoding link. The subsequent embodiments of this application describe various coding and decoding processing flows that may be used for each CU.
[0058] 2. Prediction coding: This includes intra-frame prediction and inter-frame prediction modes. The original video signal contained in the current CU in the current frame (i.e., the CU being encoded or decoded in the current frame, the current CU can also be called the current block) is predicted by the reconstructed video signal in the selected reference CU to obtain the residual video signal. The encoder needs to decide the most appropriate prediction coding mode for the current CU from among many possible prediction coding modes and inform the decoder. Among them, the prediction coding mode can include intra-frame prediction or inter-frame prediction:
[0059] (1) Intra-picture prediction: The reconstructed video signal used for prediction comes from the already coded and reconstructed area within the same video frame.
[0060] (2) Inter-picture prediction: The reconstructed video signal used for prediction comes from other video frames that have been encoded and are different from the current frame (called reference video frames).
[0061] 3. Transform Coding and Quantization: The residual video signal undergoes transform operations such as DFT (Discrete Fourier Transform) and DCT (Discrete Cosine Transform) to convert it into a transform domain, known as transform coefficients. The residual video signal in the transform domain is further subjected to a lossy quantization operation, which loses some information, making the quantized signal more suitable for compression.
[0062] In some video coding standards, there may be more than one transform method to choose from. Therefore, the encoder also needs to select one of the transforms for the current CU and inform the decoder. The degree of quantization is usually determined by the QP (Quantization Parameters). When the QP value is large, the transform coefficients representing a larger value range will be quantized to the same output, which usually results in greater distortion and lower bitrate. Conversely, when the QP value is small, the transform coefficients representing a smaller value range will be quantized to the same output, which usually results in less distortion and correspondingly higher bitrate.
[0063] 4. Entropy Coding or Statistical Coding: The quantized transform domain signal will be statistically compressed and encoded based on the frequency of occurrence of each value, and a binary (0 or 1) video stream will be output. At the same time, the encoding will generate other information, such as the selected prediction coding mode, motion vectors, etc. This other information also needs to be entropy encoded to reduce the bit rate. Among them, statistical coding is a lossless coding method that can effectively reduce the bit rate required to express the same signal. Common statistical coding methods include variable length coding (VLC) or context-based binary arithmetic coding (CABAC).
[0064] 5. Loop Filtering: The decoded image corresponding to the encoded CU can be reconstructed after undergoing inverse quantization, inverse transformation, and prediction compensation (the reverse operations of steps 2-4 in the above video encoding). Compared with the original image, the reconstructed decoded image has some information that is different from the original image due to the influence of quantization, resulting in distortion. Therefore, a filter can be used to filter the reconstructed decoded image to effectively reduce the degree of distortion caused by quantization. The filter can be, for example, a deblocking filter, SAO (Sample Adaptive Offset), or ALF (Adaptive Loop Filter). Since these filtered reconstructed decoded images will serve as reference CUs for other CUs that need to be encoded later and are used in the prediction process of other CUs, the above filtering operation is also called loop filtering, and the filtering operation within the encoding loop.
[0065] Based on the description of steps 1-5 in the above video encoding, the embodiment of the present application provides a basic working flow diagram of a video encoder, as shown in FIG1 , with the current block being the kth CU in the current frame (current image) (s shown in FIG1 ). k [x,y]) is used as an example for illustration, k is a positive integer, and k is less than or equal to the total number of CUs contained in the current frame. k [x, y] represents the pixel point (referred to as pixel) with coordinates [x, y] in the k-th CU, where x represents the horizontal coordinate of the pixel and y represents the vertical coordinate of the pixel; s k [x,y] can obtain the prediction signal after motion compensation or intra-frame prediction. and the original signal s k [x,y] is subtracted to obtain the residual video signal u k [x,y]; for the residual video signal u k [x,y] is transformed and quantized. The output data of the quantization process has two different destinations, A and B:
[0066] A: The data output by the quantization process can be sent to an entropy encoder for entropy encoding to obtain an encoded bit stream (i.e., a video bit stream), which is then output to a buffer for storage and waiting to be transmitted.
[0067] B. The data output by the quantization process can be dequantized and inversely transformed to obtain the residual video signal u′ after inverse transformation. k [x,y] The inverse transformed residual video signal u′ k [x,y] and prediction signal Add up to get a new prediction signal And the new prediction signal The new prediction signal can be sent to the buffer of the current image. After intra-frame prediction processing, we get The new prediction signal After loop filtering, the reconstructed signal s′ can be obtained k [x,y], and reconstruct the signal s′ k [x,y] is sent to the decoded image buffer for storage to generate the reconstructed video. Reconstructed signal s′ k [x,y] is obtained through motion compensation prediction in Can represent the reference block, m x and m y Represents the horizontal and vertical components of the motion vector of the reference block, respectively.
[0068] 2. Video decoding:
[0069] On the decoding side, for each CU, after obtaining the video bitstream, on the one hand, the video bitstream is first entropy decoded to obtain information on various predictive coding modes and quantized transform coefficients. Each transform coefficient is then dequantized and inversely transformed to obtain a residual video signal (also known as a residual value). On the other hand, based on the known predictive coding mode information, the prediction signal (also known as the prediction value) corresponding to the CU can be obtained. The residual video signal and the prediction signal are added to obtain a reconstructed video signal. This reconstructed video signal can be used to reconstruct the decoded image block corresponding to the CU. The reconstructed video signal needs to undergo a loop filtering operation to produce the final output signal.
[0070] The following is an introduction to the relevant background technologies involved in this application:
[0071] Current mainstream video coding standards, such as HEVC, VVC, and AVS3, all use a block-based hybrid coding framework. They divide the original video data into a series of coding blocks and combine video coding methods such as prediction, transform, and entropy coding to achieve video data compression.
[0072] 1. Block division structure:
[0073] In a block-based hybrid coding framework, video images are divided into several non-overlapping processing units (CTUs) for video compression. These units are called CTUs. CTUs can be further divided into one or more basic coding units (CUs). Each CU is a fundamental element in the coding process and can select different coding modes.
[0074] A block division structure of the HEVC video coding standard is shown in FIG2 , where a CTU can be divided downward in a quadtree manner.
[0075] The video coding standard AVS3 uses a basic block partitioning structure of QT (Quad-Tree Partition) + BT (Binary-Tree Partition) + EQT (Extended Quad-Tree Partition). In other words, in addition to supporting quadtree partitioning (QT), the video coding standard AVS3 also supports binary tree partitioning (BT) and extended quadtree partitioning (EQT). Binary tree partitioning (BT) can divide a CU into left and right or upper and lower sub-CUs; extended quadtree partitioning (EQT) includes both horizontal and vertical I-shaped partitioning methods, dividing a CU into four sub-CUs.
[0076] Figure 3 shows how the QT+BT+EQT basic block partitioning structure in the bitstream of the AVS3 video coding standard is represented. The QT partitioning is determined. If so, the partitioning is performed directly. If not, further determination is made as to whether no partitioning is required. If no partitioning is required, the determination is terminated. If partitioning is required, further determination is made as to whether extended quadtree (EQT) or binary tree (BT) partitioning is required. For both extended quadtree (EQT) and binary tree (BT) partitioning, determination is made as to whether the partitioning is horizontal or vertical.
[0077] Block partitioning is determined recursively, starting from the LCU and proceeding downwards. During this recursive process, the optimal partitioning method and encoding mode are determined through optimization at the encoder end.
[0078] 2. Intra-frame prediction:
[0079] Intra-frame prediction is a commonly used predictive coding technique. It uses spatial correlations between pixels in a video image to derive prediction values for the current coding block from adjacent coded regions. The second phase of the AVS3 video coding standard adopted the Extended Intra Prediction Mode (EIPM). The previous generation, AVS2, had 33 intra-frame prediction modes, including 30 angular modes and 3 special modes (Plane, DC, and Bilinear). These modes were encoded using the 2MPM (Most Probable Mode) encoding method, while the remaining modes used a 5-bit fixed-length encoding method. To support more refined angular prediction, AVS3 expanded the number of angular prediction modes to 62. As shown in Figure 4, the arrows point from the reference pixel to the pixel being predicted. The solid black arrows represent existing angular prediction modes, while the dashed black arrows represent newly added angular modes. The existing angular mode numbers remain unchanged, while the newly added angular modes are numbered 34 to 65.
[0080] When the angle prediction mode is used, the pixel points in the current prediction block use the reference pixel value of the corresponding position on the reference pixel row or column as the prediction value according to the direction corresponding to the angle of the prediction mode. As shown in Figure 5, for the pixel point P in the prediction block, the position of the reference pixel will be determined from the pixel row that has been encoded above according to the prediction angle in the figure, and the reference pixel value will be used as the prediction value of the pixel point P. Note that not all pixel positions point to reference pixel positions with integer pixel accuracy (for example, the reference pixel position of point P in the figure is a sub-pixel position between pixel B and pixel C). Therefore, the predicted pixel value at this position needs to be obtained by interpolation of the surrounding pixels. In order to improve the efficiency of intra-frame prediction, on-chip memory is usually used to store the reference pixels for intra-frame prediction.
[0081] 3. Inter-frame prediction:
[0082] As shown in Figure 6, inter-frame prediction uses the correlation in the video time domain and uses the adjacent coded image pixels to predict the pixels of the current image to effectively remove the video time domain redundancy, which can effectively save the bits of the coded residual data. Among them, P is the current frame, Pr is the reference frame, B is the current block, and Br is the reference block of B. B1 and B have the same coordinate position in the image, Br coordinates are (xr, yr), and B1 coordinates are (x, y). The displacement between the current block and its reference block is called the motion vector (MV), and the motion vector is calculated as follows: Formula 1: MV = (xr, yr) r -x,y r -y) Formula 1
[0083] 4. Angular Weighted Prediction (AWP) and Spatial Angular Weighted Prediction (SAWP):
[0084] The second phase of the AVS3 video coding standard adopted the AWP mode for inter-frame prediction and the SAWP mode for intra-frame prediction. Inter-frame prediction based on the AWP mode, as shown in Figure 7, uses intra-frame angular prediction to derive weight values for each pixel position. (This involves first setting reference weight values for the positions surrounding the current block (including integer and sub-pixel positions), and then using angular prediction to derive the corresponding weight value for each pixel position.) The resulting weights are then used to achieve weighted prediction of two different inter-frame prediction values. SAWP uses a similar method to derive weights for weighted prediction of two intra-frame prediction values.
[0085] In the video coding standard AVS3, under certain conditions (for example, when PictureAwpRefineIndex (the picture header index used to control whether to adjust the reference weight) is 0), the SAWP mode and the AWP mode can use the same weight derivation method. For the current block using the SAWP mode, sawp_index (weight prediction mode index), sawp_pred_mode0_index (first intra-frame prediction mode index), and sawp_pred_mode1_index (second intra-frame prediction mode index) can be decoded from the bitstream. Based on sawp_index, sawp_pred_mode0_index, and sawp_pred_mode1_index, the weight matrix of the SAWP mode and the intra-frame prediction mode of each part of the SAWP mode can be derived according to the following method for weighted prediction and intra-frame information storage.
[0086] 1. The method of deriving the weight matrix of SAWP mode:
[0087] The minimum block size supported by the angle weighting mode is 8, and the maximum block size is 64. A total of 8 angles are supported, as shown in Figure 8. The absolute values of the slopes of these 8 angles are five, namely {horizontal, vertical, 1, 2, 1 / 2}. Each angle supports 7 reference weight configurations. Therefore, for each block, the angle weighting mode has a total of 56 modes.
[0088] As shown in Figure 9, each of the seven reference weight configurations is a distribution function of the reference weight value obtained based on the reference weight index value, and a non-strictly monotonically increasing function is assigned with the 8-equal-division point position of the reference weight effective length as the reference point, where the reference weight effective length is calculated by the prediction angle and the current block size.
[0089] As shown in Figure 10, the eight angles in the angle weighting mode are divided into four partitions. The formula for deriving the pixel-by-pixel weights is slightly different depending on the area where the angle is located.
[0090] As mentioned above, for each block, there are 56 modes (weight matrices) for the angle weighting mode. AwpIndex exists in the bitstream to indicate the mode used by the current block. The parameters of the angle weighting mode can be determined based on AwpIndex according to the following formulas 2 to 5: stepIndex = (AwpIndex>>3)-3 Formula 2 modAngNum = AwpIndex%8 Formula 3 angleAreaIndex = modAngNum>>1 Formula 4
[0091] From these parameters the weights for the angle-weighted mode can be derived as follows:
[0092] (1) Calculate the effective length vL of the reference weight. The length of the reference weight is expressed using 1 / 2 pixel precision. For the first four angles (angleAreaIndex is equal to 0), the reference weight is located in the column to the left of the current block; for the last four angles (angleAreaIndex is equal to 1), the reference weight is located in the row above the current block. The calculation method of the effective length vL is as follows:
[0093] Table 1
[0094] (2) Fill in the reference weight Lw according to each position x (x<=vL), as shown in the following formulas 6 to 8 and Table 2: Lw[x]=clip3(0,8,(x-fp)<<shift) Formula 6 shift=PictureAwpRefineIndex?2:0 Formula 7 o=PictureAwpRefineIndex?3:1 Formula 8
[0095] Table 2
[0096] Among them, PictureAwpRefineIndex is the image header index used to control whether to adjust the reference weight.
[0097] (3) Fill the luminance weight matrix according to the reference weight. Let the luminance weight matrix be BwLuma(x,y), as shown in the following formula 9: BwLuma x,y =Lw[tP] Formula 9
[0098] For SAWP mode or AWP mode in B frame, the value of tP is determined according to Table 3 below:
[0099] Table 3
[0100] For the AWP mode in P frames, the value of tP is determined according to Table 4 below:
[0101] Table 4
[0102] (4) Fill the chrominance weight matrix BwChroma(x,y) according to the luminance weight matrix:
[0103] For SAWP mode or AWP mode in B frame, it is derived according to the following formula 10: BwChrome[x][y]=BwLuma[x<<1][y<<1] Formula 10
[0104] For the AWP mode in P frame, it is derived according to the following formula 11: BwChrome[x][y]=BwLuma[(x>>2)<<3][(y>>2)<<3] Formula 11
[0105] (5) Based on the derived weight matrix and the predicted value, calculate the weighted predicted value predResult(x,y) according to the following formula 12: predResult x,y =(predA x,y *Bw x,y +predB x,y *(8-Bw x,y )+4)>>3 Formula 12
[0106] 2. SAWP intra-frame prediction mode export method:
[0107] If the current prediction block E is a luminance block, let modAngNum=SawpIndex%8.
[0108] (1) Calculate the predicted value predIntraPredMode[i] of the prediction mode of the current prediction block. The value range of i is 0 to 1. predIntraPredMode[i] is also called the MPM list of SAWP.
[0109] A) Perform the following operations on intraPredModeA:
[0110] a. If the left prediction block A "exists" and is a normal intra-frame prediction, assign A's IntraLumaPredMode to intraPredModeA; otherwise, the value of intraPredModeA is equal to -1.
[0111] b. Perform mode validity processing on intraPredModeA.
[0112] c. If intraPredModeA is equal to -1, then intraPredModeA is equal to the candidate mode 0 corresponding to modAngNum in Table 5 below.
[0113] B) Perform the following operations on intraPredModeB:
[0114] a. If the prediction block B exists and is a normal intra prediction, assign B's IntraLumaPredMode to intraPredModeB; otherwise, the value of intraPredModeB is -1.
[0115] b. Perform mode validity processing on intraPredModeB.
[0116] c. If intraPredModeB is equal to -1, then intraPredModeB is equal to the candidate mode 0 corresponding to modAngNum in Table 5 below.
[0117] C) If intraPredModeA is equal to intraPredModeB, perform the following operations:
[0118] a. If intraPredModeA is not equal to the candidate mode 0 corresponding to modAngNum in Table 5 below, then intraPredModeA is equal to the candidate mode 0 corresponding to modAngNum in Table 5 below.
[0119] b. Otherwise, intraPredModeA is equal to candidate mode 1 corresponding to modAngNum in Table 5.
[0120] predIntraPredMode[0] is equal to Min(intraPredModeA, intraPredModeB), predIntraPredMode[1] is equal to Max(intraPredModeA, intraPredModeB).
[0121] (2) Calculate the value of SawpPredMode0, as shown in the following code:
[0122] (3) Calculate the value of SawpPredMode1, as shown in the following code:
[0123] This section performs the following mode validity processing on intraPredModeX, where X is A or B, as shown in the following code:
[0124] Table 5
[0125] 3. Intra-frame prediction information storage:
[0126] (1) Exporting spatial angle weighted prediction intra-frame brightness prediction mode storage method:
[0127] Let W and H be the width and height of the current coding unit, (x, y) be the top left pixel position of each 4×4 block in the current coding unit, pos_x equal to ((x>>2)<<2)+2, and pos_y equal to ((y>>2)<<2)+2. The intra luma prediction mode storage type SawpModeType for each 4×4 block is derived as follows:
[0128] A) Calculate the values of stepIndex, angleIndex, and angelAreaIndex as shown in the following code:
[0129] B) According to angleAreaIndex, query Table 6 below to obtain tP and fP, and calculate the intra-frame brightness prediction mode storage method SawpModeType for each 4×4 block in the current coding unit, as shown in the following code:
[0130] Table 6
[0131] (2) Spatial intra-frame prediction information storage:
[0132] Determine the upper left corner pixel position (x0, y0) of the spatial intra prediction information storage unit corresponding to the sample (x, y), as shown in Formula 13 and Formula 14: x0=(x>>2)<<2 Formula 13 y0=(y>>2)<<2 Formula 14
[0133] Let X be the prediction unit where the luma sample (x0, y0) is located. The intra luma prediction mode is stored in the spatial intra luma prediction mode storage unit corresponding to the sample (x, y) as follows:
[0134] A) The prediction type of the spatial intra prediction information storage unit is the prediction type of the current coding unit.
[0135] B) If the prediction unit where the luma sample (x0, y0) is located is normal intra prediction and SawpFlag is equal to 0, then the intra luma prediction mode of the spatial intra luma prediction mode storage unit is equal to IntraLumaPredMode.
[0136] C) Otherwise, if the prediction unit where the luma sample (x0, y0) is located is a normal intra prediction and SawpFlag is equal to 1, the spatial angle weighted prediction intra luma prediction mode storage method SawpModeType can be derived.
[0137] a. If SawpModeType is equal to 0, the intra-frame luma prediction mode of the spatial intra-frame luma prediction mode storage unit is equal to SawpPredMode0.
[0138] b. Otherwise (SawpModeType is equal to 1), the intra-frame luma prediction mode of the spatial intra-frame luma prediction mode storage unit is equal to SawpPredMode1.
[0139] D) Otherwise, if the prediction type of the current coding unit is block copy intra prediction, the block vector of the spatial domain intra prediction information storage unit is equal to the block vector of the current coding unit.
[0140] E) Otherwise, if the prediction type of the current coding unit is string copy intra prediction, the string vector of the spatial domain intra prediction information storage unit is equal to the string vector corresponding to the sample with coordinates (x0, y0+3).
[0141] 4. Export spatial angle weighted prediction samples:
[0142] The input of this section is the spatial angle weighted prediction brightness weight matrix SawpWeightMatrixY and chrominance weight matrix SawpWeightMatrixUV, the upper left corner sample position of the current prediction block (xE, yE), and the width W and height H of the current prediction block.
[0143] The output of this section is the weighted prediction sample matrix predMatrix.
[0144] If the current prediction block is a luma prediction block, the code is as follows:
[0145] If the current prediction block is a chroma prediction block, the code is as follows:
[0146] 5. Calculation method of SAWP MPM:
[0147] Calculate the prediction value predIntraPredMode[i] of the current prediction block prediction mode, where i ranges from 0 to 1.
[0148] (1) Perform the following operations on intraPredModeA:
[0149] A) If the left prediction block A "exists" and is a normal intra-frame prediction, assign A's IntraLumaPredMode to intraPredModeA; otherwise, the value of intraPredModeA is equal to -1.
[0150] B) Perform mode validity processing on intraPredModeA.
[0151] C) If intraPredModeA is equal to -1, then intraPredModeA is equal to the candidate mode 0 corresponding to modAngNum in Table 5 above.
[0152] (2) Perform the following operations on intraPredModeB:
[0153] A) If the upper prediction block B "exists" and is a normal intra-frame prediction, assign B's IntraLumaPredMode to intraPredModeB; otherwise, the value of intraPredModeB is equal to -1.
[0154] B) Perform mode validity processing on intraPredModeB.
[0155] C) If intraPredModeB is equal to -1, then intraPredModeB is equal to the candidate mode 0 corresponding to modAngNum in Table 5 above.
[0156] (3) If intraPredModeA is equal to intraPredModeB, perform the following operations:
[0157] A) If intraPredModeA is not equal to the candidate mode 0 corresponding to modAngNum in Table 5 above, then intraPredModeA is equal to the candidate mode 0 corresponding to modAngNum in Table 5 above.
[0158] B) Otherwise, intraPredModeA is equal to the candidate mode 1 corresponding to modAngNum in Table 5 above.
[0159] (4) predIntraPredMode[0] is equal to Min(intraPredModeA, intraPredModeB), predIntraPredMode[1] is equal to Max(intraPredModeA, intraPredModeB).
[0160] Based on the above description, an embodiment of the present application provides a video processing method. This video processing method proposes an adaptive angle weighting mode (DAWP) based on the spatial angle weighted prediction mode (SAWP). The adaptive angle weighting mode (DAWP) can rearrange the prediction modes of the spatial angle weighted prediction so that the prediction modes with a high probability of being used by the current block have a smaller index value in the prediction mode list, and designs a corresponding entropy coding method, which effectively reduces the coding bit overhead and decoding information amount of the prediction mode index, thereby improving video encoding and decoding efficiency. Specifically, the general principles of the video processing method are as follows:
[0161] At the encoding end: the coding mode indication information of the current block can be obtained; if the coding mode indication information indicates that the coding mode of the current block is a rearranged coding mode (i.e., adaptive angle weighted mode (DAWP)), the prediction mode list can be rearranged to obtain a rearranged prediction mode list. In the rearranged prediction mode list, the prediction mode with a higher probability of being used by the current block has a smaller value of the corresponding prediction mode index; the prediction mode index of the current block is determined based on the prediction mode index corresponding to the prediction mode of the current block in the rearranged prediction mode list; next, the coding mode indication information and the prediction mode index can be encoded into the video stream; the video stream can be sent to the decoding end.
[0162] At the decoding end: After receiving the video stream sent by the encoder, the coding mode indication information and the prediction mode index of the current block in the video stream can be parsed. If the coding mode indication information indicates that the coding mode of the current block is the rearranged coding mode (i.e., the adaptive angle weighted mode (DAWP)), the prediction mode list can be rearranged to obtain a rearranged prediction mode list. In the rearranged prediction mode list, the prediction mode with a higher probability of being used by the current block has a smaller corresponding prediction mode index value. Based on the prediction mode index of the current block, the prediction mode of the current block can be determined in the rearranged prediction mode list. The current block is predicted based on the prediction mode of the current block to obtain a prediction value of the current block. The prediction value of the current block can be used to reconstruct the decoded image block corresponding to the current block.
[0163] As can be seen from the above, in the video encoding and decoding process, the embodiment of the present application proposes a spatial angle weighted prediction mode (SAWP) based on rearrangement, namely, an adaptive angle weighted prediction mode (DAWP). By rearranging the prediction mode list, the prediction mode in the rearranged prediction mode list with a higher probability of being used by the current block has a smaller value of the corresponding prediction mode index; this makes the value of the prediction mode index actually used by the current block smaller, and when encoding and decoding the prediction mode index of the current block, less information is encoded and decoded, thereby improving the encoding and decoding efficiency of the prediction mode index of the current block, thereby improving the video encoding and decoding efficiency.
[0164] The video processing method proposed in the embodiment of the present application can be executed by the video processing system shown in Figure 11. As shown in Figure 11, the video processing system may include an encoding device 1101 and a decoding device 1102. The encoding device 1101 can be used to execute the process of the video processing method at the encoding end, and the decoding device 1102 can be used to execute the process of the video processing method at the decoding end.
[0165] A direct communication connection can be established between the encoding device 1101 and the decoding device 1102 by means of wired communication, or an indirect communication connection can be established between the encoding device 1101 and the decoding device 1102 by means of wireless communication. The encoding device 1101 can be a terminal or a server; the decoding device 1102 can be a terminal or a server. Among them, the terminal can be a mobile phone, a tablet computer, a laptop computer, a PDA, a mobile internet device (MID), a vehicle-mounted device, an aircraft, a wearable device (such as a smart watch, a smart bracelet, a pedometer, etc.), a virtual reality device (such as a VR (Virtual Reality) device, an AR (Augmented Reality) device), etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0166] The present application provides a video processing method, which introduces a decoding process at a decoding end. The video processing method can be executed by a computer device, which can be, for example, the decoding device 1102 in the video processing system shown in FIG11 . As shown in FIG12 , the video processing method can include but is not limited to the following steps S1201 to S1205:
[0167] S1201: Parse the coding mode indication information of the current block in the video stream.
[0168] The video bitstream is obtained by encoding the video, and the video refers to a sequence of images composed of multiple images. Each image in the video can be further divided into slices (or slices), which can be divided into a series of LCUs (or CTUs). The LCU (or CTU) can contain CUs, which are the basic coding units of the image. The current block refers to the image block currently being decoded, and the image block refers to the coding unit CU, which is the most basic element in the decoding process. The coding mode indication information of the current block can be used to indicate whether the coding mode of the current block is the rearrangement coding mode. The rearrangement coding mode refers to the adaptive angle weighting mode (DAWP).
[0169] The coding mode indication information may be located in a sequence header, a picture header, or a slice header of a video stream. A sequence header refers to information in a video stream used to indicate decoding of a picture sequence, a picture header refers to information in a video stream used to indicate decoding of a picture, and a slice header refers to information in a video stream used to indicate decoding of a slice. That is, the coding mode indication information may be a syntax element in a sequence header of a video stream, and the coding mode indication information included in the sequence header of the video stream may be used to indicate whether the current sequence (i.e., the picture sequence to which the current block belongs) uses the reordering coding mode; or, the coding mode indication information may be a syntax element in a picture header of a video stream, and the coding mode indication information included in the picture header of the video stream may be used to indicate whether the current picture (i.e., the picture to which the current block belongs) uses the reordering coding mode; or, the coding mode indication information may be a syntax element in a slice header of a video stream, and the coding mode indication information included in the slice header of the video stream may be used to indicate whether the current slice (i.e., the picture slice to which the current block belongs) uses the reordering coding mode. The following describes the coding mode indication information in the sequence header, picture header, or slice header of the video stream:
[0170] 1. The coding mode indication information is included in the sequence header of the video stream:
[0171] The coding mode indication information included in the sequence header of the video stream may include any one of the first coding mode indication information, the second coding mode indication information and the third coding mode indication information.
[0172] (1) First coding mode indication information: The first coding mode indication information may include a sequence header spatial angular weighted prediction mode flag (seq_sawp_flag) and a sequence header rearrangement-based angular weighted prediction mode flag (seq_dawp_flag); if the sequence header spatial angular weighted prediction mode flag is a first value (the first value may be 1, for example), and the sequence header rearrangement-based angular weighted prediction mode flag is a first value, then it may be determined that the coding mode indication information indicates that the coding mode of the current block is the rearrangement coding mode. The semantics of the first coding mode indication information are shown in Table 7 below:
[0173] Table 7
[0174] In Table 7 above, the sequence header spatial angle weighted prediction mode flag (seq_sawp_flag) is a binary variable; a value of '1' indicates that the SAWP mode can be used, and a value of '0' indicates that the SAWP mode should not be used; the value of SeqSawpFlag (SeqSawpFlag is a variable corresponding to the syntax element seq_sawp_flag) is equal to the value of seq_sawp_flag. If seq_sawp_flag does not exist in the bitstream, the value of SeqSawpFlag is 0. The sequence header rearrangement-based angle weighted prediction mode flag (seq_dawp_flag) is a binary variable; a value of '1' indicates that the DAWP mode can be used, and a value of '0' indicates that the DAWP mode should not be used; the value of SeqDawpFlag (SeqDawpFlag is a variable corresponding to the syntax element seq_dawp_flag) is equal to the value of seq_dawp_flag. If seq_dawp_flag does not exist in the bitstream, the value of SeqDawpFlag is 0.
[0175] The syntax of the first coding mode indication information is shown in Table 8 below:
[0176] Table 8
[0177] (2) Second coding mode indication information: The second coding mode indication information may include a sequence header spatial angle weighted prediction mode flag (seq_sawp_flag); if the sequence header spatial angle weighted prediction mode flag is a second value (the second value may be 2, for example), it may be determined that the coding mode indication information indicates that the coding mode of the current block is the reorder coding mode. The semantics of the second coding mode indication information are shown in Table 9-1 below:
[0178] Table 9-1
[0179] In Table 9-1 above, the sequence header spatial angle-weighted prediction mode flag (seq_sawp_flag) indicates the mode type of the angle-weighted prediction mode. A value of '0' indicates that SAWP should not be used. A value greater than '0' indicates that SAWP can be used and indicates whether DAWP is allowed. A value of '1' indicates that SAWP can be used but DAWP cannot be used. A value of '2' indicates that SAWP can be used and DAWP can be used. The value of SeqSawpFlag (SeqSawpFlag is a variable corresponding to the syntax element seq_sawp_flag) is equal to the value of seq_sawp_flag. If seq_sawp_flag does not exist in the bitstream, the value of SeqSawpFlag is 0.
[0180] (3) Third coding mode indication information: The third coding mode indication information includes a sequence header angle weighted prediction mode flag (seq_awp_flag), a sequence header spatial domain angle weighted prediction mode flag (seq_sawp_flag), and a sequence header rearrangement-based angle weighted prediction mode flag (seq_dawp_flag); if the sequence header angle weighted prediction mode flag or the sequence header spatial domain angle weighted prediction mode flag is a first value (the first value may be 1, for example), and the sequence header rearrangement-based angle weighted prediction mode flag is a first value, then it is determined that the coding mode indication information indicates that the coding mode of the current block is the rearrangement coding mode. The syntax of the third coding mode indication information is shown in Table 9-2 below:
[0181] Table 9-2
[0182] In Table 9-2 above, the sequence header spatial angle weighted prediction mode flag (seq_sawp_flag) is a binary variable; a value of '1' indicates that the SAWP mode can be used, and a value of '0' indicates that the SAWP mode should not be used; the value of SeqSawpFlag (SeqSawpFlag is a variable corresponding to the syntax element seq_sawp_flag) is equal to the value of seq_sawp_flag. If seq_sawp_flag does not exist in the bitstream, the value of SeqSawpFlag is 0. The sequence header angle weighted prediction mode flag (seq_awp_flag) is a binary variable; a value of '1' indicates that the AWP mode can be used, and a value of '0' indicates that the AWP mode should not be used; the value of SeqAwpFlag (SeqAwpFlag is a variable corresponding to the syntax element seq_awp_flag) is equal to the value of seq_awp_flag. If seq_awp_flag does not exist in the bitstream, the value of SeqAwpFlag is 0. The sequence header rearrangement-based angle weighted prediction mode flag (seq_dawp_flag) is a binary variable; a value of '1' indicates that the DAWP mode can be used, and a value of '0' indicates that the DAWP mode should not be used; the value of SeqDawpFlag (SeqDawpFlag is a variable corresponding to the syntax element seq_dawp_flag) is equal to the value of seq_dawp_flag. If seq_dawp_flag does not exist in the bitstream, the value of SeqDawpFlag is 0.
[0183] 2. The coding mode indication information is included in the picture header of the video stream:
[0184] The coding mode indication information included in the picture header of the video stream may include any one of the first coding mode indication information, the second coding mode indication information, the third coding mode indication information and the fourth coding mode indication information.
[0185] (1) First coding mode indication information: The first coding mode indication information may include a picture header angle weighted prediction mode flag (pic_sawp_flag) and a picture header angle weighted prediction mode flag based on realignment (pic_dawp_flag); if the picture header angle weighted prediction mode flag is a first value (the first value may be 1, for example), and the picture header angle weighted prediction mode flag based on realignment is a first value, then it may be determined that the coding mode indication information indicates that the coding mode of the current block is the realignment coding mode. The semantics of the first coding mode indication information are shown in Table 10 below:
[0186] Table 10
[0187] In Table 10 above, the picture header angle-weighted prediction mode flag (pic_sawp_flag) is a binary variable; a value of '1' indicates that the SAWP mode can be used; a value of '0' indicates that the SAWP mode should not be used; the value of PicSawpFlag (PicSawpFlag is a variable corresponding to the syntax element pic_sawp_flag) is equal to the value of pic_sawp_flag. If pic_sawp_flag does not exist in the bitstream, the value of PicSawpFlag is 0. The picture header angle-weighted prediction mode flag based on rearrangement (pic_dawp_flag) is a binary variable; a value of '1' indicates that the DAWP mode can be used; a value of '0' indicates that the DAWP mode should not be used; the value of PicDawpFlag (PicDawpFlag is a variable corresponding to the syntax element pic_dawp_flag) is equal to the value of pic_dawp_flag. If pic_dawp_flag does not exist in the bitstream, the value of PicDawpFlag is 0.
[0188] The syntax of the first coding mode indication information is shown in Table 11 below:
[0189] Table 11
[0190] (2) Second coding mode indication information: The second coding mode indication information may include a picture header angle weighted prediction mode flag (pic_sawp_flag); if the picture header angle weighted prediction mode flag is a second value (the second value may be 2, for example), it may be determined that the coding mode indication information indicates that the coding mode of the current block is the reorder coding mode. The semantics of the second coding mode indication information are shown in Table 12 below:
[0191] Table 12
[0192] In Table 12 above, the picture header angle-weighted prediction mode flag (pic_sawp_flag) indicates the mode type of the angle-weighted prediction mode. A value of '0' indicates that SAWP should not be used. A value greater than '0' indicates that SAWP can be used and indicates whether DAWP is allowed. A value of '1' indicates that SAWP can be used but DAWP cannot be used. A value of '2' indicates that SAWP can be used and DAWP can be used. The value of PicSawpFlag (PicSawpFlag is a variable corresponding to the syntax element pic_sawp_flag) is equal to the value of pic_sawp_flag. If pic_sawp_flag does not exist in the bitstream, the value of PicSawpFlag is 0.
[0193] (3) Third coding mode indication information: The video code stream may further include a sequence header, which may include a sequence header spatial angle weighted prediction mode flag (seq_sawp_flag), and the third coding mode indication information may include a picture header based on rearrangement angle weighted prediction mode flag (pic_dawp_flag); if the sequence header spatial angle weighted prediction mode flag is a first value (the first value may be 1, for example), and the picture header based on rearrangement angle weighted prediction mode flag is a first value, then it may be determined that the coding mode indication information indicates that the coding mode of the current block is the rearrangement coding mode. The semantics of the third coding mode indication information are shown in Table 13 below:
[0194] Table 13
[0195] In Table 13 above, the sequence header spatial angle weighted prediction mode flag (seq_sawp_flag) is a binary variable; a value of '1' indicates that the SAWP mode can be used, and a value of '0' indicates that the SAWP mode should not be used; the value of SeqSawpFlag (SeqSawpFlag is a variable corresponding to the syntax element seq_sawp_flag) is equal to the value of seq_sawp_flag. If seq_sawp_flag does not exist in the bitstream, the value of SeqSawpFlag is 0. The picture header reordering-based angle weighted prediction mode flag (pic_dawp_flag) is a binary variable; a value of '1' indicates that the DAWP mode can be used, and a value of '0' indicates that the DAWP mode should not be used; the value of PicDawpFlag (PicDawpFlag is a variable corresponding to the syntax element pic_dawp_flag) is equal to the value of pic_dawp_flag. If pic_dawp_flag does not exist in the bitstream, the value of PicDawpFlag is 0.
[0196] The syntax of the third coding mode indication information is shown in Table 14 below:
[0197] Table 14
[0198] (4) Fourth coding mode indication information: The video code stream may further include a sequence header, which may include a sequence header-based rearrangement angle weighted prediction mode flag (seq_dawp_flag), and the fourth coding mode indication information may include a picture header-based rearrangement angle weighted prediction mode flag (pic_dawp_flag); if the sequence header-based rearrangement angle weighted prediction mode flag is a first value (the first value may be 1, for example), and the picture header-based rearrangement angle weighted prediction mode flag is a first value, then it can be determined that the coding mode indication information indicates that the coding mode of the current block is the rearrangement coding mode. The semantics of the fourth coding mode indication information can be found in Table 15 below:
[0199] Table 15
[0200] In Table 15 above, the sequence header rearrangement-based angle-weighted prediction mode flag (seq_dawp_flag) is a binary variable; a value of '1' indicates that the DAWP mode can be used, and a value of '0' indicates that the DAWP mode should not be used; the value of SeqDawpFlag (SeqDawpFlag is a variable corresponding to the syntax element seq_dawp_flag) is equal to the value of seq_dawp_flag. If seq_dawp_flag does not exist in the bitstream, the value of SeqDawpFlag is 0. The picture header rearrangement-based angle-weighted prediction mode flag (pic_dawp_flag) is a binary variable; a value of '1' indicates that the DAWP mode can be used, and a value of '0' indicates that the DAWP mode should not be used; the value of PicDawpFlag (PicDawpFlag is a variable corresponding to the syntax element pic_dawp_flag) is equal to the value of pic_dawp_flag. If pic_dawp_flag does not exist in the bitstream, the value of PicDawpFlag is 0.
[0201] The semantics of the fourth coding mode indication information are shown in Table 16 below:
[0202] Table 16
[0203] 3. The coding mode indication information is included in the header of the video stream:
[0204] The coding mode indication information included in the slice header of the video stream may include any one of the first coding mode indication information, the second coding mode indication information, the third coding mode indication information and the fourth coding mode indication information.
[0205] (1) First coding mode indication information: The first coding mode indication information may include a slice header angle weighted prediction mode flag (slice_sawp_flag) and a slice header rearrangement-based angle weighted prediction mode flag (slice_dawp_flag); if the slice header angle weighted prediction mode flag is a first value (the first value may be 1, for example), and the slice header rearrangement-based angle weighted prediction mode flag is a first value, then it may be determined that the coding mode indication information indicates that the coding mode of the current block is the rearrangement coding mode. The semantics of the first coding mode indication information are shown in Table 17 below:
[0206] Table 17
[0207] In the above Table 17, the slice header angle weighted prediction mode flag (slice_sawp_flag) is a binary variable; a value of '1' indicates that the SAWP mode can be used; a value of '0' indicates that the SAWP mode should not be used; the value of SliceSawpFlag (SliceSawpFlag is a variable corresponding to the syntax element slice_sawp_flag) is equal to the value of slice_sawp_flag, and if slice_sawp_flag does not exist in the bitstream, the value of SliceSawpFlag is 0. The slice header rearrangement-based angle weighted prediction mode flag (slice_dawp_flag) is a binary variable; a value of '1' indicates that the DAWP mode can be used, and a value of '0' indicates that the DAWP mode should not be used; the value of SliceDawpFlag (SliceDawpFlag is a variable corresponding to the syntax element slice_dawp_flag) is equal to the value of slice_dawp_flag, and if slice_dawp_flag does not exist in the bitstream, the value of SliceDawpFlag is 0.
[0208] The syntax of the first coding mode indication information is shown in Table 18 below:
[0209] Table 18
[0210] (2) Second coding mode indication information: The second coding mode indication information may include a slice header angle weighted prediction mode flag (slice_sawp_flag). If the slice header angle weighted prediction mode flag is a second value (the second value may be 2, for example), it may be determined that the coding mode indication information indicates that the coding mode of the current block is the rearrangement coding mode. The semantics of the second coding mode indication information are shown in Table 19 below:
[0211] Table 19
[0212] In Table 19 above, the slice header angle-weighted prediction mode flag (pic_sawp_flag) indicates the mode type of the angle-weighted prediction mode. A value of '0' indicates that SAWP should not be used. A value greater than '0' indicates that SAWP can be used and indicates whether DAWP is allowed. A value of '1' indicates that SAWP can be used but DAWP cannot be used. A value of '2' indicates that SAWP can be used and DAWP can be used. The value of SliceSawpFlag (SliceSawpFlag is a variable corresponding to the syntax element slice_sawp_flag) is equal to the value of slice_sawp_flag. If slice_sawp_flag does not exist in the bitstream, the value of SliceSawpFlag is 0.
[0213] (3) Third coding mode indication information: The video code stream may further include a picture header, which may include a picture header angle-weighted prediction mode flag (pic_sawp_flag), and the third coding mode indication information may include a slice header angle-weighted prediction mode flag based on rearrangement (slice_dawp_flag); if the picture header angle-weighted prediction mode flag is a first value (the first value may be 1, for example), and the slice header angle-weighted prediction mode flag based on rearrangement is a first value, then the coding mode of the coding mode indication information may be determined to be the rearrangement coding mode. The semantics of the third coding mode indication information are shown in Table 20 below:
[0214] Table 20
[0215] In the above Table 20, the picture header angle weighted prediction mode flag (pic_sawp_flag) is a binary variable; a value of '1' indicates that the SAWP mode can be used, and a value of '0' indicates that the SAWP mode should not be used; the value of PicSawpFlag (PicSawpFlag is a variable corresponding to the syntax element pic_sawp_flag) is equal to the value of pic_sawp_flag, and if pic_sawp_flag does not exist in the bit stream, the value of PicSawpFlag is 0. The slice header rearrangement-based angle weighted prediction mode flag (slice_dawp_flag) is a binary variable; a value of '1' indicates that the DAWP mode can be used, and a value of '0' indicates that the DAWP mode should not be used; the value of SliceDawpFlag (SliceDawpFlag is a variable corresponding to the syntax element slice_dawp_flag) is equal to the value of slice_dawp_flag, and if slice_dawp_flag does not exist in the bitstream, the value of SliceDawpFlag is 0.
[0216] The syntax of the third coding mode information is shown in Table 21 below:
[0217] Table 21
[0218] (4) Fourth coding mode indication information: The video code stream may further include a picture header, which may include a picture header-based rearrangement angle weighted prediction mode flag (pic_dawp_flag), and the fourth coding mode indication information may include a slice header-based rearrangement angle weighted prediction mode flag (slice_dawp_flag); if the picture header-based rearrangement angle weighted prediction mode flag is a first value (the first value may be 1, for example), and the slice header-based rearrangement angle weighted prediction mode flag is a first value, then it can be determined that the coding mode of the coding mode indication information is the rearrangement coding mode. The semantics of the fourth coding mode indication information can be found in the following Table 22:
[0219] Table 22
[0220] In the above Table 22, the image header rearrangement-based angle weighted prediction mode flag (pic_dawp_flag) is a binary variable; a value of '1' indicates that the DAWP mode can be used, and a value of '0' indicates that the DAWP mode should not be used; the value of PicDawpFlag (PicDawpFlag is a variable corresponding to the syntax element pic_dawp_flag) is equal to the value of pic_dawp_flag, and if pic_dawp_flag does not exist in the bit stream, the value of PicDawpFlag is 0. The slice header rearrangement-based angle weighted prediction mode flag (slice_dawp_flag) is a binary variable; a value of '1' indicates that the DAWP mode can be used, and a value of '0' indicates that the DAWP mode should not be used; the value of SliceDawpFlag (SliceDawpFlag is a variable corresponding to the syntax element slice_dawp_flag) is equal to the value of slice_dawp_flag, and if slice_dawp_flag does not exist in the bitstream, the value of SliceDawpFlag is 0.
[0221] The syntax of the fourth coding mode indication information can be found in Table 23 below:
[0222] Table 23
[0223] It can be seen that the coding mode indication information can be included in syntax elements at different levels of the video code stream (sequence header at the sequence level, picture header at the picture level, or slice header at the slice level).
[0224] In addition, the coding mode indication information may also have a parsing condition. When the parsing condition is met, the coding mode indication information of the current block in the video stream may be parsed. The parsing condition may include any of the following: if the image type of the image to which the current block belongs is the first image type, it may indicate that the parsing condition is met, and the coding mode indication information of the current block in the video stream may be parsed; for example, when the image type of the image to which the current block belongs is an I frame (key frame), dawp_flag (for example, seq_dawp_flag, pic_dawp_flag, or slice_dawp_flag) needs to be parsed; for another example, when the image type of the image to which the current block belongs is a B frame (bidirectionally predicted interpolated coded frame), dawp_flag needs to be parsed; for another example, when the image type of the image to which the current block belongs is a B frame or a P frame (forward predicted coded frame), dawp_flag needs to be parsed. Alternatively, if the image type of the image to which the current block belongs is other than the second image type, it can be indicated that the parsing condition is met, and the coding mode indication information of the current block in the video stream can be parsed; for example, when the image type of the image to which the current block belongs is other than an I-frame, it is necessary to parse dawp_flag. The first image type and the second image type are the same or different, for example, the first image type and the second image type are both I-frames, or the first image type is a B-frame and the second image type is an I-frame.
[0225] S1202: Parse prediction mode indication information of a current block in a video stream, where the prediction mode indication information includes a prediction mode index of the current block.
[0226] The prediction mode indication information of the current block in the video code stream may include the prediction mode index of the current block. The prediction mode index of the current block may determine the prediction mode of the current block in the prediction mode list, and the prediction mode of the current block may be used to predict the current block. The prediction mode index of the current block may include the weighted prediction mode index of the current block and N intra-frame prediction mode indexes of the current block, where N is an integer greater than 1; correspondingly, the prediction mode list may include a weighted prediction mode list and N intra-frame prediction mode lists. The weighted prediction mode list may include multiple weighted prediction modes. The weighted prediction mode index of the current block may be used to determine the weighted prediction mode of the current block in the weighted prediction mode list, and the weighted prediction mode of the current block may be used to derive the weight matrix of the current block; the intra-frame prediction mode index of the current block may be used to determine the intra-frame prediction mode of the current block in the corresponding intra-frame prediction mode list, and the intra-frame prediction mode of the current block may be used to derive the intra-frame prediction value of the current block; the weight matrix of the current block and the N intra-frame prediction values of the current block may be used to predict the current block.
[0227] For example, the prediction mode index of the current block may include the weighted prediction mode index of the current block, the first intra-frame prediction mode index of the current block, and the second intra-frame prediction mode index of the current block; correspondingly, the prediction mode list may include the weighted prediction mode list, the first intra-frame prediction mode list, and the second intra-frame prediction mode list. The weighted prediction mode list may include multiple weighted prediction modes, the weighted prediction mode index of the current block may be used to determine the weighted prediction mode of the current block in the weighted prediction mode list, and the weighted prediction mode of the current block may be used to derive the weight matrix of the current block; the first intra-frame prediction mode index of the current block may be used to determine the first intra-frame prediction mode of the current block in the first intra-frame prediction mode list, and the first intra-frame prediction mode of the current block may be used to derive the first intra-frame prediction value of the current block; the second intra-frame prediction mode index of the current block may be used to determine the second intra-frame prediction mode of the current block in the second intra-frame prediction mode list, and the second intra-frame prediction mode of the current block may be used to derive the second intra-frame prediction value of the current block; the weight matrix of the current block, the first intra-frame prediction value of the current block, and the second intra-frame prediction value of the current block may be used to predict the current block.
[0228] This section describes the parsing of the prediction mode indication information for the current block in a video stream. For any prediction mode list (including a weighted prediction mode list or any intra-frame prediction mode list), that is, for any prediction mode index (including a weighted prediction mode index or any intra-frame prediction mode index) for the current block, the prediction mode indication information for the current block in the video stream can be parsed in any of the following ways:
[0229] (1) When the number of prediction mode lists is one, parse the prediction mode index of the current block in the video stream. For example, when the prediction mode list includes a weighted prediction mode list and the number of weighted prediction mode lists is one, parse the weighted prediction mode index (sawp_index) of the current block in the video stream. For another example, when the prediction mode list includes a first intra-frame prediction mode list and the number of first intra-frame prediction mode lists is one, parse the first intra-frame prediction mode index (sawp_pred_mode0_index) of the current block in the video stream.
[0230] (2) When there are multiple prediction mode lists, the prediction mode indication information of the current block may further include the prediction mode list index of the current block, the prediction mode list index of the current block parsed in the video code stream, and the prediction mode index of the current block parsed in the video code stream; the prediction mode list corresponding to the prediction mode list index of the current block is the available prediction mode list.
[0231] For example, when the prediction mode list includes a weighted prediction mode list, and the number of weighted prediction mode lists is multiple, the weighted prediction mode list index (sawp_list_index) of the current block and the weighted prediction mode index (sawp_index) of the current block in the video stream are parsed, and the weighted prediction mode list corresponding to the weighted prediction mode list index (sawp_list_index) of the current block is the available weighted prediction mode list. The syntax is shown in Table 24 below:
[0232] Table 24
[0233] For another example, when the prediction mode list includes a first intra-frame prediction mode list, and there are multiple first intra-frame prediction mode lists, the first intra-frame prediction mode list index (sawp_pred_mode0_list_index) of the current block and the first intra-frame prediction mode index (sawp_pred_mode0_index) of the current block in the video code stream are parsed, and the first intra-frame prediction mode list corresponding to the first intra-frame prediction mode list index (sawp_pred_mode0_list_index) of the current block is the first available intra-frame prediction mode list. The syntax is shown in Table 25 below:
[0234] Table 25
[0235] In particular, for the case of multiple weight prediction mode lists, the prediction mode list may include a weight prediction mode list, and the multiple weight prediction mode lists belong to different weight prediction mode types; the prediction mode index may include a weight prediction mode index; and the weight prediction mode index of the current block in the video code stream under each weight prediction mode type may be parsed.
[0236] For example, multiple weight prediction mode lists may include a weight angle prediction mode list and a reference weight configuration mode list, which may parse the weight angle prediction mode index (sawp_angle_index) and reference weight configuration mode index (sawp_step_index) of the current block in the video stream. Optionally, multiple weight prediction mode lists may also include a reference weight derivation function list (or a blending region width list), which may also parse the reference weight derivation function index (or a blending region width index, sawp_blend_index) of the current block in the video stream. The syntax is shown in Table 26 below:
[0237] Table 26
[0238] In particular, in the case of multiple intra-frame prediction mode lists, the prediction mode lists may include intra-frame prediction mode lists, and the multiple intra-frame prediction mode lists may belong to two types: most probable mode (MPM) and non-most probable mode (non-MPM); the prediction mode index may include an intra-frame prediction mode index. If the intra-frame prediction mode index of the current block belongs to the non-most probable mode type, the intra-frame prediction mode list index (sawp_pred_mode0_list_index) of the current block in the video bitstream is parsed, and the intra-frame prediction mode index (sawp_pred_mode0_index) of the current block in the video bitstream is parsed.
[0239] For example, there are five first intra prediction mode lists, the first list is the MPM list, and the next four lists are non-MPM lists. The video bitstream contains the index of the first available intra prediction mode list, which is only decoded in the case of the non-MPM list. The syntax is shown in Table 27 below:
[0240] Table 27
[0241] Optionally, when the prediction mode list includes a combined prediction mode list (the combined prediction mode list is obtained by combining the weighted prediction mode in the weighted prediction mode list and the intra-frame prediction mode in the intra-frame prediction mode list (for example, the intra-frame prediction mode list may include the first intra-frame prediction mode list and the second intra-frame prediction mode list)), the prediction mode index of the current block includes the combined prediction mode index of the current block, and the weighted prediction mode index and the intra-frame prediction mode index of the current block (for example, the intra-frame prediction mode index may include the first intra-frame prediction mode index and the second intra-frame prediction mode index) can be determined from the prediction mode list according to the combined prediction mode index of the current block.
[0242] The above step S1202 describes the situation of parsing the prediction mode indication information of the current block in the video stream. Next, the decoding method of the prediction mode indication information is introduced. The decoding method used for the prediction mode indication information can include any of the following:
[0243] The first method is to use variable-length code decoding in whole or in part, for example, k-order exponential Golomb decoding, truncated unary code decoding, or truncated binary code decoding.
[0244] The second method is to use fixed-length code decoding in whole or in part.
[0245] The third type is that the prediction mode indication information includes a prefix and a suffix, and the prefix and the suffix use different decoding methods. For the third case, it can include any of the following:
[0246] ① The prefix of the index in the prediction mode indication information is the group number, and the suffix is the intra-group index. The group number and the intra-group index use different decoding methods.
[0247] Assume the total number of prediction modes obtained by decoding is sig_mode (sig_mode is less than or equal to the total number of prediction modes), encode sig_mode using group coding, and assume that each group has sig_divisor elements, then there are a total of sig_group = Ceil(sig_mode / sig_divisor) groups. The total number of modes obtained by decoding sig_mode and the grouping method (e.g., the number of modes in each group, or the number of groups) can be indicated in higher-level syntax (e.g., sequence header, picture header, slice header, etc.).
[0248] For example, for the weighted prediction mode, the number of weighted prediction modes is 56, and the total number of decoded prediction modes is 56. The total number of decoded prediction modes is divided into 7 groups, with 8 weighted prediction modes in each group. The group number is decoded using truncated unary code, and the index within the group is decoded using truncated binary code; or, the group number is decoded using context-based binary decoding, and the index within the group is decoded using bypass mode. For another example, for the weighted prediction mode, the number of weighted prediction modes is 56, and the total number of decoded prediction modes is 28. The total number of decoded prediction modes is divided into 7 groups, with 4 weighted prediction modes in each group. The group number is decoded using truncated unary code, and the index within the group is decoded using truncated binary code; or, the group number is decoded using context-based binary decoding, and the index within the group is decoded using bypass mode.
[0249] ② The index in the prediction mode indication information is a binary string. The prefix of the index in the prediction mode indication information is the partial index of the binary bit before the target bit (th), and the suffix of the index in the prediction mode indication information is the remaining portion (i.e., the partial index of the binary bit after the target bit). For example, the partial index before the target bit (th) uses context-based binary decoding, and the partial index after the target bit uses bypass mode decoding.
[0250] S1203: If the coding mode indication information indicates that the coding mode of the current block is the rearranged coding mode, the prediction mode list is rearranged to obtain a rearranged prediction mode list.
[0251] The prediction mode list includes multiple prediction modes and a prediction mode index corresponding to each prediction mode. In the rearranged prediction mode list, a prediction mode with a higher probability of being used by the current block has a smaller value of its corresponding prediction mode index.
[0252] Not all prediction modes in the prediction mode list may be used by the current block. Therefore, there is no need to rearrange the entire prediction mode list. An available prediction mode list may be determined in the prediction mode list. The available prediction mode list refers to a list of prediction modes that may be used by the current block among the prediction modes included in the prediction mode list. The available prediction mode list is rearranged to obtain a rearranged prediction mode list. Step S1203 may include sub-steps s11 and s12:
[0253] s11, determining an available prediction mode list in the prediction mode list.
[0254] The prediction mode list may include a weighted prediction mode list and N intra-frame prediction mode lists. For any prediction mode list (weighted prediction mode list or any intra-frame prediction mode list), a method of determining an available prediction mode list in the prediction mode list may include any of the following:
[0255] (1) According to the available indication information obtained by parsing the video code stream, the available prediction mode list is determined in the prediction mode list. For example, for the weighted prediction mode list, the available indication information may be the weighted prediction mode list index (sawp_list_index) of the current block, and the weighted prediction mode list corresponding to the weighted prediction mode list index of the current block is an available weighted prediction mode list among multiple weighted prediction mode lists. For another example, for the first intra-frame prediction mode list, the available indication information may be the first intra-frame prediction mode list index (sawp_pred_mode0_list_index) of the current block, and the first intra-frame prediction mode list corresponding to the first intra-frame prediction mode list index (sawp_pred_mode0_list_index) of the current block is the first intra-frame prediction mode list available among multiple first intra-frame prediction mode lists.
[0256] (2) Determine the available prediction mode list in the prediction mode list according to the available determination rule, where the available determination rule is agreed upon by the encoding device and the decoding device.
[0257] (3) According to the prediction mode index that meets the availability condition in the prediction mode list, an available prediction mode list is determined in the prediction mode list.
[0258] Specifically, the prediction mode indexes in the prediction mode list can be divided into different groups; wherein, the prediction mode indexes in the prediction mode list satisfying the availability condition means that the sequence number of the group to which the prediction mode indexes in the prediction mode list belong is an available sequence number. The grouping method may include any of the following:
[0259] a. Given a preset value, calculate the quotient of the prediction mode index in the prediction mode index list and the preset value, and divide the prediction mode indexes with the same quotient into the same group. It can be described as, given a preset value d and a target value T = {t1, t2, ..., tn}, derive a list of Floor(mode_index / d) = ti(i∈[0,n]), where mode_index represents the prediction mode index. For example, when the prediction mode index (mode_index) is a weighted prediction mode index (sawp_inde), the weighted prediction mode list contains 56 weighted prediction modes, and the weighted prediction mode indexes of the 56 weighted prediction modes are 56 integers from 0 to 55. Let d = 8, T = {0, 1, 2, 3, 4, 5, 6}, then 7 groups of lists can be obtained, as shown in Table 28 below:
[0260] Table 28
[0261] For example, in the list shown in Table 28 above, the available serial number is 6, that is, the weight prediction modes corresponding to weight prediction mode indices 48, 49, 50, 51, 52, 53, 54 and 55 can be used as weight prediction modes in the available weight prediction mode list.
[0262] b. Given a preset value, calculate the modulus of the prediction mode index and the preset value in the prediction mode index list, and divide the prediction mode indexes with the same modulus into the same group. It can be described as follows: given a preset value d and a target value T = {t1, t2, ..., tn}, derive a list of mode_index%d = ti (i∈[0,n]), where mode_index represents the prediction mode index. For example, when the prediction mode index (mode_index) is a weighted prediction mode index (sawp_index), the weighted prediction mode list contains 56 weighted prediction modes, and the weighted prediction mode indexes of the 56 weighted prediction modes are 56 integers from 0 to 55. Let d = 8, T = {0, 1, 2, 3, 4, 5, 6, 7}, then 8 groups of lists can be obtained, as shown in Table 29 below:
[0263] Table 29
[0264] For example, in the list shown in Table 29 above, the available serial number is 6, that is, the weight prediction modes corresponding to weight prediction mode indices 6, 14, 22, 30, 38, 46 and 54 can be used as weight prediction modes in the available weight prediction mode list.
[0265] It should be noted that, for (3) in sub-step s11, the prediction mode index in the prediction mode list may be the original prediction mode index, or may be an adjusted prediction mode index. For example, for the intra-frame prediction mode list, the original intra-frame prediction mode list may contain 66 intra-frame prediction modes, and 66 integers in the range of 0-65 may be used to set the intra-frame prediction mode indexes of the 66 intra-frame prediction modes. However, the present application may use the 26 intra-frame prediction modes in the original intra-frame prediction mode list to set the intra-frame prediction mode list; the intra-frame prediction mode in the intra-frame prediction mode list of the present application may use its intra-frame prediction mode index in the original intra-frame prediction mode list (i.e., the original intra-frame prediction mode index); or, the intra-frame prediction mode in the intra-frame prediction mode list of the present application may re-use 26 integers in the range of 0-25 to re-set the intra-frame prediction mode indexes of the 26 intra-frame prediction modes (i.e., the adjusted intra-frame prediction mode indexes).
[0266] In particular, for the weight prediction mode list, the number of weight prediction mode lists can be multiple, and the multiple weight prediction mode lists belong to different weight prediction mode types; when determining the available weight prediction mode list in the weight prediction mode list, the available weight prediction mode lists can be determined separately in the weight prediction mode lists under different weight prediction mode types. For example, the weight prediction mode list can include a weight angle prediction mode list and a reference weight configuration list, the weight angle prediction mode list includes 8 weight angle prediction modes, and the reference weight configuration list includes 7 reference weight configuration modes. The available prediction mode lists can be derived for the weight angle prediction mode list and the reference weight configuration list respectively.
[0267] In particular, for the intra prediction mode list, the method for determining the available prediction mode list in the prediction mode list may further include: determining the available intra prediction mode list in the intra prediction mode list based on the adjacent reconstructed blocks of the current block (the adjacent reconstructed blocks refer to image blocks that are adjacent to the current block in the image to which the current block belongs and for which the corresponding decoded image blocks have been reconstructed) or the weighted prediction mode of the current block. For example, for the first intra prediction mode list, a total of 26 first intra prediction modes are preset (the first intra prediction mode index of the first intra prediction mode is encoded as 5-30); MPM list 1 (including 2 first intra prediction modes) may be derived based on the adjacent reconstructed blocks of the current block or the weighted prediction mode of the current block, and the remaining 24 first intra prediction modes are used as available first intra prediction modes, and the corresponding first intra prediction mode indexes may be numbered 0-23 and divided into 4 groups according to mode_index / d=ti, where d=6 and ti={0,1,2,3}, resulting in a total of 5 groups of lists.
[0268] In addition, for the intra-frame prediction mode list, the intra-frame prediction mode list may include a first intra-frame prediction mode list and a second intra-frame prediction mode list. If the first intra-frame prediction mode of the current block has been determined in the first intra-frame prediction mode list, a method for determining the available second intra-frame prediction mode list in the second intra-frame prediction mode list may include: after deleting the first intra-frame prediction mode of the current block from the second intra-frame prediction mode list, determining the available second prediction mode list in the deleted second intra-frame prediction mode list. In other words, the second intra-frame prediction mode list does not include the first intra-frame prediction mode of the current block.
[0269] s12, reordering the available prediction mode list to obtain a reordered prediction mode list.
[0270] After determining the available prediction mode list in the prediction mode list, not all available prediction mode lists need to be rearranged. Therefore, the first prediction mode list that needs to be rearranged and the second prediction mode list that does not need to be rearranged can be determined in the available prediction mode list, and the first prediction mode list that needs to be rearranged is rearranged to obtain the rearranged first prediction mode list. For example, the prediction mode list may include a weighted prediction mode list, a first intra-frame prediction mode list, and a second intra-frame prediction mode list. The weighted prediction mode list may be rearranged, and the first intra-frame prediction mode list and the second intra-frame prediction mode list may not be rearranged; or, the weighted prediction mode list, the first intra-frame prediction mode list, and the second intra-frame prediction mode list may all be rearranged. Optionally, the weighted prediction mode list may include a weighted angle prediction mode list, a reference weight configuration list, and a weighted mixed area list. The weighted angle prediction mode list, the reference weight configuration list, or the weighted mixed area list may be rearranged separately.
[0271] Before reordering, the reordering coding mode (i.e., DAWP mode) of the current block can be checked for availability to confirm the availability of the reordering coding mode of the current block; if the reordering coding mode of the current block is available, the first prediction mode list that needs to be reordered and the second prediction mode list that does not need to be reordered can be determined in the available prediction mode list, and the first prediction mode list that needs to be reordered can be reordered; if the reordering coding mode of the current block is not available, no reordering is required, and the prediction mode of the current block can be determined in the available prediction mode list based on the prediction mode index of the current block.
[0272] The availability check may include at least one of the following: first, if the samples of the current block template used to determine that the current block corresponds to the current block have been reconstructed, then it can be determined that the reordering coding mode of the current block is available; wherein, the samples of the current block template used to determine that the current block corresponds to the current block may include at least one of the following: samples to the left of the current block and samples above the current block. Second, if the size of the current block meets the size condition, then it can be determined that the reordering coding mode of the current block is available. Third, if the image component of the current block meets the component condition, then it can be determined that the reordering coding mode of the current block is available; for example, if the chrominance component of the current block meets the component condition, then it can be determined that the reordering coding mode of the current block is available.
[0273] Optionally, confirming the availability of the reorder coding mode for the current block may also be performed before parsing the prediction mode indication information for the current block in the video stream. In this case, the availability of the reorder coding mode for the current block is related to the decoding method of the prediction mode indication information for the current block in the video stream. For example, if the reorder coding mode for the current block is available, a variable-length code decoding method may be used when parsing the prediction mode indication information for the current block in the video stream. If the reorder coding mode for the current block is not available, a fixed-length code decoding method may be used when parsing the prediction mode indication information for the current block in the video stream.
[0274] Next, we will introduce methods for reordering the first prediction mode list that needs to be reordered. The first prediction mode list that needs to be reordered may include a weighted prediction mode list; alternatively, the first mode list that needs to be reordered may include a weighted prediction mode list, a first intra-frame prediction mode list, and a second intra-frame prediction mode list. The reordering methods for these two situations are described below.
[0275] When the first prediction mode list to be rearranged includes a weighted prediction mode list, the process of rearranging the first prediction mode list to be rearranged may include the following steps 1 to 4:
[0276] 1. Get the current block template corresponding to the current block.
[0277] The current block template corresponding to the current block refers to the reconstructed samples (or pixels) surrounding the current block. The current block template can be determined in the reconstructed region surrounding the current block. As shown in FIG13a , the current block template can include at least one of the following: First, one or more rows of samples located above the current block in the reconstructed region; for example, the current block template is M (M is an integer greater than 1) rows of samples above the current block (e.g., including the upper left, upper right, upper left, and upper right), with a width and height of (tw0, th0). Second, one or more columns of samples located to the left of the current block in the reconstructed region; for example, the current block template is M (M is an integer greater than 1) columns of samples to the left of the current block (including the upper left, lower left, upper left, and lower left), with a width and height of (tw1, th1). Third, the current block template is obtained by sampling at a fixed interval in the reconstructed region; for example, the current block template is sampled at a fixed interval, for example, every other row (or column). The fourth type is the samples located to the left and above the current block in the reconstructed area; for example, the samples to the left and above the current block can be used at the same time, for example, the current block template is the samples in a row above and a column to the left of the current block, and the width and height of the current block template are consistent with the width and height of the current block.
[0278] Optionally, the samples in the current block template may be subjected to correction processing, and the correction processing may include but is not limited to at least one of the following: filtering, linear mapping, and nonlinear mapping, etc.
[0279] 2. Determine the prediction value of the current block template under different weight prediction modes in the weight prediction mode list.
[0280] The process of determining the predicted value of the current block template in any weighted prediction mode may include:
[0281] (1) Determine the weight template of the current block template in the weight prediction mode:
[0282] Determine the weight template of the current block template in the combined prediction mode, which can include any of the following:
[0283] A. Derive the weight template of the current block template according to the weight prediction mode. The relative position relationship between the current block template and the current block needs to be considered.
[0284] In this case, this could include any of the following:
[0285] ① deriving a weight matrix for the current block template according to the weight prediction mode; determining a weight template for the current block template according to the weight matrix and a weight threshold. For example, a weight threshold may be set such that weights in the weight matrix greater than or equal to the weight threshold are set to 1, and weights less than the weight threshold are set to 0.
[0286] ②Derive the weight matrix of the current block template according to the weight prediction mode. The weight prediction mode may include a weight prediction angle mode and a reference weight configuration mode; determine the division center position (cp) of the weight matrix according to the weight prediction angle mode and the reference weight configuration mode, and determine the projection position (tp) of each sample point in the weight matrix in the weight prediction angle mode; the weight matrix may be adjusted according to the relationship between the division center position and the projection position to obtain the weight template of the current block template in the weight prediction mode.
[0287] Further, adjusting the weight matrix according to the relationship between the division center position and the projection position to obtain the weight template of the current block template in the weight prediction mode may include: if tp < cp, the weight of the sample point corresponding to the current block template is the first value, otherwise it is the second value. The settings of the first value and the second value are related to the accuracy of the weight; when the weight is the first value, the predicted value of the current block template is equal to the predicted value within the second frame, and when the weight is the second value, the predicted value of the current block template is equal to the predicted value within the first frame. For example, for the weighted prediction formula Pred = P0 * w + P1 * (1 - w), the first value is 0 and the second value is 1. For the weighted prediction formula Pred = (P0 * w + P1 * (8 - w)) / 8, the first value is 0 and the second value is 8. For the weighted prediction formula Pred = (P0 * w + P1 * (32 - w)) / 32, the first value is 0 and the second value is 32.
[0288] B. The weight templates of the current block template in different combined prediction modes have been cached, and the weight template of the current block template in the combined prediction mode can be directly initialized from the cache.
[0289] (2) Determine the available intra prediction mode list according to the weight prediction mode:
[0290] Specifically, the MPM list (Most Probable Mode list) and the non-MPM list (non-probable mode list) can be derived according to the weight prediction mode. The available intra prediction mode list can be determined from the MPM list (Most Probable Mode list) and the non-MPM list (non-probable mode list).
[0291] If the MPM list indication flag (sawp_pred_mode0_is_mpm) in the video bitstream indicates that the intra prediction mode belongs to the MPM list (for example, sawp_pred_mode0_is_mpm is 1), then the MPM list can be determined as the available intra prediction mode list.
[0292] If the MPM list indication flag (sawp_pred_mode0_is_mpm) in the video stream indicates that the intra prediction mode belongs to the non-MPM list (for example, sawp_pred_mode0_is_mpm is 1), the available intra prediction mode list can be determined in the non-MPM list according to the intra prediction mode list index of the current block in the video stream. For example, the available first intra prediction mode list can be determined in the non-MPM list according to the first intra prediction mode list index (sawp_pred_mode0_list_index) of the current block; and the available second intra prediction mode list can be determined in the non-MPM list according to the second intra prediction mode list index (sawp_pred_mode1_list_index) of the current block.
[0293] (3) Determine the intra prediction mode of the current block template in the available intra prediction mode list:
[0294] In detail, the intra prediction mode of the current block template may be determined in the available intra prediction mode list according to the intra prediction mode index of the current block.
[0295] For example, in the case where the available prediction mode list is an MPM list, the first intra-frame prediction mode of the current block template can be determined in the MPM list according to the first intra-frame prediction mode index (sawp_pred_mode0_mpm_index) of the current block; the second intra-frame prediction mode of the current block template can be determined in the MPM list according to the second intra-frame prediction mode index (sawp_pred_mode1_mpm_index) of the current block.
[0296] For another example, in the case where the available prediction mode list is a non-MPM list, the first intra-frame prediction mode of the current block template can be determined in the available first intra-frame prediction mode list according to the first intra-frame prediction mode index (sawp_pred_mode0_index) of the previous block; the second intra-frame prediction mode of the current block template can be determined in the available second intra-frame prediction mode list according to the second intra-frame prediction mode index (sawp_pred_mode1_index) of the current block.
[0297] (4) According to the intra prediction mode of the current block template, determine the intra prediction value under the current block template:
[0298] Determining the intra prediction value of the current block template in the combined prediction mode can include any of the following:
[0299] A. Determine the position of the prediction template and derive the intra-frame prediction value of the current block template according to the intra-frame prediction mode that constitutes the combined prediction mode. This may include:
[0300] ① Determine the position of the prediction template of the current block template.
[0301] The position of the prediction template may correspond to the position of the current block template; or, the position of the prediction template may not correspond to the position of the current block template. For example, in order to reduce complexity, a prediction template located within the current block may be used.
[0302] ② Determine the reference sample points used for intra-frame prediction of the current block template based on the position of the prediction template.
[0303] Optionally, the reference samples may be subjected to correction processing, and the correction processing may include but is not limited to: filtering, linear mapping, nonlinear mapping, and the like.
[0304] ③ According to the intra-frame prediction mode of the current block template, the intra-frame prediction value of the current block template is derived according to the reference sample points.
[0305] Specifically, a specific intra-frame interpolation filter can be used to derive the prediction value of the current block template based on the reference sample. For example, a bilinear interpolation filter can be used. For another example, any of all available intra-frame interpolation filters supported by SAWP can be used.
[0306] Alternatively, the same intra-frame interpolation filter as that used for the current block may be used to derive a prediction value for the current block template based on the reference sample. If the current block uses multiple intra-frame interpolation filters to derive an intra-frame prediction value, one of the intra-frame interpolation filters may be used to derive the intra-frame prediction value. For example, the intra-frame interpolation filters used for the reference sample may be sorted (e.g., from small to large) based on the position of the reference sample (including horizontal coordinates, vertical coordinates, or a straight line), and the i-th intra-frame interpolation filter may be used.
[0307] B. The intra-frame prediction values of the current block template in different weight prediction modes have been cached, and the intra-frame prediction values of the current block template in the weight prediction mode can be directly derived from the cache.
[0308] It should be noted that when determining the intra-prediction value of the current block template in combined prediction mode, if the intra-prediction mode index is the adjusted intra-prediction mode index, the corresponding intra-prediction mode index must be derived. For example, there are 66 intra-prediction modes, and SAWP only allows the use of 26 of them; these 26 modes are divided into two lists, the first list being the MPM list, and the remaining modes forming the second list. If the rearranged coding mode is used in the second list, the specific intra-prediction mode to be used must be confirmed in the second list based on the adjusted intra-prediction mode index.
[0309] (5) Perform weighted prediction on the intra-frame prediction value according to the weight template to obtain the prediction value of the current block template in the weight prediction mode:
[0310] After determining the weight template of the current block template in the weight prediction mode and determining the intra-frame prediction value of the current block template in the weight prediction mode, the intra-frame prediction value can be weighted predicted according to the weight template to obtain the prediction value of the current block template in the weight prediction mode.
[0311] 3. Determine the cost information of the current block template under different weight prediction modes according to the difference between the predicted value of the current block template under different weight prediction modes and the reconstructed value of the current block template.
[0312] The cost information for any weighted prediction mode can be used to indicate the likelihood of the weighted prediction mode being used by the current block. The smaller the cost information, the higher the likelihood. Conversely, the larger the cost information, the lower the likelihood. Specifically, the difference between the predicted value of the current block template and the reconstructed value of the current block template can include any of the following: First, the SAD (sum of absolute differences) between the predicted value of the current block template and the reconstructed value of the current block template. The SAD between the predicted value of the current block template and the reconstructed value of the current block template is determined as the cost information. Second, the SSE (sum of squared errors) between the predicted value of the current block template and the reconstructed value of the current block template. The SSE between the predicted value of the current block template and the reconstructed value of the current block template is determined as the cost information. Third, the MR-SAD (mean-removed sum of absolute differences) between the predicted value of the current block template and the reconstructed value of the current block template. The MR-SAD between the predicted value of the current block template and the reconstructed value of the current block template is determined as the cost information.
[0313] Optionally, the difference between the predicted value of the current block template and the reconstructed value of the current block template is specifically calculated based on the difference between the predicted value of each sample point in the current block template and the reconstructed value of the corresponding sample point in the current block template. The difference between the predicted value of the current block template and the reconstructed value of the current block template can be calculated based on a difference between the predicted value of each sample point in the current block template and the reconstructed value of the corresponding sample point in the current block template that is less than a difference threshold.
[0314] Fourth, based on the cost information of the current block template under different weighted prediction modes, the first prediction mode list (ie, the weighted prediction mode list) is rearranged.
[0315] The above steps 1 to 4 introduce the rearrangement when only the weighted prediction mode list needs to be rearranged. Next, the situation where the weighted prediction mode list, the first intra-frame prediction mode list and the second intra-frame prediction mode list need to be rearranged is introduced. The prediction modes in each first prediction mode list that needs to be rearranged are combined to obtain multiple combined prediction modes. For example, the first prediction mode list that needs to be rearranged may include a weighted prediction mode list, a first intra-frame prediction mode list and a second intra-frame prediction mode list, the weighted prediction mode list may include 56 weighted prediction modes, the first intra-frame prediction mode list may include 26 first intra-frame prediction modes, and the second intra-frame prediction mode list may include 26 second intra-frame prediction modes; the weighted prediction modes in the weighted prediction mode list, the first intra-frame prediction mode list and the second intra-frame prediction mode list in the second intra-frame prediction mode list are combined to obtain 56*26*26 combined prediction modes.
[0316] The reordering principle may generally include: determining the cost information of the current block template under different combined prediction modes based on the difference between the predicted value of the current block template corresponding to the current block under different combined prediction modes and the reconstructed value of the current block template; and reordering the first prediction mode list that needs to be reordered based on the cost information of the previous block template under different combined prediction modes. The reordering principle may specifically include the following steps 1 to 4:
[0317] 1. Get the current block template corresponding to the current block.
[0318] The method for obtaining the current block template corresponding to the current block is the same as the method for obtaining the current block template corresponding to the current block when only the weight prediction mode list is rearranged. It will not be repeated here. For details, please refer to the method for obtaining the current block template corresponding to the current block when only the weight prediction mode list is rearranged.
[0319] 2. Determine the prediction value of the current block template under different combination prediction modes.
[0320] The process of determining the prediction value of the current block template in any combination prediction mode may include:
[0321] (1) Determine the weight template of the current block template in the combined prediction mode:
[0322] Determine the weight template of the current block template in the combined prediction mode, which can include any of the following:
[0323] A. Deriving the current block template weight template based on the weight prediction mode that constitutes the combined prediction mode. The relative position relationship between the current block template and the current block needs to be considered.
[0324] In this case, any of the following may be included:
[0325] ①Derive a weight matrix according to the weight prediction pattern that constitutes the combined prediction pattern; determine the weight template of the current block template based on the weight matrix and the weight threshold. For example, a weight threshold can be set, and weights in the weight matrix that are greater than or equal to the weight threshold are set to 1, and weights less than the weight threshold are set to 0.
[0326] ②Derive a weight matrix according to the weight prediction pattern that constitutes the combined prediction pattern. The weight prediction pattern that constitutes the combined prediction pattern may include a weight prediction angle pattern and a reference weight configuration pattern; determine the division center position (cp) of the weight matrix according to the weight prediction angle pattern and the reference weight configuration pattern, and determine the projection position (tp) of each sample point in the weight matrix under the weight prediction angle pattern; the weight matrix can be adjusted according to the relationship between the division center position and the projection position to obtain the weight template of the current block template in the combined prediction pattern. For example, if tp < cp, the weight of the sample point corresponding to the current block template is 0, otherwise it is 1.
[0327] B. The weight templates of the current block template in different combined prediction patterns have been cached, and the weight template of the current block template in the combined prediction pattern can be directly initialized from the cache.
[0328] (2) Determine the intra-frame prediction value of the current block template in the combined prediction pattern:
[0329] Determining the intra-frame prediction value of the current block template in the combined prediction pattern may include any of the following:
[0330] A. Determine the position of the prediction template and derive the intra-frame prediction value of the current block template according to the intra-frame prediction pattern that constitutes the combined prediction pattern. It may include:
[0331] ①Determine the position of the prediction template of the current block template.
[0332] The position of the prediction template may correspond to the position of the current block template; or, the position of the prediction template may not correspond to the position of the current block template. For example, to reduce complexity, a prediction template located within the current block may be used.
[0333] ②Determine the reference sample points for intra-frame prediction of the current block template according to the position of the prediction template.
[0334] Optionally, the reference sample points may be subject to correction processing, and the correction processing may include but is not limited to: filtering, linear mapping, and non-linear mapping, etc.
[0335] ③According to the intra-frame prediction pattern that constitutes the combined prediction pattern, derive the intra-frame prediction value of the current block template based on the reference sample points.
[0336] Specifically, an MPM list may be determined based on the weighted prediction modes that constitute the combined prediction mode, and the intra-frame prediction modes that constitute the combined prediction mode may be adjusted based on the MPM list to obtain an adjusted intra-frame prediction mode. An intra-frame prediction value of the current block template may be derived based on the reference sample according to the adjusted intra-frame prediction mode.
[0337] Deriving the intra-frame prediction value of the current block template based on the reference samples according to the adjusted intra-frame prediction mode may include: using a specific intra-frame interpolation filter to derive the prediction value of the current block template based on the reference samples. For example, a bilinear interpolation filter may be used. In another example, any of all available intra-frame interpolation filters supported by the SAWP may be used.
[0338] Alternatively, the same intra-frame interpolation filter as that used for the current block may be used to derive a prediction value for the current block template based on the reference sample. If the current block uses multiple intra-frame interpolation filters to derive an intra-frame prediction value, one of the intra-frame interpolation filters may be used to derive the intra-frame prediction value. For example, the intra-frame interpolation filters used for the reference sample may be sorted (e.g., from small to large) based on the position of the reference sample (including horizontal coordinates, vertical coordinates, or a straight line), and the i-th intra-frame interpolation filter may be used.
[0339] B. The intra-frame prediction values of the current block template in different combination prediction modes have been cached, and the intra-frame prediction value of the current block template in the combination prediction mode can be directly derived from the cache.
[0340] It should be noted that when determining the intra-prediction value of the current block template in combined prediction mode, if the intra-prediction mode index is the adjusted intra-prediction mode index, the corresponding intra-prediction mode index must be derived. For example, there are 66 intra-prediction modes, and SAWP only allows the use of 26 of them; these 26 modes are divided into two lists, the first list being the MPM list, and the remaining modes forming the second list. If the rearranged coding mode is used in the second list, the specific intra-prediction mode to be used must be confirmed in the second list based on the adjusted intra-prediction mode index.
[0341] (3) Perform weighted prediction on the intra-frame prediction value according to the weight template to obtain the prediction value of the current block template in the combined prediction mode:
[0342] After determining the weight template of the current block template in the combined prediction mode and determining the intra-frame prediction value of the current block template in the combined prediction mode, the intra-frame prediction value can be weighted predicted according to the weight template to obtain the prediction value of the current block template in the combined prediction mode. For example, the combined prediction mode can be obtained by combining weight prediction mode 1, first intra-frame prediction mode 1 and second intra-frame prediction mode 1; that is, the weight template of the current block template in the combined prediction mode refers to the weight template of the current block template in the weight prediction mode 1; the intra-frame prediction value of the current block template in the combined prediction mode can include the intra-frame prediction value of the current block template in the first intra-frame prediction mode 1 and the intra-frame prediction value of the current block template in the second intra-frame prediction mode 1; based on the weight template in the weight prediction mode 1, the intra-frame prediction value in the first intra-frame prediction mode 1 and the intra-frame prediction value in the second intra-frame prediction mode 1 can be weighted predicted to obtain the prediction value of the current block template in the combined prediction mode.
[0343] 3. Determine the cost information of the current block template under different combination prediction modes according to the difference between the prediction value of the current block template under different combination prediction modes and the reconstructed value of the current block template.
[0344] The cost information for any combination prediction mode can be used to indicate the likelihood of the current block using that combination prediction mode. The smaller the cost information, the higher the likelihood; conversely, the larger the cost information, the lower the likelihood. Specifically, the difference between the predicted value of the current block template and the reconstructed value of the current block template can include any of the following: First, the SAD (sum of absolute differences) between the predicted value of the current block template and the reconstructed value of the current block template. The SAD between the predicted value of the current block template and the reconstructed value of the current block template is determined as the cost information. Second, the SSE (sum of squared errors) between the predicted value of the current block template and the reconstructed value of the current block template. The SSE between the predicted value of the current block template and the reconstructed value of the current block template is determined as the cost information. Third, the MR-SAD (mean-removed sum of absolute differences) between the predicted value of the current block template and the reconstructed value of the current block template. The MR-SAD between the predicted value of the current block template and the reconstructed value of the current block template is determined as the cost information.
[0345] Optionally, the difference between the predicted value of the current block template and the reconstructed value of the current block template is specifically calculated based on the difference between the predicted value of each sample point in the current block template and the reconstructed value of the corresponding sample point in the current block template. The difference between the predicted value of the current block template and the reconstructed value of the current block template can be calculated based on a difference between the predicted value of each sample point in the current block template and the reconstructed value of the corresponding sample point in the current block template that is less than a difference threshold.
[0346] 4. Rearrange the first prediction mode list based on the cost information of the current block template under different combination prediction modes.
[0347] When the first prediction mode list to be rearranged includes a weighted prediction mode list, a first intra-frame prediction mode list, and a second intra-frame prediction mode list, the R weighted prediction modes in the weighted prediction mode list, the P first intra-frame prediction modes in the first intra-frame prediction mode list, and the Q second intra-frame prediction modes in the second intra-frame prediction mode list can be combined to obtain R*P*Q combined prediction modes, and the cost information under the R*P*Q combined prediction modes constitutes a cost list (cost_list). Rearranging the first prediction mode list based on the cost information of the current block template under different combined prediction modes may include:
[0348] (1) According to the cost list (cost_list), the weight prediction mode list (sawp_list) is rearranged to obtain a rearranged weight prediction mode list (sorted_sawp_list).
[0349] Specifically, in the cost list, each weight prediction mode in the weight prediction mode list corresponds to multiple cost information, and the minimum cost information among the multiple cost information corresponding to each weight prediction mode can be determined as the rearranged cost information of each weight prediction mode; the weight prediction mode list can be sorted in order from small to large according to the rearranged cost information of each weight prediction mode in the weight prediction mode list to obtain a rearranged weight prediction mode list.
[0350] For example, the weighted prediction mode list includes three weighted prediction modes A1, A2, and A3, the first intra-frame prediction mode may include two first intra-frame prediction modes B1 and B2, and the second intra-frame prediction mode list may include two second intra-frame prediction modes C1 and C2; the three weighted prediction modes, the two first intra-frame prediction modes, and the two second intra-frame prediction modes can form 12 combined prediction modes. The cost list (cost_list) composed of the cost information under the 12 combined prediction modes is shown in Table 30 below:
[0351] Table 30
[0352] In the above Table 30, the minimum cost information of 0.08 among the four cost information corresponding to weighted prediction mode A1 can be determined as the reordering cost information of 0.08 for weighted prediction mode A1; similarly, the reordering cost information of 0.16 for weighted prediction mode A2 and the reordering cost information of 0.17 for weighted prediction mode A3 can be determined. According to the reordering cost information of the four weighted prediction modes, the weighted prediction mode list can be sorted in ascending order to obtain a reordered weighted prediction mode list, as shown in the following Table 31:
[0353] Table 31
[0354] The prediction mode index of the current block obtained from parsing the video code stream may include the weighted prediction mode index of the current block, the first intra-frame prediction mode index of the current block, and the second intra-frame prediction mode index of the current block. After obtaining the rearranged weighted prediction mode list, the weighted prediction mode (final_sawp_mode) of the current block can be determined in the rearranged weighted prediction mode list according to the weighted prediction mode index of the current block.
[0355] (2) Determine a first cost list (pred_mode0_cost_list) corresponding to the first intra prediction mode list in the cost list, and reorder the first intra prediction mode list according to the first cost list to obtain a reordered first intra prediction mode list (sorted_pred_mode0_list).
[0356] The method for determining the first cost list (pred_mode0_cost_list) may include: after determining the weighted prediction mode of the current block in the rearranged weighted prediction mode list, determining a first cost list corresponding to the first intra-frame prediction mode list based on cost information under a first combined prediction mode in the cost list; the weighted prediction mode constituting the first combined prediction mode is the weighted prediction mode of the current block. In other words, the first cost list (pred_mode0_cost_list) may be composed of cost information under a combined prediction mode whose weighted prediction mode in the cost list (cost_list) is the weighted prediction mode (final_sawp_mode) of the current block.
[0357] In the first cost list, each first intra-frame prediction mode in the first intra-frame prediction mode list corresponds to multiple cost information, and the minimum cost information among the multiple cost information corresponding to each first intra-frame prediction mode can be determined as the rearranged cost information of each first intra-frame prediction mode; the first intra-frame prediction mode list can be sorted in ascending order according to the rearranged cost information of each first intra-frame prediction mode in the first intra-frame prediction mode list to obtain a rearranged first intra-frame prediction mode list.
[0358] For example, if the weighted prediction mode of the current block is weighted prediction mode A1, the first cost list is shown in Table 32 below:
[0359] Table 32
[0360] In Table 32 above, the minimum cost information of 0.15 among the two cost information corresponding to the first intra-frame prediction mode B1 can be determined as the reordering cost information of 0.15 for the first intra-frame prediction mode B1; similarly, the reordering cost information of 0.08 for the first intra-frame prediction mode B2 can be determined. The first intra-frame prediction mode list can be sorted in ascending order based on the reordering cost information of the two first intra-frame prediction modes to obtain a reordered first intra-frame prediction mode list, as shown in Table 33 below:
[0361] Table 33
[0362] After obtaining the rearranged first intra prediction mode list, the first intra prediction mode (final_sawp_pred_mode0) of the current block may be determined in the rearranged first intra prediction mode list according to the first intra prediction mode index of the current block.
[0363] (3) Determine a second cost list (pred_mode1_cost_list) corresponding to the second intra prediction mode list in the cost list, and rearrange the second intra prediction mode list according to the second cost list to obtain a rearranged second intra prediction mode list (pred_mode1_cost_list).
[0364] The second cost list (pred_mode1_cost_list) may be determined in any of the following ways:
[0365] First, after determining the weighted prediction mode of the current block in the rearranged weighted prediction mode list, a second cost list corresponding to the second intra prediction mode list is determined based on the cost information under the first combined prediction mode in the cost list; wherein the weighted prediction modes constituting the first combined prediction mode are the weighted prediction modes of the current block. In other words, the second cost list (pred_mode1_cost_list) can be composed of the cost information under the combined prediction modes in the cost list (cost_list) whose weighted prediction modes are the weighted prediction mode (final_sawp_mode) of the current block.
[0366] In the second cost list, each second intra-frame prediction mode in the second intra-frame prediction mode list corresponds to multiple cost information, and the minimum cost information among the multiple cost information corresponding to each second intra-frame prediction mode can be determined as the rearranged cost information of each second intra-frame prediction mode; the second intra-frame prediction mode list can be sorted in ascending order according to the rearranged cost information of each second intra-frame prediction mode in the second intra-frame prediction mode list to obtain a rearranged second intra-frame prediction mode list.
[0367] For example, if the weighted prediction mode of the current block is weighted prediction mode A1, the second cost list is shown in Table 34 below:
[0368] Table 34
[0369] In the above Table 34, the minimum cost information of 0.12 among the two cost information corresponding to the second intra-frame prediction mode C1 can be determined as the reordering cost information of 0.12 for the second intra-frame prediction mode C1; similarly, the reordering cost information of 0.08 for the second intra-frame prediction mode C2 can be determined. The second intra-frame prediction mode list can be sorted in ascending order based on the reordering cost information of the two second intra-frame prediction modes to obtain a reordered second intra-frame prediction mode list, as shown in the following Table 35:
[0370] Table 35
[0371] After obtaining the rearranged second intra prediction mode list, the second intra prediction mode (final_sawp_pred_mode1) of the current block may be determined in the rearranged second intra prediction mode list according to the second intra prediction mode index of the current block.
[0372] The second method is to determine the weighted prediction mode of the current block in the rearranged weighted prediction mode list and the first intra-frame prediction mode of the current block in the rearranged first intra-frame prediction mode list, and then determine the second cost list corresponding to the second intra-frame prediction mode list based on the cost information of the second combined prediction mode in the cost list; wherein the weighted prediction mode constituting the second combined prediction mode is the weighted prediction mode of the current block, and the first intra-frame prediction mode constituting the second combined prediction mode is the first intra-frame prediction mode of the current block. In other words, the second cost list (pred_mode1_cost_list) can be composed of the cost information of the combined prediction mode in which the weighted prediction mode in the cost list (cost_list) is the weighted prediction mode (final_sawp_mode) of the current block and the first intra-frame prediction mode is the first intra-frame prediction mode (final_sawp_pred_mode0) of the current block.
[0373] In the second cost list, each second intra-frame prediction mode in the second intra-frame prediction mode list corresponds to a cost information, and the cost information corresponding to each second intra-frame prediction mode can be determined as the rearranged cost information of each second intra-frame prediction mode; the second intra-frame prediction mode list can be sorted in ascending order according to the rearranged cost information of each second intra-frame prediction mode in the second intra-frame prediction mode list to obtain a rearranged second intra-frame prediction mode list.
[0374] For example, if the weighted prediction mode of the current block is weighted prediction mode A1 and the first intra prediction mode of the current block is B2, the second cost list is shown in Table 36 below:
[0375] Table 36
[0376] In the above Table 36, the cost information 0.12 corresponding to the second intra-frame prediction mode C1 can be determined as the reordering cost information 0.12 of the second intra-frame prediction mode C1; similarly, the reordering cost information 0.08 of the second intra-frame prediction mode C2 can be determined. The second intra-frame prediction mode list can be sorted in ascending order based on the reordering cost information of the two second intra-frame prediction modes to obtain a reordered second intra-frame prediction mode list, as shown in the following Table 37:
[0377] Table 37
[0378] After obtaining the rearranged second intra prediction mode list, the second intra prediction mode (final_sawp_pred_mode1) of the current block may be determined in the rearranged second intra prediction mode list according to the second intra prediction mode index of the current block.
[0379] S1204 : Determine the prediction mode of the current block in the reordered prediction mode list according to the prediction mode index of the current block.
[0380] The available prediction mode list may include a first prediction mode list that needs to be reordered and a second prediction mode list that does not need to be reordered; the prediction mode index of the current block may include a first prediction mode index and a second prediction mode index, the first prediction mode index corresponding to the first prediction mode list, and the second prediction mode index corresponding to the second prediction mode list. After the first prediction mode list that needs to be reordered is reordered to obtain a reordered first prediction mode list, the first prediction mode of the current block can be determined in the reordered first prediction mode list based on the first prediction mode index; and the second prediction mode of the current block can be determined in the second prediction mode list based on the second prediction mode index.
[0381] For example, when the first prediction mode list to be rearranged includes a weighted prediction mode list, a first intra-frame prediction mode list, and a second intra-frame prediction mode list, the weighted prediction mode of the current block can be determined in the rearranged weighted prediction mode list based on the weighted prediction mode index of the current block; the first intra-frame prediction mode of the current block can be determined in the rearranged first intra-frame prediction mode list based on the first intra-frame prediction mode index of the current block; and the second intra-frame prediction mode of the current block can be determined in the rearranged second intra-frame prediction mode list based on the second intra-frame prediction mode index of the current block. Furthermore, the first prediction mode of the current block can be determined during the rearrangement process.
[0382] S1205 , predicting the current block according to the prediction mode of the current block to obtain a prediction value of the current block; the prediction value of the current block is used to reconstruct a decoded image block of the current block.
[0383] After determining the first prediction mode of the current block in the reordered first prediction mode list according to the first prediction mode index and determining the second prediction mode of the current block in the second prediction mode list according to the second prediction mode index, the current block can be predicted according to the first prediction mode and the second prediction mode to obtain a prediction value of the current block.
[0384] For example, when the rearranged first prediction mode list includes a weighted prediction mode list and multiple intra-frame prediction mode lists (for example, the two intra-frame prediction mode lists include a first intra-frame prediction mode list and a second intra-frame prediction mode list), the prediction mode adopted by the current block may include the weighted prediction mode adopted by the current block and the multiple intra-frame prediction modes adopted by the current block. The prediction process of the current block may include: deriving the weight matrix of the current block according to the weighted prediction mode adopted by the current block; deriving the intra-frame prediction value of the current block in each intra-frame prediction mode according to each intra-frame prediction mode adopted by the current block; and performing weighted prediction on the intra-frame prediction value of the current block in each intra-frame prediction mode according to the weight matrix of the current block to obtain the prediction value of the current block. The prediction value of the current block can be used to reconstruct the decoded image block of the current block.
[0385] In an embodiment of the present application, when the encoding mode of the current block is the rearranged encoding mode, the prediction mode list is rearranged so that in the rearranged prediction mode list, the prediction mode with a higher probability of being used by the current block has a smaller value corresponding to the prediction mode index; in this way, the value of the prediction mode index actually used by the current block is smaller, and less information is parsed when parsing the prediction mode index of the current block in the video code stream, thereby improving the decoding efficiency of the prediction mode index of the current block, thereby improving the video decoding efficiency.
[0386] It is worth noting that in the embodiments of the present application, the weighted prediction mode can also be called the spatial angle weighted prediction mode, and the weighted prediction mode can also be called the spatial angle weighted prediction mode index; the first intra-frame prediction mode can be called the first prediction mode of the spatial angle weighted prediction mode, and the first intra-frame prediction mode index can be called the first prediction mode index of the spatial angle weighted prediction mode, and other intra-frame prediction modes are similar; in specific implementations, the weighted prediction mode and its index, the intra-frame prediction mode and its index can also have other names, which are not limited in the embodiments of the present application.
[0387] Next, a specific decoding example is given on the decoding end:
[0388] 1. Example 1:
[0389] Embodiment 1 corresponds to the case where only the weighted prediction mode lists are rearranged and the number of weighted prediction mode lists is one. The decoding process may include:
[0390] 1. Decode the video stream and determine whether the current block uses the adaptive spatial angle weighted prediction mode (DAWP) derivation method:
[0391] 1.1 The video code stream contains a sequence header syntax element to indicate whether the current sequence is exported using the adaptive angle weighting mode (DAWP):
[0392] 1.1.1 There are two flags in the code stream: seq_sawp_flag and seq_dawp_flag, which indicate the SAWP mode used in the current sequence (x means no decoding is required). The semantics are shown in Table 7 above.
[0393] 1.1.2seq_dawp_flag can indicate whether the adaptive angle weighting mode is used for both AWP mode and SAWP mode. The syntax is shown in Table 9-2 above.
[0394] 2. If using the DAWP mode, confirm the available prediction mode list as follows. The following prediction mode list can be one or more:
[0395] 2.1 Weight matrix list: There is only one list with a total of 56 weight prediction modes.
[0396] 2.2 Intra-frame prediction mode list: The intra-frame prediction mode list contains 26 intra-frame prediction modes (numbered 5 to 30), divided into two lists:
[0397] List 1 is the MPM list, which contains two intra-frame prediction modes. The intra-frame prediction modes in this list are derived based on information from neighboring reconstructed blocks and / or the weighted prediction mode of the current block (this is how the SAWP MPM list is constructed). List 2 consists of the remaining intra-frame prediction modes. Both Lists 1 and 2 store adjusted intra-frame prediction mode indices.
[0398] 3. Parse the video stream and determine the syntax elements related to the prediction mode:
[0399] 3.1 Parse and determine the syntax element weight prediction mode index (sawp_index) of the weight prediction mode. sawp_index is used to determine the position of the sawp weight prediction mode in the weight prediction mode list:
[0400] 3.1.1 There is only one weight prediction mode list:
[0401] The weight prediction mode list contains 56 weight prediction modes, and the total number of decoding modes is 28. The total number of modes is divided into 8 groups, with 7 modes in each group. The group number uses truncated unary code, the group index uses truncated binary code, the group number uses context-based binary coding, and the group index uses bypass mode coding.
[0402] 3.2 Decoding information to determine the intra-frame prediction value of part 1:
[0403] 3.2.1 There are two mode lists (the first one is the SAWP MPM list as mentioned above, and the second one is the remaining available intra prediction modes). The syntax is shown in Table 38 below:
[0404] Table 38
[0405] 3.3 Decoding the information to determine the predicted value of part 2:
[0406] 3.3.1 There are two mode lists (the first one is the SAWP MPM list as mentioned above, and the second one is the remaining available intra prediction modes):
[0407] 3.3.1.1 Optionally, the second intra prediction mode index of the current block (mode information of sawp_pred_mode1) may be decoded according to the first intra prediction mode index of the current block (mode information of sawp_pred_mode0):
[0408] If the values of sawp_pred_mode0_is_mpm and sawp_pred_mode1_is_mpm are both 1 (indicating that the first intra prediction mode of the current block and the second intra prediction mode of the current block both belong to the MPM list), sawp_pred_mode1_mpm_index is different from sawp_pred_mode0_mpm_index. In particular, if the length of MPM is 2, sawp_pred_mode1_mpm_index can be directly determined by the value of sawp_pred_mode0_mpm_index. The syntax is shown in Table 39 below:
[0409] Table 39
[0410] 4. If DAWP mode is used, export the rearranged mode list to confirm the prediction mode of the current block:
[0411] 4.1 Confirm the availability of DAWP mode. If it is not available, do not sort the mode list:
[0412] 4.1.1 Check whether the sample corresponding to the current block template is available and has been reconstructed. The following conditions must be met at the same time:
[0413] 4.1.1.1 The samples to the left of the current block are available;
[0414] 4.1.1.2 Samples above the current block are available.
[0415] 4.2 Confirm the list of patterns that need to be rearranged:
[0416] 4.2.1 Include one or more of the following lists:
[0417] 4.2.1.1 List of weighted prediction modes.
[0418] 4.3 Traverse all weight prediction modes that need to be rearranged, set the current weight prediction mode to tmp_sawp_mode_x (the value of x is 0 to 55) and perform the following operations to export the sorted cost list (cost_list):
[0419] 4.3.1 Get the current block template (all reconstructed sample points around the current block can be used as the current block template):
[0420] 4.3.1.1 The template is one row above the current block, with a width and height of (tw0, th0);
[0421] 4.3.1.2 The template is one column to the left of the current block, with a width and height of (tw1, th1).
[0422] 4.3.2 Obtain prediction templates for each part:
[0423] 4.3.2.1 Confirm intra prediction mode:
[0424] 4.3.2.1.1 Confirm the available list of SAWP (including MPM list and list composed of other modes) according to tmp_sawp_mode_x;
[0425] 4.3.2.1.2 If the value of sawp_pred_mode0_is_mpm is 1, the first intra prediction mode of the current block template is determined from the MPM list according to sawp_pred_mode0_mpm_index; otherwise, the first intra prediction mode is determined from the non-MPM list according to sawp_pred_mode0_index;
[0426] 4.3.2.1.3 If the value of sawp_pred_mode1_is_mpm is 1, the intra prediction mode of the second part is confirmed from the MPM list according to sawp_pred_mode1_mpm_index; otherwise, the intra prediction mode of the second part is confirmed from the non-MPM list according to sawp_pred_mode1_index.
[0427] 4.3.2.2 Template position: The position of the prediction template corresponds to the current block template.
[0428] 4.3.2.3 Determine the reference sample points used for intra-frame prediction of the current block template based on the position of the prediction template.
[0429] 4.3.2.4 Derive the intra-frame prediction value of the current block template according to the intra-frame prediction mode.
[0430] The current block template may use the same intra-frame interpolation filter as the current block to derive intra-frame prediction values. If the current block uses multiple interpolation filters to derive prediction values, one of the interpolation filters is used to derive the prediction values. For example, based on the position of the sample points (horizontal coordinate, vertical coordinate, or line), the interpolation filters used for the sample points are sorted (from smallest to largest distance), and the second filter is used.
[0431] 4.3.2.5 The prediction value of the current block template can be cached. If the current intra prediction mode can be found in the cache, the cached prediction value can be used directly without re-deriving it.
[0432] 4.3.3 Export template weights:
[0433] 4.3.3.1 When deriving the weights according to the angle-weighted prediction method, the relative position relationship between the template and the current block needs to be considered.
[0434] 4.3.3.2 Weight Derivation Method:
[0435] Obtain the reference weight configuration mode and weight angle prediction mode corresponding to the current block template; determine the position of the division center cp based on the above information; calculate the position tp of the sample points corresponding to the current block template after projection according to the weight prediction angle; if tp < cp, the weight of the sample points corresponding to the current block template is 0, otherwise it is 1.
[0436] 4.3.3.3 The weight template can be initialized in advance and does not need to be exported repeatedly.
[0437] 4.3.4 Export the predicted value of the current block template. Use the above template weights to perform weighted combination on the predicted values of each part to obtain the predicted value of the current block template.
[0438] 4.3.5 Calculate the cost:
[0439] Calculate the SAD between the predicted value and the reconstructed value of the current block template.
[0440] 4.4 Sort the cost list (cost_list), including:
[0441] Sort the weight prediction mode list according to cost_list to obtain the rearranged weight prediction mode list (sorted_sawp_list), which is sorted in ascending order of cost. The mode at the sawp_index position corresponding to sorted_sawp_list is the weight prediction mode finally used for the current block, denoted as final_sawp_mode.
[0442] 5. Export the predicted value of the current block:
[0443] 5.1 Derive the weight matrix according to final_sawp_mode;
[0444] 5.2 Confirm the intra-frame prediction mode list according to final_sawp_mode, and derive the first intra-frame prediction value and the second intra-frame prediction value of the current block based on the intra-frame prediction mode related information decoded in 2.2 and 2.3;
[0445] 5.3 Perform weighted prediction on the first intra-frame prediction value and the second intra-frame prediction value according to the weight matrix to obtain the predicted value of the current block.
[0446] II. Embodiment 2:
[0447] Embodiment 2 corresponds to the case where only the weight prediction mode list is rearranged and the number of weight prediction mode lists is multiple. The decoding process may include:
[0448] 1. Decode the code stream and determine whether the coding block uses the adaptive spatial angle weighted prediction mode (DAWP) derivation method.
[0449] 2. If using DAWP mode, confirm the available mode list as follows. The following mode list can be one or more:
[0450] 2.1 Weight matrix list:
[0451] There are 56 weight prediction modes in total. The list is grouped according to the weight step (7 types), so the weight prediction mode list is divided into 8 lists, as shown in Table 29 above.
[0452] 2.2 The first intra prediction mode list and the second intra prediction mode list are the same as those in embodiment 1.
[0453] 3. Decode the code stream and determine the syntax elements related to the prediction mode:
[0454] 3.1 Parse and determine the syntax element weight prediction mode index (sawp_index) of the weight prediction mode. sawp_index is used to determine the position of the sawp weight prediction mode in the weight prediction mode list:
[0455] 3.1.1 There are two lists, the weight prediction mode list index (sawp_list_index) and the weight prediction mode index (sawp_index) need to be decoded, as shown in Table 24 above;
[0456] 3.1.2 The weight prediction mode list index (sawp_list_index) uses a truncated binary code, and the weight prediction mode index (sawp_index) uses a context-based truncated unary code; or, the weight prediction mode index (sawp_index) is encoded using the bypass mode, and the weight prediction mode index (sawp_index) is encoded using a context-based binary coding method.
[0457] 3.2 Decoding the information that determines the predicted value of Part 1.
[0458] 3.3 Decoding the information that determines the predicted value of part 2.
[0459] 4. If using DAWP mode, export the rearranged mode list and confirm the AWP mode of the current block:
[0460] 4.1 Confirm the availability of DAWP mode. If it is not available, do not sort the mode list:
[0461] 4.1.1 Check whether the sample corresponding to the current block template is available and has been reconstructed. The following conditions must be met at the same time:
[0462] 4.1.1.1 The samples to the left of the current block are available;
[0463] 4.1.1.2 Samples above the current block are available.
[0464] 4.2 Confirm the list of patterns to be rearranged:
[0465] 4.2.1 A list including the following:
[0466] 4.2.1.1 List of weighted prediction modes.
[0467] 4.2.2 According to sawp_list_index, the weight prediction mode list that needs to be rearranged is determined (the length is only 8).
[0468] 4.3 Traverse all modes that need to be rearranged, set the current mode to tmp_sawp_mode_x (the value of x is 0 to 7) and perform the following operations to export the sorted list cost_list:
[0469] 4.3.1 Obtain the current template (all reconstructed sample points around the current block can be used as templates).
[0470] 4.3.2 Obtain prediction templates for each part.
[0471] 4.3.3 Export template weights.
[0472] 4.3.4 Export weighted prediction template.
[0473] 4.3.5 Calculate the cost.
[0474] 4.4 Sort the cost_list, including:
[0475] 4.4.1 Sort the SAWP modes according to cost_list to obtain sorted_sawp_list, which is sorted by minimum cost. The mode corresponding to the SAWP mode index sawp_index in sorted_sawp_list is the final mode used for weighted prediction and is recorded as final_sawp_mode.
[0476] 5. Export predicted values:
[0477] 5.1 Export the weight matrix according to final_sawp_mode;
[0478] 5.2 Confirm the intra prediction mode list according to final_sawp_mode, and derive the first intra prediction value and the second intra prediction value of the current block according to the intra prediction mode related information decoded in 2.2 and 2.3;
[0479] 5.3 Perform weighted prediction on the first intra-frame prediction value and the second intra-frame prediction value according to the weight matrix to obtain a prediction value of the current block.
[0480] Three, embodiment 3:
[0481] Embodiment 3 corresponds to the case where both the weighted prediction mode list and the intra-frame prediction mode list are rearranged, and the number of the weighted prediction mode list and the number of the intra-frame prediction mode list are multiple. The decoding process may include:
[0482] 1. Decode the code stream and determine whether the coding block uses the adaptive spatial angle weighted prediction mode (DAWP) derivation method.
[0483] 2. If using DAWP mode, confirm the available mode list as follows. The following mode list can be one or more:
[0484] 2.1 Weight matrix list:
[0485] There are 56 weight prediction modes in total. The list is grouped according to the weight step (7 types), so the weight prediction mode list is divided into 8 lists, as shown in Table 29 above.
[0486] 2.2 First intra prediction mode list and second intra prediction mode list:
[0487] 2.2.1 If the list is an MPM list, it contains only 2 elements;
[0488] 2.2.2 If the list is a non-MPM list, it contains 24 elements;
[0489] Suppose the preset value d = 6 and the target value T = {t1, t2, ..., tn}, and derive the list of mode_index% d = ti (i∈[0,n]). The non-MPM list contains 24 modes. Suppose d = 6 and T = {0, 1, 2, 3, 4, 5}, then 6 lists are obtained, as shown in Table 40 below:
[0490] Table 40
[0491] 3. Decode the code stream and determine the syntax elements related to the prediction mode:
[0492] 3.1 Parse and determine the syntax element weight prediction mode index (sawp_index) of the weight prediction mode. The sawp_index is used to determine the position of the sawp weight prediction mode in the weight prediction mode list.
[0493] 3.1.1 There are two lists, the weight prediction mode list index (sawp_list_index) and the weight prediction mode index (sawp_index) need to be decoded, as shown in Table 24 above;
[0494] 3.1.2 The weight prediction mode list index (sawp_list_index) uses a truncated binary code, and the weight prediction mode index (sawp_index) uses a context-based truncated unary code; or, the weight prediction mode index (sawp_index) is encoded using the bypass mode, and the weight prediction mode index (sawp_index) is encoded using a context-based binary coding method.
[0495] 3.2 Decode the information to determine the predicted value of Part 1. The syntax is shown in Table 41 below:
[0496] Table 41
[0497] 3.3 Decode the information to determine the predicted value of part 2. The syntax is shown in Table 42 below:
[0498] Table 42
[0499] 4. If using DAWP mode, export the rearranged mode list and confirm the AWP mode of the current block:
[0500] 4.1 Confirm the availability of DAWP mode. If not available, do not sort the mode list.
[0501] 4.2 Confirm the list of patterns to be rearranged:
[0502] 4.2.1 A list including the following:
[0503] 4.2.1.1 List of weighted prediction modes.
[0504] 4.2.2 According to sawp_list_index, the weight prediction mode list that needs to be rearranged is determined (the length is only 8).
[0505] 4.2.3 If the value of sawp_pred_mode0_is_mpm is 1, the intra prediction mode of the first part is confirmed from the MPM list according to sawp_pred_mode0_mpm_index, otherwise the available intra prediction mode list of the first part is confirmed according to sawp_pred_mode0_list_index.
[0506] 4.2.4, if the value of sawp_pred_mode1_is_mpm is 1, the intra prediction mode of the second part is confirmed from the MPM list according to sawp_pred_mode1_mpm_index, otherwise the available intra prediction mode list of the second part is confirmed according to sawp_pred_mode1_list_index.
[0507] 4.2.5 In 4.2.3 and 4.2.4, the list of available intra-frame prediction modes needs to be adjusted according to the method in 4.3.2.1 to obtain the intra-frame prediction mode.
[0508] 4.3 Traverse all modes that need to be rearranged, set the current mode to tmp_sawp_mode_x0 (the value of x0 is 0 to 7), the current intra-frame prediction mode to tmp_sawp_ipm0_x1 (the value of x1 is 0 to 3), and tmp_sawp_ipm1_x2 (the value of x2 is 0 to 3) and perform the following operations to derive the sorted list cost_list:
[0509] 4.3.1 Obtain the current template (all reconstructed sample points around the current block can be used as templates).
[0510] 4.3.2 Obtain prediction templates for each part.
[0511] 4.3.2.1 Confirm intra prediction mode:
[0512] 4.3.2.1.1 Confirm the MPM list of SAWP according to tmp_sawp_mode_x;
[0513] 4.3.2.2.2 Adjust tmp_sawp_ipm0_x1 according to the MPM list to obtain tmp_final_sawp_ipm0_x1, and use this mode to derive the first part of the intra-frame prediction value;
[0514] 4.3.2.2.3 Adjust tmp_sawp_ipm1_x2 according to the MPM list to obtain tmp_final_sawp_ipm1_x2, and use this mode to derive the second part of the intra-frame prediction value.
[0515] 4.3.3 Export template weights.
[0516] 4.3.4 Export weighted prediction template.
[0517] 4.3.5 Calculate the cost.
[0518] 4.4 Sort the cost_list, including:
[0519] 4.4.1 Sort the SAWP modes according to cost_list to obtain sorted_sawp_list, which is sorted by minimum cost. The mode corresponding to the SAWP mode index position in sorted_sawp_list is the final mode used for weighted prediction and is recorded as final_sawp_mode.
[0520] 4.4.2 Sort the first intra prediction mode according to pred_mode0_cost_list to obtain sorted_pred_mode0_list, which is sorted by minimum cost. The mode in sorted_pred_mode0_list corresponding to sawp_pred_mode0_index is the final mode used for weighted prediction and is recorded as final_sawp_pred_mode0;
[0521] 4.4.2.1pred_mode0_cost_list is a list consisting of the SAWP modes in cost_list that are final_sawp_mode.
[0522] 4.4.3 Sort the first intra prediction mode according to pred_mode1_cost_list to obtain sorted_pred_mode1_cost_list, which is sorted by minimum cost. The mode in sorted_pred_mode0_list corresponding to sawp_pred_mode1_index is the final mode used for weighted prediction and is recorded as final_sawp_pred_mode1;
[0523] 4.4.3.1 pred_mode1_cost_list is a list consisting of the SAWP mode in cost_list being final_sawp_mode and the first intra prediction mode being final_sawp_pred_mode0.
[0524] 5. Export predicted values:
[0525] 5.1 Export the weight matrix according to final_sawp_mode;
[0526] 5.2 Confirm the intra prediction mode list according to final_sawp_mode, and derive the first intra prediction value and the second intra prediction value of the current block according to the intra prediction mode related information decoded in 2.2 and 2.3;
[0527] 5.3 Perform weighted prediction on the first intra-frame prediction value and the second intra-frame prediction value according to the weight matrix to obtain a prediction value of the current block.
[0528] In the above-mentioned embodiment 3, a situation is introduced in which the prediction mode list that needs to be rearranged includes a weighted prediction mode list, a first intra-frame prediction mode list and a second intra-frame prediction mode list; in the above-mentioned embodiment 3, when calculating the cost, the weighted prediction mode index can be determined first, and then the first intra-frame prediction mode index and the second intra-frame prediction mode index can be determined based on the weighted prediction mode index. Optionally, for the case where the prediction mode list that needs to be rearranged includes a weighted prediction mode list, a first intra-frame prediction mode list and a second intra-frame prediction mode list, a combined prediction mode list can be determined based on the weighted prediction mode list, the first intra-frame prediction mode list and the second intra-frame prediction mode list that need to be rearranged, and each combined prediction mode in the combined prediction mode list can be obtained by combining a weighted prediction mode, a first intra-frame prediction mode and a second intra-frame prediction mode; when calculating the cost, the combined prediction mode index can be determined, and the combined prediction mode index can be understood as a triple {weighted prediction mode index, first intra-frame prediction mode index, second intra-frame prediction mode index}, and the combined prediction mode index can be used to indicate a specific combined prediction mode (i.e., a specific weighted prediction mode, a first intra-frame prediction mode and a second intra-frame prediction mode), so that the cost information under the combined prediction mode can be calculated.
[0529] The present application provides a video processing method that describes the encoding process at the encoding end. The video processing method can be executed by a computer device, which can be, for example, the encoding device 1101 in the video processing system shown in FIG. 11 . As shown in FIG. 13b , the video processing method can include, but is not limited to, the following steps S1301 to S1304:
[0530] S1301: Obtain coding mode indication information of the current block.
[0531] The current block is the image block currently being encoded. An image block is a coding unit (CU), the most basic element in the encoding process. The current block's coding mode indication information can be used to indicate whether the current block's coding mode is the reordering coding mode, which is the adaptive angle weighting mode (DAWP).
[0532] S1302: If the coding mode indication information indicates that the coding mode of the current block is the rearranged coding mode, the prediction mode list is rearranged to obtain a rearranged prediction mode list.
[0533] The prediction mode list includes multiple prediction modes and a prediction mode index corresponding to each prediction mode. In the rearranged prediction mode list, a prediction mode with a higher probability of being used by the current block has a smaller value of its corresponding prediction mode index.
[0534] Not all prediction modes in the prediction mode list may be used by the current block. Therefore, it is not necessary to rearrange the entire prediction mode list. Instead, an available prediction mode list may be determined in the prediction mode list, and the available prediction mode list may be rearranged to obtain a rearranged prediction mode list. Step S1302 may include sub-steps s21 and s22:
[0535] s21, determining an available prediction mode list in the prediction mode list.
[0536] The prediction mode list may include a weighted prediction mode list and N intra-frame prediction mode lists. For any prediction mode list (weighted prediction mode list or any intra-frame prediction mode list), a method of determining an available prediction mode list in the prediction mode list may include any of the following:
[0537] (1) Determine an available prediction mode list in the prediction mode list according to an available determination rule. The available determination rule is agreed upon by the encoding device and the decoding device.
[0538] (2) According to the prediction mode index that meets the availability condition in the prediction mode list, an available prediction mode list is determined in the prediction mode list.
[0539] Specifically, the prediction mode indexes in the prediction mode list can be divided into different groups; wherein, the prediction mode indexes in the prediction mode list satisfying the availability condition means that the sequence number of the group to which the prediction mode indexes in the prediction mode list belong is an available sequence number. The grouping method may include any of the following:
[0540] a. Given a preset value, calculate the quotient of the prediction mode index in the prediction mode index list and the preset value, and group prediction mode indices with the same quotient into the same group. This can be described as follows: given a preset value d and a target value T = {t1, t2, …, tn}, derive a list of Floor(mode_index / d) = ti(i∈[0,n]), where mode_index represents the prediction mode index.
[0541] b. Given a preset value, calculate the modulus of the prediction mode index in the prediction mode index list and the preset value, and group prediction mode indexes with the same modulus into the same group. This can be described as follows: given a preset value d and a target value T = {t1, t2, …, tn}, derive a list of mode_index % d = ti (i∈[0,n]), where mode_index represents the prediction mode index.
[0542] It should be noted that, for (2) in sub-step s21, the prediction mode index in the prediction mode list may be the original prediction mode index, or may be an adjusted prediction mode index. For example, for the intra-frame prediction mode list, the original intra-frame prediction mode list may contain 66 intra-frame prediction modes, and 66 integers in the range of 0-65 may be used to set the intra-frame prediction mode indexes of the 66 intra-frame prediction modes. However, the present application may use the 26 intra-frame prediction modes in the original intra-frame prediction mode list to set the intra-frame prediction mode list; the intra-frame prediction mode in the intra-frame prediction mode list of the present application may use its intra-frame prediction mode index in the original intra-frame prediction mode list (i.e., the original intra-frame prediction mode index); or, the intra-frame prediction mode in the intra-frame prediction mode list of the present application may re-use 26 integers in the range of 0-25 to re-set the intra-frame prediction mode indexes of the 26 intra-frame prediction modes (i.e., the adjusted intra-frame prediction mode index).
[0543] In particular, for the weight prediction mode list, the number of weight prediction mode lists can be multiple, and the multiple weight prediction mode lists belong to different weight prediction mode types; when confirming the available weight prediction mode lists in the weight prediction mode list, the available weight prediction mode lists can be determined separately in the weight prediction mode lists under different weight prediction mode types.
[0544] In particular, for the intra-frame prediction mode list, the method of determining the available prediction mode list in the prediction mode list may also include: determining the available intra-frame prediction mode list in the intra-frame prediction mode list based on the adjacent reconstructed blocks of the current block or the weighted prediction mode of the current block.
[0545] In addition, for the intra-frame prediction mode list, the intra-frame prediction mode list may include a first intra-frame prediction mode list and a second intra-frame prediction mode list. If the first intra-frame prediction mode of the current block has been determined in the first intra-frame prediction mode list, a method for determining the available second intra-frame prediction mode list in the second intra-frame prediction mode list may include: after deleting the first intra-frame prediction mode of the current block from the second intra-frame prediction mode list, determining the available second prediction mode list in the deleted second intra-frame prediction mode list. In other words, the second intra-frame prediction mode list does not include the first intra-frame prediction mode of the current block.
[0546] s22, reordering the available prediction mode list to obtain a reordered prediction mode list.
[0547] After determining the available prediction mode list in the prediction mode list, not all available prediction mode lists need to be rearranged. Therefore, the first prediction mode list that needs to be rearranged and the second prediction mode list that does not need to be rearranged can be determined in the available prediction mode list, and the first prediction mode list that needs to be rearranged is rearranged to obtain the rearranged first prediction mode list.
[0548] Before reordering, the reordering coding mode (i.e., DAWP mode) of the current block can be checked for availability to confirm the availability of the reordering coding mode of the current block; if the reordering coding mode of the current block is available, the first prediction mode list that needs to be reordered and the second prediction mode list that does not need to be reordered can be determined in the available prediction mode list, and the first prediction mode list that needs to be reordered can be reordered; if the reordering coding mode of the current block is not available, no reordering is required, and the prediction mode of the current block can be determined in the available prediction mode list based on the prediction mode index of the current block.
[0549] The availability check may include at least one of the following: first, if the samples of the current block template used to determine that the current block corresponds to the current block have been reconstructed, then it can be determined that the reordering coding mode of the current block is available; wherein, the samples of the current block template used to determine that the current block corresponds to the current block may include at least one of the following: samples to the left of the current block and samples above the current block. Second, if the size of the current block meets the size condition, then it can be determined that the reordering coding mode of the current block is available. Third, if the image component of the current block meets the component condition, then it can be determined that the reordering coding mode of the current block is available; for example, if the chrominance component of the current block meets the component condition, then it can be determined that the reordering coding mode of the current block is available.
[0550] Next, we will introduce methods for reordering the first prediction mode list that needs to be reordered. The first prediction mode list that needs to be reordered may include a weighted prediction mode list; alternatively, the first mode list that needs to be reordered may include a weighted prediction mode list, a first intra-frame prediction mode list, and a second intra-frame prediction mode list. The reordering methods for these two situations are described below.
[0551] When the first prediction mode list to be rearranged includes a weighted prediction mode list, the process of rearranging the first prediction mode list to be rearranged may include the following steps 1 to 4:
[0552] 1. Get the current block template corresponding to the current block.
[0553] 2. Determine the prediction value of the current block template under different weight prediction modes in the weight prediction mode list.
[0554] The process of determining the predicted value of the current block template in any weighted prediction mode may include:
[0555] (1) Determine the weight template of the current block template in the weight prediction mode.
[0556] (2) Determine the available intra prediction mode list based on the weighted prediction mode.
[0557] (3) Determine the intra prediction mode of the current block template in the available intra prediction mode list.
[0558] (4) According to the intra-frame prediction mode of the current block template, determine the intra-frame prediction value under the current block template.
[0559] (5) Perform weighted prediction on the intra-frame prediction value according to the weight template to obtain the prediction value of the current block template in the weight prediction mode.
[0560] 3. Determine the cost information of the current block template under different weight prediction modes according to the difference between the predicted value of the current block template under different weight prediction modes and the reconstructed value of the current block template.
[0561] Fourth, based on the cost information of the current block template under different weighted prediction modes, the first prediction mode list (ie, the weighted prediction mode list) is rearranged.
[0562] The above steps 1 to 4 introduce the rearrangement when only the weighted prediction mode list needs to be rearranged. Next, the situation where the weighted prediction mode list, the first intra-frame prediction mode list and the second intra-frame prediction mode list need to be rearranged is introduced. The prediction modes in each first prediction mode list that needs to be rearranged are combined to obtain multiple combined prediction modes. For example, the first prediction mode list that needs to be rearranged may include a weighted prediction mode list, a first intra-frame prediction mode list and a second intra-frame prediction mode list, the weighted prediction mode list may include 56 weighted prediction modes, the first intra-frame prediction mode list may include 26 first intra-frame prediction modes, and the second intra-frame prediction mode list may include 26 second intra-frame prediction modes; the weighted prediction modes in the weighted prediction mode list, the first intra-frame prediction mode list and the second intra-frame prediction mode list in the second intra-frame prediction mode list are combined to obtain 56*26*26 combined prediction modes.
[0563] The reordering principle may generally include: determining the cost information of the current block template under different combined prediction modes based on the difference between the predicted value of the current block template corresponding to the current block under different combined prediction modes and the reconstructed value of the current block template; and reordering the first prediction mode list that needs to be reordered based on the cost information of the previous block template under different combined prediction modes. The reordering principle may specifically include the following steps 1 to 4:
[0564] 1. Get the current block template corresponding to the current block.
[0565] 2. Determine the prediction value of the current block template under different combination prediction modes.
[0566] The process of determining the prediction value of the current block template in any combination prediction mode may include:
[0567] (1) Determine the weight template of the current block template in the combined prediction mode.
[0568] (2) Determine the intra-frame prediction value of the current block template in the combined prediction mode.
[0569] (3) Perform weighted prediction on the intra-frame prediction value according to the weight template to obtain the prediction value of the current block template in the combined prediction mode:
[0570] 3. Determine the cost information of the current block template under different combination prediction modes according to the difference between the prediction value of the current block template under different combination prediction modes and the reconstructed value of the current block template.
[0571] 4. Rearrange the first prediction mode list based on the cost information of the current block template under different combination prediction modes.
[0572] It should be noted that the execution process of reordering the first prediction mode list that needs to be reordered in sub-step s22 is the same as the execution process of sub-step s11 in the embodiment shown in Figure 12 above. For details, please refer to the specific description of sub-step s11 in the embodiment shown in Figure 12 above, and no further details will be given here.
[0573] S1303 , determining prediction mode indication information of the current block according to the prediction mode index corresponding to the prediction mode of the current block in the reordered prediction mode list; the prediction mode of the current block is used to predict the current block.
[0574] As described above, after determining the available prediction mode list in the prediction mode list, not all available prediction mode lists need to be rearranged. Therefore, the first prediction mode list that needs to be rearranged and the second prediction mode list that does not need to be rearranged can be determined in the available prediction mode list, and the first prediction mode list that needs to be rearranged is rearranged to obtain the rearranged first prediction mode list. Correspondingly, the prediction mode of the current block can include the first prediction mode in the rearranged first prediction mode list and the second prediction mode in the second prediction mode list, the first prediction mode corresponding to the first prediction mode index, and the second prediction mode corresponding to the second prediction mode index. The prediction mode indication information of the current block includes the first prediction mode index and the second prediction mode index of the current block.
[0575] For example, when the first prediction mode list that needs to be rearranged includes a weighted prediction mode list and N intra-frame prediction mode lists, the prediction mode index corresponding to the prediction mode of the current block may include: the weighted prediction mode index corresponding to the weighted prediction mode of the current block in the rearranged weighted prediction mode list, and the intra-frame prediction mode index corresponding to the intra-frame prediction mode of the current block in each rearranged intra-frame prediction mode list (for example, the N intra-frame prediction mode lists include the first intra-frame prediction mode list and the second intra-frame prediction mode list, and the intra-frame prediction mode index corresponding to the intra-frame prediction mode of the current block in each rearranged intra-frame prediction mode list may include: the first intra-frame prediction mode index corresponding to the first intra-frame prediction mode of the current block in the rearranged first intra-frame prediction mode list, and the second intra-frame prediction mode index corresponding to the second intra-frame prediction mode of the current block in the rearranged second intra-frame prediction mode list).
[0576] S1304: Encode the coding mode indication information and the prediction mode indication information into the video bitstream.
[0577] The coding mode indication information can be encoded into the sequence header of the video stream, the picture header of the video stream, or the slice header of the video stream. The following describes the coding mode indication information encoded into the sequence header of the video stream, the picture header of the video stream, or the slice header of the video stream:
[0578] 1. The coding mode indication information is encoded into the sequence header of the video stream:
[0579] The coding mode indication information encoded into the sequence header of the video stream may include any one of the first coding mode indication information, the second coding mode indication information and the third coding mode indication information.
[0580] (1) First coding mode indication information: The first coding mode indication information may include a sequence header spatial angle weighted prediction mode flag (seq_sawp_flag) and a sequence header rearrangement-based angle weighted prediction mode flag (seq_dawp_flag); the sequence header spatial angle weighted prediction mode flag may be set to a first value (the first value may be 1, for example), and the sequence header rearrangement-based angle weighted prediction mode flag may be set to a first value, and the sequence header spatial angle weighted prediction mode flag and the sequence header rearrangement-based angle weighted prediction mode flag may be encoded into the sequence header of the video bitstream.
[0581] (2) Second coding mode indication information: The second coding mode indication information may include a sequence header spatial angle weighted prediction mode flag (seq_sawp_flag); the sequence header spatial angle weighted prediction mode flag may be set to a second value (the second value may be 2, for example), and the sequence header spatial angle weighted prediction mode flag may be encoded into the sequence header of the video stream.
[0582] (3) Third coding mode indication information: The third coding mode indication information includes a sequence header angle weighted prediction mode flag (seq_awp_flag), a sequence header spatial domain angle weighted prediction mode flag (seq_sawp_flag), and a sequence header rearrangement-based angle weighted prediction mode flag (seq_dawp_flag); the sequence header angle weighted prediction mode flag or the sequence header spatial domain angle weighted prediction mode flag may be set to a first value (the first value may be 1, for example), and the sequence header rearrangement-based angle weighted prediction mode flag may be set to a first value; the sequence header angle weighted prediction mode flag, the sequence header spatial domain angle weighted prediction mode flag, and the sequence header rearrangement-based angle weighted prediction mode flag may be encoded into a sequence header of a video bitstream.
[0583] 2. The coding mode indication information is encoded into the picture header of the video stream:
[0584] The coding mode indication information encoded into the slice header of the video stream may include first coding mode indication information, second coding mode indication information, third coding mode indication information or fourth coding mode indication information.
[0585] (1) First coding mode indication information: The first coding mode indication information may include a picture header angle weighted prediction mode flag (pic_sawp_flag) and a picture header angle weighted prediction mode flag based on realignment (pic_dawp_flag); the picture header angle weighted prediction mode flag may be set to a first value (the first value may be 1, for example), and the picture header angle weighted prediction mode flag based on realignment may be set to a first value; the picture header angle weighted prediction mode flag and the picture header angle weighted prediction mode flag based on realignment may be encoded into the picture header of the video stream.
[0586] (2) Second coding mode indication information: The second coding mode indication information may include a picture header angle weighted prediction mode flag (pic_sawp_flag); the picture header angle weighted prediction mode flag may be set to a second value (the second value may be 2, for example), and the picture header angle weighted prediction mode flag may be encoded into the picture header of the video stream.
[0587] (3) Third coding mode indication information: The video code stream may further include a sequence header, which may include a sequence header spatial angle weighted prediction mode flag (seq_sawp_flag), and the third coding mode indication information may include a picture header based on rearrangement angle weighted prediction mode flag (pic_dawp_flag); the sequence header spatial angle weighted prediction mode flag may be set to a first value (the first value may be 1, for example), the picture header based on rearrangement angle weighted prediction mode flag may be set to a first value, and the picture header based on rearrangement angle weighted prediction mode flag may be encoded into the picture header of the video code stream.
[0588] (4) Fourth coding mode indication information: The video code stream may further include a sequence header, which may include a sequence header based on rearranged angle weighted prediction mode flag (seq_dawp_flag), and the fourth coding mode indication information may include a picture header based on rearranged angle weighted prediction mode flag (pic_dawp_flag); the sequence header based on rearranged angle weighted prediction mode flag may be set to a first value (the first value may be 1, for example), and the picture header based on rearranged angle weighted prediction mode flag may be set to the first value, and the picture header based on rearranged angle weighted prediction mode flag may be encoded into the picture header of the video code stream.
[0589] 3. The coding mode indication information is encoded into the header of the video stream:
[0590] The coding mode indication information encoded into the slice header of the video stream may include first coding mode indication information, second coding mode indication information, third coding mode indication information or fourth coding mode indication information.
[0591] (1) First coding mode indication information: The first coding mode indication information may include a slice header angle weighted prediction mode flag (slice_sawp_flag) and a slice header angle weighted prediction mode flag based on realignment (slice_dawp_flag); the slice header angle weighted prediction mode flag may be set to a first value (the first value may be 1, for example), and the slice header angle weighted prediction mode flag based on realignment may be set to a first value, and the slice header angle weighted prediction mode flag and the slice header angle weighted prediction mode flag based on realignment may be encoded into the slice header of the video stream.
[0592] (2) Second coding mode indication information: The second coding mode indication information may include a slice header angle weighted prediction mode flag (slice_sawp_flag), the slice header angle weighted prediction mode flag may be set to a second value (the second value may be 2, for example), and the slice header angle weighted prediction mode flag may be encoded into the slice header of the video stream.
[0593] (3) Third coding mode indication information: The video code stream may further include a picture header, which may include a picture header angle-weighted prediction mode flag (pic_sawp_flag), and the third coding mode indication information may include a slice header rearrangement-based angle-weighted prediction mode flag (slice_dawp_flag); the picture header angle-weighted prediction mode flag may be set to a first value (the first value may be 1, for example), and the slice header rearrangement-based angle-weighted prediction mode flag may be set to the first value, and it may be determined that the slice header rearrangement-based angle-weighted prediction mode flag is encoded into the slice header of the video code stream.
[0594] (4) Fourth coding mode indication information: The video code stream may further include a picture header, which may include a picture header based on rearranged angle weighted prediction mode flag (pic_dawp_flag), and the fourth coding mode indication information may include a slice header based on rearranged angle weighted prediction mode flag (slice_dawp_flag); the picture header based on rearranged angle weighted prediction mode flag may be set to a first value (the first value may be 1, for example), and the slice header based on rearranged angle weighted prediction mode flag may be set to the first value, and the slice header based on rearranged angle weighted prediction mode may be encoded into the slice header of the video code stream.
[0595] The prediction mode indication information may include the prediction mode index of the current block. For any prediction mode list (including a weighted prediction mode list or any intra-frame prediction mode list), that is, for any prediction mode index of the current block (including a weighted prediction mode index or any intra-frame prediction mode index), encoding the prediction mode indication information into the video bitstream may include:
[0596] A. When the number of prediction mode lists is one, the prediction mode index of the current block is directly encoded into the video stream.
[0597] B. When there are multiple prediction mode lists, the prediction mode indication information of the current block may also include the prediction mode list index of the current block. The prediction mode list index of the current block and the prediction mode index of the current block may be encoded in the video code stream; the prediction mode list corresponding to the prediction mode list index of the current block is the available prediction mode list.
[0598] In particular, for the case of multiple weight prediction mode lists, the prediction mode list may include a weight prediction mode list, and the multiple weight prediction mode lists belong to different weight prediction mode types; the prediction mode index may include a weight prediction mode index; and the weight prediction mode index of the current block under each weight prediction mode type may be encoded into the video code stream respectively.
[0599] In particular, in the case of multiple intra-frame prediction mode lists, the prediction mode lists may include intra-frame prediction mode lists, and the multiple intra-frame prediction mode lists may belong to two types: most probable mode (MPM) and non-most probable mode (non-MPM); the prediction mode index may include an intra-frame prediction mode index. When the intra-frame prediction mode index of the current block belongs to the non-most probable mode type, the intra-frame prediction mode list index of the current block and the intra-frame prediction mode index of the current block may be encoded into the video bitstream.
[0600] After introducing the encoding of the prediction mode indication information into the video bitstream, the following describes the encoding method of the prediction mode indication information. The encoding method used for the prediction mode indication information can include any of the following:
[0601] The first method is to use variable-length coding in whole or in part, for example, k-order exponential Golomb coding, truncated unary coding, or truncated binary coding.
[0602] The second method is to use fixed-length code for encoding in whole or in part.
[0603] The third type is that the prediction mode indication information includes a prefix and a suffix, and the prefix and the suffix are encoded using different methods. For the third case, it can include any of the following:
[0604] ① The prefix of the index in the prediction mode indication information is the group number, and the suffix is the index within the group. The group number and the index within the group use different encoding methods.
[0605] ② The index in the prediction mode indication information is a binary string, the prefix of the index in the prediction mode indication information is the partial index of the binary bit before the target bit (th), and the suffix of the index in the prediction mode indication information is the remaining part (that is, the partial index of the binary bit between the target bit and after the target bit).
[0606] In an embodiment of the present application, when the encoding mode of the current block is the rearranged encoding mode, the prediction mode list is rearranged so that in the rearranged prediction mode list, the prediction mode with a higher probability of being used by the current block has a smaller value of the corresponding prediction mode index; in this way, the value of the prediction mode index actually used by the current block is smaller, and less information is encoded when the prediction mode index of the current block is encoded into the video code stream, thereby improving the encoding efficiency of the prediction mode index of the current block, thereby improving the video encoding efficiency.
[0607] Please refer to Figure 14, which is a schematic diagram of the structure of a video processing device provided in an embodiment of the present application. The video processing device can be provided in a computer device provided in an embodiment of the present application, and the computer device can be a decoding device. The video processing device shown in Figure 14 can be a computer program running on the computer device, and the video processing device can be used to perform some or all of the steps in the method embodiment shown in Figure 12. Referring to Figure 14, the video processing device can include the following units:
[0608] Parsing unit 1401, used to parse the coding mode indication information of the current block in the video stream;
[0609] The parsing unit 1401 is further configured to parse prediction mode indication information of a current block in a video stream, where the prediction mode indication information includes a prediction mode index of the current block;
[0610] The processing unit 1402 is configured to, if the coding mode indication information indicates that the coding mode of the current block is the rearranged coding mode, rearrange the prediction mode list to obtain a rearranged prediction mode list;
[0611] The processing unit 1402 is further configured to determine a prediction mode of the current block in the reordered prediction mode list according to the prediction mode index of the current block;
[0612] The processing unit 1402 is further configured to predict the current block according to the prediction mode of the current block to obtain a prediction value of the current block; the prediction value of the current block is used to reconstruct a decoded image block of the current block.
[0613] In one implementation, the coding mode indication information is included in a sequence header of a video stream; the coding mode indication information includes any one of first coding mode indication information, second coding mode indication information, and third coding mode indication information;
[0614] The first coding mode indication information includes a sequence header spatial angle weighted prediction mode flag and a sequence header reordering-based angle weighted prediction mode flag; if the sequence header spatial angle weighted prediction mode flag is a first value, and the sequence header reordering-based angle weighted prediction mode flag is the first value, determining that the coding mode indication information indicates that the coding mode of the current block is the reordering coding mode;
[0615] The second coding mode indication information includes a sequence header spatial angle weighted prediction mode flag; if the sequence header spatial angle weighted prediction mode flag is a second value, determining that the coding mode indication information indicates that the coding mode of the current block is a reorder coding mode;
[0616] The third coding mode indication information includes a sequence head angle weighted prediction mode flag, a sequence head spatial angle weighted prediction mode flag and a sequence head rearrangement-based angle weighted prediction mode flag; if the sequence head angle weighted prediction mode flag or the sequence head spatial angle weighted prediction mode flag is a first value, and the sequence head rearrangement-based angle weighted prediction mode flag is the first value, then it is determined that the coding mode indication information indicates that the coding mode of the current block is a rearrangement coding mode.
[0617] In one implementation, the coding mode indication information is included in a picture header of a video stream; the coding mode indication information includes any one of first coding mode indication information, second coding mode indication information, third coding mode indication information, and fourth coding mode indication information;
[0618] The first coding mode indication information includes a picture header angle-weighted prediction mode flag and a picture header rearrangement-based angle-weighted prediction mode flag; if the picture header angle-weighted prediction mode flag is a first value and the picture header rearrangement-based angle-weighted prediction mode flag is the first value, determining that the coding mode indication information indicates that the coding mode of the current block is the rearrangement coding mode;
[0619] The second coding mode indication information includes a picture header angle weighted prediction mode flag; if the picture header angle weighted prediction mode flag is a second value, determining that the coding mode indication information indicates that the coding mode of the current block is a reorder coding mode;
[0620] The video code stream further includes a sequence header, the sequence header includes a sequence header spatial angle weighted prediction mode flag, and the third coding mode indication information includes a picture header based on reordering angle weighted prediction mode flag; if the sequence header spatial angle weighted prediction mode flag is a first value and the picture header based on reordering angle weighted prediction mode flag is the first value, determining that the coding mode indication information indicates that the coding mode of the current block is the reordering coding mode;
[0621] The video code stream also includes a sequence header, the sequence header includes a sequence header based on a rearranged angle weighted prediction mode flag, and the fourth coding mode indication information includes an image header based on a rearranged angle weighted prediction mode flag; if the sequence header based on a rearranged angle weighted prediction mode flag is a first value, and the image header based on a rearranged angle weighted prediction mode flag is a first value, it is determined that the coding mode indication information indicates that the coding mode of the current block is the said rearranged coding mode.
[0622] In one implementation, the coding mode indication information is included in a slice header of a video stream; the coding mode indication information includes any one of first coding mode indication information, second coding mode indication information, third coding mode indication information, and fourth coding mode indication information;
[0623] The first coding mode indication information includes a slice header angle-weighted prediction mode flag and a slice header rearrangement-based angle-weighted prediction mode flag; if the slice header angle-weighted prediction mode flag is a first value and the slice header rearrangement-based angle-weighted prediction mode flag is the first value, determining that the coding mode indication information indicates that the coding mode of the current block is the rearrangement coding mode;
[0624] The second coding mode indication information includes a slice header angle weighted prediction mode flag, and if the slice header angle weighted prediction mode flag is a second value, determining that the coding mode indication information indicates that the coding mode of the current block is a reorder coding mode;
[0625] The video code stream further includes a picture header, the picture header includes a picture header angle-weighted prediction mode flag, and the third coding mode indication information includes a slice header angle-weighted prediction mode flag based on reordering; if the picture header angle-weighted prediction mode flag is a first value and the slice header angle-weighted prediction mode flag based on reordering is the first value, determining that the coding mode of the coding mode indication information is the reordering coding mode;
[0626] The video code stream also includes an image header, which includes an image header based on rearranged angle weighted prediction mode flag, and the fourth coding mode indication information includes a slice header based on rearranged angle weighted prediction mode flag; if the image header based on rearranged angle weighted prediction mode flag is a first value, and the slice header based on rearranged angle weighted prediction mode flag is a first value, then the coding mode of the coding mode indication information is determined to be the rearranged coding mode.
[0627] In one implementation, the parsing unit 1401 is further configured to perform the following steps:
[0628] If the image type of the image to which the current block belongs is the first image type, triggering execution of parsing the coding mode indication information of the current block in the video stream;
[0629] If the image type of the image to which the current block belongs is an image type other than the second image type, triggering execution of parsing the coding mode indication information of the current block in the video stream;
[0630] The first image type is the same as or different from the second image type.
[0631] In one implementation, the parsing unit 1401 is configured to perform the following steps when parsing the prediction mode indication information of the current block in the video stream:
[0632] When the number of prediction mode lists is one, parse the prediction mode index of the current block in the video stream;
[0633] When there are multiple prediction mode lists, the prediction mode indication information of the current block also includes the prediction mode list index of the current block, parsing the prediction mode list index of the current block in the video code stream, and parsing the prediction mode index of the current block in the video code stream; the prediction mode list corresponding to the prediction mode list index of the current block is the available prediction mode list.
[0634] In one implementation, the prediction mode list includes a weighted prediction mode list, and the multiple weighted prediction mode lists belong to different weighted prediction mode types; the prediction mode index includes a weighted prediction mode index; and the parsing unit 1401 is configured to parse the prediction mode index of the current block in the video stream, specifically to perform the following steps:
[0635] Parse the weight prediction mode index of the current block in the video stream under each weight prediction mode type.
[0636] In one implementation, the prediction mode list includes an intra-frame prediction mode list, and the plurality of intra-frame prediction mode lists are of two types: most probable mode and non-most probable mode; the prediction mode index includes an intra-frame prediction mode index;
[0637] The parsing unit 1401 is configured to parse the prediction mode list index of the current block in the video stream, and when parsing the prediction mode index of the current block in the video stream, specifically performs the following steps:
[0638] If the intra prediction mode of the current block belongs to a non-most probable mode type, the intra prediction mode list index of the current block in the video stream is parsed, and the intra prediction mode index of the current block in the video stream is parsed.
[0639] In one implementation, the decoding method used for the prediction mode indication information includes any one of the following:
[0640] Decoding using variable-length codes in whole or in part;
[0641] Decoding using fixed-length codes in whole or in part;
[0642] The prediction mode indication information includes a prefix and a suffix, and the prefix and the suffix use different decoding methods.
[0643] In one implementation, the processing unit 1402 is configured to rearrange the prediction mode list to obtain the rearranged prediction mode list, and specifically to perform the following steps:
[0644] determining a list of available prediction modes in the prediction mode list;
[0645] The available prediction mode list is rearranged to obtain a rearranged prediction mode list.
[0646] In one implementation, the processing unit 1402 is configured to, when determining the available prediction mode list in the prediction mode list, perform any one of the following:
[0647] Determining an available prediction mode list in the prediction mode list according to the available indication information obtained by parsing the video code stream;
[0648] Determining an available prediction mode list in the prediction mode list according to an available determination rule, where the available determination rule is agreed upon by the encoding device and the decoding device;
[0649] An available prediction mode list is determined in the prediction mode list according to the prediction mode index that meets the available condition in the prediction mode list.
[0650] In one implementation, the prediction mode indices in the prediction mode list are divided into different groups;
[0651] The fact that the prediction mode index in the prediction mode list meets the availability condition means that the sequence number of the group to which the prediction mode index in the prediction mode list belongs is an available sequence number.
[0652] In one implementation, the prediction mode list includes an intra prediction mode list; and the processing unit 1402 is configured to determine an available prediction mode list in the prediction mode list, and further configured to perform any one of the following:
[0653] An available intra prediction mode list is determined in the intra prediction mode list according to the neighboring reconstructed blocks of the current block and / or the weighted prediction mode of the current block.
[0654] In one implementation, the prediction mode list includes a weighted prediction mode list, and the number of weighted prediction mode lists is multiple, and the multiple weighted prediction mode lists belong to different weighted prediction mode types; the processing unit 1402 is configured to, when determining an available prediction mode list in the prediction mode list, specifically perform the following steps:
[0655] In the weight prediction mode lists under different weight prediction mode types, available weight prediction mode lists are respectively determined.
[0656] In one implementation, the processing unit 1402 is configured to rearrange the available prediction mode list to obtain the rearranged prediction mode list, and specifically to perform the following steps:
[0657] determining, in the available prediction mode list, a first prediction mode list that needs to be rearranged and a second prediction mode list that does not need to be rearranged;
[0658] The first prediction mode list is rearranged to obtain a rearranged first prediction mode list.
[0659] In one implementation, the prediction mode index of the current block includes a first prediction mode index and a second prediction mode index, the first prediction mode index corresponds to the first prediction mode list, and the second prediction mode index corresponds to the second prediction mode list;
[0660] The processing unit 1402 is configured to, when determining a prediction mode of the current block in the reordered prediction mode list according to the prediction mode index of the current block, specifically perform the following steps: determining a first prediction mode of the current block in the reordered first prediction mode list according to the first prediction mode index; and determining a second prediction mode of the current block in the second prediction mode list according to the second prediction mode index;
[0661] The processing unit 1402 is configured to predict the current block according to the prediction mode of the current block to obtain a prediction value of the current block, including: predicting the current block according to the first prediction mode and the second prediction mode to obtain a prediction value of the current block.
[0662] In one implementation, the processing unit 1402 is further configured to perform the following steps:
[0663] Check the availability of the reorder coding mode for the current block;
[0664] If the reordering coding mode of the current block is available, it is triggered to determine a first prediction mode list that needs to be reordered and a second prediction mode list that does not need to be reordered in the available prediction mode list.
[0665] In one implementation, the processing unit 1402, when performing a usability check on the reorder coding mode of the current block, is configured to perform at least one of the following:
[0666] If the sample points of the current block template used to determine the current block corresponding to the current block have been reconstructed, then determining that the reordering coding mode of the current block is available;
[0667] If the size of the current block satisfies the size condition, determining that the reorder coding mode of the current block is available;
[0668] If the image component of the current block satisfies the component condition, it is determined that the reorder coding mode of the current block is available.
[0669] In one implementation, the first prediction mode list to be reordered includes a weighted prediction mode list; the processing unit 1402 is configured to reorder the first prediction mode list to obtain the reordered first prediction mode list, specifically to perform the following steps:
[0670] Get the current block template corresponding to the current block;
[0671] Determining prediction values of the current block template under different weight prediction modes in the weight prediction mode list;
[0672] Determining cost information of the current block template under different weight prediction modes according to differences between predicted values of the current block template under different weight prediction modes and reconstructed values of the current block template;
[0673] The first prediction mode list is rearranged based on cost information of the current block template under different weight prediction modes.
[0674] In one implementation, the processing unit 1402 is configured to obtain a current block template corresponding to the current block by performing the following steps:
[0675] determining a current block template in a reconstructed region surrounding the current block;
[0676] The current block template includes at least one of the following: one or more rows of sample points located above the current block in the reconstructed area; one or more columns of sample points located to the left of the current block in the reconstructed area; the current block template is obtained by sampling at a fixed interval in the reconstructed area; and sample points located to the left and above the current block in the reconstructed area.
[0677] In one implementation, the process of determining the prediction value of the current block template in any weighted prediction mode includes:
[0678] Determine the weight template of the current block template in the weight prediction mode;
[0679] Determining a list of available intra prediction modes according to the weighted prediction mode;
[0680] Determining an intra prediction mode for a current block template in a list of available intra prediction modes;
[0681] Determining an intra-frame prediction value of the current block template according to the intra-frame prediction mode of the current block template;
[0682] The intra-frame prediction value of the current block template is weightedly predicted according to the weight template to obtain the prediction value of the current block template under the weight prediction mode.
[0683] In one implementation, the processing unit 1402 is configured to determine the weight template of the current block template in the weight prediction mode, and is specifically configured to perform any of the following:
[0684] Deriving a weight template of the current block template according to the weight prediction mode;
[0685] The weight templates of the current block template in different weight prediction modes have been cached, and the weight template of the current block template in the weight prediction mode is initialized directly from the cache.
[0686] In one implementation, the processing unit 1402 is configured to derive the weight template of the current block template according to the weight prediction mode, and is specifically configured to perform the following steps:
[0687] deriving a weight matrix of the current block template according to the weight prediction mode;
[0688] Determine a weight template of the current block template according to the weight matrix and the weight threshold;
[0689] Alternatively, the weight prediction mode includes a weight prediction angle mode and a reference weight configuration mode; the division center position of the weight matrix is determined according to the weight prediction angle mode and the reference weight configuration mode, and the projection position of each sample point in the weight matrix under the weight prediction angle mode is determined; according to the relationship between the division center position and the projection position, the weight matrix is adjusted to obtain the weight template of the current block template under the weight prediction mode.
[0690] In one implementation, the processing unit 1402 is configured to determine the intra-frame prediction value of the current block template according to the intra-frame prediction mode of the current block template, and is specifically configured to perform any one of the following:
[0691] Determining a position of a prediction template of the current block template, the position of the prediction template corresponding to or not corresponding to the position of the current block template; determining a reference sample point for intra-prediction of the current block template according to the position of the prediction template; deriving an intra-prediction value of the current block template according to the reference sample point in accordance with the intra-prediction mode of the current block template;
[0692] The intra-frame prediction values of the current block template in different weight prediction modes have been cached, and the intra-frame prediction value of the current block template in the weight prediction mode is directly derived from the cache.
[0693] In one implementation, the processing unit 1402 is configured to derive the intra prediction value of the current block template according to the reference samples according to the intra prediction mode of the current block template, and is specifically configured to perform any one of the following:
[0694] Use a specific intra-frame interpolation filter to derive a prediction value of the current block template based on the reference sample points;
[0695] The same intra-frame interpolation filter as that of the current block is used to derive a prediction value of the current block template according to reference samples.
[0696] In one implementation, when the current block uses multiple intra-frame interpolation filters, the processing unit 1402 is configured to use the same intra-frame interpolation filter as the current block to derive a prediction value of the current block template based on reference samples, specifically performing the following steps:
[0697] Selecting an intra-frame interpolation filter from a plurality of intra-frame interpolation filters used for the current block;
[0698] The selected intra-frame interpolation filter is used to derive a prediction value of the current block template according to reference samples.
[0699] In one implementation, the first prediction mode list to be rearranged includes a weighted prediction mode list, a first intra-frame prediction mode list, and a second intra-frame prediction mode list; the prediction modes in each of the first prediction mode lists to be rearranged are combined to obtain a plurality of combined prediction modes; and the processing unit 1402 is configured to rearrange the first prediction mode list to obtain the rearranged first prediction mode list, specifically to perform the following steps:
[0700] Get the current block template corresponding to the current block;
[0701] Determine the prediction value of the current block template under different combination prediction modes;
[0702] determining cost information of the current block template under different combined prediction modes according to differences between predicted values of the current block template under different combined prediction modes and reconstructed values of the current block template;
[0703] The first prediction mode list is rearranged based on cost information of the current block template in different combination prediction modes.
[0704] In one implementation, the first prediction mode list to be reordered includes a weighted prediction mode list, a first intra-frame prediction mode list, and a second intra-frame prediction mode list; R weighted prediction modes in the weighted prediction mode list, P first intra-frame prediction modes in the first intra-frame prediction mode list, and Q second intra-frame prediction modes in the second intra-frame prediction mode list are combined to obtain R*P*Q combined prediction modes; cost information under the R*P*Q combined prediction modes constitutes a cost list; and the processing unit 1402 is configured to, when reordering the first prediction mode list based on the cost information under different combined prediction modes of the current block template, specifically perform the following steps:
[0705] Rearranging the weight prediction mode list according to the cost list to obtain a rearranged weight prediction mode list;
[0706] determining a first cost list corresponding to the first intra prediction mode list in the cost list, and reordering the first intra prediction mode list according to the first cost list to obtain a reordered first intra prediction mode list;
[0707] A second cost list corresponding to the second intra prediction mode list is determined in the cost list, and the second intra prediction mode list is rearranged according to the second cost list to obtain a rearranged second intra prediction mode list.
[0708] In one implementation, the processing unit 1402 is configured to perform the following steps when determining the first cost list corresponding to the first intra prediction mode list in the cost list:
[0709] After determining the weight prediction mode of the current block in the rearranged weight prediction mode list, the first cost list corresponding to the first intra-frame prediction mode list is determined based on the cost information under the first combined prediction mode in the cost list; the weight prediction mode constituting the first combined prediction mode is the weight prediction mode of the current block.
[0710] In one implementation, the processing unit 1402 is configured to, when determining the second cost list corresponding to the second intra prediction mode list in the cost list, perform any one of the following:
[0711] After determining the weighted prediction mode of the current block in the rearranged weighted prediction mode list, determining a second cost list corresponding to the second intra prediction mode list based on the cost information of the first combined prediction mode in the cost list; wherein the weighted prediction modes constituting the first combined prediction mode are the weighted prediction modes of the current block;
[0712] After determining the weight prediction mode of the current block in the rearranged weight prediction mode list and determining the first intra-frame prediction mode of the current block in the rearranged first intra-frame prediction mode list, the second cost list corresponding to the second intra-frame prediction mode list is determined according to the cost information in the second combined prediction mode in the cost list; wherein the weight prediction mode constituting the second combined prediction mode is the weight prediction mode of the current block, and the first intra-frame prediction mode constituting the second combined prediction mode is the first intra-frame prediction mode of the current block.
[0713] In one implementation, the prediction mode used by the current block includes a weighted prediction mode used by the current block and multiple intra-frame prediction modes used by the current block; the processing unit 1402 is configured to predict the current block according to the prediction mode of the current block, and when obtaining a prediction value of the current block, specifically to perform the following steps:
[0714] Derive the weight matrix of the current block according to the weight prediction mode adopted by the current block;
[0715] According to each intra prediction mode adopted by the current block, deriving the intra prediction value of the current block in each intra prediction mode;
[0716] According to the weight matrix of the current block, weighted prediction is performed on the intra prediction value of the current block in each intra prediction mode to obtain the prediction value of the current block.
[0717] According to one embodiment of the present application, the various units in the video processing device shown in Figure 14 can be separately or all merged into one or several other units to constitute, or some (some) units therein can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In actual applications, the function of a unit can also be realized by multiple units, or the function of multiple units can be realized by one unit. In other embodiments of the present application, the video processing device can also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0718] According to another embodiment of the present application, a video processing device as shown in FIG14 can be constructed, and the video processing method of the embodiment of the present application can be implemented by running a computer program capable of executing some or all of the steps involved in the method shown in FIG12 on a general-purpose computing device such as a computer, which includes processing elements and storage elements such as a central processing unit (CPU), a random access memory (RAM), and a read-only memory (ROM). The computer program can be recorded on, for example, a computer-readable storage medium, and loaded into the above-mentioned computing device via the computer-readable storage medium and executed therein.
[0719] In an embodiment of the present application, when the encoding mode of the current block is the rearranged encoding mode, the prediction mode list is rearranged so that in the rearranged prediction mode list, the prediction mode with a higher probability of being used by the current block has a smaller value corresponding to the prediction mode index; in this way, the value of the prediction mode index actually used by the current block is smaller, and less information is parsed when parsing the prediction mode index of the current block in the video code stream, thereby improving the decoding efficiency of the prediction mode index of the current block, thereby improving the video decoding efficiency.
[0720] Please refer to Figure 15, which is a schematic diagram of the structure of a video processing device provided in an embodiment of the present application. The video processing device can be provided in a computer device provided in an embodiment of the present application, and the computer device can be an encoding device. The video processing device shown in Figure 15 can be a computer program running on the computer device. The video processing device can be used to perform some or all of the steps in the method embodiment shown in Figure 13b. Referring to Figure 15, the video processing device can include the following units:
[0721] An acquiring unit 1501 is configured to acquire coding mode indication information of a current block;
[0722] The processing unit 1502 is configured to, if the coding mode indication information indicates that the coding mode of the current block is the rearranged coding mode, rearrange the prediction mode list to obtain a rearranged prediction mode list;
[0723] The processing unit 1502 is further configured to determine prediction mode indication information of the current block according to a prediction mode index corresponding to the prediction mode of the current block in the reordered prediction mode list; the prediction mode of the current block is used to predict the current block;
[0724] The processing unit 1502 is further configured to encode the coding mode indication information and the prediction mode indication information into the video bit stream.
[0725] According to one embodiment of the present application, the various units in the video processing device shown in Figure 15 can be separately or all merged into one or several other units to constitute, or some (some) units therein can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In actual applications, the functions of a unit can also be realized by multiple units, or the functions of multiple units can be realized by one unit. In other embodiments of the present application, the video processing device can also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0726] According to another embodiment of the present application, a video processing device as shown in FIG15 can be constructed, and the video processing method of the embodiment of the present application can be implemented by running a computer program capable of executing some or all of the steps involved in the method shown in FIG13b on a general-purpose computing device such as a computer, which includes processing elements and storage elements such as a central processing unit (CPU), a random access memory (RAM), and a read-only memory (ROM). The computer program can be recorded on, for example, a computer-readable storage medium, and loaded into the computing device via the computer-readable storage medium and executed therein.
[0727] In an embodiment of the present application, when the encoding mode of the current block is the rearranged encoding mode, the prediction mode list is rearranged so that in the rearranged prediction mode list, the prediction mode with a higher probability of being used by the current block has a smaller value of the corresponding prediction mode index; in this way, the value of the prediction mode index actually used by the current block is smaller, and less information is encoded when the prediction mode index of the current block is encoded into the video code stream, thereby improving the encoding efficiency of the prediction mode index of the current block, thereby improving the video encoding efficiency.
[0728] Please refer to Figure 16, which is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device shown in Figure 16 includes at least a processor 1601, an input interface 1602, an output interface 1603, and a computer-readable storage medium 1604. The processor 1601, input interface 1602, output interface 1603, and computer-readable storage medium 1604 may be connected via a bus or other means.
[0729] Computer-readable storage medium 1604 may be stored in a memory of a computer device. Computer-readable storage medium 1604 is used to store a computer program, which includes computer instructions. Processor 1601 is used to execute the computer program stored in computer-readable storage medium 1604. Processor 1601 (or CPU (Central Processing Unit)) is the computing and control core of the computer device and is suitable for implementing computer programs, specifically loading and executing computer programs to implement corresponding method processes or corresponding functions.
[0730] The embodiment of the present application also provides a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space that stores the operating system of the computer device. In addition, a computer program suitable for being loaded and executed by the processor is also stored in the storage space. It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory (Non-Volatile Memory), such as at least one disk storage; optionally, it can also be at least one computer-readable storage medium located away from the aforementioned processor.
[0731] In some embodiments, the computer device may be a decoding device, and the processor 1601 may load and execute a computer program stored in the computer-readable storage medium 1604 to implement corresponding steps in the video processing method shown in FIG. 12 .
[0732] In other embodiments, the computer device may be an encoding device, and the processor 1601 may load and execute a computer program stored in the computer-readable storage medium 1604 to implement the corresponding steps in the video processing method shown in FIG. 13 b .
[0733] In an embodiment of the present application, the prediction mode list is rearranged so that in the rearranged prediction mode list, the prediction mode with a higher possibility of being used by the current block has a smaller value of the corresponding prediction mode index; in this way, the value of the prediction mode index actually used by the current block is smaller, and when encoding and decoding the prediction mode index of the current block, less information is encoded and decoded, thereby improving the encoding and decoding efficiency of the prediction mode index of the current block, thereby improving the video encoding and decoding efficiency.
[0734] An embodiment of the present application further provides a method for processing a video code stream, wherein the video code stream is decoded based on the embodiment shown in FIG. 12 , or the video code stream is generated according to the embodiment shown in FIG. 13 b .
[0735] The present application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the above-described video processing method.
[0736] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program; the computer-readable storage medium also stores a video stream formed by the computer program. When the computer program is read and executed by a processor of a computer device, the computer device executes the video processing method in the embodiment shown in Figure 12 above to decode the video stream; or, when the computer program is read and executed by the processor of the computer device, the computer device executes the video processing method in the embodiment shown in Figure 13b above to generate a video stream and store the video stream in the computer-readable storage medium.
Claims
1. A video processing method, characterized in that: The method is performed by a decoding device, and includes: Parsing the coding mode indication information of the current block in the video stream; Parsing prediction mode indication information of the current block in the video code stream, where the prediction mode indication information includes a prediction mode index of the current block; If the coding mode indication information indicates that the coding mode of the current block is the rearranged coding mode, rearrange the prediction mode list to obtain a rearranged prediction mode list; determining, according to the prediction mode index of the current block, a prediction mode of the current block in the reordered prediction mode list; The current block is predicted according to the prediction mode of the current block to obtain a prediction value of the current block; the prediction value of the current block is used to reconstruct a decoded image block of the current block.
2. The method according to claim 1, wherein The coding mode indication information is included in the sequence header of the video stream; the coding mode indication information includes any one of first coding mode indication information, second coding mode indication information and third coding mode indication information; The first coding mode indication information includes a sequence header spatial angular weighted prediction mode flag and a sequence header reordering-based angular weighted prediction mode flag; if the sequence header spatial angular weighted prediction mode flag is a first value and the sequence header reordering-based angular weighted prediction mode flag is the first value, determining that the coding mode indication information indicates that the coding mode of the current block is the reordering coding mode; The second coding mode indication information includes a sequence header spatial angle weighted prediction mode flag; if the sequence header spatial angle weighted prediction mode flag is a second value, determining that the coding mode indicated by the coding mode indication information is the reordering coding mode; The third coding mode indication information includes a sequence head angle weighted prediction mode flag, a sequence head spatial angle weighted prediction mode flag and a sequence head rearrangement-based angle weighted prediction mode flag; if the sequence head angle weighted prediction mode flag or the sequence head spatial angle weighted prediction mode flag is a first value, and the sequence head rearrangement-based angle weighted prediction mode flag is the first value, then it is determined that the coding mode indication information indicates that the coding mode of the current block is the rearrangement coding mode.
3. The method according to any one of claims 1 to 2, characterized in that The coding mode indication information is included in the picture header of the video stream; the coding mode indication information includes any one of first coding mode indication information, second coding mode indication information, third coding mode indication information and fourth coding mode indication information; The first coding mode indication information includes a picture header angle-weighted prediction mode flag and a picture header rearrangement-based angle-weighted prediction mode flag; if the picture header angle-weighted prediction mode flag is a first value and the picture header rearrangement-based angle-weighted prediction mode flag is the first value, determining that the coding mode indicated by the coding mode indication information is the rearrangement coding mode; The second coding mode indication information includes a picture header angle weighted prediction mode flag; if the picture header angle weighted prediction mode flag is a second value, determining that the coding mode indicated by the coding mode indication information indicates that the coding mode of the current block is the reordering coding mode; The video code stream further includes a sequence header, the sequence header including a sequence header spatial angle weighted prediction mode flag, and the third coding mode indication information includes a picture header based on rearrangement angle weighted prediction mode flag; if the sequence header spatial angle weighted prediction mode flag is a first value and the picture header based on rearrangement angle weighted prediction mode flag is the first value, determining that the coding mode indication information indicates that the coding mode of the current block is the rearrangement coding mode; The video code stream also includes a sequence header, the sequence header includes a sequence header based on a rearranged angle weighted prediction mode flag, and the fourth coding mode indication information includes an image header based on a rearranged angle weighted prediction mode flag; if the sequence header based on a rearranged angle weighted prediction mode flag is a first value, and the image header based on a rearranged angle weighted prediction mode flag is a first value, it is determined that the coding mode indication information indicates that the coding mode of the current block is the rearranged coding mode.
4. The method according to any one of claims 1 to 3, wherein The coding mode indication information is included in the slice header of the video stream; the coding mode indication information includes any one of first coding mode indication information, second coding mode indication information, third coding mode indication information and fourth coding mode indication information; The first coding mode indication information includes a slice header angle-weighted prediction mode flag and a slice header rearrangement-based angle-weighted prediction mode flag; if the slice header angle-weighted prediction mode flag is a first value and the slice header rearrangement-based angle-weighted prediction mode flag is the first value, determining that the coding mode indicated by the coding mode indication information is the rearrangement coding mode; The second coding mode indication information includes a slice header angle weighted prediction mode flag, and if the slice header angle weighted prediction mode flag is a second value, determining that the coding mode indicated by the coding mode indication information is the reordered coding mode; The video code stream further includes a picture header, the picture header includes a picture header angle-weighted prediction mode flag, and the third coding mode indication information includes a slice header angle-weighted prediction mode flag based on reordering; if the picture header angle-weighted prediction mode flag is a first value and the slice header angle-weighted prediction mode flag based on reordering is the first value, determining that the coding mode of the coding mode indication information is the reordering coding mode; The video code stream also includes an image header, the image header includes an image header based on rearranged angle weighted prediction mode flag, and the fourth coding mode indication information includes a slice header based on rearranged angle weighted prediction mode flag; if the image header based on rearranged angle weighted prediction mode flag is a first value, and the slice header based on rearranged angle weighted prediction mode flag is a first value, then the coding mode of the coding mode indication information is determined to be the rearranged coding mode.
5. The method according to any one of claims 1 to 4, characterized in that The method further includes any of the following: If the image type of the image to which the current block belongs is the first image type, triggering execution of parsing the coding mode indication information of the current block in the video stream; If the image type of the image to which the current block belongs is an image type other than the second image type, triggering execution of parsing the coding mode indication information of the current block in the video stream; The first image type is the same as or different from the second image type.
6. The method according to any one of claims 1 to 5, wherein: The parsing of the prediction mode indication information of the current block in the video stream includes: When the number of the prediction mode list is one, parsing the prediction mode index of the current block in the video stream; When there are multiple prediction mode lists, the prediction mode indication information of the current block also includes a prediction mode list index of the current block, parsing the prediction mode list index of the current block in the video code stream, and parsing the prediction mode index of the current block in the video code stream; the prediction mode list corresponding to the prediction mode list index of the current block is an available prediction mode list.
7. The method according to any one of claims 1 to 6, wherein: The prediction mode list includes a weighted prediction mode list, and the plurality of weighted prediction mode lists belong to different weighted prediction mode types; the prediction mode index includes a weighted prediction mode index; and parsing the prediction mode index of the current block in the video stream includes: Parse the weight prediction mode index of the current block in the video stream under each weight prediction mode type.
8. The method according to any one of claims 1 to 7, wherein: The prediction mode list includes an intra-frame prediction mode list, and the plurality of intra-frame prediction mode lists belong to two types: most probable mode and non-most probable mode; the prediction mode index includes an intra-frame prediction mode index; The parsing of the prediction mode list index of the current block in the video stream, and parsing of the prediction mode index of the current block in the video stream, include: If the intra prediction mode of the current block belongs to the non-most probable mode type, parsing the intra prediction mode list index of the current block in the video stream, and parsing the intra prediction mode index of the current block in the video stream.
9. The method according to any one of claims 1 to 8, wherein The decoding method used by the prediction mode indication information includes any one of the following: Decoding using variable-length codes in whole or in part; Decoding using fixed-length codes in whole or in part; The prediction mode indication information includes a prefix and a suffix, and the prefix and the suffix use different decoding methods.
10. The method according to any one of claims 1 to 9, wherein The reordering of the prediction mode list to obtain a reordered prediction mode list includes: determining an available prediction mode list in the prediction mode list; The available prediction mode list is rearranged to obtain the rearranged prediction mode list.
11. The method according to any one of claims 1 to 10, wherein: Determining the available prediction mode list in the prediction mode list includes any one of the following: Determining the available prediction mode list in the prediction mode list according to the available indication information obtained by parsing the video stream; Determining the available prediction mode list in the prediction mode list according to an available determination rule; The available prediction mode list is determined in the prediction mode list according to the prediction mode index that meets the availability condition in the prediction mode list.
12. The method according to any one of claims 1 to 11, wherein: The prediction mode indexes in the prediction mode list are divided into different groups; The fact that the prediction mode index in the prediction mode list meets the availability condition means that the sequence number of the group to which the prediction mode index in the prediction mode list belongs is an available sequence number.
13. The method according to any one of claims 1 to 12, wherein: The prediction mode list includes an intra prediction mode list; and determining an available prediction mode list in the prediction mode list further includes: An available intra prediction mode list is determined in the intra prediction mode list according to a neighboring reconstructed block of the current block or a weighted prediction mode of the current block.
14. The method according to any one of claims 1 to 13, wherein: The prediction mode list includes a weighted prediction mode list, the number of the weighted prediction mode lists is multiple, and the multiple weighted prediction mode lists belong to different weighted prediction mode types; Determining the available prediction mode list in the prediction mode list includes: In the weight prediction mode lists under different weight prediction mode types, available weight prediction mode lists are respectively determined.
15. The method according to any one of claims 1 to 14, wherein: The reordering of the available prediction mode list to obtain the reordered prediction mode list includes: Determining a first prediction mode list that needs to be rearranged and a second prediction mode list that does not need to be rearranged in the available prediction mode list; The first prediction mode list is rearranged to obtain a rearranged first prediction mode list.
16. The method according to any one of claims 1 to 15, wherein: The prediction mode index of the current block includes a first prediction mode index and a second prediction mode index, the first prediction mode index corresponds to the first prediction mode list, and the second prediction mode index corresponds to the second prediction mode list; Determining the prediction mode of the current block in the rearranged prediction mode list according to the prediction mode index of the current block includes: determining the first prediction mode of the current block in the rearranged first prediction mode list according to the first prediction mode index; and determining the second prediction mode of the current block in the second prediction mode list according to the second prediction mode index; The predicting the current block according to the prediction mode of the current block to obtain the prediction value of the current block includes: predicting the current block according to the first prediction mode and the second prediction mode to obtain the prediction value of the current block.
17. The method according to any one of claims 1 to 16, wherein: The method further comprises: Performing a usability check on the reordered coding mode of the current block; If the reordering coding mode of the current block is available, triggering execution of the first prediction mode list that needs to be reordered and the second prediction mode list that does not need to be reordered determined in the available prediction mode list.
18. The method according to any one of claims 1 to 17, wherein: The checking the availability of the reordered coding mode of the current block includes at least one of the following: If the sample points of the current block template used to determine the current block corresponding to the current block have been reconstructed, determining that the reordering coding mode of the current block is available; If the size of the current block satisfies the size condition, determining that the reordering coding mode of the current block is available; If the image component of the current block satisfies the component condition, it is determined that the reorder coding mode of the current block is available.
19. The method according to any one of claims 1 to 18, wherein: The first prediction mode list to be rearranged includes a weighted prediction mode list; and the first prediction mode list is rearranged to obtain a rearranged first prediction mode list, including: Obtaining a current block template corresponding to the current block; Determining prediction values of the current block template under different weight prediction modes in the weight prediction mode list; determining cost information of the current block template under different weight prediction modes according to differences between predicted values of the current block template under different weight prediction modes and a reconstructed value of the current block template; The first prediction mode list is rearranged based on cost information of the current block template under different weight prediction modes.
20. The method according to any one of claims 1 to 19, wherein The obtaining of the current block template corresponding to the current block includes: determining the current block template in a reconstructed area around the current block; The current block template includes at least one of the following: one or more rows of sample points located above the current block in the reconstructed area; one or more columns of sample points located to the left of the current block in the reconstructed area; the current block template is obtained by sampling at a fixed interval in the reconstructed area; and sample points located to the left and above the current block in the reconstructed area.
21. The method according to any one of claims 1 to 20, wherein: The process of determining the prediction value of the current block template in any weight prediction mode includes: Determining a weight template of the current block template in the weight prediction mode; Determining a list of available intra prediction modes according to the weighted prediction mode; Determining the intra prediction mode of the current block template in the available intra prediction mode list; Determining an intra-frame prediction value of the current block template according to the intra-frame prediction mode of the current block template; The intra-frame prediction value of the current block template is weighted predicted according to the weight template to obtain the prediction value of the current block template in the weight prediction mode.
22. The method according to any one of claims 1 to 21, wherein: The determining of the weight template of the current block template in the weight prediction mode includes any one of the following: deriving a weight template of the current block template according to the weight prediction mode; The weight templates of the current block template in different weight prediction modes have been cached, and the weight template of the current block template in the weight prediction mode is initialized directly from the cache.
23. The method according to any one of claims 1 to 22, wherein: The deriving of the weight template of the current block template according to the weight prediction mode includes: Deriving a weight matrix of the current block template according to the weight prediction mode; determining a weight template of the current block template according to the weight matrix and a weight threshold; Alternatively, the weight prediction mode includes a weight prediction angle mode and a reference weight configuration mode; the division center position of the weight matrix is determined according to the weight prediction angle mode and the reference weight configuration mode, and the projection position of each sample point in the weight matrix under the weight prediction angle mode is determined; according to the relationship between the division center position and the projection position, the weight matrix is adjusted to obtain the weight template of the current block template under the weight prediction mode.
24. The method according to any one of claims 1 to 23, wherein: The determining, according to the intra prediction mode of the current block template, the intra prediction value of the current block template includes any one of the following: Determining a position of a prediction template of the current block template, where the position of the prediction template corresponds to or does not correspond to the position of the current block template; and determining a reference sample for performing intra-frame prediction on the current block template according to the position of the prediction template; deriving an intra-frame prediction value of the current block template according to the reference sample points according to the intra-frame prediction mode of the current block template; The intra-frame prediction values of the current block template in different weight prediction modes have been cached, and the intra-frame prediction value of the current block template in the weight prediction mode is directly derived from the cache.
25. The method according to any one of claims 1 to 24, wherein: The deriving the intra prediction value of the current block template according to the reference sample point according to the intra prediction mode of the current block template includes any one of the following: Using a specific intra-frame interpolation filter, deriving a prediction value of the current block template according to the reference sample points; Using the same intra-frame interpolation filter as that of the current block, a prediction value of the current block template is derived according to the reference samples.
26. The method according to any one of claims 1 to 25, wherein: When the current block uses multiple intra-frame interpolation filters, the using the same intra-frame interpolation filter as the current block to derive a prediction value of the current block template according to the reference sample point includes: Selecting an intra-frame interpolation filter from a plurality of intra-frame interpolation filters used by the current block; The selected intra-frame interpolation filter is used to derive a prediction value of the current block template according to the reference samples.
27. The method according to any one of claims 1 to 26, wherein: The first prediction mode list to be rearranged includes a weighted prediction mode list, a first intra-frame prediction mode list, and a second intra-frame prediction mode list; the prediction modes in each of the first prediction mode lists to be rearranged are combined to obtain a plurality of combined prediction modes; The reordering of the first prediction mode list to obtain a reordered first prediction mode list includes: Obtaining a current block template corresponding to the current block; Determining prediction values of the current block template under different combination prediction modes; determining cost information of the current block template in different combined prediction modes according to differences between predicted values of the current block template in different combined prediction modes and a reconstructed value of the current block template; The first prediction mode list is rearranged based on cost information of the current block template in different combination prediction modes.
28. The method according to any one of claims 1 to 27, wherein The R weighted prediction modes in the weighted prediction mode list, the P first intra prediction modes in the first intra prediction mode list, and the Q second intra prediction modes in the second intra prediction mode list are combined to obtain R*P*Q combined prediction modes; cost information under the R*P*Q combined prediction modes constitutes a cost list; and reordering the first prediction mode list based on the cost information of the current block template under different combined prediction modes includes: Rearranging the weighted prediction mode list according to the cost list to obtain a re-arranged weighted prediction mode list; determining a first cost list corresponding to the first intra prediction mode list in the cost list, and reordering the first intra prediction mode list according to the first cost list to obtain a reordered first intra prediction mode list; A second cost list corresponding to the second intra prediction mode list is determined in the cost list, and the second intra prediction mode list is rearranged according to the second cost list to obtain a rearranged second intra prediction mode list.
29. The method according to any one of claims 1 to 28, wherein Determining the first cost list corresponding to the first intra prediction mode list in the cost list includes: After determining the weight prediction mode of the current block in the rearranged weight prediction mode list, the first cost list corresponding to the first intra-frame prediction mode list is determined based on the cost information under the first combined prediction mode in the cost list; the weight prediction mode constituting the first combined prediction mode is the weight prediction mode of the current block.
30. The method according to any one of claims 1 to 29, wherein Determining the second cost list corresponding to the second intra prediction mode list in the cost list includes any one of the following: After determining the weighted prediction mode of the current block in the rearranged weighted prediction mode list, determining a second cost list corresponding to the second intra prediction mode list based on cost information of the first combined prediction mode in the cost list; wherein the weighted prediction modes constituting the first combined prediction mode are the weighted prediction modes of the current block; After determining the weight prediction mode of the current block in the rearranged weight prediction mode list and determining the first intra-frame prediction mode of the current block in the rearranged first intra-frame prediction mode list, determine the second cost list corresponding to the second intra-frame prediction mode list according to the cost information of the second combined prediction mode in the cost list; wherein, the weight prediction mode constituting the second combined prediction mode is the weight prediction mode of the current block, and the first intra-frame prediction mode constituting the second combined prediction mode is the first intra-frame prediction mode of the current block.
31. The method according to any one of claims 1 to 30, wherein The prediction mode adopted by the current block includes a weighted prediction mode adopted by the current block and multiple intra-frame prediction modes adopted by the current block; The predicting the current block according to the prediction mode of the current block to obtain a prediction value of the current block includes: deriving a weight matrix for the current block according to a weight prediction mode adopted by the current block; According to each intra-frame prediction mode adopted by the current block, deriving an intra-frame prediction value of the current block in each intra-frame prediction mode; According to the weight matrix of the current block, weighted prediction is performed on the intra-frame prediction value of the current block in each intra-frame prediction mode to obtain the prediction value of the current block.
32. A video processing method, characterized in that: The method is performed by an encoding device, and includes: Obtaining the coding mode indication information of the current block; If the coding mode indication information indicates that the coding mode of the current block is the rearranged coding mode, rearrange the prediction mode list to obtain a rearranged prediction mode list; determining prediction mode indication information of the current block according to a prediction mode index corresponding to the prediction mode of the current block in the reordered prediction mode list; the prediction mode of the current block is used to predict the current block; The encoding mode indication information and the prediction mode indication information are encoded into a video code stream.
33. A video processing device, characterized in that: include: A parsing unit, configured to parse the coding mode indication information of the current block in the video stream; The parsing unit is further configured to parse prediction mode indication information of the current block in the video stream, where the prediction mode indication information includes a prediction mode index of the current block; a processing unit, configured to, if the coding mode indication information indicates that the coding mode of the current block is the rearranged coding mode, rearrange the prediction mode list to obtain a rearranged prediction mode list; The processing unit is further configured to determine a prediction mode of the current block in the reordered prediction mode list according to the prediction mode index of the current block; The processing unit is further configured to predict the current block according to the prediction mode of the current block to obtain a prediction value of the current block; the prediction value of the current block is used to reconstruct a decoded image block of the current block.
34. A video processing device, characterized in that: include: An acquiring unit, configured to acquire coding mode indication information of a current block; a processing unit, configured to, if the coding mode indication information indicates that the coding mode of the current block is the rearranged coding mode, rearrange the prediction mode list to obtain a rearranged prediction mode list; The processing unit is further configured to determine prediction mode indication information of the current block according to a prediction mode index corresponding to the prediction mode of the current block in the reordered prediction mode list; the prediction mode of the current block is used to predict the current block; The processing unit is further configured to encode the encoding mode indication information and the prediction mode indication information into a video code stream.
35. A computer device, characterized in that: The computer device comprises: a processor suitable for implementing a computer program; A computer-readable storage medium storing a computer program; the computer-readable storage medium further storing a video stream generated by the computer program, the computer program being suitable for being loaded by the processor and executing the video processing method according to any one of claims 1 to 31 to decode the video stream; or the computer program being suitable for being loaded by the processor and executing the video processing method according to claim 32 to generate a video stream and store the video stream in the computer-readable storage medium.
36. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program; the computer-readable storage medium also stores a video code stream formed by the computer program, and the computer program is suitable for being loaded by a processor and executing the video processing method according to any one of claims 1 to 31 to decode the video code stream; or, the computer program is suitable for being loaded by a processor and executing the video processing method according to claim 32 to generate a video code stream and store the video code stream in the computer-readable storage medium.
37. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the video processing method according to any one of claims 1 to 31 or the video processing method according to claim 32 is implemented.
38. A method for processing a video stream, characterized in that: The video code stream is decoded based on the video processing method according to any one of claims 1-31, or the video code stream is generated according to the video processing method according to claim 32.
Citation Information
Patent Citations
Inter-frame prediction method, video encoding method, and related device
CN112055203A
Video encoding / decoding method and device
CN113170117A
Video coding and decoding method and device, computer readable medium and electronic equipment
CN115086654A
Intra prediction method, encoder, decoder, and storage medium
CN116980594A
Image decoding method, image encoding method, and method for transmitting bitstream
CN117395403A