Encoding and decoding method, code stream, encoder, decoder and storage medium
Patent Information
- Application Number
- CN202380099980.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-04
- Publication Date
- 2026-02-13
AI Technical Summary
In video encoding, when the luminance block uses the direct mode in the intra-block copy mode, the chromaticity prediction mode is unreasonable, resulting in inaccurate chromaticity prediction and loss of encoding efficiency.
By determining the block vector parameters, a mapping relationship between the luminance component and the chrominance component is established, and the chrominance component is predicted using this mapping relationship, improving the accuracy of the chrominance prediction and saving code rate.
Improves the accuracy of chromaticity prediction and codec efficiency, and improves coding performance.
Smart Images

Figure CN121533016A_ABST
Abstract
Description
Coding and decoding method, code stream, encoder, decoder and storage medium Technical Field
[0001] The present application relates to the field of video coding and decoding technology, and in particular to a coding and decoding method, 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 HD and UHD video have emerged. The Joint Video Exploration Team (JVET) of the ISO / IEC and ITU-T international standards organizations has developed the video coding standard H.266 / Versatile Video Coding (VVC). Intrablock copy (IBC) is a block-level coding mode provided by VVC for video sequences with specific screen content.
[0003] In the related art, for the Direct Mode (DM), if the luminance block uses the IBC mode, then the chrominance prediction mode is set improperly, resulting in inaccurate chrominance prediction of the current block and loss of coding efficiency.
[0004] Summary of the Invention
[0005] The present application provides a coding and decoding method, a code stream, an encoder, a decoder, and a storage medium, which can improve the accuracy of chrominance prediction, save bit rate, and thus improve coding and decoding efficiency.
[0006] The technical solution of this application can be implemented as follows:
[0007] In a first aspect, an embodiment of the present application provides a decoding method, applied to a decoder, the method comprising:
[0008] Determine the first block vector parameters of the current block;
[0009] Determine a first color component reference sample and a second color component reference sample corresponding to the current block based on the first block vector parameter, and establish a mapping relationship between the first color component and the second color component according to the first color component reference sample and the second color component reference sample;
[0010] A predicted value of a second color component of the current block is determined according to the mapping relationship and the sample value of the first color component of the current block.
[0011] In a second aspect, an embodiment of the present application provides an encoding method, applied to an encoder, the method comprising:
[0012] Determine the first block vector parameters of the current block;
[0013] Determine a first color component reference sample and a second color component reference sample corresponding to the current block based on the first block vector parameter, and establish a mapping relationship between the first color component and the second color component according to the first color component reference sample and the second color component reference sample;
[0014] A predicted value of a second color component of the current block is determined according to the mapping relationship and the sample value of the first color component of the current block.
[0015] 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:
[0016] The value of the first syntax element identification information, the value of the second syntax element identification information and the mapping relationship index value; wherein the first syntax element identification information is used to indicate whether the second color component of the current block uses the target prediction mode, and the second syntax element identification information is used to indicate whether the second color component of the current block is allowed to use the target prediction mode.
[0017] In a fourth aspect, an embodiment of the present application provides an encoder, comprising a first determining unit, a first establishing unit, and a first predicting unit, wherein:
[0018] a first determining unit configured to determine a first block vector parameter of a current block;
[0019] A first establishing unit is configured to determine a first color component reference sample and a second color component reference sample corresponding to the current block based on the first block vector parameter, and establish a mapping relationship between the first color component and the second color component according to the first color component reference sample and the second color component reference sample;
[0020] The first prediction unit is configured to determine a predicted value of a second color component of the current block according to the mapping relationship and a sample value of the first color component of the current block.
[0021] In a fifth aspect, an embodiment of the present application provides an encoder, comprising a first memory and a first processor, wherein:
[0022] a first memory for storing a computer program capable of running on the first processor;
[0023] The first processor is configured to execute the method according to the second aspect when running a computer program.
[0024] In a sixth aspect, an embodiment of the present application provides a decoder, comprising a second determining unit, a second establishing unit, and a second predicting unit, wherein:
[0025] a second determining unit configured to determine a first block vector parameter of a current block;
[0026] a second establishing unit configured to determine a first color component reference sample and a second color component reference sample corresponding to the current block based on the first block vector parameter, and establish a mapping relationship between the first color component and the second color component according to the first color component reference sample and the second color component reference sample;
[0027] The second prediction unit is configured to determine a predicted value of a second color component of the current block according to the mapping relationship and a sample value of the first color component of the current block.
[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 storing a computer program, which, when executed, implements the method described in the first aspect or the method described in the second aspect.
[0032] The embodiments of the present application provide a coding and decoding method, a code stream, an encoder, a decoder, and a storage medium. Whether it is the encoding end or the decoding end, the first block vector parameter of the current block is first determined; then, based on the first block vector parameter, the first color component reference sample and the second color component reference sample corresponding to the current block are determined, and a mapping relationship between the first color component and the second color component reference sample is established based on the first color component reference sample and the second color component reference sample; then, based on the mapping relationship and the first color component sample value of the current block, the predicted value of the second color component of the current block is determined. In this way, if the luminance block corresponding to the current block is predicted based on the block vector, the first block vector parameter of the chrominance component can be determined based on the block vector parameter of the luminance block, and a mapping relationship between the luminance component and the chrominance component can be established based on the luminance component reference sample and the chrominance component reference sample at the first block vector parameter, and then the chrominance component is predicted using this mapping relationship. That is to say, the encoding and decoding method proposed in the embodiment of the present application improves the singleness problem of chrominance prediction, makes full use of the relevant information of the same-position luminance block, and can improve the accuracy of chrominance prediction; at the same time, according to the established mapping relationship, it can also effectively perform pixel-level prediction, thereby further saving bit rate, improving encoding and decoding efficiency, and thus improving encoding and decoding performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] FIG1 is a schematic diagram of a process for obtaining reconstruction samples based on the IBC mode;
[0034] FIG2 is a schematic diagram of the position distribution of adjacent blocks provided in an embodiment of the present application;
[0035] FIG3 is a first schematic diagram of the positional relationship between a luminance block and a chrominance block provided in an embodiment of the present application;
[0036] FIG4A is a schematic block diagram of an encoder provided in an embodiment of the present application;
[0037] FIG4B is a schematic block diagram of a decoder according to an embodiment of the present application;
[0038] FIG5 is a schematic diagram of a network architecture of a coding and decoding system provided in an embodiment of the present application;
[0039] FIG6 is a schematic diagram of a flow chart of a decoding method provided in an embodiment of the present application;
[0040] FIG7 is a second schematic diagram of the positional relationship between a luminance block and a chrominance block provided in an embodiment of the present application;
[0041] FIG8 is a third schematic diagram of the positional relationship between a luminance block and a chrominance block provided in an embodiment of the present application;
[0042] FIG9 is a fourth schematic diagram of the positional relationship between a luminance block and a chrominance block provided in an embodiment of the present application;
[0043] FIG10 is a schematic diagram showing a structure of whether an offset position does not cover a current block according to an embodiment of the present application;
[0044] FIG11 is a schematic diagram showing a structure of whether an offset position exceeds a preset available area according to an embodiment of the present application;
[0045] FIG12 is a schematic diagram of a structure for determining optimal chromaticity BV parameters according to an embodiment of the present application;
[0046] FIG13 is a schematic diagram showing the positions of a current chroma block and a corresponding co-located luminance area provided in an embodiment of the present application;
[0047] FIG14 is a schematic diagram of a co-located brightness area and its corresponding offset position provided in an embodiment of the present application;
[0048] FIG15 is a schematic diagram of a template type provided in an embodiment of the present application;
[0049] FIG16 is a schematic diagram of motion compensation of a template provided in an embodiment of the present application;
[0050] FIG17 is a schematic diagram showing the positions of a co-located brightness region and a reference brightness region provided in an embodiment of the present application;
[0051] FIG18 is a schematic diagram of downsampling provided in an embodiment of the present application;
[0052] FIG19 is a fifth schematic diagram of the positional relationship between a luminance block and a chrominance block provided in an embodiment of the present application;
[0053] FIG20 is a schematic diagram of a flow chart of an encoding method provided in an embodiment of the present application;
[0054] FIG21 is a first detailed flow chart of an encoding method provided in an embodiment of the present application;
[0055] FIG22 is a second detailed flow chart of an encoding method provided in an embodiment of the present application;
[0056] FIG23 is a schematic diagram of a chromaticity prediction process based on BV provided in an embodiment of the present application;
[0057] FIG24 is a schematic diagram of the structure of an encoder provided in an embodiment of the present application;
[0058] FIG25 is a schematic diagram of a specific hardware structure of an encoder provided in an embodiment of the present application;
[0059] FIG26 is a schematic diagram of the structure of a decoder provided in an embodiment of the present application;
[0060] FIG27 is a schematic diagram of a specific hardware structure of a decoder provided in an embodiment of the present application;
[0061] FIG28 is a schematic diagram of the composition structure of a coding and decoding system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0062] 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.
[0063] 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.
[0064] In the following description, reference is made to "some embodiments," which describe a subset of all possible embodiments. However, it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict. It should also be noted that the terms "first, second, and third" in the embodiments of the present application are only used to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that "first, second, and third" may be interchanged in a specific order or sequential order where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0065] Before further explaining the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained first. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations:
[0066] Coding Block (CB);
[0067] Intra block copy (IBC);
[0068] Screen Content Coding (SCC);
[0069] Block Matching (BM);
[0070] Coding Unit (CU);
[0071] Block Vector (BV);
[0072] Motion Vector (MV);
[0073] Direct Block Vector (DBV);
[0074] Block Vector Guided-PLT (BVG-PLT);
[0075] Advanced Motion Vector Prediction (IBC Advanced Motion Vector Prediction, AMVP);
[0076] Cross-Component Linear Model prediction (CCLM);
[0077] Merge Mode
[0078] Planar Mode;
[0079] H.266 / Versatile Video Coding (VVC);
[0080] VVC Test Model (VTM), a reference software testing platform for VVC.
[0081] It can be understood that in a video image, a first color component, a second color component, and a third color component are generally used to represent a coding block. These three color components are a luminance component, a blue chrominance component, and a red chrominance component. Specifically, the luminance component is usually represented by the symbol Y, the blue chrominance component is usually represented by the symbol Cb or U, and the red chrominance component is usually represented by the symbol Cr or V. Thus, a video image can be represented in either the YCbCr format or the YUV format.
[0082] It can also be understood that IBC is an extended tool of VVC for encoding video sequences of screen content types, which significantly improves the encoding efficiency of screen content sequences. Specifically, IBC is a block-level encoding mode. Similar to inter-frame technology, the encoding end performs motion search, specifically by finding the best block vector for each coding block through block matching, which can also be called a motion vector. Among them, the block vector is a vector pointing from the current block to the reference block. The difference from inter-frame technology is that the best block vector of IBC is obtained by searching in the reconstructed area of the frame where the current block is located (that is, the current coded frame), while the inter-frame motion vector is obtained by searching the adjacent reference frames of the current coded frame in the time domain.
[0083] In H.266 / VVC, the specific process of obtaining reconstructed pixels of the current block in IBC mode may include: deriving a block vector, deriving a prediction sample using the block vector, deriving a residual sample, and deriving a reconstructed sample using the prediction sample and the residual sample.
[0084] In a specific implementation, the process of obtaining a reconstruction sample in the IBC mode, as shown in FIG1 , may include:
[0085] S101: Derive block vector.
[0086] For the luma component, the inputs include: the luma position (xCb, yCb), which specifies the luma sample of the top-left corner of the current block relative to the top-left luma sample of the current image; a variable cbWidth, which specifies the width of the current block in luma samples; and a variable cbHeight, which specifies the height of the current block in luma samples. The output includes: the luma block vector (bvL). It should be noted that the current block containing luma samples is also called the "luma block."
[0087] Here, the IBC mode is divided into IBC MERGE mode and IBC AMVP mode. When deriving bvL, it is necessary to establish an IBC block vector candidate list bvCandList. The following will introduce the process of establishing the IBC MERGE list in detail. Among them, the process of establishing the IBC AMVP list is consistent with that of the IBC MERGE list, but the maximum number of candidates for the two is different.
[0088] Step 1: When IsGt4by4 is equal to TRUE (the variable IsGt4by4 is TRUE when the width multiplied by the height of the luma block is greater than 16), the derivation process of the spatial block vector candidates from the adjacent coding units specified in the decoding specification is called using the luma block position (xCb, yCb), the width cbWidth and the height cbHeight of the luma block as input, and the output is the availability flags availableFlagA1 and availableFlagB1 and the block vectors bvA1 and bvB1. The relative positions of the adjacent blocks A1 and B1 with respect to the current block are shown in Figure 2.
[0089] Step 2: When IsGt4by4 is equal to TRUE, the pseudo code for constructing the block vector candidate list bvCandList is as follows:
[0090] i=0
[0091] if(availableFlagA1)
[0092] bvCandList[i++]=bvA1
[0093] if(availableFlagB1)
[0094] bvCandList[i++]=bvB1
[0095] Step 3: The variable numCurrCand (the number of candidates currently obtained) is derived as follows:
[0096] If IsGt4by4 is equal to TRUE, numCurrCand is set equal to the number of candidates in bvCandList; otherwise numCurrCand is set to 0.
[0097] Step 4: When numCurrCand is less than MaxNumIbcMergeCand (the maximum number of candidates in MERGE mode) and NumHmvpIbcCand (the maximum number of candidates for the historical optimal block vector Hmvp in IBC mode) is greater than 0, use bvCandList and numCurrCand as input, and the modified bvCandList and numCurrCand as output to call the history-based IBC block vector candidate derivation process specified in the decoding specification.
[0098] Step 5: When numCurrCand is less than MaxNumIbcMergeCand, the following applies until numCurrCand equals MaxNumIbcMergeCand:
[0099] bvCandList[numCurrCand][0] is set equal to 0 (the horizontal component of BV);
[0100] bvCandList[numCurrCand][1] is set equal to 0 (the vertical component of BV);
[0101] numCurrCand increases by 1.
[0102] In this way, the block vector candidate list bvCandList is established, and the candidate index bvIdx is derived as follows. general_merge_flag indicates whether it is IBC MERGE mode:
[0103] bvIdx=general_merge_flag[xCb][yCb]? merge_idx[xCb][yCb]:mvp_l0_flag[xCb][yCb]
[0104] In this way, the specific bvL can be obtained according to the index bvIdx and the block vector candidate list bvCandList:
[0105] bvL[0]=bvCandList[bvIdx][0];
[0106] bvL[1]=bvCandList[bvIdx][1].
[0107] For the IBC AMVP mode, the specific bvL can be obtained by indexing bvIdx and the block vector candidate list bvCandList as the predicted bvL. The real bvL also needs to be added with the block vector difference (BVD). The specific process is as follows:
[0108] Step 1: Get the horizontal and vertical components of BVD. Where MvdL0 is the forward motion vector difference, the horizontal component of BVD is represented by bvd[0], and the vertical component of BVD is represented by bvd[1], as follows:
[0109] bvd[0]=MvdL0[xCb][yCb][0];
[0110] bvd[1]=MvdL0[xCb][yCb][1].
[0111] Step 2: Round the predicted bvL obtained above. The right shift parameter AmvrShift is used for rounding, and the left shift parameter AmvrShift is used to increase the resolution. The details are as follows:
[0112] Offset=(AmvrShift==0)? 0:((1<<(AmvrShift-1))-1);
[0113] bvL[0]=Sign(bvL[0])*(((Abs(bvL[0])+offset)>>AmvrShift)< <AmvrShift);
[0114] bvL[1]=Sign(bvL[1])*(((Abs(bvL[1])+offset)>>AmvrShift)< <AmvrShift)。
[0115] Step 3: For the real bvL, its range needs to be controlled within -2 17 to 2 17 –1, the specific derivation process is as follows:
[0116] u[0]=(bvL[0]+bvd[0]+2 18 )%2 18 ;
[0117] bvL[0]=(u[0]>=2 17 )?(u[0]-2 18 ):u[0];
[0118] u[1]=(bvL[1]+bvd[1]+2 18 )%2 18 ;
[0119] bvL[1]=(u[1]>=2 17 )?(u[1]-2 18 ):u[1].
[0120] For the chroma component, if it is a dual-tree partition, the chroma component does not perform IBC; if it is a single-tree partition, the BV of the chroma component needs to be derived.
[0121] The input includes: luminance bvL (1 / 16 pixel accuracy). The output includes: chroma block vector (Block Vector Chroma, bvC) (1 / 32 pixel accuracy). The specific derivation process is as follows:
[0122] bvC[0]=((bvL[0]>>(3+SubWidthC))*32);
[0123] bvC[1]=((bvL[1]>>(3+SubHeightC))*32).
[0124] S102: Use the block vector to derive a prediction sample.
[0125] Here, the input includes: the luma position (xCb, yCb), which specifies the top left sample of the current block relative to the top left luma sample of the current image; a variable cbWidth, which specifies the width of the current block in luma samples; a variable cbHeight, which specifies the height of the current block in luma samples; a block vector BV; and a variable cIdx, which specifies the color component index of the current block. The output includes: an array of predicted samples predSamples.
[0126] For the prediction sample, the specific derivation process is as follows:
[0127] When cIdx is equal to 0, that is, the luminance component, for x = xCb ... xCb + cbWidth - 1 and y = yCb ... yCb + cbHeight - 1:
[0128] xVb=(x+(bv[0]>>4))&(IbcBufWidthY-1);
[0129] yVb=(y+(bv[1]>>4))&(CtbSizeY-1);
[0130] predSamples[x][y]=ibcVirBuf[0][xVb][yVb].
[0131] Among them, IbcBufWidthY is the width of the brightness pixel of the reconstruction buffer unit (Buffer) stored in IBC, CtbSizeY is the size of CTU (Coding Tree Unit), and ibcVirBuf is the reconstructed pixel stored in IBC.
[0132] When cIdx is not equal to 0, that is, the chrominance component, for x=xCb / SubWidthC...xCb / SubWidthC+cbWidth / SubWidthC-1 and y=yCb / SubHeightC...yCb / SubHeightC+cbHeight / SubHeightC-1:
[0133] xVb=(x+(bv[0]>>5))&(IbcBufWidthC-1);
[0134] yVb=(y+(bv[1]>>5))&((CtbSizeY / subHeightC)-1);
[0135] predSamples[x][y]=ibcVirBuf[cIdx][xVb][yVb].
[0136] Among them, the variables SubWidthC and SubHeightC depend on the color sampling format specified by sps_chroma_format_idc, and the specific corresponding relationship is shown in Table 1.
[0137] Table 1
[0138] S103: derive residual samples.
[0139] For residual samples, the residual decoding process specified by the decoding specification can be called.
[0140] S104: derive reconstructed samples using the predicted samples and the residual samples.
[0141] For reconstructing samples (ie, reconstructing pixel values), an image reconstruction process of a specified color component specified by a decoding specification may be called.
[0142] In another specific implementation, the derivation process of the chroma prediction mode in H.266 / VVC includes the following inputs: the luma position (xCb, yCb), which specifies the upper left corner sample of the current block relative to the upper left corner luma sample of the current image; a variable cbWidth, which specifies the width of the current block in luma samples; a variable cbHeight, which specifies the height of the current block in luma samples; and a variable treeType, which specifies whether to use single tree partitioning or dual tree partitioning. The output includes: the chroma intra prediction mode IntraPredModeC[xCb][yCb] and the MIP chroma direct mode flag MipChromaDirectFlag[xCb][yCb].
[0143] If treeType is equal to SINGLE_TREE, that is, in the case of single tree partitioning, sps_chroma_format_idc is equal to 3, that is, YUV444 format (4:4:4 format), intra_chroma_pred_mode is equal to 4, and IntraMipFlag[xCb][yCb] is equal to 1, that is, the prediction mode corresponding to the same-position luminance center block is MIP mode, then:
[0144] ① The MIP chroma direct mode flag MipChromaDirectFlag[xCb][yCb] is set to 1, that is, the chroma uses the luminance MIP mode.
[0145] ② The chroma intra prediction mode IntraPredModeC[xCb][yCb] is set equal to IntraPredModeY[xCb][yCb].
[0146] otherwise:
[0147] ① The MIP chroma direct mode flag MipChromaDirectFlag[xCb][yCb] is set to equal to 0.
[0148] ②The corresponding luma intra prediction mode lumaIntraPredMode is derived as follows:
[0149] If IntraMipFlag[xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to 1, lumaIntraPredMode is set equal to INTRA_PLANAR.
[0150] Otherwise, if CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to MODE_IBC or MODE_PLT, then lumaIntraPredMode is set equal to INTRA_DC.
[0151] Note: The IntraTmp mode is newly introduced in ECM. If CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to MODE_INTRA and it is IntraTmp mode, lumaIntraPredMode is set to be equal to INTRA_PLANAR.
[0152] Otherwise, lumaIntraPredMode is set equal to IntraPredModeY[xCb+cbWidth / 2][yCb+cbHeight / 2].
[0153] ③ The chroma intra prediction mode IntraPredModeC[xCb][yCb] is derived as follows:
[0154] If cu_act_enabled_flag[xCb][yCb] is equal to 1, the chroma intra prediction mode IntraPredModeC[xCb][yCb] is set equal to lumaIntraPredMode.
[0155] otherwise:
[0156] If BdpcmFlag[xCb][yCb][1] is equal to 1, then IntraPredModeC[xCb][yCb] is set equal to BdpcmDir[xCb][yCb][1]? INTRA_ANGULAR50:INTRA_ANGULAR18.
[0157] Otherwise, cu_act_enabled_flag[xCb][yCb] is equal to 0 and BdpcmFlag[xCb][yCb][1] is equal to 0, the chroma intra prediction mode IntraPredModeC[xCb][yCb] uses cclm_mode_flag, cclm_mode_idx, intra_chroma_pred_mode, and lumaIntraPredMode as specified in Table 2.
[0158] Table 2
[0159] When sps_chroma_format_idc is equal to 2, chroma intra prediction mode X in Table 2 can be used to derive chroma intra prediction mode Y. For details, see the mapping process specification of mode X to mode Y shown in Table 3. Then, chroma intra prediction mode X is set equal to chroma intra prediction mode Y.
[0160] Table 3
[0161] In another specific implementation, for the DM mode, the DM mode refers to directly using the brightness prediction mode information of the corresponding position:
[0162] When dual-tree partitioning is used for an I-frame, the luma and chroma components are allowed to use independent block partitioning structures, such as the Dual Tree mode in H.266 / VVC. In this case, the luma component at the corresponding position of the chroma coding block may contain multiple luma coding blocks, as shown in Figure 3. In H.266 / VVC, when the value of intra_chroma_pred_mode is equal to 4, it indicates that the current chroma block is decoded using DM mode.
[0163] The intra-frame prediction mode of the chrominance block is determined based on the intra-frame prediction mode of the luminance block at the center of the luminance region corresponding to the chrominance block. The determination method can be to directly use the intra-frame prediction mode of the luminance block or to further derive the intra-frame prediction mode.
[0164] In actual implementation, the intra-frame prediction mode of the chrominance block can be determined by using the center coordinates of the luminance region corresponding to the same position of the chrominance block as a reference point and the intra-frame prediction mode of the luminance block containing the reference point. The determination method can be to directly use the intra-frame prediction mode of the luminance block or to further derive the intra-frame prediction mode.
[0165] In addition, in the embodiments of the present application, the block mentioned here may be a CU, or a sub-block, or a transform block, etc., without specific limitation.
[0166] The specific description of the coding block position taken by the DM mode is as follows:
[0167] Get the position of the current chroma block, that is, the position of the upper left chroma sample of the current chroma block relative to the upper left chroma sample of the current image, chromaPos = (x, y), scale chromaPos according to the color sampling format shown in Table 4, and obtain the position of the same luminance area corresponding to the current chroma block lumaPos = (xCb, yCb).
[0168] Table 4
[0169] The luminance position (xCb, yCb) specifies the position of the upper left luminance sample of the luminance area corresponding to the current chrominance block relative to the upper left luminance sample of the current image; a variable cbWidth specifies the width of the current block in luminance samples; a variable cbHeight specifies the height of the current block in luminance samples.
[0170] The positional relationship between the current chroma block and the corresponding luma area is shown in Figure 3. The central luma pixel position of the luma area corresponding to the current chroma CU is described as follows, where xCenter represents the horizontal coordinate position, yCenter represents the vertical coordinate position, and the coding block containing the pixel position is the block at the center position of the luma block corresponding to the chroma block:
[0171] xCenter = xCb + cbWidth >> 1;
[0172] yCenter=yCb+cbHeight>>1.
[0173] In another specific implementation, for the decoding process of chroma prediction in H.266 / VVC, the syntax elements related to its decoding are shown in Table 5. In addition, for the value of the syntax element intra_chroma_pred_mode, its corresponding binary string (Bin string) is shown in Table 6; for different syntax elements (such as ccm_mode_flag, ccm_mode_idx, and intra_chroma_pred_mode, etc.), the encoding method used for each coded bit is shown in Table 7.
[0174] Table 5
[0175] Table 6
[0176] Table 7
[0177] Wherein, binIdx indicates the number of bits. If binIdx = 0, it indicates bit 0; if binIdx = 1, it indicates bit 1. In addition, bypass indicates bypass mode, and na indicates no processing.
[0178] In the related art, under dual-tree partitioning: for the DM mode, if the corresponding luminance block is the IBC mode, then the obtained chrominance prediction mode is the DC mode, which results in a loss of coding efficiency. For example, for chrominance prediction, a fixed DC mode is used for prediction, which not only results in the predicted pixels all having the same value, but also fails to express the chrominance texture feature content of the current block; and in chrominance prediction, the information of the co-located luminance block of the IBC mode is not used, and there is no prediction algorithm similar to IBC for block copying, making it impossible to effectively compress video sequences similar to screen content. Simply put, in the current chrominance prediction process, due to the incompleteness of the chrominance prediction mode, the chrominance prediction of the current block is inaccurate, resulting in a loss of coding efficiency.
[0179] Based on this, an embodiment of the present application provides a coding and decoding method to determine the first block vector parameters of the current block; determine the first color component reference sample and the second color component reference sample corresponding to the current block based on the first block vector parameters; establish a mapping relationship between the first color component and the second color component based on the first color component reference sample and the second color component reference sample; determine the predicted value of the second color component of the current block based on the mapping relationship and the first color component sample value of the current block.
[0180] In this way, if the co-located luminance block corresponding to the current block is predicted based on the block vector, then the first block vector parameter of the chrominance component can be determined based on the block vector parameter of the luminance block, and a mapping relationship between the luminance component and the chrominance component can be established based on the luminance component reference sample and the chrominance component reference sample at the first block vector parameter, and then the chrominance component is predicted using this mapping relationship. In other words, the encoding and decoding method proposed in the embodiment of the present application improves the singleness problem of chrominance prediction, makes full use of the relevant information of the co-located luminance block, and can improve the accuracy of chrominance prediction; at the same time, based on the established mapping relationship, pixel-level prediction can also be effectively performed, thereby further saving bit rate, improving encoding and decoding efficiency, and thus improving encoding and decoding performance.
[0181] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0182] Referring to Figure 4A, it shows a schematic block diagram of the composition of an encoder provided in an embodiment of the present application. As shown in Figure 4A, the encoder (specifically, a "video encoder") 100 may include a transform and quantization unit 101, an intra-frame estimation unit 102, an intra-frame prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109 and a decoded image cache unit 110, etc., wherein the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC).For the input original video signal, a video coding block can be obtained by dividing the coding tree unit (CTU). Then, the residual pixel information obtained after intra-frame or inter-frame prediction is transformed by the transformation and quantization unit 101, including transforming the residual information from the pixel domain to the transform domain and quantizing the obtained transform coefficients to further reduce the bit rate; the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to perform intra-frame prediction on the video coding block. Specifically, the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to determine the intra-frame prediction mode to be used to encode the video coding block; the motion compensation unit 104 and the motion estimation unit 105 are used to perform inter-frame prediction coding on the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information; the motion estimation performed by the motion estimation unit 105 is the process of generating a motion vector, which can estimate the motion of the video coding block. The motion compensation unit 104 then calculates the motion vector based on the motion vector determined by the motion estimation unit 105. After determining the intra-frame prediction mode, the intra-frame prediction unit 103 is further configured to provide the selected intra-frame prediction data to the encoding unit 109, and the motion estimation unit 105 also sends the calculated motion vector data to the encoding unit 109. In addition, the inverse transform and inverse quantization unit 106 is configured to reconstruct the video coding block and reconstruct a residual block in the pixel domain. The reconstructed residual block is subjected to the filter control analysis unit 107 and the filtering unit 108 to remove the block effect artifacts. The reconstructed residual block is then added to a predictive block in the frame of the decoded image buffer unit 110 to generate a reconstructed video coding block. The encoding unit 109 is configured to encode various coding parameters and quantized transform coefficients. In the CABAC-based coding algorithm, the context content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra-frame prediction mode, and output the code stream of the video signal. The decoded image buffer unit 110 is configured to store the reconstructed video coding block for prediction reference. As the video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoded image buffer unit 110 .
[0183] Referring to FIG4B , which shows a block diagram of a decoder provided in an embodiment of the present application, as shown in FIG4B , 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 FIG4A , 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.
[0184] 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 FIG5 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 FIG5 , 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.
[0185] 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 4A and the intra-frame prediction unit 203 shown in Figure 4B. In other words, the embodiment of the present application can be applied to both the encoder and the decoder, or even to both the encoder and the decoder at the same time, but the embodiment of the present application is not specifically limited thereto.
[0186] 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.
[0187] In one embodiment of the present application, referring to FIG6 , a flowchart of a decoding method provided by an embodiment of the present application is shown. As shown in FIG6 , the method may include:
[0188] S601: Determine the first block vector parameter of the current block.
[0189] It should be noted that the decoding method in the embodiment of the present application is applied to a decoder. Furthermore, the decoding method may specifically refer to an intra-frame prediction method, more specifically, a block vector-based chrominance prediction method. A video image may be divided into multiple decoding blocks, each of which may include a first color component, a second color component, and a third color component. The current block in the embodiment of the present application refers to a decoding block in the video image for which chrominance prediction is currently being performed.
[0190] Here, if the current block predicts a first color component, and the first color component is a luminance component, then the current block may also be referred to as a luminance block; or, if the current block predicts a second color component, and the second color component is a chrominance component, then the current block may also be referred to as a chrominance block.
[0191] It should also be noted that under dual-tree partitioning, for the DM mode, when the prediction mode of the luminance block at the same position meets the first condition, the embodiment of the present application can derive the first block vector parameters applied to chrominance based on the block vector parameters of the luminance block at the same position, thereby improving the coding efficiency.
[0192] In some embodiments, determining the first block vector parameters of the current block may include: determining a first color component block of the current block; determining a second block vector parameter of the first color component block when a prediction mode of the first color component block satisfies a first condition; and determining the first block vector parameter of the current block based on the second block vector parameter of the first color component block.
[0193] It can be understood that in an embodiment of the present application, determining the first color component block of the current block may include: determining the first color component area at the same position of the current block; and determining the first color component block of the current block from multiple blocks divided from the first color component area.
[0194] It should be noted that, in the embodiment of the present application, if the first color component is a luminance component, then the first color component region may also be referred to as a "co-located luminance region". For example, if the current block is a chrominance block, then the co-located luminance region may refer to the co-located luminance region corresponding to the current block. For the current block, the co-located first color component region may be divided into blocks, for example, using a binary tree structure, a ternary tree structure, a quadtree structure, etc., to obtain multiple blocks, each of which may be regarded as a CU, a sub-block, or a transform block, etc.; then, the first color component block of the current block is determined from these multiple blocks.
[0195] For example, in Figure 3, the area filled with diagonal lines represents the co-located luminance area corresponding to the chrominance component. Within this co-located luminance area, multiple blocks can be divided; the block at the center can be selected from these blocks as the corresponding luminance block of the current block. For example, the block filled with black in Figure 3 is the corresponding luminance block of the current block (the first color component block).
[0196] Further, in some embodiments, determining the first color component block of the current block from the multiple blocks divided by the first color component area may include: selecting a target block from the multiple blocks divided by the first color component area, and using the target block as the first color component block of the current block.
[0197] The target block can be a block at any position. In a specific embodiment, the block at the center of the first color component area is selected as the target block; or the block at the upper left corner of the first color component area is selected as the target block; or the block at the lower right corner of the first color component area is selected as the target block.
[0198] Furthermore, in some embodiments, determining the first color component block of the current block may include: determining the position information of the current block; scaling the position information of the current block according to a preset sampling format to obtain the co-located area position information corresponding to the current block; determining the target position information based on the co-located area position information, and using the target block containing the target position information as the first color component block of the current block.
[0199] Furthermore, in some embodiments, determining the target position information based on the co-located area position information may include: calculating the center position based on the co-located area position information, and using the obtained center position information as the target position information; or, calculating the upper left corner position based on the co-located area position information, and using the obtained upper left position information as the target position information; or, calculating the lower right corner position based on the co-located area position information, and using the obtained lower left position information as the target position information.
[0200] In an embodiment of the present application, the preset sampling format may be a chroma sampling format (or color sampling format). For example, the mapping relationship between the position (x, y) of the current block and the position (xCb, yCb) of the co-located area is shown in Table 4.
[0201] In one possible implementation, the position of the current block, that is, the position of the upper left chromaticity sample of the current block relative to the upper left chromaticity sample of the current image, chromaPos = (x, y), is obtained, and chromaPos is scaled according to the chroma sampling format shown in Table 4 to obtain the co-located luminance area position lumaPos = (xCb, yCb) corresponding to the current block.
[0202] Here, assuming 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 is (xCb, yCb), and the width of the co-located luminance area corresponding to the current block (that is, the entire diagonal filled area of the luminance component in Figure 3) is cbWidth, and the height is cbHeight; then the block at the center position (the block at the center position of the luminance area) is the luminance block containing the center position information (xCb+cbWidth>>1, yCb+cbHeight>>1), where the block is filled with black in Figure 3.
[0203] In another possible implementation, the position of the current block, that is, the position of the upper left chromaticity sample of the current block relative to the upper left chromaticity sample of the current image, chromaPos = (x, y), is obtained, and chromaPos is scaled according to the chroma sampling format shown in Table 4 to obtain the co-located luminance area position lumaPos = (xCb, yCb) corresponding to the current block.
[0204] Here, assuming 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 is (xCb, yCb), and the width of the co-located luminance area corresponding to the current block (that is, the entire diagonal filled area of the luminance component in Figure 7) is cbWidth, and the height is cbHeight; then the block in the upper left corner (the upper left corner block of the luminance area) is the luminance block containing the position coordinates (xCb, yCb), where the block is filled with black in Figure 7.
[0205] In another possible implementation, the position of the current block, that is, the position of the upper left chromaticity sample of the current block relative to the upper left chromaticity sample of the current image, chromaPos = (x, y), is obtained, and chromaPos is scaled according to the chroma sampling format shown in Table 4 to obtain the co-located luminance area position lumaPos = (xCb, yCb) corresponding to the current block.
[0206] Here, assuming 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 is (xCb, yCb), and the width of the co-located luminance area corresponding to the current block (that is, the entire diagonal filled area of the luminance component in Figure 8) is cbWidth, and the height is cbHeight; then the block at the lower right corner (the lower right corner block of the luminance area) is the luminance block containing the position coordinates (xCb+cbWidth-1, yCb+cbHeight-1), where the block is filled with black in Figure 8.
[0207] That is, in the embodiment of the present application, the target block serving as the first color component block may be a block at any position among the multiple blocks shown in FIG3 . For example, the target block may be a block at the center position (a block filled with black) in the collocated luminance region shown in FIG3 , the target block may be a block at the upper left corner position (a block filled with black) in the collocated luminance region shown in FIG7 , the target block may be a block at the lower right corner position (a block filled with black) in the collocated luminance region shown in FIG8 , or even a block at the upper right corner position, a block at the lower left corner position, or even a block at the center position of the upper left region, etc., and this is not specifically limited here.
[0208] Further, in some embodiments, determining the first color component block of the current block from a plurality of blocks divided from the first color component area may include: determining at least one candidate block at a preset position from a plurality of blocks divided from the first color component area; and determining the first color component block of the current block based on the at least one candidate block.
[0209] In a specific embodiment, determining the first color component block of the current block according to the at least one candidate block may include: using the at least one candidate block as the first color component block of the current block.
[0210] In another specific embodiment, determining the first color component block of the current block based on at least one candidate block may include: determining a target candidate block that meets preset judgment conditions from at least one candidate block, and using the target candidate block as the first color component block of the current block.
[0211] It should be noted that, in an embodiment of the present application, whether a candidate block meets a preset judgment condition may include: obtaining at least one candidate block in sequence according to a preset order and performing a mode judgment; if the prediction mode of the first candidate block determined meets the first condition, the first candidate block is used as the first color component block of the current block.
[0212] It should also be noted that, in an embodiment of the present application, whether a candidate block satisfies a preset judgment condition may include: when it is determined that the prediction mode of the first candidate block satisfies the first condition, determining the first block vector parameter of the first candidate block; judging whether the first block vector parameter of the first candidate block satisfies the available condition; if the first block vector parameter of the first candidate block satisfies the available condition, using the first candidate block as the first color component block of the current block; if the first block vector parameter of the first candidate block does not satisfy the available condition, continuing with the mode judgment of the next candidate block until a target candidate block whose prediction mode satisfies the first condition and whose corresponding first block vector parameter satisfies the available condition is determined, and using the target candidate block as the first color component block of the current block.
[0213] In this embodiment of the present application, for the first color component block, mode determination can also be performed on at least one candidate block at a preset position. For example, as shown in Figure 9 , this includes CUs at five luma pixel positions: C, TL, TR, BL, and BR. However, this embodiment of the present application is not limited to these five positions; multiple positions are possible. Furthermore, the five positions shown in Figure 9 are not specifically limited to this.
[0214] In another possible implementation, taking the block containing five luminance pixel positions shown in FIG9 as an example, they can be acquired sequentially in a preset order until it is determined that the obtained block is predictively encoded in a mode with BV information, that is, the block at the first luminance pixel position is found to be predictively encoded in a mode with BV information, and the preset order of sequential acquisition includes but is not limited to the following order: C->TL->TR->BL->BR.
[0215] For the detailed position derivation process of C, TL, TR, BL, and BR, the position of the current block is obtained, that is, the position of the upper left chromaticity sample of the current block relative to the upper left chromaticity sample of the current image, chromaPos = (x, y), and chromaPos is scaled according to the chroma sampling format shown in Table 4 to obtain the position of the same luminance area corresponding to the current block, lumaPos = (xCb, yCb).
[0216] Here, it is assumed 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 (i.e., the position of the luminance pixel TL) is (xCb, yCb), and the width of the co-located luminance area corresponding to the current chroma coding block (i.e., the entire diagonal filled area of the luminance component in Figure 9) is cbWidth, and the height is cbHeight.
[0217] The coordinates of the position of the brightness pixel C are (xCb+cbWidth / 2,yCb+cbHeight / 2);
[0218] The coordinates of the position of the luminance pixel TL are (xCb, yCb);
[0219] The coordinates of the position of the brightness pixel TR are (xCb+cbWidth-1,yCb);
[0220] The coordinates of the position of the brightness pixel BL are (xCb, yCb+cbHeight-1);
[0221] The coordinates of the position of the luminance pixel BR are (xCb+cbWidth-1, yCb+cbHeight-1).
[0222] Thus, for the current block, it is first necessary to determine the corresponding first color component block. For example, when the first color component is a luminance component, it is necessary to determine the corresponding luminance block of the current block.
[0223] It can also be understood that in an embodiment of the present application, the method may further include: when the first color component block is predicted based on the block vector, determining whether the current block uses the target prediction mode; if the current block uses the target prediction mode, determining that the prediction mode of the first color component block meets the first condition.
[0224] It should be noted that, in the embodiment of the present application, the target prediction mode is a prediction mode based on BV guidance, which can be expressed here as a BVG-PLT mode or a BVG-LUT mode.
[0225] It should also be noted that, in this embodiment of the present application, if the corresponding luminance block of the current block is decoded using a mode with BV information and the target prediction mode is applied to the current block, then it can be determined that the prediction mode of the corresponding luminance block meets the first condition. In this case, the BV of the corresponding luminance block can be obtained, and the first block vector parameters of the current block can be determined based on the BV of the corresponding luminance block. Modes that use BV information include but are not limited to IBC mode or IntraTMP mode.
[0226] It should also be noted that in this embodiment of the present application, the number of first color component blocks can be arbitrary. That is, the first color component block of the current block is not limited to a single block and can also be composed of multiple blocks. Accordingly, when determining whether to perform prediction based on a block vector, a determination must be made for each first color component block. Only first color component blocks that meet the requirements for block vector prediction can be used to subsequently determine the first block vector parameters of the current block.
[0227] Furthermore, in an embodiment of the present application, if the first color component block is not predicted based on a block vector, that is, the first color component block is not processed in a mode with BV information, then the first syntax element identification information may be omitted from parsing. The first syntax element identification information is used to indicate whether the second color component of the current block uses the target prediction mode.
[0228] In a specific implementation, when determining the first block vector parameter of the current block according to the second block vector parameter of the first color component block, the second block vector parameter of the first color component block may be directly used as the first block vector parameter of the current block.
[0229] In another specific implementation, when determining the first block vector parameters of the current block based on the second block vector parameters of the first color component block, a block vector parameter candidate list of the second color component of the current block can also be constructed based on the second block vector parameters; and the first block vector parameters of the current block are determined based on the block vector parameter candidate list.
[0230] That is to say, in the embodiment of the present application, the second block vector parameter of the first color component block can be directly used as the first block vector parameter of the current block, or the second block vector parameter can be first used to construct a candidate list of block vector parameters of the second color component, and then the first block vector parameter of the current block is determined based on the candidate list of block vector parameters.
[0231] In some embodiments, constructing a candidate list of block vector parameters for the second color component of the current block based on the second block vector parameter may include: adjusting the second block vector parameter to determine the candidate block vector parameters for the second color component of the current block; and adding the candidate block vector parameters to the candidate list of block vector parameters.
[0232] That is to say, in an embodiment of the present application, the second block vector parameter of the first color component block can be directly used as the first block vector parameter of the current block; or, the second block vector parameter of the first color component block is adjusted to determine the candidate block vector parameter of the second color component, and then the candidate block vector parameter is used as the first block vector parameter of the current block; or, a candidate list of block vector parameters of the second color component is constructed based on the candidate block vector parameter, and then the first block vector parameter of the current block is determined based on the block vector parameter candidate list.
[0233] Assuming that the current block is a chroma block and the first color component block is a luminance block, the first block vector parameter may be the BV of the chroma block, ie, BVC; the second block vector parameter may be the BV of the luminance block, ie, BVL.
[0234] It can be understood that in an embodiment of the present application, assuming that the second block vector parameter is luminance BV = (BVLhor, BVLver) and the first block vector parameter is chrominance BV = (BVChor, BVCver), then it is possible to choose to construct a chrominance BVC candidate list containing one or more candidate block vector parameters by adjusting BVL (luminance BV) or BVC (chrominance BV).
[0235] Furthermore, in some embodiments, adjusting the second block vector parameters to determine the candidate block vector parameters of the second color component of the current block may include: determining a preset sampling format of the current block; scaling the second block vector parameters according to the preset sampling format to determine the candidate block vector parameters of the second color component of the current block.
[0236] It should be noted that, in the embodiment of the present application, the above adjustment may include scaling according to a preset sampling format, wherein the preset sampling format may be a mapping relationship between luma BV parameters and scaled chroma BV parameters as shown in Table 8.
[0237] Table 8
[0238] The syntax element sps_chroma_format_idc is used to indicate the type of color sampling format, which is specifically the chroma sampling format. Different types of color sampling formats have different corresponding scaling operations.
[0239] For example, if the value of sps_chroma_format_idc is 0, the color sampling format is determined to be monochrome, that is, there is no chroma BV parameter (BVC hor , BVC hor); If the value of sps_chroma_format_idc is 1, the color sampling format is determined to be 4:2:0. At this time, the mapping relationship between the brightness BV parameter and the chroma BV parameter is: BVC hor =BVL hor >>1, BVC hor =BVL ver >>1; If the value of sps_chroma_format_idc is 2, the color sampling format is determined to be 4:2:2. At this time, the mapping relationship between the brightness BV parameter and the chroma BV parameter is: BVC hor =BVL hor >>1, BVC hor =BVL ver If the value of sps_chroma_format_idc is 3, it means that the color sampling format is 4:4:4. At this time, the mapping relationship between the brightness BV parameter and the chroma BV parameter is: BVC hor =BVL hor , BVC hor =BVL ver .
[0240] In this way, based on Table 8, you can choose to scale according to the color sampling format, and add the scaled BVC as a candidate block vector parameter to the chroma BVC candidate list (block vector parameter candidate list).
[0241] Furthermore, in some embodiments, adjusting the second block vector parameters to determine candidate block vector parameters of the second color component of the current block may include: determining a preset sampling format of the current block; scaling the second block vector parameters according to the preset sampling format to determine first initial block vector parameters of the second color component of the current block; performing an offset calculation on the first initial block vector parameters according to one or more offset values to determine candidate block vector parameters of the second color component of the current block.
[0242] Furthermore, in some embodiments, adjusting the second block vector parameters to determine the candidate block vector parameters of the second color component of the current block may include: performing offset calculation on the second block vector parameters based on one or more offset values to determine one or more second initial block vector parameters; determining a preset sampling format of the current block, and scaling the one or more second initial block vector parameters according to the preset sampling format to determine the candidate block vector parameters of the second color component of the current block.
[0243] It should be noted that in the embodiment of the present application, the above-mentioned one or more offset values can be any number of arbitrary numerical values, such as -1, +1, -2, +2, -3, +3, etc., and are not specifically limited here.
[0244] That is, in the embodiment of the present application, after obtaining the BV of the corresponding luma block, it can be recorded as BVL, and the chroma BV obtained through the BVL can be recorded as BVC. Then, by adjusting the BVL or BVC, a chroma BVC candidate list containing one or more candidates can be constructed. That is, based on Table 8, it can be selected to scale according to the color sampling format, and the scaled BVL or BVC can be added as the candidate block vector parameter to the chroma BVC candidate list.
[0245] For example, in an embodiment of the present application, BVL can be adjusted to form four situations, thereby achieving adjustment of BVC. Among them, when BVL is an odd number, take four situations: BVL = (BVLhor, BVLver), BVL = (BVLhor+1, BVLver), BVL = (BVLhor, BVLver+1), and BVL = (BVLhor+1, BVLver+1). When BVL is an even number, take BVL = (BVLhor, BVLver). Then, Table 8 can be used to scale BVL according to the color sampling format to obtain BVC. In this way, when BVL is an odd number, four BVC candidate block vector parameters will be formed, and these candidate block vector parameters will be added to the chroma BVC candidate list.
[0246] For example, in the embodiment of the present application, BVL can be adjusted to form four situations, thereby achieving adjustment of BVC. Among them, when BVL is an odd number, four situations are taken: BVL = (BVLhor, BVLver), BVL = (BVLhor+1, BVLver), BVL = (BVLhor, BVLver+1), and BVL = (BVLhor+1, BVLver+1). When BVL is an even number, four situations are taken: BVL = (BVLhor, BVLver), BVL = (BVLhor-1, BVLver), BVL = (BVLhor, BVLver-1), and BVL = (BVLhor-1, BVLver-1). Then, Table 8 can be used to scale BVL according to the color sampling format to obtain BVC. In this way, when BVL is an odd number or an even number, four BVC candidates will be formed, and these candidates will be added to the chroma BVC candidate list.
[0247] Exemplarily, in an embodiment of the present application, the operations under different circumstances of unified parity and even numbers can also be calculated as follows: that is, directly taking four cases: BVL=(BVLhor-1, BVLver-1), BVL=(BVLhor+1, BVLver-1), BVL=(BVLho-1r, BVLver+1), and BVL=(BVLhor+1, BVLver+1).
[0248] For example, in the embodiment of the present application, BVL can be adjusted to form multiple situations, thereby achieving adjustment of BVC. Among them, when BVL is an odd number, BVL=(BVLhor, BVLver), BVL=(BVLhor+1, BVLver), BVL=(BVLhor, BVLver+1), BVL=(BVLhor+1, BVLver+1), BVL=(BVLhor+3, BVLver), BVL=(BVLhor, BVLver+3), BVL=(BVLhor+3, BVLver+3), BVL=(BVLhor-2, BVLver), BVL=(BVLhor, BVLver-2), etc., and a list is constructed for these candidates in order. When BVL is even, various cases are taken, such as BVL=(BVLhor, BVLver), BVL=(BVLhor-1, BVLver), BVL=(BVLhor, BVLver-1), BVL=(BVLhor-1, BVLver-1), BVL=(BVLhor-3, BVLver), BVL=(BVLhor, BVLver-3), BVL=(BVLhor-3, BVLver-3), BVL=(BVLhor+2, BVLver), and BVL=(BVLhor, BVLver+2). Then, Table 8 can be used to scale BVL according to the color sampling format to obtain BVC. In this way, when BVL is odd or even, multiple BVC candidates will be formed, and these candidates will be added to the chroma BVC candidate list.
[0249] Exemplarily, in an embodiment of the present application, operations in different situations of unified parity and even numbers can also be performed by the following calculations: that is, directly taking BVL=(BVLhor-1, BVLver-1), BVL=(BVLhor+1, BVLver-1), BVL=(BVLhor-1, BVLver+1), BVL=(BVLhor+1, BVLver+1), BVL=(BVLhor+3, BVLver-1), BVL=(BVLhor-1, BVLver+3), BVL=(BVLhor+3, BVLver+3), BVL=(BVLhor-3, BVLver-1), BVL=(BVLhor-1, BVLver-3), etc.
[0250] Exemplarily, in an embodiment of the present application, the obtained BVC can also be adjusted to obtain nine candidates: that is, set BVC = (BVChor, BVCver), BVC = (BVChor-1, BVCver), BVC = (BVChor, BVCver-1), BVC = (BVChor-1, BVCver-1), BVC = (BVChor+1, BVCver), BVC = (BVChor, BVCver+1), BVC = (BVChor+1, BVCver+1), BVC = (BVChor-1, BVCver+1), BVC = (BVChor+1, BVCver-1), thus forming nine BVC candidates, which are added to the chroma BVC candidate list.
[0251] Exemplarily, in an embodiment of the present application, the obtained BVC may be adjusted to obtain a variety of candidates: that is, setting BVC=(BVChor, BVCver), BVC=(BVChor-1, BVCver), BVC=(BVChor, BVCver-1), BVC=(BVChor-1, BVCver-1), BVC=(BVChor+1, BVCver), BVC=(BVChor, BVCver+1), BVC=(BVChor+1, BVCver+1), BVC=(BVChor-1, BVCver+1), BVC=(BVChor+1, BVCver-1), BVC=(BVChor-2, BVCver), BVC=(BVChor, BVCver-2), BVC=(BVChor-2, BVCver-2), BVC=(BVChor+2, BVCver), BVC=(BVChor, BVCver+2), BVC=(BVChor+2, BVCver+2), BVC=(BVChor-2, BVCver+2), BVC=(BVChor+2, BVCver-2), etc., thus forming a variety of BVC candidates, which are added to the chroma BVC candidate list.
[0252] It should be noted that in the embodiments of this application, when BVL is odd or even, since BVL is a two-dimensional vector, this specifically refers to whether one of its components is odd or even. In addition, the "+1", "-1", "+2", "-2", "+3", and "-3" here all refer to integer pixel precision.
[0253] Furthermore, in some embodiments, when determining a candidate list of block vector parameters of the second color component of the current block based on the second block vector parameters of the first color component block, the optimal block vector parameters can be first determined based on the second block vector parameters; then, the optimal block vector parameters are scaled according to a preset sampling format to determine the candidate block vector parameters of the second color component; and then, the candidate list of block vector parameters can be determined based on the candidate block vector parameters.
[0254] For example, in the embodiment of the application, in the IBC mode under single-tree inter-frame prediction and single-tree partitioning, the luma BV, denoted as BVL, is subjected to RDO to determine the optimal BVL (optimal block vector parameter), and then the optimal block vector parameter is scaled according to the preset sampling format to obtain the chroma BV, denoted as BVC. The optimal block vector parameter can be scaled using Table 8 above, or the optimal block vector parameter can be adjusted in combination with any of the above adjustment or scaling methods to obtain the corresponding candidate block vector parameters, thereby completing the construction of the block vector parameter candidate list.
[0255] Furthermore, in some embodiments, when determining a candidate list of block vector parameters of the second color component of the current block based on the second block vector parameters of the first color component block, the optimal block vector parameters corresponding to the first color component block can be determined first; and then the candidate list of block vector parameters of the second color component of the current block can be determined based on the optimal block vector parameters.
[0256] For example, in the application embodiment, the optimal block vector parameter corresponding to the luminance block can be searched through the template, which is recorded as BVL; then, a block vector parameter candidate list is constructed based on the optimal block vector parameter by combining any of the above list construction methods.
[0257] It can also be understood that in the embodiments of the present application, when determining the first block vector parameter of the current block based on the block vector parameter candidate list, it is also necessary to determine whether the candidate block vector parameters are available, that is, it is necessary to select one or more available candidate block vector parameters from the block vector parameter candidate list. Therefore, in some embodiments, determining the first block vector parameter of the current block based on the block vector parameter candidate list may include:
[0258] Determine whether there are one or more candidate block vector parameters that meet the first availability condition in the block vector parameter candidate list; if there are one or more candidate block vector parameters that meet the first availability condition in the block vector parameter candidate list, determine the first block vector parameter of the current block based on the one or more candidate block vector parameters.
[0259] Specifically, in the embodiment of the present application, only when the candidate block vector parameter meets the first availability condition can the candidate block vector parameter be determined as the first block vector parameter of the current block.
[0260] In some embodiments, one or more candidate block vector parameters satisfy a first availability condition, including but not limited to:
[0261] The offset position indicated by the one or more candidate block vector parameters does not exceed the image boundary;
[0262] The offset position indicated by the one or more candidate block vector parameters does not exceed the slice boundary;
[0263] The offset position indicated by one or more candidate block vector parameters does not cover the current block;
[0264] The offset position indicated by one or more candidate block vector parameters does not exceed a preset available area;
[0265] The offset position indicated by one or more candidate block vector parameters has been reconstructed.
[0266] It should be noted that in this embodiment of the present application, assuming the current block position is (xCb, yCb), for each candidate block vector parameter, BVC = (BVChor, BVCver), the corresponding offset position is found (xCb + BVChor, yCb + BVCver). Here, the offset position does not exceed the image boundary and can also be specifically described using data such as coordinate position information and the size parameters of the current block. For example, xCb + width + BVChor < = xCb or yCb + height + BVCver < = yCb.
[0267] It should also be noted that, in the embodiment of the present application, the first availability condition may also consider whether the slice boundary is exceeded. For example, the offset position indicated by one or more candidate block vector parameters does not exceed the slice boundary, or the offset position indicated by one or more candidate block vector parameters does not exceed the tile boundary.
[0268] It should be understood that in the embodiment of the present application, only when all of the above conditions are met can it be determined that the candidate block vector parameters meet the first availability condition, that is, the candidate block vector parameters are available. In a specific embodiment, taking one of the candidate block vector parameters as an example, the candidate block vector parameters meet the first availability condition, which at least includes: the offset position indicated by the candidate block vector parameter does not exceed the image boundary; the offset position indicated by the candidate block vector parameter does not exceed the slice boundary; the offset position indicated by the candidate block vector parameter does not overlap the current block; the offset position indicated by the candidate block vector parameter does not exceed the preset available area; and the offset position indicated by the candidate block vector parameter has been reconstructed.
[0269] For example, Figure 10 shows a schematic diagram of a structure for determining whether an offset position does not cover the current block, provided by an embodiment of the present application. As shown in Figure 10, a block filled with black represents the current block, an area filled with diagonal lines represents an available area, and an unfilled area represents an unavailable area. For the current block, if the offset position indicated by the candidate block vector parameter is in an unavailable area, then the offset position covers the current block.
[0270] For example, FIG11 shows a schematic diagram of a structure of whether an offset position exceeds a preset available area provided by an embodiment of the present application. As shown in FIG11 , a block filled with black represents a current block, an area filled with oblique lines represents an available area, and the reference blocks in the available area have all been reconstructed. In an embodiment of the present application, taking into account the storage capacity of the Buffer, under normal circumstances, the reference blocks adjacent to the current block (m, n) can be specifically: reference block (m-2, n-2), reference block (m-1, n-2), reference block (m, n-2), reference block (m+1, n-2), reference block (m-2, n-1), reference block (m-1, n-1), reference block (m, n-1), reference block (m+1, n-1), reference block (m-2, n), reference block (m-1, n), etc. as preset available areas.
[0271] Furthermore, in some embodiments, when constructing a block vector parameter candidate list, the method may also include: if all candidate block vectors in the block vector parameter candidate list do not meet the first availability condition, adjusting at least one candidate block vector parameter in the block vector parameter candidate list until at least one candidate block vector parameter meets the first availability condition.
[0272] In an embodiment of the present application, if all candidate block vectors in the block vector parameter candidate list do not meet the first availability condition, then the predicted value of the second color component of the current block can be determined according to other modes; wherein the other modes include at least one of the following: PLANAR mode, DM mode, DC mode, CCLM mode and skip mode.
[0273] In the embodiment of the present application, candidate block vector parameters for the second color component may be first determined based on the second block vector parameters of the first color component block; if the candidate block vector parameters meet the first availability condition, the candidate block vector parameters are corrected, and a block vector parameter candidate list is determined based on the corrected candidate block vector parameters. Accordingly, if the candidate block vector parameters do not meet the first availability condition, the candidate block vector parameters are adjusted until the adjusted candidate block vector parameters meet the first availability condition.
[0274] It should be noted that, in an embodiment of the present application, when the candidate block vector parameters are corrected, the offset position of the current block can be determined based on the candidate block vector parameters and the position information of the current block; then, a search process is performed based on the offset position of the current block to determine the corrected candidate block vector parameters.
[0275] It should also be understood that in the embodiment of the present application, after the second block vector parameters of the first color component block are scaled according to the preset sampling format, the obtained candidate block vector parameters need to be further corrected. Before the correction, it is necessary to determine whether the candidate block vector parameters meet the first usability condition; when the candidate block vector parameters meet the first usability condition, the candidate block vector parameters of the current block are corrected, thereby determining the corrected parameters as the first block vector parameters of the current block; or, when the candidate block vector parameters do not meet the first usability condition, the candidate block vector parameters are adjusted until the adjusted block vector parameters meet the first usability condition; and the adjusted block vector parameters are then corrected, thereby determining the corrected parameters as the first block vector parameters of the current block.
[0276] That is to say, in the embodiment of the present application, the chroma BV can be corrected, and then the corrected BVC is added to the chroma BVC candidate list. At this time, the BVC candidate list only contains the corrected BVC.
[0277] For example, after obtaining the chroma BV scaled according to the preset sampling format, it is further modified. Before modification, it is necessary to first determine whether the BV is available. If it is available, the modification is performed, or if it is not available, it is adjusted to be available and then modified. The modified BVC is added to the chroma BVC candidate list.
[0278] When determining whether it is available, the position of the current block (xCb, yCb) can be obtained, the chroma BVC = (BVChor, BVCver), the corresponding offset position (xCb + BVChor, yCb + BVCver) can be found, and the following conditions (i.e., the first available condition) can be determined. If all of them are met, the chroma BV is available:
[0279] Whether the obtained offset position does not exceed the image boundary;
[0280] Whether the obtained offset position does not cover the current block, see Figure 10 for details;
[0281] Whether the obtained offset position does not exceed the preset available area, see Figure 11 for details;
[0282] Whether the obtained offset position has been reconstructed.
[0283] For example, in an embodiment of the present application, the correction method can be performed using a template search. That is, after obtaining the corrected chroma BV parameters, the offset position is found using the position of the current block and the corrected chroma BV parameters. Then, a template matching method is used to perform a fine search near the offset position to obtain the optimal chroma BV parameters. The reference block at the optimal offset position obtained after the fine search is copied to obtain the chroma prediction block of the current block. As shown in Figure 12, the area filled with oblique lines represents the chroma reconstruction area. For the current block, the template matching method can be used to find the best matching template and the corresponding best BV. Based on the best BV (i.e., the IntraTMP BV), the reference block of the current block can be determined, and the chroma prediction value of the current block can be determined.
[0284] Since whether BV is available has been determined before the correction, it is not necessary to determine whether it is available (whether the first availability condition is met) subsequently, but the second block vector parameters can be determined directly.
[0285] Furthermore, in an embodiment of the present application, before constructing the block vector parameter candidate list, the second block vector parameter of the first color component block may be corrected, and the block vector parameter candidate list may be determined based on the corrected first block vector parameter. For example, the luma BVL may be corrected, and then the BVC candidate list may be constructed using any of the above list construction schemes.
[0286] For example, in an embodiment of the present application, the co-located luminance region corresponding to the current block can be obtained first. As shown in FIG13 , which is a schematic diagram of the coordinates and block size of the current chroma block and the co-located luminance region, the position of the current block chromaPos = (xCb, yCb) is obtained. Based on Table 4 above, chromaPos is scaled according to the color sampling format to obtain the co-located luminance region position lumaPos = (xCb_Y, yCb_Y) corresponding to the current block. The size parameter chromaSize = (cbWidth, cbHeight) of the current block is obtained. Based on the mapping relationship shown in Table 9, chromaSize is scaled according to the color sampling format to obtain the co-located luminance region size lumaSize = (cbWidth_Y, cbHeight_Y) corresponding to the current block.
[0287] Table 9
[0288] Exemplarily, the brightness BVL can be further corrected. Before the correction, it is necessary to determine whether the BVL is available (whether it meets the second availability condition). If it is available, the correction is performed; or, if it is unavailable, it is adjusted to be available and then corrected.
[0289] In some embodiments, when determining whether BVL is available, the position of the co-located luminance region (xCb_Y, yCb_Y) is obtained, the luminance BVL is obtained as (BVLhor, BVLver), and the corresponding offset position (xCb_Y+BVLhor, yCb_Y+BVLver) is found, as shown in FIG14 . The luminance BVL (first block vector parameter) is available if all of the following conditions are met, including but not limited to the following conditions:
[0290] The offset position indicated by the first block vector parameter does not exceed the image boundary;
[0291] The offset position indicated by the first block vector parameter does not exceed the slice boundary;
[0292] The offset position indicated by the first block vector parameter does not exceed the preset available area, as shown in FIG11 ;
[0293] The offset position indicated by the first block vector parameter has been reconstructed.
[0294] Furthermore, in an embodiment of the present application, when performing correction processing, the offset position of the first color component block is determined based on the second block vector parameters of the first color component block and the position information of the first color component block; and a search process is performed based on the offset position of the first color component block to determine the corrected second block vector parameters.
[0295] Exemplarily, the correction process includes but is not limited to the following methods: using the same-position luminance area search corresponding to the current block for correction, that is, after obtaining the luminance BVL, using the position of the same-position luminance area and the obtained luminance BVL to find the offset position, using the same-position luminance area to perform a detailed search near the offset position, the range of the detailed search needs to meet the limited available area (as shown in Figure 11), and finally obtaining the optimal luminance BVL.
[0296] It can be understood that in the embodiment of the present application, the method of constructing the block vector parameter candidate list includes but is not limited to the multiple situations described above, and different methods can be used to construct a candidate list at the same time.
[0297] Furthermore, in some embodiments, determining the first block vector parameter of the current block based on one or more candidate block vector parameters may include: if there is a candidate block vector parameter that meets the first availability condition in the block vector parameter candidate list, determining the candidate block vector parameter that meets the first availability condition as the first block vector parameter; if there are multiple candidate block vector parameters that meet the first availability condition in the block vector parameter candidate list, making a decision on the multiple candidate block vector parameters that meet the first availability condition to determine the first block vector parameter.
[0298] It should be noted that in the embodiment of the present application, if there are one or more candidate block vector parameters that meet the first availability condition, then when determining the first block vector parameter based on the one or more candidate block vector parameters, a certain candidate block vector parameter that meets the first availability condition can be directly determined as the first block vector parameter. In other words, if only one BVC candidate in the constructed available BVC candidate list meets the first availability condition, then the BVC (first block vector parameter) that is ultimately selected is that BVC.
[0299] It should also be noted that, in an embodiment of the present application, if there are one or more candidate block vector parameters that meet the first availability condition, then when determining the first block vector parameter based on the one or more candidate block vector parameters, a decision can be made on the multiple candidate block vector parameters that meet the first availability condition. Specifically, the decision can be made by: determining a first template for the current block; determining first matching templates for each of the multiple candidate block vector parameters based on the first template and the multiple candidate block vector parameters; when the first template and the first matching template meet the second condition, calculating the matching error between the first template of the current block and the first matching template based on a preset error criterion to determine first cost values for each of the multiple candidate block vector parameters; determining a minimum cost value from the first cost values of the multiple candidate block vector parameters, and determining the candidate block vector parameter corresponding to the minimum cost value as the first block vector parameter.
[0300] That is, in the embodiment of the present application, for multiple candidate block vector parameters that meet the first availability condition, after determining the first generation values corresponding to the multiple candidate block vector parameters, one or more second block vector parameters can be determined from the multiple candidate block vector parameters based on the first generation values. For example, if the constructed available BVC candidate list has multiple available BVC candidates, then a decision needs to be made among these available BVCs to obtain the final BV. The decision-making method includes but is not limited to a decision-making method using a template.
[0301] It can be understood that in the embodiment of the present application, the first template includes one or more sample values in the adjacent decoded area of the current block. Accordingly, the type of the first template can include at least one of the following: upper template, upper right template, left template, lower left template, and upper left template. Among them, the upper template is located in the upper decoded area adjacent to the current block, the upper right template is located in the upper right decoded area adjacent to the current block, the left template is located in the left decoded area adjacent to the current block, the lower left template is located in the lower left decoded area adjacent to the current block, and the upper left template is located in the upper left decoded area adjacent to the current block.
[0302] That is to say, in an embodiment of the present application, when selecting a template (the first template of the current block), it is possible to determine whether the pixels at the template position are available, including reconstructing chrominance information, based on the pixel availability of the adjacent areas of the current block. Figure 15 is a schematic diagram of the template type. As shown in Figure 15, based on the relative position relationship between the template and the current block, the template can be classified into template types such as upper template, left template, upper right template, lower left template, and upper left template. Among them, the sizes of different types of templates for different coding blocks can be fixed the same or different.
[0303] For example, the template size selects the same template size for the current block of any size. The following formula illustrates a setting condition for the template size, where nTbW and nTbH are the width and height of the current block, and iTempW and iTempH are the width and height of the template used:
[0304] Upper template:
[0305] Left template:
[0306] For example, you can select different template sizes based on the current block size. The following formula illustrates a template size setting condition, where nTbW and nTbH are the width and height of the current block, and iTempW and iTempH are the width and height of the template used:
[0307] Upper template:
[0308] Left template:
[0309] in,
[0310] For example, different template sizes can also be selected based on the number of pixels in the current block. The following formula illustrates a template size setting condition, where nTbW and nTbH are the width and height of the current block, nTbW×nTbH is the number of pixels in the current block, and iTempW and iTempH are the width and height of the template used:
[0311] Upper template:
[0312] Left template:
[0313] In some embodiments, when determining the first matching template based on multiple candidate block vector parameters, the position of the current point can be used as the starting point, and the area indicated by the multiple candidate block vector parameters, which has the same shape and contains the same number of sample values as the first template, can be determined as the first matching template.
[0314] For example, in an embodiment of the present application, when determining the first matching template, the first template of the current block is used to perform motion compensation on the multiple BVC candidates obtained (i.e., candidate block vector parameters that meet the first availability condition) to obtain a template corresponding to the BV (the first matching template). Figure 16 is a schematic diagram of template motion compensation. As shown in Figure 16, if the BV (BVC candidate) is available, motion compensation is performed using the first template and the BV to obtain a template corresponding to the BV, i.e., the first matching template.
[0315] It can also be understood that in the embodiment of the present application, the preset error criterion may include but is not limited to any one of the absolute error sum SAD, transformed absolute error SATD, difference square sum SSE, mean absolute difference MAD, mean absolute error MAE, mean square error MSE, etc.
[0316] For example, in an embodiment of the present application, when performing cost calculation, that is, when determining the first-generation value, there are multiple options for the cost function for calculating the cost of the template area, that is, there are multiple options for the preset error criteria. For example, you can choose the evaluation criteria such as the sum of absolute deviations (SAD), the sum of transformed absolute deviations (SATD), the sum of squared differences (SSE), the mean absolute difference (MAD), the mean absolute error (MAE), and the mean squared error (MSE). Any evaluation criterion mentioned in the following content can be selected from the above criteria. Taking the evaluation criterion of SAD as an example, the calculation formula is as follows:
[0317] Among them, predTempSizeW is the width of the template, predTempSizeH is the height of the template, predTemp[i][j] is the pixel point of the template at BV, and recTempC[i][j] is the pixel point of the current block template.
[0318] Furthermore, in some embodiments, the method may further include: when the first template and the first matching template do not satisfy the second condition, determining the first candidate block vector parameter in the block vector parameter candidate list that satisfies the first availability condition as the first block vector parameter; or,
[0319] When the first template and the first matching template do not satisfy the second condition, a candidate block vector parameter at a preset position in the block vector parameter candidate list that satisfies the first availability condition is determined as the first block vector parameter.
[0320] That is to say, if the first template and the first matching template meet the second condition, the matching error between the first template and the first matching template of the current block can be calculated according to the preset error criterion to select the candidate block vector parameter corresponding to the minimum cost value as the first block vector parameter; if the first template and the first matching template do not meet the second condition, the candidate block vector parameter at the specific position of the first candidate block vector parameter that meets the first available condition in the block vector parameter candidate list can be used as the first block vector parameter.
[0321] For example, the following situations exist for template usage when calculating the cost (i.e., cost value) based on whether the first template and the first matching template meet the second condition:
[0322] The first type: the upper template and the left template of the current block both exist, and the upper template and the left template at the corresponding BV both exist. In this case, both the upper template and the left template are available.
[0323] The second method is: Both the upper and left templates of the current block exist, but only the upper template exists at the corresponding BV. In this case, there are two methods: Method 1: If the left template at the corresponding BV does not exist, it is directly ignored, that is, only the upper template is used for calculation. Method 2: If the left template at the corresponding BV does not exist, the leftmost template width column in the reference block is used instead of the left template, that is, the upper and left templates are used for calculation.
[0324] The third method is: both the upper template and the left template of the current block exist, but only the left template exists at the corresponding BV. In this case, there are two methods: Method 1: If the upper template does not exist at the corresponding BV, it is directly not used, that is, only the left template is used for calculation. Method 2: If the upper template does not exist at the corresponding BV, the uppermost template height row inside the reference block is used instead of the upper template, that is, the upper and left templates are used for calculation.
[0325] The fourth scenario: Only the upper template exists in the current block. There are three possible approaches: Method 1: If the upper template at the corresponding BV does not exist, it is not used. The final BV selected is the first BVC in the BVC candidate list or the BVC at a specified position. Method 2: If the upper template at the corresponding BV does not exist, the uppermost template height row in the reference block is used instead. Method 3: If the upper template at the corresponding BV exists, it is used directly.
[0326] The fifth method: Only the left template exists in the current block. In this case, there are three methods: Method 1: If the left template at the corresponding BV does not exist, it is directly used. In this case, the final BV selected is the first BVC in the BVC candidate list or the BVC at a specified position. Method 2: If the left template at the corresponding BV does not exist, the leftmost template width column in the reference block is used instead. Method 3: If the left template at the corresponding BV exists, it is directly used.
[0327] The sixth type: Neither the upper template nor the left template of the current block exists. At this time, the BV finally selected is the first BVC in the BVC candidate list or the BVC at a specified position.
[0328] For example, in an embodiment of the present application, when determining the first block vector parameter based on the first cost values of each of the multiple candidate block vector parameters, excluding the case where the cost cannot be calculated, the cost of each candidate in the candidate list of BVC is calculated and sorted. The sorting method includes but is not limited to bubble sort, selection sort, insertion sort, shell sort, merge sort, quick sort, radix sort, heap sort, counting sort, bucket sort and other sorting methods. Any number of BVCs with the lowest cost are selected as the final BV (first block vector parameter) to perform chromaticity prediction based on BV. It should also be noted that when calculating the cost value of multiple candidate block vector parameters, a cost can be calculated for each candidate block vector parameter, and the candidate block vector parameter with the lowest cost is always retained. In this case, a list is not required, and even sorting is not required.
[0329] Furthermore, in an embodiment of the present application, if all candidate block vector parameters in the block vector parameter candidate list do not meet the first availability condition, the candidate block vector parameters in the block vector parameter candidate list are adjusted until there are one or more candidate block vector parameters in the block vector parameter candidate list that meet the first availability condition.
[0330] That is to say, in an embodiment of the present application, if all candidate block vector parameters in the block vector parameter candidate list are unavailable, that is, all candidate block vector parameters in the block vector parameter candidate list do not meet the first availability condition, then you can choose to adjust any one or more BVC candidates (candidate block vector parameters) in the block vector parameter candidate list until they are available. Among them, the adjustment method is not limited to cropping, scaling, etc. It is also possible to use, but not limited to, PLANAR mode or CCLM-type mode or angular prediction mode for prediction, that is, to select other modes to determine the predicted value of the second color component of the current block. For example, if it is PLANAR mode or CCLM-type mode or angular prediction mode, reference pixels and mode parameters can be obtained for chrominance prediction.
[0331] S602: Determine a first color component reference sample and a second color component reference sample corresponding to the current block based on the first block vector parameter, and establish a mapping relationship between the first color component and the second color component according to the first color component reference sample and the second color component reference sample.
[0332] It should be noted that, in the embodiment of the present application, after determining the first block vector parameter, the luma reference sample and the chroma reference sample at the first block vector parameter may be obtained. In some embodiments, determining the first color component reference sample and the second color component reference sample corresponding to the current block based on the first block vector parameter may include:
[0333] Determine the position of the current block; scale the position of the current block to determine the position of the first color component area at the same position of the current block; and scale the first block vector parameter to determine the third block vector parameter of the first color component area at the same position of the current block; determine a reference block of the first color component based on the position of the first color component area and the third block vector parameter, and determine a first color component reference sample corresponding to the current block based on the reference block of the first color component; determine a reference block of the second color component based on the position of the current block and the first block vector parameter, and determine a second color component reference sample corresponding to the current block based on the reference block of the second color component.
[0334] In the embodiment of the present application, the position of the first color component region can be obtained by scaling the position of the current block according to a preset sampling format; the third block vector parameter of the first color component region can also be obtained by scaling the first block vector parameter according to a preset sampling format. Here, the preset sampling format can be referred to in Table 4 above. It should be noted that the third block vector parameter can be obtained by amplifying the chroma BV (first block vector parameter); however, considering that the luma BV may suffer from precision loss, the luma BV obtained by amplifying the chroma BV is not necessarily equal to the original luma BV (second block vector parameter).
[0335] For example, the current block is a chroma block, and the first color component region at the same location is the co-located luma region. To obtain the first color component reference sample (luma reference sample), first obtain the position of the current block, that is, the position of the upper-left chroma sample of the current block relative to the upper-left chroma sample of the current image, chromaPos = (x, y). ChromaPos is then scaled according to the color sampling format shown in Table 4 to obtain the co-located luma region position corresponding to the current block, lumaPos = (xCb, yCb).
[0336] Exemplarily, obtain chroma BV = (BVChor, BVCver), scale the chroma BV according to the color sampling format shown in Table 4, and obtain the luminance BV = (BVYhor, BVYver) of the co-located luminance region corresponding to the current block. Obtain the position of the co-located luminance region corresponding to the current block lumaPos = (xCb, yCb), obtain luminance BV = (BVYhor, BVYver), and find the offset position (xCb + BVYhor, yCb + BVYver) corresponding to the co-located luminance region corresponding to the current block, as shown in Figure 17.
[0337] In a specific implementation, after obtaining the luma sample at the offset position, it may be downsampled to obtain a luma reference sample. In some embodiments, determining the first color component reference sample corresponding to the current block based on the reference block of the first color component may include: downsampling the reference block of the first color component to determine the first color component reference sample corresponding to the current block, so that the resolution of the first color component reference sample is the same as the resolution of the second color component reference sample.
[0338] It should be noted that in the embodiment of the present application, since the resolutions of the luma samples and the chroma samples are inconsistent, it is necessary to downsample the luma samples so that the resolutions of the downsampled luma samples and the chroma samples are the same. As shown in Figure 18, it shows a schematic diagram of the downsampling position.
[0339] It should also be noted that in the embodiment of the present application, the following sampling methods can be used to compete or default to a certain sampling method, but they include but are not limited to the following six sampling methods. For example, assuming that the brightness sample before downsampling is recBvBefDownLuma, the width of the storage buffer is iRecRefLumaStride, and the brightness sample after downsampling is recBvAftDownLuma, then the brightness sample after downsampling at position (i, j) is:
[0340] ① Downsampling method 1:
[0341] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]*2
[0342] +recBvBefDownLuma[2*i+1]
[0343] +recBvBefDownLuma[2*i-1]
[0344] +recBvBefDownLuma[2*i+iRecRefLumaStride]*2
[0345] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]
[0346] +recBvBefDownLuma[2*i-1+iRecRefLumaStride]+4)>>3;
[0347] ② Downsampling method 2:
[0348] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
[0349] +recBvBefDownLuma[2*i+1]+1)>>1;
[0350] ③ Downsampling method three:
[0351] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
[0352] +recBvBefDownLuma[2*i+iRecRefLumaStride]+1)>>1;
[0353] ④ Downsampling method 4:
[0354] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+iRecRefLumaStride]
[0355] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1;
[0356] ⑤ Downsampling method five:
[0357] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+1]
[0358] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1;
[0359] ⑥ Downsampling method six:
[0360] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
[0361] +recBvBefDownLuma[2*i+1]
[0362] +recBvBefDownLuma[2*i+iRecRefLumaStride]
[0363] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+2)>>2.
[0364] In this way, after downsampling, the downsampled luminance reference sample recBvAftDownLuma at the co-located luminance area BV corresponding to the current block is obtained.
[0365] Furthermore, for the chroma sample of the current block, first obtain the position of the current block (xCbC, yCbC), obtain the chroma BV = (BVChor, BVCver), find the corresponding offset position (xCbC+BVChor, yCbC+BVCver), that is, obtain the chroma reference sample recBvChroma at the BV corresponding to the current block.
[0366] In this way, a mapping relationship between luminance and chrominance can be constructed according to the luminance reference sample recBvAftDownLuma and the chrominance reference sample recBvChroma.
[0367] In some embodiments, establishing a mapping relationship between the first color component and the second color component based on the first color component reference sample and the second color component reference sample can include: determining a first lookup table based on the first color component reference sample and the second color component reference sample, wherein the first lookup table is used to record the value of the second color component corresponding to the first color component when the index keyword is the first color component.
[0368] In some embodiments, establishing a mapping relationship between the first color component and the second color component based on the first color component reference sample and the second color component reference sample may include: determining a first discrete model based on the first color component reference sample and the second color component reference sample, wherein the first discrete model is used to indicate the mapping relationship between the first color component and the second color component.
[0369] That is, in the embodiment of the present application, the mapping relationship can be a lookup table (LUT). The index key in the LUT can be the first color component, and the value in the LUT can be the second color component, that is, value = LUT[key]. Alternatively, the mapping relationship can be a discrete model used to represent the mapping relationship between key and value.
[0370] Exemplarily, assuming that the luminance component is the key and the chrominance component is the value, each key-value pair in the mapping relationship can be established in the following ways including but not limited to:
[0371] LUT[recBvAftDownLuma[i][j]] = recBvChroma[i][j](8)
[0372] It should also be noted that in the embodiments of the present application, for the first color component parameter samples, a preset sample range can also be defined. In some embodiments, the method may further include: performing a mapping process on the first color component reference samples so that the first color component reference samples are within the preset sample range.
[0373] In the embodiments of the present application, the preset sample range can be [0, (1 << bitdepth) - 1], where bitdepth represents the bit depth. Exemplarily, the preset sample range can be ranges such as [0, 255], [0, 511], etc., but no specific limitation is made. Among them, for multiple sample ranges, the rate-distortion cost method can be used to select one of them as the final preset sample range.
[0374] Exemplarily, taking a video with a bit depth greater than 8 bits as an example, assuming that the bit depth of the video is 10 bits, then the sample range is [0, 1023]. For the recBvAftDownLuma of the key value, it can be mapped to a preset sample range of [0, 255] or [0, 511].
[0375] Further, in some embodiments, the method may further include: when there are multiple second reference values that are different in the corresponding second color component reference samples while the first reference values in the first color component reference samples are the same, performing an overwriting process in sequence according to the sample order, and taking the last second reference value as the value having a mapping relationship with the first reference value.
[0376] Further, in some embodiments, the method may further include: when there are multiple second reference values that are different in the corresponding second color component reference samples while the first reference values in the first color component reference samples are the same, calculating the average value of the multiple second reference values, and taking the obtained average value as the value having a mapping relationship with the first reference value.
[0377] That is to say, in the embodiment of the present application, for different chromaticity values with the same key value in the mapping relationship, the entries with the same key value can be overwritten in sequence according to the sample order, or operations such as averaging can be taken. In addition, in the mapping relationship, the initialization setting of LUT[] is -1, that is, an unavailable value. "Overwriting" mainly means that if there is the same key value later, the new value will be used for storage; however, it is not limited to this method, and all can also be stored and then the average value can be calculated as the value corresponding to the key.
[0378] It can be understood that in the embodiment of the present application, the first color component reference sample and the second color component reference sample used to construct the mapping relationship can also be obtained in other ways, which are exemplified below in combination with several implementation methods.
[0379] In another specific implementation, the luma samples are not downsampled, and the chroma samples may be upsampled to obtain chroma reference samples. In some embodiments, determining the second color component reference samples corresponding to the current block based on the reference block of the second color component may include: upsampling the reference block of the second color component to determine the second color component reference samples corresponding to the current block, such that the resolution of the first color component reference samples is the same as the resolution of the second color component reference samples.
[0380] That is to say, in the embodiment of the present application, after obtaining the luminance sample recBvBefDownLuma of the same luminance area, no downsampling is performed. At this time, after obtaining the chrominance sample recBvChroma at the BV corresponding to the current block, upsampling is required, including but not limited to linear interpolation and other methods, to obtain the chrominance sample recBvChromaUp of the same size as the luminance sample at BV. In this way, the luminance sample recBvBefDownLuma at BV is used as the luminance reference sample, and the obtained upsampled chrominance sample recBvChromaUp is used as the chrominance reference sample; then the mapping relationship between luminance and chrominance is constructed based on the luminance reference sample and the chrominance reference sample.
[0381] Accordingly, in this embodiment of the present application, the predicted value of the second color component of the current block needs to be downsampled. That is, if the chroma samples are upsampled when constructing the mapping relationship, then the luminance-to-chroma prediction of the current block based on the mapping relationship needs to be downsampled to obtain the final chroma prediction value of the current block. The downsampling method includes but is not limited to average downsampling.
[0382] In yet another specific implementation, the method may further include: determining a first template of the current block; and determining a first color component reference sample and a second color component reference sample corresponding to the current block based on the first template.
[0383] In an embodiment of the present application, the first color component reference samples and the second color component reference samples used to establish the mapping relationship may also include the first color component reference samples and the second color component reference samples determined by the first template of the current block. Specifically, based on the first template of the current block, a first color component region template at the same location as the first template can be determined; then, based on the reconstructed samples in the first color component region template, the first color component reference samples can be determined; and based on the reconstructed samples in the first template, the second color component reference samples can be determined. The first template includes one or more reconstructed samples in the adjacent decoded area of the current block.
[0384] For example, in an embodiment of the present application, a chroma reference sample can be obtained based on the current chroma template of the current block; after determining the co-located luma region template of the current chroma template, a luma reference sample can be obtained based on the co-located luma region template. The luma reference samples and chroma reference samples obtained in the above embodiment are then combined to construct a mapping relationship between luma and chroma based on these luma reference samples and chroma reference samples.
[0385] In another specific implementation, the method may also include: determining a first template of the current block; determining a second matching template of the current block based on the first block vector parameters and the first template; and determining a first color component reference sample and a second color component reference sample corresponding to the current block based on the second matching template.
[0386] In an embodiment of the present application, the first color component reference samples and the second color component reference samples used to construct the mapping relationship may include, in addition to those determined by the reference block and the first template of the current block, the first color component reference samples and the second color component reference samples determined by the second matching template of the current block. Specifically, the first color component area matching template at the same position as the second matching template is first determined, and then the first color component reference samples can be determined based on the reconstructed samples in the first color component area matching template; and the second color component reference samples can be determined based on the reconstructed samples in the second matching template. The second matching template can be determined based on the first block vector parameter and the offset position indicated by the first template.
[0387] For example, in an embodiment of the present application, a chroma matching template for the current block can be determined based on the current chroma template and the first block vector parameters of the current block; chroma reference samples can be obtained based on the chroma matching template; after determining a co-located luma region matching template for the current chroma matching template, luma reference samples can be obtained based on the co-located luma region matching template. The luma reference samples and chroma reference samples obtained in the above embodiments are then combined to construct a mapping relationship between luma and chroma based on these luma reference samples and chroma reference samples.
[0388] S603: Determine a predicted value of a second color component of the current block according to the mapping relationship and the sample value of the first color component of the current block.
[0389] It should be noted that, in the embodiment of the present application, determining the first color component sample value of the current block may include: determining reconstructed pixel samples of the first color component region at the same location in the current block; and determining the first color component sample value of the current block based on the reconstructed pixel samples of the first color component region. The reconstructed pixel samples of the first color component region may be directly used as the first color component sample value of the current block, or the reconstructed pixel samples of the first color component region may be filtered and the filtered reconstructed pixel samples may be used as the first color component sample value of the current block, without specific limitation herein.
[0390] For example, in an embodiment of the present application, the filtering process is a downsampling process. Here, the reconstructed luminance sample recBefDownLuma at the position of the co-located luminance area lumaPos = (xCb, yCb) corresponding to the current block can be obtained, and the luminance sample is downsampled to obtain the downsampled reconstructed luminance sample recAftDownLuma, and the downsampled reconstructed luminance sample is used as the first color component sample value of the current block. In addition, if the luminance reference sample has been mapped to a sample range, then the downsampled reconstructed luminance sample also needs to be mapped to the same sample range here to obtain the first color component sample value of the current block.
[0391] In some embodiments, determining the predicted value of the second color component of the current block based on the mapping relationship and the first color component sample value of the current block may include: if a first color component value equal to the first color component sample value is found in the mapping relationship, then determining the value of the second color component corresponding to the first color component value as the predicted value of the second color component of the current block.
[0392] For example, in the embodiment of the present application, assuming that the predicted value of the current block is predSamples, then for predSamples[cIdx][x][y], the variable cIdx specifies the color component index of the current block, and the following prediction method can be used here:
[0393] With reference to the luminance value Yc at the same position, the chrominance prediction value is derived using the mapping relationship (discrete model) established in the above embodiment.
[0394] In some embodiments, for determining the predicted value of the second color component of the current block, the method may further include: if a first color component value equal to the first color component sample value is not found in the mapping relationship, then correcting the first color component sample value, determining the first color component correction value, and continuing to search in the mapping relationship whether there is a first color component value equal to the first color component correction value.
[0395] In a specific embodiment, correcting the first color component reconstructed value to determine the first color component corrected value may include performing an offset calculation on the first color component sample value according to one or more preset offset values to determine the first color component corrected value.
[0396] In the embodiment of the present application, the offset values can be +1, -1, +2, -2, +3, -3, etc., and there is no limitation on the number and specific values of the offset values. In addition, for the correction processing of the reconstructed value of the first color component, these multiple offset values can also be set in a certain order, for example, in the order of {+1, -1, +2, -2, +3, -3}.
[0397] Exemplarily, in an embodiment of the present application, for the mapping relationship established in the aforementioned embodiment, if Yc is not found in the input luminance set, the following processing methods are included but not limited to: Yc is corrected in the order of {Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3}, and then a matching check is performed in the input luminance set based on the corrected Yc, and then the value corresponding to the corrected Yc is determined as the chrominance prediction value of the current block.
[0398] In some embodiments, for determining the predicted value of the second color component of the current block, the method also includes: if a first color component value equal to the first color component correction value is not found in the mapping relationship, then performing an average value calculation on the second color component reference sample, and determining the obtained average value as the predicted value of the second color component of the current block.
[0399] Exemplarily, in an embodiment of the present application, for the mapping relationship established in the aforementioned embodiment, if Yc is not found in the input luminance set, the following processing methods are included but not limited to: Yc is corrected in the order of {Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3}; if all of the above corrected Yc cannot be matched in the mapping relationship, the chroma prediction value can be set to the average value of the reconstructed chroma sample recBvChroma at the corresponding BV.
[0400] In some embodiments, for determining the predicted value of the second color component of the current block, the method also includes: determining a first initial predicted value of the second color component of the current block based on the mapping relationship and the sample value of the first color component of the current block; performing a correction operation on the first initial predicted value to determine the predicted value of the second color component of the current block.
[0401] It should be noted that in the embodiment of the present application, a correction operation is performed on the first initial prediction value obtained according to the mapping relationship. The correction operation here may include a clip operation, a filtering operation, a weighted operation with the prediction value obtained by other prediction modes, etc., and there is no limitation on this.
[0402] In a specific embodiment, performing a correction operation on the first initial prediction value to determine the prediction value of the second color component of the current block may include: performing prediction processing on the second color component of the current block according to the first preset mode to determine the second initial prediction value of the second color component of the current block; and performing weighted calculation on the first initial prediction value and the second initial prediction value to determine the prediction value of the second color component of the current block. It should be noted that, in the embodiment of the present application, the first preset mode includes at least one of the following: PLANAR mode, DM mode, DC mode and CCLM mode. That is, performing a correction operation on the first initial prediction value obtained according to the mapping relationship may include but is not limited to weighting with the CCLM-type mode or other prediction modes to obtain the chrominance prediction value of the current block.
[0403] In another specific embodiment, performing a correction operation on the first initial prediction value to determine the prediction value of the second color component of the current block may include: limiting the first initial prediction value within a preset numerical range, or it may also be called a "clip operation". It should be noted that, in the embodiment of the present application, the lower limit value of the preset numerical range is the minimum prediction value (min), and the upper limit value of the preset numerical range is the maximum prediction value (max). If the first initial prediction value is within the preset numerical range, then the first initial prediction value can be used as the chrominance prediction value of the current block; if the first initial prediction value is greater than max, then max can be used as the chrominance prediction value of the current block; if the first initial prediction value is less than min, then min can be used as the chrominance prediction value of the current block.
[0404] In some embodiments, for determining the predicted value of the second color component of the current block, the method also includes: when the number of first block vector parameters is multiple, determining multiple third initial predicted values of the second color component of the current block; performing weighted calculation on the multiple third initial predicted values to determine the predicted value of the second color component of the current block.
[0405] It should be noted that in an embodiment of the present application, if the aforementioned embodiment determines multiple BVs (first block vector parameters), then multiple third initial prediction values can be obtained based on these multiple BVs; then these multiple third initial prediction values are weighted, and the weighted prediction values are used as the chrominance prediction values of the current block; or, the weighted prediction values can be further modified, including but not limited to weighting with CCLM-type modes or other prediction modes to obtain the chrominance prediction value of the current block.
[0406] In some embodiments, for determining the predicted value of the second color component of the current block, the method may further include: when the first color component block of the current block includes multiple candidate blocks, determining the second block vector parameters of each of the multiple candidate blocks; constructing multiple block vector parameter candidate lists of the second color component of the current block based on the second block vector parameters of each of the multiple candidate blocks, and determining multiple first block vector parameters of the second color component of the current block based on the multiple block vector parameter candidate lists; establishing a mapping relationship between the first color component and the second color component based on the multiple first block vector parameters, and determining the predicted value of the second color component of the current block based on the mapping relationship and the first color component sample value of the current block.
[0407] It should be noted that in the embodiment of the present application, multiple blocks of the same luminance region are obtained, and the positions of the multiple blocks include but are not limited to the following positions, as shown in Figure 19. First, it is determined whether the multiple blocks are available, and then the candidates for their respective chrominance BVC candidate lists are constructed based on the luminance BVs of the available blocks in the multiple blocks; the multiple blocks are respectively judged for the availability of the BVs in the candidate list, and the multiple blocks are further determined to have one or more BVs. All the available chrominance BVCs of the multiple blocks can establish a mapping table LUT between luminance and chrominance, so that according to this mapping table LUT, the chrominance prediction value of the current block can be obtained.
[0408] In some embodiments, for determining the predicted value of the second color component of the current block, the method also includes: determining multiple groups of first color component reference samples and second color component reference samples corresponding to the current block based on multiple first block vector parameters; establishing multiple candidate mapping relationships between the first color component and the second color component according to the multiple groups of first color component reference samples and second color component reference samples corresponding to the current block; decoding the code stream to determine the mapping relationship index value; determining the target mapping relationship according to the mapping relationship index value and the multiple candidate mapping relationships; determining the predicted value of the second color component of the current block according to the target mapping relationship and the first color component sample value of the current block.
[0409] It should be noted that in an embodiment of the present application, multiple mapping tables LUT between luminance and chrominance can be established, and then the selected target mapping table LUT can be indicated using syntax elements. Exemplarily, multiple blocks of the same luminance area are obtained, and the positions of the multiple blocks include but are not limited to the following positions, as shown in Figure 19. First, it is determined whether these multiple blocks are available, and then the candidates for their respective chrominance BVC candidate lists are constructed according to the luminance BV of the available blocks in these multiple blocks; the multiple blocks are judged for the availability of the BV in the candidate list, and the multiple blocks are further determined to have one BV or multiple BVs, and a mapping table LUT can be established for each of the available chrominance BVCs of these multiple blocks; at the decoding end, the mapping relationship index value can be determined by decoding the corresponding syntax elements; then the target mapping relationship can be determined according to the mapping relationship index value, and then the chrominance prediction value of the current block can be determined. It should be noted that the number of mapping relationships established here can be set arbitrarily, for example, the number can be set to 4, but there is no specific limitation.
[0410] In some embodiments, for determining the predicted value of the second color component of the current block, the method also includes: determining multiple groups of first color component reference samples and second color component reference samples corresponding to the current block based on multiple first block vector parameters; establishing multiple candidate mapping relationships between the first color component and the second color component based on the multiple groups of first color component reference samples and second color component reference samples corresponding to the current block; performing matching error calculation on the multiple candidate mapping relationships based on the template matching method to determine the second generation values of the multiple candidate mapping relationships; determining the minimum cost value from the second generation values of the multiple candidate mapping relationships, and determining the candidate mapping relationship corresponding to the minimum cost value as the target mapping relationship; determining the predicted value of the second color component of the current block based on the target mapping relationship and the first color component sample value of the current block.
[0411] In a specific embodiment, matching errors are calculated for multiple candidate mapping relationships based on a template matching method to determine the second-generation values of each of the multiple candidate mapping relationships, which may include: determining the first template of the current block; determining the reconstructed pixel sample values of the first color component area template at the same position of the first template; determining the predicted values of the second color components of the first template under multiple mapping relationships based on the multiple candidate mapping relationships and the reconstructed pixel sample values of the first color component area template; performing cost calculation based on the reconstructed values of the second color components of the first template and the predicted values of the second color components of the first template under multiple mapping relationships to determine the second-generation values of each of the multiple candidate mapping relationships.
[0412] It should be noted that in an embodiment of the present application, multiple mapping tables LUT between brightness and chrominance can be established, and then a template is used to select which mapping table LUT to use. Exemplarily, multiple blocks of the same brightness area are obtained, and the positions of the multiple blocks include but are not limited to the following positions, as shown in Figure 19. First, it is determined whether these multiple blocks are available, and then the candidates for their respective chrominance BVC candidate lists are constructed according to the brightness BV of the available blocks in these multiple blocks; the multiple blocks are judged for the availability of BV in the candidate list, and the multiple blocks are further determined to have one BV or multiple BVs, and a mapping table LUT can be established for each of the available chrominance BVCs of these multiple blocks; the current block template is predicted using different mapping tables LUT, and the difference is calculated with the reconstructed value of the template, and then a decision is made on which mapping relationship to use, and then the mapping relationship finally decided is used to determine the chrominance prediction value of the current block. It should be noted that the number of mapping relationships established here can be set arbitrarily, for example, the number can be set to 4, but there is no specific limit.
[0413] In a specific embodiment, the specific process of performing LUT prediction on the current block template is as follows:
[0414] Obtain the reconstructed luminance sample recBef DownLumaR of the co-located luminance area template lumaPos = (xCbR, yCbR) corresponding to the current block template, downsample the luminance sample to obtain the downsampled reconstructed luminance sample recAftDownLumaR, and perform mapping processing on the sample in the same sample range.
[0415] Assuming that the predicted value of the current block template is predSamplesR, for predSamplesR[cIdx][x][y], the variable cIdx specifies the color component index of the current block, and the prediction method is: refer to the luminance value Yc at the same position to derive the predicted value using the established mapping relationship. If Yc is not found in the input luminance set in the established mapping relationship, the following processing methods are included but not limited to: check in the order of {Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3}. If all the above values cannot be matched in the mapping relationship, the chroma prediction value of the current block is set to the average value of the reconstructed chroma sample recBvChroma at the corresponding BV.
[0416] When calculating the cost of the current block template and the template prediction value of each LUT, the following situations exist for the use of the template:
[0417] The first type: Both the upper template and the left template of the current block exist. In this case, both the upper template and the left template are available.
[0418] The second type: Only the upper template exists in the current block, and only the upper template is available.
[0419] The third type: Only the left template exists in the current block, and only the left template is available.
[0420] The fourth type: Neither the upper template nor the left template of the current block exists. In this case, the LUT finally selected is the first LUT created or the LUT at a specified position.
[0421] For example, in the embodiment of the present application, assuming that the reconstruction value of the current block template is recSamplesR, there are multiple options for the cost function for calculating the template region cost, for example, the sum of absolute deviations (SAD), the sum of transformed absolute deviations (SATD), the sum of squared differences (SSE), the mean absolute deviation (MAD), the mean absolute error (MAE), the mean squared error (MSE), and other evaluation criteria can be selected. The evaluation criteria mentioned in the following content can be selected from the above criteria. Taking the evaluation criterion of SAD as an example, the calculation formula is as follows:
[0422] Among them, predTempSizeW is the width of the template, predTempSizeH is the height of the template, predSamplesR[i][j] is the predicted pixel point of the current block template after LUT, and recSamplesR[i][j] is the reconstructed pixel point of the current block template.
[0423] It should also be noted that in the embodiment of the present application, when selecting the final LUT using the current block template, except for cases where the cost cannot be calculated, the cost of each established LUT candidate is calculated and sorted. The sorting method includes but is not limited to bubble sort, selection sort, insertion sort, shell sort, merge sort, quick sort, radix sort, heap sort, counting sort, bucket sort, etc. Among them, the LUT candidate with the lowest cost is selected as the final LUT used.
[0424] In some embodiments, the method further includes: decoding the code stream to determine the value of the first syntax element identification information; when the first syntax element identification information indicates that the second color component of the current block uses the target prediction mode, executing the step of determining the first block vector parameter of the current block.
[0425] It should be noted that, in an embodiment of the present application, if the value of the first syntax element identification information is a first value, it is determined that the first syntax element identification information indicates that the second color component of the current block uses the target prediction mode; if the value of the first syntax element identification information is a second value, it is determined that the first syntax element identification information indicates that the second color component of the current block does not use the target prediction mode.
[0426] It should also be noted that in an embodiment of the present application, the first color component area at the same position of the current block is determined; if the current block uses the DM mode and the first color component area is predicted based on the block vector, then the second color component of the current block is determined to use the target prediction mode.
[0427] For example, in the embodiment of the present application, under dual-tree partitioning, in DM mode, if the corresponding luminance region has BV information, the current block is predicted using the target prediction mode. For example:
[0428] If CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to MODE_IBC, set intra_bvgplt_flag=1, and the chroma intra prediction mode IntraPredModeC[xCb][yCb] uses the target prediction mode.
[0429] If CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to MODE_INTRA, if IntraTmpFlag[xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to 1, set intra_bvgplt_flag=1, then the chroma intra prediction mode IntraPredModeC[xCb][yCb] uses the target prediction mode.
[0430] In the embodiment of the present application, the first syntax element identification information can be represented by intra_bvgplt_flag or bvgplt_flag, and the target prediction mode can be represented by BVG-PLT or BVG-LUT. The chroma prediction mode is derived as follows:
[0431] The chroma intra prediction mode IntraPredModeC[xCb][yCb] uses cclm_mode_flag, cclm_mode_idx, intra_chroma_pred_mode, lumaIntraPredMode, and lumaTempPredMode specified in the following table. These padding items other than the BVG-LUT mode are exemplary given corresponding values, and are not required to be filled in with this value. Among them, Table 10 shows an example of chroma prediction mode derivation. As shown in Table 10, 0 represents Planar mode, 1 represents DC mode, 18 represents horizontal mode, 50 represents vertical mode, and 81 to 83 represent CCLM mode.
[0432] Table 10
[0433] According to Table 10, in DM mode, if intra_ibc_flag == 1, that is, the information obtained from the center block of the same luminance area contains BV, the chroma intra prediction mode IntraPredModeC[xCb][yCb] uses the BVG-LUT mode.
[0434] In some embodiments, the method further includes: decoding the code stream to determine the value of the second syntax element identification information; if the second syntax element identification information indicates that the second color component of the current block allows the use of the target prediction mode, executing the step of decoding the code stream to determine the value of the first syntax element identification information.
[0435] It should be noted that, in this embodiment of the present application, the second syntax element identification information can be represented by BvgpltEnabled. If the value of the second syntax element identification information is a first value, the second syntax element identification information indicates that the second color component of the current block is allowed to use the target prediction mode; if the value of the second syntax element identification information is a second value, the second syntax element identification information indicates that the second color component of the current block is not allowed to use the target prediction mode.
[0436] It should also be noted that in the embodiment of the present application, the first value and the second value are different. The first value and the second value can be in parameter form or in numerical form. Specifically, both the first syntax element identification information and the second syntax element identification information can be parameters written into the profile or the value of a flag / identifier, and are not specifically limited here.
[0437] For example, the first value may be set to 1 and the second value may be set to 0; or the first value may be set to 0 and the second value may be set to 1; or the first value may be set to true and the second value may be set to false; or the first value may be set to false and the second value may be set to true. In the embodiment of the present application, the first value may be set to 1 and the second value may be set to 0, but this is not specifically limited.
[0438] Exemplarily, in an embodiment of the present application, if the syntax element sps_ibc_enabled_flag is equal to 0 and sps_intratmp_enabled_flag is equal to 0, then BvgpltEnabled is equal to 0. Otherwise, the variable ModeIncludeBv is set, and if the corresponding luminance block is not encoded in a mode with BV information, ModeIncludeBv is equal to 0; otherwise, ModeIncludeBv is equal to 1.
[0439] BvgpltEnabled equals 1 if multiple of the following conditions are true simultaneously (including but not limited to the following):
[0440] ModeIncludeBv is equal to 1;
[0441] sh_slice_type is equal to I frame;
[0442] CtbLog2SizeC is less than or equal to MaxChromaIbcSize; wherein MaxChromaIbcSize may be determined according to the chroma CTU size or a preset value.
[0443] Otherwise, BvgpltEnabled is equal to 0. Here, if BvgpltEnabled is equal to 0, the value of the first syntax element identification information can be inferred to be 0.
[0444] It should also be noted that, in the embodiment of the present application, the value of the first syntax element identification information can also be determined at the encoding end based on the competition between the BVG-LUT mode and other modes. Among them, in the DM mode, in addition to the BVG-LUT mode, it can also compete with other modes. The final usage mode is determined according to the template cost. For example, instead of directly using the BV obtained by brightness, BV copy can be directly used, or the BVG-LUT mode defined in the embodiment of the present application can be used. After both modes are applied to the template of the current block, the one with the smaller template cost is selected as the target prediction mode of the current block.
[0445] This embodiment provides a decoding method, which first determines the first block vector parameter of the current block; then determines the first color component reference sample and the second color component reference sample corresponding to the current block based on the first block vector parameter; then establishes a mapping relationship between the first color component and the second color component based on the first color component reference sample and the second color component reference sample; and determines a predicted value of the second color component of the current block based on the mapping relationship and the first color component sample value of the current block. In this way, after determining the first block vector parameter of the chrominance component based on the block vector parameter of the luminance block, a mapping relationship between the luminance component and the chrominance component is established based on the luminance component reference sample and the chrominance component reference sample at the first block vector parameter, and then predicts the chrominance component using this mapping relationship. In this way, the problem of the singleness of the chrominance prediction is improved, the relevant information of the co-located luminance block is fully utilized, and the accuracy of the chrominance prediction can be improved. At the same time, based on the established mapping relationship, pixel-level prediction can also be effectively performed, thereby further saving bit rate and improving encoding and decoding efficiency.
[0446] In another embodiment of the present application, referring to FIG20 , which shows a schematic flow chart of an encoding method provided by an embodiment of the present application. As shown in FIG20 , the method may include:
[0447] S2001: Determine the first block vector parameter of the current block.
[0448] It should be noted that the encoding method in the embodiment of the present application is applied to an encoder. In addition, the encoding method may specifically refer to an intra-frame prediction method, more specifically, a block vector-based chrominance prediction method. A video image may be divided into a plurality of coding blocks, each of which may include a first color component, a second color component, and a third color component. The current block in the embodiment of the present application refers to a coding block in the video image that is currently to be subjected to chrominance prediction.
[0449] Here, if the current block predicts a first color component, and the first color component is a luminance component, then the current block may also be referred to as a luminance block; or, if the current block predicts a second color component, and the second color component is a chrominance component, then the current block may also be referred to as a chrominance block.
[0450] It should also be noted that under dual-tree partitioning, for the DM mode, when the prediction mode of the luminance block at the same position meets the first condition, the embodiment of the present application can derive the first block vector parameters applied to chrominance based on the block vector parameters of the luminance block at the same position, thereby improving the coding efficiency.
[0451] In some embodiments, determining the first block vector parameters of the current block may include: determining a first color component block of the current block; determining a second block vector parameter of the first color component block when a prediction mode of the first color component block satisfies a first condition; and determining the first block vector parameter of the current block based on the second block vector parameter of the first color component block.
[0452] It can be understood that in an embodiment of the present application, determining the first color component block of the current block may include: determining the first color component area at the same position of the current block; and determining the first color component block of the current block from multiple blocks divided from the first color component area.
[0453] It should be noted that, in the embodiment of the present application, if the first color component is a luminance component, then the first color component region may also be referred to as a "co-located luminance region". For example, if the current block is a chrominance block, then the co-located luminance region may refer to the co-located luminance region corresponding to the current block. For the current block, the co-located first color component region may be divided into blocks, for example, using a binary tree structure, a ternary tree structure, a quadtree structure, etc., to obtain multiple blocks, each of which may be regarded as a CU, a sub-block, or a transform block, etc.; then, the first color component block of the current block is determined from these multiple blocks.
[0454] For example, in Figure 3, the area filled with diagonal lines represents the co-located luminance area corresponding to the chrominance component. Within this co-located luminance area, multiple blocks can be divided; the block at the center can be selected from these blocks as the corresponding luminance block of the current block. For example, the block filled with black in Figure 3 is the corresponding luminance block of the current block (the first color component block).
[0455] Further, in some embodiments, determining the first color component block of the current block from the multiple blocks divided by the first color component area may include: selecting a target block from the multiple blocks divided by the first color component area, and using the target block as the first color component block of the current block.
[0456] The target block can be a block at any position. In a specific embodiment, the block at the center of the first color component area is selected as the target block; or the block at the upper left corner of the first color component area is selected as the target block; or the block at the lower right corner of the first color component area is selected as the target block.
[0457] Furthermore, in some embodiments, determining the first color component block of the current block may include: determining the position information of the current block; scaling the position information of the current block according to a preset sampling format to obtain the co-located area position information corresponding to the current block; determining the target position information based on the co-located area position information, and using the target block containing the target position information as the first color component block of the current block.
[0458] Furthermore, in some embodiments, determining the target position information based on the co-located area position information may include: calculating the center position based on the co-located area position information, and using the obtained center position information as the target position information; or, calculating the upper left corner position based on the co-located area position information, and using the obtained upper left position information as the target position information; or, calculating the lower right corner position based on the co-located area position information, and using the obtained lower left position information as the target position information.
[0459] In an embodiment of the present application, the preset sampling format may be a chroma sampling format (or color sampling format). For example, the mapping relationship between the position (x, y) of the current block and the position (xCb, yCb) of the co-located area is shown in Table 4.
[0460] In one possible implementation, the position of the current block, that is, the position of the upper left chromaticity sample of the current block relative to the upper left chromaticity sample of the current image, chromaPos = (x, y), is obtained, and chromaPos is scaled according to the chroma sampling format shown in Table 4 to obtain the co-located luminance area position lumaPos = (xCb, yCb) corresponding to the current block.
[0461] Here, assuming 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 is (xCb, yCb), and the width of the co-located luminance area corresponding to the current block (that is, the entire diagonal filled area of the luminance component in Figure 3) is cbWidth, and the height is cbHeight; then the block at the center position (the block at the center position of the luminance area) is the luminance block containing the center position information (xCb+cbWidth>>1, yCb+cbHeight>>1), where the block is filled with black in Figure 3.
[0462] In another possible implementation, the position of the current block, that is, the position of the upper left chromaticity sample of the current block relative to the upper left chromaticity sample of the current image, chromaPos = (x, y), is obtained, and chromaPos is scaled according to the chroma sampling format shown in Table 4 to obtain the co-located luminance area position lumaPos = (xCb, yCb) corresponding to the current block.
[0463] Here, assuming 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 is (xCb, yCb), and the width of the co-located luminance area corresponding to the current block (that is, the entire diagonal filled area of the luminance component in Figure 7) is cbWidth, and the height is cbHeight; then the block in the upper left corner (the upper left corner block of the luminance area) is the luminance block containing the position coordinates (xCb, yCb), where the block is filled with black in Figure 7.
[0464] In another possible implementation, the position of the current block, that is, the position of the upper left chromaticity sample of the current block relative to the upper left chromaticity sample of the current image, chromaPos = (x, y), is obtained, and chromaPos is scaled according to the chroma sampling format shown in Table 4 to obtain the co-located luminance area position lumaPos = (xCb, yCb) corresponding to the current block.
[0465] Here, assuming 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 is (xCb, yCb), and the width of the co-located luminance area corresponding to the current block (that is, the entire diagonal filled area of the luminance component in Figure 8) is cbWidth, and the height is cbHeight; then the block at the lower right corner (the lower right corner block of the luminance area) is the luminance block containing the position coordinates (xCb+cbWidth-1, yCb+cbHeight-1), where the block is filled with black in Figure 8.
[0466] That is, in the embodiment of the present application, the target block serving as the first color component block may be a block at any position among the multiple blocks shown in FIG3 . For example, the target block may be a block at the center position (a block filled with black) in the collocated luminance region shown in FIG3 , the target block may be a block at the upper left corner position (a block filled with black) in the collocated luminance region shown in FIG7 , the target block may be a block at the lower right corner position (a block filled with black) in the collocated luminance region shown in FIG8 , or even a block at the upper right corner position, a block at the lower left corner position, or even a block at the center position of the upper left region, etc., and this is not specifically limited here.
[0467] Further, in some embodiments, determining the first color component block of the current block from a plurality of blocks divided from the first color component area may include: determining at least one candidate block at a preset position from a plurality of blocks divided from the first color component area; and determining the first color component block of the current block based on the at least one candidate block.
[0468] In a specific embodiment, determining the first color component block of the current block according to the at least one candidate block may include: using the at least one candidate block as the first color component block of the current block.
[0469] In another specific embodiment, determining the first color component block of the current block based on at least one candidate block may include: determining a target candidate block that meets preset judgment conditions from at least one candidate block, and using the target candidate block as the first color component block of the current block.
[0470] It should be noted that, in an embodiment of the present application, whether a candidate block meets a preset judgment condition may include: obtaining at least one candidate block in sequence according to a preset order and performing a mode judgment; if the prediction mode of the first candidate block determined meets the first condition, the first candidate block is used as the first color component block of the current block.
[0471] It should also be noted that, in an embodiment of the present application, whether a candidate block satisfies a preset judgment condition may include: when it is determined that the prediction mode of the first candidate block satisfies the first condition, determining the first block vector parameter of the first candidate block; judging whether the first block vector parameter of the first candidate block satisfies the available condition; if the first block vector parameter of the first candidate block satisfies the available condition, using the first candidate block as the first color component block of the current block; if the first block vector parameter of the first candidate block does not satisfy the available condition, continuing with the mode judgment of the next candidate block until a target candidate block whose prediction mode satisfies the first condition and whose corresponding first block vector parameter satisfies the available condition is determined, and using the target candidate block as the first color component block of the current block.
[0472] In this embodiment of the present application, for the first color component block, mode determination can also be performed on at least one candidate block at a preset position. For example, as shown in Figure 9 , this includes CUs at five luma pixel positions: C, TL, TR, BL, and BR. However, this embodiment of the present application is not limited to these five positions; multiple positions are possible. Furthermore, the five positions shown in Figure 9 are not specifically limited to this.
[0473] In another possible implementation, taking the block containing five luminance pixel positions shown in FIG9 as an example, they can be acquired sequentially in a preset order until it is determined that the obtained block is predictively encoded in a mode with BV information, that is, the block at the first luminance pixel position is found to be predictively encoded in a mode with BV information, and the preset order of sequential acquisition includes but is not limited to the following order: C->TL->TR->BL->BR.
[0474] For the detailed position derivation process of C, TL, TR, BL, and BR, the position of the current block is obtained, that is, the position of the upper left chromaticity sample of the current block relative to the upper left chromaticity sample of the current image, chromaPos = (x, y), and chromaPos is scaled according to the chroma sampling format shown in Table 4 to obtain the position of the same luminance area corresponding to the current block, lumaPos = (xCb, yCb).
[0475] Here, it is assumed 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 (i.e., the position of the luminance pixel TL) is (xCb, yCb), and the width of the co-located luminance area corresponding to the current chroma coding block (i.e., the entire diagonal filled area of the luminance component in Figure 9) is cbWidth, and the height is cbHeight.
[0476] The coordinates of the position of the brightness pixel C are (xCb+cbWidth / 2,yCb+cbHeight / 2);
[0477] The coordinates of the position of the luminance pixel TL are (xCb, yCb);
[0478] The coordinates of the position of the brightness pixel TR are (xCb+cbWidth-1, yCb);
[0479] The coordinates of the position of the brightness pixel BL are (xCb, yCb+cbHeight-1);
[0480] The coordinates of the position of the luminance pixel BR are (xCb+cbWidth-1, yCb+cbHeight-1).
[0481] Thus, for the current block, it is first necessary to determine the corresponding first color component block. For example, when the first color component is a luminance component, it is necessary to determine the corresponding luminance block of the current block.
[0482] It can also be understood that in an embodiment of the present application, the method may further include: when the first color component block is predicted based on the block vector, determining whether the current block uses the target prediction mode; if the current block uses the target prediction mode, determining that the prediction mode of the first color component block meets the first condition.
[0483] It should be noted that, in the embodiment of the present application, the target prediction mode is a prediction mode based on BV guidance, which can be expressed here as a BVG-PLT mode or a BVG-LUT mode.
[0484] It should also be noted that, in this embodiment of the present application, if the corresponding luminance block of the current block is decoded using a mode with BV information and the target prediction mode is applied to the current block, then it can be determined that the prediction mode of the corresponding luminance block meets the first condition. In this case, the BV of the corresponding luminance block can be obtained, and the first block vector parameters of the current block can be determined based on the BV of the corresponding luminance block. Modes that use BV information include but are not limited to IBC mode or IntraTMP mode.
[0485] It should also be noted that in this embodiment of the present application, the number of first color component blocks can be arbitrary. That is, the first color component block of the current block is not limited to a single block and can also be composed of multiple blocks. Accordingly, when determining whether to perform prediction based on a block vector, a determination must be made for each first color component block. Only first color component blocks that meet the requirements for block vector prediction can be used to subsequently determine the first block vector parameters of the current block.
[0486] Furthermore, in an embodiment of the present application, if the first color component block is not predicted based on a block vector, that is, the first color component block is not processed in a mode with BV information, then the first syntax element identification information may be omitted from parsing. The first syntax element identification information is used to indicate whether the second color component of the current block uses the target prediction mode.
[0487] In a specific implementation, when determining the first block vector parameter of the current block according to the second block vector parameter of the first color component block, the second block vector parameter of the first color component block may be directly used as the first block vector parameter of the current block.
[0488] In another specific implementation, when determining the first block vector parameters of the current block based on the second block vector parameters of the first color component block, a block vector parameter candidate list of the second color component of the current block can also be constructed based on the second block vector parameters; and the first block vector parameters of the current block are determined based on the block vector parameter candidate list.
[0489] That is to say, in the embodiment of the present application, the second block vector parameter of the first color component block can be directly used as the first block vector parameter of the current block, or the second block vector parameter can be first used to construct a candidate list of block vector parameters of the second color component, and then the first block vector parameter of the current block is determined based on the candidate list of block vector parameters.
[0490] In some embodiments, constructing a candidate list of block vector parameters for the second color component of the current block based on the second block vector parameter may include: adjusting the second block vector parameter to determine the candidate block vector parameters for the second color component of the current block; and adding the candidate block vector parameters to the candidate list of block vector parameters.
[0491] That is to say, in an embodiment of the present application, the second block vector parameter of the first color component block can be directly used as the first block vector parameter of the current block; or, the second block vector parameter of the first color component block is adjusted to determine the candidate block vector parameter of the second color component, and then the candidate block vector parameter is used as the first block vector parameter of the current block; or, a candidate list of block vector parameters of the second color component is constructed based on the candidate block vector parameter, and then the first block vector parameter of the current block is determined based on the block vector parameter candidate list.
[0492] Assuming that the current block is a chroma block and the first color component block is a luminance block, the first block vector parameter may be the BV of the chroma block, ie, BVC; the second block vector parameter may be the BV of the luminance block, ie, BVL.
[0493] It can be understood that in an embodiment of the present application, assuming that the second block vector parameter is luminance BV = (BVLhor, BVLver) and the first block vector parameter is chrominance BV = (BVChor, BVCver), then it is possible to choose to construct a chrominance BVC candidate list containing one or more candidate block vector parameters by adjusting BVL (luminance BV) or BVC (chrominance BV).
[0494] Furthermore, in some embodiments, adjusting the second block vector parameters to determine the candidate block vector parameters of the second color component of the current block may include: determining a preset sampling format of the current block; scaling the second block vector parameters according to the preset sampling format to determine the candidate block vector parameters of the second color component of the current block.
[0495] It should be noted that, in the embodiment of the present application, the above adjustment may include scaling according to a preset sampling format, wherein the preset sampling format may be the mapping relationship between the luma BV parameters and the scaled chroma BV parameters shown in Table 8 above.
[0496] The syntax element sps_chroma_format_idc is used to indicate the type of color sampling format, which is specifically the chroma sampling format. Different types of color sampling formats have different corresponding scaling operations.
[0497] For example, if the value of sps_chroma_format_idc is 0, the color sampling format is determined to be monochrome, that is, there is no chroma BV parameter (BVC hor , BVC hor ); If the value of sps_chroma_format_idc is 1, the color sampling format is determined to be 4:2:0. At this time, the mapping relationship between the brightness BV parameter and the chroma BV parameter is: BVC hor =BVL hor >>1, BVC hor =BVL ver >>1; If the value of sps_chroma_format_idc is 2, the color sampling format is determined to be 4:2:2. At this time, the mapping relationship between the brightness BV parameter and the chroma BV parameter is: BVC hor =BVL hor >>1, BVC hor =BVL ver If the value of sps_chroma_format_idc is 3, it means that the color sampling format is 4:4:4. At this time, the mapping relationship between the brightness BV parameter and the chroma BV parameter is: BVC hor =BVL hor , BVC hor =BVL ver .
[0498] In this way, based on Table 8, you can choose to scale according to the color sampling format, and add the scaled BVC as a candidate block vector parameter to the chroma BVC candidate list (block vector parameter candidate list).
[0499] Furthermore, in some embodiments, adjusting the second block vector parameters to determine candidate block vector parameters of the second color component of the current block may include: determining a preset sampling format of the current block; scaling the second block vector parameters according to the preset sampling format to determine first initial block vector parameters of the second color component of the current block; performing an offset calculation on the first initial block vector parameters according to one or more offset values to determine candidate block vector parameters of the second color component of the current block.
[0500] Furthermore, in some embodiments, adjusting the second block vector parameters to determine the candidate block vector parameters of the second color component of the current block may include: performing offset calculation on the second block vector parameters based on one or more offset values to determine one or more second initial block vector parameters; determining a preset sampling format of the current block, and scaling the one or more second initial block vector parameters according to the preset sampling format to determine the candidate block vector parameters of the second color component of the current block.
[0501] It should be noted that in the embodiment of the present application, the above-mentioned one or more offset values can be any number of arbitrary numerical values, such as -1, +1, -2, +2, -3, +3, etc., and are not specifically limited here.
[0502] That is, in the embodiment of the present application, after obtaining the BV of the corresponding luma block, it can be recorded as BVL, and the chroma BV obtained through the BVL can be recorded as BVC. Then, by adjusting the BVL or BVC, a chroma BVC candidate list containing one or more candidates can be constructed. That is, based on Table 8, it can be selected to scale according to the color sampling format, and the scaled BVL or BVC can be added as the candidate block vector parameter to the chroma BVC candidate list.
[0503] For example, in an embodiment of the present application, BVL can be adjusted to form four situations, thereby achieving adjustment of BVC. Among them, when BVL is an odd number, take four situations: BVL = (BVLhor, BVLver), BVL = (BVLhor+1, BVLver), BVL = (BVLhor, BVLver+1), and BVL = (BVLhor+1, BVLver+1). When BVL is an even number, take BVL = (BVLhor, BVLver). Then, Table 8 can be used to scale BVL according to the color sampling format to obtain BVC. In this way, when BVL is an odd number, four BVC candidate block vector parameters will be formed, and these candidate block vector parameters will be added to the chroma BVC candidate list.
[0504] For example, in the embodiment of the present application, BVL can be adjusted to form four situations, thereby achieving adjustment of BVC. Among them, when BVL is an odd number, four situations are taken: BVL = (BVLhor, BVLver), BVL = (BVLhor+1, BVLver), BVL = (BVLhor, BVLver+1), and BVL = (BVLhor+1, BVLver+1). When BVL is an even number, four situations are taken: BVL = (BVLhor, BVLver), BVL = (BVLhor-1, BVLver), BVL = (BVLhor, BVLver-1), and BVL = (BVLhor-1, BVLver-1). Then, Table 8 can be used to scale BVL according to the color sampling format to obtain BVC. In this way, when BVL is an odd number or an even number, four BVC candidates will be formed, and these candidates will be added to the chroma BVC candidate list.
[0505] Exemplarily, in an embodiment of the present application, the operations under different circumstances of unified parity and even numbers can also be calculated as follows: that is, directly taking four cases: BVL=(BVLhor-1, BVLver-1), BVL=(BVLhor+1, BVLver-1), BVL=(BVLho-1r, BVLver+1), and BVL=(BVLhor+1, BVLver+1).
[0506] For example, in the embodiment of the present application, BVL can be adjusted to form multiple situations, thereby achieving adjustment of BVC. Among them, when BVL is an odd number, BVL=(BVLhor, BVLver), BVL=(BVLhor+1, BVLver), BVL=(BVLhor, BVLver+1), BVL=(BVLhor+1, BVLver+1), BVL=(BVLhor+3, BVLver), BVL=(BVLhor, BVLver+3), BVL=(BVLhor+3, BVLver+3), BVL=(BVLhor-2, BVLver), BVL=(BVLhor, BVLver-2), etc., and a list is constructed for these candidates in order. When BVL is even, various cases are taken, such as BVL=(BVLhor, BVLver), BVL=(BVLhor-1, BVLver), BVL=(BVLhor, BVLver-1), BVL=(BVLhor-1, BVLver-1), BVL=(BVLhor-3, BVLver), BVL=(BVLhor, BVLver-3), BVL=(BVLhor-3, BVLver-3), BVL=(BVLhor+2, BVLver), and BVL=(BVLhor, BVLver+2). Then, Table 8 can be used to scale BVL according to the color sampling format to obtain BVC. In this way, when BVL is odd or even, multiple BVC candidates will be formed, and these candidates will be added to the chroma BVC candidate list.
[0507] Exemplarily, in an embodiment of the present application, operations in different situations of unified parity and even numbers can also be performed by the following calculations: that is, directly taking BVL=(BVLhor-1, BVLver-1), BVL=(BVLhor+1, BVLver-1), BVL=(BVLhor-1, BVLver+1), BVL=(BVLhor+1, BVLver+1), BVL=(BVLhor+3, BVLver-1), BVL=(BVLhor-1, BVLver+3), BVL=(BVLhor+3, BVLver+3), BVL=(BVLhor-3, BVLver-1), BVL=(BVLhor-1, BVLver-3), etc.
[0508] Exemplarily, in an embodiment of the present application, the obtained BVC can also be adjusted to obtain nine candidates: that is, set BVC = (BVChor, BVCver), BVC = (BVChor-1, BVCver), BVC = (BVChor, BVCver-1), BVC = (BVChor-1, BVCver-1), BVC = (BVChor+1, BVCver), BVC = (BVChor, BVCver+1), BVC = (BVChor+1, BVCver+1), BVC = (BVChor-1, BVCver+1), BVC = (BVChor+1, BVCver-1), thus forming nine BVC candidates, which are added to the chroma BVC candidate list.
[0509] For example, in the embodiment of the present application, the obtained BVC can also be adjusted to obtain multiple candidates: that is, setting BVC=(BVChor, BVCver), BVC=(BVChor-1, BVCver), BVC=(BVChor, BVCver-1), BVC=(BVChor-1, BVCver-1), BVC=(BVChor+1, BVCver), BVC=(BVChor, BVCver+1), BVC=(BVChor+1, BVCver+1), BVC=(BVChor-1, BVCver+1), BVC=(BVChor-1, BVCver+1), BVC=(BVChor-1, BVCver+1), BVC=(BVChor-1, +1, BVCver-1), BVC=(BVChor-2, BVCver), BVC=(BVChor, BVCver-2), BVC=(BVChor-2, BVCver-2), BVC=(BVChor+2, BVCver), BVC=(BVChor, BVCver+2), BVC=(BVChor+2, BVCver+2), BVC=(BVChor-2, BVCver+2), BVC=(BVChor+2, BVCver-2), etc., thus forming a variety of BVC candidates, which are added to the chroma BVC candidate list.
[0510] It should be noted that in the embodiments of this application, when BVL is odd or even, since BVL is a two-dimensional vector, this specifically refers to whether one of its components is odd or even. In addition, the "+1", "-1", "+2", "-2", "+3", and "-3" here all refer to integer pixel precision.
[0511] Furthermore, in some embodiments, when determining a candidate list of block vector parameters of the second color component of the current block based on the second block vector parameters of the first color component block, the optimal block vector parameters can be first determined based on the second block vector parameters; then, the optimal block vector parameters are scaled according to a preset sampling format to determine the candidate block vector parameters of the second color component; and then, the candidate list of block vector parameters can be determined based on the candidate block vector parameters.
[0512] For example, in the embodiment of the application, in the IBC mode under single-tree inter-frame prediction and single-tree partitioning, the luma BV, denoted as BVL, is subjected to RDO to determine the optimal BVL (optimal block vector parameter), and then the optimal block vector parameter is scaled according to the preset sampling format to obtain the chroma BV, denoted as BVC. The optimal block vector parameter can be scaled using Table 8 above, or the optimal block vector parameter can be adjusted in combination with any of the above adjustment or scaling methods to obtain the corresponding candidate block vector parameters, thereby completing the construction of the block vector parameter candidate list.
[0513] Furthermore, in some embodiments, when determining a candidate list of block vector parameters of the second color component of the current block based on the second block vector parameters of the first color component block, the optimal block vector parameters corresponding to the first color component block can be determined first; and then the candidate list of block vector parameters of the second color component of the current block can be determined based on the optimal block vector parameters.
[0514] For example, in the application embodiment, the optimal block vector parameter corresponding to the luminance block can be searched through the template, which is recorded as BVL; then, a block vector parameter candidate list is constructed based on the optimal block vector parameter by combining any of the above list construction methods.
[0515] It can also be understood that in the embodiments of the present application, when determining the first block vector parameter of the current block based on the block vector parameter candidate list, it is also necessary to determine whether the candidate block vector parameters are available, that is, it is necessary to select one or more available candidate block vector parameters from the block vector parameter candidate list. Therefore, in some embodiments, determining the first block vector parameter of the current block based on the block vector parameter candidate list may include:
[0516] Determine whether there are one or more candidate block vector parameters that meet the first availability condition in the block vector parameter candidate list; if there are one or more candidate block vector parameters that meet the first availability condition in the block vector parameter candidate list, determine the first block vector parameter of the current block based on the one or more candidate block vector parameters.
[0517] Specifically, in the embodiment of the present application, only when the candidate block vector parameter meets the first availability condition can the candidate block vector parameter be determined as the first block vector parameter of the current block.
[0518] In some embodiments, one or more candidate block vector parameters satisfy a first availability condition, including but not limited to:
[0519] The offset position indicated by the one or more candidate block vector parameters does not exceed the image boundary;
[0520] The offset position indicated by the one or more candidate block vector parameters does not exceed the slice boundary;
[0521] The offset position indicated by one or more candidate block vector parameters does not cover the current block;
[0522] The offset position indicated by one or more candidate block vector parameters does not exceed a preset available area;
[0523] The offset position indicated by one or more candidate block vector parameters has been reconstructed.
[0524] It should be noted that in this embodiment of the present application, assuming the current block position is (xCb, yCb), for each candidate block vector parameter, BVC = (BVChor, BVCver), the corresponding offset position is found (xCb + BVChor, yCb + BVCver). Here, the offset position does not exceed the image boundary and can also be specifically described using data such as coordinate position information and the size parameters of the current block. For example, xCb + width + BVChor < = xCb or yCb + height + BVCver < = yCb.
[0525] It should also be noted that, in the embodiment of the present application, the first availability condition may also consider whether the slice boundary is exceeded. For example, the offset position indicated by one or more candidate block vector parameters does not exceed the slice boundary, or the offset position indicated by one or more candidate block vector parameters does not exceed the tile boundary.
[0526] It should be understood that in the embodiment of the present application, only when all of the above conditions are met can it be determined that the candidate block vector parameters meet the first availability condition, that is, the candidate block vector parameters are available. In a specific embodiment, taking one of the candidate block vector parameters as an example, the candidate block vector parameters meet the first availability condition, which at least includes: the offset position indicated by the candidate block vector parameter does not exceed the image boundary; the offset position indicated by the candidate block vector parameter does not exceed the slice boundary; the offset position indicated by the candidate block vector parameter does not overlap the current block; the offset position indicated by the candidate block vector parameter does not exceed the preset available area; and the offset position indicated by the candidate block vector parameter has been reconstructed.
[0527] Furthermore, in some embodiments, when constructing a block vector parameter candidate list, the method may also include: if all candidate block vectors in the block vector parameter candidate list do not meet the first availability condition, adjusting at least one candidate block vector parameter in the block vector parameter candidate list until at least one candidate block vector parameter meets the first availability condition.
[0528] In an embodiment of the present application, if all candidate block vectors in the block vector parameter candidate list do not meet the first availability condition, then the predicted value of the second color component of the current block can be determined according to other modes; wherein the other modes include at least one of the following: PLANAR mode, DM mode, DC mode, CCLM mode and skip mode.
[0529] In the embodiment of the present application, candidate block vector parameters for the second color component may be first determined based on the second block vector parameters of the first color component block; if the candidate block vector parameters meet the first availability condition, the candidate block vector parameters are corrected, and a block vector parameter candidate list is determined based on the corrected candidate block vector parameters. Accordingly, if the candidate block vector parameters do not meet the first availability condition, the candidate block vector parameters are adjusted until the adjusted candidate block vector parameters meet the first availability condition.
[0530] It should be noted that, in an embodiment of the present application, when the candidate block vector parameters are corrected, the offset position of the current block can be determined based on the candidate block vector parameters and the position information of the current block; then, a search process is performed based on the offset position of the current block to determine the corrected candidate block vector parameters.
[0531] It should also be understood that in the embodiment of the present application, after the second block vector parameters of the first color component block are scaled according to the preset sampling format, the obtained candidate block vector parameters need to be further corrected. Before the correction, it is necessary to determine whether the candidate block vector parameters meet the first usability condition; when the candidate block vector parameters meet the first usability condition, the candidate block vector parameters of the current block are corrected, thereby determining the corrected parameters as the first block vector parameters of the current block; or, when the candidate block vector parameters do not meet the first usability condition, the candidate block vector parameters are adjusted until the adjusted block vector parameters meet the first usability condition; and the adjusted block vector parameters are then corrected, thereby determining the corrected parameters as the first block vector parameters of the current block.
[0532] That is to say, in the embodiment of the present application, the chroma BV can be corrected, and then the corrected BVC is added to the chroma BVC candidate list. At this time, the BVC candidate list only contains the corrected BVC.
[0533] For example, after obtaining the chroma BV scaled according to the preset sampling format, it is further modified. Before modification, it is necessary to first determine whether the BV is available. If it is available, the modification is performed, or if it is not available, it is adjusted to be available and then modified. The modified BVC is added to the chroma BVC candidate list.
[0534] When determining whether it is available, the position of the current block (xCb, yCb) can be obtained, the chroma BVC = (BVChor, BVCver), the corresponding offset position (xCb + BVChor, yCb + BVCver) can be found, and the following conditions (i.e., the first available condition) can be determined. If all of them are met, the chroma BV is available:
[0535] Whether the obtained offset position does not exceed the image boundary;
[0536] Whether the obtained offset position does not cover the current block, see FIG10 above for details;
[0537] Whether the obtained offset position does not exceed the preset available area, see Figure 11 above for details;
[0538] Whether the obtained offset position has been reconstructed.
[0539] For example, in an embodiment of the present application, the correction method can be performed using a template search. That is, after obtaining the corrected chroma BV parameters, the offset position is found using the position of the current block and the corrected chroma BV parameters. Then, a template matching method is used to perform a fine search near the offset position to obtain the optimal chroma BV parameters. The reference block at the optimal offset position obtained after the fine search is copied to obtain the chroma prediction block of the current block. As shown in Figure 12, the area filled with oblique lines represents the chroma reconstruction area. For the current block, the template matching method can be used to find the best matching template and the corresponding best BV. Based on the best BV (i.e., the IntraTMP BV), the reference block of the current block can be determined, and the chroma prediction value of the current block can be determined.
[0540] Since whether BV is available has been determined before the correction, it is not necessary to determine whether it is available (whether the first availability condition is met) subsequently, but the second block vector parameters can be determined directly.
[0541] Furthermore, in an embodiment of the present application, before constructing the block vector parameter candidate list, the second block vector parameter of the first color component block may be corrected, and the block vector parameter candidate list may be determined based on the corrected first block vector parameter. For example, the luma BVL may be corrected, and then the BVC candidate list may be constructed using any of the above list construction schemes.
[0542] For example, in an embodiment of the present application, the co-located luminance region corresponding to the current block can be obtained first. As shown in FIG13 , which shows the coordinates and block size of the current chroma block and the co-located luminance region, the position of the current block chromaPos = (xCb, yCb) is obtained. Based on Table 4 above, chromaPos is scaled according to the color sampling format to obtain the co-located luminance region position lumaPos = (xCb_Y, yCb_Y) corresponding to the current block. The size parameter chromaSize = (cbWidth, cbHeight) of the current block is obtained. Based on the mapping relationship shown in Table 9, chromaSize is scaled according to the color sampling format to obtain the co-located luminance region size lumaSize = (cbWidth_Y, cbHeight_Y) corresponding to the current block.
[0543] Exemplarily, the brightness BVL can be further corrected. Before the correction, it is necessary to determine whether the BVL is available (whether it meets the second availability condition). If it is available, the correction is performed; or, if it is unavailable, it is adjusted to be available and then corrected.
[0544] In some embodiments, when determining whether BVL is available, the position of the co-located luminance region (xCb_Y, yCb_Y) is obtained, the luminance BVL is obtained as (BVLhor, BVLver), and the corresponding offset position (xCb_Y+BVLhor, yCb_Y+BVLver) is found, as shown in FIG14 . The luminance BVL (first block vector parameter) is available if all of the following conditions are met, including but not limited to the following conditions:
[0545] The offset position indicated by the first block vector parameter does not exceed the image boundary;
[0546] The offset position indicated by the first block vector parameter does not exceed the slice boundary;
[0547] The offset position indicated by the first block vector parameter does not exceed the preset available area, as shown in FIG11 ;
[0548] The offset position indicated by the first block vector parameter has been reconstructed.
[0549] Furthermore, in an embodiment of the present application, when performing correction processing, the offset position of the first color component block is determined based on the second block vector parameters of the first color component block and the position information of the first color component block; and a search process is performed based on the offset position of the first color component block to determine the corrected second block vector parameters.
[0550] Exemplarily, the correction process includes but is not limited to the following methods: using the same-position luminance area search corresponding to the current block for correction, that is, after obtaining the luminance BVL, using the position of the same-position luminance area and the obtained luminance BVL to find the offset position, using the same-position luminance area to perform a detailed search near the offset position, the range of the detailed search needs to meet the limited available area (as shown in Figure 11), and finally obtaining the optimal luminance BVL.
[0551] It can be understood that in the embodiment of the present application, the method of constructing the block vector parameter candidate list includes but is not limited to the multiple situations described above, and different methods can be used to construct a candidate list at the same time.
[0552] Furthermore, in some embodiments, determining the first block vector parameter of the current block based on one or more candidate block vector parameters may include: if there is a candidate block vector parameter that meets the first availability condition in the block vector parameter candidate list, determining the candidate block vector parameter that meets the first availability condition as the first block vector parameter; if there are multiple candidate block vector parameters that meet the first availability condition in the block vector parameter candidate list, making a decision on the multiple candidate block vector parameters that meet the first availability condition to determine the first block vector parameter.
[0553] It should be noted that in the embodiment of the present application, if there are one or more candidate block vector parameters that meet the first availability condition, then when determining the first block vector parameter based on the one or more candidate block vector parameters, a certain candidate block vector parameter that meets the first availability condition can be directly determined as the first block vector parameter. In other words, if only one BVC candidate in the constructed available BVC candidate list meets the first availability condition, then the BVC (first block vector parameter) that is ultimately selected is that BVC.
[0554] It should also be noted that, in an embodiment of the present application, if there are one or more candidate block vector parameters that meet the first availability condition, then when determining the first block vector parameter based on the one or more candidate block vector parameters, a decision can be made on the multiple candidate block vector parameters that meet the first availability condition. Specifically, the decision can be made by: determining a first template for the current block; determining first matching templates for each of the multiple candidate block vector parameters based on the first template and the multiple candidate block vector parameters; when the first template and the first matching template meet the second condition, calculating the matching error between the first template of the current block and the first matching template based on a preset error criterion to determine first cost values for each of the multiple candidate block vector parameters; determining a minimum cost value from the first cost values of the multiple candidate block vector parameters, and determining the candidate block vector parameter corresponding to the minimum cost value as the first block vector parameter.
[0555] That is, in the embodiment of the present application, for multiple candidate block vector parameters that meet the first availability condition, after determining the first generation values corresponding to the multiple candidate block vector parameters, one or more second block vector parameters can be determined from the multiple candidate block vector parameters based on the first generation values. For example, if the constructed available BVC candidate list has multiple available BVC candidates, then a decision needs to be made among these available BVCs to obtain the final BV. The decision-making method includes but is not limited to a decision-making method using a template.
[0556] It can be understood that in the embodiment of the present application, the first template includes one or more sample values in the adjacent coded area of the current block. Accordingly, the type of the first template may include at least one of the following: an upper template, an upper right template, a left template, a lower left template, and an upper left template. Among them, the upper template is located in the upper coded area adjacent to the current block, the upper right template is located in the upper right coded area adjacent to the current block, the left template is located in the left coded area adjacent to the current block, the lower left template is located in the lower left coded area adjacent to the current block, and the upper left template is located in the upper left coded area adjacent to the current block.
[0557] That is, in the embodiment of the present application, when selecting a template (the first template of the current block), the availability of pixels at the template position can be determined based on the pixel availability of the adjacent area of the current block, including the reconstruction of chrominance information. As shown in Figure 15, based on the relative position relationship between the template and the current block, the template can be classified into template types such as upper template, left template, upper right template, lower left template, and upper left template. Among them, the sizes of different types of templates for different coding blocks can be fixed to the same or different.
[0558] For example, the template size selects the same template size for the current block of any size. The following formula illustrates a setting condition for the template size, where nTbW and nTbH are the width and height of the current block, and iTempW and iTempH are the width and height of the template used:
[0559] Upper template:
[0560] Left template:
[0561] For example, you can select different template sizes based on the current block size. The following formula illustrates a template size setting condition, where nTbW and nTbH are the width and height of the current block, and iTempW and iTempH are the width and height of the template used:
[0562] Upper template:
[0563] Left template:
[0564] in,
[0565] For example, different template sizes can also be selected based on the number of pixels in the current block. The following formula illustrates a template size setting condition, where nTbW and nTbH are the width and height of the current block, nTbW×nTbH is the number of pixels in the current block, and iTempW and iTempH are the width and height of the template used:
[0566] Upper template:
[0567] Left template:
[0568] In some embodiments, when determining the first matching template based on multiple candidate block vector parameters, the position of the current point can be used as the starting point, and the area indicated by the multiple candidate block vector parameters, which has the same shape and contains the same number of sample values as the first template, can be determined as the first matching template.
[0569] For example, in the embodiment of the present application, when determining the first matching template, the first template of the current block is used to perform motion compensation on the multiple BVC candidates obtained (i.e., candidate block vector parameters that meet the first availability condition) to obtain a template corresponding to the BV (the first matching template). As shown in Figure 16, if the BV (BVC candidate) is available, the first template and the BV are used to perform motion compensation to obtain a template corresponding to the BV, i.e., the first matching template.
[0570] It can also be understood that in the embodiment of the present application, the preset error criterion may include but is not limited to any one of the absolute error sum SAD, transformed absolute error SATD, difference square sum SSE, mean absolute difference MAD, mean absolute error MAE, mean square error MSE, etc.
[0571] For example, in an embodiment of the present application, when performing cost calculation, that is, when determining the first-generation value, there are multiple options for the cost function for calculating the cost of the template area, that is, there are multiple options for the preset error criteria. For example, you can choose the evaluation criteria such as the sum of absolute deviations (SAD), the sum of transformed absolute deviations (SATD), the sum of squared differences (SSE), the mean absolute difference (MAD), the mean absolute error (MAE), and the mean squared error (MSE). Any evaluation criterion mentioned in the following content can be selected from the above criteria. Taking the evaluation criterion of SAD as an example, the calculation formula is as follows:
[0572] Among them, predTempSizeW is the width of the template, predTempSizeH is the height of the template, predTemp[i][j] is the pixel point of the template at BV, and recTempC[i][j] is the pixel point of the current block template.
[0573] Furthermore, in some embodiments, the method may further include: when the first template and the first matching template do not satisfy the second condition, determining the first candidate block vector parameter in the block vector parameter candidate list that satisfies the first availability condition as the first block vector parameter; or,
[0574] When the first template and the first matching template do not satisfy the second condition, a candidate block vector parameter at a preset position in the block vector parameter candidate list that satisfies the first availability condition is determined as the first block vector parameter.
[0575] That is to say, if the first template and the first matching template meet the second condition, the matching error between the first template and the first matching template of the current block can be calculated according to the preset error criterion to select the candidate block vector parameter corresponding to the minimum cost value as the first block vector parameter; if the first template and the first matching template do not meet the second condition, the candidate block vector parameter at the specific position of the first candidate block vector parameter that meets the first available condition in the block vector parameter candidate list can be used as the first block vector parameter.
[0576] For example, the following situations exist for template usage when calculating the cost (i.e., cost value) based on whether the first template and the first matching template meet the second condition:
[0577] The first type: the upper template and the left template of the current block both exist, and the upper template and the left template at the corresponding BV both exist. In this case, both the upper template and the left template are available.
[0578] The second method is: Both the upper and left templates of the current block exist, but only the upper template exists at the corresponding BV. In this case, there are two methods: Method 1: If the left template at the corresponding BV does not exist, it is directly ignored, that is, only the upper template is used for calculation. Method 2: If the left template at the corresponding BV does not exist, the leftmost template width column in the reference block is used instead of the left template, that is, the upper and left templates are used for calculation.
[0579] The third method is: both the upper template and the left template of the current block exist, but only the left template exists at the corresponding BV. In this case, there are two methods: Method 1: If the upper template does not exist at the corresponding BV, it is directly not used, that is, only the left template is used for calculation. Method 2: If the upper template does not exist at the corresponding BV, the uppermost template height row inside the reference block is used instead of the upper template, that is, the upper and left templates are used for calculation.
[0580] The fourth scenario: Only the upper template exists in the current block. There are three possible approaches: Method 1: If the upper template at the corresponding BV does not exist, it is not used. The final BV selected is the first BVC in the BVC candidate list or the BVC at a specified position. Method 2: If the upper template at the corresponding BV does not exist, the uppermost template height row in the reference block is used instead. Method 3: If the upper template at the corresponding BV exists, it is used directly.
[0581] The fifth method: Only the left template exists in the current block. In this case, there are three methods: Method 1: If the left template at the corresponding BV does not exist, it is directly used. In this case, the final BV selected is the first BVC in the BVC candidate list or the BVC at a specified position. Method 2: If the left template at the corresponding BV does not exist, the leftmost template width column in the reference block is used instead. Method 3: If the left template at the corresponding BV exists, it is directly used.
[0582] The sixth type: Neither the upper template nor the left template of the current block exists. At this time, the BV finally selected is the first BVC in the BVC candidate list or the BVC at a specified position.
[0583] For example, in an embodiment of the present application, when determining the first block vector parameter based on the first cost values of each of the multiple candidate block vector parameters, excluding the case where the cost cannot be calculated, the cost of each candidate in the candidate list of BVC is calculated and sorted. The sorting method includes but is not limited to bubble sort, selection sort, insertion sort, shell sort, merge sort, quick sort, radix sort, heap sort, counting sort, bucket sort and other sorting methods. Any number of BVCs with the lowest cost are selected as the final BV (first block vector parameter) to perform chromaticity prediction based on BV. It should also be noted that when calculating the cost value of multiple candidate block vector parameters, a cost can be calculated for each candidate block vector parameter, and the candidate block vector parameter with the lowest cost is always retained. In this case, a list is not required, and even sorting is not required.
[0584] Furthermore, in an embodiment of the present application, if all candidate block vector parameters in the block vector parameter candidate list do not meet the first availability condition, the candidate block vector parameters in the block vector parameter candidate list are adjusted until there are one or more candidate block vector parameters in the block vector parameter candidate list that meet the first availability condition.
[0585] That is to say, in an embodiment of the present application, if all candidate block vector parameters in the block vector parameter candidate list are unavailable, that is, all candidate block vector parameters in the block vector parameter candidate list do not meet the first availability condition, then you can choose to adjust any one or more BVC candidates (candidate block vector parameters) in the block vector parameter candidate list until they are available. Among them, the adjustment method is not limited to cropping, scaling, etc. It is also possible to use, but not limited to, PLANAR mode or CCLM-type mode or angular prediction mode for prediction, that is, to select other modes to determine the predicted value of the second color component of the current block. For example, if it is PLANAR mode or CCLM-type mode or angular prediction mode, reference pixels and mode parameters can be obtained for chrominance prediction.
[0586] S2002: Determine a first color component reference sample and a second color component reference sample corresponding to the current block based on the first block vector parameter, and establish a mapping relationship between the first color component and the second color component according to the first color component reference sample and the second color component reference sample.
[0587] It should be noted that, in the embodiment of the present application, after determining the first block vector parameter, the luma reference sample and the chroma reference sample at the first block vector parameter may be obtained. In some embodiments, determining the first color component reference sample and the second color component reference sample corresponding to the current block based on the first block vector parameter may include:
[0588] Determine the position of the current block; scale the position of the current block to determine the position of the first color component area at the same position of the current block; and scale the first block vector parameter to determine the third block vector parameter of the first color component area at the same position of the current block; determine a reference block of the first color component based on the position of the first color component area and the third block vector parameter, and determine a first color component reference sample corresponding to the current block based on the reference block of the first color component; determine a reference block of the second color component based on the position of the current block and the first block vector parameter, and determine a second color component reference sample corresponding to the current block based on the reference block of the second color component.
[0589] In the embodiment of the present application, the position of the first color component region can be obtained by scaling the position of the current block according to a preset sampling format; the third block vector parameter of the first color component region can also be obtained by scaling the first block vector parameter according to a preset sampling format. Here, the preset sampling format can be referred to in Table 4 above. It should be noted that the third block vector parameter can be obtained by amplifying the chroma BV (first block vector parameter); however, considering that the luma BV may suffer from precision loss, the luma BV obtained by amplifying the chroma BV is not necessarily equal to the original luma BV (second block vector parameter).
[0590] For example, the current block is a chroma block, and the first color component region at the same location is the co-located luma region. To obtain the first color component reference sample (luma reference sample), first obtain the position of the current block, that is, the position of the upper-left chroma sample of the current block relative to the upper-left chroma sample of the current image, chromaPos = (x, y). ChromaPos is then scaled according to the color sampling format shown in Table 4 to obtain the co-located luma region position corresponding to the current block, lumaPos = (xCb, yCb).
[0591] Exemplarily, obtain chroma BV = (BVChor, BVCver), scale the chroma BV according to the color sampling format shown in Table 4, and obtain the luminance BV = (BVYhor, BVYver) of the co-located luminance region corresponding to the current block. Obtain the position of the co-located luminance region corresponding to the current block lumaPos = (xCb, yCb), obtain luminance BV = (BVYhor, BVYver), and find the offset position (xCb + BVYhor, yCb + BVYver) corresponding to the co-located luminance region corresponding to the current block, as shown in Figure 17.
[0592] In a specific implementation, after obtaining the luma sample at the offset position, it may be downsampled to obtain a luma reference sample. In some embodiments, determining the first color component reference sample corresponding to the current block based on the reference block of the first color component may include: downsampling the reference block of the first color component to determine the first color component reference sample corresponding to the current block, so that the resolution of the first color component reference sample is the same as the resolution of the second color component reference sample.
[0593] It should be noted that in the embodiment of the present application, since the resolutions of the luma samples and the chroma samples are inconsistent, it is necessary to downsample the luma samples so that the resolutions of the downsampled luma samples and the chroma samples are the same. As shown in Figure 18, it shows a schematic diagram of the downsampling position.
[0594] It should also be noted that in the embodiment of the present application, the following sampling methods can be used to compete or default to a certain sampling method, but they include but are not limited to the following six sampling methods. For example, assuming that the brightness sample before downsampling is recBvBefDownLuma, the width of the storage buffer is iRecRefLumaStride, and the brightness sample after downsampling is recBvAftDownLuma, then the brightness sample after downsampling at position (i, j) is:
[0595] ① Downsampling method 1:
[0596] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]*2
[0597] +recBvBefDownLuma[2*i+1]
[0598] +recBvBefDownLuma[2*i-1]
[0599] +recBvBefDownLuma[2*i+iRecRefLumaStride]*2
[0600] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]
[0601] +recBvBefDownLuma[2*i-1+iRecRefLumaStride]+4)>>3;
[0602] ② Downsampling method 2:
[0603] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
[0604] +recBvBefDownLuma[2*i+1]+1)>>1;
[0605] ③ Downsampling method three:
[0606] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
[0607] +recBvBefDownLuma[2*i+iRecRefLumaStride]+1)>>1;
[0608] ④ Downsampling method 4:
[0609] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+iRecRefLumaStride]
[0610] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1;
[0611] ⑤ Downsampling method 5:
[0612] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+1]
[0613] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1;
[0614] ⑥ Downsampling method six:
[0615] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
[0616] +recBvBefDownLuma[2*i+1]
[0617] +recBvBefDownLuma[2*i+iRecRefLumaStride]
[0618] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+2)>>2.
[0619] In this way, after downsampling, the downsampled luminance reference sample recBvAftDownLuma at the co-located luminance area BV corresponding to the current block is obtained.
[0620] Furthermore, for the chroma sample of the current block, first obtain the position of the current block (xCbC, yCbC), obtain the chroma BV = (BVChor, BVCver), find the corresponding offset position (xCbC+BVChor, yCbC+BVCver), that is, obtain the chroma reference sample recBvChroma at the BV corresponding to the current block.
[0621] In this way, a mapping relationship between luminance and chrominance can be constructed according to the luminance reference sample recBvAftDownLuma and the chrominance reference sample recBvChroma.
[0622] In some embodiments, establishing a mapping relationship between the first color component and the second color component based on the first color component reference sample and the second color component reference sample can include: determining a first lookup table based on the first color component reference sample and the second color component reference sample, wherein the first lookup table is used to record the value of the second color component corresponding to the first color component when the index keyword is the first color component.
[0623] In some embodiments, establishing a mapping relationship between the first color component and the second color component based on the first color component reference sample and the second color component reference sample may include: determining a first discrete model based on the first color component reference sample and the second color component reference sample, wherein the first discrete model is used to indicate the mapping relationship between the first color component and the second color component.
[0624] That is, in the embodiments of the present application, the mapping relationship can be a lookup table (LUT). The index key in the LUT can be the first color component, and the value in the LUT can be the second color component, i.e., LUT[key]=value. Alternatively, the mapping relationship can be a discrete model used to represent the mapping relationship between key and value.
[0625] Exemplarily, assuming that the luminance component is the key and the chrominance component is the value, each key-value pair in the mapping relationship can be established in the following ways including but not limited to:
[0626] LUT[recBvAftDownLuma[i][j]] = recBvChroma[i][j] (17)
[0627] It should also be noted that in the embodiments of the present application, for the first color component parameter samples, it can also be limited within a preset sample range. In some embodiments, the method may further include: performing a mapping process on the first color component reference samples to make the first color component reference samples within the preset sample range.
[0628] In the embodiments of the present application, the preset sample range can be [0, (1 << bitdepth) - 1], where bitdepth represents the bit depth. Exemplarily, the preset sample range can be ranges such as [0, 255], [0, 511], etc., but no specific limitation is made. Among them, for multiple sample ranges, the rate-distortion cost method can be used to select one of them as the final preset sample range.
[0629] Exemplarily, taking a video with a bit depth greater than 8 bits as an example, assuming that the bit depth of the video is 10 bits, then the sample range is [0, 1023]. For the recBvAftDownLuma of the key value, it can be mapped to a preset sample range of [0, 255] or [0, 511].
[0630] Further, in some embodiments, the method may further include: when there are multiple second reference values that are different in the corresponding second color component reference samples while the first reference values in the first color component reference samples are the same, performing an overwriting process in sequence according to the sample order, and using the last second reference value as the value having a mapping relationship with the first reference value.
[0631] Further, in some embodiments, the method may further include: when there are multiple second reference values that are different in the corresponding second color component reference samples while the first reference values in the first color component reference samples are the same, calculating the average value of the multiple second reference values, and using the obtained average value as the value having a mapping relationship with the first reference value.
[0632] That is to say, in the embodiment of the present application, for different chromaticity values with the same key value in the mapping relationship, the entries with the same key value can be overwritten in sequence according to the sample order, or operations such as averaging can be taken. In addition, in the mapping relationship, the initialization setting of LUT[] is -1, that is, an unavailable value. "Overwriting" mainly means that if there is the same key value later, the new value will be used for storage; however, it is not limited to this method, and all can also be stored and then the average value can be calculated as the value corresponding to the key.
[0633] It can be understood that in the embodiment of the present application, the first color component reference sample and the second color component reference sample used to construct the mapping relationship can also be obtained in other ways, which are exemplified below in combination with several implementation methods.
[0634] In another specific implementation, the luma samples are not downsampled, and the chroma samples may be upsampled to obtain chroma reference samples. In some embodiments, determining the second color component reference samples corresponding to the current block based on the reference block of the second color component may include: upsampling the reference block of the second color component to determine the second color component reference samples corresponding to the current block, such that the resolution of the first color component reference samples is the same as the resolution of the second color component reference samples.
[0635] That is to say, in the embodiment of the present application, after obtaining the luminance sample recBvBefDownLuma of the same luminance area, no downsampling is performed. At this time, after obtaining the chrominance sample recBvChroma at the BV corresponding to the current block, upsampling is required, including but not limited to linear interpolation and other methods, to obtain the chrominance sample recBvChromaUp of the same size as the luminance sample at BV. In this way, the luminance sample recBvBefDownLuma at BV is used as the luminance reference sample, and the obtained upsampled chrominance sample recBvChromaUp is used as the chrominance reference sample; then the mapping relationship between luminance and chrominance is constructed based on the luminance reference sample and the chrominance reference sample.
[0636] Accordingly, in this embodiment of the present application, the predicted value of the second color component of the current block needs to be downsampled. That is, if the chroma samples are upsampled when constructing the mapping relationship, then the luminance-to-chroma prediction of the current block based on the mapping relationship needs to be downsampled to obtain the final chroma prediction value of the current block. The downsampling method includes but is not limited to average downsampling.
[0637] In yet another specific implementation, the method may further include: determining a first template of the current block; and determining a first color component reference sample and a second color component reference sample corresponding to the current block based on the first template.
[0638] In an embodiment of the present application, the first color component reference samples and the second color component reference samples used to establish the mapping relationship may also include the first color component reference samples and the second color component reference samples determined by the first template of the current block. Specifically, based on the first template of the current block, a first color component region template at the same location as the first template can be determined; then, based on the reconstructed samples in the first color component region template, the first color component reference samples can be determined; and based on the reconstructed samples in the first template, the second color component reference samples can be determined. The first template includes one or more reconstructed samples in the adjacent encoded area of the current block.
[0639] For example, in an embodiment of the present application, a chroma reference sample can be obtained based on the current chroma template of the current block; after determining the co-located luma region template of the current chroma template, a luma reference sample can be obtained based on the co-located luma region template. The luma reference samples and chroma reference samples obtained in the above embodiment are then combined to construct a mapping relationship between luma and chroma based on these luma reference samples and chroma reference samples.
[0640] In another specific implementation, the method may also include: determining a first template of the current block; determining a second matching template of the current block based on the first block vector parameters and the first template; and determining a first color component reference sample and a second color component reference sample corresponding to the current block based on the second matching template.
[0641] In an embodiment of the present application, the first color component reference samples and the second color component reference samples used to construct the mapping relationship may include, in addition to those determined by the reference block and the first template of the current block, the first color component reference samples and the second color component reference samples determined by the second matching template of the current block. Specifically, the first color component area matching template at the same position as the second matching template is first determined, and then the first color component reference samples can be determined based on the reconstructed samples in the first color component area matching template; and the second color component reference samples can be determined based on the reconstructed samples in the second matching template. The second matching template can be determined based on the first block vector parameter and the offset position indicated by the first template.
[0642] For example, in an embodiment of the present application, a chroma matching template for the current block can be determined based on the current chroma template and the first block vector parameters of the current block; chroma reference samples can be obtained based on the chroma matching template; after determining a co-located luma region matching template for the current chroma matching template, luma reference samples can be obtained based on the co-located luma region matching template. The luma reference samples and chroma reference samples obtained in the above embodiments are then combined to construct a mapping relationship between luma and chroma based on these luma reference samples and chroma reference samples.
[0643] S2003: Determine a predicted value of a second color component of the current block according to the mapping relationship and the sample value of the first color component of the current block.
[0644] It should be noted that, in the embodiment of the present application, determining the first color component sample value of the current block may include: determining reconstructed pixel samples of the first color component region at the same location in the current block; and determining the first color component sample value of the current block based on the reconstructed pixel samples of the first color component region. The reconstructed pixel samples of the first color component region may be directly used as the first color component sample value of the current block, or the reconstructed pixel samples of the first color component region may be filtered and the filtered reconstructed pixel samples may be used as the first color component sample value of the current block, without specific limitation herein.
[0645] For example, in an embodiment of the present application, the filtering process is a downsampling process. Here, the reconstructed luminance sample recBefDownLuma at the position of the co-located luminance area lumaPos = (xCb, yCb) corresponding to the current block can be obtained, and the luminance sample is downsampled to obtain the downsampled reconstructed luminance sample recAftDownLuma, and the downsampled reconstructed luminance sample is used as the first color component sample value of the current block. In addition, if the luminance reference sample has been mapped to a sample range, then the downsampled reconstructed luminance sample also needs to be mapped to the same sample range here to obtain the first color component sample value of the current block.
[0646] In some embodiments, determining the predicted value of the second color component of the current block based on the mapping relationship and the first color component sample value of the current block may include: if a first color component value equal to the first color component sample value is found in the mapping relationship, then determining the value of the second color component corresponding to the first color component value as the predicted value of the second color component of the current block.
[0647] For example, in the embodiment of the present application, assuming that the predicted value of the current block is predSamples, then for predSamples[cIdx][x][y], the variable cIdx specifies the color component index of the current block, and the following prediction method can be used here:
[0648] With reference to the luminance value Yc at the same position, the chrominance prediction value is derived using the mapping relationship (discrete model) established in the above embodiment.
[0649] In some embodiments, for determining the predicted value of the second color component of the current block, the method may further include: if a first color component value equal to the first color component sample value is not found in the mapping relationship, then correcting the first color component sample value, determining the first color component correction value, and continuing to search in the mapping relationship whether there is a first color component value equal to the first color component correction value.
[0650] In a specific embodiment, correcting the first color component reconstructed value to determine the first color component corrected value may include performing an offset calculation on the first color component sample value according to one or more preset offset values to determine the first color component corrected value.
[0651] In the embodiment of the present application, the offset values can be +1, -1, +2, -2, +3, -3, etc., and there is no limitation on the number and specific values of the offset values. In addition, for the correction processing of the reconstructed value of the first color component, these multiple offset values can also be set in a certain order, for example, in the order of {+1, -1, +2, -2, +3, -3}.
[0652] Exemplarily, in an embodiment of the present application, for the mapping relationship established in the aforementioned embodiment, if Yc is not found in the input luminance set, the following processing methods are included but not limited to: Yc is corrected in the order of {Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3}, and then a matching check is performed in the input luminance set based on the corrected Yc, and then the value corresponding to the corrected Yc is determined as the chrominance prediction value of the current block.
[0653] In some embodiments, for determining the predicted value of the second color component of the current block, the method also includes: if a first color component value equal to the first color component correction value is not found in the mapping relationship, then performing an average value calculation on the second color component reference sample, and determining the obtained average value as the predicted value of the second color component of the current block.
[0654] Exemplarily, in an embodiment of the present application, for the mapping relationship established in the aforementioned embodiment, if Yc is not found in the input luminance set, the following processing methods are included but not limited to: Yc is corrected in the order of {Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3}; if all of the above corrected Yc cannot be matched in the mapping relationship, the chroma prediction value can be set to the average value of the reconstructed chroma sample recBvChroma at the corresponding BV.
[0655] In some embodiments, for determining the predicted value of the second color component of the current block, the method also includes: determining a first initial predicted value of the second color component of the current block based on the mapping relationship and the sample value of the first color component of the current block; performing a correction operation on the first initial predicted value to determine the predicted value of the second color component of the current block.
[0656] It should be noted that in the embodiment of the present application, a correction operation is performed on the first initial prediction value obtained according to the mapping relationship. The correction operation here may include a clip operation, a filtering operation, a weighted operation with the prediction value obtained by other prediction modes, etc., and there is no limitation on this.
[0657] In a specific embodiment, performing a correction operation on the first initial prediction value to determine the prediction value of the second color component of the current block may include: performing prediction processing on the second color component of the current block according to the first preset mode to determine the second initial prediction value of the second color component of the current block; and performing weighted calculation on the first initial prediction value and the second initial prediction value to determine the prediction value of the second color component of the current block. It should be noted that, in the embodiment of the present application, the first preset mode includes at least one of the following: PLANAR mode, DM mode, DC mode and CCLM mode. That is, performing a correction operation on the first initial prediction value obtained according to the mapping relationship may include but is not limited to weighting with the CCLM-type mode or other prediction modes to obtain the chrominance prediction value of the current block.
[0658] In another specific embodiment, performing a correction operation on the first initial prediction value to determine the prediction value of the second color component of the current block may include: limiting the first initial prediction value within a preset numerical range, or it may also be called a "clip operation". It should be noted that, in the embodiment of the present application, the lower limit value of the preset numerical range is the minimum prediction value (min), and the upper limit value of the preset numerical range is the maximum prediction value (max). If the first initial prediction value is within the preset numerical range, then the first initial prediction value can be used as the chrominance prediction value of the current block; if the first initial prediction value is greater than max, then max can be used as the chrominance prediction value of the current block; if the first initial prediction value is less than min, then min can be used as the chrominance prediction value of the current block.
[0659] In some embodiments, for determining the predicted value of the second color component of the current block, the method also includes: when the number of first block vector parameters is multiple, determining multiple third initial predicted values of the second color component of the current block; performing weighted calculation on the multiple third initial predicted values to determine the predicted value of the second color component of the current block.
[0660] It should be noted that in an embodiment of the present application, if the aforementioned embodiment determines multiple BVs (first block vector parameters), then multiple third initial prediction values can be obtained based on these multiple BVs; then these multiple third initial prediction values are weighted, and the weighted prediction values are used as the chrominance prediction values of the current block; or, the weighted prediction values can be further modified, including but not limited to weighting with CCLM-type modes or other prediction modes to obtain the chrominance prediction value of the current block.
[0661] In some embodiments, for determining the predicted value of the second color component of the current block, the method may further include: when the first color component block of the current block includes multiple candidate blocks, determining the second block vector parameters of each of the multiple candidate blocks; constructing multiple block vector parameter candidate lists of the second color component of the current block based on the second block vector parameters of each of the multiple candidate blocks, and determining multiple first block vector parameters of the second color component of the current block based on the multiple block vector parameter candidate lists; establishing a mapping relationship between the first color component and the second color component based on the multiple first block vector parameters, and determining the predicted value of the second color component of the current block based on the mapping relationship and the first color component sample value of the current block.
[0662] It should be noted that in the embodiment of the present application, multiple blocks of the same luminance region are obtained, and the positions of the multiple blocks include but are not limited to the following positions, as shown in Figure 19. First, it is determined whether the multiple blocks are available, and then the candidates for their respective chrominance BVC candidate lists are constructed based on the luminance BVs of the available blocks in the multiple blocks; the multiple blocks are respectively judged for the availability of the BVs in the candidate list, and the multiple blocks are further determined to have one or more BVs. All the available chrominance BVCs of the multiple blocks can establish a mapping table LUT between luminance and chrominance, so that according to this mapping table LUT, the chrominance prediction value of the current block can be obtained.
[0663] In some embodiments, for determining the predicted value of the second color component of the current block, the method also includes: determining multiple groups of first color component reference samples and second color component reference samples corresponding to the current block based on multiple first block vector parameters; establishing multiple candidate mapping relationships between the first color component and the second color component according to the multiple groups of first color component reference samples and second color component reference samples corresponding to the current block; determining a target mapping relationship from the multiple candidate mapping relationships; and determining the predicted value of the second color component of the current block based on the target mapping relationship and the first color component sample value of the current block.
[0664] In a specific embodiment, determining a target mapping relationship from multiple candidate mapping relationships may include: performing cost calculations on multiple candidate mapping relationships based on a rate-distortion cost method to determine multiple rate-distortion cost results; determining a minimum rate-distortion cost result from the multiple rate-distortion cost results, and determining the candidate mapping relationship corresponding to the minimum rate-distortion cost result as the target mapping relationship.
[0665] It should be noted that in the embodiment of the present application, the distortion value method can be used to determine the cost result, specifically the rate-distortion cost method can be used to determine the cost result; however, it can also be the size of SAD, the size of MSE, the size of SSE or other criteria for judging the cost, which is not specifically limited here.
[0666] Furthermore, in some embodiments, the method also includes: determining a mapping relationship index value, wherein the mapping relationship index value is used to indicate a candidate mapping relationship corresponding to a minimum rate-distortion cost result among multiple rate-distortion cost results; encoding the mapping relationship index value, and writing the obtained encoded bits into the bitstream.
[0667] It should also be noted that in an embodiment of the present application, the mapping relationship index value can be determined and written into the bitstream based on the index number of the candidate mapping relationship corresponding to the minimum rate-distortion cost result in multiple candidate mapping relationships, so that the decoding end can determine the corresponding target mapping relationship based on the mapping relationship index value obtained by decoding.
[0668] That is, in an embodiment of the present application, multiple mapping tables LUTs between luminance and chrominance can be established, and then the selected target mapping table LUT can be specified using syntax elements. For example, multiple blocks of the same luminance area are obtained, and the positions of the multiple blocks include but are not limited to the following positions, as shown in Figure 19. First, it is determined whether these multiple blocks are available, and then the candidates for their respective chrominance BVC candidate lists are constructed based on the luminance BVs of the available blocks in these multiple blocks; the multiple blocks are judged for the availability of BVs in the candidate list, and the multiple blocks are further determined to have one BV or multiple BVs, and a mapping table LUT can be established for each of the available chrominance BVCs of these multiple blocks; the encoding end predicts the current block template using different mapping table LUTs, and then calculates the difference between it and the reconstructed value of the template to decide which mapping relationship to use; subsequently, at the decoding end, the mapping relationship index value can be determined by decoding the corresponding syntax element; then, the target mapping relationship can be determined based on the mapping relationship index value, and then the chrominance prediction value of the current block is determined. It should be noted that the number of mapping relationships established here can be set arbitrarily, for example, the number can be set to 4, but there is no specific limit.
[0669] In some embodiments, for determining the predicted value of the second color component of the current block, the method also includes: determining multiple groups of first color component reference samples and second color component reference samples corresponding to the current block based on multiple first block vector parameters; establishing multiple candidate mapping relationships between the first color component and the second color component based on the multiple groups of first color component reference samples and second color component reference samples corresponding to the current block; performing matching error calculation on the multiple candidate mapping relationships based on the template matching method to determine the second generation values of the multiple candidate mapping relationships; determining the minimum cost value from the second generation values of the multiple candidate mapping relationships, and determining the candidate mapping relationship corresponding to the minimum cost value as the target mapping relationship; determining the predicted value of the second color component of the current block based on the target mapping relationship and the first color component sample value of the current block.
[0670] In a specific embodiment, matching errors are calculated for multiple candidate mapping relationships based on a template matching method to determine the second-generation values of each of the multiple candidate mapping relationships, which may include: determining the first template of the current block; determining the reconstructed pixel sample values of the first color component area template at the same position of the first template; determining the predicted values of the second color components of the first template under multiple mapping relationships based on the multiple candidate mapping relationships and the reconstructed pixel sample values of the first color component area template; performing cost calculation based on the reconstructed values of the second color components of the first template and the predicted values of the second color components of the first template under multiple mapping relationships to determine the second-generation values of each of the multiple candidate mapping relationships.
[0671] It should be noted that in an embodiment of the present application, multiple mapping tables LUT between brightness and chrominance can be established, and then a template is used to select which mapping table LUT to use. Exemplarily, multiple blocks of the same brightness area are obtained, and the positions of the multiple blocks include but are not limited to the following positions, as shown in Figure 19. First, it is determined whether these multiple blocks are available, and then the candidates for their respective chrominance BVC candidate lists are constructed according to the brightness BV of the available blocks in these multiple blocks; the multiple blocks are judged for the availability of BV in the candidate list, and the multiple blocks are further determined to have one BV or multiple BVs, and a mapping table LUT can be established for each of the available chrominance BVCs of these multiple blocks; the current block template is predicted using different mapping tables LUT, and the difference is calculated with the reconstructed value of the template, and then a decision is made on which mapping relationship to use, and then the mapping relationship finally decided is used to determine the chrominance prediction value of the current block. It should be noted that the number of mapping relationships established here can be set arbitrarily, for example, the number can be set to 4, but there is no specific limit.
[0672] In a specific embodiment, the specific process of performing LUT prediction on the current block template is as follows:
[0673] Obtain the reconstructed luminance sample recBef DownLumaR of the co-located luminance area template lumaPos = (xCbR, yCbR) corresponding to the current block template, downsample the luminance sample to obtain the downsampled reconstructed luminance sample recAftDownLumaR, and perform mapping processing on the sample in the same sample range.
[0674] Assuming that the predicted value of the current block template is predSamplesR, for predSamplesR[cIdx][x][y], the variable cIdx specifies the color component index of the current block, and the prediction method is: refer to the luminance value Yc at the same position to derive the predicted value using the established mapping relationship. If Yc is not found in the input luminance set in the established mapping relationship, the following processing methods are included but not limited to: check in the order of {Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3}. If all the above values cannot be matched in the mapping relationship, the chroma prediction value of the current block is set to the average value of the reconstructed chroma sample recBvChroma at the corresponding BV.
[0675] When calculating the cost of the current block template and the template prediction value of each LUT, the following situations exist for the use of the template:
[0676] The first type: Both the upper template and the left template of the current block exist. In this case, both the upper template and the left template are available.
[0677] The second type: Only the upper template exists in the current block, and only the upper template is available.
[0678] The third type: Only the left template exists in the current block, and only the left template is available.
[0679] The fourth type: Neither the upper template nor the left template of the current block exists. In this case, the LUT finally selected is the first LUT created or the LUT at a specified position.
[0680] For example, in the embodiment of the present application, assuming that the reconstruction value of the current block template is recSamplesR, there are multiple options for the cost function for calculating the template region cost, for example, the sum of absolute deviations (SAD), the sum of transformed absolute deviations (SATD), the sum of squared differences (SSE), the mean absolute deviation (MAD), the mean absolute error (MAE), the mean squared error (MSE), and other evaluation criteria can be selected. The evaluation criteria mentioned in the following content can be selected from the above criteria. Taking the evaluation criterion of SAD as an example, the calculation formula is as follows:
[0681] Among them, predTempSizeW is the width of the template, predTempSizeH is the height of the template, predSamplesR[i][j] is the predicted pixel point of the current block template after LUT, and recSamplesR[i][j] is the reconstructed pixel point of the current block template.
[0682] It should also be noted that in the embodiment of the present application, when selecting the final LUT using the current block template, except for cases where the cost cannot be calculated, the cost of each established LUT candidate is calculated and sorted. The sorting method includes but is not limited to bubble sort, selection sort, insertion sort, shell sort, merge sort, quick sort, radix sort, heap sort, counting sort, bucket sort, etc. Among them, the LUT candidate with the lowest cost is selected as the final LUT used.
[0683] Furthermore, in an embodiment of the present application, the method further includes: determining a prediction mode of the current block; and when the prediction mode indicates that the second color component of the current block uses a target prediction mode, executing the step of determining a first block vector parameter of the current block.
[0684] In some embodiments, determining the prediction mode of the current block may include: determining multiple candidate modes, the multiple candidate modes including at least a target prediction mode; performing cost calculations on the multiple candidate modes based on a preset cost method to determine multiple third-generation values; determining a minimum cost value from the multiple third-generation values, and determining the candidate mode corresponding to the minimum cost value as the prediction mode of the current block; wherein the preset cost method includes at least one of the following: a rate-distortion cost method and a template matching method.
[0685] That is to say, in the embodiment of the present application, the BVG-LUT mode and other modes can be used simultaneously. Among them, in the DM mode, in addition to the BVG-LUT mode, other modes can also compete. The final use mode is determined according to the template cost. For example, instead of directly using the BV obtained by brightness, you can directly use BV copy, or you can use the BVG-LUT mode defined in the embodiment of the present application. After both modes are applied to the template of the current block, the one with the smaller template cost is selected as the target prediction mode for the current block.
[0686] Furthermore, in an embodiment of the present application, the method also includes: determining the first color component area at the same position of the current block; if the current block uses the DM mode and the first color component area is predicted based on the block vector, determining that the second color component of the current block uses the target prediction mode.
[0687] For example, in the embodiment of the present application, under dual-tree partitioning, in DM mode, if the corresponding luminance region has BV information, the current block is predicted using the target prediction mode. For example:
[0688] If CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to MODE_IBC, set intra_bvgplt_flag=1, and the chroma intra prediction mode IntraPredModeC[xCb][yCb] uses the target prediction mode.
[0689] If CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to MODE_INTRA, if IntraTmpFlag[xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to 1, set intra_bvgplt_flag=1, then the chroma intra prediction mode IntraPredModeC[xCb][yCb] uses the target prediction mode.
[0690] In the embodiment of the present application, the first syntax element identification information can be represented by intra_bvgplt_flag or bvgplt_flag, and the target prediction mode can be represented by BVG-PLT or BVG-LUT. The chroma prediction mode is derived as follows:
[0691] The chroma intra prediction mode IntraPredModeC[xCb][yCb] uses cclm_mode_flag, cclm_mode_idx, intra_chroma_pred_mode, lumaIntraPredMode, and lumaTempPredMode specified in the following table. These padding items other than the BVG-LUT mode are exemplary given corresponding values, and are not required to be filled in with the value. Among them, Table 10 shows an example of chroma prediction mode derivation. As shown in Table 10 above, 0 represents Planar mode, 1 represents DC mode, 18 represents horizontal mode, 50 represents vertical mode, and 81 to 83 represent CCLM mode.
[0692] According to Table 10, in DM mode, if intra_ibc_flag == 1, that is, the information obtained from the center block of the same luminance area contains BV, the chroma intra prediction mode IntraPredModeC[xCb][yCb] uses the BVG-LUT mode.
[0693] Furthermore, in an embodiment of the present application, the method also includes: determining a value of first syntax element identification information; wherein the first syntax element identification information is used to indicate whether the second color component of the current block uses a target prediction mode; encoding the value of the first syntax element identification information, and writing the obtained encoding bits into the bitstream.
[0694] It should be noted that, in this embodiment of the present application, if the second color component of the current block uses the target prediction mode, the value of the first syntax element identification information is determined to be a first value; if the second color component of the current block does not use the target prediction mode, the value of the first syntax element identification information is determined to be a second value. In addition, in this embodiment of the present application, when the first syntax element identification information indicates that the second color component of the current block uses the target prediction mode, the step of determining the first block vector parameter of the current block is performed.
[0695] Furthermore, in an embodiment of the present application, the method also includes: determining a value of second syntax element identification information; wherein the second syntax element identification information is used to indicate whether the second color component of the current block is allowed to use the target prediction mode; encoding the value of the second syntax element identification information, and writing the obtained encoding bits into the bitstream.
[0696] It should be noted that, in this embodiment of the present application, the second syntax element identification information may be represented by BvgpltEnabled. If the second color component of the current block allows the use of the target prediction mode, the value of the second syntax element identification information is determined to be a first value; if the second color component of the current block does not allow the use of the target prediction mode, the value of the second syntax element identification information is determined to be a second value.
[0697] It should also be noted that in the embodiment of the present application, the first value and the second value are different. The first value and the second value can be in parameter form or in numerical form. Specifically, both the first syntax element identification information and the second syntax element identification information can be parameters written into the profile or the value of a flag / identifier, and are not specifically limited here.
[0698] For example, the first value may be set to 1 and the second value may be set to 0; or the first value may be set to 0 and the second value may be set to 1; or the first value may be set to true and the second value may be set to false; or the first value may be set to false and the second value may be set to true. In the embodiment of the present application, the first value may be set to 1 and the second value may be set to 0, but this is not specifically limited.
[0699] Exemplarily, in an embodiment of the present application, if the syntax element sps_ibc_enabled_flag is equal to 0 and sps_intratmp_enabled_flag is equal to 0, then BvgpltEnabled is equal to 0. Otherwise, the variable ModeIncludeBv is set, and if the corresponding luminance block is not encoded in a mode with BV information, ModeIncludeBv is equal to 0; otherwise, ModeIncludeBv is equal to 1.
[0700] BvgpltEnabled equals 1 if multiple of the following conditions are true simultaneously (including but not limited to the following):
[0701] ModeIncludeBv is equal to 1;
[0702] sh_slice_type is equal to I frame;
[0703] CtbLog2SizeC is less than or equal to MaxChromaIbcSize; wherein MaxChromaIbcSize may be determined according to the chroma CTU size or a preset value.
[0704] Otherwise, BvgpltEnabled is equal to 0. Here, if BvgpltEnabled is equal to 0, the value of the first syntax element identification information can be inferred to be 0.
[0705] It can also be understood that, in the embodiment of the present application, referring to FIG. 20 , after step S2003 , the method may further include:
[0706] S2004: Determine a residual value of the second color component of the current block according to the predicted value of the second color component of the current block.
[0707] It should be noted that in the embodiment of the present application, the original value of the second color component of the current block is determined, and the residual value of the second color component of the current block is determined based on the original value and the predicted value of the second color component of the current block. Specifically, the residual value of the second color component of the current block can be obtained by performing a subtraction operation on the original value and the predicted value of the second color component of the current block.
[0708] It should also be noted that in this embodiment of the present application, the residual value of the second color component of the current block is encoded, and the resulting encoded bits are written into the bitstream. Thus, at the decoding end, the residual value of the second color component of the current block is determined by decoding the bitstream; based on the residual value and the predicted value of the second color component of the current block, the reconstructed value of the second color component of the current block is determined. Specifically, the residual value and the predicted value of the second color component of the current block can be added to recover the reconstructed value of the second color component of the current block.
[0709] Furthermore, 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 includes at least one of the following: the residual value of the second color component of the current block, the value of the first syntax element identification information, the value of the second syntax element identification information and the mapping relationship index value.
[0710] In the embodiment of the present application, the first syntax element identification information is used to indicate whether the second color component of the current block uses the target prediction mode, the second syntax element identification information is used to indicate whether the second color component of the current block is allowed to use the target prediction mode, and the mapping relationship index value is used to indicate the index number of the candidate mapping relationship corresponding to the minimum rate-distortion cost result among multiple candidate mapping relationships. In this way, the encoder writes the information to be encoded into the bitstream, which is transmitted from the encoder to the decoder, so that the decoder can obtain this information by decoding the bitstream, thereby recovering the chrominance reconstruction value of the current block.
[0711] This embodiment provides an encoding method, which first determines the first block vector parameter of the current block; then determines the first color component reference sample and the second color component reference sample corresponding to the current block based on the first block vector parameter; then establishes a mapping relationship between the first color component and the second color component based on the first color component reference sample and the second color component reference sample; and determines a predicted value of the second color component of the current block based on the mapping relationship and the first color component sample value of the current block. In this way, after determining the first block vector parameter of the chrominance component based on the block vector parameter of the luminance block, a mapping relationship between the luminance component and the chrominance component is established based on the luminance component reference sample and the chrominance component reference sample at the first block vector parameter, and then uses this mapping relationship to predict the chrominance component. In this way, the singleness problem of chrominance prediction is improved, the relevant information of the same-position luminance block is fully utilized, and the accuracy of chrominance prediction can be improved. At the same time, based on the established mapping relationship, pixel-level prediction can also be effectively performed, thereby further saving bit rate and improving encoding and decoding efficiency.
[0712] In another embodiment of the present application, based on the encoding and decoding method described in the previous embodiment, the embodiment of the present application adds a new prediction mode BVG-LUT mode (i.e., solution 1). In the process of solution 1, the corresponding luminance block is obtained, and it is determined whether the corresponding luminance block is encoded in a mode with BV information. Then, the following processing methods can be adopted:
[0713] If not, the syntax elements of this mode are not transmitted in the codestream;
[0714] If so, and the BVG-LUT mode is true, the BV of the corresponding luma block is obtained, the luma BV (BVL) is adjusted and applied to the chroma, and a candidate list of chroma BV (BVC) is constructed. Next, a determination is made as to whether the BVC candidate in the chroma BVC candidate list is available. If available, the decision phase is entered; if unavailable, the BVC is adjusted to be available and the decision phase is entered; or if all BVC candidates in the chroma BVC candidate list are unavailable, prediction is made using the PLANAR mode or another chroma prediction mode. Figures 21 and 22 illustrate different processing flow charts for situations where BVC candidates are unavailable.
[0715] Refer to Figure 21, which shows a detailed flow diagram of an encoding method provided by an embodiment of the present application. As shown in Figure 21, the detailed flow may include:
[0716] S2101: Obtain the corresponding luminance block.
[0717] S2102: Determine whether the prediction mode of the corresponding luminance block is a mode with BV information.
[0718] S2103: Syntax elements of the DBV mode are not transmitted in the code stream.
[0719] S2104: Determine whether the BVG-LUT mode is applied to the current block.
[0720] S2105: If the BVG-LUT mode is not applied to the current block, use other prediction modes for chrominance prediction.
[0721] S2106: If the BVG-LUT mode is applied to the current block, obtain the BV parameters of the corresponding luminance block.
[0722] S2107: Construct a BVC candidate list for chroma.
[0723] S2108: Determine whether the candidate BV is available.
[0724] S2109: If the candidate BV is not available, adjust the candidate BV until it is available.
[0725] S2110: If the candidate BV is available, determine the final chrominance BV.
[0726] S2111: Perform chroma prediction based on chroma BV.
[0727] Refer to Figure 22, which shows a detailed flow diagram of another encoding method provided by an embodiment of the present application. As shown in Figure 22, the detailed flow may include:
[0728] S2201: Obtain the corresponding luminance block.
[0729] S2202: Determine whether the prediction mode of the corresponding luminance block is a mode with BV information.
[0730] S2203: Syntax elements of the DBV mode are not transmitted in the code stream.
[0731] S2204: Determine whether the BVG-LUT mode is applied to the current block.
[0732] S2205: If the BVG-LUT mode is not applied to the current block, use other prediction modes for chrominance prediction.
[0733] S2206: If the BVG-LUT mode is applied to the current block, obtain the BV parameters of the corresponding luminance block.
[0734] S2207: Construct a BVC candidate list for chroma.
[0735] S2208: Determine whether the candidate BV is available.
[0736] S2209: If the candidate BV is not available, use other prediction modes for chrominance prediction.
[0737] S2210: If the candidate BV is available, determine the final chroma BV.
[0738] S2211: Perform chroma prediction based on chroma BV.
[0739] In a specific embodiment, the encoding method of the embodiment of the present application may specifically include:
[0740] S1: Get the corresponding brightness block.
[0741] The obtained block location can be any location, including but not limited to the following locations:
[0742] The obtained block location can be any location, including but not limited to the following locations:
[0743] (1) Obtain the center block of the same-position brightness area, as shown in Figure 3.
[0744] (2) Obtain the block at the upper left corner of the same brightness area, as shown in Figure 7.
[0745] (3) Obtain the block at the lower right corner of the co-located brightness area, as shown in FIG8 .
[0746] (4) The block containing five luminance pixel positions shown in FIG9 (including but not limited to five positions, which may be multiple different positions) is acquired in sequence until it is determined that the obtained block is encoded in a mode with BV information, that is, the block at the first luminance pixel position is found to be encoded in a mode with BV information, and the order of sequential acquisition includes but is not limited to the following order: C->TL->TR->BL->BR.
[0747] S2: The luminance block is encoded in a mode with BV information.
[0748] Get the block at the corresponding position and determine whether the luminance block is processed in a mode with BV information, including but not limited to IBC mode or IntraTMP mode:
[0749] If yes, get the BV of the corresponding luminance block;
[0750] If not, no syntax elements for this mode are transmitted in the codestream.
[0751] S3: Build a chroma BVC candidate list.
[0752] Assume that brightness BV=(BVL hor ,BVL ver ), chroma BV=(BVC hor ,BVC ver), by adjusting the BVL or BVC to construct a chroma BVC candidate list containing one or more candidates. The construction method includes but is not limited to one of the following situations, and different methods can be used to construct a candidate list at the same time.
[0753] Method 1: Scale according to the chroma sampling format and add the scaled BVC to the chroma BVC candidate list.
[0754] Method 2: After obtaining the BV of the corresponding luminance block, record it as BVL; the chrominance BV obtained through BVL is recorded as BVC; by adjusting BVL or BVC, a chrominance BVC candidate containing one or more candidates is constructed.
[0755] The candidate construction methods include but are not limited to the following:
[0756] Construction method 1: Adjust BVL to form four situations, and then adjust BVC.
[0757] When BVL is an odd number, take BVL=(BVL hor ,BVL ver )、BVL=(BVL hor +1, BVL ver )、BVL=(BVL hor ,BVL ver +1), BVL=(BVL hor +1,BVL ver +1) Four situations.
[0758] When BVL is an even number, take BVL=(BVL hor ,BVL ver ).
[0759] The BVL is scaled according to the chroma sampling format in the first method to obtain the BVC. In this way, when the BVL is an odd number, four BVC candidates are formed, and these candidates are added to the chroma BVC candidate list.
[0760] Construction method 2: Adjust BVL to form four situations, and then adjust BVC.
[0761] When BVL is an odd number, take BVL=(BVL hor ,BVL ver )、BVL=(BVL hor +1, BVL ver )、BVL=(BVL hor ,BVL ver +1), BVL=(BVL hor +1,BVL ver +1) Four situations.
[0762] When BVL is an even number, take BVL=(BVL hor ,BVL ver )、BVL=(BVL hor -1, BVL ver )、BVL=(BVL hor ,BVL ver -1)、BVL=(BVL hor -1,BVL ver -1) Four situations.
[0763] According to the chroma sampling format in method 1, BVL is scaled to obtain BVC. In this way, when BVL is odd or even, four BVC candidates are formed and added to the chroma BVC candidate list. This method can also be operated without distinguishing between odd and even numbers by the following calculation:
[0764] Set BVL = (BVL hor -1,BVL ver -1)、BVL=(BVL hor +1, BVL ver -1)、BVL=(BVL ho -1 r ,BVL ver +1), BVL=(BVL hor +1,BVL ver +1) Four situations, but not specifically limited.
[0765] Construction method three: Adjust BVL to form multiple situations, and then adjust BVC.
[0766] When BVL is an odd number, take BVL=(BVL hor ,BVL ver )、BVL=(BVL hor +1, BVL ver )、BVL=(BVL hor ,BVL ver +1), BVL=(BVL hor +1,BVL ver +1), BVL=(BVL hor +3,BVL ver )、BVL=(BVL hor ,BVL ver +3), BVL=(BVL hor +3,BVL ver +3), BVL=(BVL hor -2,BVL ver )、BVL=(BVL hor,BVL ver -2) and many other situations.
[0767] When BVL is an even number, take BVL=(BVL hor ,BVL ver )、BVL=(BVL hor -1, BVL ver )、BVL=(BVL hor ,BVL ver -1)、BVL=(BVL hor -1,BVL ver -1)、BVL=(BVL hor -3,BVL ver )、BVL=(BVL hor, BVL ver -3), BVL=(BVL hor -3,BVL ver -3), BVL=(BVL hor +2,BVL ver )、BVL=(BVL hor ,BVL ver +2) and many other situations.
[0768] The BVL is scaled according to the chroma sampling format in method 1 to obtain the BVC. This generates multiple BVC candidates when the BVL is odd or even, and these candidates are added to the chroma BVC candidate list. It should be noted that these candidates can be added to the chroma BVC candidate list in order.
[0769] Similar to the second method, we can also not distinguish between odd and even numbers and express them uniformly as follows:
[0770] Set BVL=(BVLhor-1,BVLver-1), BVL=(BVLhor+1,BVLver-1), BVL=(BVLhor-1,BVLver+1), BVL=(BVLhor+1,BVLver+1), BVL=(BVLhor +3,BVLver-1), BVL=(BVLhor-1,BVLver+3), BVL=(BVLhor+3,BVLver+3), BVL=(BVLhor-3,BVLver-1), BVL=(BVLhor-1,BVLver-3), etc.
[0771] Construction method 4: Adjust the BVC obtained in method 1 to obtain nine candidates, but the specific number is not limited.
[0772] Set BVC=(BVC hor ,BVC ver)、BVC=(BVC hor -1, BVC ver )、BVC=(BVC hor ,BVC ver -1), BVC=(BVC hor -1,BVC ver -1), BVC=(BVC hor +1, BVC ver )、BVC=(BVC hor ,BVC ver +1), BVC=(BVC hor +1 , BVC ver +1), BVC=(BVC hor -1,BVC ver +1), BVC=(BVC hor +1,BVC ver -1), thus forming nine BVC candidates, which are added to the chroma BVC candidate list.
[0773] Construction method 5: Adjust the BVC obtained in method 1 to obtain multiple candidates.
[0774] Set BVC=(BVC hor ,BVC ver )、BVC=(BVC hor -1, BVC ver )、BVC=(BVC hor ,BVC ver -1), BVC=(BVC hor -1,BVC ver -1), BVC=(BVC hor +1, BVC ver )、BVC=(BVC hor ,BVC ver +1), BVC=(BVC hor +1,BVC ver +1), BVC=(BVC hor -1,BVC ver +1), BVC=(BVC hor +1,BVC ver -1), BVC=(BVC hor -2, BVC ver )、BVC=(BVC hor ,BVC ver -2), BVC=(BVC hor -2,BVC ver -2), BVC=(BVChor +2, BVC ver )、BVC=(BVC hor, BVC ver +2), BVC=(BVC hor +2,BVC ver +2), BVC=(BVC hor -2,BVC ver +2), BVC=(BVC hor +2,BVC ver -2), etc., thus forming a variety of BVC candidates, which are added to the chroma BVC candidate list.
[0775] S4: Determine whether BV is available.
[0776] Get the position of the current block (xCb, yCb), get all BVC candidates obtained in S3, for each BVC candidate, BVC=(BVC hor , BVC ver ), find the corresponding offset position (xCb+BVC hor ,yCb+BVC ver ), judge the following conditions, including but not limited to the following conditions. If all of them are true, the candidate chroma BV is available, and thus a list of available BVC candidates is constructed:
[0777] Whether the obtained offset position does not exceed the picture boundary, for example, xCb+width+BVC hor <=xCb or yCb+height+BVC ver <=yCb;
[0778] Whether the obtained offset position does not cover the current block, as shown in Figure 10;
[0779] Whether the obtained offset position does not exceed the available area, as shown in Figure 11;
[0780] Whether the obtained offset position has been reconstructed.
[0781] Here, if at least one BVC candidate is available, the process proceeds to S5 for BV decision. If none are available, a BVC candidate is adjusted to be available, and the process proceeds to S5 for BV decision. Adjustment methods include, but are not limited to, cropping and scaling.
[0782] If none of them are available, a PLANAR mode, CCLM-type mode or other angular prediction mode may be used as an alternative to obtain reference pixels and mode parameters for chroma mode prediction.
[0783] S5: Decision BV.
[0784] If the available BVC candidate list obtained in S4 has only one BVC candidate, the BVC finally selected is this BVC.
[0785] If the available BVC candidate list obtained in S4 contains multiple BVC candidates, it is necessary to make a decision on these BVCs to obtain the final BV. The decision-making methods include but are not limited to the following methods:
[0786] Using templates for decision making:
[0787] ①Template selection.
[0788] Based on the pixel availability in the neighboring area of the current block, the availability of pixels at the template location is determined, including the reconstruction of chrominance information. This includes, but is not limited to, classifying templates into top, left, top-right, bottom-left, and top-left templates based on their relative positional relationship with the current block, as shown in Figure 15.
[0789] The template sizes of different types for different current blocks can be fixed to the same size or different sizes:
[0790] For example, the template size selects the same template size for any current coding block. The following formula illustrates a setting condition for the template size, where nTbW and nTbH are the width and height of the current chroma coding block, and iTempW and iTempH are the width and height of the adopted template:
[0791] Upper template:
[0792] Left template:
[0793] For example, different template sizes can be selected according to the different sizes of the current coding block. The following formula illustrates a template size setting condition, where nTbW and nTbH are the width and height of the current chroma coding block, and iTempW and iTempH are the width and height of the adopted template:
[0794] Upper template:
[0795] Left template:
[0796] in,
[0797] For example, different template sizes can also be selected based on the number of pixels in the current chroma coding block. The following formula illustrates a template size setting condition, where nTbW and nTbH are the width and height of the current chroma coding block, nTbW×nTbH is the number of pixels in the current chroma coding block, and iTempW and iTempH are the width and height of the adopted template:
[0798] Upper template:
[0799] Left template:
[0800] ②BV prediction of template.
[0801] For the obtained multiple BVC candidates, motion compensation is performed using the template of the current block to obtain the template corresponding to the BV, as shown in Figure 16. The use of templates when calculating costs has the following situations:
[0802] The first type: the upper template and the left template of the current block both exist, and the upper template and the left template at the corresponding BV both exist. In this case, both the upper template and the left template are available.
[0803] The second method is: Both the upper and left templates of the current block exist, but only the upper template exists at the corresponding BV. In this case, there are two methods: Method 1: If the left template at the corresponding BV does not exist, it is directly ignored, that is, only the upper template is used for calculation. Method 2: If the left template at the corresponding BV does not exist, the leftmost template width column in the reference block is used instead of the left template, that is, the upper and left templates are used for calculation.
[0804] The third method is: both the upper template and the left template of the current block exist, but only the left template exists at the corresponding BV. In this case, there are two methods: Method 1: If the upper template does not exist at the corresponding BV, it is directly not used, that is, only the left template is used for calculation. Method 2: If the upper template does not exist at the corresponding BV, the uppermost template height row inside the reference block is used instead of the upper template, that is, the upper and left templates are used for calculation.
[0805] The fourth scenario: Only the upper template exists in the current block. There are three possible approaches: Method 1: If the upper template at the corresponding BV does not exist, it is not used. The final BV selected is the first BVC in the BVC candidate list or the BVC at a specified position. Method 2: If the upper template at the corresponding BV does not exist, the uppermost template height row in the reference block is used instead. Method 3: If the upper template at the corresponding BV exists, it is used directly.
[0806] The fifth method: Only the left template exists in the current block. In this case, there are three methods: Method 1: If the left template at the corresponding BV does not exist, it is directly used. In this case, the final BV selected is the first BVC in the BVC candidate list or the BVC at a specified position. Method 2: If the left template at the corresponding BV does not exist, the leftmost template width column in the reference block is used instead. Method 3: If the left template at the corresponding BV exists, it is directly used.
[0807] The sixth type: Neither the upper template nor the left template of the current block exists. At this time, the BV finally selected is the first BVC in the BVC candidate list or the BVC at a specified position.
[0808] ③Calculate the cost.
[0809] There are many options for the cost function for calculating the template area cost. For example, you can choose evaluation criteria such as the sum of absolute differences (SAD), the sum of transformed absolute differences (SATD), the sum of squared differences (SSE), the mean absolute difference (MAD), the mean absolute error (MAE), the mean squared error (MSE), and the rate-distortion function (RDO). Any evaluation criterion mentioned here can be selected from the above criteria for cost calculation.
[0810] ④Select the final BV.
[0811] Except for the case where the cost cannot be calculated in ②, in other cases, the cost of each candidate in the BVC candidate list is calculated and sorted. The sorting methods include but are not limited to bubble sort, selection sort, insertion sort, shell sort, merge sort, quick sort, radix sort, heap sort, counting sort, bucket sort and other sorting methods. The BVC with the smallest cost is selected as the final BV, so as to perform chromaticity prediction based on BV. It should be noted that when calculating the cost of multiple candidate block vector parameters, a cost can be calculated for each candidate block vector parameter, and the candidate block vector parameter with the smallest cost is always retained. In this case, a list is not required, and even sorting is not required.
[0812] S6: Chroma prediction based on BV.
[0813] For chrominance prediction, the following methods are included but not limited to:
[0814] In the first approach, FIG23 is a schematic diagram of a BV-based chrominance prediction process provided by an embodiment of the present application. As shown in FIG23 , the process may include:
[0815] S231: Obtain brightness and chromaticity samples at BV.
[0816] (1) Get brightness samples:
[0817] Get the position of the current block, that is, the position of the upper left chromaticity sample of the current block relative to the upper left chromaticity sample of the current image, chromaPos = (x, y), scale chromaPos according to the chroma sampling format, and obtain the position of the same luminance area corresponding to the current block lumaPos = (xCb, yCb).
[0818] The chroma BV=(BVChor, BVCver) is obtained, and the chroma BV is adjusted according to the chroma sampling format to obtain the luminance BV=(BVYhor, BVYver) of the co-located luminance area corresponding to the current block.
[0819] Obtain the position of the co-located luminance region corresponding to the current block as lumaPos = (xCb, yCb), obtain the luminance BV = (BVYhor, BVYver), and find the offset position (xCb + BVYhor, yCb + BVYver) corresponding to the co-located luminance region corresponding to the current block, as shown in Figure 17. Downsample the luminance at this position to obtain a downsampled luminance sample, using the following sampling methods to compete or default, including but not limited to the following downsampling methods.
[0820] Assuming that the brightness sample before downsampling is recBvBefDownLuma, the width of the storage buffer is iRecRefLumaStride, and the brightness sample after downsampling is recBvAftDownLuma, the downsampled sample at position (i, j) is:
[0821] Downsampling method 1:
[0822] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]*2
[0823] +recBvBefDownLuma[2*i+1]
[0824] +recBvBefDownLuma[2*i-1]
[0825] +recBvBefDownLuma[2*i+iRecRefLumaStride]*2
[0826] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]
[0827] +recBvBefDownLuma[2*i-1+iRecRefLumaStride]+4)>>3;
[0828] Downsampling method 2:
[0829] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
[0830] +recBvBefDownLuma[2*i+1]+1)>>1;
[0831] Downsampling method three:
[0832] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
[0833] +recBvBefDownLuma[2*i+iRecRefLumaStride]+1)>>1;
[0834] Downsampling method 4:
[0835] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+iRecRefLumaStride]
[0836] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1;
[0837] Downsampling method five:
[0838] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+1]
[0839] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1;
[0840] Downsampling method six:
[0841] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
[0842] +recBvBefDownLuma[2*i+1]
[0843] +recBvBefDownLuma[2*i+iRecRefLumaStride]
[0844] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+2)>>2.
[0845] In this way, after downsampling, the downsampled reconstructed luminance sample recBvAftDownLuma at the co-located luminance area corresponding to BV of the current block is obtained.
[0846] (2) Get chroma samples:
[0847] Get the position of the current block (xCbC, yCbC), get the chrominance BV = (BVChor, BVCver), find the corresponding offset position (xCbC+BVChor, yCbC+BVCver), that is, get the reconstructed chrominance sample recBvChroma at the BV corresponding to the current block.
[0848] S232: Create a mapping table LUT from brightness to chromaticity at BV.
[0849] A luminance-to-chrominance mapping table LUT is established for the reconstructed luminance samples recBvAftDownLuma and the reconstructed chrominance samples recBvChroma at the corresponding BV obtained in S231, including but not limited to the following methods:
[0850] Luminance is the key and chroma is the value.
[0851] For videos with a bit depth greater than 8 bits, the sample range is [0,1023]. For the key value recBvAftDownLuma, it can be mapped to ranges such as [0,255] and [0,511].
[0852] For each key-value pair in the LUT table, a discrete model can be established using methods including but not limited to the following:
[0853] LUT[recBvAftDownLuma[i][j]]=recBvChroma[i][j](25)
[0854] Among them, for different chroma values with the same key value, the entries with the same key value can be overwritten in sequence according to the sample order, or an average operation can be taken.
[0855] S233: Predict the current block from luminance to chrominance according to the mapping table LUT.
[0856] Obtain the reconstructed luminance sample recBefDownLuma at the position lumaPos = (xCb, yCb) of the co-located luminance area corresponding to the current block, perform the same downsampling method on this luminance sample as in S231 to obtain a downsampled reconstructed luminance sample recAftDownLuma, and perform the same sample range mapping process on this sample as in S232. It should be noted that the downsampling described in this embodiment of the application is performed for YUV420.
[0857] Assuming that the predicted value of the current block is predSamples, then for predSamples[cIdx][x][y], the variable cIdx specifies the color component index of the current block, and the following prediction method is used:
[0858] The predicted value is derived by referring to the brightness value Yc at the same position using the discrete model established in S232.
[0859] If Yc is not found in the input luminance set in the discrete model established in S232, the following processing is included but not limited to: checking in the order of {Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3}. If the model cannot match all of the above values, the prediction is set to the average value of the reconstructed chroma sample recBvChroma at the corresponding BV.
[0860] In the second method, the predicted value of the first method is modified to obtain the final predicted value, including but not limited to weighting with the CCLM-type model or other models.
[0861] In method three, multiple BVs are determined in step S5, and the BV-based prediction of method one is performed to obtain multiple prediction values, and then these multiple prediction values are weighted to obtain weighted prediction values. The prediction values can also be further modified, including but not limited to weighting with CCLM-type models or other models.
[0862] S7: Other situations.
[0863] If it is PLANAR mode or CCLM-type mode or other angle mode, obtain reference pixels and mode parameters for chrominance prediction.
[0864] In another embodiment, the DM mode is modified (ie, solution 2). Under dual-tree partitioning, in the DM mode, if the corresponding luminance area has BV information, the current chrominance block is predicted using the BVG-LUT mode. For example:
[0865] If CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to MODE_IBC, set intra_bvgplt_flag=1, then the chroma intra prediction mode IntraPredModeC[xCb][yCb] uses the BVG-LUT mode.
[0866] If CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to MODE_INTRA, if IntraTmpFlag[xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to 1, set intra_bvgplt_flag=1, then the chroma intra prediction mode IntraPredModeC[xCb][yCb] uses the BVG-LUT mode.
[0867] Here, the derivation of the chroma prediction mode is detailed in Table 10. In DM mode, if intra_bvgplt_flag == 1, that is, the information obtained from the center block of the same luminance area contains BV, the chroma intra prediction mode IntraPredModeC[xCb][yCb] uses the BVG-LUT mode.
[0868] In addition, the prediction process of the BVG-LUT mode in Solution 1 is used, with the same steps as S1, S2, S3, S4, S5, and S6 in Solution 1. Step S1 obtains the center block of the co-located luma region. Step S2 directly obtains the BV of the corresponding luma block. If the chroma BV in step S7 is unavailable, the corresponding luma prediction mode is obtained.
[0869] Based on the encoding and decoding method described in the above embodiment, the present application also provides a code stream organization method, which may include but is not limited to the following methods.
[0870] Method 1: Encoding within MODE_INTRA. This is just one example of the code stream parsing location, for illustrative purposes only.
[0871] Added before intra_chroma_pred_mode. The specific syntax elements are described in Table 11.
[0872] Table 11
[0873] If sps_ibc_enabled_flag is equal to 0 and sps_intratmp_enabled_flag is equal to 0, then BvgpltEnabled is equal to 0. Otherwise, set the variable ModeIncludeBv. If the corresponding luminance block is not encoded in a mode with BV information, then ModeIncludeBv is equal to 0; otherwise, ModeIncludeBv is equal to 1. It should be noted that the syntax element signal sps_intratmp_enabled_flag indicates whether the intraTmp technology is included in the coding tool of the reference platform. If yes, the syntax element is transmitted; if not, the syntax element is not transmitted. Among them, there can be an SPS independent control BVG-PLT mode flag, and this code stream table is an example; there can also be no SPS control, and the decision on whether to apply the technology continues to depend on the block-level constraints.
[0874] BvgpltEnabled equals 1 if multiple of the following conditions are true simultaneously (including but not limited to the following):
[0875] ModeIncludeBv is equal to 1;
[0876] sh_slice_type is equal to I frame;
[0877] CtbLog2SizeC is less than or equal to MaxChromaIbcSize.
[0878] MaxChromaIbcSize can be determined based on the chroma CTU size or a preset value.
[0879] Otherwise, BvgpltEnabled is equal to 0.
[0880] If BvgpltEnabled is equal to 0, bvgplt_flag is inferred to be 0
[0881] bvgplt_flag is 1, indicating that the current chroma predict...
Claims
1. A decoding method, applied to a decoder, the method comprising: Determine the first block vector parameters of the current block; Determine a first color component reference sample and a second color component reference sample corresponding to the current block based on the first block vector parameter, and establish a mapping relationship between the first color component and the second color component according to the first color component reference sample and the second color component reference sample; A predicted value of a second color component of the current block is determined according to the mapping relationship and the sample value of the first color component of the current block.
2. The method according to claim 1, wherein: The determining of the first block vector parameter of the current block includes: Determining a first color component block of the current block; When the prediction mode of the first color component block satisfies a first condition, determining a second block vector parameter of the first color component block; A first block vector parameter of the current block is determined according to the second block vector parameter of the first color component block.
3. The method according to claim 2, wherein: The determining of the first color component block of the current block comprises: Determine a first color component region at a same position as the current block; A first color component block of the current block is determined from a plurality of blocks divided into the first color component area.
4. The method according to claim 3, wherein: The step of determining the first color component block of the current block from the plurality of blocks divided from the first color component area comprises: Determine at least one candidate block at a preset position from a plurality of blocks divided by the first color component area; A first color component block of the current block is determined according to the at least one candidate block.
5. The method according to claim 2, wherein: The method further comprises: When the first color component block is predicted based on the block vector, determining whether the current block uses a target prediction mode; If the current block uses the target prediction mode, it is determined that the prediction mode of the first color component block satisfies a first condition.
6. The method according to claim 2, wherein: The determining, according to the second block vector parameter of the first color component block, the first block vector parameter of the current block comprises: constructing a block vector parameter candidate list of a second color component of the current block according to the second block vector parameter; Based on the block vector parameter candidate list, a first block vector parameter of the current block is determined.
7. The method according to claim 6, wherein: The step of constructing a candidate list of block vector parameters of a second color component of the current block according to the second block vector parameter comprises: adjusting the second block vector parameter to determine a candidate block vector parameter of a second color component of the current block; The candidate block vector parameter is added to the block vector parameter candidate list.
8. The method according to claim 7, wherein: The adjusting the second block vector parameter to determine the candidate block vector parameter of the second color component of the current block includes: Determining a preset sampling format of the current block; The second block vector parameter is scaled according to the preset sampling format to determine a candidate block vector parameter of the second color component of the current block.
9. The method according to claim 7, wherein: The adjusting the second block vector parameter to determine the candidate block vector parameter of the second color component of the current block includes: Determining a preset sampling format of the current block; Scaling the second block vector parameter according to the preset sampling format to determine a first initial block vector parameter of a second color component of the current block; An offset calculation is performed on the first initial block vector parameter according to one or more offset values to determine a candidate block vector parameter of a second color component of the current block.
10. The method according to claim 7, wherein: The adjusting the second block vector parameter to determine the candidate block vector parameter of the second color component of the current block includes: Performing an offset calculation on the second block vector parameter according to one or more offset values to determine one or more second initial block vector parameters; A preset sampling format of the current block is determined, and the one or more second initial block vector parameters are scaled according to the preset sampling format to determine candidate block vector parameters of a second color component of the current block.
11. The method according to claim 6, wherein: The determining, based on the block vector parameter candidate list, a first block vector parameter of the current block comprises: determining whether the block vector parameter candidate list contains one or more candidate block vector parameters that meet a first availability condition; If the block vector parameter candidate list contains one or more candidate block vector parameters that meet the first availability condition, then according to the one or multiple candidate block vector parameters determine the first block vector parameter of the current block.
12. The method according to claim 11, wherein: The method further comprises: If all candidate block vectors in the block vector parameter candidate list do not meet the first availability condition, at least one candidate block vector parameter in the block vector parameter candidate list is adjusted until the at least one candidate block vector parameter meets the first availability condition.
13. The method according to claim 11, wherein: The one or more candidate block vector parameters satisfy a first availability condition, which at least includes: The offset position indicated by the one or more candidate block vector parameters does not exceed the image boundary; The offset position indicated by the one or more candidate block vector parameters does not exceed the slice boundary; The offset position indicated by the one or more candidate block vector parameters does not cover the current block; The offset position indicated by the one or more candidate block vector parameters does not exceed a preset available area; The offset position indicated by the one or more candidate block vector parameters has been reconstructed.
14. The method according to claim 11, wherein: The determining the first block vector parameter of the current block according to the one or more candidate block vector parameters comprises: If there is a candidate block vector parameter satisfying a first availability condition in the block vector parameter candidate list, determining the candidate block vector parameter satisfying the first availability condition as the first block vector parameter; If the block vector parameter candidate list contains multiple candidate block vector parameters that meet the first availability condition, a decision is made on the multiple candidate block vector parameters that meet the first availability condition to determine the first block vector parameter.
15. The method according to claim 14, wherein: The making a decision on the plurality of candidate block vector parameters satisfying the first availability condition to determine the first block vector parameter includes: Determining a first template of the current block; Determining first matching templates for the plurality of candidate block vector parameters respectively according to the first template and the plurality of candidate block vector parameters; When the first template and the first matching template satisfy a second condition, calculating a matching error between the first template of the current block and the first matching template according to a preset error criterion, so as to determine first generation values of the respective parameters of the plurality of candidate block vectors; A minimum cost value is determined from the first cost values of the plurality of candidate block vector parameters, and the candidate block vector parameter corresponding to the minimum cost value is determined as the first block vector parameter.
16. The method according to claim 15, wherein: The type of the first template includes at least one of the following: an upper template, an upper right template, a left template, a lower left template, and an upper left template; Among them, the upper template is located in the upper decoded area adjacent to the current block, the upper right template is located in the upper right decoded area adjacent to the current block, the left template is located in the left decoded area adjacent to the current block, the lower left template is located in the lower left decoded area adjacent to the current block, and the upper left template is located in the upper left decoded area adjacent to the current block.
17. The method according to claim 15, wherein: The method further comprises: When the first template and the first matching template do not satisfy the second condition, determining the first candidate block vector parameter in the block vector parameter candidate list that satisfies the first available condition as the first block vector parameter; or, When the first template and the first matching template do not satisfy the second condition, a candidate block vector parameter at a preset position in the block vector parameter candidate list that satisfies the first availability condition is determined as the first block vector parameter.
18. The method according to any one of claims 1 to 17, wherein: The determining, based on the first block vector parameter, a first color component reference sample and a second color component reference sample corresponding to the current block comprises: Determining the position of the current block; Scaling the position of the current block to determine the position of the first color component region at the same position of the current block; and scaling the first block vector parameter to determine the third block vector parameter of the first color component region at the same position of the current block; Determine a reference block of the first color component according to the position of the first color component area and the third block vector parameter, and determine a first color component reference sample corresponding to the current block according to the reference block of the first color component; A reference block of a second color component is determined according to the position of the current block and the first block vector parameter, and a second color component reference sample corresponding to the current block is determined according to the reference block of the second color component.
19. The method according to claim 18, wherein: The determining, according to the reference block of the first color component, a reference sample of the first color component corresponding to the current block comprises: Down-sampling is performed on the reference block of the first color component to determine a first color component reference sample corresponding to the current block, so that a resolution of the first color component reference sample is the same as a resolution of the second color component reference sample.
20. The method according to claim 18, wherein: The determining, according to the reference block of the second color component, a reference sample of the second color component corresponding to the current block comprises: Performing up-sampling processing on the reference block of the second color component to determine a reference sample of the second color component corresponding to the current block, so that a resolution of the reference sample of the first color component is the same as a resolution of the reference sample of the second color component; Correspondingly, the method further includes: performing down-sampling processing on the predicted value of the second color component of the current block.
21. The method according to claim 18, wherein: The method further comprises: Determining a first template of the current block; According to the first template, a first color component reference sample and a second color component reference sample corresponding to the current block are determined.
22. The method according to claim 18 or 21, wherein: The method further comprises: Determining a first template of the current block; Determine a second matching template for the current block according to the first block vector parameter and the first template; Determine, according to the second matching template, a first color component reference sample and a second color component reference sample corresponding to the current block.
23. The method according to claim 1, wherein: The establishing a mapping relationship between the first color component and the second color component according to the first color component reference sample and the second color component reference sample includes: A first lookup table is determined according to the first color component reference sample and the second color component reference sample, wherein the first lookup table is used to record the value of the second color component corresponding to the first color component when the index keyword is the first color component.
24. The method according to claim 1, wherein: The establishing a mapping relationship between the first color component and the second color component according to the first color component reference sample and the second color component reference sample includes: A first discrete model is determined according to the first color component reference sample and the second color component reference sample, wherein the first discrete model is used to indicate a mapping relationship between the first color component and the second color component.
25. The method according to claim 23 or 24, wherein: The method further comprises: Mapping processing is performed on the first color component reference sample so that the first color component reference sample is within a preset sample range.
26. The method according to claim 23 or 24, wherein: The method further comprises: When the first reference sample values in the first color component reference samples are the same and correspond to multiple different second reference sample values in the second color component reference samples, overwriting processing is performed in sequence according to the sample order, and the last second reference sample value is used as the value having a mapping relationship with the first reference sample value.
27. The method according to claim 23 or 24, wherein: The method further comprises: When the first reference sample values in the first color component reference samples are the same and correspond to multiple different second reference sample values in the second color component reference samples, an average value is calculated for the multiple second reference sample values, and the obtained average value is used as a value having a mapping relationship with the first reference sample value.
28. The method of claim 1, wherein: The method further comprises: Determine reconstructed pixel samples of a co-located first color component area of the current block; Based on the reconstructed pixel samples of the first color component area, a first color component sample value of the current block is determined.
29. The method of claim 1, wherein: The determining, according to the mapping relationship and the first color component sample value of the current block, a predicted value of the second color component of the current block comprises: If a first color component value equal to the first color component sample value is found in the mapping relationship, the value of the second color component corresponding to the first color component value is determined as the predicted value of the second color component of the current block.
30. The method of claim 29, wherein: The method further comprises: If a first color component value equal to the first color component sample value is not found in the mapping relationship, the first color component sample value is corrected to determine the first color component correction value, and the mapping relationship is further searched for whether there is a first color component value equal to the first color component correction value.
31. The method according to claim 30, wherein: The correcting the first color component reconstruction value to determine the first color component correction value includes: An offset calculation is performed on the first color component sample value according to one or more preset offset values to determine the first color component correction value.
32. The method of claim 30, wherein: The method further comprises: If the first color component value equal to the first color component correction value is not found in the mapping relationship, an average value is calculated for the second color component reference samples, and the obtained average value is determined as the predicted value of the second color component of the current block.
33. The method of claim 1, wherein: The determining, according to the mapping relationship and the first color component sample value of the current block, a predicted value of the second color component of the current block comprises: Determine a first initial prediction value of a second color component of the current block according to the mapping relationship and a sample value of a first color component of the current block; A correction operation is performed on the first initial prediction value to determine a prediction value of the second color component of the current block.
34. The method of claim 33, wherein: The modifying operation on the first initial prediction value to determine the prediction value of the second color component of the current block includes: Predicting the second color component of the current block according to the first preset mode, determining the second color component of the current block a second initial prediction value; wherein the first preset mode includes at least one of the following: a PLANAR mode, a DM mode, a DC mode, and a CCLM mode; A weighted calculation is performed on the first initial prediction value and the second initial prediction value to determine a prediction value of the second color component of the current block.
35. The method of claim 1, wherein: The method further comprises: When the number of the first block vector parameters is plural, determining a plurality of third initial prediction values of the second color component of the current block; A weighted calculation is performed on the multiple third initial prediction values to determine a prediction value of the second color component of the current block.
36. The method of claim 4, wherein: The method further comprises: When the first color component block of the current block includes a plurality of candidate blocks, determining a second block vector parameter of each of the plurality of candidate blocks; constructing a plurality of block vector parameter candidate lists of the second color component of the current block according to the second block vector parameters of the respective candidate blocks, and determining a plurality of first block vector parameters of the second color component of the current block according to the plurality of block vector parameter candidate lists; A mapping relationship between the first color component and the second color component is established based on the multiple first block vector parameters, and a predicted value of the second color component of the current block is determined according to the mapping relationship and the first color component sample value of the current block.
37. The method of claim 36, wherein: The method further comprises: Determine, based on the plurality of first block vector parameters, a plurality of groups of first color component reference samples and second color component reference samples corresponding to the current block; Establishing a plurality of candidate mapping relationships between the first color component and the second color component according to a plurality of groups of first color component reference samples and second color component reference samples corresponding to the current block; Decode the code stream and determine the mapping relationship index value; Determining a target mapping relationship according to the mapping relationship index value and the multiple candidate mapping relationships; A predicted value of a second color component of the current block is determined according to the target mapping relationship and the sample value of the first color component of the current block.
38. The method of claim 36, wherein: The method further comprises: Determine, based on the plurality of first block vector parameters, a plurality of groups of first color component reference samples and second color component reference samples corresponding to the current block; Establishing a plurality of candidate mapping relationships between the first color component and the second color component according to a plurality of groups of first color component reference samples and second color component reference samples corresponding to the current block; Calculating matching errors on the multiple candidate mapping relationships based on a template matching method to determine the second generation values of the multiple candidate mapping relationships; Determine a minimum cost value from the second cost values of the plurality of candidate mapping relationships, and determine the candidate mapping relationship corresponding to the minimum cost value as the target mapping relationship; A predicted value of a second color component of the current block is determined according to the target mapping relationship and the sample value of the first color component of the current block.
39. The method of claim 38, wherein: The performing matching error calculation on the plurality of candidate mapping relationships based on the template matching method to determine the second generation value of each of the plurality of candidate mapping relationships includes: Determining a first template of the current block; Determine a reconstructed pixel sample value of a first color component area template at the same position as the first template; Determine, according to the multiple candidate mapping relationships and the reconstructed pixel sample values of the first color component area template, the predicted values of the second color components of the first template under the multiple mapping relationships; Cost calculation is performed based on the reconstructed value of the second color component of the first template and the predicted values of the second color components of the first template under the multiple mapping relationships to determine the second generation values of the multiple candidate mapping relationships.
40. The method according to any one of claims 1 to 39, wherein: The method further comprises: Decoding the bitstream to determine a value of the first syntax element identification information; When the first syntax element identification information indicates that the second color component of the current block uses a target prediction mode, the step of determining a first block vector parameter of the current block is performed.
41. The method of claim 40, wherein: The method further comprises: Determine a first color component region at a same position as the current block; If the current block uses the DM mode and the first color component area is predicted based on a block vector, it is determined that the second color component of the current block uses a target prediction mode.
42. The method of claim 40, wherein: The method further comprises: Decoding the bitstream to determine a value of the second syntax element identification information; If the second syntax element identification information indicates that the second color component of the current block allows the use of the target prediction mode, decoding is performed bitstream, a step of determining a value of first syntax element identification information.
43. A coding method, applied to an encoder, the method comprising: Determine the first block vector parameters of the current block; Determine a first color component reference sample and a second color component reference sample corresponding to the current block based on the first block vector parameter, and establish a mapping relationship between the first color component and the second color component according to the first color component reference sample and the second color component reference sample; A predicted value of a second color component of the current block is determined according to the mapping relationship and the sample value of the first color component of the current block.
44. The method of claim 43, wherein: The determining of the first block vector parameter of the current block includes: Determining a first color component block of the current block; When the prediction mode of the first color component block satisfies a first condition, determining a second block vector parameter of the first color component block; A first block vector parameter of the current block is determined according to the second block vector parameter of the first color component block.
45. The method of claim 44, wherein: The determining of the first color component block of the current block comprises: Determine a first color component region at a same position as the current block; A first color component block of the current block is determined from a plurality of blocks divided into the first color component area.
46. The method of claim 45, wherein: The step of determining the first color component block of the current block from the plurality of blocks divided from the first color component area comprises: Determine at least one candidate block at a preset position from a plurality of blocks divided by the first color component area; A first color component block of the current block is determined according to the at least one candidate block.
47. The method of claim 44, wherein: The method further comprises: When the first color component block is predicted based on the block vector, determining whether the current block uses a target prediction mode; If the current block uses the target prediction mode, it is determined that the prediction mode of the first color component block satisfies a first condition.
48. The method of claim 44, wherein: The determining, according to the second block vector parameter of the first color component block, the first block vector parameter of the current block comprises: constructing a block vector parameter candidate list of a second color component of the current block according to the second block vector parameter; Based on the block vector parameter candidate list, a first block vector parameter of the current block is determined.
49. The method of claim 48, wherein: The step of constructing a candidate list of block vector parameters of a second color component of the current block according to the second block vector parameter comprises: adjusting the second block vector parameter to determine a candidate block vector parameter of a second color component of the current block; The candidate block vector parameter is added to the block vector parameter candidate list.
50. The method of claim 49, wherein: The adjusting the second block vector parameter to determine the candidate block vector parameter of the second color component of the current block includes: Determining a preset sampling format of the current block; The second block vector parameter is scaled according to the preset sampling format to determine a candidate block vector parameter of the second color component of the current block.
51. The method of claim 49, wherein: The adjusting the second block vector parameter to determine the candidate block vector parameter of the second color component of the current block includes: Determining a preset sampling format of the current block; Scaling the second block vector parameter according to the preset sampling format to determine a first initial block vector parameter of a second color component of the current block; An offset calculation is performed on the first initial block vector parameter according to one or more offset values to determine a candidate block vector parameter of a second color component of the current block.
52. The method of claim 49, wherein: The adjusting the second block vector parameter to determine the candidate block vector parameter of the second color component of the current block includes: Performing an offset calculation on the second block vector parameter according to one or more offset values to determine one or more second initial block vector parameters; A preset sampling format of the current block is determined, and the one or more second initial block vector parameters are scaled according to the preset sampling format to determine candidate block vector parameters of a second color component of the current block.
53. The method of claim 48, wherein: The determining, based on the block vector parameter candidate list, a first block vector parameter of the current block comprises: determining whether the block vector parameter candidate list contains one or more candidate block vector parameters that meet a first availability condition; If the block vector parameter candidate list contains one or more candidate block vector parameters that meet the first availability condition, a first block vector parameter of the current block is determined according to the one or more candidate block vector parameters.
54. The method of claim 53, wherein: The method further comprises: If all candidate block vectors in the block vector parameter candidate list do not meet the first availability condition, at least one candidate block vector parameter in the block vector parameter candidate list is adjusted until the at least one candidate block vector parameter meets the first availability condition.
55. The method of claim 53, wherein: The one or more candidate block vector parameters satisfy a first availability condition, which at least includes: The offset position indicated by the one or more candidate block vector parameters does not exceed the image boundary; The offset position indicated by the one or more candidate block vector parameters does not exceed the slice boundary; The offset position indicated by the one or more candidate block vector parameters does not cover the current block; The offset position indicated by the one or more candidate block vector parameters does not exceed a preset available area; The offset position indicated by the one or more candidate block vector parameters has been reconstructed.
56. The method of claim 53, wherein: The determining the first block vector parameter of the current block according to the one or more candidate block vector parameters comprises: If there is a candidate block vector parameter satisfying a first availability condition in the block vector parameter candidate list, determining the candidate block vector parameter satisfying the first availability condition as the first block vector parameter; If the block vector parameter candidate list contains multiple candidate block vector parameters that meet the first availability condition, a decision is made on the multiple candidate block vector parameters that meet the first availability condition to determine the first block vector parameter.
57. The method of claim 56, wherein: The making a decision on the plurality of candidate block vector parameters satisfying the first availability condition to determine the first block vector parameter includes: Determining a first template of the current block; Determining first matching templates for the plurality of candidate block vector parameters respectively according to the first template and the plurality of candidate block vector parameters; When the first template and the first matching template satisfy a second condition, calculating a matching error between the first template of the current block and the first matching template according to a preset error criterion, so as to determine first generation values of the respective parameters of the plurality of candidate block vectors; A minimum cost value is determined from the first cost values of the plurality of candidate block vector parameters, and the candidate block vector parameter corresponding to the minimum cost value is determined as the first block vector parameter.
58. The method of claim 57, wherein: The type of the first template includes at least one of the following: an upper template, an upper right template, a left template, a lower left template, and an upper left template; Among them, the upper template is located in the upper encoded area adjacent to the current block, the upper right template is located in the upper right encoded area adjacent to the current block, the left template is located in the left encoded area adjacent to the current block, the lower left template is located in the lower left encoded area adjacent to the current block, and the upper left template is located in the upper left encoded area adjacent to the current block.
59. The method of claim 57, wherein: The method further comprises: When the first template and the first matching template do not satisfy the second condition, determining the first candidate block vector parameter in the block vector parameter candidate list that satisfies the first available condition as the first block vector parameter; or, When the first template and the first matching template do not satisfy the second condition, a candidate block vector parameter at a preset position in the block vector parameter candidate list that satisfies the first availability condition is determined as the first block vector parameter.
60. The method according to any one of claims 43 to 59, wherein: The determining, based on the first block vector parameter, a first color component reference sample and a second color component reference sample corresponding to the current block comprises: Determining the position of the current block; Scaling the position of the current block to determine the position of the first color component region at the same position of the current block; and scaling the first block vector parameter to determine the third block vector parameter of the first color component region at the same position of the current block; Determine a reference block of the first color component according to the position of the first color component area and the third block vector parameter, and determine a first color component reference sample corresponding to the current block according to the reference block of the first color component; A reference block of a second color component is determined according to the position of the current block and the first block vector parameter, and a second color component reference sample corresponding to the current block is determined according to the reference block of the second color component.
61. The method of claim 60, wherein: The determining, according to the reference block of the first color component, a reference sample of the first color component corresponding to the current block comprises: Down-sampling is performed on the reference block of the first color component to determine a first color component reference sample corresponding to the current block, so that a resolution of the first color component reference sample is the same as a resolution of the second color component reference sample.
62. The method of claim 60, wherein: The determining, according to the reference block of the second color component, a reference sample of the second color component corresponding to the current block comprises: Performing up-sampling processing on the reference block of the second color component to determine a reference sample of the second color component corresponding to the current block, so that a resolution of the reference sample of the first color component is the same as a resolution of the reference sample of the second color component; Correspondingly, the method further includes: performing down-sampling processing on the predicted value of the second color component of the current block.
63. The method of claim 60, wherein: The method further comprises: Determining a first template of the current block; According to the first template, a first color component reference sample and a second color component reference sample corresponding to the current block are determined.
64. The method of claim 60, wherein: The method further comprises: Determining a first template of the current block; Determine a second matching template for the current block according to the first block vector parameter and the first template; Determine, according to the second matching template, a first color component reference sample and a second color component reference sample corresponding to the current block.
65. The method of claim 43, wherein: The establishing a mapping relationship between the first color component and the second color component according to the first color component reference sample and the second color component reference sample includes: A first lookup table is determined according to the first color component reference sample and the second color component reference sample, wherein the first lookup table is used to record the value of the second color component corresponding to the first color component when the index keyword is the first color component.
66. The method of claim 43, wherein: The establishing a mapping relationship between the first color component and the second color component according to the first color component reference sample and the second color component reference sample includes: A first discrete model is determined according to the first color component reference sample and the second color component reference sample, wherein the first discrete model is used to indicate a mapping relationship between the first color component and the second color component.
67. The method of claim 65 or 66, wherein: The method further comprises: Mapping processing is performed on the first color component reference sample so that the first color component reference sample is within a preset sample range.
68. The method of claim 65 or 66, wherein: The method further comprises: When the first reference sample values in the first color component reference samples are the same and correspond to multiple different second reference sample values in the second color component reference samples, overwriting processing is performed in sequence according to the sample order, and the last second reference sample value is used as the value having a mapping relationship with the first reference sample value.
69. The method of claim 65 or 66, wherein: The method further comprises: When the first reference sample values in the first color component reference samples are the same and correspond to multiple different second reference sample values in the second color component reference samples, an average value is calculated for the multiple second reference sample values, and the obtained average value is used as a value having a mapping relationship with the first reference sample value.
70. The method of claim 43, wherein: The method further comprises: Determine reconstructed pixel samples of a co-located first color component area of the current block; Based on the reconstructed pixel samples of the first color component area, a first color component sample value of the current block is determined.
71. The method of claim 43, wherein: The determining, according to the mapping relationship and the first color component sample value of the current block, a predicted value of the second color component of the current block comprises: If a first color component value equal to the first color component sample value is found in the mapping relationship, the value of the second color component corresponding to the first color component value is determined as the predicted value of the second color component of the current block.
72. The method of claim 71, wherein: The method further comprises: If a first color component value equal to the first color component sample value is not found in the mapping relationship, the first color component sample value is corrected to determine the first color component correction value, and the mapping relationship is further searched for whether there is a first color component value equal to the first color component correction value.
73. The method of claim 72, wherein: The correcting the first color component reconstruction value to determine the first color component correction value includes: An offset calculation is performed on the first color component sample value according to one or more preset offset values to determine the first color component correction value.
74. The method of claim 72, wherein: The method further comprises: If the first color component value equal to the first color component correction value is not found in the mapping relationship, an average value is calculated for the second color component reference samples, and the obtained average value is determined as the predicted value of the second color component of the current block.
75. The method of claim 43, wherein: The determining, according to the mapping relationship and the first color component sample value of the current block, a predicted value of the second color component of the current block comprises: Determine a first initial prediction value of a second color component of the current block according to the mapping relationship and a sample value of a first color component of the current block; A correction operation is performed on the first initial prediction value to determine a prediction value of the second color component of the current block.
76. The method of claim 75, wherein: The modifying operation on the first initial prediction value to determine the prediction value of the second color component of the current block includes: Predicting the second color component of the current block according to a first preset mode to determine a second initial prediction value of the second color component of the current block; wherein the first preset mode includes at least one of the following: PLANAR mode, DM mode, DC mode and CCLM mode; A weighted calculation is performed on the first initial prediction value and the second initial prediction value to determine a prediction value of the second color component of the current block.
77. The method of claim 43, wherein: The method further comprises: When the number of the first block vector parameters is plural, determining a plurality of third initial prediction values of the second color component of the current block; A weighted calculation is performed on the multiple third initial prediction values to determine a prediction value of the second color component of the current block.
78. The method of claim 46, wherein: The method further comprises: When the first color component block of the current block includes a plurality of candidate blocks, determining a second block vector parameter of each of the plurality of candidate blocks; constructing a plurality of block vector parameter candidate lists of the second color component of the current block according to the second block vector parameters of the respective candidate blocks, and determining a plurality of first block vector parameters of the second color component of the current block according to the plurality of block vector parameter candidate lists; A mapping relationship between the first color component and the second color component is established based on the multiple first block vector parameters, and a predicted value of the second color component of the current block is determined according to the mapping relationship and the first color component sample value of the current block.
79. The method of claim 78, wherein: The method further comprises: Determine, based on the plurality of first block vector parameters, a plurality of groups of first color component reference samples and second color component reference samples corresponding to the current block; Establishing a plurality of candidate mapping relationships between the first color component and the second color component according to a plurality of groups of first color component reference samples and second color component reference samples corresponding to the current block; Determining a target mapping relationship from the multiple candidate mapping relationships; A predicted value of a second color component of the current block is determined according to the target mapping relationship and the sample value of the first color component of the current block.
80. The method of claim 79, wherein: The step of determining a target mapping relationship from the plurality of candidate mapping relationships comprises: Based on the rate-distortion cost method, respectively calculate the costs of the multiple candidate mapping relationships to determine multiple rate-distortion cost results; A minimum rate-distortion cost result is determined from the multiple rate-distortion cost results, and a candidate mapping relationship corresponding to the minimum rate-distortion cost result is determined as the target mapping relationship.
81. The method of claim 80, wherein: The method further comprises: Determine a mapping relationship index value, wherein the mapping relationship index value is used to indicate a candidate mapping relationship corresponding to a minimum rate-distortion cost result among the multiple rate-distortion cost results; The mapping relationship index value is encoded, and the obtained encoding bits are written into a bit stream.
82. The method of claim 78, wherein: The method further comprises: Determine, based on the plurality of first block vector parameters, a plurality of groups of first color component reference samples and second color component reference samples corresponding to the current block; Establishing a plurality of candidate mapping relationships between the first color component and the second color component according to a plurality of groups of first color component reference samples and second color component reference samples corresponding to the current block; Calculating matching errors on the multiple candidate mapping relationships based on a template matching method to determine the second generation values of the multiple candidate mapping relationships; Determine a minimum cost value from the second cost values of the plurality of candidate mapping relationships, and determine the candidate mapping relationship corresponding to the minimum cost value as the target mapping relationship; A predicted value of a second color component of the current block is determined according to the target mapping relationship and the sample value of the first color component of the current block.
83. The method of claim 82, wherein: The performing matching error calculation on the plurality of candidate mapping relationships based on the template matching method to determine the second generation value of each of the plurality of candidate mapping relationships includes: Determining a first template of the current block; Determine a reconstructed pixel sample value of a first color component area template at the same position as the first template; Determine, according to the multiple candidate mapping relationships and the reconstructed pixel sample values of the first color component area template, the predicted values of the second color components of the first template under the multiple mapping relationships; Cost calculation is performed based on the reconstructed value of the second color component of the first template and the predicted values of the second color components of the first template under the multiple mapping relationships to determine the second generation values of the multiple candidate mapping relationships.
84. The method of any one of claims 43 to 83, wherein: The method further comprises: Determining a prediction mode for the current block; When the prediction mode indicates that the second color component of the current block uses a target prediction mode, the step of determining a first block vector parameter of the current block is performed.
85. The method of claim 84, wherein: The determining the prediction mode of the current block comprises: Determining a plurality of candidate modes, wherein the plurality of candidate modes at least includes a target prediction mode; Based on a preset cost method, cost calculation is performed on the plurality of candidate modes respectively to determine a plurality of third-generation values; Determine a minimum cost value from the multiple third cost values, and determine the candidate mode corresponding to the minimum cost value as the prediction mode of the current block; The preset cost method includes at least one of the following: a rate-distortion cost method and a template matching method.
86. The method of claim 84, wherein: The method further comprises: Determine a first color component region at a same position as the current block; If the current block uses the DM mode and the first color component area is predicted based on a block vector, it is determined that the second color component of the current block uses a target prediction mode.
87. The method of claim 84, wherein: The method further comprises: Determine a value of first syntax element identification information; wherein the first syntax element identification information is used to indicate whether the second color component of the current block uses a target prediction mode; The value of the first syntax element identification information is encoded, and the obtained encoded bits are written into a bitstream.
88. The method of claim 87, wherein: The method further comprises: Determine a value of second syntax element identification information; wherein the second syntax element identification information is used to indicate whether the second color component of the current block is allowed to use the target prediction mode; The value of the second syntax element identification information is encoded, and the obtained encoded bits are written into a bitstream.
89. A code stream, wherein The code stream is generated by bit encoding according to the information to be encoded; wherein the information to be encoded includes at least one of the following: The value of the first syntax element identification information, the value of the second syntax element identification information and the mapping relationship index value; wherein the first syntax element identification information is used to indicate whether the second color component of the current block uses the target prediction mode, and the second syntax element identification information is used to indicate whether the second color component of the current block is allowed to use the target prediction mode.
90. An encoder, comprising a first determining unit, a first establishing unit and a first predicting unit, wherein: The first determining unit is configured to determine a first block vector parameter of the current block; The first establishing unit is configured to determine a first color component reference sample and a second color component reference sample corresponding to the current block based on the first block vector parameter, and establish a mapping relationship between the first color component and the second color component according to the first color component reference sample and the second color component reference sample; The first prediction unit is configured to determine a predicted value of a second color component of the current block according to the mapping relationship and a sample value of the first color component of the current block.
91. 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 43 to 88 when running the computer program.
92. A decoder comprising a second determining unit, a second establishing unit and a second predicting unit, wherein: The second determining unit is configured to determine a first block vector parameter of the current block; The second establishing unit is configured to determine a first color component reference sample and a second color component reference sample corresponding to the current block based on the first block vector parameter, and establish a mapping relationship between the first color component and the second color component according to the first color component reference sample and the second color component reference sample; The second prediction unit is configured to determine a predicted value of a second color component of the current block according to the mapping relationship and a sample value of the first color component of the current block.
93. 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 42 when running the computer program.
94. A computer-readable storage medium, wherein: The computer-readable storage medium stores a computer program, and when the computer program is executed, it implements the method according to any one of claims 1 to 42, or implements the method according to any one of claims 43 to 88.