Intra prediction method, encoder, decoder and storage medium
The method improves intra prediction in video coding by determining a weighting matrix derivation mode and using two intra prediction modes to combine prediction blocks, addressing the inefficiencies of existing methods in handling complex textures.
Patent Information
- Application Number
- JP2023533982
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2020-12-03
- Filing Date
- 2020-12-24
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2040-12-24
AI Technical Summary
Existing intra prediction methods in video coding can only handle simple texture prediction and become complex and inefficient for predicting complex textures, leading to increased storage capacity and time required for encoding and decoding.
The proposed method determines a weighting matrix derivation mode for the current block when using the SAWP mode, and then determines two intra prediction modes and a weighting matrix based on this mode to combine prediction blocks and improve prediction accuracy.
This approach reduces complexity while improving intra prediction quality, resulting in enhanced compression performance by allowing the encoder/decoder to determine two different prediction blocks and combine them using weight matrices.
Smart Images

Figure 0007689576000031 
Figure 0007689576000032 
Figure 0007689576000033
Abstract
Description
[Technical field]
[0001] (CROSS-REFERENCE TO RELATED APPLICATIONS) This application is based on an international patent application having a filing date of December 3, 2020 and application number PCT / CN2020 / 133708, and claims priority to that international patent application, the entire contents of which are incorporated herein by reference.
[0002] The present embodiment relates to the field of image processing technology, and in particular to an intra prediction method, an encoder, a decoder, and a storage medium. [Background technology]
[0003] In order to capture more subtle edge directions expressed in natural images, Versatile Video Coding (VVC) expands the 33 intra luminance prediction angle modes defined in the video compression standard (High Efficiency Video Coding (HEVC)) to 65, and also includes two non-angle modes: Planar mode, numbered 0, and Direct Current (DC) mode, numbered 1.
[0004] Common intra prediction modes include DC mode, Planar mode, Bilinear mode, etc., but all of them can only handle simple texture prediction, and even if more and more angle modes are added, the prediction of the angle mode can only be done along a straight line with one angle. Therefore, existing intra prediction modes can only handle simple texture prediction. For complex textures, the prediction needs to be divided into smaller blocks, which increases the complexity, and correspondingly, the storage capacity and overall time required for the encoding and decoding process also increase significantly, resulting in a decrease in encoding and decoding efficiency. Summary of the Invention [Problem to be solved by the invention]
[0005] DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS The present embodiments provide an intra prediction method, an encoder, a decoder and a storage medium that can improve compression performance by reducing complexity while improving intra prediction quality. [Means for solving the problem]
[0006] The technical solution of the present embodiment can be realized as follows.
[0007] According to a first aspect, an embodiment of the present application provides an intra prediction method, applied to an encoder, the method comprising: determining a weighting matrix derivation mode for the current block when the intra prediction value of the current block is determined using a SAWP mode; determining a first intra prediction mode and a second intra prediction mode of the current block based on the weighting matrix derivation mode, and determining a weighting matrix of the current block based on the weighting matrix derivation mode; determining a prediction value for the current block based on the first intra-prediction mode, the second intra-prediction mode and the weighting matrix.
[0008] According to a second aspect, an embodiment of the present application provides an intra prediction method, applied to an encoder, the method comprising: determining a mode list for the current block if the intra prediction value of the current block is determined using a SAWP mode; determining a first intra-prediction mode and a second intra-prediction mode of the current block based on the mode list; determining a prediction value for the current block based on the first intra-prediction mode and the second intra-prediction mode.
[0009] According to a third aspect, an embodiment of the present invention provides an intra prediction method, applied to a decoder, comprising: Parsing the bitstream to determine intra-prediction mode parameters for a current block; determining a weighting matrix derivation mode for the current block if the intra prediction mode parameter indicates that the intra prediction value of the current block is determined using a SAWP mode; and determining a first intra prediction mode and a second intra prediction mode of the current block based on the weighting matrix derivation mode, and determining a weighting matrix of the current block based on the weighting matrix derivation mode; determining a prediction value for the current block based on the first intra-prediction mode, the second intra-prediction mode and the weighting matrix.
[0010] According to a fourth aspect, an embodiment of the present invention provides an intra prediction method, applied to a decoder, the method comprising: Parsing the bitstream to determine intra-prediction mode parameters for a current block; determining a mode list for the current block if the intra prediction mode parameter indicates that the intra prediction value of the current block is determined using a SAWP mode; determining a first intra-prediction mode and a second intra-prediction mode of the current block based on the mode list; determining a prediction value for the current block based on the first intra-prediction mode and the second intra-prediction mode.
[0011] According to a fifth aspect, an embodiment of the present invention provides an encoder including a first determination unit, the first determination unit is configured to determine a weighting matrix derivation mode for the current block when an intra prediction value of the current block is determined using a SAWP mode, determine a first intra prediction mode and a second intra prediction mode for the current block based on the weighting matrix derivation mode, determine a weighting matrix for the current block based on the weighting matrix derivation mode, and determine a prediction value of the current block based on the first intra prediction mode, the second intra prediction mode, and the weighting matrix; or The first determination unit is configured to, when an intra prediction value of the current block is determined using a SAWP mode, determine a mode list for the current block, determine a first intra prediction mode and a second intra prediction mode of the current block based on the mode list, and determine a prediction value of the current block based on the first intra prediction mode and the second intra prediction mode.
[0012] According to a sixth aspect, an embodiment of the present application provides an encoder, the encoder comprising a first processor and a first memory storing instructions executable by the first processor, the instructions causing the first processor to perform the above-mentioned intra prediction method.
[0013] According to a seventh aspect, an embodiment of the present invention provides a decoder, comprising: a decoding unit; and a second determination unit, The decoding unit is configured to parse the bitstream; the second determination unit is configured to determine an intra prediction mode parameter of a current block, and if the intra prediction mode parameter indicates that an intra prediction value of the current block is determined using a SAWP mode, determine a weighting matrix derivation mode of the current block, determine a first intra prediction mode and a second intra prediction mode of the current block based on the weighting matrix derivation mode, determine a weighting matrix of the current block based on the weighting matrix derivation mode, and determine a prediction value of the current block based on the first intra prediction mode, the second intra prediction mode and the weighting matrix; or The second determination unit is configured to determine intra prediction mode parameters of the current block, and if the intra prediction value of the current block is determined using a SAWP mode, determine a mode list for the current block, determine a first intra prediction mode and a second intra prediction mode of the current block based on the mode list, and determine a prediction value of the current block based on the first intra prediction mode and the second intra prediction mode.
[0014] According to an eighth aspect, an embodiment of the present application provides a decoder, the decoder comprising a second processor and a second memory storing instructions executable by the second processor, the instructions causing the second processor to execute the above-mentioned intra prediction method.
[0015] According to a ninth aspect, an embodiment of the present application provides a computer storage medium having stored thereon a computer program for causing a first processor and a second processor to execute the above-mentioned intra prediction method. Effect of the Invention
[0016] The present embodiment provides an intra prediction method, an encoder, a decoder, and a storage medium, and in one aspect, when an intra prediction value of a current block is determined using a SAWP mode, a weight matrix derivation mode of the current block is determined, a first intra prediction mode and a second intra prediction mode of the current block are determined based on the weight matrix derivation mode, a weight matrix of the current block is determined based on the weight matrix derivation mode, and a prediction value of the current block is determined based on the first intra prediction mode, the second intra prediction mode, and the weight matrix. In another aspect, when an intra prediction value of a current block is determined using a SAWP mode, a mode list of the current block is determined, a first intra prediction mode and a second intra prediction mode of the current block are determined based on the mode list, and a prediction value of the current block is determined based on the first intra prediction mode and the second intra prediction mode. That is, in the embodiment of the present application, the encoder / decoder can determine two different prediction blocks of the current block according to two different intra prediction modes, and can finally obtain a more complex prediction block by combining the prediction blocks using various weight matrices, thereby improving the prediction accuracy, and further, the encoder / decoder can also construct an MPM list using the correlation between the weight matrix and the prediction mode, thereby greatly reducing the complexity. That is, the intra prediction method proposed in the present application can reduce the complexity while improving the quality of the intra prediction, thereby improving the compression performance. [Brief description of the drawings]
[0017] [Figure 1] 1 is a schematic diagram of weight assignment. [Diagram 2] 2 is a schematic diagram of weight allocation. [Diagram 3] 1 is a schematic diagram of intra prediction. [Figure 4] 2 is a schematic diagram of intra prediction. [Figure 5A] 3 is a schematic diagram of intra prediction. [Figure 5B] 3 is a schematic diagram of intra prediction. [Figure 5C] 3 is a schematic diagram of intra prediction. [Figure 5D] 3 is a schematic diagram of intra prediction. [Figure 5E] 3 is a schematic diagram of intra prediction. [Figure 5F] 3 is a schematic diagram of intra prediction. [Figure 5G] 3 is a schematic diagram of intra prediction. [Figure 5H] 3 is a schematic diagram of intra prediction. [Figure 5I] 3 is a schematic diagram of intra prediction. [Figure 6] 1 is a schematic diagram of intra prediction modes. [Figure 7] 2 is a schematic diagram of intra prediction modes. [Figure 8] 3 is a schematic diagram of intra prediction modes. [Figure 9] FIG. 1 is a block diagram of a video encoding system configuration. [Figure 10] FIG. 1 is a block diagram of a configuration of a video decoding system. [Figure 11] 1 is a schematic diagram of the realization process of the intra prediction method; [Figure 12] FIG. 1 is a schematic diagram of a SAWP mode. [Figure 13] 3 is a schematic diagram of intra prediction. [Figure 14] FIG. 2 is a schematic diagram of adjacent blocks. [Figure 15] FIG. 1 is a schematic diagram of clustering. [Figure 16] FIG. 2 is a schematic diagram of intra-prediction mode selection. [Figure 17] 2 is a schematic diagram of the realization process of the intra prediction method; [Figure 18] 3 is a schematic diagram of the realization process of the intra prediction method; [Figure 19] 4 is a schematic diagram of the realization process of the intra prediction method. [Figure 20]1 is a schematic structural diagram of an encoder according to an embodiment of the present invention; [Figure 21] FIG. 2 is a schematic structural diagram of an encoder according to an embodiment of the present invention. [Figure 22] FIG. 1 is a schematic structural diagram of a decoder according to an embodiment of the present invention. [Diagram 23] FIG. 2 is a schematic structural diagram of a decoder according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0018] Hereinafter, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application. It can be understood that the specific embodiments described in this specification are only for illustrating the relevant application, and do not limit the application. In addition, it should be noted that for convenience of description, only the parts related to the present application are shown in the drawings.
[0019] Currently, common video coding and decoding standards are based on a block-based hybrid coding framework. Each frame in a video image is divided into square Largest Coding Units (LCUs) of the same size (e.g., 128×128, 64×64, etc.), each Largest Coding Unit may be divided into rectangular Coding Units (CUs) according to a rule, and the Coding Units may be further divided into smaller Prediction Units (PUs). Specifically, the hybrid coding framework may include modules such as prediction, transform, quantization, entropy coding, in-loop filter, etc., where the prediction module may include intra prediction and inter prediction, and the inter prediction may include motion estimation and motion compensation. Since there is a strong correlation between adjacent pixels in one frame of a video image, the intra prediction method can be used in video coding and decoding technology to eliminate the spatial redundancy between adjacent pixels. However, since there is also a strong similarity between adjacent frames in a video image, the inter prediction method can be used in video coding and decoding technology to eliminate the temporal redundancy between adjacent frames, thereby improving the coding and decoding efficiency.
[0020] The basic process of a video codec is as follows: on the encoding side, a picture of one frame is divided into blocks, intra prediction or inter prediction is performed on the current block to generate a predicted block of the current block, the predicted block is subtracted from the original block of the current block to obtain a residual block, transform and quantize the residual block to obtain a quantized coefficient matrix, and perform entropy coding on the quantized coefficient matrix to output to a bitstream. On the decoding side, intra prediction or inter prediction is performed on the current block to generate a predicted block of the current block, while analyzing the bitstream to obtain a quantized coefficient matrix, perform inverse quantization and inverse transform on the quantized coefficient matrix to obtain a residual block, and add the predicted block and the residual block to obtain a reconstructed block. The reconstructed block forms a reconstructed image, and based on the image or block, loop filtering is performed on the reconstructed image to obtain a decoded image. On the encoding side, the same operations as on the decoding side must also be performed to obtain a decoded image. The decoded image can be used as a reference frame for the inter prediction of the subsequent frame. If necessary, the encoding side needs to output the mode information or parameter information such as block division information, prediction, transformation, quantization, entropy coding, loop filtering, etc. determined by the encoding side to the bit stream. The decoding side can determine the same block division information, prediction, transformation, quantization, entropy coding, loop filtering, etc. mode information or parameter information as the encoding side by analyzing based on analysis and existing information, thereby ensuring that the decoded image obtained by the encoding side is the same as the decoded image obtained by the decoding side. The decoded image obtained by the encoding side is usually also called a reconstructed image. When predicting, the current block can be divided into prediction units, and when transforming, the current block can be divided into transform units, and the division of the prediction units and the transform units may be different.The above description is a basic process of a video encoder-decoder in a block-based hybrid coding framework, and as technology develops, some modules or steps of the framework or process may be optimized, and the embodiments of the present application are suitable for, but are not limited to, the basic process of a video encoder-decoder in the block-based hybrid coding framework.
[0021] The current block may be a current coding unit (CU) or a current prediction unit (PU), etc.
[0022] In the case of inter prediction, a decoded or reconstructed image, or information called a reference frame, is used to predict the current block. In inter prediction, motion information is used to find a reference block from a reference frame, and a prediction block is generated based on the reference block. The motion information includes a reference frame list to which the reference frame belongs, a reference frame index, and a motion vector. The motion vector may be full pixel or sub-pixel, and if the motion vector is sub-pixel, a block of the required sub-pixel of the reference frame needs to be created by interpolation filtering, where the full pixel or sub-pixel block of the reference frame obtained based on the motion vector is called a reference block. In some techniques, the reference block is directly used as a prediction block, and in other techniques, the reference block is further processed to generate a prediction block. Further processing the reference block to generate a prediction block can be understood as using the reference block as a prediction block and generating a new prediction block by processing based on the prediction block.
[0023] The Versatile Video Coding (VVC) video encoding / decoding standard currently under development has an inter-prediction mode called Geometric Partitioning Mode (GPM). The Audio Video Coding Standard (AVS) video encoding / decoding standard currently under development has an inter-prediction mode called Angular Weighted Prediction Mode (AWP). These two modes have different names and specific implementations, but they have something in common in principle.
[0024] It should be noted that while traditional unidirectional prediction only finds one reference block of the same size as the current block, traditional bidirectional prediction uses two reference blocks of the same size as the current block, and the pixel value of each point in the prediction block is the average value of the corresponding positions of the two reference blocks, that is, all points of each of the two reference blocks each account for 50% of the total. Bidirectional weighted prediction allows the proportions of the two reference blocks to be different, for example, all points in the first reference block account for 75% of the total, and all points in the second reference block account for 25% of the total. However, the proportions of all points in the same reference block are the same. Some other optimization techniques, such as Decoder side Motion Vector Refinement (DMVR) technology and Bi-directional Optical Flow (BIO), may cause some changes in the reference pixels and predicted pixels, and the GPM or AWP may also use two reference blocks of the same size as the current block, but some pixel positions may use 100% of the pixel value of the corresponding position of the first reference block, some pixel positions may use 100% of the pixel value of the corresponding position of the second reference block, and in the blending region, the pixel values of the corresponding positions of the two reference blocks may be used according to a certain ratio. How these weights are specifically assigned may be determined by the prediction mode of the GPM or AWP, or the GPM or AWP may use two reference blocks of a different size from the current block, that is, the GPM or AWP may take the necessary parts as reference blocks. That is, the parts with non-zero weights may be used as reference blocks, and the parts with zero weights may be deleted.
[0025] Illustratively, FIG. 1 is a schematic diagram 1 of weight allocation, which shows a schematic diagram of weight allocation of multiple partition modes of GPM in a 64×64 current block according to an embodiment of the present application, where there are 64 partition modes in GPM. FIG. 2 is a schematic diagram 2 of weight allocation, which shows a schematic diagram of weight allocation of multiple partition modes of AWP in a 64×64 current block according to an embodiment of the present application, where there are 56 partition modes in AWP. In either FIG. 2 or FIG. 3, in each partition mode, region 2 indicates that the weight value of the corresponding position of the first reference block is 0%, region 1 indicates that the weight value of the corresponding position of the first reference block is 100%, the gray region indicates that the weight value of the corresponding position of the first reference block is greater than 0% and less than 100% according to the shade of the color, and the weight value of the corresponding position of the second reference block is 100% minus the weight value of the corresponding position of the first reference block.
[0026] GPM and AWP have different weight derivation methods. GPM determines the angle and offset amount based on each mode and calculates the weight matrix for each mode. AWP first creates a one-dimensional weighted line and then spreads the one-dimensional weighted line over the entire matrix in a manner similar to intra-angle prediction.
[0027] It should be understood that in early encoding and decoding technologies, there is only a rectangular partitioning method, regardless of the partitioning of CU, PU, and transform unit (TU). GPM or AWP realizes the predicted non-rectangular partitioning effect without partitioning. GPM and AWP use a mask of the weights of two reference blocks, i.e., the weight graph above. This mask determines the weights of the two reference blocks when generating a predicted block, or it can be simply understood that some positions of the predicted block are from the first reference block and some positions are from the second reference block, and the blending area is obtained by weighting the corresponding positions of the two reference blocks, which can make the transition smoother. GPM and AWP do not partition the current block into two CUs or PUs according to the partitioning line, so that the transformation, quantization, inverse transformation, and inverse quantization of the residual after prediction also process the current block as a whole.
[0028] The motion information used by the current block can be saved. Subsequent coded and decoded blocks of the current frame can use motion information of previously coded and decoded blocks, such as adjacent blocks, based on the adjacent positional relationship. This utilizes correlation in the spatial domain, so such coded and decoded motion information is called motion information on the spatial domain. The motion information used by each block of the current frame can be saved. Subsequent coded and decoded frames can use motion information of previously coded and decoded frames based on the reference relationship. This utilizes correlation in the temporal domain, so such motion information of coded and decoded frames is called motion information on the temporal domain. The method of storing the motion information used by each block of the current frame usually uses a matrix of a certain size, such as a 4x4 matrix, as the minimum unit, and stores one set of motion information for each minimum unit separately. In this way, each time one block is coded and decoded, the motion information of this block can be stored in the minimum unit corresponding to the position of the block. Therefore, when using motion information on the spatial domain or motion information on the temporal domain, the motion information corresponding to the position can be directly obtained according to the position. For example, if a 16x16 block uses conventional unidirectional prediction, all 4x4 minimum units corresponding to this block store the motion information of this unidirectional prediction. If a block uses GPM or AWP, all minimum units corresponding to this block determine the first motion information, the second motion information and the position of each minimum unit, and the motion information stored in each minimum unit based on the mode of GPM or AWP. In one method, if all 4x4 pixels corresponding to one minimum unit are from the first motion information, this minimum unit stores the first motion information, and if all 4x4 pixels corresponding to one minimum unit are from the second motion information, this minimum unit stores the second motion information.If a 4x4 pixel corresponding to one smallest unit is from both the first motion information and the second motion information, the AWP selects and stores one of the motion information, and the GPM combines and stores the two motion information into bidirectional motion information if the two motion information point to different reference frame lists, otherwise it only stores the second motion information.
[0029] In the present embodiment, GPM or AWP belongs to an inter prediction technique, and GPM or AWP needs to transmit a flag indicating whether GPM or AWP is used in the bitstream, and the flag may indicate whether the current block uses GPM or AWP. When GPM or AWP is used, the encoder needs to transmit a specific mode to be used (i.e., one of 64 partition modes of GPM or one of 56 partition modes of AWP) and index values of two unidirectional motion information in the bitstream. That is, for the current block, the decoder can obtain information on whether GPM is used but AWP is used by analyzing the bitstream, and if it is determined that GPM or AWP is used, the decoder can analyze the prediction mode parameter of GPM or AWP and index values of two motion information, for example, the current block can be divided into two partitions, and then a first index value corresponding to the first partition and a second index value corresponding to the second partition can be analyzed.
[0030] Specifically, for the GPM mode, when the GPM is used, the prediction mode parameters in the GPM (e.g., specific partition modes of the GPM, etc.) are transmitted in the bitstream, and in a normal case, the GPM includes 64 partition modes. For the AWP mode, when the AWP is used, the prediction mode parameters in the AWP (e.g., specific partition modes of the AWP, etc.) are transmitted in the bitstream, and in a normal case, the AWP includes 56 partition modes.
[0031] In inter prediction mode, for example, both GPM and AWP need to use two unidirectional motion information to find two reference blocks. In the existing embodiment, the encoder side uses correlation information of the previously coded / decoded part of the current block to build one unidirectional motion information candidate list, selects unidirectional motion information from the unidirectional motion information candidate list, and writes the index values (index) of the two unidirectional motion information in the unidirectional motion information candidate list into the bitstream. The decoder side also adopts a similar method, that is, uses correlation information of the previously decoded part of the current block to build one unidirectional motion information candidate list, which is not necessarily the same as the candidate list built at the encoder side. Therefore, the index values of the two unidirectional motion information are analyzed from the bitstream, and two unidirectional motion information are found from the unidirectional motion information candidate list, which are the two unidirectional motion information that the current block needs to use.
[0032] That is, the unidirectional motion information described herein may include motion vector information (i.e., the value of (x,y)) and corresponding reference frame information (i.e., the reference frame list and the reference frame index value in the reference frame list). One method is to record the reference frame index values of two reference frame lists, where the reference frame index value corresponding to one reference frame list is valid, e.g., 0, 1, 2, etc., and the reference frame index value corresponding to the other reference frame list is invalid, i.e., -1. The reference frame list whose reference frame index value is valid is the reference frame list used by the motion information of the current block, and the corresponding reference frame can be found from the reference frame list based on the reference frame index value. Each reference frame list has one corresponding motion vector, and the motion vector corresponding to the valid reference frame list is valid, and the motion vector corresponding to the invalid reference frame list is invalid. The decoder can use the reference frame information in the unidirectional motion information to find the required reference frame, and can find the reference block from the reference frame based on the position and the motion vector, i.e., the value of (x,y), of the current block to determine the inter-prediction value of the current block.
[0033] The intra prediction method predicts the current block using the coded and decoded reconstructed pixels around the current block as reference pixels. FIG. 3 is a schematic diagram 1 of intra prediction. As shown in FIG. 3, the size of the current block is 4x4, and the pixels in the left row and the top row of the current block are reference pixels of the current block, and in intra prediction, these reference pixels are used to predict the current block. All of these reference pixels may be available, that is, they have all been coded and decoded. Alternatively, some of the reference pixels may not be available. For example, if the current block is located at the leftmost position of the entire frame, the reference pixels on the left side of the current block may not be available. Alternatively, when coding and decoding the current block, if the lower left part of the current block has not been coded and decoded, the reference pixels in the lower left part may not be available. If the reference pixels are not available, the available reference pixels or a specific value or a specific method may be used to fill in the current block, or no filling may be used.
[0034] FIG. 4 is a schematic diagram 2 of intra prediction. As shown in FIG. 4, in a multiple reference line (MRL) intra prediction method, the encoding / decoding efficiency can be improved by using more reference pixels, for example, four reference rows / columns are used as reference pixels for the current block.
[0035] Furthermore, there are multiple prediction modes in intra prediction, and Figures 5A to 5I are schematic diagrams 3 of intra prediction, and as shown in Figures 5A to 5I, in H.264, intra prediction performed on a 4x4 block may mainly include nine modes. Here, in mode 0 shown in Figure 5A, the upper pixel of the current block is copied vertically to the current block as a predicted value, in mode 1 shown in Figure 5B, the left reference pixel is copied horizontally to the current block as a predicted value, in mode 2 (DC mode) shown in Figure 5C, the average value of eight points A to D and I to L is used as the predicted value of all points, and in modes 3 to 8 shown in Figures 5D to 5I, the reference pixel is copied to the corresponding position of the current block at a specific angle, and some positions of the current block cannot exactly correspond to the reference pixel, so it may be necessary to use the weighted average value of the reference pixel or the sub-pixel of the interpolated reference pixel.
[0036] In addition, there is a planar mode, etc., and the number of angle prediction modes is increasing with the development of technology and block expansion. FIG. 6 is a schematic diagram 1 of intra prediction modes. As shown in FIG. 6, for example, the intra prediction modes used in HEVC include a total of 35 types of prediction modes, including a planar mode, a DC mode, and 33 types of angle modes. FIG. 7 is a schematic diagram 2 of intra prediction modes. As shown in FIG. 7, for example, the intra modes used in VVC include a total of 67 types of prediction modes, including a planar mode, a DC mode, and 65 types of angle modes. FIG. 8 is a schematic diagram 3 of intra prediction modes. As shown in FIG. 8, AVS3 uses a total of 66 types of prediction modes, including a DC mode, a planar mode, a bilinear mode, and 63 types of angle modes.
[0037] In addition, there are some techniques to improve prediction, such as improved sub-pixel interpolation of reference pixels and filtering of predicted pixels. For example, the multiple intra prediction filter (MIPF) in AVS3 uses different filters to generate predictions for different block sizes. For pixels at different positions in the same block, pixels closer to the reference pixel generate predictions using one filter, and pixels farther from the reference pixel generate predictions using the other filter. Techniques to filter predicted pixels, such as the intra prediction filter (IPF) in AVS3, can filter predicted values using reference pixels.
[0038] In intra prediction, the efficiency of coding and decoding can be improved by using intra mode coding techniques such as Most Probable Modes List (MPM). A mode list is constructed using intra prediction modes of surrounding coded and decoded blocks, intra prediction modes derived based on the intra prediction modes of surrounding coded and decoded blocks (such as adjacent modes), and some commonly used intra prediction modes or intra prediction modes with high usage probability (such as DC, Planar, and Bilinear modes). Since textures have a certain spatial continuity, spatial correlation is utilized for the intra prediction modes of surrounding coded and decoded blocks. MPM can be used as a prediction of intra prediction modes. That is, the probability that the current block uses MPM is considered to be higher than the probability that it does not use MPM. Therefore, fewer codewords are used for MPM during binarization, which saves overhead and improves coding and decoding efficiency.
[0039] In AVS3 text, MPM is represented by the variable predIntraPredMode (predicted value of prediction mode), such as predIntraPredMode0, predIntraPredMode1, etc. In this application, the predicted value of the predIntraPredMode prediction mode may be used as another name for MPM, and the contents of the present invention related to MPM are also considered to be applicable to predIntraPredMode.
[0040] The construction method of predIntraPredMode0 and predIntraPredMode1 in AVS3 is as follows.
[0041] The following steps are followed to calculate the predicted value of the prediction mode predIntraPredMode of the current prediction block: If the left predicted block A is “present” and is a regular intra predicted block, then assign A's IntraLumaPredMode to intraPredModeA; otherwise, intraPredModeA is equal to 0.
[0042] If the above predicted block B is “present” and is a regular intra predicted block, then assign the IntraLumaPredMode of B to intraPredModeB; otherwise, intraPredModeB is equal to 0.
[0043] If intraPredModeA is not equal to intraPredModeB, then predIntraPredMode0 is equal to Min(intraPredModeA, intraPredModeB) and predIntraPredMode1 is equal to MaxintraPredModeA, intraPredModeB), otherwise: If intraPredModeA is equal to 0, then predIntraPredMode0 is equal to 0, predIntraPredMode1 is equal to 2, If intraPredModeA is not equal to 0, then predIntraPredMode0 is equal to 0, predIntraPredMode1 is equal to intraPredModeA, Here, 0 represents DC mode and 2 represents Bilinear mode.
[0044] Existing intra prediction modes include DC mode, planar mode, bilinear mode, etc., but all of them can only handle simple texture prediction. Even if more and more angle modes are added, the prediction of the angle mode can only be done along a straight line with one angle. Therefore, existing intra prediction modes can only handle simple texture prediction. For complex textures, it is necessary to divide them into smaller blocks when predicting, or more residuals are coded, or larger distortion occurs.
[0045] In view of the above problems, in an embodiment of the present application, the encoder / decoder can determine two different prediction blocks of a current block according to two different intra prediction modes, and can finally obtain a more complex prediction block by combining the prediction blocks using various weight matrices, thereby improving the accuracy of prediction; furthermore, the encoder / decoder can also construct an MPM list using the correlation between the weight matrix and the prediction mode, thereby greatly reducing the complexity. In other words, the intra prediction method proposed in the present application can reduce the complexity while improving the quality of intra prediction, thereby improving the compression performance.
[0046] FIG. 9 shows an example of a block diagram of a configuration of a video encoding system according to an embodiment of the present application. As shown in FIG. 9, the video encoding system 10 includes a transform and quantization unit 101, an intra estimation unit 102, an intra prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109 and a decoded image buffer unit 110, etc., where the filtering unit 108 can realize deblocking filtering and Sample Adaptive Offset (SAO) filtering, and the encoding unit 109 can realize header information coding and Context-based Adaptive Binary Arithmetic Coding (CABAC). For the input original video signal, one video coding block can be obtained by dividing the coding tree unit (CTU), and then the video coding block is transformed by the transform and quantization unit 101 for the residual pixel information obtained by intra prediction or inter prediction, which includes transforming the residual information from the pixel domain to the transform domain and quantizing the obtained transform coefficients, thereby further reducing the bit rate.The intra estimation unit 102 and the intra prediction unit 103 are configured to perform intra prediction on the video coding block, specifically, the intra estimation unit 102 and the intra prediction unit 103 are configured to determine an intra prediction mode to be used for coding the video coding block, the motion compensation unit 104 and the motion estimation unit 105 are configured to perform inter prediction coding of the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information, the motion estimation performed by the motion estimation unit 105 is a process of generating a motion vector, which can estimate the motion of the video coding block, and the motion compensation unit 104 performs motion compensation based on the motion vector determined by the motion estimation unit 105, after the intra prediction mode is determined, the intra prediction unit 103 is further configured to provide the selected intra prediction data to the coding unit 109, and the motion estimation unit 105 also sends the motion vector data determined by calculation to the coding unit 109. Further, the inverse transform and inverse quantization unit 106 is configured to reconstruct the video coding block, where a residual block is reconstructed in the pixel domain, where the reconstructed residual block is filtered for blocking artifacts by the filter control analysis unit 107 and the filtering unit 108, and where the reconstructed residual block is added to one prediction block in the frame of the decoded picture buffer unit 110 to generate a reconstructed video coding block. The coding unit 109 is configured to code various coding parameters and quantized transform coefficients, where in a CABAC-based coding algorithm, the context content may be based on neighboring coding blocks, and may be used to code information indicating the determined intra-prediction mode and output a bitstream of the video signal, where the decoded picture buffer unit 110 is configured to store the reconstructed video coding block used for prediction reference.As the encoding of the video pictures progresses, newly reconstructed video coding blocks are continually generated, and all these reconstructed video coding blocks are stored in the decoded picture buffer unit 110 .
[0047] 10 shows an example of a block diagram of a video decoding system according to an embodiment of the present application, as shown in FIG. 10, the video decoding system 20 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra prediction unit 203, a motion compensation unit 204, a filtering unit 205 and a decoded image buffer unit 206, etc., where the decoding unit 201 can realize header information decoding and CABAC decoding, and the filtering unit 205 can realize deblocking filtering and SAO filtering. After the input video signal is subjected to the encoding process of FIG. 9, a bit stream of the video signal is output, and the bit stream is input to the video decoding system 20, and first, the decoding unit 201 processes to obtain decoded transform coefficients, and the transform coefficients are processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the pixel domain. The intra prediction unit 203 is configured to generate prediction data of the current video decoded block based on the determined intra prediction mode and data of the previous decoded block from the current frame or picture; the motion compensation unit 204 is configured to determine prediction information of the video decoded block by analyzing the motion vector and other related syntax elements, and use the prediction information to generate a prediction block of the video decoded block being decoded; and form a decoded video block by adding the residual block from the inverse transform and inverse quantization unit 202 and the corresponding prediction block generated by the intra prediction unit 203 or the motion compensation unit 204; the decoded video signal can be filtered out of blocking artifacts by the filtering unit 205 to improve video quality; and store the decoded video block in the decoded image buffer unit 206, which is configured to store reference images for subsequent intra prediction or motion compensation, and output the video signal to obtain a restored original video signal.
[0048] The intra prediction method in the present embodiment is mainly applied to the intra prediction unit 103 shown in FIG. 9 and the intra prediction unit 203 shown in FIG. 10. That is, the intra prediction method in the present embodiment may be applied to a video encoding system, may be applied to a video decoding system, or may be simultaneously applied to both a video encoding system and a video decoding system, but the present embodiment is not limited thereto. Furthermore, when the intra prediction method is applied to the intra prediction unit 103, the "current block" specifically refers to a currently encoded block in intra prediction, and when the intra prediction method is applied to the intra prediction unit 203, the "current block" specifically refers to a currently decoded block in intra prediction.
[0049] Hereinafter, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application.
[0050] One embodiment of the present application provides an intra prediction method applied to an encoder, and FIG. 11 is a schematic diagram 1 of the implementation process of the intra prediction method. As shown in FIG. 11, the intra prediction method performed by the encoder may include the following steps:
[0051] In step 101, if the intra prediction value of the current block is determined using the SAWP mode, a weighting matrix derivation mode of the current block is determined.
[0052] In this embodiment, the encoder can first determine the intra-prediction mode parameters of the current block.
[0053] In addition, in the implementation of the present application, the intra prediction mode parameter may indicate whether the current block can use a Spatial Angular Weighted Prediction (SAWP) encoding mode, that is, whether the current block can use two different prediction modes to perform the prediction process.
[0054] As can be understood, in the present embodiment, the intra prediction mode parameter can be understood as a flag indicating whether the SAWP mode is used. Specifically, the encoder can use one variable as the intra prediction mode parameter, and can realize the setting of the intra prediction mode parameter by setting the value of the variable.
[0055] Exemplarily, in the present application, if the current block uses the SAWP mode, the encoder may set the value of the intra prediction mode parameter to indicate that the current block uses the SAWP mode, and specifically, the encoder may set the value of the variable to 1.
[0056] Exemplarily, in the present application, if the current block does not use the SAWP mode, the encoder may set the value of the intra prediction mode parameter to indicate that the current block does not use the SAWP mode, and specifically, the encoder may set the value of the variable to 0.
[0057] Furthermore, in the present embodiment, after the encoder completes setting the intra-prediction mode parameters, it can write the intra-prediction mode parameters into the bitstream and transmit them to the decoder, so that the decoder can obtain the intra-prediction mode parameters after parsing the bitstream.
[0058] That is, in the present embodiment, at the encoder side, predictive coding is performed on the current block, and in this process, the intra-prediction mode parameters of the current block are determined, and the corresponding intra-prediction mode parameters are written into the bitstream and transmitted by the encoder to the decoder.
[0059] In addition, in the present embodiment, the SAWP mode is one of intra prediction methods. Specifically, according to the SAWP mode, two different intra prediction modes are determined for the current block, and then two prediction blocks are determined respectively based on the two different intra prediction modes. Then, a weighting matrix is determined, and the two prediction blocks are combined according to the weighting matrix, so that a new prediction block can finally be obtained, that is, a prediction block of the current block can be obtained.
[0060] FIG. 12 is a schematic diagram of the SAWP mode. As shown in FIG. 12, when performing intra prediction on a current block, a first prediction block of the current block can be determined using a first intra prediction mode, and a second prediction block of the current block can be determined using a second intra prediction mode. Then, a combination process can be performed on the first prediction block and the second prediction block using a weighting matrix, and finally, one new prediction block can be obtained.
[0061] In addition, in the present embodiment, the video image can be divided into a plurality of image blocks, and the current block is each image block currently being coded, also called coding block (CB). Here, each coding block can include a first image component, a second image component and a third image component. Specifically, in the present application, if it is assumed that the first intra prediction is performed and the first image component is a luminance component, that is, the prediction-awaiting coding block is a luminance component, it can be called a luminance block; or, if it is assumed that the second intra prediction is performed and the second image component is a chrominance component, that is, the prediction-awaiting coding block is a chrominance block.
[0062] Furthermore, in the present embodiment, when the SAWP mode is applied, the size of the current block can be restricted.
[0063] As can be seen, the intra prediction method proposed in the present embodiment needs to generate two prediction blocks using two different intra prediction modes respectively, and then perform weighting according to a weight matrix to obtain a new prediction block, therefore, in order to reduce complexity and balance compression performance and complexity, the present embodiment can restrict a prediction block of a certain size not to use the SAWP mode. Therefore, in the present application, the encoder can first determine the dimension parameters of the current block, and then determine whether the current block uses the SAWP mode based on the dimension parameters.
[0064] In addition, in the present embodiment, the dimension parameters of the current block may include the height and width of the current block, and thus the encoder can use the height and width of the current block to restrict the use of the SAWP mode, i.e., to restrict the dimensions of the predicted blocks for which the SAWP mode can be used.
[0065] For example, in this application, if the width is greater than the first threshold and the height is greater than the second threshold, it is determined that the current block uses the SAWP mode. As can be seen, one possible restriction method is to use the SAWP mode only when the width of the prediction block is greater than (or equal to) the first threshold TH1 and the height of the prediction block is greater than (or equal to) the second threshold. Here, the values of the first threshold TH1 and the second threshold may be 8, 16, 32, etc., and the first threshold may be equal to the second threshold.
[0066] For example, in this application, if the width is smaller than the third threshold and the height is larger than the fourth threshold, it is determined that the current block uses the SAWP mode. As can be seen, one possible restriction method is to use the SAWP mode only when the width of the prediction block is smaller than (or equal to or smaller than) the third threshold and the height of the prediction block is larger than (or equal to or larger than) the fourth threshold. Here, the values of the third and fourth thresholds may be 8, 16, 32, etc., and the third threshold may be equal to the fourth threshold.
[0067] In another example, the present application determines that the current block uses the SAWP mode if the width is smaller than the third threshold and the height is smaller than the fourth threshold. As can be seen, one possible restriction scheme is to use the SAWP mode only if the width of the prediction block is smaller than (or equal to) the third threshold and the height of the prediction block is smaller than (or equal to) the fourth threshold. Here, the values of the third and fourth thresholds may be 8, 16, 32, etc., and the third threshold may be equal to the fourth threshold.
[0068] In the above example, take the case where the width of the prediction block is greater than or equal to 8, and the height of the prediction block is greater than or equal to 8, and the width of the prediction block is less than or equal to 32, and the height of the prediction block is less than or equal to 32 as an example, the corresponding realization process is as follows: If(SawpEnableFlag&& IntraCuFlag&&width>=SawpMinSize&& height>=SawpMinSize&& width<=SawpMaxSize&& height<=SawpMaxSize){ sawp_flag } if (DtEnableFlag && IntraCuFlag&&!SawpFlag) { dt_split_flag } Here, SawpMinSize is equal to 8, and SawpMaxSize is equal to 32.
[0069] Furthermore, taking the case where the width of the prediction block is greater than or equal to 8, and the height of the prediction block is greater than or equal to 8, and the width of the prediction block is less than or equal to 16, and the height of the prediction block is less than or equal to 16 as an example, the corresponding realization process is as follows: If(SawpEnableFlag&& IntraCuFlag&&width>=SawpMinSize&& height>=SawpMinSize&& width<=SawpMaxSize&& height<=SawpMaxSize){ sawp_flag } if (DtEnableFlag && IntraCuFlag&&!SawpFlag) { dt_split_flag } Here, SawpMinSize is equal to 8 and SawpMaxSize is equal to 16.
[0070] Furthermore, in the present embodiment, by restricting pixel parameters, it is also possible to restrict the size of the prediction blocks for which the SAWP modes can be used.
[0071] For example, in this application, the encoder can first determine the pixel parameters of the current block, and then determine whether the current block can use the SAWP mode according to the pixel parameters and the fifth threshold. As can be seen, one possible restriction method is to use the SAWP mode only if the pixel number of the prediction block is greater than (or equal to or greater than) the fifth threshold. Here, the value of the fifth threshold may be 8, 16, 32, etc.
[0072] That is, in this application, the current block can use the SAWP mode only if the dimension parameters of the current block meet the size requirements.
[0073] In addition, in an embodiment of the present application, when an encoder performs intra prediction on a current block, in addition to the SAWP mode proposed in the present application, the available intra prediction modes include any one of the intra coding modes of a direct current (DC) mode, a planar mode, and an angular mode.
[0074] As can be understood, in the present embodiment, before performing intra prediction on the current block, the encoder can first determine a prediction mode parameter, and then, based on the prediction mode parameter, determine which specific encoding mode the current block is to be.
[0075] In the present embodiment, further, when the encoder determines a prediction mode parameter of the current block, it can first perform predictive encoding on the current block using various different prediction modes, and then calculate a rate-distortion cost result corresponding to each prediction mode of the various prediction modes; and finally, it can select a minimum rate-distortion cost result from the multiple rate-distortion cost results obtained by the calculation, and determine the prediction mode corresponding to the minimum rate-distortion cost result as the prediction mode parameter of the current block.
[0076] That is, on the encoder side, it is possible to encode each of the image components to be predicted for the current block using various prediction modes.
[0077] Further, in the embodiment of the present application, the encoder may encode the current block using various prediction modes, and then obtain a rate-distortion cost result corresponding to each prediction mode. Then, the encoder may select a minimum rate-distortion cost result from the obtained multiple rate-distortion cost results, and determine the prediction mode corresponding to the minimum rate-distortion cost result as a prediction mode parameter of the current block. Finally, the encoder may encode the current block using the determined prediction mode, which may reduce a prediction residual and improve the encoding and decoding efficiency.
[0078] In the present embodiment, furthermore, on the encoding side, when the encoder tries intra prediction for a certain prediction block, it also tries the cost of encoding according to the SAWP mode. When trying the cost of encoding according to the SAWP mode, it tries the costs of all or some possible cases, and selects the one with the smallest cost as the cost of SAWP mode encoding.
[0079] In this embodiment, all the possible cases include three combinations of changes, where the first intra prediction mode of the current block is all possible prediction modes, the second intra prediction mode of the current block is all possible prediction modes, and the weight matrix derivation mode is all possible modes. Assuming that there are 66 types of all available intra prediction modes, there are 66 possible first intra prediction modes, and there are 65 types of second intra prediction modes because the second intra prediction mode is different from the first intra prediction mode, and assuming that there are 56 types of weight matrix derivation modes (taking AWP as an example), in this application, any two different intra prediction modes and any one weight matrix derivation mode can be used, resulting in a total of 66×65×56 possibilities. If it is set not to use an intra prediction mode such as PCM, there are 65×64×56 possibilities. As can be seen, in this application, the selectable intra prediction modes can be limited, or the number of available weight matrix derivation modes can be limited, and the possible combinations are reduced accordingly.
[0080] For example, by restricting selectable intra prediction modes of a first intra prediction mode and / or restricting selectable intra prediction modes of a second intra prediction mode, the restriction of the selection of intra prediction modes means reducing the selectable intra prediction modes and / or restricting the available weight matrix derivation modes, thereby reducing the possibility of using any two different intra prediction modes and any one weight matrix derivation mode in the present application, thereby reducing the number of bits of the corresponding flag.
[0081] Further, in the present embodiment, the encoder can perform rate-distortion optimization (RDO) for all possible cases of SAWP modes to determine one combination with the lowest cost, where each combination includes a first intra-prediction mode, a second intra-prediction mode, and a weight matrix derivation mode.
[0082] Optionally, in order to reduce the consumption time of RDO, an initial selection can be performed for all possible cases of the above SAWP modes, for example, the initial selection can be performed with SAD, SATD, etc. as an approximate cost to determine a set number of combinations of the candidate first intra prediction mode, the second intra prediction mode, and the weight matrix derivation mode, and then the RDO refinement can be performed to determine the combination of the first intra prediction mode, the second intra prediction mode, and the weight matrix derivation mode with the smallest cost. Thus, some fast algorithms can be used during the initial selection to reduce the number of trials, for example, if a certain intra angle prediction mode causes a large cost, some intra prediction modes adjacent to the intra angle prediction mode will not be tried.
[0083] As can be understood, in the above initial selection and refinement, the cost may include the cost of encoding the overhead of the first intra prediction mode, the second intra prediction mode, and the weight matrix derivation mode in the bitstream. Alternatively, the cost of estimating the overhead of the first intra prediction mode, the second intra prediction mode, and the weight matrix derivation mode in the bitstream may be used in the initial selection. For example, the number of bits is estimated according to whether the first intra prediction mode or the second intra prediction mode is MPM, or the number of bits of the first or second intra prediction mode is estimated based on the order of the intra prediction modes. During RDO, the cost can be obtained by relatively accurate trial encoding. In this process, the method of constructing a mode list or the method of sorting intra prediction modes in the present application must be used.
[0084] As can be understood, in the present application, during the above initial selection and refinement, a first prediction block is determined according to a first intra prediction mode, a second prediction block is determined according to a second intra prediction mode, a weight matrix is derived according to a weight matrix derivation mode, and a prediction block of the present application is determined according to the first prediction block, the second prediction block and the weight matrix. During the initial selection of SAD and SATD, the current block and the prediction block are used to determine SAD and SATD.
[0085] Further, in the present embodiment, the encoder may first analyze the texture of the current block, for example, using gradients, and use the analyzed data to assist in the initial selection. For example, during the initial selection, an intra prediction mode in a direction that approximates a strong texture of the current block is more likely to be selected for trial. For example, during the initial selection, an intra prediction mode in a direction that approximates a weak texture of the current block is less likely to be selected for trial or is not selected.
[0086] In this application, the cost of encoding in the SAWP mode includes the cost of the codewords occupied by the first intra prediction mode, the second intra prediction mode, and the weight matrix derivation mode in the bitstream, the cost of various flags and quantization coefficients transmitted in the bitstream for transforming, quantizing, entropy coding, etc., of the prediction residual, and the cost of distortion of the reconstructed block, etc.
[0087] After the cost of encoding in the SAWP mode is determined, if the cost of encoding in the SAWP mode is less than the cost of other prediction modes (which may include other intra prediction modes or inter prediction modes, etc.), the encoder selects the SAWP mode as the prediction mode for the current block; otherwise, it selects the other prediction mode.
[0088] Furthermore, in the embodiment of the present application, the encoder tries different block division coding costs, etc. When a certain prediction block finally selects the SAWP mode, the encoder writes the flag bit required by the SAWP mode and the information of the first intra prediction mode, the second intra prediction mode, and the weight matrix derivation mode into the bitstream according to the syntax, and at the same time, performs prediction and subsequent coding operations for this prediction block according to the method of the SAWP mode.
[0089] In the present embodiment, after the encoder determines the intra prediction mode parameter of the current block, if the intra prediction mode parameter indicates that the intra prediction value of the current block is determined using a SAWP mode, the encoder can further determine a weighting matrix derivation mode of the current block.
[0090] It should be noted that in the present application, the weight matrix derivation mode is used to determine the weight matrix used by the current block. Specifically, the weight matrix derivation mode may be a mode for deriving a weight matrix. For a prediction block having a certain length and width, each weight matrix derivation mode can derive one weight matrix, and for prediction blocks of the same size, the weight matrices derived by different weight matrix derivation modes are different.
[0091] For example, in this application, the AWP of the AVS3 has 56 weight matrix derivation modes, and the GPM of the VVC has 64 weight matrix derivation modes.
[0092] In step 102, a first intra-prediction mode and a second intra-prediction mode of a current block are determined based on a weighting matrix derivation mode, and a weighting matrix of the current block is determined based on the weighting matrix derivation mode.
[0093] In this embodiment, when the intra prediction mode parameter indicates that the intra prediction value of the current block is determined using a SAWP mode, the encoder can first determine a first intra prediction mode and a second intra prediction mode of the current block based on the weight matrix derivation mode after determining the weight matrix derivation mode of the current block, and at the same time, determine a weight matrix of the current block based on the weight matrix derivation mode.
[0094] In addition, in this embodiment, the first intra prediction mode and the second intra prediction mode used by the current block may be any one of the currently common intra prediction modes, including but not limited to intra prediction modes such as DC, Planar, Bilinear and angular prediction modes.
[0095] Optionally, in the broader sense of the present application, the intra prediction mode further includes techniques for improving prediction, such as improved sub-pixel interpolation of reference pixels and filtering of predicted pixels, such as MIPF and IPF.
[0096] Correspondingly, in this application, intra prediction modes such as DC mode, Planar mode, Bilinear mode, and angular prediction mode can be referred to as basic intra prediction modes, and techniques for improving prediction such as MIPF and IPF can be referred to as improved intra prediction modes. The basic intra prediction mode is an intra prediction mode that can generate a prediction block independently without depending on other intra prediction modes, that is, the prediction block can be determined by determining the reference pixel and the basic intra prediction mode. In contrast, the improved intra prediction mode cannot generate a prediction block independently and needs to determine the prediction block depending on the basic intra prediction mode. For example, a certain angular prediction mode can determine and generate a prediction block based on the reference pixel, and the MIPF can generate or determine a prediction block using different filters for pixels at different positions based on this angular prediction mode.
[0097] Exemplarily, in the present application, the first intra prediction mode and the second intra prediction mode may both be basic intra prediction modes, that is, the present application uses two different basic intra prediction modes. In this case, the improved intra prediction mode can be combined with the first intra prediction mode and the second intra prediction mode respectively to generate the first prediction block and the second prediction block. Furthermore, after the "new prediction block" is generated in the present application, the "new prediction block" can be improved to obtain an updated prediction block.
[0098] Exemplarily, in the present application, the first intra prediction mode and the second intra prediction mode may be a combination of a basic intra prediction mode and an improved intra prediction mode, that is, in the present application, a combination of two different intra prediction modes is used. For example, the first intra prediction mode and the second intra prediction mode both use the same angle prediction mode, but the first intra prediction mode does not use an improved intra prediction mode such as IPF, and the second intra prediction mode uses an improved intra prediction mode such as IPF. Or, the first intra prediction mode and the second intra prediction mode both use the same angle prediction mode, but the first intra prediction mode uses one option of a certain improved intra prediction mode, and the second intra prediction mode uses another option of the improved intra prediction mode. After the "new prediction block" is obtained, the improved intra prediction mode may still exist, so that the "new prediction block" can be improved to obtain an updated prediction block.
[0099] As can be seen, the intra prediction method proposed in this embodiment of the present application determines two prediction blocks that are not completely identical to the current block based on the first intra prediction mode and the second intra prediction mode, determines one weighting matrix, and combines the two prediction blocks according to the weighting matrix to obtain a new prediction block.
[0100] Furthermore, in this embodiment, in all possible weight matrices, not all points in each weight matrix have the same weight, i.e., at least one possible weight matrix includes at least two different weight values.
[0101] Optionally, in this application, all possible weight matrices include at least two different weight values.
[0102] Optionally, in the present application, some weight matrices include at least two different weight values, for example, in the present application, if the minimum weight value is 0 and the maximum weight value is 8, there exists a weight matrix that includes a point with a weight value of 0 and a point with a weight value of 8. Correspondingly, some weight matrices only include the same weight value, for example, in the present application, there exists a weight matrix in which all points have a weight value of 4.
[0103] Optionally, in this application, there are only two kinds of weights in one weight matrix, one weight indicates that the predicted value of the corresponding point is completely obtained from the value of the point corresponding to the first prediction block, and another weight indicates that the predicted value of the corresponding point is completely obtained from the value of the point corresponding to the second prediction block.For example, in this application, there are only two kinds of weights in one weight matrix, which are 0 and 1 respectively.
[0104] Optionally, in this application, there may be multiple kinds of weights in one weight matrix, where the maximum and minimum values (e.g., 0) indicate that the predicted value of the corresponding point is obtained entirely from the value of the point corresponding to the first prediction block or the value of the point corresponding to the second prediction block, respectively. A weight value that is neither the maximum nor the minimum value indicates that the predicted value of the corresponding point is obtained from the weighted average of the values of the point corresponding to the first prediction block and the second prediction block. The area of the maximum weight value or the minimum weight value is also called a blending area.
[0105] It is noted that in this application, if there are only two weights in the weight matrix, the positions where the weights change form a line, or if there are multiple weights in the weight matrix, the positions in the blending region with the same weight form a line (straight line segment) that may or may not be all horizontal and vertical.
[0106] Optionally, in the present application, when there are only two types of weights in the weight matrix, the positions where the weights change form one curve (curve segment), or when there are multiple types of weights in the weight matrix, the positions with the same weight in the blend region form one curve (curve segment).
[0107] Further, in the embodiment of the present application, the encoder may determine the weight matrix using a method similar to GPM or AWP. Specifically, when GPM or AWP is used in the same encoding / decoding standard or encoder / decoder, the weight matrix may be determined using this method, thereby allowing some of the same logic to be multiplexed. For example, when AWP is used in inter prediction of AVS3, the weight matrix may be determined using the AWP method in AVS3. Of course, a method different from GPM or AWP in the same encoding / decoding standard or encoder / decoder may be used, for example, a different mode number, a different blending region algorithm, or different parameters may be used. In inter prediction, a reconstructed image in a reference frame is used as a reference block to utilize correlation in the time domain. On the other hand, in intra prediction, a reconstructed pixel around the current block is used as a reference pixel to utilize correlation in the spatial domain. The closer the distance in the spatial domain, the stronger the correlation, and the farther the distance, the weaker the correlation. Therefore, if a weighting matrix causes all pixel positions used in a prediction block to be far from the reference pixels, this part may not be able to produce a more accurate prediction value than the prior art, so such a weighting matrix is not used in intra prediction but can be used in inter prediction.
[0108] It should be noted that in the embodiment of the present application, two intra prediction modes need to be used, while in other common intra prediction methods, only one intra prediction mode is usually required.Therefore, the encoding method of the intra prediction mode used in the embodiment of the present application can be different from the encoding method of the intra prediction mode of other common intra prediction methods, and correspondingly, the MPM construction method used in the embodiment of the present application can also be different from the MPM construction method of other common intra prediction methods.
[0109] Further, in the embodiment of the present application, the intra prediction method provided in the embodiment of the present application needs to transmit information about the weight matrix derivation mode and information about two intra prediction modes in the bit stream, so for the weight matrix derivation mode, taking the AWP of AVS3 as an example, there are 56 modes, and 5 to 6 bits are required for binarization. For the intra prediction mode, taking the AVS3 as an example, there are 66 modes, and two MPMs are used. If the intra prediction mode is MPM, 2 bits are required for binarization, otherwise 7 bits are required for binarization. That is, in AVS3, the above information requires an overhead of up to 20 (6+7+7) bits.
[0110] In order to reduce the binarization overhead of the above information and improve the encoding performance, in the embodiment of the present application, the encoder may determine the above information using the correlation between the intra prediction mode of the current block and the weight matrix. Specifically, there is a certain correlation between the intra prediction mode and the weight matrix used by the current block, and by utilizing this correlation, the encoder may utilize the information of the weight matrix when encoding the intra prediction mode, and further, the encoder may utilize the information on the weight matrix derivation mode when encoding the intra prediction mode.
[0111] Furthermore, in the present embodiment, when the weight matrix includes two kinds of weights, the positions where the weights change form a straight line, or when the weight matrix includes multiple kinds of weights, the positions in the blending region with the same weight form a straight line, and this straight line can be called the boundary line. The boundary line itself has an angle, and can be set so that the angle to the right is 0 and the angle increases counterclockwise. Then, the boundary line can have a slant angle such as 0 degrees horizontally, 90 degrees vertically, 45 degrees, 135 degrees, and various other different angles. When one prediction block chooses to use a certain weight matrix, the corresponding texture may have different characteristics on both sides of the boundary line, for example, both sides of the boundary line are textures with two different angles, or one side of the boundary line is a texture with an angle, and the other side is a relatively flat texture. Since the boundary line itself has an angle, it can be assumed that the boundary line is obtained by intra-angle prediction for one point, which may be close to some textures of the current block, so there is a correlation between this straight line and the two intra-prediction modes of the current block.
[0112] Specifically, in the present application, assuming that a boundary line is obtained from one point by intra-angle prediction, at least one intra-angle prediction mode can be found, and the boundary line can be approximately created by the intra-angle prediction mode. For example, a horizontal boundary line matches a horizontal intra-prediction mode (such as mode 24 in AVS3), a vertical boundary line matches a vertical intra-prediction mode (such as mode 12 in AVS3), and a 45-degree boundary line may match a 45-degree intra-prediction mode from the bottom left to the top right (such as mode 30 in AVS3), or a 225-degree intra-prediction mode from the top right to the bottom left (such as mode 6 in AVS3). If there is only one weight value in one weight matrix, it can be matched to a mode with no obvious angle, such as DC, Planar, Bilinear, etc. As can be seen, the weight matrix derivation mode can be matched to a specific intra-prediction mode, and thus the weight matrix derivation mode can be used to support the encoding of the intra-prediction mode.
[0113] In the present application, the weighting matrix derivation mode may be an index of a weighting matrix, for example, the 56 modes of the AWP can be regarded as 56 weighting matrix derivation modes.
[0114] Exemplarily, in the present application, a mapping relationship table can be constructed to further represent the mapping relationship between the weight matrix derivation mode and the intra angle prediction mode. Specifically, the boundaries of multiple modes of AWP and GPM have the same angle, for example, the boundary angle of the AWP of AVS3 is the same for every 8 modes. The 56 AWP modes have a total of 7 boundary angle. The index of the boundary angle can be obtained from the mode number modulo 8 (%8) of the weight matrix derivation mode. For example, Table 1 is a mapping relationship table, and taking the angle mode of AVS3 as an example, the indexes 0 and 1 of the boundary angle can respectively correspond to two intra angle prediction modes, one of which is an intra angle prediction mode from the upper right corner to the lower left corner, and the other is an intra angle prediction mode from the upper left corner to the lower right corner. In a specific implementation, for the indexes of other boundary angles, other intra angle prediction modes that are approximately corresponding may also be found, or all the indexes of the boundary angles may correspond to one intra angle prediction mode.
[0115] [Table 1]
[0116] Furthermore, in the present application, generally, intra prediction is performed using the reference pixels on the left and top of the current block, and the closer the distance between pixels in space, the stronger the correlation, and the farther the distance in space, the weaker the correlation. Therefore, if only a part of the pixels of the current block are obtained by prediction of one intra prediction mode, the position of the pixels of this part will affect the probability of the intra prediction mode used for this part. That is, the position and angle of the above-mentioned boundary line will affect the selection of the two intra prediction modes on both sides of the boundary line. Figure 13 is a schematic diagram 3 of intra prediction, and as shown in Figure 13, the region 1 part of the current block indicates that the predicted values are from the first intra prediction mode, and the region 2 part of the current block indicates that all the predicted values are from the second intra prediction mode, and the blending region between region 1 and region 2 is obtained by weighting the predicted values of the two intra prediction modes. For region 1, since the reference pixel in the upper right corner is closest to region 1, an intra prediction mode (e.g., a thick arrow) in a sector-shaped angular region from the upper right to the lower left can better utilize such spatial correlation and is more likely to be used. On the other hand, since region 1 is far from the reference pixel in the upper left corner, an intra prediction mode (e.g., a thin arrow) in a sector-shaped angular region from the upper left to the lower right cannot better utilize such spatial correlation and is less likely to be used.
[0117] In further embodiments of the present application, when the encoder determines a first intra prediction mode and a second intra prediction mode of the current block based on a weighting matrix derivation mode, the encoder may first determine a mode list (MPM) using the weighting matrix derivation mode, and then further determine the first intra prediction mode and the second intra prediction mode based on the mode list.
[0118] Specifically, in this embodiment, when determining the first intra prediction mode and the second intra prediction mode using the correlation with the weight matrix, the weight matrix derivation mode can be used to construct a mode list, or information on the weight matrix derivation mode can be used when constructing the MPM. Here, since the weight matrix derivation mode can correspond to at least one intra prediction mode, the encoder can add an intra prediction mode corresponding to the weight matrix derivation mode determined for the current block to the mode list, or add several intra prediction modes related to the intra prediction mode corresponding to the weight matrix derivation mode to the mode list.
[0119] Further, in the present embodiment, when the encoder determines a mode list using a weighting matrix derivation mode, the encoder may first determine an intra prediction mode corresponding to an adjacent block of the current block, and then determine the intra prediction mode corresponding to the adjacent block as an added waiting mode; after determining that the added waiting mode satisfies a predetermined adding condition, the encoder may add the added waiting mode to the mode list, i.e., add the intra prediction mode corresponding to the adjacent block of the current block to the mode list; then, if the mode list does not meet the predetermined list length, the encoder may continue to determine a correlated intra prediction mode corresponding to the weighting matrix derivation mode, and then determine the correlated intra prediction mode corresponding to the weighting matrix derivation mode as an added waiting mode; if the encoder determines that the added waiting mode satisfies the predetermined adding condition, the encoder may add the added waiting mode to the mode list, i.e., add the correlated intra prediction mode corresponding to the weighting matrix derivation mode to the mode list.
[0120] In addition, in the present embodiment, when the encoder adds the intra prediction modes corresponding to the neighboring blocks to the mode list, the encoder may first determine the sequence parameters corresponding to the neighboring blocks, and then sequentially add the intra prediction modes corresponding to the neighboring blocks to the mode list based on the sequence parameters. Here, the encoder may determine the corresponding sequence parameters based on the spatial distance between the neighboring blocks and the current block, for example, the closer the spatial distance between the neighboring blocks and the current block, the stronger the correlation between the neighboring blocks and the current block, and the earlier the additional processing is performed, i.e., the smaller the sequence parameters, and the farther the spatial distance between the neighboring blocks and the current block, the weaker the correlation between the neighboring blocks and the current block, and the later the additional processing is performed, i.e., the larger the sequence parameters.
[0121] Furthermore, in an embodiment of the present application, when the encoder determines a correlated intra-prediction mode corresponding to a weighting matrix derivation mode, the encoder can first determine the intra-prediction mode corresponding to the weighting matrix derivation mode, and then determine the correlated intra-prediction mode according to the first index interval based on the intra-prediction mode corresponding to the weighting matrix derivation mode.
[0122] Exemplarily, in an embodiment of the present application, when determining several intra prediction modes related to an intra prediction mode corresponding to a weight matrix derivation mode, the encoder may select a mode that differs from the index number of the intra prediction mode corresponding to the weight matrix derivation mode by one or more first index intervals according to the first index interval, for example, a mode whose index number differs by 1 or a mode whose index number differs by 2. For example, assuming that the index of the intra prediction mode corresponding to the weight matrix derivation mode is 10 and the first index interval is 2, two intra prediction modes with indexes 8 and 12 may be determined as two correlated intra prediction modes related to the intra prediction mode corresponding to the weight matrix derivation mode.
[0123] In addition, in this embodiment, after the encoder adds an intra-prediction mode corresponding to an adjacent block of the current block to the mode list, or after the encoder adds a correlated intra-prediction mode corresponding to the weight matrix derivation mode to the mode list, if the mode list does not meet a predetermined list length, i.e., the mode list is not completely filled, the encoder can continue to determine the predetermined prediction mode as an additional waiting mode, and after determining that the additional waiting mode meets a predetermined addition condition, the encoder adds the additional waiting mode to the mode list, i.e., adds the predetermined prediction mode to the mode list.
[0124] As can be appreciated, in this application, the predetermined prediction mode may include one or more of a variety of different modes, such as a DC mode, a bilinear mode, a planar mode, and the like.
[0125] Furthermore, in this embodiment, after the encoder adds the intra-prediction mode corresponding to the neighboring blocks of the current block, the correlated intra-prediction mode corresponding to the weight matrix derivation mode, and a predetermined prediction mode to the mode list, if the mode list still does not meet a predetermined list length, i.e., the mode list is still not completely filled, the encoder can choose to use a prediction mode in the mode list to determine an associated intra-prediction mode, and determines the associated intra-prediction mode as an additional waiting mode, and if it determines that the additional waiting mode meets a predetermined addition condition, adds the additional waiting mode to the mode list, i.e., adds the associated intra-prediction mode corresponding to the mode list to the mode list.
[0126] That is, in the present application, after sequentially adding the intra prediction modes corresponding to the neighboring blocks of the current block, the correlated intra prediction modes corresponding to the weight matrix derivation modes, and the predetermined prediction modes to the mode list, if the mode list is still not completely filled, the encoder can determine corresponding associated intra prediction modes based on the existing prediction modes in the mode list, and then add these associated intra prediction modes to the mode list.
[0127] For example, in the present application, the encoder may sequentially determine an associated intra prediction mode related to an arbitrary prediction mode in a mode list according to a second index interval, where the encoder may select a mode that is different from the index number of the arbitrary prediction mode by one or more second index intervals according to the second index interval, for example, a mode with an index number that is different by 1 or a mode with an index number that is different by 2.
[0128] In addition, in the present embodiment, regardless of whether the intra prediction mode corresponding to the adjacent block of the current block is the addition waiting mode, the correlated intra prediction mode corresponding to the weight matrix derivation mode is the addition waiting mode, or a specified prediction mode is the addition waiting mode, or an associated intra prediction mode is the addition waiting mode, the encoder needs to determine whether the addition waiting mode satisfies a specified addition condition; specifically, if an addition waiting mode exists and is different from all prediction modes in the mode list, it can be determined that the addition waiting mode satisfies the specified addition condition, and the addition waiting mode can be added to the mode list.
[0129] Correspondingly, if the waiting mode to be added does not exist or is the same (duplicates) as one prediction mode in the mode list, it can be determined that the waiting mode to be added does not satisfy a predetermined addition condition, in which case the waiting mode to be added cannot be added to the mode list, and the waiting mode to be added is directly discarded.
[0130] As can be seen, in the present application, since the current block needs to perform intra prediction processing using two intra prediction modes, it can refer to intra prediction modes at more positions or to intra prediction modes of more neighboring blocks when constructing the MPM. Correspondingly, in the present application, the length of the mode list used by the current block can be different from the mode list length of other intra prediction modes, and since the codeword of the MPM during binarization is shorter than other modes, increasing the probability that each of the two intra prediction modes is an MPM helps to improve the efficiency of encoding and decoding.
[0131] As an example, in this embodiment, assuming that the length of the mode list used by the current block is 4, when the encoder determines the mode list using the weight matrix derivation mode, the encoder can specifically perform the following steps:
[0132] In step 201, the intra-prediction modes of the neighboring blocks are added to a mode list.
[0133] In this embodiment, the encoder may first determine the intra prediction modes corresponding to the neighboring blocks of the current block, and then sequentially add the intra prediction modes corresponding to the neighboring blocks to the mode list.
[0134] Figure 14 is a schematic diagram of neighboring blocks, and as shown in Figure 14, if the current block is E, the encoder can sequentially add the intra-prediction modes used by neighboring blocks F, G, C, A, B, and D to the mode list until the mode list is completely filled. If the position of a neighboring block among F, G, C, A, B, and D is unavailable or does not use an intra-prediction mode, the encoder skips this position.
[0135] As can be appreciated, in this application, intra prediction modes of blocks located further to the right and further below can be used if complexity permits.
[0136] In step 202 it is determined whether the mode list is completely filled, if not step 203 is executed, otherwise step 208 is executed.
[0137] In step 203, the correlated intra-prediction mode corresponding to the weighting matrix derivation mode is added to the mode list.
[0138] In the present embodiment, if the mode list is not completely filled after adding the intra-prediction modes of adjacent blocks to the mode list, i.e., the length of the mode list is less than 4, the encoder can continue to add intra-prediction modes corresponding to the weight matrix derivation modes to the mode list until the mode list is completely filled.
[0139] In addition, in the present application, the encoder may choose to add only the intra-prediction mode corresponding to the weighting matrix derivation mode to the mode list, or may choose to add the intra-prediction mode corresponding to the weighting matrix derivation mode and the corresponding correlated intra-prediction mode to the mode list.
[0140] In step 204, it is determined whether the mode list is completely filled, if not, step 204 is executed, otherwise step 208 is executed.
[0141] In step 205, the given prediction mode is added to the mode list.
[0142] In the present embodiment, if after adding a correlated intra-prediction mode corresponding to a weight matrix derivation mode to the mode list, the mode list is not completely filled, i.e., the length of the mode list is less than 4, the encoder can continue to add certain prediction modes to the mode list until the mode list is completely filled.
[0143] Here, the predetermined prediction mode may include one or more of a variety of different modes, such as a DC mode, a bilinear mode, a planar mode, and the like.
[0144] In step 206 it is determined whether the mode list is completely filled, if not then step 207 is executed, otherwise step 208 is executed.
[0145] In step 207, the associated intra-prediction mode corresponding to the mode list is added to the mode list.
[0146] In this embodiment, if, after adding a certain prediction mode to the mode list, the mode list is not completely filled, i.e., the length of the mode list is less than 4, the encoder can determine an associated intra-prediction mode corresponding to the mode list, and then sequentially add the associated intra-prediction mode to the mode list.
[0147] Specifically, if the mode list is not completely filled, intra prediction modes that differ from the index number of the first intra prediction mode by 1, -1, 2, -2, 3, -3 may be added to the MPM starting from the first intra prediction mode of the MPM until the mode list is completely filled. If an intra prediction mode among the intra prediction modes that differ from the index number of the first intra prediction mode by 1, -1, 2, -2, 3, -3 is invalid and is less than 0 or greater than the maximum value, the invalid intra prediction mode is discarded.
[0148] In step 208, a mode list is derived.
[0149] In addition, in this embodiment, while constructing the mode list, each waiting intra prediction mode (waiting to be added mode) can be added to the mode list only if it is guaranteed to be different from the existing intra prediction modes in the mode list, otherwise it is discarded.
[0150] That is, in the present application, in order to ensure that the first intra prediction mode of the current block is different from the second intra prediction mode, the encoder must ensure that during construction of the mode list, the intra prediction mode added each time to the mode list does not overlap with any existing intra prediction mode in the mode list.
[0151] Furthermore, in the present embodiment, when the encoder determines a mode list using a weighting matrix derivation mode, the encoder can first determine a list construction strategy corresponding to the weighting matrix derivation mode, and then further determine a mode list based on the list construction strategy.
[0152] That is, in the present application, for different weight matrices, i.e., different weight matrix derivation modes, the encoder can use different construction strategies to construct the mode list. For example, based on the construction strategy, if the boundary of the weight matrix is 0 degrees or 90 degrees, i.e., horizontal or vertical, the encoder can choose to take into account the intra-prediction mode corresponding to the weight matrix when constructing the mode list, and in other cases, do not consider the intra-prediction mode corresponding to the weight matrix.
[0153] For example, in the present application, assuming that the weighting matrix boundary is 0 degrees, for modes such as AWP mode 2 and mode 10 (counting from 0), horizontal intra prediction mode 24 can be added to the mode list candidates when constructing the mode list, and assuming that the weighting matrix boundary is 90 degrees, for modes such as AWP mode 6 and mode 14 (counting from 0), vertical intra prediction mode 12 can be added to the mode list candidates when constructing the mode list.
[0154] As can be understood, in the present application, in the range where the boundary line of the weight matrix is close to 0 degrees, a horizontal intra prediction mode, or a horizontal intra prediction mode and its similar intra prediction mode, may be added to the candidates of the mode list, and in the range where the boundary line of the weight matrix is close to 90 degrees, a vertical intra prediction mode, or a horizontal intra prediction mode and its similar intra prediction mode may be added to the candidates of the mode list.
[0155] As can be understood, in the present application, two intra prediction modes used for intra prediction of a current block are different, i.e., the first intra prediction mode and the second intra prediction mode are different, and then, when decoding the second intra prediction mode, the possibility of the first intra prediction mode can be eliminated, i.e., information of the first intra prediction mode can be used to decode the second intra prediction mode.
[0156] In this embodiment, the encoder may also set a candidate intra-prediction mode during construction of the mode list, where the candidate intra-prediction mode is different from all intra-prediction modes in the mode list.
[0157] Specifically, in the present application, in order to make the first intra prediction mode and the second intra prediction mode used by the current block different, the determination of the second intra prediction mode may depend on the first intra prediction mode. Here, when the encoder determines the first intra prediction mode and the second intra prediction mode based on the mode list, the encoder may first determine one prediction mode in the mode list as the first intra prediction mode, and then determine the second intra prediction mode based on the first intra prediction mode and the mode list.
[0158] Further, in an embodiment of the present application, after determining one prediction mode in the mode list as the first intra prediction mode, the encoder may remove the prediction mode from the mode list and add candidate intra prediction modes to the mode list, thereby obtaining an updated mode list, and then select one prediction mode from the updated mode list to determine it as the second intra prediction mode, where the selection manner may be arbitrary.
[0159] That is, in this embodiment, if the first intra prediction mode selects one MPM, the selectable MPMs for the second intra prediction mode are reduced by one so that the first intra prediction mode and the second intra prediction mode used by the current block are different, and in order to avoid changing the length of the selectable mode list for the first intra prediction mode and the second intra prediction mode, the encoder can add one MPM after determining the first intra prediction mode, for example, can add a pre-set candidate intra prediction mode to the mode list, thereby still being able to use the same number of MPMs as the first intra prediction mode when determining the second intra prediction mode.
[0160] For example, in the present application, assuming that the number of selectable MPMs of the first intra prediction mode and the second intra prediction mode is N, when constructing a mode list, N MPMs and one candidate MPM can be constructed first, and the selectable MPMs of the first intra prediction mode are the above N MPMs. If the first intra prediction mode selects one of the MPMs, for the second intra prediction mode, the MPM selected by the first intra prediction mode is deleted, and the candidate MPM is added to the mode list so that the second intra prediction mode can still select from the N MPMs.
[0161] In this embodiment, the encoder may further set the length parameter of the mode list to (N+1), where N is a positive integer, during construction of the mode list.
[0162] Specifically, in the present application, in order to make the first intra prediction mode and the second intra prediction mode used by the current block different, the determination of the second intra prediction mode may depend on the first intra prediction mode. Here, when the encoder determines the first intra prediction mode and the second intra prediction mode based on the mode list, if the encoder determines the first intra prediction mode using the mode list, the encoder may determine one of the first N prediction modes in the mode list as the first intra prediction mode, and then determine the second intra prediction mode based on the first intra prediction mode and the mode list.
[0163] Furthermore, in an embodiment of the present application, when determining a first intra prediction mode using a mode list, the encoder determines one of the first N prediction modes in the mode list as the first intra prediction mode, and then determines a second intra prediction mode using the other N prediction modes other than the first intra prediction mode in the mode list.
[0164] In the embodiments of the present application, when the encoder determines the first intra prediction mode and the second intra prediction mode based on the mode list, if the mode list is not used for determining the first intra prediction mode, the encoder can directly determine one of the first N prediction modes in the mode list as the second intra prediction mode.
[0165] That is, in the embodiments of the present application, assuming that the number of selectable MPMs for the intra prediction mode is N, in order to make the first intra prediction mode and the second intra prediction mode used by the current block different, when constructing the mode list, (N + 1) MPMs can be constructed. For the first intra prediction mode, the selectable MPMs are the first N MPMs in the mode list. When no MPM is selected for the first intra prediction mode, the selectable MPMs for the second intra prediction mode are the first N MPMs in the mode list. When an MPM is selected for the first intra prediction mode, the selectable MPMs for the second intra prediction mode are the N MPMs other than the first intra prediction mode in the mode list.
[0166] Exemplarily, in the present application, assuming that N is 4, the encoder can construct a mode list including five MPMs. MPM[x] represents the (x + 1)-th MPM. That is, MPM[0] represents the first MPM, because the count of the array starts from 0. The first intra prediction mode is mode0, and the second intra prediction mode is mode1. Assuming that both the first intra prediction mode and the second intra prediction mode are MPMs, and the index number of the first intra prediction mode in the selectable MPMs is idx0, and the index number of the second intra prediction mode in the selectable MPMs is idx1, mode0 = MPM[idx0] mode1 = MPM[idx1 < idx0? idx1 : idx1 + 1] That is, when idx1 < idx0, mode1 = MPM[idx1], Otherwise, mode1=MPM[idx1+1].
[0167] As can be seen, the value range of both idx0 and idx1 is 0 to 3, and the value of mode1 is related not only to idx1 but also to idx0.
[0168] Optionally, in the present embodiment, if the first intra prediction mode and the second intra prediction mode used by the current block are only guaranteed to be different, and the number of selectable MPMs of the first intra prediction mode and the second intra prediction mode is not limited, the encoder may not set the candidate intra prediction mode or may not increase the mode list length, in which case the encoder needs to change the encoding method of the second intra prediction mode. That is, after the first intra prediction mode selects one MPM in the mode list, the selectable MPMs of the second intra prediction mode are reduced by one, in which case the encoding method of the second intra prediction mode needs to be changed because the selectable MPMs of the second intra prediction mode are reduced.
[0169] For example, in the present application, the number N of MPMs is 4, and the first bit is used to indicate whether it is an MPM (for example, "1" indicates that it is an MPM, and "0" indicates that it is not an MPM). If the first intra prediction mode is an MPM, there are four MPMs, so two bits are used to indicate which MPM it is, i.e., "00, 01, 10, 11" respectively represent the first MPM, the second MPM, the third MPM, and the fourth MPM. Also, if the first intra prediction mode and the second intra prediction mode are both MPMs, there are only three MPMs available for the second intra prediction mode, so one or two bits can be used to indicate which MPM it is, for example, "00, 01, 10" respectively represent the remaining first MPM, the second MPM, and the third MPM. As can be seen, since one possibility is excluded, overhead can be saved by changing the encoding method or binarization method.
[0170] Exemplarily, in the present application, assuming that N is 4, a mode list including four MPMs can be constructed. MPM[x] represents the (x + 1)-th MPM. That is, MPM[0] represents the first MPM, because the count of the array starts from 0. The first intra prediction mode is mode0, and the second intra prediction mode is mode1. Assuming that both the first intra prediction mode and the second intra prediction mode are MPMs, and the index number of the first intra prediction mode in the selectable MPMs is idx0, and the index number of the second intra prediction mode in the selectable MPMs is idx1, mode0 = MPM[idx0] mode1 = MPM[idx1 < idx0? idx1 : idx1 + 1] That is, when idx1 < idx0, mode1 = MPM[idx1], otherwise, mode1 = MPM[idx1 + 1].
[0171] As can be seen from this, the range of the value of idx0 is 0 to 3, the range of the value of idx1 is 0 to 2, and the value of mode1 is related to not only idx1 but also idx0. idx0 can be binarized using 2 bits, and idx1 can be binarized using 1 to 2 bits.
[0172] In an embodiment of the present application, further, when the encoder determines the first intra prediction mode and the second intra prediction mode of the current block based on the weight matrix derivation mode, the encoder can further perform a sorting process on the intra prediction mode corresponding to the adjacent block of the current block, the correlation intra prediction mode corresponding to the weight matrix derivation mode, and a predetermined prediction mode in sequence, so as to obtain a candidate list of prediction modes. Here, the predetermined prediction mode includes one or more of various prediction modes such as the DC mode, the Bilinear mode, and the Planar mode. Next, the encoder can determine the first intra prediction mode and the second intra prediction mode based on the candidate list of prediction modes.
[0173] Specifically, in the present embodiment, when determining the first intra prediction mode and the second intra prediction mode using the correlation with the weight matrix, further, the intra prediction mode corresponding to the weight matrix derivation mode or some intra prediction modes related to the intra prediction mode corresponding to the weight matrix derivation mode may be assigned a codeword shorter than that of the normal intra prediction mode during binarization, or may be assigned a codeword shorter than the longest possible codeword in the intra prediction mode, that is, these codewords are not the longest. Therefore, the intra prediction mode corresponding to the weight matrix derivation mode or some intra prediction modes related to the intra prediction mode corresponding to the weight matrix derivation mode may be considered to have a higher probability of being selected than other modes.
[0174] That is, in the present embodiment, the first intra prediction mode and the second intra prediction mode do not need to use MPM, and the encoder can generate a candidate list of prediction modes by performing a sorting process on all intra prediction modes that can be used by the first intra prediction mode and the second intra prediction mode, and further, when binarizing, variable length coding is used, and shorter codewords are assigned to higher intra prediction modes in the candidate list of prediction modes, and longer codewords are assigned to lower intra prediction modes in the candidate list of prediction modes. Here, when sorting, the intra prediction mode of the neighboring block of the current block may be referenced, or the weight matrix derivation mode of the current block may be referenced.
[0175] Exemplarily, in an embodiment of the present application, a method for the encoder to determine the first intra prediction mode and the second intra prediction mode of the current block based on the weight matrix derivation mode may include the following steps.
[0176] In step 301, the intra prediction modes of the neighboring blocks are added to a candidate list.
[0177] In this embodiment, the encoder can first determine the intra prediction modes corresponding to the neighboring blocks of the current block, then sort the intra prediction modes corresponding to the neighboring blocks, and sequentially add the sorted intra prediction modes to the candidate list.
[0178] If the current block is E, the encoder may add to the candidate list the intra-prediction modes used by neighboring blocks F, G, C, A, B, and D in the following order: F, G, C, A, B, and D. If a position of a neighboring block among F, G, C, A, B, and D is unavailable or does not use an intra-prediction mode, the encoder skips this position.
[0179] As can be appreciated, in this application, intra prediction modes of blocks located further to the right and further below can be used if complexity permits.
[0180] In step 302, the correlated intra-prediction mode corresponding to the weighting matrix derivation mode is added to a candidate list.
[0181] In this embodiment, after adding the intra-prediction modes of the neighboring blocks to the candidate list, the encoder may continue to add intra-prediction modes corresponding to the weighting matrix derivation mode to the candidate list.
[0182] In addition, in the present application, the encoder may choose to add only the intra prediction mode corresponding to the weighting matrix derivation mode to the candidate list, or may choose to add the intra prediction mode corresponding to the weighting matrix derivation mode and the corresponding correlated intra prediction mode to the candidate list.
[0183] In step 303, the given prediction mode is added to a candidate list.
[0184] In this embodiment, after adding the correlated intra-prediction mode corresponding to the weighting matrix derivation mode to the candidate list, the encoder may continue to add predefined prediction modes to the candidate list.
[0185] Here, the predetermined prediction mode may include one or more of a variety of different modes, such as a DC mode, a bilinear mode, a planar mode, and the like.
[0186] In step 304, the associated intra-prediction mode corresponding to the candidate list is added to the candidate list.
[0187] In the present embodiment, after adding a certain prediction mode to the candidate list, the encoder may determine an associated intra-prediction mode corresponding to the candidate list, and then sequentially add the associated intra-prediction mode to the candidate list.
[0188] Specifically, starting from the first intra prediction mode in the candidate list, the encoder may add to the candidate list intra prediction modes that differ from the index number of the first intra prediction mode by 1, -1, 2, -2, 3, or -3. If an intra prediction mode among the intra prediction modes that differ from the index number of the first intra prediction mode by 1, -1, 2, -2, 3, or -3 is invalid and is less than 0 or greater than a maximum value, the encoder may discard the invalid intra prediction mode.
[0189] In step 305, intra-prediction modes other than those in the candidate list are added to the candidate list.
[0190] In this embodiment, the encoder adds unsorted intra-prediction modes to the candidate list starting from prediction mode index 0 until completion.
[0191] As can be seen, the probabilities of intra prediction modes are different due to the different angles and positions of the boundary lines of the weight matrix, and the probabilities of the first intra prediction mode and the second intra prediction mode are different. For example, in the example of the above drawing, the first intra prediction mode (corresponding to the white block) has a higher probability of the angle mode from the top right to the bottom left than the angle mode from the top left to the bottom right, and the second intra prediction mode (corresponding to the black block) has a higher probability of the angle mode from the top right to the bottom left than the angle mode from the top left to the bottom right. Therefore, for the first intra prediction mode and the second intra prediction mode corresponding to each weight matrix derivation mode, rearrangement can be performed based on their respective probability characteristics.
[0192] Furthermore, in this embodiment, when the encoder determines the first intra prediction mode and the second intra prediction mode of the current block based on the weight matrix derivation mode, the encoder can further establish a reference set of the first intra prediction mode corresponding to the weight matrix derivation mode, and simultaneously establish a reference set of the second intra prediction mode corresponding to the weight matrix derivation mode, and can determine the first intra prediction mode based on the reference set of the first intra prediction mode, and simultaneously determine the second intra prediction mode based on the reference set of the second intra prediction mode.
[0193] That is, in this embodiment, for a weight matrix derivation mode of a current block, the encoder can perform a sorting process on all possible intra prediction modes of a first intra prediction mode corresponding to the weight matrix derivation mode to generate a reference set for the first intra prediction mode, and at the same time, perform a sorting process on all possible intra prediction modes of a second intra prediction mode corresponding to the weight matrix derivation mode to generate a reference set for the second intra prediction mode, thereby determining the first intra prediction mode from the reference set for the first intra prediction mode, and determining the first intra prediction mode from the reference set for the second intra prediction mode.
[0194] Exemplarily, in the present application, the encoder can pre-configure one mapping table to determine the mapping relationship between each weight matrix derivation mode and the first intra prediction mode and the second intra prediction mode, and as shown in Table 2, for one weight matrix derivation mode, the encoder can determine the order of all possible intra prediction modes of the first intra prediction mode corresponding to this weight matrix derivation mode and the order of all possible intra prediction modes of the second intra prediction mode corresponding to this weight matrix derivation mode based on Table 2.
[0195] [Table 2]
[0196] Further, in an embodiment of the present application, to reduce complexity, the encoder can narrow down a lookup table such as Table 2 above by a clustering technique, for example, performing a classification process on the weight matrix derivation mode to determine the type corresponding to the weight matrix derivation mode, and for the same type of weight matrix derivation mode, the order of all possible intra prediction modes of the corresponding first intra prediction mode is the same, and further, the order of all possible intra prediction modes of the corresponding second intra prediction mode is the same.
[0197] Further, in the present embodiment, in order to reduce the complexity, the encoder can narrow down the lookup table such as Table 2 above by a clustering method, for example, a classification process can be performed on the intra prediction mode to determine the type corresponding to the intra prediction mode, for example, non-angle modes such as DC, Planar, Bilinear, etc. belong to one type, and the angle mode can perform a classification process according to a range of several radians, for example, every 45 degrees, i.e., 1 / 4 circle, belongs to one type, or every 22.5 degrees, i.e., 1 / 8 circle, belongs to one type. Specifically, the angle mode can also be divided into several unequal intervals.
[0198] Figure 15 is a schematic diagram of the clustering, and all the angular modes can be divided into nine regions as shown in Figure 15. The sorting within each region can be done according to the order of the mode numbers or from the center of the region toward both sides.
[0199] As can be seen, in the present application, the angles of the angle modes in AVS3 are not continuous, and the previous modes 3 to 32 cover a wide radian range but are relatively sparse, while the next modes 34 to 65 are relatively fine. Therefore, during classification, this characteristic can be utilized to classify the modes before and after mode 33 into different categories.
[0200] In the present embodiment, further, since the intra prediction method proposed in the present application requires the use of two different intra prediction modes and one weighting matrix to determine the predicted value of the current block, in the present application, in order to reduce overhead, the encoder can reduce the number of bits by restricting the two intra prediction modes of the current block, and at the same time, the encoder can also reduce the number of bits by restricting the weighting matrix derivation mode of the current block.
[0201] For example, in this application, since the first 33 prediction modes of AVS3 almost cover the entire angle range, AVS3 can ensure good performance by using only the first 33 prediction modes, and it is only necessary to adjust not to use EIPM during encoding. In addition, the encoder can further compress and limit the number of intra prediction modes that may be used by the current block, so that finally, encoding is performed using only 5 bits, which can further reduce overhead and achieve better performance.
[0202] Optionally, in this application, the encoder can reduce the overhead of encoding two intra-prediction modes by reducing the number of intra-prediction modes that may be used by the current block.For example, in AVS3, if 66 intra-prediction modes are used, a maximum of 7 bits are required to encode one intra-prediction mode, and if only 33 intra-prediction modes are used and no PCM mode is used, a maximum of only 6 bits are required to encode one intra-prediction mode.
[0203] Furthermore, in this application, considering that intra prediction modes usually include non-angular prediction modes such as DC, Planar, Bilinear, etc., and angular prediction modes, in the realization process, each non-angular mode may use one set of logic, or all angular modes may use one set of logic, or angular modes may use multiple sets of logic, and among different logics, some circuits may be multiplexed and some circuits may not be multiplexed. Therefore, in order to limit the number of intra prediction modes that may be used by the current block, it can be limited to only select angular prediction modes or only select non-angular prediction modes.
[0204] In the following, the restriction of the available intra prediction modes of the second intra prediction mode will be described as an example, and the corresponding restriction can also be applied to the restriction of the first intra prediction mode.
[0205] Method 1: The second intra prediction mode can only use one specified intra prediction mode among the non-angular prediction modes.
[0206] For example, the second intra prediction mode can only use DC mode, or the second intra prediction mode can only use Bilinear mode. Since there is only one possible choice for the second intra prediction mode, when the block of the present invention is used for encoding and decoding, the second intra prediction mode can be derived by default to predict the current block without determining the second intra prediction mode, and there is no need to write the second intra prediction mode into the bitstream during encoding, and there is no need to analyze what the second intra prediction mode is from the bitstream during decoding.
[0207] Method 2: The second intra prediction mode can only use non-angular modes or some modes among the non-angular modes.
[0208] For example, since the second intra prediction mode can only use DC mode and Bilinear mode and there are only two possible choices for the second intra prediction mode, the 1-bit intra_luma_pred_mode1 can indicate whether the second intra prediction mode is DC mode or Bilinear mode. During encoding, only two possibilities, DC and Bilinear, need to be tried for the second intra prediction mode, and intra_luma_pred_mode1 can be determined after determining which intra prediction mode the second intra prediction mode is. In the process of decoding the corresponding block, it is only necessary to analyze the 1-bit intra_luma_pred_mode1 for the second intra prediction mode to determine whether it is DC or Bilinear.
[0209] In another embodiment, the second intra prediction mode can only use non-angular modes, i.e., there are only three possible options for the second intra prediction mode, and the 2-bit intra_luma_pred_mode1 can indicate which intra prediction mode the second intra prediction mode is.
[0210] Method 3: The second intra prediction mode can use all angle prediction modes or only some of the angle prediction modes.
[0211] Since the number of selectable intra prediction modes of the second intra prediction mode is reduced, the number of bits of intra_luma_pred_mode1 representing the second intra prediction mode in the bitstream is also reduced. For example, in AVS3, the second intra prediction mode can only use all angle modes. In AVS3, there are three non-angle modes: DC, Plane, and Bilinear. In other words, in AVS3, the second intra prediction mode can only use modes other than 0, 1, and 2.
[0212] In one particular embodiment, the second intra prediction mode may use all intra prediction modes other than the non-angular prediction modes (ie, the second intra prediction mode may use all angular prediction modes).
[0213] In one particular embodiment, the second intra prediction mode may use a part of all angular prediction modes, where the part of angular prediction modes may be the first 33 angular prediction modes, or the part of angular prediction modes may be a part of angular prediction modes selected from the 33 angular prediction modes or the 65 angular prediction modes according to a predetermined interval, for example, the predetermined interval may be 1, 2 or other positive integers.
[0214] Table 3 shows an example of intra prediction modes of a luminance prediction block, where mode number IntraLumaPredMode corresponds to the corresponding intra prediction mode. 0 represents DC mode, 1 represents Plane mode, 2 represents Bilinear mode, 12 represents Vertical mode, 24 represents Horizontal mode, 33 represents PCM mode, and others are angle modes other than Horizontal mode and Vertical mode. For angles represented by specific mode numbers, refer to FIG. 7.
[0215] [Table 3]
[0216] Taking an example in which the second intra prediction mode can only use modes other than 0, 1, and 2, the process of constructing a selectable MPM mode list for the second intra prediction mode will be described.
[0217] Taking as an example that each intra prediction mode can use four MPMs, a mode list with a length of 8 can be constructed, where the number of non-angular prediction modes should be less than or equal to 3 since AVS3 only has three non-angular prediction modes. Here, the first four MPMs can be used to select the first intra prediction mode. The second intra prediction mode can select the first four MPMs of the non-angular modes other than the first intra prediction mode in the MPM list.
[0218] 16 as an example, assuming that the constructed MPM mode list is as shown in the figure, the first intra prediction mode can select one of the first four MPMs, and assuming that the first intra prediction mode uses 12, i.e., the first MPM in the MPM list, the MPMs that the second intra prediction mode can select are queried in a front-to-back order, and the first MPM (12) is unavailable because it is used by the first intra prediction mode. The second MPM (24) is an available mode for the second intra prediction mode because it is unused and is an available angular mode, and the MPMs corresponding to the third (0), fourth (2), and fifth (1) are unused but unavailable because they are non-angular modes. The sixth (6), seventh (8), and eighth (10) MPMs are unused and are available angle modes, and therefore are available modes for the second intra-prediction mode; thus, 24, 6, 8, and 10 correspond to modes with MPM indices of 0, 1, 2, and 3, respectively, for the second intra-prediction mode.
[0219] An example of constructing an MPM list will be described using the blocks shown in FIG. 14 as an example.
[0220] Set the length of the first sublist of the MPM mode list to 8.
[0221] The current block is E, and the intra prediction modes used by neighboring blocks F, G, C, A, B, and D are added to the MPM mode list sequentially until the MPM modes are completely filled. If the position of a neighboring block among the neighboring blocks F, G, C, A, B, and D is unavailable or does not use an intra prediction mode, skip this position. Here, in this application, in addition to using the intra prediction mode corresponding to the block shown in FIG. 14, the intra prediction mode corresponding to another block may also be used, for example, the intra prediction mode corresponding to the block to the right or below the current block may be used.
[0222] Furthermore, if the MPM mode list is not completely filled, the intra prediction mode corresponding to the weight matrix derivation mode is added to the MPM mode list until the MPM mode list is completely filled.
[0223] If the MPM mode list is not completely filled, the DC mode and the Bilinear mode are added sequentially to the MPM mode list until the MPM mode list is completely filled.
[0224] If the MPM mode list is not completely filled, add intra-prediction modes that differ from the mode number of the first intra-prediction mode by 1, -1, 2, -2, 3, -3 to the MPM mode list, starting with the first intra-prediction mode in the MPM mode list, until the MPM mode list is completely filled. If an intra-prediction mode that differs from the mode number of the first intra-prediction mode by 1, -1, 2, -2, 3, -3 is invalid and is less than 0 or greater than maximum or is PCM, discard the invalid intra-prediction mode.
[0225] If the mode number of the first intra-prediction mode in the MPM mode list is greater than the mode number of the second intra-prediction mode, then the two MPMs are swapped.
[0226] During the operation of adding to the MPM mode list, each queued intra-prediction mode can be added to the MPM mode list only if it is different from all existing intra-prediction modes in the MPM mode list; otherwise, it is discarded.
[0227] In all the above processes of restricting the selectable intra-prediction modes of the second intra-prediction mode, if the derived or determined second intra-prediction mode is an incorrect mode, the second intra-prediction mode needs to be corrected to a correct mode by performing correction according to a predetermined correspondence relationship. Specifically, when the second intra-prediction mode is limited to an angular prediction mode, if the obtained second intra-prediction mode is mode 0, 1, 2, the second intra-prediction mode needs to correspond to one or several available angular modes according to a predetermined correspondence relationship in order to avoid an incorrect mode (i.e., restricting unavailable non-angular prediction modes). For example, if mode 0 is obtained by decoding the second intra prediction mode, the second intra prediction mode is set to mode 12, i.e., vertical mode, in accordance with a predetermined correspondence relationship; if mode 1 is obtained by decoding the second intra prediction mode, the second intra prediction mode is set to mode 18, i.e., a mode oriented 45 degrees downward and to the right, in accordance with the predetermined correspondence relationship; and if mode 2 is obtained by decoding the second intra prediction mode, the second intra prediction mode is set to mode 24, i.e., horizontal mode, in accordance with the predetermined correspondence relationship.
[0228] In addition, in this embodiment, when limiting the number of intra prediction modes, the encoder can directly limit the number of intra prediction modes for all prediction blocks, or can use different limiting methods for current blocks of different sizes by referring to the dimension parameters of the current block.
[0229] For example, in the present application, for a prediction block with a large dimension parameter, such as a prediction block of size 64x64 or 32x32, the encoder can determine two intra prediction modes for the current block using all intra prediction modes, and for a prediction block with a small dimension parameter, such as a prediction block of size 8x8, the encoder can determine two intra prediction modes for the current block using some intra prediction modes, that is, the number of intra prediction modes available for the current block can be limited, because the impact of small angle differences is not obvious for prediction blocks with small dimension parameters.
[0230] As can be understood, the present application can first set a dimension threshold, for example, a second dimension threshold, and when the dimension parameter of the current block is smaller than the second dimension threshold, it can be considered that a small angle difference does not have a significant effect, and thus the number of intra prediction modes that can be selected by the current block can be limited. Specifically, the number of intra prediction modes can be limited by limiting the index numbers of the two intra prediction modes of the current block.
[0231] Exemplarily, in this application, when the dimension parameter of the current block is smaller than a second dimension threshold, the encoder may determine a first intra prediction mode and a second intra prediction mode based on a second mode index range, where the second mode index range is used to limit the index number of the intra prediction mode. Specifically, the second mode index range may include a second lower threshold and a second upper threshold, and the encoder may first determine a first index number of the first intra prediction mode, and at the same time, determine a second index number of the second intra prediction mode, and then set both the first index number and the second index number to be greater than the second lower threshold and set both the first index number and the second index number to be less than the second upper threshold.
[0232] That is, in the present application, the index number of the first intra prediction mode and the index number of the second intra prediction mode of the current block are restricted according to the second mode index range, thereby completing the restriction of the number of intra prediction modes.
[0233] For example, in AVS3, the second mode index range may be 0 to 32, that is, the second mode index range can limit the index numbers of the first intra-prediction mode and the second intra-prediction mode to the range of 0 to 32, so that the first intra-prediction mode and the second intra-prediction mode of the current block can be determined using the first 33 prediction modes.
[0234] As can be appreciated, in this application, the first dimension threshold may be the same as or different from the second dimension threshold, and the first mode index range may be the same as or different from the second mode index range.
[0235] Furthermore, when the selectable intra-prediction modes of the first intra-prediction mode and the second intra-prediction mode are not restricted, the prediction capabilities of the determined two intra-prediction modes correspond to each other, and there is no need to process the corresponding weighting matrices. However, after the selectable intra-prediction modes are restricted, the prediction capabilities of the two intra-prediction modes are changed, and therefore the corresponding weighting matrices also need to be adjusted.
[0236] Specifically, in the AWP weight matrix shown in FIG. 2, the white part of the lower right corner of weight matrix 0 (number 0) is obtained entirely from the first intra prediction mode, the black part of the upper left corner is obtained entirely from the second intra prediction mode, and the gray part is obtained by weighting two intra prediction modes. If it is necessary to use DC mode for prediction of the upper left corner and horizontal mode for prediction of the lower right corner, the first intra prediction mode can be set to horizontal mode and the second intra prediction mode can be set to DC mode. Conversely, if it is necessary to use horizontal mode for prediction of the upper left corner and DC mode for prediction of the lower right corner, the first intra prediction mode can be set to DC mode and the second intra prediction mode can be set to horizontal mode. However, when one intra prediction mode is restricted, for example, when the second intra prediction mode can only use angular mode, according to the existing method, in the case of AWP weight matrix 0, the second intra prediction mode cannot use DC mode, so that the DC mode cannot be used for prediction of the upper left corner. When one intra prediction mode is restricted, for example, when the second intra prediction mode can only use DC mode, the black part of the above AWP weight matrix can only be obtained by prediction using DC mode according to the existing method. That is, the restriction of the second intra prediction mode greatly affects the effect of prediction.
[0237] Therefore, in the present application, in some cases, the weighting matrix needs to be adjusted, that is, the weighting matrix corresponding to the first intra prediction mode needs to be exchanged with the weighting matrix corresponding to the second intra prediction mode.
[0238] Scheme 1: One weight matrix exchange flag bit is added, which indicates whether to exchange the weight matrices of two prediction blocks.
[0239] Method 2: Based on the weight matrix, determine whether to exchange the weights of two prediction blocks.
[0240] Specifically, when the selectable intra prediction modes of the first intra prediction mode are not restricted, the selectable intra prediction modes of the first intra prediction mode are many, and the prediction ability is strong, while the selectable intra prediction modes of the second intra prediction mode are restricted, so that the choices are few, and the prediction ability is weak, in this case, the weight can be automatically assigned based on the weight matrix. According to the assignment result, in the final prediction block, the points affected by the first intra prediction mode are many, and the points affected by the second intra prediction mode are few.
[0241] Method 3: Determine whether to exchange the weights of two prediction blocks based on the mode numbers of the first intra prediction mode and / or the second intra prediction mode.
[0242] Although there is a certain difference between the prediction angles logically used by adjacent angular prediction modes, due to the influence of interpolation filtering and block size, the difference between the prediction blocks created by adjacent angular prediction modes is not very large, especially in relatively small blocks. Therefore, the logic of whether to exchange the weights of two prediction blocks is set to the mode number of the intra prediction mode, for example, the use of an even-numbered angular prediction mode by a certain intra prediction mode (the first intra prediction mode or the second intra prediction mode) indicates that the weights of the two prediction blocks are not exchanged, and the use of an odd-numbered angular prediction mode by the intra prediction mode indicates that the weights of the two prediction blocks are exchanged.
[0243] In another embodiment, when the second intra prediction mode can only use a certain non-angular mode or several non-angular modes, for example, when the second intra prediction mode can only use DC mode, it can be determined whether to exchange the weights of two prediction blocks according to the oddness or evenness of the mode number of the first intra prediction mode. If the mode number of the first intra prediction mode is an even number, the weights of the two prediction blocks are not exchanged; otherwise (if the mode number of the first intra prediction mode is an odd number), the weights of the two prediction blocks are exchanged.
[0244] Optionally, in the present application, the encoder can reduce the overhead for encoding the weight matrix derivation modes by reducing the number of weight matrix derivation modes available to the current block. For example, in AVS3, when 56 weight matrix derivation modes are used, a maximum of 6 bits are required to encode one weight matrix derivation mode, and when only 32 weight matrix derivation modes are used, a maximum of 5 bits are required to encode one weight matrix derivation mode. In addition, the encoder can further compress and limit the number of weight matrix derivation modes available to the current block (to use fewer flag bits to select which weight matrix or identify the weight matrix derivation mode), for example, only 16 weight matrix derivation modes are used, and initially, encoding is realized using only 4 bits, thereby further reducing the overhead and achieving better performance. It should be noted that, in the present embodiment, when limiting the number of weight matrix derivation modes, the encoder can directly limit the number of weight matrix derivation modes of all prediction blocks, or can use different limiting methods for current blocks of different sizes by referring to the dimension parameters of the current block.
[0245] For example, in the present application, for a prediction block with a large dimension parameter, such as a prediction block of 64x64 or 32x32 size, the encoder can determine the weight matrix derivation mode of the current block using all weight matrix derivation modes, and for a prediction block with a small dimension parameter, such as a prediction block of 8x8 size, the encoder can determine the weight matrix derivation mode of the current block using some weight matrix derivation modes, that is, the number of weight matrix derivation modes available for the current block can be limited, because the impact of small angle differences is not obvious for prediction blocks with small dimension parameters.
[0246] As can be understood, the present application can first set a dimension threshold, for example, a first dimension threshold, and when the dimension parameter of the current block is smaller than the first dimension threshold, it can be considered that a small angle difference does not have a significant effect, and thus the number of weight matrix derivation modes selectable by the current block can be limited. Specifically, the number of weight matrix derivation modes can be limited by limiting the index number of the weight matrix derivation mode of the current block.
[0247] Exemplarily, in this application, when the dimension parameter of the current block is smaller than a first dimension threshold, the encoder may determine a weight matrix derivation mode based on a first mode index range, where the first mode index range is used to limit the index number of the weight matrix derivation mode. Specifically, the first mode index range may include a first lower threshold and a first upper threshold, and the encoder may compare the index number of the weight matrix derivation mode with the first lower threshold and the first upper threshold, respectively, and when the index number of the weight matrix derivation mode is smaller than the first lower threshold, the encoder may set the index number of the weight matrix derivation mode to the first lower threshold, and when the index number of the weight matrix derivation mode is larger than the first upper threshold, the encoder may set the index number of the weight matrix derivation mode to the first upper threshold.
[0248] That is, in this application, the index number of the weighting matrix derivation mode of the current block can be restricted by the first mode index range, so that the restriction of the number of weighting matrix derivation modes can be completed.
[0249] For example, in AVS3, the first mode index range may be 0 to 32, that is, the first mode index range can limit the index number of the weighting matrix derivation mode to the range of 0 to 32, so that the current block can use the first 33 weighting matrix derivation modes to determine the weighting matrix derivation mode of the current block.
[0250] Example 1: Weight matrices that can be used in the AWP include weight matrices corresponding to numbers 0 to 55, and are specifically as shown in Fig. 2. In the present application, 32 types of weight matrices are used in the SAWP, that is, weight matrices that can be used in the SAWP correspond to weight matrices 0 to 7, 16 to 23, 32 to 39, and 48 to 55 of the AWP (weight matrices corresponding to the corresponding numbers in Fig. 2). In other words, weight matrices 0 to 7 of the SAWP correspond to weight matrices 0 to 7 of the AWP, weight matrices 8 to 15 of the SAWP correspond to weight matrices 16 to 23 of the AWP, weight matrices 16 to 23 of the SAWP correspond to weight matrices 32 to 39 of the AWP, and weight matrices 24 to 31 of the SAWP correspond to weight matrices 48 to 55 of the AWP. Assuming that the probabilities of these 32 types of weight matrices are equal, a 5-bit flag bit sawp_idx is required.
[0251] In one particular embodiment, the relationship between the sawp_idx values and the binary strings is as shown in Table 4.
[0252] [Table 4]
[0253] Example 2: In this example, there are only 24 types of weight matrices used in SAWP, and the weight matrices that can be used in SAWP correspond to weight matrices 8 to 15, 24 to 31, and 40 to 47 of the AWP shown in Fig. 2. In other words, weight matrices 0 to 7 of SAWP correspond to weight matrices 8 to 15 of AWP, weight matrices 8 to 15 of SAWP correspond to weight matrices 24 to 31 of AWP, and weight matrices 16 to 23 of SAWP correspond to weight matrices 40 to 47 of AWP, and 4 to 5 flag bits sawp_idx are required.
[0254] The relationship between the sawp_idx value and the binary string is shown in Table 5.
[0255] [Table 5]
[0256] Furthermore, since index numbers 10 and 14 in the 24 weight matrices of the SAWP above correspond to index numbers 26 and 30 in the 56 weight matrices of the AWP, respectively, which are similar to the horizontal and vertical partitioning methods of binary tree partitioning (BT), longer binary strings can be assigned to them with a low probability of being actually selected, and shorter binary strings can be assigned to weight matrices with a high probability of being selected.
[0257] In one example, as shown in Table 6, the binary strings of index numbers 2 and 10 in the 24 modes of SAWP are swapped, and the binary strings of index numbers 6 and 14 are swapped.
[0258] [Table 6]
[0259] In step 103, a prediction value of the current block is determined based on the first intra-prediction mode, the second intra-prediction mode and a weighting matrix.
[0260] In this embodiment, the encoder determines a first intra prediction mode and a second intra prediction mode of the current block based on a weighting matrix derivation mode, and after determining a weighting matrix of the current block based on the weighting matrix derivation mode, the encoder can further determine a prediction value of the current block based on the first intra prediction mode, the second intra prediction mode, and the weighting matrix.
[0261] As can be understood, in the present embodiment, when the encoder determines a predicted value of the current block based on a first intra prediction mode, a second intra prediction mode, and a weighting matrix, the encoder can first determine a first predicted value of the current block based on the first intra prediction mode, and at the same time determine a second predicted value of the current block based on the second intra prediction mode, and then perform a weighted average calculation on the first predicted value and the second predicted value using the weighting matrix to finally obtain a predicted value of the current block.
[0262] Furthermore, in the present embodiment, after determining the predicted value of the current block, the encoder can further perform a difference operation on the actual value and the predicted value of the current block to obtain a difference result between the actual value and the predicted value, thereby determining the predicted difference, i.e., the residual, of the current block.
[0263] That is, in the present application, the encoder can obtain a residual by calculating the difference between the actual value of the current block and the intra-predicted value, and the residual is transformed, quantized, entropy coded, written into the bitstream, and transmitted to the decoding side.
[0264] In the present embodiment, if the intra prediction mode parameter indicates that the intra prediction value of the current block is determined using the SAWP mode, the method for the encoder to perform the encoding process may further include the following steps.
[0265] In step 401, a first initial mode and a second initial mode of a current block are determined based on the mode list.
[0266] In this embodiment, after the encoder determines the intra prediction mode parameter of the current block, if the intra prediction mode parameter indicates that the intra prediction value of the current block is determined using the SAWP mode, the encoder may further determine a mode list (MPM list) used by the current block, and may determine a first initial mode and a second initial mode of the current block based on the mode list.
[0267] In this application, the mode list is used to determine the intra-prediction mode used by the current block. Specifically, the encoder can build a mode list using some intra-prediction modes with a relatively high usage probability, and can determine two intra-prediction modes for the current block based on the mode list.
[0268] As can be understood, in this embodiment, when determining a mode list, the encoder can adopt a general method for constructing an MPM, such as constructing an MPM using the prediction mode of a neighboring block, or can use the mode list construction method related to the intra prediction method proposed in this application, i.e., construct a mode list using the weight matrix derivation mode of the current block.
[0269] In other words, in the present application, the method of constructing the mode list may be selected to use the mode list construction method provided in step 102 in the above embodiment, or other MPM construction methods may be used, and the present application is not particularly limited thereto.
[0270] Furthermore, in the present embodiment, after determining the mode list used by the current block, the encoder may first determine a first initial mode and a second initial mode of the current block based on the mode list.
[0271] For example, in this application, the encoder constructs a mode list containing N MPMs, where N is 2 nIf so, n bits (mpm_idx) can be used to indicate which MPM in the mode list is selected, i.e., to determine the first and second initial modes, and 1 bit can be used to indicate whether an offset is required (offset_needed). For example, when a mode list including four MPMs is constructed and an intra prediction mode is selected in the mode list, 2 bits (mpm_idx) need to be used to indicate which MPM in the mode list is selected as the initial mode, and the correspondence between the mpm_idx values and binary strings shown in Table 7 can be used to determine the prediction mode.
[0272] [Table 7]
[0273] In step 402, an offset mode parameter is determined, and if the offset mode parameter indicates that an offset process is to be performed, an offset parameter of the current block is determined.
[0274] In this embodiment, the encoder can further determine an offset mode parameter, where the offset mode parameter is used to determine whether offsetting is required. Specifically, if the offset mode parameter indicates performing offset processing, the encoder can further determine an offset parameter of the current block.
[0275] In addition, in this embodiment, the encoder can use one bit to indicate whether offsetting is needed (offset_needed), that is, the encoder can further determine whether the prediction mode (first initial mode or second initial mode) of the current block needs to be offset by setting the offset mode parameter.
[0276] Further, in the present embodiment, when the offset mode parameter indicates to perform offset processing, the encoder can further determine an offset parameter of the current block, where the offset parameter may include an offset manner and an offset amount, that is, by determining the offset parameter, the encoder can determine whether to perform offset processing for the first initial mode or the second initial mode of the current block.
[0277] In addition, in this embodiment, the encoder can also use coded bits to indicate the offset type and offset amount in the offset parameter. For example, the encoder can use one bit (sign) to indicate whether the offset type is "+" or "-", and can further use several bits (offset) to indicate the offset amount.
[0278] Optionally, in this application, the encoder can pre-set the offset method and offset amount, for example, the encoder can be set to only offset by a certain amount (1, 2, 4, etc.) by default.
[0279] In step 403, a first intra-prediction mode of the current block is determined based on the first initial mode and the offset parameter, and a second intra-prediction mode of the current block is determined based on the second initial mode and the offset parameter.
[0280] In the present embodiment, after the encoder determines an offset parameter for the current block, it can determine a first intra-prediction mode for the current block based on a first initial mode and the offset parameter, and at the same time, it can determine a second intra-prediction mode for the current block based on a second initial mode and the offset parameter.
[0281] Furthermore, in this embodiment, when the encoder determines the first intra prediction mode and the second intra prediction mode of the current block based on the mode list and the offset parameter, the encoder can perform an offset process on the first initial mode based on the offset method and the offset amount, thereby determining the first intra prediction mode, and at the same time, perform an offset process on the second initial mode based on the offset method and the offset amount, thereby determining the second intra prediction mode.
[0282] That is, in the present embodiment, the encoder can first use some bits to determine which prediction mode in the mode list to use, i.e., first determine an initial mode from the mode list, and then perform an offset process on the initial mode based on the offset parameter to finally determine the intra prediction mode to be used by the current block.
[0283] As can be understood, in the present embodiment, the encoder can use the same offset parameters for the first and second initial modes, i.e., perform offset processing using the same offset scheme and offset amount according to the first and second initial modes. Correspondingly, the encoder can also use different offset parameters for the first and second initial modes, i.e., perform offset processing using one offset scheme according to the first initial mode, and simultaneously perform offset processing using another offset scheme according to the second initial mode, where the offset schemes and offset amounts corresponding to the two offset schemes may not be completely identical.
[0284] That is, in the present application, the offset method and offset amount corresponding to the offset processing in the first initial mode may be the same as or different from the offset method and offset amount corresponding to the offset processing in the second initial mode.
[0285] Optionally, in the present application, the offset mode parameter corresponding to the first initial mode may be different from the offset mode parameter corresponding to the second initial mode, that is, the encoder can realize several different processing manners by respectively setting the offset mode parameters of the first initial mode and the second initial mode, such as: perform offset processing for both the first initial mode and the second initial mode, or do not perform offset processing for both the first initial mode and the second initial mode, or perform offset processing for the first initial mode and do not perform offset processing for the second initial mode, or do not perform offset processing for the first initial mode and perform offset processing for the second initial mode.
[0286] Further, in the present embodiment, if the offset mode parameter indicates that offset processing is not to be performed, the encoder can directly determine the first intra-prediction mode and the second intra-prediction mode based on the mode list, that is, the encoder can directly use some bits to determine which prediction mode in the mode list to use.
[0287] In step 404, a prediction value for the current block is determined based on the first intra-prediction mode and the second intra-prediction mode.
[0288] In this embodiment, the encoder may determine a first intra prediction mode and a second intra prediction mode of the current block based on the mode list and the offset parameter, and then may further determine a prediction value of the current block based on the first intra prediction mode and the second intra prediction mode.
[0289] In addition, in the present embodiment, when the encoder determines a predicted value of the current block, the encoder can first determine a first predicted value of the current block based on a first intra prediction mode, and at the same time determine a second predicted value of the current block based on a second intra prediction mode. Then, the encoder can finally obtain a predicted value of the current block by performing a weighted average calculation on the first predicted value and the second predicted value using a weight matrix of the current block.
[0290] Furthermore, in the present embodiment, after determining the predicted value of the current block, the encoder can further perform a difference operation on the actual value and the predicted value of the current block to obtain a difference result between the actual value and the predicted value, thereby determining the predicted difference, i.e., the residual, of the current block.
[0291] That is, in the present application, the encoder can obtain a residual by calculating the difference between the actual value of the current block and the intra-predicted value, and the residual is transformed, quantized, entropy coded, written into the bitstream, and transmitted to the decoding side.
[0292] In the present embodiment, further, according to the intra prediction method shown in steps 401 to 404 above, the encoder first selects one prediction mode from the mode list, and then determines whether offsetting is required based on the prediction mode. If offsetting is required, the encoder further determines an offset method and an offset amount, where the offset amount can be understood as an offset mode index number.
[0293] In addition, in the present embodiment, the method of determining the prediction mode of the current block by performing an offset process on the mode list may be applied to the SAWP mode of the present embodiment, or may be applied to other intra prediction modes, or may be applied to any inter prediction mode, and the present application is not particularly limited thereto. In addition, 1 bit (offset_needed) may be used to indicate whether or not offset is required, and for example, if the value of the offset mode parameter offset_needed is set to 0, it may be considered that the offset process is not performed, and if the value of the offset mode parameter offset_needed is set to 1, it may be considered that the offset process is performed.
[0294] For example, in the present application, when four MPMs are specified to be constructed, two bits can be used to determine which prediction mode to select, and one bit can be used to determine whether to perform offset processing. If the selected intra prediction mode is MPM 1, a total of three bits are required: two bits (mpm_idx) to indicate which MPM it is, and one bit (offset_needed) to indicate that no offset is required.
[0295] Furthermore, in the present embodiment, when the offset mode parameter indicates to perform offset processing, an offset parameter can be further determined, where the offset parameter may include an offset scheme of 1 bit (sign) and may further include an offset amount of several bits (offset).
[0296] That is, in the present application, when an offset is required, one bit (sign) can be used to indicate whether the offset method is "+" or "-", and further, the offset amount setting method can be set to only offset a specific amount (such as 1, 2, or 4) by default, or some overhead can be used to indicate the offset amount. For example, assuming there are two selectable offset amounts, such as 2 and 4, one bit can be used to indicate whether the offset amount is 2 or 4. When there are multiple selectable offset amounts, several bits (offset) can be used to indicate the offset amount, and the correspondence between the offset value and the binary string shown in Table 8 can be used to determine the offset amount.
[0297] [Table 8]
[0298] Based on the above embodiment, another embodiment of the present application proposes an intra prediction method applied to an encoder, and Figure 17 is a schematic diagram 2 of the implementation process of the intra prediction method. As shown in Figure 17, the intra prediction method performed by the encoder may include the following steps:
[0299] In step 501, if the intra prediction of the current block is determined using a SAWP mode, a mode list of the current block is determined.
[0300] In this embodiment, after determining that the intra prediction value of the current block is determined using the SAWP mode, the encoder may first determine a mode list for the current block.
[0301] In addition, in the present embodiment, the SAWP mode is one of intra prediction methods. Specifically, according to the SAWP mode, two different intra prediction modes are determined for the current block, and two prediction blocks are determined respectively based on the two different intra prediction modes. Then, a weighting matrix is determined, and the two prediction blocks are combined according to the weighting matrix, so that a new prediction block can finally be obtained, that is, a prediction block of the current block can be obtained.
[0302] Optionally, in this application, the decoder can first determine a dimension parameter of the current block, and then determine whether the current block uses the SAWP mode according to the dimension parameter, specifically, determine that the current block uses the SAWP mode if the width is greater than a first threshold and the height is greater than a second threshold, or determine that the current block uses the SAWP mode if the width is less than a third threshold and the height is greater than a fourth threshold.
[0303] Optionally, in the present application, the decoder can first determine pixel parameters of the current block, and then determine whether the current block uses the SAWP mode based on the pixel parameters and the fifth threshold.
[0304] Optionally, in this application, the decoder can first determine the intra-prediction mode parameter of the current block, and then determine whether the current block uses the SAWP mode based on the intra-prediction mode parameter.
[0305] It should be noted that in the present application, the weight matrix derivation mode is used to determine the weight matrix used by the current block. Specifically, the weight matrix derivation mode may be a mode for deriving a weight matrix. For a prediction block having a certain length and width, each weight matrix derivation mode can derive one weight matrix, and for prediction blocks of the same size, the weight matrices derived by different weight matrix derivation modes are different.
[0306] For example, in this application, the AWP of the AVS3 has 56 weight matrix derivation modes, and the GPM of the VVC has 64 weight matrix derivation modes.
[0307] Further, in the present embodiment, when the encoder determines a mode list using a weighting matrix derivation mode, the encoder may first determine an intra prediction mode corresponding to an adjacent block of the current block, and then determine the intra prediction mode corresponding to the adjacent block as an additional waiting mode; after determining that the additional waiting mode satisfies a predetermined additional condition, the encoder may add the additional waiting mode to the mode list, i.e., add the intra prediction mode corresponding to the adjacent block of the current block to the mode list; then, if the mode list does not meet the predetermined list length, the encoder may continue to determine a weighting matrix derivation mode of the current block, determine a correlated intra prediction mode corresponding to the weighting matrix derivation mode, and then determine the correlated intra prediction mode corresponding to the weighting matrix derivation mode as an additional waiting mode; if the encoder determines that the additional waiting mode satisfies the predetermined additional condition, the encoder may add the additional waiting mode to the mode list, i.e., add the correlated intra prediction mode corresponding to the weighting matrix derivation mode to the mode list.
[0308] In addition, in this embodiment, after the encoder adds an intra-prediction mode corresponding to an adjacent block of the current block to the mode list, or after the encoder adds a correlated intra-prediction mode corresponding to the weight matrix derivation mode to the mode list, if the mode list does not meet a predetermined list length, i.e., the mode list is not completely filled, the encoder can continue to determine the predetermined prediction mode as an additional waiting mode, and after determining that the additional waiting mode meets a predetermined addition condition, the encoder adds the additional waiting mode to the mode list, i.e., adds the predetermined prediction mode to the mode list.
[0309] As can be appreciated, in this application, the predetermined prediction mode may include one or more of a variety of different modes, such as a DC mode, a bilinear mode, a planar mode, and the like.
[0310] Furthermore, in this embodiment, after the encoder adds the intra-prediction mode corresponding to the neighboring blocks of the current block, the correlated intra-prediction mode corresponding to the weight matrix derivation mode, and a predetermined prediction mode to the mode list, if the mode list still does not meet a predetermined list length, i.e., the mode list is still not completely filled, the encoder can choose to use a prediction mode in the mode list to determine an associated intra-prediction mode, and determines the associated intra-prediction mode as an additional waiting mode, and if it determines that the additional waiting mode meets a predetermined addition condition, adds the additional waiting mode to the mode list, i.e., adds the associated intra-prediction mode corresponding to the mode list to the mode list.
[0311] That is, in the present application, after sequentially adding the intra prediction modes corresponding to the neighboring blocks of the current block, the correlated intra prediction modes corresponding to the weight matrix derivation modes, and the predetermined prediction modes to the mode list, if the mode list is still not completely filled, the encoder can determine corresponding associated intra prediction modes based on the existing prediction modes in the mode list, and then add these associated intra prediction modes to the mode list.
[0312] In addition, in the present embodiment, regardless of whether the intra prediction mode corresponding to the adjacent block of the current block is the addition waiting mode, the correlated intra prediction mode corresponding to the weight matrix derivation mode is the addition waiting mode, or a specified prediction mode is the addition waiting mode, or an associated intra prediction mode is the addition waiting mode, the encoder needs to determine whether the addition waiting mode satisfies a specified addition condition; specifically, if an addition waiting mode exists and is different from all prediction modes in the mode list, it can be determined that the addition waiting mode satisfies the specified addition condition, and the addition waiting mode can be added to the mode list.
[0313] Correspondingly, if the waiting mode to be added does not exist or is the same (duplicates) as one prediction mode in the mode list, it can be determined that the waiting mode to be added does not satisfy a predetermined addition condition, in which case the waiting mode to be added cannot be added to the mode list, and the waiting mode to be added is directly discarded.
[0314] As can be seen, in the present application, since the current block needs to perform intra prediction processing using two intra prediction modes, it can refer to intra prediction modes at more positions or to intra prediction modes of more neighboring blocks when constructing the MPM. Correspondingly, in the present application, the length of the mode list used by the current block can be different from the mode list length of other intra prediction modes, and since the codeword of the MPM during binarization is shorter than other modes, increasing the probability that each of the two intra prediction modes is an MPM helps to improve the efficiency of encoding and decoding.
[0315] Furthermore, in the present embodiment, when the encoder determines a mode list using a weighting matrix derivation mode, the encoder can first determine a list construction strategy corresponding to the weighting matrix derivation mode, and then further determine a mode list based on the list construction strategy.
[0316] That is, in the present application, for different weight matrices, i.e., different weight matrix derivation modes, the encoder can use different construction strategies to construct the mode list. For example, based on the construction strategy, if the boundary of the weight matrix is 0 degrees or 90 degrees, i.e., horizontal or vertical, the encoder can choose to take into account the intra-prediction mode corresponding to the weight matrix when constructing the mode list, and in other cases, do not consider the intra-prediction mode corresponding to the weight matrix.
[0317] In step 502, a first intra-prediction mode and a second intra-prediction mode of a current block are determined based on the mode list.
[0318] In the embodiment of the present application, after constructing a mode list for the current block, the encoder can determine the first intra prediction mode and the second intra prediction mode for the current block based on the mode list.
[0319] As can be understood, in the present application, when two intra prediction modes of a current block used for intra prediction are different, i.e., the first intra prediction mode and the second intra prediction mode are different, the possibility of the first intra prediction mode can be eliminated when the second intra prediction mode is decoded, i.e., information of the first intra prediction mode can be used to decode the second intra prediction mode.
[0320] In this embodiment, the encoder may also set a candidate intra-prediction mode during construction of the mode list, where the candidate intra-prediction mode is different from all intra-prediction modes in the mode list.
[0321] Specifically, in the present application, in order to make the first intra prediction mode and the second intra prediction mode used by the current block different, the determination of the second intra prediction mode may depend on the first intra prediction mode. Here, when the encoder determines the first intra prediction mode and the second intra prediction mode based on the mode list, the encoder may first determine one prediction mode in the mode list as the first intra prediction mode, and then determine the second intra prediction mode based on the first intra prediction mode and the mode list.
[0322] Further, in an embodiment of the present application, after determining one prediction mode in the mode list as the first intra prediction mode, the encoder may remove the prediction mode from the mode list and add candidate intra prediction modes to the mode list, thereby obtaining an updated mode list, and then select one prediction mode from the updated mode list to determine it as the second intra prediction mode, where the selection manner may be arbitrary.
[0323] For example, in the present application, assuming that the number of selectable MPMs of the first intra prediction mode and the second intra prediction mode is N, when constructing a mode list, N MPMs and one candidate MPM can be constructed first, and the selectable MPMs of the first intra prediction mode are the above N MPMs. If the first intra prediction mode selects one of the MPMs, for the second intra prediction mode, the MPM selected by the first intra prediction mode is deleted, and the candidate MPM is added to the mode list so that the second intra prediction mode can still select from the N MPMs.
[0324] In this embodiment, the encoder may further set the length parameter of the mode list to (N+1), where N is a positive integer, during construction of the mode list.
[0325] Specifically, in the present application, in order to make the first intra prediction mode and the second intra prediction mode used by the current block different, the determination of the second intra prediction mode may depend on the first intra prediction mode. Here, when the encoder determines the first intra prediction mode and the second intra prediction mode based on the mode list, if the encoder determines the first intra prediction mode using the mode list, the encoder may determine one of the first N prediction modes in the mode list as the first intra prediction mode, and then determine the second intra prediction mode based on the first intra prediction mode and the mode list.
[0326] Furthermore, in an embodiment of the present application, when determining a first intra prediction mode using a mode list, the encoder determines one of the first N prediction modes in the mode list as the first intra prediction mode, and then determines a second intra prediction mode using the other N prediction modes other than the first intra prediction mode in the mode list.
[0327] In addition, in this embodiment, when the encoder determines the first intra prediction mode and the second intra prediction mode based on the mode list, if the mode list is not used to determine the first intra prediction mode, the encoder can directly determine one of the first N prediction modes in the mode list as the second intra prediction mode.
[0328] Optionally, in the present embodiment, if the first intra prediction mode and the second intra prediction mode used by the current block are only guaranteed to be different, and the number of selectable MPMs of the first intra prediction mode and the second intra prediction mode is not limited, the encoder may not set the candidate intra prediction mode or may not increase the mode list length, in which case the encoder needs to change the encoding method of the second intra prediction mode. That is, after the first intra prediction mode selects one MPM in the mode list, the selectable MPMs of the second intra prediction mode are reduced by one, in which case the encoding method of the second intra prediction mode needs to be changed because the selectable MPMs of the second intra prediction mode are reduced.
[0329] For example, in the present application, the number N of MPMs is 4, and the first bit is used to indicate whether it is an MPM (for example, "1" indicates that it is an MPM, and "0" indicates that it is not an MPM). If the first intra prediction mode is an MPM, there are four MPMs, so two bits are used to indicate which MPM it is, i.e., "00, 01, 10, 11" respectively represent the first MPM, the second MPM, the third MPM, and the fourth MPM. Also, if the first intra prediction mode and the second intra prediction mode are both MPMs, there are only three MPMs available for the second intra prediction mode, so one or two bits can be used to indicate which MPM it is, for example, "00, 01, 10" respectively represent the remaining first MPM, the second MPM, and the third MPM. As can be seen, since one possibility is excluded, overhead can be saved by changing the encoding method or binarization method.
[0330] In step 503, a prediction value of the current block is determined based on the first intra-prediction mode and the second intra-prediction mode.
[0331] In the present embodiment, the encoder may determine a first intra prediction mode and a second intra prediction mode of the current block based on the mode list, and then may further determine a prediction value of the current block based on the first intra prediction mode and the second intra prediction mode.
[0332] As can be understood, in the present embodiment, when the encoder determines the predicted value of the current block according to the first intra prediction mode and the second intra prediction mode, the encoder can first determine the first predicted value of the current block according to the first intra prediction mode, and at the same time determine the second predicted value of the current block according to the second intra prediction mode, and then perform a weighted average calculation on the first predicted value and the second predicted value to finally obtain the predicted value of the current block. For example, the encoder can use a weight matrix to perform a weighted average calculation on the first predicted value and the second predicted value to obtain the predicted value of the current block.
[0333] Furthermore, in the present embodiment, after determining the predicted value of the current block, the encoder can further perform a difference operation on the actual value and the predicted value of the current block to obtain a difference result between the actual value and the predicted value, thereby determining the predicted difference, i.e., the residual, of the current block.
[0334] That is, in the present application, the encoder can obtain a residual by calculating the difference between the actual value of the current block and the intra-predicted value, and the residual is transformed, quantized, entropy coded, written into the bitstream, and transmitted to the decoding side.
[0335] The present embodiment provides an intra prediction method, in which the encoder / decoder can determine two different prediction blocks of a current block according to two different intra prediction modes, and can finally obtain a more complex prediction block by combining the prediction blocks using various weight matrices, thereby improving the accuracy of prediction, and further, the encoder / decoder can also construct an MPM list using the correlation between the weight matrix and the prediction mode, thereby greatly reducing the complexity. In other words, the intra prediction method proposed in the present application can reduce the complexity while improving the quality of intra prediction, thereby improving the compression performance.
[0336] In the present embodiment, further, after determining the mode list for the current block, the encoder can first determine a first initial mode and a second initial mode for the current block based on the mode list, and then determine an offset mode parameter; if the offset mode parameter indicates to perform an offset process, the encoder can determine an offset parameter for the current block, then determine a first intra prediction mode for the current block based on the first initial mode and the offset parameter, determine a second intra prediction mode for the current block based on the second initial mode and the offset parameter, and finally determine a predicted value of the current block based on the first intra prediction mode and the second intra prediction mode.
[0337] As can be understood, in this embodiment, when determining a mode list, the encoder can adopt a general method for constructing an MPM, such as constructing an MPM using the prediction mode of a neighboring block, or can use the mode list construction method related to the intra prediction method proposed in this application, i.e., construct a mode list using the weight matrix derivation mode of the current block.
[0338] In other words, in the present application, the method of constructing the mode list may be selected to use the mode list construction method provided in the above embodiment, or other MPM construction methods may be used, and the present application is not particularly limited thereto.
[0339] Furthermore, in the present embodiment, after determining the mode list used by the current block, the encoder may first determine a first initial mode and a second initial mode of the current block based on the mode list.
[0340] For example, in this application, the encoder constructs a mode list containing N MPMs, where N is 2 n If so, n bits (mpm_idx) can be used to indicate which MPM in the mode list is selected, i.e., to determine the first and second initial modes, and 1 bit can be used to indicate whether an offset is required (offset_needed). For example, when a mode list including four MPMs is constructed and an intra prediction mode is selected in the mode list, 2 bits (mpm_idx) need to be used to indicate which MPM in the mode list is selected as the initial mode, and the correspondence between the mpm_idx values and binary strings shown in Table 3 can be used to determine the prediction mode.
[0341] In addition, in this embodiment, the encoder can use one bit to indicate whether offsetting is needed (offset_needed), that is, the encoder can further determine whether the prediction mode (first initial mode or second initial mode) of the current block needs to be offset by setting the offset mode parameter.
[0342] Furthermore, in this embodiment, if the offset mode parameter indicates that an offset process is performed, the encoder may further determine an offset parameter of the current block, where the offset parameter may include an offset method and an offset amount, that is, by determining the offset parameter, the encoder may determine whether to perform an offset process for the first initial mode or the second initial mode of the current block.
[0343] In addition, in this embodiment, the encoder can also use coded bits to indicate the offset type and offset amount in the offset parameter. For example, the encoder can use one bit (sign) to indicate whether the offset type is "+" or "-", and can further use several bits (offset) to indicate the offset amount.
[0344] Optionally, in this application, the encoder can pre-set the offset method and offset amount, for example, the encoder can be set to only offset by a certain amount (1, 2, 4, etc.) by default.
[0345] Furthermore, in an embodiment of the present application, when the encoder determines the first intra prediction mode and the second intra prediction mode of the current block based on the mode list and the offset parameter, the encoder can perform an offset process on the first initial mode based on the offset method and the offset amount to determine the first intra prediction mode, and at the same time, can perform an offset process on the second initial mode based on the offset method and the offset amount to determine the second intra prediction mode.
[0346] That is, in the present embodiment, the encoder can first use some bits to determine which prediction mode in the mode list to use, i.e., first determine an initial mode from the mode list, and then perform an offset process on the initial mode based on the offset parameter to finally determine the intra prediction mode to be used by the current block.
[0347] As can be understood, in the present embodiment, the encoder can use the same offset parameters for the first and second initial modes, i.e., perform offset processing using the same offset scheme and offset amount according to the first and second initial modes. Correspondingly, the encoder can also use different offset parameters for the first and second initial modes, i.e., perform offset processing using one offset scheme according to the first initial mode, and simultaneously perform offset processing using another offset scheme according to the second initial mode, where the offset schemes and offset amounts corresponding to the two offset schemes may not be completely identical.
[0348] That is, in the present application, the offset method and offset amount corresponding to the offset processing in the first initial mode may be the same as or different from the offset method and offset amount corresponding to the offset processing in the second initial mode.
[0349] Optionally, in the present application, the offset mode parameter corresponding to the first initial mode may be different from the offset mode parameter corresponding to the second initial mode, that is, the encoder can realize several different processing manners by respectively setting the offset mode parameters of the first initial mode and the second initial mode, such as: perform offset processing for both the first initial mode and the second initial mode, or do not perform offset processing for both the first initial mode and the second initial mode, or perform offset processing for the first initial mode and do not perform offset processing for the second initial mode, or do not perform offset processing for the first initial mode and perform offset processing for the second initial mode.
[0350] Further, in the present embodiment, when the offset mode parameter indicates that offset processing is not performed, the encoder can directly determine the first intra prediction mode and the second intra prediction mode based on the mode list, that is, the encoder can directly use some bits to determine which prediction mode in the mode list to use.
[0351] In addition, in the present embodiment, when the encoder determines a predicted value of the current block, the encoder can first determine a first predicted value of the current block based on a first intra prediction mode, and at the same time determine a second predicted value of the current block based on a second intra prediction mode, and then perform a weighted average calculation on the first predicted value and the second predicted value to finally obtain a predicted value of the current block.
[0352] In summary, the intra prediction method proposed in the present embodiment considers the shortcoming that the intra prediction mode in the general technology can only predict simple texture, determines two prediction blocks according to two intra prediction modes, and combines the prediction blocks using various weight matrices to obtain a more complex prediction block, thereby improving the quality of intra prediction and further improving compression performance.As can be seen, the intra prediction method proposed in the present application can improve the coding of intra prediction modes, and utilize the probability characteristics of intra prediction modes in new scenarios to improve the coding method of intra prediction modes, and effectively improve compression performance.
[0353] It should be noted that the coding method of the intra prediction mode used in the present application may be different from the coding method of the intra prediction mode of the intra prediction method in the general technology. Correspondingly, the MPM construction method used in the present application may also be different from the MPM construction method of the intra prediction method in the general technology.
[0354] As can be understood, in the present application, since there is a certain correlation between the intra prediction mode selected by the current block and the weight matrix, the weight matrix information can be used for encoding the intra prediction mode by utilizing this correlation, that is, the encoding of the intra prediction mode can utilize the weight matrix derivation mode information. Specifically, the weight matrix derivation mode can be used to construct the MPM, or the weight matrix derivation mode information can be used when constructing the MPM.
[0355] Optionally, in the present application, an intra-prediction mode corresponding to a weight matrix derivation mode or some intra-prediction modes related to an intra-prediction mode corresponding to a weight matrix derivation mode can be set to be assigned a shorter codeword than a normal intra-prediction mode when binarized.
[0356] It should be noted that, since the present application needs to use two intra prediction modes, the intra prediction modes of more positions can be referenced or the intra prediction modes of more neighboring blocks can be referenced when constructing the MPM. The length of the mode list (i.e., MPM list) used in the present invention may be different from the length of the mode list (i.e., MPM list) of other intra prediction modes.
[0357] The present embodiment provides an intra prediction method, in which the encoder / decoder can determine two different prediction blocks of a current block according to two different intra prediction modes, and can finally obtain a more complex prediction block by combining the prediction blocks using various weight matrices, thereby improving the accuracy of prediction, and further, the encoder / decoder can also construct an MPM list using the correlation between the weight matrix and the prediction mode, thereby greatly reducing the complexity. In other words, the intra prediction method proposed in the present application can reduce the complexity while improving the quality of intra prediction, thereby improving the compression performance.
[0358] In one embodiment of the present application, an intra prediction method applied to a decoder is provided, and Figure 18 is a schematic diagram 3 of the implementation process of the intra prediction method. As shown in Figure 18, the intra prediction method performed by the decoder may include the following steps:
[0359] In step 601, the bitstream is parsed to determine the intra-prediction mode parameters of the current block.
[0360] In this embodiment, the decoder parses the bitstream to determine the intra-prediction mode parameters of the current block.
[0361] In addition, in the implementation of the present application, the intra prediction mode parameter can indicate whether the current block can use the SAWP coding mode, i.e., whether the current block can use two different prediction modes to perform the prediction process.
[0362] As can be understood, in the present embodiment, the intra-prediction mode parameter can be understood as a flag bit indicating whether the SAWP mode is used. Specifically, the decoder can analyze the bitstream and determine one variable to be used as the intra-prediction mode parameter, and can determine the intra-prediction mode parameter based on the value of the variable.
[0363] In addition, in the present embodiment, the SAWP mode is one of intra prediction methods. Specifically, according to the SAWP mode, two different intra prediction modes are determined for the current block, and two prediction blocks are determined respectively based on the two different intra prediction modes. Then, a weighting matrix is determined, and the two prediction blocks are combined according to the weighting matrix, so that a new prediction block can finally be obtained, that is, a prediction block of the current block can be obtained.
[0364] Furthermore, in the present embodiment, when the SAWP mode is applied, the size of the current block can be restricted.
[0365] As can be seen, the intra prediction method proposed in the present embodiment needs to generate two prediction blocks using two different intra prediction modes respectively, and then perform weighting according to a weight matrix to obtain a new prediction block, therefore, in order to reduce complexity and balance compression performance and complexity, the present embodiment can restrict a prediction block of a certain size not to use the SAWP mode. Therefore, in the present application, the decoder can first determine the dimension parameter of the current block, and then determine whether the current block uses the SAWP mode based on the dimension parameter.
[0366] In addition, in the present embodiment, the dimension parameters of the current block may include the height and width of the current block, and thus the decoder can use the height and width of the current block to restrict the use of the SAWP mode, i.e., to restrict the dimensions of the predicted blocks for which the SAWP mode can be used.
[0367] For example, in this application, if the width is greater than the first threshold and the height is greater than the second threshold, it is determined that the current block uses the SAWP mode. As can be seen, one possible restriction method is to use the SAWP mode only when the width of the prediction block is greater than (or equal to) the first threshold and the height of the prediction block is greater than (or equal to) the second threshold. Here, the values of the first and second thresholds may be 8, 16, 32, etc., and the first threshold may be equal to the second threshold.
[0368] For example, in this application, if the width is smaller than the third threshold and the height is larger than the fourth threshold, it is determined that the current block uses the SAWP mode. As can be seen, one possible restriction method is to use the SAWP mode only if the width of the prediction block is smaller than (or equal to or smaller than) the third threshold and the height of the prediction block is larger than (or equal to or larger than) the fourth threshold. Here, the values of the third and fourth thresholds may be 8, 16, 32, etc., and the third threshold may be equal to the fourth threshold.
[0369] Furthermore, in the present embodiment, by restricting pixel parameters, it is also possible to restrict the size of the prediction blocks for which the SAWP modes can be used.
[0370] For example, in this application, the decoder can first determine the pixel parameters of the current block, and then judge whether the current block can use the SAWP mode according to the pixel parameters and the fifth threshold. As can be seen, one possible restriction method is to use the SAWP mode only if the pixel number of the prediction block is greater than (or equal to or greater than) the fifth threshold. Here, the value of the fifth threshold may be 8, 16, 32, etc.
[0371] That is, in this application, the current block can use the SAWP mode only if the dimension parameters of the current block meet the size requirements.
[0372] For example, in the present application, there may be one frame-level flag for determining whether a currently waiting to be decoded frame uses the present invention. For example, an intraframe (e.g., an I frame) may be set to use the present invention, and an interframe (e.g., a B frame, a P frame) may be set to not use the present invention. Or, an intraframe may be set not to use the present invention, and an interframe may be set to use the present invention. Or, some interframes may be set to use the present invention, and some interframes may be set to not use the present invention. Interframes can also use intraprediction, so they can also use the present invention.
[0373] There may be one flag below the frame level, above the CU level (eg, tile, slice, patch, LCU, etc.) to determine whether this region uses the present invention or not.
[0374] In step 602, if the intra prediction mode parameter indicates that the intra prediction value of the current block is determined using the SAWP mode, a weighting matrix derivation mode for the current block is determined.
[0375] In the present embodiment, after the decoder determines the intra prediction mode parameter of the current block, if the intra prediction mode parameter indicates that the intra prediction value of the current block is determined using a SAWP mode, the decoder can further determine a weighting matrix derivation mode of the current block.
[0376] It should be noted that in the present application, the weight matrix derivation mode is used to determine the weight matrix used by the current block. Specifically, the weight matrix derivation mode may be a mode for deriving a weight matrix. For a prediction block having a certain length and width, each weight matrix derivation mode can derive one weight matrix, and for prediction blocks of the same size, the weight matrices derived by different weight matrix derivation modes are different.
[0377] For example, in this application, the AWP of the AVS3 has 56 weight matrix derivation modes, and the GPM of the VVC has 64 weight matrix derivation modes.
[0378] In step 603, a first intra prediction mode and a second intra prediction mode of the current block are determined according to a weighting matrix derivation mode, and a weighting matrix of the current block is determined according to the weighting matrix derivation mode.
[0379] In this embodiment, when the intra prediction mode parameter indicates that the intra prediction value of the current block is determined using a SAWP mode, the decoder can first determine a first intra prediction mode and a second intra prediction mode of the current block based on the weight matrix derivation mode after determining the weight matrix derivation mode of the current block, and at the same time, determine the weight matrix of the current block based on the weight matrix derivation mode.
[0380] In addition, in this embodiment, the first intra prediction mode and the second intra prediction mode used by the current block may be any one of the currently common intra prediction modes, including but not limited to intra prediction modes such as DC, Planar, Bilinear and angular prediction modes.
[0381] Optionally, in the broader sense of the present application, the intra prediction mode further includes techniques for improving prediction, such as improved sub-pixel interpolation of reference pixels and filtering of predicted pixels, such as MIPF and IPF.
[0382] Correspondingly, in this application, intra prediction modes such as DC mode, Planar mode, Bilinear mode, and angular prediction mode can be referred to as basic intra prediction modes, and techniques for improving prediction such as MIPF and IPF can be referred to as improved intra prediction modes. The basic intra prediction mode is an intra prediction mode that can generate a prediction block independently without depending on other intra prediction modes, that is, the prediction block can be determined by determining the reference pixel and the basic intra prediction mode. In contrast, the improved intra prediction mode cannot generate a prediction block independently and needs to determine the prediction block depending on the basic intra prediction mode. For example, a certain angular prediction mode can determine and generate a prediction block based on the reference pixel, and the MIPF can generate or determine a prediction block using different filters for pixels at different positions based on this angular prediction mode.
[0383] Exemplarily, in the present application, the first intra prediction mode and the second intra prediction mode may both be basic intra prediction modes, that is, the present application uses two different basic intra prediction modes. In this case, the improved intra prediction mode can be combined with the first intra prediction mode and the second intra prediction mode respectively to generate the first prediction block and the second prediction block. Furthermore, after the "new prediction block" is generated in the present application, the "new prediction block" can be improved to obtain an updated prediction block.
[0384] Exemplarily, in the present application, the first intra prediction mode and the second intra prediction mode may be a combination of a basic intra prediction mode and an improved intra prediction mode, that is, in the present application, a combination of two different intra prediction modes is used. For example, the first intra prediction mode and the second intra prediction mode both use the same angle prediction mode, but the first intra prediction mode does not use an improved intra prediction mode such as IPF, and the second intra prediction mode uses an improved intra prediction mode such as IPF. Or, the first intra prediction mode and the second intra prediction mode both use the same angle prediction mode, but the first intra prediction mode uses one option of a certain improved intra prediction mode, and the second intra prediction mode uses another option of the improved intra prediction mode. After the "new prediction block" is obtained, the improved intra prediction mode may still exist, so that the "new prediction block" can be improved to obtain an updated prediction block.
[0385] As can be seen, the intra prediction method proposed in this embodiment of the present application determines two prediction blocks that are not completely identical to the current block based on the first intra prediction mode and the second intra prediction mode, determines one weighting matrix, and combines the two prediction blocks according to the weighting matrix to obtain a new prediction block.
[0386] Furthermore, in this embodiment, in all possible weight matrices, not all points in each weight matrix have the same weight, i.e., at least one possible weight matrix includes at least two different weight values.
[0387] Optionally, in this application, all possible weight matrices include at least two different weight values.
[0388] Optionally, in the present application, some weight matrices include at least two different weight values, for example, in the present application, if the minimum weight value is 0 and the maximum weight value is 8, there exists a weight matrix that includes a point with a weight value of 0 and a point with a weight value of 8. Correspondingly, some weight matrices only include the same weight value, for example, in the present application, there exists a weight matrix in which all points have a weight value of 4.
[0389] Optionally, in this application, there are only two kinds of weights in one weight matrix, one weight indicates that the predicted value of the corresponding point is completely obtained from the value of the point corresponding to the first prediction block, and another weight indicates that the predicted value of the corresponding point is completely obtained from the value of the point corresponding to the second prediction block.For example, in this application, there are only two kinds of weights in one weight matrix, which are 0 and 1 respectively.
[0390] Optionally, in this application, there may be multiple kinds of weights in one weight matrix, where the maximum and minimum values (e.g., 0) indicate that the predicted value of the corresponding point is obtained entirely from the value of the point corresponding to the first prediction block or the value of the point corresponding to the second prediction block, respectively. A weight value that is neither the maximum nor the minimum value indicates that the predicted value of the corresponding point is obtained from the weighted average of the values of the point corresponding to the first prediction block and the second prediction block. The area of the maximum weight value or the minimum weight value is also called a blending area.
[0391] It is noted that in this application, if there are only two weights in the weight matrix, the positions where the weights change form a line, or if there are multiple weights in the weight matrix, the positions in the blending region with the same weight form a line (straight line segment) that may or may not be all horizontal and vertical.
[0392] Optionally, in the present application, when there are only two types of weights in the weight matrix, the positions where the weights change form one curve (curve segment), or when there are multiple types of weights in the weight matrix, the positions with the same weight in the blend region form one curve (curve segment).
[0393] Further, in the embodiment of the present application, the decoder may determine the weight matrix using a method similar to GPM or AWP. Specifically, when GPM or AWP is used in the same encoding / decoding standard or encoder / decoder, the weight matrix may be determined using this method, thereby allowing some of the same logic to be multiplexed. For example, when AWP is used in inter prediction of AVS3, the weight matrix may be determined using the AWP method in AVS3. Of course, a method different from GPM or AWP in the same encoding / decoding standard or encoder / decoder may be used, for example, a different mode number, a different blending region algorithm, or different parameters may be used. In inter prediction, a reconstructed image in a reference frame is used as a reference block to utilize correlation in the time domain. On the other hand, in intra prediction, a reconstructed pixel around the current block is used as a reference pixel to utilize correlation in the spatial domain. The closer the distance in the spatial domain, the stronger the correlation, and the farther the distance, the lower the correlation. Therefore, if a weighting matrix causes all pixel positions used in a prediction block to be far from the reference pixels, this part may not be able to produce a more accurate prediction value than the prior art, so such a weighting matrix is not used in intra prediction but can be used in inter prediction.
[0394] It should be noted that in the embodiment of the present application, two intra prediction modes need to be used, while in other common intra prediction methods, only one intra prediction mode is usually required.Therefore, the encoding method of the intra prediction mode used in the embodiment of the present application can be different from the encoding method of the intra prediction mode of other common intra prediction methods, and correspondingly, the MPM construction method used in the embodiment of the present application can also be different from the MPM construction method of other common intra prediction methods.
[0395] Further, in the embodiment of the present application, the intra prediction method provided in the embodiment of the present application needs to transmit information on the weight matrix derivation mode and information on two intra prediction modes in the bit stream, so that in the case of the weight matrix derivation mode, taking the AWP of AVS3 as an example, there are 56 modes, and 5 to 6 bits are required for inverse binarization. In the case of the intra prediction mode, taking the AVS3 as an example, there are 66 modes, and two MPMs are used. If the intra prediction mode is MPM, 2 bits are required for inverse binarization, and otherwise 7 bits are required for binarization. That is, in AVS3, the above information requires an overhead of up to 20 (6+7+7) bits.
[0396] In order to reduce the debinarization overhead of the above information and improve the encoding performance, in the embodiment of the present application, the decoder can determine the above information using the correlation between the intra prediction mode and the weight matrix of the current block. Specifically, there is a certain correlation between the intra prediction mode and the weight matrix used by the current block, and by utilizing this correlation, the decoder can utilize the information of the weight matrix when decoding the intra prediction mode, and further, the decoder can utilize the information on the weight matrix derivation mode when decoding the intra prediction mode.
[0397] Furthermore, in the present embodiment, when the weight matrix includes two kinds of weights, the positions where the weights change form a straight line, or when the weight matrix includes multiple kinds of weights, the positions in the blending region with the same weight form a straight line, and this straight line can be called the boundary line. The boundary line itself has an angle, and can be set so that the angle to the right is 0 and the angle increases counterclockwise. Then, the boundary line can have a slant angle such as 0 degrees horizontally, 90 degrees vertically, 45 degrees, 135 degrees, and various other different angles. When one prediction block chooses to use a certain weight matrix, the corresponding texture may have different characteristics on both sides of the boundary line, for example, both sides of the boundary line are textures with two different angles, or one side of the boundary line is a texture with an angle, and the other side is a relatively flat texture. Since the boundary line itself has an angle, it can be assumed that the boundary line is obtained by intra-angle prediction for one point, which may be close to some textures of the current block, so there is a correlation between this straight line and the two intra-prediction modes of the current block.
[0398] Specifically, in this application, assuming that the boundary line is obtained from one point by intra-angle prediction, at least one intra-angle prediction mode can be found, and the boundary line can be approximately created by the intra-angle prediction mode. For example, the horizontal boundary line matches the horizontal intra-prediction mode (such as mode 24 in AVS3), the vertical boundary line matches the vertical intra-prediction mode (such as mode 12 in AVS3), and the 45-degree boundary line may match the 45-degree intra-prediction mode from the bottom left to the top right (such as mode 30 in AVS3), or the 225-degree intra-prediction mode from the top right to the bottom left (such as mode 6 in AVS3). If there is only one weight value in one weight matrix, it can be matched to modes with no obvious angle, such as DC, Planar, and Bilinear. As can be seen, the weight matrix derivation mode can be matched to a specific intra-prediction mode, and therefore the weight matrix derivation mode can be used to support the decoding of the intra-prediction mode.
[0399] In addition, in the present application, the weighting matrix derivation mode may be an index of a weighting matrix, for example, the 56 modes of the AWP can be regarded as 56 weighting matrix derivation modes.
[0400] Exemplarily, in the present application, a mapping relationship table can be constructed to further represent the mapping relationship between the weight matrix derivation mode and the intra angle prediction mode. Specifically, the boundaries of multiple modes of AWP and GPM have the same angle, for example, the boundary angle of the AWP of AVS3 is the same for every 8 modes. The 56 AWP modes have a total of 7 boundary angle. The index of the boundary angle can be obtained from the mode number modulo 8 (%8) of the weight matrix derivation mode. For example, Table 1 is a mapping relationship table, and taking the angle mode of AVS3 as an example, the indexes 0 and 1 of the boundary angle can respectively correspond to two intra angle prediction modes, one of which is an intra angle prediction mode from the upper right corner to the lower left corner, and the other is an intra angle prediction mode from the upper left corner to the lower right corner. In a specific implementation, for the indexes of other boundary angles, other intra angle prediction modes that are approximately corresponding may also be found, or all the indexes of the boundary angles may correspond to one intra angle prediction mode.
[0401] Furthermore, in the present application, generally, intra prediction is performed using the reference pixels on the left and top of the current block, and the closer the spatial distance between pixels, the stronger the correlation, and the farther the spatial distance, the weaker the correlation. Therefore, if only a part of the pixels of the current block are obtained by prediction of one intra prediction mode, the position of the pixels of this part will affect the probability of the intra prediction mode used for this part. That is, the position and angle of the above-mentioned boundary line will affect the selection of the two intra prediction modes on both sides of the boundary line.
[0402] In further embodiments of the present application, when the decoder determines the first intra prediction mode and the second intra prediction mode of the current block based on the weight matrix derivation mode, the decoder can first determine a mode list (MPM list) using the weight matrix derivation mode, and then further determine the first intra prediction mode and the second intra prediction mode based on the mode list.
[0403] Specifically, in this embodiment, when determining the first intra prediction mode and the second intra prediction mode using the correlation with the weight matrix, the weight matrix derivation mode can be used to construct a mode list, or information on the weight matrix derivation mode can be used when constructing the MPM. Here, since the weight matrix derivation mode can correspond to at least one intra prediction mode, the decoder can add an intra prediction mode corresponding to the weight matrix derivation mode determined for the current block to the mode list, or add several intra prediction modes related to the intra prediction mode corresponding to the weight matrix derivation mode to the mode list.
[0404] Further, in the present embodiment, when the decoder determines a mode list using a weight matrix derivation mode, it can first determine an intra prediction mode corresponding to an adjacent block of the current block, and then determine the intra prediction mode corresponding to the adjacent block as an added waiting mode; after determining that the added waiting mode satisfies a predetermined adding condition, the decoder can add the added waiting mode to the mode list, that is, add the intra prediction mode corresponding to the adjacent block of the current block to the mode list; then, if the mode list does not meet the predetermined list length, the decoder can continue to determine a correlated intra prediction mode corresponding to the weight matrix derivation mode, and then determine the correlated intra prediction mode corresponding to the weight matrix derivation mode as an added waiting mode; if it determines that the added waiting mode satisfies the predetermined adding condition, it adds the added waiting mode to the mode list, that is, adds the correlated intra prediction mode corresponding to the weight matrix derivation mode to the mode list.
[0405] In addition, in the present embodiment, when the decoder adds the intra prediction modes corresponding to the neighboring blocks to the mode list, the decoder may first determine the sequence parameters corresponding to the neighboring blocks, and then sequentially add the intra prediction modes corresponding to the neighboring blocks to the mode list based on the sequence parameters. Here, the decoder may determine the corresponding sequence parameters based on the spatial distance between the neighboring blocks and the current block, for example, the closer the spatial distance between the neighboring blocks and the current block, the stronger the correlation between the neighboring blocks and the current block, and the earlier the additional processing is performed, i.e., the smaller the sequence parameters, and the farther the spatial distance between the neighboring blocks and the current block, the weaker the correlation between the neighboring blocks and the current block, and the later the additional processing is performed, i.e., the larger the sequence parameters.
[0406] Furthermore, in the present embodiment, when the decoder determines a correlated intra-prediction mode corresponding to a weighting matrix derivation mode, the decoder can first determine the intra-prediction mode corresponding to the weighting matrix derivation mode, and then determine the correlated intra-prediction mode according to the first index interval based on the intra-prediction mode corresponding to the weighting matrix derivation mode.
[0407] Exemplarily, in the present embodiment, when determining several intra prediction modes related to an intra prediction mode corresponding to a weight matrix derivation mode, the decoder may select a mode that differs from the index number of the intra prediction mode corresponding to the weight matrix derivation mode by one or more first index intervals according to the first index interval, for example, a mode whose index number differs by 1 or a mode whose index number differs by 2. For example, assuming that the index of the intra prediction mode corresponding to the weight matrix derivation mode is 10 and the first index interval is 2, two intra prediction modes with indexes 8 and 12 may be determined as two correlated intra prediction modes related to the intra prediction mode corresponding to the weight matrix derivation mode.
[0408] In addition, in the present embodiment, after the decoder adds an intra-prediction mode corresponding to an adjacent block of the current block to the mode list, or after the decoder adds a correlated intra-prediction mode corresponding to the weight matrix derivation mode to the mode list, if the mode list does not meet a predetermined list length, i.e., the mode list is not completely filled, the decoder can continue to determine the predetermined prediction mode as an additional waiting mode, and after determining that the additional waiting mode meets a predetermined addition condition, the decoder adds the additional waiting mode to the mode list, i.e., adds the predetermined prediction mode to the mode list.
[0409] As can be appreciated, in this application, the predetermined prediction mode may include one or more of a variety of different modes, such as a DC mode, a bilinear mode, a planar mode, and the like.
[0410] Furthermore, in this embodiment, after the decoder adds the intra prediction mode corresponding to the adjacent blocks of the current block, the correlated intra prediction mode corresponding to the weight matrix derivation mode, and a predetermined prediction mode to the mode list, if the mode list still does not meet a predetermined list length, i.e., the mode list is still not completely filled, the decoder can choose to use a prediction mode in the mode list to determine an associated intra prediction mode, and determines the associated intra prediction mode as an additional waiting mode, and if it determines that the additional waiting mode meets a predetermined adding condition, adds the additional waiting mode to the mode list, i.e., adds the associated intra prediction mode corresponding to the mode list to the mode list.
[0411] That is, in the present application, after sequentially adding the intra prediction modes corresponding to the adjacent blocks of the current block, the correlated intra prediction modes corresponding to the weight matrix derivation modes, and the predetermined prediction modes to the mode list, if the mode list is still not completely filled, the decoder can determine corresponding associated intra prediction modes based on the existing prediction modes in the mode list, and then add these associated intra prediction modes to the mode list.
[0412] For example, in the present application, the decoder may sequentially determine an associated intra-prediction mode associated with an arbitrary prediction mode in a mode list according to a second index interval, where the decoder may select a mode that is different from the index number of the arbitrary prediction mode by one or more second index intervals according to the second index interval, for example, a mode that is different by an index number of 1 or a mode that is different by an index number of 2.
[0413] In addition, in the present embodiment, regardless of whether the intra prediction mode corresponding to the adjacent block of the current block is the added waiting mode, the correlated intra prediction mode corresponding to the weight matrix derivation mode is the added waiting mode, or a specified prediction mode is the added waiting mode, or an associated intra prediction mode is the added waiting mode, the decoder needs to determine whether the added waiting mode satisfies a specified addition condition; specifically, if an added waiting mode exists and is different from all prediction modes in the mode list, it can be determined that the added waiting mode satisfies a specified addition condition, and the added waiting mode can be added to the mode list.
[0414] Correspondingly, if the waiting mode to be added does not exist or is the same (duplicates) as one prediction mode in the mode list, it can be determined that the waiting mode to be added does not satisfy a predetermined addition condition, in which case the waiting mode to be added cannot be added to the mode list, and the waiting mode to be added is directly discarded.
[0415] As can be seen, in the present application, since the current block needs to perform intra prediction processing using two intra prediction modes, it can refer to intra prediction modes at more positions or to intra prediction modes of more neighboring blocks when constructing the MPM. Correspondingly, in the present application, the length of the mode list used by the current block can be different from the mode list length of other intra prediction modes, and since the codeword of the MPM during binarization is shorter than other modes, increasing the probability that each of the two intra prediction modes is an MPM helps to improve the efficiency of encoding and decoding.
[0416] In addition, in the present application, in order to ensure that the first intra prediction mode of the current block is different from the second intra prediction mode, the decoder must ensure that, during construction of the mode list, the intra prediction mode added to the mode list each time does not overlap with any existing intra prediction mode in the mode list.
[0417] Furthermore, in the present embodiment, when the decoder determines a mode list using a weighting matrix derivation mode, the decoder can first determine a list construction strategy corresponding to the weighting matrix derivation mode, and then further determine a mode list based on the list construction strategy.
[0418] That is, in the present application, for different weight matrices, i.e., different weight matrix derivation modes, the decoder can use different construction strategies to construct the mode list. For example, based on the construction strategy, if the boundary of the weight matrix is 0 degrees or 90 degrees, i.e., horizontal or vertical, the decoder can choose to take into account the intra-prediction mode corresponding to the weight matrix when constructing the mode list, and in other cases, do not consider the intra-prediction mode corresponding to the weight matrix.
[0419] For example, in the present application, assuming that the weighting matrix boundary is 0 degrees, for modes such as AWP mode 2 and mode 10 (counting from 0), horizontal intra prediction mode 24 can be added to the mode list candidates when constructing the mode list, and assuming that the weighting matrix boundary is 90 degrees, for modes such as AWP mode 6 and mode 14 (counting from 0), vertical intra prediction mode 12 can be added to the mode list candidates when constructing the mode list.
[0420] As can be understood, in the present application, in the range where the boundary line of the weight matrix is close to 0 degrees, a horizontal intra prediction mode, or a horizontal intra prediction mode and its similar intra prediction mode, may be added to the candidates of the mode list, and in the range where the boundary line of the weight matrix is close to 90 degrees, a vertical intra prediction mode, or a horizontal intra prediction mode and its similar intra prediction mode may be added to the candidates of the mode list.
[0421] As can be understood, in the present application, two intra prediction modes used for intra prediction of a current block are different, i.e., the first intra prediction mode and the second intra prediction mode are different, and then, when decoding the second intra prediction mode, the possibility of the first intra prediction mode can be eliminated, i.e., information of the first intra prediction mode can be used to decode the second intra prediction mode.
[0422] In this embodiment, the decoder may further set a candidate intra-prediction mode during construction of the mode list, where the candidate intra-prediction mode is different from all intra-prediction modes in the mode list.
[0423] Specifically, in the present application, in order to make the first intra prediction mode and the second intra prediction mode used by the current block different, the determination of the second intra prediction mode may depend on the first intra prediction mode. Here, when the decoder determines the first intra prediction mode and the second intra prediction mode based on the mode list, the decoder may first determine one prediction mode in the mode list as the first intra prediction mode, and then determine the second intra prediction mode based on the first intra prediction mode and the mode list.
[0424] Further, in an embodiment of the present application, the decoder may determine one prediction mode in the mode list as the first intra prediction mode, then remove the prediction mode from the mode list, and add candidate intra prediction modes to the mode list, thereby obtaining an updated mode list, and then select one prediction mode from the updated mode list to determine it as the second intra prediction mode, where the selection manner may be arbitrary.
[0425] That is, in this embodiment, if the first intra prediction mode selects one MPM, the selectable MPMs for the second intra prediction mode are reduced by one so that the first intra prediction mode and the second intra prediction mode used by the current block are different, and in order to avoid changing the length of the selectable mode list for the first intra prediction mode and the second intra prediction mode, the decoder can add one MPM after determining the first intra prediction mode, for example, can add a pre-set candidate intra prediction mode to the mode list, so that the same number of MPMs as the first intra prediction mode can still be used when determining the second intra prediction mode.
[0426] For example, in the present application, assuming that the number of selectable MPMs of the first intra prediction mode and the second intra prediction mode is N, when constructing a mode list, N MPMs and one candidate MPM can be constructed first, and the selectable MPMs of the first intra prediction mode are the above N MPMs. If the first intra prediction mode selects one of the MPMs, for the second intra prediction mode, the MPM selected by the first intra prediction mode is deleted, and the candidate MPM is added to the mode list so that the second intra prediction mode can still select from the N MPMs.
[0427] In this embodiment, the decoder may further set the mode list length parameter to (N+1), where N is a positive integer, during construction of the mode list.
[0428] Specifically, in the present application, in order to make the first intra prediction mode and the second intra prediction mode used by the current block different, the determination of the second intra prediction mode may depend on the first intra prediction mode. Here, when the decoder determines the first intra prediction mode and the second intra prediction mode based on the mode list, if the decoder determines the first intra prediction mode using the mode list, it may determine one of the first N prediction modes in the mode list as the first intra prediction mode, and then determine the second intra prediction mode based on the first intra prediction mode and the mode list.
[0429] Further, in an embodiment of the present application, when determining a first intra prediction mode using a mode list, the decoder determines one of the first N prediction modes in the mode list as the first intra prediction mode, and then determines a second intra prediction mode using the other N prediction modes other than the first intra prediction mode in the mode list.
[0430] In addition, in the embodiments of the present application, when the decoder determines the first intra prediction mode and the second intra prediction mode based on the mode list, if the mode list is not used for determining the first intra prediction mode, the decoder can directly determine one of the first N prediction modes in the mode list as the second intra prediction mode.
[0431] That is, in the embodiments of the present application, assuming that the number of selectable MPMs for the intra prediction mode is N, in order to make the first intra prediction mode and the second intra prediction mode used by the current block different, when constructing the mode list, (N + 1) MPMs can be constructed. For the first intra prediction mode, the selectable MPMs are the first N MPMs in the mode list. When no MPM is selected for the first intra prediction mode, the selectable MPMs for the second intra prediction mode are the first N MPMs in the mode list. When an MPM is selected for the first intra prediction mode, the selectable MPMs for the second intra prediction mode are the N MPMs in the mode list other than the first intra prediction mode.
[0432] Exemplarily, in the present application, assuming that N is 4, the decoder can construct a mode list including five MPMs. MPM[x] represents the (x + 1)-th MPM. That is, MPM[0] represents the first MPM, because the count of the array starts from 0. The first intra prediction mode is mode0, and the second intra prediction mode is mode1. Assuming that both the first intra prediction mode and the second intra prediction mode are MPMs, and the index number of the first intra prediction mode in the selectable MPMs is idx0, and the index number of the second intra prediction mode in the selectable MPMs is idx1, mode0 = MPM[idx0] mode1 = MPM[idx1 < idx0? idx1 : idx1 + 1] That is, when idx1 < idx0, mode1 = MPM[idx1], Otherwise, mode1 = MPM[idx1 + 1].
[0433] As can be seen from this, the value ranges of both idx0 and idx1 are from 0 to 3, and the value of mode1 is related to not only idx1 but also idx0.
[0434] Exemplarily, in the embodiments of the present application, on the decoding side, the decoder can analyze the bitstream to determine the variable intra_luma_pred_mode0 related to the first intra prediction mode, and further can determine the variable intra_luma_pred_mode1 related to the second intra prediction mode. Next, the decoder can determine the first intra prediction mode IntraLumaPredMode0 based on intra_luma_pred_mode0, and at the same time, can determine the second intra prediction mode IntraLumaPredMode1 based on intra_luma_pred_mode1.
[0435] In the embodiments of the present application, when constructing the MPM list, it is guaranteed that MPM[0] < MPM[1]. If the initial MPM[0] > MPM[1], MPM[0] and MPM[1] can be exchanged. In order to correspond to the subsequent second step and fifth step, the encoder also needs to use a similar method for constructing the MPM list.
[0436] Specifically, the relationship between the variables intra_luma_pred_mode0 and intra_luma_pred_mode1 and the binary string can be as shown in Table 9 below.
[0437]
Table 9
[0438] Here, the first bit is used to indicate whether it is an MPM, for example, "1" indicates an MPM and "0" indicates a non-MPM. If the first intra prediction mode is an MPM, assuming that the mode list includes four MPMs, two bits can be used to indicate which MPM in the mode list to use, i.e., "00, 01, 10, 11" respectively represent the first MPM, the second MPM, the third MPM, and the fourth MPM in the mode list.
[0439] Specifically, the method in which the decoder derives IntraLumaPredMode0 and IntraLumaPredMode1 based on intra_luma_pred_mode0 and intra_luma_pred_mode1, respectively, is as follows.
[0440] 1, if the value of intra_luma_pred_mode0 is 0, IntraLumaPredMode0 is equal to MPM[0]. Otherwise, if the value of intra_luma_pred_mode0 is 1, IntraLumaPredMode0 is equal to MPM[1], if the value of intra_luma_pred_mode0 is 2, IntraLumaPredMode0 is equal to MPM[2], and if the value of intra_luma_pred_mode0 is 3, IntraLumaPredMode0 is equal to MPM[3].
[0441] 2. Otherwise, the value of IntraPredMode0 (intra_luma_pred_mode0+EipmPuFlag*32) is set as follows: If IntraPredMode0 minus 4 is less than MPM[0], then IntraLumaPredMode0 is equal to IntraPredMode0 minus 2; Otherwise, if IntraPredMode0 minus 3 is greater than MPM[0] and less than MPM[1], then IntraLumaPredMode0 is equal to IntraPredMode0 minus 1; Otherwise, IntraLumaPredMode0 is equal to IntraPredMode0.
[0442] 3. If the value of intra_luma_pred_mode0 is less than 4 and the value of intra_luma_pred_mode1 is less than 4 and the value of intra_luma_pred_mode1 is greater than or equal to the value of intra_luma_pred_mode0, then mpmPlus=1; otherwise, mpmPlus=0.
[0443] 4. If the value of intra_luma_pred_mode1 is 0, then IntraLumaPredMode1 is equal to MPM[0+mpmPlus]. Otherwise, if the value of intra_luma_pred_mode1 is 1, then IntraLumaPredMode1 is equal to MPM[1+mpmPlus], if the value of intra_luma_pred_mode1 is 2, then IntraLumaPredMode1 is equal to MPM[2+mpmPlus], and if the value of intra_luma_pred_mode1 is 3, then IntraLumaPredMode1 is equal to MPM[3+mpmPlus].
[0444] 5. Otherwise, the value of IntraPredMode1 (intra_luma_pred_mode1+EipmPuFlag*32) is set as follows: If IntraPredMode1 minus 4 is less than MPM[0], then IntraLumaPredMode1 is equal to IntraPredMode1 minus 2; Otherwise, if IntraPredMode1 minus 3 is greater than MPM[0] and less than MPM[1], then IntraLumaPredMode1 is equal to IntraPredMode1 minus 1; Otherwise, IntraLumaPredMode1 is equal to IntraPredMode1.
[0445] Here, the binary variable eipm_pu_flag is an extension flag of the luma intra prediction mode, and exemplarily, its value of "1" indicates that the extended angle intra prediction mode is used, and its value of "0" indicates that the extended luma intra prediction mode is not used. The value of EipmPuFlag is equal to the value of eipm_pu_flag. Specifically, if there is no eipm_pu_flag in the bitstream, the value of EipmPuFlag is equal to 0.
[0446] Optionally, in the present embodiment, if the first intra prediction mode and the second intra prediction mode used by the current block are only guaranteed to be different, and the number of selectable MPMs of the first intra prediction mode and the second intra prediction mode is not limited, the decoder may not set the candidate intra prediction mode or may not increase the mode list length, in which case the decoder needs to change the decoding method of the second intra prediction mode. That is, after the first intra prediction mode selects one MPM in the mode list, the selectable MPMs of the second intra prediction mode are reduced by one, in which case the decoding method of the second intra prediction mode needs to be changed because the selectable MPMs of the second intra prediction mode are reduced.
[0447] Exemplarily, in the present application, taking the case where the number N of MPMs is 4 and the first bit is used to indicate whether it is an MPM (for example, "1" indicates that it is an MPM, and "0" indicates that it is not an MPM) as an example, when the first intra prediction mode is an MPM, since there are 4 MPMs, 2 bits are used to indicate which MPM it is, that is, "00, 01, 10, 11" represent the first MPM, the second MPM, the third MPM, and the fourth MPM respectively. Also, when both the first intra prediction mode and the second intra prediction mode are MPMs, there are only 3 available MPMs for the second intra prediction mode, and 1 to 2 bits can be used to indicate which MPM it is. For example, "00, 01, 10" represent the remaining first MPM, the second MPM, and the third MPM respectively. As can be seen from this, since one possibility is excluded, the overhead can be saved by changing the inverse binarization method.
[0448] Exemplarily, in the present application, assuming that N is 4, a mode list including 4 MPMs can be constructed. MPM[x] represents the (x + 1)-th MPM. That is, MPM[0] represents the first MPM, because the count of the array starts from 0. The first intra prediction mode is mode0, and the second intra prediction mode is mode1. Assuming that both the first intra prediction mode and the second intra prediction mode are MPMs, the index number of the first intra prediction mode in the selectable MPMs is idx0, and the index number of the second intra prediction mode in the selectable MPMs is idx1, mode0 = MPM[idx0] mode1 = MPM[idx1 < idx0? idx1 : idx1 + 1] That is, when idx1 < idx0, mode1 = MPM[idx1], otherwise, mode1 = MPM[idx1 + 1].
[0449] As can be seen hereinafter, the value range of idx0 is 0 to 3, the value range of idx1 is 0 to 2, and the value of mode1 is related to not only idx1 but also idx0. idx0 can be inverse binary-coded using 2 bits, and idx1 can be inverse binary-coded using 1 to 2 bits.
[0450] Exemplarily, in the embodiment of the present application, on the decoding side, the decoder can analyze the bit stream to determine the variable intra_luma_pred_mode0 related to the first intra prediction mode, and further determine the variable intra_luma_pred_mode1 related to the second intra prediction mode. Next, the decoder can determine the first intra prediction mode IntraLumaPredMode0 based on intra_luma_pred_mode0, and at the same time, determine the second intra prediction mode IntraLumaPredMode1 based on intra_luma_pred_mode1.
[0451] In the embodiment of the present application, when constructing the MPM list, it is guaranteed that MPM[0] < MPM[1]. If the initial MPM[0] > MPM[1], MPM[0] and MPM[1] can be exchanged. In order to correspond to the subsequent second step and fifth step, the encoder also needs to use a similar method for constructing the MPM list.
[0452] Specifically, the relationship between the variables intra_luma_pred_mode0 and intra_luma_pred_mode1 and the binary string can be as shown in Table 10 below.
[0453]
Table 10
[0454] The relationship between luma_pred_mode1 and binary strings is as shown in Table 11 below, otherwise the relationship between intra_luma_pred_mode1 and binary strings is the same as the relationship between intra_luma_pred_mode0 and binary strings.
[0455] [Table 11]
[0456] Specifically, the method in which the decoder derives IntraLumaPredMode0 and IntraLumaPredMode1 based on intra_luma_pred_mode0 and intra_luma_pred_mode1, respectively, is as follows.
[0457] 1, if the value of intra_luma_pred_mode0 is 0, IntraLumaPredMode0 is equal to MPM[0]. Otherwise, if the value of intra_luma_pred_mode0 is 1, IntraLumaPredMode0 is equal to MPM[1], if the value of intra_luma_pred_mode0 is 2, IntraLumaPredMode0 is equal to MPM[2], and if the value of intra_luma_pred_mode0 is 3, IntraLumaPredMode0 is equal to MPM[3].
[0458] 2. Otherwise, the value of IntraPredMode0 (intra_luma_pred_mode0+EipmPuFlag*32) is set as follows: If IntraPredMode0 minus 4 is less than MPM[0], then IntraLumaPredMode0 is equal to IntraPredMode0 minus 2; Otherwise, if IntraPredMode0 minus 3 is greater than MPM[0] and less than MPM[1], then IntraLumaPredMode0 is equal to IntraPredMode0 minus 1; Otherwise, IntraLumaPredMode0 is equal to IntraPredMode0.
[0459] 3. If the value of intra_luma_pred_mode0 is less than 4 and the value of intra_luma_pred_mode1 is less than 4 and the value of intra_luma_pred_mode1 is greater than or equal to the value of intra_luma_pred_mode0, then mpmPlus=1; otherwise, mpmPlus=0.
[0460] 4. If the value of intra_luma_pred_mode1 is 0, then IntraLumaPredMode1 is equal to MPM[0+mpmPlus]. Otherwise, if the value of intra_luma_pred_mode1 is 1, then IntraLumaPredMode1 is equal to MPM[1+mpmPlus], if the value of intra_luma_pred_mode1 is 2, then IntraLumaPredMode1 is equal to MPM[2+mpmPlus], and if the value of intra_luma_pred_mode1 is 3, then IntraLumaPredMode1 is equal to MPM[3+mpmPlus].
[0461] 5. Otherwise, the value of IntraPredMode1 (intra_luma_pred_mode1+EipmPuFlag*32) is set as follows: If IntraPredMode1 minus 4 is less than MPM[0], then IntraLumaPredMode1 is equal to IntraPredMode1 minus 2; Otherwise, if IntraPredMode1 minus 3 is greater than MPM[0] and less than MPM[1], then IntraLumaPredMode1 is equal to IntraPredMode1 minus 1; Otherwise, IntraLumaPredMode1 is equal to IntraPredMode1.
[0462] Here, the binary variable eipm_pu_flag is an extension flag of the luma intra prediction mode, and exemplarily, its value of "1" indicates that the extended angle intra prediction mode is used, and its value of "0" indicates that the extended luma intra prediction mode is not used. The value of EipmPuFlag is equal to the value of eipm_pu_flag. Specifically, if there is no eipm_pu_flag in the bitstream, the value of EipmPuFlag is equal to 0.
[0463] In the present embodiment, further, when the decoder determines the first intra prediction mode and the second intra prediction mode of the current block based on the weight matrix derivation mode, the decoder may further sequentially perform a sorting process on the intra prediction modes corresponding to the neighboring blocks of the current block, the correlated intra prediction mode corresponding to the weight matrix derivation mode, and a predetermined prediction mode, thereby obtaining a candidate list of prediction modes, where the predetermined prediction mode includes one or more of various prediction modes such as DC mode, bilinear mode, planar mode, etc., and then the decoder may determine the first intra prediction mode and the second intra prediction mode based on the candidate list of prediction modes.
[0464] Specifically, in the present embodiment, when the first intra prediction mode and the second intra prediction mode are determined using the correlation with the weight matrix, the intra prediction mode corresponding to the weight matrix derivation mode or some intra prediction modes related to the intra prediction mode corresponding to the weight matrix derivation mode may be assigned a codeword shorter than that of the normal intra prediction mode during binarization, or may be assigned a codeword shorter than the longest possible codeword in the intra prediction mode, that is, these codewords are not the longest. Therefore, the intra prediction mode corresponding to the weight matrix derivation mode or some intra prediction modes related to the intra prediction mode corresponding to the weight matrix derivation mode may be considered to have a higher probability of being selected than other modes.
[0465] That is, in the present embodiment, the first intra prediction mode and the second intra prediction mode do not need to use MPM, and a candidate list of prediction modes can be generated by performing a sorting process on all intra prediction modes that can be used by the first intra prediction mode and the second intra prediction mode, and shorter codewords are assigned to higher intra prediction modes in the candidate list of prediction modes, and longer codewords are assigned to lower intra prediction modes in the candidate list of prediction modes. Here, when performing the sorting process, the intra prediction modes of adjacent blocks of the current block may be referenced, or the weight matrix derivation mode of the current block may be referenced.
[0466] Furthermore, in this embodiment, when the decoder determines the first intra prediction mode and the second intra prediction mode of the current block based on the weight matrix derivation mode, the decoder can further establish a reference set of the first intra prediction mode corresponding to the weight matrix derivation mode, and simultaneously establish a reference set of the second intra prediction mode corresponding to the weight matrix derivation mode, and can determine the first intra prediction mode based on the reference set of the first intra prediction mode, and simultaneously determine the second intra prediction mode based on the reference set of the second intra prediction mode.
[0467] That is, in this embodiment, for a weight matrix derivation mode of a current block, the decoder can perform a sorting process for all possible intra prediction modes of a first intra prediction mode corresponding to the weight matrix derivation mode to generate a reference set for the first intra prediction mode, and at the same time, can perform a sorting process for all possible intra prediction modes of a second intra prediction mode corresponding to the weight matrix derivation mode to generate a reference set for the second intra prediction mode, thereby determining the first intra prediction mode from the reference set for the first intra prediction mode, and determining the first intra prediction mode from the reference set for the second intra prediction mode.
[0468] Furthermore, in the present embodiment, in order to reduce complexity, a lookup table such as Table 2 above can be narrowed down by a clustering technique, for example, a classification process can be performed on the weight matrix derivation mode to determine the type corresponding to the weight matrix derivation mode, and for the same type of weight matrix derivation mode, the order of all possible intra prediction modes of the corresponding first intra prediction mode is the same, and further, the order of all possible intra prediction modes of the corresponding second intra prediction mode is the same.
[0469] Furthermore, in the present embodiment, in order to reduce complexity, a lookup table such as Table 2 above can be narrowed down by a clustering method, for example, a classification process can be performed on the intra prediction mode to determine the type corresponding to the intra prediction mode, for example, non-angle modes such as DC, Planar, Bilinear, etc. belong to one type, and the angle mode can be classified according to a range of several radians, for example, every 45 degrees, i.e., 1 / 4 circle, belongs to one type, or every 22.5 degrees, i.e., 1 / 8 circle, belongs to one type. Specifically, the angle mode can also be divided into several unequal intervals.
[0470] In the present embodiment, further, since the intra prediction method proposed in the present application requires the use of two different intra prediction modes and one weighting matrix to determine the predicted value of the current block, in order to reduce overhead, the present application can reduce the number of bits by restricting the two intra prediction modes of the current block, and at the same time, can also reduce the number of bits by restricting the weighting matrix derivation mode of the current block.
[0471] For example, in this application, since the first 33 prediction modes of AVS3 almost cover the entire angle range, AVS3 can ensure good performance by only using the first 33 prediction modes, and it is only necessary to adjust not to use EIPM during decoding. Furthermore, the number of intra prediction modes that may be used by the current block can be further compressed and limited, so that finally, decoding is performed using only 5 bits, which can further reduce overhead and achieve better performance.
[0472] Optionally, in the present application, the overhead of decoding two intra-prediction modes can be reduced by reducing the number of intra-prediction modes that may be used by the current block.For example, in AVS3, if 66 intra-prediction modes are used, a maximum of 7 bits are required to decode one intra-prediction mode, and if only 33 intra-prediction modes are used and no PCM mode is used, a maximum of only 6 bits are required to decode one intra-prediction mode.
[0473] Furthermore, in this application, considering that intra prediction modes usually include non-angular prediction modes such as DC, Planar, Bilinear, etc., and angular prediction modes, in the realization process, each non-angular mode may use one set of logic, all angular modes may use one set of logic, or angular modes may use several sets of logic, and among different logics, some circuits may be multiplexed, and some circuits may not be multiplexed. Therefore, in order to limit the number of intra prediction modes that may be used by the current block, it may be limited to only select angular prediction modes or only select non-angular prediction modes.
[0474] In the following, the restriction of the available intra prediction modes of the second intra prediction mode will be described as an example, and the corresponding restriction can also be applied to the restriction of the first intra prediction mode.
[0475] Method 1: The second intra prediction mode can only use one specified intra prediction mode among the non-angular prediction modes.
[0476] For example, the second intra prediction mode can only use DC mode, or the second intra prediction mode can only use Bilinear mode. Since there is only one possible choice for the second intra prediction mode, when the block of the present invention is used for encoding and decoding, the second intra prediction mode can be derived by default to predict the current block without determining the second intra prediction mode, and there is no need to write the second intra prediction mode into the bitstream during encoding, and there is no need to analyze what the second intra prediction mode is from the bitstream during decoding.
[0477] In this embodiment, the present invention is further described by taking the application to luma prediction as an example. If the current block (CU) uses the SAWP prediction mode, the bitstream needs to be parsed to obtain the corresponding weight matrix derivation mode and the first intra prediction mode (wherein, for the second intra prediction mode, there is only one possible choice, and in this case, the second intra prediction mode is derived as the predetermined intra prediction mode by default).
[0478] The corresponding decoding process is shown in Table 12.
[0479] [Table 12]
[0480] Here, the spatial angle weighted prediction mode index sawp_idx is used to determine a weight matrix of spatial angle weighted prediction, and the value of SawpIdx is equal to the value of sawp_idx. If there is no sawp_idx in the bitstream, the value of SawpIdx is equal to 0.
[0481] The first luma prediction mode intra_luma_pred_mode0 of spatial angle weighted prediction is used to determine a first intra prediction mode IntraLumaPredMode0 of luma blocks of spatial angle weighted prediction, and the first intra prediction mode IntraLumaPredMode0 is determined based on intra_luma_pred_mode0.
[0482] The second intra prediction mode, IntraLumaPredMode1, is derived by default.
[0483] Determine intra prediction sample matrices predMatrix0 and predMatrix1 based on the first intra prediction mode IntraLumaPredMode0 and the second intra prediction mode IntraLumaPredMode1, respectively. Determine a weight matrix SawpWeightArrayY based on SawpIdx.
[0484] A new prediction sample matrix predMatrixSawp is determined based on the two intra prediction sample matrices predMatrix0, predMatrix1 and the weight matrix SawpWeightArrayY.
[0485] The specific method is as follows.
[0486] The value of the element predMatrixSawp[x][y] in the prediction sample matrix predMatrixSawp for the spatial angle weighted prediction mode is ((predMatrix0[x][y]*AwpWeightArrayY[x][y]+predMatrix1[x][y]*(8-AwpWeightArrayY[x][y])+4)>>3).
[0487] Method 2: The second intra prediction mode can only use non-angular modes or some modes among the non-angular modes.
[0488] For example, since the second intra prediction mode can only use DC mode and Bilinear mode and there are only two possible choices for the second intra prediction mode, the 1-bit intra_luma_pred_mode1 can indicate whether the second intra prediction mode is DC mode or Bilinear mode. During encoding, only two possibilities, DC and Bilinear, need to be tried for the second intra prediction mode, and intra_luma_pred_mode1 can be determined after determining which intra prediction mode the second intra prediction mode is. In the process of decoding the corresponding block, it is only necessary to analyze the 1-bit intra_luma_pred_mode1 for the second intra prediction mode to determine whether it is DC or Bilinear.
[0489] In another embodiment, the second intra prediction mode can only use non-angular modes, i.e., there are only three possible options for the second intra prediction mode, and the 2-bit intra_luma_pred_mode1 can indicate which intra prediction mode the second intra prediction mode is.
[0490] In this embodiment, the present invention is further described by taking the example of applying to luminance prediction. If the current block (CU) uses SAWP prediction mode, it needs to parse the bitstream to obtain the corresponding weight matrix derivation mode and two intra prediction modes. The specific decoding process is shown in Table 13.
[0491] [Table 13]
[0492] The spatial angle weighted prediction mode index sawp_idx is used to determine a weight matrix for spatial angle weighted prediction, and the value of SawpIdx is equal to the value of sawp_idx. If sawp_idx is not present in the bitstream, the value of SawpIdx is equal to 0.
[0493] The first luma prediction mode intra_luma_pred_mode0 of spatial angle weighted prediction is used to determine the first intra prediction mode IntraLumaPredMode0 of the luma block of spatial angle weighted prediction, and the second luma prediction mode intra_luma_pred_mode1 of spatial angle weighted prediction is used to determine the second intra prediction mode IntraLumaPredMode1 of the luma block of spatial angle weighted prediction.
[0494] When the value of intra_luma_pred_mode1 is 0, the second intra prediction mode IntraLumaPredMode1 is the DC mode "Intra_Luma_DC", and when the value of intra_luma_pred_mode1 is 1, the second intra prediction mode IntraLumaPredMode1 is the bilinear mode "Intra_Luma_Bilinear".
[0495] Determine a first intra prediction mode IntraLumaPredMode0 and a second intra prediction mode IntraLumaPredMode1 based on intra_luma_pred_mode0 and intra_luma_pred_mode1, respectively. Determine intra prediction sample matrices predMatrix0 and predMatrix1 based on the first intra prediction mode IntraLumaPredMode0 and the second intra prediction mode IntraLumaPredMode1, respectively. Determine a weight matrix SawpWeightArrayY based on SawpIdx.
[0496] A new prediction sample matrix predMatrixSawp is determined based on the two intra prediction sample matrices predMatrix0, predMatrix1 and the weight matrix SawpWeightArrayY. The specific method is as follows:
[0497] The value of the element predMatrixSawp[x][y] in the prediction sample matrix predMatrixSawp for the spatial angle weighted prediction mode is ((predMatrix0[x][y]*AwpWeightArrayY[x][y]+predMatrix1[x][y]*(8-AwpWeightArrayY[x][y])+4)>>3).
[0498] Method 3: The second intra prediction mode can use all angle prediction modes or only some of the angle prediction modes.
[0499] Since the number of selectable intra prediction modes of the second intra prediction mode is reduced, the number of bits of intra_luma_pred_mode1 representing the second intra prediction mode in the bitstream is also reduced. For example, in AVS3, the second intra prediction mode can only use all angle modes. In AVS3, there are three non-angle modes: DC, Plane, and Bilinear. In other words, in AVS3, the second intra prediction mode can only use modes other than 0, 1, and 2.
[0500] In one particular embodiment, the second intra prediction mode may use all intra prediction modes other than the non-angular prediction modes (ie, the second intra prediction mode may use all angular prediction modes).
[0501] In one particular embodiment, the second intra prediction mode may use a part of all angular prediction modes, where the part of angular prediction modes may be the first 33 angular prediction modes, or the part of angular prediction modes may be a part of angular prediction modes selected from the 33 angular prediction modes or the 65 angular prediction modes according to a predetermined interval, for example, the predetermined interval may be 1, 2 or other positive integers.
[0502] Table 3 shows an example of intra prediction modes of a luminance prediction block, where mode number IntraLumaPredMode corresponds to the corresponding intra prediction mode. 0 represents DC mode, 1 represents Plane mode, 2 represents Bilinear mode, 12 represents Vertical mode, 24 represents Horizontal mode, 33 represents PCM mode, and others are angle modes other than Horizontal mode and Vertical mode. For angles represented by specific mode numbers, refer to FIG. 7.
[0503] Taking an example in which the second intra prediction mode can only use modes other than 0, 1, and 2, a process of constructing a selectable MPM mode list for the second intra prediction mode will be described.
[0504] Taking as an example that each intra prediction mode can use four MPMs, a mode list with a length of 8 can be constructed, where the number of non-angular prediction modes should be less than or equal to 3 since AVS3 only has three non-angular prediction modes. Here, the first four MPMs can be used to select the first intra prediction mode. The second intra prediction mode can select the first four MPMs of the non-angular modes other than the first intra prediction mode in the MPM list.
[0505] 16 as an example, assuming that the constructed MPM mode list is as shown in the figure, the first intra prediction mode can select one of the first four MPMs, and assuming that the first intra prediction mode uses 12, i.e., the first MPM in the MPM list, the MPMs that the second intra prediction mode can select are queried in a front-to-back order, and the first MPM (12) is unavailable because it is used by the first intra prediction mode. The second MPM (24) is an available mode for the second intra prediction mode because it is unused and is an available angular mode, and the MPMs corresponding to the third (0), fourth (2), and fifth (1) are unused but unavailable because they are non-angular modes. The sixth (6), seventh (8), and eighth (10) MPMs are unused and are available angle modes, and therefore are available modes for the second intra-prediction mode; thus, 24, 6, 8, and 10 correspond to modes with MPM indices of 0, 1, 2, and 3, respectively, for the second intra-prediction mode.
[0506] An example of constructing an MPM list will be described using the blocks shown in FIG. 14 as an example.
[0507] Set the length of the first sublist of the MPM mode list to 8.
[0508] The current block is E, and the intra prediction modes used by neighboring blocks F, G, C, A, B, and D are added to the MPM mode list sequentially until the MPM modes are completely filled. If the position of a neighboring block among the neighboring blocks F, G, C, A, B, and D is unavailable or does not use an intra prediction mode, skip this position. Here, in this application, in addition to using the intra prediction mode corresponding to the block shown in FIG. 14, the intra prediction mode corresponding to another block may also be used, for example, the intra prediction mode corresponding to the block to the right or below the current block may be used.
[0509] Furthermore, if the MPM mode list is not completely filled, the intra prediction mode corresponding to the weight matrix derivation mode is added to the MPM mode list until the MPM mode list is completely filled.
[0510] If the MPM mode list is not completely filled, the DC mode and the Bilinear mode are added sequentially to the MPM mode list until the MPM mode list is completely filled.
[0511] If the MPM mode list is not completely filled, add intra-prediction modes that differ from the mode number of the first intra-prediction mode by 1, -1, 2, -2, 3, -3 to the MPM mode list, starting with the first intra-prediction mode in the MPM mode list, until the MPM mode list is completely filled. If an intra-prediction mode that differs from the mode number of the first intra-prediction mode by 1, -1, 2, -2, 3, -3 is invalid and is less than 0 or greater than maximum or is PCM, discard the invalid intra-prediction mode.
[0512] If the mode number of the first intra-prediction mode in the MPM mode list is greater than the mode number of the second intra-prediction mode, then the two MPMs are swapped.
[0513] During the operation of adding to the MPM mode list, each queued intra-prediction mode can be added to the MPM mode list only if it is different from all existing intra-prediction modes in the MPM mode list; otherwise, it is discarded.
[0514] In this embodiment, the embodiment is further described by taking the example of applying to luminance prediction. If the current block (CU) uses SAWP prediction mode, it needs to parse the bitstream to obtain the corresponding weight matrix derivation mode and two intra prediction modes. The specific decoding process is shown in Table 14.
[0515] [Table 14]
[0516] The spatial angle weighted prediction mode index sawp_idx is used to determine a weight matrix for spatial angle weighted prediction, and the value of SawpIdx is equal to the value of sawp_idx. If sawp_idx is not present in the bitstream, the value of SawpIdx is equal to 0.
[0517] The first luma prediction mode of spatial angle weighted prediction, intra_luma_pred_mode0, is used to determine the first intra prediction mode of luma blocks of spatial angle weighted prediction, IntraLumaPredMode0.
[0518] The second luma prediction mode intra_luma_pred_mode1 of spatial angle weighted prediction is used to determine the second intra prediction mode IntraLumaPredMode1 of luma blocks of spatial angle weighted prediction.
[0519] Determine a first intra prediction mode IntraLumaPredMode0 and a second intra prediction mode IntraLumaPredMode1 according to intra_luma_pred_mode0 and intra_luma_pred_mode1, respectively, in which the method described above is used. Determine intra prediction sample matrices predMatrix0 and predMatrix1 according to the first intra prediction mode IntraLumaPredMode0 and the second intra prediction mode IntraLumaPredMode1, respectively. Determine a weight matrix SawpWeightArrayY according to SawpIdx.
[0520] A new prediction sample matrix predMatrixSawp is determined based on the two intra prediction sample matrices predMatrix0, predMatrix1 and the weight matrix SawpWeightArrayY.
[0521] The specific method is as follows.
[0522] The value of the element predMatrixSawp[x][y] in the prediction sample matrix predMatrixSawp for the spatial angle weighted prediction mode is ((predMatrix0[x][y]*AwpWeightArrayY[x][y]+predMatrix1[x][y]*(8-AwpWeightArrayY[x][y])+4)>>3).
[0523] In all the above processes of restricting the selectable intra-prediction modes of the second intra-prediction mode, if the derived or determined second intra-prediction mode is an incorrect mode, the second intra-prediction mode needs to be corrected to a correct mode by performing correction according to a predetermined correspondence relationship. Specifically, when the second intra-prediction mode is limited to an angular prediction mode, if the obtained second intra-prediction mode is mode 0, 1, 2, the second intra-prediction mode needs to correspond to one or several available angular modes according to a predetermined correspondence relationship in order to avoid an incorrect mode (i.e., restricting unavailable non-angular prediction modes). For example, if mode 0 is obtained by decoding the second intra prediction mode, the second intra prediction mode is set to mode 12, i.e., vertical mode, in accordance with a predetermined correspondence relationship; if mode 1 is obtained by decoding the second intra prediction mode, the second intra prediction mode is set to mode 18, i.e., a mode oriented 45 degrees downward and to the right, in accordance with the predetermined correspondence relationship; and if mode 2 is obtained by decoding the second intra prediction mode, the second intra prediction mode is set to mode 24, i.e., horizontal mode, in accordance with the predetermined correspondence relationship.
[0524] In addition, in this embodiment, when limiting the number of intra prediction modes, the number of intra prediction modes for all prediction blocks can be directly limited, or different limiting methods can be used for current blocks of different sizes by referring to the dimension parameters of the current block.
[0525] For example, in the present application, for a prediction block with a large dimension parameter, such as a prediction block of 64x64 or 32x32 size, all intra prediction modes can be used to determine two intra prediction modes for the current block, and for a prediction block with a small dimension parameter, such as a prediction block of 8x8 size, some intra prediction modes can be used to determine two intra prediction modes for the current block, that is, the number of intra prediction modes available for the current block can be limited, because the impact of small angle differences is not obvious for prediction blocks with small dimension parameters.
[0526] As can be understood, the present application can first set a dimension threshold, for example, a second dimension threshold, and when the dimension parameter of the current block is smaller than the second dimension threshold, it can be considered that a small angle difference does not have a significant effect, and thus the number of intra prediction modes that can be selected by the current block can be limited. Specifically, the number of intra prediction modes can be limited by limiting the index numbers of the two intra prediction modes of the current block.
[0527] Exemplarily, in the present application, when a dimension parameter of a current block is smaller than a second dimension threshold, a first intra prediction mode and the second intra prediction mode may be determined based on a second mode index range, where the second mode index range is used to limit an index number of an intra prediction mode. Specifically, the second mode index range may include a second lower threshold and a second upper threshold, and a first index number of the first intra prediction mode may be determined, and a second index number of the second intra prediction mode may be determined at the same time, and both the first index number and the second index number are set to be larger than the second lower threshold, and both the first index number and the second index number are set to be smaller than the second upper threshold.
[0528] That is, in the present application, the index number of the first intra prediction mode and the index number of the second intra prediction mode of the current block are restricted according to the second mode index range, thereby completing the restriction of the number of intra prediction modes.
[0529] For example, in AVS3, the second mode index range may be 0 to 32, that is, the second mode index range can limit the index numbers of the first intra-prediction mode and the second intra-prediction mode to the range of 0 to 32, so that the first intra-prediction mode and the second intra-prediction mode of the current block can be determined using the first 33 prediction modes.
[0530] As can be appreciated, in this application, the first dimension threshold may be the same as or different from the second dimension threshold, and the first mode index range may be the same as or different from the second mode index range.
[0531] Furthermore, when the selectable intra-prediction modes of the first intra-prediction mode and the second intra-prediction mode are not restricted, the prediction capabilities of the determined two intra-prediction modes correspond to each other, and there is no need to process the corresponding weighting matrices. However, after the selectable intra-prediction modes are restricted, the prediction capabilities of the two intra-prediction modes are changed, and therefore the corresponding weighting matrices also need to be adjusted.
[0532] Specifically, in the AWP weight matrix shown in FIG. 2, the white part of the lower right corner of weight matrix 0 (number 0) is obtained entirely from the first intra prediction mode, the black part of the upper left corner is obtained entirely from the second intra prediction mode, and the gray part is obtained by weighting two intra prediction modes. If it is necessary to use DC mode for prediction of the upper left corner and horizontal mode for prediction of the lower right corner, the first intra prediction mode can be set to horizontal mode and the second intra prediction mode can be set to DC mode. Conversely, if it is necessary to use horizontal mode for prediction of the upper left corner and DC mode for prediction of the lower right corner, the first intra prediction mode can be set to DC mode and the second intra prediction mode can be set to horizontal mode. However, when one intra prediction mode is restricted, for example, when the second intra prediction mode can only use angular mode, according to the existing method, in the case of AWP weight matrix 0, the second intra prediction mode cannot use DC mode, so that the DC mode cannot be used for prediction of the upper left corner. When one intra prediction mode is restricted, for example, when the second intra prediction mode can only use DC mode, the black part of the above AWP weight matrix can only be obtained by prediction using DC mode according to the existing method. That is, the restriction of the second intra prediction mode greatly affects the effect of prediction.
[0533] Therefore, in the present application, in some cases, the weighting matrix needs to be adjusted, that is, the weighting matrix corresponding to the first intra prediction mode needs to be exchanged with the weighting matrix corresponding to the second intra prediction mode.
[0534] Scheme 1: One weight matrix exchange flag bit is added, which indicates whether the weight matrices of two prediction blocks are exchanged or not, and in the decoding process, the bitstream is analyzed to obtain the flag bit to determine whether the weight matrix exchange needs to be performed.
[0535] In this embodiment, the luma prediction is further described as an example. If the current block (CU) uses the SAWP prediction mode, the bitstream needs to be parsed to obtain the corresponding weight matrix derivation mode and two intra prediction modes.
[0536] The specific decoding process is shown in Table 15.
[0537] [Table 15]
[0538] The spatial angle weighted prediction mode index sawp_idx is used to determine a weight matrix for spatial angle weighted prediction, and the value of SawpIdx is equal to the value of sawp_idx. If sawp_idx is not present in the bitstream, the value of SawpIdx is equal to 0.
[0539] The first luma prediction mode of spatial angle weighted prediction, intra_luma_pred_mode0, is used to determine the first intra prediction mode of luma blocks of spatial angle weighted prediction, IntraLumaPredMode0.
[0540] The second luma prediction mode intra_luma_pred_mode1 of spatial angle weighted prediction is used to determine the second intra prediction mode IntraLumaPredMode1 of luma blocks of spatial angle weighted prediction.
[0541] For the switch flag switch_flag of the spatial angle weighted prediction, the value of SwitchFlag is equal to the value of switch_flag.
[0542] Determine a first intra prediction mode IntraLumaPredMode0 and a second intra prediction mode IntraLumaPredMode1 based on intra_luma_pred_mode0 and intra_luma_pred_mode1, respectively. Determine intra prediction sample matrices predMatrix0 and predMatrix1 based on the first intra prediction mode IntraLumaPredMode0 and the second intra prediction mode IntraLumaPredMode1, respectively. Determine a weight matrix SawpWeightArrayY based on SawpIdx.
[0543] A new prediction sample matrix predMatrixSawp is determined based on the two intra prediction sample matrices predMatrix0, predMatrix1 and the weight matrix SawpWeightArrayY. The specific method is as follows:
[0544] If the value of SwitchFlag is 0, The value of the element predMatrixSawp[x][y] in the prediction sample matrix predMatrixSawp for the spatial angle weighted prediction mode is ((predMatrix0[x][y]*AwpWeightArrayY[x][y]+predMatrix1[x][y]*(8-AwpWeightArrayY[x][y])+4)>>3).
[0545] Otherwise, if the value of SwitchFlag is 1, The value of the element predMatrixSawp[x][y] in the prediction sample matrix predMatrixSawp for the spatial angle weighted prediction mode is ((predMatrix1[x][y]*AwpWeightArrayY[x][y]+predMatrix0[x][y]*(8-AwpWeightArrayY[x][y])+4)>>3).
[0546] Method 2: Based on the weight matrix, determine whether to exchange the weights of two prediction blocks.
[0547] Specifically, when the selectable intra prediction modes of the first intra prediction mode are not restricted, the selectable intra prediction modes of the first intra prediction mode are many, and the prediction ability is strong, while the selectable intra prediction modes of the second intra prediction mode are restricted, so that the choices are few, and the prediction ability is weak, in this case, the weight can be automatically assigned based on the weight matrix. According to the assignment result, in the final prediction block, the points affected by the first intra prediction mode are many, and the points affected by the second intra prediction mode are few.
[0548] In this embodiment, the luma prediction is further described as an example. If the current block (CU) uses the SAWP prediction mode, the bitstream needs to be parsed to obtain the corresponding weight matrix derivation mode and two intra prediction modes.
[0549] The specific decoding process is shown in Table 16.
[0550] [Table 16]
[0551] The spatial angle weighted prediction mode index sawp_idx is used to determine a weight matrix for spatial angle weighted prediction, and the value of SawpIdx is equal to the value of sawp_idx. If sawp_idx is not present in the bitstream, the value of SawpIdx is equal to 0.
[0552] The first luma prediction mode of spatial angle weighted prediction, intra_luma_pred_mode0, is used to determine the first intra prediction mode of luma blocks of spatial angle weighted prediction, IntraLumaPredMode0.
[0553] The second luma prediction mode intra_luma_pred_mode1 of spatial angle weighted prediction is used to determine the second intra prediction mode IntraLumaPredMode1 of luma blocks of spatial angle weighted prediction.
[0554] Determine a first intra prediction mode IntraLumaPredMode0 and a second intra prediction mode IntraLumaPredMode1 based on intra_luma_pred_mode0 and intra_luma_pred_mode1, respectively. Determine intra prediction sample matrices predMatrix0 and predMatrix1 based on the first intra prediction mode IntraLumaPredMode0 and the second intra prediction mode IntraLumaPredMode1, respectively. Determine a weight matrix SawpWeightArrayY based on SawpIdx.
[0555] A new prediction sample matrix predMatrixSawp is determined based on the two intra prediction sample matrices predMatrix0, predMatrix1 and the weight matrix SawpWeightArrayY. The specific method is as follows:
[0556] If SawpIdx belongs to the first set, The value of the element predMatrixSawp[x][y] in the prediction sample matrix predMatrixSawp for the spatial angle weighted prediction mode is ((predMatrix0[x][y]*AwpWeightArrayY[x][y]+predMatrix1[x][y]*(8-AwpWeightArrayY[x][y])+4)>>3).
[0557] Otherwise, if SawpIdx belongs to the second set, The value of the element predMatrixSawp[x][y] in the prediction sample matrix predMatrixSawp for the spatial angle weighted prediction mode is ((predMatrix1[x][y]*AwpWeightArrayY[x][y]+predMatrix0[x][y]*(8-AwpWeightArrayY[x][y])+4)>>3).
[0558] Here, the first set includes 0 to 27. The second set includes 28 to 55.
[0559] Method 3: Determine whether to exchange the weights of two prediction blocks based on the mode numbers of the first intra prediction mode and / or the second intra prediction mode.
[0560] Although there is a certain difference between the prediction angles logically used by adjacent angle prediction modes, due to the influence of interpolation filtering and block size, the difference between the prediction blocks created by adjacent angle prediction modes is not very large, especially in relatively small blocks. Therefore, the logic of whether to exchange the weights of two prediction blocks is set to the mode number of the intra prediction mode, for example, the use of an even-numbered angle prediction mode by a certain intra prediction mode (the first intra prediction mode or the second intra prediction mode) indicates that the weights of the two prediction blocks are not exchanged, and the use of an odd-numbered angle prediction mode by the intra prediction mode indicates that the weights of the two prediction blocks are exchanged.
[0561] Example 1: When the second intra prediction mode can only use a certain non-angular mode or several non-angular modes, for example, when the second intra prediction mode can only use DC mode, it can be determined whether to exchange the weights of the two prediction blocks according to the oddness or evenness of the mode number of the first intra prediction mode. If the mode number of the first intra prediction mode is an even number, the weights of the two prediction blocks are not exchanged; otherwise (if the mode number of the first intra prediction mode is an odd number), the weights of the two prediction blocks are exchanged.
[0562] In this embodiment, the present invention will be further described by taking the example of applying to luma prediction. If the current block (CU) uses the SAWP prediction mode, the bitstream needs to be parsed to obtain the corresponding weight matrix derivation mode and the first intra prediction mode. Furthermore, for the second intra prediction mode, if there is only one selectable intra prediction mode, the second intra prediction mode is derived as the predetermined intra prediction mode by default.
[0563] The specific decoding process is shown in Table 17.
[0564] [Table 17]
[0565] The spatial angle weighted prediction mode index sawp_idx is used to determine a weight matrix for spatial angle weighted prediction, and the value of SawpIdx is equal to the value of sawp_idx. If sawp_idx is not present in the bitstream, the value of SawpIdx is equal to 0.
[0566] The first luma prediction mode of spatial angle weighted prediction, intra_luma_pred_mode0, is used to determine the first intra prediction mode of luma blocks of spatial angle weighted prediction, IntraLumaPredMode0.
[0567] Determine a first intra prediction mode IntraLumaPredMode0 based on intra_luma_pred_mode0. Derive a second intra prediction mode IntraLumaPredMode1 by default. Determine intra prediction sample matrices predMatrix0 and predMatrix1 based on the first intra prediction mode IntraLumaPredMode0 and the second intra prediction mode IntraLumaPredMode1, respectively. Determine a weight matrix SawpWeightArrayY based on SawpIdx.
[0568] A new prediction sample matrix predMatrixSawp is determined based on the two intra prediction sample matrices predMatrix0, predMatrix1 and the weight matrix SawpWeightArrayY. The specific method is as follows:
[0569] When IntraLumaPredMode0 is an even number, the value of element predMatrixSawp[x][y] in the prediction sample matrix predMatrixSawp for the spatial angle weighted prediction mode is ((predMatrix0[x][y]*AwpWeightArrayY[x][y]+predMatrix1[x][y]*(8-AwpWeightArrayY[x][y])+4)>>3).
[0570] Otherwise, that is, if IntraLumaPredMode0 is an odd number, the value of element predMatrixSawp[x][y] in the prediction sample matrix predMatrixSawp for the spatial angle weighted prediction mode is ((predMatrix1[x][y]*AwpWeightArrayY[x][y]+predMatrix0[x][y]*(8-AwpWeightArrayY[x][y])+4)>>3).
[0571] Example 2: If the second intra prediction mode can only use non-angle modes, the oddness or evenness of the mode number of the first intra prediction mode or the second intra prediction mode can be used to determine whether to exchange the weight matrices of the two prediction blocks. For example, if the mode number of the second intra prediction mode is an even number, the weight matrices of the two prediction blocks are not exchanged, and if not (if the mode number of the second intra prediction mode is an odd number), the weight matrices of the two prediction blocks are exchanged.
[0572] In this embodiment, the present invention is further described by taking luma prediction as an example. If a current block (CU) uses a SAWP prediction mode, it is necessary to parse the bitstream to obtain the corresponding weight matrix derivation mode and two intra prediction modes.
[0573] The specific decoding process is shown in Table 18.
[0574] [Table 18]
[0575] The spatial angle weighted prediction mode index sawp_idx is used to determine a weight matrix for spatial angle weighted prediction, and the value of SawpIdx is equal to the value of sawp_idx. If sawp_idx is not present in the bitstream, the value of SawpIdx is equal to 0.
[0576] The first luma prediction mode of spatial angle weighted prediction, intra_luma_pred_mode0, is used to determine the first intra prediction mode of luma blocks of spatial angle weighted prediction, IntraLumaPredMode0.
[0577] The second luma prediction mode intra_luma_pred_mode1 of spatial angle weighted prediction is used to determine the second intra prediction mode IntraLumaPredMode1 of luma blocks of spatial angle weighted prediction.
[0578] Determine a first intra prediction mode IntraLumaPredMode0 and a second intra prediction mode IntraLumaPredMode1 based on intra_luma_pred_mode0 and intra_luma_pred_mode1, respectively. Determine intra prediction sample matrices predMatrix0 and predMatrix1 based on the first intra prediction mode IntraLumaPredMode0 and the second intra prediction mode IntraLumaPredMode1, respectively. Determine a weight matrix SawpWeightArrayY based on SawpIdx.
[0579] A new prediction sample matrix predMatrixSawp is determined based on the two intra prediction sample matrices predMatrix0, predMatrix1 and the weight matrix SawpWeightArrayY. The specific method is as follows:
[0580] When IntraLumaPredMode1 is an even number, the value of element predMatrixSawp[x][y] in the prediction sample matrix predMatrixSawp for the spatial angle weighted prediction mode is ((predMatrix0[x][y]*AwpWeightArrayY[x][y]+predMatrix1[x][y]*(8-AwpWeightArrayY[x][y])+4)>>3).
[0581] Otherwise, that is, if IntraLumaPredMode1 is an odd number, the value of element predMatrixSawp[x][y] in the prediction sample matrix predMatrixSawp for the spatial angle weighted prediction mode is ((predMatrix1[x][y]*AwpWeightArrayY[x][y]+predMatrix0[x][y]*(8-AwpWeightArrayY[x][y])+4)>>3).
[0582] Optionally, in the present application, the overhead of weight matrix derivation modes can be reduced by reducing the number of weight matrix derivation modes available to the current block. For example, in AVS3, when 56 weight matrix derivation modes are used, a maximum of 6 bits are required to decode one weight matrix derivation mode, and when only 32 weight matrix derivation modes are used, a maximum of 5 bits are required to decode one weight matrix derivation mode. In addition, the number of weight matrix derivation modes available to the current block can also be further compressed and limited (to use fewer flag bits to identify which weight matrix to select or which weight matrix derivation mode), for example, only 16 weight matrix derivation modes are used, and initially, decoding is realized using only 4 bits, thereby further reducing overhead and achieving better performance.
[0583] In addition, in this embodiment, when limiting the number of weighting matrix derivation modes, the number of weighting matrix derivation modes for all prediction blocks can be directly limited, or different limiting methods can be used for current blocks of different sizes by referring to the dimension parameters of the current block.
[0584] For example, in the present application, for a prediction block with a large dimension parameter, such as a prediction block of 64x64 or 32x32 size, all weight matrix derivation modes can be used to determine the weight matrix derivation mode of the current block, and for a prediction block with a small dimension parameter, such as a prediction block of 8x8 size, some weight matrix derivation modes can be used to determine the weight matrix derivation mode of the current block, that is, the number of weight matrix derivation modes available for the current block can be limited, because the impact of small angle differences is not obvious for prediction blocks with small dimension parameters.
[0585] As can be understood, the present application can first set a dimension threshold, for example, a first dimension threshold, and when the dimension parameter of the current block is smaller than the first dimension threshold, it can be considered that a small angle difference does not have a significant effect, and thus the number of weight matrix derivation modes selectable by the current block can be limited. Specifically, the number of weight matrix derivation modes can be limited by limiting the index number of the weight matrix derivation mode of the current block.
[0586] Exemplarily, in the present application, when the dimension parameter of the current block is smaller than a first dimension threshold, a weight matrix derivation mode may be determined based on a first mode index range, where the first mode index range is used to limit an index number of the weight matrix derivation mode. Specifically, the first mode index range may include a first lower threshold and a first upper threshold, and the index number of the weight matrix derivation mode may be compared with the first lower threshold and the first upper threshold, respectively, and when the index number of the weight matrix derivation mode is smaller than the first lower threshold, the index number of the weight matrix derivation mode may be set to the first lower threshold, and when the index number of the weight matrix derivation mode is larger than the first upper threshold, the index number of the weight matrix derivation mode may be set to the first upper threshold.
[0587] That is, in this application, the index number of the weighting matrix derivation mode of the current block can be restricted by the first mode index range, so that the restriction of the number of weighting matrix derivation modes can be completed.
[0588] For example, in AVS3, the first mode index range may be 0 to 32, that is, the first mode index range can limit the index number of the weighting matrix derivation mode to the range of 0 to 32, so that the current block can use the first 33 weighting matrix derivation modes to determine the weighting matrix derivation mode of the current block.
[0589] Example 1: Weight matrices that can be used in the AWP include weight matrices corresponding to numbers 0 to 55, and are specifically as shown in Fig. 2. In the present application, 32 types of weight matrices are used in the SAWP, that is, weight matrices that can be used in the SAWP correspond to weight matrices 0 to 7, 16 to 23, 32 to 39, and 48 to 55 of the AWP (weight matrices corresponding to the corresponding numbers in Fig. 2). In other words, weight matrices 0 to 7 of the SAWP correspond to weight matrices 0 to 7 of the AWP, weight matrices 8 to 15 of the SAWP correspond to weight matrices 16 to 23 of the AWP, weight matrices 16 to 23 of the SAWP correspond to weight matrices 32 to 39 of the AWP, and weight matrices 24 to 31 of the SAWP correspond to weight matrices 48 to 55 of the AWP. Assuming that the probabilities of these 32 types of weight matrices are equal, a 5-bit flag bit sawp_idx is required.
[0590] In this example, the derivation of weighting matrices for the angle weighted prediction mode (AWP) and the spatial angle weighted prediction mode (SAWP) will be described.
[0591] M and N represent the width and height of the current prediction unit (PU), and the weight matrix is derived as follows: (1) Derive stepIdx, angleIdx, and subAngleIdx: When deriving the weight matrix for Angle Weighted Prediction mode (AWP), AwpIdx is input, i.e.: stepIdx=(AwpIdx>>3)-3, modAngNum=AwpIdx%8; Otherwise, when deriving the weighting matrix for the spatial angle weighted prediction mode (SAWP), SawpIdx is input, i.e.: stepIdx=((SawpIdx>>3)<<1)-3, modAngNum=SawpIdx%8.
[0592] Furthermore, the derivation process of subAngleIdx is as shown in Table 19 below.
[0593] [Table 19]
[0594] (2) The process for deriving the reference weight list ReferenceWeight[x] is as shown in Table 20.
[0595] [Table 20] JPEG0007689576000021.jpg249164JPEG0007689576000022.jpg71159
[0596] (3) The process of deriving the luminance weight for the current pixel position is as shown in Table 21.
[0597] [Table 21]
[0598] (4) The process of deriving the color weight of the current pixel position is as shown in Table 22.
[0599] [Table 22]
[0600] When deriving a weighting matrix for angle weighted prediction mode (AWP), WeightArrayY is assigned to AwpWeightArrayY and WeightArrayUV is assigned to AwpWeightArrayUV.
[0601] When deriving a weighting matrix for spatial angle weighted prediction mode (SAWP), WeightArrayY is assigned to SawpWeightArrayY and WeightArrayUV is assigned to SawpWeightArrayUV.
[0602] Example 2: In this example, there are only 24 types of weight matrices used by SAWP, and the weight matrices that SAWP can use correspond to AWP weight matrices 8 to 15, 24 to 31, and 40 to 47 shown in Fig. 2. In other words, SAWP weight matrices 0 to 7 correspond to AWP weight matrices 8 to 15, SAWP weight matrices 8 to 15 correspond to AWP weight matrices 24 to 31, SAWP weight matrices 16 to 23 correspond to AWP weight matrices 40 to 47, and 4 to 5 flag bits sawp_idx are required.
[0603] In this example, the derivation of weighting matrices for the angle weighted prediction mode (AWP) and the spatial angle weighted prediction mode (SAWP) will be described.
[0604] M and N represent the width and height of the current prediction unit (PU), and the weight matrix is derived as follows: (1) Derive stepIdx, angleIdx, and subAngleIdx: When deriving the weight matrix for Angle Weighted Prediction mode (AWP), AwpIdx is input, i.e.: stepIdx=(AwpIdx>>3)-3, modAngNum=AwpIdx%8.
[0605] Otherwise, when deriving the weighting matrix for the spatial angle weighted prediction mode (SAWP), SawpIdx is input, i.e.: stepIdx=((SawpIdx>>3)<<1)-2, modAngNum=SawpIdx%8.
[0606] The derivation process of subAngleIdx is shown in Table 23.
[0607] [Table 23]
[0608] (2) The process for deriving the reference weight list ReferenceWeight[x] is as shown in Table 24.
[0609] [Table 24] JPEG0007689576000027.jpg136163
[0610] (3) The process of deriving the luminance weight for the current pixel position is as shown in Table 25. [Table 25]
[0611] (4) The process of deriving the color weight of the current pixel position is as shown in Table 26.
[0612] [Table 26]
[0613] When deriving a weighting matrix for angle weighted prediction mode (AWP), WeightArrayY is assigned to AwpWeightArrayY and WeightArrayUV is assigned to AwpWeightArrayUV.
[0614] When deriving a weighting matrix for spatial angle weighted prediction mode (SAWP), WeightArrayY is assigned to SawpWeightArrayY and WeightArrayUV is assigned to SawpWeightArrayUV.
[0615] Furthermore, since index numbers 10 and 14 in the 24 weight matrices of the SAWP above correspond to index numbers 26 and 30 in the 56 weight matrices of the AWP, respectively, which are similar to the horizontal and vertical partitioning methods of binary tree partitioning (BT), longer binary strings can be assigned to them with a low probability of being actually selected, and shorter binary strings can be assigned to weight matrices with a high probability of being selected.
[0616] In step 604, a prediction value for the current block is determined based on the first intra-prediction mode, the second intra-prediction mode and the weighting matrix.
[0617] In the present embodiment, the decoder determines a first intra prediction mode and a second intra prediction mode of the current block based on the weight matrix derivation mode, and after determining a weight matrix of the current block based on the weight matrix derivation mode, can further determine a predicted value of the current block based on the first intra prediction mode, the second intra prediction mode, and the weight matrix.
[0618] As can be understood, in the present embodiment, when the decoder determines a predicted value of the current block based on the first intra prediction mode, the second intra prediction mode, and the weighting matrix, the decoder can first determine a first predicted value of the current block based on the first intra prediction mode, and at the same time, determine a second predicted value of the current block based on the second intra prediction mode, and then perform a weighted average calculation on the first predicted value and the second predicted value using the weighting matrix to finally obtain a predicted value of the current block.
[0619] In the present embodiment, if the intra prediction mode parameter indicates that the intra prediction value of the current block is determined using a SAWP mode, the method for the decoder to perform the decoding process may further include the following steps:
[0620] In step 701, a first initial mode and a second initial mode of the current block are determined based on the mode list.
[0621] In this embodiment, after determining the intra prediction mode parameter of the current block, if the intra prediction mode parameter indicates that the intra prediction value of the current block is determined using the SAWP mode, the decoder may further determine a mode list (MPM list) used by the current block, and may determine a first initial mode and a second initial mode of the current block based on the mode list.
[0622] It should be noted that in this application, the mode list is used to determine the intra-prediction mode used by the current block. Specifically, the decoder can build a mode list using some intra-prediction modes with a relatively high usage probability, and can determine two intra-prediction modes of the current block based on the mode list.
[0623] As can be understood, in an embodiment of the present application, when determining a mode list, the decoder can adopt a general method for constructing an MPM, such as constructing an MPM using the prediction mode of a neighboring block, or can use the mode list construction method related to the intra prediction method proposed in the present application, i.e., construct a mode list using the weight matrix derivation mode of the current block.
[0624] In other words, in the present application, the method of constructing the mode list may be selected to use the mode list construction method provided in step 102 in the above embodiment, or other MPM construction methods may be used, and the present application is not particularly limited thereto.
[0625] Further, in the present embodiment, after determining a mode list used by a current block, the decoder may first determine a first initial mode and a second initial mode of the current block based on the mode list.
[0626] For example, in this application, a mode list containing N MPMs is constructed, where N is 2 nIf so, n bits (mpm_idx) can be used to indicate which MPM in the mode list is selected, i.e., to determine the first and second initial modes, and 1 bit can be used to indicate whether an offset is required (offset_needed). For example, when a mode list including four MPMs is constructed and an intra prediction mode is selected in the mode list, 2 bits (mpm_idx) need to be used to indicate which MPM in the mode list is selected as the initial mode, and the correspondence between the mpm_idx values and binary strings shown in Table 3 can be used to determine the prediction mode.
[0627] In step 702, an offset mode parameter is determined, and if the offset mode parameter indicates that an offset process is to be performed, an offset parameter of the current block is determined.
[0628] In this embodiment, the decoder can further determine an offset mode parameter, where the offset mode parameter is used to determine whether or not an offset needs to be performed. Specifically, if the offset mode parameter indicates that an offset process is performed, the decoder can further determine an offset parameter of the current block.
[0629] In addition, in this embodiment, one bit can be used to indicate whether or not offset is needed (offset_needed), that is, by analyzing the bitstream to determine the offset mode parameter, it can be further determined whether or not the prediction mode (first initial mode or second initial mode) of the current block needs to be offset.
[0630] Further, in the present embodiment, if the offset mode parameter indicates that an offset process is performed, the decoder can further analyze the bitstream to de...
Claims
1. 1. An intra prediction method applied to an encoder, comprising: determining a weighting matrix derivation mode for the current block when the intra prediction value of the current block is determined using a spatial angle weighted prediction (SAWP) mode; determining a first intra prediction mode and a second intra prediction mode of the current block based on the weighting matrix derivation mode, and determining a weighting matrix of the current block based on the weighting matrix derivation mode; determining a prediction value for the current block based on the first intra-prediction mode, the second intra-prediction mode and the weighting matrix; determining a first intra prediction mode and a second intra prediction mode of the current block based on the weight matrix derivation mode, determining a mode list using the weight matrix derivation mode; determining one prediction mode in the mode list as the first intra prediction mode; determining the second intra-prediction mode based on the first intra-prediction mode and the mode list.
2. Determining a mode list using the weight matrix derivation mode includes: determining an intra prediction mode corresponding to a neighboring block of the current block, and determining the intra prediction mode corresponding to the neighboring block as an additional waiting mode; adding the waiting-to-be-added mode to the mode list if the waiting-to-be-added mode satisfies a predetermined adding condition; If the mode list does not satisfy a predetermined list length, determine a correlated intra prediction mode corresponding to the weighting matrix derivation mode, and determine the correlated intra prediction mode corresponding to the weighting matrix derivation mode as the waiting for addition mode; adding the waiting-to-be-added mode to the mode list if the waiting-to-be-added mode satisfies the predetermined adding condition. The intra prediction method according to claim 1 .
3. The intra prediction method includes: determining the first intra prediction mode and the second intra prediction mode based on a second mode index range, the second mode index range being used to limit index numbers of intra prediction modes; The intra prediction method according to claim 1 .
4. The second mode index range includes a second lower threshold and a second upper threshold, and the intra prediction method includes: determining a first index number for the first intra-prediction mode and determining a second index number for the second intra-prediction mode; setting both the first index number and the second index number to be greater than the second lower threshold and setting both the first index number and the second index number to be smaller than the second upper threshold. The intra prediction method according to claim 3 .
5. Determining a prediction value for the current block based on the first intra-prediction mode, the second intra-prediction mode, and the weighting matrix includes: determining a first predicted value of the current block according to the first intra-prediction mode and determining a second predicted value of the current block according to the second intra-prediction mode; and performing a weighted average calculation on the first predicted value and the second predicted value using the weight matrix to obtain a predicted value of the current block. The intra prediction method according to claim 1 .
6. 1. An intra prediction method applied to a decoder, comprising: Parsing the bitstream to determine intra-prediction mode parameters for a current block; determining a weighting matrix derivation mode for the current block if the intra prediction mode parameter indicates that the intra prediction value of the current block is determined using a SAWP mode; determining a first intra prediction mode and a second intra prediction mode of the current block based on the weighting matrix derivation mode, and determining a weighting matrix of the current block based on the weighting matrix derivation mode; determining a prediction value of the current block based on the first intra-prediction mode, the second intra-prediction mode and the weighting matrix; determining a first intra prediction mode and a second intra prediction mode of the current block based on the weight matrix derivation mode, determining a mode list using the weight matrix derivation mode; determining one prediction mode in the mode list as the first intra prediction mode; determining the second intra-prediction mode based on the first intra-prediction mode and the mode list.
7. Determining a mode list using the weight matrix derivation mode includes: determining an intra prediction mode corresponding to a neighboring block of the current block, and determining the intra prediction mode corresponding to the neighboring block as an additional waiting mode; adding the waiting-to-be-added mode to the mode list if the waiting-to-be-added mode satisfies a predetermined adding condition; If the mode list does not satisfy a predetermined list length, determine a correlated intra prediction mode corresponding to the weighting matrix derivation mode, and determine the correlated intra prediction mode corresponding to the weighting matrix derivation mode as the waiting for addition mode; adding the waiting-to-be-added mode to the mode list if the waiting-to-be-added mode satisfies the predetermined adding condition. The intra prediction method according to claim 6 .
8. The intra prediction method includes: determining the first intra prediction mode and the second intra prediction mode based on a second mode index range, the second mode index range being used to limit index numbers of intra prediction modes; The intra prediction method according to claim 6 .
9. The second mode index range includes a second lower threshold and a second upper threshold, and the intra prediction method includes: determining a first index number for the first intra-prediction mode and determining a second index number for the second intra-prediction mode; setting both the first index number and the second index number to be greater than the second lower threshold and setting both the first index number and the second index number to be smaller than the second upper threshold. The intra prediction method according to claim 8 .
10. Determining a prediction value for the current block based on the first intra-prediction mode, the second intra-prediction mode, and the weighting matrix includes: determining a first predicted value of the current block according to the first intra-prediction mode and determining a second predicted value of the current block according to the second intra-prediction mode; and performing a weighted average calculation on the first predicted value and the second predicted value using the weight matrix to obtain a predicted value of the current block. The intra prediction method according to claim 6 .
11. A decoder comprising a decoding unit and a second determination unit, The decoding unit is configured to parse the bitstream; the second determination unit is configured to determine an intra prediction mode parameter of a current block; if the intra prediction mode parameter indicates that an intra prediction value of the current block is determined using a SAWP mode, determine a weighting matrix derivation mode of the current block; determine a first intra prediction mode and a second intra prediction mode of the current block based on the weighting matrix derivation mode; determine a weighting matrix of the current block based on the weighting matrix derivation mode; and determine a prediction value of the current block based on the first intra prediction mode, the second intra prediction mode, and the weighting matrix; Specifically, the second determination unit is configured to determine a mode list using the weight matrix derivation mode, determine one prediction mode in the mode list as the first intra prediction mode, and determine the second intra prediction mode based on the first intra prediction mode and the mode list.
Citation Information
Patent Citations
Image encoding method, device and image decoding method
JP2006287315A
Intranet prediction method and intranet prediction system
JP2013524670A
Entropy decoding apparatus, entropy coding apparatus, image decoding device, and image coding device
JP2019216294A