Intra-frame prediction method, encoder, decoder, and storage medium
By using two intra-frame angle prediction modes and a weight matrix combination method in hardware, the problem of high hardware implementation complexity of the intra-frame prediction mode is solved, an efficient encoding and decoding method is achieved, and compression performance is improved.
Patent Information
- Application Number
- CN202311667837.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-22
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2041-02-22
AI Technical Summary
In hardware implementation, using two different intra-frame prediction modes requires two sets of intra-frame prediction circuits, which increases the hardware implementation cost and complexity, and reduces the encoding and decoding performance.
Two different prediction blocks of the current block are determined by two different intra-frame angle prediction modes, and are combined through various weight matrices, thereby reducing the hardware implementation cost and complexity, and realizing a simple and efficient encoding and decoding method.
On the basis of improving the accuracy of intra-frame prediction, the complexity of hardware implementation is reduced and the compression performance is improved.
Smart Images

Figure CN117676133B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to an intra-frame prediction method, an encoder, a decoder, and a storage medium. Background Art
[0002] In order to capture finer edge directions presented in natural videos, Versatile Video Coding (VVC) expands the 33 intra-frame luminance prediction angle modes defined in the High Efficiency Video Coding (HEVC) video compression standard to 65, in addition to two non-angle modes, namely the Planar mode numbered 0 and the Direct Current (DC) mode numbered 1.
[0003] To improve the accuracy of intra-frame prediction, a method for performing intra-frame prediction using two different intra-frame prediction modes has been proposed. However, during hardware implementation, circuits for some different intra-frame prediction modes cannot be reused, requiring two sets of intra-frame prediction circuits. Adding new prediction circuits increases the hardware implementation cost and complexity, thereby reducing encoding and decoding performance. Summary of the Invention
[0004] The embodiments of the present application provide an intra-frame prediction method, an encoder, a decoder, and a storage medium, which can reduce the hardware implementation cost and complexity on the basis of improving the accuracy of intra-frame prediction, and realize a simple and efficient encoding and decoding method, thereby improving compression performance.
[0005] The technical solution of the embodiment of the present application can be implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides an intra-frame prediction method, applied to a decoder, the method comprising:
[0007] Decode the code stream and determine the intra-frame prediction mode parameters of the current block;
[0008] When the intra prediction mode parameter indicates that the current block uses the IWCP mode to determine the intra prediction value of the current block, determining a first mode index and a second mode index of the current block;
[0009] Constructing a most probable mode (MPM) list for the current block;
[0010] Determine a first intra prediction mode and a second intra prediction mode of the current block according to the first mode index, the second mode index, and the MPM list; wherein the first intra prediction mode and the second intra prediction mode are two different intra angular prediction modes;
[0011] A weight matrix of a current block is determined, 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.
[0012] In a second aspect, an embodiment of the present application provides an intra-frame prediction method, applied to an encoder, the method comprising:
[0013] When the current block uses the IWCP mode to determine the intra prediction value of the current block, determining a first intra prediction mode and a second intra prediction mode of the current block; wherein the first intra prediction mode and the second intra prediction mode are two different intra angular prediction modes;
[0014] Constructing an MPM list for the current block;
[0015] Determine a first mode index and a second mode index of the current block according to the first intra prediction mode, the second intra prediction mode, and the MPM list;
[0016] The first mode index and the second mode index are written into a code stream.
[0017] In a third aspect, an embodiment of the present application provides an encoder, comprising: a first determining part, a first constructing part, an encoding part,
[0018] The first determining portion is configured to determine a first intra prediction mode and a second intra prediction mode of the current block when the current block uses the IWCP mode to determine the intra prediction value of the current block; wherein the first intra prediction mode and the second intra prediction mode are two different intra angular prediction modes;
[0019] The first building part is configured to build the MPM list of the current block;
[0020] The first determining part is further configured to determine a first mode index and a second mode index of the current block according to the first intra prediction mode, the second intra prediction mode and the MPM list;
[0021] The encoding part is configured to write the first mode index and the second mode index into a code stream.
[0022] In a fourth aspect, an embodiment of the present application provides a decoder, comprising: a decoding part, a second determining part, a second constructing part,
[0023] The decoding part is configured to decode the code stream;
[0024] The second determining part is configured to determine an intra prediction mode parameter of the current block; when the intra prediction mode parameter indicates that the current block uses the IWCP mode to determine the intra prediction value of the current block, determine a first mode index and a second mode index of the current block;
[0025] A second building part is configured to build a most probable mode MPM list of the current block;
[0026] The second determination part is further configured to determine the first intra-frame prediction mode and the second intra-frame prediction mode of the current block according to the first mode index, the second mode index and the MPM list; wherein the first intra-frame prediction mode and the second intra-frame prediction mode are two different intra-frame angle prediction modes; determine the weight matrix of the current block, and determine the prediction value of the current block based on the first intra-frame prediction mode, the second intra-frame prediction mode and the weight matrix.
[0027] In a fifth aspect, an embodiment of the present application provides an encoder, which includes a first processor and a first memory storing instructions executable by the first processor. When the instructions are executed, the first processor implements the intra-frame prediction method as described above.
[0028] In a sixth aspect, an embodiment of the present application provides a decoder comprising a second processor and a second memory storing instructions executable by the second processor. When the instructions are executed, the second processor implements the intra-frame prediction method as described above.
[0029] In a seventh aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores a computer program, and when the computer program is executed by a first processor, it implements the intra-frame prediction method as described in the first aspect, or when the computer program is executed by a second processor, it implements the intra-frame prediction method as described in the second aspect.
[0030] An embodiment of the present application provides an intra-frame prediction method, an encoder, a decoder, and a storage medium. The decoder decodes a code stream and determines an intra-frame prediction mode parameter of a current block; when the intra-frame prediction mode parameter indicates that the current block uses an IWCP mode to determine an intra-frame prediction value of the current block, the first mode index and the second mode index of the current block are determined; a most probable mode (MPM) list of the current block is constructed; a first intra-frame prediction mode and a second intra-frame prediction mode of the current block are determined according to the first mode index, the second mode index, and the MPM list; wherein the first intra-frame prediction mode and the second intra-frame prediction mode are two different intra-frame angle prediction modes; a weight matrix of the current block is determined, and a prediction value of the current block is determined based on the first intra-frame prediction mode, the second intra-frame prediction mode, and the weight matrix. When the encoder determines the intra-frame prediction value of the current block using the IWCP mode, it determines the first intra-frame prediction mode and the second intra-frame prediction mode of the current block; wherein the first intra-frame prediction mode and the second intra-frame prediction mode are two different intra-frame angle prediction modes; constructs an MPM list for the current block; determines the first mode index and the second mode index of the current block based on the first intra-frame prediction mode, the second intra-frame prediction mode, and the MPM list; and writes the first mode index and the second mode index into the bitstream. In other words, in an embodiment of the present application, the codec can determine two different prediction blocks of the current block using two different intra-frame angle prediction modes, and then combine them using a variety of weight matrices to ultimately obtain a more complex prediction block. On the basis of improving the accuracy of intra-frame prediction, it can reduce the hardware implementation cost and complexity, and realize a simple and efficient encoding and decoding method, thereby improving compression performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 Schematic diagram of weight distribution Figure 1 ;
[0032] Figure 2 Schematic diagram of weight distribution Figure 2 ;
[0033] Figure 3 Schematic diagram of intra-frame prediction;
[0034] Figure 4 A block diagram of the composition of a video coding system;
[0035] Figure 5 A block diagram of a video decoding system;
[0036] Figure 6 Schematic diagram of the implementation process of the intra-frame prediction method Figure 1 ;
[0037] Figure 7 Schematic diagram of the IWCP mode;
[0038] Figure 8 is a schematic diagram of adjacent blocks;
[0039] Figure 9 Schematic diagram of the implementation process of the intra-frame prediction method Figure 2 ;
[0040] Figure 10 Schematic diagram of the structure of the encoder proposed in this embodiment Figure 1 ;
[0041] Figure 11 Schematic diagram of the structure of the encoder proposed in this embodiment Figure 2 ;
[0042] Figure 12 Schematic diagram of the structure of the decoder proposed in this embodiment of the application Figure 1 ;
[0043] Figure 13 Schematic diagram of the structure of the decoder proposed in this embodiment of the application Figure 2 . DETAILED DESCRIPTION
[0044] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. It should be understood that the specific embodiments described herein are only used to explain the related applications and are not intended to limit the applications. It should also be noted that for ease of description, only the parts relevant to the related applications are shown in the drawings.
[0045] At present, the common video coding and decoding standards are based on a block-based hybrid coding framework. Each frame in the video image is divided into square maximum coding units (LCU) of the same size (such as 128×128, 64×64, etc.). Each maximum coding unit can also be divided into rectangular coding units (CU) according to rules; and the coding units may be further divided into smaller prediction units (PU). Specifically, the hybrid coding framework may include modules such as prediction, transform, quantization, entropy coding, and in-loop filtering. Among them, the prediction module may include intra-frame prediction and inter-frame prediction, and inter-frame prediction may include motion estimation and motion compensation. Since there is a strong correlation between adjacent pixels in a frame of a video image, the use of intra-frame prediction in video coding and decoding technology can eliminate the spatial redundancy between adjacent pixels; however, since there is also a strong similarity between adjacent frames in a video image, the use of inter-frame prediction in video coding and decoding technology can eliminate the temporal redundancy between adjacent frames, thereby improving coding and decoding efficiency.
[0046] The basic process of a video codec is as follows: On the encoder side, a frame is divided into blocks. Intra-frame prediction or inter-frame prediction is used on the current block to generate a predicted block for the current block. The predicted block is subtracted from the original block to obtain a residual block. The residual block is transformed and quantized to obtain a quantization coefficient matrix. This quantization coefficient matrix is entropy encoded and output to the bitstream. On the decoder side, intra-frame prediction or inter-frame prediction is used on the current block to generate a predicted block for the current block. The decoded bitstream is then decoded to obtain a quantization coefficient matrix. This quantization coefficient matrix is inversely quantized and inversely transformed to obtain a residual block. The predicted block and residual block are added together to obtain a reconstructed block. The reconstructed blocks form a reconstructed image, which is then subjected to image-based or block-based loop filtering to obtain the decoded image. The encoder side also performs similar operations to the decoder side to obtain the decoded image. The decoded image can serve as a reference frame for inter-frame prediction in subsequent frames. Block division information, prediction, transform, quantization, entropy coding, loop filtering, and other mode or parameter information determined by the encoder are output to the bitstream if necessary. The decoding end determines the same block division information as the encoding end by parsing and analyzing the existing information, as well as the mode information or parameter information such as prediction, transformation, quantization, entropy coding, and loop filtering, thereby ensuring that the decoded image obtained by the encoding end is the same as the decoded image obtained by the decoding end. The decoded image obtained by the encoding end is also usually called a reconstructed image. The current block can be divided into prediction units during prediction, and can be divided into transformation units during transformation. The division of prediction units and transformation units can be different. The above is the basic process of the video codec under the block-based hybrid coding framework. With the development of technology, some modules or steps of the framework or process may be optimized. The embodiment of the present application is applicable to the basic process of the video codec under the block-based hybrid coding framework, but is not limited to the framework and process.
[0047] The current block may be a current coding unit (CU) or a current prediction unit (PU), etc.
[0048] Inter-frame prediction uses information from a decoded or reconstructed image or reference frame to predict the current block. Inter-frame prediction uses motion information to find a reference block from a reference frame and generates a prediction block based on the reference block. Motion information includes the reference frame list where the reference frame is located, the reference frame index, and the motion vector. The motion vector can be integer pixel or fractional pixel. If the motion vector is fractional pixel, then an interpolation filter is needed in the reference frame to make the required fractional pixel block. Here, the integer pixel or fractional pixel block in the reference frame found based on the motion vector is called a reference block. Some technologies will directly use the reference block as the prediction block, while other technologies will further process the reference block to generate a prediction block. Reprocessing the reference block to generate a prediction block can also be understood as using the reference block as the prediction block and then processing the prediction block to generate a new prediction block.
[0049] The Versatile Video Coding (VVC) video codec standard, currently under development, includes an inter-frame prediction mode called Geometric Partitioning Mode (GPM). The Audio Video Coding Standard (AVS) video codec standard, currently under development, includes an inter-frame prediction mode called Angular Weighted Prediction (AWP). While these two modes have different names and specific implementations, they share common principles.
[0050] It should be noted that traditional unidirectional prediction only searches for a reference block of the same size as the current block, while traditional bidirectional prediction uses two reference blocks of the same size. The pixel value of each point in the predicted block is the average of the corresponding positions in the two reference blocks, meaning that all points in each reference block have a 50% weighted ratio. Bidirectional weighted prediction allows for different weights in the two reference blocks, such as 75% for all points in the first reference block and 25% for all points in the second reference block. However, all points in the same reference block have the same weighted ratio. Other optimization methods, such as decoder-side motion vector refinement (DMVR) and bidirectional optical flow (BIO), can cause some changes in reference or predicted pixels. GPM or AWP also use two reference blocks of the same size as the current block, but some pixel positions use 100% of the pixel values corresponding to the first reference block, while others use 100% of the pixel values corresponding to the second reference block. In the boundary area, pixel values from both reference blocks are used in a certain ratio. The weight distribution can be determined by the prediction model of GPM or AWP.
[0051] For example, Figure 1 Schematic diagram of weight distribution Figure 1 ,like Figure 1 As shown, it shows a weight distribution diagram of multiple partitioning modes of a GPM on a 64×64 current block provided by an embodiment of the present application, wherein there are 64 partitioning modes of GPM. Figure 2 Schematic diagram of weight distribution Figure 2 ,like Figure 2 As shown, it shows a weight distribution diagram of multiple partitioning modes of an AWP provided by an embodiment of the present application on a 64×64 current block, wherein there are 56 partitioning modes of AWP. Figure 1 still Figure 2In each division mode, the black area indicates that the weight value of the corresponding position of the first reference block is 0%, the white area indicates that the weight value of the corresponding position of the first reference block is 100%, and the gray area indicates that the weight value of the corresponding position of the first reference block is a weight value greater than 0% and less than 100% according to the depth of the color. 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.
[0052] GPM and AWP use different weighting methods. GPM determines the angle and offset for each mode and then calculates a weight matrix for each mode. AWP first creates a one-dimensional weight line and then uses a method similar to intra-frame angle prediction to fill the entire matrix with this one-dimensional weight line.
[0053] It should be understood that in the early coding and decoding technologies, there were only rectangular division methods, whether it was the division of CU, PU or transform unit (TU). However, GPM or AWP achieved the predicted non-rectangular division effect without division. GPM and AWP use a mask of the weights of the two reference blocks, that is, the weight map mentioned above. This mask determines the weights of the two reference blocks when generating the prediction block, and the transition area (blending area) is obtained by weighting the corresponding positions of the two reference blocks, so that the transition is smoother. GPM and AWP do not divide the current block into two CUs or PUs according to the dividing line, so the transformation, quantization, inverse transformation, inverse quantization, etc. of the residual after prediction also treat the current block as a whole.
[0054] The motion information used by the current block can be stored. Subsequent blocks encoded or decoded in the current frame can use the motion information of previously encoded or decoded blocks (e.g., adjacent blocks) based on their positional proximity. This exploits spatial correlation, so this encoded or decoded motion information is called spatial motion information. The motion information used by each block in the current frame can be stored. Subsequent frames encoded or decoded can use the motion information of previously encoded or decoded frames based on their reference relationship. This exploits temporal correlation, so this encoded or decoded motion information is called temporal motion information. The motion information used by each block in the current frame is typically stored using a fixed-size matrix, such as a 4×4 matrix, as a minimum unit, with each minimum unit storing a set of motion information. This way, each time a block is encoded or decoded, the minimum units corresponding to its position can store the motion information for that block. This allows for direct retrieval of spatial or temporal motion information based on position. For example, if a 16x16 block uses traditional unidirectional prediction, all 4×4 minimum units corresponding to that block store the motion information for this unidirectional prediction. If a block uses GPM or AWP, then all the minimum units corresponding to this block will determine the motion information stored in each minimum unit based on the GPM or AWP mode, the first motion information, the second motion information, and the position of each minimum unit. One method is that if all the 4×4 pixels corresponding to a minimum unit come from the first motion information, then this minimum unit stores the first motion information; if all the 4×4 pixels corresponding to a minimum unit come from the second motion information, then this minimum unit stores the second motion information. If the 4×4 pixels corresponding to a minimum unit come from both the first motion information and the second motion information, then AWP will select one of the motion information to store; the GPM approach is that if the two motion information point to different reference frame lists, then they are combined into bidirectional motion information for storage, otherwise only the second motion information is stored.
[0055] It should be noted that GPM or AWP is an inter-frame prediction technology. GPM or AWP needs to transmit a flag in the bitstream to indicate whether GPM or AWP is used. This flag can indicate whether the current block uses GPM or AWP. If GPM or AWP is used, the encoder needs to transmit the specific mode used in the bitstream, that is, one of the 64 partitioning modes of GPM, or one of the 56 partitioning modes of AWP; as well as the index values of two unidirectional motion information. In other words, for the current block, the decoder can obtain information on whether GPM or AWP is used by decoding the bitstream. If it is determined to use GPM or AWP, the decoder can parse out the prediction mode parameters of GPM or AWP and the two motion information index values. For example, if the current block can be divided into two partitions, then the first index value corresponding to the first partition and the second index value corresponding to the second partition can be parsed.
[0056] Specifically, for GPM mode, if GPM is used, the bitstream will transmit GPM prediction mode parameters, such as the specific GPM partitioning mode; generally, GPM includes 64 partitioning modes. For AWP mode, if AWP is used, the bitstream will transmit AWP prediction mode parameters, such as the specific AWP partitioning mode; generally, AWP includes 56 partitioning modes.
[0057] In inter-frame prediction modes, such as GPM and AWP, two unidirectional motion information are required to search for two reference blocks. The current implementation method is to use the relevant information of the encoded / decoded part before the current block on the encoder side to build a unidirectional motion information candidate list, select unidirectional motion information from the unidirectional motion information candidate list, and write the index values (index) of the two unidirectional motion information in the unidirectional motion information candidate list into the bitstream. The same method is used on the decoder side, that is, to use the relevant information of the decoded part before the current block to build a unidirectional motion information candidate list. This unidirectional motion information candidate list must be the same as the candidate list built on the encoder side. In this way, the index values of the two unidirectional motion information are parsed from the bitstream, and then the two unidirectional motion information are found in the unidirectional motion information candidate list, which are the two unidirectional motion information needed for the current block.
[0058] That is, the unidirectional motion information described in this application may include: motion vector information, i.e., the value of (x, y), and corresponding reference frame information, i.e., a reference frame list and the reference frame index value in the reference frame list. One representation 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, such as 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 with a valid reference frame index value is the reference frame list used for the motion information of the current block. The corresponding reference frame can be found from the reference frame list based on the reference frame index value. Each reference frame list has a corresponding motion vector. The motion vector corresponding to a valid reference frame list is valid, while the motion vector corresponding to an invalid reference frame list is invalid. The decoder can find the required reference frame using the reference frame information in the unidirectional motion information. Based on the position of the current block and the motion vector, i.e., the value of (x, y), the reference block can be found in the reference frame, thereby determining the inter-frame prediction value of the current block.
[0059] The intra prediction method uses the reconstructed pixels around the current block that have been coded and decoded as reference pixels to predict the current block. Figure 3 A schematic diagram of intra-frame prediction is shown in FIG. Figure 3 As shown in the figure, the size of the current block is 4×4, and the pixels in the left row and the top column of the current block are the reference pixels of the current block. Intra-frame prediction uses these reference pixels to predict the current block. These reference pixels may all be available, that is, all have been encoded and decoded. Some may not be available. For example, if the current block is the leftmost part of the entire frame, then the reference pixels on the left of the current block are not available. Or when encoding and decoding the current block, the lower left part of the current block has not been encoded and decoded, then the reference pixels on the lower left are also not available. For the case where reference pixels are unavailable, you can use available reference pixels or certain values or certain methods to fill in, or not fill in.
[0060] Furthermore, when performing intra prediction, a multiple reference line (MRL) intra prediction method can use more reference pixels to improve coding efficiency, for example, using 4 reference rows / columns as reference pixels of the current block.
[0061] There are multiple prediction modes for intra-frame prediction. In H.264, intra-frame prediction for 4×4 blocks can mainly include 9 modes. Among them, mode 0 can copy the pixels above the current block vertically to the current block as the prediction value, mode 1 can copy the reference pixels on the left to the current block horizontally as the prediction value, mode 2 DC uses the average value of multiple adjacent points as the prediction value for all points, and modes 3 to 8 can copy the reference pixels to the corresponding positions of the current block at a certain angle. Because some positions of the current block cannot correspond exactly to the reference pixels, it is necessary to use the weighted average of the reference pixels, or the sub-pixels of the interpolated reference pixels.
[0062] In addition, there are other modes, such as Planar mode. With technological advancements and the expansion of block sizes, there are more and more angular prediction modes. For example, HEVC uses intra-frame prediction modes, including Planar mode, DC mode, and 33 angular modes, for a total of 35 prediction modes. VVC uses intra-frame prediction modes, including Planar mode, DC mode, and 65 angular modes, for a total of 67 prediction modes. AVS3 uses DC mode, Planar mode, Bilinear mode, and 63 angular modes, for a total of 66 prediction modes.
[0063] Other techniques improve prediction, such as improving pixel-by-pixel interpolation of reference pixels and filtering predicted pixels. For example, the multiple intra prediction filter (MIPF) in AVS3 uses different filters to generate prediction values for different block sizes. For pixels at different positions within the same block, one filter is used to generate prediction values for pixels closer to the reference pixel, and another filter is used for pixels farther from the reference pixel. Techniques for filtering predicted pixels, such as the intra prediction filter (IPF) in AVS3, can use reference pixels to filter the predicted values.
[0064] In intra-frame prediction, the intra-frame mode coding technology of the Most Probable Modes List (MPM) can be used to improve encoding and decoding efficiency. An MPM list is constructed using the intra-frame prediction modes of surrounding coded blocks, as well as intra-frame prediction modes derived from the intra-frame prediction modes of surrounding coded blocks, such as adjacent modes, and some commonly used or highly likely intra-frame prediction modes, such as DC, Planar, and Bilinear modes. The intra-frame prediction modes of the surrounding coded blocks are referenced to utilize spatial correlation. Because texture has a certain degree of spatial continuity, MPM can be used as a prediction of the intra-frame prediction mode. In other words, it is assumed that the probability of using MPM for the current block is higher than the probability of not using MPM. Therefore, during binarization, fewer codewords will be used for MPM, thereby saving overhead and improving encoding and decoding efficiency.
[0065] Although current intra-frame prediction modes include DC, Planar, and Bilinear, they can only predict simple textures. Even with the increasing number of angular modes, their predictions can only follow a straight line at a single angle. Therefore, current intra-frame prediction modes are only capable of predicting simple textures. For complex textures, prediction requires dividing the image into smaller blocks, encoding more residuals, or incurring significant distortion.
[0066] To address the above issues, a proposed intra-frame prediction method uses two different intra-frame prediction modes to determine two different prediction blocks for the current block. These blocks are then combined using various weight matrices to produce a more complex prediction block, improving prediction accuracy. However, since non-angular prediction modes (such as DC, Planar, Plane, and Bilinear) differ from angular prediction modes in their computational logic, each requires its own logic. This makes hardware implementation difficult to reuse circuitry for these two modes. When using two intra-frame prediction modes, if the two modes are predicted serially in hardware and then combined based on the weight matrix, both modes can use existing intra-frame prediction circuitry. However, this requires storing the prediction values from the previous predictions, and the time required for performing weighted combined intra-frame prediction is significantly longer than using only one intra-frame prediction mode. If the two intra-frame prediction modes are predicted serially in hardware, the generation of prediction values using the weighted combined intra-frame prediction method is significantly faster than a serial implementation. However, this approach requires two sets of intra-frame prediction circuitry. That is, it is necessary to add a set of intra-frame prediction circuits, which perform the predictions in the above-mentioned intra-frame non-angle prediction mode and intra-frame angle prediction mode.
[0067] It can be seen that the current method of using two different intra-frame prediction modes for intra-frame prediction can improve the prediction effect to a certain extent, but since a new prediction circuit is required, the hardware implementation cost will increase. Therefore, simplifying the newly added intra-frame prediction circuit as much as possible can reduce the complexity brought by the intra-frame weighted combination prediction. In order to solve the above problem, in an embodiment of the present application, the codec can determine two different prediction blocks of the current block through two different intra-frame angle prediction modes, and then combine them through various weight matrices to finally obtain a more complex prediction block. On the basis of improving the accuracy of intra-frame prediction, it can reduce the hardware implementation cost, reduce complexity, and implement a simple and efficient encoding and decoding method, thereby improving compression performance.
[0068] See also Figure 4 , which shows an example of a block diagram of a video encoding system provided by an embodiment of the present application; Figure 4As shown, the video coding system 10 includes a transform and quantization unit 101, an intra-frame estimation unit 102, an intra-frame 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, a coding unit 109 and a decoded image cache unit 110, etc., wherein the filtering unit 108 can implement deblocking filtering and sample adaptive offset (Sample Adaptive Offset, SAO) filtering, and the coding unit 109 can implement header information coding and context-based adaptive binary arithmetic coding (Context-based Adaptive Binary Arithmatic Coding, CABAC). For the input original video signal, through the coding tree block (Coding A video coding block can be obtained by dividing the video coding block into a plurality of blocks (CTUs) by a plurality of frames. Then, the residual pixel information obtained after intra-frame or inter-frame prediction is transformed by a transform and quantization unit 101, including transforming the residual information from the pixel domain to the transform domain and quantizing the obtained transform coefficients to further reduce the bit rate. The intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to perform intra-frame prediction on the video coding block. Specifically, the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to determine the intra-frame prediction mode to be used to encode the video coding block. The motion compensation unit 104 and the motion estimation unit 105 are used to perform inter-frame 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. The motion compensation unit 104 then uses the motion vector determined by the motion estimation unit 105 to generate a motion vector. The motion vector is used to perform motion compensation; after determining the intra-frame prediction mode, the intra-frame prediction unit 103 is also used to provide the selected intra-frame prediction data to the encoding unit 109, and the motion estimation unit 105 also sends the calculated motion vector data to the encoding unit 109; in addition, the inverse transform and inverse quantization unit 106 is used to reconstruct the video coding block, reconstruct the residual block in the pixel domain, and remove the block effect artifacts of the reconstructed residual block through the filter control analysis unit 107 and the filtering unit 108. The reconstructed residual block is then added to a predictive block in the frame of the decoded image buffer unit 110 to generate a reconstructed video coding block; the encoding unit 109 is used to encode various coding parameters and quantized transform coefficients. In the CABAC-based coding algorithm, the context content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra-frame prediction mode, and output the code stream of the video signal; and the decoded image buffer unit 110 is used to store the reconstructed video coding block for prediction reference.As the video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoded image buffer unit 110 .
[0069] See also Figure 5 , which shows an example of a block diagram of a video decoding system provided by an embodiment of the present application; Figure 5 As shown, the video decoding system 20 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra-frame prediction unit 203, a motion compensation unit 204, a filtering unit 205 and a decoded image buffer unit 206, etc., wherein the decoding unit 201 can implement header information decoding and CABAC decoding, and the filtering unit 205 can implement deblocking filtering and SAO filtering. The input video signal is processed by Figure 4 After the encoding process, the code stream of the video signal is output; the code stream is input into the video decoding system 20, and first passes through the decoding unit 201 to obtain the decoded transform coefficients; the transform coefficients are processed by the inverse transform and inverse quantization unit 202 to generate a residual block in the pixel domain; the intra-frame prediction unit 203 can be used to generate prediction data for the current video decoding block based on the determined intra-frame prediction mode and the data of the previously decoded block from the current frame or picture; the motion compensation unit 204 determines the prediction information for the video decoding block by analyzing the motion vector and other associated syntax elements, and uses the prediction information To generate a predictive block of the video decoding block being decoded; by summing the residual block from the inverse transform and inverse quantization unit 202 and the corresponding predictive block generated by the intra-frame prediction unit 203 or the motion compensation unit 204, a decoded video block is formed; the decoded video signal passes through the filtering unit 205 to remove blocking artifacts, which can improve the video quality; the decoded video block is then stored in the decoded image buffer unit 206, which stores the reference image used for subsequent intra-frame prediction or motion compensation, and is also used for the output of the video signal, that is, the restored original video signal is obtained.
[0070] The intra-frame prediction method in the embodiment of the present application is mainly used in Figure 4 The intra-frame prediction unit 103 shown in FIG. Figure 5 The intra-frame prediction unit 203 shown. That is to say, the intra-frame prediction method in the embodiment of the present application can be applied to both the video encoding system and the video decoding system, and can even be applied to both the video encoding system and the video decoding system at the same time, but the embodiment of the present application does not specifically limit this. It should also be noted that when the intra-frame prediction method is applied to the intra-frame prediction unit 103, the "current block" specifically refers to the current coding block in the intra-frame prediction; when the intra-frame prediction method is applied to the intra-frame prediction unit 203, the "current block" specifically refers to the current decoding block in the intra-frame prediction.
[0071] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application.
[0072] An embodiment of the present application proposes an intra-frame prediction method applied to a decoder. Figure 6 Schematic diagram of the implementation process of the intra-frame prediction method Figure 1 ,like Figure 6 As shown, the method for the decoder to perform intra-frame prediction may include the following steps:
[0073] Step 101: Decode the code stream and determine the intra-frame prediction mode parameters of the current block.
[0074] In an embodiment of the present application, the decoder may determine the intra-frame prediction mode parameters of the current block by decoding the code stream.
[0075] It should be noted that, in the implementation of the present application, the intra prediction mode parameter may indicate whether the current block can use the intra weighted combined prediction (IWCP) mode, that is, whether the current block can use two different intra angle prediction modes to determine the prediction value of the current block.
[0076] It is understood that in the embodiments of the present application, the intra-frame prediction mode parameter can be understood as a flag indicating whether the IWCP mode is used. Specifically, the decoder can determine a variable as the intra-frame prediction mode parameter after decoding the bitstream, so that the intra-frame prediction mode parameter can be determined by the value of the variable.
[0077] It should be noted that, in an embodiment of the present application, the IWCP mode is an intra-frame prediction method. Specifically, the IWCP mode determines two different intra-frame angle prediction modes for the current block, and then determines two prediction blocks based on the two different intra-frame angle prediction modes. Then, a weight matrix can be determined, and the two prediction blocks are combined according to the weight matrix. Finally, a new prediction block can be obtained, that is, the prediction block of the current block is obtained.
[0078] Figure 7 This is a schematic diagram of the IWCP mode, as shown in Figure 7 As shown, when intra-frame prediction is performed on the current block, intra-frame angle prediction mode 1 (first intra-frame prediction mode) can be used to determine the first prediction block of the current block, and intra-frame angle prediction mode 2 (second intra-frame prediction mode) can be used to determine the second prediction block of the current block. Then, the first prediction block and the second prediction block can be combined using a weight matrix to finally obtain a new prediction block.
[0079] It should be noted that, in an embodiment of the present application, a video image can be divided into a plurality of image blocks, and a current block is each image block currently to be encoded, which can be referred to as a coding block (CB). Here, each coding block may include a first image component, a second image component, and a third image component. Specifically, in the present application, assuming that a first intra-frame prediction is performed and the first image component is a luminance component, that is, the image component to be predicted is a luminance component, then the coding block to be predicted can be referred to as a luminance block; or, assuming that a second intra-frame prediction is performed and the second image component is a chrominance component, that is, the image component to be predicted is a chrominance component, then the coding block to be predicted can be referred to as a chrominance block.
[0080] Furthermore, in an embodiment of the present application, when the IWCP mode is applied, the size of the current block may be restricted.
[0081] It is understandable that since the intra-frame prediction method proposed in the embodiment of the present application requires using two different intra-frame angular prediction modes to generate two prediction blocks, and then weighting them according to the weight matrix to obtain a new prediction block, in order to reduce complexity and consider the trade-off between compression performance and complexity, in the embodiment of the present application, the IWCP mode can be restricted to certain sizes of prediction blocks. Therefore, in the present application, the decoder can first determine the size parameters of the current block, and then determine whether to use the IWCP mode for the current block based on the size parameters.
[0082] It should be noted that, in an embodiment of the present application, the size parameters of the current block may include the height and width of the current block. Therefore, the decoder can use the height and width of the current block to limit the use of the IWCP mode, that is, to limit the size of the prediction block that can use the IWCP mode.
[0083] For example, in this application, if both the width and height are greater than or equal to the first lower limit, and at the same time, both the width and height are less than or equal to the first upper limit, then it can be determined that the current block uses the IWCP mode. Thus, one possible limitation is to use the IWCP mode only when the width and height of the prediction block are less than (or less than or equal to) the first upper limit, and the width and height of the prediction block are greater than (or greater than or equal to) the first lower limit. The first lower limit can be 8, and the first upper limit can be 16, 32, or the like.
[0084] For example, in this application, a frame-level flag may be provided to determine whether the current frame to be decoded uses the IWCP mode. For example, intra-frames (such as I-frames) may be configured to use the IWCP mode, while inter-frames (such as B-frames and P-frames) may not use the IWCP mode. Alternatively, intra-frames may be configured to not use the IWCP mode, while inter-frames may use the IWCP mode. Alternatively, some inter-frames may be configured to use the IWCP mode, while some inter-frames may not. Inter-frames may also use intra-frame prediction, and therefore, inter-frames may also use the IWCP mode.
[0085] For example, in the present application, there may be a flag below the frame level and above the CU level (such as tile, slice, patch, LCU, etc.) to determine whether this area uses the IWCP mode.
[0086] Step 102: When the intra prediction mode parameter indicates that the current block uses the IWCP mode to determine the intra prediction value of the current block, determine a first mode index and a second mode index of the current block.
[0087] In an embodiment of the present application, after the decoder determines the intra-frame prediction mode parameters of the current block, if the intra-frame prediction mode parameters indicate that the current block uses the IWCP mode to determine the intra-frame prediction value of the current block, the decoder can further determine the first mode index and the second mode index of the current block.
[0088] It can be understood that, in the embodiment of the present application, the first mode index is used to indicate the first intra-frame prediction mode used by the current block, and the second mode index can be used to indicate the second intra-frame prediction mode of the current block.
[0089] Specifically, the value of the first mode index and the value of the second mode index are related to the number of intra-frame angle prediction modes that may exist in the first intra-frame prediction mode and the second intra-frame prediction mode. For example, the first intra-frame prediction mode and the second intra-frame prediction mode may be one of the 28 intra-frame angle prediction modes with mode numbers 4-31 respectively, then the value of the first mode index and the value of the second mode index both belong to the range of 0 to 27.
[0090] Exemplarily, in an embodiment of the present application, the parameter iwcp_pred_mode0_index may be used to represent the first mode index, while the parameter iwcp_pred_mode1_index may be used to represent the second mode index.
[0091] Step 103: Build the MPM list of the current block.
[0092] In an embodiment of the present application, the decoder may further construct an MPM list for the current block, wherein the prediction modes in the MPM list are all intra-frame angular prediction modes.
[0093] Furthermore, in an embodiment of the present application, when constructing the MPM list of the current block, the decoder needs to first determine the weight matrix derivation mode of the current block, and then use the weight matrix derivation mode to further determine the MPM list of the current block.
[0094] It should be noted that, in this application, the weight matrix derivation mode is used to determine the weight matrix used for the current block. Specifically, the weight matrix derivation mode can be a mode for deriving a weight matrix. For a prediction block of a given width and height, each weight matrix derivation mode can derive a weight matrix; for prediction blocks of the same size, different weight matrix derivation modes derive different weight matrices.
[0095] For example, in this application, AVS3's AWP has 56 weight matrix derivation modes, and VVC's GPM has 64 weight matrix derivation modes.
[0096] Optionally, in the present application, when constructing the MPM list of the current block, the decoder may construct the MPM list directly based on the prediction mode and weight matrix derivation mode of the neighboring blocks of the current block.
[0097] Optionally, in the present application, when constructing the MPM list for the current block, the decoder may also construct the MPM list based on the prediction modes of the neighboring blocks of the current block, the preset angle prediction mode set, and the weight matrix derivation mode. The preset angle prediction mode set may be a subset of all intra-frame angle prediction modes. Taking AVS3 as an example, the preset angle prediction mode set may only include 28 intra-frame angle prediction modes with mode numbers 4-31.
[0098] It can be understood that in the present application, if the range of the first intra-frame prediction mode and the second intra-frame prediction mode is not restricted, then the preset angle prediction mode set can be a combination of all intra-frame angle prediction modes; if the range of the first intra-frame prediction mode and the second intra-frame prediction mode needs to be restricted, then the preset angle prediction mode set can be only a combination of some intra-frame angle prediction modes. At this time, the preset angle prediction mode set can be used to limit the range of the first intra-frame prediction mode and the second intra-frame prediction mode, thereby effectively reducing overhead and improving compression performance.
[0099] Optionally, in the present application, when the decoder constructs an MPM list based on the intra-frame prediction mode of the adjacent blocks of the current block, the preset angle prediction mode set and the weight matrix derivation mode, it can use the prediction mode of the adjacent blocks to determine the first candidate mode; use the weight matrix derivation mode to determine the second candidate mode; and can further construct the MPM list of the current block based on the first candidate mode, the second candidate mode and the preset angle prediction mode set.
[0100] Specifically, in the present application, when the decoder uses the prediction mode of the adjacent block to determine the first candidate mode, if the adjacent block is a normal intra-frame prediction block and the prediction mode of the adjacent block is an intra-frame prediction mode, the prediction mode of the adjacent block is determined as the first candidate mode.
[0101] It can be understood that in this application, the ordinary intra-frame prediction block refers to the prediction block using the DC mode, Planar mode, Bilinear mode, angular prediction mode and other prediction modes, rather than the prediction block using the intra block copy (IBC) and intra string copy prediction prediction modes.
[0102] Figure 8 is a schematic diagram of adjacent blocks, such as Figure 8 As shown, the current block is E, where (x0, y0) is the coordinate of the upper left corner sample of block E in the image, (x1, y0) is the coordinate of the upper right corner sample of block E in the image, and (x0, y1) is the coordinate of the lower left corner sample of block E in the image. The neighboring block A of the current block E is the block where the sample (x0-1, y0) is located, the neighboring block B of the current block E is the block where the sample (x0, y0-1) is located, the neighboring block C of the current block E is the block where the sample (x1+1, y0-1) is located, the neighboring block D of the current block E is the block where the sample (x0-1, y0-1) is located, the neighboring block F of the block E is the block where the sample (x0-1, y1) is located, and the neighboring block G of the block E is the block where the sample (x1, y0-1) is located. The spatial position relationship between the current block E and its neighboring blocks A, B, C and D is as follows: Figure 8 shown.
[0103] It can be understood that, in the present application, the decoder may also use adjacent blocks to the right and below the current block.
[0104] Specifically, in the present application, when the decoder uses the weight matrix to derive the mode to determine the second candidate mode, it can first determine the dividing line angle index value based on the weight matrix to derive the mode; and then it can use the dividing line angle index value to determine the second candidate mode.
[0105] It should be noted that, in the embodiment of the present application, the second candidate mode can be determined to be L different intra-frame angular prediction modes, thereby ensuring the construction of an MPM list with a length of L.
[0106] Furthermore, in an embodiment of the present application, when the weight matrix includes two weights, the positions where the weights change form a straight line, or when the weight matrix has multiple weights, the positions in the transition region with the same weights form a straight line, and this straight line can be called a dividing line. The horizontal angle to the right can be set to 0, and the angle increases counterclockwise. Then the dividing line may have a horizontal angle of 0 degrees, a vertical angle of 90 degrees, an inclined angle such as 45 degrees, 135 degrees, and various other different angles. If a prediction block chooses to use a certain weight matrix, then the corresponding texture is likely to show different characteristics on both sides of the dividing line, such as textures of two different angles on both sides of the dividing line, or textures of one angle on one side of the dividing line and a relatively flat texture on the other side. Since the dividing line itself also has an angle, it can be assumed that a point obtained through intra-frame angle prediction may be close to some textures of the current block, so this straight line is correlated with the two intra-frame prediction modes of the current block.
[0107] Specifically, in the present application, assuming that the dividing line is obtained by intra-frame angle prediction from a point, then at least one intra-frame angle prediction mode can be found, and this intra-frame angle prediction mode can approximately make the dividing line. For example, the horizontal dividing line matches the horizontal intra-frame prediction mode, such as mode 24 in AVS3; the vertical dividing line matches the vertical intra-frame prediction mode, such as mode 12 in AVS3; the 45-degree dividing line can match the intra-frame prediction mode of 45 degrees from the lower left to the upper right, such as mode 30 in AVS3; it can also match the intra-frame prediction mode of 225 degrees from the upper right to the lower left, such as mode 6 in AVS3. If there is only one weight value in a weight matrix, it can match modes without obvious angles, such as DC mode, Planar mode, Bilinear mode, etc. It can be seen that the weight matrix derived mode can match certain intra-frame prediction modes, so the weight matrix derived mode can be used to assist in the decoding of the intra-frame prediction mode.
[0108] It should be noted that, in this application, the weight matrix derivation mode can also be the index of the weight matrix. For example, the 56 modes of AWP can be considered as 56 weight matrix derivation modes.
[0109] For example, in the present application, a mapping relationship table can be constructed to further represent the mapping relationship between the weight matrix derived mode and the intra-frame angle prediction mode. Specifically, the dividing lines of multiple modes of AWP and GPM are the same angle. For example, the dividing line angles of every 8 modes of AVS3 are the same. There are 8 kinds of dividing line angles in 56 AWP modes. The index of the dividing line angle can be obtained by the mode number of the weight matrix derived mode modulo 8 (% 8). For example, Table 1 is a mapping relationship table. Taking the angle mode of AVS3 as an example, the indexes 0 and 1 of the dividing line angle can correspond to two intra-frame angle prediction modes, one from the upper right corner to the lower left corner, and the other from the upper left corner to the lower right corner. In specific implementation, another approximately corresponding intra-frame angle prediction mode can be found for the index of other dividing line angles, or all the indexes of the dividing line angles correspond to only one intra-frame angle prediction mode.
[0110] Table 1
[0111]
[0112] For a weight matrix, in addition to the high probability of using the intra-frame angle prediction mode corresponding to its dividing line, the probability of using certain intra-frame angle prediction modes related to it is also high. For example, the intra-frame angle prediction mode corresponding to the angle close to the dividing line, or the angle perpendicular to the dividing line. The decoder can use the correlation between the weight matrix and the intra-frame angle prediction mode to construct the MPM list of the intra-frame weighted combination prediction mode. For example, when constructing the MPM list of the intra-frame weighted combination prediction mode, if the list length of the MPM list is 4, then the candidate mode corresponding to the dividing line angle index in Table 2 below can be added to the MPM list.
[0113] Table 2
[0114] Index of the dividing line angle 0 1 2 3 4 5 6 7 Candidate mode 0 30 27 24 21 18 15 12 9 Candidate mode 1 6 24 12 24 17 14 24 12 Candidate Mode 2 24 6 23 18 19 16 11 8 Candidate Mode 3 12 9 25 12 24 12 13 10
[0115] It can be understood that, based on Table 2 above, the number of candidate modes corresponding to the index of each dividing line angle is equal to the length of the MPM list, which ensures that the MPM list can be filled even when all intra prediction modes of the referenced adjacent blocks are unavailable. If the MPM list length is 4, the number of candidate modes corresponding to the index of each dividing line angle can be set to 4.
[0116] Furthermore, in the present application, when the decoder constructs an MPM list based on the first candidate mode, the second candidate mode and the preset angle prediction mode set, it can also filter the first candidate mode based on the preset angle prediction mode set to obtain the filtered candidate mode; and construct the MPM list based on the filtered candidate mode and the second candidate mode.
[0117] Specifically, in the present application, when the decoder filters the first candidate mode based on the preset angle prediction mode set and obtains the filtered candidate mode, if the first candidate mode belongs to the preset angle prediction mode set, the first candidate mode is determined as the filtered candidate mode; if the first candidate mode is an intra-frame angle prediction mode and does not belong to the preset angle prediction mode set, the replacement mode of the first candidate mode is determined in the preset angle prediction mode set, and the replacement mode is determined as the filtered candidate mode.
[0118] Furthermore, in the present application, if the first candidate mode is not an intra-frame angular prediction mode, the decoder may directly delete the first candidate mode.
[0119] It is understandable that in the present application, since the preset angle prediction mode set to which the first intra-frame prediction mode and the second intra-frame prediction mode belong is a subset of all intra-frame angle prediction modes and does not include intra-frame non-angle prediction modes, the selection of the most likely mode MPM of the current block, that is, the method of constructing the MPM list, for the intra-frame weighted combination prediction mode also needs to be adjusted accordingly. Specifically, the decoder needs to refer to the intra-frame prediction mode of the adjacent blocks around the current block when constructing the MPM list. The surrounding adjacent blocks include the left adjacent block, the upper adjacent block, the upper left adjacent block, the upper right adjacent block, the lower left adjacent block, etc. Due to spatial correlation, the surrounding adjacent blocks use a certain prediction mode, and the current block has a higher probability of using the same or similar prediction mode.
[0120] Optionally, since the first intra-frame prediction mode and the second intra-frame prediction mode of the intra-frame weighted combination prediction mode can only be intra-frame angle prediction modes, when the intra-frame prediction mode used by a reference adjacent block is an intra-frame non-angle prediction mode, that is, the first candidate mode is not an intra-frame angle prediction mode, then the decoder will not use the intra-frame non-angle prediction mode used by this reference block when constructing the MPM list of the current block, that is, the intra-frame non-angle prediction mode will not be added to the MPM list of the current block.
[0121] Optionally, since the preset angle prediction mode set to which the first intra-frame prediction mode and the second intra-frame prediction mode belong is a subset of all intra-frame angle prediction modes, when the intra-frame prediction mode used by a reference adjacent block is an intra-frame angle prediction mode outside the preset angle prediction mode set, that is, the first candidate mode is an intra-frame angle prediction mode and does not belong to the preset angle prediction mode set, then when constructing the MPM list of the current block, the decoder can convert the intra-frame angle prediction mode outside the preset angle prediction mode set into an intra-frame angle prediction mode with a similar angle within the preset angle prediction mode set, and then add it to the MPM list. Taking AVS3 as an example, if the preset angle prediction mode set restricts the first intra-frame prediction mode and the second intra-frame prediction mode to only use intra-frame angle prediction modes No. 4-31, and the adjacent block of the current block uses intra-frame angle prediction mode No. 43, then the decoder can add intra-frame angle prediction No. 12, which is similar to intra-frame angle prediction No. 43, to the MPM list of the current block in the intra-frame weighted combination prediction mode.
[0122] Furthermore, in an embodiment of the present application, when the decoder constructs an MPM list based on the filtered candidate mode and the second candidate mode, if the filtered candidate mode meets the preset addition condition, the filtered candidate mode is added to the MPM list; if the MPM list does not meet the preset list length L, and the second candidate mode meets the preset addition condition, the second candidate mode is added to the MPM list; wherein L is an integer greater than or equal to 1.
[0123] Exemplarily, in the present application, the value of L may be 4, that is, the preset list length of the MPM list is 4, or in other words, the MPM list includes 4 most probable modes.
[0124] It can be understood that, in the embodiment of the present application, the decoder can sort the L modes in the MPM list in ascending order of mode numbers.
[0125] It should be noted that in an embodiment of the present application, if the filtered candidate mode is different from the prediction mode in the MPM list, then the decoder can determine that the filtered candidate mode meets the preset addition condition; accordingly, if the second candidate mode is different from the prediction mode in the MPM list, then the decoder can determine that the second candidate mode meets the preset addition condition.
[0126] It is understandable that in an embodiment of the present application, when the decoder adds the filtered candidate modes corresponding to the adjacent blocks to the MPM list, it can determine the order parameters corresponding to the adjacent blocks; and according to the order parameters, the intra-frame filtered candidate modes corresponding to the adjacent blocks are added to the MPM list in sequence. The decoder can determine the corresponding order parameters according to the spatial distance between the adjacent blocks and the current block. For example, the closer the spatial distance between the adjacent block and the current block, the stronger the correlation between the two, the earlier the addition process is performed, that is, the smaller the order parameter; the farther the spatial distance between the adjacent block and the current block, the weaker the correlation between the two, the later the addition process is performed, that is, the larger the order parameter.
[0127] Furthermore, in an embodiment of the present application, after adding the filtered candidate mode and / or the second candidate mode to the MPM list, the decoder may also sort the L prediction modes in the MPM list in ascending order of mode numbers.
[0128] For example, in this application, it is assumed that the MPM list of the current block in the intra-frame weighted combination prediction mode is IwcpMpm[4], that is, the list length of the MPM list is 4, the index of the weight matrix derivation mode is IwcpIndex, the weight matrix derivation mode reuses the 56 derivation modes of AWP, and the preset angle prediction mode set to which the first intra-frame prediction mode and the second intra-frame prediction mode belong is the intra-frame angle prediction mode No. 4-31. Then, when constructing the MPM list of the current block, the decoder can perform the following steps in sequence:
[0129] Step S1: Set the array cand_mode
[10] and initialize all values of cand_mode to invalid values. Perform the following operations on cand_mode:
[0130] (a) If the neighboring block F "exists" and is a normal intra-frame predicted block, cand_mode[0] is equal to the intra-frame prediction mode of F,
[0131] (b) If the neighboring block G "exists" and is a normal intra-frame predicted block, cand_mode[1] is equal to the intra-frame prediction mode of G,
[0132] (c) If the neighboring block C "exists" and is a normal intra-frame predicted block, cand_mode[2] is equal to the intra-frame prediction mode of C,
[0133] (d) If the neighboring block A "exists" and is a normal intra-frame prediction block, cand_mode[3] is equal to the intra-frame prediction mode of A,
[0134] (e) If the neighboring block B "exists" and is a normal intra-frame predicted block, cand_mode[4] is equal to the intra-frame prediction mode of B,
[0135] (f) If the neighboring block D "exists" and is a normal intra-frame predicted block, cand_mode[5] is equal to the intra-frame prediction mode of D,
[0136] (g) cand_mode[6] is equal to candidate mode 0 corresponding to IwcpIndex%8,
[0137] (h) cand_mode[7] is equal to candidate mode 1 corresponding to IwcpIndex%8,
[0138] (i) cand_mode[8] is equal to candidate mode 2 corresponding to IwcpIndex%8,
[0139] (j) cand_mode[9] is equal to candidate mode 3 corresponding to IwcpIndex%8,
[0140] Here, the presence of a neighboring block X (where X is A, B, C, D, F, or G) means that the block must be within the image and belong to the same slice as block E. Otherwise, the neighboring block is not present. If the block is not present or has not yet been decoded, the block is not available. Otherwise, the block is available. If the block containing a sample in the image is not present or the sample has not yet been decoded, the sample is not available. Otherwise, the sample is available.
[0141] It can be understood that in the present application, the execution steps (a) to (f) above are the process of determining the first candidate mode; the execution steps (g) to (j) above are the process of determining the second candidate mode, wherein the decoder can refer to Table 2 above to determine the second candidate mode.
[0142] Step S2: For i from 0 to 5, perform the following operations:
[0143] (a) If cand_mode[i] is less than 3 or cand_mode[i] is equal to 33, cand_mode[i] is set to an invalid value,
[0144] That is, if the first candidate mode is an intra non-angular prediction mode, the decoder may directly delete the first candidate mode, ie, not use the first candidate mode.
[0145] (b) Otherwise, if cand_mode[i] is equal to 3, set cand_mode[i] to 4.
[0146] (c) Otherwise, if cand_mode[i] is equal to 32, set cand_mode[i] to 31.
[0147] (d) Otherwise, if cand_mode[i] is greater than 33, perform the following operations:
[0148] If cand_mode[i] is less than 44, let cand_mode[i] equal to cand_mode[i]-30,
[0149] Otherwise, if cand_mode[i] is less than 58, let cand_mode[i] equal to cand_mode[i]-33,
[0150] Otherwise, let cand_mode[i] equal to cand_mode[i]-34,
[0151] That is to say, if the first candidate mode is an intra-frame angle prediction mode, but the first candidate mode does not belong to the preset angle prediction mode set, then the decoder can select a similar intra-frame angle prediction mode in the preset angle prediction mode set as a replacement mode for the first candidate mode, and then use the replacement mode as the filtered candidate mode.
[0152] (e) Otherwise, the value of cand_mode[i] is not modified.
[0153] That is to say, if the first candidate mode belongs to the preset angle prediction mode set, the decoder can directly use the first candidate mode, that is, the first candidate mode is the filtered candidate mode.
[0154] It can be understood that, in the present application, the above step S2 is the screening process of the first candidate mode, and the screened candidate mode corresponding to the first candidate mode is finally determined.
[0155] Step S3: Set mpm_num to 0, and for i from 0 to 9, perform the following operations:
[0156] (a) If cand_mode[i] is not an invalid value, then perform the following operations:
[0157] Compare cand_mode[i] with IwcpMpm[j], where j is from 0 to mpm_num-1. If cand_mode[i] is not equal to IwcpMpm[j], perform the following operations:
[0158] 1. Let IwcpMpm[mpm_num] be equal to cand_mode[i],
[0159] 2. Let mpm_num be equal to mpm_num+1,
[0160] 3. If mpm_num is equal to 4, end step 3.
[0161] That is to say, under the premise that there are less than 4 prediction modes in the MPM list, if the filtered candidate mode is different from any prediction mode in the MPM list, the decoder can add the filtered candidate mode to the MPM list; if after all the filtered candidate modes that meet the preset addition conditions are added to the MPM list, the prediction modes in the MPM list are still less than 4, the decoder can continue to add the second candidate mode that meets the preset addition conditions to the MPM list until the list length of the MPM list reaches 4.
[0162] Step S4: Sort the four numbers of IwcpMpm[4] from small to large.
[0163] Finally, the decoder can sort the four intra-frame angle prediction modes in the MPM list in ascending order of mode numbers.
[0164] It is understandable that the present application does not limit the execution order of the above steps 102 and 103, that is, it does not limit the order between the determination process of the first mode index and the second mode index and the construction process of the MPM list.
[0165] Step 104 : Determine a first intra prediction mode and a second intra prediction mode for the current block according to the first mode index, the second mode index, and the MPM list; wherein the first intra prediction mode and the second intra prediction mode are two different intra angular prediction modes.
[0166] In an embodiment of the present application, after the decoder determines the first mode index and the second mode index of the current block and completes the construction of the MPM list of the current block, it can further determine the first intra-frame prediction mode and the second intra-frame prediction mode of the current block based on the first mode index, the second mode index and the MPM list.
[0167] It is understood that, in the embodiment of the present application, the first intra-frame prediction mode and the second intra-frame prediction mode can be two different intra-frame angular prediction modes. Specifically, in the embodiment of the present application, the first intra-frame prediction mode and the second intra-frame prediction mode can be two different intra-frame angular prediction modes in a preset angular prediction mode set.
[0168] That is to say, in this application, the first intra-frame prediction mode and the second intra-frame prediction mode can only be intra-frame angle prediction modes, that is, the first intra-frame prediction mode and the second intra-frame prediction mode are not other basic intra-frame prediction modes other than the intra-frame angle prediction mode, such as intra-frame non-angle prediction modes, including DC mode, Planar mode, PLANE mode, Bilinear mode, PCM mode, etc. Among them, the basic intra-frame prediction mode includes but is not limited to angle prediction mode and non-angle prediction mode. For example, there are 67 intra-frame prediction modes used by VVC and 66 intra-frame prediction modes used by AVS3.
[0169] It can be understood that in the present application, the restriction of the intra-frame angle prediction mode to the first intra-frame prediction mode and the second intra-frame prediction mode can, on the one hand, reduce the hardware implementation complexity of the intra-frame weighted combination prediction mode, because when the hardware implements the intra-frame weighted combination prediction mode in a parallel manner, only a new set of circuits supporting intra-frame angle weighted prediction needs to be added; on the other hand, because the block content applicable to the intra-frame weighted combination prediction mode itself is relatively complex, and the intra-frame non-angle prediction mode usually copes with scenes with relatively uniform texture changes, and fewer modes can be used to reduce overhead, so the use or non-use of the intra-frame non-angle prediction mode in the intra-frame weighted combination prediction mode has almost no effect on the compression performance.
[0170] Furthermore, in the present application, although the more intra-frame angle prediction modes that are available, the more accurate the prediction value, the correspondingly greater the overhead of transmitting the flag of the selected mode in the code stream. Therefore, in order to obtain better compression performance, a reasonable set of available intra-frame prediction modes can be selected to achieve a better trade-off between prediction effect and overhead. Specifically, the decoder can use a preset angle prediction mode set to limit the intra-frame angle prediction modes available for the first intra-frame prediction mode and the second intra-frame prediction mode, wherein the preset angle prediction mode set is a subset of all intra-frame angle prediction modes. Taking AVS3 as an example, AVS3 has 62 angle modes, namely, intra-frame angle prediction modes with mode numbers 3-32 and 34-65.
[0171] Exemplarily, in the present application, the first intra-frame prediction mode and the second intra-frame prediction mode may only use the intra-frame angle prediction modes with mode numbers 3-32, or the first intra-frame prediction mode and the second intra-frame prediction mode may only use 28 intra-frame angle prediction modes with mode numbers 4-31.
[0172] Exemplarily, in the present application, taking VVC as an example, the first intra-frame prediction mode and the second intra-frame prediction mode may only use the intra-frame angle prediction mode with an even mode number, or the first intra-frame prediction mode and the second intra-frame prediction mode may only use the intra-frame angle prediction mode with an odd mode number.
[0173] Exemplarily, in the present application, the angle prediction mode set used by the first intra-frame prediction mode and the angle prediction mode set used by the second intra-frame prediction mode are different. Optionally, the decoder can use the same preset angle prediction mode set to restrict the first intra-frame prediction mode and the second intra-frame prediction mode, that is, if the first intra-frame prediction mode can only use 28 intra-frame angle prediction modes with mode numbers 4-31, the second intra-frame prediction mode can also only use 28 intra-frame angle prediction modes with mode numbers 4-31, and then the first intra-frame prediction mode and the second intra-frame prediction mode can use the same MPM list and use the same or similar encoding and decoding methods. That is to say, if the decoder uses different preset angle prediction mode sets to restrict the first intra-frame prediction mode and the second intra-frame prediction mode, then it is necessary to use different MPM lists or use significantly different encoding and decoding methods for the first intra-frame prediction mode and the second intra-frame prediction mode.
[0174] Furthermore, in an embodiment of the present application, the decoder may determine a first mapping relationship table between index values and binary symbol strings; wherein the first mapping relationship table includes binary symbol strings of a first length, a second length, and a third length, respectively.
[0175] Exemplarily, in this application, the first length is 3 bits, the second length is 5 bits, and the third length is 6 bits.
[0176] It should be noted that, in the present application, the first mapping relationship table between index values and binary symbol strings can be used to determine the values of the first mode index and the second mode index.
[0177] Optionally, in the present application, for AVS3, if 28 intra-frame angle prediction modes with mode numbers 4-31 are used, that is, the preset angle prediction mode set includes a total of 28 modes, then a 4+8+16 encoding format can be used, that is, a mode with 4 shortest codewords, a mode with 8 shorter codewords, and a mode with 16 longer codewords. Among them, the mode with 4 shortest codewords uses a 3-bit codeword, that is, uses the first length, the mode with 8 shorter codewords uses a 5-bit codeword, that is, uses the second length, and the mode with 16 longer codewords uses a 6-bit codeword, that is, uses the third length.
[0178] It should be noted that in the present application, the prediction angles of the 28 intra-frame angle prediction modes with mode numbers 4-31 basically cover the entire commonly used angle range. At the same time, the intra-frame angle prediction modes with mode numbers 4-31 are simpler than the intra-frame angle prediction modes with mode numbers 34-65, and the use of these 28 modes to encode in the form of 4+8+16 will not cause waste of codewords. Therefore, the decoder can preferably define a preset angle prediction mode set according to the 28 intra-frame angle prediction modes with mode numbers 4-31.
[0179] Furthermore, in an embodiment of the present application, if the list length of the MPM list of the current block is 4, then the 4 most likely modes in the MPM list can correspond to the use of a binary symbol string of the first length, that is, the 4 shortest codeword modes can be used for the 4 MPMs in the MPM list; accordingly, other prediction modes in the preset angle prediction mode set and outside the MPM list can respectively use a binary symbol string of the second length and a binary symbol string of the third length.
[0180] Optionally, in the present application, for the other 24 intra-frame angle prediction modes other than the 4 MPMs in the MPM list in the preset angle prediction mode set, the decoder can evenly distribute the patterns of shorter codewords and longer codewords. Specifically, the decoder can evenly distribute the patterns of 8 shorter codewords (binary symbol strings of the second length) in the remaining 24 intra-frame angle prediction modes. For example, a pattern of 1 shorter codeword (binary symbol string of the second length) is used for every pattern of 2 longer codewords (binary symbol strings of the third length). Furthermore, in the specific implementation process, it can be achieved by modulo 3 (% 3) of the sequence numbers from 0-23 in the remaining 24 intra-frame angle prediction modes, for example, the pattern of the sequence number modulo 3 with a remainder of 2 uses a 5-bit codeword, that is, a binary symbol string of the second length is used, and the sequence number modulo 3 with a remainder of 0 or 1 uses a 6-bit codeword, that is, a binary symbol string of the third length is used.
[0181] For example, in the present application, if 28 intra-frame angle prediction modes with mode numbers 4-31 are used, that is, the preset angle prediction mode set includes a total of 28 modes, then the first mapping relationship table between the index value and the binary symbol string can be as shown in Table 3, where the first length is 3 bits, the second length is 5 bits, and the third length is 6 bits.
[0182] Table 3
[0183]
[0184] The first bit can be used to indicate whether it is an MPM, for example, "1" indicates MPM and "0" indicates not MPM. If the first intra prediction mode is MPM, assuming that the MPM list includes 4 MPMs, then 2 bits can be used to indicate which MPM in the MPM list is used, that is, "00, 01, 10, 11" respectively represent the first MPM, the second MPM, the third MPM, and the fourth MPM in the MPM list.
[0185] Furthermore, in this application, a context model is used to decode a binary symbol string whose bit flag is 0, and a context model is not used to decode a binary symbol string whose bit flag is not 0. The value of the bit flag can indicate how many bits have been decoded, and the bit flag can be represented by binIdx.
[0186] It should be noted that in this application, on the decoding side, when debinarization is performed according to Table 3, the binary symbol string with binIdx being 0 can be decoded using the context model, while the binary symbol string with binIdx not being 0 can be decoded using the equal probability model or the bypass mode.
[0187] Furthermore, in the present application, when the decoder determines the first intra-frame prediction mode and the second intra-frame prediction mode of the current block according to the first mode index, the second mode index, and the MPM list, it may first determine the value i of the first mode index according to a first mapping relationship table between index values and binary symbol strings; wherein i is an integer greater than or equal to 0. If i is greater than or equal to 0 and less than L, the (i+1)th angular prediction mode in the MPM list is determined as the first intra-frame prediction mode; if i is greater than or equal to L, the first intra-frame prediction mode is determined using the preset angular prediction mode set and the MPM list.
[0188] Specifically, in the present application, when the decoder uses the preset angle prediction mode set and the MPM list to determine the first intra-frame prediction mode, if i is greater than or equal to the mode number of the first mode in the MPM list, i and 1 are summed; if (i+1) is greater than or equal to the mode number of the second mode in the MPM list, (i+1) and 1 are summed; if (i+2) is greater than or equal to the mode number of the third mode in the MPM list, (i+2) and 1 are summed; if (i+3) is greater than or equal to the mode number of the fourth mode in the MPM list, (i+3) and 1 are summed; (i+4) is determined as the mode number of the first intra-frame prediction mode, and the first intra-frame prediction mode is determined in the preset angle prediction mode set.
[0189] Accordingly, in the present application, when the decoder uses the preset angle prediction mode set and the MPM list to determine the first intra-frame prediction mode, if i is less than the mode number of the first mode in the MPM list, i is determined as the mode number of the first intra-frame prediction mode, and the first intra-frame prediction mode is determined in the preset angle prediction mode set; or, if (i+1) is less than the mode number of the second mode in the MPM list, (i+1) is determined as the mode number of the first intra-frame prediction mode, and the first intra-frame prediction mode is determined in the preset angle prediction mode set; or, if (i+2) is less than the mode number of the third mode in the MPM list, (i+2) is determined as the mode number of the first intra-frame prediction mode, and the first intra-frame prediction mode is determined in the preset angle prediction mode set; or, if (i+3) is less than the mode number of the fourth mode in the MPM list, (i+3) is determined as the mode number of the first intra-frame prediction mode, and the first intra-frame prediction mode is determined in the preset angle prediction mode set.
[0190] Exemplarily, in the present application, if the mode numbers of the four MPMs in the MPM list are 4, 8, 12, and 16 respectively, and the value of the first mode index i determined based on the first mapping relationship table between the index value and the binary symbol string shown in Table 3 above is 5, then in the preset angle prediction mode set including 28 intra-frame angle prediction modes with mode numbers 4-31, i is compared with the mode numbers of the four MPMs in the MPM list in turn. Specifically, 5 is greater than the mode number of the first mode in the MPM list, then the decoder can determine to add 1 to i, that is, i+1=6, and then compare 6 with the mode number of the second mode in the MPM list. 6 is less than 8, then the value 6 of (i+1) can be determined as the mode number of the first intra-frame prediction mode, and the intra-frame angle prediction mode with mode number 6 in the preset angle prediction mode set can be determined as the first intra-frame prediction mode.
[0191] Exemplarily, in the present application, if the mode numbers of the four MPMs in the MPM list are 4, 8, 12, and 16, respectively, and the value i of the first mode index determined based on the first mapping relationship table between the index value and the binary symbol string as shown in Table 3 above is 10, then in the preset angle prediction mode set including 28 intra-frame angle prediction modes with mode numbers 4-31, i is compared with the mode numbers of the four MPMs in the MPM list in turn. Specifically, if 10 is greater than the mode number of the first mode in the MPM list, then the decoder can determine to add 1 to i, that is, i+1=11, and then compare 11 with the mode number of the second mode in the MPM list. , 11 is greater than 8, then the decoder can determine to add 1 to (i+1), that is, (i+1)+1=12, and then compare 12 with the mode number of the third mode in the MPM list. 12 is equal to 12, then the decoder can determine to add 1 to (i+2), that is, (i+2)+1=13, and then compare 12 with the mode number of the fourth mode in the MPM list. 13 is less than 16, then the value 13 of (i+3) can be determined as the mode number of the first intra-frame prediction mode, and the intra-frame angle prediction mode with mode number 13 in the preset angle prediction mode set can be determined as the first intra-frame prediction mode.
[0192] Furthermore, in the present application, when the decoder determines the first intra-frame prediction mode and the second intra-frame prediction mode of the current block according to the first mode index, the second mode index, and the MPM list, it may first determine the value j of the second mode index according to the first mapping relationship table; wherein j is an integer greater than or equal to 0. If j is greater than or equal to 0 and less than L, the (j+1)th angular prediction mode in the MPM list is determined as the second intra-frame prediction mode; if j is greater than or equal to L, the second intra-frame prediction mode is determined using the preset angular prediction mode set and the MPM list.
[0193] Specifically, in the present application, when the decoder uses the preset angle prediction mode set and the MPM list to determine the second intra-frame prediction mode, if j is greater than or equal to the mode number of the first mode in the MPM list, j and 1 are summed; if (j+1) is greater than or equal to the mode number of the second mode in the MPM list, (j+1) and 1 are summed; if (j+2) is greater than or equal to the mode number of the third mode in the MPM list, (j+2) and 1 are summed; if (j+3) is greater than or equal to the mode number of the fourth mode in the MPM list, (j+3) and 1 are summed; (j+4) is determined as the mode number of the second intra-frame prediction mode, and the second intra-frame prediction mode is determined in the preset angle prediction mode set.
[0194] Accordingly, in the present application, when the decoder uses the preset angular prediction mode set and the MPM list to determine the second intra-frame prediction mode, if j is less than the mode number of the first mode in the MPM list, j is determined as the mode number of the second intra-frame prediction mode, and the second intra-frame prediction mode is determined in the preset angular prediction mode set; or, if (j+1) is less than the mode number of the second mode in the MPM list, (j+1) is determined as the mode number of the second intra-frame prediction mode, and the second intra-frame prediction mode is determined in the preset angular prediction mode set; or, if (j+2) is less than the mode number of the third mode in the MPM list, (j+2) is determined as the mode number of the second intra-frame prediction mode, and the second intra-frame prediction mode is determined in the preset angular prediction mode set; or, if (j+3) is less than the mode number of the fourth mode in the MPM list, (j+3) is determined as the mode number of the second intra-frame prediction mode, and the second intra-frame prediction mode is determined in the preset angular prediction mode set.
[0195] Exemplarily, in the present application, if the current block uses the IWCP mode, the length of the MPM list of the current block is 4, that is, L=4, and the preset angle prediction mode set includes 28 intra-frame angle prediction modes with mode numbers 4-31. The decoder decodes the code stream to determine the first mode index iwcp_pred_mode0_index and the second mode index iwcp_pred_mode1_index, and then derives the first intra-frame prediction mode as IwcpPredMode0 and the second intra-frame prediction mode as IwcpPredMode1 according to the first mode index iwcp_pred_mode0_index and the second mode index iwcp_pred_mode1_index.
[0196] When the decoder determines the first intra prediction mode IwcpPredMode0 using the first mode index iwcp_pred_mode0_index, it may specifically perform the following operations:
[0197] 1. Debinarize the binary symbol string according to Table 3 and determine the value of iwcp_pred_mode0_index to be i.
[0198] Specifically, after determining the iwcp_pred_mode0_index in the form of a binary symbol string according to decoding, the binary symbol string can be debinarized according to Table 3, that is, a matching binary symbol string is found from the right column of Table 3 according to iwcp_pred_mode0_index, and then the value i of iwcp_pred_mode0_index is determined from the left column of the same row.
[0199] 2. If i is greater than or equal to 0 and less than 4, then IwcpPredMode0 is equal to IwcpMpm[i].
[0200] 3. If i is greater than or equal to 4, then IwcpPredMode0 is equal to (iwcp_pred_mode0_index + (iwcp_pred_mode0_index>=IwcpMpm[0]) + ((iwcp_pred_mode0_index+1)>=IwcpMpm[1]) + ((iwcp_pred_mode0_index+2)>=IwcpMpm[2]) + ((iwcp_pred_mode0_index+3)>=IwcpMpm[3])).
[0201] That is to say, in this application, if the first intra-frame prediction mode IwcpPredMode0 does not belong to the MPM list, but is one of the other 24 intra-frame angle prediction modes in the preset angle prediction mode set and other than the MPM in the MPM list, then the decoder can compare the value i of the first mode index iwcp_pred_mode0_index with the mode number of each angle prediction mode in the MPM list in turn, and choose whether to perform the addition operation based on the comparison result, and finally calculate the mode number of the first intra-frame prediction mode, and determine the first intra-frame prediction mode in the preset angle prediction mode set according to the mode number.
[0202] When the decoder determines the second intra prediction mode IwcpPredMode1 using the second mode index iwcp_pred_mode1_index, the decoder may specifically perform the following operations:
[0203] 1. Debinarize the binary symbol string according to Table 3 and determine the value of iwcp_pred_mode1_index to be j.
[0204] Specifically, after determining the iwcp_pred_mode1_index in the form of a binary symbol string according to decoding, the binary symbol string can be debinarized according to Table 3, that is, a matching binary symbol string is found from the right column of Table 3 according to iwcp_pred_mode1_index, and then the value j of iwcp_pred_mode1_index is determined from the left column of the same row.
[0205] 2. If j is greater than or equal to 0 and less than 4, then IwcpPredMode1 is equal to IwcpMpm[i].
[0206] 3. If j is greater than or equal to 4, then IwcpPredMode1 is equal to
[0207] (iwcp_pred_mode1_index+(iwcp_pred_mode1_index>=IwcpMpm[0])+((iwcp_pred_mode1_index+1)> =IwcpMpm[1])+((iwcp_pred_mode1_index+2)>=IwcpMpm[2])+((iwcp_pred_mode1_index+3)>=IwcpM pm[3])).
[0208] Furthermore, in an embodiment of the present application, since the intra-frame weighted combination prediction mode needs to use the first intra-frame prediction mode and the second intra-frame prediction mode to determine the prediction value of the current block, wherein the first intra-frame prediction mode and the second intra-frame prediction mode can share a preset angle prediction mode set and can also share the same MPM list, but the first intra-frame prediction mode and the second intra-frame prediction mode in the intra-frame weighted combination prediction mode are not the same. Therefore, when encoding and decoding the second intra-frame prediction mode, the first intra-frame prediction mode can be referred to. Specifically, when determining the second intra-frame prediction mode, the first intra-frame prediction mode can be excluded.
[0209] It is understandable that in the present application, for the 28 intra-frame angle prediction modes, since in the above-mentioned 4+8+16 encoding and decoding method, the probability of the 4 MPMs in the MPM list appearing is very high (the probability that the first intra-frame prediction mode is one of the 4 MPMs in the MPM list is about 50%, and the probability that the second intra-frame prediction mode is one of the 4 MPMs in the MPM list is about 50%), if the first intra-frame prediction mode and the second intra-frame prediction mode are both MPMs in the MPM list, then when determining the second intra-frame prediction mode, only one of the other 3 MPMs in the MPM list other than the first intra-frame prediction mode can be selected. In this way, the original 4-choose-1, which requires 4 3-bit codewords, can be changed to 3-choose-1, which requires 1 2-bit codeword and 2 3-bit codewords. Correspondingly, if the first intra-frame prediction mode and the second intra-frame prediction mode are not MPMs in the MPM list, then the second intra-frame prediction mode can also remove 1 from the 24 intra-frame angle prediction modes of 8+16, but the impact of this is relatively small.
[0210] It can be seen from this that when the first intra-frame prediction mode and the second intra-frame prediction mode are both MPMs in the MPM list, it is possible to choose to perform deletion processing on the first intra-frame prediction mode when determining the second intra-frame prediction mode, thereby reducing overhead.
[0211] Further, in an embodiment of the present application, if the first intra-frame prediction mode is an MPM in the MPM list, that is, the decoder determines that the value i of the first mode index is greater than or equal to 0 and less than L, then after determining the (i+1)th angle prediction mode in the MPM list as the first intra-frame prediction mode, when determining the second intra-frame prediction mode, the decoder can determine the value j of the second mode index according to the second mapping relationship table between the index value and the binary symbol string; if j is greater than or equal to i, then add 1 to j; after performing the self-addition operation, if j is greater than or equal to 0 and less than L, then determine the (j+1)th angle prediction mode in the MPM list as the second intra-frame prediction mode; if j is greater than or equal to L, then use the preset angle prediction mode set and the MPM list to determine the second intra-frame prediction mode.
[0212] Furthermore, in an embodiment of the present application, the decoder may determine a second mapping relationship table between index values and binary symbol strings; wherein the second mapping relationship table includes binary symbol strings of first length, second length, third length and fourth length respectively.
[0213] Illustratively, in this application, the first length is 3 bits, the second length is 5 bits, the third length is 6 bits, and the fourth length is 2 bits.
[0214] It should be noted that, in the present application, the second mapping relationship table between index values and binary symbol strings is only used to determine the value of the second mode index.
[0215] Optionally, in the present application, the second mapping relationship table between index values and binary symbol strings can be as shown in Table 4, where the first length is 3 bits, the second length is 5 bits, the third length is 6 bits, and the fourth length is 2 bits.
[0216] Table 4
[0217]
[0218] The length of the MPM list is 4, and the preset angle prediction mode set includes 28 intra-frame angle prediction modes with mode numbers 4-31. The decoder can determine the first mode index iwcp_pred_mode0_index and the second mode index iwcp_pred_mode1_index by decoding the code stream, and then derive the first intra-frame prediction mode as IwcpPredMode0 and the second intra-frame prediction mode as IwcpPredMode1 according to the first mode index iwcp_pred_mode0_index and the second mode index iwcp_pred_mode1_index.
[0219] It should be noted that in this application, on the decoding side, when debinarization is performed according to Table 4, the binary symbol string with binIdx being 0 can be decoded using the context model, while the binary symbol string with binIdx not being 0 can be decoded using the equal probability model or the bypass mode.
[0220] When the decoder determines the first intra prediction mode IwcpPredMode0 using the first mode index iwcp_pred_mode0_index, it may specifically perform the following operations:
[0221] 1. Debinarize the binary symbol string according to Table 3 and determine the value of iwcp_pred_mode0_index to be i.
[0222] 2. If i is greater than or equal to 0 and less than 4, then IwcpPredMode0 is equal to IwcpMpm[i].
[0223] 3. If i is greater than or equal to 4, then IwcpPredMode0 is equal to (iwcp_pred_mode0_index + (iwcp_pred_mode0_index>=IwcpMpm[0]) + ((iwcp_pred_mode0_index+1)>=IwcpMpm[1]) + ((iwcp_pred_mode0_index+2)>=IwcpMpm[2]) + ((iwcp_pred_mode0_index+3)>=IwcpMpm[3])).
[0224] When the decoder determines the second intra prediction mode IwcpPredMode1 using the second mode index iwcp_pred_mode1_index, the decoder may specifically perform the following operations:
[0225] 1. If i is greater than or equal to 0 and less than 4, perform the following operations:
[0226] (a) Debinarize the binary symbol string according to Table 4 and determine the value of iwcp_pred_mode1_index to be j;
[0227] (b) If iwcp_pred_mode1_index is greater than or equal to iwcp_pred_mode0_index, that is, j is greater than or equal to i, then iwcp_pred_mode1_index is equal to iwcp_pred_mode1_index+1, that is, j is incremented by 1, that is, j=j+1, and then step 3 is executed;
[0228] 2. If i is greater than or equal to 4, debinarize the binary symbol string according to Table 3, determine the value of iwcp_pred_mode1_index to be j, and then execute step 3;
[0229] 3. If j is greater than or equal to 0 and less than 4, then IwcpPredMode1 is equal to IwcpMpm[i].
[0230] 4. If j is greater than or equal to 4, then IwcpPredMode1 is equal to
[0231] (iwcp_pred_mode1_index+(iwcp_pred_mode1_index>=IwcpMpm[0])+((iwcp_pred_mode1_index+1)> =IwcpMpm[1])+((iwcp_pred_mode1_index+2)>=IwcpMpm[2])+((iwcp_pred_mode1_index+3)>=IwcpM pm[3])).
[0232] This shows that if the second intra-frame prediction mode needs to be determined based on the first intra-frame prediction mode, then the value j of iwcp_pred_mode1_index depends on the value i of iwcp_pred_mode0_index. Specifically, taking Table 4 as an example, if the first intra-frame prediction mode and the second intra-frame prediction mode are both MPMs in the MPM list, then there are only three MPMs available for the second intra-frame prediction mode, and then one or two bits can be used to indicate which MPM is which, such as "00, 01, 10" respectively representing the remaining first MPM, second MPM, and third MPM. It can be seen that since one possibility has been eliminated, the encoding and decoding method or the binarization or debinarization method can be changed to save overhead.
[0233] It should be noted that, in an embodiment of the present application, if the preset angle prediction mode set includes 28 intra-frame angle prediction modes with mode numbers 4-31, and the length of the MPM list is 4, then when using binary symbol strings of the first length, the second length, and the third length to determine the first mapping relationship table between the index value and the binary symbol string, the binary symbol string of the first length can be used for the 4 MPMs in the MPM list first, that is, the shortest codeword is used. Then, 8 intra-frame angle prediction modes are selected from the remaining 24 intra-frame angle prediction modes to use the binary symbol string of the second length, and 16 intra-frame angle prediction modes are selected to use the binary symbol string of the third length.
[0234] Specifically, in the present application, for the remaining 24 intra-frame angle prediction modes, shorter codewords can be used for the prediction modes corresponding to the first 8 mode numbers in order from small to large, that is, a binary symbol string of the second length is used, and then longer codewords can be used for the prediction modes corresponding to the next 16 mode numbers, that is, a binary symbol string of the third length is used.
[0235] Exemplarily, in the present application, the first mapping relationship table between index values and binary symbol strings shown in the above Table 3 can be replaced by the following Table 5, wherein Table 5 used to characterize the first mapping relationship between index values and binary symbol strings can also be used to determine the values of the first mode index and the second mode index.
[0236] Table 5
[0237]
[0238]
[0239] Accordingly, the second mapping relationship table between index values and binary symbol strings shown in the above Table 4 can also be replaced with the following Table 6, wherein Table 6 used to characterize the second mapping relationship between index values and binary symbol strings can also be used to determine the value of the second mode index.
[0240] Table 6
[0241]
[0242]
[0243] It can be understood that in the present application, if 28 intra-frame angle prediction modes with mode numbers 4-31 are used, that is, the preset angle prediction mode set includes a total of 28 modes, then encoding can be performed in the form of 4+8+16, that is, 4 3-bit codeword modes, 8 5-bit codeword modes, and 16 6-bit codeword modes.
[0244] Optionally, in the present application, if the preset angle prediction mode set includes 20 modes in total, then 4 3-bit codewords and 16 5-bit codewords can be used to represent them.
[0245] Optionally, in this application, if the preset angular prediction mode set includes 36 modes in total, four 3-bit codewords and 32 6-bit codewords may be used to represent them. For example, AVS3 uses 36 intra-frame angular prediction modes numbered 4-31, 42-45, and 56-59.
[0246] It should be noted that in the present application, if all modes in the preset angle prediction mode set are represented according to a set of binary symbol strings as shown in Table 3 and Table 4, then the "codeword" can be understood as a binary symbol string. The length of the codeword can be understood as the length of the binary symbol string. Another representation method is to use a flag bit (flag) plus a binary symbol string. For example, a binary MPM_flag is used to indicate whether the current mode is an MPM mode, that is, if the MPM_flag is 1, it indicates that the current mode is an MPM mode. If the MPM_flag is 0, it indicates that the current mode is not an MPM mode. If the current mode is an MPM mode, there are a total of 4 possibilities for MPM, and a 2-bit binary symbol string is used to indicate which MPM the current mode is. Then the codeword can be understood as a flag bit plus a binary symbol string, and the length of the codeword can be understood as the length of the flag bit plus the binary symbol string.
[0247] Step 105: Determine a weight matrix for the current block, and determine a prediction value for the current block based on the first intra prediction mode, the second intra prediction mode, and the weight matrix.
[0248] In an embodiment of the present application, the decoder needs to determine the weight matrix of the current block, so that after determining the first intra-frame prediction mode and the second intra-frame prediction mode used by the current block, it further determines the prediction value of the current block based on the first intra-frame prediction mode, the second intra-frame prediction mode and the weight matrix.
[0249] Specifically, in the present application, the decoder may determine the weight matrix of the current block according to the weight matrix derivation mode of the current block.
[0250] Furthermore, in the present application, when the decoder determines the prediction value of the current block based on the first intra-frame prediction mode, the second intra-frame prediction mode and the weight matrix, it can first determine the first prediction value of the current block according to the first intra-frame prediction mode; determine the second prediction value of the current block according to the second intra-frame prediction mode; and then use the weight matrix to perform a weighted operation on the first prediction value and the second prediction value to obtain the prediction value of the current block.
[0251] It is understood that in the present application, the first intra-frame prediction mode and the second intra-frame prediction mode can both be intra-frame angle prediction modes, that is, the embodiment of the present application uses two different intra-frame angle prediction modes. The first intra-frame prediction mode and the second intra-frame prediction mode are then combined to generate a first prediction block and a second prediction block, respectively. Then, based on the first prediction block and the second prediction block, combined with a weight matrix, a prediction block for the current block is determined.
[0252] Furthermore, in an embodiment of the present application, not all points in all possible weight matrices have the same weight. In other words, at least one possible weight matrix contains at least two different weight values.
[0253] It should be noted that in the embodiments of the present application, the decoder can use a method similar to GPM or AWP to determine the weight matrix. Specifically, if GPM or AWP is used in the same codec standard or codec, this method can be used to determine the weight matrix, thereby reusing some of the same logic. For example, if AVS3 inter-frame prediction uses AWP, then the AWP method can be used in AVS3 to determine the weight matrix. Of course, different methods can also be used compared to GPM or AWP in the same codec standard or codec, such as using a different number of modes, a different transition region algorithm, or different parameters. Because inter-frame prediction utilizes temporal correlation, it uses the reconstructed image in the reference frame as the reference block. Intra-frame prediction, on the other hand, utilizes spatial correlation, using reconstructed pixels surrounding the current block as reference pixels. The closer the spatial distance, the stronger the correlation, while the farther the distance, the weaker the correlation. Therefore, if a weight matrix causes the pixel positions used in a predicted block to be far from the reference pixels, then this part may not produce more appropriate prediction values than existing methods. In this case, such a weight matrix can be omitted and used in inter-frame prediction.
[0254] An embodiment of the present application provides an intra-frame prediction method. The codec can determine two different prediction blocks of the current block through two different intra-frame angle prediction modes, and then combine them through various weight matrices to finally obtain a more complex prediction block. On the basis of improving the accuracy of intra-frame prediction, it can reduce the hardware implementation cost and complexity, and realize a simple and efficient coding and decoding method, thereby improving compression performance.
[0255] Based on the above embodiment, in another embodiment of the present application, the following prediction sample matrix is the prediction block mentioned above, that is, "block" can be understood as "sample matrix", and the array mentioned in the text means matrix. The prediction of the luminance component by IWCP can be taken as an example, but the present invention is not limited to the luminance component, and can also be used for chrominance components and any other components in any format. Taking the application of the intra-frame prediction method proposed in this application in AVS3 as an example, the specific process of the decoder using the intra-frame weighted combination prediction mode to determine the prediction value of the current block can be described as follows:
[0256] It should be noted that, in a specific decoding embodiment, since AWP technology is used in AVS3, the weight matrix of the intra-frame weighted combination prediction (IWCP) mode reuses the weight matrix of AWP, that is, the weight matrix derivation method of IWCP is the same as the weight matrix derivation method of AWP.
[0257] For example, a sequence-level flag may be used to determine whether the current sequence to be decoded uses the IWCP mode. For example:
[0258] The sequence header definition is shown in Table 7:
[0259] Table 7
[0260] Sequence header definition Descriptor sequence_header(){ …… iwcp_enable_flag u(1) ……
[0261] The flag for enabling the intra weighted combination prediction mode, iwcp_enable_flag, is a binary variable. Specifically, a value of '1' for iwcp_enable_flag indicates that the intra weighted combination prediction mode can be used; a value of '0' indicates that the intra weighted combination prediction mode should not be used. The value of iwcpEnableFlag is equal to iwcp_enable_flag. If iwcp_enable_flag is not present in the bitstream, the value of iwcpEnableFlag is 0.
[0262] For example, a frame-level flag can be used to determine whether the current frame to be decoded uses the IWCP mode. For example, intra-frames (such as I-frames) can be configured to use the IWCP mode, while inter-frames (such as B-frames and P-frames) can not use the IWCP mode. Alternatively, intra-frames can be configured to not use the IWCP mode, while inter-frames can use the IWCP mode. Alternatively, some inter-frames can be configured to use the IWCP mode, while others can be configured not to use the IWCP mode.
[0263] Exemplarily, a flag below the frame level and above the CU level (such as tile, slice, patch, LCU, etc.) can be used to determine whether this area uses the IWCP mode.
[0264] Exemplarily, the decoder decodes the current CU, and if the current CU meets the usage conditions of IWCP, decodes the IWCP usage flag of the current CU. Otherwise, there is no need to decode the IWCP usage flag of the current CU. The usage conditions of IWCP may be that the current CU is an intra-frame coded CU (IntraCuFlag below is 1) and the current sequence can use IWCP (IwcpEnableFlag below is 1) and the size of the current block meets the restrictions (width>=IwcpMinSize&&height>=IwcpMinSize&&width<=IwcpMaxSize&&height<=IwcpMaxSize below). One possible situation is that IwcpMinSize is equal to 8 and IwcpMaxSize is equal to 32. One possible situation is that IwcpMinSize is equal to 8 and IwcpMaxSize is equal to 16. Where width is the width of the current CU and height is the height of the current CU.
[0265] For example, for YUV4:2:0 encoding, an 8×8 luma block corresponds to a 4×4 chroma block at the same location. One possible approach is to allow the 8×8 luma block to use the IWCP mode but prohibit the 4×4 chroma block from using the IWCP mode. This is because the prediction effect of the 4×4 block in the IWCP mode is not significantly improved, and it also increases the hardware implementation cost.
[0266] For example, if the current CU uses IWCP, then the current CU will not use some other modes such as Derived Tree (DT), Intra Prediction Filter (IPF), Improved Intra Prediction (IIP), etc., that is, if the current CU uses IWCP, there is no need to process the relevant information of these modes. This is because the prediction effect after the superposition of IWCP and these modes cannot be significantly improved. On the contrary, if the current CU uses IWCP, the derived mode DT, intra prediction filter IPF, and improved intra prediction IIP are not used by default, and there is no need to transmit flags such as dt_split_flag, intra_pf_flag, and iip_flag in the bitstream to indicate whether they are used, which can save codewords and is beneficial to compression efficiency.
[0267] For example, as shown in Table 8 below:
[0268] Table 8
[0269]
[0270] The intra-frame weighted combination prediction flag, iwcp_flag, is a binary variable. A value of '1' indicates that the intra-frame weighted combination prediction mode should be used; a value of '0' indicates that the intra-frame weighted combination prediction mode should not be used. The value of iwcpFlag is equal to the value of iwcp_flag. If iwcp_flag is not present in the bitstream, the value of iwcpFlag is 0.
[0271] The derived mode split flag, dt_split_flag, is a binary variable. A dt_split_flag value of '1' indicates that derived mode splitting should be performed; a dt_split_flag value of '0' indicates that derived mode splitting should not be performed. The value of dtSplitFlag is equal to the value of dt_split_flag and ranges from 0 to 4. If dt_split_flag is not present in the bitstream, the value of dtSplitFlag is 0. Derivative mode splitting indicates that rectangular prediction units can be split based on the current CU.
[0272] The intra prediction filter flag, intra_pf_flag, is a binary variable. A value of '1' for intra_pf_flag indicates that intra prediction filtering should be used for the current coding unit; a value of '0' indicates that intra prediction filtering should not be used for the current coding unit. The value of intraPfFlag is equal to the value of intra_pf_flag. If intra_pf_flag is not present in the bitstream, the value of IntraPfFlag is 0. Intra prediction filtering can generate a new prediction value by filtering the initial prediction value using reference pixels after the initial prediction value is generated.
[0273] Among them, the improved intra-frame prediction flag iip_flag is a binary variable. The iip_flag value of '1' indicates that the current coding unit should use improved intra-frame prediction; the value of '0' indicates that the current coding unit should not use improved intra-frame prediction. The value of IipFlag is equal to the value of iip_flag. If iip_flag does not exist in the bitstream, the value of IipFlag is 0. Improved intra-frame prediction can use a different filter than when improved prediction is not used to generate prediction values. An example is that for a certain angle prediction, the improved intra-frame prediction uses an 8-tap filter to generate prediction values. When improved intra-frame prediction is not used, a 4-tap filter is used to generate prediction values.
[0274] For example, if the current CU uses IWCP, it is necessary to decode the code stream and determine the weight matrix derivation mode iwcp_idx and the first mode index iwcp_pred_mode0_index and the second mode index iwcp_pred_mode0_index of the two intra-frame prediction modes.
[0275] iwcp_pred_mode1_index is shown in Table 9 below. The weight matrix derivation mode reuses the weight matrix derivation mode of AWP.
[0276] Table 9
[0277]
[0278] The intra-frame weighted combination prediction mode index iwcp_idx is used to determine the weight matrix of the intra-frame weighted combination prediction mode. The value of IwcpIndex is equal to the value of iwcp_idx. If iwcp_idx does not exist in the bitstream, the value of IwcpIndex is equal to 0.
[0279] The first mode index iwcp_pred_mode0_index in the intra weighted combination prediction mode is used to determine the first intra prediction mode IwcpPredMode0 of the luminance block in the intra weighted combination prediction mode.
[0280] The second mode index iwcp_pred_mode1_index in the intra weighted combination prediction mode is used to determine the second intra prediction mode IwcpPredMode1 of the luminance block in the intra weighted combination prediction mode.
[0281] Further, after determining the first intra-frame prediction mode and the second intra-frame prediction mode, based on the method proposed in step 105 in the above embodiment, after determining the first intra-frame brightness prediction sample matrix predMatrixY0 according to IwcpPredMode0, determining the second intra-frame brightness prediction sample matrix predMatrixY1 according to IwcpPredMode1, and determining the brightness weight matrix IwcpWeightMatrixY according to IwcpIndex, the brightness weight matrix IwcpWeightMatrixY is used to perform a weighted operation on the first intra-frame brightness prediction sample matrix predMatrixY0 and the second intra-frame brightness prediction sample matrix predMatrixY1, and finally determine the brightness prediction sample matrix predMatrixIwcpY.
[0282] Specifically, when determining the brightness prediction sample matrix predMatrixIwcpY of the IWCP according to the two intra-frame brightness prediction sample matrices predMatrixY0 and predMatrixY1 and the weight matrix IwcpWeightMatrixY, the specific method is as follows:
[0283] The value of the element predMatrixIwcpY[x][y] in the prediction sample matrix predMatrixIwcpY of the intra-frame weighted combination prediction mode is ((predMatrixY0[x][y]*IwcpWeightMatrixY[x][y]+predMatrixY1[x][y]*(8-IwcpWeightMatrixY[x][y])+4)>>3). Where (x, y) is the coordinate position within the current block.
[0284] Furthermore, after determining the prediction block of IWCP, that is, the prediction sample matrix predMatrixIwcpY of the intra-frame weighted combination prediction mode, subsequent processing can also include decoding of quantization coefficients, inverse transformation, inverse quantization to determine the residual block, and combining the residual block and the prediction block into a reconstructed block, as well as subsequent loop filtering, etc.
[0285] An embodiment of the present application provides an intra-frame prediction method. The codec can determine two different prediction blocks of the current block through two different intra-frame angle prediction modes, and then combine them through various weight matrices to finally obtain a more complex prediction block. On the basis of improving the accuracy of intra-frame prediction, it can reduce the hardware implementation cost and complexity, and realize a simple and efficient coding and decoding method, thereby improving compression performance.
[0286] An embodiment of the present application proposes an intra-frame prediction method applied to an encoder. Figure 9 Schematic diagram of the implementation process of the intra-frame prediction method Figure 2 ,like Figure 9 As shown, the method for the encoder to perform intra-frame prediction may include the following steps:
[0287] Step 201: When the current block uses the IWCP mode to determine the intra prediction value of the current block, determine the first intra prediction mode and the second intra prediction mode of the current block; wherein the first intra prediction mode and the second intra prediction mode are two different intra angular prediction modes.
[0288] In an embodiment of the present application, if it is determined that the current block uses the IWCP mode to determine the intra-frame prediction value of the current block, then the encoder can first determine the first intra-frame prediction mode and the second intra-frame prediction mode of the current block; wherein the first intra-frame prediction mode and the second intra-frame prediction mode are two different intra-frame angle prediction modes.
[0289] It should be noted that, in an embodiment of the present application, the IWCP mode is an intra-frame prediction method. Specifically, the IWCP mode determines two different intra-frame angle prediction modes for the current block, and then determines two prediction blocks based on the two different intra-frame angle prediction modes. Then, a weight matrix can be determined, and the two prediction blocks are combined according to the weight matrix. Finally, a new prediction block can be obtained, that is, the prediction block of the current block is obtained.
[0290] Furthermore, in an embodiment of the present application, when the IWCP mode is applied, the size of the current block may be restricted.
[0291] It is understandable that since the intra-frame prediction method proposed in the embodiment of the present application requires using two different intra-frame angular prediction modes to generate two prediction blocks, and then weighting them according to the weight matrix to obtain a new prediction block, in order to reduce complexity and consider the trade-off between compression performance and complexity, in the embodiment of the present application, the IWCP mode can be restricted to certain sizes of prediction blocks. Therefore, in the present application, the encoder can first determine the size parameters of the current block, and then determine whether to use the IWCP mode for the current block based on the size parameters.
[0292] It should be noted that, in an embodiment of the present application, the size parameters of the current block may include the height and width of the current block. Therefore, the encoder can use the height and width of the current block to limit the use of the IWCP mode, that is, to limit the size of the prediction block that can use the IWCP mode.
[0293] For example, in this application, if both the width and height are greater than or equal to the first lower limit, and at the same time, both the width and height are less than or equal to the first upper limit, then it can be determined that the current block uses the IWCP mode. Thus, one possible limitation is to use the IWCP mode only when the width and height of the prediction block are less than (or less than or equal to) the first upper limit, and the width and height of the prediction block are greater than (or greater than or equal to) the first lower limit. The first lower limit can be 8, and the first upper limit can be 16, 32, or the like.
[0294] For example, for YUV4:2:0 encoding, an 8×8 luma block corresponds to a 4×4 chroma block at the same location. One possible approach is to allow the 8×8 luma block to use the IWCP mode but prohibit the 4×4 chroma block from using the IWCP mode. This is because the prediction effect of the 4×4 block in the IWCP mode is not significantly improved, and it also increases the hardware implementation cost.
[0295] For example, in this application, a frame-level flag may be provided to determine whether the current frame to be decoded uses the IWCP mode. For example, intra-frames (such as I-frames) may be configured to use the IWCP mode, while inter-frames (such as B-frames and P-frames) may not use the IWCP mode. Alternatively, intra-frames may be configured to not use the IWCP mode, while inter-frames may use the IWCP mode. Alternatively, some inter-frames may be configured to use the IWCP mode, while some inter-frames may not. Inter-frames may also use intra-frame prediction, and therefore, inter-frames may also use the IWCP mode.
[0296] For example, in the present application, there may be a flag below the frame level and above the CU level (such as tile, slice, patch, LCU, etc.) to determine whether this area uses the IWCP mode.
[0297] It can be understood that in an embodiment of the present application, the encoder can determine a combination of a minimum rate distortion intra-frame prediction mode and a weight matrix derivation mode, wherein the combination includes a first intra-frame prediction mode, a second intra-frame prediction mode, and a weight matrix derivation mode.
[0298] Furthermore, in an embodiment of the present application, the first intra-frame prediction mode and the second intra-frame prediction mode may be two different intra-frame angular prediction modes. Specifically, in an embodiment of the present application, the first intra-frame prediction mode and the second intra-frame prediction mode may be two different intra-frame angular prediction modes in a preset angular prediction mode set.
[0299] That is to say, in this application, the first intra-frame prediction mode and the second intra-frame prediction mode can only be intra-frame angle prediction modes, that is, the first intra-frame prediction mode and the second intra-frame prediction mode are not other basic intra-frame prediction modes other than the intra-frame angle prediction mode, such as intra-frame non-angle prediction modes, including DC mode, Planar mode, PLANE mode, Bilinear mode, PCM mode, etc. Among them, the basic intra-frame prediction mode includes but is not limited to angle prediction mode and non-angle prediction mode. For example, there are 67 intra-frame prediction modes used by VVC and 66 intra-frame prediction modes used by AVS3.
[0300] It can be understood that in the present application, the restriction of the intra-frame angle prediction mode to the first intra-frame prediction mode and the second intra-frame prediction mode can, on the one hand, reduce the hardware implementation complexity of the intra-frame weighted combination prediction mode, because when the hardware implements the intra-frame weighted combination prediction mode in a parallel manner, only a new set of circuits supporting intra-frame angle weighted prediction needs to be added; on the other hand, because the block content applicable to the intra-frame weighted combination prediction mode itself is relatively complex, and the intra-frame non-angle prediction mode usually copes with scenes with relatively uniform texture changes, and fewer modes can be used to reduce overhead, so the use or non-use of the intra-frame non-angle prediction mode in the intra-frame weighted combination prediction mode has almost no effect on the compression performance.
[0301] Furthermore, in the present application, although the more intra-frame angle prediction modes that can be used, the more accurate the prediction value can be, the correspondingly greater the overhead of transmitting the flag of the selected mode in the code stream. Therefore, in order to obtain better compression performance, a reasonable set of available intra-frame prediction modes can be selected to achieve a better trade-off between prediction effect and overhead. Specifically, the encoder can use a preset angle prediction mode set to limit the intra-frame angle prediction modes available for the first intra-frame prediction mode and the second intra-frame prediction mode, wherein the preset angle prediction mode set is a subset of all intra-frame angle prediction modes. Taking AVS3 as an example, AVS3 has 62 angle modes, namely, intra-frame angle prediction modes with mode numbers 3-32 and 34-65.
[0302] Exemplarily, in the present application, the first intra-frame prediction mode and the second intra-frame prediction mode may only use the intra-frame angle prediction modes with mode numbers 3-32, or the first intra-frame prediction mode and the second intra-frame prediction mode may only use 28 intra-frame angle prediction modes with mode numbers 4-31.
[0303] Exemplarily, in the present application, taking VVC as an example, the first intra-frame prediction mode and the second intra-frame prediction mode may only use the intra-frame angle prediction mode with an even mode number, or the first intra-frame prediction mode and the second intra-frame prediction mode may only use the intra-frame angle prediction mode with an odd mode number.
[0304] Exemplarily, in the present application, the angle prediction mode set used by the first intra-frame prediction mode and the angle prediction mode set used by the second intra-frame prediction mode are different. Optionally, the decoder can use the same preset angle prediction mode set to restrict the first intra-frame prediction mode and the second intra-frame prediction mode, that is, if the first intra-frame prediction mode can only use 28 intra-frame angle prediction modes with mode numbers 4-31, the second intra-frame prediction mode can also only use 28 intra-frame angle prediction modes with mode numbers 4-31, and then the first intra-frame prediction mode and the second intra-frame prediction mode can use the same MPM list and use the same or similar encoding and decoding methods. That is to say, if the decoder uses different preset angle prediction mode sets to restrict the first intra-frame prediction mode and the second intra-frame prediction mode, then it is necessary to use different MPM lists or use significantly different encoding and decoding methods for the first intra-frame prediction mode and the second intra-frame prediction mode.
[0305] Step 202: Build the MPM list of the current block.
[0306] In an embodiment of the present application, the encoder may further construct an MPM list for the current block, wherein the prediction modes in the MPM list are all intra-frame angular prediction modes.
[0307] Furthermore, in an embodiment of the present application, when constructing the MPM list of the current block, the encoder needs to first determine the weight matrix derivation mode of the current block, and then use the weight matrix derivation mode to further determine the MPM list of the current block.
[0308] It should be noted that, in this application, the weight matrix derivation mode is used to determine the weight matrix used for the current block. Specifically, the weight matrix derivation mode can be a mode for deriving a weight matrix. For a prediction block of a given width and height, each weight matrix derivation mode can derive a weight matrix; for prediction blocks of the same size, different weight matrix derivation modes derive different weight matrices.
[0309] For example, in this application, AVS3's AWP has 56 weight matrix derivation modes, and VVC's GPM has 64 weight matrix derivation modes.
[0310] Optionally, in the present application, when constructing the MPM list of the current block, the decoder may construct the MPM list directly based on the prediction mode and weight matrix derivation mode of the neighboring blocks of the current block.
[0311] Optionally, in the present application, when constructing the MPM list for the current block, the encoder may also construct the MPM list based on the prediction modes of the neighboring blocks of the current block, the preset angle prediction mode set, and the weight matrix derivation mode. The preset angle prediction mode set may be a subset of all intra-frame angle prediction modes. Taking AVS3 as an example, the preset angle prediction mode set may include only 28 intra-frame angle prediction modes with mode numbers 4-31.
[0312] It can be understood that in the present application, if the range of the first intra-frame prediction mode and the second intra-frame prediction mode is not restricted, then the preset angle prediction mode set can be a combination of all intra-frame angle prediction modes; if the range of the first intra-frame prediction mode and the second intra-frame prediction mode needs to be restricted, then the preset angle prediction mode set can be only a combination of some intra-frame angle prediction modes. At this time, the preset angle prediction mode set can be used to limit the range of the first intra-frame prediction mode and the second intra-frame prediction mode, thereby effectively reducing overhead and improving compression performance.
[0313] Optionally, in the present application, when the encoder constructs the MPM list based on the intra-frame prediction mode of the adjacent blocks of the current block, the preset angle prediction mode set and the weight matrix derivation mode, it can first use the prediction mode of the adjacent blocks to determine the first candidate mode; and at the same time, use the weight matrix derivation mode to determine the second candidate mode; and then further construct the MPM list of the current block based on the first candidate mode, the second candidate mode and the preset angle prediction mode set.
[0314] Specifically, in the present application, when the encoder uses the prediction mode of the adjacent block to determine the first candidate mode, if the adjacent block is a normal intra-frame prediction block and the prediction mode of the adjacent block is an intra-frame prediction mode, the prediction mode of the adjacent block is determined as the first candidate mode.
[0315] It can be understood that in this application, the ordinary intra-frame prediction block refers to the prediction block using the DC mode, Planar mode, Bilinear mode, angular prediction mode and other prediction modes, rather than the prediction block using the IBC mode, intra string copy prediction and other prediction modes.
[0316] Specifically, in the present application, when the encoder uses the weight matrix derivation mode to determine the second candidate mode, it can first determine the dividing line angle index value based on the weight matrix derivation mode; and then it can use the dividing line angle index value to determine the second candidate mode.
[0317] It should be noted that, in the embodiment of the present application, the second candidate mode can be determined to be L different intra-frame angular prediction modes, thereby ensuring the construction of an MPM list with a length of L.
[0318] Furthermore, in an embodiment of the present application, when the weight matrix includes two weights, the positions where the weights change form a straight line, or when the weight matrix has multiple weights, the positions in the transition region with the same weights form a straight line, and this straight line can be called a dividing line. The horizontal angle to the right can be set to 0, and the angle increases counterclockwise. Then the dividing line may have a horizontal angle of 0 degrees, a vertical angle of 90 degrees, an inclined angle such as 45 degrees, 135 degrees, and various other different angles. If a prediction block chooses to use a certain weight matrix, then the corresponding texture is likely to show different characteristics on both sides of the dividing line, such as textures of two different angles on both sides of the dividing line, or textures of one angle on one side of the dividing line and a relatively flat texture on the other side. Since the dividing line itself also has an angle, it can be assumed that a point obtained through intra-frame angle prediction may be close to some textures of the current block, so this straight line is correlated with the two intra-frame prediction modes of the current block.
[0319] Specifically, in the present application, assuming that the dividing line is obtained by intra-frame angle prediction from a point, then at least one intra-frame angle prediction mode can be found, and this intra-frame angle prediction mode can approximately make the dividing line. For example, the horizontal dividing line matches the horizontal intra-frame prediction mode, such as mode 24 in AVS3; the vertical dividing line matches the vertical intra-frame prediction mode, such as mode 12 in AVS3; the 45-degree dividing line can match the intra-frame prediction mode of 45 degrees from the lower left to the upper right, such as mode 30 in AVS3; it can also match the intra-frame prediction mode of 225 degrees from the upper right to the lower left, such as mode 6 in AVS3. If there is only one weight value in a weight matrix, it can match modes without obvious angles, such as DC mode, Planar mode, Bilinear mode, etc. It can be seen that the weight matrix derived mode can match certain intra-frame prediction modes, so the weight matrix derived mode can be used to assist in the decoding of the intra-frame prediction mode.
[0320] It should be noted that, in this application, the weight matrix derivation mode can also be the index of the weight matrix. For example, the 56 modes of AWP can be considered as 56 weight matrix derivation modes.
[0321] For example, in the present application, a mapping relationship table can be constructed to further represent the mapping relationship between the weight matrix derived mode and the intra-frame angle prediction mode. Specifically, the dividing lines of multiple modes of AWP and GPM are the same angle. For example, the dividing line angles of every 8 modes of AVS3 are the same. There are 8 kinds of dividing line angles in 56 AWP modes. The index of the dividing line angle can be obtained by the mode number of the weight matrix derived mode modulo 8 (% 8). For example, Table 1 above is a mapping relationship table. Taking the angle mode of AVS3 as an example, the indexes 0 and 1 of the dividing line angle can correspond to two intra-frame angle prediction modes, one from the upper right corner to the lower left corner, and the other from the upper left corner to the lower right corner. In specific implementation, another approximately corresponding intra-frame angle prediction mode can be found for the index of other dividing line angles, or all the indexes of the dividing line angles correspond to only one intra-frame angle prediction mode.
[0322] For a weight matrix, in addition to the high probability of using the intra-frame angle prediction mode corresponding to its dividing line, the probability of using certain intra-frame angle prediction modes related to it is also high. For example, the intra-frame angle prediction mode corresponding to the angle close to the dividing line, or the angle perpendicular to the dividing line. The encoder can use the correlation between the weight matrix and the intra-frame angle prediction mode to construct the MPM list of the intra-frame weighted combination prediction mode. For example, when constructing the MPM list of the intra-frame weighted combination prediction mode, if the list length of the MPM list is 4, then the candidate mode corresponding to the dividing line angle index in Table 2 above can be added to the MPM list.
[0323] It can be understood that, based on Table 2 above, the number of candidate modes corresponding to the index of each dividing line angle is equal to the length of the MPM list, which ensures that the MPM list can be filled even when all intra prediction modes of the referenced adjacent blocks are unavailable. If the MPM list length is 4, the number of candidate modes corresponding to the index of each dividing line angle can be set to 4.
[0324] Furthermore, in the present application, when the encoder constructs the MPM list based on the first candidate mode, the second candidate mode and the preset angle prediction mode set, it can also filter the first candidate mode based on the preset angle prediction mode set to obtain the filtered candidate mode; and construct the MPM list based on the filtered candidate mode and the second candidate mode.
[0325] Specifically, in the present application, when the encoder filters the first candidate mode based on the preset angle prediction mode set to obtain the filtered candidate mode, if the first candidate mode belongs to the preset angle prediction mode set, the first candidate mode is determined as the filtered candidate mode; if the first candidate mode is an intra-frame angle prediction mode and does not belong to the preset angle prediction mode set, a replacement mode of the first candidate mode is determined in the preset angle prediction mode set, and the replacement mode is determined as the filtered candidate mode.
[0326] Furthermore, in the present application, if the first candidate mode is not an intra-frame angular prediction mode, the encoder may directly delete the first candidate mode.
[0327] It is understandable that in the present application, since the preset angle prediction mode set to which the first intra-frame prediction mode and the second intra-frame prediction mode belong is a subset of all intra-frame angle prediction modes and does not include intra-frame non-angle prediction modes, the selection of the most likely mode MPM of the current block, that is, the method of constructing the MPM list, for the intra-frame weighted combination prediction mode also needs to be adjusted accordingly. Specifically, the encoder needs to refer to the intra-frame prediction mode of the adjacent blocks around the current block when constructing the MPM list. The surrounding adjacent blocks include the left adjacent block, the upper adjacent block, the upper left adjacent block, the upper right adjacent block, the lower left adjacent block, etc. Due to spatial correlation, the surrounding adjacent blocks use a certain prediction mode, and the current block has a higher probability of using the same or similar prediction mode.
[0328] Optionally, since the first intra-frame prediction mode and the second intra-frame prediction mode of the intra-frame weighted combination prediction mode can only be intra-frame angle prediction modes, when the intra-frame prediction mode used by a reference adjacent block is an intra-frame non-angle prediction mode, that is, the first candidate mode is not an intra-frame angle prediction mode, then the encoder will not use the intra-frame non-angle prediction mode used by this reference block when constructing the MPM list of the current block, that is, the intra-frame non-angle prediction mode will not be added to the MPM list of the current block.
[0329] Optionally, since the preset angle prediction mode set to which the first intra-frame prediction mode and the second intra-frame prediction mode belong is a subset of all intra-frame angle prediction modes, when the intra-frame prediction mode used by a reference adjacent block is an intra-frame angle prediction mode outside the preset angle prediction mode set, that is, the first candidate mode is an intra-frame angle prediction mode and does not belong to the preset angle prediction mode set, then when constructing the MPM list of the current block, the encoder can convert the intra-frame angle prediction mode outside the preset angle prediction mode set into an intra-frame angle prediction mode with a similar angle within the preset angle prediction mode set, and then add it to the MPM list. Taking AVS3 as an example, if the preset angle prediction mode set restricts the first intra-frame prediction mode and the second intra-frame prediction mode to only use intra-frame angle prediction modes No. 4-31, and the adjacent block of the current block uses intra-frame angle prediction mode No. 43, then the encoder can add intra-frame angle prediction No. 12, which is similar to intra-frame angle prediction No. 43, to the MPM list of the current block in the intra-frame weighted combination prediction mode.
[0330] Furthermore, in an embodiment of the present application, when the encoder constructs the MPM list based on the filtered candidate mode and the second candidate mode, if the filtered candidate mode meets the preset addition condition, the filtered candidate mode is added to the MPM list; if the MPM list does not meet the preset list length L, and the second candidate mode meets the preset addition condition, the second candidate mode is added to the MPM list; wherein L is an integer greater than or equal to 1.
[0331] Exemplarily, in the present application, the value of L may be 4, that is, the preset list length of the MPM list is 4, or in other words, the MPM list includes 4 most probable modes.
[0332] It can be understood that, in the embodiment of the present application, the encoder may sort the L modes in the MPM list in ascending order of mode numbers.
[0333] It should be noted that, in an embodiment of the present application, if the filtered candidate mode is different from the prediction mode in the MPM list, then the encoder can determine that the filtered candidate mode meets the preset addition condition; correspondingly, if the second candidate mode is different from the prediction mode in the MPM list, then the encoder can determine that the second candidate mode meets the preset addition condition.
[0334] It is understandable that in an embodiment of the present application, when the encoder adds the filtered candidate modes corresponding to the adjacent blocks to the MPM list, it determines the order parameters corresponding to the adjacent blocks; and according to the order parameters, the intra-frame filtered candidate modes corresponding to the adjacent blocks are sequentially added to the MPM list. The encoder can determine the corresponding order parameters according to the spatial distance between the adjacent blocks and the current block. For example, the closer the spatial distance between the adjacent block and the current block, the stronger the correlation between the two, the earlier the addition process is performed, that is, the smaller the order parameter; the farther the spatial distance between the adjacent block and the current block, the weaker the correlation between the two, the later the addition process is performed, that is, the larger the order parameter.
[0335] Furthermore, in an embodiment of the present application, after adding the filtered candidate mode and / or the second candidate mode to the MPM list, the encoder may also sort the L prediction modes in the MPM list in ascending order of mode numbers.
[0336] For example, in this application, it is assumed that the MPM list of the current block in the intra-frame weighted combination prediction mode is IwcpMpm[4], that is, the list length of the MPM list is 4, the index of the weight matrix derivation mode is IwcpIndex, the weight matrix derivation mode reuses the 56 derivation modes of AWP, and the preset angle prediction mode set to which the first intra-frame prediction mode and the second intra-frame prediction mode belong is the intra-frame angle prediction mode No. 4-31. Then, when constructing the MPM list of the current block, the encoder can perform the following steps in sequence:
[0337] Step S1: Set the array cand_mode
[10] and initialize all values of cand_mode to invalid values. Perform the following operations on cand_mode:
[0338] (a) If the neighboring block F "exists" and is a normal intra-frame predicted block, cand_mode[0] is equal to the intra-frame prediction mode of F,
[0339] (b) If the neighboring block G "exists" and is a normal intra-frame predicted block, cand_mode[1] is equal to the intra-frame prediction mode of G,
[0340] (c) If the neighboring block C "exists" and is a normal intra-frame predicted block, cand_mode[2] is equal to the intra-frame prediction mode of C,
[0341] (d) If the neighboring block A "exists" and is a normal intra-frame predicted block, cand_mode[3] is equal to the intra-frame prediction mode of A,
[0342] (e) If the neighboring block B "exists" and is a normal intra-frame predicted block, cand_mode[4] is equal to the intra-frame prediction mode of B,
[0343] (f) If the neighboring block D "exists" and is a normal intra-frame predicted block, cand_mode[5] is equal to the intra-frame prediction mode of D,
[0344] (g) cand_mode[6] is equal to candidate mode 0 corresponding to IwcpIndex%8,
[0345] (h) cand_mode[7] is equal to candidate mode 1 corresponding to IwcpIndex%8,
[0346] (i) cand_mode[8] is equal to candidate mode 2 corresponding to IwcpIndex%8,
[0347] (j) cand_mode[9] is equal to candidate mode 3 corresponding to IwcpIndex%8,
[0348] Here, the presence of a neighboring block X (where X is A, B, C, D, F, or G) means that the block must be within the image and belong to the same slice as block E. Otherwise, the neighboring block is not present. If the block is not present or has not yet been decoded, the block is not available. Otherwise, the block is available. If the block containing a sample in the image is not present or the sample has not yet been decoded, the sample is not available. Otherwise, the sample is available.
[0349] It can be understood that in the present application, the execution steps (a) to (f) above are the process of determining the first candidate mode; the execution steps (g) to (j) above are the process of determining the second candidate mode, wherein the encoder can refer to Table 2 above to determine the second candidate mode.
[0350] Step S2: For i from 0 to 5, perform the following operations:
[0351] (a) If cand_mode[i] is less than 3 or cand_mode[i] is equal to 33, cand_mode[i] is set to an invalid value,
[0352] That is, if the first candidate mode is an intra non-angular prediction mode, the encoder may directly delete the first candidate mode, that is, not use the first candidate mode.
[0353] (b) Otherwise, if cand_mode[i] is equal to 3, let cand_mode[i] be equal to 4.
[0354] (c) Otherwise, if cand_mode[i] is equal to 32, set cand_mode[i] to 31.
[0355] (d) Otherwise, if cand_mode[i] is greater than 33, perform the following operations:
[0356] If cand_mode[i] is less than 44, let cand_mode[i] equal to cand_mode[i]-30,
[0357] Otherwise, if cand_mode[i] is less than 58, let cand_mode[i] equal to cand_mode[i]-33,
[0358] Otherwise, let cand_mode[i] equal to cand_mode[i]-34,
[0359] That is to say, if the first candidate mode is an intra-frame angle prediction mode, but the first candidate mode does not belong to the preset angle prediction mode set, then the encoder can select a similar intra-frame angle prediction mode in the preset angle prediction mode set as a replacement mode for the first candidate mode, and then use the replacement mode as the filtered candidate mode.
[0360] (e) Otherwise, the value of cand_mode[i] is not modified.
[0361] That is to say, if the first candidate mode belongs to the preset angle prediction mode set, the encoder can directly use the first candidate mode, that is, the first candidate mode is the filtered candidate mode.
[0362] It can be understood that, in the present application, the above step S2 is the screening process of the first candidate mode, and the screened candidate mode corresponding to the first candidate mode is finally determined.
[0363] Step S3: Set mpm_num to 0, and for i from 0 to 9, perform the following operations:
[0364] (a) If cand_mode[i] is not an invalid value, then perform the following operations:
[0365] Compare cand_mode[i] with IwcpMpm[j], where j is from 0 to mpm_num-1. If cand_mode[i] is not equal to IwcpMpm[j], perform the following operations:
[0366] 1. Let IwcpMpm[mpm_num] be equal to cand_mode[i],
[0367] 2. Let mpm_num be equal to mpm_num+1,
[0368] 3. If mpm_num is equal to 4, end step 3.
[0369] That is to say, under the premise that there are less than 4 prediction modes in the MPM list, if the filtered candidate mode is different from any prediction mode in the MPM list, the encoder can add the filtered candidate mode to the MPM list; if after all the filtered candidate modes that meet the preset addition conditions are added to the MPM list, the prediction modes in the MPM list are still less than 4, the encoder can continue to add the second candidate mode that meets the preset addition conditions to the MPM list until the list length of the MPM list reaches 4.
[0370] Step S4: Sort the four numbers of IwcpMpm[4] from small to large.
[0371] Finally, the encoder can sort the four intra-frame angular prediction modes in the MPM list in ascending order of mode numbers.
[0372] It is understandable that the present application does not limit the execution order of the above steps 202 and 203, that is, it does not limit the order between the determination process of the first intra-frame prediction mode and the second intra-frame prediction mode and the construction process of the MPM list.
[0373] Step 203: Determine a first mode index and a second mode index of the current block according to the first intra prediction mode, the second intra prediction mode, and the MPM list.
[0374] In an embodiment of the present application, after the encoder determines the first intra-frame prediction mode and the second intra-frame prediction mode of the current block and completes the construction of the MPM list of the current block, it can further determine the first mode index and the second mode index of the current block based on the first intra-frame prediction mode, the second intra-frame prediction mode and the MPM list.
[0375] It can be understood that, in the embodiment of the present application, the first mode index can be used to indicate the first intra-frame prediction mode used by the current block, and the second mode index can be used to indicate the second intra-frame prediction mode of the current block.
[0376] Specifically, the value of the first mode index and the value of the second mode index are related to the number of intra-frame angle prediction modes that may exist in the first intra-frame prediction mode and the second intra-frame prediction mode. For example, the first intra-frame prediction mode and the second intra-frame prediction mode may be one of the 28 intra-frame angle prediction modes with mode numbers 4-31 respectively, then the value of the first mode index and the value of the second mode index both belong to the range of 0 to 27.
[0377] Exemplarily, in an embodiment of the present application, the parameter iwcp_pred_mode0_index may be used to represent the first mode index, while the parameter iwcp_pred_mode1_index may be used to represent the second mode index.
[0378] Furthermore, in an embodiment of the present application, the encoder may determine a first mapping relationship table between index values and binary symbol strings; wherein the first mapping relationship table includes binary symbol strings of a first length, a second length, and a third length, respectively.
[0379] Exemplarily, in this application, the first length is 3 bits, the second length is 5 bits, and the third length is 6 bits.
[0380] It should be noted that, in the present application, the first mapping relationship table between index values and binary symbol strings can be used to determine the values of the first mode index and the second mode index.
[0381] Optionally, in the present application, for AVS3, if 28 intra-frame angle prediction modes with mode numbers 4-31 are used, that is, the preset angle prediction mode set includes a total of 28 modes, then a 4+8+16 encoding format can be used, that is, a mode with 4 shortest codewords, a mode with 8 shorter codewords, and a mode with 16 longer codewords. Among them, the mode with 4 shortest codewords uses a 3-bit codeword, that is, uses the first length, the mode with 8 shorter codewords uses a 5-bit codeword, that is, uses the second length, and the mode with 16 longer codewords uses a 6-bit codeword, that is, uses the third length.
[0382] It should be noted that in the present application, the prediction angles of the 28 intra-frame angle prediction modes with mode numbers 4-31 basically cover the entire commonly used angle range. At the same time, the intra-frame angle prediction modes with mode numbers 4-31 are simpler than the intra-frame angle prediction modes with mode numbers 34-65, and the use of these 28 modes to encode in the form of 4+8+16 will not cause waste of codewords. Therefore, the encoder can preferably define a preset angle prediction mode set according to the 28 intra-frame angle prediction modes with mode numbers 4-31.
[0383] Furthermore, in an embodiment of the present application, if the list length of the MPM list of the current block is 4, then the 4 most likely modes in the MPM list can correspond to the use of a binary symbol string of the first length, that is, the 4 shortest codeword modes can be used for the 4 MPMs in the MPM list; accordingly, other prediction modes in the preset angle prediction mode set and outside the MPM list can respectively use a binary symbol string of the second length and a binary symbol string of the third length.
[0384] Optionally, in the present application, for the other 24 intra-frame angle prediction modes in the preset angle prediction mode set and other than the 4 MPMs in the MPM list, the encoder can evenly distribute the patterns of shorter codewords and longer codewords. Specifically, the encoder can evenly distribute the patterns of 8 shorter codewords (binary symbol strings of the second length) in the remaining 24 intra-frame angle prediction modes. For example, a pattern of 1 shorter codeword (binary symbol string of the second length) is used for every pattern of 2 longer codewords (binary symbol strings of the third length). Furthermore, in the specific implementation process, it can be achieved by modulo 3 (% 3) of the sequence numbers from 0-23 in the remaining 24 intra-frame angle prediction modes, for example, the pattern of the sequence number modulo 3 with a remainder of 2 uses a 5-bit codeword, that is, a binary symbol string of the second length is used, and the sequence number modulo 3 with a remainder of 0 or 1 uses a 6-bit codeword, that is, a binary symbol string of the third length is used.
[0385] For example, in the present application, if 28 intra-frame angle prediction modes with mode numbers 4-31 are used, that is, the preset angle prediction mode set includes a total of 28 modes, then the first mapping relationship table between the index value and the binary symbol string can be as shown in Table 3 above, where the first length is 3 bits, the second length is 5 bits, and the third length is 6 bits.
[0386] The first bit can be used to indicate whether it is an MPM, for example, "1" indicates MPM and "0" indicates not MPM. If the first intra prediction mode is MPM, assuming that the MPM list includes 4 MPMs, then 2 bits can be used to indicate which MPM in the MPM list is used, that is, "00, 01, 10, 11" respectively represent the first MPM, the second MPM, the third MPM, and the fourth MPM in the MPM list.
[0387] Furthermore, in this application, a context model is used to encode a binary symbol string with a bit flag of 0, and a context model is not used to encode a binary symbol string with a bit flag not 0. The value of the bit flag can indicate how many bits have been encoded, and the bit flag can be represented by binIdx.
[0388] It should be noted that in this application, on the encoding side, when binarization is performed according to Table 3, the binary symbol string with binIdx being 0 can be encoded using the context model, while the binary symbol string with binIdx not being 0 can be encoded using the equal probability model or the bypass mode.
[0389] Furthermore, in the present application, when the encoder determines the first mode index and the second mode index of the current block according to the first intra-frame prediction mode, the second intra-frame prediction mode, and the MPM list, if the mode number of the first intra-frame prediction mode is the same as the mode number of the m-th mode in the MPM list, the value i of the first mode index is assigned according to m; if the mode number of the first intra-frame prediction mode is different from the mode number of any mode in the MPM list, the value i of the first mode index is determined using the MPM list; and the first mode index is determined according to the first mapping relationship table and i. Wherein, m is an integer greater than or equal to 0 and less than L.
[0390] That is, in this application, if the mode number of the first intra prediction mode is the same as the mode number of a mode in the MPM list, then the value of the first mode index i can be directly set to the order m of the most probable mode. For example, if the first intra prediction mode is the same as the second mode in the MPM list, then i=2.
[0391] Specifically, in the present application, when the encoder uses the MPM list to determine the value i of the first mode index, if the mode number of the first intra-frame prediction mode is greater than or equal to the mode number of the fourth mode in the MPM list, i is assigned according to the difference between the mode number of the first intra-frame prediction mode and 4; if the mode number of the first intra-frame prediction mode is less than the mode number of the fourth mode in the MPM list and is greater than or equal to the mode number of the third mode in the MPM list, i is assigned according to the difference between the mode number of the first intra-frame prediction mode and 3; if the mode number of the first intra-frame prediction mode is less than the mode number of the fourth mode in the MPM list, i is assigned according to the difference between the mode number of the first intra-frame prediction mode and 3. If the mode number of the first intra-frame prediction mode is less than the mode number of the second mode in the MPM list and is greater than or equal to the mode number of the second mode in the MPM list, i is assigned according to the difference between the mode number of the first intra-frame prediction mode and 2; if the mode number of the first intra-frame prediction mode is less than the mode number of the second mode in the MPM list and is greater than or equal to the mode number of the first mode in the MPM list, i is assigned according to the difference between the mode number of the first intra-frame prediction mode and 1; if the mode number of the first intra-frame prediction mode is less than the mode number of the first mode in the MPM list, i is assigned according to the mode number of the first intra-frame prediction mode.
[0392] For example, in the present application, if the mode numbers of the four MPMs in the MPM list are 4, 8, 12, and 16 respectively, and the mode number of the first intra-frame prediction mode is 9, the encoder can compare the mode number of the first intra-frame prediction mode with the mode numbers of the four MPMs respectively. Specifically, if 9 is greater than the mode number of the second MPM and less than the mode number of the third MPM, then the value of the first mode index i=9-2=7 can be set.
[0393] For example, in the present application, if the mode numbers of the four MPMs in the MPM list are 4, 8, 12, and 16 respectively, and the mode number of the first intra-frame prediction mode is 15, the encoder can compare the mode number of the first intra-frame prediction mode with the mode numbers of the four MPMs respectively. Specifically, if 15 is greater than the mode number of the third MPM and less than the mode number of the fourth MPM, then the value of the first mode index i=15-3=12 can be set.
[0394] It can be understood that in the present application, after the encoder determines the value i of the first mode index corresponding to the first intra-frame prediction mode, it can determine the first mode index based on the first mapping relationship table and i. Specifically, the encoder can binarize i according to the first mapping relationship table shown in Table 3 above to determine the first mode index.
[0395] Furthermore, in the present application, when the encoder determines the first mode index and the second mode index of the current block according to the first intra-frame prediction mode, the second intra-frame prediction mode, and the MPM list, if the mode number of the second intra-frame prediction mode is the same as the mode number of the m-th mode in the MPM list, the value j of the first mode index is assigned according to m; if the mode number of the second intra-frame prediction mode is different from the mode number of any mode in the MPM list, the value j of the first mode index is determined using the MPM list; and the second mode index is determined according to the first mapping relationship table and j. Wherein, m is an integer greater than or equal to 0 and less than L.
[0396] That is, in this application, if the mode number of the second intra prediction mode is the same as the mode number of a mode in the MPM list, then the value of the first mode index j can be directly set to the order m of the most probable mode. For example, if the second intra prediction mode is the same as the third mode in the MPM list, then j = 3.
[0397] Specifically, in the present application, when the encoder uses the MPM list to determine the value j of the first mode index, if the mode number of the second intra-frame prediction mode is greater than or equal to the mode number of the fourth mode in the MPM list, j is assigned according to the difference between the mode number of the second intra-frame prediction mode and 4; if the mode number of the second intra-frame prediction mode is less than the mode number of the fourth mode in the MPM list and is greater than or equal to the mode number of the third mode in the MPM list, j is assigned according to the difference between the mode number of the second intra-frame prediction mode and 3; if the mode number of the second intra-frame prediction mode is less than the mode number of the fourth mode in the MPM list, If the mode number of the second mode in the MPM list is greater than or equal to the mode number of the second mode in the MPM list, j is assigned according to the difference between the mode number of the second intra-frame prediction mode and 2; if the mode number of the second intra-frame prediction mode is less than the mode number of the second mode in the MPM list, and is greater than or equal to the mode number of the first mode in the MPM list, j is assigned according to the difference between the mode number of the second intra-frame prediction mode and 1; if the mode number of the second intra-frame prediction mode is less than the mode number of the first mode in the MPM list, j is assigned according to the mode number of the second intra-frame prediction mode.
[0398] For example, in the present application, if the mode numbers of the four MPMs in the MPM list are 4, 8, 12, and 16 respectively, and the mode number of the second intra-frame prediction mode is 17, the encoder can compare the mode number of the second intra-frame prediction mode with the mode numbers of the four MPMs respectively. Specifically, if 17 is greater than the mode number of the fourth MPM, then the value of the first mode index j=17-4=13 can be set.
[0399] For example, in the present application, if the mode numbers of the four MPMs in the MPM list are 4, 8, 12, and 16 respectively, and the mode number of the second intra-frame prediction mode is 6, the encoder can compare the mode number of the second intra-frame prediction mode with the mode numbers of the four MPMs respectively. Specifically, if 6 is greater than the mode number of the first MPM and less than the mode number of the second MPM, then the value of the first mode index j=6-1=5 can be set.
[0400] It can be understood that in the present application, after the encoder determines the value j of the second mode index corresponding to the second intra-frame prediction mode, it can determine the second mode index based on the first mapping relationship table and j. Specifically, the encoder can binarize j according to the first mapping relationship table shown in Table 3 above to determine the second mode index.
[0401] Exemplarily, in the present application, if the current block uses the IWCP mode, the length of the MPM list of the current block is 4, that is, L=4, wherein the 4 modes in the MPM list are arranged in ascending order according to the mode number, and the preset angle prediction mode set includes 28 intra-frame angle prediction modes with mode numbers 4-31. The encoder can first determine that the first intra-frame prediction mode is IwcpPredMode0 and the second intra-frame prediction mode is IwcpPredMode1, and then further determine the first mode index iwcp_pred_mode0_index and the second mode index iwcp_pred_mode1_index according to the first intra-frame prediction mode IwcpPredMode0 and the second intra-frame prediction mode IwcpPredMode1, wherein the value range of iwcp_pred_mode0_index and iwcp_pred_mode1_index is 0-27.
[0402] After determining the first intra prediction mode IwcpPredMode0 used by the intra weighted combination prediction mode of the current block, the encoder may specifically perform the following operations when determining the first mode index iwcp_pred_mode0_index:
[0403] 1. If IwcpPredMode0 is equal to IwcpMpm[m], where m is greater than or equal to 0 and less than 4, then the value i of iwcp_pred_mode0_index is equal to m.
[0404] That is, if the first intra prediction mode is the same as the mth MPM in the MPM list, then m can be directly used to assign a value to i, ie, i=m.
[0405] 2. If IwcpPredMode0 is not equal to IwcpMpm[m], the value of iwcp_pred_mode0_index is equal to IwcpPredMode0 <IwcpMpm[0]?IwcpPredMode0:IwcpPredMode0<IwcpMpm[1]?IwcpPredMode0-1:IwcpPredMode0<IwcpMpm[2]?IwcpPredMode0-2:IwcpPredMode0<IwcpMpm[3]?IwcpPredMode0-3:IwcpPredMode0–4。
[0406] 3. Binarize the value i of iwcp_pred_mode0_index according to Table 3 to determine iwcp_pred_mode0_index in the form of a binary symbol string.
[0407] Specifically, when the value i of iwcp_pred_mode0_index is binarized according to Table 3, the index value identical to i may be determined from the left column of Table 3, and then the binary symbol string iwcp_pred_mode0_index may be determined from the right column of the same row.
[0408] Accordingly, after determining the second intra prediction mode IwcpPredMode1 used by the intra weighted combination prediction mode of the current block, the encoder may specifically perform the following operations when determining the second mode index iwcp_pred_mode1_index:
[0409] 1. If IwcpPredMode1 is equal to IwcpMpm[m], where m is greater than or equal to 0 and less than 4, then the value j of iwcp_pred_mode1_index is equal to m.
[0410] That is, if the second intra prediction mode is the same as the mth MPM in the MPM list, then m can be directly used to assign a value to j, ie, i=m.
[0411] 2. If IwcpPredMode1 is not equal to IwcpMpm[m], the value j of iwcp_pred_mode1_index is equal to IwcpPredMode1 <IwcpMpm[0]?IwcpPredMode1:IwcpPredMode1<IwcpMpm[1]?IwcpPredMode1-1:IwcpPredMode1<IwcpMpm[2]?IwcpPredMode1-2:IwcpPredMode1<IwcpMpm[3]?IwcpPredMode1-3:IwcpPredMode1–4。
[0412] 3. Binarize the value j of iwcp_pred_mode1_index according to Table 3 to determine iwcp_pred_mode1_index in the form of a binary symbol string.
[0413] Specifically, when the value j of iwcp_pred_mode1_index is binarized according to Table 3, the index value identical to j may be determined from the left column of Table 3, and then the binary symbol string iwcp_pred_mode1_index may be determined from the right column of the same row.
[0414] Furthermore, in an embodiment of the present application, since the intra-frame weighted combination prediction mode needs to use the first intra-frame prediction mode and the second intra-frame prediction mode to determine the prediction value of the current block, wherein the first intra-frame prediction mode and the second intra-frame prediction mode can share a preset angle prediction mode set and can also share the same MPM list, but the first intra-frame prediction mode and the second intra-frame prediction mode in the intra-frame weighted combination prediction mode are not the same. Therefore, when encoding and decoding the second intra-frame prediction mode, the first intra-frame prediction mode can be referred to. Specifically, when determining the second intra-frame prediction mode, the first intra-frame prediction mode can be excluded.
[0415] It is understandable that in the present application, for the 28 intra-frame angle prediction modes, since in the above-mentioned 4+8+16 encoding and decoding method, the probability of the 4 MPMs in the MPM list appearing is very high (the probability that the first intra-frame prediction mode is one of the 4 MPMs in the MPM list is about 50%, and the probability that the second intra-frame prediction mode is one of the 4 MPMs in the MPM list is about 50%), if the first intra-frame prediction mode and the second intra-frame prediction mode are both MPMs in the MPM list, then when determining the second intra-frame prediction mode, only one of the other 3 MPMs in the MPM list other than the first intra-frame prediction mode can be selected. In this way, the original 4-choose-1, which requires 4 3-bit codewords, can be changed to 3-choose-1, which requires 1 2-bit codeword and 2 3-bit codewords. Correspondingly, if the first intra-frame prediction mode and the second intra-frame prediction mode are not MPMs in the MPM list, then the second intra-frame prediction mode can also remove 1 from the 24 intra-frame angle prediction modes of 8+16, but the impact of this is relatively small.
[0416] It can be seen from this that when the first intra-frame prediction mode and the second intra-frame prediction mode are both MPMs in the MPM list, it is possible to choose to perform deletion processing on the first intra-frame prediction mode when determining the second intra-frame prediction mode, thereby reducing overhead.
[0417] Optionally, in an embodiment of the present application, when the encoder determines the first mode index and the second mode index of the current block based on the first intra-frame prediction mode, the second intra-frame prediction mode and the MPM list, if the mode number of the second intra-frame prediction mode is the same as the mode number of the mth mode in the MPM list, the value j of the first mode index is assigned according to m; if the mode number of the second intra-frame prediction mode is different from the mode number of any mode in the MPM list, the value j of the first mode index is determined using the MPM list; the second mode index is determined according to the first mapping relationship table, the second mapping relationship table between index value and binary symbol string, and j.
[0418] Specifically, in the present application, when the encoder determines the second mode index based on the first mapping relationship table, the second mapping relationship table of index values and binary symbol strings, and j, if i is less than L and less than j, then after performing a subtraction operation on j, j is binarized according to the second mapping relationship table to determine the second mode index; if j is greater than or equal to L, j is binarized according to the first mapping relationship table to determine the second mode index.
[0419] Furthermore, in an embodiment of the present application, the encoder may determine a second mapping relationship table between index values and binary symbol strings; wherein the second mapping relationship table includes binary symbol strings of the first length, the second length, the third length and the fourth length respectively.
[0420] Illustratively, in this application, the first length is 3 bits, the second length is 5 bits, the third length is 6 bits, and the fourth length is 2 bits.
[0421] It should be noted that, in the present application, the second mapping relationship table between index values and binary symbol strings is only used to determine the value of the second mode index.
[0422] Optionally, in the present application, the second mapping relationship table between index values and binary symbol strings can be as shown in Table 4 above, where the first length is 3 bits, the second length is 5 bits, the third length is 6 bits, and the fourth length is 2 bits.
[0423] It should be noted that in this application, on the encoding side, when binarization is performed according to Table 4, the binary symbol string with binIdx being 0 can be encoded using the context model, while the binary symbol string with binIdx not being 0 can be encoded using the equal probability model or the bypass mode.
[0424] Exemplarily, in the present application, if the current block uses the IWCP mode, the length of the MPM list of the current block is 4, that is, L=4, wherein the 4 modes in the MPM list are arranged in ascending order according to the mode number, and the preset angle prediction mode set includes 28 intra-frame angle prediction modes with mode numbers 4-31. The encoder can first determine that the first intra-frame prediction mode is IwcpPredMode0 and the second intra-frame prediction mode is IwcpPredMode1, and then further determine the first mode index iwcp_pred_mode0_index and the second mode index iwcp_pred_mode1_index according to the first intra-frame prediction mode IwcpPredMode0 and the second intra-frame prediction mode IwcpPredMode1.
[0425] After determining the first intra prediction mode IwcpPredMode0 used by the intra weighted combination prediction mode of the current block, the encoder may specifically perform the following operations when determining the first mode index iwcp_pred_mode0_index:
[0426] 1. If IwcpPredMode0 is equal to IwcpMpm[m], where m is greater than or equal to 0 and less than 4, then the value i of iwcp_pred_mode0_index is equal to m.
[0427] That is, if the first intra prediction mode is the same as the mth MPM in the MPM list, then m can be directly used to assign a value to i, ie, i=m.
[0428] 2. If IwcpPredMode0 is not equal to IwcpMpm[m], the value of iwcp_pred_mode0_index is equal to IwcpPredMode0 <IwcpMpm[0]?IwcpPredMode0:IwcpPredMode0<IwcpMpm[1]?IwcpPredMode0-1:IwcpPredMode0<IwcpMpm[2]?IwcpPredMode0-2:IwcpPredMode0<IwcpMpm[3]?IwcpPredMode0-3:IwcpPredMode0–4。
[0429] 3. Binarize the value i of iwcp_pred_mode0_index according to Table 3 to determine iwcp_pred_mode0_index in the form of a binary symbol string.
[0430] Specifically, when the value i of iwcp_pred_mode0_index is binarized according to Table 3, the index value identical to i may be determined from the left column of Table 3, and then the binary symbol string iwcp_pred_mode0_index may be determined from the right column of the same row.
[0431] Accordingly, if the second intra prediction mode is determined according to the first intra prediction mode, then after determining the second intra prediction mode IwcpPredMode1 used by the intra weighted combination prediction mode of the current block, the encoder may specifically perform the following operations when determining the second mode index iwcp_pred_mode1_index:
[0432] 1. If IwcpPredMode1 is equal to IwcpMpm[m], where m is greater than or equal to 0 and less than 4, then the value j of iwcp_pred_mode1_index is equal to m.
[0433] That is, if the second intra prediction mode is the same as the mth MPM in the MPM list, then m can be directly used to assign a value to j, ie, i=m.
[0434] 2. If IwcpPredMode1 is not equal to IwcpMpm[m], the value j of iwcp_pred_mode1_index is equal to IwcpPredMode1 <IwcpMpm[0]?IwcpPredMode1:IwcpPredMode1<IwcpMpm[1]?IwcpPredMode1-1:IwcpPredMode1<IwcpMpm[2]?IwcpPredMode1-2:IwcpPredMode1<IwcpMpm[3]?IwcpPredMode1-3:IwcpPredMode1–4。
[0435] 3. If the value j of iwcp_pred_mode0_index is less than 4, then,
[0436] a. If iwcp_pred_mode1_index is greater than or equal to iwcp_pred_mode0_index, iwcp_pred_mode1_index is equal to iwcp_pred_mode1_index – 1;
[0437] b. Binarize the value j of iwcp_pred_mode1_index according to Table 4 to determine iwcp_pred_mode1_index in the form of a binary symbol string.
[0438] 4. If the value j of iwcp_pred_mode0_index is greater than or equal to 4, then the value j of iwcp_pred_mode1_index is binarized according to Table 3 to determine iwcp_pred_mode1_index in the form of a binary symbol string.
[0439] This shows that if the second intra-frame prediction mode needs to be determined based on the first intra-frame prediction mode, then iwcp_pred_mode1_index also depends on iwcp_pred_mode0_index. Specifically, taking Table 4 as an example, if the first intra-frame prediction mode and the second intra-frame prediction mode are both MPMs in the MPM list, then there are only three MPMs available for the second intra-frame prediction mode. One or two bits can then be used to indicate which MPM is which, such as "00, 01, 10" representing the remaining first MPM, second MPM, and third MPM, respectively. This shows that since one possibility has been eliminated, the encoding and decoding method or the binarization or debinarization method can be changed to save overhead.
[0440] It should be noted that, in an embodiment of the present application, if the preset angle prediction mode set includes 28 intra-frame angle prediction modes with mode numbers 4-31, and the length of the MPM list is 4, then when using binary symbol strings of the first length, the second length, and the third length to determine the first mapping relationship table between the index value and the binary symbol string, the binary symbol string of the first length can be used for the 4 MPMs in the MPM list first, that is, the shortest codeword is used. Then, 8 intra-frame angle prediction modes are selected from the remaining 24 intra-frame angle prediction modes to use the binary symbol string of the second length, and 16 intra-frame angle prediction modes are selected to use the binary symbol string of the third length.
[0441] Specifically, in the present application, for the remaining 24 intra-frame angle prediction modes, shorter codewords can be used for the prediction modes corresponding to the first 8 mode numbers in order from small to large, that is, a binary symbol string of the second length is used, and then longer codewords can be used for the prediction modes corresponding to the next 16 mode numbers, that is, a binary symbol string of the third length is used.
[0442] For example, in the present application, the first mapping relationship table between index values and binary symbol strings shown in Table 3 above can be replaced by Table 5 above, wherein Table 5 used to characterize the first mapping relationship between index values and binary symbol strings can also be used to determine the values of the first mode index and the second mode index.
[0443] Correspondingly, the second mapping relationship table between index values and binary symbol strings shown in Table 4 above can also be replaced with Table 6 above, wherein Table 6 used to characterize the second mapping relationship between index values and binary symbol strings can also be used to determine the value of the second mode index.
[0444] It can be understood that in the present application, if 28 intra-frame angle prediction modes with mode numbers 4-31 are used, that is, the preset angle prediction mode set includes a total of 28 modes, then encoding can be performed in the form of 4+8+16, that is, 4 3-bit codeword modes, 8 5-bit codeword modes, and 16 6-bit codeword modes.
[0445] Optionally, in the present application, if the preset angle prediction mode set includes 20 modes in total, then 4 3-bit codewords and 16 5-bit codewords can be used to represent them.
[0446] Optionally, in this application, if the preset angular prediction mode set includes 36 modes in total, four 3-bit codewords and 32 6-bit codewords may be used to represent them. For example, AVS3 uses 36 intra-frame angular prediction modes numbered 4-31, 42-45, and 56-59.
[0447] It should be noted that in the present application, if all modes in the preset angle prediction mode set are represented according to a set of binary symbol strings as shown in Table 3 and Table 4, then the "codeword" can be understood as a binary symbol string. The length of the codeword can be understood as the length of the binary symbol string. Another representation method is to use a flag bit (flag) plus a binary symbol string. For example, a binary MPM_flag is used to indicate whether the current mode is an MPM mode, that is, if the MPM_flag is 1, it indicates that the current mode is an MPM mode. If the MPM_flag is 0, it indicates that the current mode is not an MPM mode. If the current mode is an MPM mode, there are a total of 4 possibilities for MPM, and a 2-bit binary symbol string is used to indicate which MPM the current mode is. Then the codeword can be understood as a flag bit plus a binary symbol string, and the length of the codeword can be understood as the length of the flag bit plus the binary symbol string.
[0448] Step 204: Write the first mode index and the second mode index into the code stream.
[0449] In an embodiment of the present application, after determining a first mode index for indicating a first intra-frame prediction mode and a second mode index for indicating a second intra-frame prediction mode, the encoder can write the first mode index and the second mode index into the code stream and transmit it to the decoding side, so that the decoder determines the prediction value of the current block according to the first mode index and the second mode index determined by the decoded code stream.
[0450] Furthermore, in an embodiment of the present application, the encoder needs to determine the weight matrix of the current block, so that after determining the first intra-frame prediction mode and the second intra-frame prediction mode used by the current block, it further determines the prediction value of the current block based on the first intra-frame prediction mode, the second intra-frame prediction mode and the weight matrix.
[0451] It can be understood that in an embodiment of the present application, when the encoder determines the prediction value of the current block based on the first intra-frame prediction mode, the second intra-frame prediction mode and the weight matrix, it can first determine the first prediction value of the current block according to the first intra-frame prediction mode; at the same time, it can determine the second prediction value of the current block according to the second intra-frame prediction mode; then the weight matrix can be used to perform a weighted operation on the first prediction value and the second prediction value, and finally the prediction value of the current block can be obtained.
[0452] Furthermore, in an embodiment of the present application, after determining the predicted value of the current block, the encoder can also perform a difference operation on the true value and the predicted value of the current block to obtain the difference result between the two, thereby determining the predicted difference value of the current block, that is, the residual.
[0453] That is to say, in this application, the encoder can calculate the difference between the true value of the current block and the intra-frame prediction value to obtain the residual, and the residual is transformed, quantized, and entropy encoded into the bitstream and transmitted to the decoding side.
[0454] Specifically, in the present application, the encoder may determine the weight matrix of the current block according to the weight matrix derivation mode of the current block.
[0455] It is understood that in the present application, the first intra-frame prediction mode and the second intra-frame prediction mode can both be intra-frame angle prediction modes, that is, the embodiment of the present application uses two different intra-frame angle prediction modes. The first intra-frame prediction mode and the second intra-frame prediction mode are then combined to generate a first prediction block and a second prediction block, respectively. Then, based on the first prediction block and the second prediction block, combined with a weight matrix, a prediction block for the current block is determined.
[0456] Furthermore, in an embodiment of the present application, not all points in all possible weight matrices have the same weight. In other words, at least one possible weight matrix contains at least two different weight values.
[0457] It should be noted that in the embodiments of the present application, the encoder can employ a method similar to GPM or AWP to determine the weight matrix. Specifically, if GPM or AWP is used in the same codec standard or codec, this method can be used to determine the weight matrix, thereby reusing some of the same logic. For example, if AVS3 inter-frame prediction uses AWP, then the AWP method can be used in AVS3 to determine the weight matrix. Of course, different methods can also be used compared to GPM or AWP in the same codec standard or codec, such as using a different number of modes, a different transition region algorithm, or different parameters. Because inter-frame prediction exploits temporal correlation, it uses a reconstructed image in the reference frame as the reference block. Intra-frame prediction, on the other hand, exploits spatial correlation, using reconstructed pixels surrounding the current block as reference pixels. The closer the spatial distance, the stronger the correlation, while the farther the distance, the weaker the correlation. Therefore, if a weight matrix results in pixel positions used in a predicted block being far from the reference pixels, then this portion may not produce more appropriate prediction values than existing methods. In this case, such a weight matrix can be omitted and used in inter-frame prediction.
[0458] An embodiment of the present application provides an intra-frame prediction method. The codec can determine two different prediction blocks of the current block through two different intra-frame angle prediction modes, and then combine them through various weight matrices to finally obtain a more complex prediction block. On the basis of improving the accuracy of intra-frame prediction, it can reduce the hardware implementation cost and complexity, and realize a simple and efficient coding and decoding method, thereby improving compression performance.
[0459] Based on the above embodiment, in another embodiment of the present application, after determining that the current block uses the IWCP mode, the encoder may further determine the intra-frame prediction mode parameters of the current block; wherein the intra-frame prediction mode parameters are used to determine whether the current block uses the IWCP mode; and then the intra-frame prediction mode parameters may be written into the bitstream.
[0460] It should be noted that, in the implementation of this application, the intra-frame prediction mode parameter may indicate whether the current block can use the IWCP mode, that is, whether the current block can use two different intra-frame angle prediction modes to determine the prediction value of the current block.
[0461] It is understood that in the embodiments of the present application, the intra-frame prediction mode parameter can be understood as a flag indicating whether the IWCP mode is used. Specifically, the encoder parses the bitstream and can determine a variable as the intra-frame prediction mode parameter, so that the intra-frame prediction mode parameter can be determined by the value of the variable.
[0462] Exemplarily, in the present application, if the current block uses the IWCP mode, the encoder may set the value of the intra-frame prediction mode parameter to indicate that the current block uses the IWCP mode. Specifically, the encoder may set the value of the variable to 1.
[0463] Exemplarily, in the present application, if the current block does not use the IWCP mode, the encoder may set the value of the intra-frame prediction mode parameter to indicate that the current block does not use the IWCP mode. Specifically, the encoder may set the variable value to 0.
[0464] Furthermore, in an embodiment of the present application, after the encoder completes the setting of the intra-frame prediction mode parameters, it can write the intra-frame prediction mode parameters into the code stream and transmit it to the decoder, so that the decoder can obtain the intra-frame prediction mode parameters after decoding the code stream.
[0465] That is to say, in an embodiment of the present application, on the encoder side, predictive coding will be performed on the current block. During this process, the intra-frame prediction mode parameters of the current block can be determined, and the corresponding intra-frame prediction mode parameters are written into the bitstream and transmitted from the encoder to the decoder.
[0466] It is understandable that in an embodiment of the present application, the encoder may also determine the prediction mode parameters before performing intra-frame prediction on the current block, and then determine the specific encoding mode of the current block through the prediction mode parameters.
[0467] In an embodiment of the present application, further, when determining the prediction mode parameters of the current block, the encoder can first use multiple different prediction modes to predict the current block respectively, and then calculate the rate-distortion cost results corresponding to each prediction mode under the multiple prediction modes; finally, the minimum rate-distortion cost result can be selected from the multiple rate-distortion cost results calculated, and the prediction mode corresponding to the minimum rate-distortion cost result can be determined as the prediction mode parameters of the current block.
[0468] That is, at the encoder side, multiple prediction modes can be used to encode the image components to be predicted respectively for the current block.
[0469] Furthermore, in an embodiment of the present application, after encoding the current block using multiple prediction modes respectively, the encoder can obtain the rate-distortion cost result corresponding to each prediction mode; then, the minimum rate-distortion cost result is selected from the multiple rate-distortion cost results obtained, and the prediction mode corresponding to the minimum rate-distortion cost result is determined as the prediction mode parameter of the current block; in this way, the current block can finally be encoded using the determined prediction mode, and under this prediction mode, the prediction residual can be made small, which can improve the encoding and decoding efficiency.
[0470] In an embodiment of the present application, further, at the encoding end, when the encoder attempts intra-frame prediction for a prediction block, it also attempts to use the cost of encoding in the IWCP mode. When attempting to use the cost of encoding in the IWCP mode, it attempts to use all or some possible costs, and then selects the one with the lowest cost as the cost of encoding in the IWCP mode.
[0471] It should be noted that, in the embodiments of the present application, all the above-mentioned possible situations include the first intra-frame prediction mode of the current block being all possible prediction modes, the second intra-frame prediction mode of the current block being all possible prediction modes, and the weight matrix derivation mode being a combination of these three changes.
[0472] It can be understood that in the present application, the first intra-frame prediction mode and the second intra-frame prediction mode are two completely different intra-frame angle prediction modes. The encoder can limit the intra-frame angle prediction modes that can be used by the IWCP mode, and limit the number of weight matrix derivation modes that can be used by the IWCP mode. Then the possible situations will be reduced accordingly, and the complexity of the encoding end will also be reduced accordingly.
[0473] For example, in this application, assuming that there are 66 available intra-frame angle prediction modes in the IWCP mode, then there are 66 possibilities for the first intra-frame prediction mode. Since the second intra-frame prediction mode is different from the first intra-frame prediction mode, there are 65 possibilities. Assuming that there are 56 weight matrix derivation modes (taking AWP as an example), then this application may use any two different intra-frame angle prediction modes and any weight matrix derivation mode, for a total of 66×65×56 possibilities. If the available intra-frame angle prediction modes are restricted, that is, the mode range in the preset angle prediction mode set is restricted, for example, the preset angle prediction mode set is restricted to only include 28 intra-frame angle prediction modes with mode numbers 4-31, then there are 28 possibilities for the first intra-frame prediction mode. Since the second intra-frame prediction mode is different from the first intra-frame prediction mode, there are 27 possibilities for the second intra-frame prediction mode. Assuming that there are 56 weight matrix derivation modes (taking AWP as an example), then this application may use any two different intra-frame angle prediction modes and any weight matrix derivation mode, for a total of 28×27×56 possibilities.
[0474] Furthermore, in an embodiment of the present application, the encoder can perform rate-distortion optimization (RDO) on all possible cases of the IWCP mode to determine a combination with the lowest cost, wherein each combination is a combination including a first intra-frame prediction mode, a second intra-frame prediction mode, and a weight matrix derivation mode.
[0475] Optionally, to reduce the time consumption of RDO, a preliminary selection can be performed on all possible IWCP modes described above. For example, SAD and SATD can be used as approximate costs for preliminary selection to determine a set number of candidate first intra-frame prediction mode, second intra-frame prediction mode, and weight matrix derivation mode combinations. RDO can then be performed to refine the selection and determine the combination of first intra-frame prediction mode, second intra-frame prediction mode, and weight matrix derivation mode with the lowest cost. This allows the use of fast algorithms to reduce the number of attempts during the preliminary selection. For example, if an intra-frame angular prediction mode has a high cost, several adjacent intra-frame prediction modes will not be tried.
[0476] It is understandable that in the present application, in the above-mentioned preliminary selection and fine selection, the cost may include the cost of encoding the overhead of the first intra-frame prediction mode, the second intra-frame prediction mode, and the weight matrix derivation mode in the code stream. The estimated cost of the overhead of the first intra-frame prediction mode, the second intra-frame prediction mode, and the weight matrix derivation mode in the code stream can also be used during the preliminary selection. For example, the number of bits of the first intra-frame prediction mode or the second intra-frame prediction mode can be estimated based on whether it is an MPM, or the number of bits of the first or second intra-frame prediction mode can be estimated based on the order of the intra-frame prediction modes. In RDO, the cost can be obtained through relatively accurate trial encoding. This process requires the use of the method of constructing an MPM list or sorting intra-frame prediction modes in the present application.
[0477] It is understood that in this application, during both the preliminary selection and the detailed selection, the first prediction block is determined according to the first intra-frame prediction mode, the second prediction block is determined according to the second intra-frame prediction mode, the weight matrix is derived according to the weight matrix derivation mode, and the prediction block of this application is determined based on the first prediction block, the second prediction block, and the weight matrix. During the preliminary selection of SAD and SATD, the current block and the prediction block are used to determine the SAD and SATD.
[0478] Furthermore, in embodiments of the present application, the encoder may first analyze the texture of the current block, such as using gradient analysis. The analyzed data may be used to assist in preliminary selection. For example, if the texture direction of the current block is stronger, the encoder may try more intra-frame prediction modes in similar directions during the preliminary selection. For example, if the texture direction of the current block is weaker, the encoder may try fewer or no intra-frame prediction modes in similar directions during the preliminary selection.
[0479] It should be noted that in this application, the cost of encoding in accordance with the IWCP mode includes the cost of the codewords occupied by the first intra-frame prediction mode, the second intra-frame prediction mode, and the weight matrix derivation mode in the bitstream, the cost of various flags and quantization coefficients to be transmitted in the bitstream for transform quantization entropy coding of the prediction residual, and the cost of distortion of the reconstructed block.
[0480] After determining the cost of encoding according to the IWCP mode, if the cost of encoding according to the IWCP mode is less than the cost of other prediction modes, where the other prediction modes may include other intra-frame prediction modes or inter-frame prediction modes, the encoder will select the IWCP mode as the prediction mode for the current block; otherwise, it will select some other prediction mode.
[0481] Furthermore, in an embodiment of the present application, the encoder may try different block partitioning encoding costs, etc. If the IWCP mode is ultimately selected for a prediction block, the flag bits required by the IWCP mode, as well as information about the first intra-frame prediction mode, the second intra-frame prediction mode, and the weight matrix derivation mode, may be written into the bitstream according to the syntax. At the same time, the prediction block is predicted and subsequently encoded according to the IWCP mode method.
[0482] An embodiment of the present application provides an intra-frame prediction method. The codec can determine two different prediction blocks of the current block through two different intra-frame angle prediction modes, and then combine them through various weight matrices to finally obtain a more complex prediction block. On the basis of improving the accuracy of intra-frame prediction, it can reduce the hardware implementation cost and complexity, and realize a simple and efficient coding and decoding method, thereby improving compression performance.
[0483] Based on the above embodiment, in yet another embodiment of the present application, Figure 10 Schematic diagram of the structure of the encoder proposed in this embodiment Figure 1 ,like Figure 10 As shown, the encoder 300 proposed in the embodiment of the present application may include a first determining part 301, a first constructing part 302, an encoding part 303,
[0484] The first determining part 301 is configured to determine a first intra prediction mode and a second intra prediction mode of the current block when the current block uses the IWCP mode to determine the intra prediction value of the current block; wherein the first intra prediction mode and the second intra prediction mode are two different intra angular prediction modes;
[0485] The first building part 302 is configured to build the MPM list of the current block;
[0486] The first determining part 301 is further configured to determine a first mode index and a second mode index of the current block according to the first intra prediction mode, the second intra prediction mode and the MPM list;
[0487] The encoding part 303 is configured to write the first mode index and the second mode index into a bitstream.
[0488] Figure 11Schematic diagram of the structure of the encoder proposed in this embodiment Figure 2 ,like Figure 11 As shown, the encoder 300 proposed in the embodiment of the present application may also include a first processor 304, a first memory 305 storing executable instructions of the first processor 304, a first communication interface 306, and a first bus 307 for connecting the first processor 304, the first memory 305 and the first communication interface 306.
[0489] Furthermore, in an embodiment of the present application, the above-mentioned first processor 304 is configured to determine a first intra-frame prediction mode and a second intra-frame prediction mode of the current block when the current block uses the IWCP mode to determine the intra-frame prediction value of the current block; wherein the first intra-frame prediction mode and the second intra-frame prediction mode are two different intra-frame angle prediction modes; construct an MPM list for the current block; determine a first mode index and a second mode index of the current block according to the first intra-frame prediction mode, the second intra-frame prediction mode, and the MPM list; and write the first mode index and the second mode index into a bitstream.
[0490] Figure 12 Schematic diagram of the structure of the decoder proposed in this embodiment of the application Figure 1 ,like Figure 12 As shown, the decoder 400 proposed in the embodiment of the present application may include a decoding part 401, a second determining part 402, a second constructing part 403,
[0491] The decoding part 401 is configured to decode the code stream;
[0492] The second determining part 402 is configured to determine an intra prediction mode parameter of the current block; when the intra prediction mode parameter indicates that the current block uses the IWCP mode to determine the intra prediction value of the current block, determine a first mode index and a second mode index of the current block;
[0493] A second building part 403 is configured to build a most probable mode MPM list of the current block;
[0494] The second determination part 402 is further configured to determine the first intra-frame prediction mode and the second intra-frame prediction mode of the current block according to the first mode index, the second mode index and the MPM list; wherein the first intra-frame prediction mode and the second intra-frame prediction mode are two different intra-frame angle prediction modes; determine the weight matrix of the current block, and determine the prediction value of the current block based on the first intra-frame prediction mode, the second intra-frame prediction mode and the weight matrix.
[0495] Figure 13Schematic diagram of the structure of the decoder proposed in this embodiment of the application Figure 2 ,like Figure 13 As shown, the decoder 400 proposed in the embodiment of the present application may also include a second processor 404, a second memory 405 storing executable instructions of the second processor 404, a second communication interface 406, and a second bus 407 for connecting the second processor 404, the second memory 405 and the second communication interface 406.
[0496] Furthermore, in an embodiment of the present application, the above-mentioned second processor 404 is used to decode the code stream and determine the intra-frame prediction mode parameters of the current block; when the intra-frame prediction mode parameters indicate that the current block uses the IWCP mode to determine the intra-frame prediction value of the current block, determine the first mode index and the second mode index of the current block; construct the most likely mode MPM list of the current block; determine the first intra-frame prediction mode and the second intra-frame prediction mode of the current block according to the first mode index, the second mode index and the MPM list; wherein the first intra-frame prediction mode and the second intra-frame prediction mode are two different intra-frame angle prediction modes; determine the weight matrix of the current block, and determine the prediction value of the current block based on the first intra-frame prediction mode, the second intra-frame prediction mode and the weight matrix.
[0497] In addition, the functional modules in this embodiment may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware or software functional modules.
[0498] If the integrated unit is implemented in the form of a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method of this embodiment. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0499] An embodiment of the present application provides an encoder and a decoder. The decoder decodes a bitstream and determines intra-frame prediction mode parameters for a current block. When the intra-frame prediction mode parameters indicate that the current block uses an IWCP mode to determine an intra-frame prediction value for the current block, the decoder determines a first mode index and a second mode index for the current block. The decoder constructs a most probable mode (MPM) list for the current block. The decoder determines a first intra-frame prediction mode and a second intra-frame prediction mode for the current block based on the first mode index, the second mode index, and the MPM list. The first intra-frame prediction mode and the second intra-frame prediction mode are two different intra-frame angular prediction modes. The decoder determines a prediction value for the current block based on the first intra-frame prediction mode, the second intra-frame prediction mode, and the weight matrix. The decoder also determines a first intra-frame prediction mode and a second intra-frame prediction mode for the current block when the intra-frame prediction value for the current block uses an IWCP mode. The first intra-frame prediction mode and the second intra-frame prediction mode are two different intra-frame angular prediction modes. The decoder constructs an MPM list for the current block. The decoder determines a first mode index and a second mode index for the current block based on the first intra-frame prediction mode, the second intra-frame prediction mode, and the MPM list. The decoder writes the first mode index and the second mode index into the bitstream. That is to say, in an embodiment of the present application, the codec can determine two different prediction blocks of the current block through two different intra-frame angle prediction modes, and then combine them through a variety of weight matrices to finally obtain a more complex prediction block. On the basis of improving the accuracy of intra-frame prediction, it can reduce the hardware implementation cost, reduce complexity, and implement a simple and efficient encoding and decoding method, thereby improving compression performance.
[0500] The embodiments of the present application provide a computer-readable storage medium and a computer-readable storage medium, on which a program is stored. When the program is executed by a processor, the method described in the above embodiments is implemented.
[0501] Specifically, the program instructions corresponding to an intra-frame prediction method in this embodiment may be stored on a storage medium such as an optical disk, a hard disk, or a USB flash drive. When the program instructions corresponding to an intra-frame prediction method in the storage medium are read or executed by an electronic device, the following steps are included:
[0502] Decode the code stream and determine the intra-frame prediction mode parameters of the current block;
[0503] When the intra prediction mode parameter indicates that the current block uses the IWCP mode to determine the intra prediction value of the current block, determining a first mode index and a second mode index of the current block;
[0504] Constructing a most probable mode (MPM) list for the current block;
[0505] Determine a first intra prediction mode and a second intra prediction mode of the current block according to the first mode index, the second mode index, and the MPM list; wherein the first intra prediction mode and the second intra prediction mode are two different intra angular prediction modes;
[0506] A weight matrix of a current block is determined, 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.
[0507] The following steps are also included:
[0508] When the current block uses the IWCP mode to determine the intra prediction value of the current block, determining a first intra prediction mode and a second intra prediction mode of the current block; wherein the first intra prediction mode and the second intra prediction mode are two different intra angular prediction modes;
[0509] Constructing an MPM list for the current block;
[0510] Determine a first mode index and a second mode index of the current block according to the first intra prediction mode, the second intra prediction mode, and the MPM list;
[0511] The first mode index and the second mode index are written into a code stream.
[0512] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage and optical storage, etc.) containing computer-usable program code.
[0513] The present application is described with reference to the implementation flow charts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flow charts and / or block diagrams, as well as the combination of processes and / or boxes in the flow charts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the implementation flow charts. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0514] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which is implemented in the implementation flow diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0515] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process described in the flowchart. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0516] The above description is merely a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application.
[0517] Industrial Applicability
[0518] An embodiment of the present application provides an intra-frame prediction method, an encoder, a decoder, and a storage medium. The decoder decodes a code stream and determines an intra-frame prediction mode parameter of a current block; when the intra-frame prediction mode parameter indicates that the current block uses an IWCP mode to determine an intra-frame prediction value of the current block, the first mode index and the second mode index of the current block are determined; a most probable mode (MPM) list of the current block is constructed; a first intra-frame prediction mode and a second intra-frame prediction mode of the current block are determined according to the first mode index, the second mode index, and the MPM list; wherein the first intra-frame prediction mode and the second intra-frame prediction mode are two different intra-frame angle prediction modes; a weight matrix of the current block is determined, and a prediction value of the current block is determined based on the first intra-frame prediction mode, the second intra-frame prediction mode, and the weight matrix. When the encoder determines the intra-frame prediction value of the current block using the IWCP mode, it determines the first intra-frame prediction mode and the second intra-frame prediction mode of the current block; wherein the first intra-frame prediction mode and the second intra-frame prediction mode are two different intra-frame angle prediction modes; constructs an MPM list for the current block; determines the first mode index and the second mode index of the current block based on the first intra-frame prediction mode, the second intra-frame prediction mode, and the MPM list; and writes the first mode index and the second mode index into the bitstream. In other words, in an embodiment of the present application, the codec can determine two different prediction blocks of the current block using two different intra-frame angle prediction modes, and then combine them using a variety of weight matrices to ultimately obtain a more complex prediction block. On the basis of improving the accuracy of intra-frame prediction, it can reduce the hardware implementation cost and complexity, and realize a simple and efficient encoding and decoding method, thereby improving compression performance.
Claims
1. An intra-frame prediction method, applied to a decoder, comprising: Decode the code stream and determine the intra-frame prediction mode parameters of the current block; When the intra prediction mode parameter indicates that the current block uses an intra weighted combination prediction mode to determine an intra prediction value of the current block, determining a first mode index and a second mode index of the current block; Constructing a most probable mode (MPM) list for the current block; Determine a first intra prediction mode and a second intra prediction mode of the current block according to the first mode index, the second mode index, and the MPM list; wherein the first intra prediction mode and the second intra prediction mode are two different intra angular prediction modes; A weight matrix of the current block is determined, 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.
2. The method according to claim 1, wherein The method further comprises: Determining a weight matrix derivation mode for the current block; The constructing of the MPM list of the current block includes: The MPM list is constructed based on the prediction modes of the neighboring blocks of the current block and the weight matrix derivation mode.
3. The method according to claim 1, wherein The method further comprises: Determining a weight matrix derivation mode for the current block; The constructing of the MPM list of the current block includes: Constructing the MPM list based on the prediction modes of the neighboring blocks of the current block, the preset angle prediction mode set, and the weight matrix derivation mode; The constructing the MPM list based on the intra prediction mode of the neighboring blocks of the current block, the preset angle prediction mode set, and the weight matrix derivation mode includes: Determining a first candidate mode using the prediction mode of the adjacent block; Determine a second candidate mode by deriving a mode using the weight matrix; The MPM list is constructed according to the first candidate mode, the second candidate mode and the preset angle prediction mode set.
4. The method according to claim 3, wherein: The determining the first candidate mode by using the prediction mode of the adjacent block includes: If the adjacent block is a normal intra-frame prediction block, and the prediction mode of the adjacent block is an intra-frame prediction mode, determining the prediction mode of the adjacent block as the first candidate mode; or The step of using the weight matrix to derive a mode and determining a second candidate mode includes: Determining a dividing line angle index value according to the weight matrix derivation mode; The second candidate mode is determined using the dividing line angle index value.
5. The method according to claim 3, wherein The constructing the MPM list according to the first candidate mode, the second candidate mode, and the preset angle prediction mode set includes: Filtering the first candidate mode based on the preset angle prediction mode set to obtain a filtered candidate mode; Constructing the MPM list according to the filtered candidate mode and the second candidate mode; The filtering the first candidate mode based on the preset angle prediction mode set to obtain a filtered candidate mode includes: If the first candidate mode belongs to the preset angle prediction mode set, determining the first candidate mode as the filtered candidate mode; If the first candidate mode is an intra angular prediction mode and does not belong to the preset angular prediction mode set, determining a replacement mode for the first candidate mode in the preset angular prediction mode set, and determining the replacement mode as the filtered candidate mode; The method further comprises: If the first candidate mode is not an intra angular prediction mode, the first candidate mode is not added to the MPM list.
6. The method according to claim 3, wherein: The constructing the MPM list according to the first candidate mode, the second candidate mode, and the preset angle prediction mode set includes: Filtering the first candidate mode based on the preset angle prediction mode set to obtain a filtered candidate mode; Constructing the MPM list according to the filtered candidate mode and the second candidate mode; The constructing the MPM list according to the filtered candidate mode and the second candidate mode includes: If the candidate mode after screening meets the preset adding condition, the candidate mode after screening is added to the MPM list; If the MPM list does not meet the preset list length L, and the second candidate mode meets the preset addition condition, the second candidate mode is added to the MPM list; wherein L is an integer greater than or equal to 1.
7. The method according to claim 6, wherein: The method further comprises: If the filtered candidate mode is different from any of the prediction modes in the MPM list, determining that the filtered candidate mode meets the preset adding condition; If the second candidate mode is different from any prediction mode in the MPM list, it is determined that the second candidate mode meets the preset adding condition.
8. The method according to claim 6, wherein: The method further comprises: Determine a first mapping relationship table between index values and binary symbol strings; wherein the first mapping relationship table includes binary symbol strings of a first length, a second length, and a third length, respectively. in, The prediction mode in the MPM list uses a binary symbol string of the first length; Other prediction modes in the preset angular prediction mode set outside the MPM list use the binary symbol string of the second length and the binary symbol string of the third length.
9. The method according to claim 8, wherein The determining, according to the first mode index, the second mode index, and the MPM list, the first intra prediction mode and the second intra prediction mode of the current block includes: Determine the value i of the first mode index according to the first mapping relationship table; If i is greater than or equal to 0 and less than L, determining the angular prediction mode with index i in the MPM list as the first intra prediction mode; If i is greater than or equal to L, the first intra prediction mode is determined by using the preset angular prediction mode set and the MPM list.
10. The method according to claim 1, wherein The method further comprises: Determining a weight matrix derivation mode for the current block; Determining the weight matrix of the current block includes: Determining a weight matrix for the current block according to the weight matrix derivation mode; The determining, based on the first intra prediction mode, the second intra prediction mode, and the weight matrix, a prediction value of the current block includes: Determine a first prediction value of the current block according to the first intra prediction mode; determine a second prediction value of the current block according to the second intra prediction mode; The first prediction value and the second prediction value are weighted by using the weight matrix to obtain the prediction value of the current block.
11. The method according to claim 1, wherein The method further comprises: The prediction modes in the MPM list are all intra-frame angular prediction modes.
12. An intra-frame prediction method, applied to an encoder, the method comprising: When the current block uses the intra-frame weighted combination prediction mode to determine the intra-frame prediction value of the current block, determining a first intra-frame prediction mode and a second intra-frame prediction mode of the current block; wherein the first intra-frame prediction mode and the second intra-frame prediction mode are two different intra-frame angular prediction modes; Constructing a most probable mode (MPM) list for the current block; Determine a first mode index and a second mode index of the current block according to the first intra prediction mode, the second intra prediction mode, and the MPM list; The first mode index and the second mode index are written into a code stream.
13. The method according to claim 12, wherein: The method further comprises: Determining a weight matrix derivation mode for the current block; The constructing of the MPM list of the current block includes: The MPM list is constructed based on the prediction modes of the neighboring blocks of the current block and the weight matrix derivation mode.
14. The method according to claim 12, wherein: The method further comprises: Determining a weight matrix derivation mode for the current block; The constructing of the MPM list of the current block includes: Constructing the MPM list based on the prediction modes of the neighboring blocks of the current block, the preset angle prediction mode set, and the weight matrix derivation mode; The constructing the MPM list based on the intra prediction mode of the neighboring blocks of the current block, the preset angle prediction mode set, and the weight matrix derivation mode includes: Determining a first candidate mode using the prediction mode of the adjacent block; Determine a second candidate mode by deriving a mode using the weight matrix; The MPM list is constructed according to the first candidate mode, the second candidate mode and the preset angle prediction mode set.
15. The method according to claim 14, wherein The determining the first candidate mode by using the prediction mode of the adjacent block includes: If the adjacent block is a normal intra-frame prediction block, and the prediction mode of the adjacent block is an intra-frame prediction mode, determining the prediction mode of the adjacent block as the first candidate mode; or The step of using the weight matrix to derive a mode and determining a second candidate mode includes: Determining a dividing line angle index value according to the weight matrix derivation mode; The second candidate mode is determined using the dividing line angle index value.
16. The method according to claim 14, wherein The constructing the MPM list according to the first candidate mode, the second candidate mode, and the preset angle prediction mode set includes: Filtering the first candidate mode based on the preset angle prediction mode set to obtain a filtered candidate mode; Constructing the MPM list according to the filtered candidate mode and the second candidate mode; The filtering the first candidate mode based on the preset angle prediction mode set to obtain a filtered candidate mode includes: If the first candidate mode belongs to the preset angle prediction mode set, determining the first candidate mode as the filtered candidate mode; If the first candidate mode is an intra angular prediction mode and does not belong to the preset angular prediction mode set, determining a replacement mode for the first candidate mode in the preset angular prediction mode set, and determining the replacement mode as the filtered candidate mode; The method further comprises: If the first candidate mode is not an intra angular prediction mode, the first candidate mode is not added to the MPM list.
17. The method according to claim 14, wherein: The constructing the MPM list according to the first candidate mode, the second candidate mode, and the preset angle prediction mode set includes: Filtering the first candidate mode based on the preset angle prediction mode set to obtain a filtered candidate mode; Constructing the MPM list according to the filtered candidate mode and the second candidate mode; The constructing the MPM list according to the filtered candidate mode and the second candidate mode includes: If the candidate mode after screening meets the preset adding condition, the candidate mode after screening is added to the MPM list; If the MPM list does not meet the preset list length L, and the second candidate mode meets the preset addition condition, the second candidate mode is added to the MPM list; wherein L is an integer greater than or equal to 1.
18. The method according to claim 17, wherein The method further comprises: Determine a first mapping relationship table between index values and binary symbol strings; wherein the first mapping relationship table includes binary symbol strings of a first length, a second length, and a third length respectively; in, The prediction mode in the MPM list uses a binary symbol string of the first length; Other prediction modes in the preset angular prediction mode set outside the MPM list use the binary symbol string of the second length and the binary symbol string of the third length.
19. The method according to claim 12, wherein: The method further comprises: Determining a weight matrix derivation mode for the current block; Determining a weight matrix for the current block according to the weight matrix derivation mode; Determine a first prediction value of the current block according to the first intra prediction mode; determine a second prediction value of the current block according to the second intra prediction mode; The first prediction value and the second prediction value are weighted by using the weight matrix to obtain the prediction value of the current block.
20. An encoder, comprising: The first determination part, the first construction part, the encoding part, The first determining portion is configured to determine a first intra-frame prediction mode and a second intra-frame prediction mode of the current block when the current block uses an intra-frame weighted combination prediction mode to determine the intra-frame prediction value of the current block; wherein the first intra-frame prediction mode and the second intra-frame prediction mode are two different intra-frame angular prediction modes; The first building part is configured to build a most probable mode (MPM) list of the current block; The first determining part is further configured to determine a first mode index and a second mode index of the current block according to the first intra prediction mode, the second intra prediction mode and the MPM list; The encoding part is configured to write the first mode index and the second mode index into a code stream.
21. A decoder, comprising: Decoding part, second determination part, second construction part, The decoding part is configured to decode the code stream; The second determining part is configured to determine an intra prediction mode parameter of the current block; when the intra prediction mode parameter indicates that the current block uses an intra weighted combination prediction mode to determine the intra prediction value of the current block, determine a first mode index and a second mode index of the current block; a second building part configured to build a most probable mode (MPM) list of the current block; The second determining part is further configured to determine a first intra prediction mode and a second intra prediction mode of the current block according to the first mode index, the second mode index, and the MPM list; wherein the first intra prediction mode and the second intra prediction mode are two different intra angular prediction modes; A weight matrix of the current block is determined, 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.
Citation Information
Patent Citations
Devices and methods for image and video coding
CN112385234A
Matrix derivation in intra coding mode
WO2020211807A1