Encoding method, decoding method, encoder, decoder, and storage medium
By introducing the prediction effect of MPDIP mode into video encoding and decoding, the problem of unreasonable construction of candidate intra-frame prediction mode set in the existing technology is solved, and the encoding and decoding efficiency is improved.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
- Filing Date
- 2024-12-23
- Publication Date
- 2026-07-02
AI Technical Summary
Existing technologies do not consider the conversion of traditional intra-prediction modes to matrix-based intra-angle prediction mode (MPDIP) when constructing candidate intra-prediction mode sets, resulting in low encoding and decoding efficiency.
By introducing MPDIP modes into the candidate intra-prediction mode set for constructing the current block, and calculating the prediction cost of MPDIP modes to determine the ranking position of the candidate intra-prediction modes, the rationality of the candidate intra-prediction mode set is improved.
It improves the efficiency of video encoding and decoding by constructing a reasonable set of candidate intra-frame prediction modes, thereby enhancing the performance of encoding and decoding.
Smart Images

Figure CN2024141644_02072026_PF_FP_ABST
Abstract
Description
Encoding and decoding methods, codecs, and storage media Technical Field
[0001] This application relates to the field of video encoding and decoding technology, and in particular to an encoding and decoding method, an encoder and decoder, and a storage medium. Background Technology
[0002] Before encoding and decoding the current block based on the traditional intra-prediction mode, a set of candidate intra-prediction modes for the current block is first constructed, and then the intra-prediction mode to be used by the current block is selected from this set. However, the way the candidate intra-prediction mode set is constructed in related technologies still has unreasonable aspects, which reduces the efficiency of encoding and decoding. Summary of the Invention
[0003] This application provides an encoding / decoding method, an encoding / decoding method, and a storage medium. The various aspects covered in this application are described below.
[0004] In a first aspect, a decoding method is provided, which is applied to a decoder. The decoding method includes: determining a set of candidate intra-prediction modes for the current block; determining a target intra-prediction mode for the current block based on the set of candidate intra-prediction modes; determining a prediction block for the current block based on the target intra-prediction mode; and determining a reconstructed block for the current block based on the prediction block.
[0005] Secondly, an encoding method is provided, which is applied to an encoder. The encoding method includes: determining a set of candidate intra-prediction modes for the current block; determining a target intra-prediction mode for the current block based on the set of candidate intra-prediction modes; determining a prediction block for the current block based on the target intra-prediction mode; and determining a residual block for the current block based on the prediction block.
[0006] Thirdly, a decoder is provided, comprising: a first determining unit configured to determine a set of candidate intra-prediction modes for the current block; a second determining unit configured to determine a target intra-prediction mode for the current block based on the set of candidate intra-prediction modes; a third determining unit configured to determine a prediction block for the current block based on the target intra-prediction mode; and a fourth determining unit configured to determine a reconstructed block for the current block based on the prediction block.
[0007] Fourthly, a decoder is provided, comprising: a memory for storing a computer program; and a processor for executing the method of the first aspect when running the computer program.
[0008] Fifthly, an encoder is provided, comprising: a first determining unit configured to determine a set of candidate intra-prediction modes for a current block; a second determining unit configured to determine a target intra-prediction mode for the current block based on the set of candidate intra-prediction modes; a third determining unit configured to determine a prediction block for the current block based on the target intra-prediction mode; and a fourth determining unit configured to determine a residual block for the current block based on the prediction block.
[0009] In a sixth aspect, an encoder is provided, comprising: a memory for storing a computer program; and a processor for executing the method of the second aspect when running the computer program.
[0010] In a seventh aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program that, when executed, implements the method as described in the first or second aspect.
[0011] Eighthly, a non-volatile computer-readable storage medium is provided for storing a bit stream, the bit stream being generated by an encoding method using an encoder, or the bit stream being decoded by a decoding method using a decoder, wherein the decoding method is as described in the first aspect and the encoding method is as described in the second aspect.
[0012] Ninth aspect, a computer-readable storage medium is provided, which stores a bitstream generated according to the method of the second aspect.
[0013] Related technologies, when constructing the candidate intra-prediction mode set, do not consider that some traditional intra-prediction modes are converted to matrix-based position-dependent intra-prediction (MPDIP) mode for prediction. This application's embodiments introduce MPDIP mode prediction into the construction of the candidate intra-prediction mode set for the current block, making the constructed candidate intra-prediction mode set more reasonable, thereby helping to improve encoding and decoding efficiency. Attached Figure Description
[0014] Figure 1 is a structural example diagram of a video encoder applicable to embodiments of this application.
[0015] Figure 2 is a structural example diagram of a video decoder applicable to embodiments of this application.
[0016] Figure 3 is a schematic diagram of the adjacent blocks of the current block.
[0017] Figure 4 is a schematic diagram of a non-adjacent block of the current block.
[0018] Figure 5A is a schematic diagram of the left template of the current block.
[0019] Figure 5B is a schematic diagram of the upper template of the current block.
[0020] Figure 5C is a schematic diagram of the upper and left templates of the current block.
[0021] Figure 6 is a schematic diagram of a prediction of the current block based on the MPDIP pattern.
[0022] Figure 7 is a flowchart illustrating the decoding method provided in an embodiment of this application.
[0023] Figure 8A is a schematic diagram of the reference area of the upper template based on MPDIP prediction provided in an embodiment of this application.
[0024] Figure 8B is a schematic diagram of the reference area of the left template based on MPDIP prediction provided in an embodiment of this application.
[0025] Figure 9A is a schematic diagram of the reference area of the upper template provided in the embodiment of this application.
[0026] Figure 9B is a schematic diagram of the reference area of the left template provided in the embodiment of this application.
[0027] Figure 10 is a flowchart illustrating the encoding method provided in an embodiment of this application.
[0028] Figure 11 is a schematic diagram of the structure of a decoder provided in one embodiment of this application.
[0029] Figure 12 is a schematic diagram of the structure of a decoder provided in another embodiment of this application.
[0030] Figure 13 is a schematic diagram of the encoder provided in one embodiment of this application.
[0031] Figure 14 is a schematic diagram of the encoder provided in another embodiment of this application. Detailed Implementation
[0032] The technical solutions in this application will now be described with reference to the accompanying drawings.
[0033] Figure 1 is a schematic block diagram of a video encoder involved in an embodiment of this application.
[0034] It should be understood that the video encoder 100 can be used for lossy compression of images or lossless compression of images. The lossless compression can be visually lossless compression or mathematically lossless compression.
[0035] This video encoder 100 can be applied to image data in luminance / chrominance (YCbCr, YUV) format. For example, the YUV ratio can be 4:2:0, 4:2:2, or 4:4:4, where Y represents luminance (Luma), Cb (U) represents blue chrominance, Cr (V) represents red chrominance, and U and V represent chrominance (Chroma) used to describe color and saturation. For example, in color format, 4:2:0 means that there are 4 luminance components and 2 chrominance components (YYYYCbCr) for every 4 samples; 4:2:2 means that there are 4 luminance components and 4 chrominance components (YYYYCbCrCbCr) for every 4 samples; and 4:4:4 means that all samples are displayed (YYYYCbCrCbCrCbCrCbCr).
[0036] For example, the video encoder 100 reads video data and, for each image in the video data, divides the image into several coding tree units (CTUs). In some examples, CTUs may be called "tree blocks," "largest coding unit" (LCU), or "coding tree block" (CTB). Each CTU can be associated with a sample block of equal size within the image. Each sample can correspond to one luminance (luma) sample and two chrominance (chroma) samples. Therefore, each CTU can be associated with one luminance sample block and two chrominance sample blocks. The size of a CTU is, for example, 128×128, 64×64, 32×32, etc. A CTU can be further divided into several coding units (CUs) for encoding. CUs can be rectangular or square blocks. CUs can correspond to prediction units (PUs) and transform units (TUs).
[0037] In some embodiments, as shown in FIG1, the video encoder 100 may include: a prediction module 110, a residual module 120, a transform / quantization module 130, an inverse transform / quantization module 140, a reconstruction module 150, a loop filtering module 160, a decoded image buffer 170, and an entropy coding module 180. It should be noted that the video encoder 100 may include more, fewer, or different functional components.
[0038] Optionally, in this application, the current block can be referred to as the current coding unit (CU). A prediction block can also be referred to as a prediction image block or image prediction block, and a reconstructed image block can also be referred to as a reconstruction block or image reconstruction block. Due to the need for parallel processing, an image can be divided into slices. Slices within the same image can be processed in parallel, meaning there is no data dependency between them. A "frame" is a commonly used term, generally understood as one image. In this document, "frame" can also be replaced with "image" or "slice," etc.
[0039] In some embodiments, the prediction module 110 includes an inter-frame prediction module 111 and an intra-frame prediction module 112. Because there is a strong correlation between adjacent samples in an image of a video, intra-frame prediction is used in video encoding and decoding techniques to eliminate spatial redundancy between adjacent samples. Because there is a strong similarity between adjacent images in a video, inter-frame prediction is used in video encoding and decoding techniques to eliminate temporal redundancy between adjacent images, thereby improving coding efficiency.
[0040] The inter-frame prediction module 111 can be used for inter-frame prediction, which can include motion estimation and motion compensation. It can reference image information from different images. Inter-frame prediction uses motion information to find reference blocks in the reference images and generates prediction blocks based on these reference blocks to eliminate temporal redundancy. The motion information includes a list of reference images, the reference image index, and motion vectors. Motion vectors can be whole-sample or multi-sample. If the motion vectors are multi-sample, interpolation filtering needs to be used in the reference images to create the required multi-sample blocks. Here, the whole-sample or multi-sample block in the reference image found based on the motion vector is called the reference block. Some techniques directly use the reference block as the prediction block, while others process the reference block further to generate the prediction block. Processing the reference block further to generate the prediction block can also be understood as using the reference block as the prediction block and then processing it to generate a new prediction block.
[0041] The intra-frame prediction module 112 refers only to information from the same image to predict sample information within the current code image block, thereby eliminating spatial redundancy.
[0042] Intra-frame prediction has multiple prediction modes. Taking the international digital video coding standards H-series as an example, the H.264 / AVC standard has 8 angular prediction modes and 1 non-angular prediction mode, while H.265 / HEVC extends this to 33 angular prediction modes and 2 non-angular prediction modes. High Efficiency Video Coding (HEVC) uses Planar, DC, and 33 angular modes, for a total of 35 prediction modes. Versatile Video Coding (VVC) uses Planar, DC, and 65 angular modes, for a total of 67 prediction modes.
[0043] It should be noted that with the increase in angle modes, intra-frame prediction will be more accurate and better meet the needs of the development of high-definition and ultra-high-definition digital video.
[0044] The residual module 120 can generate a residual block of the CU based on the sample block of the CU and the prediction block of the CU. For example, the residual module 120 can generate a residual block of the CU such that each sample in the residual block has a value equal to the difference between the sample in the sample block of the CU and the corresponding sample in the prediction block of the CU.
[0045] Transform / quantization module 130 quantizes transform coefficients. Transform / quantization module 130 quantizes transform coefficients associated with the CU based on quantization parameter (QP) values associated with the CU. Video encoder 100 can adjust the degree of quantization applied to the transform coefficients associated with the CU by adjusting the QP values associated with the CU.
[0046] The inverse transform / quantization module 140 can apply inverse quantization and inverse transform to the quantized transform coefficients to reconstruct the residual block from the quantized transform coefficients.
[0047] The reconstruction module 150 can add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by the prediction module 110 to produce reconstructed image blocks associated with the CU. By reconstructing each sample block of the CU in this way, the video encoder 100 can reconstruct the sample blocks of the CU.
[0048] The loop filtering module 160 is used to process the samples after inverse transformation and inverse quantization to compensate for distorted information and provide a better reference for subsequent encoded samples. For example, it can perform deblocking filtering to reduce the block effect of sample blocks associated with CU.
[0049] In some embodiments, the loop filtering module 160 includes a deblocking filtering module and a sample adaptive compensation / adaptive loop filtering (SAO / ALF) module, wherein the deblocking filtering module is used to remove block effects, and the SAO / ALF module is used to remove ringing effects.
[0050] The decoded image buffer 170 can store reconstructed sample blocks. The inter-frame prediction module 111 can use a reference image containing the reconstructed sample blocks to perform inter-frame prediction on PUs in other images. In addition, the intra-frame prediction module 112 can use the reconstructed sample blocks in the decoded image buffer 170 to perform intra-frame prediction on other PUs in the same image as the CU.
[0051] The entropy encoding module 180 can receive quantized transform coefficients from the transform / quantization module 130. The entropy encoding module 180 can perform one or more entropy encoding operations on the quantized transform coefficients to produce entropy-encoded data.
[0052] Figure 2 is a schematic block diagram of a video decoder involved in an embodiment of this application.
[0053] As shown in Figure 2, the video decoder 200 includes: an entropy decoding module 210, a prediction module 220, an inverse quantization / transformation module 230, a reconstruction module 240, a loop filtering module 250, and a decoded image buffer 260. It should be noted that the video decoder 200 may contain more, fewer, or different functional components.
[0054] Video decoder 200 can receive a bitstream. Entropy decoding module 210 can parse the bitstream to extract syntax elements. As part of parsing the bitstream, entropy decoding module 210 can parse the entropy-encoded syntax elements in the bitstream. Prediction module 220, dequantization / transform module 230, reconstruction module 240, and loop filtering module 250 can decode video data based on the syntax elements extracted from the bitstream, i.e., generate decoded video data.
[0055] In some embodiments, the prediction module 220 includes an intra-frame prediction module 222 and an inter-frame prediction module 221.
[0056] Intra-prediction module 222 can perform intra-prediction to generate prediction blocks for the PU. Intra-prediction module 222 can use an intra-prediction mode to generate prediction blocks for the PU based on sample blocks of spatially adjacent PUs. Intra-prediction module 222 can also determine the intra-prediction mode of the PU based on one or more syntax elements parsed from the bitstream.
[0057] Inter-frame prediction module 221 can construct a first reference image list (list 0) and a second reference image list (list 1) based on the syntax elements parsed from the bitstream. Furthermore, if the PU uses inter-frame prediction coding, entropy decoding module 210 can parse the motion information of the PU. Inter-frame prediction module 221 can determine one or more reference blocks of the PU based on the motion information of the PU. Inter-frame prediction module 221 can generate prediction blocks for the PU based on one or more reference blocks of the PU.
[0058] The dequantization / transformation module 230 reversibly quantizes (i.e., dequantizes) the transform coefficients associated with the TU. The dequantization / transformation module 230 can use the QP value associated with the CU of the TU to determine the degree of quantization.
[0059] After the inverse quantization transform coefficients, the inverse quantization / transformation module 230 can apply one or more inverse transforms to the inverse quantization transform coefficients to generate a residual block associated with TU.
[0060] The reconstruction module 240 uses the residual block associated with the TU of the CU and the prediction block of the PU of the CU to reconstruct the sample block of the CU. For example, the reconstruction module 240 can add the samples of the residual block to the corresponding samples of the prediction block to reconstruct the sample block of the CU, thereby obtaining the reconstructed image block.
[0061] The loop filter module 250 can perform deblocking filtering operations to reduce the block effect of sample blocks associated with the CU.
[0062] The video decoder 200 can store the reconstructed image of the CU in the decoded image buffer 260. The video decoder 200 can use the reconstructed image in the decoded image buffer 260 as a reference image for subsequent prediction, or transmit the reconstructed image to a display device for presentation.
[0063] The basic process of video encoding and decoding is as follows: At the encoding end, an image is divided into blocks. For the current block, the prediction module 110 uses intra-frame prediction or inter-frame prediction to generate a prediction block for the current block. The residual module 120 can calculate a residual block based on the prediction block and the original block of the current block, that is, the difference between the prediction block and the original block of the current block. This residual block can also be called residual information. This residual block is transformed and quantized by the transform / quantization module 130, which can remove information that is not sensitive to the human eye to eliminate visual redundancy. Optionally, the residual block before transformation and quantization by the transform / quantization module 130 can be called a temporal residual block, and the temporal residual block after transformation and quantization by the transform / quantization module 130 can be called a frequency residual block or a frequency domain residual block. The entropy coding module 180 receives the quantized change coefficients output by the transform / quantization module 130, and can perform entropy coding on the quantized change coefficients to output a bitstream. For example, the entropy coding module 180 can eliminate character redundancy based on the target context model and the probability information of the binary bitstream.
[0064] At the decoding end, the entropy decoding module 210 parses the bitstream to obtain the prediction information and quantization coefficient matrix of the current block. The prediction module 220 uses the prediction information to generate a prediction block for the current block using intra-frame prediction or inter-frame prediction. The inverse quantization / transform module 230 uses the quantization coefficient matrix obtained from the bitstream to perform inverse quantization and inverse transform on the quantization coefficient matrix to obtain a residual block. The reconstruction module 240 adds the prediction block and the residual block to obtain a reconstructed block. The reconstructed blocks form a reconstructed image. The loop filtering module 250 performs loop filtering on the reconstructed image based on the image or based on the blocks to obtain a decoded image. The encoding end also requires similar operations to the decoding end to obtain a decoded image. This decoded image can also be called a reconstructed image, which can be used as a reference image for inter-frame prediction of subsequent images.
[0065] It should be noted that the block partitioning information determined at the encoding end, as well as mode information or parameter information such as prediction, transform, quantization, entropy coding, and loop filtering, are carried in the bitstream when necessary. The decoding end determines the same block partitioning information, prediction, transform, quantization, entropy coding, and loop filtering mode information or parameter information as the encoding end by parsing the bitstream and analyzing existing information, thereby ensuring that the decoded image obtained by the encoding end is the same as the decoded image obtained by the decoding end.
[0066] It is understandable that the "inverse transformation" of the transform coefficients at the decoding end can also be referred to as "transformation" in standard texts. In the embodiments of this application, "transformation" and "inverse transformation" correspond to two opposite processes. For example, "transformation" converts spatial domain values to frequency domain coefficients, while "inverse transformation" converts frequency domain coefficients back to spatial domain values. If the standard only specifies decoding, then "transformation" in the standard text refers to the decoding part, specifically the "inverse transformation" in this document. The "inverse transformation" of the transform coefficients at the decoding end can also be referred to as "transformation" in standard texts.
[0067] The above describes the basic flow of a video codec under a block-based hybrid coding framework. With the development of technology, some modules or steps of this framework or flow may be optimized. This application is applicable to the basic flow of a video codec under this block-based hybrid coding framework, but is not limited to this framework and flow.
[0068] The encoding / decoding framework provided in the embodiments of this application has been described in detail above. This application relates to the most probable mode (MPM) technology. MPM technology can be applied to the prediction module in the encoding / decoding framework. The relevant concepts in MPM technology will be introduced below.
[0069] In traditional codec frameworks, if the current block uses a standard intra-prediction encoding / decoding mode, an MPM (Multi-Modulation Model) list is constructed before encoding / decoding the current block. The MPM list consists of two parts: PMPM and SMPM. The MPM list contains multiple candidate intra-prediction modes; PMPM contains 6 candidate modes, and SMPM contains 16 candidate modes, for a total of 22 candidate intra-prediction modes. The following section describes how the MPM list is constructed.
[0070] The first step is to select Planar mode as the first candidate intra-prediction mode in the MPM list.
[0071] The second step is to add the intra-prediction modes of adjacent blocks to the MPM list. For example, Figure 3 shows a schematic diagram of adjacent blocks of the current block. As shown in Figure 3, the current block is a codec block with a width of W and a height of H. The method for determining the adjacent blocks of the current block includes: taking the top-left corner coordinates (x, y) of the current block as the origin, first determine the five adjacent positions: left (x-1, y+H-1), top (x+W-1, y-1), top-left (x-1, y-1), top-right (x+W, y-1), and bottom-left (x-1, y+H). Then, based on the codec blocks where these five adjacent positions are located, determine the left adjacent block, top adjacent block, bottom-left adjacent block, top-right adjacent block, and top-left adjacent block.
[0072] The third step is to add the intra-prediction mode derived by template-based intra-mode derivation (DIMD) of the current block to the MPM list.
[0073] The fourth step is to add the intra-prediction modes of the non-adjacent blocks of the current block to the MPM list. For example, Figure 4 shows a schematic diagram of non-adjacent blocks of the current block. As shown in Figure 4, the large block containing the numbers is a codec block of the same size as the current block. The position indicated by the number is used to determine the location of the codec block. Accordingly, the intra-prediction modes of the determined codec blocks are added to the MPM list in ascending order of the numbers.
[0074] The above four steps construct a maximum of M non-repeating candidate intra-prediction modes. It should be understood that if the current block meets the MPM ranking conditions, then M equals 8; if the current CU does not meet the MPM ranking conditions, then M equals 22. It should be understood that the specific value of M may change with technological advancements, and this embodiment is not limited to this. The MPM ranking conditions include the following:
[0075] (1) If the size of the current block is less than or equal to 128 and the slice corresponding to the current block is an intra-predictive slice, then the condition for sorting the MPM list of the current block is met; if the slice corresponding to the current block is an inter-predictive slice and the size of the current block is less than or equal to 1024, then the condition for sorting the MPM list is also met. Otherwise, the current block does not meet the condition for sorting the MPM.
[0076] (2) Further, if the MPM list of the current block meets the sorting conditions, and the number of candidates in the MPM list (excluding the first candidate pattern, i.e., the Planar pattern) is greater than or equal to 6, then template sorting is required for the candidate patterns in the current MPM list. Finally, the candidate patterns in the MPM list will be updated according to the sum of absolute differences (SAD) Cost of the template regions. It should be noted that the first candidate pattern is not sorted when sorting the candidate patterns in the MPM list.
[0077] As mentioned earlier, the MPM list consists of two parts: PMPM and SMPM. The intra-prediction modes obtained using the method described above are first used to construct the PMPM list, but the number of these intra-prediction modes may be insufficient to construct the SMPM list. In this case, the intra-prediction modes in the SMPM list can be generated by adding a certain offset value (such as 1, 2, 3, 4) to the intra-prediction modes in the MPM list.
[0078] If the sum of the PMPM and SMPM lists still does not meet the requirement of 22 intra-prediction modes, some default intra-prediction modes will be added. Specifically: {DC_IDX,VER_IDX,HOR_IDX,VER_IDX-4,VER_IDX+4,14,22,42,58,10,26,38,62,6,30,34,66,2,48,52,16}.
[0079] The above steps complete the construction of the MPM list. After the MPM list is constructed (containing 22 intra-prediction modes), the other 45 intra-prediction modes not included in the MPM list are added to the Non-MPM candidate list. The order of addition is to iterate through the 0-66 intra-prediction modes sequentially, adding those not included in the MPM list to the Non-MPM list.
[0080] After completing the MPM list and Non-MPM list, the intra-prediction mode of the current block can be encoded in the following manner, for example:
[0081] First, determine the index of the intra-prediction mode of the current block in the MPM list. Check if the intra-prediction mode of the current block is in the MPM list. If it is, then `mpmFlag` needs to be encoded as true. Second, check if the intra-prediction mode is in the PMPM list. If it is, then `firstMPMFlag` needs to be further encoded as true, and the corresponding prediction mode in Table 1 needs to be determined based on the intra-prediction mode of the current block, using the corresponding bins to represent the mode. For example, if the intra-prediction mode of the current block is a mode in the MPM list, then `mpmFlag` is 1; if the mode is also in the PMPM, then `firstMPMFlag` is also 1; if the mode corresponds to prediction mode 4 in Table 1, then 11110 will be used to encode this intra-prediction mode.
[0082] Table 1
[0083] If the prediction pattern is not in the PMPM list, then firstMPMFlag needs to be encoded as false and secondMPMFlag needs to be encoded as true. For prediction patterns in the SMPM list, the encoding method in Table 2 is used.
[0084] Table 2
[0085] It should be noted that xx represents the four cases: 00, 01, 10, and 11. For example, when the prediction mode is 0, Bin is 000; when the prediction mode is 1, Bin is 001; when the prediction mode is 2, Bin is 010; and when the prediction mode is 3, Bin is 011.
[0086] Furthermore, if the intra-prediction mode is not in the MPM list, it is in the Non-MPM list. In this case, MPMFlag needs to be encoded as false first, and then fixed-point coding is used for the intra-prediction mode. The decoding method of the intra-prediction mode of the current block will be introduced next.
[0087] First, determine if the intra-prediction mode of the current block is in the MPM list, i.e., decode MPMFlag. If MPMFlag is true, it means the intra-prediction mode of the current block is in the MPM list; otherwise, the intra-prediction mode of the current block is in the Non-MPM list. If MPMFlag is true, further determine if the intra-prediction mode of the current block is in the PMPM list, i.e., decode firstMPMFlag. If firstMPMFlag is true, it means the prediction mode of the current block is in the PMPM list. Then, parse the bins corresponding to the prediction mode using the method shown in Table 3. For example, if the parsed bins are 11110, the corresponding prediction mode is 4, which is the intra-prediction mode of the current block.
[0088] Table 3
[0089] Otherwise, if firstMPMFlag is false, it means that the intra-prediction mode of the current block is in the SMPM list. The following parsing method is used to obtain the prediction mode of the current block. Finally, the prediction mode in Table 4 is added by 6 to obtain the intra-prediction mode of the current block.
[0090] Table 4
[0091] For example, if the parsed Bin is 1001, the corresponding number is 4+1=5, which means that the prediction pattern of the current block is 5+6=11.
[0092] Otherwise, the intra-prediction mode is in the Non-MPM list. Fixed-point decoding is used to obtain the intra-prediction mode of the current block.
[0093] The previous article introduced template sorting for the MPM list. The following article will provide a detailed introduction to the template sorting method for the PMPM list.
[0094] The PMPM list sorting conditions are the same as the MPM sorting conditions described above: if the current block size is less than or equal to 128 and the slice corresponding to the current block is an intra-predictive slice, then the conditions for sorting the MPM list of the current block are met; if the slice corresponding to the current block is an inter-predictive slice and the current block size is less than or equal to 1024, then the conditions for MPM list sorting are also met. Otherwise, the current CU block does not meet the MPM sorting conditions.
[0095] When the PMPM list sorting conditions are met, the SAD Cost of each prediction mode is obtained using the reconstructed samples and predicted samples of the template region. Finally, the candidate intra-prediction modes in the PMPM are sorted in ascending order of SAD Cost. Figure 5A shows a schematic diagram of the left template of the current block. Figure 5B shows a schematic diagram of the upper template of the current block. Figure 5C shows a schematic diagram of the upper and left templates of the current block. When calculating the mode SAD cost, the reconstructed samples of the reference region are first used as the reference samples of the template region. Then, the candidate intra-prediction modes in the PMPM list are used to perform intra-prediction on the samples of the template region to obtain the sample prediction value of the template region. Finally, the SAD cost of the template region corresponding to each candidate intra-prediction mode is calculated using the sample prediction value and the reconstructed value of the template region.
[0096] In current codecs, intra-frame angle prediction modes are divided into traditional intra-frame angle prediction mode and MPDIP mode. MPDIP mode requires certain conditions to be met before it can be activated, which will be described below.
[0097] Table 5
[0098] The startup requirements for MPDIP include:
[0099] (1) The template type of the current block is Left_Above_Templete, which means that the samples of the left template and the upper template have been reconstructed;
[0100] (2) For blocks of different sizes, there will be different numbers of prediction modes. The MPDIP mode is used for intra-frame prediction, as shown in Table 5. If the width and height of the current block are both less than or equal to 16, and the intra-frame prediction mode is 0, 1, (2+2×k), then the mode satisfies MPDIP prediction; otherwise, if the intra-frame prediction mode is 0, 1, (2+4×k), then the mode satisfies MPDIP prediction.
[0101] (3) For blocks of different sizes, reference samples with different numbers of rows and columns must have been reconstructed. See Table 6 for details:
[0102] Table 6
[0103] (4) The current block size is the block size supported by MPDIP mode. The block sizes currently supported by MPDIP mode are: 4×4, 4×8, 8×4, 8×8, 4×16, 16×4, 4×32, 32×4, 8×16, 16×8, 16×16, 8×32, 32×8, 16×32, 32×16, 32×32.
[0104] When the current block meets the conditions (1) to (4) above, the MPDIP mode intra-frame prediction will be performed on the candidate mode of the current block.
[0105] The specific prediction method for the MPDIP pattern is as follows:
[0106] As shown in Figure 6, when performing intra-frame prediction on the current block, if the intra-frame prediction mode can perform MPDIP intra-frame prediction, a reference sample will be obtained based on the current block's position and size. Finally, the prediction information of the current block will be obtained using the reference sample and a preset matrix vector. If the current block does not meet the conditions of the MPDIP mode, the traditional intra-frame angle prediction mode will be used to obtain the prediction information of the current block.
[0107] As described above, before encoding and decoding the current block using the traditional intra-prediction mode, a set of candidate intra-prediction modes (such as the MPM list) is first constructed. Then, the final intra-prediction mode used by the current block is selected from this set. However, the method used in related technologies to construct the candidate intra-prediction mode set does not consider that some traditional intra-prediction modes are converted to MPDIP mode for prediction. For example, when sorting the PMPM list, the SAD cost of the template region of the current block is calculated based on the traditional intra-prediction mode, and the candidate intra-prediction modes in the PMPM list are sorted based on this SAD cost. The PMPM list constructed in this way does not consider whether the candidate intra-prediction modes perform MPDIP mode prediction; instead, it uniformly uses the traditional intra-prediction mode to predict the template region. Obviously, this sorting method of the PMPM list affects the efficiency of encoding and decoding.
[0108] To address the aforementioned issues, this application provides an encoding method comprising: determining a set of candidate intra-prediction modes for a current block; determining a target intra-prediction mode for the current block based on the set of candidate intra-prediction modes; determining a prediction block for the current block based on the target intra-prediction mode; and determining a residual block for the current block based on the prediction block.
[0109] Furthermore, embodiments of this application also provide a decoding method, comprising: determining a candidate intra-prediction mode set for the current block; determining a target intra-prediction mode for the current block based on the candidate intra-prediction mode set; determining a prediction block for the current block based on the target intra-prediction mode; and determining a reconstruction block for the current block based on the prediction block.
[0110] This application incorporates the prediction performance of the MPDIP mode into the candidate intra-prediction mode for constructing the current block, thereby making the constructed candidate intra-prediction mode set more reasonable and thus helping to improve the efficiency of encoding and decoding.
[0111] The decoding method of this application will be described in detail below with examples.
[0112] Figure 7 is a schematic flowchart of the decoding method provided in an embodiment of this application. The method in Figure 7 can be applied to a decoder.
[0113] Referring to Figure 7, in step S710, the candidate intra-prediction mode set for the current block is determined. The current block can refer to the block to be decoded. In some implementations, the current block is a luma block. In other implementations, the current block can also be a chroma block.
[0114] The candidate intra-prediction mode mentioned above can also be called a candidate intra-prediction mode. This candidate intra-prediction mode can be understood as a traditional intra-prediction mode, which can include planar, DC, and angle prediction modes. For example, this candidate intra-prediction mode could be a prediction mode determined from 67 intra-prediction modes.
[0115] The candidate intra-prediction mode set mentioned above can be a set determined from multiple prediction modes of the current block. For example, this set can be an MPM list or a Non-MPM list determined when performing prediction based on an MPM list. Exemplarily, this set can be a PMPM list or an SMPM list within the MPM list. Alternatively, this set can also be a set or list determined based on prediction modes such as TIMD and SGPM.
[0116] As mentioned earlier, the relevant technologies do not take into account that some traditional intra-prediction modes are converted to MPDIP mode for prediction. Therefore, when constructing the candidate intra-prediction mode set, the cost is calculated only based on the traditional intra-prediction modes, and the candidate intra-prediction modes in the PMPM list are sorted based on this cost. This approach is unreasonable and affects encoding and decoding efficiency.
[0117] This application incorporates the prediction performance of the MPDIP mode into the candidate intra-prediction modes for constructing the current block, thereby making the set of candidate intra-prediction modes more reasonable and thus helping to improve the efficiency of encoding and decoding. The decoding methods provided by this application are described below in conjunction with implementation methods one, two, and three.
[0118] Implementation Method 1
[0119] In this embodiment, when determining the position (or sorting position) of a candidate intra-prediction mode (hereinafter referred to as the first candidate intra-prediction mode) in the set, the cost used (hereinafter referred to as the first cost) can be determined based on the MPDIP mode corresponding to the first candidate intra-prediction mode. It should be understood that the correspondence between the first candidate intra-prediction mode and the MPDIP mode here can be interpreted as the first candidate intra-prediction mode satisfying MPDIP mode prediction. For example, when the current block meets a preset size, intra-prediction modes 0,1,(2k+2) satisfy the MPDIP mode, or intra-prediction modes 0,1,(4k+2) satisfy the MPDIP mode.
[0120] The first cost can be the cost of the template region. For example, the first cost can be determined based on the predicted and reconstructed values of the first template region of the current block. Alternatively, the first cost can be determined by the error between the predicted and reconstructed values of the first template region. Here, the cost can refer to the SAD cost.
[0121] The predicted value of the first template region mentioned above can be a predicted value obtained based on the MPDIP mode. For example, the predicted value of the first template region can be determined based on a preset matrix and the reconstructed value of the first reference region. Alternatively, the predicted value of the first template region can be determined based on the product of the preset matrix and the reconstructed value of the first reference region. Here, the preset matrix can be a preset matrix in the MPDIP mode. Different candidate intra-frame prediction modes can correspond to different preset matrices in the MPDIP mode.
[0122] The first template area may include the top template area or the left template area, or the first template area may include both the left template area and the top template area.
[0123] For example, Figure 8A shows a schematic diagram of the reference region of the upper template based on MPDIP prediction provided in an embodiment of this application; Figure 8B shows a schematic diagram of the reference region of the left template based on MPDIP prediction provided in an embodiment of this application. Assume the width of the current block is w, the height is h, and the origin is the coordinate (x, y) of the upper left corner of the current block. The upper template region is the reconstructed sample of the upper reference row of the current block, with a width of w, a height of 1, and its upper left corner coordinate position is (x, y-1); the left template region is the reconstructed sample of the left reference column of the current block, with a width of 1, a height of h, and its upper left corner coordinate position is (x-1, y).
[0124] The first reference region is the reference region for the first template region. The first reference region may include left reference columns and top reference rows. The size of the first reference region mentioned above can be determined based on the size of the current block. For example, the number of left reference columns in the first reference region can be the same as the number of reference columns in the current block; the number of top reference rows in the first reference region can be the same as the number of reference rows in the current block.
[0125] For example, Figure 8A shows the reference sample for the upper template region, and Figure 8B shows the reference sample for the left template region. Assuming the current block has 2 reference rows and 2 reference columns, the top-left corner of the upper reference row sample in the upper template region is (x-2, y-1-2), its width is the width w of the current block (the width of the short reference sample is w, and the width of the long reference sample is 2w), and its height is 2; the top-left corner of the left reference column is (x-2, y), its height is the height h of the current block (the height of the short reference sample is h, and the height of the long reference sample is 2h), and its width is 2. Similarly, the top-left corner of the upper reference row sample in the left template is (x-1-2, y-2), its width is the width w of the current block (the width of the short reference sample is w, and the width of the long reference sample is 2w), and its height is 2; the top-left corner of the left reference column is (x-1-2, y), its height is the height h of the current block (the height of the short reference sample is h, and the height of the long reference sample is 2h), and its width is 2.
[0126] For ease of understanding, the method for determining the first cost will be described exemplarily below with reference to Figures 8A and 8B.
[0127] The first candidate intra-frame prediction mode corresponds to the MPDIP mode, meaning the first cost is determined based on a preset matrix and the reconstructed values of the first reference region. As shown in Figure 8A, after obtaining the reconstructed values of the upper reference row and left reference column of the upper template region, the prediction value of the upper template region is calculated based on the preset matrix in the MPDIP mode and the reconstructed values of the aforementioned reference region. As shown in Figure 8B, after obtaining the reconstructed values of the upper reference row and left reference column of the left template region, the prediction value of the left template region is calculated based on the preset matrix in the MPDIP mode and the reconstructed values of the aforementioned reference region. Then, the SAD cost (i.e., the first cost) corresponding to the current prediction mode is calculated using the reconstructed blocks Recon and Pred of the upper and left template regions. The corresponding calculation formula is as follows: for(int i=0;i<w;++i) for(int j=0;j<h;++j) cost+=abs(pred[i][j]―Recon[i][j])
[0128] Where w is the width of the prediction block Pred and the reconstruction block Recon, and h is the height of the prediction block Pred and the reconstruction block Recon.
[0129] The specific calculation method for abs(*) is as follows:
[0130] After determining the first cost, the ranking position of the first candidate intra-prediction mode in the candidate intra-prediction mode set can be determined based on the cost.
[0131] For example, taking the sorting of the PMPM list as an example, the first candidate intra-frame prediction modes are prediction mode 2 and prediction mode 4. Assume that the sorted PMPM list according to related technologies is {0,1,2,3,4,5}, which is the first PMPM list in Table 7. In this embodiment, the PMPM list is sorted according to the first cost mentioned above, resulting in a sorted PMPM list of {0,4,2,1,3,5}, which is the second PMPM list in Table 7. Clearly, the positions of the candidate intra-frame prediction modes in the first and second PMPM lists change, and their corresponding bins also change.
[0132] Table 7
[0133] Prediction based on the MPDIP pattern corresponding to the candidate intra-frame prediction pattern may yield better results. Therefore, sorting based on the cost determined by the MPDIP pattern is more reasonable. In this way, the prediction pattern most likely to be used in the current block will be represented with fewer bins, thus helping to save codewords and improve encoding and decoding efficiency.
[0134] As mentioned earlier, the activation of MPDIP mode requires certain conditions to be met. Similarly, in some implementations, if the current block meets the first condition, the candidate intra-prediction mode set can be sorted according to the implementation method. If the current block does not meet the first condition, the candidate intra-prediction modes can be sorted according to the cost (or second cost) determined by the candidate intra-prediction mode (i.e., the traditional intra-prediction mode). Here, the first condition is related to whether MPDIP mode is enabled. Or, in other words, the first condition is related to whether MPDIP mode is enabled in the template region; therefore, the first condition can also be called the MPDIP template activation condition.
[0135] For example, the first condition may include the following:
[0136] (1) The template type attribute Left_Above_Templete of the current block (both the left template and the top template exist simultaneously);
[0137] (2) The upper reference sample and the left reference sample of the same size block that is offset one line up from the current block CU exist and have been reconstructed;
[0138] (3) The upper reference sample and the left reference sample of the same size block offset one column to the left of the current block exist and have also been reconstructed;
[0139] (4) The current block size is the block size supported by MPDIP mode.
[0140] Of course, there can be other sorting conditions for the candidate intra-prediction mode set. Taking the candidate intra-prediction mode set as an MPM list as an example, sorting will only be performed using implementation method one after the sorting conditions of the MPM list in related technologies are met. Alternatively, sorting can also be performed using implementation method one if there is at least one candidate intra-prediction mode corresponding to an MPDIP mode in the candidate intra-prediction mode set, and this at least one candidate intra-prediction mode does not include the Planar mode.
[0141] The preceding text introduced how related technologies determine costs based on traditional prediction models. When both the left and upper template regions exist in the current block, taking the reference region of the upper template region as an example, as shown in Figure 5C, its left reference column is not adjacent to the upper template region; there is a left template region between them. In other words, when predicting the template region, the related technologies do not utilize reconstructed samples from neighboring regions, thus failing to achieve accurate prediction and affecting encoding / decoding efficiency.
[0142] To address the aforementioned issues, some implementations, when two template regions for calculating the cost value exist simultaneously (such as a left template region and an upper template region), can use a region adjacent to one side of the current block as a reference sample. In other words, one of the two reference regions can be set to be adjacent to the current block. For example, as shown in Figure 9A, the left reference column of the upper template region can be set to be adjacent to the current block; or, as shown in Figure 9B, the upper reference row of the left template region can be set to be adjacent to the current block. This brings the reference region closer to the template region, fully utilizing the reconstructed samples from neighboring regions for prediction, improving prediction accuracy, and thus contributing to increased encoding / decoding efficiency.
[0143] Furthermore, the left reference column can be a region in the N adjacent columns to the left of the current block, or the upper reference row can be a region in the N adjacent rows above the current block. Here, N is an integer greater than or equal to 1.
[0144] In some implementations, the size of the reference region can be determined based on the size of the reference region corresponding to the current block. For example, if the width of the reference row of the current block is M times the width of the current block, then the width of the reference row of the template region can also be set to M times the width of the current block.
[0145] For example, as shown in Figures 9A and 9B, assume the current block has a width of w and a height of h, with the top-left corner (x, y) as the origin, and the template region has a width of 1. Then, the top-left corner of the upper reference row sample of the upper template is (x, y-2), with a width of w × 8 and a height of 1; the top-left corner of the left reference column is (x-2, y), with a height of h × 8 and a width of 1. Similarly, the top-left corner of the upper reference row sample of the left template is (x-2, y-1), with a width of w × 8 and a height of 1; the top-left corner of the left reference column is (x-2, y), with a height of h × 8 and a width of 1. After obtaining the reference samples of the upper and left templates of the current block, the predicted sample values of the current upper and left template regions are calculated using the reference samples and the traditional angle prediction model. Finally, the reconstructed samples and predicted samples of the upper and left template regions are used to calculate the SAD cost corresponding to the current prediction model.
[0146] As mentioned earlier, the candidate intra-prediction mode set can be either an MPM list or a Non-MPM list. It's important to understand that the sorting method in Implementation Method 1 can be applied only to the PMPM list sorting process, or it can be used for both the PMPM and SMPM lists. Furthermore, after the MPM list is constructed, the remaining candidate intra-prediction modes can also be sorted in the Non-MPM list based on the sorting method in Implementation Method 1.
[0147] Implementation Method Two
[0148] In this embodiment, when constructing the candidate intra-prediction mode set, more candidate intra-prediction modes corresponding to MPDIP templates can be added to the candidate intra-prediction mode set. Prediction based on MPDIP modes yields better results (such as prediction of the luma component), thus providing more accurate intra-prediction modes for the current block and improving encoding and decoding efficiency. The implementation method of the second method is described below.
[0149] First, the third candidate intra-prediction mode for the current block is determined; then, based on the third candidate intra-prediction mode, the fourth candidate intra-prediction mode is determined; finally, the fourth candidate intra-prediction mode is added to the candidate intra-prediction mode set. Here, the fourth candidate intra-prediction mode corresponds to the MPDIP mode.
[0150] The third candidate intra-prediction mode mentioned above can be understood as the initially acquired candidate intra-prediction mode. This third candidate intra-prediction mode may or may not correspond to the MPDIP mode. Taking the construction of the MPM list as an example, the third candidate intra-prediction mode can be the intra-prediction mode of the current block's neighboring blocks, the intra-prediction mode of the current block's non-neighboring blocks, or the intra-prediction mode determined based on the DIMD mode.
[0151] In some implementations, a fourth candidate intra-prediction mode can be determined based on the third candidate intra-prediction mode and the target offset value. This fourth candidate intra-prediction mode can be understood as an intra-prediction mode searched for near the third candidate intra-prediction mode using the target offset value. Alternatively, it can be described as determining other intra-prediction modes with corresponding MPDIP modes in the vicinity of the initial candidate intra-prediction mode.
[0152] The target offset value can be zero, positive, or negative. Taking the MPDIP mode corresponding to intra-frame prediction modes 0, 1, and 2×K+2 as an example, assuming the third candidate intra-frame prediction mode is 5, the fourth candidate intra-frame prediction mode is 6 when the target offset value is 1; and the fourth candidate intra-frame prediction mode is 4 when the target offset value is -1.
[0153] Furthermore, in some implementations, the target offset value can belong to any of multiple offset values. That is, the fourth candidate intra-prediction mode can be obtained within different search ranges. Or, the fourth candidate intra-prediction mode can be an intra-prediction mode determined after searching within multiple search ranges.
[0154] For example, the aforementioned multiple offset values may include a first offset value and a second offset value, and the absolute value of the first offset value is less than the absolute value of the second offset value. For example, a fourth candidate intra-frame prediction mode can be searched first with a smaller offset value, i.e., the first offset value; if the fourth candidate intra-frame prediction mode is not obtained, then a fourth candidate intra-frame prediction mode can be searched again with a larger offset value, i.e., the second offset value.
[0155] In some implementations, before adding the fourth candidate intra-prediction mode to the candidate intra-prediction mode set, it can be determined whether the fourth candidate intra-prediction mode already exists in the candidate intra-prediction mode set. If it is determined that the fourth candidate intra-prediction mode is not in the candidate intra-prediction mode set, then the fourth candidate intra-prediction mode is added to the candidate intra-prediction mode set. Correspondingly, if it is determined that the fourth candidate intra-prediction mode is in the candidate intra-prediction mode set, then the third candidate intra-prediction mode can be added to the candidate intra-prediction mode set. Alternatively, after determining that the third candidate intra-prediction mode has not yet been added to the candidate intra-prediction mode set, the third candidate intra-prediction mode is added to the candidate intra-prediction mode set.
[0156] To facilitate understanding, the method for determining the fourth candidate intra-prediction mode will be exemplified by taking the MPM list as an example.
[0157] Assume the third candidate intra-frame prediction mode is predMode and the fourth candidate intra-frame prediction mode is predPDPMode.
[0158] For example, if the width and height of the current block are both less than or equal to 16, the fourth candidate intra-prediction mode is determined as follows:
[0159] (1) The prediction mode predPDPMode is calculated using the formula k = ((predMode-2)+1) >> 1 and predPDPMode = 2 × k + 2. If the prediction mode is not added to the MPM list, then add the prediction mode to the MPM list; otherwise, continue to step (2).
[0160] (2) If the nearest predPDPMode is not added to the MPM list in step (1), the search will be performed within the range of ±1 of the offset value of k. First, search for -1, then search for +1. Specifically: if k is greater than 0, first determine whether the prediction mode predPDPMode = 2 × (k-1) + 2 is greater than or equal to 0 and less than 67. If the prediction mode meets the above conditions and has not been added to the MPM list, then add the prediction mode to the MPM list. If the fourth candidate intra-frame prediction mode is still not found, set the offset value to 1, determine whether the prediction mode predPDPMode = 2 × (k+1) + 2 is less than 67. If the prediction mode meets the above conditions and has not been added to the MPM list, then add the prediction mode to the MPM list.
[0161] (3) Otherwise, determine whether the original prediction mode predMode can be added to the PMPM list. If the prediction mode is not added to the PMPM list, then add the prediction mode to the PMPM list.
[0162] For example, if the width and height of the current CU block do not both satisfy 16 or less, the fourth candidate intra-prediction mode is determined as follows:
[0163] (1) The prediction mode predPDPMode is calculated using the formula k = ((predMode-2)+3) >> 2, predPDPMode = 4 × k + 2. If the prediction mode is not added to the MPM list, then add the prediction mode to the MPM list; otherwise, continue to step (2).
[0164] (2) If the nearest predPDPMode is not added to the MPM list in step (1), the search will be performed within the range of ±1 of the offset value of k. First, search for -1, then search for +1. Specifically: if k is greater than 0, first determine whether the prediction mode predPDPMode = 4 × (k-1) + 2 is greater than or equal to 0 and less than 67. If the prediction mode meets the above conditions and has not been added to the MPM list, then add the prediction mode to the MPM list. If the fourth candidate intra-frame prediction mode is still not found, set the offset value to 1, determine whether the prediction mode predPDPMode = 4 × (k+1) + 2 is less than 67. If the prediction mode meets the above conditions and has not been added to the MPM list, then add the prediction mode to the MPM list.
[0165] (3) Otherwise, determine whether the original prediction mode predMode can be added to the PMPM list. If the prediction mode is not added to the PMPM list, then add the prediction mode to the PMPM list.
[0166] As mentioned earlier, the activation of MPDIP mode requires certain conditions to be met. Therefore, the second implementation method can only be executed after the current block meets the activation conditions for MPDIP mode. If the conditions are not met, a third candidate mode can be added to the candidate intra-prediction mode set.
[0167] As mentioned earlier, the candidate intra-prediction mode set can be either an MPM list or a Non-MPM list. It's important to understand that implementation method two can be applied only to the construction of the PMPM list, or it can be used to construct both the PMPM and SMPM lists. Furthermore, once the MPM list is constructed, a Non-MPM list can also be constructed based on implementation method two.
[0168] Implementation Method 3
[0169] When constructing candidate intra-prediction modes, the cost determined by the MPDIP mode (corresponding to the Planar mode) can be used to determine whether to add the Planar mode to the candidate intra-prediction mode set, or to determine the position of the Planar mode in the candidate intra-prediction mode set.
[0170] Taking the MPM list as an example, when constructing the MPM list, the Planar mode is by default the first candidate intra-prediction mode and is not included in the template sorting. However, due to the existence of the MPDIP mode, for some candidate intra-prediction modes, the prediction of the MPDIP mode is more accurate than that of the Planar prediction mode. Therefore, the third implementation includes the Planar mode in the template sorting. In this way, a more accurate intra-prediction mode can be obtained from the MPM list, improving encoding and decoding efficiency.
[0171] Of course, implementation method three can also be executed only under certain conditions. Taking the PMPM list as an example, the current block can execute implementation method three only if the conditions for sorting the MPM list are met, and the MPDIP template mentioned in implementation method one is started.
[0172] If the current block does not meet the MPDIP template launch conditions, then the Planar mode can still be used as the first candidate intra-prediction mode in the PMPM list.
[0173] It should be understood that the three implementation methods described above can be used individually or in combination when constructing the candidate intra-prediction mode set, and this application embodiment does not specifically limit this. For example, taking the combination of implementation method one and implementation method two as an example, when constructing the candidate intra-prediction mode set, multiple candidate intra-prediction modes to be added to the set can be determined first through implementation method two; then, through implementation method one, multiple costs are determined based on the MPDIP modes corresponding to the multiple candidate intra-prediction modes, and the positional relationship of the multiple candidate intra-prediction modes in the candidate intra-prediction mode set is determined based on the multiple costs.
[0174] Referring again to Figure 7, in step S720, the target intra-prediction mode of the current block is determined based on the candidate intra-prediction mode set.
[0175] In some implementations, the bitstream can be decoded to determine the first index information. Further, determining the target intra-prediction mode for the current block based on the candidate intra-prediction mode set can include: determining the target intra-prediction mode based on the first index information and the candidate intra-prediction mode set. Here, the index information indicates the position of the target intra-prediction mode within the candidate intra-prediction mode set.
[0176] In some implementations, the bitstream can be decoded to determine the first identification information; then, based on the first identification information, it can be determined whether the target intra-prediction mode is located in the candidate intra-prediction mode set.
[0177] In step S730, the prediction block of the current block is determined according to the target intra-frame prediction mode. Alternatively, the prediction block of the current block is determined by predicting the current block according to the target intra-frame prediction mode.
[0178] In step S740, the reconstruction block of the current block is determined based on the predicted block.
[0179] In some implementations, the bitstream is decoded to determine the residual block of the current block; then, the reconstructed block is determined based on the residual block and the prediction block. Methods for determining the reconstructed block based on the residual block and the prediction block may include using the sum of the residual block and the prediction block as the reconstructed block of the current block.
[0180] The encoding / decoding method provided in this application, when applied to the test version of ECM, ECM15.0, yields a set of experimental data. Specific parameter results of the experimental data can be found in Table 8.
[0181] Table 8
[0182] The experimental results in Table 8 are based on the performance improvement achieved by combining implementation methods 1 and 2. On ClassE, this results in a performance improvement of -0.052%, with an average performance improvement of -0.043%. It should be noted that the time complexity in Table 8 is not considered part of the experimental results; this approach does not introduce significant time complexity.
[0183] The decoding method provided by the embodiments of this application has been described in detail above with reference to Figure 7. The encoding method provided by the embodiments of this application will be described in detail below with reference to Figure 10.
[0184] Figure 10 is a flowchart illustrating the encoding method provided in an embodiment of this application. The method in Figure 10 can be applied to an encoder.
[0185] Referring to Figure 10, in step S1010, the candidate intra-prediction mode set for the current block is determined. The current block can refer to the block to be encoded. In some implementations, the current block is a luma block. In other implementations, the current block can also be a chroma block.
[0186] The candidate intra-prediction mode mentioned above can also be called a candidate intra-prediction mode. This candidate intra-prediction mode can be understood as a traditional intra-prediction mode, which can include planar, DC, and angle prediction modes. For example, this candidate intra-prediction mode could be a prediction mode determined from 67 intra-prediction modes.
[0187] The candidate intra-prediction mode set mentioned above can be a set determined from multiple prediction modes of the current block. For example, this set can be an MPM list or a Non-MPM list determined when performing prediction based on MPM; exemplarily, this set can be a PMPM list or an SMPM list within the MPM list. Alternatively, this set can also be a set determined based on prediction modes such as TIMD and SGPM.
[0188] As mentioned earlier, the relevant technologies do not take into account that some traditional intra-prediction modes are converted to MPDIP mode for prediction. Therefore, when constructing the candidate intra-prediction mode set, the cost is calculated only based on the traditional intra-prediction modes, and the candidate intra-prediction modes in the PMPM list are sorted based on this cost. This approach is unreasonable and affects encoding and decoding efficiency.
[0189] This application incorporates the prediction performance of the MPDIP mode into the candidate intra-prediction modes for constructing the current block, thereby making the set of candidate intra-prediction modes more reasonable and thus helping to improve the efficiency of encoding and decoding. The decoding methods provided by this application are described below in conjunction with implementation methods one, two, and three.
[0190] Implementation Method 1
[0191] In this embodiment, when determining the position (or sorting position) of a candidate intra-prediction mode (hereinafter referred to as the first candidate intra-prediction mode) in the set, the cost used (hereinafter referred to as the first cost) can be determined based on the MPDIP mode corresponding to the first candidate intra-prediction mode. It should be understood that the correspondence between the first candidate intra-prediction mode and the MPDIP mode here can be interpreted as the first candidate intra-prediction mode satisfying MPDIP mode prediction. For example, when the current block meets a preset size, intra-prediction modes 0,1,(2k+2) satisfy the MPDIP mode, or intra-prediction modes 0,1,(4k+2) satisfy the MPDIP mode.
[0192] The first cost can be the cost of the template region. For example, the first cost can be determined based on the predicted and reconstructed values of the first template region of the current block. Alternatively, the first cost can be determined by the error between the predicted and reconstructed values of the first template region. Here, the cost can refer to the SAD cost.
[0193] The predicted value of the first template region mentioned above can be a predicted value obtained based on the MPDIP mode. For example, the predicted value of the first template region can be determined based on a preset matrix and the reconstructed value of the first reference region. Alternatively, the predicted value of the first template region can be determined by the product of the preset matrix and the reconstructed value of the first reference region. Here, the preset matrix can be a preset matrix in the MPDIP mode. Different candidate intra-frame prediction modes can correspond to different preset matrices in the MPDIP mode.
[0194] The first template area may include the top template area or the left template area, or the first template area may include both the left template area and the top template area.
[0195] For example, Figure 8A shows a schematic diagram of the upper template region of the current block; Figure 8B shows a schematic diagram of the left template region of the current block. Assume the width of the current block is w, the height is h, and the origin is the coordinate (x, y) of the upper left corner of the current block. The upper template region is the reconstructed sample of the upper reference row of the current block, with a width of w and a height of 1, and its upper left corner is located at (x, y-1); the left template region is the reconstructed sample of the left reference column of the current block, with a width of 1 and a height of h, and its upper left corner is located at (x-1, y).
[0196] The first reference region is the reference region for the first template region. The first reference region may include left reference columns and top reference rows. The size of the first reference region mentioned above can be determined based on the size of the current block. For example, the number of left reference columns in the first reference region can be the same as the number of reference columns in the current block; the number of top reference rows in the first reference region can be the same as the number of reference rows in the current block.
[0197] For example, Figure 8A shows the reference sample for the upper template region, and Figure 8B shows the reference sample for the left template region. Assuming the current block has 2 reference rows and 2 reference columns, the top-left corner of the upper reference row sample in the upper template region is (x-2, y-1-2), its width is the width w of the current block (the width of the short reference sample is w, and the width of the long reference sample is 2w), and its height is 2; the top-left corner of the left reference column is (x-2, y), its height is the height h of the current block (the height of the short reference sample is h, and the height of the long reference sample is 2h), and its width is 2. Similarly, the top-left corner of the upper reference row sample in the left template is (x-1-2, y-2), its width is the width w of the current block (the width of the short reference sample is w, and the width of the long reference sample is 2w), and its height is 2; the top-left corner of the left reference column is (x-1-2, y), its height is the height h of the current block (the height of the short reference sample is h, and the height of the long reference sample is 2h), and its width is 2.
[0198] For ease of understanding, the method for determining the first cost will be described exemplarily below with reference to Figures 8A and 8B.
[0199] The first candidate intra-frame prediction mode corresponds to the MPDIP mode, meaning the first cost is determined based on a preset matrix and the reconstructed values of the first reference region. As shown in Figure 8A, after obtaining the reconstructed values of the upper reference row and left reference column of the upper template region, the prediction value of the upper template region is calculated based on the preset matrix in the MPDIP mode and the reconstructed values of the aforementioned reference region. As shown in Figure 8B, after obtaining the reconstructed values of the upper reference row and left reference column of the left template region, the prediction value of the left template region is calculated based on the preset matrix in the MPDIP mode and the reconstructed values of the aforementioned reference region. Then, the SAD cost (i.e., the first cost) corresponding to the current prediction mode is calculated using the reconstructed blocks Recon and Pred of the upper and left template regions. The corresponding calculation formula is as follows: for(int i=0;i<w;++i) for(int j=0;j<h;++j) cost+=abs(pred[i][j]―Recon[i][j])
[0200] Where w is the width of the prediction block Pred and the reconstruction block Recon, and h is the height of the prediction block Pred and the reconstruction block Recon.
[0201] The specific calculation method for abs(*) is as follows:
[0202] After determining the first cost, the ranking position of the first candidate intra-prediction mode in the candidate intra-prediction mode set can be determined based on the cost.
[0203] For example, taking the sorting of the PMPM list as an example, the first candidate intra-frame prediction modes are prediction mode 2 and prediction mode 4. Assume that the sorted PMPM list according to related technologies is {0,1,2,3,4,5}, which is the first PMPM list in Table 7. In this embodiment, the PMPM list is sorted according to the first cost mentioned above, resulting in a sorted PMPM list of {0,4,2,1,3,5}, which is the second PMPM list in Table 7. Clearly, the positions of the candidate intra-frame prediction modes in the first and second PMPM lists change, and their corresponding bins also change.
[0204] Table 7
[0205] Prediction based on the MPDIP pattern corresponding to the candidate intra-frame prediction pattern may yield better results. Therefore, sorting based on the cost determined by the MPDIP pattern is more reasonable. In this way, the prediction pattern most likely to be used in the current block will be represented with fewer bins, thus helping to save codewords and improve encoding and decoding efficiency.
[0206] As mentioned earlier, the activation of MPDIP mode requires certain conditions to be met. Similarly, in some implementations, if the current block meets the first condition, the candidate intra-prediction mode set can be sorted according to the implementation method. If the current block does not meet the first condition, the candidate intra-prediction modes can be sorted according to the cost (or second cost) determined by the candidate intra-prediction mode (i.e., the traditional intra-prediction mode). Here, the first condition is related to whether MPDIP mode is enabled. Or, in other words, the first condition is related to whether MPDIP mode is enabled in the template region; therefore, the first condition can also be called the MPDIP template activation condition.
[0207] For example, the first condition may include the following:
[0208] (1) The template type attribute Left_Above_Templete of the current block (both the left template and the top template exist simultaneously);
[0209] (2) The upper reference sample and the left reference sample of the same size block that is offset one line up from the current block exist and have been reconstructed;
[0210] (3) The upper reference sample and the left reference sample of the same size block offset one column to the left of the current block exist and have also been reconstructed;
[0211] (4) The current block size is the block size supported by MPDIP mode.
[0212] Of course, there can be other sorting conditions for the candidate intra-prediction mode set. Taking the candidate intra-prediction mode set as an MPM list as an example, sorting will only be performed using implementation method one after the sorting conditions of the MPM list in related technologies are met. Alternatively, sorting can also be performed using implementation method one if there is at least one candidate intra-prediction mode corresponding to an MPDIP mode in the candidate intra-prediction mode set, and this at least one candidate intra-prediction mode does not include the Planar mode.
[0213] The preceding text introduced how related technologies determine costs based on traditional prediction models. When both the left and upper template regions exist in the current block, taking the reference region of the upper template region as an example, as shown in Figure 5C, its left reference column is not adjacent to the upper template region; there is a left template region between them. In other words, when predicting the template region, the related technologies do not utilize reconstructed samples from neighboring regions, thus failing to achieve accurate prediction and affecting encoding / decoding efficiency.
[0214] To address the aforementioned issues, some implementations, when two template regions for calculating the cost value exist simultaneously (such as a left template region and an upper template region), can use a region adjacent to one side of the current block as a reference sample. In other words, one of the two reference regions can be set to be adjacent to the current block. For example, as shown in Figure 9A, the left reference column of the upper template region can be set to be adjacent to the current block; or, as shown in Figure 9B, the upper reference row of the left template region can be set to be adjacent to the current block. This brings the reference region closer to the template region, fully utilizing the reconstructed samples from neighboring regions for prediction, improving prediction accuracy, and thus contributing to increased encoding / decoding efficiency.
[0215] Furthermore, the left reference column can be a region in the N adjacent columns to the left of the current block, or the upper reference row can be a region in the N adjacent rows above the current block. Here, N is an integer greater than or equal to 1.
[0216] In some implementations, the size of the reference region can be determined based on the size of the reference region corresponding to the current block. For example, if the width of the reference row of the current block is M times the width of the current block, then the width of the reference row of the template region can also be set to M times the width of the current block.
[0217] For example, as shown in Figures 9A and 9B, assume the current block has a width of w and a height of h, with the top-left corner (x, y) as the origin, and the template region has a width of 1. Then, the top-left corner of the upper reference row sample of the upper template is (x, y-2), with a width of w × 8 and a height of 1; the top-left corner of the left reference column is (x-2, y), with a height of h × 8 and a width of 1. Similarly, the top-left corner of the upper reference row sample of the left template is (x-2, y-1), with a width of w × 8 and a height of 1; the top-left corner of the left reference column is (x-2, y), with a height of h × 8 and a width of 1. After obtaining the reference samples of the upper and left templates of the current block, the predicted sample values of the current upper and left template regions are calculated using the reference samples and the traditional angle prediction model. Finally, the reconstructed samples and predicted samples of the upper and left template regions are used to calculate the SAD cost corresponding to the current prediction model.
[0218] As mentioned earlier, the candidate intra-prediction mode set can be either an MPM list or a Non-MPM list. It's important to understand that the sorting method in Implementation Method 1 can be applied only to the PMPM list sorting process, or it can be used for both the PMPM and SMPM lists. Furthermore, after the MPM list is constructed, the remaining candidate intra-prediction modes can also be sorted in the Non-MPM list based on the sorting method in Implementation Method 1.
[0219] Implementation Method Two
[0220] In this embodiment, when constructing the candidate intra-prediction mode set, more candidate intra-prediction modes corresponding to MPDIP templates can be added to the candidate intra-prediction mode set. Prediction based on MPDIP modes yields better results (such as prediction of the luma component), thus providing more accurate intra-prediction modes for the current block and improving encoding and decoding efficiency. The implementation method of the second method is described below.
[0221] First, the third candidate intra-prediction mode for the current block is determined; then, based on the third candidate intra-prediction mode, the fourth candidate intra-prediction mode is determined; finally, the fourth candidate intra-prediction mode is added to the candidate intra-prediction mode set. Here, the fourth candidate intra-prediction mode corresponds to the MPDIP mode.
[0222] The third candidate intra-prediction mode mentioned above can be understood as the initially acquired candidate intra-prediction mode. This third candidate intra-prediction mode may or may not correspond to the MPDIP mode. Taking the construction of the MPM list as an example, the third candidate intra-prediction mode can be the intra-prediction mode of the current block's neighboring blocks, the intra-prediction mode of the current block's non-neighboring blocks, or the intra-prediction mode determined based on the DIMD mode.
[0223] In some implementations, a fourth candidate intra-prediction mode can be determined based on the third candidate intra-prediction mode and the target offset value. This fourth candidate intra-prediction mode can be understood as an intra-prediction mode searched for near the third candidate intra-prediction mode using the target offset value. Alternatively, it can be described as determining other intra-prediction modes with corresponding MPDIP modes in the vicinity of the initial candidate intra-prediction mode.
[0224] The target offset value can be zero, positive, or negative. Taking the MPDIP mode corresponding to intra-frame prediction modes 0, 1, and 2×K+2 as an example, assuming the third candidate intra-frame prediction mode is 5, the fourth candidate intra-frame prediction mode is 6 when the target offset value is 1; and the fourth candidate intra-frame prediction mode is 4 when the target offset value is -1.
[0225] Furthermore, in some implementations, the target offset value can belong to any of multiple offset values. That is, the fourth candidate intra-prediction mode can be obtained within different search ranges. Or, the fourth candidate intra-prediction mode can be an intra-prediction mode determined after searching within multiple search ranges.
[0226] For example, the aforementioned multiple offset values may include a first offset value and a second offset value, and the absolute value of the first offset value is less than the absolute value of the second offset value. For example, a fourth candidate intra-frame prediction mode can be searched first with a smaller offset value, i.e., the first offset value; if the fourth candidate intra-frame prediction mode is not obtained, then a fourth candidate intra-frame prediction mode can be searched again with a larger offset value, i.e., the second offset value.
[0227] In some implementations, before adding the fourth candidate intra-prediction mode to the candidate intra-prediction mode set, it can be determined whether the fourth candidate intra-prediction mode already exists in the candidate intra-prediction mode set. If it is determined that the fourth candidate intra-prediction mode is not in the candidate intra-prediction mode set, then the fourth candidate intra-prediction mode is added to the candidate intra-prediction mode set. Correspondingly, if it is determined that the fourth candidate intra-prediction mode is in the candidate intra-prediction mode set, then the third candidate intra-prediction mode can be added to the candidate intra-prediction mode set. Alternatively, after determining that the third candidate intra-prediction mode has not yet been added to the candidate intra-prediction mode set, the third candidate intra-prediction mode is added to the candidate intra-prediction mode set.
[0228] To facilitate understanding, the method for determining the fourth candidate intra-prediction mode will be exemplified by taking the MPM list as an example.
[0229] Assume the third candidate intra-frame prediction mode is predMode and the fourth candidate intra-frame prediction mode is predPDPMode.
[0230] For example, if the width and height of the current block are both less than or equal to 16, the fourth candidate intra-prediction mode is determined as follows:
[0231] (1) The prediction mode predPDPMode is calculated using the formula k = ((predMode-2)+1) >> 1 and predPDPMode = 2 × k + 2. If the prediction mode is not added to the MPM list, then add the prediction mode to the MPM list; otherwise, continue to step (2).
[0232] (2) If the nearest predPDPMode is not added to the MPM list in step (1), the search will be performed within the range of ±1 of the offset value of k. First, search for -1, then search for +1. Specifically: if k is greater than 0, first determine whether the prediction mode predPDPMode = 2 × (k-1) + 2 is greater than or equal to 0 and less than 67. If the prediction mode meets the above conditions and has not been added to the MPM list, then add the prediction mode to the MPM list. If the fourth candidate intra-frame prediction mode is still not found, set the offset value to 1, determine whether the prediction mode predPDPMode = 2 × (k+1) + 2 is less than 67. If the prediction mode meets the above conditions and has not been added to the MPM list, then add the prediction mode to the MPM list.
[0233] (3) Otherwise, determine whether the original prediction mode predMode can be added to the PMPM list. If the prediction mode is not added to the PMPM list, then add the prediction mode to the PMPM list.
[0234] For example, if the width and height of the current CU block do not both satisfy 16 or less, the fourth candidate intra-prediction mode is determined as follows:
[0235] (1) The prediction mode predPDPMode is calculated using the formula k = ((predMode-2)+3) >> 2, predPDPMode = 4 × k + 2. If the prediction mode is not added to the MPM list, then add the prediction mode to the MPM list; otherwise, continue to step (2).
[0236] (2) If the nearest predPDPMode is not added to the MPM list in step (1), the search will be performed within the range of ±1 of the offset value of k. First, search for -1, then search for +1. Specifically: if k is greater than 0, first determine whether the prediction mode predPDPMode = 4 × (k-1) + 2 is greater than or equal to 0 and less than 67. If the prediction mode meets the above conditions and has not been added to the MPM list, then add the prediction mode to the MPM list. If the fourth candidate intra-frame prediction mode is still not found, set the offset value to 1, determine whether the prediction mode predPDPMode = 4 × (k+1) + 2 is less than 67. If the prediction mode meets the above conditions and has not been added to the MPM list, then add the prediction mode to the MPM list.
[0237] (3) Otherwise, determine whether the original prediction mode predMode can be added to the PMPM list. If the prediction mode is not added to the PMPM list, then add the prediction mode to the PMPM list.
[0238] As mentioned earlier, the activation of MPDIP mode requires certain conditions to be met. Therefore, the second implementation method can only be executed after the current block meets the activation conditions for MPDIP mode. If the conditions are not met, a third candidate mode can be added to the candidate intra-prediction mode set.
[0239] As mentioned earlier, the candidate intra-prediction mode set can be either an MPM list or a Non-MPM list. It's important to understand that implementation method two can be applied only to the construction of the PMPM list, or it can be used to construct both the PMPM and SMPM lists. Furthermore, once the MPM list is constructed, a Non-MPM list can also be constructed based on implementation method two.
[0240] Implementation Method 3
[0241] When constructing candidate intra-prediction modes, the cost determined by the MPDIP mode (corresponding to the Planar mode) can be used to determine whether to add the Planar mode to the candidate intra-prediction mode set, or to determine the position of the Planar mode in the candidate intra-prediction mode set.
[0242] Taking the MPM list as an example, when constructing the MPM list, the Planar mode is by default the first candidate intra-prediction mode and is not included in the template sorting. However, due to the existence of the MPDIP mode, for some candidate intra-prediction modes, the prediction of the MPDIP mode is more accurate than that of the Planar prediction mode. Therefore, the third implementation includes the Planar mode in the template sorting. In this way, a more accurate intra-prediction mode can be obtained from the MPM list, improving encoding and decoding efficiency.
[0243] Of course, implementation method three can also be executed only under certain conditions. Taking the PMPM list as an example, the current block can execute implementation method three only if the conditions for sorting the MPM list are met, and the MPDIP template mentioned in implementation method one is started.
[0244] If the current block does not meet the MPDIP template launch conditions, then the Planar mode can still be used as the first candidate intra-prediction mode in the PMPM list.
[0245] It should be understood that the three implementation methods described above can be used individually or in combination when constructing the candidate intra-prediction mode set, and this application embodiment does not specifically limit this. For example, taking the combination of implementation method one and implementation method two as an example, when constructing the candidate intra-prediction mode set, multiple candidate intra-prediction modes to be added to the set can be determined first through implementation method two; then, through implementation method one, multiple costs are determined based on the MPDIP modes corresponding to the multiple candidate intra-prediction modes, and the positional relationship of the multiple candidate intra-prediction modes in the candidate intra-prediction mode set is determined based on the multiple costs.
[0246] Referring again to Figure 10, in step S1020, the target intra-prediction mode of the current block is determined based on the candidate intra-prediction mode set.
[0247] In some implementations, the first index information can be determined based on the target intra-prediction mode and the set of candidate intra-prediction modes; then, the first index information is written into the bitstream. Here, the first index information indicates the position of the target intra-prediction mode within the set of candidate intra-prediction modes.
[0248] In some implementations, the first identification information is written into the bitstream. The first identification information is used to indicate whether the target intra-prediction mode is located in the candidate intra-prediction mode set.
[0249] In step S1030, the prediction block of the current block is determined according to the target intra-frame prediction mode. In other words, the prediction block of the current block is determined by predicting the current block according to the target intra-frame prediction mode.
[0250] In step S1040, the residual block of the current block is determined based on the prediction block.
[0251] In some implementations, residual blocks can be determined based on predicted blocks and reconstructed blocks. Methods for determining residual blocks based on predicted and reconstructed blocks include using the difference between the predicted and reconstructed blocks as the residual block for the current block.
[0252] The embodiments of this application are described in more detail below with specific examples. It should be noted that the examples below are merely to help those skilled in the art understand the embodiments of this application, and are not intended to limit the embodiments of this application to the specific numerical values or scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or variations based on the examples given below, and such modifications or variations also fall within the scope of the embodiments of this application.
[0253] This example can be applied to the construction of PMPM lists, SMPM lists, and Non-MPM lists. Specific methods can be found in Examples 1 through 3, which are described in detail below.
[0254] Example 1
[0255] 1. Obtain the initial PMPM list based on the existing ECM codec PMPM list construction method;
[0256] 2. Determine whether the current block meets the sorting conditions of the PMPM list. If it meets the sorting conditions, proceed to operation 3; otherwise, proceed to operation 6.
[0257] 3. Determine whether the current block meets the MPDIP template sorting conditions and whether the candidate mode is one of the MPDIP modes supported by the current block size. If it meets the conditions, proceed to operation 4; otherwise, proceed to operation 5.
[0258] 4. For candidate modes, MPDIP intra-frame prediction can be used, and the SAD cost of the left template and the upper template of the current block can be calculated in the manner shown in Figure 5.
[0259] (a) Figure 8A shows a schematic diagram of the top template of the current block; Figure 8B shows a schematic diagram of the left template of the current block. Assume that the width of the current block is w, the height is h, and the coordinates of the top left corner of the current block are (x, y) as the origin. The top template is the reconstructed sample of the top reference row of the current block, with a width of w and a height of 1, and its top left corner is (x, y-1); the left template is the reconstructed sample of the left reference column of the current block, with a width of 1 and a height of h, and its top left corner is (x-1, y).
[0260] (b) Determine the number of left reference columns and top reference rows of the template using the size of the current block. Figure 8A shows the reference sample of the top template, and Figure 8B shows the reference sample of the left template. Assuming that the number of reference rows and reference columns corresponding to the current block is 2, then the top left corner position of the top reference row sample of the top template is (x-2, y-1-2), its width is the width w of the current block (the width of the short reference sample is w, and the width of the long reference sample is 2w), and its height is 2; the top left corner position of the left reference column is (x-2, y), its height is the height h of the current block (the height of the short reference sample is h, and the height of the long reference sample is 2h), and its width is 2. The top left corner of the upper reference row sample of the left template is (x-1-2, y-2), its width is the width w of the current block (the width of the short reference sample is w, and the width of the long reference sample is 2w), and its height is 2; the top left corner of the left reference column is (x-1-2, y), its height is the height h of the current block (the height of the short reference sample is h, and the height of the long reference sample is 2h), and its width is 2.
[0261] (c) After obtaining the reference samples of the upper and left templates of the current block, the predicted sample values Pred of the current upper and left templates are calculated using the reference samples and the pre-set matrix vectors.
[0262] (d) Finally, the SAD cost corresponding to the current prediction model is calculated using the reconstructed sample value Recon and the predicted value Pred of the upper and left templates.
[0263] The corresponding calculation formula is as follows: for(int i = 0; i < w; ++i) for(int j = 0; j < h; ++j) cost += abs(pred[i][j] ― Recon[i][j])
[0264] Where w is the width of the prediction block Pred and the reconstruction block Recon, and h is the height of the prediction block Pred and the reconstruction block Recon.
[0265] The specific calculation method for abs(*) is as follows:
[0266] 5. Otherwise, if the upper template and left template of the current block do not exist simultaneously, the template SAD cost in the relevant technology is still used. If the upper template and left template of the current block exist simultaneously, the template SAD cost is calculated in the manner shown in Figures 9A and 9B. Specifically, as shown in Figures 9A and 9B, assuming the width of the current block is w, the height is h, the upper left corner coordinate (x, y) of the current block is the origin, and the width of the template is 1. Then, for the upper reference row sample of the upper template, the upper left corner position is (x, y-2), its width is the width w × 8 of the current block, and its height is 1; the upper left corner position of the left reference column is (x-2, y), its height is the height h × 8 of the current block, and its width is 1. For the upper reference row sample of the left template, the upper left corner position is (x-2, y-1), its width is the width w × 8 of the current block, and its height is 1; the upper left corner position of the left reference column is (x-2, y), its height is the height h × 8 of the current block, and its width is 1. After obtaining reference samples for the upper and left templates of the current block, the predicted sample values for the current upper and left templates are calculated using the reference samples and the traditional angle prediction model. Finally, the SAD cost corresponding to the current prediction model is calculated using the reconstructed samples and predicted samples of the upper and left templates.
[0267] 6. Using the existing ECM method, construct SMPM using the candidate patterns of PMPM until the number of candidate patterns in MPM reaches 22;
[0268] 7. Construct a list of Non-MPMs based on MPM candidate patterns.
[0269] MPDIP template startup conditions:
[0270] (1) The template type attribute Left_Above_Templete of the current block (both the left template and the top template exist simultaneously);
[0271] (2) The upper reference sample and the left reference sample of the same size block that is offset one line up from the current block exist and have been reconstructed;
[0272] (3) The upper reference sample and the left reference sample of the same size, which are offset one column to the left of the current block, exist and have also been reconstructed;
[0273] (4) The current block is the block size supported by MPDIP (i.e., the current block can be predicted using MPDIP for MPDIP patterns).
[0274] When conditions (1)-(4) are met simultaneously, the MPDIP template startup condition of the current block is true; otherwise, it is false.
[0275] Example 2
[0276] This example can be applied to the construction of PMPM lists, SMPM lists, and Non-MPM lists. Specific methods may include:
[0277] 1. Similarly, based on the PMPM list construction method in related technologies, the PMPM candidate mode of the current block is constructed by using the prediction mode of adjacent spatial domains, the DIMD mode of the current block, and the prediction mode of non-adjacent blocks.
[0278] 2. Determine whether the current block meets the conditions for MPDIP intra-frame prediction. The specific conditions are: the current block is of the block size supported by MPDIP; and the upper reference row samples and left column reference samples of the current block to be encoded / decoded have all been reconstructed. See the MPDIP startup conditions for details.
[0279] 3. If the current block meets the conditions for MPDIP intra-frame prediction, the initially obtained prediction mode will be rounded to its nearest PDP intra-frame prediction mode based on the size of the current block. If this prediction mode is not added to the PMPM list, it will be added to the PMPM list; otherwise, it will be determined whether the original prediction mode can be added to the PMPM list. If the original prediction mode is not added to the PMPM list, it will be added to the PMPM list. The specific execution process is as follows:
[0280] (a) Assume the current candidate mode is predMode, and assume its nearest MPDIP intra-prediction mode is predPDPMode. If predMode is less than or equal to 1, directly determine whether the current mode should be added to the candidate mode list. If it is added, skip it; otherwise, add the mode to the MPM list.
[0281] (b) If the width and height of the current block are both less than or equal to 16, the nearest MPDIP pattern to the current candidate pattern is calculated as follows:
[0282] i. If the prediction pattern is not added to the list, add the prediction pattern to the MPM list; otherwise, proceed to step ii.
[0283] ii. If the most recent predPDPMode was not added to the MPM list in step i, a search will be performed within the range of ±1 for the offset of k. First, the search will be performed for -1, and then for +1. Specifically: if k is greater than 0, it will first be determined whether the prediction mode predPDPMode = 2 × (k - 1) + 2 is greater than or equal to 0 and less than 67. If the prediction mode meets the above conditions and has not been added to the MPM list, then the prediction mode will be added to the MPM list. If the fourth candidate intra-frame prediction mode is still not found, the offset value will be set to 1, and it will be determined whether the prediction mode predPDPMode = 2 × (k + 1) + 2 is less than 67. If the prediction mode meets the above conditions and has not been added to the MPM list, then the prediction mode will be added to the MPM list.
[0284] iii. Otherwise, determine whether the original prediction model can be added to the PMPM list. If the original prediction model is not added to the PMPM list, then add the original prediction model to the PMPM list.
[0285] (c) Otherwise, the nearest MPDIP pattern to the current candidate pattern is calculated as follows:
[0286] i. If the prediction pattern is not added to the list, add the prediction pattern to the MPM list; otherwise, proceed to step ii.
[0287] ii. If the most recent predPDPMode was not added to the MPM list in step i, a search will be performed within the range of ±1 for the offset of k. First, the search will be performed for -1, and then for +1. Specifically: if k is greater than 0, it will first determine whether the prediction mode predPDPMode = 4 × (k - 1) + 2 is greater than or equal to 0 and less than 67. If the prediction mode meets the above conditions and has not been added to the MPM list, then the prediction mode will be added to the MPM list. If the fourth candidate intra-frame prediction mode is still not found, the offset value will be set to 1, and it will be determined whether the prediction mode predPDPMode = 4 × (k + 1) + 2 is less than 67. If the prediction mode meets the above conditions and has not been added to the MPM list, then the prediction mode will be added to the MPM list.
[0288] iii. Otherwise, determine whether the original prediction model can be added to the PMPM list. If the original prediction model is not added to the PMPM list, then add the original prediction model to the PMPM list.
[0289] 4. After completing the construction of the PMPM list, update the PMPM list according to whether the existing PMPM list in the ECM is sorted by template;
[0290] 5. After constructing the PMPM list, the SMPM is built based on the prediction patterns in the PMPM list with a certain fixed offset (currently offsets 1, 2, 3, 4). During this process, scheme 3 from the PMPM list construction process is also used to convert the initial candidate patterns into the most recent MPDIP patterns. If the number of candidate patterns in the SMPM is still less than 16, some default candidate patterns will be added to the SMPM until the number of candidate patterns in the SMPM reaches 16.
[0291] 6. After completing the construction of the MPM list, the following process is used to construct the Non-MPM list for the 0-67 intra-frame prediction modes:
[0292] (a) First, use scheme 3 in the PMPM list construction process to convert the initial candidate patterns into the most recent MPDIP patterns. If the converted MPDIP patterns are not added to the MPM list or the Non-MPM list, then add the converted MPDIP patterns to the Non-MPM list.
[0293] (b) Next, determine whether the current initial candidate pattern has been added to the MPM list and the Non-MPM list. If the initial candidate pattern has not been added to the MPM list and the Non-MPM list, then add the initial candidate pattern to the Non-MPM list.
[0294] (c) Construct the Non-MPM list in the above manner until the construction is complete, that is, the length of the candidate patterns in the Non-MPM list reaches 45.
[0295] Example 3
[0296] In related technologies, when constructing the MPM list, the Planar prediction pattern is used as the first candidate pattern, and this pattern is not sorted by template. This example mainly modifies whether the Planar pattern participates in template sorting.
[0297] 1. First, determine whether the current block meets the sorting conditions of the PMPM list. If the current block meets the conditions, the Planar pattern will also participate in the template sorting. The specific template sorting method is described in Scheme 1; otherwise, the method in related technologies is adopted, and the Planar prediction pattern is used as the first candidate pattern, and this pattern is not subject to template sorting.
[0298] 2. Secondly, the PMPM candidate pattern for the current block is constructed using the PMPM list construction method in related technologies.
[0299] 3. After the PMPM list is completed, and when constructing the SMPM list, if the current block meets the sorting conditions of the PMPM list, it will first determine whether the Planar prediction mode has been added to the MPM list. If it has not been added to the MPM list, the Planar mode will be added to the first position of the SMPM list. Then, the SMPM candidate modes of the current block will be constructed according to the SMPM list construction method in related technologies.
[0300] The method embodiments of this application have been described in detail above with reference to Figures 1 to 10. The apparatus embodiments of this application will be described in detail below with reference to Figures 11 to 14. It should be understood that the descriptions of the method embodiments correspond to the descriptions of the apparatus embodiments; therefore, any parts not described in detail can be referred to the preceding method embodiments.
[0301] Figure 11 is a schematic diagram of the structure of a decoder provided in an embodiment of this application. As shown in Figure 11, the decoder 1100 includes: a first determining unit 1110, a second determining unit 1120, a third determining unit 1130, and a fourth determining unit 1140.
[0302] The first determining unit 1110 is configured to determine the set of candidate intra-prediction modes for the current block.
[0303] The second determining unit 1120 is configured to determine the target intra-prediction mode of the current block based on the candidate intra-prediction mode set.
[0304] The third determining unit 1130 is configured to determine the prediction block of the current block according to the target intra-frame prediction mode.
[0305] The fourth determining unit 1140 is configured to determine the reconstruction block of the current block based on the predicted block.
[0306] In some possible implementations, the candidate intra-prediction mode set includes a first candidate intra-prediction mode, and the first determining unit 1110 is configured as follows:
[0307] Based on the first cost, determine the position of the first candidate intra-frame prediction mode in the set of candidate intra-frame prediction modes;
[0308] Wherein, the first cost is the cost determined by the MPDIP mode corresponding to the first candidate intra-frame prediction mode.
[0309] In some possible implementations, the first cost is determined based on the predicted and reconstructed values of the first template region of the current block.
[0310] In some possible implementations, the first template region corresponds to a first reference region, and the predicted value of the first template region is determined based on a preset matrix and the reconstructed value of the first reference region.
[0311] In some possible implementations, the first determining unit 1110 is further configured to determine the position of the first intra-frame prediction mode in the candidate intra-frame prediction mode set according to the first cost if the current block satisfies the first condition, wherein the first condition is related to whether MPDIP mode is enabled.
[0312] In some possible implementations, the decoder 1100 is further configured to determine the position of the first candidate intra-prediction mode in the set of candidate intra-prediction modes based on the second cost if the current block does not satisfy the first condition; wherein the second cost is the cost determined by the first candidate intra-prediction mode.
[0313] In some possible implementations, the second cost is determined based on the predicted and reconstructed values of the second template region and the third template region of the current block, where the second template region corresponds to the second reference region and the third reference region;
[0314] Wherein, the second reference region is adjacent to the current block, or the third reference region is adjacent to the current block.
[0315] Among some possible implementations, where:
[0316] The second reference area is the area in the N adjacent columns to the left of the current block; and / or,
[0317] The third reference region is the region in the adjacent N rows above the current block;
[0318] Where N is an integer greater than or equal to 1.
[0319] In some possible implementations, the size of the second reference region and / or the third reference region is determined based on the size of the reference region corresponding to the current block.
[0320] In some possible implementations, the third template region corresponds to the fourth reference region and the fifth reference region;
[0321] The fourth reference region is adjacent to the current block, or the fifth reference region is adjacent to the current block.
[0322] In some possible implementations, the fourth reference region is the region in the N adjacent columns to the left of the current block; and / or,
[0323] The fifth reference region is the region in the adjacent N rows above the current block;
[0324] Where N is an integer greater than or equal to 1.
[0325] In some possible implementations, the size of the fourth reference region and / or the fifth reference region is determined based on the size of the reference region corresponding to the current block.
[0326] In some possible implementations, the first determining unit 1110 is configured to determine a third candidate intra-prediction mode for the current block; determine a fourth candidate intra-prediction mode based on the third candidate intra-prediction mode; and add the fourth candidate intra-prediction mode to the candidate intra-prediction mode set; wherein the fourth candidate intra-prediction mode corresponds to the MPDIP mode.
[0327] In some possible implementations, the first determining unit 1110 is configured to determine the fourth candidate intra-prediction mode based on the third candidate intra-prediction mode and the target offset value.
[0328] In some possible implementations, the target offset value belongs to any one of a plurality of offset values, including a first offset value and a second offset value, wherein the absolute value of the first offset value is less than the absolute value of the second offset value.
[0329] In some possible implementations, the first determining unit 1110 is configured to determine whether the fourth candidate prediction mode is in the candidate intra-frame prediction mode set; if it is determined that the fourth candidate intra-frame prediction mode is not in the candidate intra-frame prediction mode set, then the fourth candidate intra-frame prediction mode is added to the candidate intra-frame prediction mode set.
[0330] In some possible implementations, the first determining unit 1110 is configured to add the third candidate intra-prediction mode to the candidate intra-prediction mode set if it is determined that the fourth candidate intra-prediction mode is in the candidate intra-prediction mode set.
[0331] In some possible implementations, the third candidate intra-frame prediction mode belongs to one of the following:
[0332] Intra-prediction modes of adjacent blocks of the current block;
[0333] Intra-prediction mode of non-adjacent blocks of the current block;
[0334] Intra-prediction mode determined based on DIMD mode.
[0335] In some possible implementations, the first determining unit 1110 is configured to determine a fourth candidate intra-prediction mode based on the third candidate intra-prediction mode if the current block satisfies the second condition, wherein the second condition is related to whether MPDIP mode is enabled.
[0336] The first determining unit 1110 is configured to add the third candidate intra-frame prediction mode to the candidate intra-frame prediction mode set if the current block does not meet the second condition.
[0337] In some possible implementations, the first determining unit 1110 is configured to determine, based on a third cost, whether to add the planar mode to the candidate intra-prediction mode set; and / or, based on the third cost, determine the position of the planar mode in the candidate intra-prediction mode set; wherein the third cost is the cost determined by the MPDIP mode corresponding to the planar mode.
[0338] In some possible implementations, the first determining unit 1110 is configured to determine the position of the planar mode in the candidate frame prediction mode set according to the third cost if the current block satisfies a first condition, wherein the first condition is related to whether MPDIP mode is enabled.
[0339] In some possible implementations, the first determining unit 1110 is configured to add a planar mode to the first position in the candidate intra-prediction mode set if the current block does not satisfy the first condition.
[0340] In some possible implementations, the first determining unit 1110 is configured to determine the position of each candidate intra-prediction mode in the candidate intra-prediction mode set if the current block satisfies the third condition.
[0341] In some possible implementations, the third condition includes: the size of the current block satisfies a preset size, and the prediction mode of the strip where the current block is located satisfies a preset mode; or, there is at least one candidate intra-prediction mode corresponding to the MPDIP mode in the candidate intra-prediction mode set, and the at least one candidate intra-prediction mode does not include a planar mode.
[0342] In some possible implementations, the decoder 1100 is configured to decode the bitstream and determine first index information, the first index information being used to indicate the position of the target intra-prediction mode in the candidate intra-prediction mode set; the second determining unit 1120 is configured to determine the target intra-prediction mode based on the first index information and the candidate intra-prediction mode set.
[0343] In some possible implementations, the decoder 1100 is configured to decode the bitstream, determine first identification information, and determine whether the target intra-prediction mode is located in the candidate intra-prediction mode set based on the first identification information.
[0344] Understandably, in the embodiments of this application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular one. Furthermore, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit described above can be implemented in hardware or as a software functional module.
[0345] If the integrated unit is implemented as a software functional module and 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, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0346] Therefore, this application provides a computer-readable storage medium for use in a decoder 1100. The computer-readable storage medium stores a computer program that, when executed by a processor, implements the aforementioned decoding method.
[0347] Based on the composition of the decoder 1100 described above and the computer-readable storage medium, refer to Figure 12, which shows a schematic diagram of the specific hardware structure of the decoder provided in this embodiment. As shown in Figure 12, the decoder 1200 may include: a communication interface 1210, a memory 1220, and a processor 1230; the various components are coupled together through a bus system 1240. It is understood that the bus system 1240 is used to realize the connection and communication between these components. In addition to a data bus, the bus system 1240 also includes a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as bus system 1240 in Figure 12.
[0348] The communication interface 1210 is used for receiving and sending signals during the process of sending and receiving information with other external network elements.
[0349] Memory 1220 is used to store computer programs.
[0350] Processor 1230, when running the computer program, performs the following:
[0351] Determine the set of candidate intra-prediction modes for the current block;
[0352] The target intra-prediction mode for the current block is determined based on the set of candidate intra-prediction modes.
[0353] The prediction block of the current block is determined according to the target intra-frame prediction mode;
[0354] The reconstruction block of the current block is determined based on the predicted block.
[0355] It is understood that the memory 1220 in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 1220 of the system and method described in this application is intended to include, but is not limited to, these and any other suitable types of memory.
[0356] The processor 1230 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 1230 or by instructions in software form. The processor 1230 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 1220. Processor 1230 reads the information in memory 1220 and completes the steps of the above method in conjunction with its hardware.
[0357] It is understood that the embodiments described in this application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or combinations thereof. For software implementation, the technology described in this application can be implemented through modules (e.g., procedures, functions, etc.) that perform the functions described in this application. Software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.
[0358] Alternatively, as another embodiment, the processor 1230 is also configured to execute the decoding method described in the foregoing embodiments when running the computer program.
[0359] Figure 13 is a schematic diagram of the structure of an encoder provided in an embodiment of this application. As shown in Figure 13, the encoder 1300 includes: a first determining unit 1310, a second determining unit 1320, a third determining unit 1330, and a fourth determining unit 1340.
[0360] The first determining unit 1310 is configured to determine the set of candidate intra-prediction modes for the current block.
[0361] The second determining unit 1320 is configured to determine the target intra-prediction mode of the current block based on the candidate intra-prediction mode set.
[0362] The third determining unit 1330 is configured to determine the prediction block of the current block according to the target intra-frame prediction mode.
[0363] The fourth determining unit 1340 is configured to determine the reconstruction block of the current block based on the predicted block.
[0364] In some possible implementations, the candidate intra-prediction mode set includes a first candidate intra-prediction mode, and the first determining unit 1310 is configured as follows:
[0365] Based on the first cost, determine the position of the first candidate intra-frame prediction mode in the set of candidate intra-frame prediction modes;
[0366] Wherein, the first cost is the cost determined by the MPDIP mode corresponding to the first candidate intra-frame prediction mode.
[0367] In some possible implementations, the first cost is determined based on the predicted and reconstructed values of the first template region of the current block.
[0368] In some possible implementations, the first template region corresponds to a first reference region, and the predicted value of the first template region is determined based on a preset matrix and the reconstructed value of the first reference region.
[0369] In some possible implementations, the first determining unit 1310 is further configured to determine the position of the first intra-frame prediction mode in the candidate intra-frame prediction mode set according to the first cost if the current block satisfies the first condition, wherein the first condition is related to whether MPDIP mode is enabled.
[0370] In some possible implementations, the encoder 1300 is further configured to determine the position of the first candidate intra-prediction mode in the set of candidate intra-prediction modes based on a second cost if the current block does not satisfy the first condition; wherein the second cost is the cost determined by the first candidate intra-prediction mode.
[0371] In some possible implementations, the second cost is determined based on the predicted and reconstructed values of the second template region and the third template region of the current block, where the second template region corresponds to the second reference region and the third reference region;
[0372] Wherein, the second reference region is adjacent to the current block, or the third reference region is adjacent to the current block.
[0373] Among some possible implementations, where:
[0374] The second reference area is the area in the N adjacent columns to the left of the current block; and / or,
[0375] The third reference region is the region in the adjacent N rows above the current block;
[0376] Where N is an integer greater than or equal to 1.
[0377] In some possible implementations, the size of the second reference region and / or the third reference region is determined based on the size of the reference region corresponding to the current block.
[0378] In some possible implementations, the third template region corresponds to the fourth reference region and the fifth reference region;
[0379] The fourth reference region is adjacent to the current block, or the fifth reference region is adjacent to the current block.
[0380] In some possible implementations, the fourth reference region is the region in the N adjacent columns to the left of the current block; and / or,
[0381] The fifth reference region is the region in the adjacent N rows above the current block;
[0382] Where N is an integer greater than or equal to 1.
[0383] In some possible implementations, the size of the fourth reference region and / or the fifth reference region is determined based on the size of the reference region corresponding to the current block.
[0384] In some possible implementations, the first determining unit 1310 is configured to determine a third candidate intra-prediction mode for the current block; determine a fourth candidate intra-prediction mode based on the third candidate intra-prediction mode; and add the fourth candidate intra-prediction mode to the candidate intra-prediction mode set; wherein the fourth candidate intra-prediction mode corresponds to the MPDIP mode.
[0385] In some possible implementations, the first determining unit 1310 is configured to determine the fourth candidate intra-prediction mode based on the third candidate intra-prediction mode and the target offset value.
[0386] In some possible implementations, the target offset value belongs to any one of a plurality of offset values, including a first offset value and a second offset value, wherein the absolute value of the first offset value is less than the absolute value of the second offset value.
[0387] In some possible implementations, the first determining unit 1310 is configured to determine whether the fourth candidate prediction mode is in the candidate intra-frame prediction mode set; if it is determined that the fourth candidate intra-frame prediction mode is not in the candidate intra-frame prediction mode set, then the fourth candidate intra-frame prediction mode is added to the candidate intra-frame prediction mode set.
[0388] In some possible implementations, the first determining unit 1310 is configured to add the third candidate intra-prediction mode to the candidate intra-prediction mode set if it is determined that the fourth candidate intra-prediction mode is in the candidate intra-prediction mode set.
[0389] In some possible implementations, the third candidate intra-frame prediction mode belongs to one of the following:
[0390] Intra-prediction modes of adjacent blocks of the current block;
[0391] Intra-prediction mode of non-adjacent blocks of the current block;
[0392] Intra-prediction mode determined based on DIMD mode.
[0393] In some possible implementations, the first determining unit 1310 is configured to determine a fourth candidate intra-prediction mode based on the third candidate intra-prediction mode if the current block satisfies the second condition, wherein the second condition is related to whether MPDIP mode is enabled.
[0394] The first determining unit 1310 is configured to add the third candidate intra-frame prediction mode to the candidate intra-frame prediction mode set if the current block does not meet the second condition.
[0395] In some possible implementations, the first determining unit 1310 is configured to determine, based on a third cost, whether to add the planar mode to the candidate intra-prediction mode set; and / or, based on the third cost, determine the position of the planar mode in the candidate intra-prediction mode set; wherein the third cost is the cost determined by the MPDIP mode corresponding to the planar mode.
[0396] In some possible implementations, the first determining unit 1310 is configured to determine the position of the planar mode in the candidate frame prediction mode set according to the third cost if the current block satisfies a first condition, wherein the first condition is related to whether MPDIP mode is enabled.
[0397] In some possible implementations, the first determining unit 1310 is configured to add a planar mode to the first position in the candidate intra-prediction mode set if the current block does not satisfy the first condition.
[0398] In some possible implementations, the first determining unit 1310 is configured to determine the position of each candidate intra-prediction mode in the candidate intra-prediction mode set if the current block satisfies the third condition.
[0399] In some possible implementations, the third condition includes: the size of the current block satisfies a preset size, and the prediction mode of the strip where the current block is located satisfies a preset mode; or, there is at least one candidate intra-prediction mode corresponding to the MPDIP mode in the candidate intra-prediction mode set, and the at least one candidate intra-prediction mode does not include a planar mode.
[0400] In some possible implementations, the encoder 1300 is configured to determine first index information based on the target intra-prediction mode and the candidate intra-prediction mode set, the first index information being used to indicate the position of the target intra-prediction mode in the candidate intra-prediction mode set; and to write the first index information into the bitstream.
[0401] In some possible implementations, the encoder 1300 is configured to write first identification information into the bitstream, the first identification information being used to indicate whether the target intra-prediction mode is located in the candidate intra-prediction mode set.
[0402] Understandably, in the embodiments of this application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular one. Furthermore, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit described above can be implemented in hardware or as a software functional module.
[0403] If the integrated unit is implemented as a software functional module and 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, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0404] Therefore, this application provides a computer-readable storage medium for use in an encoder 1300. The computer-readable storage medium stores a computer program that, when executed by a processor, implements the encoding method described in the foregoing embodiments.
[0405] Based on the composition of the encoder 1300 described above and the computer-readable storage medium, refer to Figure 14, which shows a schematic diagram of the specific hardware structure of the encoder provided in this embodiment. As shown in Figure 14, the encoder 1400 may include: a communication interface 1410, a memory 1420, and a processor 1430; the various components are coupled together through a bus system 1440. It is understood that the bus system 1440 is used to realize the connection and communication between these components. In addition to a data bus, the bus system 1440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as bus system 1440 in Figure 14.
[0406] The communication interface 1410 is used for receiving and sending signals during the process of sending and receiving information with other external network elements.
[0407] Memory 1420 is used to store computer programs.
[0408] Processor 1430, when running the computer program, performs the following:
[0409] Determine the set of candidate intra-prediction modes for the current block;
[0410] The target intra-prediction mode for the current block is determined based on the set of candidate intra-prediction modes.
[0411] The prediction block of the current block is determined according to the target intra-frame prediction mode;
[0412] The residual block of the current block is determined based on the prediction block.
[0413] It is understood that the memory 1420 in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 1420 of the systems and methods described in this application is intended to include, but is not limited to, these and any other suitable types of memory.
[0414] The processor 1430 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 1430 or by instructions in software form. The processor 1430 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 1420. Processor 1430 reads the information in memory 1420 and completes the steps of the above method in conjunction with its hardware.
[0415] It is understood that the embodiments described in this application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or combinations thereof. For software implementation, the technology described in this application can be implemented through modules (e.g., procedures, functions, etc.) that perform the functions described in this application. Software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.
[0416] Alternatively, as another embodiment, the processor 1430 is also configured to execute the encoding method described in the foregoing embodiments when running the computer program.
[0417] It should be noted that, in this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0418] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0419] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0420] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0421] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.
[0422] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A decoding method applied to a decoder, comprising: determining a candidate intra prediction mode set of a current block; determining a target intra prediction mode of the current block according to the candidate intra prediction mode set; determining a prediction block of the current block according to the target intra prediction mode; and determining a reconstructed block of the current block according to the prediction block. The candidate intra prediction mode set comprises a first candidate intra prediction mode, and the determining the candidate intra prediction mode set of the current block comprises: determining a position of the first candidate intra prediction mode in the candidate intra prediction mode set according to a first cost; wherein the first cost is a cost determined based on an MPDIP mode corresponding to the first candidate intra prediction mode. The first cost is determined based on prediction values and reconstructed values of a first template region of the current block. The first template region corresponds to a first reference region, and the prediction values of the first template region are determined based on a preset matrix and the reconstructed values of the first reference region. The determining the position of the first candidate intra prediction mode in the candidate intra prediction mode set according to the first cost comprises: if the current block satisfies a first condition, determining the position of the first intra prediction mode in the candidate intra prediction mode set according to the first cost, the first condition being related to whether an MPDIP mode is enabled or not. The method further comprises: if the current block does not satisfy the first condition, determining the position of the first candidate intra prediction mode in the candidate intra prediction mode set according to a second cost; wherein the second cost is a cost determined based on the first candidate intra prediction mode. The second cost is determined based on prediction values and reconstructed values of a second template region and a third template region of the current block, the second template region corresponding to a second reference region and a third reference region; wherein the second reference region is adjacent to the current block, or the third reference region is adjacent to the current block.
8. The method of claim 7, wherein: the second reference region is a region in N adjacent columns on a left side of the current block; and / or, the third reference region is a region in N adjacent rows on an upper side of the current block; wherein N is an integer greater than or equal to 1. A size of the second reference region and / or the third reference region is determined based on a size of a reference region corresponding to the current block.
10. The method of any one of claims 7 to 9, wherein: the third template region corresponds to a fourth reference region and a fifth reference region; wherein the fourth reference region is adjacent to the current block, or the fifth reference region is adjacent to the current block.
11. The method of claim 10, wherein: the fourth reference region is a region in N adjacent columns on a left side of the current block; and / or, the fifth reference region is a region in N adjacent rows on an upper side of the current block; wherein, N is an integer greater than or equal to 1. A size of the fourth reference region and / or the fifth reference region is determined based on a size of a reference region corresponding to the current block. 2. The method of claim 1, wherein, 3. The method of claim 2, wherein, 4. The method of claim 3, wherein, 5. The method of any one of claims 2 to 4, wherein, 6. The method of claim 5, wherein, 7. The method of claim 6, wherein, 9. The method of claim 7 or 8, wherein, 12. The method of claim 10 or 11, wherein, 13. The method of any one of claims 1 to 12, wherein, The method further includes: determining a third candidate intra prediction mode of the current block; determining a fourth candidate intra prediction mode according to the third candidate intra prediction mode; adding the fourth candidate intra prediction mode to the candidate intra prediction mode set; wherein the fourth candidate intra prediction mode corresponds to an MPDIP mode.
14. The method of claim 13, wherein, The method further includes: determining the fourth candidate intra prediction mode according to the third candidate intra prediction mode and a target offset value.
15. The method of claim 14, wherein, The target offset value belongs to any one of a plurality of offset values, and the plurality of offset values includes a first offset value and a second offset value, and an absolute value of the first offset value is smaller than an absolute value of the second offset value.
16. The method of any one of claims 13-15, before the adding the fourth candidate intra prediction mode to the candidate intra prediction mode set, the method further includes: determining whether the fourth candidate prediction mode is in the candidate intra prediction mode set.
17. The method of claim 16, wherein, The adding the fourth candidate intra prediction mode to the candidate intra prediction mode set includes: adding the fourth candidate intra prediction mode to the candidate intra prediction mode set in a case that the fourth candidate intra prediction mode is not in the candidate intra prediction mode set.
18. The method of claim 16 or 17, wherein, The method further includes: adding the third candidate intra prediction mode to the candidate intra prediction mode set in a case that the fourth candidate intra predication mode is in the candidate intra prediction mode set.
19. The method of any one of claims 13 to 18, wherein, The third candidate intra prediction mode belongs to one of: an intra prediction mode of a neighboring block of the current block; an intra prediction mode of a non-neighboring block of the current block; an intra prediction mode determined based on a DIMD mode.
20. The method of any one of claims 13 to 19, wherein, The determining the fourth candidate intra prediction mode according to the third candidate intra prediction mode includes: if the current block satisfies a second condition, determining the fourth candidate intra prediction mode according to the third candidate intra prediction mode, the second condition being related to whether an MPDIP mode is enabled.
21. The method of claim 20, wherein, The method further includes: if the current block does not satisfy the second condition, adding the third candidate intra prediction mode to the candidate intra prediction mode set.
22. The method of any one of claims 1 to 21, wherein, The determining the candidate intra prediction mode set of the current block includes: determining whether to add a planar mode to the candidate intra prediction mode set according to a third cost; and / or, determining a position of the planar mode in the candidate intra prediction mode set according to the third cost; wherein the third cost is a cost determined for an MPDIP mode corresponding to the planar mode.
23. The method of claim 22, wherein, The determining the position of the planar mode in the candidate intra prediction mode set according to the third cost includes: if the current block satisfies a first condition, determining the position of the planar mode in the candidate intra prediction mode set according to the third, the first condition being related to whether an MPDIP mode is enabled.
24. The method of claim 23, wherein, The method further includes: If the current block does not satisfy the first condition, a planar mode is added to a first position in the candidate intra prediction mode set.
25. The method of any one of claims 1 to 24, wherein, The determining of the candidate intra prediction mode set of the current block comprises: If the current block satisfies a third condition, positions of candidate intra prediction modes in the candidate intra prediction mode set are determined.
26. The method of claim 25, wherein, The third condition comprises: A size of the current block satisfies a preset size, a prediction mode of a slice in which the current block is located satisfies a preset mode; or, At least one candidate intra prediction mode in the candidate intra prediction mode set corresponds to an MPDIP mode, and the at least one candidate intra prediction mode does not include a planar mode.
27. The method of claim 1, wherein, The method further comprises: Decoding a code stream to determine first index information, the first index information being used to indicate a position of the target intra prediction mode in the candidate intra prediction mode set; The determining of the target intra prediction mode of the current block according to the candidate intra prediction mode set comprises: Determining the target intra prediction mode according to the first index information and the candidate intra prediction mode set.
28. The method of claim 1, wherein, Before the determining of the target intra prediction mode of the current block according to the candidate intra prediction mode set, the method further comprises: Decoding a code stream to determine first identification information; Determining, according to the first identification information, whether the target intra prediction mode is located in the candidate intra prediction mode set.
29. An encoding method applied to an encoder, comprising: Determining a candidate intra prediction mode set of a current block; Determining a target intra prediction mode of the current block according to the candidate intra prediction mode set; Determining a prediction block of the current block according to the target intra prediction mode; Determining a residual block of the current block according to the prediction block.
30. The method of claim 29, wherein, The candidate intra prediction mode set comprises a first candidate intra prediction mode, and the determining of the candidate intra prediction mode set of the current block comprises: Determining a position of the first candidate intra prediction mode in the candidate intra prediction mode set according to a first cost; The first cost is a cost determined by an MPDIP mode corresponding to the first candidate intra prediction mode.
31. The method of claim 30, wherein, The first cost is determined based on prediction values and reconstructed values of a first template region of the current block.
32. The method of claim 31, wherein, The first template region corresponds to a first reference region, and the prediction values of the first template region are determined based on a preset matrix and the reconstructed values of the first reference region.
33. The method of any one of claims 30-32, wherein, The determining of the position of the first candidate intra prediction mode in the candidate intra prediction mode set according to the first cost comprises: If the current block satisfies a first condition, the position of the first intra prediction mode in the candidate intra prediction mode set is determined according to the first cost, and the first condition is related to whether an MPDIP mode is enabled.
34. The method of claim 33, wherein, The method further comprises: If the current block does not satisfy the first condition, the position of the first candidate intra prediction mode in the candidate intra prediction mode set is determined according to a second cost; The second cost is a cost determined based on the first candidate intra prediction mode.
35. The method of claim 34, wherein, The second cost is determined based on predicted values and reconstructed values of second and third template regions of the current block, the second template region corresponding to second and third reference regions; The second reference region is adjacent to the current block, or the third reference region is adjacent to the current block.
36. The method of claim 35, wherein: The second reference region is a region in N adjacent columns to the left of the current block; and / or, The third reference region is a region in N adjacent rows above the current block; N is an integer greater than or equal to 1.
37. The method of claim 35 or 36, wherein, The size of the second reference region and / or the third reference region is determined based on the size of the corresponding reference region of the current block.
38. The method of any of claims 35-37, wherein: The third template region corresponds to fourth and fifth reference regions; The fourth reference region is adjacent to the current block, or the fifth reference region is adjacent to the current block.
39. The method of claim 38, wherein: The fourth reference region is a region in N adjacent columns to the left of the current block; and / or The fifth reference region is a region in N adjacent rows above the current block; N is an integer greater or equal to 1.
40. The method of claim 38 or 39, wherein, The size of the fourth reference region and / or the fifth reference region is determined based on the size of the corresponding reference region of the current block.
41. The method of any one of claims 29-40, wherein, The determining the candidate intra prediction mode set of the current block comprises: determining a third candidate intra prediction mode of the current block; determining a fourth candidate intra prediction mode according to the third candidate intra prediction mode; adding the fourth candidate intra prediction mode to the candidate intra prediction mode set; The fourth candidate intra prediction mode corresponds to an MPDIP mode.
42. The method of claim 41, wherein, The determining the fourth candidate intra prediction mode according to the third candidate intra prediction mode comprises: determining the fourth candidate intra prediction mode according to the third candidate intra prediction mode and a target offset value.
43. The method of claim 42, wherein, The target offset value belongs to any one of a plurality of offset values, the plurality of offset values comprising a first offset value and a second offset value, and the absolute value of the first offset value is smaller than the absolute value of the second offset value.
44. The method of any of claims 41-43, before the adding the fourth candidate intra prediction mode to the candidate intra prediction mode set, the method further comprises: determining whether the fourth candidate prediction mode is in the candidate intra prediction mode set.
45. The method of claim 42, wherein, The adding the fourth candidate intra prediction mode to the candidate intra prediction mode set comprises: if it is determined that the fourth candidate intra prediction mode is not in the candidate intra prediction mode set, adding the fourth candidate intra prediction mode to the candidate intra prediction mode set.
46. The method of claim 44 or 45, wherein, The method further comprises: if it is determined that the fourth candidate intra prediction mode is in the candidate intra prediction mode set, adding the third candidate intra prediction mode to the candidate intra prediction mode set.
47. The method of any one of claims 41 to 46, wherein, The third candidate intra prediction mode belongs to one of: an intra prediction mode of a neighboring block of the current block; an intra prediction mode of a non-neighboring block of the current block; the intra prediction mode determined based on the DIMD mode.
48. The method of any one of claims 41 to 47, wherein, The determining the fourth candidate intra prediction mode according to the third candidate intra prediction mode comprises: if the current block satisfies a second condition, determining the fourth candidate intra prediction mode according to the third candidate intra prediction mode, the second condition being related to whether the MPDIP mode is enabled.
49. The method of claim 48, wherein, The method further comprises: if the current block does not satisfy the second condition, adding the third candidate intra prediction mode to the candidate intra prediction mode set.
50. The method of any one of claims 29 to 49, wherein, The determining the candidate intra prediction mode set of the current block comprises: determining whether to add a planar mode to the candidate intra prediction mode set according to a third cost; and / or, determining a position of the planar mode in the candidate intra prediction mode set according to the third cost; wherein the third cost is a cost of an MPDIP mode corresponding to the planar mode.
51. The method of claim 50, wherein, The determining the position of the planar mode in the candidate intra prediction mode set according to the third cost comprises: if the current block satisfies a first condition, determining the position of the planar mode in the candidate intra prediction mode set according to the third, the first condition being related to whether the MPDIP mode is enabled.
52. The method of claim 51, wherein, The method further comprises: if current block does not satisfy the first condition, adding the planar mode to a first position in the candidate intra prediction mode set.
53. The method of any one of claims 29 to 52, wherein, The determining the candidate intra prediction mode set of the current block further comprises: if the current block satisfies a third condition, determining the positions of the candidate intra prediction modes in the candidate intra prediction mode set.
54. The method of claim 53, wherein, The third condition comprises: a size of the current block satisfies a preset size, and a prediction mode of a slice in which the current block is located satisfies a preset mode; or there is at least one candidate intra prediction mode corresponding to an MPDIP mode in the candidate intra prediction mode set, and the at least one candidate intra prediction mode does not include a planar mode.
55. The method of claim 29, wherein, The method further comprises: determining first index information according to the target intra prediction mode and the candidate intra prediction mode set, the first index information being used to indicate a position of the target intra prediction mode in the candidate intra prediction mode set; writing the first index information into a bitstream.
56. The method of claim 29, wherein, The method further comprises: writing first identification information into a bitstream, the first identification information being used to indicate whether the target intra prediction mode is located in the candidate intra prediction mode set. 57.A decoder, comprising: a first determining unit configured to determine a candidate intra prediction mode set of a current block; a second determining unit configured to determine a target intra prediction mode of the current block according to the candidate intra prediction mode set; a third determining unit configured to determine a prediction block of the current block according to the target intra prediction mode; a fourth determining unit configured to determine a reconstructed block of the current block according to the prediction block. 58.A decoder, comprising: a memory configured to store a computer program; A processor configured to, when executing the computer program, perform the method of any of claims 1-28.
59. An encoder comprising: a first determining unit configured to determine a set of candidate intra prediction modes for a current block; a second determining unit configured to determine a target intra prediction mode for the current block according to the set of candidate intra prediction modes; a third determining unit configured to determine a prediction block for the current block according to the target intra prediction mode; a fourth determining unit configured to determine a residual block for the current block according to the prediction block.
60. An encoder comprising: a memory configured to store a computer program; a processor configured to, when executing the computer program, perform the method of any of claims 29-56.
61. A non-transitory computer readable storage medium storing a bitstream, the bitstream generated by an encoding method with an encoder or the bitstream decoded by a decoding method with a decoder, wherein, The decoding method is the method of any of claims 1-28, and the encoding method is the method of any of claims 29-56.
62. A computer readable storage medium storing a bitstream generated by the method of any of claims 29-56.
63. A computer readable storage medium, wherein, The computer readable storage medium stores a computer program which, when executed, implements the method of any of claims 1-28, or 29-56.