Encoding method, decoding method, encoder, decoder, and storage medium

By fusing the predicted values ​​of luminance and chrominance components in the chroma TMRL mode, the problem of inaccurate prediction values ​​in the chroma TMRL mode in certain scenarios is solved, thus improving encoding and decoding efficiency.

WO2026097291A1PCT designated stage Publication Date: 2026-05-15GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2024-11-06
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

The existing chroma TMRL mode does not provide accurate predictions in certain scenarios, which affects coding efficiency.

Method used

A template-based multi-reference line intra-frame prediction mode is adopted, and the predicted values ​​of luminance and chrominance components are fused to generate the final predicted value.

Benefits of technology

It improves the prediction accuracy and diversity in chroma TMRL mode, thereby enhancing encoding and decoding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024130344_15052026_PF_FP_ABST
    Figure CN2024130344_15052026_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in embodiments of the present application are an encoding method, a decoding method, an encoder, a decoder, and a storage medium. The method comprises: determining a first predicted value when a chroma component of a current block uses a template-based multiple reference line (TMRL) intra prediction mode; determining a second predicted value when the chroma component of the current block uses a first prediction mode; and determining a predicted value of the current block on the basis of the first predicted value and the second predicted value. In this way, the accuracy and diversity of prediction in a chroma TMRL mode can be improved, thereby improving encoding and decoding efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Encoding / decoding methods, encoders, decoders, and storage media Technical Field

[0001] This application relates to the field of video encoding and decoding technology, and in particular to an encoding and decoding method, encoder, decoder, and storage medium. Background Technology

[0002] The H.266 / Versatile Video Coding (VVC) standard employs Multiple Reference Line (MRL) prediction technology, which expands the available reference lines from the adjacent reference line 0 to reference line 0, reference line 1, and reference line 3. MRL prediction technology can be combined with Most Probable Mode (MPM) for prediction.

[0003] To further improve coding performance, a template-based multiple reference line intra-prediction (TMRL) mode was proposed. However, the chroma TMRL mode in related technologies only uses the intra-prediction mode and the corresponding reference line pixels to determine the chroma prediction value of the current block. However, in some scenarios, the prediction value obtained using only the chroma TMRL mode is still not accurate enough, which has an adverse effect on coding efficiency.

[0004] Summary of the Invention

[0005] This application provides an encoding / decoding method, encoder, decoder, and storage medium that can improve the accuracy and diversity of predictions in chroma TMRL mode, thereby improving encoding / decoding efficiency.

[0006] The technical solution of this application embodiment can be implemented as follows:

[0007] In a first aspect, embodiments of this application provide a decoding method applied to a decoder, the method comprising:

[0008] Determine the first prediction value of the chroma components of the current block when using the template-based multi-reference line intra-prediction mode;

[0009] Determine the second prediction value when the chromaticity components of the current block use the first prediction mode;

[0010] The predicted value for the current block is determined based on the first and second predicted values.

[0011] Secondly, embodiments of this application provide an encoding method applied to an encoder, the method comprising:

[0012] Determine the first prediction value of the chroma components of the current block when using the template-based multi-reference line intra-prediction mode;

[0013] Determine the second prediction value when the chromaticity components of the current block use the first prediction mode;

[0014] The predicted value for the current block is determined based on the first and second predicted values.

[0015] Thirdly, embodiments of this application provide an encoder, which includes a first determining unit, wherein:

[0016] The first determining unit is configured to determine a first prediction value when the chroma components of the current block use a template-based multi-reference line intra-prediction mode; and to determine a second prediction value when the chroma components of the current block use the first prediction mode.

[0017] The first determining unit is further configured to determine the predicted value of the current block based on the first predicted value and the second predicted value.

[0018] Fourthly, embodiments of this application provide an encoder, which includes a first memory and a first processor, wherein:

[0019] A first memory for storing computer programs that can run on a first processor;

[0020] A first processor is configured to execute the encoding method as described in the second aspect when running a computer program.

[0021] Fifthly, embodiments of this application provide a decoder, which includes a second determining unit, wherein:

[0022] The second determining unit is configured to determine a first prediction value when the chroma components of the current block use a template-based multi-reference line intra-prediction mode; and to determine a second prediction value when the chroma components of the current block use the first prediction mode.

[0023] The second determining unit is further configured to determine the predicted value of the current block based on the first predicted value and the second predicted value.

[0024] Sixthly, embodiments of this application provide a decoder, which includes a second memory and a second processor, wherein:

[0025] The second memory is used to store computer programs that can run on the second processor;

[0026] The second processor is used to execute the decoding method as described in the first aspect when running a computer program.

[0027] In a seventh aspect, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the decoding method as described in the first aspect or the encoding method as described in the second aspect.

[0028] Eighthly, embodiments of this application provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the decoding method as described in the first aspect or the encoding method as described in the second aspect.

[0029] In a ninth aspect, embodiments of this application provide a computer-readable storage medium having a bitstream stored thereon, the bitstream being generated by performing the steps of the encoding method as described in the second aspect.

[0030] This application provides an encoding / decoding method, encoder, decoder, and storage medium. At both the encoding and decoding ends, a first prediction value is determined when the chroma components of the current block use a template-based multi-reference line intra-frame prediction mode; and a second prediction value is determined when the chroma components of the current block use the first prediction mode; then, based on the first and second prediction values, the prediction value of the current block is determined. Thus, when the current block uses a chroma TMRL mode fusion method, the first prediction value obtained from the chroma TMRL mode can be fused with the second prediction values ​​obtained from other chroma modes (e.g., the first prediction mode) to generate a fused final prediction value. This improves the prediction accuracy under the chroma TMRL mode, and since the first prediction mode can be any chroma mode, it also increases the prediction diversity under the chroma TMRL mode, thereby improving encoding / decoding efficiency and ultimately enhancing encoding / decoding performance. Attached Figure Description

[0031] Figure 1 is a schematic diagram of the prediction process of a TMRL model;

[0032] Figure 2 is a schematic diagram of a process for obtaining chromaticity TMRL mode prediction values ​​at the encoding end;

[0033] Figure 3 is a schematic diagram of the structure of a co-position luminance block and an adjacent chrominance block;

[0034] Figure 4 is a schematic diagram of the template area of ​​a chromaticity TMRL mode;

[0035] Figure 5 is a schematic diagram of a multi-reference row structure of a chromaticity TMRL mode;

[0036] Figure 6 is a schematic diagram of a predicted value generation method based on reference rows;

[0037] Figure 7 is a schematic diagram of the process of parsing syntax elements at the decoding end;

[0038] Figure 8 is a schematic diagram of a process for obtaining chroma reconstruction values ​​at the decoding end;

[0039] Figure 9 is a schematic diagram of the process for obtaining the chromaticity TMRL mode prediction value at the decoding end;

[0040] Figure 10 is a schematic diagram of a non-cross-component mode fusion prediction process;

[0041] Figure 11 is a schematic diagram of a video encoding and decoding network architecture provided in an embodiment of this application;

[0042] Figure 12 is a schematic block diagram of an encoder provided in an embodiment of this application;

[0043] Figure 13 is a schematic block diagram of a decoder provided in an embodiment of this application;

[0044] Figure 14 is a schematic flowchart of a decoding method provided in an embodiment of this application;

[0045] Figure 15 is a schematic flowchart of a decoding method provided in an embodiment of this application;

[0046] Figure 16 is a schematic flowchart of a decoding method provided in an embodiment of this application;

[0047] Figure 17 is a schematic flowchart of a decoding method provided in an embodiment of this application;

[0048] Figure 18 is a flowchart illustrating an encoding method provided in an embodiment of this application;

[0049] Figure 19 is a schematic diagram of the fusion prediction process of a chroma TMRL mode at the encoding end provided in an embodiment of this application;

[0050] Figure 20 is a schematic diagram of a decoding end parsing syntax elements according to an embodiment of this application;

[0051] Figure 21 is a schematic diagram of a decoding end obtaining chroma reconstruction values ​​according to an embodiment of this application;

[0052] Figure 22 is a schematic diagram of a decoding end chroma TMRL mode fusion prediction process provided in an embodiment of this application;

[0053] Figure 23 is a schematic diagram of the composition structure of an encoder provided in an embodiment of this application;

[0054] Figure 24 is a schematic diagram of the hardware structure of an encoder provided in an embodiment of this application;

[0055] Figure 25 is a schematic diagram of the composition structure of a decoder provided in an embodiment of this application;

[0056] Figure 26 is a schematic diagram of the hardware structure of a decoder provided in an embodiment of this application;

[0057] Figure 27 is a schematic diagram of the composition structure of an encoding / decoding system provided in an embodiment of this application. Detailed Implementation

[0058] In order to gain a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments of this application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for reference and illustration only and are not intended to limit the embodiments of this application.

[0059] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0060] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0061] It should also be noted that the terms "first, second, and third" used in the embodiments of this application are only used to distinguish similar objects and do not represent a specific order of objects. It is understood that "first, second, and third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0062] In video images, a first color component, a second color component, and a third color component are generally used to represent a coding block (CB). These three color components are a luma component, a blue chroma component, and a red chroma component, respectively. Specifically, the luma component is usually represented by the symbol Y, the blue chroma component is usually represented by the symbol Cb or U, and the red chroma component is usually represented by the symbol Cr or V. Thus, video images can be represented in YCbCr format or YUV format.

[0063] Before providing a further detailed description of the embodiments of this application, the nouns and terms used in the embodiments of this application will be explained. The nouns and terms used in the embodiments of this application shall be interpreted as follows:

[0064] H.266 / Versatile Video Coding (VVC);

[0065] VVC's reference software testing platform (VVC Test Model, VTM);

[0066] Enhanced Compression Model (ECM);

[0067] Joint Video Experts Team (JVET);

[0068] Coding Unit (CU);

[0069] Multiple Reference Line Intra Prediction (MRL);

[0070] Most Probable Mode (MPM);

[0071] Template-based Multiple Reference Line Intra Prediction (TMRL)

[0072] Template-based Intra Mode Derivation (TIMD);

[0073] Cross-Component Prediction (CCP);

[0074] Convolutional Cross-component Model (CCCM);

[0075] Cross-Component Linear Model (CCLM);

[0076] Multi-model Linear Mode (MMLM);

[0077] Gradient Linear Model (GLM);

[0078] Multi-model Based Cross-component Linear Model (MM-CCLM);

[0079] Multi-model Based Convolutional Cross-component Model (MM-CCCM);

[0080] Decoder-side Intra Mode Derivation (DIMD);

[0081] Direct export mode (DM);

[0082] Direct Block Vector (DBV);

[0083] Peak Signal-to-Noise Ratio (PSNR);

[0084] Mean-square error (MSE);

[0085] Mean Absolute Error (MAE);

[0086] Root Mean Squared Error (RMSE);

[0087] Sum of Absolute Difference (SAD);

[0088] Sum of Absolute Transform-based Difference (SATD)

[0089] Understandably, the following section will first introduce the TMRL mode.

[0090] H.266 / VVC employs MRL prediction technology, expanding the available reference lines from adjacent reference line 0 to reference line 0, reference line 1, and reference line 3. MRL can be combined with the Most Probable Mode (MPM) for prediction (e.g., the angle prediction mode with mode number 34 uses reference line 3 to generate the predicted value). To further improve coding performance, a TMRL mode is proposed in one implementation, replacing the conventional MRL mode for the luma component in non-TIMD modes. The TMRL mode, based on MRL prediction technology, uses template cost to sort candidate combinations of reference lines and prediction modes, and identifies the actual selected combination through an index transmitted in the bitstream. In another possible implementation, a chroma TMRL mode is further proposed, applying this technology to the chroma component to improve chroma coding performance.

[0091] Specifically, when implementing the TMRL encoding method for luma or chroma, at the encoding end, a reference row candidate list (M types) and a prediction mode list (N types) are first constructed. Then, the reference rows and prediction modes are combined pairwise to form a combination candidate list (P = M × N types). The combination candidate list is sorted using template cost, and the top T combination modes (T ≤ P) are retained. If the TMRL mode is selected in the encoding end decision, the index of the combination mode in the template-sorted combination candidate list needs to be encoded to indicate the reference row and intra-frame prediction mode used when encoding the current block. At the decoding end, the template-sorted combination candidate list is determined in the same way as at the encoding end. Combined with the index obtained from parsing the bitstream, the reference row and intra-frame prediction mode used in the current block can be obtained, and the prediction value under the TMRL mode can be obtained.

[0092] In one possible implementation, taking the decoding end as an example, Figure 1 is a schematic diagram of a prediction process for a TMRL mode. As shown in Figure 1, the prediction process may include:

[0093] S101, Obtain a combined candidate list of reference line and intra-frame prediction modes.

[0094] S102, sort the candidate list of combinations using a template.

[0095] S103, based on the TMRL mode index obtained from decoding, determine the reference line and intra-prediction mode used by the current block.

[0096] S104, determine the predicted value of the current block.

[0097] Here, TMRL modes can be divided into luma TMRL mode and chroma TMRL mode according to the different application components. The basic ideas of luma TMRL mode and chroma TMRL mode are the same. In specific implementation, there are the following differences: The maximum reference row candidate list of luma TMRL mode is {1, 3, 5, 7, 12}, the number of intra-prediction mode candidate list is 10 and comes from the MPM list, and the template is the row above and the column to the left of the current luma CU; The maximum reference row candidate list of chroma TMRL mode is {1, 3, 5}, the number of intra-prediction mode candidate list is 8, and the template is the same luma region and the row above and the column to the left of the current chroma CU.

[0098] The prediction process of the chromatic TMRL mode will be described in detail below.

[0099] (1) Encoder-side prediction process:

[0100] The prediction process for chroma TMRL mode consists of three steps: obtaining a combined candidate list of reference lines and intra-prediction modes, sorting the combined candidate list using a template, and obtaining the prediction value for the current block. The flowchart of this process is shown in Figure 2, and the prediction process may include:

[0101] S201, Obtain a combined candidate list of reference line and intra-frame prediction modes.

[0102] In this embodiment, for step S201, firstly, a candidate list of reference rows for the chroma TMRL mode is determined. An example of obtaining the candidate reference rows is as follows: If the chroma TMRL mode is available (the y-coordinate of the current chroma block is not less than 4), the maximum number of available candidate reference rows for the current chroma TMRL mode is {1,3,5}, i.e., reference row 1, reference row 3, and reference row 5. Then, based on the number of available reference rows for the current CU chroma component, the candidate reference rows for the current chroma TMRL mode are determined. For example, if the number of available reference rows for the current CU chroma component is 4, then the candidate reference rows for the current chroma TMRL mode are reference row 1 and reference row 3.

[0103] Secondly, the candidate list of intra-prediction modes for the chroma TMRL mode is determined. The candidate list can be composed of existing chroma intra-prediction modes not spanning components in the ECM, in-place luma modes, chroma modes of adjacent blocks, and the default intra-prediction mode. An example of obtaining intra-prediction mode candidates is as follows:

[0104] The build process may include:

[0105] a) Intra-frame non-cross-component prediction modes for chroma: DM, DIMD, DC modes.

[0106] b) Co-location Luminance Mode: The intra-frame prediction mode of the luminance CUs corresponding to the center C, upper left TL, upper right TR, lower left BL, and lower right BR positions within the co-location luminance region, as shown in Figure 3.

[0107] c) Prediction patterns of adjacent chromaticity blocks: chromaticity prediction patterns at positions L', T', BL', TR' and TL', as shown in Figure 3.

[0108] d) Default Intra-Prediction Mode: If the number of prediction mode candidates is still insufficient after steps a), b), and c), the default intra-prediction mode is continued to be added. The default intra-prediction mode is obtained by offsetting the first angular prediction mode in the current prediction mode candidate list; the offset can be {-1, +1, -2, +2, ...}. If this is still insufficient, the second angular prediction mode in the candidate list is offset and added, and so on.

[0109] Finally, by combining the reference row candidates (number of M, e.g., M≤3) and the intra-prediction mode candidates (number of N, e.g., N=8), P (P=M×N, e.g., M×N≤24) combination modes can be obtained.

[0110] S202, use a template to sort the candidate list of combinations.

[0111] In this embodiment, for step S202, before decoding, the co-position luminance component and the chrominance component of reference row 0 of the current CU have already been decoded to obtain reconstructed values. A feasible method for ranking candidate combinations of chrominance TMRL modes using template cost is as follows: using the co-position luminance and the chrominance region of the left column of the previous row as templates, applying combination modes (including reference row and intra-frame prediction modes) to the templates, calculating the predicted values ​​of the template regions under the combination mode, and calculating the error costY of the co-position luminance and the costCb of the chrominance in the left column of the previous row based on the predicted values ​​and reconstructed values ​​using SATD as the criterion. top costCb left costCr top and costCr left Accordingly, an example of template region selection is shown in Figure 4, which illustrates the template region in the chroma TMRL mode. The diagonal fill area indicates the template region, and the grid fill area indicates the reference row.

[0112] Accordingly, an example of template cost calculation is as follows: the template error cost is calculated according to formula (1): cost=8×costY+(costCb) top +costCr top ) << (2 + logH) + (costCb) left +costCr left ) << (2+logW) (1)

[0113] Where H represents the height of the current block and W represents the width of the current block. For all P (P = M × N) candidate combination patterns, their cost on the template is calculated, and all candidate patterns are sorted according to this cost to obtain a list of candidate combination patterns sorted by template cost. Only the top T (e.g., T = 6) combination patterns in the list are retained.

[0114] S203, determine the predicted values ​​under different combination modes.

[0115] In this embodiment, for step S203, based on the final retained candidate combination list (T types) in step S202, the i-th (0≤i<T) combination mode in the candidate list is selected, its corresponding reference row and intra-frame prediction mode are obtained, and the prediction value of the current combination mode is generated using the current CU reference row. This process includes two parts: obtaining the reference row pixel value and deriving the current block prediction value.

[0116] a) Obtain the reference row pixel value.

[0117] The available reference rows for the chroma TMRL mode include {1,3,5}, and the structure of multiple reference rows is shown in Figure 5.

[0118] When some pixels in the reference row are missing or unavailable, the nearest pixel in the reference row is used to fill the gap. If all pixels in the reference row are unavailable, all pixels in the current reference row are filled with a fixed value, the size of which is mid = 1 << (bitdepth - 1).

[0119] b) Derive the predicted value.

[0120] When generating prediction values, the more distant reference lines are treated similarly to reference line 0, where each pixel in the current block is projected along the direction onto the more distant reference line, and the projected pixel is used as the prediction value, as shown in Figure 6. If the projected pixel is located at a fractional position, the prediction value is obtained through a linear interpolation filter. The filter coefficients can be the inverse ratio of the distance between the fractional position of the projection and its two adjacent integer positions. In particular, for intra-frame prediction mode DC mode, the prediction value for all pixels in the current block is the average of the reference pixels in the upper row / left column / upper row + left column.

[0121] The predicted value for each combination mode is calculated by iterating through the final candidate combination list (T types) retained in step S202.

[0122] S204, determine the optimal combination pattern.

[0123] In this embodiment, for step S204, the cost is calculated for each combination mode in the final candidate combination list retained in step S202. The cost here can be a combination of distortion and bitrate; distortion represents prediction error, while bitrate reflects compression efficiency. An example of calculating the cost is as follows: cost=dist+λ×estbits (2)

[0124] Where dist represents distortion, with a value of dist = min{2×SAD,SATD}, λ is the Lagrange factor, and estbits is the estimated number of bits.

[0125] Based on the above costs, the T combination patterns are sorted, and the combination pattern with the lowest cost is taken as the optimal TMRL prediction pattern (i.e., the best combination pattern). The index of this pattern in the final candidate combination list retained in step S202 is recorded, and this index is denoted as Chroma TMRL Idx.

[0126] If the Chroma TMRL mode is selected in the encoding decision, the index Chroma TMRL Idx of the best combination mode in the candidate list after template sorting needs to be encoded to indicate the reference line and intra-prediction mode used when encoding the current block.

[0127] (2) Decoding and reconstruction process at the decoding end:

[0128] At the decoding end, the basic decoding process for obtaining the intra-chroma reconstruction block includes several steps such as parsing the syntax elements in the bitstream and obtaining the prediction residual, obtaining the prediction value, and determining the reconstruction value.

[0129] In one possible implementation, Figure 7 is a schematic diagram of a decoding process for parsing syntax elements. As shown in Figure 7, the process may include:

[0130] S701, parses the CCP Flag in the bitstream.

[0131] S702, determine CCP Flag.

[0132] S703, parsing CCP-related modes.

[0133] S704, Chroma TMRL Flag in the parsing bitstream.

[0134] S705, determine Chroma TMRL Flag.

[0135] S706, parse the Chroma TMRL Idx in the bitstream.

[0136] S707, parses other Non-CCP modes in the bitstream.

[0137] In this embodiment of the application, for step S702, if the value of CCP Flag is 1, then step S703 is executed, that is, parsing the CCP-related mode; if the value of CCP Flag is 0, then step S704 is executed, that is, parsing the Chroma TMRL Flag in the bitstream.

[0138] In this embodiment of the application, for step S705, if the value of Chroma TMRL Flag is 1, then step S706 is executed, that is, Chroma TMRL Idx in the bitstream is parsed; if the value of Chroma TMRL Flag is 0, then step S707 is executed, that is, other Non-CCP modes in the bitstream are parsed.

[0139] In another possible implementation, Figure 8 is a schematic diagram of a process for obtaining chroma reconstruction values ​​at the decoding end. As shown in Figure 8, the process may include:

[0140] S801, determine CCP Flag.

[0141] S802 obtains predicted values ​​based on chromaticity cross-component modes.

[0142] S803, determine Chroma TMRL Flag.

[0143] S804 obtains predicted values ​​based on TMRL mode.

[0144] S805 obtains prediction values ​​based on other chroma intra-frame prediction modes.

[0145] S806, obtain the intra-frame chroma block residual value.

[0146] S807, obtain intra-frame chroma reconstruction values.

[0147] In this embodiment, for step S801, if the CCP Flag is 1, then step S802 is executed, i.e., the predicted value is obtained based on the chroma cross-component mode; if the CCP Flag is 0, then step S803 is executed, i.e., the Chroma TMRL Flag is determined. If the Chroma TMRL Flag is 1, then step S804 is executed, i.e., the predicted value is obtained based on the TMRL mode; if the Chroma TMRL Flag is 0, then step S805 is executed, i.e., the predicted value is obtained based on other chroma intra-frame prediction modes. Then, the intra-frame chroma block residual value obtained in step S2006 is added to obtain the intra-frame chroma reconstruction value.

[0148] During the parsing of syntax elements, the CCP Flag (indicating whether it is a cross-component prediction mode) is parsed first to determine whether the current chroma block generates a prediction value through a cross-component correlation mode. If the prediction value is not generated by a CCP-related mode (CCP Flag is 0), the Chroma TMRL Flag (indicating whether it is a chroma TMRL mode) is parsed to determine whether the current chroma block generates a prediction value through a non-zero reference line. If the prediction value is generated by a TMRL-related mode (Croma TMRL Flag is 1), the Chroma TMRL Idx is parsed; if the prediction value is not generated by a TMRL-related mode (Croma TMRL Flag is 0), other chroma intra-frame prediction mode related syntax elements are parsed. For example, in one possible implementation, the related syntax semantics table for the CU layer Chroma TMRL mode is shown in Table 1.

[0149] Table 1

[0150] The `intra_tmrl_chroma_flag` flag indicates whether a chroma TMRL-related mode is used to generate the prediction value. For example, `intra_tmrl_chroma_flag` being 1 indicates that the intra-prediction mode for the chroma sample is a TMRL-related mode, while `intra_tmrl_chroma_flag` being 0 indicates that the intra-prediction mode for the chroma sample is not a TMRL-related mode. `intra_tmrl_chroma_idx` indicates the index of the chroma TMRL mode in the candidate list.

[0151] In another possible implementation, Figure 9 is a schematic diagram of a process for obtaining chroma TMRL mode prediction values ​​at the decoding end. As shown in Figure 9, this process may include:

[0152] S901, Obtain a combined candidate list of reference line and intra-frame prediction modes.

[0153] The decoding and encoding ends use the same method to construct the combined candidate list. That is, step S201 in obtaining the chroma TMRL mode prediction value is the same for both the decoding and encoding ends.

[0154] First, determine the candidate list of reference rows for the Chroma TMRL. One example of obtaining these candidates is as follows: If reference rows are available in the Chroma TMRL mode (the y-coordinate of the current chroma block is not less than 4), the maximum number of available reference rows for the current Chroma TMRL mode is {1, 3, 5}, i.e., reference rows 1, 3, and 5. Then, based on the number of available reference rows for the current CU chroma component, determine the candidate reference rows for the current Chroma TMRL mode. For example, if the number of available reference rows for the current CU chroma component is 4, then the candidate reference rows for the current Chroma TMRL mode are reference rows 1 and 3.

[0155] Secondly, the candidate list of intra-prediction modes for the chroma TMRL mode is determined. The candidate list can be composed of existing chroma intra-prediction modes not spanning components in the ECM, in-place luma modes, chroma modes of adjacent blocks, and the default intra-prediction mode. An example of obtaining intra-prediction mode candidates is as follows:

[0156] The construction process is as follows:

[0157] a) Intra-frame non-cross-component prediction modes for chroma: DM, DIMD, DC modes.

[0158] b) Co-position luminance mode: The intra-frame prediction mode of the luminance CUs corresponding to the center C, upper left TL, upper right TR, lower left BL, and lower right BR positions in the co-position luminance region, as shown in Figure 3.

[0159] c) Prediction patterns of adjacent chromaticity blocks: chromaticity prediction patterns at positions L', T', BL', TR' and TL', as shown in Figure 3.

[0160] d) Default Intra-Prediction Mode: If the number of candidate prediction modes is still insufficient after steps a), b), and c), the default intra-prediction mode is continued to be added. The default intra-prediction mode is obtained by offsetting the first angular prediction mode in the current candidate prediction mode list. The offset can be {-1, +1, -2, +2, ...}. If this is still insufficient, the second angular prediction mode in the candidate list is offset and added, and so on.

[0161] Finally, by combining the reference row candidates (number of which is M, for example, M≤3) and the intra-frame prediction mode candidates (number of which is N, for example, N=8), P (P=M×N, for example, M×N≤24) combined prediction modes can be obtained.

[0162] S902, use a template to sort the candidate list of combinations.

[0163] The steps S202 in obtaining the chroma TMRL mode prediction value are the same at the decoding and encoding ends.

[0164] Before decoding, the co-position luminance component and the chrominance component of reference row 0 have already been decoded to obtain reconstructed values. One feasible method for ranking candidate chrominance TMRL modes using template cost is as follows: Using the co-position luminance and the chrominance region of the left column of the previous row as templates, the combination mode (including reference row and intra-frame prediction modes) is applied to the templates. The predicted value of the template region under the combination mode is calculated. Based on the predicted value and reconstructed value of the template, the error costY of the co-position luminance and the cost Cb of the chrominance in the left column of the previous row are calculated using SATD as the criterion. top costCb left costCr top and costCr left Accordingly, an example of template region selection is shown in Figure 4, which illustrates the template region in the chroma TMRL mode. The diagonal fill area indicates the template region, and the grid fill area indicates the reference row.

[0165] Accordingly, an example of template cost calculation is as follows: the template error cost is calculated according to the aforementioned formula (1).

[0166] For all P (P = M × N) candidate combination patterns, calculate their cost on the template, and sort all candidate patterns according to this cost to obtain a list of candidate combination patterns sorted by template cost. Only the top T (e.g., T = 6) combination patterns in the list are retained.

[0167] S903 determines the reference line and intra-prediction mode used by the current block based on the chroma TMRL mode index.

[0168] By using the chroma TMRL mode index obtained from the decoder and the combined candidate mode list after template sorting obtained in step S902, the reference line and intra-frame prediction mode used by the current CU's chroma TMRL mode can be determined.

[0169] S904, determine the chromaticity prediction value for the current block.

[0170] According to step S903, the reference row and intra-frame prediction mode corresponding to the chroma TMRL mode index are determined, and the prediction value is generated using the current CU reference row, which includes two parts: obtaining the reference row pixel value and deriving the current block prediction value.

[0171] a) Obtain the reference row pixel value.

[0172] The available reference rows for the chroma TMRL mode include {1,3,5}, and the structure of multiple reference rows is shown in Figure 5.

[0173] When some pixels in the reference row are missing or unavailable, the nearest pixel in the reference row is used to fill the gap. If all pixels in the reference row are unavailable, all pixels in the current reference row are filled with a fixed value, the size of which is mid = 1 << (bitdepth - 1).

[0174] b) Derive the predicted value.

[0175] When generating prediction values, the more distant reference lines are treated similarly to reference line 0, where each pixel in the current block is projected along the direction onto the more distant reference line, and the projected pixel is used as the prediction value, as shown in Figure 6. If the projected pixel is located at a fractional position, the prediction value is obtained through a linear interpolation filter. The filter coefficients can be the inverse ratio of the distance between the fractional position of the projection and its two adjacent integer positions. In particular, for intra-frame prediction mode DC mode, the prediction value for all pixels in the current block is the average of the reference pixels in the upper row / left column / upper row + left column.

[0176] That's understandable. Below is a brief introduction to Fusion of Chroma Intra Prediction Modes.

[0177] To improve chroma coding efficiency, the prediction values ​​of two chroma intra-prediction modes can be fused together. The ECM draft includes several chroma intra-prediction fusion methods. For prediction values ​​of non-cross-component chroma intra-prediction modes (including Chroma DIMD, DM, Planar, DC, Hor, Ver, DBV modes, etc.), they can be fused with prediction values ​​of cross-component prediction modes. The ECM draft supports three different fusion methods.

[0178] In the first fusion method, the predicted value of the non-cross-component intra-prediction mode can be fused with the predicted value of MM-CCLM or MM-CCCM, and the final predicted value is derived as follows: pred C (i,j)=(w0×pred0(i,j)+w1×pred1(i,j)+(1<<(shift-1)))>>shift (3)

[0179] Where pred0(i,j) is the predicted value obtained using the non-cross-component prediction mode, and pred1(i,j) is the predicted value obtained using the MM-CCLM or MM-CCCM mode. C (i,j) represents the final predicted value after fusion, with shift set to 2. Here, w0 and w1 are the fusion weights.

[0180] In the second fusion method, the predicted values ​​from the non-cross-component prediction mode can be fused with the predicted values ​​from the CCLM mode, and the final predicted value is derived as follows: pred C (i,j)= α0×pred0(i,j)+ α1×rec′ L (i,j)+α2×β (4)

[0181] Where pred0(i,j) is the predicted value obtained using the non-cross-component prediction mode, rec′ L (i,j) represents the reconstructed value after downsampling of the same brightness, pred C (i,j) represents the final predicted value after fusion, and β is a fixed value with a value of 1 << (bitdepth-1). The fusion weights α0, α1, and α2 are derived from adjacent luminance and chrominance samples using the same matrix factorization (LDL) derivation method as in the CCCM mode.

[0182] In the third fusion method, the predicted values ​​of the non-cross-component prediction mode can be fused with the predicted values ​​of the MMLM mode, and the final predicted value is derived as follows:

[0183] Where pred0(i,j) is the predicted value obtained using the non-cross-component prediction mode, rec′ L (i,j) represents the reconstructed value after downsampling of the same brightness, pred C (i,j) represents the final predicted value after fusion; β is a fixed value, with a value of 1 << (bitdepth-1); modThr is the classification threshold, which is the average value of neighboring samples in the luminance reconstruction. The fusion weights α0, α1, and α2, as well as α′0, α′1, and α′1, are derived from neighboring luminance and chrominance samples using the same LDL derivation method as in the CCCM model.

[0184] For the design of syntax elements, an index intra_chroma_fusion_idx can be used to indicate whether fusion is applied and which fusion method is used. The possible values ​​and meanings of intra_chroma_fusion_idx are shown in Table 2.

[0185] Table 2

[0186] After obtaining the prediction value of the current block in the intra-chroma non-cross-component prediction mode at the encoding end, the system can choose not to use fusion, apply fusion mode 1, apply fusion mode 2, or apply fusion mode 3. If the intra-chroma non-cross-component prediction mode fusion is selected in the encoding decision, the fusion mode index intra_chroma_fusion_idx needs to be encoded to indicate whether fusion is used when encoding the current block and, if so, the fusion mode. At the decoding end, if the intra-frame prediction mode used for the current chroma block is resolved to be the non-cross-component prediction mode, the fusion mode index is further parsed to obtain whether fusion is used and, if so, the corresponding fusion mode.

[0187] In one possible implementation, Figure 10 is a schematic diagram of a non-cross-component mode fusion prediction process. As shown in Figure 10, the process may include:

[0188] S1001 calculates the predicted value of the non-component chromaticity mode.

[0189] Based on information such as the current intra-frame non-cross-component prediction mode, calculate the chroma prediction value under the current mode.

[0190] S1002, determine and calculate relevant data based on the fusion index.

[0191] Specifically, step S1002 may include:

[0192] S1002-1, Determine whether to merge and the merging method based on the merging index.

[0193] S1002-2, Calculate the predicted values ​​for other color modes.

[0194] S1002-3, Determine the fusion weights.

[0195] Here, based on the fusion index obtained from parsing the bitstream, it is determined whether fusion should be applied and, if so, the corresponding fusion method. For example, the meanings of the chroma fusion index intra_chroma_fusion_idx are shown in Table 2.

[0196] The following provides explanations for fusion methods 1, 2, and 3:

[0197] Fusion Method 1: Fusion of prediction values ​​from non-cross-component intra-frame prediction modes and MM-CCLM / MM-CCCM prediction values;

[0198] Fusion Method 2: Fusion of prediction values ​​from non-cross-component intra-frame prediction mode and CCLM prediction values;

[0199] Fusion Method 3: Fusion of prediction values ​​from non-cross-component intra-frame prediction mode and MMLM prediction values.

[0200] If the chroma fusion index is not 0, then the predicted values ​​of other chroma modes need to be determined according to the fusion method, and the fusion weight needs to be determined. The following is an explanation of different cases.

[0201] Fusion Method 1:

[0202] The formula for calculating the predicted value of fusion method 1 is shown in the aforementioned formula (3). In the formula, pred0(i,j) is the predicted value obtained using the non-cross-component prediction mode, pred1(i,j) is the predicted value obtained using the MM-CCLM or MM-CCCM mode, and pred... C (i,j) represents the final predicted value after fusion, shift is 2, and w0 and w1 are the fusion weights. To obtain the final predicted value, it is necessary to determine the intra-frame modes participating in the fusion and calculate their predicted values ​​pred1, as well as the fusion weights w0 and w1. The specific calculation steps are as follows:

[0203] (1) Calculate the predicted values ​​for other color modes.

[0204] In fusion mode 1, the intra-frame modes participating in the fusion are MM-CCLM or MM-CCCM. First, the intra-frame modes participating in the fusion need to be determined by template cost sorting, and then the prediction value of the mode is calculated.

[0205] ① Determine the intra-frame modes (MM-CCLM / MM-CCCM) to participate in the fusion.

[0206] If the current chroma block does not meet the application conditions of MM-CCCM mode, then the intra-frame mode participating in the fusion is MM-CCLM mode;

[0207] If the current chroma block meets the application conditions of the MM-CCCM mode, then the intra-frame modes participating in the fusion need to be determined by sorting the template costs. Specifically, the MM-CCLM model and the MM-CCCM model are first derived based on the reference pixels of the current chroma block, and then applied to the templates respectively. The template costs CCLMSAD and CCCMSAD are calculated respectively, and the mode with the smaller template cost is determined as the intra-frame mode participating in the fusion (the corresponding template cost is denoted as bestSAD, and the number of template pixels is denoted as NumSample).

[0208] ② Calculate the predicted value under this model.

[0209] Using the intra-frame mode participating in the fusion determined in ①, calculate the predicted value pred1 of the current chroma CU under that mode.

[0210] (2) Determine the fusion weights.

[0211] If the current chroma block does not meet the application conditions of the MM-CCCM mode, then the intra-frame mode participating in the fusion can only be the MM-CCLM mode. In this case, its fusion weights w0 and w1 are related to the intra-frame prediction modes of the adjacent chroma blocks. Specifically, first, the left adjacent chroma block cuLeft and the upper adjacent chroma block cuAbove are obtained. Then, it is determined whether the left adjacent chroma block cuLeft and the upper adjacent chroma block cuAbove are valid, and if they are valid, whether their intra-frame prediction mode is the cross-component prediction mode (CCP). If both cuLeft and cuAbove are valid and the prediction mode is CCP mode, then {w0, w1} = {1, 3}; if only one CU among cuLeft and cuAbove is valid and the prediction mode is CCP mode, then {w0, w1} = {2, 2}; otherwise, {w0, w1} = {3, 1}.

[0212] If the current chroma block meets the application conditions of MM-CCCM mode, the fusion weights are derived based on bestSAD and NumSample obtained during the process of determining the intra-frame mode to be fused. When bestSAD > 64 × NumSample, {w0, w1} = {3, 1}; when bestSAD < 4 × NumSample, {w0, w1} = {1, 3}; otherwise, {w0, w1} = {2, 2}.

[0213] Fusion Method 2:

[0214] The formula for calculating the predicted value of fusion method 2 is shown in the aforementioned formula (4). In the formula, pred0(i,j) is the predicted value obtained using the non-cross-component prediction mode, and rec′ L (i,j) represents the reconstructed value after downsampling of the same brightness, pred C (i,j) represents the final predicted value after fusion, β is a fixed value with a value of 1 << (bitdepth-1), and α0, α1, and α2 are the fusion weights. To obtain the final predicted value, rec′ needs to be calculated. L (i,j), and the fusion weights α0, α1, and α2. The specific calculation steps are as follows:

[0215] (1) Calculate the predicted values ​​for other color modes.

[0216] In fusion method 2, the reconstructed value rec′ after brightness downsampling is calculated. L .

[0217] (2) Determine the fusion weights.

[0218] Based on the chroma intra-frame prediction mode used by the current block, calculate the predicted value of this mode on the template (the template is the top two rows and left two columns of the current chroma block), obtain the luminance downsampled reconstruction value and β value of the template region, and calculate pred0(i,j) and rec′ on the template. L MSE minimization is performed using the autocorrelation matrix of (i,j) and β input, as well as the cross-correlation vector between the input and the chroma reconstruction output. The autocorrelation matrix is ​​decomposed using LDL, and the final filter coefficients, i.e., the fusion weights α0, α1, and α2, are calculated using the inverse substitution method.

[0219] Fusion Method 3:

[0220] The formula for calculating the predicted value of fusion method 3 is shown in the aforementioned formula (5). In the formula, pred0(i,j) is the predicted value obtained using the non-cross-component prediction mode, and rec′... L (i,j) represents the reconstructed value after downsampling of the same brightness, pred C (i,j) represents the final predicted value after fusion, β is a fixed value with a value of 1 << (bitdepth-1); modThr is the classification threshold, and α0, α1, α2, α′0, α′1, and α′2 are the fusion weights. To obtain the final predicted value, rec′ needs to be calculated. L (i,j), modThr, and fusion weights α0, α1, α2, α′0, α′1, and α′2. The specific calculation steps are as follows:

[0221] (1) Calculate the predicted values ​​for other color modes.

[0222] In fusion method 3, the reconstructed value rec′ after brightness downsampling is calculated. L .

[0223] (2) Determine the fusion weights.

[0224] Based on the intra-frame prediction mode of the current block, calculate the predicted value of this mode on the template (the template is the top two rows and left two columns of the current chroma block), obtain the luminance downsampled reconstruction value and β value of the template region, and divide the template input into two categories according to the mean of the luminance downsampled reconstruction value modThr on the template, respectively by calculating pred0(i,j) and rec′ on the template. L MSE minimization is performed using the autocorrelation matrix of (i,j) and β inputs, as well as the cross-correlation vector between the input and the chroma reconstruction output. The autocorrelation matrix is ​​decomposed by LDL, and the final two sets of filter coefficients, namely the fusion weights α0, α1, and α2, and α′0, α′1, and α′2, are calculated using the inverse substitution method.

[0225] S1003, determine the final predicted value of the current block.

[0226] If the fusion index is 0, it means that fusion is not applied, and the final predicted value is pred. C (i,j)=pred0(i,j) (6)

[0227] If the fusion index is 1, it means that fusion method 1 is applied, and the final predicted value is pred. C (i,j)=(w0×pred0(i,j)+w1×pred1(i,j)+(1<<(shift-1)))>>shift (7)

[0228] If the fusion index is 2, it means that fusion method 2 is applied, and the final predicted value is pred. C (i,j)=α0×pred0(i,j)+α1×rec′ L (i,j)+α2×β (8)

[0229] If the fusion index is 3, it means that fusion method 3 is applied, and the final predicted value is

[0230] In simple terms, chroma TMRL, a related technique, determines the chroma prediction value of the current block using only the intra-frame prediction mode and the corresponding reference row pixels. However, in some scenarios, the prediction values ​​obtained using only chroma TMRL are still not accurate enough, which adversely affects coding efficiency and reduces coding performance.

[0231] Based on this, embodiments of this application provide an encoding / decoding method. At both the encoding and decoding ends, a first prediction value is determined when the chroma components of the current block use a template-based multi-reference line intra-frame prediction mode; and a second prediction value is determined when the chroma components of the current block use the first prediction mode; then, based on the first and second prediction values, the prediction value of the current block is determined. Thus, when the current block uses a chroma TMRL mode fusion method, the first prediction value obtained from the chroma TMRL mode can be fused with the second prediction values ​​obtained from other chroma modes (e.g., the first prediction mode) to generate a fused final prediction value. This improves the prediction accuracy under the chroma TMRL mode, and since the first prediction mode can be any chroma mode, it also increases the prediction diversity under the chroma TMRL mode, thereby improving encoding / decoding efficiency and ultimately enhancing encoding / decoding performance.

[0232] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0233] Figure 11 is a schematic diagram of a video encoding and decoding network architecture provided in an embodiment of this application. As shown in Figure 11, 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, and N is a positive integer. The electronic devices can be various types of devices with video encoding and decoding capabilities during implementation. For example, the electronic devices may include mobile phones, tablet computers, personal computers, personal digital assistants, navigators, digital phones, video phones, televisions, sensing devices, servers, etc., and this embodiment of the application does not limit the scope of the application.

[0234] This application provides a network architecture for a video encoding / decoding system that includes decoding and encoding methods. The decoder or encoder in this application can be the aforementioned electronic device. That is, the electronic device in this application has video encoding / decoding capabilities and generally includes a video / image encoder (referred to as an encoder) and a video / image decoder (referred to as a decoder).

[0235] Figure 12 is a schematic block diagram of an encoder provided in an embodiment of this application. As shown in Figure 12, the encoder 100 may include a mode selection and control logic unit 101, an intra-frame prediction unit 102, an inter-frame prediction unit 103, a transform and quantization unit 104, an encoding unit 105, an inverse quantization and inverse transform unit 106, a loop filtering unit 107, and a decoded image buffer unit 108, etc. The mode selection and control logic unit 101 is mainly used for encoding mode selection and control logic at the encoding end, such as bit rate control and quantization parameter (QP), etc. The loop filtering unit 107 can implement deblocking filtering, sample adaptive offset (SAO) filtering, and adaptive loop filter (ALF), etc. The encoding unit 105 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC).For the input raw video, a video coding block can be obtained by partitioning it through a Coding Tree Unit (CTU). Then, the residual sample information obtained after intra-frame or inter-frame prediction is transformed by the transform and quantization unit 104, including transforming the residual information from the pixel domain to the transform domain and quantizing the resulting transform coefficients to further reduce the bit rate. The intra-frame prediction unit 102 is used to perform intra-frame prediction on the video coding block. Specifically, the intra-frame prediction unit 102 is used to determine the intra-frame prediction mode to be used to encode the video coding block. The inter-frame prediction unit 103 (including a motion estimation unit and a motion compensation unit) is used to perform inter-frame prediction coding of the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information. The motion estimation performed by the motion estimation unit is a process of generating motion vectors, which can estimate the motion of the video coding block. Then, the motion compensation unit performs motion estimation based on the motion vectors determined by the motion estimation unit 105. Motion compensation is performed; after determining the intra-frame prediction mode, the intra-frame prediction unit 102 is also used to provide the selected intra-frame prediction data to the coding unit 105, and the inter-frame prediction unit 103 also sends the calculated motion vector data to the coding unit 105; in addition, the inverse quantization and inverse transform unit 106 is used to reconstruct the video coding block, reconstructing the residual block in the pixel domain, removing block artifacts through the loop filtering unit 107, and then adding the reconstructed residual block to a predictive block in the frame of the decoding image buffer unit 108 to generate the reconstructed video coding block; the coding unit 105 is used to encode various coding parameters and quantized residual 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, outputting the video bitstream; and the decoding image buffer unit 108 is used to store the reconstructed video coding block for prediction reference. As video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoding image buffer unit 108.

[0236] Figure 13 is a schematic block diagram of a decoder provided in an embodiment of this application. As shown in Figure 13, the decoder 200 includes a decoding unit 201, an inverse quantization and inverse transform unit 202, an intra-frame prediction unit 203, a motion compensation unit 204, a loop filtering unit 205, and a decoded image buffer unit 206, etc. The decoding unit 201 can perform header information decoding and CABAC decoding, and the loop filtering unit 205 can perform deblocking filtering, SAO filtering, ALF filtering, etc. After the input video undergoes the encoding process shown in Figure 12, the output video bitstream is generated. This bitstream is input into the decoder 200, first passing through the decoding unit 201 to obtain the decoded transform coefficients. These transform coefficients are then processed by the inverse quantization and inverse transform unit 202 to generate residual blocks in the pixel domain. The intra-frame prediction unit 203 can generate prediction data for the current video decoding block based on the determined intra-frame prediction mode and data from previously decoded blocks in the current frame or image. The motion compensation unit 204 determines the prediction information for the video decoding block by analyzing motion vectors and other associated syntax elements, and uses this information... Predictive information is used to generate predictive blocks for the video block being decoded; the decoded video block is formed by summing the residual block from the inverse quantization and inverse transform unit 202 with the corresponding predictive block generated by the intra-frame prediction unit 203 or the motion compensation unit 204; the decoded video is passed through the loop filtering unit 205 to remove block artifacts, which can improve video quality; then the decoded video block is stored in the decoded image buffer unit 206, which stores reference images for subsequent intra-frame prediction or motion compensation, and is also used for outputting video information, thus obtaining the recovered original video.

[0237] It should be noted that the method in this application's embodiments affects the intra-frame coding portion of the video coding hybrid framework, primarily acting on the intra-frame prediction unit 102 portion shown in FIG12 and the intra-frame prediction unit 203 portion shown in FIG13 (indicated by bold boxes in FIG12 and FIG13). That is to say, the embodiments in this application can be applied to the encoder, the decoder, or even to both the encoder and the decoder simultaneously, but no specific limitation is made here.

[0238] It should also be noted that when the embodiments of this application are applied to the encoder 100, the "current block" can refer to the current chroma block to be encoded in the video image (also known as the "encoding block"); when the embodiments of this application are applied to the decoder 200, the "current block" can refer to the current chroma block to be decoded in the video image (also known as the "decoding block").

[0239] In one embodiment of this application, Figure 14 is a schematic flowchart of a decoding method provided in this application. As shown in Figure 14, the method may include:

[0240] S1401, determine the first prediction value of the chroma component of the current block when using the template-based multi-reference line intra-prediction mode.

[0241] It should be noted that the decoding method in this application embodiment is applied to a decoder, and the decoding method may refer to a fusion prediction method based on the chroma TMRL mode, which is used to improve the prediction accuracy in the chroma TMRL mode.

[0242] It should also be noted that, in this embodiment, the prediction and fusion of the predicted values ​​are mainly performed on the chroma components of the current block. Here, the chroma components of the current block can also be simply referred to as the "chroma block".

[0243] In some embodiments, when the chroma components of the current block use the TMRL mode, determining the first prediction value of the chroma components of the current block using the template-based multi-reference line intra-prediction mode may include: parsing the combination mode index in the bitstream; determining the first combination mode of the current block based on the combination mode index; wherein the first combination mode includes the reference line and intra-prediction mode used by the current block; and predicting the chroma components of the current block based on the reference line and intra-prediction mode used by the current block to determine the first prediction value of the current block.

[0244] In the embodiments of this application, the combination pattern index can be represented by Chroma TMRL Idx, or by the syntax element intra_tmrl_chroma_idx, to indicate the index number of the first combination pattern in the combination candidate list of the current block. Therefore, in some embodiments, the method may further include: determining the combination candidate list of the current block; and determining the first combination pattern of the current block based on the combination pattern index and the combination candidate list.

[0245] In some embodiments, determining a combined candidate list for the current block may include: determining at least one candidate reference line and at least one candidate intra-prediction mode for the current block; combining the at least one candidate reference line and at least one candidate intra-prediction mode to determine multiple candidate combined modes for the current block; and determining a combined candidate list for the current block based on the multiple candidate combined modes.

[0246] It should be noted that, in the embodiments of this application, each candidate combination mode can be composed of candidate reference lines and candidate intra-prediction modes. Specifically, the selectable range for candidate reference lines is {1, 3, 5}, i.e., reference line 1, reference line 3, and reference line 5. The candidate reference lines for the current chroma TMRL mode can be determined based on the number of available reference lines for the current block chroma component. For example, if the number of available reference lines for the current block chroma component is 4, then the candidate reference lines include reference line 1 and reference line 3; if the number of available reference lines for the current block chroma component is 6, then the candidate reference lines include reference line 1, reference line 3, and reference line 5.

[0247] Additionally, for candidate intra-frame prediction modes, a possible construction process includes:

[0248] e) Intra-frame non-cross-component prediction modes for chroma: DM, DIMD, DC modes.

[0249] f) Co-position luminance mode: The intra-frame prediction mode of the luminance CUs corresponding to the center C, upper left TL, upper right TR, lower left BL, and lower right BR positions in the co-position luminance region, as shown in Figure 3.

[0250] g) Prediction patterns of adjacent chromaticity blocks: chromaticity prediction patterns at positions L', T', BL', TR' and TL', as shown in Figure 3.

[0251] h) Default Intra-Prediction Mode: If the number of prediction mode candidates is still insufficient after steps a), b), and c), the default intra-prediction mode is continued to be added. The default intra-prediction mode is obtained by offsetting the first angular prediction mode in the current prediction mode candidate list. The offset can be {-1, +1, -2, +2, ...}. If this is still insufficient, the second angular prediction mode in the candidate list is offset and added, and so on.

[0252] Thus, after obtaining at least one candidate reference line and at least one candidate intra-frame prediction mode, for example, M candidate reference lines (e.g., M≤3) and N candidate intra-frame prediction modes (e.g., N=8), combining the M candidate reference lines and N candidate intra-frame prediction modes can yield P (P=M×N, for example, M×N≤24) candidate combination modes.

[0253] Understandably, in the embodiments of this application, these multiple candidate combination patterns can be directly determined as the combination candidate list for the current block. However, in order to reduce the encoded bits of the combination pattern index in the bitstream, the length of the combination candidate list needs to be shortened. In some embodiments, the method may further include: predicting the first template of the current block based on the multiple candidate combination patterns to determine the template prediction value corresponding to the multiple candidate combination patterns; calculating the cost based on the template prediction value corresponding to the multiple candidate combination patterns and the template reconstruction value of the first template to determine the cost result corresponding to the multiple candidate combination patterns; sorting the multiple candidate combination patterns according to the cost result, and taking the top T candidate combination patterns as the combination candidate list for the current block.

[0254] It should be noted that in this embodiment, T is a positive integer, for example, T = 6. Here, it can refer to selecting the top T candidate combination patterns from P candidate combination patterns to form the current block's combination candidate list. That is, the value of T does not exceed P.

[0255] It should also be noted that, in the embodiments of this application, the first template of the current block may include the same brightness and the chromaticity region of the left column of the previous row. In addition, the cost calculation here may be performed using criteria such as MSE, MAE, RMSE, SAD, SATD, etc., and then the cost result corresponding to each candidate combination mode is determined according to the aforementioned formula (1).

[0256] In this way, the cost results of each of the P candidate combination patterns on the first template are calculated, and then the P candidate combination patterns are sorted according to the cost results to obtain a sorted candidate list. Only the top T candidate combination patterns are retained as the final combination candidate list, so that the length of the combination candidate list changes from P to T, thereby shortening the list length.

[0257] In other words, in this embodiment of the application, the first combination mode used by the current block can be determined based on the determined combination candidate list and the value of the combination mode index. Then, the chroma components of the current block are predicted based on the reference line and intra-frame prediction mode in the first combination mode to obtain the first prediction value of the current block.

[0258] S1402, determine the second prediction value of the chromaticity component of the current block when using the first prediction mode.

[0259] S1403, Determine the prediction value of the current block based on the first prediction value and the second prediction value.

[0260] It should be noted that, in the embodiments of this application, the first prediction mode can be any mode of chroma intra-frame prediction, including but not limited to CCCM, CCLM, GLM, etc. For example, the first prediction mode may include non-cross-component prediction modes that do not use chroma multi-reference lines, such as Chroma DIMD, DM, DC, Planar, DBV, etc., and may also include cross-component prediction modes such as CCLM, CCCM, GLM, etc., and may also include other chroma TMRL modes in the combined candidate list, etc., but no limitations are made here.

[0261] In one possible implementation, the first prediction mode may differ from the template-based multi-reference line intra-prediction mode. Here, the first prediction mode differs from the TMRL mode used by the current block. Exemplarily, the first prediction mode may derive a second prediction value using reference line and / or intra-prediction modes different from the TMRL mode.

[0262] In another possible implementation, determining the first prediction mode for the current block may further include: determining at least one candidate prediction mode for the current block; and determining the first prediction mode from the at least one candidate prediction mode. Exemplarily, any one of these at least one candidate prediction modes can be used as the first prediction mode for the current block.

[0263] In another possible implementation, determining the first prediction mode for the current block may further include: predicting the first template of the current block based on at least one candidate prediction mode, and determining the template prediction value corresponding to the at least one candidate prediction mode; calculating the cost between the template prediction value corresponding to the at least one candidate prediction mode and the template reconstruction value of the first template, and determining the cost result corresponding to the at least one candidate prediction mode; sorting the at least one candidate prediction mode according to the cost result, determining the top K candidate prediction modes, and determining the first prediction mode from the K candidate prediction modes; where K is a positive integer.

[0264] In other words, in this embodiment, the first prediction mode participating in the fusion can be filtered by template cost, retaining only the mode with the lower template cost for fusion. For example, assuming that the candidate prediction modes for fusion with the chroma TMRL mode include six types, namely MM-CCCM, CCCM, MM-CCLM, CCLM, MM-GLCCCM, and GL-CCCM, the predicted values ​​of the above six candidate prediction modes on the template are calculated first, and the absolute error between the template predicted value and the reconstructed value is calculated as the template cost. The prediction modes are then sorted by template cost, and finally only the three candidate prediction modes with the lower template cost are retained to participate in the subsequent fusion of the chroma TMRL mode prediction values.

[0265] In some embodiments, determining a second prediction value for the chroma components of the current block using a first prediction mode may include: parsing a chroma fusion index in the bitstream; determining a first prediction mode for the current block when the chroma fusion index indicates that the chroma components of the current block are predicted using a fusion method; and predicting the chroma components of the current block according to the first prediction mode to determine a second prediction value for the current block.

[0266] It should be noted that, in this embodiment, the chroma fusion index can be represented by TMRL Fusion Idx, or by the syntax element intra_tmrl_chroma_fusion_idx, to indicate whether the chroma components of the current block use a fusion method. Specifically, if the value of the chroma fusion index is equal to 0, it indicates that the chroma components of the current block do not use a fusion method; if the value of the chroma fusion index is greater than 0, it indicates that the chroma components of the current block use a fusion method.

[0267] It should also be noted that, in the embodiments of this application, when the chromaticity components of the current block are predicted using a fusion method, the first prediction mode of the current block is first determined, and then the chromaticity components of the current block are predicted according to the first prediction mode to obtain the second prediction value of the current block.

[0268] In some embodiments, for step S1403, determining the predicted value of the current block based on the first predicted value and the second predicted value may include: fusing the first predicted value and the second predicted value to determine the predicted value of the current block.

[0269] In some embodiments, the method for determining the predicted value of the current block may further include: determining a first weight corresponding to a first predicted value and a second weight corresponding to a second predicted value; and performing a weighted operation on the first predicted value and the second predicted value according to the first weight and the second weight to determine the predicted value of the current block.

[0270] In this embodiment, the first weight can be represented by w0, and the second weight can be represented by w1. Furthermore, assuming the first predicted value can be represented by pred0(i,j), the second predicted value can be represented by pred1(i,j), and the predicted value of the current block can be represented by pred... C (i,j) indicates that, in one possible implementation, the first and second predicted values ​​are weighted according to the first and second weights to obtain the final predicted value (or "fused predicted value") of the current block, as shown in the following formula: pred C (i,j)=w0×pred0(i,j)+w1×pred1(i,j) (10)

[0271] In this embodiment of the application, the first weight w0 and the second weight w1 can be set according to the actual situation. The following are some possible implementation methods as examples for relevant explanation.

[0272] In one possible implementation, the method may further include setting the first weight and the second weight to fixed constants. For example, {w0,w1} could be set to {3,1}.

[0273] In another possible implementation, the method may further include: determining the left-side adjacent reference block and the upper-side adjacent reference block of the current block; and determining a first weight and a second weight based on the prediction modes of the left-side adjacent reference block and the upper-side adjacent reference block, respectively.

[0274] It should be noted that, in the embodiments of this application, determining the first weight and the second weight based on the prediction modes of the left adjacent reference block and the upper adjacent reference block may include:

[0275] When all the left-side adjacent reference blocks and the upper-side adjacent reference blocks are valid and their respective prediction modes are cross-component prediction modes, the first weight and the second weight are set to the first set of preset values.

[0276] When there is only one valid prediction mode in the left adjacent reference block and the upper adjacent reference block and the corresponding prediction mode is the cross-component prediction mode, the first weight and the second weight are set to the second set of preset values.

[0277] When all the left-side adjacent reference blocks and the upper-side adjacent reference blocks are invalid, or at least one is valid and the corresponding prediction mode is a non-cross-component prediction mode, the first weight and the second weight are set to the third set of preset values.

[0278] In this embodiment, the first set of preset values ​​can be {w0,w1} = {1,3}, the second set of preset values ​​can be {w0,w1} = {2,2}, and the third set of preset values ​​can be {w0,w1} = {3,1}. Thus, after obtaining the left-side adjacent chroma block cuLeft and the upper-side adjacent chroma block cuAbove of the current block, a determination can be made based on whether the left-side adjacent chroma block cuLeft and the upper-side adjacent chroma block cuAbove are valid, and whether their intra-frame prediction mode is a cross-component prediction mode if valid.

[0279] For example, if both cuLeft and cuAbove are valid and the prediction mode is CCP mode, then {w0,w1} = {1,3}; if only one of cuLeft and cuAbove is valid and the prediction mode is CCP mode, then {w0,w1} = {2,2}; otherwise, in other cases, {w0,w1} = {3,1}.

[0280] In another possible implementation, the method may further include: calculating the cost of a first template of the current block according to a first prediction mode, determining a first cost result, and determining the number of samples for the first template; and determining a first weight and a second weight based on the first cost result and the number of samples for the first template.

[0281] It should be noted that, in the embodiments of this application, determining the first weight and the second weight based on the first cost result and the number of samples in the first template may include:

[0282] When the first cost result is greater than the first product between the number of samples of the first factor and the first template, the first weight and the second weight are set to the fourth set of preset values;

[0283] When the first cost result is less than the second product between the number of samples of the second factor and the first template, the first weight and the second weight are set to the fifth set of preset values;

[0284] When the first cost result is greater than or equal to the second product and less than or equal to the first product, the first weight and the second weight are set to the sixth group of preset values.

[0285] In the embodiments of this application, the first factor and the second factor can be different. The first factor can be a preset constant value, such as 64; the second factor can also be a preset constant value, such as 4, and there is no limitation here.

[0286] In this embodiment, the fourth set of preset values ​​can be {w0,w1} = {3,1}, the fifth set of preset values ​​can be {w0,w1} = {1,3}, and the sixth set of preset values ​​can be {w0,w1} = {2,2}. Thus, assuming the first prediction mode is MM-CCCM mode, MM-CCCM is first applied to the template (the template is set to the row above and column to the left of the current chromaticity CU, and the total number of pixels in the template is denoted as numSample). The sum of the absolute errors between the predicted and reconstructed values ​​of the template is calculated and denoted as cccmSAD.

[0287] For example, if cccmSAD > 64 × numSample, then {w0, w1} = {3, 1}; if cccmSAD < 4 × numSample, then {w0, w1} = {1, 3}; otherwise, in other cases, {w0, w1} = {2, 2}.

[0288] In another possible implementation, the method may further include: predicting a first template of the current block according to a template-based multi-reference row intra-prediction mode and a first prediction mode respectively; determining a first template prediction value corresponding to the template-based multi-reference row intra-prediction mode and a second template prediction value corresponding to the first prediction mode; determining a first autocorrelation matrix of the first template prediction value and the second template prediction value, and determining a first cross-correlation vector between the first template prediction value, the second template prediction value and the template reconstruction value of the first template; and determining a first weight and a second weight according to the first autocorrelation matrix and the first cross-correlation vector.

[0289] In this embodiment, the formula can also be derived based on the predicted values ​​of the chroma TMRL and the first prediction mode fused with it on the template, and the reconstructed values ​​of the template itself. For example, assuming the first prediction mode fused with the chroma TMRL mode is an MM-CCCM mode, the chroma TMRL mode and the MM-CCCM mode can be applied to the template to obtain predicted values, denoted as tempPred0 and tempPred1, respectively. The template reconstructed value tempReco is then obtained. Then, tempPred0 and tempPred1 are used as inputs, and tempReco is used as the output. The autocorrelation matrix of the input and the cross-correlation vector between the input and the chroma template reconstructed value output are calculated to perform MSE minimization. The autocorrelation matrix is ​​decomposed using LDL, and the final filter coefficients, i.e., the first weight w0 and the second weight w1, are calculated using the inverse substitution method.

[0290] In other words, in this embodiment of the application, the fusion weights (including the first weight w0 and the second weight w1) can be determined according to the actual situation. For example, the selection range of the fusion weights {w0, w1} includes, but is not limited to, fixed weights {0.5, 0.5}, {0.75, 0.25}, {0.25, 0.75}, etc., or the fusion weights {w0, w1} can also be adaptively determined according to the actual situation. For example, the fusion weights can be adaptively determined based on the predicted and reconstructed values ​​of the two modes in the template, or based on the intra-frame prediction mode of the chroma of adjacent blocks, etc., without any limitation.

[0291] It is also understood that, in the embodiments of this application, the chroma fusion index is represented by the syntax element intra_tmrl_chroma_fusion_idx. When the value of the chroma fusion index is greater than 0, the fusion method used by the current block can also be determined according to the specific value of the chroma fusion index. That is, the chroma fusion index can be used to indicate whether the current block uses fusion and the corresponding fusion method number when fusion is used. For example, if the value of the chroma fusion index is equal to 1, then it is determined that the current block uses the first fusion method (or represented as: fusion method 1); if the value of the chroma fusion index is equal to 2, then it is determined that the current block uses the second fusion method (or represented as: fusion method 2); if the value of the chroma fusion index is equal to 3, then it is determined that the current block uses the third fusion method (or represented as: fusion method 3).

[0292] In one implementation, the possible values ​​and meanings of the chroma fusion index intra_tmrl_chroma_fusion_idx are shown in Table 3.

[0293] Table 3

[0294] Here, based on the chroma fusion index obtained from parsing the bitstream, it is determined whether fusion should be applied and, if so, the corresponding fusion method number. If the chroma fusion index is not 0, then the corresponding first prediction mode and fusion weight need to be determined according to the fusion method. For example, the following describes the three specific values ​​of the chroma fusion index in conjunction with fusion method 1, fusion method 2, and fusion method 3.

[0295] Fusion Method 1: Fusion of predicted values ​​from the chromaticity TMRL mode and predicted values ​​from the multi-model component linear prediction mode / multi-model convolution component prediction mode;

[0296] Fusion Method 2: Fusion of the predicted values ​​of the chromaticity TMRL mode and the predicted values ​​of the inter-component prediction modes;

[0297] Fusion Method 3: Fusion of the predicted values ​​of the chromaticity TMRL mode and the predicted values ​​of the multi-model component prediction mode.

[0298] In one possible implementation, taking a chroma blending index value of 1 as an example (see Figure 15), the method may include:

[0299] S1501, parse the chroma fusion index in the bitstream.

[0300] S1502, when the chroma fusion index indicates that the chroma components of the current block are predicted using a first fusion method, at least one candidate prediction mode for the current block is determined.

[0301] S1503, determine a first prediction mode for the current block among at least one candidate prediction mode, and predict the chromaticity components of the current block according to the first prediction mode to determine a second prediction value for the current block.

[0302] S1504, Determine the prediction value of the current block based on the first fusion method, the first prediction value, and the second prediction value.

[0303] It should be noted that, in the embodiments of this application, if the value of the chroma fusion index in the bitstream is equal to 1, that is, the chroma fusion index indicates that the chroma components of the current block use the first fusion method, then the at least one candidate prediction mode participating in the fusion of the current block may include: a multi-model component linear prediction mode and a multi-model convolution component prediction mode. For example, the at least one candidate prediction mode here may include: MM-CCLM mode and MM-CCCM mode.

[0304] In some embodiments, determining the predicted value of the current block based on the first fusion method, the first predicted value, and the second predicted value may include: fusing the first predicted value and the second predicted value according to the first fusion method to determine the predicted value of the current block.

[0305] In some embodiments, the method for determining the predicted value of the current block may further include: determining a first weight and a second weight corresponding to a first fusion method; and performing a weighted operation on the first predicted value and the second predicted value according to the first weight and the second weight to determine the predicted value of the current block.

[0306] In one specific embodiment, for the predicted value of the current block, the method may further include: performing a weighted operation on the first predicted value and the second predicted value according to the first weight and the second weight to determine the weighted predicted value; determining the third factor according to the preset displacement, and performing a right shift operation on the sum of the weighted predicted value and the third factor according to the preset displacement to determine the predicted value of the current block.

[0307] It should also be noted that in the embodiments of this application, the first weight can be represented by w0, the second weight can be represented by w1, the preset displacement can be represented by shift, and the third factor can be represented by 1 << (shift-1).

[0308] In one specific embodiment, based on a first fusion method, the first predicted value of the chroma TMRL mode and the second predicted value of the multi-model component linear prediction mode or the multi-model convolution component prediction mode are fused, and the final predicted value of the current block is derived as follows: pred C (i,j)=(w0×pred0(i,j)+w1×pred1(i,j)+(1<<(shift-1)))>>shift (11)

[0309] Where pred0(i,j) is the first predicted value obtained using the chromaticity TMRL mode, and pred1(i,j) is the second predicted value obtained using the multi-model component inter-linear prediction mode or the multi-model convolution component inter-prediction mode. C (i,j) represents the final predicted value after fusion; shift is 2, and w0 and w1 are the fusion weights. To obtain the final predicted value, it is necessary to determine the first prediction mode participating in the fusion and calculate its predicted value pred1, as well as the fusion weights w0 and w1.

[0310] In some embodiments, determining the first prediction mode of the current block among at least one candidate prediction mode may include: when the current block does not meet the application conditions of the multi-model component inter-prediction mode, determining the first prediction mode of the current block as the multi-model component inter-linear prediction mode.

[0311] When the current block meets the application conditions of the multi-model component inter-prediction mode, the cost of the first template of the current block is calculated according to the multi-model component inter-linear prediction mode and the multi-model component inter-prediction mode, respectively, to determine the two template cost results; and the minimum cost result is determined among the two template cost results, and the candidate prediction mode corresponding to the minimum cost result is determined as the first prediction mode of the current block.

[0312] It should be noted that whether the current block meets the application conditions of the multi-model convolutional integral inter-prediction mode can be related to the number of available neighboring reference pixels. For example, if the number of neighboring pixels used for referencing the derivation of the multi-model convolutional integral inter-prediction mode is too small, then the multi-model convolutional integral inter-prediction mode cannot be used.

[0313] It should also be noted that in the first fusion method, the intra-frame modes participating in the fusion are either multi-model component linear prediction modes or multi-model convolution component prediction modes. First, the intra-frame modes participating in the fusion need to be determined by comparing template costs, and then the prediction value under that mode is calculated. For example, taking the MM-CCLM and MM-CCCM modes as examples, if the current chroma block does not meet the application conditions of the MM-CCCM mode, then the intra-frame mode participating in the fusion is the MM-CCLM mode; if the current chroma block meets the application conditions of the MM-CCCM mode, then the intra-frame modes participating in the fusion need to be determined by sorting the template costs. Specifically, the MM-CCLM model and the MM-CCCM model are first derived based on the reference pixels of the current chroma block, and then applied to the template respectively, calculating their template costs CCLMSAD and CCCMSAD respectively. The mode with the smaller template cost is determined as the intra-frame mode participating in the fusion (the corresponding template cost is denoted as bestSAD, and the number of template pixels is denoted as NumSample).

[0314] Thus, after determining the first prediction mode participating in the fusion from the linear prediction mode among multi-model components and the prediction mode among multi-model convolutional components, the second prediction value pred1 of the current chromaticity CU under this mode can be calculated.

[0315] In some embodiments, when the current block does not meet the application conditions of the multi-model convolution integral prediction mode, determining the first weight and the second weight corresponding to the first fusion method may include: determining the left adjacent reference block and the upper adjacent reference block of the current block.

[0316] When all the left-side adjacent reference blocks and the upper-side adjacent reference blocks are valid and their respective prediction modes are cross-component prediction modes, the first weight and the second weight are set to the seventh group of preset values.

[0317] When there is only one valid prediction mode in the left adjacent reference block and the upper adjacent reference block and the corresponding prediction mode is the cross-component prediction mode, the first weight and the second weight are set to the eighth group of preset values.

[0318] When all the left-side adjacent reference blocks and the upper-side adjacent reference blocks are invalid, or at least one is valid and the corresponding prediction mode is a non-cross-component prediction mode, the first weight and the second weight are set to the ninth group of preset values.

[0319] In other words, in this embodiment, it is assumed that the seventh set of preset values ​​can be {w0,w1} = {1,3}, the eighth set of preset values ​​can be {w0,w1} = {2,2}, and the ninth set of preset values ​​can be {w0,w1} = {3,1}. For example, still taking MM-CCLM and MM-CCCM modes as examples, if the current block does not meet the application conditions of MM-CCCM mode, then the intra-frame mode participating in the fusion can only be MM-CCLM mode. At this time, its fusion weights w0 and w1 are related to the intra-frame prediction modes of adjacent chroma blocks. Specifically, first, the left adjacent chroma block cuLeft and the upper adjacent chroma block cuAbove are obtained, and then it is determined whether the left adjacent chroma block cuLeft and the upper adjacent chroma block cuAbove are valid, and if valid, whether its intra-frame prediction mode is the cross-component prediction mode (CCP). If both cuLeft and cuAbove are valid and the prediction mode is CCP mode, then {w0, w1} = {1, 3}; if only one of cuLeft and cuAbove is valid and the prediction mode is CCP mode, then {w0, w1} = {2, 2}; otherwise, {w0, w1} = {3, 1}.

[0320] In other embodiments, when the current block satisfies the application conditions of the multi-model convolutional integral prediction mode, determining the first weight and the second weight corresponding to the first fusion method may include: determining the minimum cost result and the number of samples of the first template.

[0321] When the minimum cost result is greater than the third product between the number of samples of the fourth factor and the first template, the first weight and the second weight are set to the tenth group preset value.

[0322] When the minimum cost result is less than the fourth product between the number of samples of the fifth factor and the first template, the first weight and the second weight are set to the eleventh set of preset values.

[0323] When the minimum cost result is greater than or equal to the fourth product and less than or equal to the third product, the first weight and the second weight are set to the preset value of the twelfth group.

[0324] In the embodiments of this application, the fourth factor and the fifth factor may be different. The fourth factor may be a preset constant value, such as 64; the fifth factor may also be a preset constant value, such as 4, and no limitation is made here.

[0325] In other words, in this embodiment, it is assumed that the tenth preset value can be {w0,w1}={3,1}, the eleventh preset value can be {w0,w1}={1,3}, and the twelfth preset value can be {w0,w1}={2,2}. If the current chroma block meets the application conditions of the multi-model convolutional integral prediction mode, the fusion weights are derived based on the bestSAD and NumSample obtained in the process of determining the intra-frame mode to participate in the fusion. When bestSAD>64×NumSample, {w0,w1}={3,1}; when bestSAD<4×NumSample, {w0,w1}={1,3}; otherwise, {w0,w1}={2,2}.

[0326] In another possible implementation, taking a chroma blending index of 2 as an example (see Figure 16), the method may include:

[0327] S1601, parse the chroma fusion index in the bitstream.

[0328] S1602, when the chroma fusion index indicates that the chroma components of the current block are predicted using the second fusion method, the first prediction mode of the current block is determined to be the inter-component prediction mode.

[0329] S1603, determine the first reconstructed value after downsampling the co-position brightness of the current block.

[0330] S1604, Determine the predicted value of the current block based on the second fusion method, the first predicted value, and the first reconstructed value.

[0331] It should be noted that, in the embodiments of this application, if the value of the chroma fusion index in the bitstream is equal to 2, that is, the chroma fusion index indicates that the chroma components of the current block are predicted using the second fusion method, then the first prediction mode of the current block includes inter-component prediction modes, such as CCLM mode or CCCM mode, etc.

[0332] In some embodiments, determining the predicted value of the current block based on the second fusion method, the first predicted value, and the first reconstructed value may include: fusing the first predicted value, the first reconstructed value, and the first constant according to the second fusion method to determine the predicted value of the current block.

[0333] In some embodiments, the method for determining the predicted value of the current block may further include: determining a first weight, a second weight, and a third weight corresponding to the second fusion method; and performing a weighted operation on the first predicted value, the first reconstructed value, and the first constant according to the first weight, the second weight, and the third weight to determine the predicted value of the current block.

[0334] In this embodiment, the first weight can be represented by α0, the second weight by α1, the third weight by α2, and the first constant by β, the value of which can be set to 1 << (bitdepth-1).

[0335] In one specific embodiment, based on a second fusion method, the first predicted value of the chroma TMRL mode and the second predicted value of the inter-component prediction mode are fused. For example, assuming the inter-component prediction mode here is an inter-component linear prediction mode, such as the CCLM mode, then the final predicted value of the current block is derived as follows: pred C (i,j)=α0×pred0(i,j)+α1×rec′ L (i,j)+α2×β (12)

[0336] Where pred0(i,j) is the first predicted value obtained using the chromaticity TMRL mode, rec′ L (i,j) represents the reconstructed value after downsampling of the same brightness, pred C (i,j) represents the final predicted value after fusion; β is a fixed value with a value of 1 << (bitdepth-1), and α0, α1, and α2 are the fusion weights. To obtain the final predicted value, rec′ needs to be calculated. L (i,j), and the fusion weights α0, α1 and α2.

[0337] Here, rec′ L (i,j) can be obtained by calculating the reconstructed value after downsampling the co-position brightness of the current block.

[0338] In some embodiments, determining the first weight, second weight, and third weight corresponding to the second fusion method may include: predicting the first template of the current block according to the template-based multi-reference line intra-prediction mode, and determining the first template prediction value corresponding to the template-based multi-reference line intra-prediction mode; obtaining the second reconstructed value and the second constant after luminance downsampling of the first template; determining the second autocorrelation matrix of the first template prediction value, the second reconstructed value, and the second constant, and determining the second cross-correlation vector between the first template prediction value, the second reconstructed value, the second constant, and the chrominance reconstructed value of the first template; and determining the first weight, the second weight, and the third weight according to the second autocorrelation matrix and the second cross-correlation vector.

[0339] In this embodiment, the second constant can also be represented by β, and its value can be set to 1 << (bitdepth-1). Thus, based on the intra-prediction mode corresponding to the current chroma TMRL, the predicted value of this mode on the template (the template is the top two rows and left two columns of the current chroma block) is calculated, obtaining the luminance downsampling reconstruction value and β value of the template region. This is achieved by calculating pred0(i,j) and rec′ on the template. L MSE minimization is performed using the autocorrelation matrix of (i,j) and β input, as well as the cross-correlation vector between the input and the chroma reconstruction output. The autocorrelation matrix is ​​decomposed using LDL, and the final filter coefficients, i.e., the fusion weights α0, α1, and α2, are calculated using the inverse substitution method.

[0340] In another possible implementation, taking a chroma blending index value of 3 as an example (see Figure 17), the method may include:

[0341] S1701, Parse the chroma fusion index in the bitstream.

[0342] S1702, when the chroma fusion index indicates that the chroma components of the current block are predicted using the third fusion method, the first prediction mode of the current block is determined to be the multi-model component prediction mode.

[0343] S1703, determine the first reconstructed value after downsampling the co-position brightness of the current block.

[0344] S1704, when the first reconstructed value is less than or equal to the classification threshold, determine the first weight, second weight and third weight corresponding to the third fusion method, and perform a weighted operation on the first predicted value, the first reconstructed value and the third constant according to the first weight, the second weight and the third weight to determine the predicted value of the current block.

[0345] S1705, when the first reconstructed value is greater than the classification threshold, determine the fourth, fifth and sixth weights corresponding to the third fusion method, and perform a weighted operation on the first predicted value, the first reconstructed value and the third constant according to the fourth, fifth and sixth weights to determine the predicted value of the current block.

[0346] It should be noted that, in the embodiments of this application, if the value of the chroma fusion index in the bitstream is equal to 3, that is, the chroma fusion index indicates that the chroma components of the current block are predicted using the third fusion method, then the first prediction mode of the current block includes the multi-model component prediction mode, such as the MMLM mode.

[0347] It should also be noted that, in the embodiments of this application, after step S1703, the predicted value of the current block can be determined based on the third fusion method, the first predicted value, and the first reconstructed value. In some embodiments, this may include: fusing the first predicted value, the first reconstructed value, and the third constant according to the third fusion method to determine the predicted value of the current block.

[0348] In one specific embodiment, determining the predicted value of the current block may further include: when the first reconstructed value is less than or equal to the classification threshold, determining the first weight, second weight, and third weight corresponding to the third fusion method, and performing a weighted operation on the first predicted value, the first reconstructed value, and the third constant according to the first weight, the second weight, and the third weight to determine the predicted value of the current block; when the first reconstructed value is greater than the classification threshold, determining the fourth weight, fifth weight, and sixth weight corresponding to the third fusion method, and performing a weighted operation on the first predicted value, the first reconstructed value, and the third constant according to the fourth weight, the fifth weight, and the sixth weight to determine the predicted value of the current block.

[0349] It should also be noted that, in the embodiments of this application, the first weight can be represented by α0, the second weight can be represented by α1, the third weight can be represented by α2; the fourth weight can be represented by α′0; the fifth weight can be represented by α′1, the sixth weight can be represented by α′2; the third constant can be represented by β, and its value can be set to 1 << (bitdepth-1).

[0350] In one specific embodiment, based on the third fusion method, the first predicted value of the chroma TMRL mode and the second predicted value of the multi-model component prediction mode are fused, and the final predicted value of the current block is derived as follows:

[0351] Where pred0(i,j) is the first predicted value obtained using the chromaticity TMRL mode, rec′ L (i,j) represents the reconstructed value after downsampling of the same brightness, pred C(i,j) represents the final predicted value after fusion; β is a fixed value, with a value of 1 << (bitdepth-1); modThr is the classification threshold, which is the average value of neighboring samples in the luminance reconstruction. The fusion weights α0, α1, and α2, as well as α′0, α′1, and α′2, are derived from neighboring luminance and chrominance samples using the same LDL derivation method as in the inter-convolutional integral prediction mode.

[0352] In some embodiments, the method may further include determining the fusion weights α0, α1 and α2 and α′0, α′1 and α′2 by dividing the first template of the current block according to a classification threshold, and determining the first sub-template and the second sub-template.

[0353] The first sub-template is predicted according to the template-based multi-reference line intra-prediction mode, and the predicted value of the first sub-template corresponding to the template-based multi-reference line intra-prediction mode is determined. After obtaining the third reconstructed value and the fourth constant of the luminance downsampled first sub-template, the third autocorrelation matrix of the predicted value, the third reconstructed value and the fourth constant of the first sub-template is determined, as well as the third cross-correlation vector between the predicted value, the third reconstructed value and the fourth constant and the chrominance reconstructed value of the first sub-template is determined. Based on the third autocorrelation matrix and the third cross-correlation vector, the first weight, the second weight and the third weight are determined.

[0354] The second sub-template is predicted according to the template-based multi-reference line intra-frame prediction mode, and the predicted value of the second sub-template corresponding to the template-based multi-reference line intra-frame prediction mode is determined. After obtaining the fourth reconstructed value and the fifth constant of the luminance downsampled second sub-template, the fourth autocorrelation matrix of the predicted value, the fourth reconstructed value and the fifth constant of the second sub-template is determined, as well as the fourth cross-correlation vector between the predicted value, the fourth reconstructed value and the fifth constant of the second sub-template and the chrominance reconstructed value of the second sub-template is determined. Based on the fourth autocorrelation matrix and the fourth cross-correlation vector, the fourth weight, the fifth weight and the sixth weight are determined.

[0355] In this embodiment, both the fourth and fifth constants can be represented by β, and their values ​​can be set to 1 << (bitdepth-1). Thus, based on the intra-prediction mode corresponding to the current chroma TMRL, the predicted value of this mode on the template (the template is the top two rows and left two columns of the current chroma block) is calculated, obtaining the luminance downsampled reconstruction value and β value of the template region. Based on the mean of the template luminance downsampled reconstruction value modThr, the input of the template is divided into two categories, respectively calculated by pred0(i,j) and rec′ on the template. LMSE minimization is performed using the autocorrelation matrix of (i,j) and β inputs, as well as the cross-correlation vector between the input and the chroma reconstruction output. The autocorrelation matrix is ​​decomposed by LDL, and the final two sets of filter coefficients, namely the fusion weights α0, α1, and α2, and α′0, α′1, and α′2, are calculated using the inverse substitution method.

[0356] In another possible implementation, taking the chroma fusion index as equal to 0 as an example, the method may also include: when the chroma fusion index indicates that the chroma components of the current block are not predicted using the fusion method, the first predicted value is directly determined as the predicted value of the current block.

[0357] It should be noted that, in the embodiments of this application, if the value of the chroma fusion index in the bitstream is equal to 0, that is, the chroma fusion index indicates that the chroma components of the current block do not use the fusion method, then the first prediction value is directly determined as the prediction value of the current block.

[0358] It should also be noted that, in the embodiments of this application, the predicted value of the current block is the final predicted value after fusion (or simply "fusion predicted value"). The final predicted value may include:

[0359] If the chroma blending index is 0, it means that no blending method is used, and the final predicted value is pred. C (i,j)=pred0(i,j) (14)

[0360] If the chroma blending index is equal to 1, it indicates that the first blending method is used, and the final predicted value is pred. C (i,j)=(w0×pred0(i,j)+w1×pred1(i,j)+(1<<(shift-1)))>>shift (15)

[0361] If the chroma blending index is equal to 2, it indicates that the second blending method is used, and the final predicted value is pred. C (i,j)=α0×pred0(i,j)+α1×rec′ L (i,j)+α2×β (16)

[0362] If the chroma blending index is equal to 3, it indicates that the third blending method is used, and the final predicted value is

[0363] It is also understood that, in some embodiments, the method may further include: parsing a first syntax element in the bitstream; parsing a second syntax element in the bitstream when the first syntax element indicates that the chroma component of the current block uses a non-cross-component prediction mode; and performing a step of determining a first prediction value when the chroma component of the current block uses a template-based multi-reference line intra-prediction mode when the second syntax element indicates that the chroma component of the current block uses a template-based multi-reference line intra-prediction mode.

[0364] In this embodiment, the first syntax element can be represented by CCP Flag, and the second syntax element can be represented by Chroma TMRL Flag or intra_tmrl_chroma_flag. That is, firstly, the CCP Flag (indicating whether it is a cross-component prediction mode) is parsed to determine whether the current chroma block generates a prediction value through a cross-component correlation mode. If the prediction value is not generated by a CCP-related mode (CCP Flag is 0), then the Chroma TMRL Flag (indicating whether it is a chroma TMRL mode) is parsed to determine whether the current chroma block generates a prediction value through a non-zero reference line. If the prediction value is generated by a TMRL-related mode (Chroma TMRL Flag is 1), then the combination mode index Chroma TMRL Idx and the chroma fusion index TMRL Fusion Idx (indicating whether fusion is performed and, if so, the corresponding fusion method) are parsed; if the prediction value is not generated by a TMRL-related mode (Chroma TMRL Flag is 0), then other intra-frame prediction mode related syntax elements are parsed. Table 4 shows a related syntax semantic table for the syntax semantics of the CU layer Chroma TMRL related mode.

[0365] Table 4

[0366] The `intra_tmrl_chroma_flag` flag indicates whether a chroma TMRL-related mode is used to generate the prediction value. For example, `intra_tmrl_chroma_flag` being 1 indicates that the intra-prediction mode for the chroma sample is a TMRL-related mode, while `intra_tmrl_chroma_flag` being 0 indicates that the intra-prediction mode for the chroma sample is not a TMRL-related mode. `intra_tmrl_chroma_idx` indicates the index of the chroma TMRL mode in the candidate list.

[0367] Additionally, `intra_tmrl_chroma_fusion_idx` indicates whether fusion is applied in the chroma TMRL mode and the corresponding fusion method. A value of 0 for `intra_tmrl_chroma_fusion_idx` means that the chroma TMRL mode does not use fusion to generate predicted values, while a value greater than 0 indicates that the chroma TMRL mode uses fusion to generate predicted values.

[0368] It is also understood that, in some embodiments, the method may further include: parsing the prediction residual value of the current block in the bitstream; and determining the reconstructed sample of the current block based on the prediction value of the current block and the prediction residual value of the current block.

[0369] It should be noted that, in the embodiments of this application, after determining the predicted value of the current block, the predicted value of the current block and the predicted residual value of the current block in the bitstream can be added together to determine the reconstructed sample of the current block.

[0370] This application provides a decoding method that determines a first prediction value for the chroma components of the current block when using a template-based multi-reference line intra-frame prediction mode; and determines a second prediction value for the chroma components of the current block when using the first prediction mode; then, based on the first and second prediction values, determines the prediction value of the current block. Thus, when the current block uses a chroma TMRL mode fusion method, the first prediction value obtained from the chroma TMRL mode can be fused with the second prediction values ​​obtained from other chroma modes (e.g., the first prediction mode) to generate a fused final prediction value. This improves the prediction accuracy under the chroma TMRL mode, and since the first prediction mode can be any chroma mode, it also increases the prediction diversity under the chroma TMRL mode, thereby improving compression efficiency and ultimately enhancing encoding / decoding performance.

[0371] In another embodiment of this application, FIG18 is a flowchart illustrating an encoding method provided in an embodiment of this application. As shown in FIG18, the method may include:

[0372] S1801, determine the first prediction value of the chroma components of the current block when using the template-based multi-reference line intra-prediction mode.

[0373] It should be noted that the encoding method in this application embodiment is applied to an encoder, and the encoding method may refer to a fusion prediction method based on chroma TMRL mode, which is used to improve the prediction accuracy in chroma TMRL mode.

[0374] It should also be noted that, in this embodiment, the prediction and fusion of the predicted values ​​are mainly performed on the chroma components of the current block. Here, the chroma components of the current block can also be simply referred to as the "chroma block".

[0375] In some embodiments, when the chroma components of the current block use the TMRL mode, determining the first predicted value of the chroma components of the current block using the template-based multi-reference line intra-prediction mode may include: determining a combination candidate list for the current block; determining a first combination mode for the current block based on the combination candidate list; wherein the first combination mode includes the reference line and intra-prediction modes used by the current block; and predicting the chroma components of the current block based on the reference line and intra-prediction modes used by the current block to determine the first predicted value of the current block.

[0376] In some embodiments, determining a combined candidate list for the current block may include: determining at least one candidate reference line and at least one candidate intra-prediction mode for the current block; combining the at least one candidate reference line and the at least one candidate intra-prediction mode to determine multiple candidate combination modes for the current block; and determining a combined candidate list for the current block based on the multiple candidate combination modes.

[0377] It should be noted that, in the embodiments of this application, each candidate combination mode can be composed of candidate reference lines and candidate intra-prediction modes. Specifically, the selectable range for candidate reference lines is {1, 3, 5}, i.e., reference line 1, reference line 3, and reference line 5. The candidate reference lines for the current chroma TMRL mode can be determined based on the number of available reference lines for the current block chroma component. For example, if the number of available reference lines for the current block chroma component is 4, then the candidate reference lines include reference line 1 and reference line 3; if the number of available reference lines for the current block chroma component is 6, then the candidate reference lines include reference line 1, reference line 3, and reference line 5.

[0378] Additionally, for candidate intra-frame prediction modes, a possible construction process includes:

[0379] i) Intra-frame non-cross-component prediction modes for chroma: DM, DIMD, DC modes.

[0380] j) Co-position luminance mode: The intra-frame prediction mode of the luminance CUs corresponding to the center C, upper left TL, upper right TR, lower left BL, and lower right BR positions in the co-position luminance region, as shown in Figure 3.

[0381] k) Prediction patterns of adjacent chromaticity blocks: chromaticity prediction patterns at positions L', T', BL', TR' and TL', as shown in Figure 3.

[0382] l) Default Intra-Prediction Mode: If the number of candidate prediction modes is still insufficient after steps a), b), and c), the default intra-prediction mode is continued to be added. The default intra-prediction mode is obtained by offsetting the first angular prediction mode in the current candidate prediction mode list. The offset can be {-1, +1, -2, +2, ...}. If this is still insufficient, the second angular prediction mode in the candidate list is offset and added, and so on.

[0383] Thus, after obtaining at least one candidate reference line and at least one candidate intra-frame prediction mode, for example, M candidate reference lines (e.g., M≤3) and N candidate intra-frame prediction modes (e.g., N=8), combining the M candidate reference lines and N candidate intra-frame prediction modes can yield P (P=M×N, for example, M×N≤24) candidate combination modes.

[0384] Understandably, in the embodiments of this application, these multiple candidate combination patterns can be directly determined as the combination candidate list for the current block. However, in order to reduce the coded bits in the bitstream, the length of the combination candidate list needs to be shortened. In some embodiments, the method may further include: predicting the first template of the current block based on the multiple candidate combination patterns to determine the template prediction value corresponding to the multiple candidate combination patterns; calculating the cost based on the template prediction value corresponding to the multiple candidate combination patterns and the template reconstruction value of the first template to determine the cost result corresponding to the multiple candidate combination patterns; sorting the multiple candidate combination patterns according to the cost result, and taking the top T candidate combination patterns as the combination candidate list for the current block.

[0385] It should be noted that in this embodiment, T is a positive integer, for example, T = 6. Here, the top T candidate combination patterns from P candidate combination patterns are used to form the current block's combination candidate list. That is, the value of T does not exceed P.

[0386] It should also be noted that, in the embodiments of this application, the first template of the current block may include the same brightness and the chromaticity region of the left column of the previous row. In addition, the cost calculation here may be performed using criteria such as MSE, MAE, RMSE, SAD, SATD, etc., and then the cost result corresponding to each candidate combination mode is determined according to the aforementioned formula (1).

[0387] In this way, the cost results of each of the P candidate combination patterns on the first template are calculated, and then the P candidate combination patterns are sorted according to the cost results to obtain a sorted candidate list. Only the top T candidate combination patterns are retained as the final combination candidate list, so that the length of the combination candidate list changes from P to T, thereby shortening the list length.

[0388] It can also be understood that, in the embodiments of this application, determining the first combination mode of the current block according to the combination candidate list may include: calculating the encoding cost of the current block according to at least two candidate combination modes in the combination candidate list, and determining the cost result corresponding to at least two candidate combination modes; determining the minimum cost result according to the cost result corresponding to at least two candidate combination modes, and determining the candidate combination mode corresponding to the minimum cost result as the first combination mode of the current block.

[0389] In other words, in this embodiment of the application, the cost can be calculated separately for each candidate combination mode in the final retained candidate combination list. The cost here can be a combination of distortion and bit rate, where distortion represents prediction error and bit rate reflects compression efficiency. An example of calculating the cost is shown in the aforementioned formula (2).

[0390] Thus, in this embodiment of the application, the T candidate combination modes are sorted according to the cost obtained by formula (2), and the candidate combination mode with the lowest cost is taken as the optimal TMRL prediction mode (i.e. the best combination mode), which is the first combination mode used in the current block.

[0391] In some embodiments, the method may further include: determining the combination mode index of the current block; encoding the combination mode index of the current block and writing the obtained encoded bits into the bitstream.

[0392] In this embodiment, the combination pattern index can be represented by Chroma TMRL Idx, or by the syntax element intra_tmrl_chroma_idx. Furthermore, the combination pattern index indicates the index number of the first combination pattern in the combination candidate list. That is, it represents the index number of the optimal combination pattern with the lowest cost in the final retained combination candidate list. Thus, based on the combination pattern index and the combination candidate list, the first combination pattern used by the current block can be determined.

[0393] In other words, in this embodiment of the application, after determining the first combination mode of the current block based on the cost calculation, the chroma components of the current block are predicted based on the reference line and intra-frame prediction mode in the first combination mode, and the first prediction value of the current block can be obtained.

[0394] S1802, determine the second prediction value of the chromaticity component of the current block when using the first prediction mode.

[0395] S1803, Determine the prediction value of the current block based on the first prediction value and the second prediction value.

[0396] It should be noted that, in the embodiments of this application, the first prediction mode can be any mode of chroma intra-frame prediction, including but not limited to CCCM, CCLM, GLM, etc. For example, the first prediction mode may include non-cross-component prediction modes that do not use chroma multi-reference lines, such as Chroma DIMD, DM, DC, Planar, DBV, etc., and may also include cross-component prediction modes such as CCLM, CCCM, GLM, etc., and may also include other chroma TMRL modes in the combined candidate list, etc., but no limitations are made here.

[0397] In one possible implementation, the first prediction mode may differ from the template-based multi-reference line intra-prediction mode. Here, the first prediction mode differs from the TMRL mode used by the current block. Exemplarily, the first prediction mode may derive a second prediction value using reference line and / or intra-prediction modes different from the TMRL mode.

[0398] In another possible implementation, determining the first prediction mode for the current block may further include: determining at least one candidate prediction mode for the current block; and determining the first prediction mode from the at least one candidate prediction mode. Exemplarily, any one of these at least one candidate prediction modes can be used as the first prediction mode for the current block.

[0399] In another possible implementation, determining the first prediction mode for the current block may further include: predicting the first template of the current block based on at least one candidate prediction mode, and determining the template prediction value corresponding to the at least one candidate prediction mode; calculating the cost between the template prediction value corresponding to the at least one candidate prediction mode and the template reconstruction value of the first template, and determining the cost result corresponding to the at least one candidate prediction mode; sorting the at least one candidate prediction mode according to the cost result, determining the top K candidate prediction modes, and determining the first prediction mode from the K candidate prediction modes; where K is a positive integer.

[0400] In other words, in this embodiment, the first prediction mode participating in the fusion can be filtered by template cost, retaining only the mode with the lower template cost for fusion. For example, assuming that the candidate prediction modes for fusion with the chroma TMRL mode include six types, namely MM-CCCM, CCCM, MM-CCLM, CCLM, MM-GLCCCM, and GL-CCCM, the predicted values ​​of the above six candidate prediction modes on the template are calculated first, and the absolute error between the template predicted value and the reconstructed value is calculated as the template cost. The prediction modes are then sorted by template cost, and finally only the three candidate prediction modes with the lower template cost are retained to participate in the subsequent fusion of the chroma TMRL mode prediction values.

[0401] In some embodiments, determining a second prediction value for the chroma components of the current block using a first prediction mode may include: determining a first prediction mode for the current block when the chroma components of the current block are predicted using a fusion method; and predicting the chroma components of the current block according to the first prediction mode to determine a second prediction value for the current block.

[0402] It should also be noted that, in the embodiments of this application, when the chromaticity components of the current block are predicted using a fusion method, the first prediction mode of the current block is first determined, and then the chromaticity components of the current block are predicted according to the first prediction mode to obtain the second prediction value of the current block.

[0403] In some embodiments, for step S1803, determining the predicted value of the current block based on the first predicted value and the second predicted value may include: fusing the first predicted value and the second predicted value to determine the predicted value of the current block.

[0404] In some embodiments, the method for determining the predicted value of the current block may further include: determining a first weight corresponding to a first predicted value and a second weight corresponding to a second predicted value; and performing a weighted operation on the first predicted value and the second predicted value according to the first weight and the second weight to determine the predicted value of the current block.

[0405] In this embodiment, the first weight can be represented by w0, and the second weight can be represented by w1. Furthermore, assuming the first predicted value can be represented by pred0(i,j), the second predicted value can be represented by pred1(i,j), and the predicted value of the current block can be represented by pred... C (i,j) indicates that, in one possible implementation, the first predicted value and the second predicted value are weighted according to the first weight and the second weight to obtain the final predicted value (or "fusion predicted value") of the current block, as shown in the aforementioned formula (10).

[0406] In this embodiment of the application, the first weight w0 and the second weight w1 can be set according to the actual situation. The following are some possible implementation methods as examples for relevant explanation.

[0407] In one possible implementation, the method may further include setting the first weight and the second weight to fixed constants. For example, {w0,w1} could be set to {3,1}.

[0408] In another possible implementation, the method may further include: determining the left-side adjacent reference block and the upper-side adjacent reference block of the current block; and determining a first weight and a second weight based on the prediction modes of the left-side adjacent reference block and the upper-side adjacent reference block, respectively.

[0409] It should be noted that, in the embodiments of this application, determining the first weight and the second weight based on the prediction modes of the left adjacent reference block and the upper adjacent reference block may include:

[0410] When all the left-side adjacent reference blocks and the upper-side adjacent reference blocks are valid and their respective prediction modes are cross-component prediction modes, the first weight and the second weight are set to the first set of preset values.

[0411] When there is only one valid prediction mode in the left adjacent reference block and the upper adjacent reference block and the corresponding prediction mode is the cross-component prediction mode, the first weight and the second weight are set to the second set of preset values.

[0412] When all the left-side adjacent reference blocks and the upper-side adjacent reference blocks are invalid, or at least one is valid and the corresponding prediction mode is a non-cross-component prediction mode, the first weight and the second weight are set to the third set of preset values.

[0413] In this embodiment, the first set of preset values ​​can be {w0,w1} = {1,3}, the second set of preset values ​​can be {w0,w1} = {2,2}, and the third set of preset values ​​can be {w0,w1} = {3,1}. Thus, after obtaining the left-side adjacent chroma block cuLeft and the upper-side adjacent chroma block cuAbove of the current block, a determination can be made based on whether the left-side adjacent chroma block cuLeft and the upper-side adjacent chroma block cuAbove are valid, and whether their intra-frame prediction mode is a cross-component prediction mode if valid.

[0414] For example, if both cuLeft and cuAbove are valid and the prediction mode is CCP mode, then {w0,w1} = {1,3}; if only one of cuLeft and cuAbove is valid and the prediction mode is CCP mode, then {w0,w1} = {2,2}; otherwise, in other cases, {w0,w1} = {3,1}.

[0415] In another possible implementation, the method may further include: calculating the cost of a first template of the current block according to a first prediction mode, determining a first cost result, and determining the number of samples for the first template; and determining a first weight and a second weight based on the first cost result and the number of samples for the first template.

[0416] It should be noted that, in the embodiments of this application, determining the first weight and the second weight based on the first cost result and the number of samples in the first template may include:

[0417] When the first cost result is greater than the first product between the number of samples of the first factor and the first template, the first weight and the second weight are set to the fourth set of preset values;

[0418] When the first cost result is less than the second product between the number of samples of the second factor and the first template, the first weight and the second weight are set to the fifth set of preset values;

[0419] When the first cost result is greater than or equal to the second product and less than or equal to the first product, the first weight and the second weight are set to the sixth group of preset values.

[0420] In the embodiments of this application, the first factor and the second factor can be different. The first factor can be a preset constant value, such as 64; the second factor can also be a preset constant value, such as 4, and there is no limitation here.

[0421] In this embodiment, the fourth set of preset values ​​can be {w0,w1} = {3,1}, the fifth set of preset values ​​can be {w0,w1} = {1,3}, and the sixth set of preset values ​​can be {w0,w1} = {2,2}. Thus, assuming the first prediction mode is MM-CCCM mode, MM-CCCM is first applied to the template (the template is set to the row above and column to the left of the current chromaticity CU, and the total number of pixels in the template is denoted as numSample). The sum of the absolute errors between the predicted and reconstructed values ​​of the template is calculated and denoted as cccmSAD.

[0422] For example, if cccmSAD > 64 × numSample, then {w0, w1} = {3, 1}; if cccmSAD < 4 × numSample, then {w0, w1} = {1, 3}; otherwise, in other cases, {w0, w1} = {2, 2}.

[0423] In another possible implementation, the method may further include: predicting a first template of the current block according to a template-based multi-reference row intra-prediction mode and a first prediction mode respectively; determining a first template prediction value corresponding to the template-based multi-reference row intra-prediction mode and a second template prediction value corresponding to the first prediction mode; determining a first autocorrelation matrix of the first template prediction value and the second template prediction value, and determining a first cross-correlation vector between the first template prediction value, the second template prediction value and the template reconstruction value of the first template; and determining a first weight and a second weight according to the first autocorrelation matrix and the first cross-correlation vector.

[0424] In this embodiment, the formula can also be derived based on the predicted values ​​of the chroma TMRL and the first prediction mode fused with it on the template, and the reconstructed values ​​of the template itself. For example, assuming the first prediction mode fused with the chroma TMRL mode is an MM-CCCM mode, the chroma TMRL mode and the MM-CCCM mode can be applied to the template to obtain predicted values, denoted as tempPred0 and tempPred1, respectively. The template reconstructed value tempReco is then obtained. Then, tempPred0 and tempPred1 are used as inputs, and tempReco is used as the output. The autocorrelation matrix of the input and the cross-correlation vector between the input and the chroma template reconstructed value output are calculated to perform MSE minimization. The autocorrelation matrix is ​​decomposed using LDL, and the final filter coefficients, i.e., the first weight w0 and the second weight w1, are calculated using the inverse substitution method.

[0425] In other words, in this embodiment of the application, the fusion weights (including the first weight w0 and the second weight w1) can be determined according to the actual situation. For example, the selection range of the fusion weights {w0, w1} includes, but is not limited to, fixed weights {0.5, 0.5}, {0.75, 0.25}, {0.25, 0.75}, etc., or the fusion weights {w0, w1} can also be adaptively determined according to the actual situation. For example, the fusion weights can be adaptively determined based on the predicted and reconstructed values ​​of the two modes in the template, or based on the intra-frame prediction mode of the chroma of adjacent blocks, etc., without any limitation.

[0426] It is also understood that, in the embodiments of this application, if the current block uses a fusion method, it is necessary to determine the corresponding first prediction mode and the fusion weight according to the specific fusion method number. The following description is based on fusion method 1, fusion method 2 and fusion method 3.

[0427] Fusion Method 1: Fusion of predicted values ​​from the chromaticity TMRL mode and predicted values ​​from the multi-model component linear prediction mode / multi-model convolution component prediction mode;

[0428] Fusion Method 2: Fusion of the predicted values ​​of the chromaticity TMRL mode and the predicted values ​​of the inter-component prediction modes;

[0429] Fusion Method 3: Fusion of the predicted values ​​of the chromaticity TMRL mode and the predicted values ​​of the multi-model component prediction mode.

[0430] In one possible implementation, taking the value of the chroma fusion index as equal to 1 as an example, the method may include: when the chroma components of the current block are predicted using a first fusion method, determining at least one candidate prediction mode for the current block; determining a first prediction mode for the current block among the at least one candidate prediction mode; predicting the chroma components of the current block according to the first prediction mode to determine a second prediction value for the current block; and determining a prediction value for the current block according to the first fusion method, the first prediction value, and the second prediction value.

[0431] It should be noted that, in this embodiment, if the chroma component of the current block uses the first fusion method, then the value of the chroma fusion index in the bitstream is equal to 1. In this case, at least one candidate prediction mode participating in the fusion of the current block may include: a multi-model component linear prediction mode and a multi-model convolution component prediction mode. For example, at least one candidate prediction mode here may include: MM-CCLM mode and MM-CCCM mode.

[0432] In some embodiments, determining the predicted value of the current block based on the first fusion method, the first predicted value, and the second predicted value may include: fusing the first predicted value and the second predicted value according to the first fusion method to determine the predicted value of the current block.

[0433] In some embodiments, the method for determining the predicted value of the current block may further include: determining a first weight and a second weight corresponding to a first fusion method; and performing a weighted operation on the first predicted value and the second predicted value according to the first weight and the second weight to determine the predicted value of the current block.

[0434] In one specific embodiment, for the predicted value of the current block, the method may further include: performing a weighted operation on the first predicted value and the second predicted value according to the first weight and the second weight to determine the weighted predicted value; determining the third factor according to the preset displacement, and performing a right shift operation on the sum of the weighted predicted value and the third factor according to the preset displacement to determine the predicted value of the current block.

[0435] It should also be noted that in the embodiments of this application, the first weight can be represented by w0, the second weight can be represented by w1, the preset displacement can be represented by shift, and the third factor can be represented by 1 << (shift-1).

[0436] In one specific embodiment, based on the first fusion method, the first predicted value of the chroma TMRL mode and the second predicted value of the multi-model component linear prediction mode or the multi-model convolutional integral quantity prediction mode are fused, and the final predicted value of the current block is derived as shown in the aforementioned formula (11). Here, pred0(i,j) is the first predicted value obtained using the chroma TMRL mode, pred1(i,j) is the second predicted value obtained using the multi-model component linear prediction mode or the multi-model convolutional integral quantity prediction mode, and pred C (i,j) represents the final predicted value after fusion; shift is 2, and w0 and w1 are the fusion weights. To obtain the final predicted value, it is necessary to determine the first prediction mode participating in the fusion and calculate its predicted value pred1, as well as the fusion weights w0 and w1.

[0437] In some embodiments, determining the first prediction mode of the current block among at least one candidate prediction mode may include: when the current block does not meet the application conditions of the multi-model component inter-prediction mode, determining the first prediction mode of the current block as the multi-model component inter-linear prediction mode.

[0438] When the current block meets the application conditions of the multi-model component inter-prediction mode, the cost of the first template of the current block is calculated according to the multi-model component inter-linear prediction mode and the multi-model component inter-prediction mode, respectively, to determine the two template cost results; and the minimum cost result is determined among the two template cost results, and the candidate prediction mode corresponding to the minimum cost result is determined as the first prediction mode of the current block.

[0439] It should be noted that whether the current block meets the application conditions of the multi-model convolutional integral inter-prediction mode can be related to the number of available neighboring reference pixels. For example, if the number of neighboring pixels used for referencing the derivation of the multi-model convolutional integral inter-prediction mode is too small, then the multi-model convolutional integral inter-prediction mode cannot be used.

[0440] It should also be noted that in the first fusion method, the intra-frame modes participating in the fusion are either multi-model component linear prediction modes or multi-model convolution component prediction modes. First, the intra-frame modes participating in the fusion need to be determined by comparing template costs, and then the prediction value under that mode is calculated. For example, taking the MM-CCLM and MM-CCCM modes as examples, if the current chroma block does not meet the application conditions of the MM-CCCM mode, then the intra-frame mode participating in the fusion is the MM-CCLM mode; if the current chroma block meets the application conditions of the MM-CCCM mode, then the intra-frame modes participating in the fusion need to be determined by sorting the template costs. Specifically, the MM-CCLM model and the MM-CCCM model are first derived based on the reference pixels of the current chroma block, and then applied to the template respectively, calculating their template costs CCLMSAD and CCCMSAD respectively. The mode with the smaller template cost is determined as the intra-frame mode participating in the fusion (the corresponding template cost is denoted as bestSAD, and the number of template pixels is denoted as NumSample).

[0441] Thus, after determining the first prediction mode participating in the fusion from the linear prediction mode among multi-model components and the prediction mode among multi-model convolutional components, the second prediction value pred1 of the current chromaticity CU under this mode can be calculated.

[0442] In some embodiments, when the current block does not meet the application conditions of the multi-model convolution integral prediction mode, determining the first weight and the second weight corresponding to the first fusion method may include: determining the left adjacent reference block and the upper adjacent reference block of the current block.

[0443] When all the left-side adjacent reference blocks and the upper-side adjacent reference blocks are valid and their respective prediction modes are cross-component prediction modes, the first weight and the second weight are set to the seventh group of preset values.

[0444] When there is only one valid prediction mode in the left adjacent reference block and the upper adjacent reference block and the corresponding prediction mode is the cross-component prediction mode, the first weight and the second weight are set to the eighth group of preset values.

[0445] When all the left-side adjacent reference blocks and the upper-side adjacent reference blocks are invalid, or at least one is valid and the corresponding prediction mode is a non-cross-component prediction mode, the first weight and the second weight are set to the ninth group of preset values.

[0446] In other words, in this embodiment, it is assumed that the seventh set of preset values ​​can be {w0,w1} = {1,3}, the eighth set of preset values ​​can be {w0,w1} = {2,2}, and the ninth set of preset values ​​can be {w0,w1} = {3,1}. For example, still taking MM-CCLM and MM-CCCM modes as examples, if the current block does not meet the application conditions of MM-CCCM mode, then the intra-frame mode participating in the fusion can only be MM-CCLM mode. At this time, its fusion weights w0 and w1 are related to the intra-frame prediction modes of adjacent chroma blocks. Specifically, first, the left adjacent chroma block cuLeft and the upper adjacent chroma block cuAbove are obtained, and then it is determined whether the left adjacent chroma block cuLeft and the upper adjacent chroma block cuAbove are valid, and if valid, whether its intra-frame prediction mode is the cross-component prediction mode (CCP). If both cuLeft and cuAbove are valid and the prediction mode is CCP mode, then {w0, w1} = {1, 3}; if only one of cuLeft and cuAbove is valid and the prediction mode is CCP mode, then {w0, w1} = {2, 2}; otherwise, {w0, w1} = {3, 1}.

[0447] In other embodiments, when the current block satisfies the application conditions of the multi-model convolutional integral prediction mode, determining the first weight and the second weight corresponding to the first fusion method may include: determining the minimum cost result and the number of samples of the first template.

[0448] When the minimum cost result is greater than the third product between the number of samples of the fourth factor and the first template, the first weight and the second weight are set to the tenth group preset value.

[0449] When the minimum cost result is less than the fourth product between the number of samples of the fifth factor and the first template, the first weight and the second weight are set to the eleventh set of preset values.

[0450] When the minimum cost result is greater than or equal to the fourth product and less than or equal to the third product, the first weight and the second weight are set to the preset value of the twelfth group.

[0451] In the embodiments of this application, the fourth factor and the fifth factor may be different. The fourth factor may be a preset constant value, such as 64; the fifth factor may also be a preset constant value, such as 4, and no limitation is made here.

[0452] In other words, in this embodiment, it is assumed that the tenth preset value can be {w0,w1}={3,1}, the eleventh preset value can be {w0,w1}={1,3}, and the twelfth preset value can be {w0,w1}={2,2}. If the current chroma block meets the application conditions of the multi-model convolutional integral prediction mode, the fusion weights are derived based on the bestSAD and NumSample obtained in the process of determining the intra-frame mode to participate in the fusion. When bestSAD>64×NumSample, {w0,w1}={3,1}; when bestSAD<4×NumSample, {w0,w1}={1,3}; otherwise, {w0,w1}={2,2}.

[0453] In another possible implementation, taking the value of the chroma fusion index as 2 as an example, the method may include: when the chroma components of the current block are predicted using the second fusion method, determining the first prediction mode of the current block as the inter-component prediction mode; determining the first reconstructed value after the co-position luminance downsampling of the current block; fusing the first predicted value, the first reconstructed value and the first constant according to the second fusion method to determine the predicted value of the current block.

[0454] It should be noted that in the embodiments of this application, if the chroma component of the current block uses the second fusion method, then the value of the chroma fusion index in the bitstream is equal to 2. At this time, the first prediction mode of the current block includes inter-component prediction modes, such as CCLM mode or CCCM mode, etc.

[0455] In some embodiments, determining the predicted value of the current block based on the second fusion method, the first predicted value, and the first reconstructed value may include: fusing the first predicted value, the first reconstructed value, and the first constant according to the second fusion method to determine the predicted value of the current block.

[0456] In some embodiments, the method for determining the predicted value of the current block may further include: determining a first weight, a second weight, and a third weight corresponding to the second fusion method; and performing a weighted operation on the first predicted value, the first reconstructed value, and the first constant according to the first weight, the second weight, and the third weight to determine the predicted value of the current block.

[0457] In this embodiment, the first weight can be represented by α0, the second weight by α1, the third weight by α2, and the first constant by β, the value of which can be set to 1 << (bitdepth-1).

[0458] In one specific embodiment, based on the second fusion method, the first predicted value of the chroma TMRL mode and the second predicted value of the inter-component prediction mode are fused. For example, assuming the inter-component prediction mode here is an inter-component linear prediction mode, such as the CCLM mode, then the final predicted value of the current block is derived as shown in the aforementioned formula (12). Here, pred0(i,j) is the first predicted value obtained using the chroma TMRL mode, rec′ L (i,j) represents the reconstructed value after downsampling of the same brightness, pred C (i,j) represents the final predicted value after fusion; β is a fixed value with a value of 1 << (bitdepth-1), and α0, α1, and α2 are the fusion weights. To obtain the final predicted value, rec′ needs to be calculated. L (i,j), and the fusion weights α0, α1, and α2. Where rec′ L (i,j) can be obtained by calculating the reconstructed value after downsampling the co-position brightness of the current block.

[0459] In some embodiments, determining the first weight, second weight, and third weight corresponding to the second fusion method may include: predicting the first template of the current block according to the template-based multi-reference line intra-prediction mode, and determining the first template prediction value corresponding to the template-based multi-reference line intra-prediction mode; obtaining the second reconstructed value and the second constant after luminance downsampling of the first template; determining the second autocorrelation matrix of the first template prediction value, the second reconstructed value, and the second constant, and determining the second cross-correlation vector between the first template prediction value, the second reconstructed value, the second constant, and the chrominance reconstructed value of the first template; and determining the first weight, the second weight, and the third weight according to the second autocorrelation matrix and the second cross-correlation vector.

[0460] In this embodiment, the second constant can also be represented by β, and its value can be set to 1 << (bitdepth-1). Thus, based on the intra-prediction mode corresponding to the current chroma TMRL, the predicted value of this mode on the template (the template is the top two rows and left two columns of the current chroma block) is calculated, obtaining the luminance downsampling reconstruction value and β value of the template region. This is achieved by calculating pred0(i,j) and rec′ on the template. L MSE minimization is performed using the autocorrelation matrix of (i,j) and β input, as well as the cross-correlation vector between the input and the chroma reconstruction output. The autocorrelation matrix is ​​decomposed using LDL, and the final filter coefficients, i.e., the fusion weights α0, α1, and α2, are calculated using the inverse substitution method.

[0461] In another possible implementation, taking the value of the chroma fusion index as 3 as an example, the method may include: when the chroma components of the current block are predicted using the third fusion method, determining the first prediction mode of the current block as the multi-model component prediction mode; determining the first reconstructed value of the current block after isotopic luminance downsampling; and determining the predicted value of the current block based on the third fusion method, the first predicted value, and the first reconstructed value.

[0462] It should be noted that in the embodiments of this application, if the chroma component of the current block uses the third fusion method, then the value of the chroma fusion index in the bitstream is equal to 3. At this time, the first prediction mode of the current block includes the prediction mode between multiple model components, such as the MMLM mode.

[0463] In some embodiments, determining the predicted value of the current block based on the third fusion method, the first predicted value, and the first reconstructed value may include: fusing the first predicted value, the first reconstructed value, and the third constant according to the third fusion method to determine the predicted value of the current block.

[0464] In one specific embodiment, determining the predicted value of the current block may further include: when the first reconstructed value is less than or equal to the classification threshold, determining the first weight, second weight, and third weight corresponding to the third fusion method, and performing a weighted operation on the first predicted value, the first reconstructed value, and the third constant according to the first weight, the second weight, and the third weight to determine the predicted value of the current block; when the first reconstructed value is greater than the classification threshold, determining the fourth weight, fifth weight, and sixth weight corresponding to the third fusion method, and performing a weighted operation on the first predicted value, the first reconstructed value, and the third constant according to the fourth weight, the fifth weight, and the sixth weight to determine the predicted value of the current block.

[0465] In this embodiment, the first weight can be represented by α0, the second weight by α1, the third weight by α2, the fourth weight by α′0, the fifth weight by α′1, the sixth weight by α′2, and the third constant by β, the value of which can be set to 1 << (bitdepth-1).

[0466] In one specific embodiment, based on the third fusion method, the first predicted value of the chroma TMRL mode and the second predicted value of the multi-model component prediction mode are fused, and the final predicted value of the current block is derived as shown in the aforementioned formula (13). Here, pred0(i,j) is the first predicted value obtained using the chroma TMRL mode, rec′ L (i,j) represents the reconstructed value after downsampling of the same brightness, pred C(i,j) represents the final predicted value after fusion; β is a fixed value, with a value of 1 << (bitdepth-1); modThr is the classification threshold, which is the average value of neighboring samples in the luminance reconstruction. The fusion weights α0, α1, and α2, as well as α′0, α′1, and α′2, are derived from neighboring luminance and chrominance samples using the same LDL derivation method as in the inter-convolutional integral prediction mode.

[0467] In some embodiments, the method may further include determining the fusion weights α0, α1 and α2 and α′0, α′1 and α′2 by dividing the first template of the current block according to a classification threshold, and determining the first sub-template and the second sub-template.

[0468] The first sub-template is predicted according to the template-based multi-reference line intra-prediction mode, and the predicted value of the first sub-template corresponding to the template-based multi-reference line intra-prediction mode is determined. After obtaining the third reconstructed value and the fourth constant of the luminance downsampled first sub-template, the third autocorrelation matrix of the predicted value, the third reconstructed value and the fourth constant of the first sub-template is determined, as well as the third cross-correlation vector between the predicted value, the third reconstructed value and the fourth constant and the chrominance reconstructed value of the first sub-template is determined. Based on the third autocorrelation matrix and the third cross-correlation vector, the first weight, the second weight and the third weight are determined.

[0469] The second sub-template is predicted according to the template-based multi-reference line intra-frame prediction mode, and the predicted value of the second sub-template corresponding to the template-based multi-reference line intra-frame prediction mode is determined. After obtaining the fourth reconstructed value and the fifth constant of the luminance downsampled second sub-template, the fourth autocorrelation matrix of the predicted value, the fourth reconstructed value and the fifth constant of the second sub-template is determined, as well as the fourth cross-correlation vector between the predicted value, the fourth reconstructed value and the fifth constant of the second sub-template and the chrominance reconstructed value of the second sub-template is determined. Based on the fourth autocorrelation matrix and the fourth cross-correlation vector, the fourth weight, the fifth weight and the sixth weight are determined.

[0470] In this embodiment, both the fourth and fifth constants can be represented by β, and their values ​​can be set to 1 << (bitdepth-1). Thus, based on the intra-prediction mode corresponding to the current chroma TMRL, the predicted value of this mode on the template (the template is the top two rows and left two columns of the current chroma block) is calculated, obtaining the luminance downsampled reconstruction value and β value of the template region. Based on the mean of the template luminance downsampled reconstruction value modThr, the input of the template is divided into two categories, respectively calculated by pred0(i,j) and rec′ on the template. LMSE minimization is performed using the autocorrelation matrix of (i,j) and β inputs, as well as the cross-correlation vector between the input and the chroma reconstruction output. The autocorrelation matrix is ​​decomposed by LDL, and the final two sets of filter coefficients, namely the fusion weights α0, α1, and α2, and α′0, α′1, and α′2, are calculated using the inverse substitution method.

[0471] In another possible implementation, taking the chroma fusion index as equal to 0 as an example, the method may also include: when the chroma components of the current block are not predicted using the fusion method, the first predicted value is directly determined as the predicted value of the current block.

[0472] It should be noted that in this embodiment, if the chroma component of the current block does not use a fusion method, then the value of the chroma fusion index in the bitstream is equal to 0. In this case, the first prediction value is directly determined as the prediction value of the current block.

[0473] It should also be noted that, in the embodiments of this application, the predicted value of the current block is the final predicted value after fusion (or simply "fusion predicted value"). The final predicted value may include:

[0474] If the value of the chroma fusion index is equal to 0, it means that the fusion method is not used, and the final predicted value is as shown in the aforementioned formula (14).

[0475] If the value of the chroma fusion index is equal to 1, it means that the first fusion method is used, and the final predicted value is as shown in the aforementioned formula (15).

[0476] If the value of the chroma fusion index is equal to 2, it means that the second fusion method is used, and the final predicted value is as shown in the aforementioned formula (16).

[0477] If the value of the chroma fusion index is equal to 3, it means that the third fusion method is used, and the final predicted value is as shown in the aforementioned formula (17).

[0478] It is also understood that, in some embodiments, the method may further include: determining the chroma fusion index of the current block; encoding the chroma fusion index of the current block; and writing the obtained encoded bits into the bitstream.

[0479] It should be noted that, in this embodiment, the chroma fusion index is used to indicate whether the chroma components of the current block use a fusion method. The chroma fusion index can be represented by TMRL Fusion Idx, or by the syntax element intra_tmrl_chroma_fusion_idx. Here, if the chroma components of the current block do not use a fusion method, the value of the chroma fusion index is determined to be 0; if the chroma components of the current block use a fusion method, the value of the chroma fusion index is determined to be greater than 0.

[0480] It should also be noted that, in this embodiment, the chroma fusion index is also used to indicate the fusion method number corresponding to the fusion method used for the chroma components of the current block. That is, when the value of the chroma fusion index is greater than 0, the specific value of the chroma fusion index can be determined based on the fusion method used by the current block. For example, if the current block uses the first fusion method (or denoted as fusion method 1), then the value of the chroma fusion index is determined to be 1; if the current block uses the second fusion method (or denoted as fusion method 2), then the value of the chroma fusion index is determined to be 2; if the current block uses the third fusion method (or denoted as fusion method 3), then the value of the chroma fusion index is determined to be 3. In other words, when the current block uses a fusion method for prediction, there is a correspondence between the value of the chroma fusion index and the fusion method number used by the current block. In one implementation, the possible values ​​and meanings of the chroma fusion index intra_tmrl_chroma_fusion_idx are shown in Table 3.

[0481] It should also be noted that, in this embodiment of the application, whether a fusion method is used for the current block and which fusion method is used can also be determined by cost calculation. For example, the cost calculation here can be a comprehensive consideration of distortion and bitrate, where distortion represents prediction error and bitrate reflects compression efficiency. An example of calculating the cost is as follows: cost=dist+λ×estbits (18)

[0482] Where dist represents distortion, with a value of dist = min{2×SAD,SATD}, λ is the Lagrange factor, and estbits is the estimated number of bits.

[0483] Thus, based on the aforementioned costs, the cost results of not using a fusion method and using the three fusion methods are sorted, and the fusion method with the lowest cost is taken as the optimal chroma TMRL fusion prediction mode. The chroma fusion index corresponding to this fusion method is recorded and denoted as TMRL Fusion Idx; and the value of TMRL Fusion Idx is written into the bitstream.

[0484] It is also understood that, in some embodiments, the method may further include: determining the value of a first syntax element; encoding the value of the first syntax element; and writing the obtained encoded bits into a bitstream.

[0485] In some embodiments, the method may further include: determining the value of a second syntax element; encoding the value of the second syntax element; and writing the obtained encoded bits into a bitstream.

[0486] It should be noted that, in the embodiments of this application, the first syntax element is used to indicate whether the chroma component of the current block uses a non-cross-component prediction mode, and the second syntax element is used to indicate whether the chroma component of the current block uses a template-based multi-reference line intra-prediction mode. Furthermore, when the chroma component of the current block uses a non-cross-component prediction mode, it is only then that the determination of whether the chroma component of the current block uses a template-based multi-reference line intra-prediction mode is made, i.e., the value of the second syntax element; when the chroma component of the current block uses a template-based multi-reference line intra-prediction mode, step S1801 is executed, i.e., the step of determining the first prediction value when the chroma component of the current block uses the template-based multi-reference line intra-prediction mode.

[0487] It should also be noted that, in the embodiments of this application, the first syntax element can be represented by CCP Flag, and the second syntax element can be represented by Chroma TMRL Flag or intra_tmrl_chroma_flag. That is, firstly, it is determined whether the current chroma block generates a prediction value through cross-component correlation mode, and the value of CCP Flag (indicating whether it is cross-component prediction mode) is written into the bitstream. If the prediction value is not generated by CCP correlation mode (CCP Flag is 0), then it is determined whether the current chroma block generates a prediction value through a non-zero reference line, and the value of Chroma TMRL Flag (indicating whether it is chroma TMRL mode) is written into the bitstream. If the prediction value is generated by a TMRL-related mode (Chroma TMRL Flag is 1), then the combination mode index Chroma TMRL Idx and the chroma fusion index TMRL Fusion Idx (indicating whether fusion is performed and the corresponding fusion method if fusion is performed) are written into the bitstream; if the prediction value is not generated by a TMRL-related mode (Chroma TMRL Flag is 0), then other intra-frame prediction mode related syntax elements are written into the bitstream.

[0488] In one possible implementation, the syntactic semantics for the Chroma TMRL-related modes in the CU layer are shown in Table 4 above. Here, `intra_tmrl_chroma_flag` indicates whether the chroma TMRL-related mode is used to generate prediction values. For example, `intra_tmrl_chroma_flag` being 1 indicates that the intra-prediction mode of the chroma sample is a TMRL-related mode, and `intra_tmrl_chroma_flag` being 0 indicates that the intra-prediction mode of the chroma sample is not a TMRL-related mode. `intra_tmrl_chroma_idx` indicates the index of the chroma TMRL mode in the candidate list. Additionally, `intra_tmrl_chroma_fusion_idx` indicates whether fusion is applied to the chroma TMRL mode and the corresponding fusion method. `intra_tmrl_chroma_fusion_idx` being 0 indicates that the chroma TMRL mode does not use fusion to generate prediction values, and `intra_tmrl_chroma_fusion_idx` being greater than 0 indicates that the chroma TMRL mode uses fusion to generate prediction values.

[0489] It is also understandable that, following step S1803, referring to Figure 16, the method may further include:

[0490] S1804, Determine the prediction residual value of the current block based on the prediction value of the current block.

[0491] S1805: Encode the prediction residual value of the current block and write the obtained encoded bits into the bit stream.

[0492] It should be noted that, in the embodiments of this application, after determining the predicted value of the current block, the initial sample value of the current block and the predicted value of the current block can be subtracted to determine the predicted residual value of the current block.

[0493] It should also be noted that, in the embodiments of this application, encoding the prediction residual value of the current block may further include transforming and quantizing the prediction residual value of the current block, and finally encoding it into the bitstream so that the decoding end can realize the reconstruction of the chroma component of the current block.

[0494] This application provides an encoding method that determines a first prediction value for the chroma components of the current block when using a template-based multi-reference line intra-frame prediction mode; and determines a second prediction value for the chroma components of the current block when using the first prediction mode; then, based on the first and second prediction values, determines the prediction value of the current block. Thus, when the current block uses a chroma TMRL mode fusion method, the first prediction value obtained from the chroma TMRL mode can be fused with the second prediction values ​​obtained from other chroma modes (e.g., the first prediction mode) to generate a fused final prediction value. This improves the prediction accuracy under the chroma TMRL mode, and since the first prediction mode can be any chroma mode, it also increases the prediction diversity under the chroma TMRL mode, thereby improving compression efficiency and ultimately enhancing encoding performance.

[0495] In another embodiment of this application, based on the encoding and decoding method described in the foregoing embodiments, a chroma TMRL mode fusion method is proposed: after the chroma TMRL mode generates a prediction value, it can be fused with the prediction values ​​of other chroma modes to obtain the final chroma prediction value, thereby improving the prediction accuracy and thus improving the encoding efficiency.

[0496] In one possible implementation, using the reference pixels of the corresponding reference row and the traditional intra-frame prediction mode, the chroma prediction value Pred0 of the current block in the chroma TMRL mode is first calculated. Then, the chroma prediction value Pred1 of the current block in other chroma modes is calculated. Based on the fusion weights {w0, w1}, the chroma prediction values ​​1 and 2 are weighted and combined to calculate the final fused chroma prediction value. The chroma modes participating in the fusion can be any chroma intra-frame prediction mode, including but not limited to CCCM mode, CCLM mode, GLM mode, etc. The fusion weights can be determined according to the actual situation. The selection range of the fusion weights {w0, w1} includes, but is not limited to, fixed weights {0.5, 0.5}, {0.75, 0.25}, {0.25, 0.75}, etc., or the fusion weights {w0, w1} can be adaptively determined according to the actual situation. For example, the fusion weights can be adaptively determined based on the predicted and reconstructed values ​​of the two modes in the template, or based on the chroma intra-frame prediction modes of adjacent blocks, etc.

[0497] In one possible implementation, the encoding end determines the chroma TMRL mode index (i.e., the "combination mode index" in the aforementioned embodiment) and the chroma fusion index (whether fusion is needed and, if so, the corresponding fusion method) based on the principle of minimizing cost. The bitstream needs to transmit the chroma TMRL mode combination mode index and the chroma fusion index. The decoding end first decodes the chroma TMRL mode combination mode index, then decodes the chroma fusion index, and calculates the final fused chroma prediction value based on the chroma TMRL mode combination mode index and the chroma fusion index.

[0498] In one possible implementation, taking the acquisition of the chroma intra-frame reconstruction block at the decoding end as an example, the available fusion methods for the chroma TMRL mode include three types:

[0499] Fusion Method 1: Fusion of predicted values ​​from the chromaticity TMRL mode and predicted values ​​from the multi-model component linear prediction mode / multi-model convolution component prediction mode;

[0500] Fusion Method 2: Fusion of the predicted values ​​of the chromaticity TMRL mode and the predicted values ​​of the inter-component prediction modes;

[0501] Fusion Method 3: Fusion of the predicted values ​​of the chromaticity TMRL mode and the predicted values ​​of the multi-model component prediction mode.

[0502] The chroma blending index of the chroma TMRL mode determines whether blending is required, and if blending is required, which of the three blending methods 1, 2, or 3 mentioned above should be used.

[0503] The implementation process of the chromaticity TMRL fusion method proposed in the embodiments of this application is described in detail below.

[0504] (1) Prediction process at the encoding end.

[0505] The fusion prediction process for chroma TMRL modes consists of four steps: obtaining a candidate list of combinations of reference lines and intra-frame prediction modes; sorting the candidate list using a template; calculating relevant data according to the fusion method; and obtaining the prediction value. Figure 19 is a schematic diagram of a fusion prediction process for chroma TMRL modes at the encoding end provided in an embodiment of this application. As shown in Figure 19, the process may include:

[0506] S1901, Obtain a combined candidate list of reference line and intra-frame prediction modes.

[0507] First, determine the candidate list of reference rows for the chroma TMRL mode. One example of obtaining the candidate reference rows is as follows: If the chroma TMRL mode is available (the y-coordinate of the current chroma block is not less than 4), the maximum number of available candidate reference rows for the current chroma TMRL mode is {1,3,5}, i.e., reference row 1, reference row 3, and reference row 5. Based on the number of available reference rows for the current CU chroma components, the candidate reference rows for the current chroma TMRL mode are determined.

[0508] Secondly, the candidate list of intra-prediction modes for the chroma TMRL mode is determined. The candidate list can be composed of existing chroma intra-prediction modes not spanning components in the ECM, in-place luma modes, chroma modes of adjacent blocks, and the default intra-prediction mode. An example of obtaining intra-prediction mode candidates is as follows:

[0509] The construction process is as follows:

[0510] a) Intra-frame non-cross-component prediction modes for chroma: DM, DIMD, DC modes.

[0511] b) Co-position luminance mode: The intra-frame prediction mode of the luminance CUs corresponding to the center C, upper left TL, upper right TR, lower left BL, and lower right BR positions in the co-position luminance region, as shown in Figure 3.

[0512] c) Prediction patterns of adjacent chromaticity blocks: chromaticity prediction patterns at positions L', T', BL', TR' and TL', as shown in Figure 3.

[0513] d) Default Intra-Prediction Mode: If the number of candidate prediction modes is still insufficient after steps a), b), and c), the default intra-prediction mode is continued to be added. The default intra-prediction mode is obtained by offsetting the first angular prediction mode in the current candidate prediction mode list. The offset can be {-1, +1, -2, +2, ...}. If this is still insufficient, the second angular prediction mode in the candidate list is offset and added, and so on.

[0514] Finally, by combining the reference row candidates (number of which is M, for example, M≤3) and the intra-frame prediction mode candidates (number of which is N, for example, N=8), P (P=M×N, for example, M×N≤24) combined prediction modes can be obtained.

[0515] S1902, use a template to sort the candidate list of combinations.

[0516] Before decoding, the co-position luminance component and the chrominance component of reference row 0 have already been decoded to obtain reconstructed values. One feasible method for combining candidate chrominance TMRL modes using template matching (or template cost sorting) is as follows: The co-position luminance and the chrominance region of the left column of the previous row are used as templates. Combination modes (including reference row and intra-frame prediction modes) are applied to the templates. The predicted values ​​of the template regions under the combination mode are calculated. Based on the predicted and reconstructed values ​​of the templates, the error costY of the co-position luminance and the cost Cb of the chrominance in the left column of the previous row are calculated using SATD as the criterion. top costCb left costCr top and costCr left Accordingly, an example of selecting a template area is shown in Figure 4.

[0517] Accordingly, an example of template cost calculation is as follows: the template error cost is calculated according to the aforementioned formula (1).

[0518] For all P (P = M × N) candidate combination patterns, calculate their cost on the template, and sort all candidate patterns according to this cost to obtain a list of candidate combination patterns sorted by template cost. Only the top T (e.g., T = 6) combination patterns in the list are retained.

[0519] S1903, determine the predicted values ​​under different combination modes.

[0520] Based on the final candidate combination list (T types) retained in step S1902, the i-th (0≤i<T) combination mode in the candidate list is selected, and its corresponding reference row and intra-frame prediction mode are obtained. The prediction value of the current combination mode is generated using the current CU reference row. This process includes two parts: obtaining the reference row pixel value and deriving the current block prediction value.

[0521] a) Obtain the reference row pixel value.

[0522] The available reference rows for the chroma TMRL mode include {1,3,5}, and the structure of multiple reference rows is shown in Figure 5.

[0523] When some pixels in the reference row are missing or unavailable, the nearest pixel in the reference row is used to fill the gap. If all pixels in the reference row are unavailable, all pixels in the current reference row are filled with a fixed value, the size of which is mid = 1 << (bitdepth - 1).

[0524] b) Derive the predicted value.

[0525] When generating prediction values, the more distant reference lines are treated similarly to reference line 0, where each pixel in the current block is projected along the direction onto the more distant reference line, and the projected pixel is used as the prediction value, as shown in Figure 6. If the projected pixel is located at a fractional position, the prediction value is obtained through a linear interpolation filter. The filter coefficients can be the inverse ratio of the distance between the fractional position of the projection and its two adjacent integer positions. In particular, for intra-frame prediction mode DC mode, the prediction value for all pixels in the current block is the average of the reference pixels in the upper row / left column / upper row + left column.

[0526] The predicted value for each combination mode is calculated by iterating through the final candidate combination list (T types) retained in step S1902.

[0527] S1904, determine the optimal combination pattern.

[0528] For each combination mode in the final candidate combination list retained in step S1902, its cost is calculated separately. The cost here can be a combination of distortion and bit rate, where distortion represents prediction error and bit rate reflects compression efficiency. An example of calculating the cost is shown in the aforementioned formula (2).

[0529] Based on the above costs, the T combination patterns are sorted, and the combination pattern with the lowest cost is taken as the optimal TMRL prediction pattern (i.e., the best combination pattern). The index (or "combination pattern index") of this pattern in the final candidate combination list retained in step S1902 is recorded and denoted as Chroma TMRL Idx.

[0530] Understandably, in the embodiments of this application, steps S1901 to S1904 are the same as the aforementioned steps S201 to S204.

[0531] S1905, determine and calculate relevant data according to the fusion method.

[0532] Specifically, step S1905 may include:

[0533] S1905-1, calculate the predicted values ​​for other color modes.

[0534] S1905-2, Determine the fusion weights.

[0535] Here, for the predicted values ​​of the chroma TMRL mode obtained in S1903, you can choose not to blend, use blending method 1, use blending method 2, and use blending method 3. Blending methods 1, 2, and 3 are as follows:

[0536] Fusion Method 1: Fusion of predicted values ​​from the chromaticity TMRL mode and predicted values ​​from the multi-model component linear prediction mode / multi-model convolution component prediction mode;

[0537] Fusion Method 2: Fusion of the predicted values ​​of the chromaticity TMRL mode and the predicted values ​​of the inter-component prediction modes;

[0538] Fusion Method 3: Fusion of the predicted values ​​of the chromaticity TMRL mode and the predicted values ​​of the multi-model component prediction mode.

[0539] The following explains the relevant data that needs to be determined and calculated for fusion methods 1, 2, and 3.

[0540] Fusion Method 1:

[0541] The formula for calculating the predicted value of fusion method 1 is shown in the aforementioned formula (11). In the formula, pred0(i,j) is the predicted value obtained using the chromaticity TMRL mode, pred1(i,j) is the predicted value obtained using the multi-model component linear prediction mode or the multi-model convolution component prediction mode, and pred... C (i,j) represents the final predicted value after fusion (referred to as the "fused predicted value"); shift is 2, and w0 and w1 are the fusion weights. To obtain the final predicted value, it is necessary to determine the intra-frame modes participating in the fusion and calculate their predicted values ​​pred1, as well as the fusion weights w0 and w1. The specific calculation steps are as follows:

[0542] (1) Calculate the predicted values ​​for other color modes.

[0543] In fusion method 1, assuming that the intra-frame modes participating in the fusion include MM-CCLM mode or MM-CCCM mode, the intra-frame modes participating in the fusion need to be determined first by comparing template costs, and then the prediction value under that mode is calculated.

[0544] ① Determine the intra-frame mode (MM-CCLM mode / MM-CCCM mode) to participate in the fusion.

[0545] If the current chroma block does not meet the application conditions of MM-CCCM mode, then the intra-frame mode participating in the fusion is MM-CCLM mode;

[0546] If the current chroma block meets the application conditions of the MM-CCCM mode, then the intra-frame modes participating in the fusion need to be determined by sorting the template costs. Specifically, the MM-CCLM model and the MM-CCCM model are first derived based on the reference pixels of the current chroma block, and then applied to the templates respectively. The template costs CCLMSAD and CCCMSAD are calculated respectively, and the mode with the smaller template cost is determined as the intra-frame mode participating in the fusion (the corresponding template cost is denoted as bestSAD, and the number of template pixels is denoted as NumSample).

[0547] ② Calculate the predicted value under this model.

[0548] Using the intra-frame mode participating in the fusion determined in ①, calculate the predicted value pred1 of the current chroma CU under that mode.

[0549] (2) Determine the fusion weights.

[0550] If the current chroma block does not meet the application conditions of the MM-CCCM mode, then the intra-frame mode participating in the fusion can only be the MM-CCLM mode. In this case, its fusion weights w0 and w1 are related to the intra-frame prediction modes of the adjacent chroma blocks. Specifically, first, the left adjacent chroma block cuLeft and the upper adjacent chroma block cuAbove are obtained. Then, it is determined whether the left adjacent chroma block cuLeft and the upper adjacent chroma block cuAbove are valid, and if they are valid, whether their intra-frame prediction mode is the cross-component prediction mode (CCP). If both cuLeft and cuAbove are valid and the prediction mode is CCP mode, then {w0, w1} = {1, 3}; if only one CU among cuLeft and cuAbove is valid and the prediction mode is CCP mode, then {w0, w1} = {2, 2}; otherwise, {w0, w1} = {3, 1}.

[0551] If the current chroma block meets the application conditions of MM-CCCM mode, the fusion weights are derived based on bestSAD and NumSample obtained during the process of determining the intra-frame mode to be fused. When bestSAD > 64 × NumSample, {w0, w1} = {3, 1}; when bestSAD < 4 × NumSample, {w0, w1} = {1, 3}; otherwise, {w0, w1} = {2, 2}.

[0552] Fusion Method 2:

[0553] The formula for calculating the predicted value of fusion method 2 can be shown in the aforementioned formula (12). In the formula, pred0(i,j) is the predicted value obtained using the chromaticity TMRL mode, rec′ L (i,j) represents the reconstructed value after downsampling of the same brightness, pred C (i,j) represents the final predicted value after fusion (which can be simply referred to as the "fusion predicted value"); β is a fixed value with a value of 1 << (bitdepth-1), and α0, α1, and α2 are the fusion weights. To obtain the final predicted value, rec′ needs to be calculated. L (i,j), and the fusion weights α0, α1, and α2. The specific calculation steps are as follows:

[0554] (1) Calculate the predicted values ​​of other prediction models.

[0555] In fusion method 2, the reconstructed value rec′ after brightness downsampling is calculated.L .

[0556] (2) Determine the fusion weights.

[0557] Based on the intra-frame prediction mode corresponding to the current chroma TMRL, calculate the predicted value of this mode on the template (the template is the top two rows and left two columns of the current chroma block), obtain the luminance downsampled reconstruction value and β value of the template region, and calculate pred0(i,j) and rec′ on the template. L MSE minimization is performed using the autocorrelation matrix of (i,j) and β input, as well as the cross-correlation vector between the input and the chroma reconstruction output. The autocorrelation matrix is ​​decomposed using LDL, and the final filter coefficients, i.e., the fusion weights α0, α1, and α2, are calculated using the inverse substitution method.

[0558] Fusion Method 3:

[0559] The formula for calculating the predicted value of fusion method 3 can be shown in the aforementioned formula (13). In the formula, pred0(i,j) is the predicted value obtained using the chromaticity TMRL mode, rec′ L (i,j) represents the reconstructed value after downsampling of the same brightness, pred C (i,j) represents the final predicted value after fusion (referred to as the "fusion predicted value"); β is a fixed value, with a value of 1 << (bitdepth-1); modThr is the classification threshold, which is the average value of adjacent samples in the luminance reconstruction. The fusion weights α0, α1, and α2, as well as α′0, α′1, and α′2, are derived from adjacent luminance and chrominance samples using the same LDL derivation method as in the inter-convolutional integral prediction mode. The specific calculation steps are as follows:

[0560] (1) Calculate the predicted values ​​of other prediction models.

[0561] In fusion method 3, the reconstructed value rec′ after brightness downsampling is calculated. L .

[0562] (2) Determine the fusion weights.

[0563] Based on the intra-prediction mode corresponding to the current chroma TMRL, calculate the predicted value of this mode on the template (the template is the top two rows and left two columns of the current chroma block), obtain the luminance downsampled reconstruction value and β value of the template region, and divide the template input into two categories according to the mean of the template luminance downsampled reconstruction value modThr, respectively by calculating pred0(i,j) and rec′ on the template. LMSE minimization is performed using the autocorrelation matrix of (i,j) and β inputs, as well as the cross-correlation vector between the input and the chroma reconstruction output. The autocorrelation matrix is ​​decomposed by LDL, and the final two sets of filter coefficients, namely the fusion weights α0, α1, and α2, and α′0, α′1, and α′2, are calculated using the inverse substitution method.

[0564] S1906, determine the final predicted value after fusion.

[0565] Based on the chroma fusion index and the fusion weights determined in step S1904, the final predicted value of the current block is obtained.

[0566] If the chroma fusion index is 0, it means that no fusion method is used, and the final predicted value is as shown in the aforementioned formula (14).

[0567] If the chroma fusion index is 1, it means that fusion mode 1 is used, and the final predicted value is as shown in the aforementioned formula (15).

[0568] If the chroma fusion index is 2, it means that fusion mode 2 is used, and the final predicted value is as shown in the aforementioned formula (16).

[0569] If the chroma fusion index is 3, it means that fusion mode 3 is used, and the final predicted value is as shown in the aforementioned formula (17).

[0570] The three fusion methods are iterated in turn, and the predicted value under each fusion method is calculated.

[0571] S1907, Determine the optimal fusion mode.

[0572] For the predicted values ​​under the three fusion methods in step S1906, calculate their costs respectively. The cost here can be a combination of distortion and bit rate. Distortion represents the prediction error, while bit rate reflects the compression efficiency. An example of calculating the cost is shown in the aforementioned formula (18).

[0573] Based on the above costs, the costs of not using the fusion method and using the three fusion methods are ranked. The fusion method with the lowest cost is taken as the optimal chroma TMRL fusion prediction mode, and the chroma fusion index corresponding to this fusion method is recorded, denoted as TMRL Fusion Idx.

[0574] If a chroma TMRL-related mode is selected during the encoding decision-making process, the index Chroma TMRL Idx of the best combination mode in the candidate list after template sorting needs to be encoded. This indicates the reference line and intra-prediction mode used when encoding the current block. Simultaneously, the chroma fusion index TMRL Fusion Idx corresponding to the chroma TMRL mode needs to be encoded to indicate whether a fusion method is applied when encoding the current block, and if so, the corresponding fusion method. The values ​​and meanings of the chroma fusion index intra_tmrl_chroma_fusion_idx are shown in Table 3.

[0575] (2) Decoding and reconstruction process at the decoding end.

[0576] At the decoding end, the basic decoding process for obtaining the intra-chroma reconstruction block includes several steps: parsing the syntax elements in the bitstream and obtaining the prediction residual, obtaining the prediction value, and determining the reconstruction value.

[0577] In one possible implementation, Figure 20 is a schematic diagram of a decoding end parsing syntax elements provided in an embodiment of this application.

[0578] As shown in Figure 20, the process may include:

[0579] S2001, parsing the CCP Flag in the bitstream.

[0580] S2002, determine the CCP flag.

[0581] S2003, parsing CCP-related modes.

[0582] S2004, Parse the Chroma TMRL Flag in the bitstream.

[0583] S2005, determine Chroma TMRL Flag.

[0584] S2006, parsing Chroma TMRL Idx in the bitstream.

[0585] S2007, parse the TMRL Fusion Idx in the bitstream.

[0586] S2008, parse other Non-CCP modes in the bitstream.

[0587] In this embodiment of the application, for step S2002, if the value of CCP Flag is 1, then step S2003 is executed, that is, parsing the CCP-related mode; if the value of CCP Flag is 0, then step S2004 is executed, that is, parsing the Chroma TMRL Flag in the bitstream.

[0588] In this embodiment of the application, for step S2005, if the value of Chroma TMRL Flag is 1, then steps S2006 and S2007 are executed, that is, Chroma TMRL Idx in the bitstream is parsed; if the value of Chroma TMRL Flag is 0, then step S2008 is executed, that is, other Non-CCP modes in the bitstream are parsed.

[0589] In another possible implementation, Figure 21 is a schematic diagram of a process for obtaining chroma reconstruction values ​​at a decoding end according to an embodiment of this application. As shown in Figure 21, the process may include:

[0590] S2101, determine CCP Flag.

[0591] S2102, obtains predicted values ​​based on chromaticity cross-component mode.

[0592] S2103, determine Chroma TMRL Flag.

[0593] S2104, obtains predicted values ​​based on TMRL pattern.

[0594] S2105, obtains the predicted value based on other chroma intra-frame prediction modes.

[0595] S2106, determine if TMRL Fusion Idx > 0.

[0596] S2107, the predicted value is obtained by fusing the predicted values ​​of the TMRL mode and the first prediction mode.

[0597] S2108, obtain the intra-frame chroma block residual value.

[0598] S2109, Obtain intra-frame chroma reconstruction values.

[0599] In this embodiment, for step S2101, if the CCP Flag is 1, then step S2102 is executed, i.e., the prediction value is obtained based on the chroma cross-component mode; if the CCP Flag is 0, then step S2103 is executed, i.e., the Chroma TMRL Flag is determined. If the Chroma TMRL Flag is 1, then step S2104 is executed, i.e., the prediction value is obtained based on the TMRL mode; if the Chroma TMRL Flag is 0, then step S2105 is executed, i.e., the prediction value is obtained based on other chroma intra-frame prediction modes.

[0600] In this embodiment, after obtaining the predicted value based on the TMRL mode, for step S2106, if the judgment result is 1, i.e., TMRL Fusion Idx > 0, then step S2107 is executed; if the judgment result is 0, i.e., TMRL Fusion Idx = 0, then step S2107 is not executed, and the predicted value obtained based on the TMRL mode is directly used as the final predicted value. Then, an addition operation is performed with the intra-frame chroma block residual value obtained in step S2108 to obtain the intra-frame chroma reconstruction value.

[0601] During the parsing of syntax elements, the CCP Flag (indicating whether it is a cross-component prediction mode) is parsed first to determine whether the current chroma block generates a prediction value through a cross-component correlation mode. If the prediction value is not generated by a CCP-related mode (CCP Flag is 0), the Chroma TMRL Flag (indicating whether it is a chroma TMRL mode) is parsed to determine whether the current chroma block generates a prediction value through a non-zero reference line. If the prediction value is generated by a TMRL-related mode (Chroma TMRL Flag is 1), the Chroma TMRL Idx and TMRL Fusion Idx (indicating whether fusion is applied and, if so, the corresponding fusion method) are parsed; if the prediction value is not generated by a TMRL-related mode (Chroma TMRL Flag is 0), other chroma intra-frame prediction mode related syntax elements are parsed. The syntax semantic table for the CU layer Chroma TMRL related mode is shown in Table 4 above.

[0602] Here, when generating predicted values ​​using the Chroma TMRL correlated mode (Chroma TMRL Flag is 1), the resolution of the TMRL Fusion Idx determines whether fusion is applied and, if so, the corresponding fusion method. If the TMRL Fusion Idx is 0, fusion is not applied, and the predicted value is generated solely by the Chroma TMRL mode. If the TMRL Fusion Idx is greater than 0, fusion is applied, and the predicted value is generated according to the corresponding fusion method: if the TMRL Fusion Idx is 1, the fusion method is Fusion Method 1, which fuses the predicted value from the Chroma TMRL mode with the MM-CCLM / MM-CCCM predicted value; if the TMRL Fusion Idx is 2, the fusion method is Fusion Method 2, which fuses the predicted value from the Chroma TMRL mode with the CCLM predicted value; and if the TMRL Fusion Idx is 3, the fusion method is Fusion Method 3, which fuses the predicted value from the Chroma TMRL mode with the MMLM predicted value.

[0603] In another possible implementation, Figure 22 is a schematic diagram of a decoding-end chroma TMRL mode fusion prediction process provided by an embodiment of this application. As shown in Figure 22, the process may include:

[0604] S2201, Obtain a combined candidate list of reference line and intra-frame prediction modes.

[0605] The decoding and encoding ends use the same method to construct the combination candidate list. That is, step S1901 in obtaining the fusion prediction value of the chroma TMRL mode is the same in both the decoding and encoding ends.

[0606] First, determine the candidate list of reference rows for the chroma TMRL. One example of obtaining the candidate reference rows is as follows: If the reference rows are available in the chroma TMRL mode (the y-coordinate of the current chroma block is not less than 4), the maximum number of available candidate reference rows for the current chroma TMRL mode is {1,3,5}, i.e., reference row 1, reference row 3, and reference row 5. Then, based on the number of available reference rows for the current CU chroma components, the candidate reference rows for the current chroma TMRL mode can be determined.

[0607] Secondly, the candidate list of intra-prediction modes for the chroma TMRL mode is determined. The candidate list can be composed of existing chroma intra-prediction modes not spanning components in the ECM, in-place luma modes, chroma modes of adjacent blocks, and the default intra-prediction mode. An example of obtaining intra-prediction mode candidates is as follows:

[0608] The construction process is as follows:

[0609] a) Intra-frame non-cross-component prediction modes for chroma: DM, DIMD, DC modes.

[0610] b) Co-position luminance mode: The intra-frame prediction mode of the luminance CUs corresponding to the center C, upper left TL, upper right TR, lower left BL, and lower right BR positions in the co-position luminance region, as shown in Figure 3.

[0611] c) Prediction patterns of adjacent chromaticity blocks: chromaticity prediction patterns at positions L', T', BL', TR' and TL', as shown in Figure 3.

[0612] d) Default Intra-Prediction Mode: If the number of candidate prediction modes is still insufficient after steps a), b), and c), the default intra-prediction mode is continued to be added. The default intra-prediction mode is obtained by offsetting the first angular prediction mode in the current candidate prediction mode list. The offset can be {-1, +1, -2, +2, ...}. If this is still insufficient, the second angular prediction mode in the candidate list is offset and added, and so on.

[0613] Finally, by combining the reference row candidates (number of which is M, for example, M≤3) and the intra-frame prediction mode candidates (number of which is N, for example, N=8), P (P=M×N, for example, M×N≤24) combined prediction modes can be obtained.

[0614] S2202, use a template to sort the candidate list of combinations.

[0615] The steps S1902 in obtaining the fusion prediction value of the chroma TMRL mode at the decoding end and the encoding end are the same.

[0616] Before decoding, the co-position luminance component and the chrominance component of reference row 0 have already been decoded to obtain reconstructed values. One feasible method for ranking candidate chrominance TMRL modes using template cost is as follows: Using the co-position luminance and the chrominance region of the left column of the previous row as templates, the combination mode (including reference row and intra-frame prediction modes) is applied to the templates. The predicted value of the template region under the combination mode is calculated. Based on the predicted value and reconstructed value of the template, the error costY of the co-position luminance and the cost Cb of the chrominance in the left column of the previous row are calculated using SATD as the criterion. top costCb left costCr top and costCr left Accordingly, an example of template region selection is shown in Figure 4. This illustrates the template region in the chroma TMRL mode; the diagonally filled area indicates the template region, and the grid-filled area indicates the reference row.

[0617] Accordingly, an example of template cost calculation is as follows: the template error cost is calculated according to the aforementioned formula (1).

[0618] For all P (P = M × N) candidate combination patterns, calculate their cost on the template, and sort all candidate patterns according to this cost to obtain a list of candidate combination patterns sorted by template cost. Only the top T (e.g., T = 6) combination patterns in the list are retained.

[0619] S2203, determine the reference line and intra-prediction mode used by the current block based on the chroma TMRL mode index.

[0620] By using the chroma TMRL mode index (i.e., the "combined mode index" in the aforementioned embodiment) obtained by the decoding end and the combined candidate mode list after template sorting obtained in step S2202, the reference line and intra-frame prediction mode used by the current CU's chroma TMRL mode can be determined.

[0621] S2204, Determine the predicted value for the chromaticity TMRL mode.

[0622] According to step S2203, the reference row and intra-frame prediction mode corresponding to the chroma TMRL mode index are determined, and the prediction value is generated using the current CU reference row, which includes two parts: obtaining the reference row pixel value and deriving the current block prediction value.

[0623] a) Obtain the reference row pixel value.

[0624] The available reference rows for the chroma TMRL mode include {1,3,5}, and the structure of multiple reference rows is shown in Figure 5.

[0625] When some pixels in the reference row are missing or unavailable, the nearest pixel in the reference row is used to fill the gap. If all pixels in the reference row are unavailable, all pixels in the current reference row are filled with a fixed value, the size of which is mid = 1 << (bitdepth - 1).

[0626] b) Derive the predicted value.

[0627] When generating prediction values, the more distant reference lines are treated similarly to reference line 0, where each pixel in the current block is projected along the direction onto the more distant reference line, and the projected pixel is used as the prediction value, as shown in Figure 6. If the projected pixel is located at a fractional position, the prediction value is obtained through a linear interpolation filter. The filter coefficients can be the inverse ratio of the distance between the fractional position of the projection and its two adjacent integer positions. In particular, for intra-frame prediction mode DC mode, the prediction value for all pixels in the current block is the average of the reference pixels in the upper row / left column / upper row + left column.

[0628] S2205, determine and calculate relevant data based on the chromaticity fusion index.

[0629] Specifically, step S2205 may include:

[0630] S2205-1, determine whether to fuse and the fusion method based on the chroma fusion index.

[0631] S2205-2, Calculate the predicted values ​​for other color modes.

[0632] S2205-3, Determine the fusion weights.

[0633] Here, based on the parsed chroma fusion index, it is determined whether fusion should be applied and, if so, the corresponding fusion method. For example, the values ​​and meanings of the chroma fusion index intra_tmrl_chroma_fusion_idx corresponding to the chroma TMRL mode are shown in Table 3.

[0634] The following provides explanations for fusion methods 1, 2, and 3:

[0635] Fusion Method 1: Fusion of predicted values ​​from the chromaticity TMRL mode and predicted values ​​from the multi-model component linear prediction mode / multi-model convolution component prediction mode;

[0636] Fusion Method 2: Fusion of the predicted values ​​of the chromaticity TMRL mode and the predicted values ​​of the inter-component prediction modes;

[0637] Fusion Method 3: Fusion of the predicted values ​​of the chromaticity TMRL mode and the predicted values ​​of the multi-model component prediction mode.

[0638] If the chroma fusion index is not 0, then the predicted values ​​of other prediction modes need to be determined according to the fusion method, and the fusion weight needs to be determined. The following is an explanation of different cases.

[0639] Fusion Method 1:

[0640] The formula for calculating the predicted value of fusion method 1 can be shown in the aforementioned formula (11). In the formula, pred0(i,j) is the predicted value obtained using the chromaticity TMRL mode, pred1(i,j) is the predicted value obtained using the multi-model component linear prediction mode or the multi-model convolution component prediction mode, and pred... C (i,j) represents the final predicted value after fusion (referred to as the "fused predicted value"); shift is 2, and w0 and w1 are the fusion weights. To obtain the final predicted value, it is necessary to determine the intra-frame modes participating in the fusion and calculate their predicted values ​​pred1, as well as the fusion weights w0 and w1. The specific calculation steps are as follows:

[0641] (1) Calculate the predicted values ​​of other prediction models.

[0642] In fusion method 1, assuming that the intra-frame modes participating in the fusion include MM-CCLM mode or MM-CCCM mode, the intra-frame modes participating in the fusion need to be determined first by comparing template costs, and then the prediction value under that mode is calculated.

[0643] ① Determine the intra-frame mode (MM-CCLM mode / MM-CCCM mode) to participate in the fusion.

[0644] If the current chroma block does not meet the application conditions of MM-CCCM mode, then the intra-frame mode participating in the fusion is MM-CCLM mode;

[0645] If the current chroma block meets the application conditions of the MM-CCCM mode, then the intra-frame modes participating in the fusion need to be determined by sorting the template costs. Specifically, the MM-CCLM model and the MM-CCCM model are first derived based on the reference pixels of the current chroma block, and then applied to the templates respectively. The template costs CCLMSAD and CCCMSAD are calculated respectively, and the mode with the smaller template cost is determined as the intra-frame mode participating in the fusion (the corresponding template cost is denoted as bestSAD, and the number of template pixels is denoted as NumSample).

[0646] ② Calculate the predicted value under this model.

[0647] Using the intra-frame mode participating in the fusion determined in ①, calculate the predicted value pred1 of the current chroma CU under that mode.

[0648] (2) Determine the fusion weights.

[0649] If the current chroma block does not meet the application conditions of the MM-CCCM mode, then the intra-frame mode participating in the fusion can only be the MM-CCLM mode. In this case, its fusion weights w0 and w1 are related to the intra-frame prediction modes of the adjacent chroma blocks. Specifically, first, the left adjacent chroma block cuLeft and the upper adjacent chroma block cuAbove are obtained. Then, it is determined whether the left adjacent chroma block cuLeft and the upper adjacent chroma block cuAbove are valid, and if they are valid, whether their intra-frame prediction mode is the cross-component prediction mode (CCP). If both cuLeft and cuAbove are valid and the prediction mode is CCP mode, then {w0, w1} = {1, 3}; if only one CU among cuLeft and cuAbove is valid and the prediction mode is CCP mode, then {w0, w1} = {2, 2}; otherwise, {w0, w1} = {3, 1}.

[0650] If the current chroma block meets the application conditions of MM-CCCM mode, the fusion weights are derived based on bestSAD and NumSample obtained during the process of determining the intra-frame mode to be fused. When bestSAD > 64 × NumSample, {w0, w1} = {3, 1}; when bestSAD < 4 × NumSample, {w0, w1} = {1, 3}; otherwise, {w0, w1} = {2, 2}.

[0651] Fusion Method 2:

[0652] The formula for calculating the predicted value of fusion method 2 can be shown in the aforementioned formula (12). In the formula, pred0(i,j) is the predicted value obtained using the chromaticity TMRL mode, rec′ L (i,j) represents the reconstructed value after downsampling of the same brightness, predC (i,j) represents the final predicted value after fusion (which can be simply referred to as the "fusion predicted value"); β is a fixed value with a value of 1 << (bitdepth-1), and α0, α1, and α2 are the fusion weights. To obtain the final predicted value, rec′ needs to be calculated. L (i,j), and the fusion weights α0, α1, and α2. The specific calculation steps are as follows:

[0653] (1) Calculate the predicted values ​​of other prediction models.

[0654] In fusion method 2, the reconstructed value rec′ after brightness downsampling is calculated. L .

[0655] (2) Determine the fusion weights.

[0656] Based on the intra-frame prediction mode corresponding to the current chroma TMRL, calculate the predicted value of this mode on the template (the template is the top two rows and left two columns of the current chroma block), obtain the luminance downsampled reconstruction value and β value of the template region, and calculate pred0(i,j) and rec′ on the template. L MSE minimization is performed using the autocorrelation matrix of (i,j) and β input, as well as the cross-correlation vector between the input and the chroma reconstruction output. The autocorrelation matrix is ​​decomposed using LDL, and the final filter coefficients, i.e., the fusion weights α0, α1, and α2, are calculated using the inverse substitution method.

[0657] Fusion Method 3:

[0658] The formula for calculating the predicted value of fusion method 3 can be shown in the aforementioned formula (13). In the formula, pred0(i,j) is the predicted value obtained using the chromaticity TMRL mode, rec′ L (i,j) represents the reconstructed value after downsampling of the same brightness, pred C (i,j) represents the final predicted value after fusion (referred to as the "fusion predicted value"); β is a fixed value, with a value of 1 << (bitdepth-1); modThr is the classification threshold, which is the average value of adjacent samples in the luminance reconstruction. The fusion weights α0, α1, and α2, as well as α′0, α′1, and α′2, are derived from adjacent luminance and chrominance samples using the same LDL derivation method as in the inter-convolutional integral prediction mode. The specific calculation steps are as follows:

[0659] (1) Calculate the predicted values ​​of other prediction models.

[0660] In fusion method 3, the reconstructed value rec′ after brightness downsampling is calculated. L .

[0661] (2) Determine the fusion weights.

[0662] Based on the intra-prediction mode corresponding to the current chroma TMRL, calculate the predicted value of this mode on the template (the template is the top two rows and left two columns of the current chroma block), obtain the luminance downsampled reconstruction value and β value of the template region, and divide the template input into two categories according to the mean of the luminance downsampled reconstruction value modThr on the template, respectively by calculating pred0(i,j) and rec′ on the template. L MSE minimization is performed using the autocorrelation matrix of (i,j) and β inputs, as well as the cross-correlation vector between the input and the chroma reconstruction output. The autocorrelation matrix is ​​decomposed by LDL, and the final two sets of filter coefficients, namely the fusion weights α0, α1, and α2, and α′0, α′1, and α′2, are calculated using the inverse substitution method.

[0663] S2206, Determine the final predicted value after fusion.

[0664] Based on the chroma fusion index and the fusion weights determined in step S2205, the final predicted value of the current block is obtained.

[0665] If the chroma fusion index is 0, it means that no fusion method is used, and the final predicted value is as shown in the aforementioned formula (14).

[0666] If the chroma fusion index is 1, it means that fusion mode 1 is used, and the final predicted value is as shown in the aforementioned formula (15).

[0667] If the chroma fusion index is 2, it means that fusion mode 2 is used, and the final predicted value is as shown in the aforementioned formula (16).

[0668] If the chroma fusion index is 3, it means that fusion mode 3 is used, and the final predicted value is as shown in the aforementioned formula (17).

[0669] The following describes several possible implementation schemes in the embodiments of this application.

[0670] In the first possible implementation, for the chroma TMRL mode, the range of modes that can be fused with the prediction values ​​includes all chroma intra-frame prediction modes, such as non-cross-component prediction modes that do not use chroma multi-reference lines, such as Chroma DIMD, DM, DC, Planar, DBV, cross-component prediction modes such as CCLM, CCCM, GLM, and other chroma TMRL modes in the combination candidate list, etc., without any limitations.

[0671] In the second possible implementation, the weights w0 and w1 for fusing the predicted values ​​of the chroma TMRL mode with other modes are determined using different methods:

[0672] Possible implementation scheme 1: For the weights w0 and w1 used to fuse the predicted values ​​of the chroma TMRL mode with other modes, they can be set to fixed weights. One way to set them is: {w0,w1}={3,1}.

[0673] Possible implementation scheme 2: The weights w0 and w1 for fusing the prediction values ​​of the chroma TMRL mode with other modes can be determined according to the intra-frame prediction mode of the adjacent chroma CUs. One setting is as follows: assuming that the mode fused with the chroma TMRL mode is the MM-CCCM mode, then obtain the left adjacent chroma block cuLeft and the upper adjacent chroma block cuAbove.

[0674] If both cuLeft and cuAbove are valid and the prediction mode is CCP mode, then {w0,w1} = {1,3};

[0675] If only one CU in cuLeft and cuAbove is valid and the prediction mode is CCP mode, then {w0,w1}={2,2};

[0676] In other cases, {w0,w1} = {3,1}.

[0677] Possible implementation scheme 3: The weights w0 and w1 for fusing the predicted values ​​of the chroma TMRL mode with other modes can be determined based on the template cost of the intra-frame mode being fused with. One setting method is as follows: Assuming that the mode being fused with the chroma TMRL mode is the MM-CCCM mode, first apply MM-CCCM to the template (the template is set to the row above and the column to the left of the current chroma CU, and the total number of pixels in the template is denoted as numSample), calculate the sum of absolute errors between the predicted value and the reconstructed value of the template, denoted as cccmSAD.

[0678] When cccmSAD > 64 × numSample, {w0, w1} = {3, 1};

[0679] When cccmSAD < 4 × numSample, {w0, w1} = {1, 3};

[0680] In other cases, {w0,w1} = {2,2}.

[0681] Possible Implementation Scheme 4: The weights w0 and w1 for fusing the prediction values ​​of the chroma TMRL mode with other modes can be derived based on the predicted values ​​of the chroma TMRL and the intra-mode it is fusing with on the template and the reconstructed value of the template itself. One approach is to assume that the mode being fused with the chroma TMRL mode is the MM-CCCM mode. First, apply the chroma TMRL mode and the MM-CCCM mode to the template to obtain the predicted values, denoted as tempPred0 and tempPred1, respectively. Obtain the template reconstructed value tempReco. Then, use tempPred0 and tempPred1 as inputs and tempReco as outputs to calculate the autocorrelation matrix of the input and the cross-correlation vector between the input and the chroma template reconstructed value output to perform MSE minimization. Perform LDL decomposition on the autocorrelation matrix and use the inverse substitution method to calculate the final filter coefficients, i.e., the fusion weights w0 and w1.

[0682] In the third possible implementation, for the chroma TMRL mode, the modes to be fused with the predicted values ​​can be filtered by template cost, retaining only the modes with lower template costs for fusion. One approach is as follows: assuming the candidate modes for fusion with the chroma TMRL mode are MM-CCCM, CCCM, MM-CCLM, CCLM, MM-GLCCCM, and GL-CCCM, first calculate the predicted values ​​of each of the six modes on the template, and then calculate the absolute error between the template predicted value and the reconstructed value as the template cost. The modes are then sorted by template cost, and only the three modes with the lowest template costs are retained for subsequent chroma TMRL predicted value fusion.

[0683] In the fourth possible implementation, two improvements can be applied simultaneously. For example, one of the four possible implementations in the second possible implementation can be selected and combined with the first possible implementation; or one of the four possible implementations in the second possible implementation can be selected and combined with the third possible implementation; or the first possible implementation can be combined with the third possible implementation, etc.

[0684] In the fifth possible implementation, three improvements can be applied simultaneously. For example, one of the four possible implementations in the second possible implementation can be selected, or it can be combined with the first and third possible implementations, etc., without any limitations.

[0685] In summary, this application proposes a chroma TMRL fusion technology solution, which can fuse the predicted value obtained by the chroma TMRL mode with the predicted value obtained by other chroma modes to generate the final fused predicted value; and shows an implementation method for obtaining the predicted value under the chroma TMRL fusion mode at the encoding and decoding ends, as well as a description of the relevant syntax elements.

[0686] For example, on ECM14.0, testing Class B, Class C, and Class E sequences at 48 intervals in the All Intra condition yields BD-rate changes of 0.01%, -0.40%, and -0.28% in the Y, Cb, and Cr components, respectively (i.e., average bitrate changes at the same PSNR). Compared to the original chroma TMRL mode (i.e., without fusion), BD-rate changes of -0.02%, -0.20%, and 0.03% in the Y, Cb, and Cr components, respectively (i.e., average bitrate changes at the same PSNR).

[0687] In this embodiment, the specific implementation of the foregoing embodiments is described in detail. According to the technical solution of the foregoing embodiments, it can be seen that by fusing the prediction value of the chroma TMRL mode with the prediction values ​​of other chroma intra-frame prediction modes, the final chroma prediction value is generated; thereby improving the accuracy and diversity of the prediction values ​​generated in the chroma TMRL mode.

[0688] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, FIG23 is a schematic diagram of the composition structure of an encoder provided in an embodiment of this application. As shown in FIG23, the encoder 230 may include a first determining unit 2301, wherein:

[0689] The first determining unit 2301 is configured to determine a first prediction value when the chroma components of the current block use a template-based multi-reference line intra-prediction mode; and to determine a second prediction value when the chroma components of the current block use the first prediction mode.

[0690] The first determining unit 2301 is further configured to determine the prediction value of the current block based on the first prediction value and the second prediction value.

[0691] In some embodiments, referring to FIG23, the encoder 230 may further include a first prediction unit 2302, wherein: the first determination unit 2301 is further configured to determine a combination candidate list for the current block; and determine a first combination mode for the current block based on the combination candidate list; wherein the first combination mode includes a reference line and an intra-frame prediction mode used by the current block; the first prediction unit 2302 is configured to predict the chroma components of the current block based on the reference line and the intra-frame prediction mode used by the current block, and determine a first prediction value for the current block.

[0692] In some embodiments, the first determining unit 2301 is further configured to determine at least one candidate reference line and at least one candidate intra-prediction mode of the current block; the first determining unit 2301 is further configured to combine the at least one candidate reference line and at least one candidate intra-prediction mode to determine multiple candidate combination modes of the current block; and determine a combination candidate list of the current block according to the multiple candidate combination modes.

[0693] In some embodiments, the first determining unit 2301 is further configured to predict the first template of the current block based on multiple candidate combination modes, and determine the template prediction value corresponding to the multiple candidate combination modes; calculate the cost between the template prediction value corresponding to the multiple candidate combination modes and the template reconstruction value of the first template, and determine the cost result corresponding to the multiple candidate combination modes; and sort the multiple candidate combination modes according to the cost result, and take the top T candidate combination modes as the combination candidate list of the current block; where T is a positive integer.

[0694] In some embodiments, the first determining unit 2301 is further configured to calculate the encoding cost of the current block based on at least two candidate combination modes in the candidate combination list, determine the cost result corresponding to at least two candidate combination modes; and determine the minimum cost result based on the cost result corresponding to at least two candidate combination modes, and determine the candidate combination mode corresponding to the minimum cost result as the first combination mode of the current block.

[0695] In some embodiments, referring to FIG23, the encoder 230 may further include an encoding unit 2303, wherein: the first determining unit 2301 is further configured to determine the combination mode index of the current block; wherein the combination mode index is used to indicate the index number of the first combination mode in the combination candidate list; the encoding unit 2303 is configured to encode the combination mode index of the current block and write the obtained encoded bits into the code stream.

[0696] In some embodiments, the first determining unit 2301 is further configured to determine a first prediction mode for the current block when the chromaticity components of the current block are predicted using a fusion method; the first prediction unit 2302 is further configured to predict the chromaticity components of the current block according to the first prediction mode and determine a second prediction value for the current block.

[0697] In some embodiments, the first determining unit 2301 is further configured to determine a first weight corresponding to the first predicted value and a second weight corresponding to the second predicted value; the first predicting unit 2302 is further configured to perform a weighted operation on the first predicted value and the second predicted value according to the first weight and the second weight to determine the predicted value of the current block.

[0698] In some embodiments, the first determining unit 2301 is further configured to set the first weight and the second weight as fixed constants.

[0699] In some embodiments, the first determining unit 2301 is further configured to determine the left adjacent reference block and the upper adjacent reference block of the current block; and to determine a first weight and a second weight based on the prediction modes of the left adjacent reference block and the upper adjacent reference block, respectively.

[0700] In some embodiments, the first determining unit 2301 is further configured to set the first weight and the second weight to a first set of preset values ​​when all the left adjacent reference blocks and the upper adjacent reference blocks are valid and their respective prediction modes are cross-component prediction modes; to set the first weight and the second weight to a second set of preset values ​​when only one of the left adjacent reference blocks and the upper adjacent reference blocks is valid and the corresponding prediction mode is a cross-component prediction mode; and to set the first weight and the second weight to a third set of preset values ​​when all the left adjacent reference blocks and the upper adjacent reference blocks are invalid, or at least one is valid and the corresponding prediction mode is a non-cross-component prediction mode.

[0701] In some embodiments, the first determining unit 2301 is further configured to perform cost calculation on the first template of the current block according to the first prediction mode, determine the first cost result, and determine the number of samples of the first template; and determine the first weight and the second weight according to the first cost result and the number of samples of the first template.

[0702] In some embodiments, the first determining unit 2301 is further configured to set the first weight and the second weight to a fourth set of preset values ​​when the first cost result is greater than the first product between the first factor and the number of samples of the first template; to set the first weight and the second weight to a fifth set of preset values ​​when the first cost result is less than the second product between the second factor and the number of samples of the first template; and to set the first weight and the second weight to a sixth set of preset values ​​when the first cost result is greater than or equal to the second product and less than or equal to the first product.

[0703] In some embodiments, the first determining unit 2301 is further configured to predict the first template of the current block according to the template-based multi-reference row intra-prediction mode and the first prediction mode respectively, and determine the first template prediction value corresponding to the template-based multi-reference row intra-prediction mode and the second template prediction value corresponding to the first prediction mode; determine the first autocorrelation matrix of the first template prediction value and the second template prediction value, and determine the first cross-correlation vector between the first template prediction value, the second template prediction value and the template reconstruction value of the first template; and determine the first weight and the second weight according to the first autocorrelation matrix and the first cross-correlation vector.

[0704] In some embodiments, the first determining unit 2301 is further configured to determine at least one candidate prediction mode for the current block; and to determine a first prediction mode from at least one candidate prediction mode.

[0705] In some embodiments, the first determining unit 2301 is further configured to predict the first template of the current block based on at least one candidate prediction mode, and determine the template prediction value corresponding to the at least one candidate prediction mode; calculate the cost between the template prediction value corresponding to the at least one candidate prediction mode and the template reconstruction value of the first template, and determine the cost result corresponding to the at least one candidate prediction mode; and sort the at least one candidate prediction mode according to the cost result, determine the top K candidate prediction modes, and determine the first prediction mode from the K candidate prediction modes; wherein K is a positive integer.

[0706] In some embodiments, the first determining unit 2301 is further configured to determine at least one candidate prediction mode for the current block when the chromaticity components of the current block are predicted using a first fusion method; and to determine a first prediction mode for the current block among the at least one candidate prediction mode; the first prediction unit 2302 is further configured to predict the chromaticity components of the current block according to the first prediction mode to determine a second prediction value for the current block; and to determine a prediction value for the current block according to the first fusion method, the first prediction value, and the second prediction value.

[0707] In some embodiments, the first determining unit 2301 is further configured to determine the first weight and the second weight corresponding to the first fusion method; the first predicting unit 2302 is further configured to perform a weighted operation on the first predicted value and the second predicted value according to the first weight and the second weight to determine the predicted value of the current block.

[0708] In some embodiments, at least one candidate prediction mode includes: a multi-model component linear prediction mode and a multi-model convolution component inter-prediction mode; the first determining unit 2301 is further configured to determine the first prediction mode of the current block as the multi-model component linear prediction mode when the current block does not meet the application conditions of the multi-model convolution component inter-prediction mode; when the current block meets the application conditions of the multi-model convolution component inter-prediction mode, to calculate the cost of the first template of the current block according to the multi-model component linear prediction mode and the multi-model convolution component inter-prediction mode respectively, to determine two template cost results; and to determine the minimum cost result among the two template cost results, and to determine the candidate prediction mode corresponding to the minimum cost result as the first prediction mode of the current block.

[0709] In some embodiments, the first determining unit 2301 is further configured to: determine the left adjacent reference block and the upper adjacent reference block of the current block when the current block does not meet the application conditions of the multi-model convolutional component prediction mode; set the first weight and the second weight to the seventh set of preset values ​​when all the left adjacent reference blocks and the upper adjacent reference blocks are valid and their respective prediction modes are cross-component prediction modes; set the first weight and the second weight to the eighth set of preset values ​​when only one of the left adjacent reference blocks and the upper adjacent reference blocks is valid and the corresponding prediction mode is a cross-component prediction mode; and set the first weight and the second weight to the ninth set of preset values ​​when all the left adjacent reference blocks and the upper adjacent reference blocks are invalid, or at least one is valid and the corresponding prediction mode is a non-cross-component prediction mode.

[0710] In some embodiments, the first determining unit 2301 is further configured to: determine the minimum cost result and the number of samples of the first template when the current block satisfies the application conditions of the prediction mode between multi-model convolution integrals; set the first weight and the second weight to the tenth set of preset values ​​when the minimum cost result is greater than the third product between the fourth factor and the number of samples of the first template; set the first weight and the second weight to the eleventh set of preset values ​​when the minimum cost result is less than the fourth product between the fifth factor and the number of samples of the first template; and set the first weight and the second weight to the twelfth set of preset values ​​when the minimum cost result is greater than or equal to the fourth product and less than or equal to the third product.

[0711] In some embodiments, the first determining unit 2301 is further configured to determine the first prediction mode of the current block as an inter-component prediction mode when the chromaticity components of the current block are predicted using the second fusion method; and to determine the first reconstructed value of the current block after in-situ luminance downsampling; the first prediction unit 2302 is further configured to determine the prediction value of the current block based on the second fusion method, the first prediction value and the first reconstructed value.

[0712] In some embodiments, the first determining unit 2301 is further configured to determine the first weight, the second weight, and the third weight corresponding to the second fusion method; the first predicting unit 2302 is further configured to perform a weighted operation on the first predicted value, the first reconstructed value, and the first constant according to the first weight, the second weight, and the third weight to determine the predicted value of the current block.

[0713] In some embodiments, the first determining unit 2301 is further configured to predict a first template of the current block according to a template-based multi-reference line intra-prediction mode, determine a first template prediction value corresponding to the template-based multi-reference line intra-prediction mode; obtain a second reconstructed value and a second constant after luminance downsampling of the first template; determine a second autocorrelation matrix of the first template prediction value, the second reconstructed value and the second constant, and determine a second cross-correlation vector between the first template prediction value, the second reconstructed value and the second constant and the chrominance reconstructed value of the first template; and determine a first weight, a second weight and a third weight according to the second autocorrelation matrix and the second cross-correlation vector.

[0714] In some embodiments, the first determining unit 2301 is further configured to determine the first prediction mode of the current block as a multi-model component prediction mode when the chromaticity component of the current block is predicted using the third fusion method; and to determine the first reconstructed value of the current block after in-situ luminance downsampling; the first prediction unit 2302 is further configured to determine the predicted value of the current block based on the third fusion method, the first predicted value and the first reconstructed value.

[0715] In some embodiments, the first determining unit 2301 is further configured to: when the first reconstructed value is less than or equal to the classification threshold, determine the first weight, the second weight, and the third weight corresponding to the third fusion method, and perform a weighted operation on the first predicted value, the first reconstructed value, and the third constant according to the first weight, the second weight, and the third weight to determine the predicted value of the current block; when the first reconstructed value is greater than the classification threshold, determine the fourth weight, the fifth weight, and the sixth weight corresponding to the third fusion method, and perform a weighted operation on the first predicted value, the first reconstructed value, and the third constant according to the fourth weight, the fifth weight, and the sixth weight to determine the predicted value of the current block.

[0716] In some embodiments, the first determining unit 2301 is further configured to: divide the first template of the current block according to a classification threshold to determine a first sub-template and a second sub-template; and predict the first sub-template according to a template-based multi-reference line intra-frame prediction mode to determine the predicted value of the first sub-template corresponding to the template-based multi-reference line intra-frame prediction mode; after obtaining the third reconstructed value and the fourth constant after luminance downsampling of the first sub-template, determine the third autocorrelation matrix of the predicted value, the third reconstructed value and the fourth constant of the first sub-template, and determine the third cross-correlation vector between the predicted value, the third reconstructed value and the fourth constant and the chroma reconstructed value of the first sub-template, and determine the third autocorrelation vector based on the third autocorrelation matrix. The first, second, and third weights are determined using the correlation matrix and the third cross-correlation vector. The second sub-template is predicted according to the template-based multi-reference line intra-frame prediction mode, and the predicted value of the second sub-template corresponding to the template-based multi-reference line intra-frame prediction mode is determined. After obtaining the fourth reconstructed value and the fifth constant of the luminance downsampled second sub-template, the fourth autocorrelation matrix of the predicted value, the fourth reconstructed value, and the fifth constant of the second sub-template is determined, as well as the fourth cross-correlation vector between the predicted value, the fourth reconstructed value, and the fifth constant of the second sub-template and the chrominance reconstructed value of the second sub-template is determined. The fourth weight, the fifth weight, and the sixth weight are determined based on the fourth autocorrelation matrix and the fourth cross-correlation vector.

[0717] In some embodiments, the first determining unit 2301 is further configured to directly determine the first predicted value as the predicted value of the current block when the chromaticity components of the current block are not predicted using a fusion method.

[0718] In some embodiments, the first determining unit 2301 is further configured to determine the chroma fusion index of the current block; wherein the chroma fusion index is used to indicate whether the chroma components of the current block use a fusion method and the corresponding fusion method number when using a fusion method for prediction; the encoding unit 2303 is further configured to encode the chroma fusion index of the current block and write the obtained encoded bits into the bit stream.

[0719] In some embodiments, the first determining unit 2301 is further configured to determine the value of a first syntax element; wherein the first syntax element is used to indicate whether the chroma component of the current block uses a non-cross-component prediction mode; the encoding unit 2303 is further configured to encode the value of the first syntax element and write the obtained encoded bits into the bitstream.

[0720] In some embodiments, the first determining unit 2301 is further configured to determine the value of the second syntax element; wherein the second syntax element is used to indicate whether the chroma component of the current block uses a template-based multi-reference line intra-prediction mode; the encoding unit 2303 is further configured to encode the value of the second syntax element and write the obtained encoded bits into the bitstream.

[0721] Understandably, in the embodiments of this application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular one. Furthermore, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit described above can be implemented in hardware or as a software functional module.

[0722] In another embodiment of this application, FIG24 is a schematic diagram of the hardware structure of an encoder provided in an embodiment of this application. As shown in FIG24, the encoder 230 may include: a first communication interface 2401, a first memory 2402, and a first processor 2403; the various components are coupled together through a first bus system 2404. It is understood that the first bus system 2404 is used to realize the connection and communication between these components. In addition to a data bus, the first bus system 2404 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, all buses are labeled as the first bus system 2404 in FIG24.

[0723] The first communication interface 2401 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;

[0724] The first memory 2402 is used to store computer programs that can run on the first processor 2403;

[0725] The first processor 2403 is configured to, when running the computer program, perform: determining a first prediction value for the chroma components of the current block using a template-based multi-reference line intra-prediction mode; determining a second prediction value for the chroma components of the current block using the first prediction mode; and determining a prediction value for the current block based on the first and second prediction values.

[0726] It is understood that the first memory 2402 in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The first memory 2402 of the system and method described in this application is intended to include, but is not limited to, these and any other suitable types of memory.

[0727] The first processor 2403 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the first processor 2403 or by software instructions. The first processor 2403 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in the first memory 2402. The first processor 2403 reads the information in the first memory 2402 and completes the steps of the above method in conjunction with its hardware.

[0728] It is understood that the embodiments described in this application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or combinations thereof. For software implementation, the technology described in this application can be implemented through modules (e.g., procedures, functions, etc.) that perform the functions described in this application. Software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.

[0729] Alternatively, as another embodiment, the first processor 2403 is also configured to perform the method described in any of the foregoing embodiments when running the computer program.

[0730] This embodiment provides an encoder that, when using the fusion method of chroma TMRL mode in the current block, can fuse the first predicted value obtained by the chroma TMRL mode with the second predicted value obtained by other chroma modes (e.g., the first prediction mode) to generate the final predicted value after fusion. This can improve the prediction accuracy in the chroma TMRL mode, and since the first prediction mode can be any chroma mode, it can also improve the prediction diversity in the chroma TMRL mode, thereby improving coding efficiency and thus improving coding performance.

[0731] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, FIG25 is a schematic diagram of the composition structure of a decoder provided in an embodiment of this application. As shown in FIG25, the decoder 250 may include a second determining unit 2501, wherein:

[0732] The second determining unit 2501 is configured to determine a first prediction value when the chroma components of the current block use a template-based multi-reference line intra-prediction mode; and to determine a second prediction value when the chroma components of the current block use the first prediction mode.

[0733] The second determining unit 2501 is further configured to determine the prediction value of the current block based on the first prediction value and the second prediction value.

[0734] In some embodiments, referring to FIG25, the decoder 250 may further include a decoding unit 2502 and a second prediction unit 2503, wherein: the decoding unit 2502 is configured to parse the combination mode index in the bitstream; the second determination unit 2501 is further configured to determine a first combination mode of the current block according to the combination mode index; wherein the first combination mode includes the reference line and intra-frame prediction mode used by the current block; the second prediction unit 2503 is configured to predict the chroma components of the current block according to the reference line and intra-frame prediction mode used by the current block, and determine a first prediction value of the current block.

[0735] In some embodiments, the second determining unit 2501 is further configured to determine a combination candidate list for the current block; and to determine a first combination pattern for the current block based on the combination pattern index and the combination candidate list.

[0736] In some embodiments, the second determining unit 2501 is further configured to determine at least one candidate reference line and at least one candidate intra-prediction mode of the current block; combine the at least one candidate reference line and at least one candidate intra-prediction mode to determine multiple candidate combination modes of the current block; and determine a combination candidate list of the current block based on the multiple candidate combination modes.

[0737] In some embodiments, the second determining unit 2501 is further configured to predict the first template of the current block based on multiple candidate combination modes, and determine the template prediction value corresponding to the multiple candidate combination modes; calculate the cost based on the template prediction value corresponding to the multiple candidate combination modes and the template reconstruction value of the first template, and determine the cost result corresponding to the multiple candidate combination modes; and sort the multiple candidate combination modes according to the cost result, and take the top T candidate combination modes as the combination candidate list of the current block; where T is a positive integer.

[0738] In some embodiments, the decoding unit 2502 is further configured to parse the chroma fusion index in the bitstream; the second determining unit 2501 is further configured to determine a first prediction mode for the current block when the chroma fusion index indicates that the chroma components of the current block are predicted using a fusion method; and the second prediction unit 2503 is further configured to predict the chroma components of the current block according to the first prediction mode and determine a second prediction value for the current block.

[0739] In some embodiments, the second determining unit 2501 is further configured to determine a first weight corresponding to the first predicted value and a second weight corresponding to the second predicted value; the second predicting unit 2503 is further configured to perform a weighted operation on the first predicted value and the second predicted value according to the first weight and the second weight to determine the predicted value of the current block.

[0740] In some embodiments, the second determining unit 2501 is further configured to set the first weight and the second weight as fixed constants.

[0741] In some embodiments, the second determining unit 2501 is further configured to determine the left adjacent reference block and the upper adjacent reference block of the current block; and to determine a first weight and a second weight based on the prediction modes of the left adjacent reference block and the upper adjacent reference block, respectively.

[0742] In some embodiments, the second determining unit 2501 is further configured to set the first weight and the second weight to a first set of preset values ​​when all the left adjacent reference blocks and the upper adjacent reference blocks are valid and their respective prediction modes are cross-component prediction modes; to set the first weight and the second weight to a second set of preset values ​​when only one of the left adjacent reference blocks and the upper adjacent reference blocks is valid and the corresponding prediction mode is a cross-component prediction mode; and to set the first weight and the second weight to a third set of preset values ​​when all the left adjacent reference blocks and the upper adjacent reference blocks are invalid, or at least one is valid and the corresponding prediction mode is a non-cross-component prediction mode.

[0743] In some embodiments, the second determining unit 2501 is further configured to perform cost calculation on the first template of the current block according to the first prediction mode, determine the first cost result, and determine the number of samples of the first template; and determine the first weight and the second weight according to the first cost result and the number of samples of the first template.

[0744] In some embodiments, the second determining unit 2501 is further configured to set the first weight and the second weight to a fourth set of preset values ​​when the first cost result is greater than the first product between the first factor and the number of samples of the first template; to set the first weight and the second weight to a fifth set of preset values ​​when the first cost result is less than the second product between the second factor and the number of samples of the first template; and to set the first weight and the second weight to a sixth set of preset values ​​when the first cost result is greater than or equal to the second product and less than or equal to the first product.

[0745] In some embodiments, the second determining unit 2501 is further configured to predict the first template of the current block according to the template-based multi-reference row intra-prediction mode and the first prediction mode respectively, and determine the first template prediction value corresponding to the template-based multi-reference row intra-prediction mode and the second template prediction value corresponding to the first prediction mode; determine the first autocorrelation matrix of the first template prediction value and the second template prediction value, and determine the first cross-correlation vector between the first template prediction value, the second template prediction value and the template reconstruction value of the first template; and determine the first weight and the second weight according to the first autocorrelation matrix and the first cross-correlation vector.

[0746] In some embodiments, the second determining unit 2501 is further configured to determine at least one candidate prediction mode for the current block; and to determine a first prediction mode from the at least one candidate prediction mode.

[0747] In some embodiments, the second determining unit 2501 is further configured to predict the first template of the current block based on at least one candidate prediction mode, and determine the template prediction value corresponding to the at least one candidate prediction mode; calculate the cost between the template prediction value corresponding to the at least one candidate prediction mode and the template reconstruction value of the first template, and determine the cost result corresponding to the at least one candidate prediction mode; and sort the at least one candidate prediction mode according to the cost result, determine the top K candidate prediction modes, and determine the first prediction mode from the K candidate prediction modes; wherein K is a positive integer.

[0748] In some embodiments, the second determining unit 2501 is further configured to determine at least one candidate prediction mode for the current block when the chroma fusion index indicates that the chroma components of the current block are predicted using a first fusion method; and to determine a first prediction mode for the current block among the at least one candidate prediction mode; the second prediction unit 2503 is further configured to predict the chroma components of the current block according to the first prediction mode to determine a second prediction value for the current block; and to determine a prediction value for the current block according to the first fusion method, the first prediction value, and the second prediction value.

[0749] In some embodiments, the second determining unit 2501 is further configured to determine the first weight and the second weight corresponding to the first fusion method; the second predicting unit 2503 is further configured to perform a weighted operation on the first predicted value and the second predicted value according to the first weight and the second weight to determine the predicted value of the current block.

[0750] In some embodiments, at least one candidate prediction mode includes: a multi-model component linear prediction mode and a multi-model convolution component inter-prediction mode; the second determining unit 2501 is further configured to determine the first prediction mode of the current block as the multi-model component linear prediction mode when the current block does not meet the application conditions of the multi-model convolution component inter-prediction mode; when the current block meets the application conditions of the multi-model convolution component inter-prediction mode, to calculate the cost of the first template of the current block according to the multi-model component linear prediction mode and the multi-model convolution component inter-prediction mode respectively, to determine two template cost results; and to determine the minimum cost result among the two template cost results, and to determine the candidate prediction mode corresponding to the minimum cost result as the first prediction mode of the current block.

[0751] In some embodiments, the second determining unit 2501 is further configured to: determine the left-side adjacent reference block and the upper-side adjacent reference block of the current block when the current block does not meet the application conditions of the multi-model convolutional component prediction mode; and set the first weight and the second weight to the seventh set of preset values ​​when all the left-side adjacent reference blocks and the upper-side adjacent reference blocks are valid and their respective prediction modes are cross-component prediction modes; set the first weight and the second weight to the eighth set of preset values ​​when only one of the left-side adjacent reference blocks and the upper-side adjacent reference blocks is valid and the corresponding prediction mode is a cross-component prediction mode; and set the first weight and the second weight to the ninth set of preset values ​​when all the left-side adjacent reference blocks and the upper-side adjacent reference blocks are invalid, or at least one is valid and the corresponding prediction mode is a non-cross-component prediction mode.

[0752] In some embodiments, the second determining unit 2501 is further configured to: determine the minimum cost result and the number of samples of the first template when the current block satisfies the application conditions of the prediction mode between multi-model convolution integrals; set the first weight and the second weight to the tenth preset value when the minimum cost result is greater than the third product between the fourth factor and the number of samples of the first template; set the first weight and the second weight to the eleventh preset value when the minimum cost result is less than the fourth product between the fifth factor and the number of samples of the first template; and set the first weight and the second weight to the twelfth preset value when the minimum cost result is greater than or equal to the fourth product and less than or equal to the third product.

[0753] In some embodiments, the second determining unit 2501 is further configured to determine the first prediction mode of the current block as an inter-component prediction mode when the chroma fusion index indicates that the chroma components of the current block are predicted using the second fusion method; and to determine the first reconstructed value of the current block after in-situ luminance downsampling; the second prediction unit 2503 is further configured to determine the prediction value of the current block based on the second fusion method, the first prediction value and the first reconstructed value.

[0754] In some embodiments, the second determining unit 2501 is further configured to determine the first weight, the second weight, and the third weight corresponding to the second fusion method; the second prediction unit 2503 is further configured to perform a weighted operation on the first predicted value, the first reconstructed value, and the first constant according to the first weight, the second weight, and the third weight to determine the predicted value of the current block.

[0755] In some embodiments, the second determining unit 2501 is further configured to predict the first template of the current block according to the template-based multi-reference line intra-prediction mode, determine the first template prediction value corresponding to the template-based multi-reference line intra-prediction mode; obtain the second reconstructed value and the second constant after luminance downsampling of the first template; determine the second autocorrelation matrix of the first template prediction value, the second reconstructed value and the second constant, and determine the second cross-correlation vector between the first template prediction value, the second reconstructed value and the second constant and the chrominance reconstructed value of the first template; and determine the first weight, the second weight and the third weight according to the second autocorrelation matrix and the second cross-correlation vector.

[0756] In some embodiments, the second determining unit 2501 is further configured to determine the first prediction mode of the current block as a multi-model component prediction mode when the chroma fusion index indicates that the chroma components of the current block are predicted using a third fusion method; and to determine the first reconstructed value of the current block after in-situ luminance downsampling; the second prediction unit 2503 is further configured to determine the predicted value of the current block based on the third fusion method, the first predicted value and the first reconstructed value.

[0757] In some embodiments, the second prediction unit 2503 is further configured to: when the first reconstructed value is less than or equal to the classification threshold, determine the first weight, the second weight, and the third weight corresponding to the third fusion method, and perform a weighted operation on the first predicted value, the first reconstructed value, and the third constant according to the first weight, the second weight, and the third weight to determine the predicted value of the current block; when the first reconstructed value is greater than the classification threshold, determine the fourth weight, the fifth weight, and the sixth weight corresponding to the third fusion method, and perform a weighted operation on the first predicted value, the first reconstructed value, and the third constant according to the fourth weight, the fifth weight, and the sixth weight to determine the predicted value of the current block.

[0758] In some embodiments, the second determining unit 2501 is further configured to: divide the first template of the current block according to a classification threshold to determine a first sub-template and a second sub-template; and predict the first sub-template according to a template-based multi-reference line intra-frame prediction mode to determine the predicted value of the first sub-template corresponding to the template-based multi-reference line intra-frame prediction mode; after obtaining the third reconstructed value and the fourth constant after luminance downsampling of the first sub-template, determine the third autocorrelation matrix of the predicted value, the third reconstructed value and the fourth constant of the first sub-template, and determine the third cross-correlation vector between the predicted value, the third reconstructed value and the fourth constant of the first sub-template and the chroma reconstructed value of the first sub-template, and determine the third autocorrelation vector based on the third autocorrelation matrix. The first, second, and third weights are determined using the correlation matrix and the third cross-correlation vector. The second sub-template is predicted according to the template-based multi-reference line intra-frame prediction mode, and the predicted value of the second sub-template corresponding to the template-based multi-reference line intra-frame prediction mode is determined. After obtaining the fourth reconstructed value and the fifth constant of the luminance downsampled second sub-template, the fourth autocorrelation matrix of the predicted value, the fourth reconstructed value, and the fifth constant of the second sub-template is determined, as well as the fourth cross-correlation vector between the predicted value, the fourth reconstructed value, and the fifth constant of the second sub-template and the chrominance reconstructed value of the second sub-template is determined. The fourth weight, the fifth weight, and the sixth weight are determined based on the fourth autocorrelation matrix and the fourth cross-correlation vector.

[0759] In some embodiments, the second determining unit 2501 is further configured to directly determine the first predicted value as the predicted value of the current block when the chroma fusion index indicates that the chroma components of the current block are not predicted using a fusion method.

[0760] In some embodiments, the decoding unit 2502 is further configured to parse a first syntax element in the bitstream; and when the first syntax element indicates that the chroma component of the current block uses a non-cross-component prediction mode, to parse a second syntax element in the bitstream; the second determining unit 2501 is further configured to perform the step of determining a first prediction value when the chroma component of the current block uses a template-based multi-reference line intra-prediction mode when the second syntax element indicates that the chroma component of the current block uses a template-based multi-reference line intra-prediction mode.

[0761] Understandably, in this embodiment, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular component. Furthermore, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional module.

[0762] In another embodiment of this application, FIG26 is a schematic diagram of the hardware structure of a decoder provided in an embodiment of this application. As shown in FIG26, the decoder 250 may include: a second communication interface 2601, a second memory 2602, and a second processor 2603; the various components are coupled together through a second bus system 2604. It is understood that the second bus system 2604 is used to realize the connection and communication between these components. In addition to a data bus, the second bus system 2604 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, all buses are labeled as the second bus system 2604 in FIG26.

[0763] The second communication interface 2601 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;

[0764] The second memory 2602 is used to store computer programs that can run on the second processor 2603;

[0765] The second processor 2603 is configured to, when running the computer program, perform the following: determining a first prediction value for the chroma components of the current block using a template-based multi-reference line intra-prediction mode; determining a second prediction value for the chroma components of the current block using the first prediction mode; and determining a prediction value for the current block based on the first and second prediction values.

[0766] Alternatively, as another embodiment, the second processor 2603 is also configured to perform the method described in any of the foregoing embodiments when running the computer program.

[0767] It is understood that the second memory 2602 has similar hardware functions to the first memory 2402, and the second processor 2603 has similar hardware functions to the first processor 2403; details will not be elaborated here.

[0768] This embodiment provides a decoder that, when using the fusion method of chroma TMRL mode in the current block, can fuse the first predicted value obtained by chroma TMRL mode with the second predicted value obtained by other chroma modes (e.g., the first prediction mode) to generate the final predicted value after fusion. This can improve the prediction accuracy in chroma TMRL mode, and since the first prediction mode can be any chroma mode, it can also improve the prediction diversity in chroma TMRL mode, thereby improving decoding efficiency and thus improving encoding and decoding performance.

[0769] In another embodiment of this application, FIG27 is a schematic diagram of the composition structure of an encoding / decoding system provided in an embodiment of this application. As shown in FIG27, the encoding / decoding system 270 may include an encoder 2701 and a decoder 2702.

[0770] In this embodiment, encoder 2701 can be any of the encoders described in the foregoing embodiments, and decoder 2702 can be any of the decoders described in the foregoing embodiments.

[0771] In some embodiments, this application also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the method as described in any of the foregoing embodiments. Specifically, when executed by a first processor, the computer program implements the encoding method as described in any of the foregoing embodiments, or when executed by a second processor, it implements the decoding method as described in any of the foregoing embodiments.

[0772] In some embodiments, this application also provides a computer program product, including a computer program or instructions. When executed by a processor, the computer program or instructions implement the method as described in any of the foregoing embodiments. Specifically, when executed by a first processor, the computer program or instructions implement the encoding method as described in any of the foregoing embodiments, or when executed by a second processor, they implement the decoding method as described in any of the foregoing embodiments.

[0773] In some embodiments, this application also provides a computer program that, when executed by a processor, implements the method as described in any of the foregoing embodiments. Specifically, when executed by a first processor, the computer program or instructions implement the encoding method as described in any of the foregoing embodiments, or when executed by a second processor, implement the decoding method as described in any of the foregoing embodiments.

[0774] In some embodiments, this application also provides a computer-readable storage medium storing a bitstream thereon. The bitstream is generated by performing the steps of the encoding method as described in any of the foregoing embodiments.

[0775] In this embodiment of the application, the information to be encoded in the encoding method includes at least one of the following: the prediction residual value of the current block, the combination mode index of the current block, the chroma fusion index of the current block, the value of the first syntax element, and the value of the second syntax element. Here, this information to be encoded is processed and written into the bitstream.

[0776] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0777] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0778] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0779] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0780] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0781] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0782] It should be noted that, in this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0783] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0784] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0785] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0786] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.

[0787] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims. Industrial applicability

[0788] In this embodiment, both the encoding and decoding ends determine the first prediction value of the chroma component of the current block when using the template-based multi-reference line intra-frame prediction mode; and determine the second prediction value of the chroma component of the current block when using the first prediction mode; then, based on the first and second prediction values, the prediction value of the current block is determined. Thus, when the current block uses the chroma TMRL mode fusion method, the first prediction value obtained from the chroma TMRL mode can be fused with the second prediction value obtained from other chroma modes (e.g., the first prediction mode) to generate the fused final prediction value. This improves the prediction accuracy under the chroma TMRL mode, and since the first prediction mode can be any chroma mode, it also increases the prediction diversity under the chroma TMRL mode, thereby improving encoding and decoding efficiency and ultimately enhancing encoding and decoding performance.

Claims

1. A decoding method applied to a decoder, the method comprising: Determine the first prediction value of the chroma components of the current block when using the template-based multi-reference line intra-prediction mode; Determine the second prediction value when the chromaticity components of the current block use the first prediction mode; The predicted value of the current block is determined based on the first predicted value and the second predicted value.

2. The method according to claim 1, wherein, The determination of the chroma components of the current block using the first prediction value of the template-based multi-reference line intra-prediction mode includes: Parse the combination pattern index in the bitstream; Based on the combined mode index, a first combined mode of the current block is determined; wherein, the first combined mode includes the reference line and intra-prediction mode used by the current block; The chroma components of the current block are predicted based on the reference line and intra-frame prediction mode used by the current block to determine the first predicted value of the current block.

3. The method according to claim 2, wherein, Determining the first combination pattern of the current block based on the combination pattern index includes: Determine the candidate list of combinations for the current block; The first combination pattern of the current block is determined based on the combination pattern index and the combination candidate list.

4. The method according to claim 3, wherein, Determining the candidate list of combinations for the current block includes: Determine at least one candidate reference line and at least one candidate intra-prediction mode for the current block; The at least one candidate reference line and the at least one candidate intra-prediction mode are combined to determine multiple candidate combination modes for the current block; Based on the various candidate combination patterns, a combination candidate list for the current block is determined.

5. The method according to claim 4, wherein, The step of determining the combination candidate list of the current block based on the multiple candidate combination patterns includes: Based on the multiple candidate combination patterns, the first template of the current block is predicted respectively, and the template prediction value corresponding to the multiple candidate combination patterns is determined. The cost results corresponding to the multiple candidate combination modes are determined by calculating the cost of the template prediction values ​​corresponding to the templates of the first template and the template reconstruction values ​​of the multiple candidate combination modes respectively. The candidate combination patterns are sorted according to the cost results, and the top T candidate combination patterns are used as the combination candidate list for the current block; where T is a positive integer.

6. The method according to any one of claims 1 to 5, wherein, The step of determining the second prediction value when the chromaticity components of the current block use the first prediction mode includes: Parse the chroma blending index in the bitstream; When the chroma fusion index indicates that the chroma components of the current block are predicted using a fusion method, a first prediction mode for the current block is determined; The chromaticity components of the current block are predicted according to the first prediction mode to determine the second predicted value of the current block.

7. The method according to claim 6, wherein, Determining the predicted value of the current block based on the first predicted value and the second predicted value includes: Determine the first weight corresponding to the first predicted value and the second weight corresponding to the second predicted value; The predicted value of the current block is determined by weighting the first predicted value and the second predicted value according to the first weight and the second weight.

8. The method according to claim 7, wherein, The method further includes: Set the first weight and the second weight to fixed constants.

9. The method according to claim 7, wherein, The method further includes: Determine the left adjacent reference block and the top adjacent reference block of the current block; The first weight and the second weight are determined based on the prediction patterns of the left adjacent reference block and the upper adjacent reference block, respectively.

10. The method according to claim 9, wherein, The step of determining the first weight and the second weight based on the prediction modes of the left adjacent reference block and the upper adjacent reference block includes: When all the left-side adjacent reference blocks and the upper-side adjacent reference blocks are valid and their respective prediction modes are cross-component prediction modes, the first weight and the second weight are set to the first set of preset values. When only one of the left adjacent reference block and the upper adjacent reference block is valid and the corresponding prediction mode is the cross-component prediction mode, the first weight and the second weight are set to the second set of preset values. When all of the left-side adjacent reference blocks and the upper-side adjacent reference blocks are invalid, or at least one is valid and the corresponding prediction mode is a non-cross-component prediction mode, the first weight and the second weight are set to the third set of preset values.

11. The method according to claim 7, wherein, The method further includes: The cost of the first template of the current block is calculated according to the first prediction mode to determine the first cost result and the number of samples of the first template. The first weight and the second weight are determined based on the first cost result and the number of samples of the first template.

12. The method according to claim 11, wherein, Determining the first weight and the second weight based on the first cost result and the number of samples in the first template includes: When the first cost result is greater than the first product between the first factor and the number of samples of the first template, the first weight and the second weight are set to the fourth set of preset values; When the first cost result is less than the second product between the second factor and the number of samples of the first template, the first weight and the second weight are set to the fifth set of preset values; When the first cost result is greater than or equal to the second product and less than or equal to the first product, the first weight and the second weight are set to the sixth set of preset values.

13. The method according to claim 7, wherein, The method further includes: Based on the template-based multi-reference row intra-frame prediction mode and the first prediction mode, the first template of the current block is predicted respectively, and the first template prediction value corresponding to the template-based multi-reference row intra-frame prediction mode and the second template prediction value corresponding to the first prediction mode are determined. Determine the first autocorrelation matrix of the first template predicted value and the second template predicted value, and determine the first cross-correlation vector between the first template predicted value and the second template predicted value and the template reconstruction value of the first template; The first weight and the second weight are determined based on the first autocorrelation matrix and the first cross-correlation vector.

14. The method according to claim 6, wherein, Determining the first prediction mode for the current block includes: Determine at least one candidate prediction mode for the current block; The first prediction pattern is determined from the at least one candidate prediction pattern.

15. The method according to claim 14, wherein, Determining the first prediction mode for the current block further includes: Based on the at least one candidate prediction mode, the first template of the current block is predicted respectively, and the template prediction value corresponding to the at least one candidate prediction mode is determined; Cost calculations are performed on the template prediction values ​​corresponding to the at least one candidate prediction mode and the template reconstruction values ​​of the first template, respectively, to determine the cost result corresponding to the at least one candidate prediction mode; The at least one candidate prediction mode is sorted according to the cost result, and the top K candidate prediction modes are determined. The first prediction mode is then determined from the K candidate prediction modes; where K is a positive integer.

16. The method according to claim 6, wherein, The method further includes: When the chroma fusion index indicates that the chroma components of the current block are predicted using a first fusion method, at least one candidate prediction mode for the current block is determined; Determine a first prediction mode for the current block from the at least one candidate prediction modes; The chromaticity components of the current block are predicted according to the first prediction mode to determine the second predicted value of the current block; The predicted value of the current block is determined based on the first fusion method, the first predicted value, and the second predicted value.

17. The method according to claim 16, wherein, Determining the predicted value of the current block based on the first fusion method, the first predicted value, and the second predicted value includes: Determine the first weight and the second weight corresponding to the first fusion method; The predicted value of the current block is determined by weighting the first predicted value and the second predicted value according to the first weight and the second weight.

18. The method according to claim 17, wherein, The at least one candidate prediction mode includes: a multi-model component linear prediction mode and a multi-model convolution component prediction mode; determining the first prediction mode of the current block among the at least one candidate prediction mode includes: When the current block does not meet the application conditions of the multi-model component inter-prediction mode, the first prediction mode of the current block is determined to be the multi-model component linear prediction mode. When the current block satisfies the application conditions of the multi-model convolutional integral inter-prediction mode, the cost of the first template of the current block is calculated according to the multi-model inter-component linear prediction mode and the multi-model convolutional integral inter-prediction mode, respectively, to determine two template cost results; and the minimum cost result is determined among the two template cost results, and the candidate prediction mode corresponding to the minimum cost result is determined as the [prediction mode name]. The first prediction pattern for the current block.

19. The method according to claim 18, wherein, Determining the first weight and second weight corresponding to the first fusion method includes: When the current block does not meet the application conditions of the multi-model convolutional integral prediction mode, determine the left adjacent reference block and the upper adjacent reference block of the current block; When all the left-side adjacent reference blocks and the upper-side adjacent reference blocks are valid and their respective prediction modes are cross-component prediction modes, the first weight and the second weight are set to the seventh group of preset values. When only one of the left adjacent reference block and the upper adjacent reference block is valid and the corresponding prediction mode is the cross-component prediction mode, the first weight and the second weight are set to the eighth group of preset values. When all of the left-side adjacent reference blocks and the upper-side adjacent reference blocks are invalid, or at least one is valid and the corresponding prediction mode is a non-cross-component prediction mode, the first weight and the second weight are set to the ninth group of preset values.

20. The method according to claim 18, wherein, Determining the first weight and second weight corresponding to the first fusion method includes: When the current block satisfies the application conditions of the multi-model convolutional integral prediction mode, determine the minimum cost result and the number of samples for the first template; When the minimum cost result is greater than the third product between the fourth factor and the number of samples of the first template, the first weight and the second weight are set to the tenth preset value; When the minimum cost result is less than the fourth product between the fifth factor and the number of samples of the first template, the first weight and the second weight are set to the eleventh set of preset values; When the minimum cost result is greater than or equal to the fourth product and less than or equal to the third product, the first weight and the second weight are set to the twelfth preset value.

21. The method according to claim 6, wherein, The method further includes: When the chroma fusion index indicates that the chroma components of the current block are predicted using the second fusion method, the first prediction mode of the current block is determined to be the inter-component prediction mode; Determine the first reconstructed value of the current block after downsampling the co-position brightness; The predicted value of the current block is determined based on the second fusion method, the first predicted value, and the first reconstructed value.

22. The method according to claim 21, wherein, Determining the predicted value of the current block based on the second fusion method, the first predicted value, and the first reconstructed value includes: Determine the first weight, second weight, and third weight corresponding to the second fusion method; The predicted value of the current block is determined by weighting the first predicted value, the first reconstructed value, and the first constant according to the first weight, the second weight, and the third weight.

23. The method according to claim 22, wherein, Determining the first weight, second weight, and third weight corresponding to the second fusion method includes: The first template of the current block is predicted according to the template-based multi-reference row intra-frame prediction mode, and the predicted value of the first template corresponding to the template-based multi-reference row intra-frame prediction mode is determined. Obtain the second reconstructed value and the second constant after downsampling the brightness of the first template; Determine the second autocorrelation matrix of the first template predicted value, the second reconstructed value, and the second constant, and determine the second cross-correlation vector between the first template predicted value, the second reconstructed value, and the second constant and the chromaticity reconstructed value of the first template; The first weight, the second weight, and the third weight are determined based on the second autocorrelation matrix and the second cross-correlation vector.

24. The method according to claim 6, wherein, The method further includes: When the chroma fusion index indicates that the chroma components of the current block are predicted using the third fusion method, the first prediction mode of the current block is determined to be the multi-model component prediction mode; Determine the first reconstructed value of the current block after downsampling the co-position brightness; The predicted value of the current block is determined based on the third fusion method, the first predicted value, and the first reconstructed value.

25. The method according to claim 24, wherein, Determining the predicted value of the current block based on the third fusion method, the first predicted value, and the first reconstructed value includes: When the first reconstructed value is less than or equal to the classification threshold, the first weight, the second weight, and the third weight corresponding to the third fusion method are determined, and the first predicted value, the first reconstructed value, and the third constant are weighted according to the first weight, the second weight, and the third weight to determine the predicted value of the current block; When the first reconstructed value is greater than the classification threshold, the fourth, fifth, and sixth weights corresponding to the third fusion method are determined, and the first predicted value, the first reconstructed value, and the third constant are adjusted according to the fourth, fifth, and sixth weights. Perform a weighted operation to determine the predicted value of the current block.

26. The method of claim 25, wherein, The method further includes: The first template of the current block is divided according to the classification threshold to determine the first sub-template and the second sub-template; The first sub-template is predicted according to the template-based multi-reference line intra-frame prediction mode to determine the predicted value of the first sub-template corresponding to the template-based multi-reference line intra-frame prediction mode; after obtaining the third reconstructed value and the fourth constant after the luminance downsampling of the first sub-template, the third autocorrelation matrix of the first sub-template predicted value, the third reconstructed value and the fourth constant is determined, and the third cross-correlation vector between the first sub-template predicted value, the third reconstructed value and the fourth constant and the chrominance reconstructed value of the first sub-template is determined, and the first weight, the second weight and the third weight are determined according to the third autocorrelation matrix and the third cross-correlation vector; The second sub-template is predicted according to the template-based multi-reference line intra-frame prediction mode to determine the predicted value of the second sub-template corresponding to the template-based multi-reference line intra-frame prediction mode; after obtaining the fourth reconstructed value and the fifth constant after the luminance downsampling of the second sub-template, the fourth autocorrelation matrix of the predicted value of the second sub-template, the fourth reconstructed value and the fifth constant is determined, as well as the fourth cross-correlation vector between the predicted value of the second sub-template, the fourth reconstructed value and the fifth constant and the chrominance reconstructed value of the second sub-template is determined, and the fourth weight, the fifth weight and the sixth weight are determined according to the fourth autocorrelation matrix and the fourth cross-correlation vector.

27. The method according to claim 6, wherein, The method further includes: When the chroma fusion index indicates that the chroma components of the current block are not predicted using a fusion method, the first predicted value is directly determined as the predicted value of the current block.

28. The method according to any one of claims 1 to 27, wherein, The method further includes: Parse the first syntax element in the bitstream; The second syntax element in the bitstream is parsed when the first syntax element indicates that the chroma component of the current block uses a non-cross-component prediction mode; When the second syntax element indicates that the chroma components of the current block use a template-based multi-reference line intra-prediction mode, the step of determining the first prediction value when the chroma components of the current block use the template-based multi-reference line intra-prediction mode is performed.

29. An encoding method applied to an encoder, the method comprising: Determine the first prediction value of the chroma components of the current block when using the template-based multi-reference line intra-prediction mode; Determine the second prediction value when the chromaticity components of the current block use the first prediction mode; The predicted value of the current block is determined based on the first predicted value and the second predicted value.

30. The method according to claim 29, wherein, The determination of the chroma components of the current block using the first prediction value of the template-based multi-reference line intra-prediction mode includes: Determine the candidate list of combinations for the current block; Based on the combined candidate list, a first combined mode for the current block is determined; wherein, the first combined mode includes the reference line and intra-frame prediction mode used by the current block; The chroma components of the current block are predicted based on the reference line and intra-frame prediction mode used by the current block to determine the first predicted value of the current block.

31. The method according to claim 30, wherein, Determining the candidate list of combinations for the current block includes: Determine at least one candidate reference line and at least one candidate intra-prediction mode for the current block; The at least one candidate reference line and the at least one candidate intra-prediction mode are combined to determine multiple candidate combination modes for the current block; Based on the various candidate combination patterns, a combination candidate list for the current block is determined.

32. The method according to claim 31, wherein, The step of determining the combination candidate list of the current block based on the multiple candidate combination patterns includes: Based on the multiple candidate combination patterns, the first template of the current block is predicted respectively, and the template prediction value corresponding to the multiple candidate combination patterns is determined. The cost results corresponding to the multiple candidate combination modes are determined by calculating the cost of the template prediction values ​​corresponding to the templates of the first template and the template reconstruction values ​​of the multiple candidate combination modes respectively. The candidate combination patterns are sorted according to the cost results, and the top T candidate combination patterns are used as the combination candidate list for the current block; where T is a positive integer.

33. The method according to claim 30, wherein, Determining the first combination pattern of the current block based on the combination candidate list includes: The encoding cost of the current block is calculated based on at least two candidate combination patterns in the candidate combination list, and the cost result corresponding to the at least two candidate combination patterns is determined. The minimum cost result is determined based on the cost results corresponding to the at least two candidate combination patterns, and the candidate combination pattern corresponding to the minimum cost result is determined as the first combination pattern of the current block.

34. The method according to claim 30, wherein, The method further includes: Determine the combination pattern index of the current block; wherein the combination pattern index is used to indicate the index number of the first combination pattern in the combination candidate list; The combination mode index of the current block is encoded, and the resulting encoded bits are written into the bitstream.

35. The method according to any one of claims 29 to 34, wherein, The step of determining the second prediction value when the chromaticity components of the current block use the first prediction mode includes: When the chromaticity components of the current block are predicted using a fusion method, a first prediction mode for the current block is determined; The chromaticity components of the current block are predicted according to the first prediction mode to determine the second predicted value of the current block.

36. The method according to claim 35, wherein, Determining the predicted value of the current block based on the first predicted value and the second predicted value includes: Determine the first weight corresponding to the first predicted value and the second weight corresponding to the second predicted value; The predicted value of the current block is determined by weighting the first predicted value and the second predicted value according to the first weight and the second weight.

37. The method of claim 36, wherein, The method further includes: Set the first weight and the second weight to fixed constants.

38. The method according to claim 36, wherein, The method further includes: Determine the left adjacent reference block and the top adjacent reference block of the current block; The first weight and the second weight are determined based on the prediction patterns of the left adjacent reference block and the upper adjacent reference block, respectively.

39. The method according to claim 38, wherein, The step of determining the first weight and the second weight based on the prediction modes of the left adjacent reference block and the upper adjacent reference block includes: When all the left-side adjacent reference blocks and the upper-side adjacent reference blocks are valid and their respective prediction modes are cross-component prediction modes, the first weight and the second weight are set to the first set of preset values. When only one of the left adjacent reference block and the upper adjacent reference block is valid and the corresponding prediction mode is the cross-component prediction mode, the first weight and the second weight are set to the second set of preset values. When all of the left-side adjacent reference blocks and the upper-side adjacent reference blocks are invalid, or at least one is valid and the corresponding prediction mode is a non-cross-component prediction mode, the first weight and the second weight are set to the third set of preset values.

40. The method of claim 36, wherein, The method further includes: The cost of the first template of the current block is calculated according to the first prediction mode to determine the first cost result and the number of samples of the first template. The first weight and the second weight are determined based on the first cost result and the number of samples of the first template.

41. The method according to claim 40, wherein, Determining the first weight and the second weight based on the first cost result and the number of samples in the first template includes: When the first cost result is greater than the first product between the first factor and the number of samples of the first template, the first weight and the second weight are set to the fourth set of preset values; When the first cost result is less than the second product between the second factor and the number of samples of the first template, the first weight and the second weight are set to the fifth set of preset values; When the first cost result is greater than or equal to the second product and less than or equal to the first product, the first weight and the second weight are set to the sixth set of preset values.

42. The method according to claim 36, wherein, The method further includes: Based on the template-based multi-reference row intra-frame prediction mode and the first prediction mode, the first template of the current block is predicted respectively, and the first template prediction value corresponding to the template-based multi-reference row intra-frame prediction mode and the second template prediction value corresponding to the first prediction mode are determined. Determine the first autocorrelation matrix of the first template predicted value and the second template predicted value, and determine the first cross-correlation vector between the first template predicted value and the second template predicted value and the template reconstruction value of the first template; The first weight and the second weight are determined based on the first autocorrelation matrix and the first cross-correlation vector.

43. The method according to claim 35, wherein, Determining the first prediction mode for the current block includes: Determine at least one candidate prediction mode for the current block; The first prediction pattern is determined from the at least one candidate prediction pattern.

44. The method according to claim 43, wherein, Determining the first prediction mode for the current block further includes: Based on the at least one candidate prediction mode, the first template of the current block is predicted respectively, and the template prediction value corresponding to the at least one candidate prediction mode is determined; Cost calculations are performed on the template prediction values ​​corresponding to the at least one candidate prediction mode and the template reconstruction values ​​of the first template, respectively, to determine the cost result corresponding to the at least one candidate prediction mode; The at least one candidate prediction mode is sorted according to the cost result, and the top K candidate prediction modes are determined. The first prediction mode is then determined from the K candidate prediction modes; where K is a positive integer.

45. The method according to claim 35, wherein, The method further includes: When the chromaticity components of the current block are predicted using a first fusion method, at least one candidate prediction mode for the current block is determined; Determine a first prediction mode for the current block from the at least one candidate prediction modes; The chromaticity components of the current block are predicted according to the first prediction mode to determine the second predicted value of the current block; The predicted value of the current block is determined based on the first fusion method, the first predicted value, and the second predicted value.

46. ​​The method according to claim 45, wherein, Determining the predicted value of the current block based on the first fusion method, the first predicted value, and the second predicted value includes: Determine the first weight and the second weight corresponding to the first fusion method; The predicted value of the current block is determined by weighting the first predicted value and the second predicted value according to the first weight and the second weight.

47. The method according to claim 46, wherein, The at least one candidate prediction mode includes: a multi-model component linear prediction mode and a multi-model convolution component prediction mode; determining the first prediction mode of the current block among the at least one candidate prediction mode includes: When the current block does not meet the application conditions of the multi-model component inter-prediction mode, the first prediction mode of the current block is determined to be the multi-model component linear prediction mode. When the current block satisfies the application conditions of the multi-model component inter-prediction mode, the cost of the first template of the current block is calculated according to the multi-model component inter-linear prediction mode and the multi-model component inter-prediction mode, respectively, to determine two template cost results; and the minimum cost result is determined among the two template cost results, and the candidate prediction mode corresponding to the minimum cost result is determined as the first prediction mode of the current block.

48. The method according to claim 47, wherein, Determining the first weight and second weight corresponding to the first fusion method includes: When the current block does not meet the application conditions of the multi-model convolutional integral prediction mode, determine the left adjacent reference block and the upper adjacent reference block of the current block; When all the left-side adjacent reference blocks and the upper-side adjacent reference blocks are valid and their respective prediction modes are cross-component prediction modes, the first weight and the second weight are set to the seventh group of preset values. When only one of the left adjacent reference block and the upper adjacent reference block is valid and the corresponding prediction mode is the cross-component prediction mode, the first weight and the second weight are set to the eighth group of preset values. When all of the left-side adjacent reference blocks and the upper-side adjacent reference blocks are invalid, or at least one is valid and the corresponding prediction mode is a non-cross-component prediction mode, the first weight and the second weight are set to the ninth group of preset values.

49. The method according to claim 47, wherein, Determining the first weight and second weight corresponding to the first fusion method includes: When the current block satisfies the application conditions of the multi-model convolutional integral prediction mode, determine the minimum cost result and the number of samples for the first template; When the minimum cost result is greater than the third product between the fourth factor and the number of samples of the first template, the first weight and the second weight are set to the tenth preset value; When the minimum cost result is less than the fourth product between the fifth factor and the number of samples of the first template, the first weight and the second weight are set to the eleventh set of preset values; When the minimum cost result is greater than or equal to the fourth product and less than or equal to the third product, the first weight and the second weight are set to the twelfth preset value.

50. The method of claim 35, wherein, The method further includes: When the chromaticity components of the current block are predicted using the second fusion method, the first prediction mode of the current block is determined to be the inter-component prediction mode. Determine the first reconstructed value of the current block after downsampling the co-position brightness; The predicted value of the current block is determined based on the second fusion method, the first predicted value, and the first reconstructed value.

51. The method according to claim 50, wherein, Determining the predicted value of the current block based on the second fusion method, the first predicted value, and the first reconstructed value includes: Determine the first weight, second weight, and third weight corresponding to the second fusion method; The predicted value of the current block is determined by weighting the first predicted value, the first reconstructed value, and the first constant according to the first weight, the second weight, and the third weight.

52. The method according to claim 51, wherein, Determining the first weight, second weight, and third weight corresponding to the second fusion method includes: The first template of the current block is predicted according to the template-based multi-reference row intra-frame prediction mode, and the predicted value of the first template corresponding to the template-based multi-reference row intra-frame prediction mode is determined. Obtain the second reconstructed value and the second constant after downsampling the brightness of the first template; Determine the second autocorrelation matrix of the first template predicted value, the second reconstructed value, and the second constant, and determine the second cross-correlation vector between the first template predicted value, the second reconstructed value, and the second constant and the chromaticity reconstructed value of the first template; The first weight, the second weight, and the third weight are determined based on the second autocorrelation matrix and the second cross-correlation vector.

53. The method according to claim 35, wherein, The method further includes: When the chromaticity components of the current block are predicted using the third fusion method, the first prediction mode of the current block is determined to be the multi-model component prediction mode; Determine the first reconstructed value of the current block after downsampling the co-position brightness; The predicted value of the current block is determined based on the third fusion method, the first predicted value, and the first reconstructed value.

54. The method according to claim 53, wherein, Determining the predicted value of the current block based on the third fusion method, the first predicted value, and the first reconstructed value includes: When the first reconstructed value is less than or equal to the classification threshold, the first weight, the second weight, and the third weight corresponding to the third fusion method are determined, and the first predicted value, the first reconstructed value, and the third constant are weighted according to the first weight, the second weight, and the third weight to determine the predicted value of the current block; When the first reconstructed value is greater than the classification threshold, the fourth, fifth, and sixth weights corresponding to the third fusion method are determined, and the first predicted value, the first reconstructed value, and the third constant are weighted according to the fourth, fifth, and sixth weights to determine the predicted value of the current block.

55. The method according to claim 54, wherein, The method further includes: The first template of the current block is divided according to the classification threshold to determine the first sub-template and the second sub-template; The first sub-template is predicted according to the template-based multi-reference line intra-frame prediction mode to determine the predicted value of the first sub-template corresponding to the template-based multi-reference line intra-frame prediction mode; after obtaining the third reconstructed value and the fourth constant after the luminance downsampling of the first sub-template, the third autocorrelation matrix of the first sub-template predicted value, the third reconstructed value and the fourth constant is determined, and the third cross-correlation vector between the first sub-template predicted value, the third reconstructed value and the fourth constant and the chrominance reconstructed value of the first sub-template is determined, and the first weight, the second weight and the third weight are determined according to the third autocorrelation matrix and the third cross-correlation vector; The second sub-template is predicted according to the template-based multi-reference line intra-frame prediction mode to determine the predicted value of the second sub-template corresponding to the template-based multi-reference line intra-frame prediction mode; after obtaining the fourth reconstructed value and the fifth constant after the luminance downsampling of the second sub-template, the fourth autocorrelation matrix of the predicted value of the second sub-template, the fourth reconstructed value and the fifth constant is determined, as well as the fourth cross-correlation vector between the predicted value of the second sub-template, the fourth reconstructed value and the fifth constant and the chrominance reconstructed value of the second sub-template is determined, and the fourth weight, the fifth weight and the sixth weight are determined according to the fourth autocorrelation matrix and the fourth cross-correlation vector.

56. The method according to claim 35, wherein, The method further includes: When the chromaticity components of the current block are not predicted using a fusion method, the first predicted value is directly determined as the predicted value of the current block.

57. The method according to claim 29, wherein, The method further includes: Determine the chroma fusion index of the current block; wherein, the chroma fusion index is used to indicate whether the chroma components of the current block use a fusion method and the corresponding fusion method number when using a fusion method for prediction; The chroma fusion index of the current block is encoded, and the resulting encoded bits are written into the bitstream.

58. The method according to any one of claims 29 to 57, wherein, The method further includes: Determine the value of the first syntax element; wherein the first syntax element is used to indicate whether the chroma component of the current block uses a non-cross-component prediction mode; The value of the first syntax element is encoded, and the resulting encoded bits are written into the bitstream.

59. The method according to any one of claims 29 to 57, wherein, The method further includes: Determine the value of the second syntax element; wherein the second syntax element is used to indicate whether the chroma components of the current block use a method based on... Multi-reference row intra-frame prediction mode for templates; The value of the second syntax element is encoded, and the resulting encoded bits are written into the bitstream.

60. An encoder, the encoder comprising a first determining unit, wherein: The first determining unit is configured to determine a first prediction value when the chroma components of the current block use a template-based multi-reference line intra-prediction mode; And determine the second prediction value when the chromaticity components of the current block use the first prediction mode; The first determining unit is further configured to determine the predicted value of the current block based on the first predicted value and the second predicted value.

61. An encoder, the encoder comprising a first memory and a first processor, wherein: The first memory is used to store computer programs that can run on the first processor; The first processor is configured to perform the method as described in any one of claims 29 to 59 when running the computer program.

62. A decoder, the decoder comprising a second determining unit, wherein: The second determining unit is configured to determine a first prediction value when the chroma components of the current block use a template-based multi-reference line intra-prediction mode; And determine the second prediction value when the chromaticity components of the current block use the first prediction mode; The second determining unit is further configured to determine the predicted value of the current block based on the first predicted value and the second predicted value.

63. A decoder, the decoder comprising a second memory and a second processor, wherein: The second memory is used to store computer programs that can run on the second processor; The second processor is configured to perform the method as described in any one of claims 1 to 28 when running the computer program.

64. A computer-readable storage medium having a computer program stored thereon, wherein, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 28, or the method as described in any one of claims 29 to 59.

65. A computer-readable storage medium having a bitstream stored thereon, wherein, The bitstream is generated by performing the steps of the encoding method as described in any one of claims 29 to 59.