Encoding method, decoding method, encoder, decoder, and storage medium
By optimizing the candidate list construction method in the ECM encoding and decoding framework and utilizing MPDIP prediction and template region value sorting, the problem of low accuracy of the MPM list in the existing technology is solved, thereby improving encoding and decoding efficiency and bit rate performance.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
- Filing Date
- 2024-10-14
- Publication Date
- 2026-04-23
AI Technical Summary
In the ECM encoding and decoding framework, the accuracy of the MPM list constructed by existing technologies is low when performing intra-frame prediction, which affects the encoding and decoding efficiency.
By optimizing the candidate list construction method, a more accurate candidate list is constructed to meet the MPDIP prediction requirements, including performing MPDIP prediction when conditions are met and calculating the cost value of the template region to rank candidate patterns.
It improves the encoding and decoding efficiency of ECM, reduces the bitrate of the current block, and matches the prediction requirements of the current block.
Smart Images

Figure CN2024124706_23042026_PF_FP_ABST
Abstract
Description
Encoding / decoding methods, encoders, decoders, and storage media Technical Field
[0001] This application relates to the field of video encoding and decoding technology, specifically to an encoding and decoding method, an encoder, a decoder, and a storage medium. Background Technology
[0002] In the ECM encoding and decoding framework, if the current coding unit (CU) adopts an intra-frame encoding and decoding mode, before encoding and decoding the current CU, the most probable mode (MPM) list of the current CU is first constructed. The MPM list contains candidate intra-frame encoding and decoding modes, including the primary most probable mode (PMPM) and the second most probable mode (SMPM). Intra-frame prediction is then performed on the current block based on the MPM list.
[0003] However, in actual encoding and decoding processes, the accuracy of intra-frame prediction using the MPM list constructed using relevant technologies is low in certain scenarios, thus affecting encoding and decoding efficiency.
[0004] Summary of the Invention
[0005] This application provides an encoding / decoding method, an encoder, a decoder, and a storage medium.
[0006] The technical solution of this application embodiment can be implemented as follows:
[0007] In a first aspect, embodiments of this application provide a decoding method applied to a decoder, the method comprising:
[0008] Construct an initial candidate list for the current block;
[0009] If the initial candidate list meets the preset sorting conditions, sort the candidate patterns in the initial candidate list.
[0010] Based on the sorted candidate patterns, construct the first candidate list for the current block;
[0011] Decode the bitstream and determine the intra-prediction mode index value of the current block;
[0012] Based on the intra prediction mode index value of the current block, determine the intra prediction mode of the current block from the first candidate list;
[0013] Based on the determined intra-frame prediction mode, the current block is predicted to determine the predicted value of the current block.
[0014] Secondly, embodiments of this application provide an encoding method applied to an encoder, the method comprising:
[0015] Construct an initial candidate list for the current block;
[0016] If the initial candidate list meets the preset sorting conditions, sort the candidate patterns in the initial candidate list.
[0017] Based on the sorted candidate patterns, construct the first candidate list for the current block;
[0018] Based on the first candidate list, determine the intra-prediction mode index value of the current block;
[0019] The intra-prediction mode index value of the current block is encoded, and the resulting encoded bits are written into the bitstream.
[0020] Thirdly, embodiments of this application provide an encoder, which includes a first determining unit and an encoding unit; wherein,
[0021] The first determining unit is configured to construct the initial candidate list for the current block;
[0022] The first determining unit is further configured to sort the candidate patterns in the initial candidate list if the initial candidate list meets the preset sorting conditions; and to construct the first candidate list of the current block based on the sorted candidate patterns.
[0023] The first determining unit is further configured to determine the intra-prediction mode index value of the current block based on the first candidate list;
[0024] The coding unit is configured to encode the intra-prediction mode index value of the current block and write the resulting coded bits into the bitstream.
[0025] Fourthly, embodiments of this application provide an encoder, which includes a first memory and a first processor; wherein,
[0026] A first memory for storing computer programs that can run on a first processor;
[0027] The first processor is used to execute the method described in the second aspect when running a computer program.
[0028] Fifthly, embodiments of this application provide a decoder, which includes a second determining unit and a decoding unit; wherein,
[0029] The second determining unit is configured to construct the initial candidate list for the current block;
[0030] The second determining unit is further configured to sort the candidate patterns in the initial candidate list if the initial candidate list meets the preset sorting conditions; and to construct the first candidate list of the current block based on the sorted candidate patterns.
[0031] The decoding unit is configured to decode the bitstream and determine the intra-prediction mode index value of the current block;
[0032] The second determining unit is further configured to determine the intra-prediction mode of the current block from the first candidate list based on the intra-prediction mode index value of the current block.
[0033] The second determining unit is further configured to predict the current block based on the determined intra-frame prediction mode and determine the predicted value of the current block.
[0034] Sixthly, embodiments of this application provide a decoder, which includes a second memory and a second processor; wherein,
[0035] The second memory is used to store computer programs that can run on the second processor;
[0036] The second processor is used to execute the methods described in the first aspect when running a computer program.
[0037] In a seventh aspect, embodiments of this application provide a computer-readable storage medium that stores a bitstream generated by such encoding method.
[0038] Eighthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed, implements the method as described in the first aspect or the method as described in the second aspect.
[0039] This application provides an encoding / decoding method, encoder, decoder, and storage medium. At both the encoding and decoding ends, an initial candidate list for the current block is constructed. If the initial candidate list meets preset sorting conditions, the candidate modes in the initial candidate list are sorted. Based on the sorted candidate modes, a first candidate list for the current block is constructed. An intra-prediction mode for the current block is determined from the first candidate list. Based on the determined intra-prediction mode, the current block is predicted to determine its predicted value. Thus, by optimizing the candidate list construction method, a more accurate candidate list is constructed to match the prediction requirements of the current block for MPDIP prediction, thereby improving the encoding / decoding efficiency of ECM. Attached Figure Description
[0040] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0041] Figure 1 is a schematic diagram showing the positions of adjacent blocks of the current block in an embodiment of this application;
[0042] Figure 2 is a schematic diagram showing the positions of non-adjacent blocks of the current block in an embodiment of this application;
[0043] Figure 3 is a schematic diagram of the position of the reference pixel of the left template of the current block in an embodiment of this application;
[0044] Figure 4 is a schematic diagram of the position of the reference pixel of the upper template of the current block in an embodiment of this application;
[0045] Figure 5 is a flowchart illustrating the MPDIP prediction process in an embodiment of this application;
[0046] Figure 6 is a schematic diagram of the network architecture of an encoding / decoding system provided in an embodiment of this application;
[0047] Figure 7 is a flowchart illustrating a decoding method provided in an embodiment of this application;
[0048] Figure 8 is a schematic diagram of the position of the reference pixel of the upper template of the current block in an embodiment of this application;
[0049] Figure 9 is a schematic diagram of the position of the reference pixel of the left template of the current block in an embodiment of this application;
[0050] Figure 10 is a flowchart illustrating an encoding method provided in an embodiment of this application;
[0051] Figure 11 is a schematic diagram of the composition structure of an encoder provided in an embodiment of this application;
[0052] Figure 12 is a schematic diagram of the specific hardware structure of an encoder provided in an embodiment of this application;
[0053] Figure 13 is a schematic diagram of the composition structure of a decoder provided in an embodiment of this application;
[0054] Figure 14 is a schematic diagram of the specific hardware structure of a decoder provided in an embodiment of this application;
[0055] Figure 15 is a schematic diagram of the composition structure of an encoding and decoding system provided in an embodiment of this application. Detailed Implementation
[0056] The technical solutions of the embodiments of this application will now be described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0058] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0059] It should also be noted that the terms "first, second, and third" used in the embodiments of this application are only used to distinguish similar objects and do not represent a specific order of objects. It is understood that "first, second, and third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0060] In video images, a coding block (CB) is typically represented by a first image component, a second image component, and a third image component. These three image components are a luma component, a blue chroma component, and a red chroma component, respectively. Specifically, the luma component is usually represented by the symbol Y, the blue chroma component is usually represented by the symbol Cb or U, and the red chroma component is usually represented by the symbol Cr or V. Thus, video images can be represented in YCbCr format or YUV format.
[0061] Before providing a further detailed description of the embodiments of this application, the nouns and terms used in the embodiments of this application will be explained. The nouns and terms used in the embodiments of this application shall be interpreted as follows:
[0062] Moving Picture Experts Group (MPEG)
[0063] International Organization for Standardization (ISO)
[0064] International Electrotechnical Commission (IEC)
[0065] Joint Video Experts Team (JVET)
[0066] Alliance for Open Media (AOM)
[0067] The next-generation video coding standard H.266 / Versatile Video Coding (VVC)
[0068] VVC Reference Software Testing Platform (VVC Test Model, VTM)
[0069] Audio Video Standard (AVS)
[0070] Most Probable Mode (MPM)
[0071] Prioritize the most probable mode (PMPM).
[0072] Second Most Probable Mode (SMPM)
[0073] Non-Most Probable Mode (Non-MPM)
[0074] Decoder-side intra-mode derivation (DIMD)
[0075] Matrix-based position-dependent intra prediction (MPDIP)
[0076] Sum Absolute Distortion (SAD)
[0077] Template-based intra-mode derivation (TIMD)
[0078] Spatial Geometric Partitioning Mode (SGPM)
[0079] Context-based Adaptive Variable-Length code (CAVLC)
[0080] Context-based Adaptive Binary Arithmetic Coding (CABAC)
[0081] It's understandable that digital video compression technology primarily compresses massive amounts of digital video data to facilitate transmission and storage. With the surge in internet video and increasing demands for video clarity, while existing digital video compression standards can save considerable video data, there is still a need to pursue better digital video compression technologies to reduce the bandwidth and traffic pressure on digital video transmission.
[0082] 1. How the MPM list is constructed in ECM
[0083] In the existing ECM codec framework, if the current CU adopts the ordinary intra-frame encoding and decoding mode (also known as intra-frame prediction mode), before encoding and decoding the current CU, the MPM list of the current CU is first constructed. The MPM list contains candidate intra-frame prediction modes, which include PMPM and SMPM. PMPM contains 6 (NUM_PRIMARY_MOST_PROBABLE_MODES = 6) candidate modes, while SMPM contains 16 (NUM_SECONDARY_MOST_PROBABLE_MODES = 16) candidate modes. That is, the MPM contains a total of 22 (NUM_MOST_PROBABLE_MODES = 6 + 16 = 22) candidate modes.
[0084] 1) The PMPM list is constructed in the following order:
[0085] a) PMPM's first candidate mode is the Planar mode;
[0086] b) Inheriting the intra-prediction mode of adjacent blocks; As shown in Figure 1, the current block is a block with width W and height H. Adjacent blocks are determined by taking the top-left corner coordinates (x, y) of the current block as the origin, as shown in Figure 1. 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). Based on the CU encoding / decoding blocks where these five adjacent positions are located, determine the left adjacent CU, top adjacent CU, bottom-left adjacent CU, top-right adjacent CU, and bottom-left adjacent CU blocks. Specifically, as shown in Figure 1, the intra-prediction modes of the five adjacent blocks are added in the order of left L, top A, top-left AL, top-right AR, and bottom-left BL.
[0087] c) Add the intra-prediction mode derived from the DIMD mode of the current block;
[0088] d) Inherit the intra-prediction mode of non-adjacent blocks, as shown in Figure 2. The large block shown in the figure is a block of the same size as the current block. The position indicated by the number is the position of the block determined by that position. The intra-prediction mode of the determined block is added to the PMPM list in ascending order of the number.
[0089] By constructing steps a)-d) above, a maximum of M non-repeating candidate patterns can be obtained. Note: If the current CU satisfies the PMPM list sorting condition, then M equals 8 (NUM_PRIMARY_MOST_PROBABLE_MODES+2), including Planar patterns; if the current CU does not satisfy the PMPM list sorting condition, then M equals 22 (NUM_MOST_PROBABLE_MODES).
[0090] e) The current CU block satisfies the PMPM list sorting conditions, specifically as follows: If the size of the current CU block is less than or equal to 128 and the slice corresponding to the current block is Intra (intra-prediction slice), then the conditions for sorting the MPM list of the current CU are met; if the slice corresponding to the current block is Inter (inter-prediction slice), and the size of the current CU block is less than or equal to 1024, then the conditions for PMPM list sorting are also met. Otherwise, the current CU block does not satisfy the PMPM list sorting conditions.
[0091] f) If the current CU's PMPM list meets the sorting conditions, and the number of candidates in the PMPM list (excluding the first candidate pattern, i.e., the Planar pattern) is greater than or equal to 6 (NUM_PRIMARY_MOST_PROBABLE_MODES), then template sorting is required for the candidate patterns in the current PMPM list. Note: When sorting the patterns in the PMPM list, the first candidate pattern is not sorted. Finally, the candidate patterns in the PMPM list will be updated according to the SAD Cost of the template region.
[0092] 2) How to construct the SMPM list:
[0093] a) The patterns in the SMPM candidate list are first generated by adding a certain offset (offset=1,2,3,4) to other intra-frame angle prediction patterns in the PMPM list excluding Planar and DC;
[0094] b) If PMPM plus SMPM has fewer than 22 candidate patterns, some default candidate patterns 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}.
[0095] 3) How to construct the Non-MPM list:
[0096] In ECM, after the MPM list is constructed (22 intra-prediction modes), the other 45 (66-22) intra-prediction modes not in the MPM list are added to the Non-MPM candidate list in the order of 0-66. Candidate modes that do not exist in the MPM list are added to the Non-MPM list.
[0097] 4) After completing the MPM list and Non-MPM list, the intra-prediction mode of the current CU is encoded in the following manner.
[0098] 2. Sorting method of PMPM in ECM
[0099] Figure 3 is a schematic diagram of reference pixels for the left template of the current block in an embodiment of this application, and Figure 4 is a schematic diagram of reference pixels for the upper template of the current block in an embodiment of this application. In the current ECM codec, when the conditions for sorting the PMPM list are met, the SAD Cost of each prediction mode is obtained by using the reconstructed pixel values of the template region and the predicted pixel values of the template region. Finally, the candidate modes in the PMPM are sorted in ascending order of SAD Cost.
[0100] The conditions for PMPM list sorting are as described above. If the current CU block meets the PMPM list sorting conditions, specifically: if the current CU block size is less than or equal to 128 and the corresponding slice is Intra (intra-prediction slice), then the conditions for sorting the current CU's MPM list are met; if the current block corresponds to an Inter (inter-prediction slice) and the current CU 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 PMPM list sorting conditions.
[0101] PMPM's sorting algorithm:
[0102] 1) As shown in Figure 3, the calculation diagram of the SAD cost of the left template is illustrated; as shown in Figure 4, the calculation diagram of the SAD cost of the upper template is illustrated. The area filled with diagonal lines is the reference area for calculating the SAD cost of the calculation mode.
[0103] 2) When calculating the candidate mode SAD cost, firstly, the reconstructed pixels in the diagonal-filled area are used as reference pixels in the template area. Secondly, the candidate modes in PMPM are used to perform intra-frame prediction on the pixels in the template area to obtain the pixel prediction value of the template area.
[0104] 3) Finally, the template SAD cost corresponding to each candidate mode is calculated using the pixel prediction and reconstruction values of the template region.
[0105] 3. Intra-frame angle prediction in ECM
[0106] In existing ECM codecs, intra-frame angle prediction modes are divided into traditional intra-frame angle prediction mode and MPDIP intra-frame angle prediction mode. The specific conditions for starting MPDIP intra-frame prediction are shown in Table 1.
[0107] Table 1
[0108] MPDIP intra-frame prediction activation conditions:
[0109] 1) The template type of the CU block to be encoded and decoded is Left_Above_Templete, which means that the pixels in the left template region and the upper template region have been reconstructed;
[0110] 2) In the existing ECM, MPDIP prediction uses different numbers of prediction modes for intra-frame prediction based on different CU block sizes, as shown in Table 1. If the width and height of the current CU block are both less than or equal to 16, and the intra-frame prediction mode is 0, 1, or (2+2×k), then the mode satisfies MPDIP prediction; otherwise, for other block sizes, and the intra-frame prediction mode is 0, 1, or (2+4×k), then the mode satisfies MPDIP prediction.
[0111] 3) For blocks of different sizes, it is required that reference pixels with different numbers of rows and columns have been reconstructed. See Table 2 for details.
[0112] Table 2
[0113] Where numMRLLeft represents the number of columns of left reference pixels and numMRLTop represents the number of rows of top reference pixels.
[0114] 4) When the current CU meets the above conditions for starting MPDIP intra-frame prediction 1)->3), MPDIP intra-frame prediction will be performed on the candidate mode of the current CU.
[0115] The specific MPDIP intra-frame prediction method is shown in Figure 5.
[0116] As shown in Figure 5, when performing intra-frame prediction on the current CU, if the intra-frame prediction mode can perform MPDIP intra-frame prediction, reference pixels will be obtained based on the current CU's position and CU block size. Finally, the prediction information of the current CU will be obtained using the reference pixels and the matrix vector preset by the intra-frame prediction mode. If the current CU does not meet the activation conditions for MPDIP intra-frame prediction, the traditional intra-frame angle prediction mode will be used to obtain the prediction information of the current CU block.
[0117] However, in actual encoding and decoding processes, the accuracy of intra-frame prediction using the MPM list constructed using relevant technologies is low in certain scenarios, thus affecting encoding and decoding efficiency.
[0118] In existing ECM codecs, for the current block that can be predicted using MPDIP, a list of MPMs is constructed using relevant technologies. However, the candidate patterns in the MPM list cannot meet the prediction requirements of the current block, which affects the encoding and decoding efficiency.
[0119] For the current block undergoing MPDIP prediction, the SAD cost of the template region of the current block is calculated using the method shown in Figures 3 and 4 when sorting the PMPM list. Then, the candidate modes in the PMPM list are sorted based on the SAD cost. This method of calculating the template region SAD cost, when sorting the intra-prediction modes in the PMPM list, does not distinguish whether a candidate mode can be used for MPDIP prediction; instead, it uniformly uses the traditional intra-angle prediction mode to predict the template region. This PMPM sorting method affects the accuracy of the sorting results, thus impacting encoding and decoding efficiency.
[0120] Based on this, embodiments of this application provide an encoding and decoding method that optimizes the candidate list construction method to build a more accurate candidate list to match the prediction requirements of the current block for MPDIP prediction, thereby improving the encoding and decoding efficiency of ECM.
[0121] Specifically, a new candidate list sorting method is provided. If the current block meets the MPDIP template sorting conditions, MPDIP prediction is performed on the template region based on the reference pixels of the template region of the current block, and the cost value of the template region is calculated to sort the candidate modes. This can obtain a more accurate PMPM list, reduce the bit rate of the current block, and improve the encoding and decoding efficiency of ECM.
[0122] Specifically, a new candidate list construction method is provided. If the current block meets the MPDIP intra-prediction start condition, the initial candidate mode is converted into a preset intra-prediction mode, adding more accurate candidate modes to the MPM list and / or non-MPM list of the current block. This makes the constructed MPM list and / or non-MPM list meet the prediction requirements of the current block, further improving the encoding and decoding efficiency of ECM.
[0123] Furthermore, this application embodiment also provides a network architecture for an encoding / decoding system including an encoder and a decoder. Figure 6 shows a schematic diagram of the network architecture of an encoding / decoding system provided in this application embodiment. As shown in Figure 6, the network architecture includes one or more electronic devices 13 to 1N and a communication network 01, wherein the electronic devices 13 to 1N can perform video interaction through the communication network 01. The electronic devices can be various types of devices with video encoding / decoding capabilities, such as smartphones, tablets, personal computers, personal digital assistants, navigators, digital phones, video phones, televisions, sensing devices, servers, etc., without specific limitations. Additionally, the decoder or encoder in this application embodiment can be the aforementioned electronic device.
[0124] It should be noted that the method in this application embodiment is mainly applied to the inter-frame prediction unit, and can be applied to the encoder, the decoder, or even both the encoder and the decoder at the same time, but this application embodiment does not make any specific limitations.
[0125] It should also be noted that when applied to the encoder, "current block" specifically refers to the coded block currently undergoing intra-frame prediction; when applied to the decoder, "current block" specifically refers to the decoded block currently undergoing intra-frame prediction.
[0126] To facilitate understanding of the technical solutions of the embodiments of this application, the technical solutions of this application are described in detail below through specific embodiments. The above-mentioned related technologies are optional solutions and can be arbitrarily combined with the technical solutions of the embodiments of this application, all of which fall within the protection scope of the embodiments of this application. The embodiments of this application include at least some of the following contents.
[0127] In one embodiment of this application, referring to FIG7, a flowchart of a decoding method provided by an embodiment of this application is shown. As shown in FIG7, the method may include:
[0128] S701: Construct the initial candidate list for the current block;
[0129] The initial candidate list includes one or more candidate modes for the current block, where each candidate mode is a candidate intra-prediction mode. Specifically, the initial candidate list includes the most likely preferred mode (PMPM) for the current block, and can be understood as an initial list of PMPMs.
[0130] In some embodiments, the initial candidate list includes one or more preset intra-prediction modes. When a preset intra-prediction mode is selected to perform intra-prediction on the current block or the template region of the current block, the preset intra-prediction mode is replaced by the matrix-based intra-angle prediction MPDIP mode.
[0131] In some embodiments, constructing an initial candidate list for the current block includes: obtaining an initial candidate mode for the current block; and, if the current block meets the MPDIP intra-prediction initiation conditions, converting the initial candidate mode of the current block into a corresponding preset intra-prediction mode and adding it to the initial candidate list.
[0132] In some embodiments, obtaining the initial candidate mode of the current block includes: obtaining the Planar mode; obtaining the intra prediction modes of the adjacent blocks of the current block in sequence based on the inheritance order of adjacent blocks; obtaining the intra prediction mode derived from the DIMD mode of the current block; and obtaining the intra prediction modes of the non-adjacent blocks of the current block in sequence based on the inheritance order of non-adjacent blocks.
[0133] The MPDIP intra-frame prediction initiation condition indicates whether MPDIP prediction can be performed on the current block. If the condition is met, the initial candidate mode is converted into a preset intra-frame prediction mode and added to the initial candidate list. This provides more accurate candidate modes for the current block, matching its prediction requirements. If the condition is not met, and the initial candidate list does not contain an initial candidate mode, the initial candidate mode is directly added to the initial candidate list.
[0134] In some embodiments, the MPDIP intra-prediction initiation conditions include at least one of the following: the template type of the current block is a first template type; the width of the current block is less than or equal to a first preset value and the height of the current block is less than or equal to a second preset value, and the initial candidate mode belongs to a first intra-prediction mode, the preset intra-prediction mode includes the first intra-prediction mode; the width of the current block is greater than the first preset value or the height of the current block is greater than the second preset value, and the initial candidate mode belongs to a second intra-prediction mode, the preset intra-prediction mode includes the second intra-prediction mode; the reference pixels of the current block have been reconstructed.
[0135] The preset intra-prediction modes include the traditional intra-angle prediction modes that can be replaced by the MPDIP mode, as shown in Table 1. If the width and height of the current CU block are both less than or equal to 16, and the intra-prediction mode is the first intra-prediction mode 0, 1, (2+2×k), then this mode can perform MPDIP prediction; otherwise, for other block sizes, and the intra-prediction mode is the second intra-prediction mode 0, 1, (2+4×k), then this mode can perform MPDIP prediction.
[0136] For example, the first template type includes, but is not limited to, Left_Above_Templete, which means that the reconstruction is completed using the upper left reference pixel, the upper reference pixel, and the left reference pixel of the current block. Another example is that the first template type can also be Above_Templete, meaning that the reconstruction is completed using the upper reference pixel of the current block. Yet another example is that the first template type can also be Left_Templete, meaning that the reconstruction is completed using the left reference pixel of the current block.
[0137] In some embodiments, the reference pixels of the current block include the upper reference row pixels and the left reference column pixels of the current block; the number of upper reference pixel rows and the number of left reference pixel columns of the current block are related to the size of the current block.
[0138] For example, as shown in Table 2, if the current block size is 32x16 / 16x32 / 32x32, the number of upper reference pixel rows and left reference pixel columns of the current block is 1; otherwise, the number of upper reference pixel rows and left reference pixel columns of the current block is 2.
[0139] In other embodiments, the number of upper reference pixel rows of the current block can also be a default value, and the number of left reference pixel columns of the current block can also be a default value. For example, the default value can be 1 or 2.
[0140] It should be noted that when determining the start condition for MPDIP intra-frame prediction, the width of the upper reference pixel of the current block is the same as the width w of the current block, and the height of the left reference pixel of the current block is the same as the height h of the current block.
[0141] In some embodiments, if the current block meets the MPDIP intra-prediction initiation conditions and the initial candidate mode of the current block is not a preset intra-prediction mode, the initial candidate mode of the current block is converted into the corresponding preset intra-prediction mode and added to the initial candidate list.
[0142] In some embodiments, if the current block meets the MPDIP intra-prediction initiation conditions and the initial candidate mode of the current block is not Planar mode or DC mode, the initial candidate mode of the current block is converted into the corresponding preset intra-prediction mode and added to the initial candidate list.
[0143] In some embodiments, the initial candidate mode of the current block is converted to the most recent preset intra-prediction mode and added to the initial candidate list. For example, the initial candidate mode of the current block is rounded to the most recent preset intra-prediction mode and added to the initial candidate list.
[0144] In some embodiments, based on a first conversion rule, the initial candidate mode number value is converted into a first value, which is an integer obtained by rounding the conversion result; based on a second conversion rule, the first value is converted into the number value of a preset intra-frame prediction mode; the first conversion rule and the second conversion rule are inverses of each other.
[0145] In some embodiments, the first conversion rule includes: if the number value of the initial candidate pattern is greater than or equal to the second value, calculating the difference between the number value of the initial candidate pattern and the second value; calculating the sum of the determined difference and the third value; and calculating the quotient of the determined sum and the fourth value to obtain the first value.
[0146] The second conversion rule includes: calculating the product of the first value and the fourth value; calculating the sum of the determined product and the second value to obtain the number value of the preset intra-frame prediction mode.
[0147] In some embodiments, the first and second transformation rules are related to the size of the current block. For example, one or more parameters of the first and second transformation rules are determined based on the size of the current block. Specifically, the third and fourth values are determined based on the size of the current block.
[0148] The first transformation rule can be a first function, and the second transformation rule can be a second function. For example, if the current block size is W≤16 && H≤16, the first function is k=((predMode-2)+1)>>1, where k is the first value, the number of the initial candidate mode of predMod, and the second function is predPDPMode=2×k+2, where predPDPMode is the number of the preset intra-frame prediction mode. As another example, if the current block size is W>16||H>16, the first function is k=((predMode-2)+3)>>2, and the second function is predPDPMode=4×k+2.
[0149] In some embodiments, the method further includes: converting the first value into a preset intra-frame prediction mode number value by adding an offset value to the first value based on a second conversion rule.
[0150] For example, if multiple offset values are included, based on the second transformation rule, the first value is added to the current offset value and converted into the number value of the preset intra-frame prediction mode. This value is then added to the initial candidate list, and the process stops. If the value is not added to the initial candidate list, the process continues to try the next offset value. As another example, based on the second transformation rule, the first value is sequentially added to the current offset value and converted into the number value of the preset intra-frame prediction mode. Whether the value is added to the initial candidate list or not, the process continues to iterate over the next offset value until all offset values have been iterated over.
[0151] The current offset value is determined based on a preset search order. For example, the offset value includes ±1, that is, for k, the offset is ±1, and the search order is to search for -1 first, and then search for +1.
[0152] In some embodiments, the method further includes at least one of the following: adding an initial candidate mode to the initial candidate list if the current block does not meet the MPDIP intra-prediction initiation conditions; adding an initial candidate mode to the initial candidate list if the preset intra-prediction mode corresponding to the initial candidate mode has already been added to the initial candidate list; and adding an initial candidate mode to the end of the initial candidate list if the preset intra-prediction mode corresponding to the initial candidate mode has already been added to the initial candidate list.
[0153] As shown in Figure 1, five adjacent block intra prediction modes are added in the order of left L, top A, top left AL, top right AR, and bottom left BL. When the intra prediction mode 13 of the upper adjacent block A of the current block is obtained, for example, if the current block meets the MPDIP intra prediction start condition, 13 is rounded to the nearest preset intra prediction mode 12. If the PMPM list does not contain 12, then 12 is added to the PMPM list. If the PMPM list contains 12 but does not contain 13, then 13 is added to the PMPM list. If the current block does not meet the MPDIP intra prediction start condition, and if the PMPM list does not contain 13, then 13 is added to the PMPM list.
[0154] For example, if the current block meets the MPDIP intra-prediction start condition, 13 is rounded to the nearest preset intra-prediction mode 12. If the PMPM list does not contain 12, then 12 is added to the PMPM list. If the PMPM list does not contain 13, then 13 is added to the PMPM list after 12, or 13 is added to the candidate list. After the initial candidate list is completed, the candidate list is added to the end of the initial candidate list.
[0155] S702: If the initial candidate list meets the preset sorting conditions, sort the candidate patterns in the initial candidate list.
[0156] The sorting criteria are used to indicate whether the current block adopts the template-based candidate list sorting method provided in the embodiments of this application. In some embodiments, the sorting criteria include a first condition and a second condition, wherein the first condition is a condition that triggers the initial candidate list sorting, and the second condition is a condition that triggers the MPDIP template sorting.
[0157] In some embodiments, the first condition includes at least one of the following: the size of the current block is less than or equal to a third preset value, and the decoding unit to which the current block belongs is an intra-frame prediction unit; the size of the current block is less than or equal to a fourth preset value, and the decoding unit to which the current block belongs is an inter-frame prediction unit; the number of candidate modes in the initial candidate list is greater than or equal to a first quantity threshold.
[0158] The third and fourth preset values can be area thresholds, where the third preset value is less than the fourth preset value. For example, the third preset value is 128 and the fourth preset value is 1024. Alternatively, the third and fourth preset values can also include width and height thresholds, where the width threshold of the third preset value is less than the width threshold of the fourth preset value, and the height threshold of the third preset value is less than the height threshold of the fourth preset value.
[0159] The number of candidate patterns in the initial candidate list can refer to the number of candidate patterns participating in the sorting. The first numerical threshold is an integer greater than 1. For example, the first numerical threshold can be any integer between 2 and (MN), where M is the total number of candidate patterns in the initial candidate list (M is greater than or equal to 2), and N is the number of non-parameter sorting operations (N is greater than or equal to 0). For example, the first number threshold is 6, or it can be a positive integer such as 2 or 3.
[0160] For example, the first candidate pattern in the initial candidate pattern list is fixed as the Planar pattern, meaning the Planar pattern is not sorted; the other candidate patterns are sorted. As another example, the first two candidate patterns in the initial candidate pattern list are fixed as the Planar pattern and the DC pattern, meaning the Planar pattern and the DC pattern are not sorted; the other candidate patterns are sorted.
[0161] For example, the first condition may include: the size of the current block is less than or equal to a third preset value, and the decoding unit to which the current block belongs is an intra-prediction unit; the number of candidate modes in the initial candidate list is greater than or equal to a first quantity threshold. For example, if the Planar mode does not participate in the sorting, and the size of the current block is less than or equal to 128 and the slice corresponding to the current block is an intra-prediction slice, and the number of candidate modes in the initial candidate list (excluding the Planar mode) is greater than or equal to 6, then the current block is determined to meet the first condition. Alternatively, if the Planar mode participates in the sorting, and the size of the current block is less than or equal to 128 and the slice corresponding to the current block is an intra-prediction slice, and the number of candidate modes in the initial candidate list (including the Planar mode) is greater than or equal to 2, then the current block is determined to meet the first condition.
[0162] For example, the first condition could also include: the size of the current block is less than or equal to a fourth preset value, and the decoding unit to which the current block belongs is an inter-frame prediction unit; the number of candidate modes in the initial candidate list is greater than or equal to a first quantity threshold. For example, if the Planar mode does not participate in the sorting, and the size of the current block is less than or equal to 1024 and the slice corresponding to the current block is an inter-frame prediction slice, and the number of candidate modes in the initial candidate list (excluding the Planar mode) is greater than or equal to 6, then the current block is determined to meet the first condition. Alternatively, if the Planar mode participates in the sorting, and the size of the current block is less than or equal to 1024 and the slice corresponding to the current block is an inter-frame prediction slice, and the number of candidate modes in the initial candidate list (including the Planar mode) is greater than or equal to 2, then the current block is determined to meet the first condition.
[0163] In some embodiments, the second condition includes at least one of the following: the reference pixels of the template region of the current block have been reconstructed; the current block meets the MPDIP intra-prediction initiation condition, and the initial candidate list includes a preset intra-prediction mode.
[0164] In some embodiments, the reference pixels of the template region of the current block include the upper reference row pixels of the template region and the left reference column pixels of the template region, and the number of upper reference pixel rows and the number of left reference pixel columns of the template region are related to the size of the current block.
[0165] For example, as shown in Table 2, if the current block size is 32x16 / 16x32 / 32x32, the number of upper reference pixel rows and left reference pixel columns in the template region is 1; otherwise, the number of upper reference pixel rows and left reference pixel columns in the template region is 2.
[0166] In other embodiments, the number of upper reference pixel rows in the template region can also be a default value, and the number of left reference pixel columns in the template region can also be a default value. For example, the default value can be 1 or 2.
[0167] It should be noted that when performing the second condition judgment, the width of the upper reference pixel of the template area is the same as the width w of the current block, and the height of the left reference pixel of the template area is the same as the height h of the current block.
[0168] In Figure 8, the block enclosed by the thick solid line represents the current CU, its upper template, and its reference pixels. In Figure 9, the block enclosed by the thick solid line represents the current CU, its left template, and its reference pixels. Assume the current CU has a width of w and a height of h, with the origin at the top-left corner coordinates (x, y). Assume the template region has 2 rows of upper reference pixels and 2 columns of left reference pixels. Then, in Figure 8, the top-left corner of the upper reference row pixels of the upper template is (x, y-1-2), with a width equal to the current CU's width w and a height of 2. The top-left corner of the upper reference column pixels of the upper template is (x-2, y-1), with a height equal to the current CU's height h and a width of 2. The upper template also includes a top-left reference pixel, with its top-left corner at (x-2, y-1-2). The top-left corner of the upper reference row pixel of the left template is (x-1, y-2), its width is the width w of the current CU, and its height is 2; the top-left corner of the left reference column pixel of the left template is (x-1-2, y), its height is the height h of the current CU, and its width is 2. The left template also includes the top-left reference pixel, whose top-left corner is (x-1-2, y-2).
[0169] In some embodiments, sorting the candidate modes in the initial candidate list includes: if the current candidate mode in the initial candidate list is a preset intra-prediction mode, the current candidate mode is replaced with the corresponding MPDIP mode; template prediction is performed based on the MPDIP mode corresponding to the current candidate mode and the reference pixels of the template region of the current block to determine the predicted value of the template region of the current block; if the current candidate mode in the initial candidate list is not a preset intra-prediction mode, template prediction is performed based on the current candidate mode and the reference pixels of the template region of the current block to determine the predicted value of the template region of the current block; the cost of the candidate modes in the initial candidate list is determined based on the predicted value and the reconstructed value of the template region of the current block; and the candidate modes are sorted based on their cost values in the initial candidate list. The cost values of the candidate modes include, but are not limited to, sum of absolute errors (SAD), sum of transform absolute errors (SATD), sum of squared differences (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), rate distortion cost (RDO), etc.
[0170] Methods for MPDIP prediction of template regions may include multiplying the reference pixels of each template region of the current block with the matrix vector corresponding to the MPDIP mode to obtain the predicted value of each template region.
[0171] The MPDIP pattern corresponding to the current candidate pattern of the current block or the template region of the current block is determined based on the size of the current block and the current candidate pattern. Specifically, the matrix vector corresponding to the MPDIP pattern is determined based on the current candidate pattern and the size of the current block.
[0172] In some embodiments, the reference pixels of the upper template region of the current block include pixels in one or more of the following regions after the current block is offset upwards by N rows: the upper adjacent region, the upper right adjacent region, the upper left adjacent region, the left adjacent region, and the lower left adjacent region, where N is a positive integer. For example, N can be 1, N can be 2, or other positive integers, and the value of N can also be related to the size of the current block.
[0173] The reference pixels for the left template region of the current block include pixels in one or more of the following regions offset M columns to the left: the upper adjacent region, the upper right adjacent region, the upper left adjacent region, the left adjacent region, and the lower left adjacent region, where M is a positive integer. For example, M can be 1, M can be 2, or other positive integers, and the value of M can also be related to the size of the current block.
[0174] M and N can be equal or unequal.
[0175] In some embodiments, during template prediction, the upper reference pixel width and the left reference pixel height of the template region are related to the size of the current block. For example, the upper reference pixel width of the template region is determined based on the width of the current block, and the left reference pixel height of the template region is determined based on the height of the current block.
[0176] In some embodiments, when performing template prediction, the width of the upper reference pixel of the template region is the same as the width w of the current block, and the height of the left reference pixel of the template region is the same as the height h of the current block.
[0177] In some embodiments, when performing template prediction, the number of upper reference pixel rows and the number of left reference pixel columns of the template region are related to the size of the current block.
[0178] S703: Construct the first candidate list for the current block based on the sorted candidate patterns;
[0179] The sorted candidate patterns can be understood as sorted PMPMs. The sorted PMPMs are used to construct the first candidate list. The first candidate list can be the PMPM list of the current block or the MPM list of the current block. The MPM list can be a list that includes PMPMs and SMPMs, or it can be a list that includes PMPMs, SMPMs and non-MPMs.
[0180] In some embodiments, constructing a first candidate list for the current block based on a plurality of sorted candidate patterns includes adding the plurality of sorted candidate patterns to the first candidate list. The first candidate list constructed in this case is the PMPM list.
[0181] In some embodiments, constructing a first candidate list for the current block based on a sorted plurality of candidate patterns includes: adding the sorted plurality of candidate patterns to a first part of the first candidate list; obtaining one or more second candidate patterns based on the sorted first candidate patterns and one or more offset values; and adding the one or more second candidate patterns to a second part of the first candidate list, with the first part preceding the second part. The first candidate list constructed in this way is an MPM list, which includes PMPM and SMPM, with the first part including PMPM and the second part including SMPM.
[0182] The sorted candidate modes include two or more candidate modes. The first candidate mode can be any of the sorted candidate modes. The first candidate mode can also be a specific candidate mode or one or more candidate modes. For example, the first candidate mode is any intra-frame angle prediction mode in Part 1 other than Planar and DC.
[0183] The current offset value is added to the sorted first candidate pattern to obtain the second candidate pattern. If the first candidate list does not contain the second candidate pattern, the second candidate pattern is added. Continue to traverse the next offset value until the second part is added or all offsets are traversed.
[0184] For example, offset values can include positive numbers such as 1, 2, 3, and 4. As another example, offset values can also include negative numbers such as -1, -2, -3, and -4.
[0185] In some embodiments, adding one or more second candidate modes to the second part of the first candidate list may include: if the MPDIP intra-prediction initiation conditions are met in the current block, converting the second candidate mode into the most recent preset intra-prediction mode and adding it to the second part of the first candidate list; if the MPDIP intra-prediction initiation conditions are not met in the current block, adding the second candidate mode to the second part of the first candidate list. The second candidate mode is rounded to the most recent preset intra-prediction mode, adding more accurate candidate modes to the second part to match the prediction requirements of the current block. The specific conversion method can refer to the conversion method of the initial candidate mode, and will not be elaborated here.
[0186] In some embodiments, the method further includes: if the total number of candidate patterns in the first part and the second part of the first candidate list is less than a second number threshold, adding a default candidate pattern to the first candidate list based on a first order.
[0187] After the first part (which can be considered as the PMPM list) is built, the second part (which can be considered as the SMPM list) will be built according to the candidate patterns in the first part, at a certain offset (1,2,3,4). If the candidate patterns in the first and second parts are still insufficient (e.g., the second quantity threshold is 22), some default candidate patterns will be added, such as {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}, until it equals 22.
[0188] In some embodiments, the preset intra-prediction modes in the second part of the first candidate list precede the non-preset intra-prediction modes. During the construction of the second part, if the current block meets the MPDIP intra-prediction initiation conditions, the preset intra-prediction mode corresponding to the MPDIP mode is added to the beginning of the second part, and the non-preset intra-prediction modes are added to the end of the second part. If the intra-prediction mode of the current frame is located in the second part, this list construction method can reduce the codewords of the index values.
[0189] In some embodiments, constructing a first candidate list for the current block based on a plurality of sorted candidate patterns includes: adding the plurality of sorted candidate patterns to a first part of the first candidate list; obtaining one or more second candidate patterns based on the sorted first candidate patterns and one or more offset values; adding the one or more second candidate patterns to a second part of the first candidate list; and adding other candidate patterns to a third part of the first candidate list based on a second order, wherein the other candidate patterns are candidate patterns other than those in the first and second parts of the first candidate list, with the first part preceding the second part and the third part following the second part. The first candidate list constructed in this way is an MPM list, which is a list of PMPM, SMPM, and non-MPM, with the first part including PMPM, the second part including SMPM, and the third part including non-MPM.
[0190] The first, second, and third parts of the first candidate list can also be understood as three sub-lists of candidate patterns, or three sets of candidate patterns. Each part includes one or more candidate patterns. This application specifically provides a method for constructing these first, second, and third parts.
[0191] After the first and second parts are constructed, the third part (which can be regarded as a non-MPM list part) is further constructed using other candidate modes. For example, the second order specifically involves iterating through the intra-prediction modes 0-66 in sequence and adding candidate modes that are not present in the first and second parts to the third part.
[0192] In some embodiments, the preset intra-prediction mode in the third part of the first candidate list precedes the non-preset intra-prediction mode.
[0193] If the current block meets the MPDIP intra-prediction start condition, the preset intra-prediction mode corresponding to the MPDIP mode will be added to the beginning of the second part, and the non-preset intra-prediction mode will be added to the end of the second part. If the intra-prediction mode of the current frame is located in the third part, this list construction method can reduce the codewords of the index value.
[0194] S704: Decode the bitstream and determine the intra-prediction mode index value of the current block;
[0195] In some embodiments, if the value of the relevant syntax element of the current block indicates that the intra-prediction mode of the current block is located in the fourth part of the first candidate list, the bitstream is decoded to determine the first index value of the intra-prediction mode of the current block; if the value of the relevant syntax element of the current block indicates that the intra-prediction mode of the current block is located in the fifth part of the first candidate list, the bitstream is decoded to determine the second index value of the intra-prediction mode of the current block.
[0196] In some embodiments, the method further includes: decoding the bitstream and determining the values of the relevant syntax elements of the current block.
[0197] In some embodiments, the relevant syntax elements of the current block include a first syntax element and a second syntax element. The decoding method for the values of the relevant syntax elements includes: decoding the bitstream to determine the first syntax element of the current block; if the value of the first syntax element is a fifth preset value, decoding the bitstream to determine the second syntax element of the current block; if the value of the second syntax element is a fifth preset value, determining that the intra-prediction mode of the current block is located in the fourth part of the first candidate list; if the value of the second syntax element is a sixth preset value, determining that the intra-prediction mode of the current block is located in the fifth part of the first candidate list; if the value of the first syntax element is a sixth preset value, determining that the intra-prediction mode of the current block is located in the sixth part of the first candidate list.
[0198] The fifth and sixth preset values are not equal. For example, the fifth preset value is 1 and the sixth preset value is 0. Or, for another example, the fifth preset value is 0 and the sixth preset value is 1.
[0199] The fourth, fifth, and sixth parts of the first candidate list can also be understood as three sub-lists of candidate patterns, or three sets of candidate patterns. Each part includes one or more candidate patterns. This application provides a specific indexing method for these fourth, fifth, and sixth parts.
[0200] The fourth part of the first candidate list precedes the fifth part, and the fifth part precedes the sixth part. In other words, by dividing the first candidate list into three parts, with different index values indexing the intra-prediction modes in different parts, and encoding the index values of the intra-prediction modes located in each part, the number of codewords can be reduced.
[0201] It should be noted that the number and order of candidate patterns in the first and fourth parts of the first candidate list may be the same or different; the number and order of candidate patterns in the second and fifth parts of the first candidate list may be the same or different; and the number and order of candidate patterns in the third and sixth parts of the first candidate list may be the same or different.
[0202] S705: Determine the intra prediction mode of the current block from the first candidate list based on the intra prediction mode index value of the current block;
[0203] In some embodiments, the intra-prediction mode of the current block is determined from a fourth portion of the first candidate list based on a first index value; or, the intra-prediction mode of the current block is determined from a fifth portion of the first candidate list based on a second index value; or, the intra-prediction mode of the current block is determined from a sixth portion of the first candidate list based on a third index value.
[0204] S706: Based on the determined intra-frame prediction mode, predict the current block and determine the predicted value of the current block.
[0205] Specifically, the predicted value of the current block is determined based on the determined intra-frame prediction mode and the reference pixel of the current block.
[0206] In some embodiments, when predicting the current block, the width of the upper reference pixel and the height of the left reference pixel of the current block are related to the size of the current block. For example, the width of the upper reference pixel of the current block is determined based on the width of the current block, and the height of the left reference pixel of the current block is determined based on the height of the current block.
[0207] In some embodiments, when predicting the current block, the width of the upper reference pixel of the current block is the same as the width w of the current block, and the height of the left reference pixel of the current block is the same as the height h of the current block.
[0208] In some embodiments, when predicting the current block, the number of upper reference pixel rows and the number of left reference pixel columns in the template region are related to the size of the current block.
[0209] In some embodiments, the method further includes: decoding the bitstream to determine the residual value of the current block; and determining the reconstructed value of the current block based on the residual value and the predicted value of the current block.
[0210] In another embodiment of this application, referring to FIG10, a flowchart of an encoding method provided by an embodiment of this application is shown. As shown in FIG10, the method may include:
[0211] S1001: Construct the initial candidate list for the current block;
[0212] The initial candidate list includes one or more candidate modes for the current block, where each candidate mode is a candidate intra-prediction mode. Specifically, the initial candidate list includes the most probable mode (PMPM) for the current block, and can be understood as an initial list of PMPMs.
[0213] In some embodiments, the initial candidate list includes one or more preset intra-prediction modes. When a preset intra-prediction mode is selected to perform intra-prediction on the current block or the template region of the current block, the preset intra-prediction mode is replaced by the matrix-based intra-angle prediction MPDIP mode.
[0214] In some embodiments, constructing an initial candidate list for the current block includes: obtaining an initial candidate mode for the current block; and, if the current block meets the MPDIP intra-prediction initiation conditions, converting the initial candidate mode of the current block into a corresponding preset intra-prediction mode and adding it to the initial candidate list.
[0215] In some embodiments, obtaining the initial candidate mode of the current block includes: obtaining the Planar mode; obtaining the intra prediction modes of the adjacent blocks of the current block in sequence based on the inheritance order of adjacent blocks; obtaining the intra prediction mode derived from the DIMD mode of the current block; and obtaining the intra prediction modes of the non-adjacent blocks of the current block in sequence based on the inheritance order of non-adjacent blocks.
[0216] The MPDIP intra-frame prediction initiation condition indicates whether MPDIP prediction can be performed on the current block. If the condition is met, the initial candidate mode is converted into a preset intra-frame prediction mode and added to the initial candidate list. This provides more accurate candidate modes for the current block, matching its prediction requirements. If the condition is not met, and the initial candidate list does not contain an initial candidate mode, the initial candidate mode is directly added to the initial candidate list.
[0217] In some embodiments, the MPDIP intra-prediction initiation conditions include at least one of the following: the template type of the current block is a first template type; the width of the current block is less than or equal to a first preset value and the height of the current block is less than or equal to a second preset value, and the initial candidate mode belongs to a first intra-prediction mode, the preset intra-prediction mode includes the first intra-prediction mode; the width of the current block is greater than the first preset value or the height of the current block is greater than the second preset value, and the initial candidate mode belongs to a second intra-prediction mode, the preset intra-prediction mode includes the second intra-prediction mode; the reference pixels of the current block have been reconstructed.
[0218] The first preset value and the second preset value can be equal, for example, the first preset value and the second preset value can be 16, or they can be 32. The first preset value and the second preset value can also be unequal.
[0219] In some embodiments, the reference pixels of the current block include the upper reference row pixels and the left reference column pixels of the current block; the number of upper reference pixel rows and the number of left reference pixel columns of the current block are related to the size of the current block.
[0220] In other embodiments, the number of upper reference pixel rows of the current block can also be a default value, and the number of left reference pixel columns of the current block can also be a default value. For example, the default value can be 1 or 2.
[0221] It should be noted that when determining the start condition for MPDIP intra-frame prediction, the width of the upper reference pixel of the current block is the same as the width w of the current block, and the height of the left reference pixel of the current block is the same as the height h of the current block.
[0222] In some embodiments, if the current block meets the MPDIP intra-prediction initiation conditions and the initial candidate mode of the current block is not a preset intra-prediction mode, the initial candidate mode of the current block is converted into the corresponding preset intra-prediction mode and added to the initial candidate list.
[0223] In some embodiments, if the current block meets the MPDIP intra-prediction initiation conditions and the initial candidate mode of the current block is not Planar mode or DC mode, the initial candidate mode of the current block is converted into the corresponding preset intra-prediction mode and added to the initial candidate list.
[0224] In some embodiments, the initial candidate mode of the current block is converted to the most recent preset intra-prediction mode and added to the initial candidate list. For example, the initial candidate mode of the current block is rounded to the most recent preset intra-prediction mode and added to the initial candidate list.
[0225] In some embodiments, based on a first conversion rule, the initial candidate mode number value is converted into a first value, which is an integer obtained by rounding the conversion result; based on a second conversion rule, the first value is converted into the number value of a preset intra-frame prediction mode; the first conversion rule and the second conversion rule are inverses of each other.
[0226] In some embodiments, the first conversion rule includes: if the number value of the initial candidate pattern is greater than or equal to the second value, calculating the difference between the number value of the initial candidate pattern and the second value; calculating the sum of the determined difference and the third value; and calculating the quotient of the determined sum and the fourth value to obtain the first value.
[0227] The second conversion rule includes: calculating the product of the first value and the fourth value; calculating the sum of the determined product and the second value to obtain the number value of the preset intra-frame prediction mode.
[0228] In some embodiments, the first and second transformation rules are related to the size of the current block. For example, one or more parameters of the first and second transformation rules are determined based on the size of the current block. Specifically, the third and fourth values are determined based on the size of the current block.
[0229] In some embodiments, the method further includes: converting the first value into a preset intra-frame prediction mode number value by adding an offset value to the first value based on a second conversion rule.
[0230] In some embodiments, the method further includes at least one of the following: adding an initial candidate mode to the initial candidate list if the current block does not meet the MPDIP intra-prediction initiation conditions; adding an initial candidate mode to the initial candidate list if the preset intra-prediction mode corresponding to the initial candidate mode has already been added to the initial candidate list; and adding an initial candidate mode to the end of the initial candidate list if the preset intra-prediction mode corresponding to the initial candidate mode has already been added to the initial candidate list.
[0231] S1002: If the initial candidate list meets the preset sorting conditions, sort the candidate patterns in the initial candidate list.
[0232] The sorting condition is used to indicate whether the current block adopts the candidate list sorting method provided in the embodiments of this application. In some embodiments, the sorting condition includes a first condition and a second condition, wherein the first condition is a condition that triggers the initial candidate list sorting and the second condition is a condition that triggers the MPDIP template sorting.
[0233] In some embodiments, the first condition includes at least one of the following: the size of the current block is less than or equal to a third preset value, and the decoding unit to which the current block belongs is an intra-frame prediction unit; the size of the current block is less than or equal to a fourth preset value, and the decoding unit to which the current block belongs is an inter-frame prediction unit; the number of candidate modes in the initial candidate list is greater than or equal to a first quantity threshold.
[0234] In some embodiments, the second condition includes at least one of the following: the reference pixels of the template region of the current block have been reconstructed; the current block meets the MPDIP intra-prediction initiation condition, and the initial candidate list includes a preset intra-prediction mode.
[0235] In some embodiments, the reference pixels of the template region of the current block include the upper reference row pixels of the template region and the left reference column pixels of the template region, and the number of upper reference pixel rows and the number of left reference pixel columns of the template region are related to the size of the current block.
[0236] In other embodiments, the number of upper reference pixel rows in the template region can also be a default value, and the number of left reference pixel columns in the template region can also be a default value. For example, the default value can be 1 or 2.
[0237] It should be noted that when performing the second condition judgment, the width of the upper reference pixel of the template area is the same as the width w of the current block, and the height of the left reference pixel of the template area is the same as the height h of the current block.
[0238] In some embodiments, sorting the candidate modes in the initial candidate list includes: if the current candidate mode in the initial candidate list is a preset intra-frame prediction mode, the current candidate mode is replaced with the corresponding MPDIP mode; template prediction is performed based on the MPDIP mode corresponding to the current candidate mode and the reference pixels of the template region of the current block to determine the predicted value of the template region of the current block; if the current candidate mode in the initial candidate list is not a preset intra-frame prediction mode, template prediction is performed based on the current candidate mode and the reference pixels of the template region of the current block to determine the predicted value of the template region of the current block; the cost value of the candidate modes in the initial candidate list is determined based on the predicted value and the reconstructed value of the template region of the current block; and the candidate modes in the initial candidate list are sorted based on their cost values.
[0239] In some embodiments, the reference pixels of the upper template region of the current block include pixels in one or more of the following regions after the current block is offset upwards by N rows: the upper adjacent region, the upper right adjacent region, the upper left adjacent region, the left adjacent region, and the lower left adjacent region, where N is a positive integer. For example, N can be 1, N can be 2, or other positive integers, and the value of N can also be related to the size of the current block.
[0240] In some embodiments, during template prediction, the upper reference pixel width and the left reference pixel height of the template region are related to the size of the current block. For example, the upper reference pixel width of the template region is determined based on the width of the current block, and the left reference pixel height of the template region is determined based on the height of the current block.
[0241] In some embodiments, when performing template prediction, the width of the upper reference pixel of the template region is the same as the width w of the current block, and the height of the left reference pixel of the template region is the same as the height h of the current block.
[0242] In some embodiments, when performing template prediction, the number of upper reference pixel rows and the number of left reference pixel columns of the template region are related to the size of the current block.
[0243] S1003: Based on the sorted candidate patterns, construct the first candidate list for the current block;
[0244] In some embodiments, a plurality of sorted candidate patterns are added to a first part of a first candidate list; one or more second candidate patterns are obtained based on the sorted first candidate patterns and one or more offset values; and one or more second candidate patterns are added to a second part of the first candidate list, with the first part preceding the second part.
[0245] In some embodiments, adding one or more second candidate modes to the second part of the first candidate list may include: if the MPDIP intra-prediction initiation conditions are met in the current block, converting the second candidate mode into the most recent preset intra-prediction mode and adding it to the second part of the first candidate list; if the MPDIP intra-prediction initiation conditions are not met in the current block, adding the second candidate mode to the second part of the first candidate list. The second candidate mode is rounded to the most recent preset intra-prediction mode, adding more accurate candidate modes to the second part to match the prediction requirements of the current block. The specific conversion method can refer to the conversion method of the initial candidate mode, and will not be elaborated here.
[0246] In some embodiments, the method further includes: if the total number of candidate patterns in the first part and the second part of the first candidate list is less than a second number threshold, adding a default candidate pattern to the first candidate list based on a first order.
[0247] In some embodiments, the preset intra-prediction modes in the second part of the first candidate list precede the non-preset intra-prediction modes. During the construction of the second part, if the current block meets the MPDIP intra-prediction initiation conditions, the preset intra-prediction mode corresponding to the MPDIP mode is added to the beginning of the second part, and the non-preset intra-prediction modes are added to the end of the second part. If the intra-prediction mode of the current frame is located in the second part, this list construction method can reduce the codewords of the index values.
[0248] In some embodiments, the method further includes: adding other candidate patterns to a third part of a first candidate list based on a second order, wherein the other candidate patterns are candidate patterns other than those in the first and second parts of the first candidate list, and the third part is located after the second part.
[0249] In some embodiments, the preset intra-prediction mode in the third part of the first candidate list precedes the non-preset intra-prediction mode.
[0250] S1004: Based on the first candidate list, determine the intra-prediction mode index value of the current block;
[0251] In some embodiments, the predicted value of the current block is determined by using the candidate modes of the first candidate list and the reference pixels of the current block; the candidate modes are encoded based on the predicted values of the current block corresponding to multiple candidate modes to determine the intra-frame prediction mode index value of the current block.
[0252] In some embodiments, when predicting the current block, the width of the upper reference pixel and the height of the left reference pixel of the current block are related to the size of the current block. For example, the width of the upper reference pixel of the current block is determined based on the width of the current block, and the height of the left reference pixel of the current block is determined based on the height of the current block.
[0253] In some embodiments, when predicting the current block, the width of the upper reference pixel of the current block is the same as the width w of the current block, and the height of the left reference pixel of the current block is the same as the height h of the current block.
[0254] In some embodiments, when predicting the current block, the number of upper reference pixel rows and the number of left reference pixel columns in the template region are related to the size of the current block.
[0255] S1005: Encode the intra-prediction mode index value of the current block and write the resulting encoded bits into the bitstream.
[0256] In some embodiments, the method includes: determining the value of a relevant syntax element of the current block based on the intra-prediction mode index value of the current block; encoding the value of the relevant syntax element of the current block and writing the obtained encoded bits into the bitstream; when the value of the relevant syntax element of the current block indicates that the intra-prediction mode of the current block is located in the fourth part of the first candidate list, encoding the first index value of the intra-prediction mode of the current block and writing the obtained encoded bits into the bitstream; when the value of the relevant syntax element of the current block indicates that the intra-prediction mode of the current block is located in the fifth part of the first candidate list, encoding the second index value of the intra-prediction mode of the current block and writing the obtained encoded bits into the bitstream.
[0257] In some embodiments, the method further includes: encoding the third index value of the intra-prediction mode of the current block when the value of the relevant syntax element of the current block indicates that the intra-prediction mode of the current block is located in the sixth part of the first candidate list, and writing the obtained encoded bits into the bitstream.
[0258] It is understandable that the index range of the first index value is the fourth part of the first candidate list, the index range of the second index value is the fifth part of the first candidate list, and the index range of the third index value is the sixth part of the first candidate list.
[0259] In some embodiments, the relevant syntax elements of the current block include a first syntax element and a second syntax element. The value of the first syntax element is used to indicate whether the intra-prediction mode of the current block is located in the fourth and fifth parts of the first candidate list, and the value of the second syntax element is used to indicate whether the intra-prediction mode of the current block is located in the fourth part of the first candidate list.
[0260] The method further includes: encoding the first syntax element of the current block and writing the obtained encoded bits into the bitstream; when the value of the first syntax element is a fifth preset value, encoding the second syntax element of the current block and writing the obtained encoded bits into the bitstream.
[0261] Based on the above embodiments, the method for sorting the PMPM list will be further illustrated with examples.
[0262] To improve ECM encoding and decoding efficiency, this application provides a novel candidate list sorting method, applicable to both the decoder and encoder, which may specifically include:
[0263] 1. Obtain the initial PMPM list (corresponding to the initial candidate list) based on the existing ECM codec PMPM list construction method;
[0264] 2. Determine whether the current CU meets the sorting conditions of the PMPM list. If it meets the sorting conditions, proceed to operation 3; otherwise, proceed to operation 6.
[0265] 3. Determine whether the current CU meets the MPDIP template sorting conditions and whether the candidate mode is one of the MPDIP modes supported by the current CU size. If it meets the conditions, proceed to operation 4; otherwise, proceed to operation 5.
[0266] 4. MPDIP intra-frame prediction can be used for candidate modes. The SAD cost of the upper template region of the current CU is calculated using the reference pixels of the upper template as shown in Figure 8, and the SAD cost of the left template region of the current CU is calculated using the reference pixels of the left template as shown in Figure 9.
[0267] a) In Figure 8, the block enclosed by the thick solid line represents the current CU, its upper template, and its reference pixels. In Figure 9, the block enclosed by the thick solid line represents the current CU, its left template, and its reference pixels. Assume the current CU has a width of w and a height of h, with the origin at the top-left corner (x, y). In the current ECM encoding / decoding framework, the template width for the PMPM list sorting is 1. That is, the upper template is the reconstructed pixel of the upper reference row of the current CU, with a width equal to the width w of the current CU and a height of 1. The top-left corner of the upper template is at (x, y-1). The left template is the reconstructed pixel of the left reference column of the current CU to be encoded, with a width of 1 and a height equal to the height h of the current CU. The top-left corner of the left template is at (x-1, y).
[0268] b) The size of the current CU block is used to determine the left reference pixel of column numMRLLeft and the top reference pixel of row numMRLTop. Specifically, in Figure 8, the diagonally filled area represents the reference pixels of the upper template area, and in Figure 9, the diagonally filled area represents the reference pixels of the left template area. Specifically: Assuming that the number of reference rows and reference columns corresponding to the current CU is 2, then in Figure 8, the top left corner position of the top reference row pixel of the upper template is (x, y-1-2), its width is the width w of the current CU (the width of the short reference pixel is w, and the width of the long reference pixel is 2w), and its height is 2; the top left corner position of the left reference column pixel of the upper template is (x-2, y-1), its height is the height h of the current CU (the height of the short reference pixel is h, and the height of the long reference pixel is 2h), and its width is 2. The upper template also includes the top left reference pixel, whose top left corner position is (x-2, y-1-2). The top-left corner of the upper reference row pixels of the left template is located at (x-1, y-2), its width is the current CU width w (short reference pixel width is w, long reference pixel width is 2w), and its height is 2. The top-left corner of the left reference column pixels of the left template is located at (x-1-2, y), its height is the current CU height h (short reference pixel height is h, long reference pixel height is 2h), and its width is 2. The left template also includes the top-left reference pixel, whose top-left corner is located at (x-1-2, y-2). It should be noted that the short or long reference pixel width and height can be determined based on the current CU size. If a long reference pixel width and a long long reference pixel height are used, if the pixels in the lower left or upper right region are not fully reconstructed, the last reconstructed pixel in the corresponding row or column can be used to pad the unreconstructed pixels.
[0269] c) After obtaining the upper template reference pixel and the left template reference pixel of the current CU block, the predicted pixel value Pred of the current upper template region and the left template region is calculated using the reference pixel and the preset matrix vector corresponding to the current candidate mode.
[0270] d) Finally, the SAD cost corresponding to the current candidate mode is calculated using the pixel reconstruction values Recon and Pred of the upper and left template regions. for(int i = 0; i <w;++i) for(int j=0;j<h;++j) cost+=abs(pred[i][j]-Recon[i][j])
[0271] Where w is the width of the predicted block Pred and the reconstructed block Recon in the template region, and h is the height of the predicted block Pred and the reconstructed block Recon in the template region. The specific calculation method for abs(*) is as follows:
[0272] 5. Otherwise, the existing ECM method shown in Figures 3 and 4 will still be used to calculate the SAD cost of the template region;
[0273] 6. Sort the candidate patterns according to the template region SAD cost to obtain the constructed PMPM list (corresponding to the first part of the first candidate list);
[0274] 7. Use the candidate patterns of the PMPM list to construct the SMPM list (corresponding to the second part of the first candidate list). For example, using the existing ECM method, use the candidate patterns of the PMPM list to construct the SMPM list until the number of candidate patterns in the MPM list reaches 22.
[0275] 8. Construct a Non-MPM list (corresponding to the third part of the first candidate list) using other candidate modes outside the MPM list. Specifically, iterate through intra-prediction modes 0-66 in sequence and add candidate modes that do not exist in the MPM list to the Non-MPM list.
[0276] The conditions for sorting the MPDIP template in operation 3 may specifically include:
[0277] 1) The current CU's template type attribute is Left_Above_Templete (both the left and top templates exist simultaneously);
[0278] 2) The upper reference pixel and left reference pixel of the same size block offset one row upwards in the current CU (the block enclosed by the thick dashed line in Figure 8) exist and have been reconstructed;
[0279] 3) The upper reference pixel and left reference pixel of the same size block offset one column to the left of the current CU (the block enclosed by the thick dashed line in Figure 9) exist and have also been reconstructed;
[0280] 4) The current block size of the CU is the block size supported by MPDIP mode (i.e., the current CU meets the MPDIP intra-frame prediction conditions).
[0281] When conditions 1) to 4) are met simultaneously, the condition for sorting the MPDIP template of the current CU is true; otherwise, it is false.
[0282] It should be noted that the first candidate pattern in the initial PMPM list is the Planar pattern. If the PMPM list is sorted by template, the Planar pattern may not be included in the sorting. That is, the position of the Planar pattern is fixed, and the Planar pattern may not be included in the sorting.
[0283] This application provides a novel candidate list sorting method. In existing ECM codecs, when constructing the MPM list of the current CU codec block, candidate PMPM lists for the current CU are sequentially obtained from adjacent blocks of the CU to be encoded, the DIMD mode of the current CU, and non-adjacent blocks. If the current CU codec block satisfies the PMPM list sorting conditions and the current CU satisfies the MPDIP template sorting conditions, MPDIP intra-frame prediction is performed on the template region based on the upper and left templates of the current CU, calculating a more accurate SAD cosine of the template region corresponding to the MPDIP mode. For traditional angle prediction modes, the existing ECM template calculation method is still used. Finally, the candidate modes of the PMPM list are still sorted according to the SAD cost of the template region, thereby obtaining a more accurate PMPM list, reducing the codewords of the current CU prediction mode, and further improving the coding efficiency of ECM.
[0284] To further improve the efficiency of ECM encoding and decoding, this application provides a new method for constructing a candidate list. This method is applied to both the decoder and the encoder, and specifically may include:
[0285] 1. Based on the existing PMPM list construction method in ECM, construct the PMPM candidate mode of the current block to be encoded and decoded by using the prediction mode of adjacent spatial domains, the DIMD mode of the current block, and the prediction mode of non-adjacent blocks.
[0286] 2. Determine whether the current CU meets the MPDIP intra-prediction conditions. The specific conditions are: the current CU is within the block size supported by MPDIP; and the upper reference row pixels and left column reference pixels of the current CU to be encoded / decoded have all been reconstructed. These conditions are the same as the MPDIP intra-prediction start conditions mentioned above.
[0287] 3. If the current CU meets the MPDIP intra-prediction start condition, the initial candidate mode will be rounded to its nearest preset intra-prediction mode based on the size of the current CU block. These modes can be replaced with MPDIP modes for MPDIP intra-prediction of the current CU. If the converted prediction mode is not added to the PMPM list, it will be added to the PMPM list; otherwise, it will be determined whether the initial candidate mode can be added to the PMPM list. If the initial candidate mode is not added to the PMPM list, it will be added to the PMPM list. The specific execution process is as follows:
[0288] a) Assume the initial candidate mode is predMode, and its nearest preset 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, skip it; otherwise, add the mode to the MPM list.
[0289] b) If the width and height of the current CU block are both less than or equal to 16, then the nearest preset intra-prediction mode, predPDPMode, is calculated as follows:
[0290] ik = ((predMode-2)+1)>>1, predPDPMode = 2×k+2. If the prediction mode is not added to the list, add the prediction mode to the MPM list; otherwise, continue to step ii;
[0291] 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, search for -1, then search for +1. Specifically: if k is greater than 0, first check if predPDPMode = 2 × (k - 1) + 2. Check if this mode is greater than or equal to 0 and less than 67. If the mode meets these conditions and has not been added to the MPM list, then add the mode to the MPM list. If the most recent MPDIP mode is still not found, set the offset to 1 and continue to check if it can be added to the MPM list in the same way as if the offset were -1. If it can, add the predicted mode to the MPM list; otherwise, if it has already been added, or if predPDPMode is less than 0 or greater than 66, ...
[0292] iii. Otherwise, determine whether the initial forecast pattern can be added to the PMPM list. If the initial forecast pattern is not added to the PMPM list, then add the initial forecast pattern to the PMPM list.
[0293] c) Otherwise, the nearest preset intra-prediction mode, predPDPMode, is calculated using the following method:
[0294] ik = ((predMode-2)+3) >> 2, predPDPMode = 4×k+2. If the prediction mode is not added to the list, add it to the MPM list; otherwise, continue to step ii;
[0295] ii. If the most recent predPDPMode was not added to the MPM list in step i, then a search will be performed within the range of ±1 for the offset of k. First, search for -1, then search for +1. Specifically: if k is greater than 0, first check if predPDPMode = 4 × (k - 1) + 2. Check if this mode is greater than or equal to 0 and less than 67. If the mode meets the above conditions and has not been added to the MPM list, then add the mode to the MPM list. If the most recent MPDIP mode is still not found, set the offset to 1 and continue to check if it can be added to the MPM list in the same way as if the offset were -1. If it can, then add the predicted mode to the MPM list.
[0296] iii. Otherwise, determine whether the initial forecast pattern can be added to the PMPM list. If the initial forecast pattern is not added to the PMPM list, then add the initial forecast pattern to the PMPM list.
[0297] 4. After constructing the PMPM list, the PMPM list is updated based on whether the existing ECM PMPM list is template-sorted. For example, the SAD cost of the template region of the current block is calculated using the existing ECM template calculation method. Alternatively, if the candidate list sorting method provided in this application meets the MPDIP template sorting condition for the current block, MPDIP prediction is performed on the template region based on the reference pixels of the current block's template region, and the SAD cost of the template region is calculated.
[0298] 5. After constructing the PMPM list, the SMPM is built based on the prediction modes in the PMPM list with a fixed offset (currently offsets 1, 2, 3, 4). If the number of candidate modes in the SMPM is still less than 16, some default candidate modes will be added to the SMPM until the number of candidate modes in the SMPM reaches 16. For example, when the current CU meets the MPDIP intra-prediction start condition, the preset intra-prediction mode is placed before the non-preset intra-prediction modes, or the non-preset intra-prediction mode is converted into the most recent preset intra-prediction mode and added to the SMPM. For example, after adding predPDPMode, the initial predMode is discarded, or the initial predMode is added to the PMPM list, or the initial predMode is stored in the candidate list and added to the SMPM.
[0299] 6. After completing the construction of the MPM list, add the prediction modes that were not added to the MPM list from the 0-66 intra-frame prediction modes to the Non-MPM list in sequence.
[0300] This application provides a new method for constructing a candidate list. Based on the existing PMPM list construction method, when the current CU meets the MPDIP intra-prediction start condition, the obtained intra-prediction mode is rounded to the nearest preset intra-prediction mode. If the converted mode is not added to the PMPM list, it will be added to the PMPM list, thereby allowing more accurate angle prediction modes to be added to this type of CU block. Otherwise, it will determine whether the currently integrated initial candidate mode has been added to the PMPM list. If it has not been added to the PMPM list, the initial candidate mode will be added to the PMPM list.
[0301] It should be noted that since the current intra-frame prediction modes of ECM include TIMD mode and PMPM, which also perform template sorting on candidate traditional intra-frame angle prediction modes during list construction, this scheme can also be applied to intra-frame angle prediction modes such as TIMD, PMPM, and SGPM.
[0302] Furthermore, based on the first candidate list of the embodiments of this application, the encoding and decoding method of the current block is further illustrated with examples.
[0303] coding:
[0304] a) First, determine the index value of the current CU's intra-prediction mode in the MPM list. Check if the current CU's intra-prediction mode is in the MPM list (corresponding to the fourth and fifth parts of the first candidate list). If it is, encode `mpmFlag` (corresponding to the first syntax element) as `true`. Next, check if the intra-prediction mode is in the PMPM list (i.e., the fourth part of the first candidate list). If it is, further encode `firstMPMFlag` (corresponding to the second syntax element) as `true`. Determine which prediction mode in Table 3 corresponds to the current block's intra-encoding / decoding mode, and then represent the mode using the corresponding bins. For example, if the current block's intra-encoding / decoding mode is a mode in the MPM list, then `mpmFlag` is 1. If the mode is also in the PMPM list, `firstMPMFlag` is also 1, as shown in Table 3. If the mode corresponds to prediction mode 4 in Table 3, 11110 will be used to encode this prediction mode.
[0305] Table 3
[0306] If the prediction pattern is not in the PMPM list but is in the SMPM list (corresponding to the fifth part of the first candidate list), then firstMPMFlag needs to be encoded as false and secondMPMFlag needs to be encoded as true. Then, the corresponding prediction pattern 0-15 is encoded using the mapping relationship shown in Table 4.
[0307] Table 4
[0308] Among them, xx represents 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.
[0309] b) Secondly, if the intra-prediction mode is not in the MPM list, then it is in the Non-MPM list (corresponding to the fifth part of the first candidate list). In this case, MPMFlag needs to be encoded as false first, and then fixed-point coding should be used for the prediction mode.
[0310] decoding:
[0311] a) First, determine whether the current CU's intra-prediction mode is in the MPM list, i.e., decode MPMFlag. If MPMFlag is true, it means the current CU's intra-prediction mode is in the MPM list; otherwise, the current CU's intra-prediction mode is in the Non-MPM list. If MPMFlag is true, then determine whether the current CU's intra-prediction mode is in the PMPM list, i.e., decode firstMPMFlag. If firstMPMFlag is true, it means the current CU's prediction mode is in the PMPM list. Then, parse the bins corresponding to the prediction mode using the method shown in Table 5. For example, if the parsed bins are 11110, the corresponding prediction mode is 4. Finally, use the decoding method shown below to parse the current CU's prediction mode.
[0312] Table 5
[0313] Otherwise, if firstMPMFlag is false, it means that the prediction mode of the current CU is in the SMPM list. In this case, the prediction mode of the current CU is obtained by parsing as shown in Table 6, and finally the prediction mode is increased by 6 to become the prediction mode of the current CU.
[0314] Table 6
[0315] For example, if the Bin obtained from the analysis is 1001, the corresponding number is 4+1=5, which means that the current CU prediction mode is 4+6=10.
[0316] b) Otherwise, the intra-prediction mode is in the Non-MPM list. Fixed-point decoding is used to obtain the prediction mode of the current CU.
[0317] The following table demonstrates the encoding efficiency of attributes: Table 7 shows the specific performance of a new candidate list sorting method. Table 8 shows the specific performance of a new candidate list sorting method combined with a new candidate list construction method.
[0318] Table 7
[0319] Through this performance test, we can clearly see that the solution will achieve significant performance improvements for various sequences on the existing ECM14.0 version, with a coding efficiency of 0.05% on ClassE sequences and an average performance improvement of 0.04%.
[0320] Table 8
[0321] Combining the two approaches results in a further performance improvement, with a 0.1% performance increase on Class E and an average performance increase of 0.07%.
[0322] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, referring to FIG11, a schematic diagram of the composition structure of an encoder provided in an embodiment of this application is shown. As shown in FIG11, the encoder 110 may include a first determining unit 1101 and an encoding unit 1102; wherein,
[0323] The first determining unit 1101 is configured to construct the initial candidate list for the current block;
[0324] The first determining unit 1101 is further configured to sort the candidate patterns in the initial candidate list if the initial candidate list meets the preset sorting conditions; and to construct the first candidate list of the current block based on the sorted candidate patterns.
[0325] The first determining unit 1101 is further configured to determine the intra-prediction mode index value of the current block based on the first candidate list;
[0326] The encoding unit 1102 is configured to encode the intra-prediction mode index value of the current block and write the obtained encoded bits into the bit stream.
[0327] Understandably, each functional unit of the encoder also performs the encoding method of any of the foregoing embodiments.
[0328] 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.
[0329] If the integrated unit is implemented as a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, 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 of 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.
[0330] Therefore, embodiments of this application provide a computer-readable storage medium applied to an encoder 110, the computer-readable storage medium storing a computer program that, when executed by a first processor, implements the method of any of the foregoing embodiments.
[0331] This application provides a computer-readable storage medium that stores a bitstream generated by an encoding method such as described above.
[0332] Based on the composition of encoder 110 and the computer-readable storage medium, see Figure 12, which illustrates a specific hardware structure diagram of encoder 110 provided in this embodiment. As shown in Figure 12, encoder 110 may include: a first communication interface 1201, a first memory 1202, and a first processor 1203; the various components are coupled together through a first bus system 1204. It is understood that the first bus system 1204 is used to realize the connection and communication between these components. In addition to a data bus, the first bus system 1204 also includes a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as the first bus system 1204 in Figure 12.
[0333] The first communication interface 1201 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
[0334] The first memory 1202 is used to store computer programs that can run on the first processor 1203;
[0335] The first processor 1203 is used to execute the following when running computer programs:
[0336] Construct an initial candidate list for the current block;
[0337] If the initial candidate list meets the preset sorting conditions, sort the candidate patterns in the initial candidate list.
[0338] Based on the sorted candidate patterns, construct the first candidate list for the current block;
[0339] Based on the first candidate list, determine the intra-prediction mode index value of the current block;
[0340] The intra-prediction mode index value of the current block is encoded, and the resulting encoded bits are written into the bitstream.
[0341] It is understood that the first memory 1202 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 first memory 1202 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.
[0342] The first processor 1203 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 first processor 1203 or by instructions in software form. The first processor 1203 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 the first memory 1202. The first processor 1203 reads the information in the first memory 1202 and completes the steps of the above method in conjunction with its hardware.
[0343] 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 of this application, or combinations thereof. For software implementation, the technology of this application can be implemented through modules (e.g., procedures, functions, etc.) that perform the functions of 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.
[0344] Alternatively, as another embodiment, the first processor 1203 is also configured to execute any of the methods in the foregoing embodiments when running a computer program.
[0345] This embodiment provides an encoder in which...
[0346] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, referring to FIG13, a schematic diagram of the composition structure of a decoder 130 provided in an embodiment of this application is shown. As shown in FIG13, the decoder 130 may include: a second determining unit 1301 and a decoding unit 1302; wherein,
[0347] The second determining unit 1301 is configured to construct an initial candidate list for the current block;
[0348] The second determining unit 1301 is further configured to sort the candidate patterns in the initial candidate list if the initial candidate list meets the preset sorting conditions; and to construct the first candidate list of the current block based on the sorted candidate patterns.
[0349] Decoding unit 1302 is configured to decode the bitstream and determine the intra-prediction mode index value of the current block;
[0350] The second determining unit 1301 is further configured to determine the intra-prediction mode of the current block from the first candidate list based on the intra-prediction mode index value of the current block.
[0351] The second determining unit 1301 is configured to predict the current block based on the determined intra-frame prediction mode and determine the predicted value of the current block.
[0352] Understandably, each functional unit of the decoder also performs the decoding method of any of the aforementioned embodiments.
[0353] Based on the composition of the decoder 130 and the computer-readable storage medium, Figure 14 illustrates a schematic diagram of the specific hardware structure of the decoder 130 provided in this embodiment. As shown in Figure 14, the decoder 130 may include: a second communication interface 1401, a second memory 1402, and a second processor 1403; the various components are coupled together through a second bus system 1404. It is understood that the second bus system 1404 is used to realize the connection and communication between these components. In addition to a data bus, the second bus system 1404 also includes a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as the second bus system 1404 in Figure 14.
[0354] The second communication interface 1401 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
[0355] The second memory 1402 is used to store computer programs that can run on the second processor 1403;
[0356] The second processor 1403 is used to execute the following when running computer programs:
[0357] Construct an initial candidate list for the current block;
[0358] If the initial candidate list meets the preset sorting conditions, sort the candidate patterns in the initial candidate list.
[0359] Based on the sorted candidate patterns, construct the first candidate list for the current block;
[0360] Decode the bitstream and determine the intra-prediction mode index value of the current block;
[0361] Based on the intra prediction mode index value of the current block, determine the intra prediction mode of the current block from the first candidate list;
[0362] Based on the determined intra-frame prediction mode, the current block is predicted to determine the predicted value of the current block.
[0363] Alternatively, as another embodiment, the second processor 1403 is also configured to execute any of the methods in the foregoing embodiments when running a computer program.
[0364] It is understood that the second memory 1402 has similar hardware functions to the first memory 1202, and the second processor 1403 has similar hardware functions to the first processor 1203; these will not be described in detail here.
[0365] This embodiment provides a decoder, in which...
[0366] In another embodiment of this application, referring to FIG15, a schematic diagram of the composition structure of an encoding / decoding system provided in an embodiment of this application is shown. As shown in FIG15, the encoding / decoding system 150 may include an encoder 1501 and a decoder 1502.
[0367] In this embodiment, encoder 1501 can be any of the encoders in the foregoing embodiments, and decoder 1502 can be any of the decoders in the foregoing embodiments.
[0368] 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.
[0369] 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.
[0370] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined to obtain new method embodiments without conflict. The features disclosed in the several product embodiments provided in this application can be arbitrarily combined to obtain new product embodiments without conflict. The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined to obtain new method embodiments or device embodiments without conflict.
[0371] 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. Industrial applicability
[0372] This application provides an encoding / decoding method, encoder, decoder, and storage medium. At both the encoding and decoding ends, an initial candidate list for the current block is constructed. If the initial candidate list meets preset sorting conditions, the candidate modes in the initial candidate list are sorted. Based on the sorted candidate modes, a first candidate list for the current block is constructed. An intra-prediction mode for the current block is determined from the first candidate list. Based on the determined intra-prediction mode, the current block is predicted to determine its prediction value. Thus, by optimizing the candidate list construction method, a more accurate candidate list is constructed to match the prediction requirements of the current block for MPDIP prediction, thereby improving the encoding / decoding efficiency of ECM.
Claims
1. A decoding method applied to a decoder, the method comprising: Construct an initial candidate list for the current block; If the initial candidate list meets the preset sorting conditions, the candidate patterns in the initial candidate list are sorted. Based on the sorted candidate patterns, construct the first candidate list for the current block; Decode the bitstream and determine the intra-prediction mode index value of the current block; Based on the intra-prediction mode index value of the current block, the intra-prediction mode of the current block is determined from the first candidate list; The current block is predicted based on the determined intra-frame prediction mode to determine the predicted value of the current block.
2. The method according to claim 1, wherein, The initial candidate list includes one or more preset intra-prediction modes. When the preset intra-prediction mode is selected to perform intra-prediction on the current block or the template region of the current block, the preset intra-prediction mode is replaced by the matrix-based intra-angle prediction MPDIP mode.
3. The method according to claim 2, wherein, The initial candidate list for constructing the current block includes: Obtain the initial candidate pattern for the current block; If the current block meets the MPDIP intra-prediction initiation conditions, the initial candidate mode of the current block is converted into the corresponding preset intra-prediction mode and added to the initial candidate list.
4. The method according to claim 3, wherein, The step of converting the initial candidate mode into the preset intra-frame prediction mode includes: Based on the first conversion rule, the number value of the initial candidate pattern is converted into a first value, which is an integer obtained by rounding the conversion result. Based on the second conversion rule, the first value is converted into the number value of the preset intra-frame prediction mode; The first conversion rule and the second conversion rule are inverses of each other.
5. The method according to claim 4, wherein, The first conversion rule includes: If the number value of the initial candidate pattern is greater than or equal to the second value, calculate the difference between the number value of the initial candidate pattern and the second value; Calculate the sum of the determined difference and the third value; Calculate the quotient of the determined sum and the fourth value to obtain the first value; The second conversion rule includes: Calculate the product of the first value and the fourth value; The sum of the determined product and the second value is calculated to obtain the number value of the preset intra-frame prediction mode.
6. The method according to claim 5, wherein, The first transformation rule and the second transformation rule are related to the size of the current block.
7. The method according to claim 4, wherein, The method further includes: Based on the second conversion rule, the first value is converted into the number value of the preset intra-frame prediction mode after adding the offset value.
8. The method according to claim 3, wherein, It also includes at least one of the following: If the current block does not meet the MPDIP intra-frame prediction initiation conditions, the initial candidate mode is added to the initial candidate list; If the preset intra-frame prediction mode corresponding to the initial candidate mode has been added to the initial candidate list, the initial candidate mode is added to the initial candidate list. If the preset intra-frame prediction mode corresponding to the initial candidate mode has been added to the initial candidate list, the initial candidate mode is added to the end of the initial candidate list.
9. The method according to any one of claims 1 to 8, wherein, The sorting conditions include a first condition and a second condition. The first condition is the condition that triggers the initial candidate list sorting, and the second condition is the condition that triggers the MPDIP template sorting.
10. The method according to claim 9, wherein, The first condition includes at least one of the following: The size of the current block is less than or equal to a third preset value, and the decoding unit to which the current block belongs is an intra-frame prediction unit; The size of the current block is less than or equal to the fourth preset value, and the decoding unit to which the current block belongs is an inter-frame prediction unit; The number of candidate patterns in the initial candidate list is greater than or equal to the first quantity threshold.
11. The method according to claim 9, wherein, The second condition includes at least one of the following: The reference pixels of the template region of the current block have been reconstructed; The current block meets the MPDIP intra-prediction start condition, and the initial candidate list includes a preset intra-prediction mode.
12. The method according to claim 11, wherein, The reference pixels of the template region of the current block include the upper reference row pixels of the template region and the left reference column pixels of the template region; The number of upper reference pixel rows and the number of left reference pixel columns in the template region are related to the size of the current block.
13. The method according to claim 3 or 11, wherein, The MPDIP intra-frame prediction initiation condition includes at least one of the following: The template type of the current block is the first template type; The width of the current block is less than or equal to a first preset value and the height of the current block is less than or equal to a second preset value, and the initial candidate mode belongs to a first intra-frame prediction mode, and the preset intra-frame prediction mode includes the first intra-frame prediction mode. If the width of the current block is greater than the first preset value or the height of the current block is greater than the second preset value, and the initial candidate mode belongs to the second intra-frame prediction mode, the preset intra-frame prediction mode includes the second intra-frame prediction mode. The reference pixels of the current block have been reconstructed.
14. The method according to claim 13, wherein, The reference pixels of the current block include the upper reference row pixels of the current block and the left reference column pixels of the current block; The number of upper reference pixel rows and the number of left reference pixel columns of the current block are related to the size of the current block.
15. The method according to any one of claims 1 to 14, wherein, The step of sorting the candidate patterns in the initial candidate list includes: If the current candidate mode in the initial candidate list is a preset intra-frame prediction mode, the current candidate mode is replaced with the corresponding MPDIP mode. Based on the MPDIP mode corresponding to the current candidate mode and the reference pixels of the template region of the current block, template prediction is performed to determine the predicted value of the template region of the current block. If the current candidate mode in the initial candidate list is not the preset intra-frame prediction mode, template prediction is performed based on the current candidate mode and the reference pixels of the template region of the current block to determine the predicted value of the template region of the current block. Based on the predicted value and its reconstructed value of the template region of the current block, the cost of the candidate patterns in the initial candidate list is determined; The candidate patterns are sorted based on their cost values in the initial candidate list.
16. The method according to claim 15, wherein, The MPDIP mode corresponding to the current candidate mode is determined based on the size of the current block and the current candidate mode.
17. The method according to claim 15, wherein, The reference pixels of the template region of the current block include the upper reference row pixels of the template region and the left reference column pixels of the template region; When performing template prediction, the upper reference pixel width and the left reference pixel height of the template region are related to the size of the current block.
18. The method according to any one of claims 15 to 17, wherein, The reference pixels of the upper template region of the current block include pixels in one or more of the following regions after the current block is offset upwards by N rows: the upper adjacent region, the upper right adjacent region, the upper left adjacent region, the left adjacent region, and the lower left adjacent region, where N is a positive integer; The reference pixels of the left template region of the current block include pixels in one or more of the following regions after the current block is offset to the left by M columns: the upper adjacent region, the upper right adjacent region, the upper left adjacent region, the left adjacent region, and the lower left adjacent region, where M is a positive integer.
19. The method according to any one of claims 1 to 18, wherein, The construction of the first candidate list for the current block based on multiple sorted candidate patterns includes: Add the sorted candidate patterns to the first part of the first candidate list; Based on the sorted first candidate pattern and one or more offset values, one or more second candidate patterns are obtained; Add the one or more second candidate patterns to the second part of the first candidate list, the first part preceding the second part.
20. The method according to claim 19, wherein, The second part of adding the one or more second candidate patterns to the first candidate list includes: If the current block satisfies the MPDIP intra-prediction initiation condition, the second candidate mode is converted into the most recent preset intra-prediction mode and added to the second part of the first candidate list; If the current block does not meet the MPDIP intra-frame prediction initiation conditions, the second candidate mode is added to the second part of the first candidate list.
21. The method according to claim 19 or 20, wherein, The method further includes: If the total number of candidate patterns in the first part and the second part of the first candidate list is less than the second number threshold, the default candidate pattern is added to the first candidate list based on the first order.
22. The method according to claim 19, wherein, In the second part of the first candidate list, the preset intra-prediction mode is placed before the non-preset intra-prediction mode.
23. The method according to any one of claims 19 to 22, wherein, The method further includes: Other candidate patterns are added to the third part of the first candidate list based on a second order. These other candidate patterns are candidate patterns other than those in the first and second parts of the first candidate list. The third part is located after the second part.
24. The method according to claim 23, wherein, In the third part of the first candidate list, the preset intra-prediction mode is placed before the non-preset intra-prediction mode.
25. The method according to claims 1 to 24, wherein, The decoded bitstream determines the intra-prediction mode index value of the current block, including: If the value of the relevant syntax element of the current block indicates that the intra-prediction mode of the current block is located in the fourth part of the first candidate list, the bitstream is decoded to determine the first index value of the intra-prediction mode of the current block. If the value of the relevant syntax element of the current block indicates that the intra-prediction mode of the current block is located in the fifth part of the first candidate list, the bitstream is decoded to determine the second index value of the intra-prediction mode of the current block.
26. The method of claim 25, wherein, The method further includes: If the value of the relevant syntax element of the current block indicates that the intra-prediction mode of the current block is located in the sixth part of the first candidate list, the bitstream is decoded to determine the third index value of the intra-prediction mode of the current block.
27. The method according to claim 26, wherein, The relevant syntax elements of the current block include a first syntax element and a second syntax element; The method further includes: Decode the bitstream to determine the first syntax element of the current block; The value of the first syntax element is a fifth preset value. The bitstream is decoded to determine the second syntax element of the current block. When the value of the second syntax element is the fifth preset value, it is determined that the intra-prediction mode of the current block is located in the fourth part of the first candidate list; When the value of the second syntax element is the sixth preset value, it is determined that the intra-prediction mode of the current block is located in the fifth part of the first candidate list; When the value of the first syntax element is the sixth preset value, it is determined that the intra-prediction mode of the current block is located in the sixth part of the first candidate list.
28. An encoding method applied to an encoder, the method comprising: Construct an initial candidate list for the current block; If the initial candidate list meets the preset sorting conditions, the candidate patterns in the initial candidate list are sorted. Based on the sorted candidate patterns, construct the first candidate list for the current block; Based on the first candidate list, determine the intra-prediction mode index value of the current block; The intra-prediction mode index value of the current block is encoded, and the resulting encoded bits are written into the bitstream.
29. The method according to claim 28, wherein, The initial candidate list includes one or more preset intra-prediction modes. When the preset intra-prediction mode is selected to perform intra-prediction on the current block or the template region of the current block, the preset intra-prediction mode is replaced by the matrix-based intra-angle prediction MPDIP mode.
30. The method according to claim 29, wherein, The initial candidate list for constructing the current block includes: Obtain the initial candidate pattern for the current block; If the current block meets the MPDIP intra-prediction initiation conditions, the initial candidate mode of the current block is converted into the corresponding preset intra-prediction mode and added to the initial candidate list.
31. The method according to claim 30, wherein, The step of converting the initial candidate mode into the preset intra-frame prediction mode includes: Based on the first conversion rule, the number value of the initial candidate pattern is converted into a first value, which is an integer obtained by rounding the conversion result. Based on the second conversion rule, the first value is converted into the number value of the preset intra-frame prediction mode; The first conversion rule and the second conversion rule are inverses of each other.
32. The method according to claim 31, wherein, The first conversion rule includes: If the number value of the initial candidate pattern is greater than or equal to the second value, calculate the difference between the number value of the initial candidate pattern and the second value; Calculate the sum of the determined difference and the third value; Calculate the quotient of the determined sum and the fourth value to obtain the first value; The second conversion rule includes: Calculate the product of the first value and the fourth value; The sum of the determined product and the second value is calculated to obtain the number value of the preset intra-frame prediction mode.
33. The method according to claim 32, wherein, The first transformation rule and the second transformation rule are related to the size of the current block.
34. The method according to claim 31, wherein, The method further includes: Based on the second conversion rule, the first value is converted into the number value of the preset intra-frame prediction mode after adding the offset value.
35. The method according to claim 30, wherein, It also includes at least one of the following: If the current block does not meet the MPDIP intra-frame prediction initiation conditions, the initial candidate mode is added to the initial candidate list. If the preset intra-frame prediction mode corresponding to the initial candidate mode has been added to the initial candidate list, the initial candidate mode is added to the initial candidate list. If the preset intra-frame prediction mode corresponding to the initial candidate mode has been added to the initial candidate list, the initial candidate mode is added to the end of the initial candidate list.
36. The method according to any one of claims 28 to 35, wherein, The sorting conditions include a first condition and a second condition. The first condition is the condition that triggers the initial candidate list sorting, and the second condition is the condition that triggers the MPDIP template sorting.
37. The method according to claim 36, wherein, The first condition includes at least one of the following: The size of the current block is less than or equal to a third preset value, and the decoding unit to which the current block belongs is an intra-frame prediction unit; The size of the current block is less than or equal to the fourth preset value, and the decoding unit to which the current block belongs is an inter-frame prediction unit; The number of candidate patterns in the initial candidate list is greater than or equal to the first quantity threshold.
38. The method according to claim 36, wherein, The second condition includes at least one of the following: The reference pixels of the template region of the current block have been reconstructed; The current block meets the MPDIP intra-prediction start condition, and the initial candidate list includes a preset intra-prediction mode.
39. The method according to claim 38, wherein, The reference pixels of the template region of the current block include the upper reference row pixels of the template region and the left reference column pixels of the template region; The number of upper reference pixel rows and the number of left reference pixel columns in the template region are related to the size of the current block.
40. The method according to claim 30 or 38, wherein, The MPDIP intra-frame prediction initiation condition includes at least one of the following: The template type of the current block is the first template type; The width of the current block is less than or equal to a first preset value and the height of the current block is less than or equal to a second preset value, and the initial candidate mode belongs to a first intra-frame prediction mode, and the preset intra-frame prediction mode includes the first intra-frame prediction mode. If the width of the current block is greater than the first preset value or the height of the current block is greater than the second preset value, and the initial candidate mode belongs to the second intra-frame prediction mode, the preset intra-frame prediction mode includes the second intra-frame prediction mode. The reference pixels of the current block have been reconstructed.
41. The method according to claim 40, wherein, The reference pixels of the current block include the upper reference row pixels of the current block and the left reference column pixels of the current block; The number of upper reference pixel rows and the number of left reference pixel columns of the current block are related to the size of the current block.
42. The method according to any one of claims 28 to 41, wherein, The step of sorting the candidate patterns in the initial candidate list to obtain the first candidate list of the current block includes: If the current candidate mode in the initial candidate list is a preset intra-frame prediction mode, the current candidate mode is replaced with the corresponding MPDIP mode. Based on the MPDIP mode corresponding to the current candidate mode and the reference pixels of the template region of the current block, template prediction is performed to determine the predicted value of the template region of the current block. If the current candidate mode in the initial candidate list is not the preset intra-frame prediction mode, template prediction is performed based on the current candidate mode and the reference pixels of the template region of the current block to determine the predicted value of the template region of the current block. The cost of determining candidate patterns in the initial candidate list based on the predicted and reconstructed values of the template region of the current block. value; The candidate patterns are sorted based on their cost values in the initial candidate list.
43. The method according to claim 42, wherein, The MPDIP mode corresponding to the current candidate mode is determined based on the size of the current block and the current candidate mode.
44. The method according to claim 42, wherein, The reference pixels of the template region of the current block include the upper reference row pixels of the template region and the left reference column pixels of the template region; When performing template prediction, the upper reference pixel width and the left reference pixel height of the template region are related to the size of the current block.
45. The method according to any one of claims 42 to 44, wherein, The reference pixels of the upper template region of the current block include pixels in one or more of the following regions after the current block is offset upwards by N rows: the upper adjacent region, the upper right adjacent region, the upper left adjacent region, the left adjacent region, and the lower left adjacent region, where N is a positive integer; The reference pixels of the left template region of the current block include pixels in one or more of the following regions after the current block is offset to the left by M columns: the upper adjacent region, the upper right adjacent region, the upper left adjacent region, the left adjacent region, and the lower left adjacent region, where M is a positive integer.
46. The method according to any one of claims 28 to 45, wherein, The construction of the first candidate list for the current block based on multiple sorted candidate patterns includes: Add the sorted candidate patterns to the first part of the first candidate list; Based on the sorted first candidate pattern and one or more offset values, one or more second candidate patterns are obtained; Add the one or more second candidate patterns to the second part of the first candidate list, the first part preceding the second part.
47. The method according to claim 46, wherein, The second part of adding the one or more second candidate patterns to the first candidate list includes: If the current block satisfies the MPDIP intra-prediction initiation condition, the second candidate mode is converted into the most recent preset intra-prediction mode and added to the second part of the first candidate list; If the current block does not meet the MPDIP intra-frame prediction initiation conditions, the second candidate mode is added to the second part of the first candidate list.
48. The method according to claim 46, wherein, The method further includes: If the total number of candidate patterns in the first part and the second part of the first candidate list is less than the second number threshold, the default candidate pattern is added to the first candidate list based on the first order.
49. The method according to claim 46, wherein, In the second part of the first candidate list, the preset intra-prediction mode is placed before the non-preset intra-prediction mode.
50. The method according to any one of claims 46 to 49, wherein, The method further includes: Other candidate patterns are added to the third part of the first candidate list based on a second order. These other candidate patterns are candidate patterns other than those in the first and second parts of the first candidate list. The third part is located after the second part.
51. The method according to claim 50, wherein, In the third part of the first candidate list, the preset intra-prediction mode is placed before the non-preset intra-prediction mode.
52. The method according to any one of claims 28 to 51, wherein, The method further includes: The values of the relevant syntax elements of the current block are determined based on the intra-prediction mode index value of the current block. The values of the relevant syntax elements of the current block are encoded, and the resulting encoded bits are written into the bitstream. When the value of the relevant syntax element of the current block indicates that the intra-prediction mode of the current block is located in the fourth part of the first candidate list, the first index value of the intra-prediction mode of the current block is encoded, and the resulting encoded bits are written into the bitstream. If the value of the relevant syntax element of the current block indicates that the intra-prediction mode of the current block is located in the fifth part of the first candidate list, the second index value of the intra-prediction mode of the current block is encoded, and the resulting encoded bits are written into the bitstream.
53. The method according to claim 52, wherein, The method further includes: If the value of the relevant syntax element of the current block indicates that the intra-prediction mode of the current block is located in the sixth part of the first candidate list, the third index value of the intra-prediction mode of the current block is encoded, and the resulting encoded bits are written into the bitstream.
54. The method according to claim 53, wherein, The relevant syntax elements of the current block include a first syntax element and a second syntax element. The value of the first syntax element is used to indicate whether the intra-prediction mode of the current block is located in the fourth and fifth parts of the first candidate list. The value of the second syntax element is used to indicate whether the intra-prediction mode of the current block is located in the fourth part of the first candidate list. The method further includes: The first syntax element of the current block is encoded, and the resulting encoded bits are written into the bitstream; When the value of the first syntax element is the fifth preset value, the second syntax element of the current block is encoded, and the resulting encoded bits are written into the bitstream.
55. An encoder, comprising a first determining unit and an encoding unit; wherein: The first determining unit is configured to construct an initial candidate list for the current block; The first determining unit is further configured to sort the candidate patterns in the initial candidate list if the initial candidate list satisfies a preset sorting condition; Based on the sorted candidate patterns, construct the first candidate list for the current block; The first determining unit is further configured to determine the intra-prediction mode index value of the current block based on the first candidate list; The encoding unit is configured to encode the intra-prediction mode index value of the current block and write the obtained encoded bits into the bitstream.
56. An encoder, comprising a first memory and a first processor; wherein: The first memory is used to store computer programs that can run on the first processor; The first processor is configured to perform the method as described in any one of claims 28 to 54 when running the computer program.
57. A decoder, comprising a second determining unit and a decoding unit; wherein: The second determining unit is configured to construct an initial candidate list for the current block; The second determining unit is further configured to sort the candidate patterns in the initial candidate list if the initial candidate list satisfies a preset sorting condition; Based on the sorted candidate patterns, construct the first candidate list for the current block; The decoding unit is configured to decode the bitstream and determine the intra-prediction mode index value of the current block; The second determining unit is further configured to determine the intra-prediction mode of the current block from the first candidate list based on the intra-prediction mode index value of the current block; The second determining unit is further configured to predict the current block based on the determined intra-frame prediction mode, and determine the predicted value of the current block.
58. A decoder, comprising a second memory and a second processor; wherein: The second memory is used to store computer programs that can run on the second processor; The second processor is configured to perform the method as described in any one of claims 1 to 27 when running the computer program.
59. A computer-readable storage medium, wherein, The computer-readable storage medium stores the bitstream generated by the encoding method as described in any one of claims 28 to 54.
60. A computer-readable storage medium, wherein, The computer-readable storage medium stores a computer program that, when executed, implements the method as described in any one of claims 1 to 27, or the method as described in any one of claims 28 to 54.
Citation Information
Patent Citations
HEVC (High Efficiency Video Coding) intra-frame prediction mode selection method and device
CN104954788A
Decision method and device for intra-frame prediction mode and video coding equipment
CN115834880A
Image decoding method, image encoding method, and method for transmitting bitstream
CN117395403A
Video encoding / decoding method and apparatus
CN117917073A
Intra-prediction mode-based image processing method, and device therefor
WO2019103542A1