Encoding and decoding method, code stream, encoder, decoder and storage medium
Patent Information
- Application Number
- CN202280101701.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-08
- Publication Date
- 2025-06-24
AI Technical Summary
In the H.266/VVC video coding standard, intra-frame chroma prediction in non-CCLM mode is not effective, resulting in low encoding and decoding efficiency.
By determining the prediction mode parameters of adjacent reference blocks of the current block, the reference intra prediction mode parameters of the non-CCLM mode are derived, thereby improving the accuracy of intra chroma prediction and encoding and decoding efficiency.
It improves the accuracy of intra-frame chroma prediction and encoding and decoding performance, and improves encoding and decoding efficiency.
Smart Images

Figure CN120202669A_ABST
Abstract
Description
Coding and decoding method, code stream, encoder, decoder and storage medium Technical Field
[0001] The embodiments of the present application relate to the field of video coding and decoding technology, and in particular to a coding and decoding method, a bit stream, an encoder, a decoder, and a storage medium. Background Art
[0002] As demand for video display quality increases, new video applications such as high-definition and ultra-high-definition video have emerged. The Joint Video Exploration Team (JVET) of the international standards organizations ISO / IEC and ITU-T has developed the video coding standard H.266 / Versatile Video Coding (VVC).
[0003] In H.266 / VVC, cross-component prediction technology primarily involves the Cross-Component Linear Model (CCLM) mode. However, for non-CCLM modes, the candidate list construction process is incomplete, resulting in poor intra-frame chrominance prediction and reduced encoding and decoding efficiency.
[0004] Summary of the Invention
[0005] The embodiments of the present application provide a coding and decoding method, a code stream, an encoder, a decoder, and a storage medium, which can not only improve the accuracy of intra-frame chrominance prediction, but also improve the coding and decoding efficiency, thereby improving the coding and decoding performance.
[0006] The technical solution of the embodiment of the present application can be implemented as follows:
[0007] In a first aspect, an embodiment of the present application provides a decoding method, comprising:
[0008] Determine a reference block for the current block; wherein the reference block is an adjacent block of the current block;
[0009] When the prediction mode of the second color component of the reference block satisfies a first condition, determining a reference intra-frame prediction mode parameter according to the reference block;
[0010] A prediction value of a second color component of the current block is determined according to a reference intra-frame prediction mode parameter.
[0011] In a second aspect, an embodiment of the present application provides an encoding method, including:
[0012] Determine a reference block for the current block; wherein the reference block is an adjacent block of the current block;
[0013] When the prediction mode of the second color component of the reference block satisfies a first condition, determining a reference intra-frame prediction mode parameter according to the reference block;
[0014] determining a predicted value of a second color component of a current block according to a reference intra-frame prediction mode parameter;
[0015] A prediction difference value of the second color component of the current block is determined according to the prediction value of the second color component of the current block.
[0016] In a third aspect, an embodiment of the present application provides a code stream, which is generated by bit encoding based on information to be encoded; wherein the information to be encoded includes at least one of the following:
[0017] The predicted difference value of the second color component of the current block, the mode index number and the first parameter.
[0018] In a fourth aspect, an embodiment of the present application provides an encoder, comprising a first determining unit and a first predicting unit; wherein,
[0019] a first determining unit configured to determine a reference block of the current block; wherein the reference block is a neighboring block of the current block; and when a prediction mode of a second color component of the reference block satisfies a first condition, determine a reference intra-frame prediction mode parameter according to the reference block;
[0020] a first prediction unit configured to determine a predicted value of a second color component of a current block according to a reference intra-frame prediction mode parameter;
[0021] The first determining unit is further configured to determine a predicted difference value of the second color component of the current block according to the predicted value of the second color component of the current block.
[0022] In a fifth aspect, an embodiment of the present application provides an encoder, comprising a first memory and a first processor; wherein,
[0023] a first memory for storing a computer program capable of running on the first processor;
[0024] The first processor is configured to execute the method according to the second aspect when running a computer program.
[0025] In a sixth aspect, an embodiment of the present application provides a decoder, comprising a second determination unit and a second prediction unit; wherein,
[0026] a second determining unit configured to determine a reference block of the current block; wherein the reference block is a neighboring block of the current block; and when a prediction mode of a second color component of the reference block satisfies a first condition, determine a reference intra-frame prediction mode parameter according to the reference block;
[0027] The second prediction unit is configured to determine a prediction value of a second color component of the current block according to a reference intra-frame prediction mode parameter.
[0028] In a seventh aspect, an embodiment of the present application provides a decoder, comprising a second memory and a second processor; wherein,
[0029] a second memory for storing a computer program capable of running on the second processor;
[0030] The second processor is configured to execute the method according to the first aspect when running a computer program.
[0031] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed, it implements the method described in the first aspect or the method described in the second aspect.
[0032] Embodiments of the present application provide a coding and decoding method, a bitstream, an encoder, a decoder, and a storage medium. Whether at the encoding or decoding end, a reference block for a current block is determined, where the reference block is an adjacent block to the current block. When the prediction mode of the second color component of the reference block satisfies a first condition, reference intra-frame prediction mode parameters are determined based on the reference block. Based on the reference intra-frame prediction mode parameters, a predicted value of the second color component of the current block is determined. Thus, at the encoding end, a predicted difference value of the second color component of the current block can be determined based on the predicted value of the second color component of the current block. At the decoding end, a reconstructed value of the second color component of the current block can be determined based on the predicted value of the second color component of the current block. In other words, by analyzing relevant parameters of the reference blocks adjacent to the current block, non-CCLM reference intra-frame prediction mode parameters can be determined. Based on these reference intra-frame prediction mode parameters, the completeness and diversity of intra-frame chroma prediction modes can be improved, thereby improving the accuracy of intra-frame chroma prediction and encoding and decoding efficiency, thereby enhancing encoding and decoding performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] FIG1 is a schematic diagram showing the positional relationship between a luma CU and a chroma CU according to an embodiment of the present application;
[0034] FIG2 is a schematic diagram showing another positional relationship between a luma CU and a chroma CU provided in an embodiment of the present application;
[0035] FIG3 is a schematic diagram showing the positional relationship between another luma CU and chroma CU provided in an embodiment of the present application;
[0036] FIG4 is a schematic diagram showing the positional relationship between another luma CU and chroma CU provided in an embodiment of the present application;
[0037] FIG5 is a schematic diagram of the position distribution of reference chroma pixels adjacent to a current block provided by an embodiment of the present application;
[0038] FIG6 is a block diagram of an encoder according to an embodiment of the present application;
[0039] FIG7 is a schematic block diagram of a decoder according to an embodiment of the present application;
[0040] FIG8 is a schematic diagram of a network architecture of a coding and decoding system provided in an embodiment of the present application;
[0041] FIG9 is a flowchart diagram of a decoding method provided in an embodiment of the present application;
[0042] FIG10A is a first schematic diagram of the position distribution of reference chromaticity pixels provided in an embodiment of the present application;
[0043] FIG10B is a first schematic diagram of the position distribution of reference brightness pixels provided in an embodiment of the present application;
[0044] FIG11A is a second schematic diagram of the position distribution of reference chromaticity pixels provided in an embodiment of the present application;
[0045] FIG11B is a second schematic diagram of the position distribution of reference brightness pixels provided in an embodiment of the present application;
[0046] FIG12A is a third schematic diagram of the position distribution of reference chromaticity pixels provided in an embodiment of the present application;
[0047] FIG12B is a third schematic diagram of the position distribution of reference brightness pixels provided in an embodiment of the present application;
[0048] FIG13A is a fourth schematic diagram of the position distribution of reference chromaticity pixels provided in an embodiment of the present application;
[0049] FIG13B is a fourth schematic diagram of the position distribution of reference brightness pixels provided in an embodiment of the present application;
[0050] FIG14 is a schematic histogram of gradient intensity values corresponding to an intra-frame prediction mode provided by an embodiment of the present application;
[0051] FIG15 is a second flow chart of a decoding method provided in an embodiment of the present application;
[0052] FIG16 is a third flow chart of a decoding method provided in an embodiment of the present application;
[0053] FIG17 is a schematic diagram of a flow chart of an encoding method provided in an embodiment of the present application;
[0054] FIG18 is a schematic diagram of the structure of an encoder provided in an embodiment of the present application;
[0055] FIG19 is a schematic diagram of a specific hardware structure of an encoder provided in an embodiment of the present application;
[0056] FIG20 is a schematic diagram of the structure of a decoder provided in an embodiment of the present application;
[0057] FIG21 is a schematic diagram of a specific hardware structure of a decoder provided in an embodiment of the present application;
[0058] FIG22 is a schematic diagram of the composition structure of a coding and decoding system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below with reference to the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.
[0060] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0061] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0062] It should also be pointed out that the terms "first\second\third" involved in the embodiments of the present application are only used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0063] In a video image, a first color component, a second color component, and a third color component are generally used to represent a coding block (CB); wherein the three color components are a luminance component, a blue chrominance component, and a red chrominance component, respectively. Specifically, the luminance component is usually represented by the symbol Y, the blue chrominance component is usually represented by the symbol Cb or U, and the red chrominance component is usually represented by the symbol Cr or V; thus, the video image can be represented in either the YCbCr format or the YUV format.
[0064] It can be understood that in the current video image or video encoding and decoding process, the cross-component prediction technology mainly includes the cross-component linear model (CCLM) prediction mode and the multi-directional linear model (MDLM) prediction mode. Regardless of the model factor derived according to the CCLM prediction mode or the model factor derived according to the MDLM prediction mode, the corresponding prediction model can realize the prediction between color components such as the first color component to the second color component, the second color component to the first color component, the first color component to the third color component, the third color component to the first color component, the second color component to the third color component, or the third color component to the second color component.
[0065] Taking the prediction from the first color component to the second color component as an example, assuming that the first color component is the luminance component and the second color component is the chrominance component, in order to reduce the redundancy between the luminance component and the chrominance component, the CCLM prediction mode is used in VVC, that is, the chrominance prediction value is constructed according to the luminance reconstruction value of the same coding block, such as: Pred C (i, j) = α·Rec L (i,j)+β.
[0066] Among them, i, j represent the position coordinates of the pixel to be predicted in the coding block, i represents the horizontal direction, and j represents the vertical direction; Pred C (i, j) represents the chroma prediction value corresponding to the pixel to be predicted at the position coordinate (i, j) in the coding block, Rec L (i, j) represents the reconstructed brightness value of the pixel to be predicted at position (i, j) in the same coding block (after downsampling). In addition, α and β represent model factors, which can be derived from the reference pixels.
[0067] In H.266 / VVC, there can be multiple intra-frame chroma prediction modes, such as INTRA_LT_CCLM mode, INTRA_L_CCLM mode, and INTRA_T_CCLM mode. These intra-frame chroma prediction modes are also called cross-component linear model (CCLM) modes. For example, PLANAR mode, DC mode, ANGULAR18 mode, ANGULAR50 mode, and DM (direct mode, DM) mode are also called non-CCLM modes. Among them, in DM mode, the intra-frame chroma prediction mode can be set to be equal to the intra-frame luma prediction mode.
[0068] For example, in ITU-T H.266, see Table 1, different values of ccm_mode_flag may correspond to different intra-frame chroma prediction modes. For example, when ccm_mode_flag is equal to 0, the intra-frame chroma prediction mode is non-CCLM mode; when ccm_mode_flag is equal to 1, the intra-frame chroma prediction mode is CCLM mode.
[0069] Table 1
[0070]
[0071] It should be noted that the DM mode in the embodiments of the present application refers to the case where cclm_mode_flag is equal to 0 and intra_chroma_pred_mode is equal to 4, that is, the intra-frame chroma prediction mode index number is directly set to be equal to the intra-frame luma prediction mode index number. When cclm_mode_flag is equal to 0, the intra_chroma_pred_mode takes the value of 0-3, and the intra-frame chroma prediction mode index number can also be determined based on the intra-frame luma prediction mode index number. This is different from the "DM mode" in that it is not a one-to-one correspondence.
[0072] It should also be noted that in this embodiment of the present application, the luminance component of the current block can be simply referred to as a luminance block, and the chrominance component of the current block can be simply referred to as a chrominance block. At least one Coding Unit (CU) can be divided into a luminance block, which can be referred to as a "luminance CU" in this embodiment of the present application; at least one Coding Unit can also be divided into a chrominance block, which can be referred to as a "chrominance CU" in this embodiment of the present application.
[0073] In addition, the DM mode refers to the direct use of the brightness prediction mode information of the corresponding position. When the I frame uses dual-tree partitioning, the brightness block (the entire diagonal filling area in the left picture) and the chrominance block (the entire diagonal filling area in the right picture) are allowed to use independent block partitioning structures. At this time, the brightness component of the corresponding position of the chrominance CU may contain multiple brightness CUs, as shown in Figure 1. In H.266 / VVC, the chrominance CU inherits the intra-frame prediction mode of the CU at the center position of the corresponding brightness block. When single-tree partitioning is used, the brightness block (the entire diagonal filling area in the left picture) and the chrominance block (the entire diagonal filling area in the right picture) use the same block partitioning structure. At this time, the brightness component of the corresponding position of the chrominance CU contains only one brightness CU, as shown in Figure 2.
[0074] In one possible embodiment, in order to better predict the chrominance component, it is proposed to add multiple traditional prediction modes through a certain derivation process to supplement the completeness of the available optional modes for chrominance prediction. The overall process of this technical solution is described below.
[0075] Here, the original five non-CCLM modes are replaced with MaxChromaCandidateListNum chroma prediction modes. These MaxChromaCandidateListNum chroma prediction modes are added sequentially according to the following process, ensuring the mutual differences between the modes. Wherein, MaxChromaCandidateListNum refers to a preset number, indicating the maximum number of modes that can be stored in the chroma candidate list.
[0076] It should be noted that the process of adding operations involved in the following steps is to first establish a list of length MaxChromaCandidateListNum, and then add each mode to the list in the following order. After the list is constructed, there may also be adjustments (including adjustments in order and mode). It can be divided into three cases: In the first case, if the list is constructed in the order of the following steps and no adjustment is required after the construction is completed, the encoder needs to construct the list, and the decoder only needs to construct a mode to obtain the list index for code stream transmission; In the second case, if the list is constructed in the order of the following steps and adjustment is required after the construction is completed, both the encoder and the decoder need to construct a complete list, and after the adjustment, the decoder selects the mode corresponding to the list index for code stream transmission; In the third case, for the encoder in the first case, a complete list needs to be constructed for rate-distortion optimization, but there may be a fast algorithm, including but not limited to rate-distortion optimization of only the first few modes, in which case the encoder does not need to construct all the mode lists.
[0077] It should also be noted that the order of adding the following steps and the position scanning order of each step include but are not limited to the order described below. The following steps are only for illustration.
[0078] (1) Taking dual-tree partitioning as an example, according to the position shown in FIG3 , the intra-frame luminance prediction mode of the CU where the C, TL, TR, BL, and BR of the co-located luminance block corresponding to the current chrominance coding block are located is added in sequence.
[0079] The detailed position derivation process of C, TL, TR, BL, and BR is given below:
[0080] Assume that the position of the co-located luminance pixel corresponding to the upper left corner of the current block relative to the luminance pixel in the upper left corner of the image (that is, the position of the luminance pixel TL) is (xCb, yCb), and the width of the co-located luminance area corresponding to the current block (the entire filled area of the diagonal line in the left figure) is cbWidth, and the height is cbHeight.
[0081] The coordinates of the position of the brightness pixel C are (xCb+cbWidth / 2,yCb+cbHeight / 2);
[0082] The coordinates of the position of the luminance pixel TL are (xCb, yCb);
[0083] The coordinates of the position of the brightness pixel TR are (xCb+cbWidth-1, yCb);
[0084] The coordinates of the position of the brightness pixel BL are (xCb, yCb+cbHeight-1);
[0085] The coordinates of the position of the luminance pixel BR are (xCb+cbWidth-1, yCb+cbHeight-1).
[0086] It can be understood that the specific derivation rules of the brightness prediction mode of the same-position brightness block are as follows:
[0087] If the partition tree type treeType is single tree (SINGLE_TREE), as shown in FIG4 , the process of adding the brightness prediction mode of the CU where C is located in step (1) is performed;
[0088] If the partition tree type treeType is dual tree (DUAL_TREE), as shown in Figure 3, perform the following operations:
[0089] Taking the derivation of the luma prediction mode of the CU where the luma pixel C is located as an example, assuming that the position of the co-located luma pixel corresponding to the upper left corner of the current block relative to the luma pixel in the upper left corner of the image (i.e., the position of the luma pixel TL) is (xCb, yCb), and the width of the co-located luma area corresponding to the current block (the entire diagonal filled area in the left figure) is cbWidth, and the height is cbHeight. The derivation process of the prediction mode lumaIntraPredMode of the corresponding co-located luma block is as follows:
[0090] - Determine whether the CU where the luminance sampling point at the center of the co-located luminance region (i.e., C) is located uses the MIP mode. The center position refers to the luminance sampling point with coordinates (xCb+cbWidth / 2, yCb+cbHeight / 2).
[0091] If IntraMipFlag[xCb+cbWidth / 2][yCb+cbHeight / 2] is 1, then lumaIntraPredMode=INTRA_PLANAR; where the array IntraMipFlag[x][y] refers to whether the current block containing the pixel point with coordinates (x, y) uses the MIP mode.
[0092] -Otherwise, if CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] is MODE_IBC or MODE_PLT, lumaIntraPredMode=INTRA_DC; wherein the array CuPredMode[chType][x][y] refers to the prediction mode used by the luminance block or chrominance block containing the pixel point with coordinates (x, y), chType 0 refers to the luminance component, and chType 1 refers to the chrominance component.
[0093] Otherwise, lumaIntraPredMode = IntraPredModeY[xCb+cbWidth / 2][yCb+cbHeight / 2]; where the array IntraPredModeY[x][y] refers to the intra prediction mode used by the current block containing the pixel at coordinates (x, y). For example, Table 2 shows the mapping relationship between the chroma subsampling format of digital video and sps_chroma_format_idc.
[0094] Table 2
[0095] sps_chroma_format_idc Chroma subsampling format 0 monochrome 14:2:0 24:2:2 34:4:4
[0096] The specific derivation rules for converting the luma prediction mode of the same-position luma block to the chroma prediction mode are as follows:
[0097] When sps_chroma_format_idc is 0, the chroma intra prediction mode does not need to be used, so this derivation rule does not exist;
[0098] When sps_chroma_format_idc is 2, the mode X of the intra-frame luma prediction mode lumaIntraPredMode as specified in Table 3 can be used to derive the mode Y of the intra-frame chroma prediction mode;
[0099] Otherwise, the intra chroma prediction mode is equal to the intra luma prediction mode lumaIntraPredMode.
[0100] Exemplarily, Table 3 shows the mapping relationship between the intra-frame luma prediction mode X and the intra-frame chroma prediction mode Y, which is specifically shown below.
[0101] Table 3
[0102]
[0103] (2) According to the positions shown in FIG5 , the intra-frame chroma prediction modes of the coded chroma blocks where the reference chroma pixels 0, 1, 2, 3, and 4 adjacent to the current block are located are added in sequence.
[0104] The detailed position derivation process of the adjacent chroma pixels 0, 1, 2, 3, and 4 is explained below:
[0105] Assume that the position of the upper left chroma pixel of the current chroma block (the entire filled area of the diagonal line) relative to the upper left chroma pixel of the image is (xCb, yCb), the width of the current chroma block is cbWidth, and the height is cbHeight.
[0106] The position information of chroma pixel 0 is (xCb-1, yCb+cbHeight-1);
[0107] The position information of chroma pixel 1 is (xCb+cbWidth-1,yCb-1);
[0108] The position information of chroma pixel 2 is (xCb-1, yCb+cbHeight);
[0109] The position information of chroma pixel 3 is (xCb+cbWidth, yCb-1);
[0110] The position information of the chroma pixel 4 is (xCb-1, yCb-1).
[0111] It can be understood that the specific rules for converting the chroma prediction mode of the adjacent coded chroma block to the traditional chroma prediction mode are as follows:
[0112] When the prediction mode of the adjacent coded chroma block is inter mode, no addition operation is performed;
[0113] When the chroma prediction mode of the adjacent coded chroma block is CCLM mode, no addition operation is performed;
[0114] Otherwise, the intra chroma prediction mode of the neighboring coded chroma block is directly added.
[0115] (3) Add the patterns with pattern index values +1 or -1 of the first two patterns added in the above steps (1) and (2). There are two ways here: the first way is to determine whether the pattern is an angle pattern. If it is an angle pattern, add the angle pattern mapped by the angle pattern with a minimum angle unit offset clockwise or counterclockwise. If the pattern is not an angle pattern, do nothing. The second way is to directly add 1 or -1 to the corresponding pattern index value: if the pattern index value is 0, only add the pattern with a pattern index value of 1; if the pattern index value is the maximum pattern index, only add the pattern with a pattern index value of -1 of the maximum pattern index. In addition, if there is only one pattern, only add the two angle patterns offset by the pattern; if it is not an angle pattern, do not execute step (3).
[0116] (4) Add a pre-set set of default non-CCLM mode lists (the default list includes but is not limited to the modes described later). For example, the modes in the list are PLANAR_IDX, VER_IDX, HOR_IDX, DC_IDX, VDIA_IDX, VER_IDX–4, VER_IDX+4, HOR_IDX–4, and HOR_IDX+4.
[0117] In simple terms, in the related art, a set of non-CCLM intra-frame prediction mode lists are used to predict the chrominance components for the current block, and the CCLM modes of the adjacent coded and decoded chrominance blocks are ignored. This will have some defects. For example, the CCLM mode that uses the linear relationship between components for prediction has better prediction effect in coded and decoded blocks with different content characteristics. Therefore, more chrominance coded and decoded blocks of the CCLM mode are used in a frame of image. However, the construction process of the intra-frame prediction mode list of the non-CCLM mode ignores the CCLM mode of the adjacent coded and decoded chrominance blocks, which will lose some spatial correlation; that is, the acquisition and construction process of the non-CCLM mode list of the existing chrominance prediction mode is incomplete, resulting in poor chrominance prediction effect.
[0118] Based on this, an embodiment of the present application provides a decoding method to determine a reference block of a current block; wherein the reference block is an adjacent block of the current block; when the prediction mode of the second color component of the reference block meets the first condition, the reference frame intra-prediction mode parameters are determined according to the reference block; and the prediction value of the second color component of the current block is determined according to the reference frame intra-prediction mode parameters.
[0119] An embodiment of the present application also provides an encoding method for determining a reference block of a current block; wherein the reference block is an adjacent block of the current block; when the prediction mode of the second color component of the reference block meets a first condition, determining a reference intra-frame prediction mode parameter based on the reference block; determining a prediction value of the second color component of the current block based on the reference intra-frame prediction mode parameter; and determining a prediction difference value of the second color component of the current block based on the prediction value of the second color component of the current block.
[0120] In this way, both the encoding and decoding ends can determine the reference intra-frame prediction mode parameters of non-CCLM by analyzing the relevant parameters of the reference blocks adjacent to the current block; based on these reference intra-frame prediction mode parameters, the completeness and diversity of the intra-frame chroma prediction mode can be improved, thereby improving the accuracy of the intra-frame chroma prediction, and also improving the encoding and decoding efficiency, thereby improving the encoding and decoding performance.
[0121] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0122] Referring to Figure 6, which shows a schematic block diagram of the composition of an encoder provided in an embodiment of the present application. As shown in Figure 6, the encoder (specifically, a "video encoder") 100 may include a transform and quantization unit 101, an intra-frame estimation unit 102, an intra-frame prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109, and a decoded image cache unit 110, etc., wherein the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC).For the input original video signal, a video coding block can be obtained by dividing it into coding tree units (CTUs). Then, the residual pixel information obtained after intra-frame or inter-frame prediction is transformed by the transform and quantization unit 101, including transforming the residual information from the pixel domain to the transform domain and quantizing the obtained transform coefficients to further reduce the bit rate; the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to perform intra-frame prediction on the video coding block; specifically, the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to determine the intra-frame prediction mode to be used to encode the video coding block; the motion compensation unit 104 and the motion estimation unit 105 are used to perform inter-frame prediction coding on the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information; the motion estimation performed by the motion estimation unit 105 is the process of generating a motion vector, which can estimate the motion of the video coding block, and the motion compensation unit 104 then calculates the motion vector based on the motion vector determined by the motion estimation unit 105. After determining the intra-frame prediction mode, the intra-frame prediction unit 103 is further configured to provide the selected intra-frame prediction data to the encoding unit 109, and the motion estimation unit 105 also sends the calculated motion vector data to the encoding unit 109. In addition, the inverse transform and inverse quantization unit 106 is configured to reconstruct the video coding block and reconstruct a residual block in the pixel domain. The reconstructed residual block is subjected to the filter control analysis unit 107 and the filtering unit 108 to remove the block effect artifacts. The reconstructed residual block is then added to a predictive block in the frame of the decoded image buffer unit 110 to generate a reconstructed video coding block. The encoding unit 109 is configured to encode various coding parameters and quantized transform coefficients. In the CABAC-based coding algorithm, the context content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra-frame prediction mode, and output the code stream of the video signal. The decoded image buffer unit 110 is configured to store the reconstructed video coding block for prediction reference. As the video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoded image buffer unit 110 .
[0123] Referring to Figure 7 , which shows a schematic block diagram of a decoder provided in an embodiment of the present application, as shown in Figure 7 , the decoder (specifically, a "video decoder") 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra-frame prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206. The decoding unit 201 can implement header information decoding and CABAC decoding, and the filtering unit 205 can implement deblocking filtering and SAO filtering. After the input video signal is encoded as shown in FIG6 , a code stream of the video signal is output; the code stream is input to the decoder 200 and first passes through the decoding unit 201 to obtain decoded transform coefficients; the transform coefficients are processed by the inverse transform and inverse quantization unit 202 to generate a residual block in the pixel domain; the intra-frame prediction unit 203 can be used to generate prediction data for the current video decoding block based on the determined intra-frame prediction mode and data from the previously decoded block of the current frame or picture; the motion compensation unit 204 determines the prediction information for the video decoding block by analyzing the motion vector and other associated syntax elements, and uses The prediction information is used to generate a predictive block for the video decoding block being decoded; a decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 202 with the corresponding predictive block generated by the intra-frame prediction unit 203 or the motion compensation unit 204; the decoded video signal passes through the filtering unit 205 to remove blocking artifacts, thereby improving video quality; the decoded video block is then stored in the decoded image buffer unit 206, which stores reference images used for subsequent intra-frame prediction or motion compensation, and is also used for outputting the video signal, thereby obtaining the restored original video signal.
[0124] Furthermore, the embodiment of the present application also provides a network architecture of a coding and decoding system including an encoder and a decoder, wherein FIG8 shows a schematic diagram of a network architecture of a coding and decoding system provided by the embodiment of the present application. As shown in FIG8 , the network architecture includes one or more electronic devices 13 to 1N and a communication network 01, wherein the electronic devices 13 to 1N can perform video interaction through the communication network 01. During implementation, the electronic device can be various types of devices with video coding and decoding functions. For example, the electronic device can include a smart phone, a tablet computer, a personal computer, a personal digital assistant, a navigator, a digital phone, a video phone, a television, a sensing device, a server, etc., which is not specifically limited in the embodiment of the present application. Here, the decoder or encoder described in the embodiment of the present application can be the above-mentioned electronic device.
[0125] It should be noted that the method of the embodiment of the present application is mainly applied to the intra-frame prediction unit 103 shown in Figure 6 and the intra-frame prediction unit 203 shown in Figure 7. In other words, the embodiment of the present application can be applied to both the encoder and the decoder, and can even be applied to both the encoder and the decoder at the same time, but the embodiment of the present application is not specifically limited thereto.
[0126] It should also be noted that, when applied to the intra-frame prediction unit 103, the "current block" specifically refers to the coding block currently to be intra-frame predicted; when applied to the intra-frame prediction unit 203, the "current block" specifically refers to the decoding block currently to be intra-frame predicted.
[0127] In one embodiment of the present application, referring to FIG9 , which is applied to a decoder, a flowchart of a decoding method provided by an embodiment of the present application is shown. As shown in FIG9 , the method may include:
[0128] S910: Determine a reference block for the current block.
[0129] It should be noted that the decoding method of the embodiments of the present application is applied to a decoding device, or a decoding apparatus integrated with the decoding device (also referred to as a "decoder"). Furthermore, the decoding method of the embodiments of the present application may specifically refer to an intra-frame prediction method. Assuming that the first color component is a luminance component and the second color component is a chrominance component, more specifically, this is a method for deriving an intra-frame chrominance prediction mode.
[0130] It should also be noted that in this embodiment of the present application, the current block includes at least a first color component and a second color component. For the first color component of the current block, the block can be simply referred to as a first color component block; and when the first color component is a luminance component, the first color component block can also be referred to as a luminance block. Similarly, for the second color component of the current block, the block can be simply referred to as a second color component block; and when the second color component is a chrominance component, the second color component block can also be referred to as a chrominance block.
[0131] It should also be noted that in the embodiments of this application, the current block may refer to the decoded block in the video image currently undergoing intra-frame prediction. The reference block is a neighboring block of the current block; the term "neighboring" here can refer to spatial proximity, temporal proximity, or other similar terms, without specific limitation. Thus, when this method is applied to a decoder, the reference block of the current block may be a decoded neighboring block of the current block.
[0132] Illustratively, in an embodiment of the present application, when the method is applied to a decoder, taking chroma component prediction as an example, the reference chroma block is the adjacent decoded chroma block of the current block.
[0133] S920 : When the prediction mode of the second color component of the reference block satisfies the first condition, determine a reference intra-frame prediction mode parameter according to the reference block.
[0134] It should be noted that, in the embodiment of the present application, if the prediction mode of the second color component of the reference block meets the first condition, then the reference intra-frame prediction mode parameters can be derived based on the reference block.
[0135] In some embodiments, the first condition may include: the prediction mode of the second color component of the reference block is a first preset mode.
[0136] In a possible implementation, the first preset mode may be a non-angular prediction mode. Exemplarily, the first preset mode may include at least one of the following: an inter-component prediction mode, an IBC mode, a MIP mode, and a Palette mode.
[0137] It should be understood that in the embodiment of the present application, the inter-component prediction mode may be a CCLM mode.
[0138] In another possible implementation, the first preset mode may be an inter-frame prediction mode.
[0139] That is, in the embodiment of the present application, if the prediction mode of the second color component of the reference block is the first preset mode, such as the CCLM mode, then the reference intra-frame prediction mode parameters can be derived according to the reference block of the current block.
[0140] In some embodiments, the first condition may include: the prediction mode of the second color component of the reference block is not a second preset mode.
[0141] In yet another possible implementation, the second preset mode may be an angle prediction mode.
[0142] In another possible implementation, the second preset mode may be a traditional prediction mode. For example, the second preset mode may be a DC mode or a Planar mode.
[0143] That is to say, in an embodiment of the present application, if the prediction mode of the second color component of the reference block is not the second preset mode, such as the angle prediction mode, the DC mode or the Planar mode, then the reference frame intra-prediction mode parameters can also be derived based on the reference block of the current block.
[0144] In addition, for the intra prediction mode, taking the DC mode and the Planar mode as examples, illustratively, the DC mode may also be represented by INTRA_DC, and the Planar mode may also be represented by INTRA_PLANAR.
[0145] In some embodiments, the first condition may include: decoding a code stream and determining a first parameter; wherein the first parameter indicates determining a reference intra-frame prediction mode parameter according to a reference block.
[0146] It should also be understood that in the embodiment of the present application, the first parameter can also be written into the code stream, and then the decoding end determines the first parameter by decoding the code stream, and the first parameter indicates that the reference frame intra prediction mode parameter needs to be determined based on the reference block.
[0147] In some embodiments, determining the reference intra-frame prediction mode parameters based on the reference block may include: determining the reference pixel based on the reference block; determining the first parameter based on the reconstructed sample value of the reference pixel; and determining the reference intra-frame prediction mode parameters based on the first parameter.
[0148] In a specific embodiment, determining a reference pixel based on a reference block may include: determining a reference pixel based on pixels in an adjacent area of the reference block; wherein the adjacent area includes at least one of the following: a left adjacent area, an upper adjacent area, and an upper-left adjacent area.
[0149] For example, the adjacent area to the left of the reference block, the adjacent area above the reference block, and the adjacent area to the upper left of the reference block can all be referred to as adjacent areas of the reference block. Referring to FIG10A , the current block is a chroma block, and the reference block of the current block is an adjacent decoded chroma block. The adjacent area of the adjacent decoded chroma block can be a chroma area composed of multiple dot pixels. Referring to FIG10B , the reference block is a co-located luminance block adjacent to the decoded chroma block, and the adjacent area of the co-located luminance block adjacent to the decoded chroma block can be a luminance area composed of multiple dot pixels.
[0150] In another specific embodiment, determining the reference pixel according to the reference block may include: determining the reference pixel according to pixels in the reference block.
[0151] For example, referring to FIG11A , the current block is a chroma block, the reference block of the current block is an adjacent decoded chroma block, and the reference pixel is a pixel in the adjacent decoded chroma block; referring to FIG11B , the reference block is a co-located luminance block of an adjacent decoded chroma block, and the reference pixel is a pixel in the co-located luminance block of the adjacent decoded chroma block.
[0152] Further, with respect to the first parameter, in some embodiments, determining the first parameter based on the reconstructed sample value of the reference pixel may include: performing gradient calculation on the reconstructed sample value of the reference pixel to determine the horizontal gradient value and the vertical gradient value of the reference pixel; performing angle mapping based on the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one intra-frame prediction mode corresponding to the reference pixel; performing gradient intensity calculation based on the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one gradient intensity value corresponding to the reference pixel; and determining the first parameter based on at least one intra-frame prediction mode and at least one gradient intensity value corresponding to the reference pixel.
[0153] It is understandable that the reference pixel may include at least one candidate pixel, and each candidate pixel corresponds to an intra-frame prediction mode and a gradient strength value. Taking any candidate pixel as an example, in some embodiments, performing angle mapping based on the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one intra-frame prediction mode corresponding to the reference pixel may include: determining the absolute horizontal gradient value and the absolute vertical gradient value of the candidate pixel; performing angle mapping based on the absolute horizontal gradient value and the absolute vertical gradient value of the candidate pixel to determine the initial mode index value of the candidate pixel; and determining an intra-frame prediction mode corresponding to the candidate pixel based on the initial mode index value of the candidate pixel.
[0154] It should be noted that, in the embodiment of the present application, the horizontal gradient value of the candidate pixel can be represented by gVer[x][y], and the vertical gradient value of the candidate pixel can be represented by gHor[x][y]; then the absolute value of the horizontal gradient of the candidate pixel can be represented by abs(gVer[x][y]), and the absolute value of the vertical gradient of the candidate pixel can be represented by abs(gHor[x][y]). In this way, according to the angle mapping of abs(gVer[x][y]) and abs(gHor[x][y]), the initial mode index value of the candidate pixel can be determined, represented by angIdx[x][y]; then, according to the value of angIdx[x][y], an intra-frame prediction mode corresponding to the candidate pixel can be determined.
[0155] Furthermore, in some embodiments, determining an intra-frame prediction mode corresponding to the candidate pixel based on the initial mode index value of the candidate pixel may include: compensating the initial mode index value according to a preset angle compensation value to determine the target mode index value of the candidate pixel; and determining an intra-frame prediction mode corresponding to the candidate pixel based on the target mode index value of the candidate pixel.
[0156] It should also be noted that, in the embodiment of the present application, the preset angle compensation value can be represented by angOffset[region[x][y]], and the target mode index value of the candidate pixel (i.e., the corresponding intra-frame prediction mode) can be represented by ipm[x][y]. Here, the value of ipm[x][y] is equal to the sum of angOffset[region[x][y]] and angIdx[x][y]. Then, based on the value of ipm[x][y], the corresponding intra-frame prediction mode can be determined.
[0157] It can also be understood that for angOffset[region[x][y]], in some embodiments, the method may also include: determining the target quadrant value of the candidate pixel; determining the value corresponding to the target quadrant value under a preset mapping relationship; and setting the preset angle compensation value to be equal to the value.
[0158] It should be noted that in this embodiment of the present application, the target quadrant value of the candidate pixel can be represented by region[x][y], and the preset mapping relationship can be angOffset = {18, 18, 50, 50}. If the target quadrant value is 0 or 1, the preset angle compensation value can be 18; if the target quadrant value is 2 or 3, the preset angle compensation value can be 50.
[0159] Furthermore, in some embodiments, determining the target quadrant value of a candidate pixel may include: determining a first symbol value based on the horizontal gradient value of the candidate pixel; and determining a second symbol value based on the vertical gradient value of the candidate pixel; determining a comparison value of the candidate pixel based on a comparison result of the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel; and performing quadrant mapping based on the comparison value, the first symbol value, and the second symbol value to determine the target quadrant value corresponding to the candidate pixel.
[0160] It should also be noted that, in the embodiment of the present application, the first symbol value can be expressed as signV[x][y], which is used to represent whether gVer[x][y] is greater than 0 or less than 0; the second symbol value can be expressed as signH[x][y], which is used to represent whether gHor[x][y] is greater than 0 or less than 0, and the comparison value can be expressed as HgV[x][y], which is used to represent whether abs(gHor[x][y]) is greater than abs(gVer[x][y]); in this way, the target quadrant value region[x][y] can be determined according to signV[x][y], signH[x][y] and HgV[x][y].
[0161] It can also be understood that in some embodiments, performing gradient strength calculation based on the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one gradient strength value corresponding to the reference pixel may include: performing an addition calculation based on the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel to determine a gradient strength value corresponding to the candidate pixel.
[0162] In an embodiment of the present application, a gradient intensity value corresponding to a candidate pixel can be represented by iAmp[x][y], which is equal to the sum of abs(gVer[x][y]) and abs(gHor[x][y]).
[0163] In the embodiment of the present application, the reconstructed sample value of the reference pixel includes at least one of the following: the reconstructed sample value of the first color component of the reference pixel; the reconstructed sample value of the second color component of the reference pixel.
[0164] In a specific embodiment, determining the first parameter based on the reconstructed sample value of the reference pixel may include: determining at least one intra-frame prediction mode and at least one gradient intensity value corresponding to the first color component of the reference pixel when the reconstructed sample value of the reference pixel is the reconstructed sample value of the first color component of the reference pixel; determining at least one intra-frame prediction mode and at least one gradient intensity value corresponding to the second color component of the reference pixel when the reconstructed sample value of the reference pixel is the reconstructed sample value of the second color component of the reference pixel; forming a first set based on the at least one intra-frame prediction mode corresponding to the first color component of the reference pixel and the at least one intra-frame prediction mode corresponding to the second color component of the reference pixel, wherein the first set includes at least one reference intra-frame prediction mode with mutually different characteristics; accumulating gradient intensity values belonging to the same reference intra-frame prediction mode based on the at least one gradient intensity value corresponding to the first color component of the reference pixel and the at least one gradient intensity value corresponding to the second color component of the reference pixel to determine the gradient intensity value corresponding to the at least one reference intra-frame prediction mode; and determining the first parameter based on the at least one reference intra-frame prediction mode and the gradient intensity value corresponding to the at least one reference intra-frame prediction mode.
[0165] 10A to 13B , exemplary descriptions of determining at least one intra prediction mode and at least one gradient magnitude value corresponding to a reference pixel are provided below.
[0166] In one possible implementation, a reference pixel is determined based on pixels in an adjacent area of a reference block, and then based on the reference pixel, at least one intra-frame prediction mode and at least one gradient strength value corresponding to the reference pixel are determined, wherein the reference pixel includes at least one candidate pixel.
[0167] For example, referring to FIG10A , the current block is a chroma block, and the reference block is an adjacent decoded chroma block. Assuming that the width of the adjacent decoded chroma block is CbNbWidth and the height is CbNbHeight. Assuming that the coordinate information of the candidate chroma pixel is pC[x][y], then x∈[-3,CbNbWidth], y∈[-3,-1] and x∈[-3,-1], y∈[0,CbNbHeight], where the origin [0][0] is the pixel coordinate information of the upper left corner of the adjacent decoded chroma block, the candidate chroma pixel is located in the chroma region formed by the multiple dots in FIG10A . Referring to FIG10B , taking the YUV420 format as an example, the width of the co-located luminance block adjacent to the decoded chroma block is 2×CbNbWidth and the height is 2×CbNbHeight. Assuming that the coordinate information of the candidate luma pixel is pY[x][y], then x∈[-3,2×CbNbWidth], y∈[-3,-1] and x∈[-3,-1], y∈[0,2×CbNbHeight], where the origin [0][0] is the pixel coordinate information of the upper left corner of the co-located luma block adjacent to the decoded chroma block, and the candidate luma pixel is located in the luma area composed of multiple dots in Figure 10B.
[0168] The following is pseudo code for determining an intra prediction mode and a gradient magnitude value corresponding to a candidate pixel. In the following pseudo code, angOffset is the preset angle offset value, gHor[x][y] is the vertical gradient value, gVer[x][y] is the horizontal gradient value, signH[x][y] is the second sign value, signV[x][y] is the first sign value, region[x][y] is the target quadrant value, ipm[x][y] is the intra prediction mode, and iAmp[x][y] is the gradient magnitude value.
[0169] Let mapHgV = {{2,1},{1,2}}, mapVgH = {{3,4},{4,3}}, angTable = {0,2048,4096,6144,8192,12288,16384,20480,24576,28672,32768,36864,40960,47104,53248,59392,65536};
[0170] Let the preset angle compensation value angOffset = {18, 18, 50, 50};
[0171] Step (1): For the coordinate information pC[x][y] of the candidate chroma pixel, that is, x∈[-3,CbNbWidth], y=-2 and x=-2, y∈[0,CbNbHeight], calculate the following values.
[0172] Vertical gradient value: gHor[x][y]=pC[x-1][y-1]+2×pC[x-1][y]+pC[x-1][y+1]-pC[x+1][y-1]-2×pC[x+1][y]-pC[x+1][y+1];
[0173] Horizontal gradient value: gVer[x][y]=pC[x-1][y-1]+2×pC[x][y-1]+pC[x+1][y-1]-pC[x-1][y+1]-2×pC[x][y+1]-pC[x+1][y+1];
[0174] Second symbol value: signH[x][y]=gHor[x][y]<0?1:0;
[0175] First symbol value: signV[x][y]=gVer[x][y]<0?1:0;
[0176] Comparison value: HgV[x][y]=(abs(gHor[x][y])>abs(gVer[x][y])?1:0);
[0177] Target quadrant value: region[x][y]=(HgV[x][y]==1?mapHgV[signH[x][y]][signV[x][y]]:mapVgH[signH[x][y]][signV[x][y]]);
[0178] grad[x][y]=(HgV[x][y]==1?abs(gVer[x][y]) / abs(gHor[x][y]):abs(gHor[x][y]) / abs(gVer[x][y]));
[0179] grad[x][y]=round(grad[x][y]*(1<<16));
[0180] Initial pattern index value: angIdx[x][y] = argmini(abs(angTable[i]-grad[x][y]));
[0181] Intra-frame prediction mode: ipm[x][y]=angOffset[region[x][y]]+angIdx[x][y];
[0182] Gradient intensity value: iAmp[x][y]=abs(gHor[x][y])+abs(gVer[x][y]).
[0183] Step (2): For the coordinate information pY[x][y] of the candidate luminance pixel, that is, x∈[-3,2×CbNbWidth], y=-2 and x=-2, y∈[0,2×CbNbHeight], calculate the following values.
[0184] Vertical gradient value: gHor[x][y]=pY[x-1][y-1]+2×pY[x-1][y]+pY[x-1][y+1]-pY[x+1][y-1]-2×pY[x+1][y]-pY[x+1][y+1];
[0185] Horizontal gradient value: gVer[x][y]=pY[x-1][y-1]+2×pY[x][y-1]+pY[x+1][y-1]-pY[x-1][y+1]-2×pY[x][y+1]-pY[x+1][y+1];
[0186] Second symbol value: signH[x][y]=gHor[x][y]<0?1:0;
[0187] First symbol value: signV[x][y]=gVer[x][y]<0?1:0;
[0188] Comparison value: HgV[x][y]=(abs(gHor[x][y])>abs(gVer[x][y])?1:0);
[0189] Target quadrant value: region[x][y]=(HgV[x][y]==1?mapHgV[signH[x][y]][signV[x][y]]:mapVgH[signH[x][y]][signV[x][y]]);
[0190] grad[x][y]=(HgV[x][y]==1?abs(gVer[x][y]) / abs(gHor[x][y]):abs(gHor[x][y]) / abs(gVer[x][y]));
[0191] grad[x][y]=round(grad[x][y]*(1<<16));
[0192] Initial pattern index value: angIdx[x][y] = argmini(abs(angTable[i]-grad[x][y]));
[0193] Intra-frame prediction mode: ipm[x][y]=angOffset[region[x][y]]+angIdx[x][y];
[0194] Gradient intensity value: iAmp[x][y]=abs(gHor[x][y])+abs(gVer[x][y]).
[0195] In another possible implementation, a reference pixel is determined based on all pixels in a reference block, and then at least one intra-frame prediction mode and at least one gradient strength value corresponding to the reference pixel are determined based on the reference pixel, wherein the reference pixel includes at least one candidate pixel.
[0196] For example, referring to FIG11A , the current block is a chroma block, and the reference block is an adjacent decoded chroma block. Assume that the width of the adjacent decoded chroma block is CbNbWidth and the height is CbNbHeight. Assume that the coordinate information of the candidate chroma pixel is pC[x][y], then x∈[0,CbNbWidth-1], y∈[0,CbNbHeight-1], where the origin [0][0] is the pixel coordinate information of the upper left corner of the adjacent decoded chroma block, and the candidate chroma pixel is located in the chroma area composed of multiple dots in FIG11A . Referring to FIG11B , taking the YUV420 format as an example, the width of the co-located luminance block of the adjacent decoded chroma block is 2×CbNbWidth and the height is 2×CbNbHeight. Assuming that the coordinate information of the candidate luminance pixel is pY[x][y], then x∈[0,2×CbNbWidth-1], y∈[0,2×CbNbHeight-1], where the origin [0][0] is the pixel coordinate information of the upper left corner of the co-located luminance block adjacent to the decoded chrominance block, the candidate luminance pixel is located in the luminance area composed of multiple dots in Figure 11B.
[0197] The following is pseudo code for determining an intra prediction mode and a gradient magnitude value corresponding to a candidate pixel. In the following pseudo code, angOffset is the preset angle offset value, gHor[x][y] is the vertical gradient value, gVer[x][y] is the horizontal gradient value, signH[x][y] is the second sign value, signV[x][y] is the first sign value, region[x][y] is the target quadrant value, ipm[x][y] is the intra prediction mode, and iAmp[x][y] is the gradient magnitude value.
[0198] Let mapHgV = {{2,1},{1,2}}, mapVgH = {{3,4},{4,3}}, angTable = {0,2048,4096,6144,8192,12288,16384,20480,24576,28672,32768,36864,40960,47104,53248,59392,65536};
[0199] Let the preset angle compensation value angOffset = {18, 18, 50, 50};
[0200] Step (1): For the coordinate information pC[x][y] of the candidate chroma pixel, i.e., x∈[1,CbNbWidth-2], y∈[1,CbNbHeight-2], calculate the following values.
[0201] Vertical gradient value: gHor[x][y]=pC[x-1][y-1]+2×pC[x-1][y]+pC[x-1][y+1]-pC[x+1][y-1]-2×pC[x+1][y]-pC[x+1][y+1];
[0202] Horizontal gradient value: gVer[x][y]=pC[x-1][y-1]+2×pC[x][y-1]+pC[x+1][y-1]-pC[x-1][y+1]-2×pC[x][y+1]-pC[x+1][y+1];
[0203] Second symbol value: signH[x][y]=gHor[x][y]<0?1:0;
[0204] First symbol value: signV[x][y]=gVer[x][y]<0?1:0;
[0205] Comparison value: HgV[x][y]=(abs(gHor[x][y])>abs(gVer[x][y])?1:0);
[0206] Target quadrant value: region[x][y]=(HgV[x][y]==1?mapHgV[signH[x][y]][signV[x][y]]:mapVgH[signH[x][y]][signV[x][y]]);
[0207] grad[x][y]=(HgV[x][y]==1?abs(gVer[x][y]) / abs(gHor[x][y]):abs(gHor[x][y]) / abs(gVer[x][y]));
[0208] grad[x][y]=round(grad[x][y]*(1<<16));
[0209] Initial pattern index value: angIdx[x][y] = argmini(abs(angTable[i]-grad[x][y]));
[0210] Intra-frame prediction mode: ipm[x][y]=angOffset[region[x][y]]+angIdx[x][y];
[0211] Gradient intensity value: iAmp[x][y]=abs(gHor[x][y])+abs(gVer[x][y]).
[0212] Step (2): For the coordinate information pY[x][y] of the candidate luminance pixel, i.e., x∈[1,2×CbNbWidth-2], y∈[1,2×CbNbHeight-2], calculate the following values.
[0213] Vertical gradient value: gHor[x][y]=pY[x-1][y-1]+2×pY[x-1][y]+pY[x-1][y+1]-pY[x+1][y-1]-2×pY[x+1][y]-pY[x+1][y+1];
[0214] Horizontal gradient value: gVer[x][y]=pY[x-1][y-1]+2×pY[x][y-1]+pY[x+1][y-1]-pY[x-1][y+1]-2×pY[x][y+1]-pY[x+1][y+1];
[0215] Second symbol value: signH[x][y]=gHor[x][y]<0?1:0;
[0216] First symbol value: signV[x][y]=gVer[x][y]<0?1:0;
[0217] Comparison value: HgV[x][y]=(abs(gHor[x][y])>abs(gVer[x][y])?1:0);
[0218] Target quadrant value: region[x][y]=(HgV[x][y]==1?mapHgV[signH[x][y]][signV[x][y]]:mapVgH[signH[x][y]][signV[x][y]]);
[0219] grad[x][y]=(HgV[x][y]==1?abs(gVer[x][y]) / abs(gHor[x][y]):abs(gHor[x][y]) / abs(gVer[x][y]));
[0220] grad[x][y]=round(grad[x][y]*(1<<16));
[0221] Initial pattern index value: angIdx[x][y] = argmini(abs(angTable[i]-grad[x][y]));
[0222] Intra-frame prediction mode: ipm[x][y]=angOffset[region[x][y]]+angIdx[x][y];
[0223] Gradient intensity value: iAmp[x][y]=abs(gHor[x][y])+abs(gVer[x][y]).
[0224] In another possible implementation, considering that determining the reference pixel based on all pixels in the reference block will increase the computational complexity, the reference pixel can also be determined based on part of the pixels in the reference block, and then based on the reference pixel, at least one intra-frame prediction mode and at least one gradient strength value corresponding to the reference pixel are determined, wherein the reference pixel includes at least one candidate pixel.
[0225] For example, referring to FIG12A , the current block is a chroma block, and the reference block is an adjacent decoded chroma block. Assume that the width of the adjacent decoded chroma block is CbNbWidth and the height is CbNbHeight. Assume that the coordinate information of the candidate chroma pixel is pC[x][y], then x∈ [CbNbWidth-3, CbNbWidth-1], y∈[0, CbNbHeight-1], where the origin [0][0] is the pixel coordinate information of the upper left corner of the adjacent decoded chroma block. The candidate chroma pixel is located in the chroma area composed of multiple dots in FIG12A . Referring to FIG12B , taking the YUV420 format as an example, the width of the co-located luminance block adjacent to the decoded chroma block is 2×CbNbWidth and the height is 2×CbNbHeight. Assuming that the coordinate information of the candidate luma pixel is pY[x][y], then x∈[2×CbNbWidth-3,2×CbNbWidth-1], y∈[0,2×CbNbHeight-1], where the origin [0][0] is the pixel coordinate information of the upper left corner of the co-located luma block adjacent to the decoded chroma block. The candidate luma pixel is located in the luma area composed of multiple dots in Figure 12B.
[0226] The following is pseudo code for determining an intra prediction mode and a gradient magnitude value corresponding to a candidate pixel. In the following pseudo code, angOffset is the preset angle offset value, gHor[x][y] is the vertical gradient value, gVer[x][y] is the horizontal gradient value, signH[x][y] is the second sign value, signV[x][y] is the first sign value, region[x][y] is the target quadrant value, ipm[x][y] is the intra prediction mode, and iAmp[x][y] is the gradient magnitude value.
[0227] Let mapHgV = {{2,1},{1,2}}, mapVgH = {{3,4},{4,3}}, angTable = {0,2048,4096,6144,8192,12288,16384,20480,24576,28672,32768,36864,40960,47104,53248,59392,65536};
[0228] Let the preset angle compensation value angOffset = {18, 18, 50, 50};
[0229] Step (1): For the coordinate information pC[x][y] of the candidate chroma pixel, ie, x=CbNbWidth-2, y∈[1,CbNbHeight-2], the following values are calculated.
[0230] Vertical gradient value: gHor[x][y]=pC[x-1][y-1]+2×pC[x-1][y]+pC[x-1][y+1]-pC[x+1][y-1]-2×pC[x+1][y]-pC[x+1][y+1];
[0231] Horizontal gradient value: gVer[x][y]=pC[x-1][y-1]+2×pC[x][y-1]+pC[x+1][y-1]-pC[x-1][y+1]-2×pC[x][y+1]-pC[x+1][y+1];
[0232] Second symbol value: signH[x][y]=gHor[x][y]<0?1:0;
[0233] First symbol value: signV[x][y]=gVer[x][y]<0?1:0;
[0234] Comparison value: HgV[x][y]=(abs(gHor[x][y])>abs(gVer[x][y])?1:0);
[0235] Target quadrant value: region[x][y]=(HgV[x][y]==1?mapHgV[signH[x][y]][signV[x][y]]:mapVgH[signH[x][y]][signV[x][y]]);
[0236] grad[x][y]=(HgV[x][y]==1?abs(gVer[x][y]) / abs(gHor[x][y]):abs(gHor[x][y]) / abs(gVer[x][y]));
[0237] grad[x][y]=round(grad[x][y]*(1<<16));
[0238] Initial pattern index value: angIdx[x][y] = argmini(abs(angTable[i]-grad[x][y]));
[0239] Intra-frame prediction mode: ipm[x][y]=angOffset[region[x][y]]+angIdx[x][y];
[0240] Gradient intensity value: iAmp[x][y]=abs(gHor[x][y])+abs(gVer[x][y]).
[0241] Step (2): For the coordinate information pY[x][y] of the candidate luminance pixel, ie, x=2×CbNbWidth-2], y∈[1,2×CbNbHeight-2], the following values are calculated.
[0242] Vertical gradient value: gHor[x][y]=pY[x-1][y-1]+2×pY[x-1][y]+pY[x-1][y+1]-pY[x+1][y-1]-2×pY[x+1][y]-pY[x+1][y+1];
[0243] Horizontal gradient value: gVer[x][y]=pY[x-1][y-1]+2×pY[x][y-1]+pY[x+1][y-1]-pY[x-1][y+1]-2×pY[x][y+1]-pY[x+1][y+1];
[0244] Second symbol value: signH[x][y]=gHor[x][y]<0?1:0;
[0245] First symbol value: signV[x][y]=gVer[x][y]<0?1:0;
[0246] Comparison value: HgV[x][y]=(abs(gHor[x][y])>abs(gVer[x][y])?1:0);
[0247] Target quadrant value: region[x][y]=(HgV[x][y]==1?mapHgV[signH[x][y]][signV[x][y]]:mapVgH[signH[x][y]][signV[x][y]]);
[0248] grad[x][y]=(HgV[x][y]==1?abs(gVer[x][y]) / abs(gHor[x][y]):abs(gHor[x][y]) / abs(gVer[x][y]));
[0249] grad[x][y]=round(grad[x][y]*(1<<16));
[0250] Initial pattern index value: angIdx[x][y] = argmini(abs(angTable[i]-grad[x][y]));
[0251] Intra-frame prediction mode: ipm[x][y]=angOffset[region[x][y]]+angIdx[x][y];
[0252] Gradient intensity value: iAmp[x][y]=abs(gHor[x][y])+abs(gVer[x][y]).
[0253] In another possible implementation, taking another reference pixel position as an example, and considering that determining the reference pixel based on all pixels in the reference block will increase the computational complexity, the reference pixel can also be determined based on some pixels in the reference block, and then based on the reference pixel, at least one intra-frame prediction mode and at least one gradient strength value corresponding to the reference pixel are determined, wherein the reference pixel includes at least one candidate pixel.
[0254] For example, referring to FIG13A, the current block is a chroma block, and the reference block is an adjacent decoded chroma block. Assume that the width of the adjacent decoded chroma block is CbNbWidth and the height is CbNbHeight. Assume that the coordinate information of the candidate chroma pixel is pC[x][y], then x∈[0,CbNbWidth-1], y∈[CbNbHeight-3,CbNbHeight-1], where the origin [0][0] is the pixel coordinate information of the upper left corner of the adjacent decoded chroma block, and the candidate chroma pixel is located in the chroma area composed of multiple dots in FIG13A. Referring to FIG13B, taking the YUV420 format as an example, the width of the co-located luminance block of the adjacent decoded chroma block is 2×CbNbWidth and the height is 2×CbNbHeight. Assuming that the coordinate information of the candidate luma pixel is pY[x][y], then x∈[0,2×CbNbWidth-1], y∈[2×CbNbHeight-3,2×CbNbHeight-1], where the origin [0][0] is the pixel coordinate information of the upper left corner of the co-located luma block adjacent to the decoded chroma block. The candidate luma pixel is located in the luma area composed of multiple dots in 13B.
[0255] The following is pseudo code for determining an intra prediction mode and a gradient magnitude value corresponding to a candidate pixel. In the following pseudo code, angOffset is the preset angle offset value, gHor[x][y] is the vertical gradient value, gVer[x][y] is the horizontal gradient value, signH[x][y] is the second sign value, signV[x][y] is the first sign value, region[x][y] is the target quadrant value, ipm[x][y] is the intra prediction mode, and iAmp[x][y] is the gradient magnitude value.
[0256] Let mapHgV = {{2,1},{1,2}}, mapVgH = {{3,4},{4,3}}, angTable = {0,2048,4096,6144,8192,12288,16384,20480,24576,28672,32768,36864,40960,47104,53248,59392,65536};
[0257] Let the preset angle compensation value angOffset = {18, 18, 50, 50};
[0258] Step (1): For the coordinate information pC[x][y] of the candidate chroma pixel, ie, x=[0, CbNbWidth-1], y=CbNbHeight-2, the following values are calculated.
[0259] Vertical gradient value: gHor[x][y]=pC[x-1][y-1]+2×pC[x-1][y]+pC[x-1][y+1]-pC[x+1][y-1]-2×pC[x+1][y]-pC[x+1][y+1];
[0260] Horizontal gradient value: gVer[x][y]=pC[x-1][y-1]+2×pC[x][y-1]+pC[x+1][y-1]-pC[x-1][y+1]-2×pC[x][y+1]-pC[x+1][y+1];
[0261] Second symbol value: signH[x][y]=gHor[x][y]<0?1:0;
[0262] First symbol value: signV[x][y]=gVer[x][y]<0?1:0;
[0263] Comparison value: HgV[x][y]=(abs(gHor[x][y])>abs(gVer[x][y])?1:0);
[0264] Target quadrant value: region[x][y]=(HgV[x][y]==1?mapHgV[signH[x][y]][signV[x][y]]:mapVgH[signH[x][y]][signV[x][y]]);
[0265] grad[x][y]=(HgV[x][y]==1?abs(gVer[x][y]) / abs(gHor[x][y]):abs(gHor[x][y]) / abs(gVer[x][y]));
[0266] grad[x][y]=round(grad[x][y]*(1<<16));
[0267] Initial pattern index value: angIdx[x][y] = argmini(abs(angTable[i]-grad[x][y]));
[0268] Intra-frame prediction mode: ipm[x][y]=angOffset[region[x][y]]+angIdx[x][y];
[0269] Gradient intensity value: iAmp[x][y]=abs(gHor[x][y])+abs(gVer[x][y]).
[0270] Step (2): For the coordinate information pY[x][y] of the candidate luminance pixel, ie, x = [0, 2×CbNbWidth-1], y = 2×CbNbHeight-2, the following values are calculated.
[0271] Vertical gradient value: gHor[x][y]=pY[x-1][y-1]+2×pY[x-1][y]+pY[x-1][y+1]-pY[x+1][y-1]-2×pY[x+1][y]-pY[x+1][y+1];
[0272] Horizontal gradient value: gVer[x][y]=pY[x-1][y-1]+2×pY[x][y-1]+pY[x+1][y-1]-pY[x-1][y+1]-2×pY[x][y+1]-pY[x+1][y+1];
[0273] Second symbol value: signH[x][y]=gHor[x][y]<0?1:0;
[0274] First symbol value: signV[x][y]=gVer[x][y]<0?1:0;
[0275] Comparison value: HgV[x][y]=(abs(gHor[x][y])>abs(gVer[x][y])?1:0);
[0276] Target quadrant value: region[x][y]=(HgV[x][y]==1?mapHgV[signH[x][y]][signV[x][y]]:mapVgH[signH[x][y]][signV[x][y]]);
[0277] grad[x][y]=(HgV[x][y]==1?abs(gVer[x][y]) / abs(gHor[x][y]):abs(gHor[x][y]) / abs(gVer[x][y]));
[0278] grad[x][y]=round(grad[x][y]*(1<<16));
[0279] Initial pattern index value: angIdx[x][y] = argmini(abs(angTable[i]-grad[x][y]));
[0280] Intra-frame prediction mode: ipm[x][y]=angOffset[region[x][y]]+angIdx[x][y];
[0281] Gradient intensity value: iAmp[x][y]=abs(gHor[x][y])+abs(gVer[x][y]).
[0282] It should be noted that the initial mode index value is the closest calculated intra prediction mode index value, and after compensating it using the preset angle compensation value angOffset[region[x][y]], the calculated intra prediction mode can be determined.
[0283] For example, FIG14 shows a schematic histogram of gradient intensity values corresponding to at least one intra-frame prediction mode provided in an embodiment of the present application. As shown in FIG14 , the gradient values iAmp of steps (1) and (2) in any of the aforementioned implementations can be accumulated according to the corresponding intra-frame prediction mode ipm, and a histogram can be established with the intra-frame prediction mode ipm as the horizontal coordinate and the gradient intensity value iAmp as the vertical coordinate. The histogram can include gradient intensity values corresponding to at least one intra-frame prediction mode, and the mode index interval range of the at least one intra-frame prediction mode is [0,66].
[0284] In some embodiments, determining the reference intra-frame prediction mode parameters based on the first parameter may include: forming a second set based on the gradient strength values corresponding to at least one reference intra-frame prediction mode; if the gradient strength values in the second set are all zero, determining the reference intra-frame prediction mode parameters based on the PLANAR mode; if there are non-zero items in the gradient strength values in the second set, determining the maximum gradient strength value from the second set, and determining the reference intra-frame prediction mode parameters based on the intra-frame prediction mode corresponding to the maximum gradient strength value.
[0285] Exemplarily, as shown in FIG14 , the second set may include gradient strength values corresponding to at least one intra-frame prediction mode. From FIG14 , it can be intuitively obtained that the maximum gradient value among the gradient strength values corresponding to the at least one intra-frame prediction mode and the intra-frame prediction mode corresponding to the maximum gradient strength value are included.
[0286] Furthermore, in some embodiments, the maximum gradient strength value in the second set is assigned to -1 to determine a third set; if the intra-frame prediction mode corresponding to the maximum gradient strength value is the same as the first color component prediction mode of the first color component block at the same position of the reference block, a new maximum gradient strength value is determined from the third set, and the reference intra-frame prediction mode parameters are determined according to the intra-frame prediction mode corresponding to the new maximum gradient strength value.
[0287] Furthermore, in some embodiments, if the intra prediction mode corresponding to the new maximum gradient magnitude value is the same as the first color component prediction mode of the first color component block at the same position of the reference block, the reference intra prediction mode parameters are determined according to the DC mode.
[0288] In the embodiment of the present application, the reference intra-frame prediction mode parameter derived from the histogram shown in FIG14 is represented by IntraPredModeD, and its corresponding mode index interval range is [0, 66].
[0289] Exemplarily, if the histogram does not contain any non-zero entries, then IntraPredModeD=INTRA_PLANAR.
[0290] Otherwise, set IntraPredModeD=argmax i(HoG[i]) and set HoG[IntraPredModeD] to -1;
[0291] If IntraPredModeD is equal to the DM mode of the chroma block where (xCbNb, yCbNb) is located, then search again and set IntraPredModeD = argmax i (HoG[i]);
[0292] If IntraPredModeD continues to be equal to the DM mode of the chroma block where (xCbNb, yCbNb) is located, then IntraPredModeD=INTRA_DC.
[0293] S930 : Determine a prediction value of the second color component of the current block according to the reference intra-frame prediction mode parameter.
[0294] It should be noted that, in an embodiment of the present application, determining the predicted value of the second color component of the current block based on the prediction mode parameters within the reference frame may include: constructing a mode candidate list of the second color component of the current block based on the prediction mode parameters within the reference frame; and determining the predicted value of the second color component of the current block based on the mode candidate list.
[0295] In some embodiments, determining the predicted value of the second color component of the current block based on the mode candidate list may include: parsing the code stream to determine the mode index number of the second color component of the current block; determining the target prediction mode corresponding to the mode index number based on the mode candidate list; and using the target prediction mode to perform prediction processing on the second color component of the current block to determine the predicted value of the second color component of the current block.
[0296] It should be noted that in an embodiment of the present application, after establishing the mode candidate list, the decoding end can determine the target prediction mode through the mode index number obtained by decoding; then use the target prediction mode to predict the second color component of the current block to determine the predicted value of the second color component of the current block.
[0297] Furthermore, in some embodiments, the method may also include: parsing the code stream to determine the predicted difference value of the second color component of the current block; and determining the reconstructed value of the second color component of the current block based on the predicted value of the second color component of the current block and the predicted difference value of the second color component of the current block.
[0298] It should also be noted that in the embodiment of the present application, since the encoding end has determined the predicted difference value of the second color component of the current block and written it into the code stream, the decoding end can perform an addition operation on the predicted value of the second color component of the current block and the predicted difference value of the second color component of the current block after obtaining the predicted difference value through decoding, thereby obtaining the reconstructed value of the second color component of the current block.
[0299] That is, taking the chroma component as an example, a mode candidate list for the chroma component of the current block is constructed based on the reference intra-frame prediction mode parameters. During the construction process, texture analysis is performed by fully utilizing the content characteristics of adjacent decoded reference blocks, constructing a gradient histogram with entries corresponding to multiple angle modes. By using horizontal and vertical gradient values to determine gradient intensity values, a reference intra-frame prediction mode parameter can be determined and added to the mode candidate list, thereby improving the diversity of intra-frame chroma prediction modes. Furthermore, based on this mode candidate list, a more accurate chroma prediction value can be obtained, thereby enhancing the accuracy of intra-frame chroma prediction.
[0300] It should also be understood that in the embodiments of the present application, for the reference block of the current block, in some embodiments, determining the reference block of the current block may also include: determining at least one target pixel adjacent to the current block; determining at least one first target block based on the blocks in which the at least one target pixel is located; and determining the reference block of the current block based on the at least one first target block.
[0301] For example, referring to FIG5 , the current block (the entire filled area of the diagonal line) is the chroma block, the target pixel adjacent to the current block can be pixel 0, and the block where pixel 0 is located can be the first target block, which is the reference block of the current block.
[0302] Further, in some embodiments, based on at least one first target block, the reference intra-frame prediction mode parameters of at least one first target block are determined in sequence as reference blocks in a first preset order; and based on the reference intra-frame prediction mode parameters of at least one first target block, a mode candidate list of the second color component of the current block is constructed.
[0303] It should be understood that the first preset order can be set manually or according to a certain rule in a specific scenario, and the embodiments of the present application do not limit this.
[0304] For example, referring to Figure 5, the current block (the entire filled area of the diagonal line) is the chroma block, and 0, 1, 2, 3, and 4 are the target pixels respectively. Assuming that the coordinate information of the upper left corner of the current block relative to the upper left chroma pixel of the image is (xCb, yCb), the width of the current block is cbWidth, and the height is cbHeight, the coordinate information of 0, 1, 2, 3, and 4 is as follows.
[0305] The coordinate information of target pixel 0 is (xCb-1, yCb+cbHeight-1);
[0306] The coordinate information of target pixel 1 is (xCb+cbWidth-1,yCb-1);
[0307] The coordinate information of target pixel 2 is (xCb-1, yCb+cbHeight);
[0308] The coordinate information of target pixel 3 is (xCb+cbWidth, yCb-1);
[0309] The coordinate information of the target pixel 4 is (xCb-1, yCb-1).
[0310] According to the coordinate information of 0, 1, 2, 3, and 4, the blocks where 0, 1, 2, 3, and 4 are located can be determined, and the blocks where 0, 1, 2, 3, and 4 are located can be used as five first target blocks respectively. The five first target blocks can be used as reference blocks in turn, so that the reference intra-frame prediction mode parameters of the five first target blocks can be determined with reference to the method described above, and then the mode candidate list of the second color component of the current block can be constructed according to the reference intra-frame prediction mode parameters of the five first target blocks.
[0311] In addition, in some embodiments, the method may further include: determining the prediction mode of the second color component of the reference block; when the prediction mode of the second color component of the reference block does not meet the first condition, directly adding the prediction mode of the second color component of the reference block to the mode candidate list.
[0312] Exemplarily, in an embodiment of the present application, if the prediction mode of the second color component of the reference block is an intra-frame prediction mode other than the inter-frame prediction mode and the CCLM mode, then the mode candidate list of the second color component of the current block can be constructed based on the prediction mode of the second color component of the reference block, that is, the prediction mode of the second color component of the reference block is directly added to the mode candidate list.
[0313] An embodiment of the present application provides a decoding method. After determining the reference block of the current block, when the prediction mode of the second color component of the reference block meets a first condition, a reference intra-frame prediction mode parameter can be determined based on the reference block; a mode candidate list of the second color component of the current block can be constructed based on the reference intra-frame prediction mode parameter; and a prediction value of the second color component of the current block can be determined based on the mode candidate list. In this way, when determining the reference intra-frame prediction mode parameter of the non-CCLM mode, the prediction mode of the adjacent decoded reference block is taken into account. In this way, not only can the completeness and diversity of the intra-frame chroma prediction mode be improved, but also the accuracy of the intra-frame chroma prediction can be improved, thereby improving decoding efficiency and thus decoding performance.
[0314] In another embodiment of the present application, based on the decoding method described in the above embodiment, see Figure 15, which shows a second flow chart of a decoding method provided by an embodiment of the present application. As shown in Figure 15, the method may include:
[0315] S1510: Determine a first color component area at the same position as the current block.
[0316] For example, referring to Figure 3 or Figure 4, the current block is the chroma block (the entire diagonal line filled area in the right picture of Figure 3 or Figure 4), and the first color component area at the same position of the current block is the luminance block (the entire diagonal line filled area in the left picture of Figure 3 or Figure 4).
[0317] S1520: Determine at least one second target block at a preset position from at least one block divided by the first color component area.
[0318] Exemplarily, in the single-tree mode, referring to FIG. 4 , the first color component region is divided into a block, and the second target block at the preset position is a C block.
[0319] Exemplarily, in the dual-tree mode, referring to FIG3 , the first color component region is divided into multiple blocks. There are five second target blocks at preset positions, which are respectively denoted as TL block, TR block, C block, BL block, and BR block.
[0320] As shown in Figure 3, assuming that the position of the co-located luminance block corresponding to the upper left corner of the current block relative to the luminance block in the upper left corner of the image (i.e., the position of the luminance block TL) is (xCb, yCb), and the width of the co-located luminance area corresponding to the current block (the entire diagonal line filling area in the left figure) is cbWidth and the height is cbHeight, the position coordinates of the five second target blocks can be recorded as follows:
[0321] The coordinate information of block C is (xCb+cbWidth / 2,yCb+cbHeight / 2);
[0322] The coordinate information of the TL block is (xCb, yCb);
[0323] The coordinate information of the TR block is (xCb+cbWidth-1,yCb);
[0324] The coordinate information of the BL block is (xCb, yCb+cbHeight-1);
[0325] The coordinate information of the BR block is (xCb+cbWidth-1, yCb+cbHeight-1).
[0326] It should be understood that the five positions of the second target blocks shown in Figure 3 are for illustrative purposes only. The embodiments of the present application are not limited to these five positions and can be multiple different positions. The embodiments of the present application do not limit the number and specific positions of the second target blocks.
[0327] S1530: Determine a reference block for the current block according to at least one second target block.
[0328] Exemplarily, one of the at least one second target blocks may be used as a reference block for the current block. For example, block C in FIG4 may be used as a reference block for the current block.
[0329] Exemplarily, multiple second target blocks may be used as reference blocks for the current block. For example, the C block, TL block, TR block, BL block, and BR block in FIG3 may be used as reference blocks for the current block in sequence.
[0330] In some embodiments, the method may further include: determining the first color component prediction mode parameters of at least one second target block in sequence based on a preset order of at least one second target block; and constructing a mode candidate list for the second color component of the current block based on the first color component prediction mode parameters of at least one second target block.
[0331] It should be understood that when there is only one second target block, the preset order of the second target blocks may not be used as a reference.
[0332] It should also be understood that the second preset order can be manually set or set according to a certain rule in a specific scenario, and the embodiments of the present application are not limited to this. For example, referring to Figure 3, the preset order of the second target blocks can include, but is not limited to, the following order: C->TL->TR->BL->BR.
[0333] Exemplarily, an exemplary description of determining the first color component prediction mode parameters of at least one second target block is given below.
[0334] In one example, in the single tree mode, referring to FIG. 4 , the first color component prediction mode parameter of the second target block may be the first color component prediction mode of the C block.
[0335] In another example, in the dual-tree mode, referring to FIG3 , assuming that the second target block is block C in FIG3 , determining the first color component prediction mode parameters of block C in FIG3 can be divided into the following steps.
[0336] The first step is to determine whether block C in FIG3 uses the MIP mode.
[0337] If the C block in Figure 3 uses the MIP mode, the first color component prediction mode parameter of the C block in Figure 3 is the PLANAR mode. This can be expressed in pseudo code as follows: If IntraMipFlag[xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to 1, then lumaIntraPredMode is set to INTRA_PLANAR. Here, (xCb+cbWidth / 2, yCb+cbHeight / 2) is the coordinate information of the C block; IntraMipFlag[xCb+cbWidth / 2][yCb+cbHeight / 2] is an array indicating whether the C block uses the MIP mode; lumaIntraPredMode is the first color component prediction mode parameter, and INTRA_PLANAR is the PLANAR mode.
[0338] Otherwise, if the C block in FIG3 does not use the MIP mode, the second step is executed.
[0339] In the second step, if CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] is IBC mode or PLT mode, the prediction mode parameters of the first color component of block C are DC mode. Among them, (xCb+cbWidth / 2, yCb+cbHeight / 2) is the coordinate information of block C, and [0] is the first color component.
[0340] Otherwise, if CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] is not IBC mode or PLT mode, execute the third step.
[0341] In the third step, the first color component prediction mode parameter of the C block is set to IntraPredModeY[xCb+cbWidth / 2][yCb+cbHeight / 2], where (xCb+cbWidth / 2, yCb+cbHeight / 2) is the coordinate information of the C block.
[0342] It should be understood that determining the first color component prediction mode parameters of other blocks (such as TL block and TR block) except C block in Figure 3 is similar to determining the first color component prediction mode parameters of C block, and will not be repeated here.
[0343] Furthermore, in some embodiments, constructing a mode candidate list for the second color component of the current block according to the first color component prediction mode parameter of at least one second target block may be implemented in two possible ways:
[0344] In a possible implementation, the first color component prediction mode parameter of at least one second target block is added to the mode candidate list of the second color component of the current block.
[0345] Exemplarily, in the single tree mode, referring to FIG. 4 , the first color component prediction mode of the C block may be added to the mode candidate list of the second color component of the current block.
[0346] Exemplarily, in the dual-tree mode, referring to FIG3 , assuming that the second target block is block C in FIG3 , and the first color component prediction mode parameter of block C is the PLANAR mode, the PLANAR mode can be added to the mode candidate list of the second color component of the current block.
[0347] In another possible implementation, referring to Table 2 above, in the chroma subsampling format, the first color component prediction mode parameters of at least one second target block may need to be converted before being added to the mode candidate list of the second color component of the current block.
[0348] Exemplarily, when sps_chroma_format_idc is 0, there is no need to convert the first color component prediction mode parameters of at least one second target block. At this time, the first color component prediction mode parameters of at least one second target block do not need to be added to the mode candidate list of the second color component of the current block.
[0349] Exemplarily, when sps_chroma_format_idc is 2, referring to the aforementioned Table 3, the preset rules specified in Table 3 are used to convert the first color component prediction mode parameters of at least one second target block to obtain the converted first color component prediction mode parameters of at least one second target block, and the converted first color component prediction mode parameters of the second target blocks are added to the mode candidate list of the second color component of the current block.
[0350] Exemplarily, when sps_chroma_format_idc is 1 or 3, there is no need to convert the first color component prediction mode parameters of at least one second target block. At this time, the first color component prediction mode parameters of at least one second target block can be directly added to the mode candidate list of the second color component of the current block.
[0351] It should be noted that the decoding method shown in Figure 9 can construct a mode candidate list for the second color component of the current block based on the reference intra-frame prediction mode parameters of at least one first target block, and the decoding method shown in Figure 15 can construct a mode candidate list for the second color component of the current block based on the first color component prediction mode parameters of at least one second target block. Based on this, the mode candidate list for the second color component of the current block can be constructed based on the reference intra-frame prediction mode parameters of at least one first target block and the first color component prediction mode parameters of at least one second target block.
[0352] In another embodiment of the present application, based on the decoding method described in the above embodiment, see Figure 16, which shows a flowchart diagram of a decoding method provided by the embodiment of the present application. As shown in Figure 16, the method may include:
[0353] S1610: Determine the first two prediction modes in the mode candidate list.
[0354] In which, the mode candidate list can be constructed based on the reference intra-frame prediction mode parameters of at least one first target block, or based on the first color component prediction mode parameters of at least one second target block, or can be constructed jointly based on the reference intra-frame prediction mode parameters of at least one first target block and the first color component prediction mode parameters of at least one second target block.
[0355] S1620: Perform an offset operation on the mode index numbers of the first two prediction modes to determine at least one new intra-frame prediction mode.
[0356] It should be noted that for the first two prediction modes in the mode candidate list, in one possible implementation, a determination is first made as to whether the prediction mode is an angle mode. If the prediction mode is an angle mode, the angle mapped by the angle mode is offset clockwise or counterclockwise by a minimum angle unit to obtain a mapped angle mode, and the mapped angle mode is used as the new intra-frame prediction mode. If the prediction mode is not an angle mode, a new intra-frame prediction mode is not determined.
[0357] In another possible implementation, the mode index number of the prediction mode is directly increased or decreased by 1. In this scenario, the following special cases exist: if the mode index number is 0, the prediction mode with the mode index number 1 is used as the new intra-frame prediction mode; if the mode index number is the maximum mode index number, the prediction mode corresponding to the maximum mode index number minus 1 is used as the new intra-frame prediction mode. If there is a single prediction mode, it is determined whether the single mode is an angle mode. If the single mode is an angle mode, the angle mode is used as the new intra-frame prediction mode; if the single mode is not an angle mode, the new intra-frame prediction mode is not determined.
[0358] S1630: Place at least one new intra prediction mode in the mode candidate list.
[0359] In the embodiment of the present application, when placing at least one new intra-frame prediction mode in the mode candidate list, it is necessary to ensure that the intra-frame prediction modes in the mode candidate list have different characteristics.
[0360] In an embodiment of the present application, after placing at least one new intra-frame prediction mode in the mode candidate list, the mode candidate list can be constructed by the new intra-frame prediction mode, or by the new intra-frame prediction mode and the reference intra-frame prediction mode parameters of at least one first target block, or by the new intra-frame prediction mode and the first color component prediction mode parameters of at least one second target block, or by the new intra-frame prediction mode, the reference intra-frame prediction mode parameters of at least one first target block and the first color component prediction mode parameters of at least one second target block. This embodiment of the present application is not limited to this.
[0361] It should be noted that the embodiment of the present application can determine at least one new intra-frame prediction mode by offsetting the mode index numbers of the first two prediction modes in the mode candidate list, and place the at least one new intra-frame prediction mode in the mode candidate list. This not only improves the completeness and diversity of intra-frame chroma prediction modes, but also improves the accuracy of intra-frame chroma prediction, thereby improving decoding efficiency and thus decoding performance.
[0362] It should also be noted that, in the embodiment of the present application, a preset intra-frame prediction mode can also be used to construct a mode candidate list. The preset intra-frame prediction mode can be at least one of the following: PLANAR_IDX, VER_IDX, HOR_IDX, DC_IDX, VDIA_IDX, VER_IDX-4, VER_IDX+4, HOR_IDX-4, HOR_IDX+4.
[0363] In an embodiment of the present application, a mode candidate list is constructed by constructing a mode candidate list through a pre-set intra-frame prediction mode, a mode candidate list is constructed through a new intra-frame prediction mode, a mode candidate list is constructed through the reference intra-frame prediction mode parameters of at least one first target block, and a candidate list is constructed through the first color component prediction mode of at least one second target block. These four methods of constructing a mode candidate list can be used alone or in combination, and the embodiment of the present application does not limit this.
[0364] It should be understood that in the embodiment of the present application, the prediction modes in the mode candidate list can be adjusted in order.
[0365] It should also be understood that in the embodiment of the present application, the intra-frame prediction modes in the mode candidate list have different characteristics.
[0366] The embodiment of the present application provides a decoding method, which can construct a mode candidate list through a pre-set intra-frame prediction mode, or through a new intra-frame prediction mode, or through the reference intra-frame prediction mode parameters of at least one first target block, or through the first color component prediction mode of at least one second target block. And these four methods of constructing the mode candidate list can be used alone or in combination. In this way, not only can the completeness and diversity of the intra-frame chroma prediction mode be improved, but also the accuracy of the intra-frame chroma prediction can be improved, thereby improving the decoding efficiency and thus improving the decoding performance.
[0367] In another embodiment of the present application, referring to FIG17 , which is applied to an encoder, a schematic flow chart of an encoding method provided by an embodiment of the present application is shown. As shown in FIG17 , the method may include:
[0368] S1710: Determine a reference block for the current block.
[0369] It should be noted that the encoding method of the embodiment of the present application is applied to an encoding device, or an encoding device integrated with the encoding device (also referred to as an "encoder"). In addition, the encoding method of the embodiment of the present application can specifically refer to an intra-frame prediction method. Assuming that the first color component is a luma component and the second color component is a chroma component, more specifically, this is a method for deriving an intra-frame chroma prediction mode.
[0370] It should also be noted that in the embodiments of this application, the current block may refer to the coding block in the video image currently undergoing intra-frame prediction. The reference block is a neighboring block of the current block; the term "neighboring" here can refer to spatial proximity, temporal proximity, or other similar terms, without specific limitation. Thus, when this method is applied to an encoder, the reference block of the current block may be a neighboring coded block of the current block.
[0371] Illustratively, in an embodiment of the present application, when the method is applied to an encoder, taking chroma component prediction as an example, the reference chroma block is the adjacent encoded chroma block of the current block.
[0372] S1720 : When the prediction mode of the second color component of the reference block satisfies the first condition, determine a reference intra-frame prediction mode parameter according to the reference block.
[0373] It should be noted that, in the embodiment of the present application, if the prediction mode of the second color component of the reference block meets the first condition, then the reference intra-frame prediction mode parameters can be derived based on the reference block.
[0374] In some embodiments, the first condition may include: the prediction mode of the second color component of the reference block is a first preset mode.
[0375] In a possible implementation, the first preset mode may be a non-angular prediction mode. Exemplarily, the first preset mode includes at least one of the following: an inter-component prediction mode, an IBC mode, a MIP mode, and a Palette mode.
[0376] Among them, the inter-component prediction mode can be the CCLM mode.
[0377] In another possible implementation, the first preset mode is an inter-frame prediction mode.
[0378] That is, in the embodiment of the present application, if the prediction mode of the second color component of the reference block is the first preset mode, such as the CCLM mode, then the reference intra-frame prediction mode parameters can be derived according to the reference block of the current block.
[0379] In some embodiments, the first condition may include: the prediction mode of the second color component of the reference block is not a second preset mode.
[0380] In yet another possible implementation, the second preset mode is an angle prediction mode.
[0381] In another possible implementation, the second preset mode is a traditional prediction mode. Exemplarily, the second preset mode may be a DC mode or a Planar mode.
[0382] That is to say, in an embodiment of the present application, if the prediction mode of the second color component of the reference block is not the second preset mode, such as the angle prediction mode, the DC mode or the Planar mode, then the reference frame intra-prediction mode parameters can also be derived based on the reference block of the current block.
[0383] In some embodiments, the first condition may include determining a first parameter, the first parameter indicating determining a reference intra-frame prediction mode parameter based on a reference block; wherein the method further includes: encoding the first parameter and writing the obtained coded bits into the bitstream.
[0384] It should also be understood that in the embodiment of the present application, the first parameter can also be written into the code stream, and then the decoding end determines the first parameter by decoding the code stream, and the first parameter indicates that the reference frame intra prediction mode parameter needs to be determined based on the reference block.
[0385] In some embodiments, determining the reference intra-frame prediction mode parameters based on the reference block may include: determining the reference pixel based on the reference block; determining the first parameter based on the reconstructed sample value of the reference pixel; and determining the reference intra-frame prediction mode parameters based on the first parameter.
[0386] In a specific embodiment, determining a reference pixel based on a reference block may include: determining a reference pixel based on pixels in an adjacent area of the reference block; wherein the adjacent area includes at least one of the following: a left adjacent area, an upper adjacent area, and an upper-left adjacent area.
[0387] In another specific embodiment, determining the reference pixel according to the reference block may include: determining the reference pixel according to pixels in the reference block.
[0388] Further, with respect to the first parameter, in some embodiments, determining the first parameter based on the reconstructed sample value of the reference pixel may include: performing gradient calculation on the reconstructed sample value of the reference pixel to determine the horizontal gradient value and the vertical gradient value of the reference pixel; performing angle mapping based on the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one intra-frame prediction mode corresponding to the reference pixel; performing gradient intensity calculation based on the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one gradient intensity value corresponding to the reference pixel; and determining the first parameter based on at least one intra-frame prediction mode and at least one gradient intensity value corresponding to the reference pixel.
[0389] In an embodiment of the present application, a reference pixel includes at least one candidate pixel, and each candidate pixel corresponds to an intra-frame prediction mode and a gradient strength value. Taking any candidate pixel as an example, in some embodiments, performing angle mapping based on the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one intra-frame prediction mode corresponding to the reference pixel may include: determining the absolute horizontal gradient value and the absolute vertical gradient value of the candidate pixel; performing angle mapping based on the absolute horizontal gradient value and the absolute vertical gradient value of the candidate pixel to determine an initial mode index value of the candidate pixel; and determining an intra-frame prediction mode corresponding to the candidate pixel based on the initial mode index value of the candidate pixel.
[0390] Furthermore, in some embodiments, determining an intra-frame prediction mode corresponding to the candidate pixel based on the initial mode index value of the candidate pixel may include: compensating the initial mode index value according to a preset angle compensation value to determine the target mode index value of the candidate pixel; and determining an intra-frame prediction mode corresponding to the candidate pixel based on the target mode index value of the candidate pixel.
[0391] Furthermore, in some embodiments, the method further includes: determining a target quadrant value of the candidate pixel; determining a value corresponding to the target quadrant value under a preset mapping relationship; and setting a preset angle compensation value to be equal to the value.
[0392] Furthermore, in some embodiments, determining the target quadrant value of a candidate pixel may include: determining a first symbol value based on the horizontal gradient value of the candidate pixel; and determining a second symbol value based on the vertical gradient value of the candidate pixel; determining a comparison value of the candidate pixel based on a comparison result of the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel; and performing quadrant mapping based on the comparison value, the first symbol value, and the second symbol value to determine the target quadrant value corresponding to the candidate pixel.
[0393] Further, in some embodiments, performing gradient strength calculation based on the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one gradient strength value corresponding to the reference pixel may include: performing an addition calculation based on the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel to determine a gradient strength value corresponding to the candidate pixel.
[0394] In the embodiment of the present application, the reconstructed sample value of the reference pixel includes at least one of the following: the reconstructed sample value of the first color component of the reference pixel; the reconstructed sample value of the second color component of the reference pixel.
[0395] Thus, with respect to the first parameter, in a specific embodiment, determining the first parameter based on the reconstructed sample value of the reference pixel may include: when the reconstructed sample value of the reference pixel is the reconstructed sample value of the first color component of the reference pixel, determining at least one intra-frame prediction mode and at least one gradient intensity value corresponding to the first color component of the reference pixel; when the reconstructed sample value of the reference pixel is the reconstructed sample value of the second color component of the reference pixel, determining at least one intra-frame prediction mode and at least one gradient intensity value corresponding to the second color component of the reference pixel; forming a first set based on the at least one intra-frame prediction mode corresponding to the first color component of the reference pixel and the at least one intra-frame prediction mode corresponding to the second color component of the reference pixel, wherein the first set includes at least one reference intra-frame prediction mode having mutually different characteristics; accumulating gradient intensity values belonging to the same reference intra-frame prediction mode based on the at least one gradient intensity value corresponding to the first color component of the reference pixel and the at least one gradient intensity value corresponding to the second color component of the reference pixel to determine the gradient intensity value corresponding to the at least one reference intra-frame prediction mode; and determining the first parameter based on the at least one reference intra-frame prediction mode and the gradient intensity value corresponding to the at least one reference intra-frame prediction mode.
[0396] Exemplarily, when the embodiments of the present application are applied to an encoder, the exemplary description of determining at least one intra-frame prediction mode and at least one gradient strength value corresponding to a reference pixel is similar to that on the decoder side and will not be repeated here.
[0397] In some embodiments, determining the reference intra-frame prediction mode parameters based on the first parameter may include: forming a second set based on the gradient strength values corresponding to at least one reference intra-frame prediction mode; if the gradient strength values in the second set are all zero, determining the reference intra-frame prediction mode parameters based on the PLANAR mode; if there are non-zero items in the gradient strength values in the second set, determining the maximum gradient strength value from the second set, and determining the reference intra-frame prediction mode parameters based on the intra-frame prediction mode corresponding to the maximum gradient strength value.
[0398] It should be noted that after determining the reference intra-frame prediction mode parameters according to the intra-frame prediction mode corresponding to the maximum gradient intensity value, the method may further include: assigning the maximum gradient intensity value in the second set to -1, and determining a third set; if the intra-frame prediction mode corresponding to the maximum gradient intensity value is the same as the first color component prediction mode of the first color component block at the same position of the reference block, then determining a new maximum gradient intensity value from the third set, and determining the reference intra-frame prediction mode parameters according to the intra-frame prediction mode corresponding to the new maximum gradient intensity value.
[0399] It should also be noted that after determining the reference intra-frame prediction mode parameters based on the intra-frame prediction mode corresponding to the new maximum gradient intensity value, the method may further include: if the intra-frame prediction mode corresponding to the new maximum gradient intensity value is the same as the first color component prediction mode of the first color component block at the same position of the reference block, then determining the reference intra-frame prediction mode parameters based on the DC mode.
[0400] S1730 , determining a prediction value of a second color component of the current block according to the reference intra-frame prediction mode parameter.
[0401] It should be noted that, in an embodiment of the present application, determining the predicted value of the second color component of the current block based on the prediction mode parameters within the reference frame may include: constructing a mode candidate list of the second color component of the current block based on the prediction mode parameters within the reference frame; and determining the predicted value of the second color component of the current block based on the mode candidate list.
[0402] In some embodiments, determining a reference block of the current block may include: determining at least one target pixel adjacent to the current block; determining at least one first target block based on the block where the at least one target pixel is located; and determining a reference block of the current block based on the at least one first target block.
[0403] It should be noted that in an embodiment of the present application, for these first target blocks, the method may also include: based on at least one first target block, using them as reference blocks in sequence according to a first preset order, determining the reference intra-frame prediction mode parameters of at least one first target block; and constructing a mode candidate list for the second color component of the current block based on the reference intra-frame prediction mode parameters of at least one first target block.
[0404] It should be understood that the first preset order can be set manually or according to a certain rule in a specific scenario, and the embodiments of the present application do not limit this.
[0405] In some embodiments, determining a reference block of the current block may also include: determining a first color component area at the same position as the current block; determining at least one second target block at a preset position from a plurality of blocks divided from the first color component area; and determining a reference block of the current block based on the at least one second target block.
[0406] It should also be noted that, in an embodiment of the present application, for these second target blocks, the method may further include: determining the first color component prediction mode parameters of at least one second target block in sequence based on a preset order of at least one second target block; and constructing a mode candidate list for the second color component of the current block based on the intra-reference frame prediction mode parameters of at least one first target block and the first color component prediction mode parameters of at least one second target block.
[0407] Furthermore, after determining the mode candidate list, in some embodiments, the method may also include: determining the first two prediction modes in the mode candidate list; performing an offset operation on the mode index numbers of the first two prediction modes to determine at least one new intra-frame prediction mode; and placing at least one new intra-frame prediction mode in the mode candidate list.
[0408] Furthermore, after determining the mode candidate list, in some embodiments, the method may further include: adjusting the order of the prediction modes in the mode candidate list.
[0409] Further, in some embodiments, determining the predicted value of the second color component of the current block based on the pattern candidate list may include: determining the target prediction mode of the second color component of the current block based on the pattern candidate list; and performing prediction processing on the second color component of the current block using the target prediction mode to determine the predicted value of the second color component of the current block.
[0410] In a specific embodiment, determining a target prediction mode for the second color component of the current block based on a mode candidate list may include: pre-encoding the second color component of the current block based on at least one candidate prediction mode in the mode candidate list, and determining a pre-encoding result for each of the at least one candidate prediction mode; determining a rate-distortion cost value for each of the at least one candidate prediction mode based on the pre-encoding result for each of the at least one candidate prediction mode; determining a minimum rate-distortion cost value from the rate-distortion cost values for each of the at least one candidate prediction mode, and determining the candidate prediction mode corresponding to the minimum rate-distortion cost value as the target prediction mode for the second color component of the current block.
[0411] In an embodiment of the present application, for at least one candidate prediction mode in the mode candidate list, the distortion value of each of the at least one candidate prediction mode can be determined. In a specific embodiment, the distortion value can be determined based on the cost result of Rate Distortion Optimization (RDO), the cost result of Sum of Absolute Difference (SAD), or even the cost result of Sum of Absolute Transformed Difference (SATD), but this is not limited to any particular embodiment.
[0412] For example, taking the rate-distortion cost value as an example, the rate-distortion cost value of each of the at least one candidate prediction mode can be determined based on the pre-encoding results of each of the at least one candidate prediction mode; then the minimum rate-distortion cost value is selected therefrom, and the candidate prediction mode corresponding to the minimum rate-distortion cost value is determined as the target prediction mode (i.e., the optimal prediction mode), thereby improving the encoding efficiency of the second color component.
[0413] In some embodiments, the method may further include: determining a mode index number corresponding to the target prediction mode according to the mode candidate list; encoding the mode index number, and writing the obtained encoded bits into the bitstream.
[0414] For example, referring to Table 4, truncated unary codes are used for binarization, and each pattern index number can be encoded using either a context model or bypass coding.
[0415] Table 4
[0416]
[0417] S1740 , determining a prediction difference value of the second color component of the current block according to the prediction value of the second color component of the current block.
[0418] It should be noted that determining the predicted difference value of the second color component of the current block based on the predicted value of the second color component of the current block may include: determining the predicted difference value of the second color component of the current block based on the original value of the second color component of the current block and the predicted value of the second color component of the current block.
[0419] Furthermore, in some embodiments, the method may further include: encoding the predicted difference value of the second color component of the current block, and writing the obtained encoded bits into the bitstream.
[0420] In an embodiment of the present application, after determining the predicted value of the second color component of the current block, a subtraction operation can be performed on the original value of the second color component of the current block and the predicted value of the second color component of the current block to obtain the predicted difference value of the second color component of the current block, which is then written into the code stream.
[0421] It should also be noted that an embodiment of the present application also provides a code stream, which is generated by bit encoding based on the information to be encoded; wherein the information to be encoded may include at least one of the following: the predicted difference value of the second color component of the current block, the mode index number and the first parameter.
[0422] In an embodiment of the present application, after determining the predicted difference value, mode index number, and first parameter of the second color component of the current block, the encoder can encode this information and write it into a bitstream, which is then transmitted to the decoder via the bitstream. This allows the decoder to subsequently directly determine information such as the predicted difference value, mode index number, and first parameter of the second color component of the current block by decoding the bitstream, thereby improving decoding efficiency.
[0423] The present application provides an encoding method that considers adjacent coded chroma block prediction modes when determining non-CCLM reference intra-frame prediction mode parameters. This not only improves the completeness and diversity of intra-frame chroma prediction modes, but also improves the accuracy of intra-frame chroma prediction, thereby improving encoding efficiency and, in turn, performance.
[0424] In another embodiment of the present application, when the chroma prediction mode of the adjacent coded block is the CCLM mode, the adjacent coded block still has its own texture content characteristics and spatial correlation with the current block, and the reconstructed luminance information and reconstructed chroma information of the adjacent coded block are both encoded reconstruction information. Therefore, the embodiment of the present application proposes a derivation technology of the LM mode (Linear Model-Derived Mode, LM-DM) using this reconstruction information. Here, in order to better predict chroma, multiple prediction modes can be added through a derivation process to supplement the completeness of the existing optional chroma prediction modes.
[0425] For example, the original five non-CCLM modes are replaced with MaxChromaCandidateListNum chroma prediction modes. These MaxChromaCandidateListNum chroma prediction modes can be added sequentially in a preset order, ensuring the mutual differences between the chroma prediction modes. MaxChromaCandidateListNum refers to a preset number, indicating the maximum number of modes that can be stored in the chroma candidate list. For example, a chroma candidate list of length MaxChromaCandidateListNum can be first established, and then each mode can be added to the chroma candidate list sequentially in a preset order.
[0426] In addition, after the chroma candidate list is built, it may also be adjusted (including adjustments to the order and mode). Specifically, it can be divided into three situations:
[0427] (1) If the chroma candidate list is constructed in a preset order and does not need to be adjusted after construction, the encoder needs to construct the chroma candidate list, and the decoder only needs to construct a pattern to obtain the chroma candidate list index for bitstream transmission;
[0428] (2) If the chroma candidate list is constructed in a preset order and needs to be adjusted after construction, both the encoder and decoder need to construct a complete chroma candidate list, and after the adjustment, the decoder selects the mode corresponding to the chroma candidate list index transmitted in the bitstream;
[0429] (3) For the encoding end in (1), a complete chroma candidate list needs to be constructed for rate-distortion optimization, but there may be a fast algorithm, including but not limited to performing rate-distortion optimization only on the first few modes. In this case, the encoding end does not need to construct a chroma candidate list for all modes.
[0430] In a specific embodiment, taking the decoding end as an example, MaxChromaCandidateListNum chroma prediction modes may be added sequentially according to the following preset order.
[0431] It should be understood that the following preset order is only an example, and the preset order for adding the chroma prediction mode includes but is not limited to the order described below.
[0432] (1) According to the position shown in Figure 3, the intra-frame luminance prediction mode of the CU where the C, TL, TR, BL, and BR of the co-located luminance block (the entire slash filled area in the left figure) corresponding to the current chroma decoding block (the entire slash filled area in the right figure) is located is added to the chroma candidate list in order.
[0433] The detailed position derivation process of C, TL, TR, BL, and BR is given below:
[0434] Assume that the position of the co-located luminance block corresponding to the upper left corner of the current chroma decoding block relative to the luminance block in the upper left corner of the image (that is, the position of the luminance block TL) is (xCb, yCb), and the width of the co-located luminance block corresponding to the current chroma decoding block (the entire filled area of the diagonal line in the left figure) is cbWidth, and the height is cbHeight.
[0435] The coordinate information of block C is (xCb+cbWidth / 2,yCb+cbHeight / 2);
[0436] The coordinate information of the TL block is (xCb, yCb);
[0437] The coordinate information of the TR block is (xCb+cbWidth-1,yCb);
[0438] The coordinate information of the BL block is (xCb, yCb+cbHeight-1);
[0439] The coordinate information of the BR block is (xCb+cbWidth-1, yCb+cbHeight-1).
[0440] The specific derivation rules of the brightness prediction mode of the same-position brightness block are as follows:
[0441] If the tree type is divided into a single tree type, see FIG4 , the luminance prediction mode of the CU where C is located can be added to the chrominance candidate list.
[0442] If the tree type is dual tree type, refer to Figure 3 and perform the following operations:
[0443] Taking the derivation of the luma prediction mode of block C as an example, assuming that the position of the co-located luma block corresponding to the upper left corner of the current chroma decoding block relative to the luma block in the upper left corner of the image (i.e., the position of luma block TL) is (xCb, yCb), and the width of the co-located luma block corresponding to the current chroma decoding block (the entire filled area of the diagonal line in the left figure) is cbWidth, and the height is cbHeight. The luma prediction mode lumaIntraPredMode of block C is deduced as follows:
[0444] First, determine whether the C block in Figure 3 uses the MIP mode. The position information of the C block is (xCb+cbWidth / 2, yCb+cbHeight / 2).
[0445] If IntraMipFlag[xCb+cbWidth / 2][yCb+cbHeight / 2] is 1, lumaIntraPredMode=INTRA_PLANAR.
[0446] Among them, the array IntraMipFlag[x][y] refers to whether the decoding block containing the coordinates (x, y) uses the MIP mode.
[0447] Secondly, if CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] is MODE_IBC or MODE_PLT, then lumaIntraPredMode=INTRA_DC.
[0448] Among them, the array CuPredMode[chType][x][y] refers to the intra-frame prediction mode used by the luminance or chrominance decoding block containing the coordinates (x, y), chType is 0 for luminance, and chType is 1 for chrominance.
[0449] otherwise,
[0450] lumaIntraPredMode=IntraPredModeY[xCb+cbWidth / 2][yCb+cbHeight / 2].
[0451] The array IntraPredModeY[x][y] refers to the intra prediction mode used by the decoded block containing the coordinates (x, y).
[0452] In some embodiments, referring to Table 2, the specific derivation rules for converting the luma prediction mode of the co-located luma block into the chroma prediction mode are as follows:
[0453] When sps_chroma_format_idc is 0, the chroma intra prediction mode does not need to be used, so this derivation rule does not exist;
[0454] When sps_chroma_format_idc is 2, mode X of the intra-frame luma prediction mode lumaIntraPredMode specified in Table 3 is used to derive mode Y of the intra-frame chroma prediction mode;
[0455] Otherwise, the intra chroma prediction mode is equal to the intra luma prediction mode lumaIntraPredMode.
[0456] (2) According to the positions shown in FIG5 , the intra-frame chroma prediction modes of the decoded chroma blocks at positions 0, 1, 2, 3, and 4 adjacent to the current chroma decoding block are added in sequence.
[0457] The detailed position derivation process of the adjacent chroma pixels 0, 1, 2, 3, and 4 is explained below:
[0458] Assume that the position of the upper left chroma pixel of the current chroma decoding block relative to the upper left chroma pixel of the image is (xCb, yCb), the width of the current chroma decoding block is cbWidth, and the height is cbHeight.
[0459] The position information of chroma pixel 0 is (xCb-1, yCb+cbHeight-1);
[0460] The position information of chroma pixel 1 is (xCb+cbWidth-1,yCb-1);
[0461] The position information of chroma pixel 2 is (xCb-1, yCb+cbHeight);
[0462] The position information of chroma pixel 3 is (xCb+cbWidth, yCb-1);
[0463] The position information of the chroma pixel 4 is (xCb-1, yCb-1).
[0464] In some embodiments, the specific rules for converting the chroma prediction mode of the adjacent decoded chroma block to the traditional chroma prediction mode are as follows:
[0465] When the prediction mode of the adjacent decoded chroma block is inter mode, no addition operation is performed;
[0466] When the chroma prediction mode of the adjacent decoded chroma block is CCLM, the LM mode derivation process (Linear Model-Derived Mode, LM-DM) is performed;
[0467] Otherwise, the intra chroma prediction mode of the neighboring decoded chroma block is directly added.
[0468] (3) Add the patterns with pattern index +1 or -1 of the first two patterns added in the above steps (1) and (2). There are two ways here: the first is to determine whether the pattern is an angle pattern. If it is an angle pattern, add the angle pattern mapped by the angle pattern with a minimum angle unit offset clockwise or counterclockwise. If the pattern is not an angle pattern, do nothing. The second is to directly add 1 or -1 to the corresponding pattern index value: if the pattern index value is 0, only add the pattern with pattern index 1; if the pattern index value is the maximum pattern index, only add the pattern with pattern index -1 of the maximum pattern index. If there is only one pattern, only add the two angle patterns offset by the pattern. If it is not an angle pattern, do not execute step (3).
[0469] (4) A set of pre-set default non-CCLM mode chromaticity candidate lists are added (the default chromaticity candidate list includes but is not limited to the subsequent description form), and the modes in the chromaticity candidate list are PLANAR_IDX, VER_IDX, HOR_IDX, DC_IDX, VDIA_IDX, VER_IDX–4, VER_IDX+4, HOR_IDX–4, HOR_IDX+4.
[0470] In an embodiment of the present application, when the chroma prediction mode of the adjacent decoded chroma block is the CCLM mode, the LM-DM derivation process is executed, and the derivation process mainly includes the following three steps: the first step is to determine the template area and obtain the reconstructed pixels of the template area, the second step is to calculate the gradient mapping of the pixels obtained in the first step into an angle pattern and count it in the histogram, and the third step is to derive the LM-DM mode.
[0471] Assume that the coordinates of the upper left chroma pixel of the adjacent decoded chroma block relative to the upper left chroma pixel of the image are (xCbNb, yCbNb), the width of the chroma pixel size is CbNbWidth, and the height of the chroma pixel size is CbNbHeight. For example, if sps_chroma_format_idc is 1, that is, the YUV420 format, the width of the luma pixel size is 2×CbNbWidth, and the height of the luma pixel size is 2×CbNbHeight.
[0472] Step 1: Determine the template area and obtain the reconstructed pixels (i.e., input) of the template area.
[0473] Input: The chroma pixels in the adjacent area of the adjacent decoded chroma block are pC[x][y], where x∈[-3,CbNbWidth], y∈[-3,-1] and x∈[-3,-1], y∈[0,CbNbHeight], and the origin [0][0] is the coordinate of the chroma pixel in the upper left corner of the block. The co-located luma pixels in the adjacent area of the adjacent decoded chroma block are pY[x][y], where x∈[-3,2×CbNbWidth], y∈[-3,-1] and x∈[-3,-1], y∈[0,2×CbNbHeight], and the origin [0][0] is the coordinate of the luma pixel corresponding to the chroma pixel in the upper left corner of the block. The specific positions are shown as the circle pixels in Figure 10A and the circle pixels in Figure 10B.
[0474] Step 2: Calculate the gradient map of the pixels obtained in the first step into an angle pattern and store it in a histogram. For the specific pseudo code, please refer to the description above.
[0475] Taking one of the implementation methods as an example, the gradient intensity values iAmp of step (1) and step (2) are accumulated according to the corresponding intra-frame prediction mode ipm, and a histogram HOG is established with the intra-frame prediction mode ipm as the horizontal coordinate and the gradient intensity value iAmp as the vertical coordinate, as shown in Figure 14.
[0476] Step 3: Derive the model (i.e. output) of LM-DM.
[0477] Output: The intra-frame chroma prediction mode IntraPredModeD can be derived from LM-DM, and the mode index range is [0,66].
[0478] If the histogram HOG does not contain non-zero entries, IntraPredModeD=INTRA_PLANAR.
[0479] Otherwise, set IntraPredModeD=argmax i(HoG[i]) and set HoG[IntraPredModeD] to -1;
[0480] If IntraPredModeD is equal to the DM mode of the chroma block where (xCbNb, yCbNb) is located, the search is repeated and IntraPredModeD=argmax i(HoG[i]).
[0481] If IntraPredModeD continues to be equal to the DM mode of the chroma block where (xCbNb, yCbNb) is located, then IntraPredModeD=INTRA_DC.
[0482] In some embodiments, the template pixels in the adjacent area of the adjacent decoded block are still used for analysis. However, because the luma and chroma pixels within the block have also been reconstructed, the embodiments of the present application can also use all the internal pixels of the adjacent decoded block to derive the LM-DM pattern.
[0483] The detailed steps of the derivation process of LM-DM are as follows:
[0484] Assume that the coordinates of the upper left corner pixel position of the adjacent decoded chroma block relative to the upper left corner pixel position of the image are (xCbNb, yCbNb), the width of the chroma pixel size is CbNbWidth, and the height of the chroma pixel size is CbNbHeight. For example, if sps_chroma_format_idc is 1, that is, the YUV420 format, the width of the luma pixel size is 2×CbNbWidth, and the height of the luma pixel size is 2×CbNbHeight.
[0485] Step 1: Determine the template area and obtain the reconstructed pixels (i.e., input) of the template area.
[0486] Input: The chroma pixel of the adjacent decoded chroma block is pC[x][y], where x∈[0,CbNbWidth-1], y∈[0,CbNbHeight-1], and the origin [0][0] is the coordinate of the chroma pixel at the top left corner of the block. The co-located luma pixel of the adjacent decoded chroma block is pY[x][y], where x∈[0,2×CbNbWidth-1], y∈[0,2×CbNbHeight-1], and the origin [0][0] is the coordinate of the luma pixel corresponding to the chroma pixel at the top left corner of the block. The specific positions are shown as the dot pixels in Figure 11A and the dot pixels in Figure 11B.
[0487] Step 2: Calculate the gradient mapping of the pixels obtained in the first step into an angle pattern and store it in a histogram. The specific pseudo code can be found in the description of the above content and will not be repeated here.
[0488] Step 3: Derive the model (i.e. output) of LM-DM.
[0489] Output: The intra-frame chroma prediction mode IntraPredModeD can be derived from LM-DM, and the mode index range is [0,66].
[0490] If the histogram HOG does not contain non-zero entries, IntraPredModeD=INTRA_PLANAR.
[0491] Otherwise, set IntraPredModeD=argmax i(HoG[i]) and set HoG[IntraPredModeD] to -1;
[0492] If IntraPredModeD is equal to the DM mode of the chroma block where (xCbNb, yCbNb) is located, the search is repeated and IntraPredModeD=argmax i(HoG[i]).
[0493] If IntraPredModeD continues to be equal to the DM mode of the chroma block where (xCbNb, yCbNb) is located, then IntraPredModeD=INTRA_DC.
[0494] In other embodiments, when all internal pixels of adjacent decoded blocks are used to derive the LM-DM pattern, the computational complexity increases as the number of luma and chroma pixels within the block increases. Therefore, to reduce complexity, embodiments of the present application may also use a portion of the internal pixels of adjacent decoded blocks for analysis.
[0495] Here, description is made by taking the adjacent chroma pixels located at chroma pixel 0 and chroma pixel 1 in FIG. 5 as examples.
[0496] (i) Taking the chroma pixel 0 in Figure 5 as an example, the detailed steps of the LM-DM derivation process are as follows:
[0497] Step 1: Determine the template area and obtain the reconstructed pixels (i.e., input) of the template area.
[0498] Input: The chroma pixel of the adjacent decoded chroma block is pC[x][y], where x∈[CbNbWidth-3,CbNbWidth-1], y∈[0,CbNbHeight-1], and the origin [0][0] is the coordinate of the chroma pixel at the top left corner of the block. The co-located luma pixel of the adjacent decoded chroma block is pY[x][y], where x∈[2×CbNbWidth-3,2×CbNbWidth-1], y∈[0,2×CbNbHeight-1], and the origin [0][0] is the coordinate of the luma pixel corresponding to the chroma pixel at the top left corner of the block. The specific positions are shown as the circle pixels in Figure 12A and the circle pixels in Figure 12B.
[0499] Step 2: Calculate the gradient map of the pixels obtained in the first step into an angle pattern and store it in a histogram. The specific pseudo code can be found in the above description and will not be repeated here.
[0500] Step 3: Derive the model (i.e. output) of LM-DM.
[0501] (ii) Taking the chroma pixel 1 in FIG5 as an example, the detailed steps of the LM-DM derivation process are as follows:
[0502] Step 1: Determine the template area and obtain the reconstructed pixels (i.e., input) of the template area.
[0503] Input: The chroma pixel of the adjacent decoded chroma block is pC[x][y], where x∈[0,CbNbWidth-1], y∈[CbNbHeight-3,CbNbHeight-1], and the origin [0][0] is the coordinate of the chroma pixel at the top left corner of the block. The co-located luma pixel of the adjacent decoded chroma block is pY[x][y], where x∈[0,2×CbNbWidth-1], y∈[2×CbNbHeight-3,2×CbNbHeight-1], and the origin [0][0] is the coordinate of the luma pixel corresponding to the chroma pixel at the top left corner of the block. The specific positions are shown as the dot pixels in Figure 13A and the dot pixels in Figure 13B.
[0504] Step 2: Calculate the gradient mapping of the pixels obtained in the first step into an angle pattern and store it in a histogram. The specific pseudo code can be found in the description of the above content and will not be repeated here.
[0505] Step 3: Derive the model (i.e. output) of LM-DM.
[0506] Output: The intra-frame chroma prediction mode IntraPredModeD can be derived from LM-DM, and the mode index range is [0,66].
[0507] If the histogram HOG does not contain non-zero entries, IntraPredModeD=INTRA_PLANAR.
[0508] Otherwise, set IntraPredModeD=argmax i(HoG[i]) and set HoG[IntraPredModeD] to -1;
[0509] If IntraPredModeD is equal to the DM mode of the chroma block where (xCbNb, yCbNb) is located, the search is repeated and IntraPredModeD=argmax i(HoG[i]).
[0510] If IntraPredModeD continues to be equal to the DM mode of the chroma block where (xCbNb, yCbNb) is located, then IntraPredModeD=INTRA_DC.
[0511] Simply put, in an embodiment of the present application, when the chroma prediction mode of the adjacent coded chroma block is the CCLM mode, the adjacent coded chroma block still has its own texture content characteristics and spatial correlation with the current coded block, and the reconstructed luminance information and reconstructed chroma information of the adjacent coded block are both coded and decoded reconstruction information. Therefore, the embodiment of the present application uses the above-mentioned reconstruction information to derive the LM-DM mode.
[0512] It should also be noted that, in the embodiment of the present application, the derivation method of the non-CCLM mode of the intra-frame chroma block in the LM-DM mode may include:
[0513] (1) Make full use of the content characteristics of the encoded and decoded blocks to perform texture gradient analysis;
[0514] (2) Make full use of the high correlation between luminance and chrominance, and derive the non-CCLM mode through luminance and chrominance.
[0515] In the embodiment of the present application, the specific implementation of the aforementioned embodiment is described in detail through the above embodiment. It can be seen that according to the technical solution of the aforementioned embodiment, the embodiment of the present application can improve the completeness of the intra-frame chroma prediction mode. Among them, by performing texture gradient analysis on adjacent encoded chroma blocks and luminance blocks, a gradient histogram with entries corresponding to multiple angle modes is constructed, and by using horizontal and vertical Sobel filters to calculate the pure horizontal and vertical intensities of the template area respectively, the angle mode is determined and the amplitude is updated to obtain the optimal non-CCLM mode. In the case of different content characteristics of the current encoded and decoded blocks, the embodiment of the present application can further improve the diversity of the intra-frame chroma prediction mode, thereby obtaining a more accurate chroma prediction value.
[0516] In another embodiment of the present application, see FIG18 , which shows a schematic diagram of the structure of an encoder provided by an embodiment of the present application. As shown in FIG18 , the encoder 1800 may include: a first determination unit 1810 and a first prediction unit 1820; wherein,
[0517] A first determining unit 1810 is configured to determine a reference block for a current block, wherein the reference block is a neighboring block of the current block; and when a prediction mode of a second color component of the reference block satisfies a first condition, determine a reference intra prediction mode parameter based on the reference block;
[0518] A first prediction unit 1820 is configured to determine a predicted value of a second color component of a current block according to a reference intra prediction mode parameter;
[0519] The first determining unit 1810 is further configured to determine a predicted difference value of the second color component of the current block according to the predicted value of the second color component of the current block.
[0520] In some embodiments, the first condition includes: the prediction mode of the second color component of the reference block is a first preset mode.
[0521] In some embodiments, the first preset mode includes at least one of the following: inter-component prediction mode, IBC mode, MIP mode, and Palette mode.
[0522] In some embodiments, the inter-component prediction mode is CCLM mode.
[0523] In some embodiments, the first preset mode is an inter prediction mode.
[0524] In some embodiments, the first condition includes: the prediction mode of the second color component of the reference block is not a second preset mode.
[0525] In some embodiments, the second preset mode is an angle prediction mode.
[0526] In some embodiments, the second preset mode is a DC mode or a Planar mode.
[0527] In some embodiments, the first condition includes determining a first parameter, the first parameter indicating determining a reference intra prediction mode parameter according to the reference block.
[0528] In some embodiments, referring to FIG. 18 , the encoder 1800 may further include an encoding unit 1830 configured to encode the first parameter and write the obtained encoded bits into a bitstream.
[0529] In some embodiments, referring to FIG. 18 , the encoder 1800 may further include a first construction unit 1840 ; wherein,
[0530] A first constructing unit 1840 is configured to construct a mode candidate list for the second color component of the current block according to the reference intra prediction mode parameter;
[0531] The first prediction unit 1820 is further configured to determine a prediction value of the second color component of the current block according to the mode candidate list.
[0532] In some embodiments, the first determination unit 1810 is further configured to determine a reference pixel based on a reference block; determine a first parameter based on a reconstructed sample value of the reference pixel; and determine a reference intra-frame prediction mode parameter based on the first parameter.
[0533] In some embodiments, the first determination unit 1810 is further configured to determine the reference pixel based on pixels in an adjacent area of the reference block; wherein the adjacent area includes at least one of the following: a left adjacent area, an upper adjacent area, and an upper-left adjacent area.
[0534] In some embodiments, the first determining unit 1810 is further configured to determine the reference pixel according to the pixels in the reference block.
[0535] In some embodiments, the first determination unit 1810 is further configured to perform gradient calculation on the reconstructed sample value of the reference pixel to determine the horizontal gradient value and the vertical gradient value of the reference pixel; perform angle mapping based on the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one intra-frame prediction mode corresponding to the reference pixel; perform gradient intensity calculation based on the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one gradient intensity value corresponding to the reference pixel; and determine the first parameter based on at least one intra-frame prediction mode and at least one gradient intensity value corresponding to the reference pixel.
[0536] In some embodiments, the reference pixel includes at least one candidate pixel, and each candidate pixel corresponds to an intra-frame prediction mode and a gradient strength value; the first determination unit 1810 is further configured to determine the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel; perform angle mapping based on the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel to determine the initial mode index value of the candidate pixel; and determine an intra-frame prediction mode corresponding to the candidate pixel based on the initial mode index value of the candidate pixel.
[0537] In some embodiments, the first determination unit 1810 is further configured to compensate the initial mode index value according to a preset angle compensation value to determine the target mode index value of the candidate pixel; and determine an intra-frame prediction mode corresponding to the candidate pixel according to the target mode index value of the candidate pixel.
[0538] In some embodiments, the first determining unit 1810 is further configured to determine a target quadrant value of the candidate pixel; determine a value corresponding to the target quadrant value under a preset mapping relationship; and set the preset angle compensation value to be equal to the value.
[0539] In some embodiments, the first determination unit 1810 is further configured to determine a first symbol value based on the horizontal gradient value of the candidate pixel; and determine a second symbol value based on the vertical gradient value of the candidate pixel; determine a comparison value of the candidate pixel based on a comparison result of the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel; and perform quadrant mapping based on the comparison value, the first symbol value, and the second symbol value to determine the target quadrant value corresponding to the candidate pixel.
[0540] In some embodiments, the first determining unit 1810 is further configured to perform an addition calculation based on the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel to determine a gradient intensity value corresponding to the candidate pixel.
[0541] In some embodiments, the reconstructed sample value of the reference pixel includes at least one of the following: a reconstructed sample value of a first color component of the reference pixel; and a reconstructed sample value of a second color component of the reference pixel.
[0542] In some embodiments, the first determining unit 1810 is further configured to, when the reconstructed sample value of the reference pixel is the reconstructed sample value of the first color component of the reference pixel, determine at least one intra-frame prediction mode and at least one gradient magnitude value corresponding to the first color component of the reference pixel; and, when the reconstructed sample value of the reference pixel is the reconstructed sample value of the second color component of the reference pixel, determine at least one intra-frame prediction mode and at least one gradient magnitude value corresponding to the second color component of the reference pixel;
[0543] The first constructing unit 1840 is further configured to form a first set based on at least one intra prediction mode corresponding to the first color component of the reference pixel and at least one intra prediction mode corresponding to the second color component of the reference pixel, wherein the first set includes at least one reference intra prediction mode having mutually different characteristics;
[0544] The first determination unit 1810 is further configured to perform cumulative calculation on the gradient intensity values belonging to the same reference intra-frame prediction mode based on at least one gradient intensity value corresponding to the first color component of the reference pixel and at least one gradient intensity value corresponding to the second color component of the reference pixel, to determine the gradient intensity value corresponding to at least one reference intra-frame prediction mode; and determine the first parameter based on the at least one reference intra-frame prediction mode and the gradient intensity value corresponding to the at least one reference intra-frame prediction mode.
[0545] In some embodiments, the first determination unit 1810 is further configured to form a second set based on gradient strength values corresponding to at least one reference intra-frame prediction mode; and if the gradient strength values in the second set are all zero, determine the reference intra-frame prediction mode parameters according to the PLANAR mode; if there is a non-zero item in the gradient strength values in the second set, determine the maximum gradient strength value from the second set, and determine the reference intra-frame prediction mode parameters according to the intra-frame prediction mode corresponding to the maximum gradient strength value.
[0546] In some embodiments, the first determination unit 1810 is further configured to assign the maximum gradient strength value in the second set to -1 to determine the third set; if the intra-frame prediction mode corresponding to the maximum gradient strength value is the same as the first color component prediction mode of the first color component block at the same position of the reference block, then determine a new maximum gradient strength value from the third set, and determine the reference intra-frame prediction mode parameters according to the intra-frame prediction mode corresponding to the new maximum gradient strength value.
[0547] In some embodiments, the first determination unit 1810 is further configured to determine the reference intra-frame prediction mode parameters according to the DC mode if the intra-frame prediction mode corresponding to the new maximum gradient magnitude value is the same as the first color component prediction mode of the first color component block at the same position of the reference block.
[0548] In some embodiments, the first determination unit 1810 is further configured to determine at least one target pixel adjacent to the current block; determine at least one first target block based on the block where the at least one target pixel is located; and determine a reference block of the current block based on the at least one first target block.
[0549] In some embodiments, the first determining unit 1810 is further configured to determine a reference intra prediction mode parameter of each of the at least one first target block based on the at least one first target block, sequentially serving as reference blocks in a first preset order;
[0550] The first constructing unit 1840 is further configured to construct a mode candidate list for the second color component of the current block according to the reference intra prediction mode parameters of the at least one first target block.
[0551] In some embodiments, the first determination unit 1810 is further configured to determine a first color component area at the same position as the current block; determine at least one second target block at a preset position from at least one block divided from the first color component area; and determine a reference block of the current block based on the at least one second target block.
[0552] In some embodiments, the first determination unit 1810 is further configured to determine, in sequence, the first color component prediction mode parameters of at least one second target block based on a preset order of at least one second target block; the first construction unit 1840 is further configured to construct a mode candidate list for the second color component of the current block based on the reference frame intra-prediction mode parameters of at least one first target block and the first color component prediction mode parameters of at least one second target block.
[0553] In some embodiments, the first determination unit 1810 is further configured to determine the first two prediction modes in the mode candidate list; perform an offset operation on the mode index numbers of the first two prediction modes to determine at least one new intra-frame prediction mode; and place the at least one new intra-frame prediction mode in the mode candidate list.
[0554] In some embodiments, referring to FIG. 18 , the encoder 1800 may further include a first adjustment unit 1850 configured to sequentially adjust the prediction modes in the mode candidate list.
[0555] In some embodiments, the first determination unit 1810 is further configured to determine a target prediction mode for the second color component of the current block based on a mode candidate list; the first prediction unit 1820 is further configured to perform prediction processing on the second color component of the current block using the target prediction mode to determine a predicted value of the second color component of the current block.
[0556] In some embodiments, the encoding unit 1830 is further configured to pre-encode the second color component of the current block according to at least one candidate prediction mode in the mode candidate list, and determine a pre-encoding result of each of the at least one candidate prediction mode;
[0557] The first determination unit 1810 is further configured to determine a rate-distortion cost value of each of at least one candidate prediction mode based on a pre-encoding result of each of the at least one candidate prediction mode; determine a minimum rate-distortion cost value from the rate-distortion cost values of each of the at least one candidate prediction mode, and determine the candidate prediction mode corresponding to the minimum rate-distortion cost value as the target prediction mode for the second color component of the current block.
[0558] In some embodiments, the first determining unit 1810 is further configured to determine a mode index number corresponding to the target prediction mode according to the mode candidate list;
[0559] The encoding unit 1830 is further configured to encode the mode index sequence number and write the obtained encoded bits into the bitstream.
[0560] In some embodiments, the first determining unit 1810 is further configured to determine a predicted difference value of the second color component of the current block based on the original value of the second color component of the current block and the predicted value of the second color component of the current block;
[0561] The encoding unit 1830 is further configured to encode the predicted difference value of the second color component of the current block, and write the obtained encoded bits into the bitstream.
[0562] It is understandable that in the embodiments of the present application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and of course it can also be a module, or it can be non-modular. Moreover, the various components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional modules.
[0563] If the integrated unit is implemented as a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, or the portion that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0564] Therefore, an embodiment of the present application provides a computer-readable storage medium, which is applied to the encoder 1800. The computer-readable storage medium stores a computer program, and when the computer program is executed by the first processor, it implements the method described in any one of the aforementioned embodiments.
[0565] Based on the composition of the encoder 1800 and the computer-readable storage medium, refer to Figure 19, which shows a specific hardware structure diagram of the encoder 1800 provided in an embodiment of the present application. As shown in Figure 19, the encoder 1800 may include: a first communication interface 1910, a first memory 1920 and a first processor 1930; each component is coupled together through a first bus system 1940. It can be understood that the first bus system 1940 is used to achieve connection and communication between these components. In addition to the data bus, the first bus system 1940 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are labeled as the first bus system 1940 in Figure 19. Among them,
[0566] The first communication interface 1910 is used to receive and send signals when sending and receiving information with other external network elements;
[0567] A first memory 1920 is used to store computer programs that can be run on the first processor 1930;
[0568] The first processor 1930 is configured to, when running the computer program, execute:
[0569] Determine a reference block for the current block; wherein the reference block is an adjacent block of the current block; when a prediction mode of a second color component of the reference block satisfies a first condition, determine a reference intra-frame prediction mode parameter based on the reference block; determine a prediction value of the second color component of the current block based on the reference intra-frame prediction mode parameter; and determine a prediction difference value of the second color component of the current block based on the prediction value of the second color component of the current block.
[0570] It is understood that the first memory 1920 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The first memory 1920 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0571] The first processor 1930 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in the first processor 1930. The above-mentioned first processor 1930 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the first memory 1920 , and the first processor 1930 reads the information in the first memory 1920 and completes the steps of the above method in combination with its hardware.
[0572] It is to be understood that these embodiments described in the present application can be implemented with hardware, software, firmware, middleware, microcode or its combination.For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processor (Digital Signal Processing, DSP), digital signal processing equipment (DSP Device, DSPD), programmable logic device (Programmable Logic Device, PLD), field programmable gate array (Field-Programmable Gate Array, FPGA), general-purpose processor, controller, microcontroller, microprocessor, other electronic units for performing functions described in the present application or its combination.For software implementation, the technology described in the present application can be realized by the module (such as process, function etc.) that performs 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.
[0573] Optionally, as another embodiment, the first processor 1930 is further configured to execute the method described in any one of the aforementioned embodiments when running the computer program.
[0574] This embodiment provides an encoder in which non-CCLM reference intra-frame prediction mode parameters are determined by performing relevant parameter analysis on reference blocks adjacent to a current block. Based on these reference intra-frame prediction mode parameters, the completeness and diversity of intra-frame chroma prediction modes can be improved, thereby improving the accuracy of intra-frame chroma prediction, and also improving coding efficiency, thereby enhancing coding performance.
[0575] In another embodiment of the present application, see FIG20 , which shows a schematic diagram of the structure of a decoder provided by an embodiment of the present application. As shown in FIG20 , the decoder 2000 may include: a second determination unit 2010 and a second prediction unit 2020; wherein,
[0576] The second determining unit 2010 is configured to determine a reference block for the current block, wherein the reference block is a neighboring block of the current block; and when the prediction mode of the second color component of the reference block satisfies a first condition, determine a reference intra-frame prediction mode parameter according to the reference block;
[0577] The second prediction unit 2020 is configured to determine a prediction value of a second color component of the current block according to a reference intra-frame prediction mode parameter.
[0578] In some embodiments, the first condition includes: the prediction mode of the second color component of the reference block is a first preset mode.
[0579] In some embodiments, the first preset mode includes at least one of the following: inter-component prediction mode, IBC mode, MIP mode, and Palette mode.
[0580] In some embodiments, the inter-component prediction mode is CCLM mode.
[0581] In some embodiments, the first preset mode is an inter prediction mode.
[0582] In some embodiments, the first condition includes: the prediction mode of the second color component of the reference block is not a second preset mode.
[0583] In some embodiments, the second preset mode is an angle prediction mode.
[0584] In some embodiments, the second preset mode is a DC mode or a Planar mode.
[0585] In some embodiments, the first condition includes: decoding a code stream and determining a first parameter; wherein the first parameter indicates determining a reference intra-frame prediction mode parameter according to a reference block.
[0586] In some embodiments, referring to FIG. 20 , the decoder 2000 may further include a second constructing unit 2030 , wherein:
[0587] A second constructing unit 2030 is configured to construct a mode candidate list for the second color component of the current block according to the reference intra prediction mode parameter;
[0588] The second prediction unit 2020 is further configured to determine a predicted value of the second color component of the current block according to the mode candidate list.
[0589] In some embodiments, the second determination unit 2010 is further configured to determine a reference pixel based on the reference block; determine a first parameter based on the reconstructed sample value of the reference pixel; and determine a reference intra-frame prediction mode parameter based on the first parameter.
[0590] In some embodiments, the second determination unit 2010 is further configured to determine the reference pixel based on pixels in an adjacent area of the reference block; wherein the adjacent area includes at least one of the following: a left adjacent area, an upper adjacent area, and an upper-left adjacent area.
[0591] In some embodiments, the second determining unit 2010 is further configured to determine the reference pixel according to the pixels in the reference block.
[0592] In some embodiments, the second determination unit 2010 is further configured to perform gradient calculation on the reconstructed sample value of the reference pixel to determine the horizontal gradient value and the vertical gradient value of the reference pixel; perform angle mapping based on the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one intra-frame prediction mode corresponding to the reference pixel; perform gradient intensity calculation based on the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one gradient intensity value corresponding to the reference pixel; and determine the first parameter based on the at least one intra-frame prediction mode and the at least one gradient intensity value corresponding to the reference pixel.
[0593] In some embodiments, the reference pixel includes at least one candidate pixel, and each candidate pixel corresponds to an intra-frame prediction mode and a gradient strength value; the second determination unit 2010 is further configured to determine the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel; perform angle mapping based on the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel to determine the initial mode index value of the candidate pixel; and determine an intra-frame prediction mode corresponding to the candidate pixel based on the initial mode index value of the candidate pixel.
[0594] In some embodiments, the second determination unit 2010 is further configured to compensate the initial mode index value according to a preset angle compensation value to determine the target mode index value of the candidate pixel; and determine an intra-frame prediction mode corresponding to the candidate pixel according to the target mode index value of the candidate pixel.
[0595] In some embodiments, the second determining unit 2010 is further configured to determine a target quadrant value of the candidate pixel; determine a value corresponding to the target quadrant value under a preset mapping relationship; and set the preset angle compensation value to be equal to the value.
[0596] In some embodiments, the second determination unit 2010 is further configured to determine a first symbol value based on the horizontal gradient value of the candidate pixel; and determine a second symbol value based on the vertical gradient value of the candidate pixel; determine a comparison value of the candidate pixel based on a comparison result of the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel; and perform quadrant mapping based on the comparison value, the first symbol value, and the second symbol value to determine the target quadrant value corresponding to the candidate pixel.
[0597] In some embodiments, the second determining unit 2010 is further configured to perform an addition calculation based on the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel to determine a gradient intensity value corresponding to the candidate pixel.
[0598] In some embodiments, the reconstructed sample value of the reference pixel includes at least one of the following: a reconstructed sample value of a first color component of the reference pixel; and a reconstructed sample value of a second color component of the reference pixel.
[0599] In some embodiments, the second determining unit 2010 is further configured to, when the reconstructed sample value of the reference pixel is the reconstructed sample value of the first color component of the reference pixel, determine at least one intra-frame prediction mode and at least one gradient magnitude value corresponding to the first color component of the reference pixel; and, when the reconstructed sample value of the reference pixel is the reconstructed sample value of the second color component of the reference pixel, determine at least one intra-frame prediction mode and at least one gradient magnitude value corresponding to the second color component of the reference pixel;
[0600] The second constructing unit 2030 is further configured to form a first set based on at least one intra prediction mode corresponding to the first color component of the reference pixel and at least one intra prediction mode corresponding to the second color component of the reference pixel, wherein the first set includes at least one reference intra prediction mode having mutually different characteristics;
[0601] The second determining unit 2010 is further configured to accumulate gradient magnitude values belonging to the same reference intra prediction mode based on at least one gradient magnitude value corresponding to the first color component of the reference pixel and at least one gradient magnitude value corresponding to the second color component of the reference pixel, to determine a gradient magnitude value corresponding to at least one reference intra prediction mode;
[0602] The second determining unit 2010 is further configured to determine a first parameter according to the at least one reference intra-frame prediction mode and the gradient strength value corresponding to the at least one reference intra-frame prediction mode.
[0603] In some embodiments, the second determination unit 2010 is further configured to form a second set based on gradient strength values corresponding to at least one reference intra-frame prediction mode; and if the gradient strength values in the second set are all zero, determine the reference intra-frame prediction mode parameters according to the PLANAR mode; if there is a non-zero item in the gradient strength values in the second set, determine the maximum gradient strength value from the second set, and determine the reference intra-frame prediction mode parameters according to the intra-frame prediction mode corresponding to the maximum gradient strength value.
[0604] In some embodiments, the second determination unit 2010 is further configured to assign the maximum gradient strength value in the second set to -1 to determine the third set; if the intra-frame prediction mode corresponding to the maximum gradient strength value is the same as the first color component prediction mode of the first color component block at the same position of the reference block, then determine a new maximum gradient strength value from the third set, and determine the reference intra-frame prediction mode parameters according to the intra-frame prediction mode corresponding to the new maximum gradient strength value.
[0605] In some embodiments, the second determination unit 2010 is further configured to determine the reference intra-frame prediction mode parameters according to the DC mode if the intra-frame prediction mode corresponding to the new maximum gradient magnitude value is the same as the first color component prediction mode of the first color component block at the same position of the reference block.
[0606] In some embodiments, the second determination unit 2010 is further configured to determine at least one target pixel adjacent to the current block; determine at least one first target block based on the block where the at least one target pixel is located; and determine a reference block of the current block based on the at least one first target block.
[0607] In some embodiments, the second determination unit 2010 is further configured to determine the reference intra-frame prediction mode parameters of at least one first target block based on at least one first target block, which is used as a reference block in sequence according to a first preset order; the second construction unit 2030 is further configured to construct a mode candidate list for the second color component of the current block based on the reference intra-frame prediction mode parameters of at least one first target block.
[0608] In some embodiments, the second determination unit 2010 is further configured to determine a first color component area at the same position as the current block; determine at least one second target block at a preset position from at least one block divided from the first color component area; and determine a reference block of the current block based on the at least one second target block.
[0609] In some embodiments, the second determining unit 2010 is further configured to sequentially determine the first color component prediction mode parameter of each of the at least one second target block based on a preset order of the at least one second target block;
[0610] The second construction unit 2030 is further configured to construct a mode candidate list for the second color component of the current block according to the reference intra prediction mode parameters of at least one first target block and the first color component prediction mode parameters of at least one second target block.
[0611] In some embodiments, the second determination unit 2010 is further configured to determine the first two prediction modes in the mode candidate list; perform an offset operation on the mode index numbers of the first two prediction modes to determine at least one new intra-frame prediction mode; and place the at least one new intra-frame prediction mode in the mode candidate list.
[0612] In some embodiments, referring to FIG. 20 , the decoder 2000 may further include a second adjustment unit 2040 configured to sequentially adjust the prediction modes in the mode candidate list.
[0613] In some embodiments, referring to FIG. 20 , the decoder 2000 may further include a decoding unit 2050 configured to parse the bitstream and determine a mode index number of the second color component of the current block;
[0614] The second determining unit 2010 is further configured to determine the target prediction mode corresponding to the mode index number according to the mode candidate list;
[0615] The second prediction unit 2020 is further configured to perform prediction processing on the second color component of the current block using the target prediction mode to determine a predicted value of the second color component of the current block.
[0616] In some embodiments, the decoding unit 2050 is further configured to parse the code stream to determine the prediction difference value of the second color component of the current block;
[0617] The second determining unit 2010 is further configured to determine a reconstructed value of the second color component of the current block according to the predicted value of the second color component of the current block and the predicted difference value of the second color component of the current block.
[0618] It is understood that in this embodiment, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular system. Furthermore, the various components in this embodiment can be integrated into a single processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The aforementioned integrated units can be implemented in the form of hardware or software functional modules.
[0619] If the integrated unit is implemented as a software functional module and not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, this embodiment provides a computer-readable storage medium, which is used in decoder 2000 and stores a computer program. When the computer program is executed by the second processor, it implements any of the methods in the aforementioned embodiments.
[0620] Based on the composition of the decoder 2000 and the computer-readable storage medium, refer to Figure 21, which shows a specific hardware structure diagram of the decoder 2000 provided in an embodiment of the present application. As shown in Figure 21, the decoder 2000 may include: a second communication interface 2110, a second memory 2120 and a second processor 2130; each component is coupled together through a second bus system 2140. It can be understood that the second bus system 2140 is used to achieve connection and communication between these components. In addition to the data bus, the second bus system 2140 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are labeled as the second bus system 2140 in Figure 21. Among them,
[0621] The second communication interface 2110 is used to receive and send signals during the process of sending and receiving information between other external network elements;
[0622] The second memory 2120 is used to store computer programs that can be run on the second processor 2130;
[0623] The second processor 2130 is configured to, when running the computer program, execute:
[0624] Determine a reference block for the current block; wherein the reference block is an adjacent block of the current block; when a prediction mode of a second color component of the reference block satisfies a first condition, determine a reference intra-frame prediction mode parameter based on the reference block; and determine a prediction value of the second color component of the current block based on the reference intra-frame prediction mode parameter.
[0625] Optionally, as another embodiment, the second processor 2130 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.
[0626] It can be understood that the hardware functions of the second memory 2120 are similar to those of the first memory 1920, and the hardware functions of the second processor 2130 are similar to those of the first processor 1930; they will not be described in detail here.
[0627] This embodiment provides a decoder in which non-CCLM reference intra-frame prediction mode parameters are determined by performing relevant parameter analysis on reference blocks adjacent to a current block. Based on these reference intra-frame prediction mode parameters, the completeness and diversity of intra-frame chroma prediction modes can be improved, thereby improving the accuracy of intra-frame chroma prediction, and also improving decoding efficiency, thereby enhancing decoding performance.
[0628] In yet another embodiment of the present application, referring to FIG22 , a schematic diagram of the structure of a coding and decoding system provided by an embodiment of the present application is shown. As shown in FIG22 , the coding and decoding system 2200 may include an encoder 2210 and a decoder 2220 .
[0629] In the embodiment of the present application, the encoder 2210 may be the encoder described in any one of the aforementioned embodiments, and the decoder 2220 may be the decoder described in any one of the aforementioned embodiments.
[0630] It should be noted that, in this application, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0631] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0632] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0633] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0634] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0635] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims. Industrial Applicability
[0636] In an embodiment of the present application, at the decoding end, a reference block for the current block is determined; wherein the reference block is a neighboring block of the current block; when the prediction mode of the second color component of the reference block meets a first condition, reference intra-frame prediction mode parameters are determined based on the reference block; and a predicted value of the second color component of the current block is determined based on the reference intra-frame prediction mode parameters. At the encoding end, a reference block for the current block is determined; wherein the reference block is a neighboring block of the current block; when the prediction mode of the second color component of the reference block meets a first condition, reference intra-frame prediction mode parameters are determined based on the reference block; a predicted value of the second color component of the current block is determined based on the reference intra-frame prediction mode parameters; and a predicted difference value of the second color component of the current block is determined based on the predicted value of the second color component of the current block. In this way, by analyzing relevant parameters of the reference blocks adjacent to the current block, non-CCLM reference intra-frame prediction mode parameters can be determined; based on these reference intra-frame prediction mode parameters, the completeness and diversity of intra-frame chroma prediction modes can be improved, thereby improving the accuracy of intra-frame chroma prediction, and also improving encoding and decoding efficiency, thereby improving encoding and decoding performance.
Claims
1. A decoding method, applied to a decoder, comprising: Determining a reference block of a current block; wherein the reference block is a neighboring block of the current block; When the prediction mode of the second color component of the reference block satisfies a first condition, determining a reference intra-frame prediction mode parameter according to the reference block; Determine a predicted value of the second color component of the current block according to the reference intra-frame prediction mode parameter.
2. The method according to claim 1, wherein The first condition includes: the prediction mode of the second color component of the reference block is a first preset mode.
3. The method according to claim 2, wherein: The first preset mode includes at least one of the following: inter-component prediction mode, IBC mode, MIP mode and Palette mode.
4. The method according to claim 3, wherein: The inter-component prediction mode is the CCLM mode.
5. The method according to claim 2, wherein: The first preset mode is an inter-frame prediction mode.
6. The method according to claim 1, wherein The first condition includes: the prediction mode of the second color component of the reference block is not a second preset mode.
7. The method according to claim 6, wherein: The second preset mode is an angle prediction mode.
8. The method according to claim 6, wherein: The second preset mode is a DC mode or a Planar mode.
9. The method according to claim 1, wherein: The first condition includes: decoding a code stream and determining a first parameter; wherein the first parameter indicates determining a reference intra-frame prediction mode parameter based on the reference block.
10. The method according to claim 1, wherein The determining, according to the reference intra-frame prediction mode parameter, a predicted value of the second color component of the current block, comprises: constructing a mode candidate list for the second color component of the current block according to the reference intra-frame prediction mode parameter; Determine a predicted value of the second color component of the current block according to the mode candidate list.
11. The method according to claim 1, wherein The determining, according to the reference block, a reference intra-frame prediction mode parameter, includes: Determining a reference pixel according to the reference block; Determining a first parameter according to the reconstructed sample value of the reference pixel; Determine a reference intra-frame prediction mode parameter according to the first parameter.
12. The method according to claim 11, wherein The determining of the reference pixel according to the reference block includes: Determining the reference pixel based on pixels in an adjacent area of the reference block; The adjacent area includes at least one of the following: a left adjacent area, an upper adjacent area, and an upper-left adjacent area.
13. The method according to claim 11, wherein The determining of the reference pixel according to the reference block includes: The reference pixel is determined according to pixels in the reference block.
14. The method according to claim 11, wherein The determining of the first parameter according to the reconstructed sample value of the reference pixel includes: Performing gradient calculation on the reconstructed sample value of the reference pixel to determine the horizontal gradient value and the vertical gradient value of the reference pixel; Performing angle mapping according to a horizontal gradient value and a vertical gradient value of the reference pixel to determine at least one intra prediction mode corresponding to the reference pixel; Performing gradient intensity calculation based on the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one gradient intensity value corresponding to the reference pixel; The first parameter is determined according to at least one intra prediction mode and at least one gradient strength value corresponding to the reference pixel.
15. The method according to claim 14, wherein The reference pixel includes at least one candidate pixel, and each candidate pixel corresponds to an intra prediction mode and a gradient strength value; The performing angle mapping according to the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one intra prediction mode corresponding to the reference pixel includes: Determine the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel; Performing angle mapping according to the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel to determine the initial mode index value of the candidate pixel; An intra-frame prediction mode corresponding to the candidate pixel is determined according to the initial mode index value of the candidate pixel.
16. The method according to claim 15, wherein The determining, according to the initial mode index value of the candidate pixel, an intra prediction mode corresponding to the candidate pixel includes: Compensating the initial mode index value according to a preset angle compensation value to determine a target mode index value of the candidate pixel; An intra-frame prediction mode corresponding to the candidate pixel is determined according to the target mode index value of the candidate pixel.
17. The method according to claim 16, wherein The method further comprises: determining a target quadrant value for the candidate pixel; Determine the value corresponding to the target quadrant value under the preset mapping relationship; The preset angle compensation value is set to be equal to the value.
18. The method according to claim 17, wherein Determining the target quadrant value of the candidate pixel includes: determining a first symbol value according to a horizontal gradient value of the candidate pixel; and determining a second symbol value according to a vertical gradient value of the candidate pixel; Determining a comparison value of the candidate pixel according to a comparison result of the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel; Quadrant mapping is performed according to the comparison value, the first symbol value, and the second symbol value to determine a target quadrant value corresponding to the candidate pixel.
19. The method according to claim 15, wherein The performing gradient intensity calculation according to the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one gradient intensity value corresponding to the reference pixel includes: An addition calculation is performed according to the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel to determine a gradient intensity value corresponding to the candidate pixel.
20. The method according to claim 14, wherein The reconstructed sample value of the reference pixel includes at least one of the following: reconstructed sample values of the first color component of the reference pixel; A reconstructed sample of the second color component of the reference pixel.
21. The method according to claim 20, wherein The determining of the first parameter according to the reconstructed sample value of the reference pixel includes: When the reconstructed sample value of the reference pixel is a reconstructed sample value of a first color component of the reference pixel, determining at least one intra prediction mode and at least one gradient magnitude value corresponding to the first color component of the reference pixel; When the reconstructed sample value of the reference pixel is a reconstructed sample value of a second color component of the reference pixel, determining at least one intra prediction mode and at least one gradient magnitude value corresponding to the second color component of the reference pixel; forming a first set based on at least one intra prediction mode corresponding to the first color component of the reference pixel and at least one intra prediction mode corresponding to the second color component of the reference pixel, wherein the first set includes at least one reference intra prediction mode having mutually different characteristics; Accumulating gradient magnitude values belonging to the same reference intra prediction mode based on at least one gradient magnitude value corresponding to the first color component of the reference pixel and at least one gradient magnitude value corresponding to the second color component of the reference pixel to determine a gradient magnitude value corresponding to the at least one reference intra prediction mode; The first parameter is determined according to the at least one reference intra-frame prediction mode and a gradient strength value corresponding to the at least one reference intra-frame prediction mode.
22. The method according to claim 21, wherein The determining, according to the first parameter, a reference intra-frame prediction mode parameter includes: forming a second set according to the gradient strength values corresponding to the at least one reference intra-frame prediction mode; If all gradient strength values in the second set are zero, determining the reference frame intra prediction mode parameters according to the PLANAR mode; If there is a non-zero entry in the gradient strength value in the second set, a maximum gradient strength value is determined from the second set, and the reference intra-frame prediction mode parameter is determined according to the intra-frame prediction mode corresponding to the maximum gradient strength value.
23. The method according to claim 22, wherein The method further comprises: Assigning the maximum gradient strength value in the second set to -1 to determine a third set; If the intra-frame prediction mode corresponding to the maximum gradient strength value is the same as the first color component prediction mode of the first color component block at the same position of the reference block, a new maximum gradient strength value is determined from the third set, and the reference intra-frame prediction mode parameters are determined according to the intra-frame prediction mode corresponding to the new maximum gradient strength value.
24. The method according to claim 23, wherein The method further comprises: If the intra prediction mode corresponding to the new maximum gradient magnitude value is the same as the first color component prediction mode of the first color component block at the same position as the reference block, the reference intra prediction mode parameters are determined according to the DC mode.
25. The method according to claim 10, wherein The determining of a reference block for the current block includes: Determining at least one target pixel adjacent to the current block; Determining at least one first target block according to the block where each of the at least one target pixels is located; A reference block of the current block is determined according to the at least one first target block.
26. The method according to claim 25, wherein The method further comprises: Based on the at least one first target block, sequentially serving as the reference blocks in a first preset order, determining a reference intra-frame prediction mode parameter of each of the at least one first target block; A mode candidate list for the second color component of the current block is constructed according to the reference intra-frame prediction mode parameters of each of the at least one first target blocks.
27. The method according to claim 26, wherein The determining of the reference block of the current block further includes: Determining a first color component region at a same position as the current block; Determining at least one second target block at a preset position from at least one block divided by the first color component area; A reference block of the current block is determined according to the at least one second target block.
28. The method according to claim 27, wherein The method further comprises: Determining, in sequence, a first color component prediction mode parameter of each of the at least one second target block based on a preset order of the at least one second target block; A mode candidate list of the second color component of the current block is constructed according to the reference intra prediction mode parameters of the at least one first target block and the first color component prediction mode parameters of the at least one second target block.
29. The method according to claim 28, wherein The method further comprises: Determine the first two prediction modes in the mode candidate list; Performing an offset operation on the mode index numbers of the first two prediction modes to determine at least one new intra-frame prediction mode; The at least one new intra prediction mode is placed in the mode candidate list.
30. The method of claim 28, wherein The method further comprises: The prediction modes in the mode candidate list are sequentially adjusted.
31. The method according to claim 10, wherein The determining, according to the mode candidate list, a predicted value of the second color component of the current block, comprises: Parsing the code stream to determine the mode index number of the second color component of the current block; Determining the target prediction mode corresponding to the mode index number according to the mode candidate list; The target prediction mode is used to perform prediction processing on the second color component of the current block to determine a predicted value of the second color component of the current block.
32. The method according to claim 31, wherein The method further comprises: Parsing the code stream to determine a predicted difference value of the second color component of the current block; A reconstructed value of the second color component of the current block is determined according to the predicted value of the second color component of the current block and the predicted difference value of the second color component of the current block.
33. A coding method, applied to an encoder, comprising: Determining a reference block of a current block; wherein the reference block is a neighboring block of the current block; When the prediction mode of the second color component of the reference block satisfies a first condition, determining a reference intra-frame prediction mode parameter according to the reference block; determining a predicted value of a second color component of the current block according to the reference intra-frame prediction mode parameter; A prediction difference value of the second color component of the current block is determined according to the prediction value of the second color component of the current block.
34. The method according to claim 33, wherein The first condition includes: the prediction mode of the second color component of the reference block is a first preset mode.
35. The method according to claim 34, wherein The first preset mode includes at least one of the following: inter-component prediction mode, IBC mode, MIP mode and Palette mode.
36. The method according to claim 35, wherein The inter-component prediction mode is the CCLM mode.
37. The method of claim 34, wherein: The first preset mode is an inter-frame prediction mode.
38. The method of claim 33, wherein: The first condition includes: the prediction mode of the second color component of the reference block is not a second preset mode.
39. The method according to claim 38, wherein The second preset mode is an angle prediction mode.
40. The method of claim 38, wherein The second preset mode is a DC mode or a Planar mode.
41. The method of claim 33, wherein: The first condition includes determining a first parameter, the first parameter indicating determining a reference intra prediction mode parameter based on the reference block; The method further comprises: The first parameter is encoded, and the obtained encoded bits are written into a bitstream.
42. The method of claim 33, wherein: The determining, according to the reference intra-frame prediction mode parameter, a predicted value of the second color component of the current block, comprises: constructing a mode candidate list for the second color component of the current block according to the reference intra-frame prediction mode parameter; Determine a predicted value of the second color component of the current block according to the mode candidate list.
43. The method of claim 33, wherein: The determining, according to the reference block, a reference intra-frame prediction mode parameter, includes: Determining a reference pixel according to the reference block; Determining a first parameter according to the reconstructed sample value of the reference pixel; Determine a reference intra-frame prediction mode parameter according to the first parameter.
44. The method according to claim 43, wherein The determining of the reference pixel according to the reference block includes: Determining the reference pixel based on pixels in an adjacent area of the reference block; The adjacent area includes at least one of the following: a left adjacent area, an upper adjacent area, and an upper-left adjacent area.
45. The method of claim 43, wherein The determining of the reference pixel according to the reference block includes: The reference pixel is determined according to pixels in the reference block.
46. The method of claim 43, wherein The determining of the first parameter according to the reconstructed sample value of the reference pixel includes: Performing gradient calculation on the reconstructed sample value of the reference pixel to determine the horizontal gradient value and the vertical gradient value of the reference pixel; Performing angle mapping according to a horizontal gradient value and a vertical gradient value of the reference pixel to determine at least one intra prediction mode corresponding to the reference pixel; Performing gradient intensity calculation based on the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one gradient intensity value corresponding to the reference pixel; The first parameter is determined according to at least one intra prediction mode and at least one gradient strength value corresponding to the reference pixel.
47. The method of claim 46, wherein The reference pixel includes at least one candidate pixel, and each candidate pixel corresponds to an intra prediction mode and a gradient strength value; The performing angle mapping according to the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one intra prediction mode corresponding to the reference pixel includes: Determine the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel; Performing angle mapping according to the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel to determine the initial mode index value of the candidate pixel; An intra-frame prediction mode corresponding to the candidate pixel is determined according to the initial mode index value of the candidate pixel.
48. The method of claim 47, wherein The determining, according to the initial mode index value of the candidate pixel, an intra prediction mode corresponding to the candidate pixel includes: Compensating the initial mode index value according to a preset angle compensation value to determine a target mode index value of the candidate pixel; An intra-frame prediction mode corresponding to the candidate pixel is determined according to the target mode index value of the candidate pixel.
49. The method according to claim 48, wherein The method further comprises: determining a target quadrant value for the candidate pixel; Determine the value corresponding to the target quadrant value under the preset mapping relationship; The preset angle compensation value is set to be equal to the value.
50. The method of claim 49, wherein Determining the target quadrant value of the candidate pixel includes: determining a first symbol value according to a horizontal gradient value of the candidate pixel; and determining a second symbol value according to a vertical gradient value of the candidate pixel; Determining a comparison value of the candidate pixel according to a comparison result of the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel; Quadrant mapping is performed according to the comparison value, the first symbol value, and the second symbol value to determine a target quadrant value corresponding to the candidate pixel.
51. The method of claim 47, wherein: The performing gradient intensity calculation according to the horizontal gradient value and the vertical gradient value of the reference pixel to determine at least one gradient intensity value corresponding to the reference pixel includes: An addition calculation is performed according to the horizontal gradient absolute value and the vertical gradient absolute value of the candidate pixel to determine a gradient intensity value corresponding to the candidate pixel.
52. The method of claim 46, wherein The reconstructed sample value of the reference pixel includes at least one of the following: reconstructed sample values of the first color component of the reference pixel; A reconstructed sample of the second color component of the reference pixel.
53. The method of claim 52, wherein: The determining of the first parameter according to the reconstructed sample value of the reference pixel includes: When the reconstructed sample value of the reference pixel is a reconstructed sample value of a first color component of the reference pixel, determining at least one intra prediction mode and at least one gradient magnitude value corresponding to the first color component of the reference pixel; When the reconstructed sample value of the reference pixel is a reconstructed sample value of a second color component of the reference pixel, determining at least one intra prediction mode and at least one gradient magnitude value corresponding to the second color component of the reference pixel; forming a first set based on at least one intra prediction mode corresponding to the first color component of the reference pixel and at least one intra prediction mode corresponding to the second color component of the reference pixel, wherein the first set includes at least one reference intra prediction mode having mutually different characteristics; Accumulating gradient magnitude values belonging to the same reference intra prediction mode based on at least one gradient magnitude value corresponding to the first color component of the reference pixel and at least one gradient magnitude value corresponding to the second color component of the reference pixel to determine a gradient magnitude value corresponding to the at least one reference intra prediction mode; The first parameter is determined according to the at least one reference intra-frame prediction mode and a gradient strength value corresponding to the at least one reference intra-frame prediction mode.
54. The method of claim 53, wherein: The determining, according to the first parameter, a reference intra-frame prediction mode parameter includes: forming a second set according to the gradient strength values corresponding to the at least one reference intra-frame prediction mode; If all gradient strength values in the second set are zero, determining the reference frame intra prediction mode parameters according to the PLANAR mode; If there is a non-zero entry in the gradient strength value in the second set, a maximum gradient strength value is determined from the second set, and the reference intra-frame prediction mode parameter is determined according to the intra-frame prediction mode corresponding to the maximum gradient strength value.
55. The method of claim 54, wherein The method further comprises: Assigning the maximum gradient strength value in the second set to -1 to determine a third set; If the intra-frame prediction mode corresponding to the maximum gradient strength value is the same as the first color component prediction mode of the first color component block at the same position of the reference block, a new maximum gradient strength value is determined from the third set, and the reference intra-frame prediction mode parameters are determined according to the intra-frame prediction mode corresponding to the new maximum gradient strength value.
56. The method of claim 55, wherein: The method further comprises: If the intra prediction mode corresponding to the new maximum gradient magnitude value is the same as the first color component prediction mode of the first color component block at the same position as the reference block, the reference intra prediction mode parameters are determined according to the DC mode.
57. The method of claim 42, wherein: The determining of a reference block for the current block includes: Determining at least one target pixel adjacent to the current block; Determining at least one first target block according to the block where each of the at least one target pixels is located; A reference block of the current block is determined according to the at least one first target block.
58. The method of claim 57, wherein The method further comprises: Based on the at least one first target block, sequentially serving as the reference blocks in a first preset order, determining a reference intra-frame prediction mode parameter of each of the at least one first target block; A mode candidate list for the second color component of the current block is constructed according to the reference intra-frame prediction mode parameters of each of the at least one first target blocks.
59. The method of claim 58, wherein The determining of the reference block of the current block further includes: Determining a first color component region at a same position as the current block; Determining at least one second target block at a preset position from at least one block divided by the first color component area; A reference block of the current block is determined according to the at least one second target block.
60. The method of claim 59, wherein The method further comprises: Determining, in sequence, a first color component prediction mode parameter of each of the at least one second target block based on a preset order of the at least one second target block; A mode candidate list of the second color component of the current block is constructed according to the reference intra prediction mode parameters of the at least one first target block and the first color component prediction mode parameters of the at least one second target block.
61. The method of claim 60, wherein: The method further comprises: Determine the first two prediction modes in the mode candidate list; Performing an offset operation on the mode index numbers of the first two prediction modes to determine at least one new intra-frame prediction mode; The at least one new intra prediction mode is placed in the mode candidate list.
62. The method of claim 60, wherein: The method further comprises: The prediction modes in the mode candidate list are sequentially adjusted.
63. The method of claim 42, wherein: The determining, according to the mode candidate list, a predicted value of the second color component of the current block, comprises: determining, according to the mode candidate list, a target prediction mode for the second color component of the current block; The target prediction mode is used to perform prediction processing on the second color component of the current block to determine a predicted value of the second color component of the current block.
64. The method of claim 63, wherein The determining, according to the mode candidate list, a target prediction mode for the second color component of the current block, comprises: pre-encoding the second color component of the current block according to at least one candidate prediction mode in the mode candidate list, and determining a pre-encoding result of each of the at least one candidate prediction mode; determining a rate-distortion cost value of each of the at least one candidate prediction mode according to a precoding result of each of the at least one candidate prediction mode; A minimum rate-distortion cost value is determined from the rate-distortion cost values of the at least one candidate prediction mode, and the candidate prediction mode corresponding to the minimum rate-distortion cost value is determined as the target prediction mode for the second color component of the current block.
65. The method of claim 63, wherein The method further comprises: Determining the mode index number corresponding to the target prediction mode according to the mode candidate list; The mode index sequence number is encoded, and the obtained encoded bits are written into a bitstream.
66. The method according to any one of claims 33 to 65, wherein The determining, according to the predicted value of the second color component of the current block, a predicted difference value of the second color component of the current block, comprises: determining a predicted difference value of the second color component of the current block according to the original value of the second color component of the current block and the predicted value of the second color component of the current block; The method further comprises: The predicted difference value of the second color component of the current block is encoded, and the obtained encoded bits are written into a bitstream.
67. A code stream, wherein The code stream is generated by bit encoding based on information to be encoded; wherein the information to be encoded includes at least one of the following: The predicted difference value of the second color component of the current block, the mode index number and the first parameter.
68. An encoder comprising a first determining unit and a first predicting unit; wherein, The first determining unit is configured to determine a reference block of the current block; wherein the reference block is a neighboring block of the current block; and when the prediction mode of the second color component of the reference block satisfies a first condition, determine a reference intra-frame prediction mode parameter according to the reference block; The first prediction unit is configured to determine a predicted value of the second color component of the current block according to the reference intra-frame prediction mode parameter; The first determining unit is further configured to determine a predicted difference value of the second color component of the current block according to the predicted value of the second color component of the current block.
69. An encoder comprising a first memory and a first processor; wherein: The first memory is used to store a computer program that can be run on the first processor; The first processor is configured to execute the method according to any one of claims 33 to 66 when running the computer program.
70. A decoder comprising a second determination unit and a second prediction unit; wherein The second determining unit is configured to determine a reference block of the current block; wherein the reference block is a neighboring block of the current block; and when the prediction mode of the second color component of the reference block satisfies a first condition, determine a reference intra-frame prediction mode parameter according to the reference block; The second prediction unit is configured to determine a prediction value of the second color component of the current block according to the reference intra-frame prediction mode parameter.
71. A decoder comprising a second memory and a second processor; wherein: The second memory is used to store a computer program that can be run on the second processor; The second processor is configured to execute the method according to any one of claims 1 to 32 when running the computer program.
72. A computer-readable storage medium, wherein: The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 32 is implemented, or the method according to any one of claims 33 to 66 is implemented.