Coding method, encoder, decoder, and storage medium
Patent Information
- Application Number
- CN202480083686.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-05
- Publication Date
- 2026-08-18
AI Technical Summary
The existing template-based intra-mode derivation (TIMD) technology has large deviations in selecting the optimal prediction mode in some scenarios, resulting in low prediction accuracy during video encoding.
On the encoding and decoding end, by determining the template of the current block, one or more plane intra prediction modes are added as candidate prediction modes, and the correlation between the template and the current block is used to adaptively select a more matching prediction mode to improve the prediction effect.
It improves the prediction accuracy and encoding and decoding efficiency of TIMD mode, and enhances the effect of video encoding.
Smart Images

Figure CN122603507A_ABST
Abstract
Description
Coding and decoding method, encoder, decoder and storage medium Technical Field
[0001] The present application relates to the field of video coding and decoding technology, and in particular to a coding and decoding method, an encoder, a decoder, and a storage medium. Background Art
[0002] The template-based intra mode derivation (TIMD) technology uses the reconstructed pixels of the L-shaped part adjacent to the current block as a template, calculates the prediction value of the template under different prediction modes, and obtains the template error value between the prediction value and the reconstructed value of the template under different prediction modes. The optimal prediction mode is selected according to the template error value to predict the current block.
[0003] However, in the actual encoding process, the optimal prediction mode selected by the TIMD technology has large deviations in some scenarios, resulting in low prediction accuracy of the current block.
[0004] Summary of the Invention
[0005] The present application provides a coding and decoding method, an encoder, a decoder, and a storage medium to improve the prediction effect of the TIMD mode, thereby improving the coding and decoding efficiency.
[0006] The technical solution of this application can be implemented as follows:
[0007] In a first aspect, an embodiment of the present application provides a decoding method, applied to a decoder, the method comprising:
[0008] Decode the code stream and determine the prediction parameters of the current block;
[0009] In a case where the prediction parameter indicates that a prediction value of the current block is determined using a template-based intra mode derivation mode, determining a prediction cost value of a candidate prediction mode based on the template of the current block, wherein the candidate prediction mode includes one or more planar intra prediction modes;
[0010] determining a target prediction mode for the current block according to the prediction cost values of the candidate prediction modes;
[0011] A prediction value of the current block is determined according to the target prediction mode.
[0012] In a second aspect, an embodiment of the present application provides an encoding method, applied to an encoder, the method comprising:
[0013] Determining prediction cost values of candidate prediction modes based on a template of a current block, wherein the candidate prediction modes include one or more planar intra prediction modes;
[0014] determining a target prediction mode for the current block according to the prediction cost values of the candidate prediction modes;
[0015] determining a prediction value of the current block according to the target prediction mode;
[0016] Making an encoding decision based on the prediction value of the current block to determine a prediction parameter of the current block, wherein the prediction parameter is used to indicate whether to use a template-based intra mode derivation mode to determine the prediction value of the current block;
[0017] The prediction parameters are encoded, and the obtained encoded bits are written into a bitstream.
[0018] In a third aspect, an embodiment of the present application provides an encoder, comprising a first prediction unit, a first determination unit, and an encoding unit; wherein:
[0019] The first prediction unit is configured to determine a prediction cost value of a candidate prediction mode based on a template of the current block, wherein the candidate prediction mode includes one or more planar intra prediction modes;
[0020] The first prediction unit is further configured to determine a target prediction mode for the current block according to the prediction cost value of the candidate prediction mode; and determine a prediction value for the current block according to the target prediction mode;
[0021] The first determining unit is configured to make an encoding decision according to the prediction value of the current block, and determine a prediction parameter of the current block, wherein the prediction parameter is used to indicate whether to use a template-based intra mode derivation mode to determine the prediction value of the current block;
[0022] The encoding unit is configured to encode the prediction parameters and write the obtained encoded bits into a bitstream.
[0023] In a fourth aspect, an embodiment of the present application provides an encoder, comprising a first memory and a first processor; wherein:
[0024] a first memory for storing a computer program capable of running on the first processor;
[0025] The first processor is configured to execute the method according to the second aspect when running a computer program.
[0026] In a fifth aspect, an embodiment of the present application provides a decoder, comprising a decoding unit and a second prediction unit; wherein:
[0027] The decoding unit is configured to decode the code stream and determine the prediction parameters of the current block;
[0028] The second prediction unit is configured to, when the prediction parameter indicates that a prediction value of the current block is determined using a template-based intra mode derivation mode, determine a prediction cost value of a candidate prediction mode based on the template of the current block, wherein the candidate prediction mode includes one or more planar intra prediction modes;
[0029] The second prediction unit is further configured to determine a target prediction mode of the current block according to the prediction cost value of the candidate prediction mode; and determine a prediction value of the current block according to the target prediction mode.
[0030] In a sixth aspect, an embodiment of the present application provides a decoder, including a second memory and a second processor; wherein:
[0031] a second memory for storing a computer program capable of running on the second processor;
[0032] The second processor is configured to execute the method according to the first aspect when running a computer program.
[0033] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a code stream generated by the encoding method as described.
[0034] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed, implements the method described in the first aspect or the method described in the second aspect.
[0035] The embodiments of the present application provide a coding and decoding method, an encoder, a decoder, and a storage medium. Whether at the coding end or the decoding end, when a template-based intra-frame mode derivation mode (TIMD mode) is used to determine the prediction value of the current block, a prediction cost value of a candidate prediction mode is determined based on the template of the current block, wherein the candidate prediction mode includes one or more plane intra-frame prediction modes; based on the prediction cost value of the candidate prediction mode, a target prediction mode of the current block is determined; based on the target prediction mode, a prediction value of the current block is determined. In this way, the correlation between the template and the current block is fully utilized, and one or more plane intra-frame prediction modes are added to the TIMD mode as candidate prediction modes, so that the TIMD mode can adaptively select a more matching prediction mode based on the template, thereby improving the prediction effect of the TIMD mode and thus improving the coding and decoding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] FIG1 is a block diagram of an encoder according to an embodiment of the present application;
[0037] FIG2 is a block diagram of a decoder according to an embodiment of the present application;
[0038] FIG3 is a schematic diagram of a network architecture of a coding and decoding system provided in an embodiment of the present application;
[0039] FIG4 is a schematic diagram of a prediction process of a TIMD mode provided in an embodiment of the present application;
[0040] FIG5 is a schematic diagram of a template position and a template reference area provided in an embodiment of the present application;
[0041] FIG6 is a schematic diagram of a reference pixel area in a TIMD mode according to an embodiment of the present application;
[0042] FIG7 is a schematic diagram of a flowchart of a decoding method provided in an embodiment of the present application;
[0043] FIG8 is a schematic diagram of adjacent block positions provided in an embodiment of the present application;
[0044] FIG9 is a schematic diagram of the positions of a current block and reference pixels provided by an embodiment of the present application;
[0045] FIG10 is a schematic diagram of a flow chart of an encoding method provided in an embodiment of the present application;
[0046] FIG11 is a schematic diagram of the structure of an encoder provided in an embodiment of the present application;
[0047] FIG12 is a schematic diagram of a specific hardware structure of an encoder provided in an embodiment of the present application;
[0048] FIG13 is a schematic diagram of the structure of a decoder provided in an embodiment of the present application;
[0049] FIG14 is a schematic diagram of a specific hardware structure of a decoder provided in an embodiment of the present application;
[0050] FIG15 is a schematic diagram of the composition structure of a coding and decoding system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below with reference to the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.
[0052] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0053] In the following description, reference is 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. It should also be noted that the terms "first, second, and third" in the embodiments of the present application are only used to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that "first, second, and third" may be interchanged in a specific order or sequential order where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0054] Before further explaining the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained first. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations:
[0055] Coding Block (CB);
[0056] Block Matching (BM);
[0057] Coding Unit (CU);
[0058] Block Vector (BV);
[0059] Motion Vector (MV);
[0060] Sum of Absolute Difference (SAD);
[0061] Sum of Absolute Transformed Difference (SATD);
[0062] Mean Square Error (MSE);
[0063] Sum of Squared Differences (SSD);
[0064] Mean Absolute Deviation (MAD);
[0065] Mean Square Differences (MSD);
[0066] Normalized Correlation Coefficient (NCC);
[0067] H.266 / Versatile Video Coding (VVC);
[0068] VVC Test Model (VTM), a reference software testing platform for VVC;
[0069] Template Matching (TM);
[0070] Intra Template Matching Prediction (Intra TMP);
[0071] Intra block copy (IBC);
[0072] Beyond VVC's reference software testing platform (Enhanced Compression Model, ECM);
[0073] Template based Intra Mode Derivation (TIMD).
[0074] It can be understood that in a video image, a first color component, a second color component, and a third color component are generally used to represent a coding block. These three color components are a luminance component, a blue chrominance component, and a red chrominance component. Specifically, the luminance component is usually represented by the symbol Y, the blue chrominance component is usually represented by the symbol Cb or U, and the red chrominance component is usually represented by the symbol Cr or V. Thus, a video image can be represented in either the YCbCr format or the YUV format.
[0075] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0076] Referring to Figure 1, which shows a schematic block diagram of the composition of an encoder provided in an embodiment of the present application. As shown in Figure 1, the encoder (specifically, a "video encoder") 100 may include a transform and quantization unit 101, an intra-frame estimation unit 102, an intra-frame prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109, and a decoded image cache unit 110, etc., wherein the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC).For the input original video signal, a video coding block can be obtained by dividing the coding tree unit (CTU). Then, the residual pixel information obtained after intra-frame or inter-frame prediction is transformed by the transformation and quantization unit 101, including transforming the residual information from the pixel domain to the transform domain and quantizing the obtained transform coefficients to further reduce the bit rate; the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to perform intra-frame prediction on the video coding block. Specifically, the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to determine the intra-frame prediction mode to be used to encode the video coding block; the motion compensation unit 104 and the motion estimation unit 105 are used to perform inter-frame prediction coding on the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information; the motion estimation performed by the motion estimation unit 105 is the process of generating a motion vector, which can estimate the motion of the video coding block. The motion compensation unit 104 then calculates the motion vector based on the motion vector determined by the motion estimation unit 105. After determining the intra-frame prediction mode, the intra-frame prediction unit 103 is further configured to provide the selected intra-frame prediction data to the encoding unit 109, and the motion estimation unit 105 also sends the calculated motion vector data to the encoding unit 109. In addition, the inverse transform and inverse quantization unit 106 is configured to reconstruct the video coding block and reconstruct a residual block in the pixel domain. The reconstructed residual block is subjected to the filter control analysis unit 107 and the filtering unit 108 to remove the block effect artifacts. The reconstructed residual block is then added to a predictive block in the frame of the decoded image buffer unit 110 to generate a reconstructed video coding block. The encoding unit 109 is configured to encode various coding parameters and quantized transform coefficients. In the CABAC-based coding algorithm, the context content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra-frame prediction mode, and output the code stream of the video signal. The decoded image buffer unit 110 is configured to store the reconstructed video coding block for prediction reference. As the video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoded image buffer unit 110 .
[0077] Referring to Figure 2, which shows a schematic block diagram of a decoder provided in an embodiment of the present application, as shown in Figure 2, the decoder (specifically, a "video decoder") 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra-frame prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206. The decoding unit 201 can implement header information decoding and CABAC decoding, and the filtering unit 205 can implement deblocking filtering and SAO filtering. After the input video signal is encoded as shown in FIG1 , a code stream of the video signal is output; the code stream is input to the decoder 200 and first passes through the decoding unit 201 to obtain the decoded transform coefficients; the transform coefficients are processed by the inverse transform and inverse quantization unit 202 to generate a residual block in the pixel domain; the intra-frame prediction unit 203 can be used to generate prediction data for the current video decoding block based on the determined intra-frame prediction mode and the data of the previously decoded block from the current frame or picture; the motion compensation unit 204 determines the prediction information for the video decoding block by analyzing the motion vector and other associated syntax elements, and uses The prediction information is used to generate a predictive block for the video decoding block being decoded; a decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 202 with the corresponding predictive block generated by the intra-frame prediction unit 203 or the motion compensation unit 204; the decoded video signal passes through the filtering unit 205 to remove blocking artifacts, thereby improving video quality; the decoded video block is then stored in the decoded image buffer unit 206, which stores reference images used for subsequent intra-frame prediction or motion compensation, and is also used for outputting the video signal, thereby obtaining the restored original video signal.
[0078] Furthermore, an embodiment of the present application also provides a network architecture of a coding and decoding system including an encoder and a decoder, wherein FIG3 shows a schematic diagram of a network architecture of a coding and decoding system provided by an embodiment of the present application. As shown in FIG3 , 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. During implementation, the electronic device can be various types of devices with video coding and decoding functions. For example, the electronic device can include a smart phone, a tablet computer, a personal computer, a personal digital assistant, a navigator, a digital phone, a video phone, a television, a sensing device, a server, etc., which are not specifically limited here. In addition, the decoder or encoder described in the embodiment of the present application can be the above-mentioned electronic device.
[0079] Template based intra mode derivation (TIMD) is an intra prediction mode that can be used for luma or chroma. The encoder and decoder use the same operation to obtain the final prediction value. Specifically, for a prediction mode in a given prediction mode set (such as an (MPM) list, etc.), a template prediction value is calculated for the template area of the current block based on the mode, and a given evaluation criterion (such as the sum of absolute transform differences (SATD)) is calculated for the template prediction value and the template reconstruction value. Based on the size of the evaluation criterion, a certain number (such as one or two) of candidate prediction modes are selected to predict the current block.
[0080] Specifically, the process of TIMD technology is as shown in Figure 4:
[0081] S1. Determine the template type and size
[0082] Get the reconstructed brightness pixel at the template location.
[0083] Based on the pixel availability of the neighboring area of the current block, the availability of pixels at the template position and the template reference position is determined. This includes, but is not limited to: based on the relative position of the template and the current block, templates can be classified into upper template, left template, upper right template, lower left template, upper left template, etc. The template reference area varies with different template types, and the template area is allowed to overlap with the template reference area.
[0084] In addition, in order to meet the needs of different coding blocks, the template type and the reference area corresponding to the template can be flexibly combined, as shown in Figure 5; the sizes of different types of templates for different coding blocks can be fixed to the same or different. For example, different template sizes can be selected according to the different sizes of the current block. Taking the template in Figure 5 as an example, the following formula describes a template size setting condition, where uiWidth and uiHeight are the width and height of the current block, and iTempW and iTempH are the width and height of the adopted template:
[0085] S2. Obtaining reference area pixels
[0086] As shown in Figure 6, the template reference areas that can be used by TIMD technology include the adjacent reconstructed pixel area on the left side of the left template and the adjacent reconstructed pixel area on the top of the upper template. Assume that the length of the adjacent reconstructed pixel area on the left is m_leftRefLength, the length of the adjacent reconstructed pixel area on the top is m_topRefLength, iTempHeight is the height of the upper template, iTempWidth is the width of the left template, uiWidth and uiHeight are the width and height of the current block, then: m_leftRefLength = (uiHeight + iTempHeight) < < 3 m_topRefLength = (uiWidth + iTempWidth) < < 3
[0087] S3. Obtain TIMD candidate prediction mode
[0088] Construct a prediction mode list, including but not limited to the following modes: 67 intra-frame prediction modes (PLANAR, DC, and 65 angular prediction modes), prediction modes involving block vectors (IntraTmp, IBC, etc.). The list can be constructed in any order, including but not limited to the following: prediction modes for adjacent coding blocks, prediction modes for non-adjacent coding blocks, etc.
[0089] S4. Generate the final prediction value of the current block
[0090] At the template area determined in S1, prediction of the mode in the candidate prediction mode list obtained in S3 is performed.
[0091] By looping through different prediction modes, multiple sets of prediction information for the template region can be obtained, and the optimal prediction mode can be selected based on certain evaluation criteria. For example, the sum of absolute deviations (SAD), the sum of transformed absolute deviations (SATD), the sum of squared differences (SSE), the mean absolute difference (MAD), the mean absolute error (MAE), the mean squared error (MSE), etc. can be selected.
[0092] The following uses SATD as an example, including but not limited to the following processing methods:
[0093] If there are multiple templates, the SATDs of the multiple templates are accumulated to obtain a SATD sum, and then the size of the SATD sum is used to select the optimal prediction mode;
[0094] Alternatively, different templates are calculated separately, and then the SATD is divided by the average number of pixels in the template area to select the optimal prediction mode.
[0095] In addition, during step S4, if the prediction mode list obtained in S2 has been completely traversed, adjustments can be made based on the selected optimal prediction mode to obtain one or more untraversed prediction modes, and the template prediction and optimal selection processes of steps S3 and S4 can be performed again.
[0096] In addition, the optimal prediction mode includes but is not limited to one. If certain conditions are met, multiple optimal prediction modes can be selected, including but not limited to the following conditions: the SATD of the second prediction mode is less than 2 times that of the first prediction mode, etc.
[0097] Then, the prediction process of the above selected prediction mode is performed on the current coding block:
[0098] If only one prediction mode is selected in S4, then only the prediction of this prediction mode is performed;
[0099] If S4 selects multiple prediction modes, weighted prediction of the multiple prediction modes is performed, and the weighting coefficients include but are not limited to the following methods: obtained by SATD calculated by S4, average weighting, etc.
[0100] The following example illustrates this: iBestMode is the first prediction mode, iSecondaryMode is the second prediction mode, and predSamples[x][y] is the predicted value of the current block.
[0101] If TIMD selects only one candidate mode, weighted fusion is not performed, and the current coding block is predicted using iBestMode to obtain the final prediction value. That is, predSamples[x][y] is directly obtained using the corresponding method of the prediction mode, where x = 0..uiWidth-1 and y = 0..uiHeight-1.
[0102] If TIMD selects more than one candidate mode, let the evaluation criteria of iBestMode and iSecondaryMode be uiBestCost and uiSecondaryCost respectively.
[0103] TIMD technology decides whether to apply weighted fusion based on the size of uiBestCost and uiSecondaryCost. The details are as follows:
[0104] If uiSecondaryCost>=2*uiBestCost, weighted fusion is not applied, and the current coding block is predicted using iBestMode to obtain the final prediction value.
[0105] If uiSecondaryCost < 2 * uiBestCost, then weighted fusion is applied. Let the weight of iBestMode be weight1 and the weight of iSecondaryMode be weight2. Specifically as follows: weight1 = uiSecondaryCost / (uiBestCost + uiSecondaryCost) weight2 = 1 - weight1
[0106] After using iBestMode and iSecondaryMode to obtain two prediction values (pelPred[x][y] and pelPredFusion[x][y], where x = 0..nTbW-1, y = 0..nTbH–1), the current coding block is weighted fusion applied to obtain the final prediction value predSamples[x][y]. Specifically: predSamples[x][y] = pelPred[x][y]*weight1 + pelPredFusion[x][y]*weight2
[0107] However, in the actual encoding process, the optimal prediction mode selected by the TIMD technology has large deviations in some scenarios, resulting in low prediction accuracy of the current block.
[0108] Based on this, an embodiment of the present application provides a coding and decoding method that fully utilizes the correlation between the template and the current block, adds one or more planar intra-frame prediction modes as candidate prediction modes to the TIMD mode, so that the TIMD mode can adaptively select a more matching prediction mode based on the template, thereby improving the prediction effect of the TIMD mode and thus improving the coding and decoding efficiency.
[0109] It should be noted that the method of the embodiment of the present application is mainly applied to the intra-frame prediction unit 103 shown in Figure 1 and the intra-frame prediction unit 203 shown in Figure 2. In other words, the embodiment of the present application can be applied to both the encoder and the decoder, or even to both the encoder and the decoder at the same time, but the embodiment of the present application is not specifically limited thereto.
[0110] It should also be noted that when applied to the encoding end part, the "current block" specifically refers to the encoding block that is currently to be intra-frame predicted, also known as the "current encoding block"; when applied to the decoding end part, the "current block" specifically refers to the decoding block that is currently to be intra-frame predicted, also known as the "current decoding block".
[0111] In one embodiment of the present application, referring to FIG7 , a schematic flow chart of a decoding method provided by an embodiment of the present application is shown. As shown in FIG7 , the method may include:
[0112] S701: Decode the code stream and determine the prediction parameters of the current block;
[0113] It should be noted that the prediction parameter is used to indicate whether to use the template-based intra-frame mode derivation mode (TIMD mode) to determine the prediction value of the current block. If the prediction parameter is used to indicate the use of the TIMD mode to determine the prediction value of the current block, the subsequent method steps of using the TIMD mode for prediction in the embodiment of the present application are performed. If the prediction parameter is used to indicate not using the TIMD mode to determine the prediction value of the current block, other prediction modes are used for prediction.
[0114] Exemplarily, the prediction parameters include at least a first syntax element for indicating whether to use a template-based intra-frame mode derivation mode to determine the prediction value of the current block. When the value of the first syntax element is 0, it indicates that the prediction value of the current block is not determined using the TIMD mode; when the value of the first syntax element is 1, it indicates that the prediction value of the current block is determined using the TIMD mode.
[0115] In some embodiments, the method further includes determining prediction parameters for the current block based on reference information of the current block, where the reference information of the current block includes at least one of the following: reference sample values of a reconstructed reference block of the current block, prediction information of the reference block, size of the current block, syntax elements of a codestream, etc. In other words, whether the current block uses the TIMD mode can be implicitly inferred based on the reference information of the current block.
[0116] S702: When the prediction parameter indicates that a template-based intra mode derivation mode is used to determine a prediction value of the current block, determining a prediction cost value of a candidate prediction mode based on the template of the current block, where the candidate prediction mode includes one or more planar intra prediction modes;
[0117] In some embodiments, the method further includes determining candidate prediction modes for the current block, wherein the candidate prediction modes include at least one or more planar intra-frame prediction modes. Exemplarily, the one or more planar intra-frame prediction modes include one or more of a planar prediction mode (PLANAR mode), a horizontal plane prediction mode (PLANAR_HOR mode), a vertical plane prediction mode (PLANAR_VER mode), etc. The candidate prediction modes may also include other intra-frame prediction modes different from the planar intra-frame prediction mode.
[0118] Exemplarily, one or more intra-frame prediction modes in a preset intra-frame prediction mode list are used as candidate prediction modes.
[0119] Exemplarily, a candidate prediction mode is determined based on a prediction mode of a reconstructed reference block of the current block, wherein the reference block includes adjacent blocks and / or non-adjacent blocks of the current block. The reference block may include one or more adjacent blocks. As shown in FIG8 , the adjacent blocks may be adjacent blocks to the left, lower left, upper right, above, or upper left. The reference block may include one or more non-adjacent blocks. The reference block may include one or more adjacent blocks and one or more non-adjacent blocks.
[0120] In some embodiments, determining a candidate prediction mode based on the prediction mode of the reconstructed reference block of the current block includes: when the prediction mode of the reference block includes a first plane intra-frame prediction mode, determining that the candidate prediction mode includes the first plane intra-frame prediction mode, wherein the first plane intra-frame prediction mode includes one or more plane intra-frame prediction modes; when the prediction mode of the reference block does not include the first plane intra-frame prediction mode, determining that the candidate prediction mode includes the prediction mode of the reference block and the first plane intra-frame prediction mode. In other words, whether the candidate prediction mode includes a plane intra-frame prediction mode and how many types of the candidate prediction mode include, is related to the prediction mode existing in the reference block, and the candidate prediction mode includes one or more intra-frame prediction modes existing in the reference block. The first plane intra-frame prediction mode can be any plane intra-frame prediction mode or a specific prediction mode. Exemplarily, the first plane intra-frame prediction mode is PLANAR_HOR mode or PLANAR_VER mode.
[0121] It should be noted that, in addition to the first planar intra prediction mode, the candidate prediction modes also include other prediction modes of neighboring blocks.
[0122] In other embodiments, determining candidate prediction modes based on the prediction mode of a reconstructed reference block of the current block includes determining that the candidate prediction modes include the prediction mode of the reference block and one or more planar intra prediction modes. In other words, whether the candidate prediction modes include the planar intra prediction mode and how many planar intra prediction modes the candidate prediction modes include are unrelated to the prediction modes that exist in the reference block. Regardless of whether the reference block exists in the planar intra prediction mode, the candidate prediction modes directly include the one or more preset planar intra prediction modes.
[0123] In some embodiments, determining a candidate prediction mode based on a prediction mode of a reconstructed reference block of a current block also includes: when none of the prediction modes of the reference block are available, determining that the candidate prediction mode also includes a planar prediction mode; or, when the prediction mode of the reference block is available but does not include an angle prediction mode, determining that the candidate prediction mode also includes a planar prediction mode and a direct current prediction mode (DC mode); or, when the prediction mode of the reference block includes an angle prediction mode, constructing a most probable prediction mode list (MPM list) based on the prediction mode of the reference block, and determining at least one wide angle prediction mode of the reference block, wherein the most probable prediction mode list includes one or more prediction modes; determining that the candidate prediction mode includes one or more prediction modes in the most probable prediction mode list, at least one wide angle prediction mode, a direct current prediction mode, a vertical angle prediction mode (VER mode) and a horizontal angle prediction mode (HOR mode).
[0124] In some embodiments, determining a candidate prediction mode based on a prediction mode of a reconstructed reference block for the current block further includes: obtaining block vectors of one or more reference blocks if the prediction mode of the reference block includes a block vector-based prediction mode (including IntraTmp, IBC, etc.); and determining a candidate block vector for the current block based on the block vectors of the one or more reference blocks. In other words, if the candidate prediction mode for the current block includes a block vector-based prediction mode, then the candidate block vector for the current block must be obtained based on the block vectors of the reference blocks to implement the block vector-based prediction mode for the current block.
[0125] The following is a further example of the method for determining the candidate prediction mode in the embodiment of the present application.
[0126] Obtain a prediction mode list, where candidate prediction modes include but are not limited to the following mode types: 67 intra-frame prediction modes (PLANAR mode, DC mode, and 65 angle prediction modes), derivative modes of the PLANAR mode such as PLANAR_HOR mode and PLANAR_VER mode, prediction modes involving block vectors, etc.
[0127] The order of constructing the list includes, but is not limited to, the following: prediction mode of adjacent blocks, prediction mode of non-adjacent blocks, etc. The derived modes of the PLANAR mode include, but are not limited to, the following construction order, which can be directly included in the list or added according to the order of adjacent blocks or non-adjacent blocks.
[0128] The following example illustrates a method for obtaining 67 intra-frame prediction modes: a candidate prediction mode is selected based on the prediction modes of the neighboring blocks (left, lower left, upper right, upper, upper left) of the current block.
[0129] If there is no angular prediction mode for the neighboring block, the candidate prediction modes include the PLANAR mode and the DC mode.
[0130] If there is an angular prediction mode for the adjacent block, the candidate prediction mode includes the MPM list and the wide angle prediction mode. If one or more of the DC / HOR / VER modes are not in the MPM list, they are added at the end of the MPM list.
[0131] The following examples include methods for obtaining derived modes of the PLANAR mode, including but not limited to the following:
[0132] If the neighboring block does not have the PLANAR_HOR mode or the PLANAR_VER mode, the candidate prediction mode does not include the PLANAR_HOR mode or the PLANAR_VER mode.
[0133] If the neighboring block has PLANAR_HOR mode and / or PLANAR_VER mode, the candidate prediction mode also includes the PLANAR_HOR mode and / or PLANAR_VER mode of the neighboring block.
[0134] The following is another example of a method for obtaining a prediction mode involving a block vector: a block vector set is selected based on the prediction modes of the neighboring blocks (left, lower left, upper right, upper, upper left) of the current coding block.
[0135] If there is no prediction mode involving a block vector for the neighboring block, there is no need to determine a candidate block vector.
[0136] If a prediction mode involving a block vector exists for a neighboring block, the candidate block vector includes a valid block vector of the neighboring block, where valid means that the reference block of the current block relative to the offset of the block vector has been reconstructed.
[0137] In some embodiments, the candidate prediction mode is used to predict the template of the current block to determine the first predicted sample value of the template of the current block; and the prediction cost value of the candidate prediction mode is determined based on the first reconstructed sample value and the first predicted sample value of the template of the current block.
[0138] In other words, by looping through different prediction modes, we can obtain multiple sets of prediction information for the template, and select the optimal prediction mode based on the prediction cost. Prediction costs include but are not limited to sum of absolute deviations (SAD), transformed sum of absolute deviations (SATD), sum of squared differences (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), rate-distortion error (RDO), and more.
[0139] S703: Determine a target prediction mode for the current block based on the prediction cost of the candidate prediction mode;
[0140] Exemplarily, based on the prediction cost values of the candidate prediction modes, a first intra-frame prediction mode corresponding to the minimum prediction cost value is determined. The current block is predicted based on the first intra-frame prediction value to obtain a prediction value for the current block. The first intra-frame prediction mode can be understood as the optimal prediction mode selected in the TIMD mode. The optimal prediction mode is used to predict the current block to obtain a prediction value for the current block in the TIMD mode.
[0141] Exemplarily, a first intra-frame prediction mode corresponding to a minimum prediction cost value is determined based on the prediction cost values of the candidate prediction modes; a second intra-frame prediction mode corresponding to a second minimum cost value is determined based on the prediction cost values of the candidate prediction modes, wherein the second intra-frame prediction mode includes one or more intra-frame prediction modes; and a weighted prediction is performed on the current block based on the first intra-frame prediction mode and the second intra-frame prediction mode to obtain a prediction value of the current block. The second intra-frame prediction mode can be understood as one or more suboptimal prediction modes selected in the TIMD mode, and a weighted prediction is performed based on multiple intra-frame prediction modes to obtain a prediction value of the current block in the TIMD mode.
[0142] That is, the target prediction mode may include one or more intra prediction modes, but the target prediction mode selected in the TIMD mode may include or exclude the planar intra prediction mode.
[0143] The following prediction cost values take SATD as an example, including but not limited to the following processing methods:
[0144] If there are multiple templates, the SATDs of the multiple templates are accumulated to obtain a SATD sum, and then the size of the SATD sum is used to select the target prediction mode;
[0145] Alternatively, different templates may be calculated separately, and then the SATD is divided by the average number of pixels in the template area to select the target prediction mode.
[0146] In addition, the target prediction mode includes but is not limited to one, and multiple prediction modes can be selected if certain conditions are met, including but not limited to the following conditions: the SATD of the second intra-frame prediction mode is less than 2 times that of the first intra-frame prediction mode, etc.
[0147] Then, the prediction process of the above-selected prediction mode is performed on the current block: if only one prediction mode is selected, only the prediction of this prediction mode is performed; if multiple prediction modes are selected, weighted prediction of multiple prediction modes is performed, and the weighting coefficients include but are not limited to the following methods: obtained by the calculated SATD, average weighting, etc.
[0148] S704: Determine a prediction value of the current block according to the target prediction mode.
[0149] In some embodiments, the prediction value of the current block is determined according to the target prediction mode, including: when the first intra-frame prediction mode is a horizontal plane prediction mode or a vertical plane prediction mode, the current block is predicted according to the first intra-frame prediction mode to determine the prediction value of the current block; or, when the first intra-frame prediction mode is a horizontal plane prediction mode or a vertical plane prediction mode, and the second intra-frame prediction mode is a preset intra-frame prediction mode, the current block is weighted predicted according to the first intra-frame prediction mode and the second intra-frame prediction mode to determine the prediction value of the current block.
[0150] That is, in TMID mode, when the horizontal plane prediction mode or the vertical plane prediction mode is selected as the optimal prediction mode, it may not participate in the weighted fusion process with other prediction modes, or may only participate in the weighted fusion process with certain specific prediction modes.
[0151] In some embodiments, the method further includes: using other prediction modes to determine other prediction values of the current block, wherein the other prediction values include one or more prediction values; weightedly fusing the prediction value of the current block and the other prediction values to obtain the final prediction value of the current block.
[0152] That is to say, the prediction value obtained by the TIMD mode provided in the embodiment of the present application can be weighted and fused with other prediction values obtained by other prediction modes to obtain the final prediction value of the current block.
[0153] The prediction process is illustrated below with an example: iBestMode is the first intra-frame prediction mode, iSecondaryMode is the second intra-frame prediction mode, and predSamples[x][y] is the predicted value of the current block.
[0154] If TIMD selects only one target prediction mode, weighted fusion is not performed, and the current block is predicted using iBestMode to obtain the final prediction value. That is, predSamples[x][y] is directly obtained using the corresponding method of the prediction mode, where x = 0..uiWidth-1 and y = 0..uiHeight-1.
[0155] If TIMD selects more than one target prediction mode, let the evaluation criteria of iBestMode and iSecondaryMode be uiBestCost and uiSecondaryCost respectively.
[0156] TIMD technology decides whether to apply weighted fusion based on the size of uiBestCost and uiSecondaryCost. The details are as follows:
[0157] If uiSecondaryCost>=2*uiBestCost, weighted fusion is not applied, and the current block is predicted using iBestMode to obtain the final prediction value.
[0158] If uiSecondaryCost < 2 * uiBestCost, then weighted fusion is applied. Let the weight of iBestMode be weight1 and the weight of iSecondaryMode be weight2. Specifically as follows: weight1 = uiSecondaryCost / (uiBestCost + uiSecondaryCost) weight2 = 1 - weight1
[0159] After using iBestMode and iSecondaryMode to obtain two prediction values (pelPred[x][y] and pelPredFusion[x][y], where x = 0..nTbW-1, y = 0..nTbH–1), the current block is weighted fusion applied to obtain the final prediction value predSamples[x][y]. Specifically: predSamples[x][y] = pelPred[x][y]*weight1 + pelPredFusion[x][y]*weight2
[0160] Furthermore, when the target prediction mode includes the PLANAR_HOR mode and the PLANAR_VER mode, the prediction process includes the following:
[0161] Assume that the width of the current block is W and the height is H, the reference pixel of the top reference row (topRow) is topRow[t], t=0...W, the reference pixel of the left reference column (leftCol) is leftCol[l], l=0...H, and the upper left reference pixel is TL. As shown in Figure 9, the top reference row is black, the solid black is the upper right corner reference pixel topRow[W], the left reference column is gray, and the solid gray is the lower left corner reference pixel leftCol[H].
[0162] The prediction process of the PLANAR model is: predSamples[x][y] is the predicted value, x = 0..W-1 and y = 0..H–1.
[0163] Vertical prediction value predV[x][y]=((H-1-y)*topRow[x]+(y+1)*leftCol[H])< <Log2(W)
[0164] Horizontal prediction value predH[x][y]=((W-1-x)*leftCol[y]+(x+1)*topRow[W])< <Log2(H)
[0165] Average the vertical and horizontal prediction values
[0166] predSamples[x][y]=(predV[x][y]+predH[x][y]+W*H)>>(Log2(W)+Log2(H)+1)
[0167] The prediction process of the PLANAR_HOR mode is: predSamples[x][y] is the predicted value, x = 0..W-1 and y = 0..H–1.
[0168] predSamples[x][y]=((W-1-x)*leftCol[y]+(x+1)*topRow[W]+(1<<(Log2(W)-1)))>>Log2(W)
[0169] The prediction process of the PLANAR_VER mode is: predSamples[x][y] is the predicted value, x = 0..W-1 and y = 0..H–1.
[0170] predSamples[x][y]=((H-1-y)*topRow[x]+(y+1)*leftCol[H]+(1<<(Log2(H)-1)))< <Log2(H)
[0171] Here, Log2(n) is the logarithm of n with base 2.
[0172] It should be noted that the prediction method of the TIMD mode provided in the embodiment of the present application can also participate in other prediction modes, including but not limited to: intra-frame prediction sub-block partitioning mode (Intra Sub-Partition, ISP), multiple reference line intra prediction mode (Multiple Reference Line intra prediction, MRL), spatial geometric partitioning mode (Spatial Geometric Partitioning Mode, SGPM), etc.
[0173] Exemplarily, determining a prediction value of the current block based on the target prediction mode includes: when the prediction parameters indicate that the current block uses a multi-reference row intra prediction mode (MRL mode), determining reference sample values of the current block, wherein the reference sample values include values of multiple rows of reconstructed samples above the current block and / or values of multiple columns of reconstructed samples to the left of the current block; and predicting the current block using the target prediction mode based on the reference sample values of the current block to obtain a prediction value of the current block. That is, based on the use of the TIMD mode, the reference sample values of the current block may be values of multiple rows and columns of reconstructed samples.
[0174] Exemplarily, the prediction parameters may also include a second syntax element for indicating whether the current block uses the MRL mode. When the value of the second syntax element is 0, it is determined that the MRL mode is not used; when the value of the second syntax element is 1, it is determined that the MRL mode is used.
[0175] In some embodiments, determining a prediction value of the current block based on a target prediction mode includes: when the prediction parameters indicate that the current block uses an intra-frame sub-block partitioning mode (ISP mode), determining reference sample values of sub-blocks of the current block, wherein the reference sample values include one or more rows of reconstructed sample values reconstructed above the sub-block and / or one or more columns of reconstructed sample values reconstructed to the left of the sub-block; and predicting the sub-block using the target prediction mode based on the reference sample values of the sub-block to obtain a prediction value of the sub-block. That is, based on the use of the TIMD mode, the current block can be divided into sub-blocks and prediction can be performed on each sub-block. In addition, the reference sample values of each sub-block can be a row and column of reconstructed sample values, or multiple rows and columns of reconstructed sample values.
[0176] Exemplarily, the prediction parameters may also include a third syntax element for indicating whether the current block uses the ISP mode. When the value of the third syntax element is 0, it is determined to indicate that the ISP mode is not used; when the value of the third syntax element is 1, it is determined to indicate that the ISP mode is used.
[0177] In some embodiments, determining a prediction value for the current block based on a target prediction mode includes: geometrically partitioning the current block when prediction parameters indicate that the current block uses a spatial geometric partitioning mode (SGPM mode); and predicting the first partition using the target prediction mode based on reference sample values of the first partition in the current block to obtain a prediction value for the first partition. That is, based on the use of the TIMD mode, spatial geometric partitioning can be performed on the current block, and prediction can be performed for one or more partitions. Furthermore, the reference sample values for each partition can be reconstructed sample values for one row and one column, or reconstructed sample values for multiple rows and multiple columns.
[0178] Exemplarily, the prediction parameters may also include a fourth syntax element for indicating whether the current block uses the SGPM mode. When the value of the fourth syntax element is 0, it indicates that the SGPM mode is not used; when the value of the fourth syntax element is 1, it indicates that the ISP mode is used.
[0179] In some embodiments, based on the use of the TIMD mode, and with the PLANAR_HOR mode or the PLANAR_VER mode selected as the target prediction mode, other prediction modes may be involved.
[0180] By adopting the above technical solution, the correlation between the template and the current block is fully utilized, and one or more planar intra-frame prediction modes are added to the TIMD mode as candidate prediction modes, so that the TIMD mode can adaptively select a more matching prediction mode based on the template, improve the prediction effect of the TIMD mode, and thus improve the decoding efficiency.
[0181] In another embodiment of the present application, see Figure 10, which shows a schematic flow chart of an encoding method provided in an embodiment of the present application. As shown in Figure 10, the encoding method may include:
[0182] S1001: Determine prediction cost values of candidate prediction modes based on a template of a current block, where the candidate prediction modes include one or more planar intra prediction modes;
[0183] In some embodiments, the method further includes determining candidate prediction modes for the current block, wherein the candidate prediction modes include at least one or more planar intra-frame prediction modes. Exemplarily, the one or more planar intra-frame prediction modes include one or more of a planar prediction mode (PLANAR mode), a horizontal plane prediction mode (PLANAR_HOR mode), a vertical plane prediction mode (PLANAR_VER mode), etc. The candidate prediction modes may also include other intra-frame prediction modes different from the planar intra-frame prediction mode.
[0184] Exemplarily, one or more intra-frame prediction modes in a preset intra-frame prediction mode list are used as candidate prediction modes.
[0185] Exemplarily, a candidate prediction mode is determined based on a prediction mode of a reconstructed reference block of the current block, wherein the reference block includes adjacent blocks and / or non-adjacent blocks of the current block. The reference block may include one or more adjacent blocks. As shown in FIG8 , the adjacent blocks may be adjacent blocks to the left, lower left, upper right, above, or upper left. The reference block may include one or more non-adjacent blocks. The reference block may include one or more adjacent blocks and one or more non-adjacent blocks.
[0186] In some embodiments, determining a candidate prediction mode based on the prediction mode of the reconstructed reference block of the current block includes: when the prediction mode of the reference block includes a first plane intra-frame prediction mode, determining that the candidate prediction mode includes the first plane intra-frame prediction mode, wherein the first plane intra-frame prediction mode includes one or more plane intra-frame prediction modes; when the prediction mode of the reference block does not include the first plane intra-frame prediction mode, determining that the candidate prediction mode includes the prediction mode of the reference block and the first plane intra-frame prediction mode. In other words, whether the candidate prediction mode includes a plane intra-frame prediction mode and how many types of the candidate prediction mode include, is related to the prediction mode existing in the reference block, and the candidate prediction mode includes one or more intra-frame prediction modes existing in the reference block. The first plane intra-frame prediction mode can be any plane intra-frame prediction mode or a specific prediction mode. Exemplarily, the first plane intra-frame prediction mode is PLANAR_HOR mode or PLANAR_VER mode.
[0187] It should be noted that, in addition to the first planar intra prediction mode, the candidate prediction modes also include other prediction modes of neighboring blocks.
[0188] In other embodiments, determining candidate prediction modes based on the prediction mode of a reconstructed reference block of the current block includes determining that the candidate prediction modes include the prediction mode of the reference block and one or more planar intra prediction modes. In other words, whether the candidate prediction modes include the planar intra prediction mode and how many planar intra prediction modes the candidate prediction modes include are unrelated to the prediction modes that exist in the reference block. Regardless of whether the reference block exists in the planar intra prediction mode, the candidate prediction modes directly include the one or more preset planar intra prediction modes.
[0189] In some embodiments, determining a candidate prediction mode based on a prediction mode of a reconstructed reference block of a current block also includes: when none of the prediction modes of the reference block are available, determining that the candidate prediction mode also includes a planar prediction mode; or, when the prediction mode of the reference block is available but does not include an angle prediction mode, determining that the candidate prediction mode also includes a planar prediction mode and a direct current prediction mode (DC mode); or, when the prediction mode of the reference block includes an angle prediction mode, constructing a most probable prediction mode list (MPM list) based on the prediction mode of the reference block, and determining at least one wide angle prediction mode of the reference block, wherein the most probable prediction mode list includes one or more prediction modes; determining that the candidate prediction mode includes one or more prediction modes in the most probable prediction mode list, at least one wide angle prediction mode, a direct current prediction mode, a vertical angle prediction mode (VER mode) and a horizontal angle prediction mode (HOR mode).
[0190] In some embodiments, determining a candidate prediction mode based on a prediction mode of a reconstructed reference block for the current block further includes: obtaining block vectors of one or more reference blocks if the prediction mode of the reference block includes a block vector-based prediction mode (including IntraTmp, IBC, etc.); and determining a candidate block vector for the current block based on the block vectors of the one or more reference blocks. That is, if the candidate prediction mode for the current block includes a block vector-based prediction mode, then it is also necessary to obtain a candidate block vector for the current block based on the best block vector of the reference block to implement the block vector-based prediction mode for the current block.
[0191] The following is a further example of the method for determining the candidate prediction mode in the embodiment of the present application.
[0192] Obtain a prediction mode list, where candidate prediction modes include but are not limited to the following mode types: 67 intra-frame prediction modes (PLANAR mode, DC mode, and 65 angle prediction modes), derivative modes of the PLANAR mode such as PLANAR_HOR mode and PLANAR_VER mode, prediction modes involving block vectors, etc.
[0193] The order of constructing the list includes, but is not limited to, the following: prediction mode of adjacent blocks, prediction mode of non-adjacent blocks, etc. The derived modes of the PLANAR mode include, but are not limited to, the following construction order, which can be directly included in the list or added according to the order of adjacent blocks or non-adjacent blocks.
[0194] The following example illustrates a method for obtaining 67 intra-frame prediction modes: a candidate prediction mode is selected based on the prediction modes of the neighboring blocks (left, lower left, upper right, upper, upper left) of the current block.
[0195] If there is no angular prediction mode for the neighboring block, the candidate prediction modes include the PLANAR mode and the DC mode.
[0196] If there is an angular prediction mode for the adjacent block, the candidate prediction mode includes the MPM list and the wide angle prediction mode. If one or more of the DC / HOR / VER modes are not in the MPM list, they are added at the end of the MPM list.
[0197] The following examples include methods for obtaining derived modes of the PLANAR mode, including but not limited to the following:
[0198] If the neighboring block does not have the PLANAR_HOR mode or the PLANAR_VER mode, the candidate prediction mode does not include the PLANAR_HOR mode or the PLANAR_VER mode.
[0199] If the neighboring block has PLANAR_HOR mode and / or PLANAR_VER mode, the candidate prediction mode also includes the PLANAR_HOR mode and / or PLANAR_VER mode of the neighboring block.
[0200] The following is another example of a method for obtaining a prediction mode involving a block vector: a block vector set is selected based on the prediction modes of the neighboring blocks (left, lower left, upper right, upper, upper left) of the current coding block.
[0201] If there is no prediction mode involving a block vector for the neighboring block, there is no need to determine a candidate block vector.
[0202] If a prediction mode involving a block vector exists for a neighboring block, the candidate block vector includes a valid block vector of the neighboring block, where valid means that the reference block of the current block relative to the offset of the block vector has been reconstructed.
[0203] In some embodiments, the candidate prediction mode is used to predict the template of the current block to determine the first predicted sample value of the template of the current block; and the prediction cost value of the candidate prediction mode is determined based on the first reconstructed sample value and the first predicted sample value of the template of the current block.
[0204] In other words, by looping through different prediction modes, we can obtain multiple sets of prediction information for the template, and select the optimal prediction mode based on the prediction cost. Prediction costs include but are not limited to sum of absolute deviations (SAD), transformed sum of absolute deviations (SATD), sum of squared differences (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), rate-distortion error (RDO), and more.
[0205] S1002: Determine a target prediction mode for the current block based on the prediction cost of the candidate prediction mode;
[0206] Exemplarily, based on the prediction cost values of the candidate prediction modes, a first intra-frame prediction mode corresponding to the minimum prediction cost value is determined. The current block is predicted based on the first intra-frame prediction value to obtain a prediction value for the current block. The first intra-frame prediction mode can be understood as the optimal prediction mode selected in the TIMD mode. The optimal prediction mode is used to predict the current block to obtain a prediction value for the current block in the TIMD mode.
[0207] Exemplarily, a first intra-frame prediction mode corresponding to a minimum prediction cost value is determined based on the prediction cost values of the candidate prediction modes; a second intra-frame prediction mode corresponding to a second minimum cost value is determined based on the prediction cost values of the candidate prediction modes, wherein the second intra-frame prediction mode includes one or more intra-frame prediction modes; and a weighted prediction is performed on the current block based on the first intra-frame prediction mode and the second intra-frame prediction mode to obtain a prediction value of the current block. The second intra-frame prediction mode can be understood as one or more suboptimal prediction modes selected in the TIMD mode, and a weighted prediction is performed based on multiple intra-frame prediction modes to obtain a prediction value of the current block in the TIMD mode.
[0208] That is, the target prediction mode may include one or more intra prediction modes, but the target prediction mode selected in the TIMD mode may include or exclude the planar intra prediction mode.
[0209] S1003: Determine a prediction value of the current block according to the target prediction mode;
[0210] In some embodiments, the prediction value of the current block is determined according to the target prediction mode, including: when the first intra-frame prediction mode is a horizontal plane prediction mode or a vertical plane prediction mode, the current block is predicted according to the first intra-frame prediction mode to determine the prediction value of the current block; or, when the first intra-frame prediction mode is a horizontal plane prediction mode or a vertical plane prediction mode, and the second intra-frame prediction mode is a preset intra-frame prediction mode, the current block is weighted predicted according to the first intra-frame prediction mode and the second intra-frame prediction mode to determine the prediction value of the current block.
[0211] That is, in TMID mode, when the horizontal plane prediction mode or the vertical plane prediction mode is selected as the optimal prediction mode, it may not participate in the weighted fusion process with other prediction modes, or may only participate in the weighted fusion process with certain specific prediction modes.
[0212] In some embodiments, the method further includes: using other prediction modes to determine other prediction values of the current block, wherein the other prediction values include one or more prediction values; weightedly fusing the prediction value of the current block and the other prediction values to obtain the final prediction value of the current block.
[0213] That is to say, the prediction value obtained by the TIMD mode provided in the embodiment of the present application can be weighted and fused with other prediction values obtained by other prediction modes to obtain the final prediction value of the current block.
[0214] S1004: Making an encoding decision based on the prediction value of the current block to determine a prediction parameter of the current block, wherein the prediction parameter is used to indicate whether to use a template-based intra mode derivation mode to determine the prediction value of the current block;
[0215] It should be noted that the prediction parameter is used to indicate whether to use the template-based intra-frame mode derivation mode (TIMD mode) to determine the prediction value of the current block. If the prediction parameter is used to indicate the use of the TIMD mode to determine the prediction value of the current block, the subsequent method steps of using the TIMD mode for prediction in the embodiment of the present application are performed. If the prediction parameter is used to indicate not using the TIMD mode to determine the prediction value of the current block, other prediction modes are used for prediction.
[0216] Exemplarily, the prediction parameters include at least a first syntax element for indicating whether to use a template-based intra-frame mode derivation mode to determine the prediction value of the current block. When the value of the first syntax element is 0, it indicates that the prediction value of the current block is not determined using the TIMD mode; when the value of the first syntax element is 1, it indicates that the prediction value of the current block is determined using the TIMD mode.
[0217] In some embodiments, the method further includes determining prediction parameters for the current block based on reference information of the current block, where the reference information of the current block includes at least one of the following: reference sample values of a reconstructed reference block of the current block, prediction information of the reference block, size of the current block, syntax elements of a codestream, etc. In other words, whether the current block uses the TIMD mode can be implicitly inferred based on the reference information of the current block.
[0218] S1005: Encode the prediction parameters and write the obtained coded bits into the bitstream.
[0219] It should be noted that the prediction method of the TIMD mode provided in the embodiment of the present application can also participate in other prediction modes, including but not limited to: intra-frame prediction sub-block partitioning mode (Intra Sub-Partition, ISP), multiple reference line intra prediction mode (Multiple Reference Line intra prediction, MRL), spatial geometric partitioning mode (Spatial Geometric Partitioning Mode, SGPM), etc.
[0220] Exemplarily, determining a prediction value of the current block based on the target prediction mode includes: when the prediction parameters indicate that the current block uses a multi-reference row intra prediction mode (MRL mode), determining reference sample values of the current block, wherein the reference sample values include values of multiple rows of reconstructed samples above the current block and / or values of multiple columns of reconstructed samples to the left of the current block; and predicting the current block using the target prediction mode based on the reference sample values of the current block to obtain a prediction value of the current block. That is, based on the use of the TIMD mode, the reference sample values of the current block may be values of multiple rows and columns of reconstructed samples.
[0221] Exemplarily, the prediction parameters may also include a second syntax element for indicating whether the current block uses the MRL mode. When the value of the second syntax element is 0, it is determined that the MRL mode is not used; when the value of the second syntax element is 1, it is determined that the MRL mode is used.
[0222] In some embodiments, determining a prediction value of the current block based on a target prediction mode includes: when the prediction parameters indicate that the current block uses an intra-frame sub-block partitioning mode (ISP mode), determining reference sample values of sub-blocks of the current block, wherein the reference sample values include one or more rows of reconstructed sample values reconstructed above the sub-block and / or one or more columns of reconstructed sample values reconstructed to the left of the sub-block; and predicting the sub-block using the target prediction mode based on the reference sample values of the sub-block to obtain a prediction value of the sub-block. That is, based on the use of the TIMD mode, the current block can be divided into sub-blocks and prediction can be performed on each sub-block. In addition, the reference sample values of each sub-block can be a row and column of reconstructed sample values, or multiple rows and columns of reconstructed sample values.
[0223] Exemplarily, the prediction parameters may also include a third syntax element for indicating whether the current block uses the ISP mode. When the value of the third syntax element is 0, it is determined to indicate that the ISP mode is not used; when the value of the third syntax element is 1, it is determined to indicate that the ISP mode is used.
[0224] In some embodiments, determining a prediction value for the current block based on a target prediction mode includes: geometrically partitioning the current block when prediction parameters indicate that the current block uses a spatial geometric partitioning mode (SGPM mode); and predicting the first partition using the target prediction mode based on reference sample values of the first partition in the current block to obtain a prediction value for the first partition. That is, based on the use of the TIMD mode, spatial geometric partitioning can be performed on the current block, and prediction can be performed for one or more partitions. Furthermore, the reference sample values for each partition can be reconstructed sample values for one row and one column, or reconstructed sample values for multiple rows and multiple columns.
[0225] Exemplarily, the prediction parameters may also include a fourth syntax element for indicating whether the current block uses the SGPM mode. When the value of the fourth syntax element is 0, it indicates that the SGPM mode is not used; when the value of the fourth syntax element is 1, it indicates that the ISP mode is used.
[0226] In some embodiments, based on the use of the TIMD mode, and with the PLANAR_HOR mode or the PLANAR_VER mode selected as the target prediction mode, other prediction modes may be involved.
[0227] By adopting the above technical solution, the correlation between the template and the current block is fully utilized, and one or more planar intra-frame prediction modes are added to the TIMD mode as candidate prediction modes, so that the TIMD mode can adaptively select a more matching prediction mode based on the template, improve the prediction effect of the TIMD mode, and thus improve the coding efficiency.
[0228] In yet another embodiment of the present application, based on the same inventive concept as the previous embodiment, see Figure 11, which shows a schematic diagram of the structure of an encoder provided by an embodiment of the present application. As shown in Figure 11, the encoder 1100 may include a first prediction unit 1101, a first determination unit 1102, and an encoding unit 1103; wherein:
[0229] The first prediction unit 1101 is configured to determine a prediction cost value of a candidate prediction mode based on a template of a current block, wherein the candidate prediction mode includes one or more planar intra prediction modes;
[0230] The first prediction unit 1101 is further configured to determine a target prediction mode for the current block according to the prediction cost values of the candidate prediction modes; and determine a prediction value for the current block according to the target prediction mode;
[0231] A first determining unit 1102 is configured to make an encoding decision based on the prediction value of the current block and determine a prediction parameter of the current block, wherein the prediction parameter is used to indicate whether to use a template-based intra mode derivation mode to determine the prediction value of the current block;
[0232] The encoding unit 1103 is configured to encode the prediction parameters and write the obtained coded bits into the bitstream.
[0233] In some embodiments, the first prediction unit 1101 is further configured to determine a candidate prediction mode according to a prediction mode of a reference block reconstructed from the current block, wherein the reference block includes adjacent blocks and / or non-adjacent blocks of the current block.
[0234] In some embodiments, the first prediction unit 1101 is configured to, when the prediction mode of the reference block includes the first plane intra-frame prediction mode, determine that the candidate prediction mode includes the first plane intra-frame prediction mode, wherein the first plane intra-frame prediction mode includes one or more plane intra-frame prediction modes; and when the prediction mode of the reference block does not include the first plane intra-frame prediction mode, determine that the candidate prediction mode includes the prediction mode of the reference block and the first plane intra-frame prediction mode.
[0235] In some embodiments, the first prediction unit 1101 is configured to determine that the candidate prediction modes include a prediction mode of a reference block and one or more planar intra prediction modes.
[0236] In some embodiments, the first prediction unit 1101 is configured to, when none of the prediction modes of the reference block are available, determine that the candidate prediction mode also includes a planar prediction mode; or, when the prediction mode of the reference block is available but does not include an angle prediction mode, determine that the candidate prediction mode also includes a planar prediction mode and a DC prediction mode; or, when the prediction mode of the reference block includes an angle prediction mode, construct a most likely prediction mode list based on the prediction mode of the reference block, and determine at least one wide-angle prediction mode of the reference block, wherein the most likely prediction mode list includes one or more prediction modes; determine that the candidate prediction mode includes one or more prediction modes in the most likely prediction mode list, at least one wide-angle prediction mode, a DC prediction mode, one or more prediction modes of a vertical angle prediction mode and a horizontal angle prediction mode.
[0237] In some embodiments, the first prediction unit 1101 is configured to obtain block vectors of one or more reference blocks when the prediction mode of the reference block includes a prediction mode based on a block vector; and determine a candidate block vector of the current block based on the block vectors of the one or more reference blocks.
[0238] In some embodiments, the one or more planar intra prediction modes include one or more of a planar prediction mode, a horizontal plane prediction mode, and a vertical plane prediction mode.
[0239] In some embodiments, the first prediction unit 1101 is configured to use the candidate prediction mode to predict the template of the current block and determine the first predicted sample value of the template of the current block; and determine the prediction cost value of the candidate prediction mode based on the first reconstructed sample value and the first predicted sample value of the template of the current block.
[0240] In some embodiments, the first prediction unit 1101 is configured to determine a first intra-frame prediction mode corresponding to a minimum prediction cost value based on the prediction cost values of the candidate prediction modes; and determine a second intra-frame prediction mode corresponding to a second minimum cost value based on the prediction cost values of the candidate prediction modes, wherein the second intra-frame prediction mode includes one or more intra-frame prediction modes.
[0241] In some embodiments, the first prediction unit 1101 is configured such that the first intra-frame prediction mode is a horizontal plane prediction mode or a vertical plane prediction mode, and the current block is predicted according to the first intra-frame prediction mode to determine the prediction value of the current block; or, when the first intra-frame prediction mode is a horizontal plane prediction mode or a vertical plane prediction mode, and the second intra-frame prediction mode is a preset intra-frame prediction mode, the current block is weighted predicted according to the first intra-frame prediction mode and the second intra-frame prediction mode to determine the prediction value of the current block.
[0242] In some embodiments, the first prediction unit 1101 is configured to determine the reference sample value of the current block when the prediction parameters indicate that the current block uses a multi-reference row intra-frame prediction mode, wherein the reference sample value includes multiple rows of reconstructed sample values reconstructed on the upper side of the current block and / or multiple columns of reconstructed sample values reconstructed on the left side of the current block; and predict the current block using the target prediction mode according to the reference sample value of the current block to obtain a predicted value of the current block.
[0243] In some embodiments, the first prediction unit 1101 is configured to determine the reference sample value of the sub-block of the current block when the prediction parameter indicates that the current block uses the intra-frame sub-block partitioning mode, wherein the reference sample value includes one or more rows of reconstructed sample values on the upper side of the sub-block and / or one or more columns of reconstructed sample values on the left side of the sub-block; and predict the sub-block using the target prediction mode according to the reference sample value of the sub-block to obtain the predicted value of the sub-block.
[0244] In some embodiments, the first prediction unit 1101 is configured to perform geometric segmentation on the current block when the prediction parameters indicate that the current block uses a spatial geometric segmentation mode; predict the first partition using the target prediction mode based on the reference sample value of the first partition in the current block to obtain a prediction value of the first partition.
[0245] In some embodiments, the target prediction mode is a horizontal plane prediction mode or a vertical plane prediction mode.
[0246] It is understandable that in the embodiments of the present application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and of course it can also be a module, or it can be non-modular. Moreover, the various components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional modules.
[0247] 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, or the portion 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 for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method of this embodiment. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0248] Therefore, an embodiment of the present application provides a computer-readable storage medium, which is applied to the encoder 1100. The computer-readable storage medium stores a computer program, and when the computer program is executed by the first processor, it implements the method of any one of the aforementioned embodiments.
[0249] An embodiment of the present application provides a computer-readable storage medium, which stores a code stream generated by the encoding method.
[0250] Based on the composition of the encoder 1100 and the computer-readable storage medium, refer to Figure 12, which shows a specific hardware structure diagram of the encoder 120 provided in an embodiment of the present application. As shown in Figure 12, the encoder 1100 may include: a first communication interface 1201, a first memory 1202 and a first processor 1203; each component is coupled together through a first bus system 1204. It can be understood that the first bus system 1204 is used to achieve connection and communication between these components. In addition to the data bus, the first bus system 1204 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are labeled as the first bus system 1204 in Figure 12. Among them,
[0251] The first communication interface 1201 is used to receive and send signals when sending and receiving information with other external network elements;
[0252] A first memory 1202 is used to store computer programs that can be run on the first processor 1203;
[0253] The first processor 1203 is configured to, when running the computer program, execute:
[0254] Determining prediction cost values of candidate prediction modes based on a template of the current block, wherein the candidate prediction modes include one or more planar intra prediction modes;
[0255] Determining a target prediction mode for the current block based on the prediction cost values of the candidate prediction modes;
[0256] Determine the prediction value of the current block according to the target prediction mode;
[0257] Making an encoding decision based on the prediction value of the current block to determine a prediction parameter of the current block, wherein the prediction parameter is used to indicate whether to use a template-based intra-frame mode derivation mode to determine the prediction value of the current block;
[0258] Encode the prediction parameters and write the resulting coded bits into the bitstream.
[0259] It is understood that the first memory 1202 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The first memory 1202 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0260] The first processor 1203 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in the first processor 1203. The above-mentioned first processor 1203 can 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. The various methods, steps, and logic block diagrams disclosed in the embodiments of this application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the first memory 1202 , and the first processor 1203 reads the information in the first memory 1202 and completes the steps of the above method in combination with its hardware.
[0261] It is understood that the embodiments described herein can be implemented with 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 (DSP 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 the present application or a combination thereof. For software implementation, the technology of the present application can be implemented by a module (such as a process, a function, etc.) that performs the functions of the present application. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.
[0262] Optionally, as another embodiment, the first processor 1203 is further configured to execute any one of the methods in the foregoing embodiments when running a computer program.
[0263] This embodiment provides an encoder in which the correlation between the template and the current block is fully utilized to add one or more planar intra-frame prediction modes as candidate prediction modes to the TIMD mode, so that the TIMD mode can adaptively select a more matching prediction mode based on the template, thereby improving the prediction effect of the TIMD mode and thus improving the coding efficiency.
[0264] In yet another embodiment of the present application, based on the same inventive concept as the above embodiment, see FIG13 , which shows a schematic diagram of the structure of a decoder 1300 provided in an embodiment of the present application. As shown in FIG13 , the decoder 1300 may include: a decoding unit 1301 and a second prediction unit 1302; wherein:
[0265] The decoding unit 1301 is configured to decode the bitstream and determine the prediction parameters of the current block;
[0266] The second prediction unit 1302 is configured to determine a prediction cost value of a candidate prediction mode based on the template of the current block when the prediction parameter indicates that the template-based intra mode derivation mode is used to determine the prediction value of the current block, wherein the candidate prediction mode includes one or more planar intra prediction modes;
[0267] The second prediction unit 1302 is further configured to determine a target prediction mode of the current block according to the prediction cost value of the candidate prediction mode; and determine a prediction value of the current block according to the target prediction mode.
[0268] In some embodiments, the second prediction unit 1302 is further configured to determine a candidate prediction mode according to a prediction mode of a reconstructed reference block of the current block, wherein the reference block includes adjacent blocks and / or non-adjacent blocks of the current block.
[0269] In some embodiments, the second prediction unit 1302 is configured to, when the prediction mode of the reference block includes the first plane intra-frame prediction mode, determine that the candidate prediction mode includes the first plane intra-frame prediction mode, wherein the first plane intra-frame prediction mode includes one or more plane intra-frame prediction modes; and when the prediction mode of the reference block does not include the first plane intra-frame prediction mode, determine that the candidate prediction mode includes the prediction mode of the reference block and the first plane intra-frame prediction mode.
[0270] In some embodiments, the second prediction unit 1302 is configured to determine that the candidate prediction modes include a prediction mode of a reference block and one or more planar intra prediction modes.
[0271] In some embodiments, the second prediction unit 1302 is configured to, when none of the prediction modes of the reference block are available, determine that the candidate prediction mode also includes a planar prediction mode; or, when the prediction mode of the reference block is available but does not include an angle prediction mode, determine that the candidate prediction mode also includes a planar prediction mode and a direct current prediction mode; or, when the prediction mode of the reference block includes an angle prediction mode, construct a most likely prediction mode list based on the prediction mode of the reference block, and determine at least one wide angle prediction mode of the reference block, wherein the most likely prediction mode list includes one or more prediction modes; determine that the candidate prediction mode includes one or more prediction modes in the most likely prediction mode list, at least one wide angle prediction mode, a direct current prediction mode, one or more prediction modes of a vertical angle prediction mode and a horizontal angle prediction mode.
[0272] In some embodiments, the second prediction unit 1302 is configured to obtain block vectors of one or more reference blocks when the prediction mode of the reference block includes a prediction mode based on a block vector; and determine a candidate block vector of the current block based on the block vectors of the one or more reference blocks.
[0273] In some embodiments, the one or more planar intra prediction modes include one or more of a planar prediction mode, a horizontal plane prediction mode, and a vertical plane prediction mode.
[0274] In some embodiments, the second prediction unit 1302 is configured to use the candidate prediction mode to predict the template of the current block and determine the first predicted sample value of the template of the current block; and determine the prediction cost value of the candidate prediction mode based on the first reconstructed sample value and the first predicted sample value of the template of the current block.
[0275] In some embodiments, the second prediction unit 1302 is configured to determine a first intra-frame prediction mode corresponding to a minimum prediction cost value based on the prediction cost values of the candidate prediction modes; and determine a second intra-frame prediction mode corresponding to a second minimum cost value based on the prediction cost values of the candidate prediction modes, wherein the second intra-frame prediction mode includes one or more intra-frame prediction modes.
[0276] In some embodiments, the second prediction unit 1302 is configured to, when the first intra-frame prediction mode is a horizontal plane prediction mode or a vertical plane prediction mode, predict the current block according to the first intra-frame prediction mode to determine a prediction value of the current block; or, when the first intra-frame prediction mode is a horizontal plane prediction mode or a vertical plane prediction mode, and the second intra-frame prediction mode is a preset intra-frame prediction mode, perform weighted prediction on the current block according to the first intra-frame prediction mode and the second intra-frame prediction mode to determine a prediction value of the current block.
[0277] In some embodiments, the second prediction unit 1302 is configured to determine the reference sample value of the current block when the prediction parameters indicate that the current block uses a multi-reference row intra-frame prediction mode, wherein the reference sample value includes multiple rows of reconstructed sample values reconstructed on the upper side of the current block and / or multiple columns of reconstructed sample values reconstructed on the left side of the current block; and predict the current block using the target prediction mode according to the reference sample value of the current block to obtain a predicted value of the current block.
[0278] In some embodiments, the second prediction unit 1302 is configured to determine the reference sample value of the sub-block of the current block when the prediction parameter indicates that the current block uses the intra-frame sub-block partitioning mode, wherein the reference sample value includes one or more rows of reconstructed sample values on the upper side of the sub-block and / or one or more columns of reconstructed sample values on the left side of the sub-block; and predict the sub-block using the target prediction mode according to the reference sample value of the sub-block to obtain a predicted value of the sub-block.
[0279] In some embodiments, the second prediction unit 1302 is configured to perform geometric segmentation on the current block when the prediction parameters indicate that the current block uses a spatial geometric segmentation mode; predict the first partition using the target prediction mode based on the reference sample value of the first partition in the current block to obtain a prediction value of the first partition.
[0280] In some embodiments, the target prediction mode is a horizontal plane prediction mode or a vertical plane prediction mode.
[0281] Based on the composition of the decoder 1300 and the computer-readable storage medium, refer to Figure 14, which shows a specific hardware structure diagram of the decoder 1300 provided in an embodiment of the present application. As shown in Figure 14, the decoder 1300 may include: a second communication interface 1401, a second memory 1402 and a second processor 1403; each component is coupled together through a second bus system 1404. It can be understood that the second bus system 1404 is used to achieve connection and communication between these components. In addition to the data bus, the second bus system 1404 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are labeled as the second bus system 1404 in Figure 14. Among them,
[0282] The second communication interface 1401 is used to receive and send signals during the process of sending and receiving information between other external network elements;
[0283] The second memory 1402 is used to store computer programs that can be run on the second processor 1403;
[0284] The second processor 1403 is configured to, when running the computer program, execute:
[0285] Decode the code stream and determine the prediction parameters of the current block;
[0286] In a case where the prediction parameter indicates that a prediction value of the current block is determined using a template-based intra mode derivation mode, determining a prediction cost value of a candidate prediction mode based on the template of the current block, wherein the candidate prediction mode includes one or more planar intra prediction modes;
[0287] Determining a target prediction mode for the current block based on the prediction cost values of the candidate prediction modes;
[0288] According to the target prediction mode, the prediction value of the current block is determined.
[0289] It can be understood that the hardware functions of the second memory 1402 and the first memory 1202 are similar, and the hardware functions of the second processor 1403 and the first processor 1203 are similar; they will not be described in detail here.
[0290] This embodiment provides a decoder in which the correlation between the template and the current block is fully utilized to add one or more planar intra-frame prediction modes as candidate prediction modes to the TIMD mode, so that the TIMD mode can adaptively select a more matching prediction mode based on the template, thereby improving the prediction effect of the TIMD mode and thus improving decoding efficiency.
[0291] In yet another embodiment of the present application, referring to FIG15 , a schematic diagram of the structure of a coding and decoding system provided by an embodiment of the present application is shown. As shown in FIG15 , the coding and decoding system 150 may include an encoder 1501 and a decoder 1502 .
[0292] In the embodiment of the present application, the encoder 1501 may be the encoder of any one of the aforementioned embodiments, and the decoder 1502 may be the decoder of any one of the aforementioned embodiments.
[0293] It should be noted that, in this application, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0294] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0295] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0296] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0297] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0298] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims. Industrial Applicability
[0299] The embodiments of the present application provide a coding and decoding method, an encoder, a decoder, and a storage medium. Whether at the encoding end or the decoding end, when a template-based intra-frame mode derivation mode (TIMD mode) is used to determine the prediction value of the current block, a prediction cost value of a candidate prediction mode is determined based on the template of the current block, wherein the candidate prediction mode includes one or more planar intra-frame prediction modes; based on the prediction cost value of the candidate prediction mode, a target prediction mode of the current block is determined; and based on the target prediction mode, a prediction value of the current block is determined. In this way, the correlation between the template and the current block is fully utilized, and one or more planar intra-frame prediction modes are added to the TIMD mode as candidate prediction modes, so that the TIMD mode can adaptively select a more matching prediction mode based on the template, thereby improving the prediction effect of the TIMD mode and thus improving coding and decoding efficiency.
Claims
1. A decoding method, applied to a decoder, the method comprising: Decoding a bitstream to determine prediction parameters of a current block; When the prediction parameters indicate using an in - frame mode derivation mode based on a template to determine the prediction value of the current block, determining a prediction cost value of a candidate prediction mode based on the template of the current block, wherein the candidate prediction mode includes one or more planar in - frame prediction modes; Determining a target prediction mode of the current block according to the prediction cost value of the candidate prediction mode; Determining the prediction value of the current block according to the target prediction mode.
2. The method according to claim 1, wherein, The method further comprises: Determining the candidate prediction mode according to the prediction mode of the reconstructed reference block of the current block, wherein the reference block includes adjacent blocks and / or non - adjacent blocks of the current block.
3. The method according to claim 2, wherein, The determining the candidate prediction mode according to the prediction mode of the reconstructed reference block of the current block includes: When the prediction mode of the reference block includes a first planar in - frame prediction mode, determining that the candidate prediction mode includes the first planar in - frame prediction mode, wherein the first planar in - frame prediction mode includes one or more planar in - frame prediction modes; When the prediction mode of the reference block does not include the first planar in - frame prediction mode, determining that the candidate prediction mode includes the prediction mode of the reference block and the first planar in - frame prediction mode.
4. The method according to claim 2, wherein, The determining the candidate prediction mode according to the prediction mode of the reconstructed reference block of the current block includes: Determining that the candidate prediction mode includes the prediction mode of the reference block and the one or more planar in - frame prediction modes.
5. The method according to claim 3 or 4, wherein The determining the candidate prediction mode according to the prediction mode of the reconstructed reference block of the current block further includes: When the prediction modes of the reference blocks are all unavailable, determining that the candidate prediction mode further includes a planar prediction mode; or, When the prediction modes of the reference blocks are available but do not include an angular prediction mode, determining that the candidate prediction mode further includes a planar prediction mode and a DC prediction mode; or, When the prediction mode of the reference block includes an angular prediction mode, constructing a most - likely prediction mode list according to the prediction mode of the reference block, and determining at least one wide - angle prediction mode of the reference block, wherein the most - likely prediction mode list includes one or more prediction modes; Determining that the candidate prediction mode includes one or more prediction modes in the most - likely prediction mode list, the at least one wide - angle prediction mode, a DC prediction mode, a vertical - angle prediction mode, and a horizontal - angle prediction mode.
6. The method according to claim 3 or 4, wherein, The determining the candidate prediction mode according to the prediction mode of the reconstructed reference block of the current block further includes: When the prediction mode of the reference block includes a prediction mode based on a block vector, obtaining block vectors of one or more reference blocks; Determining a candidate block vector of the current block according to the block vectors of the one or more reference blocks.
7. The method according to any one of claims 1 to 6, wherein, The one or more planar in - frame prediction modes include one or more of a planar prediction mode, a horizontal - plane prediction mode, and a vertical - plane prediction mode.
8. The method according to claim 1, wherein Determining a prediction cost value of a candidate prediction mode based on the template of the current block includes: Using the candidate prediction mode to perform prediction on the template of the current block to determine a first predicted sample value of the template of the current block; Determining a prediction cost value of the candidate prediction mode according to a first reconstructed sample value and the first predicted sample value of the template of the current block.
9. The method according to claim 1, wherein Determining a target prediction mode of the current block according to the prediction cost value of the candidate prediction mode includes: Determining a first intra-frame prediction mode corresponding to the minimum prediction cost value according to the prediction cost value of the candidate prediction mode; Determining a second intra-frame prediction mode corresponding to the second smallest cost value according to the prediction cost value of the candidate prediction mode, where the second intra-frame prediction mode includes one or more intra-frame prediction modes.
10. The method according to claim 9, wherein, Determining a predicted value of the current block according to the target prediction mode includes: If the first intra-frame prediction mode is a horizontal plane prediction mode or a vertical plane prediction mode, performing prediction on the current block according to the first intra-frame prediction mode to determine a predicted value of the current block; or, If the first intra-frame prediction mode is a horizontal plane prediction mode or a vertical plane prediction mode, and the second intra-frame prediction mode is a preset intra-frame prediction mode, performing weighted prediction on the current block according to the first intra-frame prediction mode and the second intra-frame prediction mode to determine a predicted value of the current block. Determining a predicted value of the current block according to the target prediction mode includes:
11. The method according to claim 1, wherein, When the prediction parameter indicates that the current block uses a multi-reference row intra-frame prediction mode, determining a reference sample value of the current block, where the reference sample value includes multiple reconstructed sample values reconstructed above the current block, and / or multiple reconstructed sample values reconstructed to the left of the current block; Performing prediction on the current block according to the reference sample value of the current block by using the target prediction mode to obtain a predicted value of the current block. Determining a predicted value of the current block according to the target prediction mode includes:
12. The method according to claim 1 or 11, wherein When the prediction parameter indicates that the current block uses an intra-frame sub-block partitioning mode, determining a reference sample value of a sub-block of the current block, where the reference sample value includes one or more reconstructed sample values reconstructed above the sub-block, and / or one or more reconstructed sample values reconstructed to the left of the sub-block; Performing prediction on the sub-block according to the reference sample value of the sub-block by using the target prediction mode to obtain a predicted value of the sub-block. Determining a predicted value of the current block according to the target prediction mode includes:
13. The method according to claim 1 or 11, wherein When the prediction parameter indicates that the current block uses a spatial geometric partitioning mode, performing geometric partitioning on the current block; Performing prediction on the first partition according to the reference sample value in the first partition of the current block by using the target prediction mode to obtain a predicted value of the first partition. The target prediction mode is a horizontal plane prediction mode or a vertical plane prediction mode.
14. The method according to any one of claims 11 to 13, wherein, 15. An encoding method applied to an encoder, the method includes: Determine the prediction cost value of candidate prediction modes based on the template of the current block, where the candidate prediction modes include one or more planar intra prediction modes; Determine the target prediction mode of the current block according to the prediction cost value of the candidate prediction modes; Determine the predicted value of the current block according to the target prediction mode; Make an encoding decision according to the predicted value of the current block, and determine the prediction parameter of the current block, where the prediction parameter is used to indicate whether to use the intra mode derivation mode based on the template to determine the predicted value of the current block; Encode the prediction parameter and write the obtained encoded bits into the bitstream.
16. The method according to claim 15, wherein, The method further includes: Determine the candidate prediction modes according to the prediction modes of the reconstructed reference blocks of the current block, where the reference blocks include adjacent blocks and / or non-adjacent blocks of the current block.
17. The method according to claim 16, wherein, The determining the candidate prediction modes according to the prediction modes of the reconstructed reference blocks of the current block includes: When the prediction mode of the reference block includes a first planar intra prediction mode, determine that the candidate prediction modes include the first planar intra prediction mode, where the first planar intra prediction mode includes one or more planar intra prediction modes; When the prediction mode of the reference block does not include the first planar intra prediction mode, determine that the candidate prediction modes include the prediction mode of the reference block and the first planar intra prediction mode.
18. The method according to claim 16, wherein The determining the candidate prediction modes according to the prediction modes of the reconstructed reference blocks of the current block includes: Determine that the candidate prediction modes include the prediction mode of the reference block and the one or more planar intra prediction modes.
19. The method according to claim 17 or 18, wherein The determining the candidate prediction modes according to the prediction modes of the reconstructed reference blocks of the current block further includes: When the prediction modes of the reference blocks are all unavailable, determine that the candidate prediction modes further include a planar prediction mode; or, When the prediction modes of the reference blocks are available but do not include an angular prediction mode, determine that the candidate prediction modes further include a planar prediction mode and a DC prediction mode; or, When the prediction modes of the reference blocks include an angular prediction mode, construct a most likely prediction mode list according to the prediction modes of the reference blocks, and determine at least one wide-angle prediction mode of the reference blocks, where the most likely prediction mode list includes one or more prediction modes; Determine that the candidate prediction modes include one or more prediction modes in the most likely prediction mode list, the at least one wide-angle prediction mode, the DC prediction mode, the vertical angular prediction mode, and the horizontal angular prediction mode.
20. The method according to claim 17 or 18, wherein The determining the candidate prediction modes according to the prediction modes of the reconstructed reference blocks of the current block further includes: When the prediction mode of the reference block includes a block vector-based prediction mode, obtain the block vectors of one or more reference blocks; Determine the candidate block vectors of the current block according to the block vectors of the one or more reference blocks.
21. The method according to any one of claims 15 to 20, wherein, The one or more planar intra prediction modes include one or more of a planar prediction mode, a horizontal planar prediction mode, and a vertical planar prediction mode.
22. The method according to claim 15, wherein, Determining a prediction cost value of a candidate prediction mode based on the template of the current block includes: Performing prediction on the template of the current block by using the candidate prediction mode to determine a first predicted sample value of the template of the current block; Determining the prediction cost value of the candidate prediction mode according to a first reconstructed sample value and the first predicted sample value of the template of the current block.
23. The method according to claim 15, wherein, Determining the target prediction mode of the current block according to the prediction cost value of the candidate prediction mode includes: Determining a first intra prediction mode corresponding to the minimum prediction cost value according to the prediction cost value of the candidate prediction mode; Determining a second intra prediction mode corresponding to the second smallest cost value according to the prediction cost value of the candidate prediction mode, where the second intra prediction mode includes one or more intra prediction modes.
24. The method according to claim 23, wherein, Determining the predicted value of the current block according to the target prediction mode includes: If the first intra prediction mode is a horizontal planar prediction mode or a vertical planar prediction mode, predicting the current block according to the first intra prediction mode to determine the predicted value of the current block; or If the first intra prediction mode is a horizontal planar prediction mode or a vertical planar prediction mode and the second intra prediction mode is a preset intra prediction mode, performing weighted prediction on the current block according to the first intra prediction mode and the second intra prediction mode to determine the predicted value of the current block.
25. The method according to claim 15, wherein Determining the predicted value of the current block according to the target prediction mode includes: Determining a reference sample value of the current block, where the reference sample value includes multiple reconstructed sample values reconstructed above the current block and / or multiple reconstructed sample values reconstructed to the left of the current block; Predicting the current block according to the reference sample value of the current block by using the target prediction mode to obtain the predicted value of the current block; Wherein, the prediction parameter is further used to indicate whether the current block uses a multi-reference row intra prediction mode.
26. The method according to claim 15 or 25, wherein Determining the predicted value of the current block according to the target prediction mode includes: Dividing the current block by using an intra sub-block partitioning mode to determine a reference sample value of a sub-block of the current block, where the reference sample value includes one or more reconstructed sample values reconstructed above the sub-block and / or one or more reconstructed sample values reconstructed to the left of the sub-block; Predicting the sub-block according to the reference sample value of the sub-block by using the target prediction mode to obtain the predicted value of the sub-block; Wherein, the prediction parameter is further used to indicate whether the current block uses an intra sub-block partitioning mode; 27. The method according to claim 15 or 25, wherein Determining the predicted value of the current block according to the target prediction mode includes: Dividing the current block by using a spatial domain geometric segmentation mode to determine a reference sample value of a first partition of the current block; Predicting the first partition according to the reference sample value of the first partition in the current block by using the target prediction mode to obtain the predicted value of the first partition, Among them, the prediction parameter is further used to indicate whether the current block uses a spatial geometric segmentation mode.
28. The method according to any one of claims 25 to 27, wherein, The target prediction mode is a horizontal plane prediction mode or a vertical plane prediction mode.
29. An encoder, comprising a first prediction unit, a first determination unit, and an encoding unit; wherein: The first prediction unit is configured to determine the prediction cost value of a candidate prediction mode based on the template of the current block, wherein the candidate prediction mode includes one or more planar intra prediction modes; The first prediction unit is further configured to determine the target prediction mode of the current block according to the prediction cost value of the candidate prediction mode; and determine the predicted value of the current block according to the target prediction mode; The first determination unit is configured to make an encoding decision according to the predicted value of the current block, and determine the prediction parameter of the current block, wherein the prediction parameter is used to indicate whether to use the intra-mode derivation mode based on the template to determine the predicted value of the current block; The encoding unit is configured to encode the prediction parameter and write the obtained encoded bits into the code stream.
30. An encoder, comprising a first memory and a first processor; wherein: The first memory is used to store a computer program that can run on the first processor; The first processor is configured to execute the method according to any one of claims 15 to 28 when running the computer program.
31. A decoder, comprising a decoding unit and a second prediction unit; wherein: The decoding unit is configured to decode the code stream and determine the prediction parameter of the current block; The second prediction unit is configured to, when the prediction parameter indicates that the intra-mode derivation mode based on the template is used to determine the predicted value of the current block, determine the prediction cost value of the candidate prediction mode based on the template of the current block, wherein the candidate prediction mode includes one or more planar intra prediction modes; The second prediction unit is further configured to determine the target prediction mode of the current block according to the prediction cost value of the candidate prediction mode; and determine the predicted value of the current block according to the target prediction mode.
32. A decoder, comprising a second memory and a second processor; wherein: The second memory is used to store a computer program that can run on the second processor; The second processor is configured to execute the method according to any one of claims 1 to 14 when running the computer program. The computer-readable storage medium stores the code stream generated by the encoding method according to any one of claims 15 to 28.
33. A computer-readable storage medium, wherein, The computer-readable storage medium stores a computer program, and when the computer program is executed, it implements the method according to any one of claims 1 to 14, or implements the method according to any one of claims 15 to 28.
34. A computer-readable storage medium, wherein,