Encoding and decoding method, encoder, decoder and storage medium

CN120051993APending Publication Date: 2025-05-27GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202280100854.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2022-10-13
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

The transmission method of block vector difference symbol information in the intra-frame block copy mode in H.266/VVC is complicated, which leads to a decrease in coding performance and an increase in bit rate, which cannot meet the rapid development needs of video applications.

Method used

By determining the BVD absolute value and symbol index information of the block at the decoding end, sorting is performed to determine the BVD, and CABAC encoding and decoding technology is used to reduce the code rate of BVD symbol transmission and improve coding efficiency.

Benefits of technology

It effectively reduces the bit rate required for BVD symbol transmission in intra-frame block copy mode, improves coding efficiency, and improves video coding performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120051993A_ABST
    Figure CN120051993A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a coding and decoding method, which comprises the following steps: at a decoding end, decoding a code stream, and determining a BVD absolute value and BVD symbol index information of a current block; sorting the candidate BVDs of the current block according to the absolute value of the BVD of the current block, and determining a sorting result; determining the BVD of the current block according to the BVD symbol index information and the sorting result; and determining a reconstruction value of the current block according to the BVD of the current block. At the coding end, sorting the candidate BVDs of the current block according to the absolute value of the BVD of the current block, and determining a sorting result; determining BVD symbol index information of the current block according to the BVD symbol information of the current block and the sorting result; and writing the BVD absolute value and the BVD symbol index information into a code stream.
Need to check novelty before this filing date? Find Prior Art

Description

Coding and decoding method, encoder, decoder and storage medium Technical Field

[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to a coding and decoding method, an encoder, a decoder, and a storage medium. Background Art

[0002] As demand for video display quality increases, new video applications such as HD and UHD video have emerged. H.265 / High Efficiency Video Coding (HEVC) is no longer able to meet the demands of rapidly evolving video applications. The Joint Video Exploration Team (JVET) has proposed the next-generation video coding standard, H.266 / Versatile Video Coding (VVC), and its corresponding test model, the VVC Test Model (VTM), a reference software test platform.

[0003] Intrablock copy (IBC) is an extension of VVC's screen content coding for video sequences with screen content. It significantly improves the coding efficiency of screen content sequences. However, in IBC mode, the transmission method of block vector difference (BVD) symbol information is often complex, which increases the transmission bit rate to a certain extent, thereby reducing the coding performance of IBC mode.

[0004] Summary of the Invention

[0005] The embodiments of the present application provide a coding and decoding method, an encoder, a decoder, and a storage medium, which can effectively save the code rate required for BVD symbol transmission in the IBC mode, thereby improving coding efficiency.

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

[0007] In a first aspect, an embodiment of the present application provides a decoding method, applied to a decoder, the method comprising:

[0008] Decode the code stream and determine the BVD absolute value and BVD symbol index information of the current block;

[0009] Sorting candidate BVDs of the current block according to the absolute value of the BVD of the current block to determine a sorting result;

[0010] Determining the BVD of the current block according to the BVD symbol index information and the sorting result;

[0011] A reconstruction value of the current block is determined according to the BVD of the current block.

[0012] In a second aspect, an embodiment of the present application provides an encoding method, applied to an encoder, the method comprising:

[0013] Sorting candidate BVDs of the current block according to the absolute value of the BVD of the current block to determine a sorting result;

[0014] Determining BVD symbol index information of the current block according to the BVD symbol information of the current block and the sorting result;

[0015] The BVD absolute value and the BVD symbol index information are written into the code stream.

[0016] In a third aspect, an embodiment of the present application provides an encoder, comprising a first determining unit and an encoding unit; wherein,

[0017] The first determining unit is configured to sort the candidate BVDs of the current block according to the BVD absolute value of the current block to determine a sorting result; and determine the BVD symbol index information of the current block according to the BVD symbol information of the current block and the sorting result;

[0018] The encoding unit is configured to write the BVD absolute value and the BVD symbol index information into a bit stream.

[0019] In a fourth aspect, an embodiment of the present application provides an encoder, comprising a first memory and a first processor; wherein,

[0020] The first memory is used to store a computer program that can be run on the first processor;

[0021] The first processor is configured to execute the method according to the second aspect when running the computer program.

[0022] In a fifth aspect, an embodiment of the present application provides a decoder, comprising a decoding unit and a second determining unit; wherein,

[0023] The decoding unit is configured to decode the code stream;

[0024] The second determining unit is configured to determine the BVD absolute value and BVD symbol index information of the current block;

[0025] According to the BVD absolute value of the current block, the candidate BVDs of the current block are sorted to determine a sorting result; according to the BVD symbol index information and the sorting result, the BVD of the current block is determined; according to the BVD of the current block, a reconstructed value of the current block is determined.

[0026] In a sixth aspect, an embodiment of the present application provides a decoder, comprising a second memory and a second processor; wherein:

[0027] The second memory is used to store a computer program that can be run on the second processor;

[0028] The second processor is configured to execute the method according to the first aspect when running the computer program.

[0029] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed, the method as described in the first aspect or the method as described in the second aspect is implemented.

[0030] The embodiments of the present application provide a coding and decoding method, an encoder, a decoder, and a storage medium. At the decoding end, a bitstream is decoded to determine the absolute value of the BVD and the BVD symbol index information of the current block; candidate BVDs of the current block are sorted based on the absolute value of the BVD of the current block to determine the sorting result; the BVD of the current block is determined based on the BVD symbol index information and the sorting result; and a reconstructed value of the current block is determined based on the BVD of the current block. At the encoding end, candidate BVDs of the current block are sorted based on the absolute value of the BVD of the current block to determine the sorting result; the BVD symbol index information of the current block is determined based on the BVD symbol information and the sorting result; and the BVD absolute value and BVD symbol index information are written into the bitstream. It can be seen that in the embodiments of the present application, the candidate BVDs of the current block can be effectively sorted according to the absolute value of the BVD of the current block, so that the sorting result can be used to determine and transmit the BVD symbol index information during encoding, and the sorting result can be used to parse the BVD symbol information of the current block during decoding. At the same time, the CABAC encoding and decoding technology can be used to encode and decode the BVD symbol information, which can effectively save the code rate required for the BVD symbol transmission in the IBC mode, thereby improving the encoding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0032] Figure 2 is a schematic diagram of adjacent blocks;

[0033] FIG3 is a block diagram of a video encoding system provided in an embodiment of the present application;

[0034] FIG4 is a block diagram of a video decoding system provided in an embodiment of the present application;

[0035] FIG5 is a first schematic diagram of a decoding method in an embodiment of the present application;

[0036] Figure 6 is a schematic diagram of template types;

[0037] FIG7 is a schematic diagram of the BVP and BVD of the current coding block;

[0038] FIG8 is a schematic diagram of template motion compensation;

[0039] FIG9 is a schematic diagram of a BVD combination;

[0040] FIG10 is a second schematic diagram of the decoding method in an embodiment of the present application;

[0041] FIG11 is a schematic diagram of calculating cost;

[0042] FIG12 is a first schematic diagram of an encoding method in an embodiment of the present application;

[0043] FIG13 is a second schematic diagram of the encoding method in an embodiment of the present application;

[0044] FIG14 is a schematic diagram of the structure of the encoder;

[0045] FIG15 is a second schematic diagram of the structure of the encoder;

[0046] FIG16 is a schematic diagram of the first structure of a decoder;

[0047] FIG17 is a second schematic diagram of the structure of the decoder. DETAILED DESCRIPTION

[0048] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below with reference to the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.

[0049] In the following description, reference is made to "some embodiments," which describe a subset of all possible embodiments. However, it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict. It should also be noted that the terms "first, second, and third" in the embodiments of the present application are only used to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that "first, second, and third" may be interchanged in a specific order or sequential order where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0050] In a video image, a first image component, a second image component, and a third image component are generally used to represent a coding block (CB); wherein the three image 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; in this way, the video image can be represented in the YCbCr format or the YUV format.

[0051] In the embodiment of the present application, the first image component may be a luminance component, the second image component may be a blue chrominance component, and the third image component may be a red chrominance component, but this embodiment of the present application does not specifically limit this.

[0052] Common video codec standards all use a block-based hybrid coding framework. Each frame in a video image is divided into square Largest Coding Units (LCUs) or Coding Tree Units (CTUs) of the same size (e.g., 128×128, 64×64, etc.). Each LCU or CTU can be further divided into rectangular Coding Units (CUs) based on rules. Coding Units may also be divided into smaller Prediction Units (PUs) and Transform Units (TUs), etc.

[0053] The hybrid coding framework may include modules such as prediction, transform, quantization, entropy coding, and in-loop filtering. The prediction module may include intra-frame prediction and inter-frame prediction, and inter-frame prediction may include motion estimation and motion compensation. Since there is a strong correlation between adjacent pixels within a frame of a video image, the use of intra-frame prediction in video coding and decoding technology can eliminate spatial redundancy between adjacent pixels. However, since there is also a strong similarity between adjacent frames in a video image, the use of inter-frame prediction in video coding and decoding technology can eliminate temporal redundancy between adjacent frames, thereby improving coding and decoding efficiency.

[0054] The basic process of a video codec is as follows: On the encoder side, a frame is divided into blocks. Intra-frame prediction or inter-frame prediction is used on the current block to generate a predicted block for the current block. The predicted block is subtracted from the original block to obtain a residual block. The residual block is transformed and quantized to obtain a quantization coefficient matrix. This quantization coefficient matrix is ​​entropy encoded and output to the bitstream. On the decoder side, intra-frame prediction or inter-frame prediction is used on the current block to generate a predicted block for the current block. The decoded bitstream is then decoded to obtain a quantization coefficient matrix. This quantization coefficient matrix is ​​inversely quantized and inversely transformed to obtain a residual block. The predicted block and residual block are added together to obtain a reconstructed block. The reconstructed blocks form a reconstructed image, which is then subjected to image-based or block-based loop filtering to obtain the decoded image. The encoder side also performs similar operations to the decoder side to obtain the decoded image. The decoded image can serve as a reference frame for inter-frame prediction in subsequent frames. Block division information, prediction, transform, quantization, entropy coding, loop filtering, and other mode or parameter information determined by the encoder are output to the bitstream if necessary. The decoding end determines the same block division information as the encoding end by decoding and analyzing the existing information, as well as the mode information or parameter information such as prediction, transformation, quantization, entropy coding, and loop filtering, thereby ensuring that the decoded image obtained by the encoding end is the same as the decoded image obtained by the decoding end. The decoded image obtained by the encoding end is also usually called a reconstructed image. The current block can be divided into prediction units during prediction, and the current block can be divided into transformation units during transformation. The division of prediction units and transformation units can be different. The above is the basic process of the video codec under the block-based hybrid coding framework. With the development of technology, some modules or steps of the framework or process may be optimized. The embodiment of the present application is applicable to the basic process of the video codec under the block-based hybrid coding framework, but is not limited to the framework and process.

[0055] The current block (CB) may be a current coding unit (CU) or a current prediction unit (PU), etc.

[0056] Intrablockcopy (IBC) is an extension tool of VVC for the coding of video sequences of screen content type (Screen content coding), which significantly improves the coding efficiency of screen content sequences.

[0057] IBC is a block-level coding mode. Similar to inter-frame technology, the encoder performs motion search, namely block matching (BM), to find the optimal block vector (BV) for each CU, also known as the motion vector (MV). The block vector is a vector pointing from the current block to the reference block. Unlike inter-frame technology, the optimal block vector of IBC is searched in the reconstructed area of ​​the frame where the current CU is located (i.e., the current coded frame), while the inter-frame motion vector is obtained by searching the adjacent reference frames of the current coded frame in the temporal domain.

[0058] Figure 1 is a prediction diagram of the IBC mode. As shown in Figure 1, the specific process of obtaining the reconstructed pixels of the current coding block in the IBC mode in H.266 / VVC may include deriving BV, deriving prediction samples using BV, deriving residual samples, and deriving reconstructed samples using the prediction samples and residual samples.

[0059] The specific process of deriving BV is as follows:

[0060] (1) Brightness:

[0061] Input: luma position (xCb, yCb), which specifies the top left corner sample of the current coding block relative to the top left corner luma sample of the current picture, a variable cbWidth, which specifies the width of the current coding block in luma samples, and a variable cbHeight, which specifies the height of the current coding block in luma samples.

[0062] Output: bvL (Block Vector Luma) of luminance.

[0063] The IBC modes are divided into IBCMERGE and IBCAMVP. When deriving bvL, it is necessary to establish an IBC block vector candidate list bvCandList. The following describes the list establishment process of IBCMERGE. The list establishment process of IBCAMVP is consistent with IBCMERGE, but the maximum number of candidates of the two is different.

[0064] Step 1: When IsGt4by4 is equal to TRUE (the variable IsGt4by4 is the luminance width multiplied by the height, and is TRUE when IsGt4by4 is greater than 16), the derivation process of the spatial block vector candidate from the adjacent coding unit specified in the decoding specification is called using the luminance coding block position (xCb, yCb), the luminance coding block width cbWidth and the height cbHeight as input, and the output is the availability flag availableFlagA1, availableFlagB1 and the block vectors bvA1 and bvB1. Among them, A1 and B1 are adjacent blocks. Figure 2 is a schematic diagram of adjacent blocks. As shown in Figure 2, the relative positions of the adjacent blocks where A1 and B1 are located and the current coding block are the lower left corner and upper right corner, respectively.

[0065] Step 2: When IsGt4by4 is equal to TRUE, the block vector candidate list bvCandList is constructed as follows:

[0066] i=0

[0067] if(availableFlagA1)

[0068] bvCandList[i++]=bvA1

[0069] if(availableFlagB1)

[0070] bvCandList[i++]=bvB1

[0071] Step 3: The variable numCurrCand represents the number of candidates currently obtained. The derivation process of numCurrCand is as follows:

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

[0073] Step 4: When numCurrCand is less than MaxNumIbcMergeCand (the maximum number of candidates in MERGE mode) and NumHmvpIbcCand (the maximum number of candidates representing the historical optimal block vector (Hmvp) in IBC mode) is greater than 0, use bvCandList and numCurrCand as input, and the modified bvCandList and numCurrCand as output to call the history-based IBC block vector candidate derivation process specified in the decoding specification.

[0074] Step 5:

[0075] When numCurrCand is less than MaxNumIbcMergeCand, the following applies until numCurrCand is equal to MaxNumIbcMergeCand:

[0076] bvCandList[numCurrCand][0] (ie, the horizontal component of bv) is set equal to 0.

[0077] bvCandList[numCurrCand][1] (ie, the vertical component of bv) is set equal to 0.

[0078] numCurrCand increases by 1.

[0079] In this way, the block vector candidate list bvCandList is established, and general_merge_flag is used to indicate whether it is IBCMERGE mode. The candidate index bvIdx is derived as follows:

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

[0081] In this way, the specific bvL can be obtained according to the index bvIdx and the block vector candidate list bvCandList:

[0082] bvL[0]=bvCandList[bvIdx][0]

[0083] bvL[1]=bvCandList[bvIdx][1]

[0084] For the IBCAMVP mode, the specific bvL can be obtained by indexing bvIdx and the block vector candidate list bvCandList as the predicted bvL. The real bvL also needs to be added with the block vector difference (BVD). The specific process is as follows:

[0085] Step 1: Get the horizontal and vertical components of BVD, where MvdL0 is the forward motion vector difference.

[0086] bvd[0]=MvdL0[xCb][yCb][0]

[0087] bvd[1]=MvdL0[xCb][yCb][1]

[0088] Step 2: Perform a rounding operation on the predicted bvL obtained above. Among them, the right shift parameter AmvrShift is used for rounding, and the left shift parameter AmvrShift is used to improve the resolution.

[0089] offset = (AmvrShift == 0)? 0 : ((1 << (AmvrShift - 1)) - 1); bvL[0] = Sign(bvL[0]) * (((Abs(bvL[0]) + offset) >> AmvrShift) << AmvrShift);

[0090] bvL[1] = Sign(bvL[1]) * (((Abs(bvL[1]) + offset) >> AmvrShift) << AmvrShift); Step 3: The true bvL is derived as follows, and its range needs to be controlled between -217 and 217 - 1:

[0091] u[0] = (bvL[0] + bvd[0] + 218) % 218;

[0092] bvL[0] = (u[0] >= 217)? (u[0] - 218) : u[0];

[0093] u[1] = (bvL[1] + bvd[1] + 218) % 218;

[0094] bvL[1] = (u[1] >= 217)? (u[1] - 218) : u[1];

[0095] (2) Chrominance: If it is a dual-tree partition, no IBC is performed on the chrominance; if it is a single-tree partition, the BV of the chrominance needs to be derived.

[0096] Input: bvL of luminance (1 / 16 pixel precision)

[0097] Output: bvC (Block Vector chroma) of chrominance (1 / 32 pixel precision)

[0098] The derivation process is as follows:

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

[0100] bvC[1] = ((bvL[1] >> (3 + SubHeightC)) * 32);

[0101] Among them, the specific process of deriving the predicted sample using BV is as follows:

[0102] Input: Luma position (xCb, yCb), which specifies the top left corner sample of the current coding block relative to the top left corner luma sample of the current picture, a variable cbWidth, which specifies the width of the current coding block in luma samples, a variable cbHeight, which specifies the height of the current coding block in luma samples, a block vector bv, and a variable cIdx, which specifies the color component index of the current block.

[0103] Output: array predSamples of predicted samples.

[0104] The derivation process is as follows:

[0105] When cIdx is equal to 0, that is, the brightness component, for x = xCb..xCb + cbWidth-1 and y = yCb..yCb + cbHeight-1:

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

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

[0108] predSamples[x][y]=ibcVirBuf[0][xVb][yVb]

[0109] IbcBufWidthY is the width of the brightness pixels of the reconstructed buffer stored in IBC, CtbSizeY is the size of the CTU (Coding Tree Unit), and ibcVirBuf is the reconstructed pixels stored in IBC.

[0110] When cIdx is not equal to 0, that is, the chrominance component, for x=xCb / SubWidthC..xCb / SubWidthC+cbWidth / SubWidthC-1 and y=yCb / SubHeightC..yCb / SubHeightC+cbHeight / SubHeightC-1:

[0111] xVb=(x+(bv[0]>>5))&(IbcBufWidthC-1)

[0112] yVb=(y+(bv[1]>>5))&((CtbSizeY / subHeightC)-1)

[0113] predSamples[x][y]=ibcVirBuf[cIdx][xVb][yVb]

[0114] The variables SubWidthC and SubHeightC depend on the chroma format sampling structure specified by sps_chroma_format_idc. The specific correspondence is shown in the following table:

[0115] Table 1

[0116] sps_chroma_format_idc color sampling format SubWidthCSubHeightC0 monochrome 1114:2:02224:2:22134:4:411

[0117] When deriving residual samples, the decoding process of the residual signal of the coding block in the inter-frame prediction mode specified in the decoding specification can be called. When deriving reconstructed samples using the predicted samples and residual samples, the image reconstruction process of the specified color component specified in the decoding specification can be called.

[0118] Furthermore, in the BVD encoding process of IBC, for the IBCAMVP mode, basic block vector prediction (BVP) can be used for motion estimation to search for the best block motion vector, and the difference between the best block motion vector and the basic block vector is the block vector difference BVD.

[0119] The BVD encoding process is as follows: for the horizontal and vertical components of the BVD, first encode the flag of whether the BVD is zero; if it is not zero, encode its absolute value, and then bypass encode the BVD symbol; otherwise, no bit will be encoded.

[0120] Furthermore, for the decoding process of BVD of IBC in H.266 / VVC, the decoding method of BVD in VVC is the same as the decoding method of MVD between frames. The specific decoding process of MVD is:

[0121]

[0122]

[0123]

[0124] Among them, mvd_sign_flag[compIdx] represents the sign of the motion vector difference of a certain (horizontal or vertical) component compIdx: if mvd_sign_flag[compIdx] is equal to 0, the corresponding motion vector component difference has a positive value; otherwise (mvd_sign_flag[compIdx] is equal to 1), the corresponding motion vector component difference is negative; when mvd_sign_flag[compIdx] does not exist, it is inferred to be equal to 0.

[0125] The motion vector difference lMvd[compIdx] for compIdx=0..1 is derived as follows. The value of lMvd[compIdx] should be in the range of -217 to 217-1:

[0126] lMvd[compIdx]=abs_mvd_greater0_flag[compIdx]×(abs_mvd_minus2[compIdx]+2)×(1-2×mvd_sign_flag[compIdx])

[0127] In IBC mode, refList is equal to 0. For compIdx = 0..1 (0 represents the horizontal component and 1 represents the vertical component), MvdL0[x0][y0][compIdx] is set equal to lMvd[compIdx], and the horizontal and vertical components of BVD are derived:

[0128] bvd[0]=MvdL0[x0][y0][0]

[0129] bvd[1]=MvdL0[x0][y0][1]

[0130] Table 2

[0131]

[0132] Furthermore, the decoding process of BVD of IBC in Beyond VVC is as follows:

[0133]

[0134]

[0135] Among them, bvd_sign_flag[compIdx] represents the sign of the motion vector difference of a certain (horizontal or vertical) component compIdx: if bvd_sign_flag[compIdx] is equal to 0, the corresponding motion vector component difference has a positive value; otherwise (bvd_sign_flag[compIdx] is equal to 1), the corresponding motion vector component difference is negative; when bvd_sign_flag[compIdx] does not exist, it is inferred to be equal to 0.

[0136] The motion vector difference bvd[compIdx] for compIdx=0..1 is derived as follows:

[0137] bvd[compIdx]=abs_bvd_greater0_flag[compIdx]×

[0138] (abs_bvd_minus1[compIdx]+1)×(1-2×bvd_sign_flag[compIdx])

[0139] Table 3

[0140]

[0141] As shown above, bypass coding is currently used for BVD symbols in IBC mode. Bypass coding is an equal-probability coding method that does not require adaptive probability updates. Instead, it uses a fixed probability of 0 and 1, each accounting for 1 / 2, for coding. This coding method is simple and cannot be adaptively updated based on video information and historical coding information. One BVD symbol information corresponds to one bit of the code stream, resulting in a large bit rate redundancy.

[0142] It can be seen that there is still a lot of room for improvement in the currently common BVD encoding scheme.

[0143] Refer to Figure 3, which shows an example of a block diagram of a video coding system provided by an embodiment of the present application; as shown in Figure 3, the video coding system 10 includes a transform and quantization unit 101, an intra-frame estimation unit 102, an intra-frame prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109 and a decoded image cache unit 110, etc., wherein the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC).For the input original video signal, a video coding block can be obtained by dividing it into coding tree units (CTUs). Then, the residual pixel information obtained after intra-frame or inter-frame prediction is transformed by the transform and quantization unit 101, including transforming the residual information from the pixel domain to the transform domain and quantizing the obtained transform coefficients to further reduce the bit rate; the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to perform intra-frame prediction on the video coding block; specifically, the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to determine the intra-frame prediction mode to be used to encode the video coding block; the motion compensation unit 104 and the motion estimation unit 105 are used to perform inter-frame prediction coding on the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information; the motion estimation performed by the motion estimation unit 105 is the process of generating a motion vector, which can estimate the motion of the video coding block, and the motion compensation unit 104 then calculates the motion vector based on the motion vector determined by the motion estimation unit 105. After determining the intra-frame prediction mode, the intra-frame prediction unit 103 is further configured to provide the selected intra-frame prediction data to the encoding unit 109, and the motion estimation unit 105 also sends the calculated motion vector data to the encoding unit 109. In addition, the inverse transform and inverse quantization unit 106 is configured to reconstruct the video coding block and reconstruct a residual block in the pixel domain. The reconstructed residual block is subjected to the filter control analysis unit 107 and the filtering unit 108 to remove the block effect artifacts. The reconstructed residual block is then added to a predictive block in the frame of the decoded image buffer unit 110 to generate a reconstructed video coding block. The encoding unit 109 is configured to encode various coding parameters and quantized transform coefficients. In the CABAC-based coding algorithm, the context content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra-frame prediction mode, and output the code stream of the video signal. The decoded image buffer unit 110 is configured to store the reconstructed video coding block for prediction reference. As the video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoded image buffer unit 110 .

[0144] Referring to FIG4 , an example block diagram of a video decoding system provided by an embodiment of the present application is shown. As shown in FIG4 , the video decoding system 20 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra-frame prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206. The decoding unit 201 can implement header information decoding and CABAC decoding, and the filtering unit 205 can implement deblocking filtering and SAO filtering. After the input video signal undergoes the encoding process shown in FIG4 , a bitstream of the video signal is output. The bitstream is input to the video decoding system 20 and first passes through the decoding unit 201 to obtain decoded transform coefficients. The transform coefficients are processed by the inverse transform and inverse quantization unit 202 to generate 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 of the current frame or picture. The motion compensation unit 204 determines 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 for the video decoding block being decoded; a decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 202 with the corresponding predictive block generated by the intra-frame prediction unit 203 or the motion compensation unit 204; the decoded video signal passes through the filtering unit 205 to remove blocking artifacts, thereby improving video quality; the decoded video block is then stored in the decoded image buffer unit 206, which stores reference images used for subsequent intra-frame prediction or motion compensation, and is also used for outputting the video signal, thereby obtaining the restored original video signal.

[0145] The encoding method in the embodiment of the present application can be applied to the intra-frame prediction unit 103 shown in Figure 3 and the encoding unit 109 part that can implement the CABAC encoding algorithm. In addition, the decoding method in the embodiment of the present application can also be applied to the intra-frame prediction unit 203 shown in Figure 4 and the decoding unit 201 that can implement the CABAC decoding algorithm. That is to say, the encoding and decoding method in the embodiment of the present application can be applied to both video encoding systems and video decoding systems, and can even be applied to both video encoding systems and video decoding systems at the same time, but the embodiment of the present application does not make specific limitations. It should also be noted that when the encoding and decoding method is applied to a video encoding system, the "current block" specifically refers to the current encoding block in the intra-frame prediction; when the encoding and decoding method is applied to a video decoding system, the "current block" specifically refers to the current decoding block in the intra-frame prediction.

[0146] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application.

[0147] The embodiment of the present application provides a decoding method, which can be applied to a decoder. FIG5 is a schematic diagram of the decoding method in the embodiment of the present application. As shown in FIG5 , the decoding method performed by the decoder may include the following steps:

[0148] Step 101: Decode the code stream to determine the BVD absolute value and BVD symbol index information of the current block.

[0149] In the embodiment of the present application, the decoder can determine the BVD absolute value and BVD symbol index information of the current block by decoding the code stream.

[0150] It should be noted that in the embodiment of the present application, the decoder can directly parse the bitstream to obtain the true absolute value of the BVD of the current block, that is, the decoder can determine the absolute value of the BVD of the current block by decoding the bitstream.

[0151] Furthermore, in an embodiment of the present application, the decoder decodes the code stream and can also determine the BVD symbol index information of the current block, that is, parse and obtain the symbol prediction index of the current block.

[0152] It will be appreciated that in the embodiments of the present application, the BVD absolute value includes a first component absolute value absBvdX and a second component absolute value absBvdY; that is, the BVD absolute value includes a horizontal component absolute value and a vertical component absolute value. Accordingly, the BVD of the current block may include a first component candBvdX and a second component candBvdY. Simultaneously, the candidate BVD of the current block also includes a first component candBvdX and a second component candBvdY. That is, the BVD may include both a horizontal component and a vertical component.

[0153] Further, in an embodiment of the present application, if absBvdX and absBvdY are both not 0, then it can be determined that the number of bits of the BVD symbol index information is 2; if absBvdX or absBvdY is 0, then it can be determined that the number of bits of the BVD symbol index information is 1.

[0154] It should be noted that in the embodiments of the present application, in addition to the fixed-length encoding method described above, a variable-length encoding method may also be used to encode the BVD symbol index information. For example, the BVD symbol index information may be encoded using a truncated unary code, or binarized using a truncated binary code (truncated binarization). In this case, the number of bits of the BVD symbol index information is not necessarily 2.

[0155] That is to say, in an embodiment of the present application, if a truncated unary code is used to encode the BVD symbol index information (here, the BVD symbol index information can be an index value in the candidate BVD list), the number of bits of the symbol index information corresponding to different candidate BVDs is not exactly the same, which is a variable-length code.

[0156] It should be noted that, in an embodiment of the present application, the number of bits in the binary number of the BVD symbol index information can be determined based on the absolute value of the BVD parsed during the decoding process. Specifically, if the absolute values ​​of both the horizontal and vertical components of the BVD are not 0, the number of bits in the binary number of the BVD symbol index information is 2; if the horizontal component of the BVD is 0 and the absolute value of the vertical component is not 0, the number of bits in the binary number of the BVD symbol index information is 1; if the horizontal component of the BVD is not 0 and the absolute value of the vertical component is 0, the number of bits in the binary number of the BVD symbol index information is 1.

[0157] Then, the decoder can use CABAC (Context Adaptive Binary Arithmetic Coding) or bypass the corresponding decoding process to parse the binary number corresponding to the BVD symbol index information from the bitstream.

[0158] For the context model of CABAC used for BVD symbol index information, a single probability model or multiple probability models may be used, which may include but is not limited to distinguishing different probability models based on the absolute value of the horizontal component or vertical component of the BVD, the sum or difference of the horizontal component and vertical component of the BVD, etc.

[0159] For example, the absolute value of the horizontal component or vertical component of the BVD is used to classify the bits of the BVD symbol index information of the BVD using different probability models:

[0160] (1) Assuming that a threshold for the absolute value classification of the horizontal or vertical component of BVD is set to THR0, and there are two probability models, then when the BVD symbol index information is two bits, the 0th bit of this binary number is distinguished according to the size relationship between the absolute value of the horizontal component of BVD and THR0, that is, when the absolute value of the horizontal component of BVD is less than or equal to THR0, the first probability model is used, and when the absolute value of the horizontal component of BVD is greater than THR0, the second probability model is used; then, the first bit of the above binary number is distinguished according to the size relationship between the absolute value of the vertical component of BVD and THR0, that is, when the absolute value of the vertical component of BVD is less than or equal to THR0, the first probability model is used, and when the absolute value of the vertical component of BVD is greater than THR0, the second probability model is used.

[0161] (2) Assuming that a threshold for the absolute value classification of the horizontal component of BVD is set to THR0, and a threshold for the absolute value classification of the vertical component is set to THR1, there are four probability models in total. Then, when the BVD symbol index information is two bits, the 0th bit of this binary number is distinguished according to the size relationship between the absolute value of the horizontal component of BVD and THR0, that is, when the absolute value of the horizontal component of BVD is less than or equal to THR0, the first probability model is used, and when the absolute value of the horizontal component of BVD is greater than THR0, the second probability model is used; then, the 1st bit of the above binary number is distinguished according to the size relationship between the absolute value of the vertical component of BVD and THR1, that is, when the absolute value of the vertical component of BVD is less than or equal to THR1, the third probability model is used, and when the absolute value of the vertical component of BVD is greater than THR1, the fourth probability model is used.

[0162] Furthermore, in embodiments of the present application, after determining the absolute value of the BVD of the current block, the absolute value of the BVD can be used to determine a combination list of BVDs, where the combination list of BVDs includes any number of candidate BVDs for the current block. In other words, the absolute value of the BVD can be used to determine the candidate BVDs for the current block, which can also be understood as using the absolute value of the BVD to determine an initial set of candidate BVDs for the current block.

[0163] It should be noted that, in the embodiment of the present application, a combination list of BVDs (candidate BVDs) can be created between the possible symbols of BVDs and the absolute values ​​of BVDs, which may include the cases where only horizontal BVDs exist, only vertical BVDs exist, and both exist.

[0164] Furthermore, in an embodiment of the present application, when creating a combination list of BVDs (candidate BVDs), it mainly includes permuting and combining possible symbols of BVD, and multiplying possible horizontal symbols and vertical symbols by the horizontal absolute value component and vertical absolute value component of BVD respectively.

[0165] Exemplarily, in an embodiment of the present application, if only vertical BVD exists, that is, if absBvdX is equal to 0, then the candidate BVD may be determined according to absBvdY.

[0166] For example, BVD is divided into horizontal and vertical components. When the horizontal component is zero, only the vertical component is encoded, so only the combination list of the vertical component symbols is constructed, specifically for the following two cases:

[0167] The first case: the horizontal components are all positive, which is just a placeholder. The vertical components are first positive and then negative. A symbol list is constructed, and then the constructed symbol list is multiplied by the absolute values ​​of the horizontal and vertical components of BVD to obtain the combined list of BVD.

[0168]

[0169] The second case: the horizontal components are all positive, which is just a placeholder. The vertical components are first negative and then positive. A sign list is constructed, and then the constructed sign list is multiplied by the absolute values ​​of the horizontal and vertical components of BVD to obtain the combined list of BVD.

[0170]

[0171] Exemplarily, in an embodiment of the present application, if only the horizontal BVD exists, that is, if absBvdY is equal to 0, then the candidate BVD may be determined according to absBvdX.

[0172] For example, BVD is divided into horizontal and vertical components. When the vertical component is zero, only the horizontal component is encoded, so only the combination list of the horizontal component symbols is constructed, specifically for the following two cases:

[0173] The first case: the vertical components are all positive, which is just a placeholder. The horizontal components are first positive and then negative. A sign list is constructed, and then the constructed sign list is multiplied by the absolute values ​​of the vertical and horizontal components of BVD to obtain the combined list of BVD.

[0174]

[0175]

[0176] The second case: the vertical components are all positive, which is just a placeholder. The horizontal components are first negative and then positive. A sign list is constructed, and then the constructed sign list is multiplied by the absolute values ​​of the vertical and horizontal components of BVD to obtain the combined list of BVD.

[0177]

[0178] Illustratively, in an embodiment of the present application, if both the horizontal BVD and the vertical BVD exist, that is, if both absBvdX and absBvdY are not equal to 0, then the candidate BVD may be determined according to absBvdX and absBvdY.

[0179] For example, BVD is divided into horizontal and vertical components. When both components are non-zero, both need to be encoded. Therefore, a BVD list is constructed for both horizontal and vertical components. Specifically, there are 24 cases, namely, any permutation of the four combinations of {+1, +1}, {+1, -1}, {-1, +1}, and {-1, -1}. The following examples illustrate:

[0180] The 0th bit of the list is that both the horizontal and vertical components are positive, the 1st bit of the list is that the horizontal component is positive and the vertical component is negative, the 2nd bit of the list is that the horizontal component is negative and the vertical component is positive, and the 3rd bit of the list is that both the horizontal and vertical components are negative. A sign list is constructed, and then the constructed sign list is multiplied by the absolute values ​​of the vertical and horizontal components of BVD to obtain a combination list of BVD.

[0181]

[0182] Step 102: Sort the candidate BVDs of the current block according to the absolute value of the BVD of the current block to determine a sorting result.

[0183] In an embodiment of the present application, after determining the BVD absolute value and BVD symbol index information of the current block, the candidate BVDs of the current block may be further sorted according to the BVD absolute value of the current block to determine a sorting result.

[0184] Furthermore, in an embodiment of the present application, when sorting the candidate BVDs of the current block according to the absolute value of the BVD of the current block and determining the sorting result, the first-generation value corresponding to one or more candidate BVDs of the current block can be first determined according to the absolute value of the BVD; then the candidate BVDs can be sorted according to the first-generation value to determine the sorting result.

[0185] It can be understood that, in an embodiment of the present application, one or more candidate BVDs may include BVDs in which candBvdX is set equal to -absBvdX or absBvdX, and candBvdY is set equal to -absBvdY or absBvdY.

[0186] It should be noted that in an embodiment of the present application, when determining the first generation value corresponding to one or more candidate BVDs of the current block based on the absolute value of the BVD of the current block, the first matching template can be first determined based on the candidate BVD; then, based on a preset error criterion, the matching error between the first template of the current block and the first matching template is calculated to determine the first generation value corresponding to the candidate BVD.

[0187] For example, in an embodiment of the present application, when performing cost calculation, that is, when determining the first-generation value, there are multiple options for the cost function for calculating the cost of the template area, that is, there are multiple options for the preset error criteria. For example, you can choose the sum of absolute deviations (SAD), the sum of transformed absolute deviations (SATD), the sum of squared differences (SSE), the mean absolute difference (MAD), the mean absolute error (MAE), the mean squared error (MSE), the rate-distortion function (RDO), and other evaluation criteria. Any evaluation criterion mentioned in the following content can be selected from the above criteria. Taking the evaluation criterion of SAD as an example, the calculation formula is as follows:

[0188]

[0189] Among them, predTempSizeW is the width of the template, predTempSizeH is the height of the template, predTemp[i][j] is the pixel point of the template at BV, and recTempC[i][j] is the pixel point of the current block template.

[0190] That is to say, in an embodiment of the present application, the preset error criterion may include any one of the sum of absolute error SAD, the sum of transformed absolute error SATD, the sum of squared differences SSE, the mean absolute difference MAD, the mean absolute error MAE, the mean squared error MSE, and the rate-distortion function RDO.

[0191] It can be understood that, in the embodiment of the present application, the first template includes one or more sample values ​​in the adjacent decoded area of ​​the current block.

[0192] For example, in an embodiment of the present application, when selecting a template (the first template of the current block), the availability of pixels at the template position can be determined based on the pixel availability of the neighboring area of ​​the current block, including the reconstruction of brightness information. Figure 6 is a schematic diagram of template types. As shown in Figure 6, based on the relative position relationship between the template and the current block, the template can be classified into template types such as upper template, left template, upper right template, lower left template, and upper left template. Among them, the sizes of different types of templates for different coding blocks can be fixed the same or different.

[0193] For example, the template size selects the same template size for any current coding block (current block). The following formula illustrates a setting condition for the template size, where nTbW and nTbH are the width and height of the current luminance coding block (current block), and iTempW and iTempH are the width and height of the adopted template, respectively:

[0194] Upper template:

[0195] Left template:

[0196] For example, different template sizes can be selected according to the different sizes of the current coding block. The following formula illustrates a template size setting condition, where nTbW and nTbH are the width and height of the current luma coding block, respectively, and iTempW and iTempH are the width and height of the adopted template, respectively:

[0197] Upper template:

[0198] Left template:

[0199]

[0200] For example, you can also select different template sizes based on the number of pixels in the current brightness coding block. The following formula illustrates a template size setting condition:

[0201] nTbW and nTbH are the width and height of the current luminance coding block, nTbW×nTbH are the number of pixels of the current luminance coding block, and iTempW and iTempH are the width and height of the template used:

[0202] Upper template:

[0203] Left template:

[0204] It should be noted that, in an embodiment of the present application, when determining the first matching template based on the candidate BVD, the block vector prediction value BVP of the current block can be determined first; then the candidate BV of the current block is determined based on the BVP and the candidate BVD; wherein the candidate BV is used to indicate the position of the first matching template; then, the first matching template can be determined based on the candidate BV.

[0205] Exemplarily, in an embodiment of the present application, assuming that BVP includes a third component currBvpX and a fourth component currBvpY, then when determining the candidate BV of the current block based on BVP and the candidate BVD, the two-dimensional vector of the candidate BV can be selected to be set to (currBvpX+candBvdX, currBvpY+candBvdY), that is, the two-dimensional vector of BV is determined based on the first component candBvdX and the second component candBvdY of the candidate BVD, and the third component currBvpX and the fourth component currBvpY of BVP.

[0206] Furthermore, in an embodiment of the present application, when determining the first matching template based on the candidate BV, the first matching template may be determined based on the position of the current point and the two-dimensional vector of the candidate BV.

[0207] Exemplarily, in an embodiment of the present application, the position of the current point can be selected as the starting point, and the area indicated by the two-dimensional vector of the candidate BV, which has the same shape and contains the same number of samples as the first template, can be determined as the first matching template.

[0208] When predicting the BV of the current block, a new BV can be generated using the combined list of the BVP and BVD of the current block. Figure 7 is a schematic diagram of the BVP and BVD of the current coding block, and Figure 8 is a schematic diagram of template motion compensation. As shown in Figures 7 and 8, the current block is used to determine whether the BV is available (the available condition is that the reference block pointed to by the BV has been reconstructed and does not exceed the search range set by the IBC and the image boundary and other conditions). If the current BV is available, then the template of the current block and the new BV will be used for motion compensation to obtain the template at the corresponding BV. Figure 9 is a schematic diagram of the BVD combination. As shown in Figure 9, the horizontal and vertical components of the BVD generate a total of 4 combinations of BVDs, which are used for motion compensation at the templates. There are several situations in which the template is used when calculating the cost:

[0209] The first type: the upper template and the left template of the current block both exist, and the upper template and the left template at the corresponding BV both exist. In this case, both the upper template and the left template are available.

[0210] The second method is: Both the upper and left templates of the current block exist, but only the upper template exists at the corresponding BV. In this case, there are two methods: Method 1: If the left template at the corresponding BV does not exist, it is directly ignored, that is, only the upper template is used for calculation. Method 2: If the left template at the corresponding BV does not exist, the leftmost template width column in the reference block is used instead of the left template, that is, the upper and left templates are used for calculation.

[0211] The third method is: both the upper template and the left template of the current block exist, but only the left template exists at the corresponding BV. In this case, there are two methods: Method 1: If the upper template does not exist at the corresponding BV, it is directly not used, that is, only the left template is used for calculation. Method 2: If the upper template does not exist at the corresponding BV, the uppermost template height row inside the reference block is used instead of the upper template, that is, the upper and left templates are used for calculation.

[0212] The fourth scenario: Only the upper template exists in the current block. In this case, there are three methods: Method 1: If the upper template at the corresponding BV does not exist, it is not used. Method 2: If the upper template at the corresponding BV does not exist, the uppermost template height row in the reference block is used instead. Method 3: If the upper template at the corresponding BV exists, it is used directly.

[0213] The fifth method: Only the left template exists in the current block. In this case, there are three methods: Method 1: If the left template at the corresponding BV does not exist, it is not used directly. Method 2: If the left template at the corresponding BV does not exist, the leftmost template width column in the reference block is used instead of the left template. Method 3: If the left template at the corresponding BV exists, it is used directly.

[0214] Type 6: Both the upper template and the left template of the current block do not exist. The BVD combination in this case is ignored.

[0215] In the above six cases, when the reference block pointed to by BV is unavailable, the BVD combination in this case is ignored. When the BVD combination in a certain case is ignored, the cost in this case is set to the maximum value of the cost evaluation criterion.

[0216] Furthermore, in an embodiment of the present application, if both of the above two templates can be obtained, the template is processed at this time, including but not limited to the following method: weighted fusion of the two, calculated as follows:

[0217] cost = w0 × above + w1 × left

[0218] Among them, the weighted fusion standard can choose a fixed weighting coefficient or assign a weighting coefficient based on the sum of the absolute values ​​of the differences between the reconstructed brightness and the predicted brightness of each template. The formula for calculating the weighting coefficient of the latter is as follows: SAD A is the mean absolute difference of the upper template, SAD L is the mean absolute difference of the left template:

[0219]

[0220] It can be seen that in the embodiments of the present application, template prediction can be performed based on the combination list of BVP and BVD of the current block (candidate BVD), and the cost (first generation value) of each BVD combination (candidate BVD) in the BVD combination list can be calculated, that is, the cost of the template area can be calculated, and the cost of various combinations in the BVD combination list can be calculated using the template, specifically the cost of the reconstructed luminance pixel at the position obtained by template prediction using the reconstructed luminance pixel at the current block template position and the BV obtained by the combination of BVP and BVD of the current block.

[0221] It should be noted that, in the embodiments of the present application, when calculating the cost (first generation value), not only brightness but also chrominance, namely Cb and Cr components, may be used, which is not specifically limited in the present application.

[0222] Furthermore, in embodiments of the present application, after calculating the first generation value of each candidate BVD, the candidate BVDs can be sorted using the first generation value to obtain a sorting result. The sorting result can be a sorted list of candidate BVDs for the current block, or a set of candidate BVDs that has been sorted to determine the candidate BVD with the smallest first generation value. This is not specifically limited in the present application.

[0223] It should be noted that in an embodiment of the present application, if the sorting result is a candidate BVD list of the current block, then correspondingly, the sorting process can be to sort the candidate BVDs according to the first generation value to determine the candidate BVD list of the current block, wherein the candidate BVD list includes at least one candidate BVD.

[0224] Furthermore, in an embodiment of the present application, when sorting the candidate BVDs according to the first-generation value to determine the candidate BVD list of the current block, you can choose to sort one or more candidate BVDs according to a preset error criterion in ascending order of the matching error indicated by the first-generation value to determine the candidate BVD list.

[0225] It is understood that in the embodiment of the present application, the sorting result may be a new list OrderedList (a list of candidate BVDs of the current block) arranged in ascending (descending) order. For example, a sorting method such as bubble sort, selection sort, insertion sort, shell sort, merge sort, quick sort, radix sort, heap sort, counting sort, bucket sort, etc. may be used.

[0226] Furthermore, in an embodiment of the present application, the sorting result may also be a new list OrderedList (a candidate BVD list of the current block) in a specific order.

[0227] Illustratively, in an embodiment of the present application, when sorting the candidate BVDs according to the first generation value to determine the candidate BVD list of the current block, if absBvdX and absBvdY are both not equal to 0, the candidate BVDs are stored in the first array and the second array, respectively; then, based on the first generation value, the first candidate BVD and the second candidate BVD in the first array, as well as the third candidate BVD and the fourth candidate BVD in the second array are determined; finally, the first candidate BVD, the second candidate BVD, the third candidate BVD, and the fourth candidate BVD can be sorted based on the first generation value to determine the candidate BVD list.

[0228] If both the horizontal and vertical components of BVD exist, that is, absBvdX and absBvdY are not equal to 0, it is assumed that the combination list (candidate BVD) is {(+BVD HOR , +BVD VER), (+BVD HOR , -BVD VER ), (-BVD HOR , -BVD VER ), (-BVD HOR , +BVD VER )}, and its corresponding cost list is {Cost(+BVD HOR , +BVD VER ), Cost(+BVD HOR , -BVD VER ), Cost(-BVD HOR , -BVD VER ), Cost(-BVD HOR , +BVD VER )}. The order of the members in the above two lists can be arranged in any order.

[0229] Define two arrays posiGrp and negaGrp. posiGrp stores two BVD combinations with positive signs on the same component (level), and negaGrp stores two BVD combinations with negative signs on the same component (level).

[0230] Assume posiGrp={(+BVD HOR , +BVD VER ), (+BVD HOR , -BVD VER )}, negaGrp={(-BVD HOR , +BVD VER ), (-BVD HOR , -BVD VER )}. The order of the members in the posiGrp and negaGrp lists can be arranged arbitrarily.

[0231] First comparison: Compare Cost(+BVD HOR , +BVD VER ) and Cost(+BVD HOR , -BVD VER ), set posiGrp[0] to the smaller BVD combination of the two, and set posiGrp[1] to the larger BVD combination of the two;

[0232] Second comparison: Comparison of Cost(-BVD HOR , +BVD VER ) and Cost(-BVD HOR , -BVD VER ), set negaGrp[0] to the smaller BVD combination of the two, and set negaGrp[1] to the larger BVD combination of the two;

[0233] The third comparison: compare the cost corresponding to posiGrp[0] and negaGrp[0].

[0234] It should be noted that in an embodiment of the present application, when sorting the first candidate BVD, the second candidate BVD, the third candidate BVD, and the fourth candidate BVD based on the first generation value to determine the candidate BVD list, one available method is as follows: if the first generation value of the first candidate BVD is less than or equal to the first generation value of the third candidate BVD, the first candidate BVD is set as the first candidate BVD in the candidate BVD list, the third candidate BVD is set as the second candidate BVD in the candidate BVD list, the second candidate BVD is set as the third candidate BVD in the candidate BVD list, and the fourth candidate BVD is set as the fourth candidate BVD in the candidate BVD list. If the first generation value of the first candidate BVD is greater than the first generation value of the third candidate BVD, the third candidate BVD is set as the first candidate BVD in the candidate BVD list, the first candidate BVD is set as the second candidate BVD in the candidate BVD list, the fourth candidate BVD is set as the third candidate BVD in the candidate BVD list, and the second candidate BVD is set as the fourth candidate BVD in the candidate BVD list.

[0235] Correspondingly, the final sorting process can be: if in the third comparison, the Cost corresponding to posiGrp[0] is less than or equal to the Cost corresponding to negaGrp[0], posiGrp[0] is sorted at the 0th position of the candidate BVD list OrderedList, negaGrp[0] is sorted at the 1st position of the candidate BVD list OrderedList, posiGrp[1] is sorted at the 2nd position of the candidate BVD list OrderedList, and negaGrp[1] is sorted at the 3rd position of the candidate BVD list OrderedList.

[0236] If in the third comparison, the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0], sort negaGrp[0] at the 0th position in the candidate BVD list OrderedList, sort posiGrp[0] at the 1st position in the candidate BVD list OrderedList, sort negaGrp[1] at the 2nd position in the candidate BVD list OrderedList, and sort posiGrp[1] at the 3rd position in the candidate BVD list OrderedList.

[0237] Among them, the candidate BVD at position 0 in the candidate BVD list of the current block is the first candidate BVD in the candidate BVD list, the candidate BVD at position 1 is the second candidate BVD in the candidate BVD list, the candidate BVD at position 2 is the third candidate BVD in the candidate BVD list, and the candidate BVD at position 3 is the fourth candidate BVD in the candidate BVD list.

[0238] It should be noted that in an embodiment of the present application, when sorting the first candidate BVD, the second candidate BVD, the third candidate BVD, and the fourth candidate BVD based on the first generation value to determine the candidate BVD list, another available method is as follows: if the first generation value of the first candidate BVD is less than or equal to the first generation value of the third candidate BVD, the first candidate BVD is set as the first candidate BVD in the candidate BVD list, the second candidate BVD is set as the second candidate BVD in the candidate BVD list, the third candidate BVD is set as the third candidate BVD in the candidate BVD list, and the fourth candidate BVD is set as the fourth candidate BVD in the candidate BVD list. If the first generation value of the first candidate BVD is greater than the first generation value of the third candidate BVD, the third candidate BVD is set as the first candidate BVD in the candidate BVD list, the fourth candidate BVD is set as the second candidate BVD in the candidate BVD list, the first candidate BVD is set as the third candidate BVD in the candidate BVD list, and the second candidate BVD is set as the fourth candidate BVD in the candidate BVD list.

[0239] Correspondingly, the final sorting process can be: if in the third comparison, the Cost corresponding to posiGrp[0] is less than or equal to the Cost corresponding to negaGrp[0], posiGrp[0] is sorted at the 0th position in the candidate BVD list OrderedList, negaGrp[0] is sorted at the 2nd position in the candidate BVD list OrderedList, posiGrp[1] is sorted at the 1st position in the candidate BVD list OrderedList, and negaGrp[1] is sorted at the 3rd position in the candidate BVD list OrderedList.

[0240] If in the third comparison, the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0], sort negaGrp[0] at the 0th position in the candidate BVD list OrderedList, sort posiGrp[0] at the 2nd position in the candidate BVD list OrderedList, sort negaGrp[1] at the 1st position in the candidate BVD list OrderedList, and sort posiGrp[1] at the 3rd position in the candidate BVD list OrderedList.

[0241] Illustratively, in an embodiment of the present application, when sorting the candidate BVDs according to the first generation value to determine the candidate BVD list of the current block, if absBvdX is equal to 0 or absBvdY is equal to 0, the candidate BVD with the smallest first generation value among the candidate BVDs is set as the first candidate BVD in the candidate BVD list, and another candidate BVD among the candidate BVDs is set as the second candidate BVD in the candidate BVD list.

[0242] If only the horizontal component or the vertical component of the BVD exists, that is, absBvdX or absBvdY is equal to 0, then the two candidate BVDs can be directly sorted according to the size of the first generation value to generate a candidate BVD list.

[0243] For the case where only the BVD vertical component exists, assume that the combination list is {(0, +BVD VER ),(0,-BVD VER )}, and its corresponding cost list is {Cost(0, +BVD VER ), Cost(0, -BVD VER )}. The order of the members in the above two lists can be arranged in any order.

[0244] The sorting process is: compare Cost(0, +BVD VER ) and Cost(0, -BVD VER ) size:

[0245] If Cost(0, +BVD VER )<=Cost(0, -BVD VER ), then (0, +BVD VER ) is sorted in the 0th position of the candidate BVD list OrderedList, and (0, -BVD VER ) is sorted at the first position in the candidate BVD list OrderedList;

[0246] If Cost(0, +BVD VER )>Cost(0,-BVD VER ), then (0, -BVD VER ) is sorted in the 0th position of the candidate BVD list OrderedList, and (0, +BVD VER ) is sorted at the first position in the candidate BVD list OrderedList.

[0247] For the case where only the BVD horizontal component exists, assume that the combination list is {(+BVD HOR ,0),(-BVD HOR,0)}, and its corresponding cost list is {Cost(+BVD HOR ,0),Cost(-BVD HOR ,0)}. The order of the members in the above two lists can be arranged in any order.

[0248] The sorting process is: compare Cost(+BVD HOR ,0) and Cost(-BVD HOR ,0)’s size:

[0249] If Cost(+BVD HOR ,0)<=Cost(-BVD HOR ,0), then (+BVD HOR ,0) is sorted in the 0th position of the candidate BVD list OrderedList, and (-BVD HOR ,0) is ranked first in the candidate BVD list OrderedList;

[0250] If Cost(+BVD HOR ,0)>Cost(-BVD HOR ,0), then (-BVD HOR ,0) is sorted in the 0th position of the candidate BVD list OrderedList, and (+BVD HOR , 0) is ranked first in the candidate BVD list OrderedList.

[0251] It should be noted that in an embodiment of the present application, if the sorting result is a candidate BVD set of the current block, then correspondingly, the sorting process can be to sort the candidate BVDs according to the first generation value to determine the candidate BVD set of the current block, wherein the candidate BVD set includes at least one candidate BVD.

[0252] Furthermore, when sorting the candidate BVDs according to the first-generation value and determining the candidate BVD set of the current block, if absBvdX and absBvdY are both not equal to 0, the candidate BVDs are stored in the first array and the second array respectively; then the fifth candidate BVD with the smallest first-generation value in the first array and the sixth candidate BVD with the smallest first-generation value in the second array are determined; finally, the candidate BVD with the smallest first-generation value among the fifth candidate BVD and the sixth candidate BVD can be determined as the BVD with the smallest cost in the candidate BVD set.

[0253] If both the horizontal and vertical components of BVD exist, that is, both absBvdX and absBvdY are non-zero, then the combination list is {(+, +), (+, -), (-, -), (-, +)}, and the corresponding cost list is {Cost (+, +), Cost (+, -), Cost (-, -), Cost (-, +)}. The order of the members in the two lists can be arbitrary.

[0254] Define two arrays posiGrp and negaGrp. posiGrp stores the sign combination of two BVDs with positive signs on the same component (level), and negaGrp stores the sign combination of two BVDs with negative signs on the same component (level).

[0255] Assume that posiGrp = {(+, +), (+, -)}, negaGrp = {(-, +), (-, -)}. The order of the members in the two lists posiGrp and negaGrp can be arranged arbitrarily.

[0256] First comparison: Compare the sizes of Cost(+,+) and Cost(+,-), set posiGrp[0] to the smaller BVD sign combination of the two, and set posiGrp[1] to the larger BVD sign combination of the two;

[0257] Second comparison: compare the size of Cost(-, +) and Cost(-, -), set negaGrp[0] to the sign combination of the smaller BVD of the two, and set negaGrp[1] to the sign combination of the larger BVD of the two;

[0258] The third comparison: compare the cost corresponding to posiGrp[0] and negaGrp[0].

[0259] Then, a symbol combination of a BVD with the minimum cost can be determined, that is, the BVD with the minimum cost in the candidate BVD set can be determined.

[0260] If only the horizontal component or the vertical component of the BVD exists, that is, absBvdX or absBvdY is equal to 0, then the two candidate BVDs can be directly sorted according to the size of the first generation value to determine the BVD with the minimum cost in the candidate BVD set.

[0261] For example, in an embodiment of the present application, when sorting the candidate BVDs according to the first-generation value to determine the candidate BVD set of the current block, if absBvdX is equal to 0 or absBvdY is equal to 0, then the candidate BVD with the smallest first-generation value among the candidate BVDs can be determined as the BVD with the smallest cost in the candidate BVD set.

[0262] For the case where only the vertical component of a BVD exists, assume the combination list is {(+, +), (+, -)}, and the corresponding cost list is {Cost(+, +), Cost(+, -)}. The order of the members in these two lists can be arbitrarily arranged. The comparison process is to compare Cost(+, +) and Cost(+, -) to determine the sign combination of the BVD with the minimum cost, that is, to determine the minimum cost BVD in the candidate BVD set.

[0263] For the case where only the horizontal component of a BVD exists, assume the combination list is {(+, +), (-, +)}, and the corresponding cost list is {Cost(+, +), Cost(-, +)}. The order of the members in the two lists can be arbitrarily arranged. The comparison process is to compare the size of Cost(+, +) and Cost(-, +), and then determine the sign combination of the BVD with the minimum cost, that is, determine the minimum cost BVD in the candidate BVD set.

[0264] Step 103: Determine the BVD of the current block according to the BVD symbol index information and the sorting result.

[0265] In an embodiment of the present application, after sorting the candidate BVDs of the current block according to the absolute value of the BVD of the current block and determining the sorting result, the BVD of the current block can be determined according to the BVD symbol index information and the sorting result.

[0266] It should be noted that in an embodiment of the present application, if the candidate BVD list of the current block obtained by the sorting process is an ascending (descending) list, then you can choose to use the conversion list to indirectly obtain the real BVD symbol, or you can directly use logical reasoning to obtain the real BVD symbol.

[0267] When the symbol of the real BVD is indirectly obtained by using the transformation list, the BVD combination list OrderedList can be first converted into the index transformation list TransformedList according to the transformation rule.

[0268] Illustratively, in an embodiment of the present application, the candidate BVD list may be transformed to determine an index transformed list (TransformedList).

[0269] Furthermore, in an embodiment of the present application, when determining the BVD of the current block based on the BVD symbol index information and the sorting result, when both absBvdX and absBvdY are not 0, if the first bit of the BVD symbol index information is 0, it is determined that the candBvdX of the BVD of the current block is the same as the candBvdX of the first candidate BVD or the third candidate BVD in the index conversion list; then the candBvdY of the BVD of the current block can be determined according to the first candidate BVD or the third candidate BVD.

[0270] Further, in an embodiment of the present application, when determining the candBvdY of the BVD of the current block according to the first candidate BVD or the third candidate BVD, if the second bit of the BVD symbol index information is 0, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the first candidate BVD; if the second bit is 1, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the third candidate BVD.

[0271] Furthermore, in an embodiment of the present application, when determining the BVD of the current block based on the BVD symbol index information and the sorting result, when absBvdX and absBvdY are both not 0, if the first bit of the BVD symbol index information is 1, it is determined that the first component symbol is the same as the first component symbol of the second candidate BVD or the fourth candidate BVD in the index conversion list; then the candBvdY of the BVD of the current block can be determined according to the second candidate BVD or the fourth candidate BVD.

[0272] Further, in an embodiment of the present application, when determining the candBvdY of the BVD of the current block according to the second candidate BVD or the fourth candidate BVD, if the second bit of the BVD symbol index information is 0, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the second candidate BVD; if the second bit is 1, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the fourth candidate BVD.

[0273] That is, in the embodiment of the present application, when both the horizontal component and the vertical component of the BVD exist, the symbol prediction index of the BVD is two bits.

[0274] Assume that the sorted BVD combination list OrderedList is:

[0275] Table 4. OrderedList of sorted BVD combinations where both horizontal and vertical BVDs exist

[0276] Index horizontal component vertical component 0a1a21b1b22c1c23d1d2

[0277] Use the following conversion rules to convert the sorted BVD combination list OrderedList into TransformedList (index transformation list):

[0278] Place the BVD combination with the smallest cost after sorting at the 0th position of the TransformedList list, that is, place (a1, a2) at the 0th position of the TransformedList list. Place the BVD combination with the same sign as a1 at the 2nd position of the TransformedList list, that is, assuming b1 has the same sign as it, place (b1, b2) at the 2nd position of the TransformedList list. Place the BVD combination with a smaller cost but a different sign from a1 at the 1st position of the TransformedList list, that is, place (c1, c2) at the 1st position of the TransformedList list. Place the BVD combination with a larger cost but a different sign from a1 at the 3rd position of the TransformedList list, that is, place (d1, d2) at the 3rd position of the TransformedList list.

[0279] Then the index transformation list TransformedList is:

[0280] Table 5. Index transformation list TransformedList that exists in both horizontal and vertical BVD

[0281] Index Horizontal Component Vertical Component 0a1a21c1(-a1)c22b1(a1)b23d1(-a1)d2

[0282] For the index conversion list, the symbol of the real BVD is obtained according to the following rules. At this time, the predicted index of the symbol is equal to the index of the leftmost column in the table:

[0283] Parse the symbol prediction index bit 0:

[0284] When the 0th bit is 0, the true BVD horizontal component is equal to a1. Check its vertical component. If the 1st bit is 0, the true BVD vertical component is equal to a2; if the 1st bit is 1, the true BVD vertical component is equal to -a2.

[0285] When the 0th bit is 1, the true BVD horizontal component is equal to -a1. Check the vertical component of the candidate BVD of index 1. If the 1st bit is 0, the true BVD vertical component is equal to c2; if the 1st bit is 1, the true BVD vertical component is equal to -c2.

[0286] For example: Assume that the sorted BVD combination list OrderedList is:

[0287] Table 6. OrderedList instance of sorted BVD combination list with both horizontal and vertical BVDs

[0288] Index horizontal component vertical component 0-BVD HOR +BVD VER 1-BVD HOR -BVD VER 2+BVD HOR +BVD VER 3+BVD HOR -BVD VER

[0289] Then convert the sorted BVD combination list OrderedList into TransformedList according to the conversion rules:

[0290] Table 34. Index transformation list TransformedList instance that exists for both horizontal and vertical BVD

[0291] Index horizontal component vertical component 0-BVD HOR +BVD VER 1+BVD HOR +BVD VER 2-BVD HOR -BVD VER

[0292] 3+BVD HOR -BVD VER

[0293] (1) Assume that the parsed

[0294] bvsdIdx=0

[0295] Then the true BVD combination is the horizontal component -BVD HOR , the vertical component is +BVD VER .

[0296] (2) Assuming that the parsed

[0297] bvsdIdx=2

[0298] Then the true BVD combination is the horizontal component -BVD HOR , the vertical component is -BVD VER .

[0299] (3) Assuming the parsed

[0300] bvsdIdx=1

[0301] Then the true BVD combination is the horizontal component +BVD HOR , the vertical component is +BVD VER .

[0302] (4) Assuming the parsed

[0303] bvsdIdx=3

[0304] Then the true BVD combination is the horizontal component +BVD HOR , the vertical component is -BVD VER .

[0305] Further, in an embodiment of the present application, when determining the BVD of the current block based on the BVD symbol index information and the sorting result, when absBvdX is 0, if the value of the BVD symbol index information is 0, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the first candidate BVD in the index conversion list; if the value of the BVD symbol index information is 1, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the second candidate BVD in the index conversion list.

[0306] That is, in the embodiment of the present application, when the BVD vertical component exists, the symbol prediction index of the BVD is one bit.

[0307] Assume that the sorted BVD combination list OrderedList is:

[0308] Table 7. OrderedList of sorted BVD combinations where only vertical BVDs exist

[0309] Index horizontal component vertical component 00a210b2 (-a2)

[0310] Then the index transformation list TransformedList is the same as the sorted BVD combination list OrderedList.

[0311] The index transformation list TransformedList is:

[0312] Table 8. TransformedList of indexes where only vertical BVD exists

[0313] Index horizontal component vertical component 00a210b2 (-a2)

[0314] For the index conversion list, the symbol of the real BVD is obtained according to the following rules. At this time, the predicted index of the symbol is equal to the index of the leftmost column in the table:

[0315] If the 0th bit is 0, the true BVD vertical component is a2; otherwise, the true BVD vertical component is -a2.

[0316] For example: Assume that the sorted BVD combination list OrderedList is:

[0317] Table 9. OrderedList instance of sorted BVD combination list where only vertical BVD exists

[0318] Index horizontal component vertical component 00+BVD VER 10-BVD VER

[0319] The index transformation list TransformedList is:

[0320] Table 10. TransformedList instance with indexes where only vertical BVD exists

[0321] Index horizontal component vertical component 00+BVD VER 10-BVD VER

[0322] (1) Assume that the symbol prediction index is:

[0323] bvsdIdx=0

[0324] The horizontal component of the true BVD is 0, and the vertical component is +BVD VER .

[0325] (2) Assume that the symbol prediction index is:

[0326] bvsdIdx=1

[0327] The horizontal component of the true BVD is 0, and the vertical component is -BVD VER .

[0328] Further, in an embodiment of the present application, when determining the BVD of the current block based on the BVD symbol index information and the sorting result, when absBvdY is 0, if the value of the BVD symbol index information is 0, it is determined that the candBvdX of the BVD of the current block is the same as the candBvdX of the first candidate BVD in the index conversion list; if the value of the BVD symbol index information is 1, it is determined that the candBvdX of the BVD of the current block is the same as the candBvdX of the second candidate BVD in the index conversion list.

[0329] That is, in the embodiment of the present application, when the BVD horizontal component exists, the symbol prediction index of the BVD is one bit.

[0330] Assume that the sorted BVD combination list OrderedList is:

[0331] Table 11. OrderedList of sorted BVD combinations where only horizontal BVDs exist

[0332] Index horizontal component vertical component 0a101b1(-a1)0

[0333] Then the index transformation list TransformedList is the same as the sorted BVD combination list OrderedList.

[0334] The index transformation list TransformedList is:

[0335] Table 12 TransformedList of indexes where only horizontal BVD exists

[0336] Index horizontal component vertical component

[0337] 0a101b1(-a1)0

[0338] For the index conversion list, the symbol of the real BVD is obtained according to the following rules. At this time, the predicted index of the symbol is equal to the index of the leftmost column in the table:

[0339] If the 0th bit is 0, the true BVD horizontal component is a1, otherwise, the true BVD horizontal component is -a1.

[0340] For example: Assume that the sorted BVD combination list OrderedList is:

[0341] Table 13. OrderedList instance of sorted BVD combination list where only horizontal BVD exists

[0342] Index horizontal component vertical component 0+BVD HOR 01-BVD HOR 0

[0343] The index transformation list TransformedList is:

[0344] Table 14. TransformedList instance where only horizontal BVD exists

[0345] Index horizontal component vertical component 0+BVD HOR 01-BVD HOR 0

[0346] (1) Assume that the symbol prediction index is:

[0347] bvsdIdx=0

[0348] Then the horizontal component of the true BVD is +BVD HOR , the vertical component is 0.

[0349] (2) Assume that the symbol prediction index is:

[0350] bvsdIdx=1

[0351] Then the horizontal component of the true BVD is -BVD HOR , the vertical component is 0.

[0352] Further, in an embodiment of the present application, if logical reasoning is chosen to obtain the true BVD symbol, when determining the BVD of the current block based on the BVD symbol index information and the candidate BVD list, when both absBvdX and absBvdY are not 0, if the first bit of the BVD symbol index information is 0, then it is determined that the candBvdX of the BVD of the current block is the same as the candBvdX of the first candidate BVD in the candidate BVD list, otherwise they are different; then the candidate BVD list is traversed to determine the first candidate BVD with the same candBvdX as the BVD of the current block; if the second bit of the BVD symbol index information is 0, then it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the first candidate BVD, otherwise they are different.

[0353] In the first case, both the horizontal and vertical components of BVD exist. In this case, the symbol prediction index of BVD is two bits:

[0354] Assume that the sorted BVD combination list OrderedList is:

[0355] Table 15. OrderedList of sorted BVD combinations where both horizontal and vertical BVDs exist

[0356] Index horizontal component vertical component 0a1a21b1b22c1c23d1d2

[0357] If the 0th bit of the parsed BVD's sign prediction index is 0, the horizontal component of the true BVD is equal to a1. If the 0th bit is 1, the horizontal component of the true BVD is equal to -a1, which is the opposite of a1. In this case, the horizontal component of the true BVD is determined to be e1. Then, starting from index 0, the sorted list (the candidate BVD list for the current block) is traversed. When a BVD with the same horizontal component as the true BVD determined above first appears in the list, its vertical component is checked. Assuming its vertical component is f2, if the first bit is 0, the vertical component of the true BVD is equal to f2. If the first bit is 1, the vertical component of the true BVD is equal to -f2, which is the opposite of f2. In this case, the vertical component of the true BVD is determined to be e2. In this way, the true BVD is obtained, that is, the BVD with a horizontal component of e1 and a vertical component of e2.

[0358] For example: Assume that the sorted BVD combination list OrderedList is:

[0359] Table 16. OrderedList instance of sorted BVD combination list with both horizontal and vertical BVDs

[0360] Index horizontal component vertical component 0-BVD HOR +BVD VER 1-BVD HOR -BVD VER 2+BVD HOR +BVD VER 3+BVD HOR -BVD VER

[0361] (1) Assume that the 0th bit and the 1st bit of the symbol prediction index of the parsed BVD are 0.

[0362] Then the horizontal component of the true BVD is -BVD HOR , the vertical component is +BVD VER .

[0363] (2) Assume that the 0th bit of the symbol prediction index of the parsed BVD is 1 and the 1st bit is 0.

[0364] Then the horizontal component of the true BVD is +BVD HOR , the vertical component is +BVD VER .

[0365] (3) Assume that the 0th bit of the symbol prediction index of the parsed BVD is 0 and the 1st bit is 1.

[0366] Then the horizontal component of the true BVD is -BVD HOR , the vertical component is -BVDVER .

[0367] (4) Assume that the 0th bit and the 1st bit of the symbol prediction index of the parsed BVD are 1.

[0368] Then the horizontal component of the true BVD is +BVD HOR , the vertical component is -BVD VER .

[0369] Further, in an embodiment of the present application, if logical reasoning is chosen to obtain the true BVD symbol, when determining the BVD of the current block based on the BVD symbol index information and the candidate BVD list, when absBvdX is 0, if the value of the BVD symbol index information is 0, then it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the first candidate BVD in the candidate BVD list; if the value of the BVD symbol index information is 1, then it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the second candidate BVD in the candidate BVD list.

[0370] In the second case, only the vertical component of BVD exists. In this case, the symbol prediction index of BVD is one bit:

[0371] Assume that the sorted BVD combination list OrderedList is:

[0372] Table 17. OrderedList of sorted BVD combinations where only vertical BVDs exist

[0373] Index horizontal component vertical component 00a210b2 (-a2)

[0374] If the 0th bit of the parsed BVD sign prediction index is 0, the true BVD vertical component is equal to a2; if the 0th bit is 1, the true BVD vertical component is equal to -a2, which is the opposite of a2. In this case, the true BVD vertical component is e2 and the horizontal component is 0. In this way, the true BVD is obtained, that is, the BVD with a horizontal component of 0 and a vertical component of e2.

[0375] For example: Assume that the sorted BVD combination list OrderedList is:

[0376] Table 18. OrderedList instance of sorted BVD combination list where only vertical BVD exists

[0377] Index horizontal component vertical component 00+BVD VER 10-BVD VER

[0378] (1) Assume that the 0th bit of the symbol prediction index of the parsed BVD is 0.

[0379] Then the horizontal component of the true BVD is 0, and the vertical component is +BVD VER .

[0380] (2) Assume that the 0th bit of the symbol prediction index of the parsed BVD is 1.

[0381] Then the horizontal component of the true BVD is 0 and the vertical component is -BVD VER .

[0382] Further, in an embodiment of the present application, if logical reasoning is chosen to obtain the true BVD symbol, when determining the BVD of the current block based on the BVD symbol index information and the candidate BVD list, when absBvdY is 0, if the value of the BVD symbol index information is 0, then it is determined that the candBvdX of the BVD of the current block is the same as the candBvdX of the first candidate BVD in the candidate BVD list; if the value of the BVD symbol index information is 1, then it is determined that the candBvdX of the BVD of the current block is the same as the candBvdX of the second candidate BVD in the candidate BVD list.

[0383] In the third case, only the horizontal component of BVD exists. In this case, the symbol prediction index of BVD is one bit:

[0384] Assume that the sorted BVD combination list OrderedList is:

[0385] Table 19. OrderedList of sorted BVD combinations where only horizontal BVDs exist

[0386] Index horizontal component vertical component 0a101b1(-a1)0

[0387] If the 0th bit of the parsed BVD sign prediction index is 0, the horizontal component of the true BVD is equal to a1. If the 0th bit is 1, the horizontal component of the true BVD is equal to -a1, which is the opposite of a1. In this case, the horizontal component of the true BVD is e1 and the vertical component is 0. In this way, the true BVD is obtained, that is, the BVD with a horizontal component of e1 and a vertical component of 0.

[0388] For example: Assume that the sorted BVD combination list OrderedList is:

[0389] Table 20. OrderedList instance of sorted BVD combination list where only horizontal BVD exists

[0390] Index horizontal component vertical component 0+BVD HOR01-BVD HOR 0

[0391] (1) Assume that the 0th bit of the symbol prediction index of the parsed BVD is 0.

[0392] Then the horizontal component of the true BVD is +BVD HOR , the vertical component is 0.

[0393] (2) Assume that the 0th bit of the symbol prediction index of the parsed BVD is 1.

[0394] Then the horizontal component of the true BVD is -BVD HOR , the vertical component is 0.

[0395] It should be noted that, in an embodiment of the present application, if the candidate BVD list of the current block obtained by the sorting process is a list in a specific order, then when determining the BVD of the current block, the candidate BVD indicated by the BVD symbol index information in the candidate BVD list can be directly determined as the BVD of the current block. Among them, the sorted BVD combination list OrderedList can be directly assigned to TransformedList, that is, the candidate BVD list OrderedList and the index transformation list TransformedList are the same. Therefore, in TransformedList (or OrderedList), the BVD combination corresponding to the symbol prediction index of BVD is the real BVD.

[0396] It can be understood that in an embodiment of the present application, if the candidate BVD list of the current block obtained by the sorting process is a list in a specific order, then at the encoding end, the two components corresponding to the BVD can be directly encoded at the same time, and correspondingly, at the decoding end, the two components corresponding to the BVD can be directly determined together through the BVD symbol index information.

[0397] That is to say, in the embodiment of the present application, the BVD symbol index information obtained by decoding can be directly used to determine the candidate BVD indicated by the BVD symbol index information from the candidate BVD list.

[0398] Correspondingly, in an embodiment of the present application, for a solution in which the decoding end parses the combined index (BVD symbol index information) and simultaneously obtains the horizontal and vertical components, at the encoding end, the encoder can use a traversal method to determine the transmitted index (BVD symbol index information).

[0399] It can be understood that in the embodiments of the present application, for the candidate BVD list determined by sorting in ascending order according to the matching error indicated by the first-generation value, that is, when the candidate BVD list of the current block is an ascending (descending) list, the candidate BVD indicated by the BVD symbol index information in the candidate BVD list can also be directly determined as the BVD of the current block.

[0400] In the first case, both the horizontal and vertical components of BVD exist. In this case, the symbol prediction index of BVD is two bits:

[0401] Assume that the sorted BVD combination list OrderedList is:

[0402] Table 21. OrderedList of sorted BVD combinations where both horizontal and vertical BVDs exist

[0403] Index Horizontal Component Vertical Component 0a1a21b1(-a1)b22c1(a1)c23d1(-a1)d2

[0404] Then the index transformation list TransformedList is:

[0405] Table 22. Index transformation list TransformedList that exists for both horizontal and vertical BVD

[0406] Index Horizontal Component Vertical Component 0a1a21b1(-a1)b22c1(a1)c23d1(-a1)d2

[0407] For the index conversion list, the symbol of the real BVD is obtained according to the following rules. At this time, the predicted index of the symbol is equal to the index of the leftmost column in the table:

[0408] Parse the symbol prediction index bit 0:

[0409] When the 0th bit is 0, the true BVD horizontal component is equal to a1. Check its vertical component. If the 1st bit is 0, the true BVD vertical component is equal to a2; if the 1st bit is 1, the true BVD vertical component is equal to -a2.

[0410] When the 0th bit is 1, the true BVD horizontal component is equal to -a1. Check the vertical component of the candidate BVD of index 1. If the 1st bit is 0, the true BVD vertical component is equal to c2; if the 1st bit is 1, the true BVD vertical component is equal to -c2.

[0411] For example: Assume that the sorted BVD combination list OrderedList is:

[0412] Table 23. OrderedList instance of sorted BVD combination list with both horizontal and vertical BVDs

[0413] Index horizontal component vertical component 0-BVD HOR +BVD VER 1+BVD HOR +BVD VER 2-BVD HOR -BVD HOR 3+BVD HOR -BVD VER

[0414] Then TransformedList is:

[0415] Table 24. Index transformation list TransformedList instance that exists for both horizontal and vertical BVD

[0416] Index horizontal component vertical component 0-BVD HOR +BVD VER 1+BVD HOR +BVD VER 2-BVD HOR -BVD HOR 3+BVD HOR -BVD VER

[0417] (1) Assume that the parsed

[0418] bvsdIdx=0

[0419] Then the true BVD combination is the horizontal component -BVD HOR , the vertical component is +BVD VER .

[0420] (2) Assuming that the parsed

[0421] bvsdIdx=2

[0422] Then the true BVD combination is the horizontal component -BVD HOR , the vertical component is -BVD VER .

[0423] (3) Assuming the parsed

[0424] bvsdIdx=1

[0425] Then the true BVD combination is the horizontal component +BVD HOR , the vertical component is +BVD VER .

[0426] (4) Assuming the parsed

[0427] bvsdIdx=3

[0428] Then the true BVD combination is the horizontal component +BVD HOR , the vertical component is -BVD VER .

[0429] In the second case, only the BVD vertical component exists. In this case, the BVD symbol prediction index is one bit:

[0430] Assume that the sorted BVD combination list OrderedList is:

[0431] Table 25. OrderedList of sorted BVD combinations where only vertical BVDs exist

[0432] Index horizontal component vertical component 00a210b2 (-a2)

[0433] Then the index transformation list TransformedList is:

[0434] Table 54. Index TransformedList where only vertical BVD exists

[0435] Index horizontal component vertical component 00a210b2 (-a2)

[0436] For the index conversion list, the symbol of the real BVD is obtained according to the following rules. At this time, the predicted index of the symbol is equal to the index of the leftmost column in the table:

[0437] When the 0th bit is 0, the vertical component of the real BVD is equal to a2; otherwise, the vertical component of the real BVD is equal to -a2.

[0438] For example: Assume that the sorted BVD combination list OrderedList is:

[0439] Table 26. OrderedList instance of sorted BVD combination list where only vertical BVD exists

[0440] Index horizontal component vertical component 00+BVD VER 10-BVD VER

[0441] TransformedList is:

[0442] Table 56. Indexed TransformedList instances where only vertical BVD exists

[0443] Index horizontal component vertical component 00+BVD VER 10-BVD VER

[0444] (1) Assume that the parsed symbol prediction index is:

[0445] bvsdIdx=0

[0446] The horizontal component of the true BVD is 0, and the vertical component is +BVD VER .

[0447] (2) Assume that the symbol prediction index is parsed:

[0448] bvsdIdx=1

[0449] The horizontal component of the true BVD is 0, and the vertical component is -BVD VER .

[0450] In the third case, only the BVD horizontal component exists. In this case, the BVD symbol prediction index is one bit:

[0451] Assume that the sorted BVD combination list OrderedList is:

[0452] Table 27. OrderedList of sorted BVD combinations where only horizontal BVDs exist

[0453] Index horizontal component vertical component 0a101b1(-a1)0

[0454] Then the index transformation list TransformedList is:

[0455] Table 28. TransformedList of indexes that only exist for horizontal BVD

[0456] Index horizontal component vertical component 0a101b1(-a1)0

[0457] For the index conversion list, the symbol of the real BVD is obtained according to the following rules. At this time, the predicted index of the symbol is equal to the index of the leftmost column in the table:

[0458] When the 0th bit is 0, the horizontal component of the true BVD is equal to a1, otherwise, the horizontal component of the true BVD is equal to -a1.

[0459] For example: Assume that the sorted BVD combination list OrderedList is:

[0460] Table 29. OrderedList instance of sorted BVD combination list where only horizontal BVD exists

[0461] Index horizontal component vertical component 0+BVD HOR 01-BVD HOR 0

[0462] TransformedList is:

[0463] Table 60. TransformedList instance where only horizontal BVD exists

[0464] Index horizontal component vertical component 0+BVD HOR 01-BVD HOR 0

[0465] (1) Assume that the parsed symbol prediction index is:

[0466] bvsdIdx=0

[0467] Then the horizontal component of the true BVD is +BVD HOR , the vertical component is 0.

[0468] (2) Assume that the parsed symbol prediction index is:

[0469] bvsdIdx=1

[0470] Then the horizontal component of the true BVD is -BVD HOR , the vertical component is 0.

[0471] Furthermore, in an embodiment of the present application, if the sorting result after the sorting process is a candidate BVD set for the current block, then after the sorting, the candidate BVD with the lowest template matching cost is determined, that is, the lowest cost BVD in the candidate BVD set is determined. At this time, if the value of bvsdIdx is bit0+bit1<<1, that is, bit0 represents the horizontal component symbol and bit1 represents the vertical component symbol, then the minimum BVD symbol combination (minimum cost BVD) determines the symbol of bit0 and bit1 when the value is equal to 0, and the opposite symbol when the value is equal to 1.

[0472] It should be noted that, in an embodiment of the present application, when determining the BVD of the current block based on the BVD symbol index information and the sorting result, when both absBvdX and absBvdY are not 0, if the first bit of the BVD symbol index information is 0, it is determined that the candBvdX of the BVD of the current block is the same as the candBvdX of the BVD with the minimum cost in the candidate BVD set; then the candBvdY of the BVD of the current block can be determined according to the BVD with the minimum cost in the candidate BVD set.

[0473] It should be noted that, in an embodiment of the present application, when determining the BVD of the current block based on the BVD symbol index information and the sorting result, when both absBvdX and absBvdY are not 0, if the first bit of the BVD symbol index information is 1, it is determined that the candBvdX of the BVD of the current block has an opposite sign to the candBvdX of the BVD with the minimum cost in the candidate BVD set; then the candBvdY of the BVD of the current block can be determined according to the BVD with the minimum cost in another array other than the array where the BVD with the minimum cost in the candidate BVD set is located.

[0474] Furthermore, in an embodiment of the present application, when determining the candBvdY of the BVD of the current block according to the BVD with the minimum cost in the candidate BVD set, if the second bit of the BVD symbol index information is 0, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the BVD with the minimum cost in the candidate BVD set; if the second bit is 1, it is determined that the candBvdY of the BVD of the current block is opposite in sign to the candBvdY of the BVD with the minimum cost in the candidate BVD set.

[0475] Furthermore, in an embodiment of the present application, when determining the candBvdY of the BVD of the current block according to the minimum cost BVD in another array other than the array where the minimum cost BVD in the candidate BVD set is located, if the second bit of the BVD sign index information is 0, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the minimum cost BVD in the other array; if the second bit is 1, it is determined that the candBvdY of the BVD of the current block is of opposite sign to the candBvdY of the minimum cost BVD in the other array.

[0476] It should be noted that, in the embodiment of the present application, it is assumed that the signs of the horizontal component and vertical component of the real BVD are bvdSign[0] and bvdSign[1], where a value of 0 indicates positive and a value of 1 indicates negative.

[0477] For example, in an embodiment of the present application, if both horizontal and vertical components of a BVD exist, two possible situations for the BVD with the minimum cost in the candidate BVD set determined after sorting are as follows:

[0478] (1) If in the third comparison, the Cost corresponding to posiGrp[0] <= the Cost corresponding to negaGrp[0]:

[0479] If the 0th bit is 0, bvd_sign[0] = 0. If the 1st bit is 0, bvd_sign[1] = posiGrp[0][1]; if the 1st bit is 1, bvd_sign[1] = posiGrp[1][1].

[0480] If the 0th bit is 1, bvd_sign[0] = 1. If the 1st bit is 0, bvd_sign[1] = negaGrp[0][1]; if the 1st bit is 1, bvd_sign[1] = negaGrp[1][1].

[0481] (2) If in the third comparison, the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0]:

[0482] If the 0th bit is 1, bvd_sign[0] = 0. If the 1st bit is 0, bvd_sign[1] = posiGrp[0][1]; if the 1st bit is 1, bvd_sign[1] = posiGrp[1][1].

[0483] If the 0th bit is 0, bvd_sign[0] = 1. If the 1st bit is 0, bvd_sign[1] = negaGrp[0][1]; if the 1st bit is 1, bvd_sign[1] = negaGrp[1][1].

[0484] It should be noted that, in an embodiment of the present application, when determining the BVD of the current block based on the BVD symbol index information and the sorting result, when absBvdX is 0, if the value of the BVD symbol index information is 0, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the BVD with the minimum cost in the candidate BVD set; if the value of the BVD symbol index information is 1, it is determined that the candBvdY of the BVD of the current block is opposite in sign to the candBvdY of the BVD with the minimum cost in the candidate BVD set.

[0485] For example, in an embodiment of the present application, if the BVD only has a vertical component, two possible situations for the BVD with the minimum cost in the candidate BVD set determined after sorting are as follows:

[0486] (1) If Cost(+,+)<=Cost(+,-):

[0487] If the 0th bit is 0, then bvd_sign[1]=0.

[0488] If the 0th bit is 1, then bvd_sign[1]=1.

[0489] (2) If Cost(+, +)>Cost(+, -):

[0490] If the 0th bit is 0, then bvd_sign[1]=1.

[0491] If the 0th bit is 1, then bvd_sign[1]=0.

[0492] It should be noted that, in an embodiment of the present application, when determining the BVD of the current block based on the BVD symbol index information and the sorting result, when absBvdY is 0, if the value of the BVD symbol index information is 0, it is determined that the absBvdX of the BVD of the current block is the same as the absBvdX of the BVD with the minimum cost in the candidate BVD set; if the value of the BVD symbol index information is 1, it is determined that the absBvdX of the BVD of the current block is opposite in sign to the absBvdX of the BVD with the minimum cost in the candidate BVD set.

[0493] For example, in an embodiment of the present application, if only the horizontal component of the BVD exists, two possible situations for the BVD with the minimum cost in the candidate BVD set determined after sorting are as follows:

[0494] (1) If Cost(+,+)<=Cost(-,+):

[0495] If the 0th bit is 0, then bvd_sign[0]=0.

[0496] If the 0th bit is 1, then bvd_sign[0]=1.

[0497] (2) If Cost(+, +)>Cost(-, +):

[0498] If the 0th bit is 0, then bvd_sign[0]=1.

[0499] If the 0th bit is 1, then bvd_sign[0]=0.

[0500] It can be seen that the above method of determining the BVD of the current block based on the candidate BVD set can save the steps of establishing a list and obtaining the symbol prediction index. For the case where both the horizontal and vertical components of the BVD exist, the decoding end can directly obtain the true BVD symbol through three comparisons, which is less complex.

[0501] Step 104: Determine a reconstruction value of the current block according to the BVD of the current block.

[0502] In an embodiment of the present application, after determining the BVD of the current block according to the BVD symbol index information and the sorting result, the decoder can use the BVD of the current block to perform motion compensation, thereby determining a reconstructed value of the current block.

[0503] For example, in an embodiment of the present application, the overall process of the decoding end is as follows:

[0504] There are several ways:

[0505] (1) The BVD symbol is parsed after the absolute value of BVD is parsed:

[0506]

[0507]

[0508]

[0509] The symbol prediction index (i.e., BVD symbol index information) bvdIdx is derived as follows:

[0510] If abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] are both TRUE, then bvsdIdx=bvsd_idx;

[0511] Otherwise, if either abs_bvd_greater0_flag[0] or abs_bvd_greater0_flag[1] is TRUE, then bvsdIdx=bvsd_idx_single.

[0512] The absolute value of the motion vector difference abs_bvd[compIdx] for compIdx=0..1 is derived as follows:

[0513] abs_bvd[compIdx]=abs_bvd_greater0_flag[compIdx]*(abs_bvd_minus1[compIdx]+1)bvsd_idx can use two different probability models:

[0514] Table 30

[0515]

[0516] Or using four different probability models:

[0517] Table 31

[0518]

[0519] Alternatively, one can use a probabilistic model and the other a bypass code:

[0520] Table 32

[0521]

[0522] or

[0523] Table 33

[0524]

[0525] bvsd_idx_single can use different probability models based on the absolute value:

[0526] Table 34

[0527]

[0528] compIdx=0…1, indicating the horizontal component or the vertical component.

[0529] It is also possible to use a separate probability model:

[0530] Table 35

[0531]

[0532] Alternatively, you can use bypass encoding:

[0533] Table 36

[0534]

[0535] (2) The process of parsing the BVD symbol is performed in the middle of the function bvd_coding() that parses the absolute value of BVD, that is, after parsing the flags abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] that indicate whether the horizontal and vertical components of BVD are zero:

[0536]

[0537]

[0538] The symbol prediction index bvdIdx is derived as follows:

[0539] If abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] are both TRUE, then bvsdIdx=bvsd_idx;

[0540] Otherwise, if either abs_bvd_greater0_flag[0] or abs_bvd_greater0_flag[1] is TRUE, then bvsdIdx=bvsd_idx_single.

[0541] bvsd_idx can use two different probability models:

[0542] Table 37

[0543]

[0544] Alternatively, one can use a probabilistic model and the other a bypass code:

[0545] Table 38

[0546]

[0547] or

[0548] Table 39

[0549]

[0550] bvsd_idx_single can use a single probability model:

[0551] Table 40

[0552]

[0553] Alternatively, you can use bypass encoding:

[0554] Table 41

[0555]

[0556] (3) The process of parsing the BVD symbol is performed in the middle of the function bvd_coding() that parses the absolute value of the BVD, that is, after parsing the flags abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] that indicate whether the horizontal and vertical components of the BVD are zero. However, unlike (2), only one bvsd_idx variable is introduced, and the binarization of this variable is moved to CABAC for processing (the binarization and CABAC processing flow involved in this process can also be implemented in (1), that is, the process of parsing the BVD symbol is performed after the function bvd_coding() that parses the absolute value of the BVD, and a binarization flow similar to the following can also be applied):

[0557]

[0558]

[0559] The symbol prediction index bvdIdx is derived as follows:

[0560] bvsdIdx=bvsd_idx

[0561] The following describes the binarization process of bvsd_idx and its corresponding specific forms, including but not limited to the following:

[0562] 1) Use fixed-length binarization to binarize bvsd_idx:

[0563] At this point, there are two forms:

[0564] The first form is:

[0565] If abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] are both TRUE:

[0566] Table 42

[0567]

[0568] Otherwise, if abs_bvd_greater0_flag[0] or abs_bvd_greater0_flag[1] is TRUE:

[0569] Table 43

[0570]

[0571] A brief description of the above process:

[0572] If abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] are both TRUE, when the binary string of the parsed bvsd_idx is 00B, bvsd_idx is 0; when the binary string of the parsed bvsd_idx is 01B, bvsd_idx is 1; when the binary string of the parsed bvsd_idx is 10B, bvsd_idx is 2; when the binary string of the parsed bvsd_idx is 11B, bvsd_idx is 3.

[0573] Otherwise, if either abs_bvd_greater0_flag[0] or abs_bvd_greater0_flag[1] is TRUE, when the binary string of the parsed bvsd_idx is 0B, bvsd_idx is 0; when the binary string of the parsed bvsd_idx is 1B, bvsd_idx is 1.

[0574] At this point, the relationship between the context probability model of the bvsd_idx syntax element and binIdx is:

[0575] If abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] are both TRUE:

[0576] There can be two different probability models:

[0577] Table 44

[0578]

[0579] Alternatively, one can use a probabilistic model and the other a bypass code:

[0580] Table 45

[0581]

[0582] or

[0583] Table 46

[0584]

[0585] Otherwise, if abs_bvd_greater0_flag[0] or abs_bvd_greater0_flag[1] is TRUE:

[0586] You can use independent probability models:

[0587] Table 47

[0588]

[0589] Alternatively, you can use bypass encoding:

[0590] Table 48

[0591]

[0592] The second form is:

[0593] If abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] are both TRUE:

[0594] Table 49

[0595]

[0596] That is, if abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] are both TRUE, when the binary string of the parsed bvsd_idx is 00B, bvsd_idx is 0; when the binary string of the parsed bvsd_idx is 01B, bvsd_idx is 1; when the binary string of the parsed bvsd_idx is 10B, bvsd_idx is 2; when the binary string of the parsed bvsd_idx is 11B, bvsd_idx is 3.

[0597] Otherwise, if abs_bvd_greater0_flag[0] or abs_bvd_greater0_flag[1] is TRUE:

[0598] Table 50

[0599]

[0600] That is, when the binary string of the parsed bvsd_idx is 00B after binarization, bvsd_idx is 0; when the binary string of the parsed bvsd_idx is 01B after binarization, bvsd_idx is 1.

[0601] At this point, the relationship between the context probability model of the bvsd_idx syntax element and binIdx is:

[0602] If abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] are both TRUE, the same as the first form;

[0603] Otherwise, if abs_bvd_greater0_flag[0] or abs_bvd_greater0_flag[1] is TRUE:

[0604] Either one or two probability models can be used:

[0605] Table 51

[0606]

[0607] or

[0608]

[0609] It is also possible to use independent probability models and bypass codes together:

[0610] Table 52

[0611]

[0612] Alternatively, you can use bypass encoding:

[0613] Table 53

[0614]

[0615] 2) Use truncated binarization to binarize bvsd_idx:

[0616] Table 54

[0617]

[0618] When the binary string of the parsed bvsd_idx after binarization is 00B, bvsd_idx is 0; when the binary string of the parsed bvsd_idx after binarization is 01B, bvsd_idx is 1; when the binary string of the parsed bvsd_idx after binarization is 100B, bvsd_idx is 2; when the binary string of the parsed bvsd_idx after binarization is 101B, bvsd_idx is 3.

[0619] At this point, the relationship between the context probability model of the bvsd_idx syntax element and binIdx is:

[0620] You can use three probability models, or two, or one:

[0621] Table 55

[0622]

[0623] or

[0624] Table 56

[0625]

[0626] or

[0627] Table 57

[0628]

[0629] You can also use bypass encoding for any of the above binIdx, and combine them arbitrarily. Here is just one example:

[0630] Table 58

[0631]

[0632] 3) Use Exp-Golomb binarization to binarize bvsd_idx:

[0633] Table 59

[0634]

[0635] When the binary string of the parsed bvsd_idx after binarization is 1B, bvsd_idx is 0; when the binary string of the parsed bvsd_idx after binarization is 010B, bvsd_idx is 1; when the binary string of the parsed bvsd_idx after binarization is 011B, bvsd_idx is 2; when the binary string of the parsed bvsd_idx after binarization is 00100B, bvsd_idx is 3.

[0636] At this point, the relationship between the context probability model of the bvsd_idx syntax element and binIdx is:

[0637] Any combination of probabilistic models and bypass coding can be used, the following are just two examples:

[0638] Table 60

[0639]

[0640] or

[0641] Table 61

[0642]

[0643] In summary, the decoding method proposed in steps 101 to 104 above creates a combination list of BVDs between possible symbols of BVDs and absolute values ​​of BVDs, sorts the combination list using a template, and uses real BVD symbols and the sorted list to obtain symbol prediction indexes for CABAC encoding. This method has higher coding efficiency than bypass coding, thereby saving the bit rate required for BVD transmission in IBC.

[0644] It should be noted that the decoding method proposed in the embodiment of the present application can, on the one hand, make full use of the similarity between the template and the current coding block to effectively sort the BVD symbol combination list; on the other hand, CABAC can be used for encoding, which has higher coding efficiency than bypass coding.

[0645] The embodiment of the present application provides a coding and decoding method. At the decoding end, a bitstream is decoded to determine the absolute value of the BVD and BVD symbol index information of the current block; candidate BVDs of the current block are sorted based on the absolute value of the BVD of the current block to determine the sorting result; the BVD of the current block is determined based on the BVD symbol index information and the sorting result; and a reconstructed value of the current block is determined based on the BVD of the current block. At the encoding end, candidate BVDs of the current block are sorted based on the absolute value of the BVD of the current block to determine the sorting result; the BVD symbol index information of the current block is determined based on the BVD symbol information and the sorting result; and the BVD absolute value and BVD symbol index information are written into the bitstream. It can be seen that in the embodiments of the present application, the candidate BVDs of the current block can be effectively sorted according to the absolute value of the BVD of the current block, so that the sorting result can be used to determine and transmit the BVD symbol index information during encoding, and the sorting result can be used to parse the BVD symbol information of the current block during decoding. At the same time, the CABAC encoding and decoding technology can be used to encode and decode the BVD symbol information, which can effectively save the code rate required for the BVD symbol transmission in the IBC mode, thereby improving the encoding efficiency.

[0646] Based on the above embodiment, another embodiment of the present application provides a decoding method, wherein, for a decoder, during decoding, the BVD decoding input may be code stream information of the BVD absolute value and sign (BVD sign index information), and the BVD decoding output may be the actual information of the BVD absolute value and sign.

[0647] Among them, Figure 10 is a second schematic diagram of the decoding method in an embodiment of the present application. As shown in Figure 10, the BVD decoding process includes parsing the absolute value of the BVD (step 201), parsing the symbol prediction index of the BVD, that is, parsing the BVD symbol index information (step 202), creating a combination list of BVDs between the possible symbols of the BVD and the absolute value of the BVD, that is, determining the candidate BVD of the current block (step 203), performing template prediction based on the combination list of the BVP and BVD of the current block, calculating the cost of each BVD combination in the BVD combination list, that is, calculating the cost of the template area (first generation value) for the combination list (step 204), sorting the list and deriving the true BVD based on the symbol prediction index and the sorted list, and performing motion compensation (step 205).

[0648] Regarding the parsing of the absolute value of BVD proposed in step 201, the decoder can directly parse the actual absolute value of BVD from the bitstream, that is, the decoder can determine the absolute value of BVD of the current block by decoding the bitstream.

[0649] Regarding the determination of the symbol prediction index (BVD symbol index information) proposed in step 202, first, the number of bits of the binary number of the symbol prediction index can be determined based on the absolute value of the BVD parsed in step 201 during the decoding process. Specifically, if the absolute values ​​of both the horizontal and vertical components of the BVD are not 0, the number of bits of the binary number of the symbol prediction index is 2; if the horizontal component of the BVD is 0 and the absolute value of the vertical component is not 0, the number of bits of the binary number of the symbol prediction index is 1; if the horizontal component of the BVD is not 0 and the absolute value of the vertical component is 0, the number of bits of the binary number of the symbol prediction index is 1.

[0650] Then, the decoder can use CABAC (Context Adaptive Binary Arithmetic Coding) or bypass the corresponding decoding process to parse the binary number corresponding to the symbol prediction index from the bitstream.

[0651] For the context model of CABAC used for symbol prediction index, a single probability model or multiple probability models can be used, which may include but are not limited to distinguishing different probability models based on the absolute value of the horizontal component or vertical component of BVD, the sum or difference of the horizontal component and vertical component of BVD, etc.

[0652] For the process of determining the candidate BVDs of the current block proposed in step 203, that is, by creating a combination list of BVDs (candidate BVDs or initial set) between the possible signs of BVDs and the absolute values ​​of BVDs, the combination list of BVDs can be created according to different situations, such as only horizontal BVDs exist, only vertical BVDs exist, and both exist.

[0653] Determining the BVD combination list includes permuting and combining possible symbols of the BVD, and multiplying possible horizontal symbols and vertical symbols by the horizontal absolute value component and the vertical absolute value component of the BVD respectively.

[0654] To better illustrate how to construct a BVD combination list (candidate BVD or initial set), three simple classifications are used as examples:

[0655] Classification Example 1: BVD is divided into horizontal and vertical components. When the horizontal component is zero, only the vertical component is encoded. Therefore, only the combination list of the vertical component symbols is constructed. Specifically, there are two cases:

[0656] The first case: the horizontal components are all positive, which is just a placeholder. The vertical components are first positive and then negative. A symbol list is constructed, and then the constructed symbol list is multiplied by the absolute values ​​of the horizontal and vertical components of BVD to obtain the combined list of BVD.

[0657] The second case: the horizontal components are all positive, which is just a placeholder. The vertical components are first negative and then positive. A sign list is constructed, and then the constructed sign list is multiplied by the absolute values ​​of the horizontal and vertical components of BVD to obtain the combined list of BVD.

[0658] Classification Example 2: BVD is divided into horizontal and vertical components. When the vertical component is zero, only the horizontal component is encoded, so only the combination list of the horizontal component symbols is constructed. Specifically, there are two cases:

[0659] The first case: the vertical components are all positive, which is just a placeholder. The horizontal components are first positive and then negative. A sign list is constructed, and then the constructed sign list is multiplied by the absolute values ​​of the vertical and horizontal components of BVD to obtain the combined list of BVD.

[0660] The second case: the vertical components are all positive, which is just a placeholder. The horizontal components are first negative and then positive. A sign list is constructed, and then the constructed sign list is multiplied by the absolute values ​​of the vertical and horizontal components of BVD to obtain the combined list of BVD.

[0661] Classification Example 3: BVD is divided into horizontal and vertical components. When both components are non-zero, both need to be encoded. Therefore, a BVD list is constructed for both horizontal and vertical components. Specifically, there are 24 cases, namely, any permutation of the four combinations of {+1, +1}, {+1, -1}, {-1, +1}, and {-1, -1}. The following examples illustrate:

[0662] The 0th bit of the list is that both the horizontal and vertical components are positive, the 1st bit of the list is that the horizontal component is positive and the vertical component is negative, the 2nd bit of the list is that the horizontal component is negative and the vertical component is positive, and the 3rd bit of the list is that both the horizontal and vertical components are negative. A sign list is constructed, and then the constructed sign list is multiplied by the absolute values ​​of the vertical and horizontal components of BVD to obtain a combination list of BVD.

[0663] For the template prediction proposed in step 204 based on the combination list (candidate BVD) of the BVP and BVD of the current block, the cost (first generation value) of each BVD combination (candidate BVD) in the BVD combination list is calculated, that is, the cost of the template area is calculated. The cost of various combinations in the BVD combination list can be calculated using the template, specifically the cost of the reconstructed luminance pixel at the position obtained by template prediction using the reconstructed luminance pixel at the current block template position and the BV obtained by the combination of the BVP and BVD of the current block.

[0664] It should be noted that, in the embodiments of the present application, when calculating the cost (first generation value), not only brightness but also chrominance, namely Cb and Cr components, may be used, which is not specifically limited in the present application.

[0665] When selecting a template (the first template for the current block), the availability of pixels at the template location can be determined based on the pixel availability in the neighboring area of ​​the current block, including the ability to reconstruct brightness information. As shown in Figure 6, templates can be categorized into top, left, top-right, bottom-left, and top-left templates based on their relative positional relationship with the current block. Templates of different types can have fixed or different sizes for different coding blocks.

[0666] For example, the template size may be the same for any current coding block (current block), or different template sizes may be selected according to different sizes of the current coding block, or different template sizes may be selected according to the number of pixels in the current brightness coding block.

[0667] When predicting the BV of the current block, the combined list of the BVP and BVD of the current block can be used to generate a new BV. As shown in Figure 8, the current block is used to determine whether the BV is available (the available condition is that the reference block pointed to by the BV has been reconstructed and does not exceed the search range set by the IBC and the image boundary and other conditions). If the current BV is available, the template of the current block and the new BV are used for motion compensation to obtain the template at the corresponding BV. As shown in Figure 9, the horizontal and vertical components of the BVD generate a total of 4 combinations of BVDs, which are used for motion compensation at the template respectively. There are several situations in which the template is used when calculating the cost:

[0668] The first type: the upper template and the left template of the current block both exist, and the upper template and the left template at the corresponding BV both exist. In this case, both the upper template and the left template are available.

[0669] The second method is: Both the upper and left templates of the current block exist, but only the upper template exists at the corresponding BV. In this case, there are two methods: Method 1: If the left template at the corresponding BV does not exist, it is directly ignored, that is, only the upper template is used for calculation. Method 2: If the left template at the corresponding BV does not exist, the leftmost template width column in the reference block is used instead of the left template, that is, the upper and left templates are used for calculation.

[0670] The third method is: both the upper template and the left template of the current block exist, but only the left template exists at the corresponding BV. In this case, there are two methods: Method 1: If the upper template does not exist at the corresponding BV, it is directly not used, that is, only the left template is used for calculation. Method 2: If the upper template does not exist at the corresponding BV, the uppermost template height row inside the reference block is used instead of the upper template, that is, the upper and left templates are used for calculation.

[0671] The fourth scenario: Only the upper template exists in the current block. In this case, there are three methods: Method 1: If the upper template at the corresponding BV does not exist, it is not used. Method 2: If the upper template at the corresponding BV does not exist, the uppermost template height row in the reference block is used instead. Method 3: If the upper template at the corresponding BV exists, it is used directly.

[0672] The fifth method: Only the left template exists in the current block. In this case, there are three methods: Method 1: If the left template at the corresponding BV does not exist, it is not used directly. Method 2: If the left template at the corresponding BV does not exist, the leftmost template width column in the reference block is used instead of the left template. Method 3: If the left template at the corresponding BV exists, it is used directly.

[0673] Type 6: Both the upper template and the left template of the current block do not exist. The BVD combination in this case is ignored.

[0674] In the above six cases, when the reference block pointed to by BV is unavailable, the BVD combination in this case is ignored. Among them, when the BVD combination in a certain case is ignored, the cost in this case is set to the maximum value of the cost evaluation criterion.

[0675] When performing cost calculation, i.e., determining the first-generation value, there are multiple options for the cost function for calculating the cost of the template area, i.e., there are multiple options for the preset error criteria. For example, the evaluation criteria may include the sum of absolute deviations (SAD), the sum of transformed absolute deviations (SATD), the sum of squared differences (SSE), the mean absolute difference (MAD), the mean absolute error (MAE), the mean squared error (MSE), and the rate-distortion function (RDO).

[0676] After calculating the cost (first generation value) of the template area in step 204, step 205 can be executed, that is, sorting the combination list according to the cost obtained in the template area, that is, the candidate BVDs can be sorted using the first generation value, and the symbol prediction index of the BVD and the sorted list (the candidate BVD list of the current block) can be used to obtain the real BVD, and then motion compensation can be performed.

[0677] When sorting the combination list according to the cost obtained from the template area, that is, sorting the candidate BVDs according to the first generation value, a new list OrderedList (candidate BVD list of the current block) arranged in ascending (descending) order can be used, or a new list OrderedList arranged in a specific order can be used.

[0678] (1) Arrange the new list OrderedList in ascending (descending) order.

[0679] For example, sorting methods such as bubble sort, selection sort, insertion sort, shell sort, merge sort, quick sort, radix sort, heap sort, counting sort, and bucket sort are used.

[0680] (2) A new list OrderedList arranged in a specific order.

[0681] Including but not limited to the following forms: Here is a specific order of arrangement:

[0682] Case 1: Assume that the combination list (candidate BVD) is {(+BVD HOR , +BVD VER ), (+BVD HOR , -BVD VER ), (-BVD HOR , -BVD VER ), (-BVD HOR , +BVD VER )}, and its corresponding cost list is {Cost(+BVD HOR , +BVD VER ), Cost(+BVD HOR , -BVD VER ), Cost(-BVD HOR , -BVD VER ), Cost(-BVD HOR , +BVD VER )}. The order of the members in the above two lists can be arranged in any order.

[0683] Define two arrays posiGrp and negaGrp. posiGrp stores two BVD combinations with positive signs on the same component (level), and negaGrp stores two BVD combinations with negative signs on the same component (level).

[0684] Assume posiGrp={(+BVD HOR , +BVD VER ), (+BVD HOR , -BVD VER )}, negaGrp={(-BVD HOR , +BVD VER ), (-BVD HOR , -BVD VER )}. The order of the members in the posiGrp and negaGrp lists can be arranged arbitrarily.

[0685] First comparison: Compare Cost(+BVD HOR , +BVD VER ) and Cost(+BVD HOR , -BVD VER ), set posiGrp[0] to the smaller BVD combination of the two, and set posiGrp[1] to the larger BVD combination of the two;

[0686] Second comparison: Comparison of Cost(-BVD HOR , +BVD VER ) and Cost(-BVD HOR , -BVD VER ), set negaGrp[0] to the smaller BVD combination of the two, and set negaGrp[1] to the larger BVD combination of the two;

[0687] The third comparison: compare the Cost corresponding to posiGrp[0] and negaGrp[0];

[0688] The final sorting process:

[0689] If in the third comparison, the Cost corresponding to posiGrp[0] is less than or equal to the Cost corresponding to negaGrp[0], posiGrp[0] is sorted at the 0th position in the candidate BVD list OrderedList, negaGrp[0] is sorted at the 1st position in the candidate BVD list OrderedList, posiGrp[1] is sorted at the 2nd position in the candidate BVD list OrderedList, and negaGrp[1] is sorted at the 3rd position in the candidate BVD list OrderedList.

[0690] If in the third comparison, the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0], sort negaGrp[0] at the 0th position in the candidate BVD list OrderedList, sort posiGrp[0] at the 1st position in the candidate BVD list OrderedList, sort negaGrp[1] at the 2nd position in the candidate BVD list OrderedList, and sort posiGrp[1] at the 3rd position in the candidate BVD list OrderedList.

[0691] Among them, the candidate BVD at position 0 in the candidate BVD list of the current block is the first candidate BVD in the candidate BVD list, the candidate BVD at position 1 is the second candidate BVD in the candidate BVD list, the candidate BVD at position 2 is the third candidate BVD in the candidate BVD list, and the candidate BVD at position 3 is the fourth candidate BVD in the candidate BVD list.

[0692] Another way to sort is:

[0693] If in the third comparison, the Cost corresponding to posiGrp[0] is less than or equal to the Cost corresponding to negaGrp[0], posiGrp[0] is sorted at the 0th position in the candidate BVD list OrderedList, negaGrp[0] is sorted at the 2nd position in the candidate BVD list OrderedList, posiGrp[1] is sorted at the 1st position in the candidate BVD list OrderedList, and negaGrp[1] is sorted at the 3rd position in the candidate BVD list OrderedList.

[0694] If in the third comparison, the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0], sort negaGrp[0] at the 0th position in the candidate BVD list OrderedList, sort posiGrp[0] at the 2nd position in the candidate BVD list OrderedList, sort negaGrp[1] at the 1st position in the candidate BVD list OrderedList, and sort posiGrp[1] at the 3rd position in the candidate BVD list OrderedList.

[0695] The second case: Assume that the combination list is {(0, +BVD VER ),(0,-BVD VER )}, and its corresponding cost list is {Cost(0, +BVD VER ), Cost(0, -BVD VER )}. The order of the members in the above two lists can be arranged in any order.

[0696] The sorting process is: compare Cost(0, +BVD VER ) and Cost(0, -BVD VER ) size:

[0697] If Cost(0, +BVD VER )<=Cost(0, -BVD VER ), then (0, +BVD VER ) is sorted in the 0th position of the candidate BVD list OrderedList, and (0, -BVD VER ) is sorted at the first position in the candidate BVD list OrderedList;

[0698] If Cost(0, +BVD VER )>Cost(0,-BVD VER ), then (0, -BVD VER ) is sorted in the 0th position of the candidate BVD list OrderedList, and (0, +BVD VER ) is sorted at the first position in the candidate BVD list OrderedList.

[0699] The third case: Assume that the combination list is {(+BVD HOR ,0),(-BVD HOR ,0)}, and its corresponding cost list is {Cost(+BVD HOR ,0),Cost(-BVD HOR ,0)}. The order of the members in the above two lists can be arranged in any order.

[0700] The sorting process is: compare Cost(+BVD HOR ,0) and Cost(-BVD HOR ,0)’s size:

[0701] If Cost(+BVD HOR ,0)<=Cost(-BVD HOR ,0), then (+BVD HOR ,0) is sorted in the 0th position of the candidate BVD list OrderedList, and (-BVD HOR ,0) is ranked first in the candidate BVD list OrderedList;

[0702] If Cost(+BVD HOR ,0)>Cost(-BVD HOR ,0), then (-BVD HOR,0) is sorted in the 0th position of the candidate BVD list OrderedList, and (+BVD HOR , 0) is ranked first in the candidate BVD list OrderedList.

[0703] After sorting the combination list based on the cost obtained from the template region, that is, sorting the candidate BVDs based on the first-generation value, the sorting result obtained can also be the candidate BVD set for the current block. The candidate BVDs can be sorted based on the first-generation value to determine the candidate BVD set for the current block, where the candidate BVD set includes at least one candidate BVD.

[0704] If both the horizontal and vertical components of BVD exist, that is, both absBvdX and absBvdY are non-zero, then the combination list is {(+, +), (+, -), (-, -), (-, +)}, and the corresponding cost list is {Cost (+, +), Cost (+, -), Cost (-, -), Cost (-, +)}. The order of the members in the two lists can be arbitrary.

[0705] Define two arrays posiGrp and negaGrp. posiGrp stores the sign combination of two BVDs with positive signs on the same component (level), and negaGrp stores the sign combination of two BVDs with negative signs on the same component (level).

[0706] Assume that posiGrp = {(+, +), (+, -)}, negaGrp = {(-, +), (-, -)}. The order of the members in the two lists posiGrp and negaGrp can be arranged arbitrarily.

[0707] First comparison: Compare the sizes of Cost(+,+) and Cost(+,-), set posiGrp[0] to the sign combination of the smaller BVD of the two, and set posiGrp[1] to the sign combination of the larger BVD of the two;

[0708] Second comparison: compare the size of Cost(-, +) and Cost(-, -), set negaGrp[0] to the sign combination of the smaller BVD of the two, and set negaGrp[1] to the sign combination of the larger BVD of the two;

[0709] The third comparison: compare the cost corresponding to posiGrp[0] and negaGrp[0].

[0710] Then, a symbol combination of a BVD with the minimum cost can be determined, that is, the BVD with the minimum cost in the candidate BVD set can be determined.

[0711] For the case where only the vertical component of a BVD exists, assume the combination list is {(+, +), (+, -)}, and the corresponding cost list is {Cost(+, +), Cost(+, -)}. The order of the members in these two lists can be arbitrarily arranged. The comparison process is to compare Cost(+, +) and Cost(+, -) to determine the sign combination of the BVD with the minimum cost, that is, to determine the minimum cost BVD in the candidate BVD set.

[0712] For the case where only the horizontal component of a BVD exists, assume the combination list is {(+, +), (-, +)}, and the corresponding cost list is {Cost(+, +), Cost(-, +)}. The order of the members in the two lists can be arbitrarily arranged. The comparison process is to compare the size of Cost(+, +) and Cost(-, +), and then determine the sign combination of the BVD with the minimum cost, that is, determine the minimum cost BVD in the candidate BVD set.

[0713] When using the symbol prediction index of BVD (BVD symbol index information) and the sorted list (candidate BVD list of the current block) to determine the true BVD, because the sorted list (candidate BVD list of the current block) is divided into three cases, namely, BVD has only horizontal components, BVD has only vertical components, and BVD has both horizontal and vertical components, so the three cases are also introduced here.

[0714] Among them, for the new list OrderedList arranged in ascending (descending) order, there may be two solutions, one is to use the conversion list to indirectly obtain the real BVD symbol, and the other is to directly use logical reasoning to obtain the real BVD symbol.

[0715] When using the transformation list to indirectly obtain the real BVD symbol, the decoder needs to first convert the BVD combination list OrderedList into the index transformation list TransformedList according to the transformation rules.

[0716] In the first case, both the horizontal and vertical components of BVD exist. In this case, the symbol prediction index of BVD is two bits:

[0717] Assume that the sorted BVD combination list OrderedList is:

[0718] Table 62. OrderedList of sorted BVD combinations where both horizontal and vertical BVDs exist

[0719] Index horizontal component vertical component 0a1a21b1b22c1c23d1d2

[0720] Use the following conversion rules to convert the sorted BVD combination list OrderedList into TransformedList (index transformation list):

[0721] Place the BVD combination with the smallest cost after sorting at the 0th position of the TransformedList list, that is, place (a1, a2) at the 0th position of the TransformedList list. Place the BVD combination with the same sign as a1 at the 2nd position of the TransformedList list, that is, assuming b1 has the same sign as it, place (b1, b2) at the 2nd position of the TransformedList list. Place the BVD combination with a smaller cost but a different sign from a1 at the 1st position of the TransformedList list, that is, place (c1, c2) at the 1st position of the TransformedList list. Place the BVD combination with a larger cost but a different sign from a1 at the 3rd position of the TransformedList list, that is, place (d1, d2) at the 3rd position of the TransformedList list.

[0722] Then the index transformation list TransformedList is:

[0723] Table 63. Index transformation list TransformedList exists for both horizontal and vertical BVD

[0724] Index Horizontal Component Vertical Component 0a1a21c1(-a1)c22b1(a1)b23d1(-a1)d2

[0725] For the index conversion list, the symbol of the real BVD is obtained according to the following rules. At this time, the predicted index of the symbol is equal to the index of the leftmost column in the table:

[0726] Parse the symbol prediction index bit 0:

[0727] When the 0th bit is 0, the true BVD horizontal component is equal to a1. Check its vertical component. If the 1st bit is 0, the true BVD vertical component is equal to a2; if the 1st bit is 1, the true BVD vertical component is equal to -a2.

[0728] When the 0th bit is 1, the true BVD horizontal component is equal to -a1. Check the vertical component of the candidate BVD of index 1. If the 1st bit is 0, the true BVD vertical component is equal to c2; if the 1st bit is 1, the true BVD vertical component is equal to -c2.

[0729] In the second case, only the BVD vertical component exists. In this case, the BVD symbol prediction index is one bit:

[0730] Assume that the sorted BVD combination list OrderedList is:

[0731] Table 64. OrderedList of sorted BVD combinations where only vertical BVDs exist

[0732] Index horizontal component vertical component 00a210b2 (-a2)

[0733] Then the index transformation list TransformedList is the same as the sorted BVD combination list OrderedList.

[0734] The index transformation list TransformedList is:

[0735] Table 65. Index TransformedList where only vertical BVD exists

[0736] Index horizontal component vertical component 00a210b2 (-a2)

[0737] For the index conversion list, the symbol of the real BVD is obtained according to the following rules. At this time, the predicted index of the symbol is equal to the index of the leftmost column in the table:

[0738] If the 0th bit is 0, the true BVD vertical component is a2; otherwise, the true BVD vertical component is -a2.

[0739] In the third case, only the BVD horizontal component exists. In this case, the BVD symbol prediction index is one bit:

[0740] Assume that the sorted BVD combination list OrderedList is:

[0741] Table 66. OrderedList of sorted BVD combinations where only horizontal BVDs exist

[0742] Index horizontal component vertical component 0a101b1(-a1)0

[0743] Then the index transformation list TransformedList is the same as the sorted BVD combination list OrderedList.

[0744] The index transformation list TransformedList is:

[0745] Table 67. TransformedList of indexes that only exist for horizontal BVD

[0746] Index horizontal component vertical component 0a101b1(-a1)0

[0747] For the index conversion list, the symbol of the real BVD is obtained according to the following rules. At this time, the predicted index of the symbol is equal to the index of the leftmost column in the table:

[0748] If the 0th bit is 0, the true BVD horizontal component is a1, otherwise, the true BVD horizontal component is -a1.

[0749] When directly using logical reasoning to obtain the true BVD symbol, in the first case, both the horizontal component and the vertical component of the BVD exist. In this case, the BVD symbol prediction index is two bits:

[0750] Assume that the sorted BVD combination list OrderedList is:

[0751] Table 68. OrderedList of sorted BVD combinations where both horizontal and vertical BVDs exist

[0752] Index horizontal component vertical component 0a1a21b1b22c1c23d1d2

[0753] If the 0th bit of the parsed BVD's sign prediction index is 0, the horizontal component of the true BVD is equal to a1. If the 0th bit is 1, the horizontal component of the true BVD is equal to -a1, which is the opposite of a1. In this case, the horizontal component of the true BVD is determined to be e1. Then, starting from index 0, the sorted list (the candidate BVD list for the current block) is traversed. When a BVD with the same horizontal component as the true BVD determined above first appears in the list, its vertical component is checked. Assuming its vertical component is f2, if the first bit is 0, the vertical component of the true BVD is equal to f2. If the first bit is 1, the vertical component of the true BVD is equal to -f2, which is the opposite of f2. In this case, the vertical component of the true BVD is determined to be e2. In this way, the true BVD is obtained, that is, the BVD with a horizontal component of e1 and a vertical component of e2.

[0754] In the second case, only the vertical component of BVD exists. In this case, the symbol prediction index of BVD is one bit:

[0755] Assume that the sorted BVD combination list OrderedList is:

[0756] Table 69. OrderedList of sorted BVD combinations where only vertical BVDs exist

[0757] Index horizontal component vertical component 00a210b2 (-a2)

[0758] If the 0th bit of the parsed BVD sign prediction index is 0, the true BVD vertical component is equal to a2; if the 0th bit is 1, the true BVD vertical component is equal to -a2, which is the opposite of a2. In this case, the true BVD vertical component is e2 and the horizontal component is 0. In this way, the true BVD is obtained, that is, the BVD with a horizontal component of 0 and a vertical component of e2.

[0759] In the third case, only the horizontal component of BVD exists. In this case, the symbol prediction index of BVD is one bit:

[0760] Assume that the sorted BVD combination list OrderedList is:

[0761] Table 70. OrderedList of sorted BVD combinations where only horizontal BVDs exist

[0762] Index horizontal component vertical component 0a101b1(-a1)0

[0763] If the 0th bit of the parsed BVD sign prediction index is 0, the horizontal component of the true BVD is equal to a1. If the 0th bit is 1, the horizontal component of the true BVD is equal to -a1, which is the opposite of a1. In this case, the horizontal component of the true BVD is e1 and the vertical component is 0. In this way, the true BVD is obtained, that is, the BVD with a horizontal component of e1 and a vertical component of 0.

[0764] Furthermore, for a new list OrderedList arranged in a specific order, the sorted BVD combination list OrderedList can be directly assigned to TransformedList.

[0765] In TransformedList, the BVD combination corresponding to the symbol prediction index of BVD is the real BVD.

[0766] In the first case, both the horizontal and vertical components of BVD exist. In this case, the symbol prediction index of BVD is two bits:

[0767] Assume that the sorted BVD combination list OrderedList is:

[0768] Table 71. OrderedList of sorted BVD combinations where both horizontal and vertical BVDs exist

[0769] Index Horizontal Component Vertical Component 0a1a21b1(-a1)b22c1(a1)c23d1(-a1)d2

[0770] Then the index transformation list TransformedList is:

[0771] Table 72. Index transformation list TransformedList that exists for both horizontal and vertical BVD

[0772] Index horizontal component vertical component 0a1a21b1(-a1)b2

[0773] 2c1(a1)c23d1(-a1)d2

[0774] For the index conversion list, the symbol of the real BVD is obtained according to the following rules. At this time, the predicted index of the symbol is equal to the index of the leftmost column in the table:

[0775] Parse the symbol prediction index bit 0:

[0776] When the 0th bit is 0, the true BVD horizontal component is equal to a1. Check its vertical component. If the 1st bit is 0, the true BVD vertical component is equal to a2; if the 1st bit is 1, the true BVD vertical component is equal to -a2.

[0777] When the 0th bit is 1, the true BVD horizontal component is equal to -a1. Check the vertical component of the candidate BVD of index 1. If the 1st bit is 0, the true BVD vertical component is equal to c2; if the 1st bit is 1, the true BVD vertical component is equal to -c2.

[0778] In the second case, only the BVD vertical component exists. In this case, the BVD symbol prediction index is one bit:

[0779] Assume that the sorted BVD combination list OrderedList is:

[0780] Table 73. OrderedList of sorted BVD combinations where only vertical BVDs exist

[0781] Index horizontal component vertical component 00a210b2 (-a2)

[0782] Then the index transformation list TransformedList is:

[0783] Table 74. Index TransformedList where only vertical BVD exists

[0784] Index horizontal component vertical component 00a210b2 (-a2)

[0785] For the index conversion list, the symbol of the real BVD is obtained according to the following rules. At this time, the predicted index of the symbol is equal to the index of the leftmost column in the table:

[0786] When the 0th bit is 0, the vertical component of the real BVD is equal to a2; otherwise, the vertical component of the real BVD is equal to -a2.

[0787] In the third case, only the BVD horizontal component exists. In this case, the BVD symbol prediction index is one bit:

[0788] Assume that the sorted BVD combination list OrderedList is:

[0789] Table 75. OrderedList of sorted BVD combinations where only horizontal BVDs exist

[0790] Index horizontal component vertical component 0a101b1(-a1)0

[0791] Then the index transformation list TransformedList is:

[0792] Table 76. TransformedList of indexes that only exist for horizontal BVD

[0793] Index horizontal component vertical component 0a101b1(-a1)0

[0794] For the index conversion list, the symbol of the real BVD is obtained according to the following rules. At this time, the predicted index of the symbol is equal to the index of the leftmost column in the table:

[0795] When the 0th bit is 0, the horizontal component of the true BVD is equal to a1, otherwise, the horizontal component of the true BVD is equal to -a1.

[0796] Furthermore, in an embodiment of the present application, if the sorting result after the sorting process is a candidate BVD set for the current block, then after the sorting, the candidate BVD with the lowest template matching cost is determined, that is, the lowest cost BVD in the candidate BVD set is determined. At this time, if the value of bvsdIdx is bit0+bit1<<1, that is, bit0 represents the horizontal component symbol and bit1 represents the vertical component symbol, then the minimum BVD symbol combination (minimum cost BVD) determines the symbol of bit0 and bit1 when the value is equal to 0, and the opposite symbol when the value is equal to 1.

[0797] It should be noted that, in the embodiment of the present application, it is assumed that the signs of the horizontal component and vertical component of the real BVD are bvdSign[0] and bvdSign[1], where a value of 0 indicates positive and a value of 1 indicates negative.

[0798] Case 1: Both horizontal and vertical components of BVD exist.

[0799] (1) If in the third comparison, the Cost corresponding to posiGrp[0] <= the Cost corresponding to negaGrp[0]:

[0800] If the 0th bit is 0, bvd_sign[0] = 0. If the 1st bit is 0, bvd_sign[1] = posiGrp[0][1]; if the 1st bit is 1, bvd_sign[1] = posiGrp[1][1].

[0801] If the 0th bit is 1, bvd_sign[0] = 1. If the 1st bit is 0, bvd_sign[1] = negaGrp[0][1]; if the 1st bit is 1, bvd_sign[1] = negaGrp[1][1].

[0802] (2) If in the third comparison, the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0]:

[0803] If the 0th bit is 1, bvd_sign[0] = 0. If the 1st bit is 0, bvd_sign[1] = posiGrp[0][1]; if the 1st bit is 1, bvd_sign[1] = posiGrp[1][1].

[0804] If the 0th bit is 0, bvd_sign[0] = 1. If the 1st bit is 0, bvd_sign[1] = negaGrp[0][1]; if the 1st bit is 1, bvd_sign[1] = negaGrp[1][1].

[0805] The second case: BVD only has vertical component.

[0806] (1) If Cost(+,+)<=Cost(+,-):

[0807] If the 0th bit is 0, then bvd_sign[1]=0.

[0808] If the 0th bit is 1, then bvd_sign[1]=1.

[0809] (2) If Cost(+, +)>Cost(+, -):

[0810] If the 0th bit is 0, then bvd_sign[1]=1.

[0811] If the 0th bit is 1, then bvd_sign[1]=0.

[0812] The third case: BVD only has horizontal component.

[0813] (1) If Cost(+,+)<=Cost(-,+):

[0814] If the 0th bit is 0, then bvd_sign[0]=0.

[0815] If the 0th bit is 1, then bvd_sign[0]=1.

[0816] (2) If Cost(+, +)>Cost(-, +):

[0817] If the 0th bit is 0, then bvd_sign[0]=1.

[0818] If the 0th bit is 1, then bvd_sign[0]=0.

[0819] It can be seen that the above method of determining the BVD of the current block based on the candidate BVD set can omit the steps of establishing a list and obtaining a symbol prediction index. The decoding end can directly obtain the true BVD symbol through three comparisons.

[0820] For example, in the embodiment of the present application, taking the case where there are two probability models in the CABAC model as an example, the parsing position is as described in (1) in the overall process of the decoding end of the main technical solution, which is located after bvd_coding(), the overall process of the decoding end is as follows:

[0821]

[0822]

[0823]

[0824] If abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] are both TRUE, then bvd_sign_bin[0] is the 0th bit and bvd_sign_bin[1] is the 1st bit.

[0825] If only abs_bvd_greater0_flag[0] is TRUE, then bvd_sign_bin[0] is the 0th bit above;

[0826] If only abs_bvd_greater0_flag[1] is TRUE, bvd_sign_bin[1] is the 0th bit mentioned above.

[0827] The absolute value of the motion vector difference abs_bvd[compIdx] for compIdx=0..1 is derived as follows:

[0828] abs_bvd[compIdx]=abs_bvd_greater0_flag[compIdx]*(abs_bvd_minus1[compIdx]+1)

[0829] Table 77

[0830]

[0831] compIdx=0…1, indicating the horizontal component or the vertical component.

[0832] The derivation process of the true BVD is as follows:

[0833] bvd[compIdx]=abs_bvd_greater0_flag[compIdx]*

[0834] (abs_bvd_minus1[compIdx]+1)*(1-2*bvd_sign[compIdx])

[0835] Furthermore, in an embodiment of the present application, for the above embodiment, in adopting a candidate BVD list OrderedList in a specific order and determining a candidate BVD set, a solution of using two arrays to store candidate BVDs separately is proposed, wherein, when both horizontal and vertical components of the BVD exist, the order of the horizontal component and the vertical component can be interchanged.

[0836] For example, in an embodiment of the present application, if both horizontal and vertical components of BVD exist, assuming that the combination list is {(+, +), (+, -), (-, -), (-, +)}, the corresponding cost list is {Cost (+, +), Cost (+, -), Cost (-, -), Cost (-, +)}. The order of the members in the above two lists can be arranged arbitrarily.

[0837] Define two arrays posiGrp and negaGrp. posiGrp stores the sign combination of two BVDs with positive signs on the same component (vertical), and negaGrp stores the sign combination of two BVDs with negative signs on the same component (vertical).

[0838] Assume that posiGrp = {(+, +), (-, +)}, negaGrp = {(+, -), (-, -)}. The order of the members in the two lists posiGrp and negaGrp can be arranged arbitrarily.

[0839] First comparison: Compare the sizes of Cost(+,+) and Cost(-,+), set posiGrp[0] to the smaller BVD combination of the two, and set posiGrp[1] to the larger BVD combination of the two;

[0840] Second comparison: compare the size of Cost(+,-) and Cost(-,-), set negaGrp[0] to the smaller BVD combination of the two, and set negaGrp[1] to the larger BVD combination of the two;

[0841] The third comparison: compare the Cost corresponding to posiGrp[0] and negaGrp[0];

[0842] (1) If in the third comparison, the Cost corresponding to posiGrp[0] <= the Cost corresponding to negaGrp[0]:

[0843] If the 0th bit is 0, bvd_sign[1] = 0. If the 1st bit is 0, bvd_sign[0] = posiGrp[0][0]; if the 1st bit is 1, bvd_sign[0] = posiGrp[1][0].

[0844] If the 0th bit is 1, bvd_sign[1] = 1. If the 1st bit is 0, bvd_sign[0] = negaGrp[0][0]; if the 1st bit is 1, bvd_sign[0] = negaGrp[1][0].

[0845] (2) If in the third comparison, the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0]:

[0846] If the 0th bit is 1, bvd_sign[1] = 0. If the 1st bit is 0, bvd_sign[0] = posiGrp[0][0]; if the 1st bit is 1, bvd_sign[0] = posiGrp[1][0].

[0847] If the 0th bit is 0, bvd_sign[1] = 1. If the 1st bit is 0, bvd_sign[0] = negaGrp[0][0]; if the 1st bit is 1, bvd_sign[0] = negaGrp[1][0].

[0848] Furthermore, in the embodiments of the present application, when both horizontal and vertical components of the BVD are present, the order of the horizontal and vertical components can be interchanged, and the order of the horizontal and vertical components can be determined by certain criteria. This includes, but is not limited to, determining the order of the horizontal and vertical components based on criteria such as the absolute values ​​of the horizontal and vertical components of the BVD.

[0849] Furthermore, in an embodiment of the present application, for the sorted BVD combination list (candidate BVD list), their respective costs can be stored, and then a reordering can be performed based on these stored costs. The specific process is: if the cost difference between a candidate in the list and the previous candidate is lower than the λ value, for example, |D1-D2|<λ, then the candidate is considered redundant, where D1 and D2 are the costs obtained after the first sorting, and λ is the Lagrangian parameter used in the encoder-side RD criterion.

[0850] For example, FIG11 is a schematic diagram of calculating the cost. As shown in FIG11 , the algorithm for calculating the cost is defined as follows:

[0851] (1) Determine the minimum cost difference between a candidate and its previous candidate among all candidates in the list

[0852] If the minimum cost difference is greater than or equal to λ, the list is considered diverse enough and the re-ranking stops.

[0853] If the minimum cost difference is less than λ, the candidate is considered redundant and is moved to another position that is sufficiently diverse compared to its previous candidates.

[0854] (2) The algorithm stops after a finite number of iterations.

[0855] Thus, the encoding and decoding method proposed in the embodiment of the present application can effectively reduce the bit rate required for BVD symbol transmission in IBC mode. Specifically, a combination list of BVDs can be created between the possible BVD symbols and the absolute value of the BVD, and the combination list can be sorted using a template. The symbol prediction index is obtained using the actual BVD symbols and the sorted list for CABAC encoding. The proposed scheme has higher coding efficiency than bypass coding, thereby reducing the bit rate required for BVD transmission in IBC.

[0856] That is to say, the embodiment of the present application proposes a new symbol transmission method for BVD in IBC, which can make full use of the similarity between the template and the current coding block to effectively sort the symbol combination list of BVD; at the same time, CABAC is used for encoding, which has higher coding efficiency than bypass coding.

[0857] The embodiment of the present application provides a coding and decoding method. At the decoding end, a bitstream is decoded to determine the absolute value of the BVD and BVD symbol index information of the current block; candidate BVDs of the current block are sorted based on the absolute value of the BVD of the current block to determine the sorting result; the BVD of the current block is determined based on the BVD symbol index information and the sorting result; and a reconstructed value of the current block is determined based on the BVD of the current block. At the encoding end, candidate BVDs of the current block are sorted based on the absolute value of the BVD of the current block to determine the sorting result; the BVD symbol index information of the current block is determined based on the BVD symbol information and the sorting result; and the BVD absolute value and BVD symbol index information are written into the bitstream. It can be seen that in the embodiments of the present application, the candidate BVDs of the current block can be effectively sorted according to the absolute value of the BVD of the current block, so that the sorting result can be used to determine and transmit the BVD symbol index information during encoding, and the sorting result can be used to parse the BVD symbol information of the current block during decoding. At the same time, the CABAC encoding and decoding technology can be used to encode and decode the BVD symbol information, which can effectively save the code rate required for the BVD symbol transmission in the IBC mode, thereby improving the encoding efficiency.

[0858] An embodiment of the present application provides an encoding method, which can be applied to an encoder. FIG12 is a schematic diagram 1 of the encoding method in the embodiment of the present application. As shown in FIG12 , the method for performing decoding processing by a decoder may include the following steps:

[0859] Step 301: Sort candidate BVDs of the current block according to the absolute value of the BVD of the current block to determine a sorting result.

[0860] In an embodiment of the present application, the encoder may first determine the absolute value of the BVD of the current block, and then sort the candidate BVDs of the current block according to the absolute value of the BVD of the current block, thereby determining a sorting result.

[0861] It will be appreciated that in the embodiments of the present application, the BVD absolute value includes a first component absolute value absBvdX and a second component absolute value absBvdY; that is, the BVD absolute value includes a horizontal component absolute value and a vertical component absolute value. Accordingly, the BVD of the current block may include a first component candBvdX and a second component candBvdY. Simultaneously, the candidate BVD of the current block also includes a first component candBvdX and a second component candBvdY. That is, the BVD may include both a horizontal component and a vertical component.

[0862] Further, in an embodiment of the present application, if absBvdX and absBvdY are both not 0, then it can be determined that the number of bits of the BVD symbol index information is 2; if absBvdX or absBvdY is 0, then it can be determined that the number of bits of the BVD symbol index information is 1.

[0863] It should be noted that in the embodiments of the present application, in addition to the fixed-length encoding method described above, a variable-length encoding method may also be used to encode the BVD symbol index information. For example, the BVD symbol index information may be encoded using a truncated unary code, or binarized using a truncated binary code (truncated binarization). In this case, the number of bits of the BVD symbol index information is not necessarily 2.

[0864] That is to say, in an embodiment of the present application, if a truncated unary code is used to encode the BVD symbol index information (here, the BVD symbol index information can be an index value in the candidate BVD list), the number of bits of the symbol index information corresponding to different candidate BVDs is not exactly the same, which is a variable-length code.

[0865] Furthermore, in embodiments of the present application, after determining the absolute value of the BVD of the current block, the absolute value of the BVD can be used to determine a combination list of BVDs, where the combination list of BVDs includes any number of candidate BVDs for the current block. In other words, the absolute value of the BVD can be used to determine the candidate BVDs for the current block, which can also be understood as using the absolute value of the BVD to determine an initial set of candidate BVDs for the current block.

[0866] It should be noted that, in the embodiment of the present application, a combination list of BVDs (candidate BVDs) can be created between the possible symbols of BVDs and the absolute values ​​of BVDs, which may include the cases where only horizontal BVDs exist, only vertical BVDs exist, and both exist.

[0867] Furthermore, in an embodiment of the present application, when creating a combination list of BVDs (candidate BVDs), it mainly includes permuting and combining possible symbols of BVD, and multiplying possible horizontal symbols and vertical symbols by the horizontal absolute value component and vertical absolute value component of BVD respectively.

[0868] Exemplarily, in an embodiment of the present application, if only vertical BVD exists, that is, if absBvdX is equal to 0, then the candidate BVD may be determined according to absBvdY.

[0869] For example, BVD is divided into horizontal and vertical components. When the horizontal component is zero, only the vertical component is encoded, so only the combination list of the vertical component symbols is constructed, specifically for the following two cases:

[0870] The first case: the horizontal components are all positive, which is just a placeholder. The vertical components are first positive and then negative. A symbol list is constructed, and then the constructed symbol list is multiplied by the absolute values ​​of the horizontal and vertical components of BVD to obtain the combined list of BVD.

[0871]

[0872] The second case: the horizontal components are all positive, which is just a placeholder. The vertical components are first negative and then positive. A sign list is constructed, and then the constructed sign list is multiplied by the absolute values ​​of the horizontal and vertical components of BVD to obtain the combined list of BVD.

[0873]

[0874] Exemplarily, in an embodiment of the present application, if only the horizontal BVD exists, that is, if absBvdY is equal to 0, then the candidate BVD may be determined according to absBvdX.

[0875] For example, BVD is divided into horizontal and vertical components. When the vertical component is zero, only the horizontal component is encoded, so only the combination list of the horizontal component symbols is constructed, specifically for the following two cases:

[0876] The first case: the vertical components are all positive, which is just a placeholder. The horizontal components are first positive and then negative. A sign list is constructed, and then the constructed sign list is multiplied by the absolute values ​​of the vertical and horizontal components of BVD to obtain the combined list of BVD.

[0877]

[0878] The second case: the vertical components are all positive, which is just a placeholder. The horizontal components are first negative and then positive. A sign list is constructed, and then the constructed sign list is multiplied by the absolute values ​​of the vertical and horizontal components of BVD to obtain the combined list of BVD.

[0879]

[0880] Illustratively, in an embodiment of the present application, if both the horizontal BVD and the vertical BVD exist, that is, if both absBvdX and absBvdY are not equal to 0, then the candidate BVD may be determined according to absBvdX and absBvdY.

[0881] For example, BVD is divided into horizontal and vertical components. When both components are non-zero, both need to be encoded. Therefore, a BVD list is constructed for both horizontal and vertical components. Specifically, there are 24 cases, namely, any permutation of the four combinations of {+1, +1}, {+1, -1}, {-1, +1}, and {-1, -1}. The following examples illustrate:

[0882] The 0th bit of the list is that both the horizontal and vertical components are positive, the 1st bit of the list is that the horizontal component is positive and the vertical component is negative, the 2nd bit of the list is that the horizontal component is negative and the vertical component is positive, and the 3rd bit of the list is that both the horizontal and vertical components are negative. A sign list is constructed, and then the constructed sign list is multiplied by the absolute values ​​of the vertical and horizontal components of BVD to obtain a combination list of BVD.

[0883]

[0884] Furthermore, in an embodiment of the present application, after determining the absolute value of the BVD of the current block, the candidate BVDs of the current block may be sorted according to the absolute value of the BVD to determine a sorting result.

[0885] Furthermore, in an embodiment of the present application, when sorting the candidate BVDs of the current block according to the absolute value of BVD and determining the sorting result, the first-generation value corresponding to one or more candidate BVDs of the current block can be determined according to the absolute value of BVD; then the candidate BVDs can be sorted according to the first-generation value to determine the sorting result.

[0886] It can be understood that, in an embodiment of the present application, one or more candidate BVDs may include BVDs in which candBvdX is set equal to -absBvdX or absBvdX, and candBvdY is set equal to -absBvdY or absBvdY.

[0887] It should be noted that in an embodiment of the present application, when determining the first generation value corresponding to one or more candidate BVDs of the current block based on the absolute value of the BVD of the current block, the first matching template can be first determined based on the candidate BVD; then, based on a preset error criterion, the matching error between the first template of the current block and the first matching template is calculated to determine the first generation value corresponding to the candidate BVD.

[0888] For example, in an embodiment of the present application, when performing cost calculation, that is, when determining the first-generation value, there are multiple options for the cost function for calculating the cost of the template area, that is, there are multiple options for the preset error criteria. For example, you can choose the sum of absolute deviations (SAD), the sum of transformed absolute deviations (SATD), the sum of squared differences (SSE), the mean absolute difference (MAD), the mean absolute error (MAE), the mean squared error (MSE), the rate-distortion function (RDO), and other evaluation criteria. Any evaluation criterion mentioned in the following content can be selected from the above criteria. Taking the evaluation criterion of SAD as an example, the calculation formula is as follows:

[0889]

[0890] Among them, predTempSizeW is the width of the template, predTempSizeH is the height of the template, predTemp[i][j] is the pixel point of the template at BV, and recTempC[i][j] is the pixel point of the current block template.

[0891] That is to say, in an embodiment of the present application, the preset error criterion may include any one of the sum of absolute error SAD, the sum of transformed absolute error SATD, the sum of squared differences SSE, the mean absolute difference MAD, the mean absolute error MAE, the mean squared error MSE, and the rate-distortion function RDO.

[0892] It can be understood that, in the embodiment of the present application, the first template includes one or more sample values ​​in the adjacent decoded area of ​​the current block.

[0893] For example, in an embodiment of the present application, when selecting a template (the first template of the current block), the availability of pixels at the template position can be determined based on the pixel availability in the neighboring area of ​​the current block, including the reconstruction of brightness information. As shown in Figure 6, based on the relative position relationship between the template and the current block, the template can be classified into template types such as upper template, left template, upper right template, lower left template, and upper left template. The sizes of different types of templates for different coding blocks can be fixed or different.

[0894] For example, the template size may be the same for any current coding block (current block), or different template sizes may be selected according to different sizes of the current coding block, or different template sizes may be selected according to the number of pixels in the current brightness coding block.

[0895] It should be noted that, in an embodiment of the present application, when determining the first matching template based on the candidate BVD, the block vector prediction value BVP of the current block can be determined first; then the candidate BV of the current block is determined based on the BVP and the candidate BVD; wherein the candidate BV is used to indicate the position of the first matching template; then, the first matching template can be determined based on the candidate BV.

[0896] Exemplarily, in an embodiment of the present application, assuming that BVP includes a third component currBvpX and a fourth component currBvpY, then when determining the candidate BV of the current block based on BVP and the candidate BVD, the two-dimensional vector of the candidate BV can be selected to be set to (currBvpX+candBvdX, currBvpY+candBvdY), that is, the two-dimensional vector of BV is determined based on the first component candBvdX and the second component candBvdY of the candidate BVD, and the third component currBvpX and the fourth component currBvpY of BVP.

[0897] Furthermore, in an embodiment of the present application, when determining the first matching template based on the candidate BV, the first matching template may be determined based on the position of the current point and the two-dimensional vector of the candidate BV.

[0898] Exemplarily, in an embodiment of the present application, the position of the current point can be selected as the starting point, and the area indicated by the two-dimensional vector of the candidate BV, which has the same shape and contains the same number of samples as the first template, can be determined as the first matching template.

[0899] When predicting the BV of the current block, the combined list of the BVP and BVD of the current block can be used to generate a new BV. As shown in Figure 8, the current block is used to determine whether the BV is available (the available condition is that the reference block pointed to by the BV has been reconstructed and does not exceed the search range set by the IBC and the image boundary and other conditions). If the current BV is available, the template of the current block and the new BV are used for motion compensation to obtain the template at the corresponding BV. As shown in Figure 9, the horizontal and vertical components of the BVD generate a total of 4 combinations of BVDs, which are used for motion compensation at the template respectively. There are several situations in which the template is used when calculating the cost:

[0900] The first type: the upper template and the left template of the current block both exist, and the upper template and the left template at the corresponding BV both exist. In this case, both the upper template and the left template are available.

[0901] The second method is: Both the upper and left templates of the current block exist, but only the upper template exists at the corresponding BV. In this case, there are two methods: Method 1: If the left template at the corresponding BV does not exist, it is directly ignored, that is, only the upper template is used for calculation. Method 2: If the left template at the corresponding BV does not exist, the leftmost template width column in the reference block is used instead of the left template, that is, the upper and left templates are used for calculation.

[0902] The third method is: both the upper template and the left template of the current block exist, but only the left template exists at the corresponding BV. In this case, there are two methods: Method 1: If the upper template does not exist at the corresponding BV, it is directly not used, that is, only the left template is used for calculation. Method 2: If the upper template does not exist at the corresponding BV, the uppermost template height row inside the reference block is used instead of the upper template, that is, the upper and left templates are used for calculation.

[0903] The fourth scenario: Only the upper template exists in the current block. In this case, there are three methods: Method 1: If the upper template at the corresponding BV does not exist, it is not used. Method 2: If the upper template at the corresponding BV does not exist, the uppermost template height row in the reference block is used instead. Method 3: If the upper template at the corresponding BV exists, it is used directly.

[0904] The fifth method: Only the left template exists in the current block. In this case, there are three methods: Method 1: If the left template at the corresponding BV does not exist, it is not used directly. Method 2: If the left template at the corresponding BV does not exist, the leftmost template width column in the reference block is used instead of the left template. Method 3: If the left template at the corresponding BV exists, it is used directly.

[0905] Type 6: Both the upper template and the left template of the current block do not exist. The BVD combination in this case is ignored.

[0906] In the above six cases, when the reference block pointed to by BV is unavailable, the BVD combination in this case is ignored. When the BVD combination in a certain case is ignored, the cost in this case is set to the maximum value of the cost evaluation criterion.

[0907] Furthermore, in an embodiment of the present application, if both templates are available, the templates are processed, including but not limited to the following method: weighted fusion of the two templates. The weighted fusion criterion may be a fixed weighting coefficient or a weighting coefficient assigned based on the sum of the absolute values ​​of the differences between the reconstructed brightness and the predicted brightness of the respective templates.

[0908] It can be seen that in the embodiments of the present application, template prediction can be performed based on the combination list of BVP and BVD of the current block (candidate BVD), and the cost (first generation value) of each BVD combination (candidate BVD) in the BVD combination list can be calculated, that is, the cost of the template area can be calculated, and the cost of various combinations in the BVD combination list can be calculated using the template, specifically the cost of the reconstructed luminance pixel at the position obtained by template prediction using the reconstructed luminance pixel at the current block template position and the BV obtained by the combination of BVP and BVD of the current block.

[0909] It should be noted that, in the embodiments of the present application, when calculating the cost (first generation value), not only brightness but also chrominance, namely Cb and Cr components, may be used, which is not specifically limited in the present application.

[0910] Furthermore, in embodiments of the present application, after calculating the first generation value of each candidate BVD, the candidate BVDs can be sorted using the first generation value to obtain a sorting result. The sorting result can be a sorted list of candidate BVDs for the current block, or a set of candidate BVDs that has been sorted to determine the candidate BVD with the smallest first generation value. This is not specifically limited in the present application.

[0911] It should be noted that in an embodiment of the present application, if the sorting result is a candidate BVD list of the current block, then correspondingly, the sorting process can be to sort the candidate BVDs according to the first generation value to determine the candidate BVD list of the current block, wherein the candidate BVD list includes at least one candidate BVD.

[0912] Furthermore, in an embodiment of the present application, when sorting the candidate BVDs according to the first-generation value to determine the candidate BVD list of the current block, you can choose to sort one or more candidate BVDs according to a preset error criterion in ascending order of the matching error indicated by the first-generation value to determine the candidate BVD list.

[0913] It is understood that in the embodiment of the present application, the sorting result may be a new list OrderedList (a list of candidate BVDs of the current block) arranged in ascending (descending) order. For example, a sorting method such as bubble sort, selection sort, insertion sort, shell sort, merge sort, quick sort, radix sort, heap sort, counting sort, bucket sort, etc. may be used.

[0914] Furthermore, in an embodiment of the present application, the sorting result may also be a new list OrderedList (a candidate BVD list of the current block) in a specific order.

[0915] Illustratively, in an embodiment of the present application, when sorting the candidate BVDs according to the first generation value to determine the candidate BVD list of the current block, if absBvdX and absBvdY are both not equal to 0, the candidate BVDs are stored in the first array and the second array, respectively; then, based on the first generation value, the first candidate BVD and the second candidate BVD in the first array, as well as the third candidate BVD and the fourth candidate BVD in the second array are determined; finally, the first candidate BVD, the second candidate BVD, the third candidate BVD, and the fourth candidate BVD can be sorted based on the first generation value to determine the candidate BVD list.

[0916] If both the horizontal and vertical components of BVD exist, that is, absBvdX and absBvdY are not equal to 0, it is assumed that the combination list (candidate BVD) is {(+BVD HOR , +BVD VER ), (+BVD HOR , -BVD VER ), (-BVD HOR , -BVD VER ), (-BVD HOR , +BVD VER )}, and its corresponding cost list is {Cost(+BVD HOR , +BVD VER ), Cost(+BVD HOR , -BVD VER ), Cost(-BVD HOR , -BVD VER ), Cost(-BVD HOR , +BVD VER )}. The order of the members in the above two lists can be arranged in any order.

[0917] Define two arrays posiGrp and negaGrp. posiGrp stores two BVD combinations with positive signs on the same component (level), and negaGrp stores two BVD combinations with negative signs on the same component (level).

[0918] Assume posiGrp={(+BVD HOR , +BVD VER ), (+BVD HOR , -BVD VER )}, negaGrp={(-BVD HOR , +BVD VER ), (-BVD HOR , -BVD VER )}. The order of the members in the posiGrp and negaGrp lists can be arranged arbitrarily.

[0919] First comparison: Compare Cost(+BVD HOR , +BVD VER ) and Cost(+BVD HOR , -BVD VER ), set posiGrp[0] to the smaller BVD combination of the two, and set posiGrp[1] to the larger BVD combination of the two;

[0920] Second comparison: Comparison of Cost(-BVD HOR , +BVD VER ) and Cost(-BVD HOR , -BVD VER ), set negaGrp[0] to the smaller BVD combination of the two, and set negaGrp[1] to the larger BVD combination of the two;

[0921] The third comparison: compare the cost corresponding to posiGrp[0] and negaGrp[0].

[0922] It should be noted that in an embodiment of the present application, when sorting the first candidate BVD, the second candidate BVD, the third candidate BVD, and the fourth candidate BVD based on the first generation value to determine the candidate BVD list, one available method is as follows: if the first generation value of the first candidate BVD is less than or equal to the first generation value of the third candidate BVD, the first candidate BVD is set as the first candidate BVD in the candidate BVD list, the third candidate BVD is set as the second candidate BVD in the candidate BVD list, the second candidate BVD is set as the third candidate BVD in the candidate BVD list, and the fourth candidate BVD is set as the fourth candidate BVD in the candidate BVD list. If the first generation value of the first candidate BVD is greater than the first generation value of the third candidate BVD, the third candidate BVD is set as the first candidate BVD in the candidate BVD list, the first candidate BVD is set as the second candidate BVD in the candidate BVD list, the fourth candidate BVD is set as the third candidate BVD in the candidate BVD list, and the second candidate BVD is set as the fourth candidate BVD in the candidate BVD list.

[0923] Correspondingly, the final sorting process can be: if in the third comparison, the Cost corresponding to posiGrp[0] is less than or equal to the Cost corresponding to negaGrp[0], posiGrp[0] is sorted at the 0th position of the candidate BVD list OrderedList, negaGrp[0] is sorted at the 1st position of the candidate BVD list OrderedList, posiGrp[1] is sorted at the 2nd position of the candidate BVD list OrderedList, and negaGrp[1] is sorted at the 3rd position of the candidate BVD list OrderedList.

[0924] If in the third comparison, the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0], sort negaGrp[0] at the 0th position in the candidate BVD list OrderedList, sort posiGrp[0] at the 1st position in the candidate BVD list OrderedList, sort negaGrp[1] at the 2nd position in the candidate BVD list OrderedList, and sort posiGrp[1] at the 3rd position in the candidate BVD list OrderedList.

[0925] Among them, the candidate BVD at position 0 in the candidate BVD list of the current block is the first candidate BVD in the candidate BVD list, the candidate BVD at position 1 is the second candidate BVD in the candidate BVD list, the candidate BVD at position 2 is the third candidate BVD in the candidate BVD list, and the candidate BVD at position 3 is the fourth candidate BVD in the candidate BVD list.

[0926] It should be noted that in an embodiment of the present application, when sorting the first candidate BVD, the second candidate BVD, the third candidate BVD, and the fourth candidate BVD based on the first generation value to determine the candidate BVD list, another available method is as follows: if the first generation value of the first candidate BVD is less than or equal to the first generation value of the third candidate BVD, the first candidate BVD is set as the first candidate BVD in the candidate BVD list, the second candidate BVD is set as the second candidate BVD in the candidate BVD list, the third candidate BVD is set as the third candidate BVD in the candidate BVD list, and the fourth candidate BVD is set as the fourth candidate BVD in the candidate BVD list. If the first generation value of the first candidate BVD is greater than the first generation value of the third candidate BVD, the third candidate BVD is set as the first candidate BVD in the candidate BVD list, the fourth candidate BVD is set as the second candidate BVD in the candidate BVD list, the first candidate BVD is set as the third candidate BVD in the candidate BVD list, and the second candidate BVD is set as the fourth candidate BVD in the candidate BVD list.

[0927] Correspondingly, the final sorting process can be: if in the third comparison, the Cost corresponding to posiGrp[0] is less than or equal to the Cost corresponding to negaGrp[0], posiGrp[0] is sorted at the 0th position in the candidate BVD list OrderedList, negaGrp[0] is sorted at the 2nd position in the candidate BVD list OrderedList, posiGrp[1] is sorted at the 1st position in the candidate BVD list OrderedList, and negaGrp[1] is sorted at the 3rd position in the candidate BVD list OrderedList.

[0928] If in the third comparison, the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0], sort negaGrp[0] at the 0th position in the candidate BVD list OrderedList, sort posiGrp[0] at the 2nd position in the candidate BVD list OrderedList, sort negaGrp[1] at the 1st position in the candidate BVD list OrderedList, and sort posiGrp[1] at the 3rd position in the candidate BVD list OrderedList.

[0929] Illustratively, in an embodiment of the present application, when sorting the candidate BVDs according to the first generation value to determine the candidate BVD list of the current block, if absBvdX is equal to 0 or absBvdY is equal to 0, the candidate BVD with the smallest first generation value among the candidate BVDs is set as the first candidate BVD in the candidate BVD list, and another candidate BVD among the candidate BVDs is set as the second candidate BVD in the candidate BVD list.

[0930] If only the horizontal component or the vertical component of the BVD exists, that is, absBvdX or absBvdY is equal to 0, then the two candidate BVDs can be directly sorted according to the size of the first generation value to generate a candidate BVD list.

[0931] For the case where only the BVD vertical component exists, assume that the combination list is {(0, +BVD VER ),(0,-BVD VER )}, and its corresponding cost list is {Cost(0, +BVD VER ), Cost(0, -BVD VER )}. The order of the members in the above two lists can be arranged in any order.

[0932] The sorting process is: compare Cost(0, +BVD VER ) and Cost(0, -BVD VER) size:

[0933] If Cost(0, +BVD VER )<=Cost(0, -BVD VER ), then (0, +BVD VER ) is sorted in the 0th position of the candidate BVD list OrderedList, and (0, -BVD VER ) is sorted at the first position in the candidate BVD list OrderedList;

[0934] If Cost(0, +BVD VER )>Cost(0,-BVD VER ), then (0, -BVD VER ) is sorted in the 0th position of the candidate BVD list OrderedList, and (0, +BVD VER ) is sorted at the first position in the candidate BVD list OrderedList.

[0935] For the case where only the BVD horizontal component exists, assume that the combination list is {(+BVD HOR ,0),(-BVD HOR ,0)}, and its corresponding cost list is {Cost(+BVD HOR ,0),Cost(-BVD HOR ,0)}. The order of the members in the above two lists can be arranged in any order.

[0936] The sorting process is: compare Cost(+BVD HOR ,0) and Cost(-BVD HOR ,0)’s size:

[0937] If Cost(+BVD HOR ,0)<=Cost(-BVD HOR ,0), then (+BVD HOR ,0) is sorted in the 0th position of the candidate BVD list OrderedList, and (-BVD HOR ,0) is ranked first in the candidate BVD list OrderedList;

[0938] If Cost(+BVD HOR ,0)>Cost(-BVD HOR ,0), then (-BVD HOR ,0) is sorted in the 0th position of the candidate BVD list OrderedList, and (+BVD HOR , 0) is ranked first in the candidate BVD list OrderedList.

[0939] It should be noted that in an embodiment of the present application, if the sorting result is a candidate BVD set of the current block, then correspondingly, the sorting process can be to sort the candidate BVDs according to the first generation value to determine the candidate BVD set of the current block, wherein the candidate BVD set includes at least one candidate BVD.

[0940] Furthermore, when sorting the candidate BVDs according to the first-generation value and determining the candidate BVD set of the current block, if absBvdX and absBvdY are both not equal to 0, the candidate BVDs are stored in the first array and the second array respectively; then the fifth candidate BVD with the smallest first-generation value in the first array and the sixth candidate BVD with the smallest first-generation value in the second array are determined; finally, the candidate BVD with the smallest first-generation value among the fifth candidate BVD and the sixth candidate BVD can be determined as the BVD with the smallest cost in the candidate BVD set.

[0941] If both the horizontal and vertical components of BVD exist, that is, both absBvdX and absBvdY are non-zero, then the combination list is {(+, +), (+, -), (-, -), (-, +)}, and the corresponding cost list is {Cost (+, +), Cost (+, -), Cost (-, -), Cost (-, +)}. The order of the members in the two lists can be arbitrary.

[0942] Define two arrays posiGrp and negaGrp. posiGrp stores the sign combination of two BVDs with positive signs on the same component (level), and negaGrp stores the sign combination of two BVDs with negative signs on the same component (level).

[0943] Assume that posiGrp = {(+, +), (+, -)}, negaGrp = {(-, +), (-, -)}. The order of the members in the two lists posiGrp and negaGrp can be arranged arbitrarily.

[0944] First comparison: Compare the sizes of Cost(+,+) and Cost(+,-), set posiGrp[0] to the smaller BVD sign combination of the two, and set posiGrp[1] to the larger BVD sign combination of the two;

[0945] Second comparison: compare the size of Cost(-, +) and Cost(-, -), set negaGrp[0] to the sign combination of the smaller BVD of the two, and set negaGrp[1] to the sign combination of the larger BVD of the two;

[0946] The third comparison: compare the cost corresponding to posiGrp[0] and negaGrp[0].

[0947] Then, a symbol combination of a BVD with the minimum cost can be determined, that is, the BVD with the minimum cost in the candidate BVD set can be determined.

[0948] If only the horizontal component or the vertical component of the BVD exists, that is, absBvdX or absBvdY is equal to 0, then the two candidate BVDs can be directly sorted according to the size of the first generation value to determine the BVD with the minimum cost in the candidate BVD set.

[0949] For example, in an embodiment of the present application, when sorting the candidate BVDs according to the first-generation value to determine the candidate BVD set of the current block, if absBvdX is equal to 0 or absBvdY is equal to 0, then the candidate BVD with the smallest first-generation value among the candidate BVDs can be determined as the BVD with the smallest cost in the candidate BVD set.

[0950] For the case where only the vertical component of a BVD exists, assume the combination list is {(+, +), (+, -)}, and the corresponding cost list is {Cost(+, +), Cost(+, -)}. The order of the members in these two lists can be arbitrarily arranged. The comparison process is to compare Cost(+, +) and Cost(+, -) to determine the sign combination of the BVD with the minimum cost, that is, to determine the minimum cost BVD in the candidate BVD set.

[0951] For the case where only the horizontal component of a BVD exists, assume the combination list is {(+, +), (-, +)}, and the corresponding cost list is {Cost(+, +), Cost(-, +)}. The order of the members in the two lists can be arbitrarily arranged. The comparison process is to compare the size of Cost(+, +) and Cost(-, +), and then determine the sign combination of the BVD with the minimum cost, that is, determine the minimum cost BVD in the candidate BVD set.

[0952] Step 302: Determine the BVD symbol index information of the current block according to the BVD symbol information of the current block and the sorting result.

[0953] In an embodiment of the present application, after sorting the candidate BVDs of the current block according to the absolute value of the BVD of the current block and determining the sorting result, the BVD symbol index information of the current block can be further determined based on the BVD symbol information of the current block and the sorting result.

[0954] It should be noted that in an embodiment of the present application, if the candidate BVD list of the current block obtained by the sorting process is an ascending (descending) list, then you can choose to use the conversion list to indirectly obtain the BVD symbol index information (symbol prediction index), or you can directly use logical reasoning to obtain the BVD symbol index information.

[0955] When the conversion list is used to indirectly obtain the BVD symbol index information, the BVD combination list OrderedList may be converted into the index conversion list TransformedList according to the conversion rule.

[0956] Illustratively, in an embodiment of the present application, the candidate BVD list may be transformed to determine an index transformed list (TransformedList).

[0957] Furthermore, in an embodiment of the present application, when determining the BVD symbol index information of the current block based on the BVD symbol information and sorting result of the current block, when absBvdX and absBvdY are both not 0, if the first component symbol of the BVD symbol information of the current block is the same as the first component symbol of the first candidate BVD in the index conversion list, the first bit of the BVD symbol index information is determined to be 0; otherwise, the first bit is determined to be 1.

[0958] Further, in an embodiment of the present application, when the first bit is determined to be 0, if the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the first candidate BVD in the index conversion list, the second bit of the BVD symbol index information is determined to be 0; otherwise, the second bit is determined to be 1.

[0959] Further, in an embodiment of the present application, when the first bit is determined to be 1, if the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the candidate BVD with an index of 1 in the index conversion list, the second bit of the BVD symbol index information is determined to be 0; otherwise, the second bit is determined to be 1.

[0960] That is, in the embodiment of the present application, when both the horizontal component and the vertical component of the BVD exist, the symbol prediction index of the BVD is two bits.

[0961] Assume that the sorted BVD combination list OrderedList is:

[0962] Table 78. OrderedList of sorted BVD combinations where both horizontal and vertical BVDs exist

[0963] Index horizontal component vertical component 0a1a21b1b22c1c23d1d2

[0964] Use the following conversion rules to convert the sorted BVD combination list OrderedList into TransformedList (index transformation list):

[0965] Place the BVD combination with the smallest cost after sorting at the 0th position of the TransformedList list, that is, place (a1, a2) at the 0th position of the TransformedList list. Place the BVD combination with the same sign as a1 at the 2nd position of the TransformedList list, that is, assuming b1 has the same sign as it, place (b1, b2) at the 2nd position of the TransformedList list. Place the BVD combination with a smaller cost but a different sign from a1 at the 1st position of the TransformedList list, that is, place (c1, c2) at the 1st position of the TransformedList list. Place the BVD combination with a larger cost but a different sign from a1 at the 3rd position of the TransformedList list, that is, place (d1, d2) at the 3rd position of the TransformedList list.

[0966] Then the index transformation list TransformedList is:

[0967] Table 79. Index transformation list TransformedList exists for both horizontal and vertical BVD

[0968] Index Horizontal Component Vertical Component 0a1a21c1(-a1)c22b1(a1)b23d1(-a1)d2

[0969] For the index conversion list, the symbol prediction index is obtained according to the following rules. In this case, the symbol prediction index is equal to the index of the leftmost column in the table:

[0970] Assume that the horizontal component of the true BVD is e1 and the vertical component is e2.

[0971] For candidate BVD at index 0:

[0972] If the horizontal component a1 == e1 is satisfied, the 0th bit is 0, and then its vertical component is checked. If the vertical component a2 == e2 is satisfied, the 1st bit is 0, otherwise the 1st bit is 1.

[0973] If the horizontal component a1 == e1 is not satisfied, the 0th bit is 1, and then the vertical component of the candidate BVD of index 1 is checked. If the vertical component c2 == e2 is satisfied, the 1st bit is 0, otherwise the 1st bit is 1.

[0974] The symbol prediction index is represented as follows:

[0975] bvsdIdx=bit0+bit1<<1

[0976] For example: Assume that the sorted BVD combination list OrderedList is:

[0977] Table 80. OrderedList instance of sorted BVD combination list with both horizontal and vertical BVDs

[0978] Index horizontal component vertical component 0-BVD HOR +BVD VER 1-BVD HOR -BVD VER

[0979] 2+BVD HOR +BVD VER 3+BVD HOR -BVD VER

[0980] Then convert the sorted BVD combination list OrderedList into TransformedList according to the above conversion rules:

[0981] Table 81. Index transformation list TransformedList instance with both horizontal and vertical BVD

[0982] Index horizontal component vertical component 0-BVD HOR +BVD VER 1+BVD HOR +BVD VER 2-BVD HOR -BVD VER 3+BVD HOR -BVD VER

[0983] (1) Assume that the horizontal component of the true BVD is -BVD HOR , the vertical component is +BVD VER ,but:

[0984] bvsdIdx=0

[0985] (2) Assume that the horizontal component of the true BVD is -BVD HOR , the vertical component is -BVD VER ,but:

[0986] bvsdIdx=2

[0987] (3) Assume that the horizontal component of the true BVD is +BVD HOR , the vertical component is +BVDVER ,but:

[0988] bvsdIdx=1

[0989] (4) Assume that the horizontal component of the true BVD is +BVD HOR , the vertical component is -BVD VER ,but:

[0990] bvsdIdx=3

[0991] Furthermore, in an embodiment of the present application, when determining the BVD symbol index information of the current block based on the BVD symbol information and sorting result of the current block, when absBvdX is 0, if the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the first candidate BVD in the index conversion list, the BVD symbol index information is determined to be 0; otherwise, the BVD symbol index information is determined to be 1.

[0992] That is, if only the BVD vertical component exists, the BVD symbol prediction index is one bit:

[0993] Assume that the sorted BVD combination list OrderedList is:

[0994] Table 82. OrderedList of sorted BVD combinations where only vertical BVDs exist

[0995] Index horizontal component vertical component 00a210b2 (-a2)

[0996] Then the index transformation list TransformedList is the same as the sorted BVD combination list OrderedList.

[0997] The index transformation list TransformedList is:

[0998] Table 6. TransformedList of indexes where only vertical BVD exists

[0999] Index horizontal component vertical component 00a210b2 (-a2)

[1000] For the index conversion list, the symbol prediction index is obtained according to the following rules. In this case, the symbol prediction index is equal to the index of the leftmost column in the table:

[1001] Assume that the horizontal component of the true BVD is 0 and the vertical component is e2.

[1002] If a2 == e2, the 0th bit is 0; otherwise, the 0th bit is 1.

[1003] The symbol prediction index is represented as follows:

[1004] bvsdIdx=bit0

[1005] For example: Assume that the sorted BVD combination list OrderedList is:

[1006] Table 83. OrderedList instance of sorted BVD combination list where only vertical BVD exists

[1007] Index horizontal component vertical component 00+BVD VER 10-BVD VER

[1008] The index transformation list TransformedList is:

[1009] Table 8. TransformedList instance with indexes where only vertical BVD exists

[1010] Index horizontal component vertical component 00+BVD VER 10-BVD VER

[1011] (1) Assume that the horizontal component of the true BVD is 0 and the vertical component is +BVD VER ,but:

[1012] bvsdIdx=0

[1013] (2) Assume that the horizontal component of the true BVD is 0 and the vertical component is -BVD VER ,but:

[1014] bvsdIdx=1

[1015] Furthermore, in an embodiment of the present application, when determining the BVD symbol index information of the current block based on the BVD symbol information and sorting result of the current block, when absBvdY is 0, if the first component symbol of the BVD symbol information of the current block is the same as the first component symbol of the first candidate BVD in the index conversion list, the BVD symbol index information is determined to be 0; otherwise, the BVD symbol index information is determined to be 1.

[1016] That is, if only the BVD horizontal component exists, the symbol prediction index of BVD is one bit:

[1017] Assume that the sorted BVD combination list OrderedList is:

[1018] Table 84. OrderedList of sorted BVD combinations where only horizontal BVDs exist

[1019] Index horizontal component vertical component 0a101b1(-a1)0

[1020] Then the index transformation list TransformedList is the same as the sorted BVD combination list OrderedList.

[1021] The index transformation list TransformedList is:

[1022] Table 85. TransformedList of indexes that only exist for horizontal BVD

[1023] Index horizontal component vertical component 0a101b1(-a1)0

[1024] For the index conversion list, the symbol prediction index is obtained according to the following conversion rules. In this case, the symbol prediction index is equal to the index of the leftmost column in the table:

[1025] Assume that the horizontal component of the true BVD is e1 and the vertical component is 0.

[1026] If a1 == e1, the 0th bit is 0, otherwise, the 0th bit is 1.

[1027] The symbol prediction index is represented as follows:

[1028] bvsdIdx=bit0

[1029] For example: Assume that the sorted BVD combination list OrderedList is:

[1030] Table 86. OrderedList instance of sorted BVD combination list where only horizontal BVD exists

[1031] Index horizontal component vertical component 0+BVD HOR 01-BVD HOR 0

[1032] The index transformation list TransformedList is:

[1033] Table 87. TransformedList instance where only horizontal BVD exists

[1034] Index horizontal component vertical component 0+BVD HOR 01-BVD HOR 0

[1035] (1) Assume that the horizontal component of the true BVD is +BVD HOR , the vertical component is 0, then:

[1036] bvsdIdx=0

[1037] (2) Assume that the horizontal component of the true BVD is -BVD HOR , the vertical component is 0, then:

[1038] bvsdIdx=1

[1039] Furthermore, when directly using logical reasoning to obtain the BVD symbol index information, if both the horizontal component and the vertical component of the BVD exist, then when determining the BVD symbol index information of the current block based on the BVD symbol information and the sorting result of the current block, when absBvdX and absBvdY are both not 0, if the first component symbol of the BVD symbol information of the current block is the same as the first component symbol of the first candidate BVD in the candidate BVD list, then the first bit of the BVD symbol index information is determined to be 0; otherwise, the first bit is determined to be 1; the candidate BVD list is traversed to determine the first candidate BVD with the same first component symbol as the BVD symbol information of the current block; if the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the first candidate BVD, then the second bit of the BVD symbol index information is determined to be 0; otherwise, the second bit is determined to be 1.

[1040] It can be seen that in the first case, both the horizontal component and the vertical component of BVD exist. In this case, the symbol prediction index of BVD is two bits:

[1041] Assume that the sorted BVD combination list OrderedList is:

[1042] Table 88. OrderedList of sorted BVD combinations where both horizontal and vertical BVDs exist

[1043] Index horizontal component vertical component 0a1a21b1b22c1c23d1d2

[1044] Assume that the horizontal component of the true BVD is e1 and the vertical component is e2.

[1045] For the candidate BVD with index 0, if the horizontal component a1 == e1 is satisfied, the 0th bit is 0, otherwise, the 0th bit is 1. Then, starting from index 0, the sorted list is traversed. When a BVD with the same horizontal component as the real BVD first appears in the list, its vertical component is checked. Assuming its vertical component is f2, if f2 == e2 is satisfied, the first bit is 0, otherwise the first bit is 1. The symbol prediction index is represented as follows:

[1046] bvsdIdx=bit0+bit1<<1

[1047] Bit0 is the 0th bit, and bit1 is the 1st bit.

[1048] For example: Assume that the sorted BVD combination list OrderedList is:

[1049] Table 89. OrderedList instance of sorted BVD combination list with both horizontal and vertical BVDs

[1050] Index horizontal component vertical component 0-BVD HOR +BVD VER 1-BVD HOR -BVD VER 2+BVD HOR +BVD VER 3+BVD HOR -BVD VER

[1051] (1) Assume that the horizontal component of the true BVD is -BVD HOR , the vertical component is +BVD VER .

[1052] Then the 0th bit is 0 and the 1st bit is 0. The symbol prediction index is expressed as follows:

[1053] bvsdIdx=bit0+bit1<<1=0

[1054] (2) Assume that the horizontal component of the true BVD is -BVD HOR , the vertical component is -BVD VER .

[1055] Then the 0th bit is 0 and the 1st bit is 1. The symbol prediction index is expressed as follows:

[1056] bvsdIdx=bit0+bit1<<1=2

[1057] (3) Assume that the horizontal component of the true BVD is +BVD HOR , the vertical component is +BVD VER .

[1058] Then the 0th bit is 1 and the 1st bit is 0. The symbol prediction index is expressed as follows:

[1059] bvsdIdx=bit0+bit1<<1=1

[1060] (4) Assume that the horizontal component of the true BVD is +BVD HOR , the vertical component is -BVD VER .

[1061] Then the 0th bit is 1 and the 1st bit is 1. The symbol prediction index is expressed as follows:

[1062] bvsdIdx=bit0+bit1<<1=3

[1063] Furthermore, when directly using logical reasoning to obtain the BVD symbol index information, if only the BVD vertical component exists, then when determining the BVD symbol index information of the current block based on the BVD symbol information and sorting result of the current block, when absBvdX is 0, if the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the first candidate BVD in the candidate BVD list, the BVD symbol index information is determined to be 0, otherwise the BVD symbol index information is determined to be 1.

[1064] It can be seen that in the second case, only the vertical component of BVD exists, and the symbol prediction index of BVD is one bit:

[1065] Assume that the sorted BVD combination list OrderedList is:

[1066] Table 90 OrderedList of sorted BVD combinations where only vertical BVD exists

[1067] Index horizontal component vertical component 00a210b2 (-a2)

[1068] Assume that the horizontal component of the true BVD is 0 and the vertical component is e2.

[1069] If a2 == e2, the 0th bit is 0; otherwise, the 0th bit is 1.

[1070] The symbol prediction index is represented as follows:

[1071] bvsdIdx=bit0

[1072] For example: Assume that the sorted BVD combination list OrderedList is:

[1073] Table 91. OrderedList instance of sorted BVD combination list where only vertical BVD exists

[1074] Index horizontal component vertical component 00+BVD VER 10-BVD VER

[1075] (1) Assume that the horizontal component of the true BVD is 0 and the vertical component is +BVD VER .

[1076] The 0th bit is 0. The symbol prediction index is represented as follows:

[1077] bvsdIdx=bit0=0

[1078] (2) Assume that the horizontal component of the true BVD is 0 and the vertical component is -BVD VER .

[1079] The 0th bit is 1. The symbol prediction index is represented as follows:

[1080] bvsdIdx=bit0=1

[1081] Furthermore, when directly using logical reasoning to obtain the BVD symbol index information, if only the BVD horizontal component exists, then when determining the BVD symbol index information of the current block based on the BVD symbol information and sorting result of the current block, when absBvdY is 0, if the first component symbol of the BVD symbol information of the current block is the same as the first component symbol of the first candidate BVD in the candidate BVD list, the BVD symbol index information is determined to be 0, otherwise the BVD symbol index information is determined to be 1.

[1082] It can be seen that in the third case, only the horizontal component of BVD exists, and the symbol prediction index of BVD is one bit:

[1083] Assume that the sorted BVD combination list OrderedList is:

[1084] Table 92. OrderedList of sorted BVD combinations where only horizontal BVDs exist

[1085] Index horizontal component vertical component 0a101b1(-a1)0

[1086] Assume that the horizontal component of the true BVD is e1 and the vertical component is 0.

[1087] If a1 == e1, the 0th bit is 0, otherwise, the 0th bit is 1.

[1088] The symbol prediction index is represented as follows:

[1089] bvsdIdx=bit0

[1090] For example:

[1091] Assume that the sorted BVD combination list OrderedList is:

[1092] Table 93. OrderedList instance of sorted BVD combination list where only horizontal BVD exists

[1093] Index horizontal component vertical component 0+BVD HOR 01-BVD HOR 0

[1094] (1) Assume that the horizontal component of the true BVD is +BVD HOR , the vertical component is 0.

[1095] The 0th bit is 0. The symbol prediction index is represented as follows:

[1096] bvsdIdx=bit0=0

[1097] (2) Assume that the horizontal component of the true BVD is -BVD HOR , the vertical component is 0.

[1098] The 0th bit is 1. The symbol prediction index is represented as follows:

[1099] bvsdIdx=bit0=1

[1100] It should be noted that, in an embodiment of the present application, if the candidate BVD list of the current block obtained by the sorting process is a list in a specific order, then the list index of the candidate BVD that corresponds to the symbols of the horizontal and vertical components of the actual BVD can be directly determined as the BVD symbol index information (symbol prediction index) of the BVD. The sorted BVD combination list OrderedList can be directly assigned to TransformedList, that is, the candidate BVD list OrderedList and the index transformation list TransformedList are the same.

[1101] It can be understood that in an embodiment of the present application, if the candidate BVD list of the current block obtained by the sorting process is a list in a specific order, then at the encoding end, the two components corresponding to the BVD can be directly encoded at the same time, and correspondingly, at the decoding end, the two components corresponding to the BVD can be directly determined together through the BVD symbol index information.

[1102] That is to say, in the embodiment of the present application, the BVD symbol index information obtained by decoding can be directly used to determine the candidate BVD indicated by the BVD symbol index information from the candidate BVD list.

[1103] Accordingly, in an embodiment of the present application, for a solution in which the decoding end parses the combined index (BVD symbol index information) to simultaneously derive the horizontal and vertical components, at the encoding end, the encoder may use a traversal method to determine the transmitted index (BVD symbol index information).

[1104] It can be understood that in the embodiments of the present application, for the candidate BVD list determined by sorting in ascending order according to the matching error indicated by the first-generation value, that is, when the candidate BVD list of the current block is an ascending (descending) list, the BVD symbol index information can also be set directly according to the index value of the candidate BVD in the list that is the same as the BVD symbol information of the current block.

[1105] Exemplarily, in an embodiment of the present application, when determining the BVD symbol index information of the current block based on the BVD symbol information and sorting result of the current block, a candidate BVD with the same BVD symbol information as the current block can be determined in the candidate BVD list; then the BVD symbol index information is set according to the index value of the candidate BVD.

[1106] In the first case, both the horizontal and vertical components of BVD exist. In this case, the symbol prediction index of BVD is two bits:

[1107] Assume that the sorted BVD combination list OrderedList is:

[1108] Table 94. OrderedList of sorted BVD combinations where both horizontal and vertical BVDs exist

[1109] Index Horizontal Component Vertical Component 0a1a21b1(-a1)b22c1(a1)c23d1(-a1)d2

[1110] Then the index transformation list TransformedList is:

[1111] Table 95. Index transformation list TransformedList that exists for both horizontal and vertical BVD

[1112] Index Horizontal Component Vertical Component 0a1a21b1(-a1)b22c1(a1)c23d1(-a1)d2

[1113] For the index conversion list, the symbol prediction index is obtained according to the following rules. In this case, the symbol prediction index is equal to the index of the leftmost column in the table:

[1114] Assume that the horizontal component of the true BVD is e1 and the vertical component is e2.

[1115] For candidate BVD at index 0:

[1116] If the horizontal component a1 == e1 is satisfied, the 0th bit is 0, and then its vertical component is checked. If the vertical component a2 == e2 is satisfied, the 1st bit is 0, otherwise the 1st bit is 1.

[1117] If the horizontal component a1 == e1 is not satisfied, the 0th bit is 1, and then the vertical component of the candidate BVD of index 1 is checked. If the vertical component c2 == e2 is satisfied, the 1st bit is 0, otherwise the 1st bit is 1.

[1118] The symbol prediction index is represented as follows:

[1119] bvsdIdx=bit0+bit1<<1

[1120] For example: Assume that the sorted BVD combination list OrderedList is:

[1121] Table 96. OrderedList instance of sorted BVD combination list with both horizontal and vertical BVDs

[1122] Index horizontal component vertical component 0-BVD HOR +BVD VER 1+BVD HOR +BVD VER 2-BVD HOR -BVD HOR 3+BVD HOR -BVD VER

[1123] Then TransformedList is:

[1124] Table 97. Index transformation list TransformedList instance with both horizontal and vertical BVD

[1125] Index horizontal component vertical component 0-BVD HOR +BVD VER 1+BVD HOR +BVD VER 2-BVD HOR -BVD HOR 3+BVD HOR -BVD VER

[1126] (1) Assume that the horizontal component of the true BVD is -BVD HOR , the vertical component is +BVD VER ,but:

[1127] bvsdIdx=0

[1128] (2) Assume that the horizontal component of the true BVD is -BVD HOR , the vertical component is -BVD VER ,but:

[1129] bvsdIdx=2

[1130] (3) Assume that the horizontal component of the true BVD is +BVD HOR , the vertical component is +BVD VER ,but:

[1131] bvsdIdx=1

[1132] (4) Assume that the horizontal component of the true BVD is +BVD HOR , the vertical component is -BVD VER ,but:

[1133] bvsdIdx=3

[1134] In the second case, only the BVD vertical component exists. In this case, the BVD symbol prediction index is one bit:

[1135] Assume that the sorted BVD combination list OrderedList is:

[1136] Table 98. OrderedList of sorted BVD combinations where only vertical BVDs exist

[1137] Index horizontal component vertical component 00a210b2 (-a2)

[1138] Then the index transformation list TransformedList is:

[1139] Table 99. Index TransformedList where only vertical BVD exists

[1140] Index horizontal component vertical component

[1141] 00a210b2(-a2)

[1142] For the index conversion list, the symbol prediction index is obtained according to the following rules. In this case, the symbol prediction index is equal to the index of the leftmost column in the table:

[1143] Assume that the horizontal component of the true BVD is 0 and the vertical component is e2.

[1144] If a2 == e2, the 0th bit is 0; otherwise, the 0th bit is 1.

[1145] The symbol prediction index is represented as follows:

[1146] bvsdIdx=bit0

[1147] For example: Assume that the sorted BVD combination list OrderedList is:

[1148] Table 100. OrderedList instance of sorted BVD combination list where only vertical BVD exists

[1149] Index horizontal component vertical component 00+BVD VER 10-BVD VER

[1150] TransformedList is:

[1151] Table 101. TransformedList instance with indexes only present for vertical BVDs

[1152] Index horizontal component vertical component 00+BVD VER 10-BVD VER

[1153] (1) Assume that the horizontal component of the true BVD is 0 and the vertical component is +BVD VER ,but:

[1154] bvsdIdx=0

[1155] (2) Assume that the horizontal component of the true BVD is 0 and the vertical component is -BVD VER ,but:

[1156] bvsdIdx=1

[1157] In the third case, only the BVD horizontal component exists. In this case, the BVD symbol prediction index is one bit:

[1158] Assume that the sorted BVD combination list OrderedList is:

[1159] Table 102. OrderedList of sorted BVD combinations where only horizontal BVDs exist

[1160] Index horizontal component vertical component 0a101b1(-a1)0

[1161] Then the index transformation list TransformedList is:

[1162] Table 103. TransformedList of indexes that only exist for horizontal BVD

[1163] Index horizontal component vertical component 0a101b1(-a1)0

[1164] For the index conversion list, the symbol prediction index is obtained according to the following rules. In this case, the symbol prediction index is equal to the index of the leftmost column in the table:

[1165] Assume that the horizontal component of the true BVD is e1 and the vertical component is 0.

[1166] If a1 == e1, the 0th bit is 0, otherwise, the 0th bit is 1.

[1167] The symbol prediction index is represented as follows:

[1168] bvsdIdx=bit0

[1169] For example: Assume that the sorted BVD combination list OrderedList is:

[1170] Table 104. OrderedList instance of sorted BVD combination list where only horizontal BVD exists

[1171] Index horizontal component vertical component 0+BVD HOR 01-BVD HOR 0

[1172] TransformedList is:

[1173] Table 105. TransformedList instance where only horizontal BVD exists

[1174] Index horizontal component vertical component 0+BVD HOR 01-BVD HOR 0

[1175] (1) Assume that the horizontal component of the true BVD is +BVD HOR , the vertical component is 0, then:

[1176] bvsdIdx=0

[1177] (2) Assume that the horizontal component of the true BVD is -BVD HOR , the vertical component is 0, then:

[1178] bvsdIdx=1

[1179] It should be noted that in the embodiment of the present application, if the sorting result after the sorting process is the candidate BVD set of the current block, then after the sorting, the candidate BVD with the lowest template matching cost is determined, that is, the lowest cost BVD in the candidate BVD set is determined. At this time, if the value of bvsdIdx is bit0+bit1<<1, that is, bit0 represents the horizontal component symbol and bit1 represents the vertical component symbol, then the minimum BVD symbol combination (minimum cost BVD) determines the symbol of bit0 and bit1 when the value is equal to 0, and the opposite symbol when the value is equal to 1.

[1180] Furthermore, in an embodiment of the present application, when determining the BVD symbol index information of the current block based on the BVD symbol information and sorting result of the current block, when absBvdX and absBvdY are both not 0, if the first component symbol of the BVD symbol information of the current block is the same as the first component symbol of the minimum cost BVD in the candidate BVD set, then the first bit of the BVD symbol index information is determined to be 0; then the second bit of the BVD symbol index information of the current block can be determined according to the minimum cost BVD in the candidate BVD set.

[1181] Furthermore, in an embodiment of the present application, when determining the BVD symbol index information of the current block based on the BVD symbol information and sorting result of the current block, when absBvdX and absBvdY are both not 0, if the first component symbol of the BVD symbol information of the current block is different from the first component symbol of the minimum cost BVD in the candidate BVD set, then the first bit of the BVD symbol index information is determined to be 1; then the second bit of the BVD symbol index information of the current block can be determined according to the minimum cost BVD in another array other than the array where the minimum cost BVD in the candidate BVD set is located.

[1182] It should be noted that, in an embodiment of the present application, when determining the second bit of the BVD symbol index information of the current block according to the BVD with the minimum cost in the candidate BVD set, if the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the BVD with the minimum cost in the candidate BVD set, then the second bit of the BVD symbol index information is determined to be 0; if the second component symbol of the BVD symbol information of the current block is different from the second component symbol of the BVD with the minimum cost in the candidate BVD set, then the second bit of the BVD symbol index information is determined to be 1.

[1183] It should be noted that, in an embodiment of the present application, when determining the second bit of the BVD symbol index information of the current block according to the minimum cost BVD in another array other than the array where the minimum cost BVD in the candidate BVD set is located, if the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the minimum cost BVD in another array, then the second bit of the BVD symbol index information is determined to be 0; if the second component symbol of the BVD symbol information of the current block is different from the second component symbol of the minimum cost BVD in another array, then the second bit of the BVD symbol index information is determined to be 1.

[1184] It should be noted that, in the embodiment of the present application, it is assumed that the signs of the horizontal component and vertical component of the real BVD are bvdSign[0] and bvdSign[1], where a value of 0 indicates positive and a value of 1 indicates negative.

[1185] For example, in an embodiment of the present application, if both horizontal and vertical components of a BVD exist, two possible situations for the BVD with the minimum cost in the candidate BVD set determined after sorting are as follows:

[1186] (1) If in the third comparison, the Cost corresponding to posiGrp[0] <= the Cost corresponding to negaGrp[0]:

[1187] If bvd_sign[0]=0, the 0th bit is 0. Then, it is determined whether bvd_sign[1] is equal to posiGrp[0][1]. If they are equal, the 1st bit is 0, otherwise the 1st bit is 1.

[1188] If bvd_sign[0]=1, the 0th bit is 1. Then, it is determined whether bvd_sign[1] is equal to negaGrp[0][1]. If they are equal, the 1st bit is 0, otherwise the 1st bit is 1.

[1189] (2) If in the third comparison, the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0]:

[1190] If bvd_sign[0]=0, the 0th bit is 1. Then, it is determined whether bvd_sign[1] is equal to posiGrp[0][1]. If they are equal, the 1st bit is 0, otherwise the 1st bit is 1.

[1191] If bvd_sign[0]=1, the 0th bit is 0. Then, it is determined whether bvd_sign[1] is equal to negaGrp[0][1]. If they are equal, the 1st bit is 0, otherwise the 1st bit is 1.

[1192] Furthermore, in an embodiment of the present application, when determining the BVD symbol index information of the current block based on the BVD symbol information and sorting result of the current block, when absBvdX is 0, if the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the BVD with the minimum cost in the candidate BVD set, the value of the BVD symbol index information is determined to be 0; otherwise, the value of the BVD symbol index information is determined to be 1.

[1193] For example, in an embodiment of the present application, if the BVD only has a vertical component, two possible situations for the BVD with the minimum cost in the candidate BVD set determined after sorting are as follows:

[1194] (1) If Cost(+,+)<=Cost(+,-):

[1195] If bvd_sign[1]=0, the 0th bit is 0.

[1196] If bvd_sign[1]=1, the 0th bit is 1.

[1197] (2) If Cost(+, +)>Cost(+, -):

[1198] If bvd_sign[1]=0, the 0th bit is 1.

[1199] If bvd_sign[1]=1, the 0th bit is 0.

[1200] Furthermore, in an embodiment of the present application, when determining the BVD symbol index information of the current block based on the BVD symbol information and sorting result of the current block, when absBvdY is 0, if the first component symbol of the BVD symbol information of the current block is the same as the first component symbol of the BVD with the minimum cost in the candidate BVD set, the value of the BVD symbol index information is determined to be 0; otherwise, the value of the BVD symbol index information is determined to be 1.

[1201] For example, in an embodiment of the present application, if only the horizontal component of the BVD exists, two possible situations for the BVD with the minimum cost in the candidate BVD set determined after sorting are as follows:

[1202] (1) If Cost(+,+)<=Cost(-,+):

[1203] If bvd_sign[0]=0, the 0th bit is 0.

[1204] If bvd_sign[0]=1, the 0th bit is 1.

[1205] (2) If Cost(+, +)>Cost(-, +):

[1206] If bvd_sign[0]=0, the 0th bit is 1.

[1207] If bvd_sign[0]=1, the 0th bit is 0.

[1208] It can be seen that the above method of determining the BVD symbol index information of the current block based on the candidate BVD set can save the steps of establishing a list and obtaining the symbol prediction index. For the case where both the horizontal and vertical components of the BVD exist, the encoding end directly obtains the bit0 and bit1 to be encoded through three comparisons, which is less complex.

[1209] Step 303: Write the BVD absolute value and BVD symbol index information into the code stream.

[1210] In an embodiment of the present application, after the BVD symbol index information of the current block is determined according to the BVD symbol information and the sorting result of the current block, the BVD absolute value and the BVD symbol index information may be written into the bitstream.

[1211] Furthermore, in an embodiment of the present application, context-adaptive binary arithmetic coding (CABAC) can be selected to encode the BVD absolute value and BVD sign index information. Alternatively, a bypass mode can be used to encode the BVD absolute value and BVD sign index information.

[1212] It should be noted that, in the embodiment of the present application, the BVD absolute value and the BVD symbol index information (symbol prediction index) need to be written into the bitstream.

[1213] For example, in the embodiment of the present application, when the symbol prediction index is two bits, it is encoded as 00B when it is 0, 01B when it is 1, 10B when it is 2, and 11B when it is 3. When the symbol prediction index is one bit, it is encoded as 0B when it is 0, and 1B when it is 1.

[1214] Then, CABAC (Context Adaptive Binary Arithmetic Coding) or bypass may be used to encode each bit of the converted binary number, that is, the symbol prediction index of BVD is written into the bitstream.

[1215] For the context model of CABAC used for symbol prediction index, a single probability model or multiple probability models can be used: including but not limited to different probability models distinguished according to the absolute value of the horizontal component or vertical component of BVD, the sum or difference of the horizontal component and vertical component of BVD, etc.

[1216] For example, different probability models are used for the bits of the BVD sign prediction index according to the absolute value of the horizontal component or the vertical component of the BVD:

[1217] (1) Assuming that a threshold for the absolute value classification of the horizontal or vertical component of BVD is set to THR0, and there are two probability models, then when the symbol prediction index is two bits, the 0th bit of this binary number is distinguished according to the size relationship between the absolute value of the horizontal component of BVD and THR0, that is, when the absolute value of the horizontal component of BVD is less than or equal to THR0, the first probability model is used, and when the absolute value of the horizontal component of BVD is greater than THR0, the second probability model is used; then, the first bit of the above binary number is also distinguished according to the size relationship between the absolute value of the vertical component of BVD and THR0, that is, when the absolute value of the vertical component of BVD is less than or equal to THR0, the first probability model is used, and when the absolute value of the vertical component of BVD is greater than THR0, the second probability model is used.

[1218] (2) Assuming that a threshold for the absolute value classification of the horizontal component of BVD is set to THR0, and a threshold for the absolute value classification of the vertical component is set to THR1, there are four probability models in total. Then, when the symbol prediction index is two bits, the 0th bit of this binary number is distinguished according to the size relationship between the absolute value of the horizontal component of BVD and THR0, that is, when the absolute value of the horizontal component of BVD is less than or equal to THR0, the first probability model is used, and when the absolute value of the horizontal component of BVD is greater than THR0, the second probability model is used; then, the 1st bit of the above binary number is also distinguished according to the size relationship between the absolute value of the vertical component of BVD and THR1, that is, when the absolute value of the vertical component of BVD is less than or equal to THR1, the third probability model is used, and when the absolute value of the vertical component of BVD is greater than THR1, the fourth probability model is used.

[1219] In summary, the encoding method proposed in steps 301 to 303 above creates a combination list of BVDs between possible symbols of BVDs and absolute values ​​of BVDs, sorts the combination list using a template, and uses real BVD symbols and the sorted list to obtain symbol prediction indexes for CABAC encoding. This method has higher encoding efficiency than bypass coding, thereby saving the bit rate required for BVD transmission in IBC.

[1220] It should be noted that the encoding method proposed in the embodiment of the present application, on the one hand, can make full use of the similarity between the template and the current coding block to effectively sort the BVD symbol combination list; on the other hand, CABAC can be used for encoding, which has higher coding efficiency than bypass coding.

[1221] Furthermore, in the encoding method proposed in the embodiments of the present application, for an encoder, during encoding processing, the BVD encoding input can be the real information of the BVD absolute value and sign, and the BVD encoding output can be the code stream information of the BVD absolute value and sign (BVD sign index information).

[1222] Among them, Figure 13 is a second schematic diagram of the encoding method in an embodiment of the present application. As shown in Figure 13, the BVD encoding process includes encoding the absolute value of BVD (step 401), determining the candidate BVD of the current block by creating a combination list of BVD between the possible symbols of BVD and the absolute value of BVD (step 402), performing template prediction based on the BVP of the current block and the combination list of BVD, calculating the cost of each BVD combination in the BVD combination list, that is, calculating the cost of the template area for the combination list (first generation value) (step 403), sorting the list and using the real BVD symbol and the sorted list to obtain the symbol prediction index (BVD symbol index information) (step 404) and finally encoding the symbol prediction index (BVD symbol index information) of BVD (step 405).

[1223] It should be noted that, in the embodiments of the present application, when calculating the cost (first generation value), not only brightness but also chrominance, namely Cb and Cr components, may be used, which is not specifically limited in the present application.

[1224] Furthermore, in an embodiment of the present application, when calculating the cost, if both templates can be obtained, the template is processed at this time, including but not limited to the following methods: weighted fusion of the two, wherein the weighted fusion standard can select a fixed weighting coefficient or allocate a weighting coefficient based on the sum of the absolute values ​​of the differences between the pixel values ​​of the reconstructed brightness and the predicted brightness of each template.

[1225] Furthermore, in an embodiment of the present application, for the sorted BVD combination list (candidate BVD list), their respective costs can be stored, and then a reordering can be performed based on these stored costs. The specific process is: if the cost difference between a candidate in the list and the previous candidate is lower than the λ value, for example, |D1-D2|<λ, then the candidate is considered redundant, where D1 and D2 are the costs obtained after the first sorting, and λ is the Lagrangian parameter used in the encoder-side RD criterion.

[1226] For example, the algorithm for calculating the cost is defined as follows:

[1227] (1) Determine the minimum cost difference between a candidate and its previous candidate among all candidates in the list

[1228] If the minimum cost difference is greater than or equal to λ, the list is considered diverse enough and the re-ranking stops.

[1229] If the minimum cost difference is less than λ, the candidate is considered redundant and is moved to another position that is sufficiently diverse compared to its previous candidates.

[1230] (2) The algorithm stops after a finite number of iterations.

[1231] Furthermore, in an embodiment of the present application, for the above embodiment, in adopting a candidate BVD list OrderedList in a specific order and determining a candidate BVD set, a solution of using two arrays to store candidate BVDs separately is proposed, wherein, when both horizontal and vertical components of the BVD exist, the order of the horizontal component and the vertical component can be interchanged.

[1232] For example, in the embodiment of the present application, assuming that the combination list is {(+, +), (+, -), (-, -), (-, +)}, its corresponding cost list is {Cost (+, +), Cost (+, -), Cost (-, -), Cost (-, +)}. The order of the members in the above two lists can be arranged arbitrarily.

[1233] Define two arrays posiGrp and negaGrp. posiGrp stores the sign combination of two BVDs with positive signs on the same component (vertical), and negaGrp stores the sign combination of two BVDs with negative signs on the same component (vertical).

[1234] Assume that posiGrp = {(+, +), (-, +)}, negaGrp = {(+, -), (-, -)}. The order of the members in the two lists posiGrp and negaGrp can be arranged arbitrarily.

[1235] First comparison: Compare the sizes of Cost(+,+) and Cost(-,+), set posiGrp[0] to the smaller BVD combination of the two, and set posiGrp[1] to the larger BVD combination of the two;

[1236] Second comparison: compare the size of Cost(+,-) and Cost(-,-), set negaGrp[0] to the smaller BVD combination of the two, and set negaGrp[1] to the larger BVD combination of the two;

[1237] The third comparison: compare the Cost corresponding to posiGrp[0] and negaGrp[0];

[1238] (1) If in the third comparison, the Cost corresponding to posiGrp[0] <= the Cost corresponding to negaGrp[0]:

[1239] If bvd_sign[1]=0, the 0th bit is 0. Then, it is determined whether bvd_sign[0] is equal to posiGrp[0][0]. If they are equal, the 1st bit is 0, otherwise the 1st bit is 1.

[1240] If bvd_sign[1]=1, the 0th bit is 1. Then, it is determined whether bvd_sign[0] is equal to negaGrp[0][0]. If they are equal, the 1st bit is 0, otherwise the 1st bit is 1.

[1241] (2) If in the third comparison, the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0]:

[1242] If bvd_sign[1]=0, the 0th bit is 1. Then, it is determined whether bvd_sign[0] is equal to posiGrp[0][0]. If they are equal, the 1st bit is 0, otherwise the 1st bit is 1.

[1243] If bvd_sign[1]=1, the 0th bit is 0. Then, it is determined whether bvd_sign[0] is equal to negaGrp[0][0]. If they are equal, the 1st bit is 0, otherwise the 1st bit is 1.

[1244] Furthermore, in the embodiments of the present application, when both horizontal and vertical components of the BVD are present, the order of the horizontal and vertical components can be interchanged, and the order of the horizontal and vertical components can be determined by certain criteria. This includes, but is not limited to, determining the order of the horizontal and vertical components based on criteria such as the absolute values ​​of the horizontal and vertical components of the BVD.

[1245] The embodiment of the present application provides a coding and decoding method. At the decoding end, a bitstream is decoded to determine the absolute value of the BVD and BVD symbol index information of the current block; candidate BVDs of the current block are sorted based on the absolute value of the BVD of the current block to determine the sorting result; the BVD of the current block is determined based on the BVD symbol index information and the sorting result; and a reconstructed value of the current block is determined based on the BVD of the current block. At the encoding end, candidate BVDs of the current block are sorted based on the absolute value of the BVD of the current block to determine the sorting result; the BVD symbol index information of the current block is determined based on the BVD symbol information and the sorting result; and the BVD absolute value and BVD symbol index information are written into the bitstream. It can be seen that in the embodiments of the present application, the candidate BVDs of the current block can be effectively sorted according to the absolute value of the BVD of the current block, so that the sorting result can be used to determine and transmit the BVD symbol index information during encoding, and the sorting result can be used to parse the BVD symbol information of the current block during decoding. At the same time, the CABAC encoding and decoding technology can be used to encode and decode the BVD symbol information, which can effectively save the code rate required for the BVD symbol transmission in the IBC mode, thereby improving the encoding efficiency.

[1246] Based on the above embodiment, in another embodiment of the present application, based on the same inventive concept as the above embodiment, FIG14 is a schematic diagram of the composition structure of an encoder. As shown in FIG14 , the encoder 110 may include: a first determining unit 111, an encoding unit 112, wherein:

[1247] The first determining unit 111 is configured to sort the candidate BVDs of the current block according to the absolute value of the BVD of the current block to determine a sorting result; and determine the BVD symbol index information of the current block according to the BVD symbol information of the current block and the sorting result;

[1248] The encoding unit 112 is configured to write the BVD absolute value and the BVD symbol index information into a bitstream.

[1249] It is understood that in this embodiment, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular system. Furthermore, the various components in this embodiment can be integrated into a single processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The aforementioned integrated units can be implemented in the form of hardware or software functional modules.

[1250] If the integrated unit is implemented as a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, or the portion that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[1251] Therefore, an embodiment of the present application provides a computer-readable storage medium, which is applied to the encoder 110. The computer-readable storage medium stores a computer program, and when the computer program is executed by the first processor, it implements the method described in any one of the aforementioned embodiments.

[1252] Based on the composition of the above-mentioned encoder 110 and the computer-readable storage medium, Figure 15 is a second schematic diagram of the composition structure of the encoder. As shown in Figure 15, the encoder 110 may include: a first memory 113 and a first processor 114, a first communication interface 115 and a first bus system 116. The first memory 113, the first processor 114, and the first communication interface 115 are coupled together through the first bus system 116. It can be understood that the first bus system 116 is used to achieve connection and communication between these components. In addition to the data bus, the first bus system 116 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, various buses are labeled as the first bus system 116 in Figure 10. Among them,

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

[1254] The first memory 113 is used to store a computer program that can be run on the first processor;

[1255] The first processor 114 is configured to, when running the computer program, sort the candidate BVDs of the current block according to the BVD absolute value of the current block to determine a sorting result; determine the BVD symbol index information of the current block according to the BVD symbol information of the current block and the sorting result; and write the BVD absolute value and the BVD symbol index information into a bitstream.

[1256] It is understood that the first memory 113 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The first memory 113 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[1257] The first processor 114 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in the first processor 114. The above-mentioned first processor 114 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The various methods, steps, and logic block diagrams disclosed in the embodiments of this application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the first memory 113 , and the first processor 114 reads the information in the first memory 113 and completes the steps of the above method in combination with its hardware.

[1258] It is to be understood that these embodiments described in the present application can be implemented with hardware, software, firmware, middleware, microcode or its combination.For hardware implementation, processing unit can be implemented in one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processor (Digital Signal Processing, DSP), digital signal processing equipment (DSP Device, DSPD), programmable logic device (Programmable Logic Device, PLD), field programmable gate array (Field-Programmable Gate Array, FPGA), general-purpose processor, controller, microcontroller, microprocessor, other electronic units for performing functions described in the present application or its combination.For software implementation, technology described in the present application can be realized by the module (such as process, function etc.) that performs functions described in the present application. Software code can be stored in memory and executed by processor. Memory can be implemented in processor or outside processor.

[1259] Optionally, as another embodiment, the first processor 114 is further configured to execute the method described in any one of the aforementioned embodiments when running the computer program.

[1260] FIG16 is a schematic diagram of the first structure of a decoder. As shown in FIG16 , the decoder 120 may include: a decoding unit 121 and a second determining unit 122; wherein,

[1261] The decoding unit 121 is configured to decode the code stream;

[1262] The second determining unit 122 is configured to determine the BVD absolute value and BVD symbol index information of the current block;

[1263] According to the BVD absolute value of the current block, the candidate BVDs of the current block are sorted to determine a sorting result; according to the BVD symbol index information and the sorting result, the BVD of the current block is determined; according to the BVD of the current block, a reconstructed value of the current block is determined.

[1264] It is understood that in this embodiment, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular system. Furthermore, the various components in this embodiment can be integrated into a single processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The aforementioned integrated units can be implemented in the form of hardware or software functional modules.

[1265] If the integrated unit is implemented as a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, or the portion that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[1266] Therefore, an embodiment of the present application provides a computer-readable storage medium, which is applied to the decoder 120. The computer-readable storage medium stores a computer program, and when the computer program is executed by the first processor, it implements the method described in any one of the aforementioned embodiments.

[1267] Based on the composition of the above-mentioned decoder 120 and the computer-readable storage medium, Figure 17 is a second schematic diagram of the composition structure of the decoder. As shown in Figure 17, the decoder 120 may include: a second memory 123 and a second processor 124, a second communication interface 125 and a second bus system 126. The second memory 123 and the second processor 124, and the second communication interface 125 are coupled together through the second bus system 126. It can be understood that the second bus system 126 is used to realize the connection and communication between these components. In addition to the data bus, the second bus system 126 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are labeled as the second bus system 126 in Figure 12. Among them,

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

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

[1270] The second processor 124 is configured to, when running the computer program, decode the bitstream, determine the BVD absolute value and BVD symbol index information of the current block; sort the candidate BVDs of the current block according to the BVD absolute value of the current block, and determine a sorting result; determine the BVD of the current block according to the BVD symbol index information and the sorting result; and determine a reconstructed value of the current block according to the BVD of the current block.

[1271] It is understood that the second memory 123 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The second memory 123 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[1272] The second processor 124 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in the second processor 124. The above-mentioned second processor 124 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the second memory 123 , and the second processor 124 reads the information in the second memory 123 and completes the steps of the above method in combination with its hardware.

[1273] It is to be understood that these embodiments described in the present application can be implemented with hardware, software, firmware, middleware, microcode or its combination.For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processor (Digital Signal Processing, DSP), digital signal processing equipment (DSP Device, DSPD), programmable logic device (Programmable Logic Device, PLD), field programmable gate array (Field-Programmable Gate Array, FPGA), general-purpose processor, controller, microcontroller, microprocessor, other electronic units for performing functions described in the present application or its combination.For software implementation, the technology described in the present application can be realized by the module (such as process, function etc.) that performs functions described in the present application. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[1274] The embodiments of the present application provide an encoder and decoder. At the decoding end, a bitstream is decoded to determine the absolute value of the current block's BVD and BVD symbol index information. Candidate BVDs for the current block are sorted based on the absolute value of the current block's BVD to determine a sorting result. The BVD of the current block is determined based on the BVD symbol index information and the sorting result. A reconstructed value of the current block is determined based on the BVD of the current block. At the encoding end, candidate BVDs for the current block are sorted based on the absolute value of the current block's BVD to determine a sorting result. The BVD symbol index information for the current block is determined based on the BVD symbol information and the sorting result. The BVD absolute value and BVD symbol index information are written into the bitstream. It can be seen that in the embodiments of the present application, the candidate BVDs of the current block can be effectively sorted according to the absolute value of the BVD of the current block, so that the sorting result can be used to determine and transmit the BVD symbol index information during encoding, and the sorting result can be used to parse the BVD symbol information of the current block during decoding. At the same time, the CABAC encoding and decoding technology can be used to encode and decode the BVD symbol information, which can effectively save the code rate required for the BVD symbol transmission in the IBC mode, thereby improving the encoding efficiency.

[1275] It should be noted that, in the embodiments of the present application, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[1276] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

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

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

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

[1280] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims. Industrial Applicability

[1281] The embodiments of the present application provide a coding and decoding method, an encoder, a decoder, and a storage medium. At the decoding end, a bitstream is decoded to determine the absolute value of the BVD and the BVD symbol index information of the current block; candidate BVDs of the current block are sorted based on the absolute value of the BVD of the current block to determine the sorting result; the BVD of the current block is determined based on the BVD symbol index information and the sorting result; and a reconstructed value of the current block is determined based on the BVD of the current block. At the encoding end, candidate BVDs of the current block are sorted based on the absolute value of the BVD of the current block to determine the sorting result; the BVD symbol index information of the current block is determined based on the BVD symbol information and the sorting result; and the BVD absolute value and BVD symbol index information are written into the bitstream. It can be seen that in the embodiments of the present application, the candidate BVDs of the current block can be effectively sorted according to the absolute value of the BVD of the current block, so that the sorting result can be used to determine and transmit the BVD symbol index information during encoding, and the sorting result can be used to parse the BVD symbol information of the current block during decoding. At the same time, the CABAC encoding and decoding technology can be used to encode and decode the BVD symbol information, which can effectively save the code rate required for the BVD symbol transmission in the IBC mode, thereby improving the encoding efficiency.

Claims

1. A decoding method, applied to a decoder, comprising: Decode the code stream and determine the absolute value of the block vector difference BVD and the BVD symbol index information of the current block; Sorting candidate BVDs of the current block according to the absolute value of the BVD of the current block to determine a sorting result; Determining the BVD of the current block according to the BVD symbol index information and the sorting result; A reconstruction value of the current block is determined according to the BVD of the current block.

2. The method according to claim 1, wherein The BVD absolute value includes a first component absolute value absBvdX and a second component absolute value absBvdY; The candidate BVD includes a first component candBvdX and a second component candBvdY.

3. The method according to claim 2, wherein: The method further comprises: If the absBvdX is equal to 0, the candidate BVD is determined according to the absBvdY.

4. The method according to claim 2, wherein: The method further comprises: If the absBvdY is equal to 0, the candidate BVD is determined according to the absBvdX.

5. The method according to claim 2, wherein: The method further comprises: If both the absBvdX and the absBvdY are not equal to 0, the candidate BVD is determined according to the absBvdX and the absBvdY.

6. The method according to claim 2, wherein: The step of sorting the candidate BVDs of the current block according to the absolute value of the BVD of the current block to determine the sorting result includes: Determining, according to the BVD absolute value, first generation values ​​corresponding to one or more candidate BVDs of the current block; The candidate BVDs are sorted according to the first generation value to determine the sorting result.

7. The method according to claim 6, wherein: The method further comprises: The one or more candidate BVDs include a BVD in which the candBvdX is set equal to -absBvdX or absBvdX, and the candBvdY is set equal to -absBvdY or absBvdY.

8. The method according to claim 7, wherein: The determining, according to the absolute value of the BVD of the current block, first generation values ​​corresponding to one or more candidate BVDs of the current block includes: A first matching template determined according to the candidate BVD; According to a preset error criterion, a matching error between the first template of the current block and the first matching template is calculated to determine a first generation value corresponding to the candidate BVD.

9. The method according to claim 8, wherein The method further comprises: The first template includes one or more sample values ​​in a neighboring decoded area of ​​the current block.

10. The method according to claim 8, wherein The first matching template determined according to the candidate BVD includes: Determining a block vector prediction value BVP of the current block; Determining a candidate BV of the current block according to the BVP and the candidate BVD; wherein the candidate BV is used to indicate the position of the first matching template; The first matching template is determined according to the candidate BV.

11. The method according to claim 10, wherein: The BVP includes a third component currBvpX and a fourth component currBvpY, and determining the candidate BV of the current block according to the BVP and the candidate BVD includes: The two-dimensional vector of the candidate BV is set to (currBvpX+candBvdX, currBvpY+candBvdY).

12. The method according to claim 11, wherein The determining the first matching template according to the candidate BV includes: The first matching template is determined according to the position of the current point and the two-dimensional vector of the candidate BV.

13. The method according to claim 12, wherein: The method further comprises: Taking the position of the current point as a starting point, the area indicated by the two-dimensional vector of the candidate BV, which has the same shape and contains the same number of samples as the first template, is determined as the first matching template.

14. The method according to claim 8, wherein The preset error criterion includes any one of the sum of absolute difference (SAD), the sum of absolute difference (SATD), the sum of squared differences (SSE), the mean absolute difference (MAD), the mean absolute error (MAE), the mean squared error (MSE), and the rate-distortion function (RDO).

15. The method according to claim 8, wherein The sorting result is a candidate BVD list of the current block, and the method further includes: The candidate BVDs are sorted according to the first generation value to determine a candidate BVD list for the current block, wherein the candidate BVD list includes at least one candidate BVD.

16. The method according to claim 15, wherein The step of sorting the candidate BVDs according to the first generation value to determine a candidate BVD list for the current block includes: According to the preset error criterion, the one or more candidate BVDs are sorted in ascending order of the matching errors indicated by the first generation value to determine the candidate BVD list.

17. The method according to claim 15, wherein: The step of sorting the candidate BVDs according to the first generation value to determine a candidate BVD list for the current block includes: If both the absBvdX and the absBvdY are not equal to 0, the candidate BVD is stored in the first array and the second array respectively; Determining, based on the first generation value, a first candidate BVD and a second candidate BVD in the first array, and a third candidate BVD and a fourth candidate BVD in the second array; Based on the first generation value, the first candidate BVD, the second candidate BVD, the third candidate BVD, and the fourth candidate BVD are sorted to determine the candidate BVD list.

18. The method according to claim 17, wherein: The method further comprises: If the first generation value of the first candidate BVD is less than or equal to the first generation value of the third candidate BVD, set the first candidate BVD as the first candidate BVD in the candidate BVD list, set the third candidate BVD as the second candidate BVD in the candidate BVD list, set the second candidate BVD as the third candidate BVD in the candidate BVD list, and set the fourth candidate BVD as the fourth candidate BVD in the candidate BVD list; Otherwise, the third candidate BVD is set to the first candidate BVD in the candidate BVD list, the first candidate BVD is set to the second candidate BVD in the candidate BVD list, the fourth candidate BVD is set to the third candidate BVD in the candidate BVD list, and the second candidate BVD is set to the fourth candidate BVD in the candidate BVD list.

19. The method according to claim 17, wherein The method further comprises: If the first generation value of the first candidate BVD is less than or equal to the first generation value of the third candidate BVD, set the first candidate BVD as the first candidate BVD in the candidate BVD list, set the second candidate BVD as the second candidate BVD in the candidate BVD list, set the third candidate BVD as the third candidate BVD in the candidate BVD list, and set the fourth candidate BVD as the fourth candidate BVD in the candidate BVD list; Otherwise, the third candidate BVD is set to the first candidate BVD in the candidate BVD list, the fourth candidate BVD is set to the second candidate BVD in the candidate BVD list, the first candidate BVD is set to the third candidate BVD in the candidate BVD list, and the second candidate BVD is set to the fourth candidate BVD in the candidate BVD list.

20. The method according to claim 15, wherein The step of sorting the candidate BVDs according to the first generation value to determine a candidate BVD list for the current block includes: If the absBvdX is equal to 0 or the absBvdY is equal to 0, the candidate BVD with the smallest first generation value among the candidate BVDs is set as the first candidate BVD in the candidate BVD list, and the other candidate BVD among the candidate BVDs is set as the second candidate BVD in the candidate BVD list.

21. The method according to claim 8, wherein The sorting result is a candidate BVD set of the current block, and the method further includes: The candidate BVDs are sorted according to the first generation value to determine a candidate BVD set for the current block, wherein the candidate BVD set includes at least one candidate BVD.

22. The method according to claim 21, wherein The step of sorting the candidate BVDs according to the first generation value to determine a candidate BVD set for the current block includes: If both the absBvdX and the absBvdY are not equal to 0, the candidate BVD is stored in the first array and the second array respectively; Determine a fifth candidate BVD in the first array with the smallest first-generation value, and a sixth candidate BVD in the second array with the smallest first-generation value; The candidate BVD with the smallest first-generation value among the fifth candidate BVD and the sixth candidate BVD is determined as the BVD with the smallest cost in the candidate BVD set.

23. The method according to claim 21, wherein The step of sorting the candidate BVDs according to the first generation value to determine a candidate BVD set for the current block includes: If the absBvdX is equal to 0 or the absBvdY is equal to 0, the candidate BVD with the smallest first-generation value among the candidate BVDs is determined as the BVD with the smallest cost in the candidate BVD set.

24. The method according to any one of claims 16 to 20, wherein: The determining the BVD of the current block according to the BVD symbol index information and the sorting result includes: The candidate BVD in the candidate BVD list and indicated by the BVD symbol index information is determined as the BVD of the current block.

25. The method according to claim 16, wherein The method further comprises: The candidate BVD list is converted to determine an index conversion list.

26. The method according to claim 25, wherein The determining the BVD of the current block according to the BVD symbol index information and the sorting result includes: When both the absBvdX and the absBvdY are not 0, if the first bit of the BVD symbol index information is 0, it is determined that the candBvdX of the BVD of the current block is the same as the candBvdX of the first candidate BVD or the third candidate BVD in the index conversion list; candBvdY of the BVD of the current block is determined according to the first candidate BVD or the third candidate BVD.

27. The method according to claim 26, wherein The method further comprises: If the second bit of the BVD symbol index information is 0, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the first candidate BVD; If the value of the second bit is 1, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the third candidate BVD.

28. The method according to claim 25, wherein The determining the BVD of the current block according to the BVD symbol index information and the sorting result includes: When both absBvdX and absBvdY are not 0, if the first bit of the BVD symbol index information is 1, it is determined that the first component symbol is the same as the first component symbol of the second candidate BVD or the fourth candidate BVD in the index conversion list; candBvdY of the BVD of the current block is determined according to the second candidate BVD or the fourth candidate BVD.

29. The method according to claim 28, wherein The method further comprises: If the second bit of the BVD symbol index information is 0, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the second candidate BVD; If the value of the second bit is 1, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the fourth candidate BVD.

30. The method of claim 25, wherein: The determining the BVD of the current block according to the BVD symbol index information and the sorting result includes: When the absBvdX is 0, if the value of the BVD symbol index information is 0, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the first candidate BVD in the index conversion list; if the value of the BVD symbol index information is 1, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the second candidate BVD in the index conversion list.

31. The method of claim 25, wherein: The determining the BVD of the current block according to the BVD symbol index information and the sorting result includes: When the absBvdY is 0, if the value of the BVD symbol index information is 0, it is determined that the candBvdX of the BVD of the current block is the same as the candBvdX of the first candidate BVD in the index conversion list; if the value of the BVD symbol index information is 1, it is determined that the candBvdX of the BVD of the current block is the same as the candBvdX of the second candidate BVD in the index conversion list.

32. The method of claim 16, wherein: The determining the BVD of the current block according to the BVD symbol index information and the candidate BVD list includes: When both absBvdX and absBvdY are not 0, if the first bit of the BVD symbol index information is 0, it is determined that the candBvdX of the BVD of the current block is the same as the candBvdX of the first candidate BVD in the candidate BVD list, otherwise they are different; Traverse the candidate BVD list and determine the first candidate BVD that has the same candBvdX as the BVD of the current block; If the second bit of the BVD symbol index information is 0, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the first candidate BVD, otherwise they are different.

33. The method of claim 16, wherein: The determining the BVD of the current block according to the BVD symbol index information and the candidate BVD list includes: When the absBvdX is 0, if the value of the BVD symbol index information is 0, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the first candidate BVD in the candidate BVD list; if the value of the BVD symbol index information is 1, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the second candidate BVD in the candidate BVD list.

34. The method of claim 16, wherein: The determining the BVD of the current block according to the BVD symbol index information and the candidate BVD list includes: When the absBvdY is 0, if the value of the BVD symbol index information is 0, it is determined that the candBvdX of the BVD of the current block is the same as the candBvdX of the first candidate BVD in the candidate BVD list; if the value of the BVD symbol index information is 1, it is determined that the candBvdX of the BVD of the current block is the same as the candBvdX of the second candidate BVD in the candidate BVD list.

35. The method of claim 21, wherein The determining the BVD of the current block according to the BVD symbol index information and the sorting result includes: When both absBvdX and absBvdY are not 0, if the first bit of the BVD symbol index information is 0, it is determined that the candBvdX of the BVD of the current block is the same as the candBvdX of the minimum cost BVD in the candidate BVD set; The candBvdY of the BVD of the current block is determined according to the BVD with the minimum cost in the candidate BVD set.

36. The method of claim 21, wherein The determining the BVD of the current block according to the BVD symbol index information and the sorting result includes: When both absBvdX and absBvdY are not 0, if the first bit of the BVD sign index information is 1, it is determined that the candBvdX of the BVD of the current block has an opposite sign to the candBvdX of the minimum cost BVD in the candidate BVD set; The candBvdY of the BVD of the current block is determined according to the BVD with the lowest cost in another array other than the array where the BVD with the lowest cost in the candidate BVD set is located.

37. The method according to claim 35, wherein The method further comprises: If the second bit of the BVD symbol index information is 0, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the minimum cost BVD in the candidate BVD set; If the value of the second bit is 1, it is determined that the candBvdY of the BVD of the current block has an opposite sign to the candBvdY of the minimum cost BVD in the candidate BVD set.

38. The method according to claim 36, wherein The method further comprises: If the second bit of the BVD symbol index information is 0, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the minimum cost BVD in the other array; If the value of the second bit is 1, it is determined that the candBvdY of the BVD of the current block has an opposite sign to the candBvdY of the minimum cost BVD in the other array.

39. The method according to claim 21, wherein The determining the BVD of the current block according to the BVD symbol index information and the sorting result includes: When the absBvdX is 0, if the value of the BVD symbol index information is 0, it is determined that the candBvdY of the BVD of the current block is the same as the candBvdY of the BVD with the minimum cost in the candidate BVD set; if the value of the BVD symbol index information is 1, it is determined that the candBvdY of the BVD of the current block is opposite in sign to the candBvdY of the BVD with the minimum cost in the candidate BVD set.

40. The method of claim 21, wherein The determining the BVD of the current block according to the BVD symbol index information and the sorting result includes: When the absBvdY is 0, if the value of the BVD symbol index information is 0, it is determined that the absBvdX of the BVD of the current block is the same as the absBvdX of the BVD with the minimum cost in the candidate BVD set; if the value of the BVD symbol index information is 1, it is determined that the absBvdX of the BVD of the current block is opposite in sign to the absBvdX of the BVD with the minimum cost in the candidate BVD set.

41. The method of claim 2, wherein: The method further comprises: If both the absBvdX and the absBvdY are not 0, it is determined that the number of bits of the BVD symbol index information is 2; if the absBvdX or the absBvdY is 0, it is determined that the number of bits of the BVD symbol index information is 1.

42. The method of claim 2, wherein: The method further comprises: The BVD symbol index information is encoded using a truncated unary code, so the number of bits of the symbol index information corresponding to different candidate BVDs is not exactly the same.

43. A coding method, applied to an encoder, comprising: Sorting candidate BVDs of the current block according to the absolute value of the BVD of the current block to determine a sorting result; Determining BVD symbol index information of the current block according to the BVD symbol information of the current block and the sorting result; The BVD absolute value and the BVD symbol index information are written into the code stream.

44. The method according to claim 43, wherein The BVD absolute value includes a first component absolute value absBvdX and a second component absolute value absBvdY; The candidate BVD includes a first component candBvdX and a second component candBvdY.

45. The method of claim 44, wherein: The method further comprises: If the absBvdX is equal to 0, the candidate BVD is determined according to the absBvdY.

46. ​​The method of claim 44, wherein The method further comprises: If the absBvdY is equal to 0, the candidate BVD is determined according to the absBvdX.

47. The method of claim 44, wherein The method further comprises: If both the absBvdX and the absBvdY are not equal to 0, the candidate BVD is determined according to the absBvdX and the absBvdY.

48. The method of claim 44, wherein The step of sorting the candidate BVDs of the current block according to the absolute value of the BVD of the current block to determine the sorting result includes: Determining, according to the BVD absolute value, first generation values ​​corresponding to one or more candidate BVDs of the current block; The candidate BVDs are sorted according to the first generation value to determine the sorting result.

49. The method according to claim 48, wherein The method further comprises: The one or more candidate BVDs include a BVD in which the candBvdX is set equal to -absBvdX or absBvdX, and the candBvdY is set equal to -absBvdY or absBvdY.

50. The method of claim 49, wherein The determining, according to the absolute value of the BVD of the current block, first generation values ​​corresponding to one or more candidate BVDs of the current block includes: A first matching template determined according to the candidate BVD; According to a preset error criterion, a matching error between the first template of the current block and the first matching template is calculated to determine a first generation value corresponding to the candidate BVD.

51. The method of claim 50, wherein: The method further comprises: The first template includes one or more sample values ​​in a neighboring decoded area of ​​the current block.

52. The method of claim 50, wherein: The first matching template determined according to the candidate BVD includes: Determining a block vector prediction value BVP of the current block; Determining a candidate BV of the current block according to the BVP and the candidate BVD; wherein the candidate BV is used to indicate the position of the first matching template; The first matching template is determined according to the candidate BV.

53. The method of claim 52, wherein: The BVP includes a third component currBvpX and a fourth component currBvpY, and determining the candidate BV of the current block according to the BVP and the candidate BVD includes: The two-dimensional vector of the candidate BV is set to (currBvpX+candBvdX, currBvpY+candBvdY).

54. The method of claim 53, wherein: The determining the first matching template according to the candidate BV includes: The first matching template is determined according to the position of the current point and the two-dimensional vector of the candidate BV.

55. The method of claim 54, wherein The method further comprises: Taking the position of the current point as a starting point, the area indicated by the two-dimensional vector of the candidate BV, which has the same shape and contains the same number of samples as the first template, is determined as the first matching template.

56. The method of claim 50, wherein: The preset error criterion includes any one of the sum of absolute difference (SAD), the sum of absolute difference (SATD), the sum of squared differences (SSE), the mean absolute difference (MAD), the mean absolute error (MAE), the mean squared error (MSE), and the rate-distortion function (RDO).

57. The method of claim 50, wherein: The sorting result is a candidate BVD list of the current block, and the method further includes: The candidate BVDs are sorted according to the first generation value to determine a candidate BVD list for the current block, wherein the candidate BVD list includes at least one candidate BVD.

58. The method of claim 57, wherein The step of sorting the candidate BVDs according to the first generation value to determine a candidate BVD list for the current block includes: According to the preset error criterion, the one or more candidate BVDs are sorted in ascending order of the matching errors indicated by the first generation value to determine the candidate BVD list.

59. The method of claim 57, wherein The step of sorting the candidate BVDs according to the first generation value to determine a candidate BVD list for the current block includes: If both the absBvdX and the absBvdY are not equal to 0, the candidate BVD is stored in the first array and the second array respectively; Determining, based on the first generation value, a first candidate BVD and a second candidate BVD in the first array, and a third candidate BVD and a fourth candidate BVD in the second array; Based on the first generation value, the first candidate BVD, the second candidate BVD, the third candidate BVD, and the fourth candidate BVD are sorted to determine the candidate BVD list.

60. The method of claim 59, wherein The method further comprises: If the first generation value of the first candidate BVD is less than or equal to the first generation value of the third candidate BVD, set the first candidate BVD as the first candidate BVD in the candidate BVD list, set the third candidate BVD as the second candidate BVD in the candidate BVD list, set the second candidate BVD as the third candidate BVD in the candidate BVD list, and set the fourth candidate BVD as the fourth candidate BVD in the candidate BVD list; Otherwise, the third candidate BVD is set to the first candidate BVD in the candidate BVD list, the first candidate BVD is set to the second candidate BVD in the candidate BVD list, the fourth candidate BVD is set to the third candidate BVD in the candidate BVD list, and the second candidate BVD is set to the fourth candidate BVD in the candidate BVD list.

61. The method of claim 59, wherein: The method further comprises: If the first generation value of the first candidate BVD is less than or equal to the first generation value of the third candidate BVD, set the first candidate BVD as the first candidate BVD in the candidate BVD list, set the second candidate BVD as the second candidate BVD in the candidate BVD list, set the third candidate BVD as the third candidate BVD in the candidate BVD list, and set the fourth candidate BVD as the fourth candidate BVD in the candidate BVD list; Otherwise, the third candidate BVD is set to the first candidate BVD in the candidate BVD list, the fourth candidate BVD is set to the second candidate BVD in the candidate BVD list, the first candidate BVD is set to the third candidate BVD in the candidate BVD list, and the second candidate BVD is set to the fourth candidate BVD in the candidate BVD list.

62. The method of claim 57, wherein: The step of sorting the candidate BVDs according to the first generation value to determine a candidate BVD list for the current block includes: If the absBvdX is equal to 0 or the absBvdY is equal to 0, the candidate BVD with the smallest first generation value among the candidate BVDs is set as the first candidate BVD in the candidate BVD list, and the other candidate BVD among the candidate BVDs is set as the second candidate BVD in the candidate BVD list.

63. The method of claim 50, wherein: The sorting result is a candidate BVD set of the current block, and the method further includes: The candidate BVDs are sorted according to the first generation value to determine a candidate BVD set for the current block, wherein the candidate BVD set includes at least one candidate BVD.

64. The method of claim 62, wherein: The step of sorting the candidate BVDs according to the first generation value to determine a candidate BVD set for the current block includes: If both the absBvdX and the absBvdY are not equal to 0, the candidate BVD is stored in the first array and the second array respectively; Determine a fifth candidate BVD in the first array with the smallest first-generation value, and a sixth candidate BVD in the second array with the smallest first-generation value; The candidate BVD with the smallest first-generation value among the fifth candidate BVD and the sixth candidate BVD is determined as the BVD with the smallest cost in the candidate BVD set.

65. The method of claim 63, wherein The step of sorting the candidate BVDs according to the first generation value to determine a candidate BVD set for the current block includes: If the absBvdX is equal to 0 or the absBvdY is equal to 0, the candidate BVD with the smallest first-generation value among the candidate BVDs is determined as the BVD with the smallest cost in the candidate BVD set.

66. The method according to any one of claims 56 to 62, wherein: The determining, according to the BVD symbol information of the current block and the sorting result, the BVD symbol index information of the current block includes: Determine the candidate BVD having the same BVD symbol information as that of the current block in the candidate BVD list; The BVD symbol index information is set according to the index value of the candidate BVD.

67. The method of claim 58, wherein The method further comprises: The candidate BVD list is converted to determine an index conversion list.

68. The method of claim 67, wherein The determining, according to the BVD symbol information of the current block and the sorting result, the BVD symbol index information of the current block includes: When both the absBvdX and the absBvdY are not 0, if the first component symbol of the BVD symbol information of the current block is the same as the first component symbol of the first candidate BVD in the index conversion list, the first bit of the BVD symbol index information is determined to be 0; otherwise, the first bit is determined to be 1.

69. The method of claim 67, wherein The method further comprises: When the first bit is determined to be 0, if the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the first candidate BVD in the index conversion list, the second bit of the BVD symbol index information is determined to be 0; otherwise, the second bit is determined to be 1; When the first bit is determined to be 1, if the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the candidate BVD with an index of 1 in the index conversion list, the second bit of the BVD symbol index information is determined to be 0; otherwise, the second bit is determined to be 1.

70. The method of claim 67, wherein The determining, according to the BVD symbol information of the current block and the sorting result, the BVD symbol index information of the current block includes: When the absBvdX is 0, if the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the first candidate BVD in the index conversion list, the BVD symbol index information is determined to be 0; otherwise, the BVD symbol index information is determined to be 1.

71. The method of claim 67, wherein The determining, according to the BVD symbol information of the current block and the sorting result, the BVD symbol index information of the current block includes: When the absBvdY is 0, if the first component symbol of the BVD symbol information of the current block is the same as the first component symbol of the first candidate BVD in the index conversion list, the BVD symbol index information is determined to be 0; otherwise, the BVD symbol index information is determined to be 1.

72. The method of claim 58, wherein The determining, according to the BVD symbol information of the current block and the sorting result, the BVD symbol index information of the current block includes: When both absBvdX and absBvdY are not 0, if the first component symbol of the BVD symbol information of the current block is the same as the first component symbol of the first candidate BVD in the candidate BVD list, the first bit of the BVD symbol index information is determined to be 0; otherwise, the first bit is determined to be 1; Traversing the candidate BVD list, determining a first candidate BVD having the same first component symbol as the BVD symbol information of the current block; If the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the first candidate BVD, the second bit of the BVD symbol index information is determined to be 0; otherwise, the second bit is determined to be 1.

73. The method of claim 58, wherein The determining, according to the BVD symbol information of the current block and the sorting result, the BVD symbol index information of the current block includes: When the absBvdX is 0, if the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the first candidate BVD in the candidate BVD list, the BVD symbol index information is determined to be 0, otherwise the BVD symbol index information is determined to be 1.

74. The method of claim 58, wherein The determining, according to the BVD symbol information of the current block and the sorting result, the BVD symbol index information of the current block includes: When the absBvdY is 0, if the first component symbol of the BVD symbol information of the current block is the same as the first component symbol of the first candidate BVD in the candidate BVD list, the BVD symbol index information is determined to be 0, otherwise the BVD symbol index information is determined to be 1.

75. The method of claim 63, wherein The determining, according to the BVD symbol information of the current block and the sorting result, the BVD symbol index information of the current block includes: When both absBvdX and absBvdY are not 0, if the first component symbol of the BVD symbol information of the current block is the same as the first component symbol of the minimum cost BVD in the candidate BVD set, determining that the first bit of the BVD symbol index information is 0; The second bit of the BVD symbol index information of the current block is determined according to the minimum cost BVD in the candidate BVD set.

76. The method of claim 63, wherein The determining, according to the BVD symbol information of the current block and the sorting result, the BVD symbol index information of the current block includes: When both absBvdX and absBvdY are not 0, if the first component symbol of the BVD symbol information of the current block is different from the first component symbol of the minimum cost BVD in the candidate BVD set, determining that the first bit of the BVD symbol index information is 1; The second bit of the BVD symbol index information of the current block is determined according to the minimum cost BVD in another array other than the array where the minimum cost BVD in the candidate BVD set is located.

77. The method of claim 75, wherein: The method further comprises: If the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the minimum cost BVD in the candidate BVD set, determining that the second bit of the BVD symbol index information is 0; If the second component symbol of the BVD symbol information of the current block is different from the second component symbol of the minimum cost BVD in the candidate BVD set, it is determined that the second bit of the BVD symbol index information is 1.

78. The method of claim 76, wherein: The method further comprises: If the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the minimum cost BVD in the other array, determining that the second bit of the BVD symbol index information is 0; If the second component symbol of the BVD symbol information of the current block is different from the second component symbol of the minimum cost BVD in the other array, it is determined that the second bit of the BVD symbol index information is 1.

79. The method of claim 63, wherein The determining, according to the BVD symbol information of the current block and the sorting result, the BVD symbol index information of the current block includes: When the absBvdX is 0, if the second component symbol of the BVD symbol information of the current block is the same as the second component symbol of the minimum cost BVD in the candidate BVD set, the value of the BVD symbol index information is determined to be 0; otherwise, the value of the BVD symbol index information is determined to be 1.

80. The method of claim 63, wherein The determining, according to the BVD symbol information of the current block and the sorting result, the BVD symbol index information of the current block includes: When the absBvdY is 0, if the first component symbol of the BVD symbol information of the current block is the same as the first component symbol of the minimum cost BVD in the candidate BVD set, the value of the BVD symbol index information is determined to be 0; otherwise, the value of the BVD symbol index information is determined to be 1.

81. The method of claim 43, wherein The method further comprises: The BVD absolute value and the BVD sign index information are encoded using context-adaptive binary arithmetic coding (CABAC).

82. The method of claim 43, wherein The method further comprises: The BVD absolute value and the BVD symbol index information are encoded using a bypass mode.

83. An encoder, comprising a first determining unit and an encoding unit; wherein: The first determining unit is configured to sort the candidate BVDs of the current block according to the BVD absolute value of the current block to determine a sorting result; and determine the BVD symbol index information of the current block according to the BVD symbol information of the current block and the sorting result; The encoding unit is configured to write the BVD absolute value and the BVD symbol index information into a bit stream.

84. An encoder comprising a first memory and a first processor; wherein: The first memory is used to store a computer program that can be run on the first processor; The first processor is configured to execute the method according to any one of claims 41 to 79 when running the computer program.

85. A decoder comprising a decoding unit and a second determining unit; wherein: The decoding unit is configured to decode the code stream; The second determining unit is configured to determine the BVD absolute value and BVD symbol index information of the current block; According to the BVD absolute value of the current block, the candidate BVDs of the current block are sorted to determine a sorting result; according to the BVD symbol index information and the sorting result, the BVD of the current block is determined; according to the BVD of the current block, a reconstructed value of the current block is determined.

86. A decoder comprising a second memory and a second processor; wherein: The second memory is used to store a computer program that can be run on the second processor; The second processor is configured to execute the method according to any one of claims 1 to 40 when running the computer program.

87. A computer-readable storage medium storing a computer program, wherein the computer program, when executed, implements the method according to any one of claims 1 to 42, or implements the method according to any one of claims 43 to 82.