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

By introducing multi-reference line intra-frame prediction technology during the encoding and decoding process of chroma blocks, the intra-frame prediction value is determined by using the reconstructed values ​​of multiple line samples, which solves the problem of insufficient chroma component prediction accuracy and achieves higher encoding and decoding performance.

WO2026007062A1PCT designated stage Publication Date: 2026-01-08GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/103580
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2026-01-08

AI Technical Summary

Technical Problem

In existing technologies, the intra-frame prediction accuracy of chroma components is insufficient and difficult to improve effectively.

Method used

A multi-reference row intra-frame prediction technique is introduced, which uses the reconstructed values ​​of multiple rows of samples to determine the intra-frame prediction value of the chroma block, and then determines the reconstructed value of the chroma block based on the residual value and the intra-frame prediction value.

Benefits of technology

It improves the encoding and decoding performance of chroma components and enhances the prediction accuracy of chroma blocks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024103580_08012026_PF_FP_ABST
    Figure CN2024103580_08012026_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide an encoding method, a decoding method, an encoder, a decoder, storage medium, and bitstream. The decoding method comprises: decoding a bitstream, and determining a residual value of a current chroma block (S510); determining an intra prediction value of the current chroma block on the basis of reconstructed values of N rows of samples (S520), N being a positive integer greater than 1; and determining a reconstructed value of the current chroma block on the basis of the residual value and the intra prediction value (S530).
Need to check novelty before this filing date? Find Prior Art

Description

Coding method, coder, storage medium and bitstream TECHNICAL FIELD

[0001] The present application relates to the technical field of video coding, in particular to a coding method, a coder, a storage medium and a bitstream. BACKGROUND

[0002] Intra prediction includes intra prediction for a luma component and intra prediction for a chroma component. How to improve the prediction accuracy of the chroma component is a problem to be solved.

[0003] SUMMARY

[0004] Embodiments of the present application provide a coding method, a coder, a storage medium and a bitstream. Each aspect involved in the present application is introduced below.

[0005] In a first aspect, a decoding method is provided, applied to a decoder, including: decoding a bitstream, determining a residual value of a current chroma block; determining an intra prediction value of the current chroma block according to reconstructed values of N rows of samples, N being a positive integer greater than 1; and determining a reconstructed value of the current chroma block according to the residual value and the intra prediction value.

[0006] In a second aspect, an encoding method is provided, applied to an encoder, including: determining an intra prediction value of a current chroma block according to reconstructed values of N rows of samples, N being a positive integer greater than 1; determining a residual value of the current chroma block according to the intra prediction value; and encoding the residual value.

[0007] In a third aspect, a decoder is provided, including: a decoding unit configured to decode a bitstream, determine a residual value of a current chroma block; a first determining unit configured to determine an intra prediction value of the current chroma block according to reconstructed values of N rows of samples, N being a positive integer greater than 1; and a second determining unit configured to determine a reconstructed value of the current chroma block according to the residual value and the intra prediction value.

[0008] In a fourth aspect, a decoder is provided, including: a memory configured to store a computer program; and a processor configured to execute the method of the first aspect when running the computer program.

[0009] In a fifth aspect, an encoder is provided, including: a first determining unit configured to determine an intra prediction value of a current chroma block according to reconstructed values of N rows of samples, N being a positive integer greater than 1; a second determining unit configured to determine a residual value of the current chroma block according to the intra prediction value; and an encoding unit configured to encode the residual value.

[0010] In a sixth aspect, an encoder is provided, and the encoder comprises a memory configured to store a computer program, and a processor configured to execute the computer program to perform the method of the second aspect.

[0011] In a seventh aspect, a non-volatile computer readable storage medium storing a bitstream is provided, and the bitstream is generated by using an encoding method of an encoder, or the bitstream is decoded by using a decoding method of a decoder, wherein the decoding method is the method of the first aspect, and the encoding method is the method of the second aspect.

[0012] In an eighth aspect, a bitstream is provided, and the bitstream is generated by using the method of the second aspect.

[0013] In a ninth aspect, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program, and the computer program is executed to implement the method of the first aspect or the method of the second aspect.

[0014] In a tenth aspect, a computer readable medium is provided, and the computer readable medium stores the bitstream generated by using the method of the second aspect.

[0015] In an eleventh aspect, a computer program product is provided, and the computer program product comprises a computer program, and the computer program is executed to implement the method of the first aspect or the second aspect.

[0016] The embodiments of the present application introduce the multi-reference line intra prediction technology for chroma components, which helps to improve the prediction accuracy of the chroma components. BRIEF DESCRIPTION OF DRAWINGS

[0017] FIG. 1 is an example diagram of a structure of a video encoder to which the embodiments of the present application can be applied.

[0018] FIG. 2 is an example diagram of a structure of a video decoder to which the embodiments of the present application can be applied.

[0019] FIG. 3 is a schematic diagram of neighboring positions of a current block.

[0020] FIG. 4 is an example diagram of a multi-reference line intra prediction mode.

[0021] FIG. 5 is a flowchart of a decoding method provided by the embodiments of the present application.

[0022] FIG. 6 is a schematic diagram of a current chroma block and a same-positioned luma block thereof according to the embodiments of the present application.

[0023] FIG. 7 is a flowchart of a possible implementation of step S520 in FIG. 5.

[0024] FIG. 8 is an example diagram of a template error calculation method according to an embodiment of the present application.

[0025] FIG. 9 is another example diagram of a template error calculation method according to an embodiment of the present application.

[0026] FIG. 10 is a flow diagram of an encoding method according to an embodiment of the present application.

[0027] FIG. 11 is a structural diagram of a decoder according to an embodiment of the present application.

[0028] FIG. 12 is a structural diagram of a decoder according to another embodiment of the present application.

[0029] FIG. 13 is a structural diagram of an encoder according to an embodiment of the present application.

[0030] FIG. 14 is a structural diagram of an encoder according to another embodiment of the present application. DETAILED DESCRIPTION

[0031] FIG. 1 is a schematic block diagram of a video encoder according to an embodiment of the present application.

[0032] It should be understood that the video encoder 100 can be used for lossy compression of images, and can also be used for lossless compression of images. The lossless compression can be visually lossless compression, or mathematically lossless compression.

[0033] The video encoder 100 can be applied to image data in YCbCr (YUV) format. For example, the YUV ratio can be 4:2:0, 4:2:2, or 4:4:4, Y represents luminance (Luma), Cb (U) represents blue chrominance, and Cr (V) represents red chrominance. U and V represent chrominance (Chroma) for describing color and saturation. For example, in terms of color format, 4:2:0 means that there are 4 luminance components and 2 chrominance components (YYYYCbCr) for every 4 pixels, 4:2:2 means that there are 4 luminance components and 4 chrominance components (YYYYCbCrCbCr) for every 4 pixels, and 4:4:4 means full pixel display (YYYYCbCrCbCrCbCrCbCr).

[0034] For example, the video encoder 100 reads the video data, partitions, for each picture in the video data, a picture into a number of coding tree units (CTUs), which can be referred to in some examples as "treeblocks," "largest coding units" (LCUs) or "coding tree blocks" (CTBs). Each CTU can be associated with a same size block of pixels within the picture. Each pixel can correspond to a luminance (luma) sample and two chrominance (chroma) samples. Thus, each CTU can be associated with a luma sample block and two chroma sample blocks. A CTU size can be, for example, 128x128, 64x64, 32x32, and the like. A CTU can be further partitioned into coding units (CUs) for coding, which can be square or non-square in shape. CUs can be further partitioned into prediction units (PUs) and transform units (TUs) to separate the processes of prediction, motion compensation, and transform, to provide more flexibility in processing. In one example, a CTU is quad-tree partitioned into CUs, and a CU is quad-tree partitioned into TUs and PUs.

[0035] A video encoder and a video decoder can support various PU sizes. Assuming that a size of a particular CU is 2Nx2N, the video encoder and the video decoder can support a PU size of 2Nx2N or NxN for intra prediction, and support symmetric PUs of 2Nx2N, 2NxN, Nx2N, NxN, or similar sizes for inter prediction. The video encoder and the video decoder can also support asymmetric PUs of 2NxnU, 2NxnD, nLx2N, and nRx2N for inter prediction.

[0036] In some embodiments, as shown in FIG. 1, the video encoder 100 can include a prediction unit 110, a residual unit 120, a transform / quantization unit 130, an inverse transform / quantization unit 140, a reconstruction unit 150, a loop filter unit 160, a decoded picture buffer 170, and an entropy encoding unit 180. It is noted that the video encoder 100 can include more, less, or different functional components.

[0037] Optionally, in this application, a current block can be referred to as a current coding unit (CU) or a current prediction unit (PU), and the like. A prediction block can also be referred to as a predicted image block or an image predicted block, and a reconstructed image block can also be referred to as a reconstructed block or an image reconstructed block.

[0038] In some embodiments, the prediction unit 110 includes an inter-prediction unit 111 and an intra-prediction unit 112. Due to the strong correlation between adjacent pixels in one image of a video, the method of intra-prediction is used in video coding technology to eliminate the spatial redundancy between adjacent pixels. Due to the strong similarity between adjacent images in a video, the method of inter-prediction is used in video coding technology to eliminate the temporal redundancy between adjacent images, thereby improving the coding efficiency.

[0039] The inter-prediction unit 111 can be used for inter-prediction, which can include motion estimation and motion compensation, can refer to image information of different images, and inter-prediction uses motion information to find a reference block in a reference image, generates a prediction block according to the reference block, and is used to eliminate temporal redundancy. Inter-prediction uses motion information to find a reference block in a reference image, generates a prediction block according to the reference block. The motion information includes a reference image list where the reference image is located, a reference image index, and a motion vector. The motion vector can be an integer pixel or a fractional pixel. If the motion vector is a fractional pixel, an interpolation filter needs to be used in the reference image to obtain the required fractional pixel block. Here, the integer pixel or fractional pixel block in the reference image found according to the motion vector is called a reference block. Some technologies directly use the reference block as the prediction block, and some technologies generate the prediction block by processing the reference block. Generating the prediction block by processing the reference block can also be understood as using the reference block as the prediction block and then processing the prediction block to generate a new prediction block.

[0040] The intra-prediction unit 112 only refers to the information of the same image to predict the pixel information in the current code image block, which is used to eliminate spatial redundancy.

[0041] There are many intra-prediction modes. Taking the H series of international digital video coding standards as an example, the H.264 / AVC standard has 8 angle prediction modes and 1 non-angle prediction mode, and the H.265 / HEVC is extended to 33 angle prediction modes and 2 non-angle prediction modes. The intra-prediction modes used by HEVC include Planar, DC, and 33 angle modes, a total of 35 prediction modes. The intra-prediction modes used by VVC include Planar, DC, and 65 angle modes, a total of 67 prediction modes.

[0042] It should be noted that with the increase of angle modes, the intra-prediction will be more accurate and more in line with the needs of the development of high-definition and ultra-high-definition digital video.

[0043] Residual unit 120 can generate a residual block for a CU based on the pixel block of the CU and the prediction block of the PUs of the CU. For example, residual unit 120 can generate a residual block for a CU such that each sample in the residual block has a value equal to a difference between a sample in the pixel block of the CU and a corresponding sample in the prediction block of the PUs of the CU.

[0044] Transform / quantization unit 130 can quantize the transform coefficients. Transform / quantization unit 130 can quantize the transform coefficients associated with a TU of a CU based on a quantization parameter (QP) value associated with the CU. Video encoder 100 can adjust the degree of quantization applied to the transform coefficients associated with a CU by adjusting the QP value associated with the CU.

[0045] Inverse transform / quantization unit 140 can apply inverse quantization and inverse transformation, respectively, to the quantized transform coefficients to reconstruct a residual block from the quantized transform coefficients.

[0046] Reconstruction unit 150 can add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by prediction unit 110 to produce a reconstructed image block associated with a TU. By reconstructing the sample blocks of each TU of a CU in this way, video encoder 100 can reconstruct the pixel block of the CU.

[0047] Loop filter unit 160 is configured to process the pixels after inverse transform and inverse quantization to mitigate distortion information and provide a better reference for subsequent encoding pixels. For example, a deblocking filter operation can be performed to reduce blocking artifacts associated with the pixel block of the CU.

[0048] In some embodiments, loop filter unit 160 includes a deblocking filter unit configured to remove blocking artifacts and a sample adaptive offset / adaptive loop filter (SAO / ALF) unit configured to remove ringing artifacts.

[0049] Decoded picture buffer 170 can store reconstructed pixel blocks. Inter prediction unit 111 can use reference pictures containing reconstructed pixel blocks to perform inter prediction for PUs of other pictures. In addition, intra prediction unit 112 can use reconstructed pixel blocks in decoded picture buffer 170 to perform intra prediction for other PUs in the same picture as the CU.

[0050] Entropy encoding unit 180 can receive quantized transform coefficients from transform / quantization unit 130. Entropy encoding unit 180 can perform one or more entropy encoding operations on the quantized transform coefficients to generate entropy encoded data.

[0051] FIG. 2 is a schematic block diagram of a video decoder according to an embodiment of the present application.

[0052] As shown in FIG. 2, video decoder 200 includes an entropy decoding unit 210, a prediction unit 220, an inverse quantization / unit conversion unit 230, a reconstruction unit 240, a loop filtering unit 250, and a decoded picture buffer 260. It is noted that video decoder 200 can include more, less, or different functional components.

[0053] Video decoder 200 can receive a bitstream. Entropy decoding unit 210 can parse the bitstream to extract syntax elements from the bitstream. As part of parsing the bitstream, entropy decoding unit 210 can entropy decode syntax elements in the bitstream. Prediction unit 220, inverse quantization / unit conversion unit 230, reconstruction unit 240, and loop filtering unit 250 can decode video data according to the syntax elements extracted from the bitstream, i.e., produce decoded video data.

[0054] In some embodiments, prediction unit 220 includes an intra-prediction unit 222 and an inter-prediction unit 221.

[0055] Intra-prediction unit 222 can perform intra-prediction to generate a prediction block for a PU. Intra-prediction unit 222 can use an intra-prediction mode to generate the prediction block for the PU based on blocks of pixels of spatially neighboring PUs. Intra-prediction unit 222 can also determine the intra-prediction mode for the PU according to one or more syntax elements parsed from the bitstream.

[0056] Inter-prediction unit 221 can construct a first reference picture list (List 0) and a second reference picture list (List 1) according to syntax elements parsed from the bitstream. In addition, if the PU is coded using inter-prediction, entropy decoding unit 210 can parse motion information for the PU. Inter-prediction unit 221 can determine one or more reference blocks for the PU according to the motion information for the PU. Inter-prediction unit 221 can generate the prediction block for the PU according to the one or more reference blocks for the PU.

[0057] Inverse quantization / unit conversion unit 230 can inverse quantize (i.e., de-quantize) transform coefficients associated with a TU. Inverse quantization / unit conversion unit 230 can determine a degree of quantization using a QP value associated with a CU of the TU.

[0058] After inverse quantizing the transform coefficients, inverse quantization / unit conversion unit 230 can apply one or more inverse transforms to the inverse quantized transform coefficients in order to produce a residual block associated with the TU.

[0059] Reconstruction unit 240 reconstructs a pixel block of a CU using a residual block associated with a TU of the CU and a prediction block for a PU of the CU. For example, reconstruction unit 240 can add samples of the residual block to corresponding samples of the prediction block to reconstruct the pixel block of the CU, resulting in a reconstructed image block.

[0060] The in-loop filter unit 250 can perform a deblocking filtering operation to reduce blocking artifacts of the pixel blocks associated with the CU.

[0061] The video decoder 200 can store the reconstructed pictures of CUs in a decoded picture buffer 260. The video decoder 200 can use the reconstructed pictures in the decoded picture buffer 260 as reference pictures for subsequent prediction, or transmit the reconstructed pictures to a display device for presentation.

[0062] The basic procedure of video coding is as follows: at the encoding side, a picture is divided into blocks, for a current block, the prediction unit 110 uses intra prediction or inter prediction to generate a prediction block of the current block. The residual unit 120 can calculate a residual block based on the prediction block and the original block of the current block, i.e., the difference between the prediction block and the original block of the current block, which can also be referred to as residual information. The residual block can be processed by the transform / quantization unit 130, which can remove information that is not sensitive to the human eye to eliminate visual redundancy. Optionally, the residual block before being processed by the transform / quantization unit 130 can be referred to as a time-domain residual block, and the residual block after being processed by the transform / quantization unit 130 can be referred to as a frequency-domain residual block or a frequency-domain residual block. The entropy encoding unit 180 receives the quantized transform coefficients output by the transform / quantization unit 130 and entropy encodes the quantized transform coefficients to output a bitstream. For example, the entropy encoding unit 180 can eliminate character redundancy based on a target context model and probability information of a binary code stream.

[0063] At the decoding side, the entropy decoding unit 210 can parse the bitstream to obtain prediction information, a quantized coefficient matrix, etc. of the current block, and the prediction unit 220 uses intra prediction or inter prediction based on the prediction information to generate a prediction block of the current block. The inverse quantization / inverse transform unit 230 uses the quantized coefficient matrix obtained from the bitstream to perform inverse quantization and inverse transform on the quantized coefficient matrix to obtain a residual block. The reconstruction unit 240 adds the prediction block and the residual block to obtain a reconstructed block. The reconstructed block constitutes a reconstructed picture, and the in-loop filter unit 250 performs in-loop filtering on the reconstructed picture based on the picture or based on the block to obtain a decoded picture. The encoding side also needs to perform similar operations to obtain the decoded picture. The decoded picture can also be referred to as a reconstructed picture, and the reconstructed picture can be used as a reference picture for subsequent inter prediction.

[0064] It should be noted that the block division information determined at the encoding side, as well as the prediction, transform, quantization, entropy encoding, in-loop filtering, and other mode information or parameter information, etc. are carried in the bitstream when necessary. The decoding side determines the same block division information, prediction, transform, quantization, entropy encoding, in-loop filtering, and other mode information or parameter information as the encoding side by analyzing the bitstream and based on the existing information, so as to ensure that the decoded picture obtained at the encoding side is the same as the decoded picture obtained at the decoding side.

[0065] The above is the basic process of the video codec under the block-based hybrid coding framework. With the development of technology, some modules or steps of the framework or process can be optimized. The present application is applicable to the basic process of the video codec under the block-based hybrid coding framework, but is not limited to the framework and process.

[0066] The foregoing describes the coding framework provided by the embodiments of the present application in detail. The embodiments of the present application can be applied to the intra prediction unit in the coding framework. The intra prediction technology provided by the related art is described in detail below.

[0067] Most probable mode (MPM) technology

[0068] According to the statistical characteristics, the closer the pixel region is to the current block, the more likely it is to select the same (intra) prediction mode as the current block. According to this characteristic, the MPM technology is adopted in high efficiency video coding (HEVC), versatile video coding (VVC) and enhanced compression model (ECM).

[0069] The MPM in ECM constructs an MPM list and a secondary MPM list. The length of the MPM list is 6, and the length of the secondary MPM list is 16. The MPM list is filled with the intra prediction modes most likely to be selected by the current block. For example, the intra prediction modes in the MPM list mainly include the intra prediction modes of the blocks at the above left (AL), above (A), above right (AR), left (L), below left (BL) and other positions of the current block (as shown in FIG. 3). The intra prediction modes in the secondary MPM list in ECM are mainly composed of some angular prediction modes related to the intra prediction modes in the MPM list.

[0070] As an example, in ECM, the MPM list includes 6 intra prediction modes. Among the 6 intra prediction modes, the planar mode is the first intra prediction mode in the MPM list. The remaining 5 intra prediction modes in the MPM list can be determined in turn based on the following 3 steps:

[0071] Step a: the prediction modes selected by the 5 surrounding neighboring prediction blocks,

[0072] Step b: the mode based on gradient histogram derived by the surrounding reconstructed pixels,

[0073] Step c: the angle related to the two angle modes first derived in a and b.

[0074] In the process of performing the above steps a to c, when the number of intra prediction modes in the MPM list exceeds 5, the extra intra prediction modes will automatically enter the second MPM list.

[0075] Multiple reference line (MRL) intra prediction

[0076] In HEVC, the intra prediction uses the last row and the left column closest to the current block as the reference samples for prediction. If there is a large error between the reconstructed value and the original value of the last row and the left column, the prediction quality of the current block will also be greatly affected. In order to solve this problem, the MRL intra prediction technology is adopted in VVC. In the MRL intra prediction technology, in addition to the nearest row of reference samples of the current block (i.e. reference line 0), VVC can also use reference line 1 and reference line 2 as extended reference lines for intra prediction, as shown in FIG. 4. In addition, in order to reduce the coding complexity, MRL is only applied to the non-planar mode in the MPM list.

[0077] Compared with the VVC test model (VTM), more reference lines can be used in the MRL tool in ECM. Specifically, in ECM, the length of the MRL list is 6, that is, it includes 6 reference lines. The index of the 6 reference lines is as follows: MULTI_REF_LINE IDX[6] = {0, 1, 3, 5, 7, 12}.

[0078] Template-based multiple reference line intra prediction (TMRL) intra prediction technology

[0079] The TMRL predefines N reference lines and M predefined intra prediction modes, thereby constructing N*M combined prediction modes, each of which corresponds to a reference line and an intra prediction mode. Then, the TMRL technology constructs a template at the position of the reference line 0, and calculates template errors between prediction values and reconstructed values of the N*M combined prediction modes on the template. The template errors can be measured by a sum of absolute difference (SAD) or a sum of absolute transformed difference (SATD). After obtaining the template errors of the N*M combined prediction modes, the template errors can be sorted in ascending order, and K combined prediction modes with smaller template errors among the N*M combined prediction modes can be reserved. Then, a final combined prediction mode can be determined based on rate-distortion costs of the K combined prediction modes. After determining the final combined prediction mode, the encoder encodes a mode flag (tmrl flag) and a mode index (tmrl idx). The mode flag can be used to indicate that the TMRL mode is used for the current block, and the mode index indicates which one of the K combined prediction modes is the final combined prediction mode.

[0080] In the related art, the MRL technology is only applied to the coding and decoding of the luminance block, and is not applied to the coding and decoding of the chrominance block.

[0081] Therefore, embodiments of the present disclosure provide an encoding method, including: determining an intra prediction value of a current chrominance block according to reconstructed values of N lines of samples, N being a positive integer greater than 1; determining a residual value of the current chrominance block according to the intra prediction value; and encoding the residual value.

[0082] In addition, embodiments of the present disclosure also provide a decoding method, including: decoding a bitstream to determine a residual value of a current chrominance block; determining an intra prediction value of the current chrominance block according to reconstructed values of N lines of samples, N being a positive integer greater than 1; and determining a reconstructed value of the current chrominance block according to the residual value and the intra prediction value.

[0083] According to the above content, it can be known that embodiments of the present disclosure are equivalent to applying the multi-reference line technology to the coding and decoding of the chrominance block, which is helpful to improve the coding and decoding performance of the chrominance component.

[0084] Hereinafter, the decoding method provided by embodiments of the present disclosure will be described in detail.

[0085] FIG. 5 is a schematic flowchart of the decoding method provided by embodiments of the present disclosure. The decoding method of FIG. 5 can be applied to a decoder.

[0086] Referring to FIG. 5, in step S510, a bitstream is decoded to determine a residual value of a current chrominance block.

[0087] At step S520, the intra prediction value of the current chroma block is determined according to the reconstructed values of the N lines of samples. The N lines of samples can be located in the reconstructed area around the current chroma block. The N lines of samples can also be referred to as N lines of reference samples, N reference lines, N prediction lines, or N available reference lines.

[0088] The embodiments of the present application do not limit the value of N and N can be any positive integer greater than 1. For example, N can be 2, 3, 4, 5, 6, or 7. In addition, the N lines of samples can be located above the current chroma block, and the line distance between the N lines of samples and the current chroma block can include one or more of the following line distances: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12. As an example, the N lines of samples include: samples located above the current chroma block and having a line distance of 1 with the current chroma block, samples located above the current chroma block and having a line distance of 3 with the current chroma block, and samples located above the current chroma block and having a line distance of 5 with the current chroma block.

[0089] At step S530, the reconstructed value of the current chroma block is determined according to the residual value of the current chroma block and the intra prediction value of the current chroma block. For example, the reconstructed value of the current chroma block can be obtained by summing the residual value of the current chroma block and the intra prediction value of the current chroma block.

[0090] In the related art, a chroma block uses only one line of samples (one reference line) for intra prediction. The embodiments of the present application introduce the reference line technology into the decoding process of a chroma block, which helps to improve the decoding performance of the chroma block.

[0091] In some implementations, step S520 can include determining the intra prediction value of the current chroma block according to the reconstructed values of the N lines of samples and M intra prediction modes of the current chroma block.

[0092] The embodiments of the present application do not limit the value of M and M can be any positive integer greater than or equal to 1. As a specific example, the value of M can be 3, 4, 5, 6, 7, 8, 9, 10, or 11.

[0093] The embodiments of the present application do not limit the determination manner of the value of M. For example, in some implementations, the value of M can be determined based on a predefined manner. For another example, in some other implementations, the value of M can be obtained from a bitstream.

[0094] The M intra prediction modes mentioned above can be prediction modes in a prediction mode set (e.g., a prediction mode list) for the current chroma block. The prediction mode set can be, for example, an MPM set (or MPM list). Which intra prediction modes are included in the M intra prediction modes can be set empirically, and some specific examples are given below.

[0095] In some implementations, the M intra prediction modes can include a first intra prediction mode. The first intra prediction mode can be determined based on a second intra prediction mode. The second intra prediction mode mentioned here is an intra prediction mode used by the current chroma block in a direct mode (DM). The intra prediction mode used by the current chroma block in the DM is an intra prediction mode of a collocated luma block of the current chroma block.

[0096] Further, in some implementations, the first intra prediction mode mentioned above being determined based on the second intra prediction mode can include: if the second intra prediction mode belongs to a first intra prediction mode set, the first intra prediction mode is the second intra prediction mode. The intra prediction modes in the first intra prediction mode set can all be angular prediction modes or traditional prediction modes (traditional intra prediction modes can include, in addition to angular prediction modes, DC mode and other traditional non-angular prediction modes). If the intra prediction modes in the first intra prediction mode set are all angular prediction modes, the first intra prediction mode mentioned above being determined based on the second intra prediction mode can include: if the second intra prediction mode is an angular prediction mode, the first intra prediction mode is the second intra prediction mode. If the intra prediction modes in the first intra prediction mode set are all traditional intra prediction modes, the first intra prediction mode mentioned above being determined based on the second intra prediction mode can include: if the second intra prediction mode is a traditional intra prediction mode, the first intra prediction mode is the second intra prediction mode.

[0097] Alternatively, in some embodiments, the aforementioned determining the first intra prediction mode based on the second intra prediction mode can include: if the second intra prediction mode does not belong to the first set of intra prediction modes, the first intra prediction mode is an intra prediction mode in the first set of intra prediction modes corresponding to the second intra prediction mode. The intra prediction modes in the first set of intra prediction modes can all be angular prediction modes or legacy prediction modes (the legacy intra prediction modes can include the DC mode and other legacy non-angular prediction modes in addition to the angular prediction modes). If the intra prediction modes in the first set of intra prediction modes are all angular prediction modes, the aforementioned determining the first intra prediction mode based on the second intra prediction mode can include: if the second intra prediction mode does not belong to the angular prediction modes, the first intra prediction mode is an angular prediction mode, and the first intra prediction mode can be obtained by converting the second intra prediction mode into an angular prediction mode. If the intra prediction modes in the first set of intra prediction modes are all legacy intra prediction modes, the aforementioned determining the first intra prediction mode based on the second intra prediction mode can include: if the second intra prediction mode does not belong to the legacy intra prediction modes, the first intra prediction mode can be a legacy intra prediction mode, and the first intra prediction mode can be obtained by converting the second intra prediction mode into a legacy intra prediction mode. As an example, the second intra prediction mode can be one of the following non-legacy intra prediction modes: matrix weighted intra prediction (MIP), decoder side intra mode derivation (DIMD), template-based intra mode derivation (TIMD), spatial geometric partitioning mode (SGPM), and extrapolation filter-based intra prediction mode (EIP). In this case, the second intra prediction mode can be converted into a legacy intra prediction mode using a standard default scheme, and the converted legacy intra prediction mode can be used as the first intra prediction mode. The conversion of the aforementioned second intra prediction mode and the legacy intra prediction mode can be referred to related art. For example, in the case of DIMD, the gradient amplitudes corresponding to multiple legacy intra prediction modes can be derived based on the DIMD mode. Then, the intra prediction mode with the highest gradient amplitude can be used as the aforementioned first intra prediction mode.Of course, if the second intra prediction mode is a chroma block copy mode, such as a direct block vector (DBV) mode, it can be skipped because such intra prediction modes cannot utilize the reference lines for intra prediction.

[0098] Further, in some implementations, if the intra prediction mode after the second intra prediction mode conversion is a PLANAR mode, the PLANAR mode can be skipped, i.e., not be used as a candidate intra prediction mode for the current chroma block. This is because, in the multi-reference line intra prediction mode, the prediction effect of the PLANAR mode is usually not good, and thus, skipping the PLANAR mode helps to improve the coding performance.

[0099] In some implementations, the M intra prediction modes can include a third intra prediction mode. The third intra prediction mode is determined based on an intra prediction mode (e.g., an angular prediction mode) derived for the current chroma block in a DIMD mode (chroma DIMD mode). For example, the intra prediction mode (e.g., the angular prediction mode) derived for the current chroma block in the DIMD mode can be used as the third intra prediction mode. Alternatively, a prediction mode obtained by offsetting a mode index of the intra prediction mode derived for the current chroma block in the DIMD mode can be used as the third intra prediction mode.

[0100] In some implementations, the M intra prediction modes can include a fourth intra prediction mode. The fourth intra prediction mode includes one or more of a direct current (DC) mode, a horizontal mode, and a vertical mode.

[0101] In some implementations, the M intra prediction modes can include a fifth intra prediction mode. The fifth intra prediction mode is determined based on an intra prediction mode of a collocated luma block of the current chroma block. The fifth intra prediction mode can include one or more of an intra prediction mode corresponding to a top-left position of the collocated luma block, an intra prediction mode corresponding to a top-right position of the collocated luma block, an intra prediction mode corresponding to a bottom-left position of the collocated luma block, an intra prediction mode corresponding to a bottom-right position of the collocated luma block, and an intra prediction mode corresponding to a center position of the collocated luma block. The intra prediction mode corresponding to a certain position can be understood as an intra prediction mode used by a luma block at the position.

[0102] For example, referring to FIG. 6, the shaded area on the right side of FIG. 6 represents a current chroma block, and the shaded area on the left side of FIG. 6 represents a co-located luma block of the current chroma block. The co-located luma block includes a TL position, a TR position, a C position, a BL position, and a BR position. The M intra prediction modes can include intra prediction modes corresponding to the TL position, the TR position, the BL position, and the BR position.

[0103] In some implementations, the M intra prediction modes can include a sixth intra prediction mode. The sixth intra prediction mode can be determined based on intra prediction modes of neighboring chroma blocks of the current chroma block. The sixth intra prediction mode can include one or more of: an intra prediction mode corresponding to a top-left neighboring position of the current chroma block, an intra prediction mode corresponding to a top neighboring position of the current chroma block, an intra prediction mode corresponding to a top-right neighboring position of the current chroma block, an intra prediction mode corresponding to a left neighboring position of the current chroma block, and an intra prediction mode corresponding to a bottom-left neighboring position of the current chroma block. An intra prediction mode corresponding to a certain position as mentioned above can be understood as an intra prediction mode used by a chroma block containing the position.

[0104] Still referring to FIG. 6, the shaded area on the right side of FIG. 6 represents a current chroma block. The sixth intra prediction mode can include intra prediction modes of chroma blocks of the L’ position, the T’ position, the BL’ position, the TR’ position, and the TL’ position.

[0105] In some implementations, the M intra prediction modes can include a seventh intra prediction mode. The seventh intra prediction mode can be determined based on a mode index of a first angular prediction mode. The first angular prediction mode as mentioned herein can be determined based on the first intra prediction mode, the third intra prediction mode, the fourth intra prediction mode, the fifth intra prediction mode, or the sixth intra prediction mode as mentioned above. For example, the first intra prediction mode, the third intra prediction mode, the fourth intra prediction mode, the fifth intra prediction mode, and the sixth intra prediction mode as mentioned above can be sequentially added to a prediction mode set of the current chroma block, and a mode index of a first angular prediction mode (or a first two angular prediction modes) in the prediction mode set can be offset to obtain a new angular prediction mode as the seventh intra prediction mode. Further, in some implementations, when a number of intra prediction modes in the prediction mode set of the current chroma block is less than M, the seventh intra prediction mode is added to the prediction mode set. Otherwise, the seventh intra prediction mode can not be added to the prediction mode set of the current chroma block.

[0106] For example, assume M is equal to 10, if the number of intra prediction modes in the prediction mode set of the current chroma block is less than 10, then a new angle mode is obtained by shifting the mode index x of the first angle mode x in the prediction mode set of the current chroma block by {-1, +1, -2, +2, -3, +3,...}. Then, the new angle prediction modes x-1, x+1, x-2,... are added to the prediction mode set of the current chroma block in turn until the number of intra prediction modes in the prediction mode set reaches 10.

[0107] For example, assume M is equal to 8, if the number of intra prediction modes in the prediction mode set of the current chroma block is less than 8, then a new angle mode is obtained by shifting the mode index x of the first angle mode x in the prediction mode set of the current chroma block by {-1, +1, -2, +2, -3, +3,...}. Then, the new angle prediction modes x-1, x+1, x-2,... are added to the prediction mode set of the current chroma block in turn until the number of intra prediction modes in the prediction mode set reaches 8.

[0108] It is mentioned above that the M intra prediction modes can include one or more of the first intra prediction mode, the third intra prediction mode, the fourth intra prediction mode, the fifth intra prediction mode, the sixth intra prediction mode, and the seventh intra prediction mode. It is understood that in some implementations, these intra prediction modes can be added to the prediction mode set of the current chroma block in a certain order. For example, these intra prediction modes can be added to the prediction mode set of the current chroma block in the order of the first intra prediction mode, the third intra prediction mode, the fourth intra prediction mode, the fifth intra prediction mode, the sixth intra prediction mode, and the seventh intra prediction mode. For another example, these intra prediction modes can be added to the prediction mode set of the current chroma block in the order of the third intra prediction mode, the first intra prediction mode, the fifth intra prediction mode, the fourth intra prediction mode, the sixth intra prediction mode, and the seventh intra prediction mode.

[0109] In some implementations, in the process of adding the aforementioned intra prediction modes to the prediction mode set of the current chroma block, the intra prediction modes in the prediction mode set can be de-duplicated, so that the final M intra prediction modes are M non-duplicated intra prediction modes.

[0110] In some implementations, in the process of adding the aforementioned intra prediction modes to the prediction mode set of the current chroma block, when the number of intra prediction modes in the prediction mode set reaches M, the addition of intra prediction modes to the prediction mode set can be stopped.

[0111] It is indicated above that the intra prediction value of the current chroma block can be determined based on the N lines of samples and the M intra prediction modes. Specifically, the N lines of samples and the M intra prediction modes can be combined together, thereby constructing L combined prediction modes (L=NXM), wherein one combined prediction mode can correspond to one line of samples in the N lines of samples and one intra prediction mode in the M intra prediction modes. After the L combined prediction modes are constructed, the intra prediction value of the current chroma block can be determined according to the L combined prediction modes. For example, in some implementations, at the encoding end, the current chroma block can be intra predicted according to the L combined prediction modes; a target intra prediction mode can be determined by using a rate-distortion optimization algorithm according to the prediction results of the L combined prediction modes; the intra prediction value of the current chroma block can be determined according to the target intra prediction mode; and the index of the target intra prediction mode can be written into a bitstream. At the decoding end, the target intra prediction mode can be selected from the M intra prediction modes according to the index, and the intra prediction value of the current chroma block can be determined according to the target intra prediction mode.

[0112] However, the number of combined prediction modes formed by combining the N reference lines and the M intra prediction modes together is generally large, and if a rate-distortion optimization algorithm is directly used to select a target combined prediction mode from the L combined prediction modes, the encoding complexity can be greatly increased. Therefore, in order to reduce the encoding complexity, in some other implementations, a template-based multi-reference line prediction mode can be introduced, which can first calculate the template errors (such as SAD or SATD) of the L combined prediction modes, and then select a suitable combined prediction mode from the L combined prediction modes according to the template errors of the L combined prediction modes, thereby reducing the encoding complexity. The template-based multi-reference line prediction mode will be described in detail below in combination with FIG. 7.

[0113] Referring to FIG. 7, in step S710, the template is intra predicted according to the L combined prediction modes, and the prediction values corresponding to the L combined prediction modes are determined. The prediction values corresponding to the L combined prediction modes mentioned here refer to the prediction values of the template obtained by intra predicting the template based on the L combined prediction modes.

[0114] In some implementations, the template in step S710 can include a first template. The first template is a region where the (reconstructed) luma samples are located. As an example, the first template can include a region corresponding to a collocated luma block of the current chroma block. It should be understood that the first template can include the entire region of the collocated luma block, or can only include part of the region in the collocated luma block. Compared with the chroma block, the luma block can provide more abundant information (such as texture information), and therefore, when calculating the template error, considering the luma component can help to improve the reliability of the template error.

[0115] In some implementations, the template can include a second template. The second template is for a region where the chroma samples are located. As an example, the second template includes a neighboring region of the current chroma block (a region in the reconstructed region surrounding the current chroma block that is adjacent to the current chroma block). For example, the second template can include a neighboring region of the current chroma block, or the second template can also include a region that is apart from the current chroma block and is close to the current chroma block. Illustratively, the second template can include a region where the samples in the last row and / or the last column adjacent to the current chroma block are located.

[0116] It should be appreciated that the template mentioned in step S710 can include only the first template mentioned above, only the second template mentioned above, or both the first template and the second template mentioned above.

[0117] In step S720, L template errors (i.e., L template errors corresponding to the L combined prediction modes respectively) are determined according to the prediction values corresponding to the L combined prediction modes and the reconstructed values of the template. For example, the difference between the prediction values corresponding to the L combined prediction modes and the reconstructed values of the template can be calculated, thereby obtaining the L template errors.

[0118] It is mentioned above that the template can include a first template. Assuming that the L combined prediction modes include a first combined prediction mode, and the error corresponding to the first combined prediction mode in the L template errors is a first template error, the first template error can be determined based on an error corresponding to the first template. The error corresponding to the first template refers to an error determined based on intra prediction of the first template according to the first combined prediction mode. Since the first template is for a region where the luma samples are located, the error can also be referred to as a template error of the luma part. For ease of description, the error is referred to as a first error hereinafter. In some implementations, the first template error can be equal to the first error.

[0119] It is mentioned above that the template can include a second template. Assuming that the L combined prediction modes include a first combined prediction mode, and the error corresponding to the first combined prediction mode in the L template errors is a first template error, the first template error can be determined based on an error corresponding to the second template. The error corresponding to the second template refers to an error determined based on intra prediction of the second template according to the first combined prediction mode. Since the second template is for a region where the chroma samples are located, the error can also be referred to as a template error of the chroma part. For ease of description, the error is referred to as a second error hereinafter. In some implementations, the first template error can be equal to the second error.

[0120] Of course, in some implementations, the template can include a first template and a second template. Accordingly, the first template error can be determined based on the first error and the second error. For example, the first template error can be equal to a sum of the first error and the second error, or equal to a weighted sum of the first error and the second error.

[0121] In addition to considering the first error and the second error mentioned above, one or more of the following factors can also be considered in determining the first template error: a size of the current chroma block (e.g., a width and / or a height of the current chroma block), a size of the second template (e.g., a width and / or a height of the second template), a size of the collocated luma block (e.g., a width and / or a height of the collocated luma block), a size of the first template (e.g., a width and / or a height of the first template). For example, the sizes of the first template and the second template can be different, the number of samples in the first template and the second template used to calculate the error can be different, and in the case that the first template error includes both the first error and the second error, scaling the first error and / or the second error based on the above-mentioned size factors can be considered, which can make the calculated template error more accurate.

[0122] For ease of understanding, the calculation of the first error, the second error, and the first template error will be illustrated below with reference to FIGS. 8 and 9, taking the first template as the area where the collocated luma block of the current chroma block is located, and the second template as the area where the last row and the left column adjacent to the current chroma block are located as an example.

[0123] As shown in FIG. 8, when calculating the first error (template error of the luma part), the collocated luma block of the current chroma block can be set as the template (e.g., the shaded area in FIG. 8). Then, the corresponding reference line and the intra prediction mode can be set on the collocated luma block according to the reference line and the intra prediction mode in the first combined prediction mode to perform intra prediction. After the intra prediction is completed, the first error costLuma can be calculated according to the generated prediction value and the reconstructed value of the collocated luma block. In this example, if the sampling format is 4:2:0, and the reference line in the first combined prediction mode is the nth line, the reference line in the first combined prediction mode can be set as the 2*nth line, and the intra prediction mode in the first combined prediction mode can remain unchanged.

[0124] As shown in FIG. 9, when calculating the second error (the template error of the chroma part), the neighboring one row and one column of pixels of the current chroma block can be set as a second template. The second template includes an upper template and a left template as shown in FIG. 9. Then, the second template can be intra-predicted according to the reference line in the first combined prediction mode and the intra-prediction mode. After the intra-prediction ends, the second error can be calculated according to the generated prediction value and the reconstructed value of the second template. Since the chroma component includes two channels of Cb and Cr, the second error can include: costCbA (the error of the Cb component in the upper template A), costCbL (the error of the Cb component in the left template L), costCrA (the error of the Cr component in the upper template A), and costCrL (the error of the Cr component in the left template L).

[0125] After obtaining the first error and the second error, the first error and the second error can be weighted and summed to obtain the first template error. For example, the first template error can satisfy the following formula (or be determined based on the following formula):

[0126] templateCost = w0*costLuma + w1*(costCbA + costCrA) + w2*(costCbL + costCrL);

[0127] wherein templateCost represents the first template error, costLuma represents the first error, costCbA and costCrA represent the errors determined based on intra-prediction of the upper template in the second template according to the first combined prediction mode, costCbL and costCrL represent the errors determined based on intra-prediction of the left template in the second template according to the first combined prediction mode, costCbA and costCbL represent the errors corresponding to the Cb component, costCrA and costCrL represent the errors corresponding to the Cr component, w0, w1, and w2 represent the weight factors corresponding to each error, and in an example, the weight factors of the three errors can be considered to be the same, i.e., all 1, and then the first template error satisfies the following formula:

[0128] templateCost = costLuma + (costCbA + costCrA) + (costCbL + costCrL);

[0129] In another example, the corresponding weight factors can be set for each error, and then the first template error can be determined by the following formula:

[0130] templateCost = 8*costLuma + 2logH + 2-logN1*(costCbA + costCrA) + 2logW + 2-logN2*(costCbL + costCrL).

[0131] H represents the height of the current chroma block, W represents the width of the current chroma block, N1 represents the height of the upper template, and N2 represents the width of the left template (in the above example, the upper template and the left template are one row and one column respectively, so N1 and N2 are equal, both equal to 1).

[0132] Continuing to refer to FIG. 7, at step S730, a target combined prediction mode is determined from the L combined prediction modes according to the L template errors. There are multiple implementation manners for step S730, two possible implementation manners are given below.

[0133] Implementation manner one:

[0134] First, K combined prediction modes are determined from the L combined prediction modes according to the L template errors (K is a positive integer, and 1 < K < L, for example, K can be equal to 12). For example, the L combined prediction modes can be sorted in ascending order according to the L template errors, and the K combined prediction modes with smaller template errors are selected as the K combined prediction modes. Then, the target combined prediction mode can be determined from the K combined prediction modes according to a first index obtained from the bitstream. The first index can be used to indicate which one of the K combined prediction modes is the target combined prediction mode. The first index can be referred to as a combined prediction mode index. The first index can be represented by chromaTmrlIdx. The first index can be represented based on a truncated unary code and decoded based on an equal probability model. Of course, the first index can also be represented or decoded in other manners.

[0135] Implementation manner two:

[0136] After the L template errors are determined, the combined prediction mode with the smallest template error among the L combined prediction modes can be determined as the target combined prediction mode. Compared with the implementation manner one, the implementation manner two does not need to decode the first index, so that the overhead of coding bits can be reduced.

[0137] Continuing to refer to FIG. 7, at step S740, an intra prediction value of the current chroma block is determined according to the target combined prediction mode. For example, the target combined prediction mode includes the i-th sample in the N rows of samples and the j-th intra prediction mode in the M intra prediction modes, then the current chroma block can be intra predicted by using the j-th intra prediction mode with the i-th sample as a reference to obtain the intra prediction value of the current chroma block. The specific implementation manner can refer to the conventional intra prediction process, which will not be described here.

[0138] The decoding method provided by the embodiments of the present application is described in detail above. According to the description above, the embodiments of the present application introduce a multi-reference line intra prediction technology or a template-based multi-reference line intra prediction technology for chroma components, which helps to improve the coding efficiency of chroma blocks. In some implementation manners, first identification information can be carried in a bitstream. The first identification information can be used to indicate whether the intra prediction value of the current chroma block is determined according to the reconstructed values of N lines of samples; or the first identification information can be used to indicate whether the intra prediction mode of the current chroma block is a multi-reference line intra prediction mode; or the first identification information can be used to indicate whether the intra prediction mode of the current chroma block is a template-based multi-reference line intra prediction mode.

[0139] In some implementation manners, the first identification information can be represented by chromaTmrlFlag. The first identification information can include a first value and a second value. If the value of the first identification information is the first value (such as 1 or true), it indicates that the intra prediction value of the current chroma block can be determined according to the reconstructed values of N lines of samples, or the intra prediction mode of the current chroma block is a multi-reference line intra prediction mode, or the intra prediction mode of the current chroma block is a template-based multi-reference line intra prediction mode. If the value of the first identification information is the second value (such as 0 or false), it indicates that the intra prediction value of the current chroma block is not determined according to the reconstructed values of N lines of samples, or the intra prediction mode of the current chroma block is not a multi-reference line intra prediction mode, or the intra prediction mode of the current chroma block is not a template-based multi-reference line intra prediction mode.

[0140] The decoding method provided by the embodiments of the present application is described in detail above. According to the description above, the embodiments of the present application introduce a multi-reference line intra prediction technology or a template-based multi-reference line intra prediction technology for chroma components, which helps to improve the coding efficiency of chroma blocks. In some implementation manners, first identification information can be carried in a bitstream. The first identification information can be used to indicate whether the intra prediction value of the current chroma block is determined according to the reconstructed values of N lines of samples; or the first identification information can be used to indicate whether the intra prediction mode of the current chroma block is a multi-reference line intra prediction mode; or the first identification information can be used to indicate whether the intra prediction mode of the current chroma block is a template-based multi-reference line intra prediction mode.

[0141] FIG. 10 is a schematic flowchart of an encoding method provided by the embodiments of the present application. The encoding method of FIG. 10 can be applied to an encoder.

[0142] Referring to FIG. 10, in step S1010, the intra prediction value of the current chroma block is determined according to the reconstructed values of N lines of samples. The N lines of samples can be located in a reconstructed region around the current chroma block. The N lines of samples can also be referred to as N lines of reference samples, N reference lines, N prediction lines, or N available reference lines.

[0143] The value of N is not limited in the embodiments of the present application, and can be any positive integer greater than 1. For example, N can be 2, 3, 4, 5, 6 or 7. In addition, the N rows of samples can be located above the current chroma block, and the row distance between the N rows of samples and the current chroma block can include one or more of the following row distances: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12. For example, the N rows of samples include: samples located above the current chroma block and having a row distance of 1 with the current chroma block, samples located above the current chroma block and having a row distance of 3 with the current chroma block, and samples located above the current chroma block and having a row distance of 5 with the current chroma block.

[0144] In steps S1020-S1030, a residual value of the current chroma block is determined according to the intra prediction value, and the residual value is encoded. For example, the residual value of the current chroma block can be determined by subtracting the intra prediction value from the original value of the current chroma block, and then the residual value of the current chroma block can be entropy encoded.

[0145] In the related art, the chroma block uses only one row of samples (one reference row) for intra prediction. The embodiments of the present application introduce the reference row technology into the encoding process of the chroma block, which helps to improve the encoding performance of the chroma block.

[0146] In some implementations, the above step S1010 can include determining the intra prediction value of the current chroma block according to the reconstructed values of the N rows of samples and M intra prediction modes of the current chroma block.

[0147] The value of M is not limited in the embodiments of the present application, and can be any positive integer greater than or equal to 1. As a specific example, the value of M can be 3, 4, 5, 6, 7, 8, 9, 10 or 11.

[0148] The determination method of the value of M is not limited in the embodiments of the present application. For example, in some implementations, the value of M can be determined based on a predefined method. For another example, in some other implementations, the value of M can be obtained from a bitstream.

[0149] The M intra prediction modes mentioned above can be prediction modes in a prediction mode set (such as a prediction mode list) of the current chroma block. The prediction mode set can be, for example, an MPM set (or MPM list). The specific intra prediction modes included in the M intra prediction modes can be set according to experience, and some specific examples are given below.

[0150] In some implementations, the M intra prediction modes can include a first intra prediction mode. The first intra prediction mode can be determined based on a second intra prediction mode. The second intra prediction mode referred to herein is an intra prediction mode used by a current chroma block under the DM. The intra prediction mode used by the current chroma block under the DM is an intra prediction mode of a collocated luma block of the current chroma block.

[0151] Further, in some implementations, the first intra prediction mode referred to above as being determined based on the second intra prediction mode can include that if the second intra prediction mode belongs to a first intra prediction mode set, the first intra prediction mode is the second intra prediction mode. The intra prediction modes in the first intra prediction mode set can all be angular prediction modes or legacy prediction modes (legacy intra prediction modes can include DC mode and other legacy non-angular prediction modes in addition to angular prediction modes). If the intra prediction modes in the first intra prediction mode set are all angular prediction modes, the first intra prediction mode referred to above as being determined based on the second intra prediction mode can include that if the second intra prediction mode is an angular prediction mode, the first intra prediction mode is the second intra prediction mode. If the intra prediction modes in the first intra prediction mode set are all legacy intra prediction modes, the first intra prediction mode referred to above as being determined based on the second intra prediction mode can include that if the second intra prediction mode is a legacy intra prediction mode, the first intra prediction mode is the second intra prediction mode.

[0152] Alternatively, in some embodiments, the determining the first intra prediction mode based on the second intra prediction mode can include: if the second intra prediction mode does not belong to the first set of intra prediction modes, the first intra prediction mode is an intra prediction mode in the first set of intra prediction modes corresponding to the second intra prediction mode. The intra prediction modes in the first set of intra prediction modes can all be angular prediction modes or traditional prediction modes (the traditional intra prediction modes can include the DC mode and other traditional non-angular prediction modes in addition to the angular prediction modes). If the intra prediction modes in the first set of intra prediction modes are all angular prediction modes, the determining the first intra prediction mode based on the second intra prediction mode can include: if the second intra prediction mode does not belong to the angular prediction modes, the first intra prediction mode is an angular prediction mode, and the first intra prediction mode can be obtained by converting the second intra prediction mode into an angular prediction mode. If the intra prediction modes in the first set of intra prediction modes are all traditional intra prediction modes, the determining the first intra prediction mode based on the second intra prediction mode can include: if the second intra prediction mode does not belong to the traditional intra prediction modes, the first intra prediction mode can be a traditional intra prediction mode, and the first intra prediction mode can be obtained by converting the second intra prediction mode into a traditional intra prediction mode. As an example, the second intra prediction mode can be one of the following non-traditional intra prediction modes: MIP, DIMD, TIMD, SGPM, EIP. In this case, the second intra prediction mode can be converted into a traditional intra prediction mode by using a standard default scheme, and the converted traditional intra prediction mode can be used as the first intra prediction mode. The conversion of the second intra prediction mode into a traditional intra prediction mode can refer to related technologies. For example, based on the DIMD mode, the gradient amplitudes corresponding to multiple traditional intra prediction modes can be derived. Then, the intra prediction mode with the highest gradient amplitude can be used as the first intra prediction mode. Of course, if the second intra prediction mode is a chroma block copy mode such as the DBV mode, it can be skipped because such an intra prediction mode cannot use the reference line for intra prediction.

[0153] Further, in some embodiments, if the intra prediction mode obtained by converting the second intra prediction mode is the PLANAR mode, the PLANAR mode can be skipped, i.e., the PLANAR mode is not used as a candidate intra prediction mode for the current chroma block. This is because, in the multi-reference line intra prediction mode, the prediction effect of the PLANAR mode is usually not good, and therefore, skipping the PLANAR mode can help improve the encoding performance.

[0154] In some implementations, the M intra prediction modes can include a third intra prediction mode. The third intra prediction mode is determined based on an intra prediction mode (e.g., an angular prediction mode) derived for the current chroma block in a DIMD mode (chroma DIMD mode). For example, the intra prediction mode (e.g., the angular prediction mode) derived for the current chroma block in the DIMD mode can be used as the third intra prediction mode. Alternatively, a prediction mode obtained by offsetting a mode index of the intra prediction mode derived for the current chroma block in the DIMD mode can be used as the third intra prediction mode.

[0155] In some implementations, the M intra prediction modes can include a fourth intra prediction mode. The fourth intra prediction mode includes one or more of a direct current (DC) mode, a horizontal mode, and a vertical mode.

[0156] In some implementations, the M intra prediction modes can include a fifth intra prediction mode. The fifth intra prediction mode is determined based on an intra prediction mode of a collocated luma block of the current chroma block. The fifth intra prediction mode can include one or more of an intra prediction mode corresponding to a top-left position of the collocated luma block, an intra prediction mode corresponding to a top-right position of the collocated luma block, an intra prediction mode corresponding to a bottom-left position of the collocated luma block, an intra prediction mode corresponding to a bottom-right position of the collocated luma block, and an intra prediction mode corresponding to a center position of the collocated luma block. The intra prediction mode corresponding to a certain position can be understood as an intra prediction mode used by a luma block containing the position.

[0157] For example, as shown in FIG. 6, the shaded area on the right side of FIG. 6 represents a current chroma block, and the shaded area on the left side of FIG. 6 represents a collocated luma block of the current chroma block. The collocated luma block includes a top-left position, a top-right position, a center position, a bottom-left position, and a bottom-right position. The M intra prediction modes can include intra prediction modes corresponding to the top-left position, the top-right position, the bottom-left position, and the bottom-right position.

[0158] In some implementations, the M intra prediction modes can include a sixth intra prediction mode. The sixth intra prediction mode can be determined based on an intra prediction mode of a neighboring chroma block of the current chroma block. The sixth intra prediction mode can include one or more of an intra prediction mode corresponding to a top-left neighboring position of the current chroma block, an intra prediction mode corresponding to a top neighboring position of the current chroma block, an intra prediction mode corresponding to a top-right neighboring position of the current chroma block, an intra prediction mode corresponding to a left neighboring position of the current chroma block, and an intra prediction mode corresponding to a bottom-left neighboring position of the current chroma block. The intra prediction mode corresponding to a certain position can be understood as an intra prediction mode used by a chroma block containing the position.

[0159] Still taking FIG. 6 as an example, the shaded area on the right side of FIG. 6 represents the current chroma block. The sixth intra prediction mode can include the intra prediction modes of the chroma block at the L' position, the T' position, the BL' position, the TR' position, and the TL' position.

[0160] In some implementations, the M intra prediction modes can include a seventh intra prediction mode. The seventh intra prediction mode can be determined based on a mode index of a first angular prediction mode. The first angular prediction mode mentioned herein can be determined based on the first intra prediction mode, the third intra prediction mode, the fourth intra prediction mode, the fifth intra prediction mode, or the sixth intra prediction mode mentioned above. For example, the first intra prediction mode, the third intra prediction mode, the fourth intra prediction mode, the fifth intra prediction mode, and the sixth intra prediction mode mentioned above can be sequentially added to a prediction mode set of the current chroma block, and the mode index of the first angular prediction mode (or the first two angular prediction modes) in the prediction mode set is offset to obtain a new angular prediction mode as the seventh intra prediction mode. Further, in some implementations, when the number of intra prediction modes in the prediction mode set of the current chroma block is less than M, the seventh intra prediction mode is added to the prediction mode set. Otherwise, the seventh intra prediction mode can not be added to the prediction mode set of the current chroma block.

[0161] For example, assuming that M is equal to 10, if the number of intra prediction modes in the prediction mode set of the current chroma block is less than 10, a new angular mode is obtained by offsetting the mode index x of the first angular mode x in the prediction mode set of the current chroma block according to {1, -1, 2, -2, 3, -3}. Then, the new angular prediction modes x+1, x-1, x+2, … are sequentially added to the prediction mode set of the current chroma block until the number of intra prediction modes in the prediction mode set reaches 10.

[0162] It is noted above that the M intra prediction modes can include one or more of a first intra prediction mode, a third intra prediction mode, a fourth intra prediction mode, a fifth intra prediction mode, a sixth intra prediction mode, and a seventh intra prediction mode. It is to be understood that in some implementations, these intra prediction modes can be added to the prediction mode set of the current chroma block in a certain order. For example, these intra prediction modes can be added to the prediction mode set of the current chroma block in the order of the first intra prediction mode, the third intra prediction mode, the fourth intra prediction mode, the fifth intra prediction mode, the sixth intra prediction mode, and the seventh intra prediction mode. For another example, these intra prediction modes can be added to the prediction mode set of the current chroma block in the order of the third intra prediction mode, the first intra prediction mode, the fifth intra prediction mode, the fourth intra prediction mode, the sixth intra prediction mode, and the seventh intra prediction mode.

[0163] In some implementations, in the process of adding the aforementioned intra prediction modes to the prediction mode set of the current chroma block, the intra prediction modes in the prediction mode set can be de-duplicated, so that the final M intra prediction modes are M non-duplicated intra prediction modes.

[0164] In some implementations, in the process of adding the aforementioned intra prediction modes to the prediction mode set of the current chroma block, when the number of intra prediction modes in the prediction mode set reaches M, the adding of intra prediction modes to the prediction mode set can be stopped.

[0165] It is noted above that the intra prediction value of the current chroma block can be determined based on the N lines of samples and the M intra prediction modes. Specifically, the N lines of samples and the M intra prediction modes can be combined together to construct L combined prediction modes (L = N x M), where one combined prediction mode can correspond to one line of samples in the N lines of samples and one intra prediction mode in the M intra prediction modes. After the L combined prediction modes are constructed, the intra prediction value of the current chroma block can be determined according to the L combined prediction modes. For example, in some implementations, at the encoding end, the current chroma block can be intra predicted according to the L combined prediction modes; a target intra prediction mode can be determined by using a rate-distortion optimization algorithm according to the prediction results of the L combined prediction modes; the intra prediction value of the current chroma block can be determined according to the target intra prediction mode; and the index of the target intra prediction mode can be written into a bitstream. At the decoding end, the target intra prediction mode can be selected from the M intra prediction modes according to the index, and the intra prediction value of the current chroma block can be determined according to the target intra prediction mode.

[0166] However, the number of combined prediction modes formed by the combination of N reference lines and M intra prediction modes is generally large, and if a rate-distortion optimization algorithm is directly used to select a target combined prediction mode from the L combined prediction modes, the encoding complexity can be greatly increased. Therefore, in order to reduce the encoding complexity, in some other implementations, a template-based multi-reference line prediction mode can be introduced, which first calculates the template error (such as SAD or SATD) of the L combined prediction modes, and then selects a suitable combined prediction mode from the L combined prediction modes according to the template error of the L combined prediction modes, thereby reducing the encoding complexity. The template-based multi-reference line prediction mode will be described in detail below in combination with FIG. 7.

[0167] Referring to FIG. 7, in step S710, the template is intra-predicted according to the L combined prediction modes to determine the prediction values corresponding to the L combined prediction modes. The prediction values corresponding to the L combined prediction modes mentioned here refer to the prediction values of the template obtained by intra-predicting the template based on the L combined prediction modes.

[0168] In some implementations, the template in step S710 can include a first template. The first template is a region where the (reconstructed) luma samples are located. As an example, the first template can include a region corresponding to a collocated luma block of the current chroma block. It should be understood that the first template can include the entire region of the collocated luma block, or can only include part of the region in the collocated luma block. Compared with the chroma block, the luma block can provide more abundant information (such as texture information), and therefore, when calculating the template error, considering the luma component can help to improve the reliability of the template error.

[0169] In some implementations, the template can include a second template. The second template is a region where the chroma samples are located. As an example, the second template includes a neighboring region (a region adjacent to the current chroma block in the reconstructed region around the current chroma block) of the current chroma block. For example, the second template can include a neighboring region of the current chroma block, or the second template can also include a region that is away from the current chroma block but close to the current chroma block. For example, the second template can include a region where the samples in the last row and / or the left column adjacent to the current chroma block are located.

[0170] It should be understood that the template mentioned in step S710 can only include the first template mentioned above, only include the second template mentioned above, or include both the first template and the second template mentioned above.

[0171] At step S720, L template errors (i.e., L template errors corresponding to the L combined prediction modes respectively) are determined according to the prediction values corresponding to the L combined prediction modes and the reconstructed values of the template. For example, the difference between the prediction values corresponding to the L combined prediction modes and the reconstructed values of the template can be calculated, thereby obtaining the L template errors.

[0172] It is mentioned above that the template can include a first template. Assuming that the L combined prediction modes include a first combined prediction mode, and the error corresponding to the first combined prediction mode among the L template errors is a first template error, the first template error can be determined based on an error corresponding to the first template. The error corresponding to the first template refers to an error determined based on intra prediction of the first template according to the first combined prediction mode. Since the first template is a region where the luma samples are located, the error can also be referred to as a template error of the luma part. For ease of description, the error is referred to as a first error hereinafter. In some implementations, the first template error can be equal to the first error.

[0173] It is mentioned above that the template can include a second template. Assuming that the L combined prediction modes include a first combined prediction mode, and the error corresponding to the first combined prediction mode among the L template errors is a first template error, the first template error can be determined based on an error corresponding to the second template. The error corresponding to the second template refers to an error determined based on intra prediction of the second template according to the first combined prediction mode. Since the second template is a region where the chroma samples are located, the error can also be referred to as a template error of the chroma part. For ease of description, the error is referred to as a second error hereinafter. In some implementations, the first template error can be equal to the second error.

[0174] Of course, in some implementations, the template can include the first template and the second template. Accordingly, the first template error can be determined based on the first error and the second error. For example, the first template error can be equal to the sum of the first error and the second error, or equal to a weighted sum of the first error and the second error.

[0175] In addition to considering the first error and the second error mentioned above, one or more of the following factors can also be considered in the process of determining the first template error: the size of the current chroma block (such as the width and / or height of the current chroma block), the size of the second template (such as the width and / or height of the second template), the size of the co-located luma block (such as the width and / or height of the co-located luma block), the size of the first template (such as the width and / or height of the first template). For example, the sizes of the first template and the second template can be different, the number of samples used to calculate the error in the first template and the second template can be different, and in the case where the first template error includes both the first error and the second error, scaling processing can be performed on the first error and / or the second error based on the above-mentioned size factors, so that the calculated template error is more accurate.

[0176] For ease of understanding, the calculation manner of the first error, the second error and the first template error is exemplarily illustrated below in combination with FIG. 8 and FIG. 9, taking the first template as the region where the co-located luma block of the current chroma block is located and the second template as the region where the last row and the left column adjacent to the current chroma block are located as examples.

[0177] As shown in FIG. 8, when the first error (the template error of the luma part) is calculated, the co-located luma block of the current chroma block can be set as the template (such as the shaded region in FIG. 8). Then, the corresponding reference line and the intra prediction mode can be set on the co-located luma block to perform intra prediction according to the reference line and the intra prediction mode in the first combined prediction mode. After the intra prediction ends, the first error costLuma can be calculated according to the generated prediction value and the reconstructed value of the co-located luma block. In this example, if the sampling format is 4:2:0 and the reference line in the first combined prediction mode is the nth line, the reference line in the first combined prediction mode can be set as the 2*nth line, and the intra prediction mode in the first combined prediction mode can remain unchanged.

[0178] As shown in FIG. 9, when the second error (the template error of the chroma part) is calculated, the first row and the first column of pixels adjacent to the current chroma block can be set as the second template. The second template includes the upper template and the left template as shown in FIG. 9. Then, the second template can be intra predicted according to the reference line and the intra prediction mode in the first combined prediction mode. After the intra prediction ends, the second error can be calculated according to the generated prediction value and the reconstructed value of the second template. Since the chroma component includes two channels of Cb and Cr, the second error can include: costCbA (the error of the Cb component in the upper template A), costCbL (the error of the Cb component in the left template L), costCrA (the error of the Cr component in the upper template A) and costCrL (the error of the Cr component in the left template L).

[0179] After the first error and the second error are obtained, the first error and the second error can be weighted and summed to obtain the first template error. For example, the first template error can satisfy the following formula (or be determined based on the following formula):

[0180] templateCost = w0*costLuma + w1*(costCbA + costCrA) + w2*(costCbL + costCrL);

[0181] wherein templateCost represents the first template error, costLuma represents the first error, costCbA and costCrA represent errors determined based on the first combined prediction mode for intra-predicting the top template in the second template, costCbL and costCrL represent errors determined based on the first combined prediction mode for intra-predicting the left template in the second template, costCbA and costCbL represent errors corresponding to the Cb component, costCrA and costCrL represent errors corresponding to the Cr component, w0, w1, w2 represent weight factors corresponding to each error respectively, in an example, the weight factors of the three errors can be considered to be the same, i.e., all equal to 1, and the first template error satisfies the following formula:

[0182] templateCost = costLuma + (costCbA + costCrA) + (costCbL + costCrL).

[0183] In another example, a corresponding weight factor can be set for each error, and the first template error can be determined by the following formula:

[0184] templateCost = 8 * costLuma + 2logH + 2 - logN1 * (costCbA + costCrA) + 2logW + 2 - logN2 * (costCbL + costCrL).

[0185] H represents the height of the current chroma block, W represents the width of the current chroma block, N1 represents the height of the top template, and N2 represents the width of the left template (in the above example, the top template and the left template are a row and a column respectively, so N1 and N2 are equal, both equal to 1).

[0186] Continuing to refer to FIG. 7, in step S730, a target combined prediction mode is determined from the L template errors and the L combined prediction modes. There can be multiple implementation manners for step S730, and two possible implementation manners are given below.

[0187] Implementation manner one:

[0188] Firstly, K combined prediction modes (K is a positive integer, and 1 < K < L, K can be equal to 12 for example) are determined from the L combined prediction modes according to the L template errors. For example, the L combined prediction modes can be sorted in ascending order according to the L template errors, and the K combined prediction modes with smaller template errors can be selected as the K combined prediction modes. Then, a target combined prediction mode can be determined from the K combined prediction modes according to rate-distortion costs of the K combined prediction modes. Then, a first index corresponding to the target combined prediction mode can be written into a bitstream. The first index can be used to indicate which one of the K combined prediction modes is the target combined prediction mode. The first index can be referred to as a combined prediction mode index. The first index can be represented by chromaTmrlIdx. The first index can be represented based on a truncated unary code and coded based on an equiprobable model. Of course, the first index can also be represented or coded in other ways.

[0189] Implementation mode two:

[0190] After the L template errors are determined, a combined prediction mode with the smallest template error in the L combined prediction modes can be determined as the target combined prediction mode. Compared with the implementation mode one, the implementation mode two does not need to code the first index, so that the overhead of coding bits can be reduced.

[0191] Continuing to refer to FIG. 7, in step S740, an intra prediction value of the current chroma block is determined according to the target combined prediction mode. For example, if the target combined prediction mode includes an i-th row sample in N row samples and a j-th intra prediction mode in M intra prediction modes, the current chroma block can be intra predicted by using the j-th intra prediction mode with the i-th row sample as a reference to obtain the intra prediction value of the current chroma block. The specific implementation mode can refer to a conventional intra prediction process, which will not be described here.

[0192] The foregoing describes the encoding method provided by the embodiments of the present application in detail. According to the foregoing description, the embodiments of the present application introduce a multi-reference row intra prediction technology or a template-based multi-reference row intra prediction technology for chroma components, which is helpful to improve the coding efficiency of chroma blocks. In some implementation modes, first identification information can be carried in a bitstream. The first identification information can be used to indicate whether an intra prediction value of a current chroma block is determined according to reconstructed values of N row samples; or the first identification information can be used to indicate whether an intra prediction mode of the current chroma block is a multi-reference row intra prediction mode; or the first identification information can be used to indicate whether the intra prediction mode of the current chroma block is a template-based multi-reference row intra prediction mode.

[0193] In some embodiments, the first identification information can be represented by chromaTmrlFlag. The first identification information can include a first value and a second value. If the first identification information takes the first value (e.g., 1 or true), it indicates that the intra prediction value of the current chroma block can be determined according to the reconstructed values of N lines of samples, or the intra prediction mode of the current chroma block is the multi-reference line intra prediction mode, or the intra prediction mode of the current chroma block is the template-based multi-reference line intra prediction mode. If the first identification information takes the second value (e.g., 0 or false), it indicates that the intra prediction value of the current chroma block is not determined according to the reconstructed values of N lines of samples, or the intra prediction mode of the current chroma block is not the multi-reference line intra prediction mode, or the intra prediction mode of the current chroma block is not the template-based multi-reference line intra prediction mode.

[0194] It should be understood that the "N lines of samples" mentioned in the above various embodiments can also be referred to as "N lines of pixels".

[0195] It should also be understood that the "luma samples" mentioned in the above various embodiments can also be referred to as "luma components"; the "chroma samples" mentioned in the above various embodiments can also be referred to as "chroma components".

[0196] It should also be understood that in the above various embodiments, when determining the intra prediction value of the current chroma block, in addition to considering the N lines of samples, the N columns of samples corresponding to the N lines of samples can also be considered. For example, assuming that the N lines of samples include the 1st, 3rd, and 5th lines of samples above the current chroma block, when determining the intra prediction value of the current chroma block, the 1st, 3rd, and 5th lines of samples to the left of the current chroma block can also be considered.

[0197] The embodiments of the present application will be described in more detail below with reference to specific examples. The following examples can be applied to the loop filtering unit at the encoding end. It should be noted that the following examples are only intended to help those skilled in the art understand the embodiments of the present application, and are not intended to limit the embodiments of the present application to the specific values or specific scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes based on the examples given, and such modifications or changes also fall within the scope of the embodiments of the present application.

[0198] The present example proposes to introduce the TMRL technology into the chroma component, thereby proposing a new chroma intra prediction mode. The implementation of the chroma intra prediction mode can include the following steps.

[0199] Step one, constructing a combined prediction mode

[0200] The present example predefines N available reference lines refList[N] and M intra prediction modes MPMList[M]. In one embodiment of the present example, 3 available reference lines are pre-defined in the reference line list, and 8 intra prediction modes are pre-defined in the intra prediction mode list.

[0201] Among them, 3 reference behaviors line 1, line 3, line 5.

[0202] Among them, the general principle of the construction process of MPMList can be set as follows: in the process of inserting the intra prediction mode in MPMList, if the intra prediction mode to be added to MPMList is an angle prediction mode, it can be directly added to MPMList; if the intra prediction mode to be added to MPMList is a non-angle prediction mode, it can be converted into an angle prediction mode before being added to MPMList; if the intra prediction mode to be added to MPMList is a chroma block copy mode, such as DBV mode, it is skipped.

[0203] Specifically, the construction process of the 8 intra prediction modes of the present example can be carried out in the following order.

[0204] 1. Obtain the intra prediction mode of the current chroma block in DM mode. Specifically, check the intra prediction mode of the center position of the co-located luma block corresponding to the current chroma block. If the intra prediction mode of the center position of the co-located luma block is an angle prediction mode, the intra prediction mode is directly added to MPMList. If the intra prediction mode of the center position of the co-located luma block is other types of intra prediction mode, such as MIP, DIMD, TIMD, OBIC, SGPM, EIP, etc., the intra prediction mode can be converted into a traditional intra prediction mode according to the standard default scheme, and the converted traditional intra prediction mode is added to MPMList. If the intra prediction mode of the center position of the co-located luma block is PLANAR mode, step 1 is skipped.

[0205] 2. Derive an angle prediction mode according to chroma DIMD mode, and add the derived angle prediction mode to MPMList.

[0206] 3. Add DC mode, horizontal mode, and vertical mode to MPMList.

[0207] 4. Add the intra prediction mode of the co-located luma block of the current chroma block to MPMList. For example, as shown in the left graph of FIG. 6, the intra prediction modes corresponding to the {TL, TR, BL, BR} four positions of the co-located luma block can be added to MPMList.

[0208] 5. Add the intra prediction mode of the neighboring chroma block of the current chroma block to MPMList. For example, as shown in the right graph of FIG. 6, the intra prediction modes corresponding to the {L', T', BL', TR', TL'} five positions can be added to MPMList.

[0209] 6、If the number of the prediction modes in the current MPMList is less than 10, and the first angular prediction mode added in the MPMList is angular prediction mode x, the mode index x of the angular prediction mode x can be offset according to {-1, +1, -2, +2, -3, +3} based on the angular prediction mode x to obtain a new angular prediction mode. Then, the newly obtained angular prediction modes x-1, x+1, x-2, … can be added to the MPMList in turn until the number of the prediction modes in the MPMList reaches 8.

[0210] The process of constructing the MPMList according to the above steps 1-6 can introduce a de-redundancy operation. That is, during the process of constructing the MPMList, if a repeated intra prediction mode appears, it can be skipped so as not to add the repeated intra prediction mode to the MPMList. In addition, if the MPMList already contains 8 non-repeated intra prediction modes at any step of steps 1-6, the construction of the MPMList can be stopped.

[0211] After obtaining the MPMList, 24 combined prediction modes can be constructed according to the 3 available reference lines and the 8 intra prediction modes in the MPMList.

[0212] Step two, calculate the template error

[0213] The template error can be calculated based on the difference between the predicted value of the 24 combined prediction modes on the template and the reconstructed value thereof. In order to estimate the prediction effect of the 24 combined prediction modes, the 24 combined prediction modes can be reordered according to the size of the template error. This operation is an operation that both the encoder and the decoder need to perform.

[0214] The template error calculated in this example includes two parts: the template error of the luminance part and the template error of the chrominance part described below.

[0215] I. Template error of the luminance part

[0216] When calculating the template error of the luminance part, the same-position luminance block of the current chrominance block can be set as the template. Then, the corresponding reference line and intra prediction mode can be set on the corresponding same-position luminance block for prediction according to the reference line and the intra prediction mode of the current combined prediction mode. Then, the template error of the luminance part costLuma can be calculated according to the generated predicted value and the reconstructed value of the same-position luminance block, as shown in FIG. 8. In this example, if the sampling format of the pixel is 4:2:0, and the reference line of the current combined prediction mode is the nth line in the chrominance block, the reference line of the current combined prediction mode can be set as the 2*n line when calculating the template error of the luminance part, and the intra prediction mode is not modified.

[0217] II. Template error of chroma part

[0218] When calculating the template error of the chroma part, the neighboring one row and one column of samples of the current chroma block can be set as the template. Then, the neighboring one row and one column can be predicted according to the reference line of the current combined prediction mode and the intra prediction mode. Next, the template error of the chroma part can be calculated according to the generated prediction value and the reconstructed value of the template. The chroma component includes two channels of Cb and Cr, each of which contains two templates of the upper template A and the left template L (as shown in FIG. 9), and the template error of the chroma part can be represented by costCbA, costCbL, costCrA and costCrL respectively.

[0219] Finally, the template error of the current combined prediction mode can be obtained according to the template error of the luma part and the template error of the chroma part in a preset weighted summation manner.

[0220] In the present example, the weighted summation manner of the template error of the luma part and the template error of the chroma part can be as follows:

[0221] templateCost = 8 * costLuma + (costCbA + costCrA) << (logH + 2 - logN) + (costCbL + costCrL) << (logW + 2 - logN); or,

[0222] templateCost = 8 * costLuma + 2logH + 2 - logN1 * (costCbA + costCrA) + 2logW + 2 - logN2 * (costCbL + costCrL);

[0223] Wherein, logW and logH are related to the width and height of the current block, and are the logarithm of the width and height with 2 as the base. The value of logN is related to the template size of the chroma part, and in the present example, the template of the chroma part is set to the neighboring one row and one column of the current chroma block, i.e. the size is 1, so the value of logN is 0.

[0224] Step three, constructing combined prediction mode candidates

[0225] The template error templateCost of each combined prediction mode is sorted in ascending order, and the K combined prediction modes with smaller template error are selected as the final combined prediction mode candidates, and K is 6 in the present example.

[0226] Step four, determining the target combined prediction mode

[0227] At the encoding end, rate-distortion cost of the K combined prediction modes can be calculated, so that a target combined prediction mode can be selected from the K combined prediction modes. The prediction result of the current chroma block can be obtained according to the reference line and the intra prediction mode indicated by the target combined prediction mode.

[0228] In the example, a mode flag chromaTmrlFlag and a mode candidate index chromaTmrlIdx can be encoded at the encoding end. The chromaTmrlFlag equal to 1 indicates that the intra prediction mode of the current chroma block is the template-based multi-reference line chroma intra prediction mode. The chromaTmrlFlag equal to 0 indicates that the intra prediction mode of the current chroma block is not the template-based multi-reference line chroma intra prediction mode. The chromaTmrlIdx defines the index of the target combined prediction mode in the K combined prediction modes. In the example, the chromaTmrlFlag is encoded by using a context model, and the chromaTmrlIdx is represented by using a truncated unary code and encoded by using an equiprobable model.

[0229] The above example needs to encode the combined prediction mode index chromaTmrlIdx to indicate the target combined prediction mode. In other examples, the template errors of the 24 combined prediction modes can be sorted in ascending order, and the combined prediction mode with the smallest template error is selected as the final target combined prediction mode. Then, the encoding end can only encode the mode flag chromaTmrlFlag, and does not need to encode the combined prediction mode index chromaTmrlIdx. The decoding end can select the combined prediction mode with the smallest template error according to the same template error calculation manner.

[0230] It should be noted that the above is an example of taking the template error including the template error of the luminance part and the template error of the chroma part. In other examples, the template error can be calculated only according to the template error of the luminance part, or only according to the template error of the chroma part.

[0231] The performance test of the template-based multi-reference line chroma intra prediction mode is as follows:

[0232] Test result one:

[0233] Test result two:

[0234] According to the above test results, it can be seen that by introducing the template-based multi-reference line intra prediction technology into the chroma component, the chroma encoding performance is improved by about 0.2%.

[0235] The method embodiments of the present application are described in detail above in combination with FIG. 1 to FIG. 10, and the device embodiments of the present application are described in detail below in combination with FIG. 11 to FIG. 14. It should be understood that the description of the method embodiments and the description of the device embodiments correspond to each other, and therefore, the parts not described in detail can be referred to the foregoing method embodiments.

[0236] FIG. 11 is a structural schematic diagram of a decoder provided by an embodiment of the present application. The decoder 1100 in FIG. 11 includes a decoding unit 1110, a first determining unit 1120, and a second determining unit 1130. The decoding unit 1110 is configured to decode a bitstream to determine a residual value of a current chroma block; the first determining unit 1120 is configured to determine an intra prediction value of the current chroma block according to reconstructed values of N rows of samples, N being a positive integer greater than 1; and the second determining unit 1130 is configured to determine a reconstructed value of the current chroma block according to the residual value and the intra prediction value.

[0237] In some implementations, the first determining unit 1120 is configured to determine the intra prediction value according to L combined prediction modes, wherein each of the L combined prediction modes represents a combination of one row of samples in the N rows of samples and one intra prediction mode in M intra prediction modes, M being a positive integer greater than or equal to 1.

[0238] In some implementations, the first determining unit 1120 is configured to: determine prediction values corresponding to the L combined prediction modes by performing intra prediction on a template according to the L combined prediction modes; determine L template errors according to the prediction values corresponding to the L combined prediction modes and a reconstructed value of the template; determine a target combined prediction mode from the L combined prediction modes according to the L template errors; and determine the intra prediction value according to the target combined prediction mode.

[0239] In some implementations, the first determining unit 1120 is configured to: determine K combined prediction modes from the L combined prediction modes according to the L template errors, K being a positive integer and 1 < K < L; and determine the target combined prediction mode from the K combined prediction modes according to a first index acquired from the bitstream.

[0240] In some implementations, the first index satisfies one or more of the following: the first index is based on a truncated unary code representation; and the first index is based on an equal probability model decoding.

[0241] In some implementations, the target combined prediction mode is a combined prediction mode with a minimum template error among the L combined prediction modes.

[0242] In some embodiments, the L combined prediction modes include a first combined prediction mode, and the L template errors include a first template error corresponding to the first combined prediction mode; the first template error is determined based on one or more of: a first error determined based on intra-prediction of a first template based on the first combined prediction mode, the first template being a region where luma samples are located; a second error determined based on intra-prediction of a second template based on the first combined prediction mode, the second template being a region where chroma samples are located.

[0243] In some embodiments, the first template includes a region corresponding to a co-located luma block of the current chroma block.

[0244] In some embodiments, the second template includes a neighboring region of the current chroma block.

[0245] In some embodiments, the first template error is further determined based on one or more of: a size of the current chroma block; a size of the second template.

[0246] In some embodiments, the first template error is equal to a weighted sum of the first error and the second error.

[0247] In some embodiments, the first template error satisfies:

[0248] templateCost = w0 * costLuma + w1 * (costCbA + costCrA) + w2 * (costCbL + costCrL);

[0249] wherein templateCost represents the first template error, costLuma represents the first error, the second template includes an above template and a left template neighboring the current chroma block, costCbA and costCrA represent errors determined based on intra-prediction of the above template based on the first combined prediction mode, costCbL and costCrL represent errors determined based on intra-prediction of the left template based on the first combined prediction mode, costCbA and costCbL represent errors corresponding to Cb components, costCrA and costCrL represent errors corresponding to Cr components, and w0, w1, and w2 represent weights.

[0250] In some embodiments, the first error and the second error have the same weight; or the second error is determined based on a size of the current chroma block and / or a size of the second template.

[0251] In some embodiments, the first template error satisfies:

[0252] templateCost = 8 * costLuma + 2logH + 2 - logN1 * (costCbA + costCrA) + 2logW + 2 - logN2 * (costCbL + costCrL);

[0253] wherein templateCost represents the first template error, costLuma represents the first error, the second template comprises an above template and a left template adjacent to the current chroma block, costCbA and costCrA represent errors determined based on the first combined prediction mode for intra-predicting the above template, costCbL and costCrL represent errors determined based on the first combined prediction mode for intra-predicting the left template, costCbA and costCbL represent errors corresponding to a Cb component, costCrA and costCrL represent errors corresponding to a Cr component, n represents a weight of costLuma, H represents a height of the current chroma block, W represents a width of the current chroma block, N1 represents a height of the above template, and N2 represents a width of the left template.

[0254] In some implementations, the M intra prediction modes include one or more of: a first intra prediction mode determined based on a second intra prediction mode, the second intra prediction mode being an intra prediction mode used by the current chroma block in a direct mode DM; a third intra prediction mode determined based on an intra prediction mode derived for the current chroma block in a decoder-side intra mode derivation DIMD mode; a fourth intra prediction mode including one or more of a direct current mode, a horizontal mode, and a vertical mode; a fifth intra prediction mode determined based on an intra prediction mode of a collocated luma block of the current chroma block; a sixth intra prediction mode determined based on an intra prediction mode of a neighboring chroma block of the current chroma block; and a seventh intra prediction mode determined based on a mode index of a first angular prediction mode, the first angular prediction mode being determined based on the first intra prediction mode, the third intra prediction mode, the fourth intra prediction mode, the fifth intra prediction mode, or the sixth intra prediction mode.

[0255] In some embodiments, the first intra prediction mode is determined based on a second intra prediction mode, including one or more of the following: if the second intra prediction mode belongs to a first set of intra prediction modes, the first intra prediction mode is the second intra prediction mode, wherein the first set of intra prediction modes includes at least angular prediction modes; if the second intra prediction mode does not belong to the first set of intra prediction modes, the first intra prediction mode is an intra prediction mode in the first set of intra prediction modes corresponding to the second intra prediction mode.

[0256] In some embodiments, the fifth intra prediction mode includes one or more of the following: an intra prediction mode corresponding to a top-left position of the collocated luma block; an intra prediction mode corresponding to a top-right position of the collocated luma block; an intra prediction mode corresponding to a bottom-left position of the collocated luma block; an intra prediction mode corresponding to a bottom-right position of the collocated luma block.

[0257] In some embodiments, the sixth intra prediction mode includes one or more of the following: an intra prediction mode corresponding to a top-left neighboring position of the current chroma block; an intra prediction mode corresponding to a top neighboring position of the current chroma block; an intra prediction mode corresponding to a top-right neighboring position of the current chroma block; an intra prediction mode corresponding to a left neighboring position of the current chroma block; an intra prediction mode corresponding to a bottom-left neighboring position of the current chroma block.

[0258] In some embodiments, the N rows of samples include one or more of the following: samples located above the current chroma block with a row distance of 1 to the current chroma block; samples located above the current chroma block with a row distance of 3 to the current chroma block; samples located above the current chroma block with a row distance of 5 to the current chroma block.

[0259] In some embodiments, the decoding unit 1110 is further configured to decode the bitstream to determine first identification information, the first identification information being used to indicate whether the current chroma block determines the intra prediction value according to the reconstructed values of the N rows of samples.

[0260] It can be understood that, in the embodiments of the present application, the "unit" can be a part of circuit, a part of processor, a part of program or software, etc., and of course can be a module, and can also be non-modular. Moreover, each component in the embodiments can be integrated in a processing unit, or each unit can exist physically independently, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware, or in the form of a software functional module.

[0261] The integrated unit, if implemented in the form of a software function module and not sold or used as an independent product, can be stored in a computer readable storage medium based on such understanding. The technical solutions of the embodiments essentially or the parts that make contributions to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the method described in the embodiments. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0262] Therefore, the embodiments of the present application provide a computer readable storage medium applied to the decoder 1000, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the decoding method in the first embodiment.

[0263] Based on the composition of the decoder 1100 and the computer readable storage medium, referring to FIG. 12, a specific hardware structure schematic diagram of the decoder 1100 is shown. As shown in FIG. 12, the decoder 1200 can include a communication interface 1210, a memory 1220 and a processor 1230; and the various components are coupled together through a bus system 1240. It can be understood that the bus system 1240 is used to realize the connection communication between the components. The bus system 1240 includes a data bus, a power bus, a control bus and a status signal bus. However, for the purpose of clear illustration, all kinds of buses are marked as the bus system 1240 in FIG. 12. Among them,

[0264] The communication interface 1210 is used for receiving and sending signals in the process of transceiving information with other external network elements;

[0265] The memory 1220 is used for storing a computer program;

[0266] The processor 1230 is used for executing the following steps when running the computer program:

[0267] Decoding a bitstream to determine a residual value of a current chroma block;

[0268] Determining an intra prediction value of the current chroma block according to reconstructed values of N rows of samples, N being a positive integer greater than 1;

[0269] Determining a reconstructed value of the current chroma block according to the residual value and the intra prediction value.

[0270] It is to be appreciated that the memory 1220 in embodiments of the application can be volatile, nonvolatile, or a combination of both. The non-volatile memory can be, for example, read only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), electrically EPROM (EEPROM), or flash memory. The volatile memory can be, for example, random access memory (RAM), which acts as external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The memory 1220 of the system and method described herein are intended to include, without being limited to, these and any other suitable types of memory.

[0271] The processor 1230 can be an integrated circuit chip power on the signal. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware in the processor 1230 or the instruction in the form of software. The processor 1230 described above can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component. The disclosed methods, steps and logic block diagrams in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can be any conventional processor. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register or other mature storage medium in the art. The storage medium is located in the memory 1220, and the processor 1230 reads the information in the memory 1220 and combines the hardware to complete the steps of the above method.

[0272] It can be understood that the embodiments described in the present application can be realized by hardware, software, firmware, middleware, microcode or combination thereof. For hardware implementation, the processing unit can be realized in one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processors (Digital Signal Processing, DSP), digital signal processing devices (DSP Device, DSPD), programmable logic devices (Programmable Logic Device, PLD), field programmable gate arrays (Field-Programmable Gate Array, FPGA), general processors, controllers, microcontrollers, microprocessors, other electronic units for executing functions described in the present application or combination thereof. For software implementation, the technology described in the present application can be realized by modules (such as processes, functions, etc.) for executing functions described in the present application. The software code can be stored in the memory and executed by the processor. The memory can be implemented in the processor or outside the processor.

[0273] Alternatively, as another embodiment, the processor 1230 is further configured to execute the decoding method described in the foregoing embodiments when running the computer program.

[0274] FIG. 13 is a schematic diagram of an encoder according to an embodiment of the present application. As shown in FIG. 13, the encoder 1300 includes a first determination unit 1310, a second determination unit 1320, and an encoding unit 1330. The first determination unit 1310 is configured to determine an intra prediction value of a current chroma block according to reconstructed values of N rows of samples, N being a positive integer greater than 1; the second determination unit 1320 is configured to determine a residual value of the current chroma block according to the intra prediction value; and the encoding unit 1330 is configured to encode the residual value.

[0275] In some embodiments, the first determination unit 1310 is configured to determine the intra prediction value according to L combined prediction modes, each of the L combined prediction modes representing a combination of one of M intra prediction modes and one of the N rows of samples, M being a positive integer greater than or equal to 1.

[0276] In some embodiments, the first determination unit 1310 is configured to perform intra prediction on a template according to the L combined prediction modes to determine prediction values corresponding to the L combined prediction modes, determine L template errors according to the prediction values corresponding to the L combined prediction modes and reconstructed values of the template, determine a target combined prediction mode from the L combined prediction modes according to the L template errors, and determine the intra prediction value according to the target combined prediction mode.

[0277] In some embodiments, the first determination unit 1310 is configured to determine K combined prediction modes from the L combined prediction modes according to the L template errors, K being a positive integer and 1 < K < L, and determine the target combined prediction mode from the K combined prediction modes according to rate-distortion costs of the K combined prediction modes.

[0278] In some embodiments, the encoding unit 1330 is further configured to write a first index into a bitstream, the first index being used to indicate the target combined prediction mode from the K combined prediction modes.

[0279] In some embodiments, the first index satisfies one or more of the following: the first index is based on a truncated unary code representation; and the first index is based on an equal probability model encoding.

[0280] In some embodiments, the target combined prediction mode is a combined prediction mode with a minimum template error among the L combined prediction modes.

[0281] In some embodiments, the L combined prediction modes include a first combined prediction mode, and the L template errors include a first template error corresponding to the first combined prediction mode; the first template error is determined based on one or more of: a first error determined based on intra-prediction of a first template based on the first combined prediction mode, the first template being a region where luma samples are located; a second error determined based on intra-prediction of a second template based on the first combined prediction mode, the second template being a region where chroma samples are located.

[0282] In some embodiments, the first template includes a region corresponding to a co-located luma block of the current chroma block.

[0283] In some embodiments, the second template includes a neighboring region of the current chroma block.

[0284] In some embodiments, the first template error is further determined based on one or more of: a size of the current chroma block; a size of the second template.

[0285] In some embodiments, the first template error is equal to a weighted sum of the first error and the second error.

[0286] In some embodiments, the first template error satisfies:

[0287] templateCost = w0 * costLuma + w1 * (costCbA + costCrA) + w2 * (costCbL + costCrL);

[0288] wherein templateCost represents the first template error, costLuma represents the first error, the second template includes an above template and a left template neighboring the current chroma block, costCbA and costCrA represent errors determined based on intra-prediction of the above template based on the first combined prediction mode, costCbL and costCrL represent errors determined based on intra-prediction of the left template based on the first combined prediction mode, costCbA and costCbL represent errors corresponding to Cb components, costCrA and costCrL represent errors corresponding to Cr components, and w0, w1, and w2 represent weights.

[0289] In some embodiments, the first error and the second error have the same weight; or the second error is determined based on a size of the current chroma block and / or a size of the second template.

[0290] In some embodiments, the first template error satisfies:

[0291] templateCost = 8 * costLuma + 2logH + 2 - logN1 * (costCbA + costCrA) + 2logW + 2 - logN2 * (costCbL + costCrL);

[0292] wherein templateCost represents the first template error, costLuma represents the first error, the second template comprises an above template and a left template adjacent to the current chroma block, costCbA and costCrA represent errors determined based on the first combined prediction mode for intra-predicting the above template, costCbL and costCrL represent errors determined based on the first combined prediction mode for intra-predicting the left template, costCbA and costCbL represent errors corresponding to a Cb component, costCrA and costCrL represent errors corresponding to a Cr component, n represents a weight of costLuma, H represents a height of the current chroma block, W represents a width of the current chroma block, N1 represents a height of the above template, and N2 represents a width of the left template.

[0293] In some implementations, the M intra prediction modes include one or more of: a first intra prediction mode determined based on a second intra prediction mode, the second intra prediction mode being an intra prediction mode used by the current chroma block in a direct mode DM; a third intra prediction mode determined based on an intra prediction mode derived for the current chroma block in a decoder-side intra mode derivation DIMD mode; a fourth intra prediction mode including one or more of a direct current mode, a horizontal mode, and a vertical mode; a fifth intra prediction mode determined based on an intra prediction mode of a collocated luma block of the current chroma block; a sixth intra prediction mode determined based on an intra prediction mode of a neighboring chroma block of the current chroma block; and a seventh intra prediction mode determined based on a mode index of a first angular prediction mode, the first angular prediction mode being determined based on the first intra prediction mode, the third intra prediction mode, the fourth intra prediction mode, the fifth intra prediction mode, or the sixth intra prediction mode.

[0294] In some embodiments, the first intra prediction mode is determined based on a second intra prediction mode, including one or more of the following: if the second intra prediction mode belongs to a first intra prediction mode set, the first intra prediction mode is the second intra prediction mode, wherein the first intra prediction mode set includes at least angular prediction modes; if the second intra prediction mode does not belong to the first intra prediction mode set, the first intra prediction mode is an intra prediction mode in the first intra prediction mode set corresponding to the second intra prediction mode.

[0295] In some embodiments, the fifth intra prediction mode includes one or more of the following: an intra prediction mode corresponding to a top-left position of the co-located luma block; an intra prediction mode corresponding to a top-right position of the co-located luma block; an intra prediction mode corresponding to a bottom-left position of the co-located luma block; an intra prediction mode corresponding to a bottom-right position of the co-located luma block.

[0296] In some embodiments, the sixth intra prediction mode includes one or more of the following: an intra prediction mode corresponding to a top-left neighboring position of the current chroma block; an intra prediction mode corresponding to a top neighboring position of the current chroma block; an intra prediction mode corresponding to a top-right neighboring position of the current chroma block; an intra prediction mode corresponding to a left neighboring position of the current chroma block; an intra prediction mode corresponding to a bottom-left neighboring position of the current chroma block.

[0297] In some embodiments, the N rows of samples include one or more of the following: samples located above the current chroma block with a row distance of 1 to the current chroma block; samples located above the current chroma block with a row distance of 3 to the current chroma block; samples located above the current chroma block with a row distance of 5 to the current chroma block.

[0298] In some embodiments, the coding unit 1330 is further configured to write first identification information into a bitstream, the first identification information being used to indicate whether the current chroma block determines the intra prediction value according to the reconstructed values of the N rows of samples.

[0299] It can be understood that, in the embodiments of the present application, the "unit" can be a part of circuit, a part of processor, a part of program or software, etc., and of course can be a module, and can also be non-modular. Moreover, each component in the embodiments can be integrated in a processing unit, or each unit can exist physically independently, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware, or in the form of a software function module.

[0300] The integrated unit, if implemented in the form of a software function module and not sold or used as an independent product, can be stored in a computer readable storage medium based on such understanding. The technical solutions of the embodiments essentially or the parts that contribute to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the method described in the embodiments. The aforementioned storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0301] Therefore, the embodiments of the present application provide a computer readable storage medium applied to the encoder 1200, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the decoding method in any one of the foregoing embodiments.

[0302] Based on the composition of the encoder 1300 and the computer readable storage medium, referring to FIG. 14, a specific hardware structure schematic diagram of the encoder 1300 provided by the embodiments of the present application is shown. As shown in FIG. 13, the encoder 1400 can include a communication interface 1410, a memory 1420 and a processor 1430; and the various components are coupled together through a bus system 1440. It can be understood that the bus system 1440 is used to realize the connection communication between the components. The bus system 1440 includes a data bus, a power supply bus, a control bus and a state signal bus. However, for the purpose of clear illustration, all kinds of buses are marked as the bus system 1440 in FIG. 14. Among them,

[0303] The communication interface 1410 is used for receiving and sending signals in the process of transceiving information with other external network elements;

[0304] The memory 1420 is used for storing a computer program;

[0305] The processor 1430 is used for executing the following steps when running the computer program:

[0306] Determine an intra prediction value of the current chroma block according to reconstructed values of N rows of samples, N being a positive integer greater than 1;

[0307] Determine a residual value of the current chroma block according to the intra prediction value;

[0308] Encode the residual value.

[0309] It is to be appreciated that the memory 1420 in embodiments of the application can be volatile, nonvolatile, or a combination of both. The non-volatile memory can be, for example, read only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), electrically EPROM (EEPROM), or flash memory. The volatile memory can be, for example, random access memory (RAM), which acts as external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous dynamic RAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The memory 1420 of the system and method described herein are intended to include, without being limited to, these and any other suitable types of memory.

[0310] The processor 1430 can be an integrated circuit chip powerfully processing signals. In implementation process, each step of the above method can be completed by the integrated logic circuit or the instruction in the form of software in the processor 1430. The processor 1430 described above can be a general 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, discrete hardware components. Each method, step and logic block in the embodiments of the present application can be realized or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware code processor to execute, or be executed by a combination of hardware and software modules in the code processor. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register, or other mature storage medium in the art. The storage medium is located in the storage 1420, and the processor 1430 reads the information in the storage 1420 and combines the hardware to complete the steps of the above method.

[0311] It can be understood that the embodiments described in the present application can be realized by 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 executing the functions described in the present application or a combination thereof. For software implementation, the technologies described in the present application can be realized by modules (such as processes, functions, etc.) for executing the functions described in the present application. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0312] Optionally, as another embodiment, the processor 1430 is further configured to execute the encoding method in the foregoing embodiments when running the computer program.

[0313] It should be noted that, in the present application, the terms "comprising", "containing" or any other variant thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but can also include other elements not expressly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the phrase "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.

[0314] The above-mentioned sequence numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.

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

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

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

[0318] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A decoding method applied to a decoder, comprising: decoding a bitstream to determine a residual value of a current chroma block; determining an intra prediction value of the current chroma block according to reconstructed values of N lines of samples, N being a positive integer greater than 1; determining a reconstructed value of the current chroma block according to the residual value and the intra prediction value.

2. The method of claim 1, wherein, The determining the intra prediction value of the current chroma block according to the reconstructed values of N lines of samples comprises: determining the intra prediction value according to L combined prediction modes; wherein each of the L combined prediction modes represents a combination of one line of samples among the N lines of samples and one intra prediction mode among M intra prediction modes, M being a positive integer greater than or equal to 1.

3. The method of claim 2, wherein, The determining the intra prediction value according to L combined prediction modes comprises: determining prediction values corresponding to the L combined prediction modes by intra predicting a template according to the L combined prediction modes; determining L template errors according to the prediction values corresponding to the L combined prediction modes and the reconstructed values of the template; determining a target combined prediction mode from the L combined prediction modes according to the L template errors; determining the intra prediction value according to the target combined prediction mode.

4. The method of claim 3, wherein, The determining a target combined prediction mode from the L combined prediction modes according to the L template errors comprises: determining K combined prediction modes from the L combined prediction modes according to the L template errors, K being a positive integer and 1 < K < L; determining the target combined prediction mode from the K combined prediction modes according to a first index acquired from the bitstream.

5. The method of claim 4, wherein, The first index satisfies one or more of the following: The first index is based on a truncated unary code representation. The first index is based on an equiprobability model decoding.

6. The method of claim 3, wherein, The target combined prediction mode is a combined prediction mode with a minimum template error among the L combined prediction modes.

7. The method of claim 3, wherein, The L combined prediction modes comprise a first combined prediction mode, and the L template errors comprise a first template error corresponding to the first combined prediction mode. The first template error is determined based on one or more of the following: a first error determined based on intra predicting a first template according to the first combined prediction mode, the first template being a region where luma samples are located; a second error determined based on intra predicting a second template according to the first combined prediction mode, the second template being a region where chroma samples are located.

8. The method of claim 7, wherein, The first template comprises a region corresponding to a collocated luma block of the current chroma block.

9. The method of claim 7, wherein, The second template comprises a neighboring region of the current chroma block.

10. The method of any one of claims 7 to 9, wherein, The first template error is further determined based on one or more of the following: a size of the current chroma block; a size of the second template.

11. The method of any one of claims 7 to 10, wherein, The first template error is equal to a weighted sum of the first error and the second error.

12. The method of claim 11, wherein, The first template error satisfies: templateCost = w0*costLuma + w1*(costCbA + costCrA) + w2*(costCbL + costCrL). The first template error satisfies: templateCost = w0*costLuma + w1*(costCbA + costCrA) + w2*(costCbL + costCrL). wherein templateCost represents the first template error, costLuma represents the first error, the second template comprises an upper template and a left template neighboring the current chroma block, costCbA and costCrA represent errors determined based on the first combined prediction mode for intra prediction of the upper template, costCbL and costCrL represent errors determined based on the first combined prediction mode for intra prediction of the left template, costCbA and costCbL represent errors corresponding to a Cb component, costCrA and costCrL represent errors corresponding to a Cr component, w0, w1 and w2 represent weights.

13. The method of claim 11 or 12, wherein: the first error and the second error have the same weight; or the second error is determined based on a size of the current chroma block and / or a size of the second template.

14. The method of claim 13, wherein, the first template error satisfies: templateCost = 8 * costLuma + 2logH + 2 - logN1 * (costCbA + costCrA) + 2logW + 2 - logN2 * (costCbL + costCrL); wherein templateCost represents the first template error, costLuma represents the first error, the second template comprises an upper template and a left template neighboring the current chroma block, costCbA and costCrA represent errors determined based on the first combined prediction mode for intra prediction of the upper template, costCbL and costCrL represent errors determined based on the first combined prediction mode for intra prediction of the left template, costCbA and costCbL represent errors corresponding to a Cb component, costCrA and costCrL represent errors corresponding to a Cr component, n represents a weight of costLuma, H represents a height of the current chroma block, W represents a width of the current chroma block, N1 represents a height of the upper template, N2 represents a width of the left template.

15. The method of claim 2, wherein, the M intra prediction modes comprise one or more of: a first intra prediction mode determined based on a second intra prediction mode, the second intra prediction mode being an intra prediction mode used by the current chroma block in a direct mode DM; a third intra prediction mode determined based on an intra prediction mode derived for the current chroma block in a decoded-in-loop mode derivation DIMD mode; a fourth intra prediction mode comprising one or more of a direct current mode, a horizontal mode and a vertical mode; a fifth intra prediction mode determined based on an intra prediction mode of a collocated luma block of the current chroma block; a sixth intra prediction mode determined based on an intra prediction mode of a neighboring chroma block of the current chroma block; a seventh intra prediction mode, the seventh intra prediction mode being determined based on a mode index of a first angular prediction mode, the first angular prediction mode being determined based on the first intra prediction mode, the third intra prediction mode, the fourth intra prediction mode, the fifth intra prediction mode, or the sixth intra prediction mode.

16. The method of claim 15, wherein, the first intra prediction mode being determined based on a second intra prediction mode, including one or more of: if the second intra prediction mode belongs to a first intra prediction mode set, the first intra prediction mode being the second intra prediction mode, wherein the first intra prediction mode set includes at least angular prediction modes; if the second intra prediction mode does not belong to the first intra prediction mode set, the first intra prediction mode being an intra prediction mode in the first intra prediction mode set corresponding to the second intra prediction mode.

17. The method of claim 15, wherein, the fifth intra prediction mode including one or more of: an intra prediction mode corresponding to a top-left position of the collocated luma block; an intra prediction mode corresponding to a top-right position of the collocated luma block; an intra prediction mode corresponding to a bottom-left position of the collocated luma block; an intra prediction mode corresponding to a bottom-right position of the collocated luma block.

18. The method of claim 15, wherein, the sixth intra prediction mode including one or more of: an intra prediction mode corresponding to a top-left neighboring position of the current chroma block; an intra prediction mode corresponding to a top neighboring position of the current chroma block; an intra prediction mode corresponding to a top-right neighboring position of the current chroma block; an intra prediction mode corresponding to a left neighboring position of the current chroma block; an intra prediction mode corresponding to a bottom-left neighboring position of the current chroma block.

19. The method of claim 1, wherein, the N lines of samples including one or more of: a sample located above the current chroma block with a line distance of 1 to the current chroma block; a sample located above the current chroma block with a line distance of 3 to the current chroma block; a sample located above the current chroma block with a line distance of 5 to the current chroma block.

20. The method of claim 1, wherein, the method further includes: decoding a bitstream to determine first identification information, the first identification information being used to indicate whether the intra prediction value of the current chroma block is determined according to the reconstructed values of the N lines of samples.

21. An encoding method applied to an encoder, including: determining an intra prediction value of a current chroma block according to reconstructed values of N lines of samples, N being a positive integer greater than 1; determining a residual value of the current chroma block according to the intra prediction value; encoding the residual value.

22. The method of claim 21, wherein, the determining the intra prediction value of the current chroma block according to the reconstructed values of the N lines of samples includes: determining the intra prediction value according to L combined prediction modes; wherein each combined prediction mode in the L combined prediction modes represents a combination of one line of samples in the N lines of samples and one intra prediction mode in M intra prediction modes, M being a positive integer greater than or equal to 1.

23. The method of claim 22, wherein, the determining the intra prediction value according to the L combined prediction modes includes: performing intra prediction on a template according to the L combined prediction modes to determine prediction values corresponding to the L combined prediction modes; determine L template errors according to the prediction values corresponding to the L combined prediction modes and the reconstructed values of the template; determine a target combined prediction mode from the L combined prediction modes according to the L template errors; determine the intra prediction value according to the target combined prediction mode.

24. The method of claim 23, wherein, The determining the target combined prediction mode from the L combined prediction modes according to the L template errors comprises: determine K combined prediction modes from the L combined prediction modes according to the L template errors, K is a positive integer, and 1 < K < L; determine the target combined prediction mode from the K combined prediction modes according to rate-distortion costs of the K combined prediction modes.

25. The method of claim 24, wherein, The method further comprises: write a first index into a bitstream, the first index being used to indicate the target combined prediction mode from the K combined prediction modes.

26. The method of claim 25, wherein, The first index satisfies one or more of the following: The first index is based on a truncated unary code representation. The first index is based on an equal probability model coding.

27. The method of claim 23, wherein, The target combined prediction mode is a combined prediction mode with the smallest template error among the L combined prediction modes.

28. The method of claim 23, wherein, The L combined prediction modes comprise a first combined prediction mode, and the L template errors comprise a first template error corresponding to the first combined prediction mode. The first template error is determined based on one or more of the following: a first error determined based on intra prediction of a first template according to the first combined prediction mode, the first template being a region where luma samples are located; a second error determined based on intra prediction of a second template according to the first combined prediction mode, the second template being a region where chroma samples are located.

29. The method of claim 28, wherein, The first template comprises a region corresponding to a collocated luma block of the current chroma block.

30. The method of claim 28, wherein, The second template comprises a neighboring region of the current chroma block.

31. The method of any one of claims 28-30, wherein, The first template error is further determined based on one or more of the following: a size of the current chroma block; a size of the second template.

32. The method of any one of claims 7 to 10, wherein, The first template error is equal to a weighted sum of the first error and the second error.

33. The method of claim 32, wherein, The first template error satisfies: templateCost=w0*costLuma+w1*(costCbA+costCrA)+w2*(costCbL+costCrL); wherein, templateCost represents the first template error, costLuma represents the first error, the second template comprises an upper template and a left template adjacent to the current chroma block, costCbA and costCrA represent errors determined based on intra prediction of the upper template according to the first combined prediction mode, costCbL and costCrL represent errors determined based on intra prediction of the left template according to the first combined prediction mode, costCbA and costCbL represent errors corresponding to Cb components, costCrA and costCrL represent errors corresponding to Cr components, and w0, w1, and w2 represent weights.

34. The method of claim 32 or 33, wherein: the first error and the second error have the same weight; or the second error is determined based on a size of the current chroma block and / or a size of the second template.

35. The method of claim 34, wherein, the first template error satisfies: templateCost = 8 * costLuma + 2logH + 2 - logN1 * (costCbA + costCrA) + 2logW + 2 - logN2 * (costCbL + costCrL); wherein, templateCost represents the first template error, costLuma represents the first error, the second template comprises an upper template and a left template neighboring the current chroma block, costCbA and costCrA represent errors determined based on the first combined prediction mode for intra prediction of the upper template, costCbL and costCrL represent errors determined based on the first combined prediction mode for intra prediction of the left template, costCbA and costCbL represent errors corresponding to a Cb component, costCrA and costCrL represent errors corresponding to a Cr component, n represents a weight of costLuma, H represents a height of the current chroma block, W represents a width of the current chroma block, N1 represents a height of the upper template, and N2 represents a width of the left template. the M intra prediction modes comprise one or more of:

36. The method of claim 22, wherein, a first intra prediction mode determined based on a second intra prediction mode, the second intra prediction mode being an intra prediction mode used by the current chroma block in a direct mode DM; a third intra prediction mode determined based on an intra prediction mode derived for the current chroma block in a decoded-in-loop mode derived DM mode; a fourth intra prediction mode comprising one or more of a direct current mode, a horizontal mode, and a vertical mode; a fifth intra prediction mode determined based on an intra prediction mode of a collocated luma block of the current chroma block; a sixth intra prediction mode determined based on an intra prediction mode of a neighboring chroma block of the current chroma block; a seventh intra prediction mode determined based on a mode index of a first angular prediction mode, the first angular prediction mode being determined based on the first intra prediction mode, the third intra prediction mode, the fourth intra prediction mode, the fifth intra prediction mode, or the sixth intra prediction mode. the first intra prediction mode determined based on the second intra prediction mode comprises one or more of:

37. The method of claim 36, wherein, if the second intra prediction mode belongs to a first intra prediction mode set, the first intra prediction mode is the second intra prediction mode, wherein the first intra prediction mode set comprises at least angular prediction modes; or if the second intra prediction mode does not belong to the first intra prediction mode set, the first intra prediction mode is determined based on the second intra prediction mode and a third intra prediction mode, the third intra prediction mode being determined based on a mode index of a first angular prediction mode, the first angular prediction mode being determined based on the first intra prediction mode, the third intra prediction mode, the fourth intra prediction mode, the fifth intra prediction mode, or the sixth intra prediction mode. If the second intra prediction mode does not belong to the first set of intra prediction modes, the first intra prediction mode is an intra prediction mode in the first set of intra prediction modes corresponding to the second intra prediction mode.

38. The method of claim 36, wherein, The fifth intra prediction mode comprises one or more of: an intra prediction mode corresponding to a top-left position of the collocated luma block; an intra prediction mode corresponding to a top-right position of the collocated luma block; an intra prediction mode corresponding to a bottom-left position of the collocated luma block; an intra prediction mode corresponding to a bottom-right position of the collocated luma block.

39. The method of claim 36, wherein, The sixth intra prediction mode comprises one or more of: an intra prediction mode corresponding to a top-left neighboring position of the current chroma block; an intra prediction mode corresponding to a top neighboring position of the current chroma block; an intra prediction mode corresponding to a top-right neighboring position of the current chroma block; an intra prediction mode corresponding to a left neighboring position of the current chroma block; an intra prediction mode corresponding to a bottom-left neighboring position of the current chroma block.

40. The method of claim 21, wherein, The N lines of samples comprise one or more of: samples located above the current chroma block with a line distance of 1 to the current chroma block; samples located above the current chroma block with a line distance of 3 to the current chroma block; samples located above the current chroma block with a line distance of 5 to the current chroma block.

41. The method of claim 21, wherein, The method further comprises: writing, into a bitstream, first identification information, the first identification information being used to indicate whether the current chroma block determines the intra prediction value according to the reconstructed values of the N lines of samples.

42. A decoder, comprising: a decoding unit configured to decode a bitstream and determine a residual value of a current chroma block; a first determining unit configured to determine an intra prediction value of the current chroma block according to reconstructed values of N lines of samples, N being a positive integer greater than 1; a second determining unit configured to determine a reconstructed value of the current chroma block according to the residual value and the intra prediction value.

43. A decoder, comprising: a memory configured to store a computer program; a processor configured to execute the computer program and perform the method of any one of claims 1 to 20 when the computer program is executed.

44. An encoder, comprising: a first determining unit configured to determine an intra prediction value of a current chroma block according to reconstructed values of N lines of samples, N being a positive integer greater than 1; a second determining unit configured to determine a residual value of the current chroma block according to the intra prediction value; an encoding unit configured to encode the residual value.

45. An encoder, comprising: a memory configured to store a computer program; a processor configured to execute the computer program and perform the method of any one of claims 21 to 41 when the computer program is executed.

46. A non-transitory computer readable storage medium storing a bitstream, the bitstream generated by an encoding method with an encoder or the bitstream decoded by a decoding method with a decoder, wherein, The decoding method is the method of any one of claims 1 to 20, and the encoding method is the method of any one of claims 21 to 41.

47. A bitstream, comprising a bitstream generated by the method of any one of claims 21 to 41.

48. A computer readable storage medium, wherein, The computer readable storage medium stores a computer program which, when executed, implements the method of any of claims 1-20, or the method of any of claims 21-41.

49. A computer readable medium storing a bitstream generated by the method of any of claims 21-41.

Citation Information

Patent Citations

  • Method and system of video coding

    CN113785565A

  • Encoding method, decoding method, encoder, decoder and electronic equipment

    CN114868386A

  • Video coding method and device and medium

    CN116055737A

  • Method and apparatus for video encoding or decoding

    US20200296382A1

  • Chroma from Luma Prediction Model Selection

    US20230041999A1