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

By establishing a mapping relationship between luminance and chrominance components in H.266/VVC and utilizing the correlation of reconstructed samples in the image, the problem of a single chrominance prediction mode is solved, the accuracy of chrominance prediction is improved, the bit rate is saved, and the encoding and decoding efficiency is increased.

WO2025138232A9PCT designated stage Publication Date: 2026-07-23GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2023-12-29
Publication Date
2026-07-23

Smart Images

  • Figure CN2023143587_23072026_PF_FP_ABST
    Figure CN2023143587_23072026_PF_FP_ABST
Patent Text Reader

Abstract

The present application discloses an encoding method, a decoding method, a code stream, an encoder, a decoder, and a storage medium. The method comprises: determining prediction parameters of a current block; on the basis of the prediction parameters, determining a first reference prediction parameter set of the current block, wherein the first reference prediction parameter set comprises one or more first candidate reference prediction parameters; on the basis of the first reference prediction parameter set, determining a first color component reference sample value and a second color component reference sample value of the current block; on the basis of the first color component reference sample value and the second color component reference sample value, determining a mapping relationship between a first color component and a second color component; and on the basis of the mapping relationship and a first color component sample value of the current block, determining a predicted value of the second color component of the current block. In this way, the uniformity of chroma prediction can be improved, the accuracy of chroma prediction can also be improved, the code rate can be saved, and the encoding and decoding efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

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

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

[0002] As people's demands for video display quality increase, new video application forms such as high-definition and ultra-high-definition video have emerged. The Joint Video Exploration Team (JVET) of the international standards organizations ISO / IEC and ITU-T has developed the video coding standard H.266 / Versatile Video Coding (VVC). Among them, Intra-block copy (IBC) is a block-level coding mode provided by VVC for video sequences of screen content types.

[0003] In related technologies, for Direct Mode (DM), if the luma block uses IBC mode, then the obtained chroma mode is DC mode. At this time, the intra-frame prediction mode of the chroma mode cannot be properly determined, resulting in inaccurate chroma prediction of the current block and loss of coding efficiency.

[0004] Summary of the Invention

[0005] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium, which can not only improve the uniformity of chroma prediction, but also improve the accuracy of chroma prediction, save bitrate, and thus improve encoding / decoding efficiency.

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

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

[0008] Determine the prediction parameters for the current block;

[0009] Based on the prediction parameters, a first reference prediction parameter set for the current block is determined; wherein, the first reference prediction parameter set contains one or more first candidate reference prediction parameters;

[0010] Based on the first reference prediction parameter set, determine the first color component reference sample value and the second color component reference sample value of the current block;

[0011] The mapping relationship between the first color component and the second color component is determined based on the reference sample value of the first color component and the reference sample value of the second color component.

[0012] Based on the mapping relationship and the sample value of the first color component of the current block, determine the predicted value of the second color component of the current block.

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

[0014] Determine the prediction parameters for the current block;

[0015] Based on the prediction parameters, a first reference prediction parameter set for the current block is determined; wherein, the first reference prediction parameter set contains one or more first candidate reference prediction parameters;

[0016] Based on the first reference prediction parameter set, determine the first color component reference sample value and the second color component reference sample value of the current block;

[0017] The mapping relationship between the first color component and the second color component is determined based on the reference sample value of the first color component and the reference sample value of the second color component.

[0018] Based on the mapping relationship and the sample value of the first color component of the current block, determine the predicted value of the second color component of the current block.

[0019] Thirdly, embodiments of this application provide a bitstream generated by bit encoding information to be encoded; wherein the information to be encoded includes at least one of the following:

[0020] The residual value of the second color component of the current block, the value of the filter identifier information, the value of the mapping relationship index, the value of the first syntax element, and the value of the second syntax element; wherein, the filter identifier information is used to indicate the downsampling method of the current block, the first syntax element is used to indicate whether the current block uses the first prediction mode, and the second syntax element is used to indicate whether the current block is allowed to use the first prediction mode.

[0021] Fourthly, embodiments of this application provide an encoder, including a first determining unit and a first predicting unit, wherein:

[0022] The first determining unit is configured to determine the prediction parameters of the current block; and to determine a first reference prediction parameter set of the current block based on the prediction parameters; wherein the first reference prediction parameter set includes one or more first candidate reference prediction parameters;

[0023] The first determining unit is further configured to determine a first color component reference sample value and a second color component reference sample value of the current block based on the first reference prediction parameter set; and to determine a mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value.

[0024] The first prediction unit is configured to determine the 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.

[0025] Fifthly, embodiments of this application provide an encoder, including a first memory and a first processor, wherein:

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

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

[0028] Sixthly, embodiments of this application provide a decoder, including a second determining unit and a second predicting unit, wherein:

[0029] The second determining unit is configured to determine the prediction parameters of the current block; and to determine a first reference prediction parameter set of the current block based on the prediction parameters; wherein the first reference prediction parameter set includes one or more first candidate reference prediction parameters;

[0030] The second determining unit is further configured to determine the first color component reference sample value and the second color component reference sample value of the current block according to the first reference prediction parameter set; and to determine the mapping relationship between the first color component and the second color component according to the first color component reference sample value and the second color component reference sample value.

[0031] The second prediction unit is configured to determine the 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.

[0032] In a seventh aspect, embodiments of this application provide a decoder, including a second memory and a second processor, wherein:

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

[0034] The second processor is configured to execute the method described in the first aspect when running a computer program.

[0035] Eighthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by at least one processor, implements the method described in the first aspect or the method described in the second aspect.

[0036] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. Whether at the encoding or decoding end, the method involves: determining prediction parameters for the current block; determining a first reference prediction parameter set for the current block based on the prediction parameters; wherein the first reference prediction parameter set includes one or more first candidate reference prediction parameters; determining a first color component reference sample and a second color component reference sample for the current block based on the first reference prediction parameter set; determining 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 determining the predicted value of the second color component for the current block based on the mapping relationship and the first color component sample of the current block. Thus, if the current block uses BVG-LUT mode, a first reference prediction parameter set for the applied chroma component can be determined, and based on the first reference prediction parameter set, the luminance component reference sample and chroma component reference sample of the current block can be determined, thereby establishing a mapping relationship between the luminance component and the chroma component, and then using this mapping relationship to predict the chroma component. In other words, this method fully utilizes the correlation between the reconstructed samples and the current block samples in the current image, improving the uniqueness of chromaticity prediction and thus enhancing the accuracy of chromaticity prediction. Moreover, based on the established mapping relationship, pixel-level prediction can be effectively performed, thereby further saving bitrate, improving encoding and decoding efficiency, and ultimately enhancing encoding and decoding performance. Attached Figure Description

[0037] Figure 1 is a schematic diagram of a process for obtaining reconstructed samples based on the IBC model;

[0038] Figure 2 is a schematic diagram of the positional distribution of adjacent blocks provided in an embodiment of this application;

[0039] Figure 3 is a schematic diagram of the positional relationship between a luminance block and a chrominance block provided in an embodiment of this application;

[0040] Figure 4A is a schematic block diagram of an encoder provided in an embodiment of this application;

[0041] Figure 4B is a schematic block diagram of a decoder provided in an embodiment of this application;

[0042] Figure 5 is a schematic diagram of the network architecture of an encoding / decoding system provided in an embodiment of this application;

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

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

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

[0046] Figure 9 is a schematic diagram of the positional relationship between a luminance block and a chrominance block according to an embodiment of this application;

[0047] Figure 10 is a schematic diagram of the positional relationship between a luminance block and a chrominance block according to an embodiment of this application;

[0048] Figure 11 is a schematic diagram of the positional relationship between a luminance block and a chrominance block according to an embodiment of this application;

[0049] Figure 12 is a schematic diagram of whether the offset position does not cover the current block according to an embodiment of this application;

[0050] Figure 13 is a structural schematic diagram of whether the offset position exceeds the preset available area according to an embodiment of this application;

[0051] Figure 14 is a schematic diagram of a template type provided in an embodiment of this application;

[0052] Figure 15 is a schematic diagram of motion compensation for a template provided in an embodiment of this application;

[0053] Figure 16 is a schematic diagram showing the positions of a co-position brightness region and a reference brightness region provided in an embodiment of this application;

[0054] Figure 17A is a schematic diagram of downsampling provided in an embodiment of this application;

[0055] Figure 17B is a schematic diagram of downsampling provided in an embodiment of this application;

[0056] Figure 17C is a schematic diagram of downsampling provided in an embodiment of this application;

[0057] Figure 17D is a schematic diagram of downsampling provided in an embodiment of this application;

[0058] Figure 17E is a schematic diagram of downsampling provided in an embodiment of this application;

[0059] Figure 17F is a schematic diagram of downsampling provided in an embodiment of this application;

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

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

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

[0063] Figure 21 is a schematic flowchart of an encoding method provided in an embodiment of this application;

[0064] Figure 22 is a detailed flowchart of an encoding method provided in an embodiment of this application;

[0065] Figure 23 is a schematic diagram of a colorimetric prediction process based on BV provided in an embodiment of this application;

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

[0067] Figure 25 is a schematic diagram of the specific hardware structure of an encoder provided in an embodiment of this application;

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

[0069] Figure 27 is a schematic diagram of the specific hardware structure of a decoder provided in an embodiment of this application;

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

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

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

[0073] In the following description, references to "some embodiments" refer to a subset of all possible embodiments. It is understood that "some embodiments" may be the same 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, third" used in the embodiments of this application are merely for distinguishing similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

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

[0075] Coding Block (CB);

[0076] Intra-block copy (IBC);

[0077] Screen Content Coding (SCC);

[0078] Block Matching (BM);

[0079] Coding Unit (CU);

[0080] Block Vector (BV);

[0081] Motion Vector (MV);

[0082] Direct Block Vector (DBV);

[0083] Block Vector Guided LUT (BVG-LUT);

[0084] Advanced Motion Vector Prediction (AMVP) (IBC)

[0085] Cross-Component Linear Model prediction (CCLM);

[0086] Merge Mode;

[0087] Planar Mode;

[0088] Sum of Absolute Difference (SAD);

[0089] Sum of Absolute Transformed Difference (SATD);

[0090] Mean Squared Error (MSE);

[0091] Root Mean Square Error (RMSE);

[0092] Mean Absolute Error (MAE);

[0093] Mean Absolute Deviation (MAD);

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

[0095] VVC Reference Software Testing Platform (VVC Test Model, VTM).

[0096] It is understandable that in video images, a first color component, a second color component, and a third color component are generally used to represent coded blocks. These three color components are a luminance component, a blue chrominance component, and a red chrominance component, respectively. Specifically, the luminance component is usually represented by the symbol Y, the blue chrominance component is usually represented by the symbol Cb or U, and the red chrominance component is usually represented by the symbol Cr or V. Thus, video images can be represented in YCbCr format or YUV format.

[0097] It can also be understood that IBC is an extension 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 coding mode. Similar to inter-frame techniques, the encoder performs motion search, specifically by finding the optimal block vector, also known as a motion vector, for the current coded block through block matching. The block vector is a vector pointing from the current block to a reference block. The difference between IBC and inter-frame techniques is that the optimal block vector in IBC is searched within the reconstructed region of the image containing the current block (i.e., the current coded image), while the motion vector in inter-frame techniques is searched for in other reference images outside the current coded image (e.g., a temporal reference image of the current coded image).

[0098] In H.266 / VVC, the specific process of obtaining the reconstruction value of the current block in IBC mode can include: deriving the block vector, deriving the prediction sample using the block vector, deriving the residual sample, and deriving the reconstruction sample using the prediction sample and the residual sample.

[0099] In one specific implementation, the process for obtaining reconstructed samples in IBC mode is shown in Figure 1. This process may include:

[0100] S101: Derive the block vector.

[0101] For the luminance component, the input includes: luminance position (xCb, yCb), specifying the luminance sample of the top-left corner of the current block relative to the top-left corner of the current image; a variable cbWidth, specifying the width of the current block in the luminance sample; and a variable cbHeight, specifying the height of the current block in the luminance sample. The output includes: luminance bvL (Block Vector for Luma samples). It should be noted that the current block containing the luminance sample can also be called a "luminance block".

[0102] Here, the IBC mode is divided into the IBC MERGE mode and the IBC AMVP mode. When deriving bvL, it is necessary to build an IBC block vector candidate list bvCandList. The following will describe in detail the process of building the IBC MERGE list. The process of building the IBC AMVP list is the same as that of the IBC MERGE list, but the maximum number of candidates for the two can be different.

[0103] Step 1: When IsGt4by4 equals TRUE (the variable IsGt4by4 is TRUE when the width multiplied by the height of the luma block is greater than 16), determine the availability of spatial blocks and block vector candidates of adjacent coding units based on the luma block position (xCb, yCb), the width cbWidth of the luma block, and the height cbHeight of the luma block. Set the availability flags availableFlagA1 and availableFlagB1 of the adjacent blocks and the block vectors bvA1 and bvB1 accordingly. The relative positions of the adjacent blocks containing A1 and B1 with the current block are shown in Figure 2.

[0104] Step 2: When IsGt4by4 equals TRUE, the pseudocode for constructing the candidate list of block vectors bvCandList is as follows:

[0105] Step 3: The derivation process of the variable numCurrCand (the number of candidates obtained so far) is as follows:

[0106] If IsGt4by4 equals TRUE, numCurrCand is set to equal the number of candidates in bvCandList; otherwise, numCurrCand is set to 0.

[0107] 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 best block vector Hmvp in IBC mode) is greater than 0, take bvCandList and numCurrCand as inputs and the modified bvCandList and numCurrCand as outputs, and call the derivation process of historical IBC block vector candidates as specified in the decoding specification.

[0108] Step 5: When numCurrCand is less than MaxNumIbcMergeCand, the following applies until numCurrCand equals MaxNumIbcMergeCand:

[0109] bvCandList[numCurrCand][0] is set to equal to 0 (the horizontal component of BV);

[0110] bvCandList[numCurrCand][1] is set to equal to 0 (the vertical component of BV);

[0111] Increase numCurrCand by 1.

[0112] Thus, the candidate list of block vectors, bvCandList, is established. The candidate index, bvIdx, is derived as follows, and general_merge_flag indicates whether it is in IBC MERGE mode:

[0113] bvIdx=general_merge_flag[xCb][yCb]? merge_idx[xCb][yCb]:mvp_l0_flag[xCb][yCb]

[0114] Thus, the specific bvL can be obtained based on the index bvIdx and the candidate list of block vectors bvCandList:

[0115] bvL[0]=bvCandList[bvIdx][0];

[0116] bvL[1]=bvCandList[bvIdx][1].

[0117] For the IBC AMVP mode, the specific bvL can be obtained by indexing bvIdx and the block vector candidate list bvCandList. The predicted bvL is then added to the actual bvL. The specific process is as follows:

[0118] Step 1: Obtain the horizontal and vertical components of BVD. MvdL0 represents the difference in the forward motion vector. The horizontal component of BVD is represented by bvd[0], and the vertical component of BVD is represented by bvd[1]. The details are as follows:

[0119] bvd[0]=MvdL0[xCb][yCb][0];

[0120] bvd[1]=MvdL0[xCb][yCb][1].

[0121] Step 2: Round the obtained predicted bvL. The right-shift parameter AmvrShift is used for rounding, while the left-shift parameter AmvrShift is used to improve resolution. Details are as follows:

[0122] Offset=(AmvrShift==0)? 0:((1<<(AmvrShift-1))-1);

[0123] bvL[0]=Sign(bvL[0])*(((Abs(bvL[0])+offset)>>AmvrShift)< <AmvrShift);

[0124] bvL[1]=Sign(bvL[1])*(((Abs(bvL[1])+offset)>>AmvrShift)< <AmvrShift)。

[0125] Step 3: For the actual BVL, its range needs to be controlled within -2. 17 to 2 17 The specific derivation process is as follows: -1 to the range of 1.

[0126] u[0]=(bvL[0]+bvd[0]+2 18 )%2 18 ;

[0127] bvL[0]=(u[0]>=2 17 )? (u[0]-2 18 ):u[0];

[0128] u[1]=(bvL[1]+bvd[1]+2 18 )%2 18 ;

[0129] bvL[1]=(u[1]>=2 17 )? (u[1]-2 18 ):u[1].

[0130] For chroma components, if it is a two-tree partition, IBC is not performed on the chroma components; if it is a single-tree partition, the BV of the chroma components needs to be derived.

[0131] The inputs include: luminance (bvL) with 1 / 16 pixel precision. The output includes: chrominance block vector (bvC) with 1 / 32 pixel precision. The specific derivation process is as follows:

[0132] bvC[0]=((bvL[0]>>(3+SubWidthC))*32);

[0133] bvC[1]=((bvL[1]>>(3+SubHeightC))*32).

[0134] S102: Derive the predicted sample using block vectors.

[0135] Here, the input includes: a luminance position (xCb, yCb), specifying the top-left luminance sample of the current block relative to the top-left luminance sample of the current image; a variable cbWidth, specifying the width of the current block in the luminance sample; a variable cbHeight, specifying the height of the current block in the luminance sample; a block vector BV; and a variable cIdx, specifying the color component index of the current block. The output includes: an array of predicted samples, predSamples.

[0136] For the predicted samples, the specific derivation process is as follows:

[0137] When cIdx equals 0, which represents the luminance component, for x = xCb…xCb+cbWidth-1 and y = yCb…yCb+cbHeight-1:

[0138] xVb=(x+(bv[0]>>4))&(IbcBufWidthY-1);

[0139] yVb=(y+(bv[1]>>4))&(CtbSizeY-1);

[0140] predSamples[x][y]=ibcVirBuf[0][xVb][yVb].

[0141] Where IbcBufWidthY is the width of the luminance pixels in the reconstruction buffer unit (Buffer) stored in IBC, CtbSizeY is the size of the CTU (Coding Tree Unit), and ibcVirBuf is the reconstructed pixel stored in IBC.

[0142] When cIdx is not equal to 0, i.e., it is a chromaticity component, for x = xCb / SubWidthC…xCb / SubWidthC+cbWidth / SubWidthC-1 and y = yCb / SubHeightC…yCb / SubHeightC+cbHeight / SubHeightC-1:

[0143] xVb=(x+(bv[0]>>(3+SubWidthC)))&(IbcBufWidthC-1);

[0144] yVb=(y+(bv[1]>>(3+SubHeightC)))&((CtbSizeY / subHeightC)-1);

[0145] predSamples[x][y]=ibcVirBuf[cIdx][xVb][yVb].

[0146] The variables SubWidthC and SubHeightC depend on the color sampling format specified by sps_chroma_format_idc, and the specific correspondence is shown in Table 1.

[0147] Table 1

[0148] S103: Derive the residual samples.

[0149] Decode the bitstream to determine the residual sample of the current block.

[0150] S104: Derive reconstructed samples using predicted samples and residual samples.

[0151] Based on the predicted samples and residual samples of the current block, the reconstructed samples of the current block are determined. For example, the sum of the predicted samples and residuals of the current block is calculated, and the reconstructed samples of the current block are set to be equal to this sum; wherein, the calculation process includes restricting the sum to a preset value range, the preset value range being determined according to the bit depth of the reconstructed samples.

[0152] In another specific implementation, the derivation process of the chroma prediction mode in H.266 / VVC includes the following inputs: luminance position (xCb, yCb), specifying the luminance sample of the top-left corner of the current block relative to the luminance sample of the top-left corner of the current image; a variable cbWidth, specifying the width of the current block in the luminance sample; a variable cbHeight, specifying the height of the current block in the luminance sample; and a variable treeType, specifying whether to use a single-tree partition or a dual-tree partition. The outputs include: IntraPredModeC[xCb][yCb] and MipChromaDirect Flag[xCb][yCb].

[0153] If treeType equals SINGLE_TREE (single-tree partitioning), sps_chroma_format_idc equals 3 (YUV444 format, 4:4:4 format), intra_chroma_pred_mode equals 4, and IntraMipFlag[xCb][yCb] equals 1 (MIP mode for the corresponding co-positional luminance center block), then:

[0154] ① The MIP chroma direct mode flag MipChromaDirectFlag[xCb][yCb] is set to 1, which means that the chroma uses the luminance MIP mode.

[0155] ② Set the IntraPredModeC[xCb][yCb] to be equal to IntraPredModeY[xCb][yCb].

[0156] otherwise:

[0157] ① Set the MIP chroma direct mode flag MipChromaDirectFlag[xCb][yCb] to 0.

[0158] ②The derivation of the corresponding lumaIntraPredMode is as follows:

[0159] If IntraMipFlag[xCb+cbWidth / 2][yCb+cbHeight / 2] equals 1, then lumaIntraPredMode is set to equal INTRA_PLANAR.

[0160] Otherwise, if CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to MODE_IBC or MODE_PLT, then set lumaIntraPredMode to be equal to INTRA_DC.

[0161] Note: In ECM, a new IntraTmp mode has been introduced. If CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] is equal to MODE_INTRA and is in IntraTmp mode, then lumaIntraPredMode is set to equal INTRA_PLANAR.

[0162] Otherwise, lumaIntraPredMode is set to equal IntraPredModeY[xCb+cbWidth / 2][yCb+cbHeight / 2].

[0163] ③ The derivation of the chroma intra-prediction mode IntraPredModeC[xCb][yCb] is as follows:

[0164] If cu_act_enabled_flag[xCb][yCb] equals 1, then the chroma intra-prediction mode IntraPredModeC[xCb][yCb] is set to equal lumaIntraPredMode.

[0165] otherwise:

[0166] If BdpcmFlag[xCb][yCb][1] equals 1, then IntraPredModeC[xCb][yCb] is set to equal BdpcmDir[xCb][yCb][1]? INTRA_ANGULAR50:INTRA_ANGULAR18.

[0167] Otherwise, cu_act_enabled_flag[xCb][yCb] equals 0 and BdpcmFlag[xCb][yCb][1] equals 0, and the chroma intra-prediction mode IntraPredModeC[xCb][yCb] uses cclm_mode_flag, cclm_mode_idx, intra_chroma_pred_mode, and lumaIntraPredMode specified in Table 2.

[0168] Table 2

[0169] When sps_chroma_format_idc equals 2, the chroma intra-prediction mode Y can be derived using the chroma intra-prediction mode X in Table 2. For details, refer to the mapping process specification from mode X to mode Y shown in Table 3. Then, set the chroma intra-prediction mode X to be equal to the chroma intra-prediction mode Y.

[0170] Table 3

[0171] In another specific implementation, for DM mode, DM mode refers to directly using the brightness prediction mode information of the corresponding location:

[0172] When an I-frame uses dual-tree partitioning, 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-coded block may contain multiple luma-coded 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.

[0173] The intra-prediction mode of the chroma block is determined based on the intra-prediction mode of the luma block at the center of the luma region corresponding to the chroma block. This determination can be achieved by directly using the intra-prediction mode of the luma block, or by further deriving the intra-prediction mode.

[0174] In practical implementation, the intra-prediction mode of the chroma block can be determined by using the center coordinates of the corresponding luminance region as a reference point and the intra-prediction mode of the luminance block containing that reference point. The determination method can be either directly using the intra-prediction mode of the luminance block or by further deriving the intra-prediction mode.

[0175] In addition, in the embodiments of this application, the block mentioned herein may be a CU, a sub-block, or a transformation block, etc., and there is no limitation thereto.

[0176] The specific location of the coded block in DM mode is described as follows:

[0177] Obtain the position of the current chroma block, that is, the position of the top left chroma sample of the current chroma block relative to the top left chroma sample of the current image, chromaPos=(x,y). Scale chromaPos according to the color sampling format shown in Table 4 to obtain the position of the corresponding brightness region of the current chroma block, lumaPos=(xCb,yCb).

[0178] Table 4

[0179] The luminance position (xCb, yCb) specifies the position of the top-left luminance sample of the luminance region corresponding to the current chroma block relative to the top-left luminance sample of the current image; a variable cbWidth specifies the width of the current block in the luminance sample; and a variable cbHeight specifies the height of the current block in the luminance sample.

[0180] The positional relationship between the current chroma block and its corresponding luminance region is shown in Figure 3. The position of the center luminance pixel of the luminance region 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 coded block containing this pixel position is the block at the center position of the luminance block corresponding to the chroma block:

[0181] xCenter = xCb + cbWidth >> 1;

[0182] yCenter=yCb+cbHeight>>1.

[0183] In another specific implementation, the decoding process for chroma prediction in H.266 / VVC, and the related syntax elements are shown in Table 5. Furthermore, the corresponding binary strings for the values ​​of the syntax element `intra_chroma_pred_mode` are shown in Table 6; and the encoding method for each encoded bit of different syntax elements (e.g., `cclm_mode_flag`, `cclm_mode_idx`, and `intra_chroma_pred_mode`) is shown in Table 7.

[0184] Table 5

[0185] Table 6

[0186] Table 7

[0187] Here, binIdx represents the number of bits; if binIdx = 0, it represents the 0th bit; if binIdx = 1, it represents the 1st bit. Additionally, bypass indicates bypass mode, and na indicates no processing.

[0188] In related technologies, under dual-tree partitioning: for DM mode, if the corresponding luma block is in IBC mode, then the obtained chroma prediction mode is DC mode, resulting in a loss of coding efficiency. That is, during chroma prediction, the correlation between the reconstructed samples in the current image and the samples in the current coding block is not utilized, leading to a loss of coding efficiency.

[0189] Based on this, embodiments of this application provide an encoding / decoding method that determines prediction parameters for the current block; determines a first reference prediction parameter set for the current block based on the prediction parameters; wherein the first reference prediction parameter set includes one or more first candidate reference prediction parameters; determines a first color component reference sample and a second color component reference sample for the current block based on the first reference prediction parameter set; determines 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 prediction value for the second color component of the current block based on the mapping relationship and the first color component sample of the current block.

[0190] In this way, if the current block uses the BVG-LUT mode, the first reference prediction parameter set for the applied chroma components can be determined. Based on the first reference prediction parameter set, the reference sample values ​​for the luminance and chroma components of the current block are determined, thus establishing a mapping relationship between the luminance and chroma components. This mapping relationship is then used to predict the chroma components. In other words, this fully utilizes the correlation between the reconstructed samples in the current image and the samples in the current block, improving the singularity of chroma prediction and thus increasing its accuracy. Furthermore, based on the established mapping relationship, pixel-level prediction can be effectively performed, further saving bitrate, improving encoding and decoding efficiency, and ultimately enhancing encoding and decoding performance.

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

[0192] Referring to Figure 4A, it shows a schematic block diagram of an encoder provided in an embodiment of this application. As shown in Figure 4A, the 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 and analysis unit 107, a filtering unit 108, an encoding unit 109, and a decoded image buffer unit 110, etc. Among them, 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 raw video signal, a video coding block can be obtained by partitioning it through a Coding Tree Unit (CTU). Then, the residual pixel information obtained after intra-frame or inter-frame prediction is transformed by the transform and quantization unit 101, including transforming the residual information from the pixel domain to the transform domain and quantizing the resulting 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 of the received video coding block relative to one or more blocks in one or more reference frames to provide time prediction information. The motion estimation performed by the motion estimation unit 105 is a process of generating motion vectors, which can estimate the motion of the video coding block. Then, the motion compensation unit 104 is used to perform the motion estimation based on the motion vectors determined by the motion estimation unit 105. The motion compensation is performed. After determining the intra-prediction mode, the intra-prediction unit 103 is also used to provide the selected intra-prediction data to the coding unit 109, and the motion estimation unit 105 also sends the calculated motion vector data to the coding unit 109. In addition, the inverse transform and inverse quantization unit 106 is used to reconstruct the video coding block, reconstruct the residual block in the pixel domain, and remove the block artifacts by the filter control analysis unit 107 and the filtering unit 108. Then, the reconstructed residual block is added to a predictive block in the frame of the decoding image buffer unit 110 to generate the reconstructed video coding block. The coding unit 109 is used 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-prediction mode and output the bitstream of the video signal. The decoding image buffer unit 110 is used to store the reconstructed video coding block for prediction reference. As video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoding image buffer unit 110.

[0193] Referring to Figure 4B, a block diagram of a decoder provided in this application embodiment is shown. As shown in Figure 4B, the 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, etc. The decoding unit 201 can perform header information decoding and CABAC decoding, and the filtering unit 205 can perform deblocking filtering and SAO filtering. After the input video signal undergoes the encoding processing shown in Figure 4A, the bitstream of the video signal is output. This bitstream is input into the decoder 200, first passing through the decoding unit 201 to obtain the decoded transform coefficients. The transform coefficients are then processed by the inverse transform and inverse quantization unit 202 to generate residual blocks 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 previously decoded blocks in the current frame or image. The motion compensation unit 204 determines the prediction information for the video decoding block by analyzing motion vectors and other associated syntax elements, and uses... The prediction information is used to generate a predictive block of the video block being decoded; the 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-prediction unit 203 or the motion compensation unit 204; the decoded video signal is passed through the filtering unit 205 to remove block artifacts, which can improve video quality; then the decoded video block is stored in the decoding image buffer unit 206, which stores reference images for subsequent intra-prediction or motion compensation, and is also used for the output of the video signal, thus obtaining the recovered original video signal.

[0194] Furthermore, this application embodiment also provides a network architecture for an encoding / decoding system including an encoder and a decoder. Figure 5 shows a schematic diagram of such a network architecture. As shown in Figure 5, the network architecture includes one or more electronic devices 13 to 1N and a communication network 01. The electronic devices 13 to 1N can perform video interaction through the communication network 01. During implementation, the electronic devices can be various types of devices with video encoding / decoding capabilities. For example, the electronic devices may include smartphones, tablets, personal computers, personal digital assistants, navigators, digital phones, video phones, televisions, sensing devices, servers, etc., without any limitation.

[0195] It should be noted that the decoder or encoder in the embodiments of this application can be the aforementioned electronic device. The encoder can also be called a "video encoder" or "image encoder," and the decoder can also be called a "video decoder" or "image decoder."

[0196] It should also be noted that the encoding and decoding methods of this application embodiment are mainly applied to the intra-prediction unit 103 part shown in FIG4A and the intra-prediction unit 203 part shown in FIG4B. That is to say, the embodiments of this application can be applied to the encoder, the decoder, or even the encoder and the decoder simultaneously, but the embodiments of this application do not make any limitations.

[0197] It should also be noted that when applied to the intra-prediction unit 103, "current block" specifically refers to the coding block currently to be intra-predicted; when applied to the intra-prediction unit 203, "current block" specifically refers to the decoding block currently to be intra-predicted.

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

[0199] S601, determine the prediction parameters for the current block.

[0200] It should be noted that the decoding method in this application embodiment is applied to a decoder. Furthermore, this decoding method specifically refers to an intra-frame prediction method, and more specifically, a block vector-based chroma prediction method. The video image can be divided into multiple decoding blocks, each of which may include a first color component, a second color component, and a third color component. In this application embodiment, the current block refers to the decoding block in the video image currently undergoing chroma prediction.

[0201] Here, if the current block predicts the first color component, and the first color component is the luminance component, then the current block can also be called a luminance block; or, if the current block predicts the second color component, and the second color component is the chrominance component, then the current block can also be called a chrominance block.

[0202] It should also be noted that, in the embodiments of this application, the prediction parameters can be used to indicate whether the current block uses a first prediction mode. In some embodiments, the method may include: decoding the bitstream to determine the prediction parameters of the current block.

[0203] In this embodiment of the application, if the prediction parameter takes the first value, it is determined that the current block uses the first prediction mode; if the prediction parameter takes the second value, it is determined that the current block does not use the first prediction mode.

[0204] In some embodiments, the method may further include, for the prediction parameters: decoding the bitstream to determine the value of the first syntax element; and determining the prediction parameters of the current block based on the value of the first syntax element.

[0205] It should be noted that, in the embodiments of this application, the first syntax element can be represented by intra_bvglut_flag, or it can also be represented by bvglut_flag. The first syntax element can be used to indicate whether the current block uses the first prediction mode. Here, if the value of the first syntax element is the first value, it is determined that the current block uses the first prediction mode; if the value of the first syntax element is the second value, it is determined that the current block does not use the first prediction mode.

[0206] It should also be noted that, in the embodiments of this application, determining the prediction parameter of the current block based on the value of the first syntax element may include: setting the value of the prediction parameter to be equal to the value of the first syntax element.

[0207] It should also be noted that, in the embodiments of this application, the first value and the second value are different. Specifically, the first value can be set to 1 and the second value can be set to 0; or, the first value can be set to 0 and the second value can be set to 1; or, the first value can be set to true and the second value can be set to false; or, the first value can be set to false and the second value can be set to true.

[0208] In one specific embodiment, the first value is set to 1 and the second value is set to 0. For example, if the value of the first syntax element is 1, it indicates that the prediction parameter indicates that the current block uses the first prediction mode, and the decoding method of this embodiment continues to be executed; otherwise, if the value of the first syntax element is 0, it indicates that the prediction parameter indicates that the current block does not use the first prediction mode, and other prediction modes in related technologies (such as PLANA mode, CCLM mode, angle prediction mode, etc.) can be used for decoding.

[0209] S602, determine the first reference prediction parameter set for the current block based on the prediction parameters; wherein the first reference prediction parameter set contains one or more first candidate reference prediction parameters.

[0210] It should be noted that, in the embodiments of this application, when the prediction parameters indicate that the current block uses a first prediction mode, a first reference prediction parameter set for the current block is determined. The first prediction mode can be a BVG-LUT mode. That is, for the current block, if the current block uses the BVG-LUT mode, then the first reference prediction parameter set for the current block can be determined.

[0211] In some embodiments, determining a first reference prediction parameter set for the current block, as shown in FIG7, the method may include:

[0212] S701, determine the first color component block of the current block.

[0213] S702, determine the second reference prediction parameter set for the current block based on the first color component block.

[0214] S703, determine the first reference prediction parameter set for the current block based on the second reference prediction parameter set.

[0215] It should be noted that, in the embodiments of this application, the first reference prediction parameter set may include one or more first candidate reference prediction parameters. The first candidate reference prediction parameters may be vector parameters based on the second color component.

[0216] It should also be noted that, in the embodiments of this application, the second reference prediction parameter set may include one or more second candidate reference prediction parameters. These second candidate reference prediction parameters may be vector parameters based on the first color component.

[0217] For example, the first color component can be a luminance component, and the second color component can be a chrominance component. Then, the first candidate reference prediction parameter can be a vector parameter based on the chrominance component, and the second candidate reference prediction parameter can be a vector parameter based on the luminance component.

[0218] In some embodiments, the vector parameters include one of the following: block vector parameters and motion vector parameters. That is, both the first reference prediction parameter set and the second reference prediction parameter set can be a parameter list applied to BV, or a parameter list applied to MV.

[0219] In a specific embodiment, taking BV as an example, the "first reference prediction parameter" can be a block vector parameter based on the chromaticity component, and the first reference prediction parameter set can be called the chromaticity BVC candidate list; the "second reference prediction parameter" can be a block vector parameter based on the luminance component, and the second reference prediction parameter set can be called the luminance BVL candidate list.

[0220] In some embodiments, determining the first color component block of the current block, as shown in FIG8, the method may include:

[0221] S801, determine the first color component region at the same position in the current block.

[0222] S802, based on multiple partitions of the first color component region, determine the first candidate block at the first position.

[0223] S803 performs a position offset search within a preset search area at the first position to determine multiple second candidate blocks.

[0224] S804, determine the first color component block of the current block based on the first candidate block and / or multiple second candidate blocks.

[0225] It should be noted that, in the embodiments of this application, the first color component region at the same position of the current block is first determined; then, based on the multiple division blocks of the first color component region, the first color component block of the current block is determined.

[0226] It should be noted that, in the embodiments of this application, if the first color component is a luminance component, then the region of the first color component can also be called a "corresponding luminance region". For example, if the current block is a chroma block, then the corresponding luminance region can refer to the luminance region at the same position corresponding to the current block. For the current block, the first color component region at the same position can be divided into blocks, for example, by using a binary tree structure, ternary tree structure, quadtree structure, etc., to obtain multiple blocks. Each block can 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 partitioned blocks.

[0227] For example, taking Figure 3 as an example, the area filled with diagonal lines represents the corresponding luminance region of the chromaticity component. This corresponding luminance region can be divided into multiple blocks; the block at the center of these blocks can be selected as the corresponding luminance block of the current block. For example, the block filled with black in Figure 3 is the corresponding luminance block (first color component block) of the current block.

[0228] In one specific embodiment, for determining the first color component block of the current block, the method may include: determining a first candidate block at a first position from a plurality of partitioned blocks of the first color component region; and determining the first color component block of the current block based on the first candidate block at the first position.

[0229] In this embodiment, the first position can refer to any position within the first color component region. For example, the first position can be the center position, the upper left corner position, the lower right corner position, or a specific position within the first color component region.

[0230] In the embodiments of this application, the first candidate block may refer to the block located at the first position. In a specific embodiment, the block located at the center of the first color component region is selected as the first candidate block; and / or, the block located at the upper left corner of the first color component region is selected as the first candidate block; and / or, the block located at the lower right corner of the first color component region is selected as the first candidate block, etc., without any limitation.

[0231] Furthermore, in some embodiments, the method of determining the first color component block of the current block based on the first candidate block at the first position may include: performing a position offset search in a preset search area at the first position to determine a plurality of second candidate blocks; and determining the first color component block of the current block based on the first candidate block and / or the plurality of second candidate blocks.

[0232] In this embodiment of the application, the position offset search is performed in the preset search area of ​​the first position. This can be to search for multiple positions in the directions such as upper left, upper, and left based on the first position. For example, the coordinate offsets of the first position to the upper left (xOffset, yOffset) = (-2, -2), to the upper left (xOffset, yOffset) = (0, -2), and to the left (xOffset, yOffset) = (-2, 0) can be obtained. No limitation is made here.

[0233] 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 position information of the corresponding region of the current block; determining the target position information according to the position information of the corresponding region, and taking the candidate block containing the target position information as the first color component block of the current block.

[0234] In some embodiments, determining the target location information based on the location information of the corresponding region may include: calculating the center position based on the location information of the corresponding region and using the obtained center position information as the target location information; or, calculating the upper left corner position based on the location information of the corresponding region and using the obtained upper left corner position information as the target location information; or, calculating the lower right corner position based on the location information of the corresponding region and using the obtained lower left corner position information as the target location information.

[0235] In this embodiment of the application, the preset sampling format can 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 corresponding region is shown in Table 4.

[0236] In one possible implementation, the position of the current block is obtained, that is, the position of the top left chroma sample of the current block relative to the top left chroma sample of the current image, chromaPos=(x,y). The chromaPos is scaled according to the chroma sampling format shown in Table 4 to obtain the position of the corresponding luminance region of the current block, lumaPos=(xCb,yCb).

[0237] Here, assuming the position of the corresponding brightness pixel at the top left corner of the current block relative to the top left corner brightness pixel of the image is (xCb, yCb), and the width of the corresponding brightness region (i.e., the entire diagonally filled area of ​​the brightness component in Figure 3) is cbWidth, and the height is cbHeight; then the block at the center (the center block of the brightness region) is the brightness block containing the center coordinates (xCb+cbWidth>>1, yCb+cbHeight>>1), which is the block filled with black in Figure 3. In Figure 3, the small white blocks represent the center coordinates, which can be used to locate the position of this brightness block.

[0238] Here, for multiple second candidate blocks, multiple positions can be searched to the upper left, upper, and left from the position of the luminance block, including but not limited to the following exemplary search positions: obtaining the upper left coordinate offset (xOffset, yOffset) = (-2, -2), the upper coordinate offset (xOffset, yOffset) = (0, -2), and the left coordinate offset (xOffset, yOffset) = (-2, 0) from the center position of the luminance region. The luminance block used for the luminance region is the luminance block containing the position coordinates (xCb + cbWidth >> 1 + xOffset, yCb + cbHeight >> 1 + yOffset).

[0239] In another possible implementation, the position of the current block is obtained, that is, the position of the top left chroma sample of the current block relative to the top left chroma sample of the current image, chromaPos=(x,y). The chromaPos is scaled according to the chroma sampling format shown in Table 4 to obtain the position of the corresponding luminance region of the current block, lumaPos=(xCb,yCb).

[0240] Here, assuming the position of the corresponding brightness pixel at the top left corner of the current block relative to the top left corner brightness pixel of the image is (xCb, yCb), and the width of the corresponding brightness region (i.e., the entire diagonally filled area of ​​the brightness component in Figure 9) is cbWidth, and the height is cbHeight; then the block at the top left corner (the top left corner block of the brightness region) is the brightness block containing the top left corner coordinates (xCb, yCb), which is the block filled with black in Figure 9. In Figure 9, the small white blocks represent the position of the top left corner coordinates, which can be used to locate the position of this brightness block.

[0241] Here, for multiple second candidate blocks, multiple positions can be searched to the upper left, upper, and left from the position of the luminance block, including but not limited to the following exemplary search positions: obtaining the upper left coordinate offset (xOffset, yOffset) = (-2, -2), the upper coordinate offset (xOffset, yOffset) = (0, -2), and the left coordinate offset (xOffset, yOffset) = (-2, 0) from the upper left corner position of the luminance region. The luminance block used for the luminance region is the luminance block containing the position coordinates (xCb + xOffset, yCb + yOffset).

[0242] In another possible implementation, the position of the current block is obtained, that is, the position of the top left chroma sample of the current block relative to the top left chroma sample of the current image, chromaPos=(x,y). chromaPos is scaled according to the chroma sampling format shown in Table 4 to obtain the position of the corresponding luminance region of the current block, lumaPos=(xCb,yCb).

[0243] Here, assuming the position of the corresponding brightness pixel at the top left corner of the current block relative to the top left corner brightness pixel of the image is (xCb, yCb), and the width of the corresponding brightness region (i.e., the entire diagonally filled area of ​​the brightness component in Figure 10) is cbWidth, and the height is cbHeight; then the block at the bottom right corner (the bottom right corner block of the brightness region) is the brightness block containing the bottom right corner coordinates (xCb+cbWidth-1, yCb+cbHeight-1), which is the block filled with black in Figure 10. In Figure 10, the small white block represents the position of the bottom right corner coordinates, which can be used to locate the position of this brightness block.

[0244] Here, for multiple second candidate blocks, multiple positions can be searched to the upper left, upper, and left from the position of the luminance block, including but not limited to the following exemplary search positions: obtaining the upper left coordinate offset (xOffset, yOffset) = (-2, -2), the upper coordinate offset (xOffset, yOffset) = (0, -2), and the left coordinate offset (xOffset, yOffset) = (-2, 0) from the lower right corner of the luminance region. The luminance block used for the luminance region is the luminance block containing the position coordinates (xCb + cbWidth - 1 + xOffset, yCb + cbHeight - 1 + yOffset).

[0245] In other words, in this embodiment, the first candidate block for the first color component block can be any block among the multiple blocks shown in Figure 3. For example, the block at the center of the same brightness region as shown in Figure 3 (the block filled with black), the block at the upper left corner of the same brightness region as shown in Figure 9 (the block filled with black), the block at the lower right corner of the same brightness region as shown in Figure 10 (the block filled with black), or even the block at the upper right corner, the lower left corner, or even the block at the center of the upper left region, etc., without any limitation. Furthermore, based on the first candidate block, multiple positions can be searched to the upper left, upper, and left to obtain multiple second candidate blocks. Then, based on the first candidate block and / or multiple second candidate blocks, the first color component block of the current block can be determined.

[0246] In some embodiments, the method may further include: determining at least one candidate block at a preset position from a plurality of partitioned blocks of the first color component region; and determining the first color component block of the current block based on the at least one candidate block.

[0247] In this embodiment, at least one candidate block can be used as the first color component block of the current block. That is, the first color component block can be at least one candidate block obtained sequentially. For example, as shown in Figure 11, this includes five luminance pixel positions (CUs): C, TL, TR, BL, and BR. However, this embodiment is not limited to five positions and can have multiple different positions; nor is it limited to the five positions shown in Figure 11, and no limitation is made in any way.

[0248] In another possible implementation, taking the block containing five brightness pixel positions shown in Figure 11 as an example, the pixels can be acquired sequentially in a preset order, which includes, but is not limited to, the following order: C->TL->TR->BL->BR.

[0249] For the detailed 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 corner color sample of the current block relative to the upper left corner color sample of the current image, chromaPos = (x, y). According to the chroma sampling format shown in Table 4, chromaPos is scaled to obtain the position of the corresponding brightness region of the current block, lumaPos = (xCb, yCb).

[0250] Here, we assume that the position of the corresponding luminance pixel at the top left corner of the current block relative to the luminance pixel at the top left corner of the image (i.e., the position of luminance pixel TL) is (xCb, yCb), and the width of the corresponding luminance region (i.e., the entire diagonal filled region of the luminance component in Figure 11) corresponding to the current chroma coding block is cbWidth, and the height is cbHeight.

[0251] The coordinates of the position of the brightness pixel C are (xCb+cbWidth / 2, yCb+cbHeight / 2);

[0252] The coordinates of the position of the brightness pixel TL are (xCb, yCb);

[0253] The coordinates of the position of the luminance pixel TR are (xCb+cbWidth-1,yCb);

[0254] The coordinates of the position of the luminance pixel BL are (xCb, yCb+cbHeight-1);

[0255] The coordinates of the position of the luminance pixel BR are (xCb+cbWidth-1, yCb+cbHeight-1).

[0256] Here, when searching for each location, multiple locations can be searched to the upper left, upper, and left from that location, including but not limited to the following exemplary search locations: obtaining the upper left coordinate offset (xOffset, yOffset) = (-2, -2), the upper coordinate offset (xOffset, yOffset) = (0, -2), and the left coordinate offset (xOffset, yOffset) = (-2, 0) for this location. The luminance block used for the luminance area is a luminance block that contains the coordinates of this location plus the coordinates of the aforementioned offset locations.

[0257] Therefore, for the current block, it is first necessary to determine the corresponding first color component block. For example, when the first color component is the luminance component, it is necessary to determine the corresponding luminance block of the current block. Specifically, one or more corresponding luminance blocks can be determined using the several possible implementation methods described above.

[0258] It is understood that after determining the first color component block, a second reference prediction parameter set for the current block can be constructed. In some embodiments, the method may include: determining one or more candidate vector parameters based on the first color component block; and determining the second reference prediction parameter set for the current block based on the one or more candidate vector parameters based on the first color component.

[0259] It should be noted that, in the embodiments of this application, determining the second reference prediction parameter set of the current block based on one or more candidate vector parameters based on the first color component may include: adjusting the candidate vector parameters based on the first color component to determine the candidate vector parameters based on the second color component; when the candidate vector parameters based on the second color component meet the preset availability conditions, the candidate vector parameters based on the first color component are used as the second candidate reference prediction parameters and added to the second reference prediction parameter set.

[0260] Here, taking the block vector parameter BV as an example, assuming the current block is a chroma block and the first color component block is a luma block, then the candidate vector parameter based on the first color component can be the BV of the luma block, i.e., BVL; the candidate vector parameter based on the second color component can be the BV of the chroma block, i.e., BVC.

[0261] It should also be noted that, in the embodiments of this application, assuming that the candidate vector parameter based on the first color component is luminance BV = (BVLhor, BVLver) and the candidate vector parameter based on the second color component is chrominance BV = (BVChor, BVCver), then the corresponding chrominance BV can be determined by adjusting BVL (luminance BV).

[0262] In one specific embodiment, adjusting the candidate vector parameters based on the first color component to determine the candidate vector parameters based on the second color component may include: determining a preset sampling format for the current block; scaling the candidate vector parameters based on the first color component according to the preset sampling format to determine the candidate vector parameters based on the second color component.

[0263] It should be noted that, in the embodiments of this application, the above adjustments may include scaling processing according to a preset sampling format. The preset sampling format may be the mapping relationship between luminance BV and scaled chrominance BV as shown in Table 8.

[0264] Table 8

[0265] Here, the default format can refer to the color sampling format, such as monochrome, 4:2:0, 4:2:2, 4:4:4, etc. The syntax element `sps_chroma_format_idc` indicates the type of color sampling format, specifically the chroma sampling format. Different color sampling formats require different scaling operations.

[0266] For example, if the value of sps_chroma_format_idc is 0, then the color sampling format is determined to be monochrome, that is, the chroma BV parameter (BVC) does not exist. hor BVC horIf the value of `sps_chroma_format_idc` is 1, then the color sampling format is determined to be 4:2:0. In this case, the mapping relationship between luminance (BV) and chrominance (BV) is: BVC hor =BVL hor >>1, BVC hor =BVL ver >>1; If the value of sps_chroma_format_idc is 2, then the color sampling format is determined to be 4:2:2. In this case, the mapping relationship between luminance BV and chrominance BV is: BVC hor =BVL hor >>1, BVC hor =BVL ver If the value of `sps_chroma_format_idc` is 3, it indicates that the color sampling format is 4:4:4. In this case, the mapping relationship between luminance (BV) and chrominance (BV) is: BVC hor =BVL hor BVC hor =BVL ver .

[0267] Thus, based on Table 8, the candidate BVL can be scaled according to the color sampling format to obtain a scaled BVC; then, it can be determined whether the scaled BVC meets the preset usability conditions. The scaled BVC meeting the preset usability conditions includes, but is not limited to:

[0268] The offset position indicated by the scaled BVC does not exceed the image boundary;

[0269] The offset position indicated by the scaled BVC does not exceed the slice boundary;

[0270] The current block is not covered by the offset indicated by the scaled BVC;

[0271] The offset position indicated by the scaled BVC does not exceed the preset available area;

[0272] The offset position indicated by the scaled BVC has been reconstructed.

[0273] It should also be noted that, in the embodiments of this application, one or more candidate vector parameters (i.e., one or more candidate BVLs) based on the first color component block are scaled. Specifically, if a candidate BVL is scaled based on the color sampling format shown in Table 8, and the scaled BVL meets preset usability conditions, then this candidate BVL can be used as a second candidate reference prediction parameter and added to the second reference prediction parameter set to construct the second reference prediction parameter set. The second reference prediction parameter set may contain one or more second candidate reference prediction parameters.

[0274] It can also be understood that after constructing the second reference prediction parameter set, the first reference prediction parameter set for the current block can be further determined. In some embodiments, the method may include: adjusting one or more second candidate reference prediction parameters in the second reference prediction parameter set to determine a first candidate reference prediction parameter corresponding to each of the one or more second candidate reference prediction parameters; and determining the first reference prediction parameter set for the current block based on the first candidate reference prediction parameters corresponding to each of the one or more second candidate reference prediction parameters.

[0275] It should be noted that in the embodiments of this application, the number of first candidate reference prediction parameters and second candidate reference prediction parameters is the same. That is, for each second candidate reference prediction parameter, it can be adjusted to obtain one or more first candidate reference prediction parameters, and then a usable first candidate reference prediction parameter is determined from them. However, it should be noted that the number of first candidate reference prediction parameters and second candidate reference prediction parameters can also be different. In this case, each second candidate reference prediction parameter can determine more than one usable first candidate reference prediction parameter, which is not limited here.

[0276] In some embodiments, one or more second candidate reference prediction parameters in the second reference prediction parameter set are adjusted to determine a first candidate reference prediction parameter corresponding to each of the one or more second candidate reference prediction parameters. Taking one of the second candidate reference prediction parameters as an example, the method may include: adjusting the second candidate reference prediction parameters to determine a third reference prediction parameter set based on the second color component; and determining the first candidate reference prediction parameter corresponding to the second candidate reference prediction parameter according to the third reference prediction parameter set.

[0277] In the embodiments of this application, for each second candidate reference prediction parameter, the corresponding first candidate reference prediction parameter can be determined in this way to obtain the first reference prediction parameter set.

[0278] For example, assuming the current block is a chroma block and the first color component block is a luma block, then the first candidate reference prediction parameter can be a candidate BV (Browser Vector Value) for the chroma block, i.e., a candidate BVC; the second candidate reference prediction parameter can be a candidate BV (Browser Vector Value) for the luma block, i.e., a candidate BVL. Adjusting the second candidate reference prediction parameter can determine one or more candidate vector parameters based on the second color component, i.e., one or more candidate BVCs, which can construct a third reference prediction parameter set.

[0279] It is understood that, in the embodiments of this application, assuming that the second candidate reference prediction parameter is luminance BV = (BVLhor, BVLver) and the candidate vector parameter based on the second color component is chrominance BV = (BVChor, BVCver), then a chrominance BVC candidate list containing one or more candidate block vector parameters can be constructed by adjusting BVL (luminance BV) or BVC (chrominance BV).

[0280] In one possible implementation, adjusting the second candidate reference prediction parameters to determine a third reference prediction parameter set based on the second color component may include: scaling the second candidate reference prediction parameters according to a preset sampling format of the current block, determining candidate vector parameters based on the second color component, and adding the candidate vector parameters based on the second color component to the third reference prediction parameter set.

[0281] It should be noted that, in the embodiments of this application, the above adjustments may include scaling processing according to a preset sampling format. The preset sampling format may be the mapping relationship between the luminance BV and the scaled chrominance BV shown in Table 8. Here, the preset format can refer to a color sampling format, such as monochrome, 4:2:0, 4:2:2, 4:4:4, etc. Thus, scaling can be performed according to the color sampling format shown in Table 8, and the scaled BVC can be added as a candidate vector parameter to the third reference prediction parameter set.

[0282] In another possible implementation, adjusting the second candidate reference prediction parameters to determine a third reference prediction parameter set based on the second color component may include: scaling the second candidate reference prediction parameters according to a preset sampling format of the current block to determine a first initial vector parameter based on the second color component; performing offset calculations on the first initial vector parameter based on the second color component according to one or more offset values ​​to determine one or more candidate vector parameters based on the second color component, and adding one or more candidate vector parameters based on the second color component to the third reference prediction parameter set.

[0283] In another possible implementation, adjusting the second candidate reference prediction parameters to determine a third reference prediction parameter set based on the second color component may include: performing offset calculations on the second candidate reference prediction parameters according to one or more offset values ​​to determine one or more second initial vector parameters based on the first color component; scaling the one or more second initial vector parameters based on the first color component according to the preset sampling format of the current block to determine one or more candidate vector parameters based on the second color component; and adding the one or more candidate vector parameters based on the second color component to the third reference prediction parameter set.

[0284] It should be noted that, in the embodiments of this application, the above one or more offset values ​​can be any number of arbitrary values, such as -1, +1, -2, +2, -3, +3, etc., and no limitation is made here.

[0285] In other words, in this embodiment of the application, after obtaining the BV of the corresponding luma block, it can be denoted as BVL, and the chromaticity BV obtained through BVL can be denoted as BVC. Then, by adjusting BVL or BVC, a candidate chromaticity BVC can be constructed, containing one or more candidate options. The construction methods of the candidate options include, but are not limited to, the following:

[0286] In one possible construction method, BVL can be adjusted to form four cases, thereby achieving the adjustment of BVC. Specifically, when BVL is odd, the four cases are BVL = (BVLhor, BVLver), BVL = (BVLhor+1, BVLver), BVL = (BVLhor, BVLver+1), and BVL = (BVLhor+1, BVLver+1). When BVL is even, BVL = (BVLhor, BVLver).

[0287] Alternatively, when BVL is even, 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 scenarios.

[0288] Here, BVC[0] = BVL[0] * 2 / SubWidthC, BVC[1] = BVL[1] * 2 / SubHeightC. SubWidthC and SubHeightC can be determined according to the mapping relationship between sps_chroma_format_idc and color sampling format in Table 1.

[0289] The BVL is scaled according to the above formula to obtain the BVC. When the BVL is odd or even, four BVC candidates will be formed. These candidates are added to the chromaticity BVC candidate list (i.e., the third reference prediction parameter set).

[0290] In another possible construction method, BVL can be adjusted to form four cases, thereby achieving the adjustment of BVC. Specifically, when BVL is odd, the four cases are BVL = (BVLhor, BVLver), BVL = (BVLhor+1, BVLver), BVL = (BVLhor, BVLver+1), and BVL = (BVLhor+1, BVLver+1). When BVL is even, the four cases are BVL = (BVLhor, BVLver), BVL = (BVLhor-1, BVLver), BVL = (BVLhor, BVLver-1), and BVL = (BVLhor-1, BVLver-1). Next, the BVL is scaled according to the color sampling format in Table 8 to obtain the BVC. This will result in four BVC candidates when the BVL is odd or even. These candidates are then added to the chromaticity BVC candidate list (i.e., the third reference prediction parameter set).

[0291] It should be noted that in this construction method, the operation for different odd and even numbers can also be unified by the following calculation: take four cases: BVL = (BVLhor-1, BVLver-1), BVL = (BVLhor+1, BVLver-1), BVL = (BVLho-1r, BVLver+1), and BVL = (BVLhor+1, BVLver+1).

[0292] In another possible construction method, BVL can be adjusted to form multiple cases, thereby adjusting BVC. Specifically, when BVL is odd, multiple cases are considered, 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). These candidates are then used to construct a list in sequence. When BVL is even, various cases are considered, including 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). Next, BVL is scaled according to the color sampling format in Table 8 to obtain BVC. This results in multiple BVC candidates for both odd and even BVL values. These candidates are then added to the chromaticity BVC candidate list (i.e., the third reference prediction parameter set).

[0293] It should be noted that in this construction method, the operation for different odd and even numbers can also be unified by the following calculations: take 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.

[0294] In another possible construction method, the obtained BVC can 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. These candidates are then added to the chromaticity BVC candidate list (i.e., the third reference prediction parameter set).

[0295] In another possible construction method, the obtained BVC can 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+ ... The following are some examples of BVC candidates: er-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. These candidates are then added to the chromaticity BVC candidate list (i.e., the third reference prediction parameter set).

[0296] It should also be noted that, in the embodiments of this application, for the case where BVL is odd or even, since BVL is a two-dimensional vector, it specifically refers to a certain component being odd or even. Furthermore, "+1", "-1", "+2", "-2", "+3", and "-3" all refer to integer pixel precision.

[0297] It is understood that, in the embodiments of this application, when determining the first candidate reference prediction parameter based on the third reference prediction parameter set, it is also necessary to determine whether the candidate vector parameters in the third reference prediction parameter set are available, that is, it is necessary to select one or more available candidate vector parameters from the third reference prediction parameter set. Therefore, in some embodiments, determining the first candidate reference prediction parameter corresponding to the second candidate reference prediction parameter based on the third reference prediction parameter set may include: determining whether the third reference prediction parameter set has one or more candidate vector parameters that satisfy a preset availability condition; and when the third reference prediction parameter set has one or more candidate vector parameters that satisfy the preset availability condition, determining the first candidate reference prediction parameter based on the one or more candidate vector parameters.

[0298] Specifically, in the embodiments of this application, a candidate vector parameter can only be determined as the first candidate reference prediction parameter if the candidate vector parameter meets the preset availability conditions.

[0299] In some embodiments, one or more candidate vector parameters satisfy preset availability conditions, including but not limited to:

[0300] The offset position indicated by one or more candidate vector parameters does not exceed the image boundary;

[0301] The offset position indicated by one or more candidate vector parameters does not exceed the slice boundary;

[0302] The offset position indicated by one or more candidate vector parameters does not cover the current block;

[0303] The offset position indicated by one or more candidate vector parameters does not exceed the preset available area;

[0304] The offset positions indicated by one or more candidate vector parameters have been reconstructed.

[0305] It should be noted that, in this embodiment, assuming the current block position is (xCb, yCb), and for the candidate vector parameters, BVC = (BVChor, BVCver), the corresponding offset position is found to be (xCb + BVChor, yCb + BVCver). Here, the offset position can be specifically described using coordinate position information and data such as the size parameters of the current block, even if it does not exceed the image boundary. For example, xCb + width + BVChor <= xCb or yCb + height + BVCver <= yCb.

[0306] It should also be noted that, in the embodiments of this application, the preset availability conditions can also take into account whether the slice boundary is exceeded. For example, the offset position indicated by one or more candidate vector parameters does not exceed the slice boundary, or the offset position indicated by one or more candidate vector parameters does not exceed the tile boundary.

[0307] In this embodiment, a candidate vector parameter can only be considered usable if all of the above conditions are met. In one specific embodiment, taking one candidate vector parameter as an example, the candidate vector parameter satisfying the preset usability conditions includes at least: the offset position indicated by the candidate vector parameter does not exceed the image boundary; the offset position indicated by the candidate vector parameter does not exceed the patch boundary; the offset position indicated by the candidate vector parameter does not cover the current block; the offset position indicated by the candidate vector parameter does not exceed the preset usable area; and the offset position indicated by the candidate vector parameter has been reconstructed.

[0308] For example, Figure 12 shows a schematic diagram of whether an offset position does not cover the current block according to an embodiment of this application. As shown in Figure 12, the block filled with black represents the current block, the area filled with diagonal lines represents the available area, and the unfilled area represents the unavailable area. For the current block, if the offset position indicated by the candidate block vector parameter is in the unavailable area, then the offset position will cover the current block.

[0309] For example, Figure 13 shows a schematic diagram of whether the offset position exceeds the preset available area according to an embodiment of this application. As shown in Figure 13, the black-filled block represents the current block, and the area filled with diagonal lines represents the available area, and all reference blocks within the available area have been reconstructed. In this embodiment of the application, considering the storage capacity of the Buffer, the reference blocks adjacent to the current block (m, n) can generally be: 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 the preset available area.

[0310] In other words, when determining whether a color is usable, the current block position (xCb, yCb) can be obtained, the chroma BVC = (BVChor, BVCver) can be obtained, the corresponding offset position (xCb + BVChor, yCb + BVCver) can be found, and the following conditions can be checked, including but not limited to the following conditions (i.e., preset usability conditions). If all of them are true, then the chroma BV is usable:

[0311] Does the obtained offset position not exceed the image boundary?

[0312] To determine whether the obtained offset position does not cover the current block, please refer to Figure 12.

[0313] xCb+width+BVChor<=xCb or yCb+height+BVCver<=yCb;

[0314] Whether the obtained offset position does not exceed the preset available area, see Figure 13 for details;

[0315] Has the obtained offset position been reconstructed?

[0316] It can also be understood that, in the embodiments of this application, the construction methods of the third reference prediction parameter set include, but are not limited to, the various situations described above. One of these methods can be used to construct the candidate list, or multiple methods can be used simultaneously to construct the list. That is, four BVC candidates are determined for each BVL to construct the third reference prediction parameter set. Then, for each BVL, a usable BVC is decided from the four BVC candidates, which is the first candidate reference prediction parameter corresponding to that BVL.

[0317] In some embodiments, determining a first candidate reference prediction parameter based on one or more candidate vector parameters includes: if there is a candidate vector parameter in the third reference prediction parameter set that satisfies a preset availability condition, then the candidate vector parameter that satisfies the preset availability condition is determined as the first candidate reference prediction parameter; if there are multiple candidate vector parameters in the third reference prediction parameter set that satisfy the preset availability condition, then a decision is made on the multiple candidate vector parameters that satisfy the preset availability condition to determine the first candidate reference prediction parameter.

[0318] It should be noted that, in the embodiments of this application, if there are one or more candidate vector parameters that satisfy the preset availability conditions, then when determining the first candidate reference prediction parameter based on one or more candidate vector parameters, one of the candidate vector parameters that satisfies the preset availability conditions can be directly determined as the first candidate reference prediction parameter. That is, if only one BVC candidate in the constructed available BVC candidate list satisfies the preset availability conditions, then the final selected first candidate reference prediction parameter is that BVC.

[0319] It should also be noted that, in the embodiments of this application, if there are multiple candidate vector parameters that meet preset availability conditions, then decisions can also be made on these multiple candidate vector parameters. Specifically, this can be as follows: determine a first template for the current block; determine a first matching template for each of the multiple candidate vector parameters based on the first template and the multiple candidate vector parameters; when the first template and the first matching template meet preset existence conditions, calculate the matching error between the first template and the first matching template of the current block according to a preset error criterion, so as to determine the first generation value of each of the multiple candidate vector parameters; determine the minimum generation value from the first generation values ​​of each of the multiple candidate vector parameters, and determine the candidate vector parameter corresponding to the minimum generation value as the first candidate reference prediction parameter.

[0320] In other words, in this embodiment of the application, after determining the first-generation value corresponding to multiple candidate vector parameters that meet the preset availability conditions, one or more candidate vector parameters can be determined from the multiple candidate vector parameters based on the first-generation value. For example, if the constructed list of available BVC candidates has multiple available BVC candidates, then it is necessary to make a decision on these available BVCs to obtain the final BV. The decision-making method includes, but is not limited to, using a template for decision-making.

[0321] It should be noted that, in the embodiments of this application, the first template includes one or more samples from the adjacent decoded regions of the current block. Accordingly, the type of the first template may include at least one of the following: top template, top-right template, left template, bottom-left template, and top-left template. Specifically, the top template is located in the top-adjacent decoded region of the current block, the top-right template is located in the top-right-adjacent decoded region of the current block, the left template is located in the left-adjacent decoded region of the current block, the bottom-left template is located in the bottom-left-adjacent decoded region of the current block, and the top-left template is located in the top-left-adjacent decoded region of the current block.

[0322] It should also be noted that, in this embodiment, 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 adjacent areas of the current block, including the reconstruction of chroma information. Figure 14 is a schematic diagram of template types. As shown in Figure 14, based on the relative positional relationship between the template and the current block, templates can be classified into template types such as top template, left template, top-right template, bottom-left template, and top-left template. The dimensions of different types of templates for different coding blocks can be fixed and the same, or they can be different.

[0323] For example, the template size can be set to the same size for any current block. The following formula illustrates a condition for setting the template size, where nTbW and nTbH are the width and height of the current block, respectively, and iTempW and iTempH are the width and height of the template being used, respectively:

[0324] Template above:

[0325] Left template:

[0326] For example, different template sizes can be selected based on the different sizes of 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, respectively, and iTempW and iTempH are the width and height of the template being used, respectively:

[0327] Template above:

[0328] Left template:

[0329] in,

[0330] For example, different template sizes can 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, respectively, nTbW × nTbH are the number of pixels in the current block, and iTempW and iTempH are the width and height of the template used, respectively:

[0331] Template above:

[0332] Left template:

[0333] In some embodiments, when determining the first matching template based on multiple candidate vector parameters, the region indicated by the multiple candidate vector parameters that has the same shape and contains the same number of sample values ​​as the first template is determined as the first matching template, starting from the position of the current point.

[0334] For example, in the embodiments of this application, when determining the first matching template, the first template of the current block is used to perform motion compensation on the obtained multiple BVC candidates (i.e., candidate block vector parameters that meet the preset usability conditions) to obtain the template (first matching template) at the corresponding BV. Figure 15 is a schematic diagram of template motion compensation. As shown in Figure 15, if the BV (BVC candidate) is usable, motion compensation will be performed using the first template and the BV to obtain the template at the corresponding BV, i.e., the first matching template.

[0335] It can also be understood that, in the embodiments of this application, the preset error criteria may include, but are not limited to, any one of the following: Sum of Absolute Errors (SAD), Sum of Transformed Absolute Errors (SATD), Sum of Squared Differences (SSE), Mean Absolute Differences (MAD), Mean Absolute Errors (MAE), Mean Squared Errors (MSE).

[0336] For example, in this embodiment of the application, when calculating costs, i.e., determining the first-generation value, there are multiple choices for the cost function used to calculate the cost of the template area, i.e., there are multiple choices for the preset error criteria. For example, evaluation criteria such as Sum of Absolute Errors (SAD), Sum of Transformed Absolute Errors (SATD), Sum of Squared Differences (SSE), Mean Absolute Difference (MAD), Mean Absolute Error (MAE), and Mean Squared Error (MSE) can be selected. Any evaluation criterion mentioned below can be selected from the above criteria. Taking the SAD evaluation criterion as an example, the calculation formula is as follows:

[0337] Where predTempSizeW is the width of the template, predTempSizeH is the height of the template, predTemp[i][j] is the pixel value of the template at BV, and recTempC[i][j] is the pixel value of the current block template.

[0338] Furthermore, in some embodiments, the method may further include: when the first template and the first matching template do not satisfy a preset existence condition, determining the first candidate vector parameter in the third reference prediction parameter set that satisfies the preset availability condition as the first candidate reference prediction parameter; or, when the first template and the first matching template do not satisfy the preset existence condition, determining the candidate vector parameter at the second position in the third reference prediction parameter set that satisfies the preset availability condition as the first reference prediction parameter.

[0339] In other words, if the first template and the first matching template meet the preset existence conditions, the matching error between the first template and the first matching template of the current block can be calculated according to the preset error criteria, so as to select the candidate vector parameter corresponding to the minimum cost value as the first candidate reference prediction parameter; if the first template and the first matching template do not meet the preset existence conditions, the first candidate vector parameter in the third reference prediction parameter set that meets the preset availability conditions or the candidate vector parameter at a specified position can be determined as the first candidate reference prediction parameter.

[0340] For example, regarding whether the first template and the first matching template meet the preset existence conditions, the template usage when calculating the cost (i.e., the cost value) can be in the following situations:

[0341] The first scenario: Both the top and left templates of the current block exist, and both the top and left templates at the corresponding BV point also exist. In this case, both the top and left templates are available.

[0342] The second scenario: Both the top and left templates of the current block exist, but only the top template exists at the corresponding BV. In this case, there are two methods: Method 1: If the left template does not exist at the corresponding BV, it is not used directly, i.e., only the top template is used for calculation. Method 2: If the left template does not exist at the corresponding BV, the leftmost template width column inside the reference block is used to replace the left template, i.e., both the top and left templates are used for calculation.

[0343] The third scenario: Both the top and left templates 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 top template does not exist at the corresponding BV, it is not used directly, i.e., only the left template is used for calculation. Method 2: If the top template does not exist at the corresponding BV, the template height row at the topmost edge of the reference block is used instead of the top template, i.e., both the top and left templates are used for calculation.

[0344] The fourth scenario: Only the top template exists in the current block. In this case, there are three methods: Method 1: If the top template does not exist at the corresponding BV, it is not used. The final selected BV is the first BVC in the BVC candidate list or a BVC at a specified position. Method 2: If the top template does not exist at the corresponding BV, the topmost template height row inside the reference block is used instead. Method 3: If the top template exists at the corresponding BV, it is used directly.

[0345] Fifth scenario: 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 not used. The final selected BV is the first BVC in the BVC candidate list or a BVC at a specified position. Method 2: If the left template at the corresponding BV does not exist, the leftmost template width column inside the reference block is used instead. Method 3: If the left template at the corresponding BV exists, it is used directly.

[0346] The sixth scenario: If neither the upper template nor the left template exists in the current block, the final selected BV is either the first BVC in the BVC candidate list or a BVC at a specified position.

[0347] For example, in this embodiment of the application, when determining the first candidate reference prediction parameter based on the first-generation value of each of the multiple candidate vector parameters, except in cases where the cost cannot be calculated, the cost of each candidate in the candidate list of BVCs 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. Any number of BVCs with the lowest cost are selected as the final selected BV (first candidate reference prediction parameter) for BV-based chromaticity prediction. It should also be noted that when calculating the cost of multiple candidate vector parameters, a cost can be calculated for each candidate vector parameter, always retaining the candidate vector parameter with the lowest cost. In this case, a list or even sorting may not be necessary.

[0348] Thus, after obtaining one or more first candidate reference prediction parameters, a first reference prediction parameter set can be constructed.

[0349] S603, determine the first color component reference sample value and the second color component reference sample value of the current block according to the first reference prediction parameter set.

[0350] It should be noted that, in the embodiments of this application, the "reference prediction parameter" here is a parameter used to derive the reference sample value of the current block, specifically a vector parameter (e.g., BV or MV). Then, based on these reference samples, the mapping relationship between the first color component and the second color component can be derived.

[0351] It should also be noted that if all candidate vector parameters in the third reference prediction parameter set are unavailable, that is, if all candidate block vector parameters in the third reference prediction parameter set do not meet the preset availability condition, then there are no available first candidate reference prediction parameters, and therefore no first reference prediction parameter set exists. In this case, the method may further include: when all candidate vector parameters in the third reference prediction parameter set do not meet the preset availability condition, determining the first color component reconstruction sample and the second color component reconstruction sample at the third position of the current block; and determining the first color component reference value and the second color component reference value of the current block based on the first color component reconstruction sample and the second color component reconstruction sample at the third position.

[0352] In other words, in this embodiment of the application, luminance pixels and chrominance pixels at a set position can also be obtained. The set position includes, but is not limited to, the adjacent row and the adjacent column of the current block, so as to obtain the first color component reference sample value and the second color component reference sample value of the current block.

[0353] In some embodiments, determining the first color component reference sample and the second color component reference sample of the current block based on the first reference prediction parameter set may include: determining a first color component reconstructed sample and a second color component reconstructed sample indicated by one or more first candidate reference prediction parameters, based on the first reference prediction parameter set; determining a first color component reconstructed sample and a second color component reconstructed sample at a third position of the current block; and determining the first color component reference sample and the second color component reference sample of the current block based on the first color component reconstructed sample and the second color component reconstructed sample indicated by one or more first candidate reference prediction parameters, as well as the first color component reconstructed sample and the second color component reconstructed sample at the third position.

[0354] In embodiments of this application, determining a first color component reconstruction sample and a second color component reconstruction sample indicated by one or more first candidate reference prediction parameters based on a first reference prediction parameter set may include: determining the position of the current block; scaling the position of the current block to determine the position of a first color component region at the same position of the current block; scaling the first candidate reference prediction parameters to determine scaled reference prediction parameters for the first color component region at the same position of the current block; determining a reference block for the first color component based on the position of the first color component region and the scaled reference prediction parameters, and determining a first color component reconstruction sample indicated by the first candidate reference prediction parameters based on the reference block of the first color component; determining a reference block for the second color component based on the position of the current block and the first candidate reference prediction parameters, and determining a second color component reconstruction sample indicated by the first candidate reference prediction parameters based on the reference block of the second color component.

[0355] In this embodiment, 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 scaled reference prediction parameter of the first color component region can also be obtained by scaling the first candidate reference prediction parameter according to a preset sampling format. Here, the preset sampling format can be found in Table 4 above. It should be noted that the scaled reference prediction parameter can be obtained by amplifying the chroma BV; however, considering that the luminance BV may suffer from accuracy loss, the luminance BV obtained by amplifying the chroma BV is not necessarily equal to the original luminance BV (the second candidate reference prediction parameter).

[0356] For example, the current block is a chroma block, and the first color component region at the same position is the corresponding brightness region. To obtain the reference sample value (brightness reference sample) of the first color component, firstly, 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); scale chromaPos according to the color sampling format shown in Table 4 to obtain the position of the corresponding brightness region lumaPos = (xCb, yCb) of the current block.

[0357] For example, obtain the chromaticity BV = (BVChor, BVCver). Scale the chromaticity BV according to the color sampling format shown in Table 4 to obtain the luminance BV = (BVYhor, BVYver) of the corresponding luminance region of the current block. Obtain the position lumaPos = (xCb, yCb) of the corresponding luminance region of the current block, obtain the luminance BV = (BVYhor, BVYver), and find the offset position (xCb + BVYhor, yCb + BVYver) of the corresponding luminance region of the current block, as shown in Figure 16.

[0358] In one specific implementation, after obtaining the luminance sample at the offset position, it can be downsampled to obtain a luminance reference sample. In some embodiments, determining the first color component reconstruction sample indicated by the first candidate reference prediction parameters based on the reference block of the first color component may include: performing downsampling processing on the reference block of the first color component to determine the first color component reconstruction sample indicated by the first candidate reference prediction parameters, so that the resolution of the first color component reconstruction sample is the same as the resolution of the second color component reconstruction sample.

[0359] It should be noted that, in the embodiments of this application, performing downsampling processing on the reference block of the first color component to determine the reconstructed sample of the first color component indicated by the first candidate reference prediction parameter may include: determining the downsampling method of the current block; performing downsampling processing on the reference block of the first color component according to the downsampling method to determine the reconstructed sample of the first color component indicated by the first candidate reference prediction parameter.

[0360] It should also be noted that, in this embodiment, since the resolutions of the luminance and chrominance samples are inconsistent, the luminance samples need to be downsampled to ensure that the resolutions of the downsampled luminance and chrominance samples are the same. Here, to determine the downsampling method for the current block, several sampling methods can be used in competition or a default method can be adopted, including but not limited to the following six sampling methods. For example, assuming the luminance sample before downsampling is recBvBefDownLuma, the width of the storage buffer is iRecRefLumaStride, and the luminance sample after downsampling is recBvAftDownLuma, then the downsampled luminance sample at position (i,j) is:

[0361] Downsampling method 1 (as shown in Figure 17A):

[0362] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]*2

[0363] +recBvBefDownLuma[2*i+1]

[0364] +recBvBefDownLuma[2*i-1]

[0365] +recBvBefDownLuma[2*i+iRecRefLumaStride]*2

[0366] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]

[0367] +recBvBefDownLuma[2*i-1+iRecRefLumaStride]+4)>>3;

[0368] Downsampling method two (as shown in Figure 17B):

[0369] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]

[0370] +recBvBefDownLuma[2*i+1]+1)>>1;

[0371] Downsampling method three (as shown in Figure 17C):

[0372] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]

[0373] +recBvBefDownLuma[2*i+iRecRefLumaStride]+1)>>1;

[0374] Downsampling method four (as shown in Figure 17D):

[0375] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+iRecRefLumaStride]

[0376] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1;

[0377] Downsampling method five (as shown in Figure 17E):

[0378] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+1]

[0379] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1;

[0380] Downsampling method six (as shown in Figure 17F):

[0381] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]

[0382] +recBvBefDownLuma[2*i+1]

[0383] +recBvBefDownLuma[2*i+iRecRefLumaStride]

[0384] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+2)>>2.

[0385] In some embodiments, determining the downsampling method of the current block may include: decoding the bitstream, determining the value of the filter identifier information, and determining the downsampling method of the current block based on the value of the filter identifier information.

[0386] In other words, the decoder can determine the value of the filter identifier information by decoding the bitstream, and thus determine the downsampling method for the current block. The filter identifier information can be represented by `filter_idx`, and its value can be 0, 1, 2, 3, 4, 5, etc. After determining the downsampling method for the current block, downsampling can then be performed to obtain the downsampled luminance reference sample `recBvAftDownLuma` at the corresponding BV position of the luminance region in the current block.

[0387] 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 corresponding BV of the current block.

[0388] In some embodiments, determining a first color component reconstruction sample and a second color component reconstruction sample at a third position of the current block may include: determining a first template of the current block; and determining a first color component reconstruction sample and a second color component reconstruction sample at a third position based on the first template.

[0389] It should be noted that, in the embodiments of this application, the first template includes one or more samples from the adjacent decoded regions of the current block. Accordingly, the type of the first template may include at least one of the following: top template, top-right template, left template, bottom-left template, and top-left template. Specifically, the top template is located in the top-adjacent decoded region of the current block, the top-right template is located in the top-right-adjacent decoded region of the current block, the left template is located in the left-adjacent decoded region of the current block, the bottom-left template is located in the bottom-left-adjacent decoded region of the current block, and the top-left template is located in the top-left-adjacent decoded region of the current block.

[0390] In other words, the first color component reference sample and the second color component reference sample of the current block include not only the first color component reconstruction sample and the second color component reconstruction sample indicated by one or more first candidate reference prediction parameters, but also the first color component reconstruction sample and the second color component reconstruction sample at a third position (e.g., the first template region) of the current block. The third position represents any set position of the current block, which includes, but is not limited to, the adjacent row and the adjacent column of the current block.

[0391] Thus, based on the luminance reference sample recBvAftDownLuma, the chromaticity reference sample recBvChroma, and the reconstructed luminance and chromaticity samples at the third position, a mapping relationship between luminance and chromaticity can be constructed.

[0392] S604, determine the mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value.

[0393] It should be noted that, in one possible implementation, determining the mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value may include: determining a first lookup table based on the first color component reference sample value and the second color component reference sample value, wherein the first lookup table is used to record the value of the second color component corresponding to the index key being the first color component.

[0394] It should also be noted that, in another possible implementation, determining the mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value may include: determining a first discrete model based on the first color component reference sample value and the second color component reference sample value, wherein the first discrete model is used to indicate the mapping relationship between the first color component and the second color component.

[0395] In other words, the mapping relationship here can be a lookup table (LUT). The index key in the lookup table can be the first color component, and the value in the lookup table can be the second color component, i.e., value = LUT[key]. Alternatively, the mapping relationship can also be a discrete model used to represent the mapping relationship between key and value.

[0396] 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: LUT[recBvAftDownLuma[i][j]] = recBvChroma[i][j] (8)

[0397] It should also be noted that in the embodiments of this 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 mapping processing on the first color component reference sample values to make the first color component reference sample values within the preset sample range.

[0398] In the embodiments of this 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 there is no limitation. 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.

[0399] 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].

[0400] 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 values while the first reference values in the first color component reference values are the same, performing an overwrite 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.

[0401] 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 values while the first reference values in the first color component reference values 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.

[0402] In other words, in this embodiment of the application, for different chromaticity values ​​with the same key in the mapping relationship, entries with the same key value can be overwritten sequentially according to the sample order, or an average value can be applied. Additionally, in the mapping relationship, the LUT[] is initialized to -1, i.e., an unusable value. "Overwriting" mainly means that if there are subsequent entries with the same key value, a new value will be used for storage; however, it is not limited to this method. All entries can also be stored and the average value calculated as the value corresponding to that key.

[0403] It is understood that, in the embodiments of this application, the first color component reference sample value and the second color component reference sample value used to construct the mapping relationship can also be obtained in other ways. The following describes several implementation methods by way of example.

[0404] In another specific implementation, the luminance sample is not downsampled; instead, the chrominance sample is upsampled to obtain a chrominance reference sample. In some embodiments, determining the reconstructed sample of the second color component indicated by the first candidate reference prediction parameter based on the reference block of the second color component may include: upsampling the reference block of the second color component to determine the reconstructed sample of the second color component indicated by the first candidate reference prediction parameter, so that the resolution of the reconstructed sample of the first color component is the same as the resolution of the reconstructed sample of the second color component.

[0405] In other words, in this embodiment of the application, after obtaining the reconstructed luminance sample recBvBefDownLuma of the same luminance region, no downsampling is performed. At this time, after obtaining the reconstructed chrominance sample recBvChroma at the BV corresponding to the current block, upsampling is required, including but not limited to linear interpolation, to obtain a reconstructed chrominance sample recBvChromaUp of the same size as the reconstructed luminance sample at BV.

[0406] Thus, the reconstructed luminance sample recBvBefDownLuma at BV is used as the luminance reference sample, and the upsampled reconstructed 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.

[0407] Accordingly, in this embodiment, the predicted value of the second color component of the current block also needs to be downsampled. That is, if the reconstructed chromaticity sample of the current block is upsampled when constructing the mapping relationship, then when predicting the luminance to chromaticity of the current block according to the mapping relationship, the obtained chromaticity prediction value also needs to be downsampled to obtain the final chromaticity prediction value of the current block. The downsampling method includes, but is not limited to, average downsampling.

[0408] In another specific implementation, the method may further include: determining a first template for the current block; and determining a first color component reference sample and a second color component reference sample for the current block based on the first template.

[0409] In this embodiment, the first color component reference value and the second color component reference value used to construct the mapping relationship may further include the first color component reference value and the second color component reference value 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 position as the first template can be determined; then, the first color component reference value can be determined based on the reconstructed samples in the first color component region template; and the second color component reference value can be determined based on the reconstructed samples in the first template. The first template includes one or more reconstructed samples from adjacent decoded regions of the current block.

[0410] For example, a chromaticity reference sample can be obtained based on the current chromaticity template of the current block; after determining the corresponding luminance region template of the current chromaticity template, a luminance reference sample can be obtained based on the corresponding luminance region template. Then, combining the luminance reference sample and chromaticity reference sample obtained in the above embodiments, a mapping relationship between luminance and chromaticity is constructed based on these luminance reference samples and chromaticity reference samples.

[0411] S605, Based on the mapping relationship and the sample value of the first color component of the current block, determine the predicted value of the second color component of the current block.

[0412] It should be noted that, in the embodiments of this 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 position of 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. This can be done by directly using the reconstructed pixel samples of the first color component region as the first color component sample value of the current block, or by filtering the reconstructed pixel samples of the first color component region and using the filtered reconstructed pixel samples as the first color component sample value of the current block; no limitation is made here.

[0413] For example, in this embodiment, the filtering process is a downsampling process. Here, the reconstructed luminance sample recBefDownLuma at the position of the corresponding luminance region lumaPos = (xCb, yCb) of the current block can be obtained. This luminance sample is then 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 undergone sample range mapping processing, then the downsampled reconstructed luminance sample also needs to undergo the same sample range mapping processing to obtain the first color component sample value of the current block.

[0414] 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 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.

[0415] For example, in this embodiment of the application, assuming 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:

[0416] Referring to the luminance value Yc at the same location, the chromaticity prediction value is derived using the mapping relationship (discrete model) established in the aforementioned embodiments.

[0417] In some embodiments, for determining the predicted value of the second color component of the current block, the method may further include: if no first color component value equal to the first color component sample value is found in the mapping relationship, then the first color component sample value is corrected to determine the first color component correction value, and the method continues to search in the mapping relationship for a first color component value equal to the first color component correction value.

[0418] In one specific embodiment, correcting the reconstructed value of the first color component to determine the corrected value of the first color component may include: performing offset calculation on the sample value of the first color component according to one or more preset offset values ​​to determine the corrected value of the first color component.

[0419] In this embodiment, the offset value can be +1, -1, +2, -2, +3, -3, etc., and there is no limitation on the number of offset values ​​or their specific 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, the correction processing is performed in the order of {+1, -1, +2, -2, +3, -3}.

[0420] For example, in the embodiments of this application, if Yc is not found in the input luminance set of the mapping relationship established in the foregoing embodiments, the following processing methods are included but not limited to: correcting Yc in the order of {Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3}, then performing a matching check in the input luminance set based on the corrected Yc, and then determining the value corresponding to the corrected Yc as the chromaticity prediction value of the current block.

[0421] In some embodiments, for determining the predicted value of the second color component of the current block, the method further includes: if no first color component value equal to the first color component correction value is found in the mapping relationship, then the average value of the second color component reference sample is calculated, and the obtained average value is determined as the predicted value of the second color component of the current block.

[0422] For example, in the embodiments of this application, if Yc is not found in the input luminance set of the mapping relationship established in the foregoing embodiments, 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 the mapping relationship cannot match all the above corrected Yc, then the chromaticity prediction value can be set to the average value of the reconstructed chromaticity sample recBvChroma at the corresponding BV.

[0423] In some embodiments, for determining the predicted value of the second color component of the current block, the method further 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; and performing a correction operation on the first initial predicted value to determine the predicted value of the second color component of the current block.

[0424] It should be noted that in the embodiments of this application, the first initial predicted value obtained according to the mapping relationship is corrected. The correction operation here may include clip operation, filtering operation, weighted operation of predicted values ​​obtained with other prediction modes, etc., and there is no limitation on it.

[0425] In one specific embodiment, correcting the first initial prediction value to determine the predicted 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 a first preset mode to determine a second initial prediction value of the second color component of the current block; and performing a weighted calculation on the first initial prediction value and the second initial prediction value to determine the predicted value of the second color component of the current block. It should be noted that, in this embodiment, the first preset mode includes at least one of the following: PLANA mode, DM mode, DC mode, and CCLM mode. That is, correcting the first initial prediction value obtained according to the mapping relationship may include, but is not limited to, weighting it with a CCLM-type mode or other prediction modes to obtain the chromaticity prediction value of the current block.

[0426] In another specific embodiment, correcting 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 to a preset numerical range, or it may also be called a "clip operation". It should be noted that in this embodiment, the lower limit of the preset numerical range is the minimum prediction value (min), and the upper limit of the preset numerical range is the maximum prediction value (max). Specifically, if the first initial prediction value is within the preset numerical range, then the first initial prediction value can be used as the chromaticity prediction value of the current block; if the first initial prediction value is greater than max, then max can be used as the chromaticity prediction value of the current block; if the first initial prediction value is less than min, then min can be used as the chromaticity prediction value of the current block.

[0427] In some embodiments, for determining the predicted value of the second color component of the current block, the method further includes: when the first reference prediction parameter set includes a plurality of first candidate reference prediction parameters, determining a plurality of third initial prediction values ​​of the second color component of the current block; and performing a weighted calculation on the plurality of third initial prediction values ​​to determine the predicted value of the second color component of the current block.

[0428] It should be noted that in the embodiments of this application, if the foregoing embodiments determine multiple BVs (first candidate reference prediction 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 value is used as the chroma prediction value of the current block; or, the weighted prediction value can be further modified, including but not limited to weighting with CCLM-type modes or other prediction modes, to obtain the chroma prediction value of the current block.

[0429] In one specific embodiment, for determining the predicted value of the second color component of the current block, the method may further include: when the first reference prediction parameter set includes multiple first candidate reference prediction parameters, determining a first color component reconstruction sample and a second color component reconstruction sample indicated by each of the multiple first candidate reference prediction parameters; determining multiple mapping relationships between the first color component and the second color component based on the first color component reconstruction samples and the second color component reconstruction samples indicated by each of the multiple first candidate reference prediction parameters; determining multiple third initial prediction values ​​of the second color component of the current block based on the multiple mapping relationships; and performing a weighted calculation on the multiple third initial prediction values ​​to determine the predicted value of the second color component of the current block.

[0430] It should be noted that in this embodiment, multiple blocks of the same luminance region are obtained. The positions of these multiple blocks include, but are not limited to, the following positions, as shown in Figure 11. Multiple blocks can correspond to multiple luminance values ​​(BVs). These multiple luminance BVs each construct their own candidate list for chrominance values ​​(BVCs). The availability of BVs in the candidate list is determined to decide on one or more BVs, or to determine multiple groups of BVs through clustering. For multiple groups of BVs, multiple mapping tables (LUTs) between luminance and chrominance can be established. Thus, multiple initial chrominance prediction values ​​can be obtained based on these multiple mapping tables (LUTs). The chrominance prediction value of the current block can be obtained through weighted calculation.

[0431] In some embodiments, for determining the predicted value of the second color component of the current block, as shown in FIG18, the method may include:

[0432] S1801, when the first color component block of the current block includes multiple candidate blocks, determine the second reference prediction parameter set of the current block; wherein, the second reference prediction parameter set contains multiple second candidate reference prediction parameters.

[0433] S1802, determine multiple first candidate reference prediction parameters based on multiple second candidate reference prediction parameters; and determine multiple candidate mapping relationships between the first color component and the second color component based on the multiple first candidate reference prediction parameters.

[0434] S1803, decode the bitstream and determine the mapping relationship index value.

[0435] S1804, determine the target mapping relationship based on the mapping relationship index value and multiple candidate mapping relationships.

[0436] S1805, Based on the target mapping relationship and the sample value of the first color component of the current block, determine the predicted value of the second color component of the current block.

[0437] It should be noted that in this embodiment, 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 region are obtained, and the positions of these blocks include, but are not limited to, the following positions, as shown in Figure 11. These multiple blocks can correspond to multiple luminance BVs. These multiple luminance BVs respectively construct their own candidate lists for chrominance BVCs. The availability of BVs in the candidate lists is determined to decide on one or more BVs, or to determine multiple groups of BVs through clustering. Each available chrominance BVC of these multiple blocks can establish a mapping table (LUT). At the decoding end, the mapping relationship index value can be determined by decoding the corresponding syntax elements. Then, based on the mapping relationship index value, the target mapping relationship can be determined, thereby determining the chrominance prediction value of the current block. It should be noted that the number of mapping relationships established here can be arbitrarily set, for example, it can be set to 4, but there is no limitation.

[0438] In some embodiments, for determining the predicted value of the second color component of the current block, as shown in FIG19, the method may include:

[0439] S1901, when the first color component block of the current block includes multiple candidate blocks, determine the second reference prediction parameter set of the current block; wherein, the second reference prediction parameter set contains multiple second candidate reference prediction parameters.

[0440] S1902, based on multiple second candidate reference prediction parameters, determine multiple first candidate reference prediction parameters; and based on the multiple first candidate reference prediction parameters, determine multiple candidate mapping relationships between the first color component and the second color component.

[0441] S1903, based on template matching, calculates the matching error of multiple candidate mapping relationships to determine the second-generation value of each of the multiple candidate mapping relationships.

[0442] S1904, determine the minimum generation value from the second generation values ​​of multiple candidate mapping relationships, and determine the candidate mapping relationship corresponding to the minimum generation value as the target mapping relationship.

[0443] S1905, Based on the target mapping relationship and the sample value of the first color component of the current block, determine the predicted value of the second color component of the current block.

[0444] In one specific embodiment, calculating the matching error of multiple candidate mapping relationships based on template matching to determine the second-generation value of each candidate mapping relationship may include: determining a first template for the current block; determining the reconstructed pixel sample value of a first color component region template at the same position as the first template; determining the predicted value of the second color component of the first template under the multiple mapping relationships based on the multiple candidate mapping relationships and the reconstructed pixel sample value of the first color component region template; and calculating the cost based on the reconstructed value of the second color component of the first template and the predicted value of the second color component of the first template under the multiple mapping relationships to determine the second-generation value of each candidate mapping relationship.

[0445] It should be noted that in this embodiment, multiple mapping tables (LUTs) between luminance and chrominance can be established, and then a template is used to select which mapping table LUT to use. For example, multiple blocks of the same luminance region are obtained, and the positions of these blocks include, but are not limited to, the following positions, as shown in Figure 11. These multiple blocks can correspond to multiple luminance values ​​(BVs). Each of these luminance BVs constructs its own candidate list for chrominance values ​​(BVCs). The availability of BVs in the candidate list is determined to decide on one or more BVs, or multiple groups of BVs can be determined through clustering. Each available chrominance BVC of these multiple blocks can establish a mapping table LUT. The current block template is predicted using different mapping table LUTs, and the difference is calculated with the reconstructed value of the template to determine which mapping relationship to use. Then, the final determined mapping relationship 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 arbitrarily set, for example, it can be set to 4, but there is no limitation.

[0446] In one specific embodiment, the process of performing LUT prediction on the current block template is as follows:

[0447] Obtain the reconstructed luminance sample recBefDownLumaR at the position of the luminance region template lumaPos=(xCbR,yCbR) corresponding to the current block template. Downsample this luminance sample to obtain the downsampled reconstructed luminance sample recAftDownLumaR. Then, perform mapping processing on this sample within the same sample range.

[0448] Assuming the predicted value of the current block template is predSamplesR, then for predSamplesR[cIdx][x][y], the variable cIdx specifies the color component index of the current block. The prediction method is to 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: checking in the order of {Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3}. If none of the above values ​​can be matched in the mapping relationship, then the chromaticity predicted value of the current block is set to the average value of the reconstructed chromaticity sample recBvChroma at the corresponding BV.

[0449] When calculating costs for the current block template and the template prediction values ​​for each LUT, the template usage can be categorized into the following scenarios:

[0450] The first scenario: Both the top and left templates of the current block exist, in which case both the top and left templates are available.

[0451] The second type: only the top template exists in the current block, in which case only the top template is available.

[0452] The third type: only the left template exists in the current block, in which case only the left template is available.

[0453] The fourth type: If neither the template on the current block nor the template on the left exists, the final LUT selected will be the first LUT created or a LUT at a specified position.

[0454] For example, in this embodiment of the application, assuming the reconstruction value of the current block template is recSamplesR, there are multiple choices for the cost function to calculate the cost of the template region. For example, evaluation criteria such as Sum of Absolute Errors (SAD), Sum of Transformed Absolute Errors (SATD), Sum of Squared Differences (SSE), Mean Absolute Difference (MAD), Mean Absolute Error (MAE), and Mean Squared Error (MSE) can be selected. Any of the evaluation criteria mentioned below can be chosen from the above criteria. Taking the SAD evaluation criterion as an example, the calculation formula is as follows:

[0455] Where predTempSizeW is the width of the template, predTempSizeH is the height of the template, predSamplesR[i][j] is the predicted pixel of the current block template after LUT, and recSamplesR[i][j] is the reconstructed pixel of the current block template.

[0456] It should also be noted that, in this embodiment, when selecting the final LUT using the current block template, except for cases where the cost cannot be calculated, the cost of each candidate LUT 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, and bucket sort. The candidate LUT with the lowest cost is selected as the final LUT used.

[0457] In some embodiments, after determining the predicted value of the second color component of the current block, the method may further include: decoding the bitstream to determine the residual value of the second color component of the current block; and determining the reconstructed value of the second color component of the current block based on the residual value and the predicted value.

[0458] It should be noted that, in the embodiments of this application, determining the reconstructed value of the second color component of the current block may include: performing an addition operation based on the residual value and the predicted value to obtain the reconstructed value of the second color component of the current block.

[0459] In some embodiments, the method further includes: determining a first color component region at the same location of the current block; if the current block uses DM mode and the first color component region is predicted based on the block vector, then determining that the current block uses a first prediction mode.

[0460] It should be noted that, in the embodiments of this application, the first color component region at the same position of the current block is determined; if the current block uses DM mode and the first color component region is predicted based on the block vector, then the current block is determined to use the first prediction mode.

[0461] For example, in the embodiments of this application, under dual-tree partitioning and DM mode, if the corresponding luminance region has BV information, the current block is predicted using the first prediction mode (BVG-LUT mode). For example:

[0462] If CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] equals MODE_IBC, and intra_bvglut_flag is set to 1, then the chroma intra-prediction mode IntraPredModeC[xCb][yCb] uses BVG-LUT.

[0463] If CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] equals MODE_INTRA, and if IntraTmpFlag[xCb+cbWidth / 2][yCb+cbHeight / 2] equals 1, then set intra_bvglut_flag = 1, and the chroma intra-prediction mode IntraPredModeC[xCb][yCb] uses BVG-LUT.

[0464] In this embodiment, the first syntax element can be used to indicate whether the current block uses the BVG-LUT mode. The first syntax element can be represented by intra_bvgplt_flag or bvgplt_flag. The chroma prediction mode is derived as follows:

[0465] The chroma intra-prediction mode IntraPredModeC[xCb][yCb] uses cclm_mode_flag, cclm_mode_idx, intra_chroma_pred_mode, lumaIntraPredMode, and lumaTempPredMode as specified in the table below. These filler items, other than BVG-LUT modes, are provided as examples of corresponding values ​​and are not required to be filled in with these values. Table 9 shows an example of chroma prediction mode derivation. As shown in Table 9, 0 represents Planar mode, 1 represents DC mode, 18 represents horizontal mode, 50 represents vertical mode, and 81-83 represent CCLM mode.

[0466] Table 9

[0467] As shown in Table 9, in DM mode, if intra_bvglut_flag == 1, that is, the information obtained from the center position block of the same luminance region contains BV, then the chroma intra-prediction mode IntraPredModeC[xCb][yCb] uses the BVG-LUT mode.

[0468] In some embodiments, the method further includes: determining the value of a second syntax element; and when the second syntax element indicates that the current block is allowed to use a first prediction mode, performing the step of determining the prediction parameters of the current block.

[0469] It should be noted that, in the embodiments of this application, the second syntax element can be represented by BvglutEnabled. If the value of the second syntax element is a first value, then the second syntax element indicates that the current block is allowed to use the first prediction mode; if the value of the second syntax element is a second value, then the second syntax element indicates that the current block is not allowed to use the first prediction mode.

[0470] It should also be noted that, in the embodiments of this application, the first value and the second value are different. The first value and the second value can be in parameter form or in numeric form. Specifically, both the first syntax element and the second syntax element can be parameters written in the profile, or the value of a flag / identifier; no limitations are imposed here.

[0471] For example, the first value can be set to 1 and the second value can be set to 0; or, the first value can be set to 0 and the second value can be set to 1; or, the first value can be set to true and the second value can be set to false; or, the first value can be set to false and the second value can be set to true. In this embodiment of the application, the first value can be set to 1 and the second value can be set to 0, but there is no limitation on this.

[0472] For example, in this embodiment of the application, if the syntax element sps_ibc_enabled_flag is equal to 0 and sps_intratmp_enabled_flag is equal to 0, then BvglutEnabled is equal to 0. Otherwise, the variable ModeIncludeBv is set; if the corresponding luma block is not encoded in a mode with BV information, then ModeIncludeBv is equal to 0; otherwise, ModeIncludeBv is equal to 1.

[0473] In one possible implementation, BvglutEnabled equals 1 if multiple of the following conditions are true simultaneously (including but not limited to the following):

[0474] ModeIncludeBv equals 1;

[0475] sh_slice_type equals I-frame;

[0476] CtbLog2SizeC is less than or equal to MaxChromaIbcSize; where MaxChromaIbcSize can be determined based on the chromaticity CTU size or a preset value.

[0477] In another possible implementation, BvglutEnabled equals 1 if multiple of the following conditions are true simultaneously (including but not limited to the following):

[0478] ModeIncludeBv equals 1;

[0479] CtbLog2SizeC is less than or equal to MaxChromaIbcSize; where MaxChromaIbcSize can be determined based on the chromaticity CTU size or a preset value.

[0480] In another possible implementation, BvglutEnabled equals 1 if multiple of the following conditions are true simultaneously (including but not limited to the following conditions):

[0481] CtbLog2SizeC is less than or equal to MaxChromaIbcSize; where MaxChromaIbcSize can be determined based on the chromaticity CTU size or a preset value.

[0482] For each possible implementation, BvglutEnabled is equal to 0; otherwise, BvglutEnabled is equal to 0. Here, if BvglutEnabled is equal to 0, then the value of the first syntax element can be inferred to be 0.

[0483] It should also be noted that, in the embodiments of this application, the prediction mode for the current block can also be determined at the encoding end by competing with other modes based on the BVG-LUT mode. In DM mode, in addition to the BVG-LUT mode, it can also compete with other modes. The final mode used is determined based on the template cost. For example, instead of directly using the BV obtained from luminance, it can directly use BV replication, or it can use the BVG-LUT mode defined in the embodiments of this application. After both modes are applied to the template of the current block, the one with the lower template cost is selected as the prediction mode for the current block.

[0484] This embodiment provides a decoding method that determines the prediction parameters of the current block; determines a first reference prediction parameter set for the current block based on the prediction parameters; wherein the first reference prediction parameter set includes one or more first candidate reference prediction parameters; determines a first color component reference sample and a second color component reference sample for the current block based on the first reference prediction parameter set; determines 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 the predicted value of the second color component of the current block based on the mapping relationship and the first color component sample of the current block. Thus, if the current block uses BVG-LUT mode, the first reference prediction parameter set for the applied chroma component can be determined, and the luminance component reference sample and chroma component reference sample of the current block can be determined based on the first reference prediction parameter set, thereby establishing a mapping relationship between the luminance component and the chroma component, and then using this mapping relationship to predict the chroma component. In other words, this method fully utilizes the correlation between the reconstructed samples and the current block samples in the current image, improving the uniqueness of chromaticity prediction and thus enhancing the accuracy of chromaticity prediction. Moreover, based on the established mapping relationship, pixel-level prediction can be effectively performed, thereby further saving bitrate, improving encoding and decoding efficiency, and ultimately enhancing encoding and decoding performance.

[0485] In another embodiment of this application, FIG20 is a schematic flowchart of an encoding method provided by an embodiment of this application. As shown in FIG20, the method may include:

[0486] S2001, Determine the prediction parameters for the current block.

[0487] It should be noted that the encoding method in this application embodiment is applied to an encoder. Furthermore, this encoding method specifically refers to an intra-frame prediction method, and more specifically, a block vector-based chroma prediction method. The video image can be divided into multiple coded blocks, each of which may include a first color component, a second color component, and a third color component. In this application embodiment, the current block refers to the coded block in the video image currently undergoing chroma prediction.

[0488] Here, if the current block predicts the first color component, and the first color component is the luminance component, then the current block can also be called a luminance block; or, if the current block predicts the second color component, and the second color component is the chrominance component, then the current block can also be called a chrominance block.

[0489] It should also be noted that, in the embodiments of this application, the prediction parameters can be used to indicate whether the current block uses a first prediction mode. In some embodiments, the method may include: determining a first-generation value for the current block using the first prediction mode, and determining a second-generation value for the current block not using the first prediction mode; and determining prediction parameters based on the first-generation value and the second-generation value.

[0490] In one specific embodiment, determining the prediction parameter based on the first generation value and the second generation value may include: if the first generation value is less than the second generation value, then determining the prediction parameter to indicate that the current block uses the first prediction mode; if the first generation value is greater than the second generation value, then determining the prediction parameter to indicate that the current block does not use the first prediction mode.

[0491] In some embodiments, the method may further include: determining the value of a first syntax element based on prediction parameters; encoding the value of the first syntax element; and writing the obtained encoded bits into a bitstream.

[0492] It should be noted that, in the embodiments of this application, determining the value of the first syntax element based on the prediction parameters may include: if the prediction parameters indicate that the current block uses the first prediction mode, then the value of the first syntax element is determined to be a first value; if the prediction parameters indicate that the current block does not use the first prediction mode, then the value of the first syntax element is determined to be a second value.

[0493] It should also be noted that, in the embodiments of this application, if the current block uses the first prediction mode, the prediction parameter is determined to be a first value; if the current block does not use the first prediction mode, the prediction parameter is determined to be a second value. Here, the method may further include: setting the value of the prediction parameter to be equal to the value of the first syntax element.

[0494] It should also be noted that, in the embodiments of this application, the first syntax element can be represented by intra_bvglut_flag, or it can also be represented by bvglut_flag. The first syntax element can be used to indicate whether the current block uses the first prediction mode. Here, if the value of the first syntax element is the first value, it is determined that the current block uses the first prediction mode; if the value of the first syntax element is the second value, it is determined that the current block does not use the first prediction mode.

[0495] It is understood that in the embodiments of this application, the first value and the second value are different. Specifically, the first value can be set to 1 and the second value can be set to 0; or, the first value can be set to 0 and the second value can be set to 1; or, the first value can be set to true and the second value can be set to false; or, the first value can be set to false and the second value can be set to true.

[0496] In one specific embodiment, the first value is set to 1 and the second value is set to 0. For example, if the value of the first syntax element is 1, it indicates that the prediction parameter indicates that the current block uses the first prediction mode, and the encoding method of this embodiment continues to be executed; otherwise, if the value of the first syntax element is 0, it indicates that the prediction parameter indicates that the current block does not use the first prediction mode, and other prediction modes in related technologies (such as PLANA mode, CCLM mode, angle prediction mode, etc.) can be used for encoding processing.

[0497] S2002, Based on the prediction parameters, determine the first reference prediction parameter set for the current block; wherein, the first reference prediction parameter set contains one or more first candidate reference prediction parameters.

[0498] It should be noted that, in the embodiments of this application, when the prediction parameters indicate that the current block uses a first prediction mode, a first reference prediction parameter set for the current block is determined. The first prediction mode can be a BVG-LUT mode. That is, for the current block, if the current block uses the BVG-LUT mode, then the first reference prediction parameter set for the current block can be determined.

[0499] In some embodiments, determining a first reference prediction parameter set for the current block may include: determining a first color component block for the current block; determining a second reference prediction parameter set for the current block based on the first color component block; and determining a first reference prediction parameter set for the current block based on the second reference prediction parameter set.

[0500] It should be noted that, in the embodiments of this application, the first reference prediction parameter set may include one or more first candidate reference prediction parameters. The first candidate reference prediction parameters may be vector parameters based on the second color component.

[0501] It should also be noted that, in the embodiments of this application, the second reference prediction parameter set may include one or more second candidate reference prediction parameters. These second candidate reference prediction parameters may be vector parameters based on the first color component.

[0502] For example, the first color component can be a luminance component, and the second color component can be a chrominance component. Then, the first candidate reference prediction parameter can be a vector parameter based on the chrominance component, and the second candidate reference prediction parameter can be a vector parameter based on the luminance component.

[0503] In some embodiments, the vector parameters include one of the following: block vector parameters and motion vector parameters. That is, both the first reference prediction parameter set and the second reference prediction parameter set can be a parameter list applied to BV, or a parameter list applied to MV.

[0504] In a specific embodiment, taking BV as an example, the "first reference prediction parameter" can be a block vector parameter based on the chromaticity component, and the first reference prediction parameter set can be called the chromaticity BVC candidate list; the "second reference prediction parameter" can be a block vector parameter based on the luminance component, and the second reference prediction parameter set can be called the luminance BVL candidate list.

[0505] In some embodiments, determining a first color component block of the current block may include: determining a first color component region at the same location of the current block; and determining a first color component block of the current block based on a plurality of partitioned blocks of the first color component region.

[0506] It should be noted that, in the embodiments of this application, if the first color component is a luminance component, then the region of the first color component can also be called a "corresponding luminance region". For example, if the current block is a chroma block, then the corresponding luminance region can refer to the luminance region at the same position corresponding to the current block. For the current block, the first color component region at the same position can be divided into blocks, for example, by using a binary tree structure, ternary tree structure, quadtree structure, etc., to obtain multiple blocks. Each block can 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 partitioned blocks.

[0507] For example, taking Figure 3 as an example, the area filled with diagonal lines represents the corresponding luminance region of the chromaticity component. This corresponding luminance region can be divided into multiple blocks; the block at the center of these blocks can be selected as the corresponding luminance block of the current block. For example, the block filled with black in Figure 3 is the corresponding luminance block (first color component block) of the current block.

[0508] In one specific embodiment, for determining the first color component block of the current block, the method may include: determining a first candidate block at a first position from a plurality of partitioned blocks; and determining the first color component block of the current block based on the first candidate block at the first position.

[0509] In this embodiment, the first position can refer to any position within the first color component region. For example, the first position can be the center position, the upper left corner position, the lower right corner position, or a specific position within the first color component region.

[0510] In the embodiments of this application, the first candidate block may refer to the block located at the first position. In a specific embodiment, the block located at the center of the first color component region is selected as the first candidate block; and / or, the block located at the upper left corner of the first color component region is selected as the first candidate block; and / or, the block located at the lower right corner of the first color component region is selected as the first candidate block, etc., without any limitation.

[0511] Furthermore, in some embodiments, the method of determining the first color component block of the current block based on the first candidate block at the first position may include: performing a position offset search in a preset search area at the first position to determine a plurality of second candidate blocks; and determining the first color component block of the current block based on the first candidate block and / or the plurality of second candidate blocks.

[0512] In this embodiment of the application, the position offset search is performed in the preset search area of ​​the first position. This can be to search for multiple positions in the directions such as upper left, upper, and left based on the first position. For example, the coordinate offsets of the first position to the upper left (xOffset, yOffset) = (-2, -2), to the upper left (xOffset, yOffset) = (0, -2), and to the left (xOffset, yOffset) = (-2, 0) can be obtained. No limitation is made here.

[0513] 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 position information of the corresponding region of the current block; determining the target position information according to the position information of the corresponding region, and taking the candidate block containing the target position information as the first color component block of the current block.

[0514] In some embodiments, determining the target location information based on the location information of the corresponding region may include: calculating the center position based on the location information of the corresponding region and using the obtained center position information as the target location information; or, calculating the upper left corner position based on the location information of the corresponding region and using the obtained upper left corner position information as the target location information; or, calculating the lower right corner position based on the location information of the corresponding region and using the obtained lower left corner position information as the target location information.

[0515] In this embodiment of the application, the preset sampling format can 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 corresponding region is shown in Table 4.

[0516] In one possible implementation, the position of the current block is obtained, that is, the position of the top left chroma sample of the current block relative to the top left chroma sample of the current image, chromaPos=(x,y). The chromaPos is scaled according to the chroma sampling format shown in Table 4 to obtain the position of the corresponding luminance region of the current block, lumaPos=(xCb,yCb).

[0517] Here, assuming the position of the corresponding brightness pixel at the top left corner of the current block relative to the top left corner brightness pixel of the image is (xCb, yCb), and the width of the corresponding brightness region (i.e., the entire diagonally filled area of ​​the brightness component in Figure 3) is cbWidth, and the height is cbHeight; then the block at the center (the center block of the brightness region) is the brightness block containing the center coordinates (xCb+cbWidth>>1, yCb+cbHeight>>1), which is the block filled with black in Figure 3. In Figure 3, the small white blocks represent the center coordinates, which can be used to locate the position of this brightness block.

[0518] Here, for multiple second candidate blocks, multiple positions can be searched to the upper left, upper, and left from the position of the luminance block, including but not limited to the following exemplary search positions: obtaining the upper left coordinate offset (xOffset, yOffset) = (-2, -2), the upper coordinate offset (xOffset, yOffset) = (0, -2), and the left coordinate offset (xOffset, yOffset) = (-2, 0) from the center position of the luminance region. The luminance block used for the luminance region is the luminance block containing the position coordinates (xCb + cbWidth >> 1 + xOffset, yCb + cbHeight >> 1 + yOffset).

[0519] In another possible implementation, the position of the current block is obtained, that is, the position of the top left chroma sample of the current block relative to the top left chroma sample of the current image, chromaPos=(x,y). The chromaPos is scaled according to the chroma sampling format shown in Table 4 to obtain the position of the corresponding luminance region of the current block, lumaPos=(xCb,yCb).

[0520] Here, assuming the position of the corresponding brightness pixel at the top left corner of the current block relative to the top left corner brightness pixel of the image is (xCb, yCb), and the width of the corresponding brightness region (i.e., the entire diagonally filled area of ​​the brightness component in Figure 9) is cbWidth, and the height is cbHeight; then the block at the top left corner (the top left corner block of the brightness region) is the brightness block containing the top left corner coordinates (xCb, yCb), which is the block filled with black in Figure 9. In Figure 9, the small white blocks represent the position of the top left corner coordinates, which can be used to locate the position of this brightness block.

[0521] Here, for multiple second candidate blocks, multiple positions can be searched to the upper left, upper, and left from the position of the luminance block, including but not limited to the following exemplary search positions: obtaining the upper left coordinate offset (xOffset, yOffset) = (-2, -2), the upper coordinate offset (xOffset, yOffset) = (0, -2), and the left coordinate offset (xOffset, yOffset) = (-2, 0) from the upper left corner position of the luminance region. The luminance block used for the luminance region is the luminance block containing the position coordinates (xCb + xOffset, yCb + yOffset).

[0522] In another possible implementation, the position of the current block is obtained, that is, the position of the top left chroma sample of the current block relative to the top left chroma sample of the current image, chromaPos=(x,y). chromaPos is scaled according to the chroma sampling format shown in Table 4 to obtain the position of the corresponding luminance region of the current block, lumaPos=(xCb,yCb).

[0523] Here, assuming the position of the corresponding brightness pixel at the top left corner of the current block relative to the top left corner brightness pixel of the image is (xCb, yCb), and the width of the corresponding brightness region (i.e., the entire diagonally filled area of ​​the brightness component in Figure 10) is cbWidth, and the height is cbHeight; then the block at the bottom right corner (the bottom right corner block of the brightness region) is the brightness block containing the bottom right corner coordinates (xCb+cbWidth-1, yCb+cbHeight-1), which is the block filled with black in Figure 10. In Figure 10, the small white block represents the position of the bottom right corner coordinates, which can be used to locate the position of this brightness block.

[0524] Here, for multiple second candidate blocks, multiple positions can be searched to the upper left, upper, and left from the position of the luminance block, including but not limited to the following exemplary search positions: obtaining the upper left coordinate offset (xOffset, yOffset) = (-2, -2), the upper coordinate offset (xOffset, yOffset) = (0, -2), and the left coordinate offset (xOffset, yOffset) = (-2, 0) from the lower right corner of the luminance region. The luminance block used for the luminance region is the luminance block containing the position coordinates (xCb + cbWidth - 1 + xOffset, yCb + cbHeight - 1 + yOffset).

[0525] In other words, in this embodiment, the first candidate block for the first color component block can be any block among the multiple blocks shown in Figure 3. For example, the block at the center of the same brightness region as shown in Figure 3 (the block filled with black), the block at the upper left corner of the same brightness region as shown in Figure 9 (the block filled with black), the block at the lower right corner of the same brightness region as shown in Figure 10 (the block filled with black), or even the block at the upper right corner, the lower left corner, or even the block at the center of the upper left region, etc., without any limitation. Furthermore, based on the first candidate block, multiple positions can be searched to the upper left, upper, and left to obtain multiple second candidate blocks. Then, based on the first candidate block and / or multiple second candidate blocks, the first color component block of the current block can be determined.

[0526] In some embodiments, the method may further include: determining at least one candidate block at a preset position from a plurality of partitioned blocks of the first color component region; and determining the first color component block of the current block based on the at least one candidate block.

[0527] In this embodiment, at least one candidate block can be used as the first color component block of the current block. That is, the first color component block can be at least one candidate block obtained sequentially. For example, as shown in Figure 11, this includes five luminance pixel positions (CUs): C, TL, TR, BL, and BR. However, this embodiment is not limited to five positions and can have multiple different positions; nor is it limited to the five positions shown in Figure 11, and no limitation is made in any way.

[0528] In another possible implementation, taking the block containing five brightness pixel positions shown in Figure 11 as an example, the pixels can be acquired sequentially in a preset order, which includes, but is not limited to, the following order: C->TL->TR->BL->BR.

[0529] For the detailed 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 corner color sample of the current block relative to the upper left corner color sample of the current image, chromaPos = (x, y). According to the chroma sampling format shown in Table 4, chromaPos is scaled to obtain the position of the corresponding brightness region of the current block, lumaPos = (xCb, yCb).

[0530] Here, we assume that the position of the corresponding luminance pixel at the top left corner of the current block relative to the luminance pixel at the top left corner of the image (i.e., the position of luminance pixel TL) is (xCb, yCb), and the width of the corresponding luminance region (i.e., the entire diagonal filled region of the luminance component in Figure 11) corresponding to the current chroma coding block is cbWidth, and the height is cbHeight.

[0531] The coordinates of the position of the brightness pixel C are (xCb+cbWidth / 2, yCb+cbHeight / 2);

[0532] The coordinates of the position of the brightness pixel TL are (xCb, yCb);

[0533] The coordinates of the position of the luminance pixel TR are (xCb+cbWidth-1,yCb);

[0534] The coordinates of the position of the luminance pixel BL are (xCb, yCb+cbHeight-1);

[0535] The coordinates of the position of the luminance pixel BR are (xCb+cbWidth-1, yCb+cbHeight-1).

[0536] Here, when searching for each location, multiple locations can be searched to the upper left, upper, and left from that location, including but not limited to the following exemplary search locations: obtaining the upper left coordinate offset (xOffset, yOffset) = (-2, -2), the upper coordinate offset (xOffset, yOffset) = (0, -2), and the left coordinate offset (xOffset, yOffset) = (-2, 0) for this location. The luminance block used for the luminance area is a luminance block that contains the coordinates of this location plus the coordinates of the aforementioned offset locations.

[0537] Therefore, for the current block, it is first necessary to determine the corresponding first color component block. For example, when the first color component is the luminance component, it is necessary to determine the corresponding luminance block of the current block. Specifically, one or more corresponding luminance blocks can be determined using the several possible implementation methods described above.

[0538] It is understood that after determining the first color component block, a second reference prediction parameter set for the current block can be constructed. In some embodiments, the method may include: determining one or more candidate vector parameters based on the first color component block; and determining the second reference prediction parameter set for the current block based on the one or more candidate vector parameters based on the first color component.

[0539] It should be noted that, in the embodiments of this application, determining the second reference prediction parameter set of the current block based on one or more candidate vector parameters based on the first color component may include: adjusting the candidate vector parameters based on the first color component to determine the candidate vector parameters based on the second color component; when the candidate vector parameters based on the second color component meet the preset availability conditions, the candidate vector parameters based on the first color component are used as the second candidate reference prediction parameters and added to the second reference prediction parameter set.

[0540] Here, taking the block vector parameter BV as an example, assuming the current block is a chroma block and the first color component block is a luma block, then the candidate vector parameter based on the first color component can be the BV of the luma block, i.e., BVL; the candidate vector parameter based on the second color component can be the BV of the chroma block, i.e., BVC.

[0541] It should also be noted that, in the embodiments of this application, assuming that the candidate vector parameter based on the first color component is luminance BV = (BVLhor, BVLver) and the candidate vector parameter based on the second color component is chrominance BV = (BVChor, BVCver), then the corresponding chrominance BV can be determined by adjusting BVL (luminance BV).

[0542] In one specific embodiment, adjusting the candidate vector parameters based on the first color component to determine the candidate vector parameters based on the second color component may include: determining a preset sampling format for the current block; scaling the candidate vector parameters based on the first color component according to the preset sampling format to determine the candidate vector parameters based on the second color component.

[0543] It should be noted that, in the embodiments of this application, the above adjustments may include scaling processing according to a preset sampling format. The preset sampling format can be the mapping relationship between luminance BV and scaled chrominance BV shown in Table 8. Here, the preset format can refer to a color sampling format, such as monochrome, 4:2:0, 4:2:2, 4:4:4, etc. The syntax element `sps_chroma_format_idc` is used to indicate the type of color sampling format, specifically the chrominance sampling format. Different types of color sampling formats correspond to different scaling operations.

[0544] For example, if the value of sps_chroma_format_idc is 0, then the color sampling format is determined to be monochrome, that is, the chroma BV parameter (BVC) does not exist. hor BVC horIf the value of `sps_chroma_format_idc` is 1, then the color sampling format is determined to be 4:2:0. In this case, the mapping relationship between luminance (BV) and chrominance (BV) is: BVC hor =BVL hor >>1, BVC hor =BVL ver >>1; If the value of sps_chroma_format_idc is 2, then the color sampling format is determined to be 4:2:2. In this case, the mapping relationship between luminance BV and chrominance BV is: BVC hor =BVL hor >>1, BVC hor =BVL ver If the value of `sps_chroma_format_idc` is 3, it indicates that the color sampling format is 4:4:4. In this case, the mapping relationship between luminance (BV) and chrominance (BV) is: BVC hor =BVL hor BVC hor =BVL ver .

[0545] Thus, based on Table 8, the candidate BVL can be scaled according to the color sampling format to obtain a scaled BVC; then, it can be determined whether the scaled BVC meets the preset usability conditions. The scaled BVC meeting the preset usability conditions includes, but is not limited to:

[0546] The offset position indicated by the scaled BVC does not exceed the image boundary;

[0547] The offset position indicated by the scaled BVC does not exceed the slice boundary;

[0548] The current block is not covered by the offset indicated by the scaled BVC;

[0549] The offset position indicated by the scaled BVC does not exceed the preset available area;

[0550] The offset position indicated by the scaled BVC has been reconstructed.

[0551] It should also be noted that, in the embodiments of this application, one or more candidate vector parameters (i.e., one or more candidate BVLs) based on the first color component block are scaled. Specifically, if a candidate BVL is scaled based on the color sampling format shown in Table 8, and the scaled BVL meets preset usability conditions, then this candidate BVL can be used as a second candidate reference prediction parameter and added to the second reference prediction parameter set to construct the second reference prediction parameter set. The second reference prediction parameter set may contain one or more second candidate reference prediction parameters.

[0552] It can also be understood that after constructing the second reference prediction parameter set, the first reference prediction parameter set for the current block can be further determined. In some embodiments, the method may include: adjusting one or more second candidate reference prediction parameters in the second reference prediction parameter set to determine a first candidate reference prediction parameter corresponding to each of the one or more second candidate reference prediction parameters; and determining the first reference prediction parameter set for the current block based on the first candidate reference prediction parameters corresponding to each of the one or more second candidate reference prediction parameters.

[0553] It should be noted that in the embodiments of this application, the number of first candidate reference prediction parameters and second candidate reference prediction parameters is the same. That is, for each second candidate reference prediction parameter, it can be adjusted to obtain one or more first candidate reference prediction parameters, and then a usable first candidate reference prediction parameter is determined from them. However, it should be noted that the number of first candidate reference prediction parameters and second candidate reference prediction parameters can also be different. In this case, each second candidate reference prediction parameter can determine more than one usable first candidate reference prediction parameter, which is not limited here.

[0554] In some embodiments, one or more second candidate reference prediction parameters in the second reference prediction parameter set are adjusted to determine a first candidate reference prediction parameter corresponding to each of the one or more second candidate reference prediction parameters. Taking one of the second candidate reference prediction parameters as an example, the method may include: adjusting the second candidate reference prediction parameters to determine a third reference prediction parameter set based on the second color component; and determining the first candidate reference prediction parameter corresponding to the second candidate reference prediction parameter according to the third reference prediction parameter set.

[0555] In the embodiments of this application, for each second candidate reference prediction parameter, the corresponding first candidate reference prediction parameter can be determined in this way to obtain the first reference prediction parameter set.

[0556] For example, assuming the current block is a chroma block and the first color component block is a luma block, then the first candidate reference prediction parameter can be a candidate BV (Browser Vector Value) for the chroma block, i.e., a candidate BVC; the second candidate reference prediction parameter can be a candidate BV (Browser Vector Value) for the luma block, i.e., a candidate BVL. Adjusting the second candidate reference prediction parameter can determine one or more candidate vector parameters based on the second color component, i.e., one or more candidate BVCs, which can construct a third reference prediction parameter set.

[0557] It is understood that, in the embodiments of this application, assuming that the second candidate reference prediction parameter is luminance BV = (BVLhor, BVLver) and the candidate vector parameter based on the second color component is chrominance BV = (BVChor, BVCver), then a chrominance BVC candidate list containing one or more candidate block vector parameters can be constructed by adjusting BVL (luminance BV) or BVC (chrominance BV).

[0558] In one possible implementation, adjusting the second candidate reference prediction parameters to determine a third reference prediction parameter set based on the second color component may include: scaling the second candidate reference prediction parameters according to a preset sampling format of the current block, determining candidate vector parameters based on the second color component, and adding the candidate vector parameters based on the second color component to the third reference prediction parameter set.

[0559] It should be noted that, in the embodiments of this application, the above adjustments may include scaling processing according to a preset sampling format. The preset sampling format may be the mapping relationship between the luminance BV and the scaled chrominance BV shown in Table 8. Here, the preset format can refer to a color sampling format, such as monochrome, 4:2:0, 4:2:2, 4:4:4, etc. Thus, scaling can be performed according to the color sampling format shown in Table 8, and the scaled BVC can be added as a candidate vector parameter to the third reference prediction parameter set.

[0560] In another possible implementation, adjusting the second candidate reference prediction parameters to determine a third reference prediction parameter set based on the second color component may include: scaling the second candidate reference prediction parameters according to a preset sampling format of the current block to determine a first initial vector parameter based on the second color component; performing offset calculations on the first initial vector parameter based on the second color component according to one or more offset values ​​to determine one or more candidate vector parameters based on the second color component, and adding one or more candidate vector parameters based on the second color component to the third reference prediction parameter set.

[0561] In another possible implementation, adjusting the second candidate reference prediction parameters to determine a third reference prediction parameter set based on the second color component may include: performing offset calculations on the second candidate reference prediction parameters according to one or more offset values ​​to determine one or more second initial vector parameters based on the first color component; scaling the one or more second initial vector parameters based on the first color component according to the preset sampling format of the current block to determine one or more candidate vector parameters based on the second color component; and adding the one or more candidate vector parameters based on the second color component to the third reference prediction parameter set.

[0562] It should be noted that, in the embodiments of this application, the above one or more offset values ​​can be any number of arbitrary values, such as -1, +1, -2, +2, -3, +3, etc., and no limitation is made here.

[0563] In other words, in this embodiment of the application, after obtaining the BV of the corresponding luma block, it can be denoted as BVL, and the chromaticity BV obtained through BVL can be denoted as BVC. Then, by adjusting BVL or BVC, a candidate chromaticity BVC can be constructed, containing one or more candidate options. The construction methods of the candidate options include, but are not limited to, the following:

[0564] In one possible construction method, BVL can be adjusted to form four cases, thereby achieving the adjustment of BVC. Specifically, when BVL is odd, the four cases are BVL = (BVLhor, BVLver), BVL = (BVLhor+1, BVLver), BVL = (BVLhor, BVLver+1), and BVL = (BVLhor+1, BVLver+1). When BVL is even, BVL = (BVLhor, BVLver).

[0565] Alternatively, when BVL is even, 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 scenarios.

[0566] Here, BVC[0] = BVL[0] * 2 / SubWidthC, BVC[1] = BVL[1] * 2 / SubHeightC. SubWidthC and SubHeightC can be determined according to the mapping relationship between sps_chroma_format_idc and color sampling format in Table 1.

[0567] The BVL is scaled according to the above formula to obtain the BVC. When the BVL is odd or even, four BVC candidates will be formed. These candidates are added to the chromaticity BVC candidate list (i.e., the third reference prediction parameter set).

[0568] In another possible construction method, BVL can be adjusted to form four cases, thereby achieving the adjustment of BVC. Specifically, when BVL is odd, the four cases are BVL = (BVLhor, BVLver), BVL = (BVLhor+1, BVLver), BVL = (BVLhor, BVLver+1), and BVL = (BVLhor+1, BVLver+1). When BVL is even, the four cases are BVL = (BVLhor, BVLver), BVL = (BVLhor-1, BVLver), BVL = (BVLhor, BVLver-1), and BVL = (BVLhor-1, BVLver-1). Next, the BVL is scaled according to the color sampling format in Table 8 to obtain the BVC. This will result in four BVC candidates when the BVL is odd or even. These candidates are then added to the chromaticity BVC candidate list (i.e., the third reference prediction parameter set).

[0569] It should be noted that in this construction method, the operation for different odd and even numbers can also be unified by the following calculation: take four cases: BVL = (BVLhor-1, BVLver-1), BVL = (BVLhor+1, BVLver-1), BVL = (BVLho-1r, BVLver+1), and BVL = (BVLhor+1, BVLver+1).

[0570] In another possible construction method, BVL can be adjusted to form multiple cases, thereby adjusting BVC. Specifically, when BVL is odd, multiple cases are considered, 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). These candidates are then used to construct a list in sequence. When BVL is even, various cases are considered, including 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). Next, BVL is scaled according to the color sampling format in Table 8 to obtain BVC. This results in multiple BVC candidates for both odd and even BVL values. These candidates are then added to the chromaticity BVC candidate list (i.e., the third reference prediction parameter set).

[0571] It should be noted that in this construction method, the operation for different odd and even numbers can also be unified by the following calculations: take 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.

[0572] In another possible construction method, the obtained BVC can 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. These candidates are then added to the chromaticity BVC candidate list (i.e., the third reference prediction parameter set).

[0573] In another possible construction method, the obtained BVC can 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+ ... The following are some examples of BVC candidates: er-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. These candidates are then added to the chromaticity BVC candidate list (i.e., the third reference prediction parameter set).

[0574] It should also be noted that, in the embodiments of this application, for the case where BVL is odd or even, since BVL is a two-dimensional vector, it specifically refers to a certain component being odd or even. Furthermore, "+1", "-1", "+2", "-2", "+3", and "-3" all refer to integer pixel precision.

[0575] It is understood that, in the embodiments of this application, when determining the first candidate reference prediction parameter based on the third reference prediction parameter set, it is also necessary to determine whether the candidate vector parameters in the third reference prediction parameter set are available, that is, it is necessary to select one or more available candidate vector parameters from the third reference prediction parameter set. Therefore, in some embodiments, determining the first candidate reference prediction parameter corresponding to the second candidate reference prediction parameter based on the third reference prediction parameter set may include: determining whether the third reference prediction parameter set has one or more candidate vector parameters that satisfy a preset availability condition; and when the third reference prediction parameter set has one or more candidate vector parameters that satisfy the preset availability condition, determining the first candidate reference prediction parameter based on the one or more candidate vector parameters.

[0576] Specifically, in the embodiments of this application, a candidate vector parameter can only be determined as the first candidate reference prediction parameter if the candidate vector parameter meets the preset availability conditions.

[0577] In some embodiments, one or more candidate vector parameters satisfy preset availability conditions, including but not limited to:

[0578] The offset position indicated by one or more candidate vector parameters does not exceed the image boundary;

[0579] The offset position indicated by one or more candidate vector parameters does not exceed the slice boundary;

[0580] The offset position indicated by one or more candidate vector parameters does not cover the current block;

[0581] The offset position indicated by one or more candidate vector parameters does not exceed the preset available area;

[0582] The offset positions indicated by one or more candidate vector parameters have been reconstructed.

[0583] It should be noted that, in this embodiment, assuming the current block position is (xCb, yCb), and for the candidate vector parameters, BVC = (BVChor, BVCver), the corresponding offset position is found to be (xCb + BVChor, yCb + BVCver). Here, the offset position can be specifically described using coordinate position information and data such as the size parameters of the current block, even if it does not exceed the image boundary. For example, xCb + width + BVChor <= xCb or yCb + height + BVCver <= yCb.

[0584] It should also be noted that, in the embodiments of this application, the preset availability conditions can also take into account whether the slice boundary is exceeded. For example, the offset position indicated by one or more candidate vector parameters does not exceed the slice boundary, or the offset position indicated by one or more candidate vector parameters does not exceed the tile boundary.

[0585] In this embodiment, a candidate vector parameter can only be considered usable if all of the above conditions are met. In one specific embodiment, taking one candidate vector parameter as an example, the candidate vector parameter satisfying the preset usability conditions includes at least: the offset position indicated by the candidate vector parameter does not exceed the image boundary; the offset position indicated by the candidate vector parameter does not exceed the patch boundary; the offset position indicated by the candidate vector parameter does not cover the current block; the offset position indicated by the candidate vector parameter does not exceed the preset usable area; and the offset position indicated by the candidate vector parameter has been reconstructed.

[0586] For example, Figure 12 shows a schematic diagram of whether an offset position does not cover the current block according to an embodiment of this application. As shown in Figure 12, the block filled with black represents the current block, the area filled with diagonal lines represents the available area, and the unfilled area represents the unavailable area. For the current block, if the offset position indicated by the candidate block vector parameter is in the unavailable area, then the offset position will cover the current block.

[0587] For example, Figure 13 shows a schematic diagram of whether the offset position exceeds the preset available area according to an embodiment of this application. As shown in Figure 13, the black-filled block represents the current block, and the area filled with diagonal lines represents the available area, and all reference blocks within the available area have been reconstructed. In this embodiment of the application, considering the storage capacity of the Buffer, the reference blocks adjacent to the current block (m, n) can generally be: 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 the preset available area.

[0588] In other words, when determining whether a color is usable, the current block position (xCb, yCb) can be obtained, the chroma BVC = (BVChor, BVCver) can be obtained, the corresponding offset position (xCb + BVChor, yCb + BVCver) can be found, and the following conditions can be checked, including but not limited to the following conditions (i.e., preset usability conditions). If all of them are true, then the chroma BV is usable:

[0589] Does the obtained offset position not exceed the image boundary?

[0590] To determine whether the obtained offset position does not cover the current block, please refer to Figure 12.

[0591] xCb+width+BVChor<=xCb or yCb+height+BVCver<=yCb;

[0592] Whether the obtained offset position does not exceed the preset available area, see Figure 13 for details;

[0593] Has the obtained offset position been reconstructed?

[0594] It can also be understood that, in the embodiments of this application, the construction methods of the third reference prediction parameter set include, but are not limited to, the various situations described above. One of these methods can be used to construct the candidate list, or multiple methods can be used simultaneously to construct the list. That is, four BVC candidates are determined for each BVL to construct the third reference prediction parameter set. Then, for each BVL, a usable BVC is decided from the four BVC candidates, which is the first candidate reference prediction parameter corresponding to that BVL.

[0595] In some embodiments, determining a first candidate reference prediction parameter based on one or more candidate vector parameters includes: if there is a candidate vector parameter in the third reference prediction parameter set that satisfies a preset availability condition, then the candidate vector parameter that satisfies the preset availability condition is determined as the first candidate reference prediction parameter; if there are multiple candidate vector parameters in the third reference prediction parameter set that satisfy the preset availability condition, then a decision is made on the multiple candidate vector parameters that satisfy the preset availability condition to determine the first candidate reference prediction parameter.

[0596] It should be noted that, in the embodiments of this application, if there are one or more candidate vector parameters that satisfy the preset availability conditions, then when determining the first candidate reference prediction parameter based on one or more candidate vector parameters, one of the candidate vector parameters that satisfies the preset availability conditions can be directly determined as the first candidate reference prediction parameter. That is, if only one BVC candidate in the constructed available BVC candidate list satisfies the preset availability conditions, then the final selected first candidate reference prediction parameter is that BVC.

[0597] It should also be noted that, in the embodiments of this application, if there are multiple candidate vector parameters that meet preset availability conditions, then decisions can also be made on these multiple candidate vector parameters. Specifically, this can be as follows: determine a first template for the current block; determine a first matching template for each of the multiple candidate vector parameters based on the first template and the multiple candidate vector parameters; when the first template and the first matching template meet preset existence conditions, calculate the matching error between the first template and the first matching template of the current block according to a preset error criterion, so as to determine the first generation value of each of the multiple candidate vector parameters; determine the minimum generation value from the first generation values ​​of each of the multiple candidate vector parameters, and determine the candidate vector parameter corresponding to the minimum generation value as the first candidate reference prediction parameter.

[0598] In other words, in this embodiment of the application, after determining the first-generation value corresponding to multiple candidate vector parameters that meet the preset availability conditions, one or more candidate vector parameters can be determined from the multiple candidate vector parameters based on the first-generation value. For example, if the constructed list of available BVC candidates has multiple available BVC candidates, then it is necessary to make a decision on these available BVCs to obtain the final BV. The decision-making method includes, but is not limited to, using a template for decision-making.

[0599] It should be noted that, in the embodiments of this application, the first template includes one or more samples from the adjacent decoded regions of the current block. Accordingly, the type of the first template may include at least one of the following: top template, top-right template, left template, bottom-left template, and top-left template. Specifically, the top template is located in the top-adjacent decoded region of the current block, the top-right template is located in the top-right-adjacent decoded region of the current block, the left template is located in the left-adjacent decoded region of the current block, the bottom-left template is located in the bottom-left-adjacent decoded region of the current block, and the top-left template is located in the top-left-adjacent decoded region of the current block.

[0600] It should also be noted that, in this embodiment, 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 adjacent areas of the current block, including the reconstruction of chroma information. Figure 14 is a schematic diagram of template types. As shown in Figure 14, based on the relative positional relationship between the template and the current block, templates can be classified into template types such as top template, left template, top-right template, bottom-left template, and top-left template. The dimensions of different types of templates for different coding blocks can be fixed and the same, or they can be different.

[0601] For example, the template size can be set to the same size for any current block. The following formula illustrates a condition for setting the template size, where nTbW and nTbH are the width and height of the current block, respectively, and iTempW and iTempH are the width and height of the template being used, respectively:

[0602] Template above:

[0603] Left template:

[0604] For example, different template sizes can be selected based on the different sizes of 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, respectively, and iTempW and iTempH are the width and height of the template being used, respectively:

[0605] Template above:

[0606] Left template:

[0607] in,

[0608] For example, different template sizes can 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, respectively, nTbW × nTbH are the number of pixels in the current block, and iTempW and iTempH are the width and height of the template used, respectively:

[0609] Template above:

[0610] Left template:

[0611] In some embodiments, when determining the first matching template based on multiple candidate vector parameters, the region indicated by the multiple candidate vector parameters that has the same shape and contains the same number of sample values ​​as the first template is determined as the first matching template, starting from the position of the current point.

[0612] For example, in the embodiments of this application, when determining the first matching template, the first template of the current block is used to perform motion compensation on the obtained multiple BVC candidates (i.e., candidate block vector parameters that meet the preset usability conditions) to obtain the template (first matching template) at the corresponding BV. Figure 15 is a schematic diagram of template motion compensation. As shown in Figure 15, if the BV (BVC candidate) is usable, motion compensation will be performed using the first template and the BV to obtain the template at the corresponding BV, i.e., the first matching template.

[0613] It can also be understood that, in the embodiments of this application, the preset error criteria may include, but are not limited to, any one of the following: Sum of Absolute Errors (SAD), Sum of Transformed Absolute Errors (SATD), Sum of Squared Differences (SSE), Mean Absolute Differences (MAD), Mean Absolute Errors (MAE), Mean Squared Errors (MSE).

[0614] For example, in this embodiment of the application, when calculating costs, i.e., determining the first-generation value, there are multiple choices for the cost function used to calculate the cost of the template area, i.e., there are multiple choices for the preset error criteria. For example, evaluation criteria such as Sum of Absolute Errors (SAD), Sum of Transformed Absolute Errors (SATD), Sum of Squared Differences (SSE), Mean Absolute Difference (MAD), Mean Absolute Error (MAE), and Mean Squared Error (MSE) can be selected. Any evaluation criterion mentioned below can be selected from the above criteria. Taking the SAD evaluation criterion as an example, the calculation formula is as follows:

[0615] Where predTempSizeW is the width of the template, predTempSizeH is the height of the template, predTemp[i][j] is the pixel value of the template at BV, and recTempC[i][j] is the pixel value of the current block template.

[0616] Furthermore, in some embodiments, the method may further include: when the first template and the first matching template do not satisfy a preset existence condition, determining the first candidate vector parameter in the third reference prediction parameter set that satisfies the preset availability condition as the first candidate reference prediction parameter; or, when the first template and the first matching template do not satisfy the preset existence condition, determining the candidate vector parameter at the second position in the third reference prediction parameter set that satisfies the preset availability condition as the first reference prediction parameter.

[0617] In other words, if the first template and the first matching template meet the preset existence conditions, the matching error between the first template and the first matching template of the current block can be calculated according to the preset error criteria, so as to select the candidate vector parameter corresponding to the minimum cost value as the first candidate reference prediction parameter; if the first template and the first matching template do not meet the preset existence conditions, the first candidate vector parameter in the third reference prediction parameter set that meets the preset availability conditions or the candidate vector parameter at a specified position can be determined as the first candidate reference prediction parameter.

[0618] For example, regarding whether the first template and the first matching template meet the preset existence conditions, the template usage when calculating the cost (i.e., the cost value) can be in the following situations:

[0619] The first scenario: Both the top and left templates of the current block exist, and both the top and left templates at the corresponding BV point also exist. In this case, both the top and left templates are available.

[0620] The second scenario: Both the top and left templates of the current block exist, but only the top template exists at the corresponding BV. In this case, there are two methods: Method 1: If the left template does not exist at the corresponding BV, it is not used directly, i.e., only the top template is used for calculation. Method 2: If the left template does not exist at the corresponding BV, the leftmost template width column inside the reference block is used to replace the left template, i.e., both the top and left templates are used for calculation.

[0621] The third scenario: Both the top and left templates 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 top template does not exist at the corresponding BV, it is not used directly, i.e., only the left template is used for calculation. Method 2: If the top template does not exist at the corresponding BV, the template height row at the topmost edge of the reference block is used instead of the top template, i.e., both the top and left templates are used for calculation.

[0622] The fourth scenario: Only the top template exists in the current block. In this case, there are three methods: Method 1: If the top template does not exist at the corresponding BV, it is not used. The final selected BV is the first BVC in the BVC candidate list or a BVC at a specified position. Method 2: If the top template does not exist at the corresponding BV, the topmost template height row inside the reference block is used instead. Method 3: If the top template exists at the corresponding BV, it is used directly.

[0623] Fifth scenario: 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 not used. The final selected BV is the first BVC in the BVC candidate list or a BVC at a specified position. Method 2: If the left template at the corresponding BV does not exist, the leftmost template width column inside the reference block is used instead. Method 3: If the left template at the corresponding BV exists, it is used directly.

[0624] The sixth scenario: If neither the upper template nor the left template exists in the current block, the final selected BV is either the first BVC in the BVC candidate list or a BVC at a specified position.

[0625] For example, in this embodiment of the application, when determining the first candidate reference prediction parameter based on the first-generation value of each of the multiple candidate vector parameters, except in cases where the cost cannot be calculated, the cost of each candidate in the candidate list of BVCs 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. Any number of BVCs with the lowest cost are selected as the final selected BV (first candidate reference prediction parameter) for BV-based chromaticity prediction. It should also be noted that when calculating the cost of multiple candidate vector parameters, a cost can be calculated for each candidate vector parameter, always retaining the candidate vector parameter with the lowest cost. In this case, a list or even sorting may not be necessary.

[0626] Thus, after obtaining one or more first candidate reference prediction parameters, a first reference prediction parameter set can be constructed.

[0627] S2003, based on the first reference prediction parameter set, determine the first color component reference sample value and the second color component reference sample value of the current block.

[0628] It should be noted that, in the embodiments of this application, the "reference prediction parameter" here is a parameter used to derive the reference sample value of the current block, specifically a vector parameter (e.g., BV or MV). Then, based on these reference samples, the mapping relationship between the first color component and the second color component can be derived.

[0629] It should also be noted that if all candidate vector parameters in the third reference prediction parameter set are unavailable, that is, if all candidate block vector parameters in the third reference prediction parameter set do not meet the preset availability condition, then there are no available first candidate reference prediction parameters, and therefore no first reference prediction parameter set exists. In this case, the method may further include: when all candidate vector parameters in the third reference prediction parameter set do not meet the preset availability condition, determining the first color component reconstruction sample and the second color component reconstruction sample at the third position of the current block; and determining the first color component reference value and the second color component reference value of the current block based on the first color component reconstruction sample and the second color component reconstruction sample at the third position.

[0630] In other words, in this embodiment of the application, luminance pixels and chrominance pixels at a set position can also be obtained. The set position includes, but is not limited to, the adjacent row and the adjacent column of the current block, so as to obtain the first color component reference sample value and the second color component reference sample value of the current block.

[0631] In some embodiments, determining the first color component reference sample and the second color component reference sample of the current block based on the first reference prediction parameter set may include: determining a first color component reconstructed sample and a second color component reconstructed sample indicated by one or more first candidate reference prediction parameters, based on the first reference prediction parameter set; determining a first color component reconstructed sample and a second color component reconstructed sample at a third position of the current block; and determining the first color component reference sample and the second color component reference sample of the current block based on the first color component reconstructed sample and the second color component reconstructed sample indicated by one or more first candidate reference prediction parameters, as well as the first color component reconstructed sample and the second color component reconstructed sample at the third position.

[0632] In embodiments of this application, determining a first color component reconstruction sample and a second color component reconstruction sample indicated by one or more first candidate reference prediction parameters based on a first reference prediction parameter set may include: determining the position of the current block; scaling the position of the current block to determine the position of a first color component region at the same position of the current block; scaling the first candidate reference prediction parameters to determine scaled reference prediction parameters for the first color component region at the same position of the current block; determining a reference block for the first color component based on the position of the first color component region and the scaled reference prediction parameters, and determining a first color component reconstruction sample indicated by the first candidate reference prediction parameters based on the reference block of the first color component; determining a reference block for the second color component based on the position of the current block and the first candidate reference prediction parameters, and determining a second color component reconstruction sample indicated by the first candidate reference prediction parameters based on the reference block of the second color component.

[0633] In this embodiment, 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 scaled reference prediction parameter of the first color component region can also be obtained by scaling the first candidate reference prediction parameter according to a preset sampling format. Here, the preset sampling format can be found in Table 4 above. It should be noted that the scaled reference prediction parameter can be obtained by amplifying the chroma BV; however, considering that the luminance BV may suffer from accuracy loss, the luminance BV obtained by amplifying the chroma BV is not necessarily equal to the original luminance BV (the second candidate reference prediction parameter).

[0634] For example, the current block is a chroma block, and the first color component region at the same position is the corresponding brightness region. To obtain the reference sample value (brightness reference sample) of the first color component, firstly, 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); scale chromaPos according to the color sampling format shown in Table 4 to obtain the position of the corresponding brightness region lumaPos = (xCb, yCb) of the current block.

[0635] For example, obtain the chromaticity BV = (BVChor, BVCver). Scale the chromaticity BV according to the color sampling format shown in Table 4 to obtain the luminance BV = (BVYhor, BVYver) of the corresponding luminance region of the current block. Obtain the position lumaPos = (xCb, yCb) of the corresponding luminance region of the current block, obtain the luminance BV = (BVYhor, BVYver), and find the offset position (xCb + BVYhor, yCb + BVYver) of the corresponding luminance region of the current block, as shown in Figure 16.

[0636] In one specific implementation, after obtaining the luminance sample at the offset position, it can be downsampled to obtain a luminance reference sample. In some embodiments, determining the first color component reconstruction sample indicated by the first candidate reference prediction parameters based on the reference block of the first color component may include: performing downsampling processing on the reference block of the first color component to determine the first color component reconstruction sample indicated by the first candidate reference prediction parameters, so that the resolution of the first color component reconstruction sample is the same as the resolution of the second color component reconstruction sample.

[0637] It should be noted that, in the embodiments of this application, performing downsampling processing on the reference block of the first color component to determine the reconstructed sample of the first color component indicated by the first candidate reference prediction parameter may include: determining the downsampling method of the current block; performing downsampling processing on the reference block of the first color component according to the downsampling method to determine the reconstructed sample of the first color component indicated by the first candidate reference prediction parameter.

[0638] In some embodiments, as shown in Figure 21, the method for determining the downsampling method of the current block may include:

[0639] S2101, calculate the cost of multiple candidate downsampling methods based on a preset competition method, and determine the cost result corresponding to each of the multiple candidate downsampling methods.

[0640] S2102, select the minimum cost result from the cost results corresponding to each of the multiple candidate downsampling methods.

[0641] S2103, determine the candidate downsampling method corresponding to the minimum cost result as the downsampling method for the current block.

[0642] It should be noted that, in the embodiments of this application, the preset competition mode can be a rate-distortion optimization (RDO) mode, such as a full RDO competition mode, a competition mode that only performs one RDO selection, a competition mode that performs a variable number of RDO selections, or a competition mode that performs a set number of RDO selections, etc. These modes will be described in detail below.

[0643] For example, the brightness reconstruction sample of the current block is downsampled to obtain the downsampled brightness sample. The preset contention method at the encoding end includes, but is not limited to, the following:

[0644] ① Adopt a full RDO competition mode.

[0645] Different sampling methods correspond to different brightness downsampling reconstruction values. For each sampling method, prediction, transformation, quantization, reconstruction, distortion and bit calculation are performed to update the optimal value.

[0646] ② Only one RDO selection is performed.

[0647] Different sampling methods correspond to different brightness downsampling reconstruction values. For each sampling method, a prediction is made, and the distortion between the predicted value and the original value is calculated. This includes, but is not limited to, SAD, SATD, etc. The downsampling method with the least distortion is selected, and the distortion and bits are calculated for this downsampling method through prediction, transformation, quantization, and reconstruction.

[0648] ③ Perform RDO selection with a variable number of iterations.

[0649] By default, the prediction, transformation, quantization, and reconstruction of downsampling mode 1 are performed, calculating distortion and bits. For each downsampling mode from 1 to 6, the distortion between the predicted value and the original value is calculated, including but not limited to SAD, SATD, etc. The distortion of modes 2 to 6 is compared with the distortion of mode 1 in turn. If scale * distortion (downsampling mode 2 to 6) < distortion (downsampling mode 1), where scale can take values ​​including but not limited to 1, 1.5, 1.15, 1.3, etc., then the corresponding RDO count is increased.

[0650] ④ Select the RDO for the set number of times.

[0651] ② Perform an RDO (Reverse Decision) operation by weighting the predicted value obtained from this sampling method with the intra-prediction mode at the position pointed to by BVL (including but not limited to the center luma block) to obtain the predicted value, and then performing RDO. Alternatively, perform an RDO by weighting the predicted value obtained from this sampling method with the chroma predicted value at the position pointed to by BVC (including but not limited to the center luma block). It is important to note that if weighting is added, a corresponding `weight_flag` (indicating whether weighting is applied) or `weight_idx` (indicating the index of the weighting options, such as 0, 1 / 4, 1 / 2, 3 / 4, 1, etc.) syntax element should be added to the bitstream.

[0652] It should also be noted that, in this embodiment, since the resolutions of the luminance and chrominance samples are inconsistent, the luminance samples need to be downsampled to ensure that the resolutions of the downsampled luminance and chrominance samples are the same. Here, to determine the downsampling method for the current block, several candidate sampling methods can be used in competition, or a default sampling method can be adopted, but these include, but are not limited to, the following six sampling methods. For example, assuming the luminance sample before downsampling is recBvBefDownLuma, the width of the storage buffer is iRecRefLumaStride, and the luminance sample after downsampling is recBvAftDownLuma, then the downsampled luminance sample at position (i,j) is:

[0653] Downsampling method 1 (as shown in Figure 17A):

[0654] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]*2

[0655] +recBvBefDownLuma[2*i+1]

[0656] +recBvBefDownLuma[2*i-1]

[0657] +recBvBefDownLuma[2*i+iRecRefLumaStride]*2

[0658] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]

[0659] +recBvBefDownLuma[2*i-1+iRecRefLumaStride]+4)>>3;

[0660] Downsampling method two (as shown in Figure 17B):

[0661] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]

[0662] +recBvBefDownLuma[2*i+1]+1)>>1;

[0663] Downsampling method three (as shown in Figure 17C):

[0664] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]

[0665] +recBvBefDownLuma[2*i+iRecRefLumaStride]+1)>>1;

[0666] Downsampling method four (as shown in Figure 17D):

[0667] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+iRecRefLumaStride]

[0668] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1;

[0669] Downsampling method five (as shown in Figure 17E):

[0670] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+1]

[0671] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1;

[0672] Downsampling method six (as shown in Figure 17F):

[0673] recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]

[0674] +recBvBefDownLuma[2*i+1]

[0675] +recBvBefDownLuma[2*i+iRecRefLumaStride]

[0676] +recBvBefDownLuma[2*i+1+iRecRefLumaStride]+2)>>2.

[0677] In some embodiments, the method may further include: determining the value of the filter identification information; encoding the value of the filter identification information; and writing the obtained encoded bits into the bit stream.

[0678] In other words, in this embodiment, the filter identifier information is used to indicate the index number of the current block's downsampling method among multiple candidate downsampling methods. This allows the decoding end to directly determine the downsampling method of the current block after determining the value of the filter identifier information through the decoded bitstream. The filter identifier information can be represented by `filter_idx`, and its value can be 0, 1, 2, 3, 4, 5, etc. Thus, after determining the downsampling method of the current block, the downsampled luminance reference sample `recBvAftDownLuma` at the corresponding BV position of the same luminance region of the current block can be obtained through downsampling.

[0679] 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 corresponding BV of the current block.

[0680] In some embodiments, determining a first color component reconstruction sample and a second color component reconstruction sample at a third position of the current block may include: determining a first template of the current block; and determining a first color component reconstruction sample and a second color component reconstruction sample at a third position based on the first template.

[0681] It should be noted that, in the embodiments of this application, the first template includes one or more samples from the adjacent decoded regions of the current block. Accordingly, the type of the first template may include at least one of the following: top template, top-right template, left template, bottom-left template, and top-left template. Specifically, the top template is located in the top-adjacent decoded region of the current block, the top-right template is located in the top-right-adjacent decoded region of the current block, the left template is located in the left-adjacent decoded region of the current block, the bottom-left template is located in the bottom-left-adjacent decoded region of the current block, and the top-left template is located in the top-left-adjacent decoded region of the current block.

[0682] In other words, the first color component reference sample and the second color component reference sample of the current block include not only the first color component reconstruction sample and the second color component reconstruction sample indicated by one or more first candidate reference prediction parameters, but also the first color component reconstruction sample and the second color component reconstruction sample at a third position (e.g., the first template region) of the current block. The third position represents any set position of the current block, which includes, but is not limited to, the adjacent row and the adjacent column of the current block.

[0683] Thus, based on the luminance reference sample recBvAftDownLuma, the chromaticity reference sample recBvChroma, and the reconstructed luminance and chromaticity samples at the third position, a mapping relationship between luminance and chromaticity can be constructed.

[0684] S2004, Determine the mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value.

[0685] It should be noted that, in one possible implementation, determining the mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value may include: determining a first lookup table based on the first color component reference sample value and the second color component reference sample value, wherein the first lookup table is used to record the value of the second color component corresponding to the index key being the first color component.

[0686] It should also be noted that in another possible implementation manner, determining the mapping relationship between the first color component and the second color component according to the first color component reference sample value and the second color component reference sample value may include: determining a first discrete model according to the first color component reference sample value and the second color component reference sample value, where the first discrete model is used to indicate the mapping relationship between the first color component and the second color component.

[0687] That is to say, the mapping relationship here can be a Look Up Table (LUT). Among them, the index keyword (key) in the look-up table can be the first color component, and the value of the look-up table can be the second color component, that is, value = LUT[key]. Or, the mapping relationship can also be a discrete model, which is used to characterize the mapping relationship between key and value.

[0688] Exemplarily, assuming that the luminance component is the key and the chrominance component is the value, then each key-value pair in the mapping relationship can be established in the following ways including but not limited to: LUT[recBvAftDownLuma[i][j]] = recBvChroma[i][j] (17)

[0689] It should also be noted that in the embodiments of the present application, for the first color component parameter sample, 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 sample value to make the first color component reference sample value within the preset sample range.

[0690] 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 there is no limitation. 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.

[0691] 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].

[0692] Furthermore, in some embodiments, the method may further include: when multiple second reference samples in the first color component reference samples are the same and correspond to different second reference samples in the second color component reference samples, performing overlay processing sequentially according to the sample order, and taking the last second reference sample as a value that has a mapping relationship with the first reference sample.

[0693] Furthermore, in some embodiments, the method may further include: when the first reference sample values ​​in the first color component reference sample values ​​are the same and correspond to multiple second reference sample values ​​that are different in the second color component reference sample values, calculating the average value of the multiple second reference sample values, and using the obtained average value as a value that has a mapping relationship with the first reference sample value.

[0694] In other words, in this embodiment of the application, for different chromaticity values ​​with the same key in the mapping relationship, entries with the same key value can be overwritten sequentially according to the sample order, or an average value can be applied. Additionally, in the mapping relationship, the LUT[] is initialized to -1, i.e., an unusable value. "Overwriting" mainly means that if there are subsequent entries with the same key value, a new value will be used for storage; however, it is not limited to this method. All entries can also be stored and the average value calculated as the value corresponding to that key.

[0695] It is understood that, in the embodiments of this application, the first color component reference sample value and the second color component reference sample value used to construct the mapping relationship can also be obtained in other ways. The following describes several implementation methods by way of example.

[0696] In another specific implementation, the luminance sample is not downsampled; instead, the chrominance sample is upsampled to obtain a chrominance reference sample. In some embodiments, determining the reconstructed sample of the second color component indicated by the first candidate reference prediction parameter based on the reference block of the second color component may include: upsampling the reference block of the second color component to determine the reconstructed sample of the second color component indicated by the first candidate reference prediction parameter, so that the resolution of the reconstructed sample of the first color component is the same as the resolution of the reconstructed sample of the second color component.

[0697] In other words, in this embodiment of the application, after obtaining the reconstructed luminance sample recBvBefDownLuma of the same luminance region, no downsampling is performed. At this time, after obtaining the reconstructed chrominance sample recBvChroma at the BV corresponding to the current block, upsampling is required, including but not limited to linear interpolation, to obtain a reconstructed chrominance sample recBvChromaUp of the same size as the reconstructed luminance sample at BV.

[0698] Thus, the reconstructed luminance sample recBvBefDownLuma at BV is used as the luminance reference sample, and the upsampled reconstructed 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.

[0699] Accordingly, in this embodiment, the predicted value of the second color component of the current block also needs to be downsampled. That is, if the reconstructed chromaticity sample of the current block is upsampled when constructing the mapping relationship, then when predicting the luminance to chromaticity of the current block according to the mapping relationship, the obtained chromaticity prediction value also needs to be downsampled to obtain the final chromaticity prediction value of the current block. The downsampling method includes, but is not limited to, average downsampling.

[0700] In another specific implementation, the method may further include: determining a first template for the current block; and determining a first color component reference sample and a second color component reference sample for the current block based on the first template.

[0701] In this embodiment, the first color component reference value and the second color component reference value used to construct the mapping relationship may further include the first color component reference value and the second color component reference value 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 position as the first template can be determined; then, the first color component reference value can be determined based on the reconstructed samples in the first color component region template; and the second color component reference value can be determined based on the reconstructed samples in the first template. The first template includes one or more reconstructed samples from adjacent decoded regions of the current block.

[0702] For example, a chromaticity reference sample can be obtained based on the current chromaticity template of the current block; after determining the corresponding luminance region template of the current chromaticity template, a luminance reference sample can be obtained based on the corresponding luminance region template. Then, combining the luminance reference sample and chromaticity reference sample obtained in the above embodiments, a mapping relationship between luminance and chromaticity is constructed based on these luminance reference samples and chromaticity reference samples.

[0703] S2005, Based on the mapping relationship and the sample value of the first color component of the current block, determine the predicted value of the second color component of the current block.

[0704] It should be noted that, in the embodiments of this 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 position of 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. This can be done by directly using the reconstructed pixel samples of the first color component region as the first color component sample value of the current block, or by filtering the reconstructed pixel samples of the first color component region and using the filtered reconstructed pixel samples as the first color component sample value of the current block; no limitation is made here.

[0705] For example, in this embodiment, the filtering process is a downsampling process. Here, the reconstructed luminance sample recBefDownLuma at the position of the corresponding luminance region lumaPos = (xCb, yCb) of the current block can be obtained. This luminance sample is then 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 undergone sample range mapping processing, then the downsampled reconstructed luminance sample also needs to undergo the same sample range mapping processing to obtain the first color component sample value of the current block.

[0706] 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 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.

[0707] For example, in this embodiment of the application, assuming 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:

[0708] Referring to the luminance value Yc at the same location, the chromaticity prediction value is derived using the mapping relationship (discrete model) established in the aforementioned embodiments.

[0709] In some embodiments, for determining the predicted value of the second color component of the current block, the method may further include: if no first color component value equal to the first color component sample value is found in the mapping relationship, then the first color component sample value is corrected to determine the first color component correction value, and the method continues to search in the mapping relationship for a first color component value equal to the first color component correction value.

[0710] In one specific embodiment, correcting the reconstructed value of the first color component to determine the corrected value of the first color component may include: performing offset calculation on the sample value of the first color component according to one or more preset offset values ​​to determine the corrected value of the first color component.

[0711] In this embodiment, the offset value can be +1, -1, +2, -2, +3, -3, etc., and there is no limitation on the number of offset values ​​or their specific 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, the correction processing is performed in the order of {+1, -1, +2, -2, +3, -3}.

[0712] For example, in the embodiments of this application, if Yc is not found in the input luminance set of the mapping relationship established in the foregoing embodiments, the following processing methods are included but not limited to: correcting Yc in the order of {Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3}, then performing a matching check in the input luminance set based on the corrected Yc, and then determining the value corresponding to the corrected Yc as the chromaticity prediction value of the current block.

[0713] In some embodiments, for determining the predicted value of the second color component of the current block, the method further includes: if no first color component value equal to the first color component correction value is found in the mapping relationship, then the average value of the second color component reference sample is calculated, and the obtained average value is determined as the predicted value of the second color component of the current block.

[0714] For example, in the embodiments of this application, if Yc is not found in the input luminance set of the mapping relationship established in the foregoing embodiments, 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 the mapping relationship cannot match all the above corrected Yc, then the chromaticity prediction value can be set to the average value of the reconstructed chromaticity sample recBvChroma at the corresponding BV.

[0715] In some embodiments, for determining the predicted value of the second color component of the current block, the method further 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; and performing a correction operation on the first initial predicted value to determine the predicted value of the second color component of the current block.

[0716] It should be noted that in the embodiments of this application, the first initial predicted value obtained according to the mapping relationship is corrected. The correction operation here may include clip operation, filtering operation, weighted operation of predicted values ​​obtained with other prediction modes, etc., and there is no limitation on it.

[0717] In one specific embodiment, correcting the first initial prediction value to determine the predicted 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 a first preset mode to determine a second initial prediction value of the second color component of the current block; and performing a weighted calculation on the first initial prediction value and the second initial prediction value to determine the predicted value of the second color component of the current block. It should be noted that, in this embodiment, the first preset mode includes at least one of the following: PLANA mode, DM mode, DC mode, and CCLM mode. That is, correcting the first initial prediction value obtained according to the mapping relationship may include, but is not limited to, weighting it with a CCLM-type mode or other prediction modes to obtain the chromaticity prediction value of the current block.

[0718] In another specific embodiment, correcting 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 to a preset numerical range, or it may also be called a "clip operation". It should be noted that in this embodiment, the lower limit of the preset numerical range is the minimum prediction value (min), and the upper limit of the preset numerical range is the maximum prediction value (max). Specifically, if the first initial prediction value is within the preset numerical range, then the first initial prediction value can be used as the chromaticity prediction value of the current block; if the first initial prediction value is greater than max, then max can be used as the chromaticity prediction value of the current block; if the first initial prediction value is less than min, then min can be used as the chromaticity prediction value of the current block.

[0719] In some embodiments, for determining the predicted value of the second color component of the current block, the method further includes: when the first reference prediction parameter set includes a plurality of first candidate reference prediction parameters, determining a plurality of third initial prediction values ​​of the second color component of the current block; and performing a weighted calculation on the plurality of third initial prediction values ​​to determine the predicted value of the second color component of the current block.

[0720] It should be noted that in the embodiments of this application, if the foregoing embodiments determine multiple BVs (first candidate reference prediction 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 value is used as the chroma prediction value of the current block; or, the weighted prediction value can be further modified, including but not limited to weighting with CCLM-type modes or other prediction modes, to obtain the chroma prediction value of the current block.

[0721] In one specific embodiment, for determining the predicted value of the second color component of the current block, the method may further include: when the first reference prediction parameter set includes multiple first candidate reference prediction parameters, determining a first color component reconstruction sample and a second color component reconstruction sample indicated by each of the multiple first candidate reference prediction parameters; determining multiple mapping relationships between the first color component and the second color component based on the first color component reconstruction samples and the second color component reconstruction samples indicated by each of the multiple first candidate reference prediction parameters; determining multiple third initial prediction values ​​of the second color component of the current block based on the multiple mapping relationships; and performing a weighted calculation on the multiple third initial prediction values ​​to determine the predicted value of the second color component of the current block.

[0722] It should be noted that in this embodiment, multiple blocks of the same luminance region are obtained. The positions of these multiple blocks include, but are not limited to, the following positions, as shown in Figure 11. Multiple blocks can correspond to multiple luminance values ​​(BVs). These multiple luminance BVs each construct their own candidate list for chrominance values ​​(BVCs). The availability of BVs in the candidate list is determined to decide on one or more BVs, or to determine multiple groups of BVs through clustering. For multiple groups of BVs, multiple mapping tables (LUTs) between luminance and chrominance can be established. Thus, multiple initial chrominance prediction values ​​can be obtained based on these multiple mapping tables (LUTs). The chrominance prediction value of the current block can be obtained through weighted calculation.

[0723] In some embodiments, for determining the predicted value of the second color component of the current block, the method may include: when the first color component block of the current block includes multiple candidate blocks, determining a second reference prediction parameter set for the current block; wherein the second reference prediction parameter set includes multiple second candidate reference prediction parameters; determining multiple first candidate reference prediction parameters based on the multiple second candidate reference prediction parameters; and determining multiple candidate mapping relationships between the first color component and the second color component based on the multiple first candidate reference prediction parameters; 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 sample value of the first color component of the current block.

[0724] In one specific embodiment, determining the target mapping relationship from multiple candidate mapping relationships may include: calculating the cost of each of the multiple candidate mapping relationships to determine the cost result corresponding to each of the multiple candidate mapping relationships; determining the minimum cost result from the cost results corresponding to each of the multiple candidate mapping relationships; and determining the candidate mapping relationship corresponding to the minimum cost result as the target mapping relationship.

[0725] It should be noted that, in the embodiments of this application, the cost result can be determined by the distortion value, specifically by the rate-distortion cost method; 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 are not specifically limited here.

[0726] Furthermore, in some embodiments, the method further includes: determining a mapping relationship index value, wherein the mapping relationship index value is used to indicate the index number of the target mapping relationship among multiple candidate mapping relationships; encoding the mapping relationship index value, and writing the obtained encoded bits into a code stream.

[0727] It should also be noted that, in this embodiment of the application, the index value of the mapping relationship can be determined and written into the code stream based on the index number of the candidate mapping relationship corresponding to the minimum cost result among 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.

[0728] In other words, in this embodiment, 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 region are obtained, and the positions of these blocks include, but are not limited to, the following positions, as shown in Figure 11. These multiple blocks can correspond to multiple luminance BVs. These multiple luminance BVs respectively construct their own candidate lists for chrominance BVCs. The availability of BVs in the candidate lists is determined to decide on one or more BVs, or to determine multiple groups of BVs through clustering. Each available chrominance BVC of these multiple blocks can establish a mapping table (LUT). At the decoding end, the mapping relationship index value can be determined by decoding the corresponding syntax elements. Then, based on the mapping relationship index value, the target mapping relationship can be determined, thereby determining the chrominance prediction value of the current block. It should be noted that the number of mapping relationships established here can be arbitrarily set, for example, it can be set to 4, but there is no limitation.

[0729] In some embodiments, for determining the predicted value of the second color component of the current block, the method may include: when the first color component block of the current block includes multiple candidate blocks, determining a second reference prediction parameter set for the current block; wherein the second reference prediction parameter set includes multiple second candidate reference prediction parameters; determining multiple first candidate reference prediction parameters based on the multiple second candidate reference prediction parameters; and determining multiple candidate mapping relationships between the first color component and the second color component based on the multiple first candidate reference prediction parameters; calculating the matching error of the multiple candidate mapping relationships based on template matching to determine the second generation value of each of the multiple candidate mapping relationships; determining the minimum generation value from the second generation values ​​of each of the multiple candidate mapping relationships, and determining the candidate mapping relationship corresponding to the minimum generation value as the target mapping relationship; and determining the predicted value of the second color component of the current block based on the target mapping relationship and the sample value of the first color component of the current block.

[0730] In one specific embodiment, calculating the matching error of multiple candidate mapping relationships based on template matching to determine the second-generation value of each candidate mapping relationship may include: determining a first template for the current block; determining the reconstructed pixel sample value of a first color component region template at the same position as the first template; determining the predicted value of the second color component of the first template under the multiple mapping relationships based on the multiple candidate mapping relationships and the reconstructed pixel sample value of the first color component region template; and calculating the cost based on the reconstructed value of the second color component of the first template and the predicted value of the second color component of the first template under the multiple mapping relationships to determine the second-generation value of each candidate mapping relationship.

[0731] It should be noted that in this embodiment, multiple mapping tables (LUTs) between luminance and chrominance can be established, and then a template is used to select which mapping table LUT to use. For example, multiple blocks of the same luminance region are obtained, and the positions of these blocks include, but are not limited to, the following positions, as shown in Figure 11. These multiple blocks can correspond to multiple luminance values ​​(BVs). Each of these luminance BVs constructs its own candidate list for chrominance values ​​(BVCs). The availability of BVs in the candidate list is determined to decide on one or more BVs, or multiple groups of BVs can be determined through clustering. Each available chrominance BVC of these multiple blocks can establish a mapping table LUT. The current block template is predicted using different mapping table LUTs, and the difference is calculated with the reconstructed value of the template to determine which mapping relationship to use. Then, the final determined mapping relationship 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 arbitrarily set, for example, it can be set to 4, but there is no limitation.

[0732] In one specific embodiment, the process of performing LUT prediction on the current block template is as follows:

[0733] Obtain the reconstructed luminance sample recBef DownLumaR at the position of the luminance region 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 with the same sample range.

[0734] Assuming the predicted value of the current block template is predSamplesR, then for predSamplesR[cIdx][x][y], the variable cIdx specifies the color component index of the current block. The prediction method is to 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: checking in the order of {Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3}. If none of the above values ​​can be matched in the mapping relationship, then the chromaticity predicted value of the current block is set to the average value of the reconstructed chromaticity sample recBvChroma at the corresponding BV.

[0735] When calculating costs for the current block template and the template prediction values ​​for each LUT, the template usage can be categorized into the following scenarios:

[0736] The first scenario: Both the top and left templates of the current block exist, in which case both the top and left templates are available.

[0737] The second type: only the top template exists in the current block, in which case only the top template is available.

[0738] The third type: only the left template exists in the current block, in which case only the left template is available.

[0739] The fourth type: If neither the template on the current block nor the template on the left exists, the final LUT selected will be the first LUT created or a LUT at a specified position.

[0740] For example, in this embodiment of the application, assuming the reconstruction value of the current block template is recSamplesR, there are multiple choices for the cost function to calculate the cost of the template region. For example, evaluation criteria such as Sum of Absolute Errors (SAD), Sum of Transformed Absolute Errors (SATD), Sum of Squared Differences (SSE), Mean Absolute Difference (MAD), Mean Absolute Error (MAE), and Mean Squared Error (MSE) can be selected. Any of the evaluation criteria mentioned below can be chosen from the above criteria. Taking the SAD evaluation criterion as an example, the calculation formula is as follows:

[0741] Where predTempSizeW is the width of the template, predTempSizeH is the height of the template, predSamplesR[i][j] is the predicted pixel of the current block template after LUT, and recSamplesR[i][j] is the reconstructed pixel of the current block template.

[0742] It should also be noted that, in this embodiment, when selecting the final LUT using the current block template, except for cases where the cost cannot be calculated, the cost of each candidate LUT 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, and bucket sort. The candidate LUT with the lowest cost is selected as the final LUT used.

[0743] S2006, Determine the residual value of the second color component of the current block based on the predicted value of the second color component of the current block.

[0744] It should be noted that, in this embodiment, the initial value of the second color component of the current block is determined; based on the initial value and the predicted value, the residual value of the second color component of the current block is determined. Specifically, the residual value of the second color component of the current block can be obtained by subtracting the initial value and the predicted value.

[0745] In some embodiments, the method further includes: encoding the residual value of the second color component of the current block and writing the obtained encoded bits into the bitstream. This enables the subsequent decoding end to recover the reconstructed value of the second color component of the current block based on the residual value and the predicted value.

[0746] In some embodiments, determining the prediction parameters of the current block may include: determining the prediction mode of the current block; and determining the prediction parameters of the current block based on the prediction mode of the current block.

[0747] It should be noted that, in the embodiments of this application, determining the prediction mode of the current block may include: determining multiple candidate modes of the current block; wherein, the multiple candidate modes include a first prediction mode and other prediction modes besides the first prediction mode; calculating the cost of the multiple candidate modes based on a preset cost method, and determining the cost result corresponding to each of the multiple candidate modes; determining the minimum cost result from the cost results corresponding to each of the multiple candidate modes, and determining the candidate mode corresponding to the minimum cost result as the prediction mode of the current block; wherein, the preset cost method includes at least one of the following: rate-distortion cost method and template matching method.

[0748] It should also be noted that, in the embodiments of this application, the prediction mode for the current block can be the BVG-LUT mode and other modes used simultaneously at the encoding end. Specifically, in DM mode, in addition to the BVG-LUT mode, other modes can compete. The final mode used is determined based on the template cost. For example, instead of directly using the BV obtained from luminance, it can directly use BV replication, or it can use the BVG-LUT mode defined in the embodiments of this application. After both modes are applied to the template of the current block, the one with the lower template cost is selected as the prediction mode for the current block.

[0749] In some embodiments, the method further includes: determining a first color component region at the same location of the current block; if the current block uses DM mode and the first color component region is predicted based on the block vector, then determining that the current block uses a first prediction mode.

[0750] It should be noted that, in the embodiments of this application, the first color component region at the same position of the current block is determined; if the current block uses DM mode and the first color component region is predicted based on the block vector, then the current block is determined to use the first prediction mode.

[0751] For example, in the embodiments of this application, under dual-tree partitioning and DM mode, if the corresponding luminance region has BV information, the current block is predicted using the first prediction mode (BVG-LUT mode). For example:

[0752] If CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] equals MODE_IBC, and intra_bvglut_flag is set to 1, then the chroma intra-prediction mode IntraPredModeC[xCb][yCb] uses BVG-LUT.

[0753] If CuPredMode[0][xCb+cbWidth / 2][yCb+cbHeight / 2] equals MODE_INTRA, and if IntraTmpFlag[xCb+cbWidth / 2][yCb+cbHeight / 2] equals 1, then set intra_bvglut_flag = 1, and the chroma intra-prediction mode IntraPredModeC[xCb][yCb] uses BVG-LUT.

[0754] In this embodiment, the first syntax element can be used to indicate whether the current block uses the BVG-LUT mode. The first syntax element can be represented by intra_bvgplt_flag or bvgplt_flag. The chroma prediction mode is derived as follows:

[0755] The chroma intra-prediction mode IntraPredModeC[xCb][yCb] uses cclm_mode_flag, cclm_mode_idx, intra_chroma_pred_mode, lumaIntraPredMode, and lumaTempPredMode as specified in the table below. These filler items, other than BVG-LUT modes, are provided as examples of corresponding values ​​and are not required to be filled in with these values. Table 9 shows an example of chroma prediction mode derivation. As shown in Table 9, 0 represents Planar mode, 1 represents DC mode, 18 represents horizontal mode, 50 represents vertical mode, and 81-83 represent CCLM mode.

[0756] As shown in Table 9, in DM mode, if intra_bvglut_flag == 1, that is, the information obtained from the center position block of the same luminance region contains BV, then the chroma intra-prediction mode IntraPredModeC[xCb][yCb] uses the BVG-LUT mode.

[0757] In some embodiments, the method further includes: determining the value of a second syntax element; and when the second syntax element indicates that the current block is allowed to use a first prediction mode, performing the step of determining the prediction parameters of the current block.

[0758] In some embodiments, the method further includes: determining the value of a second syntax element; wherein the second syntax element is used to indicate whether the current block is allowed to use a first prediction mode; encoding the value of the second syntax element and writing the obtained encoded bits into the bitstream.

[0759] It should be noted that, in the embodiments of this application, the second syntax element can be represented by BvglutEnabled. If the value of the second syntax element is a first value, then the second syntax element indicates that the current block is allowed to use the first prediction mode; if the value of the second syntax element is a second value, then the second syntax element indicates that the current block is not allowed to use the first prediction mode.

[0760] It should also be noted that, in the embodiments of this application, the first value and the second value are different. The first value and the second value can be in parameter form or in numeric form. Specifically, both the first syntax element and the second syntax element can be parameters written in the profile, or the value of a flag / identifier; no limitations are imposed here.

[0761] For example, the first value can be set to 1 and the second value can be set to 0; or, the first value can be set to 0 and the second value can be set to 1; or, the first value can be set to true and the second value can be set to false; or, the first value can be set to false and the second value can be set to true. In this embodiment of the application, the first value can be set to 1 and the second value can be set to 0, but there is no limitation on this.

[0762] For example, in this embodiment of the application, if the syntax element sps_ibc_enabled_flag is equal to 0 and sps_intratmp_enabled_flag is equal to 0, then BvglutEnabled is equal to 0. Otherwise, the variable ModeIncludeBv is set; if the corresponding luma block is not encoded in a mode with BV information, then ModeIncludeBv is equal to 0; otherwise, ModeIncludeBv is equal to 1.

[0763] In one possible implementation, BvglutEnabled equals 1 if multiple of the following conditions are true simultaneously (including but not limited to the following):

[0764] ModeIncludeBv equals 1;

[0765] sh_slice_type equals I-frame;

[0766] CtbLog2SizeC is less than or equal to MaxChromaIbcSize; where MaxChromaIbcSize can be determined based on the chromaticity CTU size or a preset value.

[0767] In another possible implementation, BvglutEnabled equals 1 if multiple of the following conditions are true simultaneously (including but not limited to the following):

[0768] ModeIncludeBv equals 1;

[0769] CtbLog2SizeC is less than or equal to MaxChromaIbcSize; where MaxChromaIbcSize can be determined based on the chromaticity CTU size or a preset value.

[0770] In another possible implementation, BvglutEnabled equals 1 if multiple of the following conditions are true simultaneously (including but not limited to the following conditions):

[0771] CtbLog2SizeC is less than or equal to MaxChromaIbcSize; where MaxChromaIbcSize can be determined based on the chromaticity CTU size or a preset value.

[0772] For each possible implementation, BvglutEnabled is equal to 0; otherwise, BvglutEnabled is equal to 0. Here, if BvglutEnabled is equal to 0, then the value of the first syntax element can be inferred to be 0.

[0773] Furthermore, this application embodiment also provides a bitstream, 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: the residual value of the second color component of the current block, the value of the filter identification information, the mapping relationship index value, the value of the first syntax element, and the value of the second syntax element.

[0774] In this embodiment of the application, the filter identification information is used to indicate the downsampling method of the current block, the first syntax element is used to indicate whether the current block uses the first prediction mode, and the second syntax element is used to indicate whether the current block is allowed to use the first prediction mode.

[0775] This embodiment provides an encoding method that determines the prediction parameters of the current block; determines a first reference prediction parameter set for the current block based on the prediction parameters; wherein the first reference prediction parameter set includes one or more first candidate reference prediction parameters; determines a first color component reference sample and a second color component reference sample for the current block based on the first reference prediction parameter set; determines 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 the predicted value of the second color component of the current block based on the mapping relationship and the first color component sample of the current block. Thus, if the current block uses the BVG-LUT mode, the first reference prediction parameter set for the applied chroma component can be determined, and the luminance component reference sample and chroma component reference sample of the current block can be determined based on the first reference prediction parameter set, thereby establishing a mapping relationship between the luminance component and the chroma component, and then using this mapping relationship to predict the chroma component. In other words, this method fully utilizes the correlation between the reconstructed samples and the current block samples in the current image, improving the uniqueness of chromaticity prediction and thus enhancing the accuracy of chromaticity prediction. Moreover, based on the established mapping relationship, pixel-level prediction can be effectively performed, thereby further saving bitrate, improving encoding and decoding efficiency, and ultimately enhancing encoding and decoding performance.

[0776] In another embodiment of this application, based on the encoding and decoding method described in the foregoing embodiments, this application adds a new prediction mode, BVG-LUT mode (i.e., Scheme 1). In the process of Scheme 1, from the decoding side, the decoded bitstream determines the prediction parameters of the current block. When the prediction parameters indicate that the current block uses the BVG LUT mode, the BV of the corresponding luma block is obtained, and the luma BV (BVL) is adjusted and applied to chroma to construct a candidate list of chroma BV (BVC). Then, it is determined whether the BVC candidates in the candidate list of chroma BVC are available: if available, the decision-making process is initiated; if unavailable, the BVC can be adjusted to be available and then proceed to the decision-making process or discarded. Then, the reconstructed luma sample and reconstructed chroma sample at the set position of the current block are directly used to construct the mapping relationship between the luma component and the chroma component, and then BV-based chroma prediction is performed.

[0777] For example, Figure 22 is a detailed flowchart of an encoding method provided in an embodiment of this application. As shown in Figure 22, the detailed flowchart may include:

[0778] S2201: Determine whether the BVG-LUT mode is applied to the current block.

[0779] S2202: Obtain the corresponding brightness block.

[0780] S2203: Construct a candidate list of luminance BVL values.

[0781] S2204: Construct a candidate list for chroma BVC.

[0782] S2205: Determine whether the candidate BV is available.

[0783] S2206: If candidate BVs are available, then decide on the final chromaticity BV.

[0784] S2207: Chromaticity prediction based on chromaticity BV.

[0785] S2208: Use other prediction modes for chromaticity prediction.

[0786] It should be noted that, in this embodiment of the application, for step S2201, if the determination result is negative, i.e., the BVG-LUT mode is not applied to the current block, then step S2208 is executed; if the determination result is positive, i.e., the BVG-LUT mode is applied to the current block, then steps S2202 to S2207 are executed. Furthermore, for step S2205, if the determination result is negative, it is directly discarded, and then step S2207 is executed; if the determination result is positive, then step S2206 is executed to perform a BV decision, and then step S2207 is executed.

[0787] In one specific embodiment, the encoding method of this application may include:

[0788] S1: Obtain the corresponding luminance block (specifically, obtain the reference luminance block corresponding to the current block's chromaticity component).

[0789] The methods for obtaining this information include, but are not limited to:

[0790] (Method 1) Obtain the center position block of the same brightness region, as shown in Figure 3:

[0791] Obtain the position of the current chroma block, that is, the position of the top left chroma sample of the current chroma block relative to the top left chroma sample of the current image, chromaPos=(x,y). Scale chromaPos according to the chroma sampling format shown in Table 4 to obtain the position of the corresponding brightness region of the current chroma block, lumaPos=(xCb,yCb).

[0792] Assume that the position of the corresponding luminance pixel at the top left corner of the current chroma coding block relative to the luminance pixel at the top left corner of the image is (xCb, yCb), and the width of the corresponding luminance region of the current chroma coding block is cbWidth, and the height is cbHeight.

[0793] The center position of the brightness region is a brightness block containing position coordinates (xCb+cbWidth>>1, yCb+cbHeight>>1); multiple positions can be searched from this brightness block position to the upper left, upper, and left, including but not limited to the search positions in the following examples:

[0794] Obtain the left-upward coordinate offset (xOffset, yOffset) = (-2, -2), the upward coordinate offset (xOffset, yOffset) = (0, -2), and the left-side coordinate offset (xOffset, yOffset) = (-2, 0) of the center position block of the same brightness region. The brightness block used for the brightness region is the brightness block containing the position coordinates (xCb+cbWidth>>1+xOffset, yCb+cbHeight>>1+yOffset).

[0795] (Method 2) Obtain the block at the top left corner of the same brightness region, as shown in Figure 9:

[0796] Obtain the position of the current chroma block, that is, the position of the top left chroma sample of the current chroma block relative to the top left chroma sample of the current image, chromaPos=(x,y). Scale chromaPos according to the chroma sampling format shown in Table 4 to obtain the position of the corresponding brightness region of the current chroma block, lumaPos=(xCb,yCb).

[0797] Assume that the position of the corresponding luminance pixel at the top left corner of the current chroma coding block relative to the luminance pixel at the top left corner of the image is (xCb, yCb), and the width of the corresponding luminance region of the current chroma coding block is cbWidth, and the height is cbHeight.

[0798] The top-left corner block of the brightness region is the brightness block containing the position coordinates (xCb, yCb); multiple positions can be searched from this brightness block position to the top left, top, and left, including but not limited to the search positions in the following examples:

[0799] Obtain the top-left coordinate offsets of the top-left corner block of the corresponding brightness region: (xOffset, yOffset) = (-2, -2), (xOffset, yOffset) = (0, -2), and (xOffset, yOffset) = (-2, 0). The brightness block used for the brightness region is the brightness block containing the position coordinates (xCb+xOffset, yCb+yOffset).

[0800] (Method 3) Obtain the block at the lower right corner of the same brightness region, as shown in Figure 10:

[0801] Obtain the position of the current chroma block, that is, the position of the top left chroma sample of the current chroma block relative to the top left chroma sample of the current image, chromaPos=(x,y). Scale chromaPos according to the chroma sampling format shown in Table 4 to obtain the position of the corresponding brightness region of the current chroma block, lumaPos=(xCb,yCb).

[0802] Assume that the position of the corresponding luminance pixel at the top left corner of the current chroma coding block relative to the luminance pixel at the top left corner of the image is (xCb, yCb), and the width of the corresponding luminance region of the current chroma coding block is cbWidth, and the height is cbHeight.

[0803] The top-left corner block of the brightness region is the brightness block containing the position coordinates (xCb+cbWidth-1, yCb+cbHeight-1); multiple positions can be searched from this brightness block position to the top left, top, and left, including but not limited to the search positions in the following examples:

[0804] Obtain the top-left offset (xOffset, yOffset) = (-2, -2), the upward offset (xOffset, yOffset) = (0, -2), and the left offset (xOffset, yOffset) = (-2, 0) of the bottom-right corner block of the same brightness region. The brightness block used in the brightness region is the brightness block containing the position coordinates (xCb + cbWidth-1 + xOffset, yCb + cbHeight-1 + yOffset).

[0805] (Method 4) In the block containing five brightness pixel positions shown in Figure 11 (including but not limited to five positions, which may be multiple different positions), the pixels are obtained sequentially. The order of obtaining the pixels sequentially includes but is not limited to the following order: C->TL->TR->BL->BR.

[0806] Detailed derivation of the positions of C, TL, TR, BL, and BR:

[0807] Obtain the position of the current chroma block, that is, the position of the top left chroma sample of the current chroma block relative to the top left chroma sample of the current image, chromaPos=(x,y). Scale chromaPos according to the chroma sampling format shown in Table 4 to obtain the position of the corresponding brightness region of the current chroma block, lumaPos=(xCb,yCb).

[0808] The position of the corresponding luminance pixel at the top left corner of the current chroma coding block relative to the luminance pixel at the top left corner of the image (i.e., the position of the luminance pixel TL) is (xCb, yCb). The width of the corresponding luminance region of the current chroma coding block is cbWidth, and the height is cbHeight.

[0809] The coordinates of the position of the brightness pixel C are (xCb+cbWidth / 2, yCb+cbHeight / 2);

[0810] The coordinates of the position of the brightness pixel TL are (xCb, yCb);

[0811] The coordinates of the position of the luminance pixel TR are (xCb+cbWidth-1,yCb);

[0812] The coordinates of the position of the luminance pixel BL are (xCb, yCb+cbHeight-1);

[0813] The coordinates of the position of the luminance pixel BR are (xCb+cbWidth-1, yCb+cbHeight-1).

[0814] When searching for each location, multiple locations can be searched from that location to the upper left, upper, and left, including but not limited to the following examples: obtaining the upper-left coordinate offset (xOffset, yOffset) = (-2, -2), the upper coordinate offset (xOffset, yOffset) = (0, -2), and the left coordinate offset (xOffset, yOffset) = (-2, 0). The luminance block used for the luminance area is a luminance block that contains the coordinates of that location plus the coordinates of the aforementioned offset locations.

[0815] S2: Construct a candidate list of luminance BVL values.

[0816] Based on the luminance block obtained in S1, the obtained BVL information encoded in the mode with BV information is scaled, that is, the chromaticity BV information BVC is obtained by means of S3, and then the availability is judged in step S4. If it is available, this BVL information is added to the BVL list.

[0817] S3: Construct a candidate list for chroma BVC.

[0818] For the BVL candidate list obtained by S2, assume that the brightness BV in the list is equal to (BVL) hor BVL ver ), chromaticity BV = (BVC) hor BVC ver A candidate list of chroma BVCs containing one or more candidates can be constructed by adjusting BVL or BVC. The construction method is described below. One of these methods can be used to construct the candidate list, or multiple methods can be used simultaneously.

[0819] Method 1: Scale the chroma sampling format shown in Table 8 and add the scaled BVC to the chroma BVC candidate list.

[0820] Method 2: After obtaining the BV of the corresponding luma block, denote it as BVL. The chromaticity BV obtained through BVL is denoteed as BVC. By adjusting BVL or BVC, construct a chromaticity BVC candidate with one or more candidates.

[0821] Candidate construction methods include, but are not limited to, the following:

[0822] Method 1: Adjust BVL to form four cases, thereby achieving the adjustment of BVC.

[0823] When BVL is odd, 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 scenarios.

[0824] When BVL is even, take BVL = (BVL) hor, BVL ver ).

[0825] or:

[0826] When BVL is even, 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 scenarios.

[0827] Here, BVC[0] = BVL[0] * 2 / SubWidthC; BVC[1] = BVL[1] * 2 / SubHeightC. SubWidthC and SubHeightC are determined according to the correspondence between sps_chroma_format_idc and the chroma format sampling structure in Table 1.

[0828] The BVL is scaled according to the above formula to obtain the BVC. This results in four BVC candidates when the BVL is odd or even. These candidates are added to the chroma BVC candidate list. Then, the S5 method is used to determine one BVC from the four BVCs of each BVL.

[0829] Method 2: Adjust BVL to form four cases, thereby achieving the adjustment of BVC.

[0830] When BVL is odd, 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 scenarios.

[0831] When BVL is even, 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 scenarios.

[0832] The BVL is scaled according to the chroma sampling format in Method 1 to obtain the BVC. This results in four BVC candidates for both odd and even BVL values. These candidates are then added to the chroma BVC candidate list. Alternatively, this method can unify the operations for odd and even numbers using the following calculation: Take 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 scenarios.

[0833] Method 3: Adjust BVL to create multiple scenarios, thereby enabling adjustments to BVC.

[0834] When BVL is odd, 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 For cases such as -2), a list is constructed sequentially for these candidates.

[0835] When BVL is even, 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 other situations.

[0836] The BVL is scaled according to the chroma sampling format in Method 1 to obtain the BVC. This will generate multiple BVC candidates when the BVL is odd or even. These candidates are then added to the chroma BVC candidate list.

[0837] Similar to method two, it can also be uniformly expressed as: 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.

[0838] Method 4: Adjust the BVC obtained from Method 1 to obtain nine candidates.

[0839] 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, BVCver -1), thus forming nine BVC candidates, which are then added to the chroma BVC candidate list.

[0840] Construction Method 5: Adjust the BVC obtained from Method 1 to obtain multiple candidates.

[0841] 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 = (BVC) hor +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, and adding these candidates to the chroma BVC candidate list.

[0842] S4: Determine if BV is available.

[0843] Get the position of the current chroma block (xCb, yCb), get all BVC candidates obtained in S3, and for each BVC candidate, BVC = (BVC...hor BVC ver Find the corresponding offset position (xCb+BVC) hor ,yCb+BVC ver The following conditions are considered, including but not limited to: If all of them are true, then the candidate chromaticity color volume (BVC) is usable. This constructs a list of usable BVC candidates:

[0844] Does the obtained offset position not exceed the Picture boundary?

[0845] Whether the obtained offset position does not cover the current block, as shown in Figure 12;

[0846] xCb+width+BVC hor <= xCb or yCb + height + BVC ver <= yCb;

[0847] Whether the obtained offset position does not exceed the available area, as shown in Figure 13;

[0848] Has the obtained offset position been reconstructed?

[0849] If at least one BVC candidate is available, proceed to S5 to make a BV decision. If none are available, obtain the luminance and chrominance pixels at a set location, which includes, but is not limited to, the adjacent row and column of the current block, and proceed to S6 to build a LUT using template pixels.

[0850] S5: Decision BV.

[0851] It should be noted that if the available BVC candidate list obtained by S4 contains only one BVC candidate, then the BVC finally selected is that BVC.

[0852] It should also be noted that if the available BVC candidate list obtained by S4 contains multiple BVC candidates, then a decision needs to be made on these BVCs to obtain the final BV. The decision-making methods include, but are not limited to, the following:

[0853] Use all available BVCs at the top of the BVC candidate list.

[0854] or:

[0855] Using templates for decision-making:...

Claims

A decoding method, applied to a decoder, the method comprising: Determine the prediction parameters for the current block; Based on the prediction parameters, a first reference prediction parameter set for the current block is determined; wherein, the first reference prediction parameter set includes one or more first candidate reference prediction parameters; Based on the first reference prediction parameter set, determine the first color component reference sample value and the second color component reference sample value of the current block; Based on the first color component reference sample value and the second color component reference sample value, determine the mapping relationship between the first color component and the second color component; Based on the mapping relationship and the sample value of the first color component of the current block, the predicted value of the second color component of the current block is determined. According to the method of claim 1, wherein, The determination of the prediction parameters for the current block includes: Decode the bitstream to determine the value of the first syntax element; The prediction parameters of the current block are determined based on the value of the first syntax element. According to the method of claim 1, wherein, Determining the first reference prediction parameter set for the current block based on the prediction parameters includes: When the prediction parameters indicate that the current block uses a first prediction mode, a first reference prediction parameter set for the current block is determined. According to the method of claim 1, wherein, Determining the first reference prediction parameter set for the current block includes: Determine the first color component block of the current block; Based on the first color component block, a second reference prediction parameter set for the current block is determined; wherein the second reference prediction parameter set contains one or more second candidate reference prediction parameters; The first reference prediction parameter set of the current block is determined based on the second reference prediction parameter set. The method according to claim 4, wherein, The first candidate reference prediction parameter is a vector parameter based on the second color component, and the second candidate reference prediction parameter is a vector parameter based on the first color component. The method according to claim 5, wherein, The vector parameters include one of the following: block vector parameters and motion vector parameters. The method according to claim 4, wherein, Determining the first color component block of the current block includes: Determine the first color component region at the same position as the current block; Based on multiple partitions of the first color component region, the first color component block of the current block is determined. The method according to claim 7, wherein, The step of determining the first color component block of the current block based on multiple partitioned blocks of the first color component region includes: From the plurality of partitioned blocks, determine the first candidate block at the first position; Based on the first candidate block at the first position, determine the first color component block of the current block. The method according to claim 8, wherein, Determining the first color component block of the current block based on the first candidate block at the first position includes: Perform a position offset search within a preset search area at the first position to determine multiple second candidate blocks; The first color component block of the current block is determined based on the first candidate block and / or the plurality of second candidate blocks. The method according to claim 4, wherein, The step of determining the second reference prediction parameter set for the current block based on the first color component block includes: Based on the first color component block, determine one or more candidate vector parameters based on the first color component; A second reference prediction parameter set for the current block is determined based on one or more candidate vector parameters based on the first color component. The method according to claim 10, wherein, Determining the second reference prediction parameter set for the current block based on the one or more candidate vector parameters based on the first color component includes: The candidate vector parameters based on the first color component are adjusted to determine the candidate vector parameters based on the second color component; When the candidate vector parameters based on the second color component meet the preset availability conditions, the candidate vector parameters based on the first color component are used as the second candidate reference prediction parameters and added to the second reference prediction parameter set. The method according to claim 11, wherein, The step of adjusting the candidate vector parameters based on the first color component to determine the candidate vector parameters based on the second color component includes: Determine the preset sampling format of the current block; The candidate vector parameters based on the first color component are scaled according to the preset sampling format to determine the candidate vector parameters based on the second color component. The method according to claim 4, wherein, The step of determining the first [number] of the current block based on the second reference prediction parameter set. A reference prediction parameter set, including: Adjust one or more second candidate reference prediction parameters in the second reference prediction parameter set to determine the first candidate reference prediction parameter corresponding to each of the one or more second candidate reference prediction parameters; The first reference prediction parameter set of the current block is determined based on the first candidate reference prediction parameters corresponding to each of the one or more second candidate reference prediction parameters. The method according to claim 13, wherein, The step of adjusting one or more second candidate reference prediction parameters in the second reference prediction parameter set, and determining the first candidate reference prediction parameter corresponding to each of the one or more second candidate reference prediction parameters, includes: The second candidate reference prediction parameters are adjusted to determine a third reference prediction parameter set based on the second color component; Based on the third set of reference prediction parameters, the first candidate reference prediction parameter corresponding to the second candidate reference prediction parameter is determined. The method according to claim 14, wherein, The step of adjusting the second candidate reference prediction parameters to determine the third reference prediction parameter set based on the second color component includes: The second candidate reference prediction parameters are scaled according to the preset sampling format of the current block to determine the candidate vector parameters based on the second color component, and the candidate vector parameters based on the second color component are added to the third reference prediction parameter set. The method according to claim 14, wherein, The step of adjusting the second candidate reference prediction parameters to determine the third reference prediction parameter set based on the second color component includes: The second candidate reference prediction parameters are scaled according to the preset sampling format of the current block to determine the first initial vector parameters based on the second color component; The first initial vector parameter based on the second color component is offset according to one or more offset values ​​to determine one or more candidate vector parameters based on the second color component, and the one or more candidate vector parameters based on the second color component are added to the third reference prediction parameter set. The method according to claim 14, wherein, The step of adjusting the second candidate reference prediction parameters to determine the third reference prediction parameter set for the second color component includes: The second candidate reference prediction parameters are offset based on one or more offset values ​​to determine one or more second initial vector parameters based on the first color component; The one or more second initial vector parameters based on the first color component are scaled according to the preset sampling format of the current block to determine one or more candidate vector parameters based on the second color component, and the one or more candidate vector parameters based on the second color component are added to the third reference prediction parameter set. The method according to claim 14, wherein, The step of determining the first candidate reference prediction parameter corresponding to the second candidate reference prediction parameter based on the third reference prediction parameter set includes: When there are one or more candidate vector parameters in the third reference prediction parameter set that satisfy the preset availability conditions, the first candidate reference prediction parameter is determined based on the one or more candidate vector parameters. The method according to claim 18, wherein, The one or more candidate vector parameters satisfy preset availability conditions, including at least: The offset position indicated by the one or more candidate vector parameters does not exceed the image boundary; The offset position indicated by the one or more candidate vector parameters does not exceed the slice boundary; The offset position indicated by the one or more candidate vector parameters does not cover the current block; The offset position indicated by the one or more candidate vector parameters does not exceed the preset available area; The offset positions indicated by the one or more candidate vector parameters have been reconstructed. The method according to claim 18, wherein, Determining the first candidate reference prediction parameter based on the one or more candidate vector parameters includes: If the third reference prediction parameter set has a candidate vector parameter that satisfies a preset availability condition, then the candidate vector parameter that satisfies the preset availability condition is determined as the first candidate reference prediction parameter; If the third reference prediction parameter set contains multiple candidate vector parameters that satisfy preset availability conditions, then a decision is made on the multiple candidate vector parameters that satisfy the preset availability conditions to determine the first candidate reference prediction parameter. The method according to claim 20, wherein, The step of making a decision on multiple candidate vector parameters that meet the preset availability conditions to determine the first candidate reference prediction parameter includes: Determine the first template of the current block; Based on the first template and the plurality of candidate vector parameters, a first matching template is determined for each of the plurality of candidate vector parameters; When the first template and the first matching template satisfy a preset existence condition, the matching error between the first template and the first matching template of the current block is calculated according to a preset error criterion to determine the first generation value of each of the multiple candidate vector parameters; The minimum generation value is determined from the first generation values ​​of each of the multiple candidate vector parameters, and the candidate vector corresponding to the minimum generation value is... The parameters are determined to be the first candidate reference prediction parameters. The method according to claim 21, wherein, The method further includes: When the first template and the first matching template do not satisfy a preset existence condition, the first candidate vector parameter in the third reference prediction parameter set that satisfies a preset availability condition is determined as the first candidate reference prediction parameter; or... When the first template and the first matching template do not meet the preset existence condition, the candidate vector parameter at the second position in the third reference prediction parameter set that meets the preset availability condition is determined as the first reference prediction parameter. The method according to claim 14, wherein, The method further includes: When all candidate vector parameters in the third reference prediction parameter set do not meet the preset availability conditions, the first color component reconstruction sample and the second color component reconstruction sample at the third position of the current block are determined. Based on the reconstructed samples of the first and second color components at the third position, the reference values ​​of the first and second color components of the current block are determined. According to the method of claim 1, wherein, The step of determining the first color component reference sample value and the second color component reference sample value of the current block based on the first reference prediction parameter set includes: Based on the first reference prediction parameter set, determine the first color component reconstruction sample and the second color component reconstruction sample indicated by each of the one or more first candidate reference prediction parameters; Determine the first color component reconstruction sample and the second color component reconstruction sample at the third position of the current block; The first color component reference value and the second color component reference value of the current block are determined based on the first color component reconstruction sample and the second color component reconstruction sample indicated by the one or more first candidate reference prediction parameters, and the first color component reconstruction sample and the second color component reconstruction sample at the third position. The method according to claim 24, wherein, The step of determining the first color component reconstruction sample and the second color component reconstruction sample indicated by each of the one or more first candidate reference prediction parameters according to the first reference prediction parameter set includes: Determine the position of the current block; The position of the current block is scaled to determine the position of the first color component region at the same position of the current block; and the first candidate reference prediction parameter is scaled to determine the scaled reference prediction parameter of the first color component region at the same position of the current block. Based on the location of the first color component region and the scaled reference prediction parameters, a reference block for the first color component is determined, and based on the reference block for the first color component, a reconstructed sample of the first color component indicated by the first candidate reference prediction parameters is determined. Based on the position of the current block and the first candidate reference prediction parameter, a reference block for the second color component is determined, and based on the reference block for the second color component, a reconstructed sample for the second color component indicated by the first candidate reference prediction parameter is determined. The method according to claim 25, wherein, The step of determining the first color component reconstruction sample indicated by the first candidate reference prediction parameters based on the reference block of the first color component includes: The reference block of the first color component is downsampled to determine the first color component reconstruction sample indicated by the first candidate reference prediction parameter, so that the resolution of the first color component reconstruction sample is the same as the resolution of the second color component reconstruction sample. The method according to claim 25, wherein, The step of determining the second color component reconstruction sample indicated by the first candidate reference prediction parameters based on the reference block of the second color component includes: The reference block of the second color component is upsampled to determine the second color component reconstruction sample indicated by the first candidate reference prediction parameter, so that the resolution of the first color component reconstruction sample is the same as the resolution of the second color component reconstruction sample. Accordingly, the method further includes: downsampling the predicted value of the second color component of the current block. The method according to claim 26, wherein, The step of downsampling the reference block of the first color component to determine the reconstructed sample of the first color component indicated by the first candidate reference prediction parameters includes: Determine the downsampling method for the current block; The reference block of the first color component is downsampled according to the downsampling method to determine the reconstructed sample of the first color component indicated by the first candidate reference prediction parameter. The method according to claim 28, wherein, Determining the downsampling method for the current block includes: Decode the bitstream and determine the value of the filter identifier information; The downsampling method of the current block is determined based on the value of the filter identifier information. The method according to claim 24, wherein, Determining the first color component reconstruction sample and the second color component reconstruction sample at the third position of the current block includes: Determine the first template of the current block; Based on the first template, the first color component reconstruction sample and the second color component reconstruction sample at the third position are determined. The method according to claim 21 or 30, wherein, The type of the first template includes at least one of the following: top template, top right template, left template, bottom left template, and top left template; The upper template is located in the upper decoded area adjacent to the current block, and the upper right template is located in the right area adjacent to the current block. The upper decoded area, 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. The method according to any one of claims 1 to 31, wherein, The step of determining the mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value includes: A first lookup table is determined based on the first color component reference sample value and the second color component reference sample value, wherein the first lookup table is used to record the value of the second color component corresponding to the index key being the first color component. The method according to any one of claims 1 to 31, wherein, The step of determining the mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value includes: A first discrete model is determined 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. The method according to claim 32 or 33, wherein, The method further includes: The first color component reference sample value is mapped to make the first color component reference sample value fall within a preset sample range. The method according to claim 32 or 33, wherein, The method further includes: When multiple second reference samples in the first color component reference sample value are the same and correspond to different second reference samples in the second color component reference sample value, the overlay process is performed sequentially according to the sample order, and the last second reference sample value is taken as the value that has a mapping relationship with the first reference sample value. The method according to claim 32 or 33, wherein, The method further includes: When the first reference sample in the first color component reference sample is the same and corresponds to multiple second reference samples that are different in the second color component reference sample, the average value of the multiple second reference samples is calculated, and the obtained average value is used as a value that has a mapping relationship with the first reference sample. According to the method of claim 1, wherein, The method further includes: Determine the reconstructed pixel samples of the first color component region at the same position of the current block; The first color component sample value of the current block is determined based on the reconstructed pixel samples of the first color component region. According to the method of claim 1, wherein, Determining the 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 includes: If a first color component value equal to the first color component sample value is found in the mapping relationship, then 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. The method according to claim 38, wherein, The method further includes: If no first color component value equal to the first color component sample value is 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 continued to search for a first color component value equal to the first color component correction value. The method according to claim 39, wherein, The step of correcting the reconstructed value of the first color component to determine the corrected value of the first color component includes: The first color component sample value is offset by one or more preset offset values ​​to determine the first color component correction value. The method according to claim 39, wherein, The method further includes: If no first color component value equal to the first color component correction value is found in the mapping relationship, the average value of the second color component reference sample is calculated, and the obtained average value is determined as the predicted value of the second color component of the current block. According to the method of claim 1, wherein, Determining the 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 includes: Based on the mapping relationship and the sample value of the first color component of the current block, determine the first initial prediction value of the second color component of the current block; The first initial prediction value is corrected to determine the prediction value of the second color component of the current block. The method according to claim 42, wherein, The step of correcting the first initial prediction value to determine the prediction value of the second color component of the current block includes: The second color component of the current block is predicted 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; The first initial prediction value and the second initial prediction value are weighted and calculated to determine the prediction value of the second color component of the current block. According to the method of claim 1, wherein, The method further includes: Decode the bitstream and determine the residual value of the second color component of the current block; Based on the residual value and the predicted value, the reconstructed value of the second color component of the current block is determined. According to the method of claim 1, wherein, The method further includes: When the first reference prediction parameter set includes multiple first candidate reference prediction parameters, the first color component reconstruction sample and the second color component reconstruction sample indicated by each of the multiple first candidate reference prediction parameters are determined. Based on the first color component reconstructed sample and the second color component reconstructed sample indicated by the plurality of first candidate reference prediction parameters, a plurality of mapping relationships between the first color component and the second color component are determined. Based on the multiple mapping relationships, determine multiple third initial prediction values ​​for the second color component of the current block; The predicted value of the second color component of the current block is determined by weighting the multiple third initial prediction values. According to the method of claim 1, wherein, The method further includes: When the first color component block of the current block includes multiple candidate blocks, a second reference prediction parameter set for the current block is determined; wherein the second reference prediction parameter set contains multiple second candidate reference prediction parameters; Based on the plurality of second candidate reference prediction parameters, a plurality of first candidate reference prediction parameters are determined; Based on the multiple first candidate reference prediction parameters, multiple candidate mapping relationships between the first color component and the second color component are determined. Decode the bitstream and determine the mapping index values; The target mapping relationship is determined based on the mapping relationship index value and the multiple candidate mapping relationships; Based on the target mapping relationship and the sample value of the first color component of the current block, the predicted value of the second color component of the current block is determined. According to the method of claim 1, wherein, The method further includes: When the first color component block of the current block includes multiple candidate blocks, a second reference prediction parameter set for the current block is determined; wherein the second reference prediction parameter set contains multiple second candidate reference prediction parameters; Based on the plurality of second candidate reference prediction parameters, a plurality of first candidate reference prediction parameters are determined; Based on the multiple first candidate reference prediction parameters, multiple candidate mapping relationships between the first color component and the second color component are determined. The matching error of the multiple candidate mapping relationships is calculated based on template matching to determine the second-generation value of each of the multiple candidate mapping relationships. Determine the minimum generation value from the second generation values ​​of the plurality of candidate mapping relationships, and determine the candidate mapping relationship corresponding to the minimum generation value as the target mapping relationship; Based on the target mapping relationship and the sample value of the first color component of the current block, the predicted value of the second color component of the current block is determined. The method according to claim 47, wherein, The step of calculating the matching error of the multiple candidate mapping relationships based on template matching to determine the second-generation value of each of the multiple candidate mapping relationships includes: Determine the first template of the current block; Determine the reconstructed pixel sample value of the first color component region template at the same position as the first template; Based on the multiple candidate mapping relationships and the reconstructed pixel sample values ​​of the first color component region template, the predicted values ​​of the second color components of the first template under the multiple mapping relationships are determined. The second-generation value of each of the multiple candidate mapping relationships is determined by calculating the cost based on the reconstructed value of the second color component of the first template and the predicted value of the second color component of the first template under the multiple mapping relationships. According to the method of claim 1, wherein, The method further includes: Determine the first color component region at the same position as the current block; If the current block uses DM mode and the first color component region is predicted based on block vectors, then the current block is determined to use the first prediction mode. The method according to any one of claims 1 to 49, wherein, The method further includes: Determine the value of the second syntax element; When the second syntax element indicates that the current block is allowed to use the first prediction mode, the step of determining the prediction parameters of the current block is performed. An encoding method, applied to an encoder, the method comprising: Determine the prediction parameters for the current block; Based on the prediction parameters, a first reference prediction parameter set for the current block is determined; wherein, the first reference prediction parameter set includes one or more first candidate reference prediction parameters; Based on the first reference prediction parameter set, determine the first color component reference sample value and the second color component reference sample value of the current block; Based on the first color component reference sample value and the second color component reference sample value, determine the mapping relationship between the first color component and the second color component; Based on the mapping relationship and the sample value of the first color component of the current block, the predicted value of the second color component of the current block is determined. The method according to claim 51, wherein, The first reference prediction for the current block is determined based on the prediction parameters. The measurement parameter set includes: When the prediction parameters indicate that the current block uses a first prediction mode, a first reference prediction parameter set for the current block is determined. The method according to claim 52, wherein, The determination of the prediction parameters for the current block includes: Determine the first generation value of the current block using the first prediction mode, and determine the second generation value of the current block not using the first prediction mode; The prediction parameters are determined based on the first-generation value and the second-generation value. The method according to claim 53, wherein, Determining the prediction parameters based on the first-generation value and the second-generation value includes: If the value of the first generation is less than the value of the second generation, then the prediction parameter is determined to instruct the current block to use the first prediction mode; If the value of the first generation is greater than the value of the second generation, then the prediction parameter is determined to indicate that the current block does not use the first prediction mode. The method according to claim 54, wherein, The method further includes: Based on the prediction parameters, determine the value of the first syntax element; The value of the first syntax element is encoded, and the resulting encoded bits are written into the bitstream. The method according to claim 55, wherein, Determining the value of the first syntax element based on the prediction parameters includes: If the prediction parameter indicates that the current block uses the first prediction mode, then the value of the first syntax element is determined to be the first value; If the prediction parameter indicates that the current block does not use the first prediction mode, then the value of the first syntax element is determined to be the second value. The method according to claim 51, wherein, Determining the first reference prediction parameter set for the current block includes: Determine the first color component block of the current block; Based on the first color component block, a second reference prediction parameter set for the current block is determined; wherein the second reference prediction parameter set contains one or more second candidate reference prediction parameters; The first reference prediction parameter set of the current block is determined based on the second reference prediction parameter set. The method according to claim 57, wherein, The first candidate reference prediction parameter is a vector parameter based on the second color component, and the second candidate reference prediction parameter is a vector parameter based on the first color component. The method according to claim 58, wherein, The vector parameters include one of the following: block vector parameters and motion vector parameters. The method according to claim 57, wherein, Determining the first color component block of the current block includes: Determine the first color component region at the same position as the current block; Based on multiple partitions of the first color component region, the first color component block of the current block is determined. The method according to claim 60, wherein, The step of determining the first color component block of the current block based on multiple partitioned blocks of the first color component region includes: From the plurality of partitioned blocks, determine the first candidate block at the first position; Based on the first candidate block at the first position, determine the first color component block of the current block. The method according to claim 61, wherein, Determining the first color component block of the current block based on the first candidate block at the first position includes: Perform a position offset search within a preset search area at the first position to determine multiple second candidate blocks; The first color component block of the current block is determined based on the first candidate block and / or the plurality of second candidate blocks. The method according to claim 57, wherein, The step of determining the second reference prediction parameter set for the current block based on the first color component block includes: Based on the first color component block, determine one or more candidate vector parameters based on the first color component; A second reference prediction parameter set for the current block is determined based on one or more candidate vector parameters based on the first color component. The method according to claim 63, wherein, Determining the second reference prediction parameter set for the current block based on the one or more candidate vector parameters based on the first color component includes: The candidate vector parameters based on the first color component are adjusted to determine the candidate vector parameters based on the second color component; When the candidate vector parameters based on the second color component meet the preset availability conditions, the candidate vector parameters based on the first color component are used as the second candidate reference prediction parameters and added to the second reference prediction parameter set. The method according to claim 64, wherein, The step of adjusting the candidate vector parameters based on the first color component to determine the candidate vector parameters based on the second color component includes: Determine the preset sampling format of the current block; The candidate vector parameters based on the first color component are scaled according to the preset sampling format to determine the candidate vector parameters based on the second color component. The method according to claim 57, wherein, The step of determining the current block based on the second reference prediction parameter set. The first reference prediction parameter set includes: Adjust one or more second candidate reference prediction parameters in the second reference prediction parameter set to determine the first candidate reference prediction parameter corresponding to each of the one or more second candidate reference prediction parameters; The first reference prediction parameter set of the current block is determined based on the first candidate reference prediction parameters corresponding to each of the one or more second candidate reference prediction parameters. The method according to claim 66, wherein, The step of adjusting one or more second candidate reference prediction parameters in the second reference prediction parameter set, and determining the first candidate reference prediction parameter corresponding to each of the one or more second candidate reference prediction parameters, includes: The second candidate reference prediction parameters are adjusted to determine a third reference prediction parameter set based on the second color component; Based on the third set of reference prediction parameters, the first candidate reference prediction parameter corresponding to the second candidate reference prediction parameter is determined. The method according to claim 67, wherein, The step of adjusting the second candidate reference prediction parameters to determine the third reference prediction parameter set based on the second color component includes: The second candidate reference prediction parameters are scaled according to the preset sampling format of the current block to determine the candidate vector parameters based on the second color component, and the candidate vector parameters based on the second color component are added to the third reference prediction parameter set. The method according to claim 67, wherein, The step of adjusting the second candidate reference prediction parameters to determine the third reference prediction parameter set based on the second color component includes: The second candidate reference prediction parameters are scaled according to the preset sampling format of the current block to determine the first initial vector parameters based on the second color component; The first initial vector parameter based on the second color component is offset according to one or more offset values ​​to determine one or more candidate vector parameters based on the second color component, and the one or more candidate vector parameters based on the second color component are added to the third reference prediction parameter set. The method according to claim 67, wherein, The step of adjusting the second candidate reference prediction parameters to determine the third reference prediction parameter set for the second color component includes: The second candidate reference prediction parameters are offset based on one or more offset values ​​to determine one or more second initial vector parameters based on the first color component; The one or more second initial vector parameters based on the first color component are scaled according to the preset sampling format of the current block to determine one or more candidate vector parameters based on the second color component, and the one or more candidate vector parameters based on the second color component are added to the third reference prediction parameter set. The method according to claim 67, wherein, The step of determining the first candidate reference prediction parameter corresponding to the second candidate reference prediction parameter based on the third reference prediction parameter set includes: When there are one or more candidate vector parameters in the third reference prediction parameter set that satisfy the preset availability conditions, the first candidate reference prediction parameter is determined based on the one or more candidate vector parameters. The method according to claim 71, wherein, The one or more candidate vector parameters satisfy preset availability conditions, including at least: The offset position indicated by the one or more candidate vector parameters does not exceed the image boundary; The offset position indicated by the one or more candidate vector parameters does not exceed the slice boundary; The offset position indicated by the one or more candidate vector parameters does not cover the current block; The offset position indicated by the one or more candidate vector parameters does not exceed the preset available area; The offset positions indicated by the one or more candidate vector parameters have been reconstructed. The method according to claim 71, wherein, Determining the first candidate reference prediction parameter based on the one or more candidate vector parameters includes: If the third reference prediction parameter set has a candidate vector parameter that satisfies a preset availability condition, then the candidate vector parameter that satisfies the preset availability condition is determined as the first candidate reference prediction parameter; If the third reference prediction parameter set contains multiple candidate vector parameters that satisfy preset availability conditions, then a decision is made on the multiple candidate vector parameters that satisfy the preset availability conditions to determine the first candidate reference prediction parameter. The method according to claim 73, wherein, The step of making a decision on multiple candidate vector parameters that meet the preset availability conditions to determine the first candidate reference prediction parameter includes: Determine the first template of the current block; Based on the first template and the plurality of candidate vector parameters, a first matching template is determined for each of the plurality of candidate vector parameters; When the first template and the first matching template satisfy a preset existence condition, the matching error between the first template and the first matching template of the current block is calculated according to a preset error criterion to determine the first generation value of each of the multiple candidate vector parameters; The minimum generation value is determined from the first generation values ​​of each of the multiple candidate vector parameters, and the candidate vector corresponding to the minimum generation value is... The parameters are determined to be the first candidate reference prediction parameters. The method according to claim 74, wherein, The method further includes: When the first template and the first matching template do not satisfy a preset existence condition, the first candidate vector parameter in the third reference prediction parameter set that satisfies a preset availability condition is determined as the first candidate reference prediction parameter; or... When the first template and the first matching template do not meet the preset existence condition, the candidate vector parameter at the second position in the third reference prediction parameter set that meets the preset availability condition is determined as the first reference prediction parameter. The method according to claim 67, wherein, The method further includes: When all candidate vector parameters in the third reference prediction parameter set do not meet the preset availability conditions, the first color component reconstruction sample and the second color component reconstruction sample at the third position of the current block are determined. Based on the reconstructed samples of the first and second color components at the third position, the reference values ​​of the first and second color components of the current block are determined. The method according to claim 51, wherein, The step of determining the first color component reference sample value and the second color component reference sample value of the current block based on the first reference prediction parameter set includes: Based on the first reference prediction parameter set, determine the first color component reconstruction sample and the second color component reconstruction sample indicated by each of the one or more first candidate reference prediction parameters; Determine the first color component reconstruction sample and the second color component reconstruction sample at the third position of the current block; The first color component reference value and the second color component reference value of the current block are determined based on the first color component reconstruction sample and the second color component reconstruction sample indicated by the one or more first candidate reference prediction parameters, and the first color component reconstruction sample and the second color component reconstruction sample at the third position. The method according to claim 77, wherein, The step of determining the first color component reconstruction sample and the second color component reconstruction sample indicated by each of the one or more first candidate reference prediction parameters according to the first reference prediction parameter set includes: Determine the position of the current block; The position of the current block is scaled to determine the position of the first color component region at the same position of the current block; and the first candidate reference prediction parameter is scaled to determine the scaled reference prediction parameter of the first color component region at the same position of the current block. Based on the location of the first color component region and the scaled reference prediction parameters, a reference block for the first color component is determined, and based on the reference block for the first color component, a reconstructed sample of the first color component indicated by the first candidate reference prediction parameters is determined. Based on the position of the current block and the first candidate reference prediction parameter, a reference block for the second color component is determined, and based on the reference block for the second color component, a reconstructed sample for the second color component indicated by the first candidate reference prediction parameter is determined. The method according to claim 78, wherein, The step of determining the first color component reconstruction sample indicated by the first candidate reference prediction parameters based on the reference block of the first color component includes: The reference block of the first color component is downsampled to determine the first color component reconstruction sample indicated by the first candidate reference prediction parameter, so that the resolution of the first color component reconstruction sample is the same as the resolution of the second color component reconstruction sample. The method according to claim 78, wherein, The step of determining the second color component reconstruction sample indicated by the first candidate reference prediction parameters based on the reference block of the second color component includes: The reference block of the second color component is upsampled to determine the second color component reconstruction sample indicated by the first candidate reference prediction parameter, so that the resolution of the first color component reconstruction sample is the same as the resolution of the second color component reconstruction sample. Accordingly, the method further includes: downsampling the predicted value of the second color component of the current block. The method according to claim 79, wherein, The step of downsampling the reference block of the first color component to determine the reconstructed sample of the first color component indicated by the first candidate reference prediction parameters includes: Determine the downsampling method for the current block; The reference block of the first color component is downsampled according to the downsampling method to determine the reconstructed sample of the first color component indicated by the first candidate reference prediction parameter. The method according to claim 81, wherein, Determining the downsampling method for the current block includes: Based on a preset competition method, the cost of multiple candidate downsampling methods is calculated to determine the cost result corresponding to each of the multiple candidate downsampling methods; Select the minimum cost result from the cost results corresponding to each of the multiple candidate downsampling methods; The candidate downsampling method corresponding to the minimum cost result is determined as the downsampling method for the current block. The method according to claim 82, wherein, The preset competition mode is a rate-distortion optimization mode. The method according to claim 82, wherein, The method further includes: Determine the value of the filter identifier information; wherein, the filter identifier information is used to indicate the index number of the downsampling method of the current block among the multiple candidate downsampling methods; The values ​​of the filter identifier information are encoded, and the resulting encoded bits are written into the bitstream. The method according to claim 77, wherein, Determining the first color component reconstruction sample and the second color component reconstruction sample at the third position of the current block includes: Determine the first template of the current block; Based on the first template, the first color component reconstruction sample and the second color component reconstruction sample at the third position are determined. The method according to claim 74 or 85, wherein, The type of the first template includes at least one of the following: top template, top right template, left template, bottom left template, and top left template; 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. The method according to any one of claims 51 to 86, wherein, The step of determining the mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value includes: A first lookup table is determined based on the first color component reference sample value and the second color component reference sample value, wherein the first lookup table is used to record the value of the second color component corresponding to the index key being the first color component. The method according to any one of claims 51 to 86, wherein, The step of determining the mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value includes: A first discrete model is determined 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. The method according to claim 87 or 88, wherein, The method further includes: The first color component reference sample value is mapped to make the first color component reference sample value fall within a preset sample range. The method according to claim 87 or 88, wherein, The method further includes: When multiple second reference samples in the first color component reference sample value are the same and correspond to different second reference samples in the second color component reference sample value, the overlay process is performed sequentially according to the sample order, and the last second reference sample value is taken as the value that has a mapping relationship with the first reference sample value. The method according to claim 87 or 88, wherein, The method further includes: When the first reference sample in the first color component reference sample is the same and corresponds to multiple second reference samples that are different in the second color component reference sample, the average value of the multiple second reference samples is calculated, and the obtained average value is used as a value that has a mapping relationship with the first reference sample. The method according to claim 51, wherein, The method further includes: Determine the reconstructed pixel samples of the first color component region at the same position of the current block; The first color component sample value of the current block is determined based on the reconstructed pixel samples of the first color component region. The method according to claim 51, wherein, Determining the 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 includes: If a first color component value equal to the first color component sample value is found in the mapping relationship, then 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. The method according to claim 93, wherein, The method further includes: If no first color component value equal to the first color component sample value is 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 continued to search for a first color component value equal to the first color component correction value. The method according to claim 94, wherein, The step of correcting the reconstructed value of the first color component to determine the corrected value of the first color component includes: The first color component sample value is offset by one or more preset offset values ​​to determine the first color component correction value. The method according to claim 94, wherein, The method further includes: If no first color component value equal to the first color component correction value is found in the mapping relationship, the average value of the second color component reference sample is calculated, and the obtained average value is determined as the predicted value of the second color component of the current block. The method according to claim 51, wherein, Determining the 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 includes: Based on the mapping relationship and the sample value of the first color component of the current block, determine the first initial prediction value of the second color component of the current block; The first initial prediction value is corrected to determine the prediction value of the second color component of the current block. The method according to claim 97, wherein, The step of correcting the first initial prediction value to determine the prediction value of the second color component of the current block includes: The second color component of the current block is predicted 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; The first initial prediction value and the second initial prediction value are weighted and calculated to determine the prediction value of the second color component of the current block. The method according to claim 51, wherein, The method further includes: Determine the initial value of the second color component of the current block; Based on the initial value and the predicted value, determine the residual value of the second color component of the current block; The residual value of the second color component of the current block is encoded, and the resulting encoded bits are written into the bitstream. The method according to claim 51, wherein, The method further includes: When the first reference prediction parameter set includes multiple first candidate reference prediction parameters, the first color component reconstruction sample and the second color component reconstruction sample indicated by each of the multiple first candidate reference prediction parameters are determined. Based on the first color component reconstructed sample and the second color component reconstructed sample indicated by the plurality of first candidate reference prediction parameters, a plurality of mapping relationships between the first color component and the second color component are determined. Based on the multiple mapping relationships, determine multiple third initial prediction values ​​for the second color component of the current block; The predicted value of the second color component of the current block is determined by weighting the multiple third initial prediction values. The method according to claim 51, wherein, The method further includes: When the first color component block of the current block includes multiple candidate blocks, a second reference prediction parameter set for the current block is determined; wherein the second reference prediction parameter set contains multiple second candidate reference prediction parameters; Based on the plurality of second candidate reference prediction parameters, a plurality of first candidate reference prediction parameters are determined; Based on the multiple first candidate reference prediction parameters, multiple candidate mapping relationships between the first color component and the second color component are determined. From the plurality of candidate mapping relationships, the target mapping relationship is determined; Based on the target mapping relationship and the sample value of the first color component of the current block, the predicted value of the second color component of the current block is determined. The method according to claim 101, wherein, Determining the target mapping relationship from the plurality of candidate mapping relationships includes: Cost calculations are performed on the multiple candidate mapping relationships to determine the cost results corresponding to each of the multiple candidate mapping relationships; The minimum cost result is determined from the cost results corresponding to each of the multiple candidate mapping relationships, and the candidate mapping relationship corresponding to the minimum cost result is determined as the target mapping relationship. The method according to claim 101, wherein, The method further includes: Determine the mapping relationship index value, wherein the mapping relationship index value is used to indicate the index number of the target mapping relationship among the plurality of candidate mapping relationships; The mapping index value is encoded, and the resulting encoded bits are written into the bitstream. The method according to claim 51, wherein, The method further includes: When the first color component block of the current block includes multiple candidate blocks, a second reference prediction parameter set for the current block is determined; wherein the second reference prediction parameter set contains multiple second candidate reference prediction parameters; Based on the plurality of second candidate reference prediction parameters, a plurality of first candidate reference prediction parameters are determined; Based on the multiple first candidate reference prediction parameters, multiple candidate mapping relationships between the first color component and the second color component are determined. The matching error of the multiple candidate mapping relationships is calculated based on template matching to determine the second-generation value of each of the multiple candidate mapping relationships. Determine the minimum generation value from the second generation values ​​of the plurality of candidate mapping relationships, and determine the candidate mapping relationship corresponding to the minimum generation value as the target mapping relationship; Based on the target mapping relationship and the sample value of the first color component of the current block, the predicted value of the second color component of the current block is determined. The method according to claim 104, wherein, The step of calculating the matching error of the multiple candidate mapping relationships based on template matching to determine the second-generation value of each of the multiple candidate mapping relationships includes: Determine the first template of the current block; Determine the reconstructed pixel sample value of the first color component region template at the same position as the first template; Based on the multiple candidate mapping relationships and the reconstructed pixel sample values ​​of the first color component region template, the predicted values ​​of the second color components of the first template under the multiple mapping relationships are determined. The second-generation value of each of the multiple candidate mapping relationships is determined by calculating the cost based on the reconstructed value of the second color component of the first template and the predicted value of the second color component of the first template under the multiple mapping relationships. The method according to claim 51, wherein, The determination of the prediction parameters for the current block includes: Determine the prediction mode for the current block; The prediction parameters of the current block are determined based on the prediction mode of the current block. The method according to claim 106, wherein, Determining the prediction mode of the current block includes: Determine multiple candidate modes for the current block; wherein the multiple candidate modes include a first prediction mode and other prediction modes besides the first prediction mode; The cost of the multiple candidate modes is calculated based on a preset cost method to determine the cost result corresponding to each of the multiple candidate modes. The minimum cost result is determined from the cost results corresponding to each of the multiple candidate modes, and the candidate mode corresponding to the minimum cost result is determined as the prediction mode of the current block; The preset cost method includes at least one of the following: rate-distortion cost method and template matching method. The method according to claim 51, wherein, The method further includes: Determine the first color component region at the same position as the current block; If the current block uses DM mode and the first color component region is predicted based on block vectors, then the current block is determined to use the first prediction mode. The method according to any one of claims 51 to 108, wherein, The method further includes: Determine the value of the second syntax element; wherein the second syntax element is used to indicate whether the current block allows the use of the first prediction mode; The value of the second syntax element is encoded, and the resulting encoded bits are written into the bitstream. A type of bitstream, in which, The bitstream is generated by bit encoding based on information to be encoded; wherein the information to be encoded includes at least one of the following: The residual value of the second color component of the current block, the value of the filter identifier information, the mapping relationship index value, the value of the first syntax element, and the value of the second syntax element; The filter identification information is used to indicate the downsampling method of the current block, the first syntax element is used to indicate whether the current block uses the first prediction mode, and the second syntax element is used to indicate whether the current block is allowed to use the first prediction mode. An encoder includes a first determining unit and a first predicting unit, wherein: The first determining unit is configured to determine the prediction parameters of the current block; And based on the prediction parameters, a first reference prediction parameter set for the current block is determined; wherein the first reference prediction parameter set includes one or more first candidate reference prediction parameters; The first determining unit is further configured to determine a first color component reference sample value and a second color component reference sample value of the current block based on the first reference prediction parameter set; and to determine a mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value. The first prediction unit is configured to determine the 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. An encoder includes a first memory and a first processor, wherein: The first memory is used to store computer programs that can run on the first processor; The first processor is configured to perform the method as described in any one of claims 51 to 109 when running the computer program. A decoder includes a second determining unit and a second predicting unit, wherein: The second determining unit is configured to determine the prediction parameters of the current block; And based on the prediction parameters, a first reference prediction parameter set for the current block is determined; wherein the first reference prediction parameter set includes one or more first candidate reference prediction parameters; The second determining unit is further configured to determine the first color component reference sample value and the second color component reference sample value of the current block according to the first reference prediction parameter set; and to determine the mapping relationship between the first color component and the second color component according to the first color component reference sample value and the second color component reference sample value. The second prediction unit is configured to determine the 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. A decoder, the decoder comprising a second memory and a second processor, wherein: The second memory is used to store computer programs that can run on the second processor; The second processor is configured to perform the method as described in any one of claims 1 to 50 when running the computer program. A computer-readable storage medium, wherein, The computer-readable storage medium stores a computer program that, when executed by at least one processor, implements the method as claimed in any one of claims 1 to 50, or the method as claimed in any one of claims 51 to 109.