Encoding / Decoding Method, Encoder, Decoder, and Storage Medium

The proposed encoding/decoding method for IBC mode in VVC addresses the complexity of BVD transmission by sorting and optimizing BVD information, thereby reducing bit rate and improving coding efficiency.

JP2025533269APending Publication Date: 2025-10-03GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
JP2025521229
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2022-10-13
Publication Date
2025-10-03

AI Technical Summary

Technical Problem

The transmission method of block vector difference (BVD) code information in Intra Block Copy (IBC) mode of H.266/Versatile Video Coding (VVC) is complex, leading to increased bit rates and decreased coding performance.

Method used

An encoding/decoding method that involves sorting candidate BVDs based on their absolute values, determining a sorting result, and encoding/decoding BVD magnitude and index information using CABAC to reduce bit rate.

Benefits of technology

This method effectively reduces the bit rate required for BVD code transmission in IBC mode, enhancing coding efficiency by optimizing the sorting and encoding/decoding processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2025533269000001_ABST
    Figure 2025533269000001_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides an encoding / decoding method, in which the decoding side decodes a bitstream, determines a BVD absolute value and BVD code index information of a current block, sorts candidate BVDs of the current block according to the BVD absolute value of the current block to determine the sorting result, determines a BVD of the current block according to the BVD code index information and the sorting result, and determines a reconstructed value of the current block according to the BVD of the current block. The encoding side sorts candidate BVDs of the current block according to the BVD absolute value of the current block to determine the sorting result, determines BVD code index information of the current block according to the BVD code information of the current block and the sorting result, and writes the BVD absolute value and BVD code index information into the bitstream.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

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

[0002] As people's demands for video display quality increase, new video application formats such as high-definition and ultra-high-definition video have emerged. H.265 / High Efficiency Video Coding (HEVC) can no longer meet the requirements of the rapid development of 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 is the VVC Reference Software Test Platform (VTM).

[0003] Intra block copy (IBC) is an extension tool for VVC's screen content coding, which significantly improves the coding efficiency of screen content sequences. However, in IBC mode, the transmission method of block vector difference (BVD) code information is often relatively complicated, which increases the transmission bit rate to a certain extent and results in a decrease in the coding performance of IBC mode. Summary of the Invention [Problem to be solved by the invention]

[0004] The embodiments of the present application provide an encoding / decoding method, an encoder, a decoder, and a storage medium that can effectively reduce the bit rate required for BVD code transmission in IBC mode, thereby improving coding efficiency. [Means for solving the problem]

[0005] The technical solutions of the embodiments of the present application can be realized as follows.

[0006] In a first aspect, an embodiment of the present application provides a decoding method applied to a decoder, the method comprising: Decoding the bitstream to determine the BVD magnitude and BVD code index information of the current block; Performing a sorting process on the candidate BVDs of the current block according to the BVD absolute value of the current block, and determining a sorting result; determining a BVD of the current block based on the BVD code index information and the sorting result; determining a reconstruction value of the current block based on the BVD of the current block.

[0007] In a second aspect, embodiments of the present application provide an encoding method applied to an encoder, the method comprising: Performing a sorting process on the candidate BVDs of the current block according to the BVD absolute value of the current block, and determining a sorting result; determining BVD code index information of the current block based on the BVD code information of the current block and the sorting result; and writing the BVD magnitude and the BVD code index information into a bitstream.

[0008] In a third aspect, an embodiment of the present application provides an encoder, comprising: a first determining unit; and an encoding unit; the first determining unit is configured to perform a sorting process on the candidate BVDs of the current block according to the BVD absolute value of the current block, determine a sorting result, and determine BVD code index information of the current block according to BVD code information of the current block and the sorting result; The encoding unit is configured to write the BVD magnitude and the BVD code index information into a bitstream.

[0009] In a fourth aspect, embodiments of the present application provide an encoder comprising a first memory and a first processor; the first memory is configured to store a computer program executable by the first processor; The first processor is configured to execute the computer program to perform the method according to the second aspect.

[0010] In a fifth aspect, an embodiment of the present application provides a decoder, comprising: a decoding unit; and a second determining unit; the decoding unit is configured to decode a bitstream; The second determining unit determines a BVD magnitude and BVD code index information of a current block; The method is configured to: perform a sorting process on candidate BVDs of the current block based on the BVD absolute value of the current block; determine a sorting result; determine a BVD of the current block based on the BVD code index information and the sorting result; and determine a reconstructed value of the current block based on the BVD of the current block.

[0011] In a sixth aspect, embodiments of the present application provide a decoder, comprising a second memory and a second processor; the second memory is configured to store a computer program executable by the second processor; The second processor is configured to execute the computer program to perform the method of the first aspect.

[0012] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium having stored thereon a computer program for implementing the method according to the first aspect or the method according to the second aspect. [Effects of the Invention]

[0013] The present embodiment provides an encoding / decoding method, an encoder, a decoder, and a storage medium, in which the decoding side decodes a bitstream, determines a BVD absolute value and BVD code index information of a current block, sorts candidate BVDs of the current block based on the BVD absolute value of the current block to determine the sorting result, determines a BVD of the current block based on the BVD code index information and the sorting result, and determines a reconstructed value of the current block based on the BVD of the current block. The encoding side sorts candidate BVDs of the current block based on the BVD absolute value of the current block to determine the sorting result, determines BVD code index information of the current block based on the BVD code information of the current block and the sorting result, and writes the BVD absolute value and BVD code index information into the bitstream. As can be seen, in the embodiment of the present application, an effective sorting process can be performed on the candidate BVDs of the current block based on the BVD absolute value of the current block. Therefore, during encoding, the sorting result can be used to determine and transmit BVD code index information. During decoding, the sorting result can be used to analyze the BVD code information of the current block. Furthermore, the CABAC encoding / decoding technology can be used to perform encoding / decoding processes on the BVD code information. This effectively reduces the bit rate required for BVD code transmission in IBC mode, and improves coding efficiency. [Brief explanation of the drawings]

[0014] [Figure 1] FIG. 1 is a schematic diagram of a prediction of an IBC mode. [Figure 2] FIG. 2 is a schematic diagram of adjacent blocks. [Figure 3]1 is a block diagram of a video encoding system according to an embodiment of the present application; [Figure 4] 1 is a block diagram of a video decoding system according to an embodiment of the present application; [Figure 5] 1 is a schematic diagram 1 of a decoding method in an embodiment of the present application. [Figure 6] 1 is a schematic diagram of a template type. [Figure 7] FIG. 1 is a schematic diagram of BVP and BVD for the current coding block. [Figure 8] FIG. 1 is a schematic diagram of template motion compensation. [Figure 9] Schematic diagram of BVD combinations. [Figure 10] 2 is a schematic diagram 2 of a decoding method in an embodiment of the present application. [Figure 11] FIG. 1 is a schematic diagram of cost calculation. [Figure 12] 1 is a schematic diagram 1 of an encoding method in an embodiment of the present application. [Figure 13] 2 is a schematic diagram 2 of an encoding method in an embodiment of the present application. [Figure 14] 1 is an exemplary structural diagram of an encoder configuration. [Figure 15] 2 is an exemplary structural diagram of an encoder configuration. [Figure 16] 1 is an exemplary structural diagram of a decoder configuration; [Figure 17] 2 is an exemplary structural diagram of a decoder configuration. DETAILED DESCRIPTION OF THE INVENTION

[0015] In order to allow 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 will be described in detail below with reference to the drawings, which are for illustrative purposes only and are not intended to limit the embodiments of the present application.

[0016] In the following description, the term "some embodiments" refers to a subset of all possible embodiments, and it is understood that the term "some embodiments" may refer to the same or different subsets of all possible embodiments, which may be combined with each other without conflict. The terms "first / second / third" used in the embodiments of the present application are merely used to distinguish between similar objects and do not represent a particular order of the objects. It is understood that "first / second / third" may, in some cases, be interchangeable with a particular order or precedence order, such that the embodiments of the present application described herein may be performed in an order other than that shown or described.

[0017] In a video image, a coding block (CB) is generally represented by a first image component, a second image component, and a third image component, where these three image components are one luminance component, one blue chrominance component, and one red chrominance component, respectively; specifically, the luminance component is usually represented by the code "Y", the blue chrominance component is usually represented by the code "Cb" or "U", and the red chrominance component is usually represented by the code "Cr" or "V", and thus a video image can be represented in either a YCbCr format or a YUV format.

[0018] In the present embodiment, the first image component may be a luminance component, the second image component may be a blue chromaticity component, and the third image component may be a red chromaticity component, but the present embodiment is not particularly limited thereto.

[0019] Common video coding and decoding standards adopt 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., 128x128, 64x64, etc.), and each LCU or CTU may be further divided into rectangular Coding Units (CUs) according to a rule. The Coding Units may then be further divided into smaller Prediction Units (PUs), Transform Units (TUs), etc.

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

[0021] The basic process of a video codec is as follows: On the encoding side, a frame of image is divided into blocks, intra- or inter-prediction is performed on the current block to generate a predicted block for the current block, the predicted block is subtracted from the original block of the current block to obtain a residual block, transformation and quantization are performed on the residual block to obtain a quantized coefficient matrix, and entropy coding is performed on the quantized coefficient matrix to output the result as a bitstream. On the decoding side, intra- or inter-prediction is performed on the current block to generate a predicted block for the current block, while the bitstream is decoded to obtain a quantized coefficient matrix, inverse quantization and inverse transformation are performed on the quantized coefficient matrix to obtain a residual block, and the predicted block and residual block are added to obtain a reconstructed block. The reconstructed block forms a reconstructed image, and loop filtering is performed on the reconstructed image based on the image or block to obtain a decoded image. On the encoding side, the same operations as on the decoding side must be performed to obtain a decoded image. The decoded image can be used as a reference frame for inter-prediction of a subsequent frame. If necessary, mode information or parameter information such as block division information, prediction, transform, quantization, entropy coding, and loop filtering determined by the encoding side must be output to a bitstream. The decoding side determines the same mode information or parameter information such as block division information, prediction, transform, quantization, entropy coding, and loop filtering as the encoding side through decoding and analysis based on existing information, thereby ensuring that the decoded image obtained by the encoding side is the same as the decoded image obtained by the decoding side. The decoded image obtained by the encoding side is usually also called a reconstructed image. During prediction, the current block can be divided into prediction units, and during transformation, the current block can be divided into transform units, and the division of the prediction units and the transform units may be different.The above is the basic process of a video codec in a block-based hybrid coding framework, and as technology develops, some modules or steps of the framework or process may be optimized. The embodiments of the present application apply to, but are not limited to, the basic process of a video codec in the block-based hybrid coding framework.

[0022] The current block (CB) may be a current coding unit (CU) or a current prediction unit (PU), for example.

[0023] Intra block copy (IBC) is an extension tool for VVC's screen content coding, which significantly improves the coding efficiency of screen content sequences.

[0024] IBC is a block-level coding mode, and like interframe technology, the coding side performs motion search, i.e., block matching (BM), to find the optimal block vector (BV) for each CU, also known as a motion vector (MV), which points from the current block to a reference block. It differs from interframe technology in that the optimal block vector in IBC is searched for in the reconstruction domain of the frame in which the current CU is located (i.e., the current coding frame), whereas the motion vector in interframe is searched for in an adjacent reference frame in the temporal domain of the current coding frame.

[0025] FIG. 1 is a schematic diagram of IBC mode prediction. As shown in FIG. 1, a specific process of obtaining reconstructed pixels of a current coding block in IBC mode in H.266 / VVC may include: deriving a BV, deriving a predicted sample using the BV, deriving a residual sample, and deriving a reconstructed sample using the predicted sample and the residual sample.

[0026] Here, the specific process for deriving BV is as follows:

[0027] (1) Brightness: Input: Luminance position (xCb, yCb) specifying the top-left corner sample of the current coding block relative to the top-left corner luma sample of the current image, variable cbWidth specifying the width of the current coding block in luma samples, and variable cbHeight specifying the height of the current coding block in luma samples. Output: bvL (Block Vector Luma) of luminance.

[0028] IBC modes are divided into IBCMERGE and IBCAMVP. When deriving bvL, both require the establishment of an IBC block vector candidate list bvCandList. Below, we will introduce the list establishment process for IBCMERGE. The list establishment process for IBCAMVP is the same as that for IBCMERGE, but the maximum number of candidates for the two is different.

[0029] In step 1, if IsGt4by4 is TRUE (the variable IsGt4by4 is the product of the luminance width and height, and is TRUE when IsGt4by4 is greater than 16), the process for deriving spatial block vector candidates from neighboring coding units, as specified in the decoding specification, is invoked using the position (xCb, yCb) of the luminance coding block, the width cbWidth of the luminance coding block, and the height cbHeight of the luminance coding block as input. The output is the availability flags availableFlagA1 and availableFlagB1, and the block vectors bvA1 and bvB1. Here, A1 and B1 are neighboring blocks. Figure 2 is a schematic diagram of neighboring blocks. As shown in Figure 2, the relative positions of the neighboring blocks A1 and B1 and the current coding block are the lower left corner and the upper right corner, respectively.

[0030] In step 2, if IsGt4by4 is TRUE, the block vector candidate list bvCandList is constructed as follows:

[0031] i=0 if(availableFlagA1) bvCandList[i++]=bvA1 if(availableFlagB1) bvCandList[i++]=bvB1

[0032] In step 3, the variable numCurrCand represents the number of currently obtained candidates, and the derivation process of numCurrCand is as follows.

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

[0034] In step 4, if numCurrCand is smaller than MaxNumIbcMergeCand (the maximum number of candidates in MERGE mode) and NumHmvpIbcCand (the maximum number of history-optimal block vector (Hmvp) candidates in IBC mode) is greater than 0, the process for deriving history-based IBC block vector candidates specified in the decoding standard is invoked with bvCandList and numCurrCand as inputs and the modified bvCandList and numCurrCand as outputs.

[0035] In step 5, If numCurrCand is less than MaxNumIbcMergeCand, apply the following until numCurrCand is equal to MaxNumIbcMergeCand:

[0036] Set bvCandList[numCurrCand][0] (i.e., the horizontal component of bv) to 0. Set bvCandList[numCurrCand][1] (i.e., the vertical component of bv) to 0. Increase numCurrCand by 1.

[0037] This establishes a block vector candidate list bvCandList, and general_merge_flag indicates whether the mode is IBCMERGE or not. The candidate index bvIdx is derived in the following manner.

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

[0039] In this way, a specific bvL can be obtained based on the index bvIdx and the block vector candidate list bvCandList.

[0040] bvL[0]=bvCandList[bvIdx][0] bvL[1]=bvCandList[bvIdx][1] In the IBCAMVP mode, a specific bvL can be obtained as the predicted bvL using the index bvIdx and the block vector candidate list bvCandList, and the true bvL needs to further add the block vector difference (BVD), and the specific process is as follows:

[0041] In step 1, the horizontal and vertical components of BVD are obtained, where MvdL0 is the forward motion vector difference.

[0042] bvd[0]=MvdL0[xCb][yCb][0] bvd[1]=MvdL0[xCb][yCb][1]

[0043] In step 2, a rounding operation is performed on the prediction bvL obtained above, where the right shift parameter AmvrShift is used for rounding and the left shift parameter AmvrShift is used for improving the resolution.

[0044] offset=(AmvrShift == 0)? 0 :((1 << (AmvrShift - 1))- 1) bvL[0]=Sign(bvL[0])×(((Abs(bvL[0])+offset)>>AmvrShift)<< AmvrShift) bvL[1]=Sign(bvL[1])×(((Abs(bvL[1])+offset)>>AmvrShift)< <AmvrShift)

[0045] In step 3, the true bvL is derived as follows, and its range is constrained to be between -217 and 217-1:

[0046] u[0]=(bvL[0]+bvd[0]+218)% 218 bvL[0]=(u[0] >= 217)? (u[0] - 218): u[0] u[1]=(bvL[1]+bvd[1]+218)% 218 bvL[1]=(u[1] >= 217)? (u[1] - 218): u[1]

[0047] (2) Chromaticity: In the case of binary tree decomposition, IBC is not performed on chromaticity, whereas in the case of single tree decomposition, BV of chromaticity needs to be derived.

[0048] Input: Luminance bvL (1 / 16 pixel accuracy) Output: bvC (Block Vector chroma) chromaticity (1 / 32 pixel accuracy) The derivation process is as follows:

[0049] bvC[0]=((bvL[0]>>(3+SubWidthC))×32) bvC[1]=((bvL[1]>>(3+SubHeightC))×32)

[0050] Here, the specific process of deriving a predicted sample using BV is as follows:

[0051] Input: Luminance location (xCb, yCb) specifying the top-left corner sample of the current coding block relative to the top-left corner luma sample of the current image, variable cbWidth specifying the width of the current coding block in luma samples, variable cbHeight specifying the height of the current coding block in luma samples, block vector bv, and variable cIdx specifying the color component index of the current block. Output: Array of prediction samples predSamples.

[0052] The derivation process is as follows:

[0053] If cIdx is 0, i.e. for the luminance component, then for x=xCb..xCb+cbWidth-1 and y=yCb..yCb+cbHeight-1, then:

[0054] xVb=(x+(bv[0] >>4))&(IbcBufWidthY - 1) yVb=(y+(bv[1] >>4))&(CtbSizeY - 1) predSamples[x][y]=ibcVirBuf[0][xVb][yVb]

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

[0056] If cIdx is not 0, i.e., for the chromaticity components, for x=xCb / SubWidthC..xCb / SubWidthC+cbWidth / SubWidthC-1 and y=yCb / SubHeightC..yCb / SubHeightC+cbHeight / SubHeightC-1, then:

[0057] xVb=(x+(bv[0] >>5))&(IbcBufWidthC- 1) yVb=(y+(bv[1] >>5))&((CtbSizeY / subHeightC)- 1) predSamples[x][y]=ibcVirBuf[cIdx][xVb][yVb]

[0058] The variables SubWidthC and SubHeightC depend on the chromaticity format sampling structure specified by sps_chroma_format_idc, and the specific correspondence is as shown in the table below.

[0059] [Table 1]

[0060] Here, when deriving the residual samples, a decoding process of the residual signal of the coded block in the inter prediction mode defined in the decoding standard can be invoked. When deriving the reconstructed samples using the predicted samples and the residual samples, an image reconstruction process of the specified color component defined in the decoding standard can be invoked.

[0061] Furthermore, in the IBC BVD encoding process, in the IBCAMVP mode, motion estimation is performed using basic block vector prediction (BVP: Block Vector Predition) to search for the optimal block motion vector, and the difference between the searched optimal block motion vector and the basic block vector is the block vector difference (BVD).

[0062] Here, the BVD encoding process is as follows: for the horizontal and vertical components of BVD, first encode the flag indicating whether BVD is zero or not. If BVD is not zero, encode its absolute value, and then bypass-encode the BVD code; otherwise, do not encode any further bits.

[0063] Furthermore, regarding 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 of interframe. The specific decoding process of MVD is as follows:

[0064] [Table 2] [Table 3]

[0065] Here, mvd_sign_flag[compIdx] represents the sign of the motion vector difference for a given (horizontal or vertical) component compIdx. If mvd_sign_flag[compIdx] is 0, the corresponding motion vector component difference has a positive value; otherwise (mvd_sign_flag[compIdx] is 1), the corresponding motion vector component difference has a negative value; if mvd_sign_flag[compIdx] is not present, the corresponding motion vector component difference is assumed to be equal to 0.

[0066] The derivation of the motion vector difference lMvd[compIdx] for compIdx=0..1 is as follows, and the value of lMvd[compIdx] must be in the range of -217 to 217-1.

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

[0068] In IBC mode, if refList is equal to 0 and compIdx=0..1 (0 indicates the horizontal component and 1 indicates the vertical component), MvdL0[x0][y0][compIdx] is set equal to lMvd[compIdx], which derives the horizontal and vertical components of BVD as follows:

[0069] bvd[0]=MvdL0[x0][y0][0] bvd[1]=MvdL0[x0][y0][1]

[0070] [Table 4]

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

[0072] [Table 5] [Table 6]

[0073] where bvd_sign_flag[compIdx] indicates the sign of the motion vector difference for a given (horizontal or vertical) component compIdx. If bvd_sign_flag[compIdx] is 0, the corresponding motion vector component difference has a positive value; otherwise (bvd_sign_flag[compIdx] is 1), the corresponding motion vector component difference has a negative value; if bvd_sign_flag[compIdx] is not present, the corresponding motion vector component difference is assumed to be equal to 0.

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

[0075] bvd[compIdx]=abs_bvd_greater0_flag[compIdx]×(abs_bvd_minus1[compIdx]+1)×(1-2×bvd_sign_flag[compIdx])

[0076] [Table 7]

[0077] As mentioned above, the current BVD code in IBC mode uses bypass coding, which is an equal-probability coding method that does not require adaptive probability updating. The probability of 0 and 1 is fixed at 1 / 2, respectively. This coding method is simple and does not allow adaptive updating based on video information or historical coding information. One BVD code corresponds to one bit in the bitstream, resulting in significant bitrate redundancy.

[0078] As can be seen, there is still a lot of room for improvement in the currently popular BVD coding scheme.

[0079] FIG. 3 shows an example of a block diagram of a video encoding system according to an embodiment of the present application. As shown in FIG. 3, the video encoding system 10 includes a transform and quantization unit 101, an intra estimation unit 102, an intra 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 buffer unit 110, etc., where the filtering unit 108 can realize deblocking filtering and Sample Adaptive Offset (SAO) filtering, and the encoding unit 109 can realize header information coding and Context-based Adaptive Binary Arithmetic Coding (CABAC). For the input original video signal, one video coding block can be obtained by dividing the coding tree unit (CTU), and then, for the residual pixel information obtained by intra prediction or inter prediction, the video coding block is transformed by the transform and quantization unit 101, which includes transforming the residual information from the pixel domain to the transform domain and quantizing the obtained transform coefficients, thereby further reducing the bit rate.The intra estimation unit 102 and the intra prediction unit 103 are configured to perform intra prediction on the video coding block. Specifically, the intra estimation unit 102 and the intra prediction unit 103 are configured to determine an intra prediction mode to be used for coding the video coding block. The motion compensation unit 104 and the motion estimation unit 105 are configured to perform inter predictive coding of the received video coding block on 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 a process of generating motion vectors, which are used to estimate the motion of the video coding block. The motion compensation unit 104 performs motion compensation based on the motion vectors determined by the motion estimation unit 105. After the intra prediction mode is determined, the intra prediction unit 103 is further configured to provide the selected intra prediction data to the encoding unit 109. The motion estimation unit 105 is also configured to send the calculated motion vector data to the encoding unit 109. Further, the inverse transform and inverse quantization unit 106 is configured to reconstruct the video coding block, the residual block is reconstructed in the pixel domain, the reconstructed residual block is subjected to blocking artifact removal by the filter control analysis unit 107 and the filtering unit 108, and the reconstructed residual block is added to one prediction block in the frame of the decoded picture buffer unit 110 to generate a reconstructed video coding block. The coding unit 109 is configured to code various coding parameters and quantized transform coefficients, and in a CABAC-based coding algorithm, the context content is based on neighboring coding blocks and encodes information indicating a determined intra-prediction mode, which can be used to output a bitstream of the video signal, and the decoded picture buffer unit 110 is configured to store the reconstructed video coding block used for prediction reference.As the encoding of the video pictures progresses, new reconstructed video coding blocks are continually generated, and all of these reconstructed video coding blocks are stored in the decoded picture buffer unit 110 .

[0080] 4 shows an example of a block diagram of a video decoding system according to an embodiment of the present application. As shown in FIG. 4, the video decoding system 20 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206. The decoding unit 201 can perform header information decoding and CABAC decoding, and the filtering unit 205 can perform deblocking filtering and SAO filtering. After performing the encoding process of FIG. 4 on an input video signal, a bitstream of the video signal is output. The bitstream is input to the video decoding system 20. First, the decoding unit 201 processes decoded transform coefficients, and the transform coefficients are processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the pixel domain. The intra prediction unit 203 is configured to generate prediction data for the current video decoded block based on the determined intra prediction mode and data of a previously decoded block from the current frame or picture. The motion compensation unit 204 is configured to determine prediction information for the video decoded block by analyzing the motion vectors and other related syntax elements, and use the prediction information to generate a prediction block for the video decoded block being decoded. A decoded video block is formed by adding the residual block from the inverse transform and inverse quantization unit 202 and the corresponding prediction block generated by the intra prediction unit 203 or the motion compensation unit 204. The decoded video signal is filtered by the filtering unit 205 to remove blocking artifacts and improve video quality. The decoded video block is then stored in the decoded image buffer unit 206, which is configured to store reference images used for subsequent intra prediction or motion compensation, and output the video signal to obtain a reconstructed original video signal.

[0081] The encoding method in the embodiment of the present application may be applied to the intra prediction unit 103 shown in FIG. 3 and the encoding unit 109 capable of implementing the CABAC encoding algorithm. The decoding method in the embodiment of the present application may also be applied to the intra prediction unit 203 shown in FIG. 4 and the decoding unit 201 capable of implementing the CABAC decoding algorithm. That is, the encoding / decoding method in the embodiment of the present application may be applied to a video encoding system, a video decoding system, or even simultaneously to both a video encoding system and a video decoding system, but the embodiment of the present application is not particularly limited thereto. It should be noted that when the encoding / decoding method is applied to a video encoding system, the "current block" specifically refers to a current encoding block in intra prediction, and when the encoding / decoding method is applied to a video decoding system, the "current block" specifically refers to a current decoding block in intra prediction.

[0082] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application.

[0083] An embodiment of the present application proposes a decoding method, which can be applied to a decoder. Figure 5 is a schematic diagram 1 of the decoding method in an embodiment of the present application. As shown in Figure 5, the method by which the decoder performs the decoding process may include the following steps:

[0084] In step 101, the bitstream is decoded to determine the BVD magnitude and BVD code index information of the current block.

[0085] In the present embodiment, the decoder can determine the BVD magnitude and BVD code index information of the current block by decoding the bitstream.

[0086] It should be noted that in this embodiment, the decoder can directly analyze the true BVD magnitude of the current block from the bitstream, i.e., the decoder can determine the BVD magnitude of the current block by decoding the bitstream.

[0087] Furthermore, in the embodiment of the present application, the decoder can also determine the BVD code index information of the current block by decoding the bitstream, that is, obtain the code prediction index of the current block by analysis.

[0088] As can be seen, in the present embodiment, the BVD absolute value includes a first component absolute value absBvdX and a second component absolute value absBvdY, i.e., the BVD absolute value includes a horizontal component absolute value and a vertical component absolute value. Correspondingly, the BVD of the current block may include a first component candBvdX and a second component candBvdY, and similarly, the candidate BVD of the current block may also include a first component candBvdX and a second component candBvdY, i.e., the BVD may include a horizontal component and a vertical component.

[0089] Furthermore, in the embodiment of the present application, if absBvdX and absBvdY are not both 0, it can be determined that the number of bits of the BVD code index information is 2, and if absBvdX or absBvdY is 0, it can be determined that the number of bits of the BVD code index information is 1.

[0090] In addition, in the embodiments of the present application, in addition to the fixed-length coding methods listed above, a variable-length coding method can also be adopted to encode the BVD code index information. For example, truncated unary coding can be adopted to encode the BVD code index information, that is, truncated binarization can be used to perform binarization. In this case, the number of bits of the BVD code index information is not necessarily two.

[0091] That is, in the embodiment of the present application, when the BVD code index information (where the BVD code index information may be an index value in the candidate BVD list) is encoded using a truncated unary code, the number of bits of the code index information corresponding to different candidate BVDs is not exactly the same, i.e., it is variable-length coded.

[0092] In the embodiment of the present application, the number of binary bits of the BVD code index information can be determined based on the BVD absolute value analyzed in the decoding process. Here, if the absolute values ​​of the horizontal and vertical components of the BVD are not both zero, the number of binary bits of the BVD code index information is 2. If the horizontal component of the BVD is zero and the absolute value of the vertical component is not zero, the number of binary bits of the BVD code index information is 1. If the horizontal component of the BVD is not zero and the absolute value of the vertical component is zero, the number of binary bits of the BVD code index information is 1.

[0093] The decoder can then parse the binary numbers corresponding to the BVD code index information from the bitstream using a decoding process corresponding to context-based adaptive binary arithmetic coding (CABAC) or bypass.

[0094] For the CABAC context model used for the BVD code index information, a single probability model or multiple probability models can be used, including, but not limited to, distinguishing between different probability models based on the absolute value of the horizontal or vertical components of the BVD, the sum or difference of the horizontal and vertical components of the BVD, etc.

[0095] For example, the absolute value of the horizontal or vertical component of the BVD is used to classify different probability models used for the bits of the BVD code index information of the BVD.

[0096] (1) Suppose the threshold used for classification using the absolute value of the horizontal or vertical component of BVD is THR0 and there are two probability models. When the BVD code index information is two bits, the 0th bit of this binary number is distinguished based on the magnitude relationship between the absolute value of the horizontal component of BVD and THR0. That is, if the absolute value of the horizontal component of BVD is equal to or less than THR0, the first probability model is used, and if the absolute value of the horizontal component of BVD is greater than THR0, the second probability model is used. The 1st bit of the above binary number is also distinguished based on the magnitude relationship between the absolute value of the vertical component of BVD and THR0. That is, if the absolute value of the vertical component of BVD is equal to or less than THR0, the first probability model is used, and if the absolute value of the vertical component of BVD is greater than THR0, the second probability model is used.

[0097] (2) Assuming that the threshold used for classification using the absolute value of the horizontal component of BVD is THR0 and the threshold used for classification using the absolute value of the vertical component is THR1, and there are a total of four probability models, if the BVD code index information is two bits, the zeroth bit of this binary number is distinguished based on the magnitude relationship between the absolute value of the horizontal component of BVD and THR0. That is, if the absolute value of the horizontal component of BVD is less than or equal to THR0, the first probability model is used, and if the absolute value of the horizontal component of BVD is greater than THR0, the second probability model is used. And the first bit of the above binary number is distinguished based on the magnitude relationship between the absolute value of the vertical component of BVD and THR1. That is, if the absolute value of the vertical component of BVD is less than or equal to THR1, the third probability model is used, and if the absolute value of the vertical component of BVD is greater than THR1, the fourth probability model is used.

[0098] Furthermore, in the embodiment of the present application, after determining the BVD absolute value of the current block, the BVD absolute value can be used to determine a BVD combination list, where the BVD combination list includes any number of candidate BVDs in the current block. That is, the BVD absolute value can be used to determine the candidate BVDs of the current block, which can also be understood as determining an initial set of candidate BVDs of the current block using the BVD absolute value.

[0099] In the embodiment of the present application, a list of BVD combinations (candidate BVDs) can be created for possible BVD signs and BVD absolute values. This list may include cases where only horizontal BVDs exist, only vertical BVDs exist, or both exist.

[0100] Furthermore, in the embodiment of the present application, generating a BVD combination list (candidate BVD) mainly involves permuting and combining possible BVD codes, and multiplying the possible horizontal and vertical codes by the horizontal absolute value components and vertical absolute value components of the BVD, respectively.

[0101] Illustratively, in an embodiment of the present application, when only vertical BVDs exist, ie, when absBvdX is 0, the candidate BVDs can be determined based on absBvdY.

[0102] For example, BVD is divided into horizontal and vertical components, and when the horizontal component is zero, only the vertical component is coded, so a combination list is created only for the code of the vertical component. Specifically, there are the following two cases:

[0103] First case: the horizontal components are all positive signs and are just placeholders, and the vertical components are first positive signs and then negative signs, to create a sign list, and then multiply the created sign list by the absolute values ​​of the horizontal and vertical components of the BVD to get a combined list of BVD.

[0104] { {+1,+1}, {+1,-1}, }; { { 0,+BVD VER}, { 0,-BVD VER}, }.

[0105] Second case: the horizontal components are all positive signs and are just placeholders, and the vertical components are first negative signs and then positive signs, to create a sign list, and then multiply the created sign list by the absolute values ​​of the horizontal and vertical components of the BVD to get a combined list of BVD.

[0106] { {+1,-1}, {+1,+1}, }; { { 0,-BVD VER}, { 0,+BVD VER}, }.

[0107] Illustratively, in an embodiment of the present application, when only horizontal BVDs exist, ie, when absBvdY is 0, the candidate BVDs can be determined based on absBvdX.

[0108] For example, BVD is divided into horizontal and vertical components, and when the vertical component is zero, only the horizontal component is coded, so a combination list is created only for the code of the horizontal component. Specifically, there are the following two cases:

[0109] First case: all vertical components are positive signs and are just placeholders, and horizontal components are first positive signs and then negative signs to create a sign list, and then multiply the created sign list by the absolute values ​​of the vertical and horizontal components of BVD to get a combined list of BVD.

[0110] { {+1,+1}, {-1,+1}, }; { {+BVD HOR ,0}, {-BVD HOR ,0}, }.

[0111] In the second case, the vertical components are all positive signs and are just placeholders, and the horizontal components are first negative signs and then positive signs to create a sign list, and then multiply the created sign list by the absolute values ​​of the vertical and horizontal components of the BVD to get a combined list of BVD.

[0112] { {-1,+1}, {+1,+1}, }; { {-BVD HOR ,0}, {+BVD HOR ,0}, }.

[0113] Illustratively, in an embodiment of the present application, when both horizontal BVD and vertical BVD exist, ie, when absBvdX and absBvdY are not both zero, a candidate BVD can be determined based on absBvdX and absBvdY.

[0114] For example, BVD is divided into horizontal and vertical components. If both components are non-zero, they must be coded. Therefore, the horizontal and vertical components are combined to create a BVD list. Specifically, the list is divided into 24 cases, which are any permutation of the four combinations {+1,+1}, {+1,-1}, {-1,+1}, and {-1,-1}. Examples are given below.

[0115] At the 0th position of the list, both the horizontal and vertical components are positive, at the 1st position of the list, the horizontal component is positive and the vertical component is negative, at the 2nd position of the list, the horizontal component is negative and the vertical component is positive, and at the 3rd position of the list, both the horizontal and vertical components are negative, a code list is created, and then the created code list is multiplied by the absolute values ​​of the vertical and horizontal components of the BVD to obtain a BVD combination list.

[0116] { {+1,+1}, {+1,-1}, {-1,+1}, {-1,-1}, }; { {+BVD HOR ,+BVD VER}, {+BVD HOR ,-BVD VER}, {-BVD HOR ,+BVD VER}, {-BVD HOR ,-BVD VER}, }.

[0117] In step 102, a sorting process is performed on the candidate BVDs of the current block based on the BVD absolute value of the current block, and the sorting result is determined.

[0118] In the embodiment of the present application, after determining the BVD absolute value and BVD code index information of the current block, a sorting process can be further performed on the candidate BVDs of the current block based on the BVD absolute value of the current block, and the sorting result can be determined.

[0119] Furthermore, in an embodiment of the present application, when performing a sorting process on the candidate BVDs of the current block based on the BVD absolute value of the current block and determining the sorting result, a first cost value corresponding to one or more candidate BVDs of the current block can be determined based on the BVD absolute value, and then the candidate BVDs can be sorted based on the first cost value to determine the sorting result.

[0120] As can be appreciated, in an embodiment of the present application, one or more candidate BVDs may include BVDs with candBvdX set equal to −absBvdX or absBvdX, respectively, and candBvdY set equal to −absBvdY or absBvdY, respectively.

[0121] In addition, in an embodiment of the present application, when determining a first cost value corresponding to one or more candidate BVDs of the current block based on the BVD absolute value of the current block, a first matching template can be first determined based on the candidate BVDs, and then the matching error between the first template of the current block and the first matching template can be calculated based on a predetermined error criterion to determine the first cost value corresponding to the candidate BVDs.

[0122] For example, in the embodiment of the present application, when calculating the cost, i.e., when determining the first cost value, there are multiple options for the cost function for calculating the cost of the template region, that is, there are multiple options for the predetermined error criterion. For example, evaluation criteria such as sum of absolute error (SAD), sum of absolute transformed error (SATD), sum of squared differences (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), rate distortion optimization (RDO), etc. can be selected. The evaluation criteria mentioned in the following content can be any one of the above criteria. Taking the evaluation criterion of SAD as an example, the calculation formula is as follows:

[0123]

number

[0124] That is, in an embodiment of the present application, the predetermined error criterion may include any one of the following: sum of absolute error (SAD), sum of absolute transformed error (SATD), sum of squared differences (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), and rate-distortion optimization (RDO).

[0125] As can be seen, in the present embodiment, the first template comprises one or more sample values ​​in adjacent decoded regions of the current block.

[0126] For example, in an embodiment of the present application, when selecting a template (first template for a current block), it can be determined whether a pixel at the template position is available and contains reconstructed luminance information based on the availability of pixels in the neighboring regions of the current block. Figure 6 is a schematic diagram of template types. As shown in Figure 6, templates can be classified into template types such as top template, left template, top right template, bottom left template, and top left template based on the relative positional relationship between the template and the current block. Here, the template sizes of different types for different coding blocks may be fixed to the same size or may be different.

[0127] For example, regarding the template size, the same template size is selected for any current coding block (current block), and the following equation shows an example of the template size setting conditions, where nTbW and nTbH are the width and height of the current luminance coding block (current block), respectively, and iTempW and iTempH are the width and height of the adopted template, respectively.

[0128]

number

[0129]

number

[0130] For example, different template sizes can be selected based on the number of pixels in the current luminance coding block. The following equation shows an example of the template size setting conditions, where nTbW and nTbH are the width and height of the current luminance coding block, respectively, nTbW × nTbH is the number of pixels in the current luminance coding block, and iTempW and iTempH are the width and height of the adopted template, respectively.

[0131]

number

[0132] In addition, in the 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 first determined, and then the candidate BV of the current block can be determined based on the BVP and the candidate BVD, where the candidate BV indicates the position of the first matching template, and then the first matching template can be determined based on the candidate BV.

[0133] For example, in an embodiment of the present application, assuming that the BVP includes a third component currBvpX and a fourth component currBvpY, when determining a candidate BV for a current block based on the BVP and a candidate BVD, the two-dimensional vector of the candidate BV can be set to (currBvpX+candBvdX, currBvpY+candBvdY), that is, the two-dimensional vector of the BV can be 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 the BVP.

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

[0135] For example, in an embodiment of the present application, starting from the position of the current point, an area indicated by the two-dimensional vector of the candidate BV that has the same shape and contains the same number of sample values ​​as the first template can be determined as the first matching template.

[0136] When performing BV prediction for a current block, a new BV can be generated using the combination 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 (conditions for availability include that the reference block pointed to by the BV has already been reconstructed and does not exceed the search range and image boundary set by IBC). If the current BV is available, motion compensation is performed using the template of the current block and the new BV to obtain a template with the corresponding BV. Figure 9 is a schematic diagram of BVD combination. As shown in Figure 9, the horizontal and vertical components of the BVD generate a total of four combined BVDs, and motion compensation is performed using each template. There are several cases for using templates when calculating costs:

[0137] First case: If the top template and the left template of the current block both exist, and the top template and the left template both exist in the corresponding BV, then both the top template and the left template are available.

[0138] Second case: If both the top template and the left template of the current block exist, but only the top template exists in the corresponding BV, there are two methods: Method 1: The left template does not exist in the corresponding BV, so it is not used directly, i.e., calculation is performed using only the top template; Method 2: If the left template does not exist in the corresponding BV, the leftmost template width column in the reference block is used instead of the left template, i.e., calculation is performed using the top template and the left template.

[0139] Third case: If both the top template and the left template of the current block exist, but only the left template exists in the corresponding BV, there are two methods: Method 1: The top template does not exist in the corresponding BV, so it is not used directly, i.e., calculation is performed using only the left template; Method 2: If the top template does not exist in the corresponding BV, the topmost template height row in the reference block is used instead of the top template, i.e., calculation is performed using the top template and the left template.

[0140] Fourth case: If only the top template of the current block exists, there are three ways: Method 1: The top template does not exist in the corresponding BV and is not used directly; Method 2: If the top template does not exist in the corresponding BV, the topmost template height row in the reference block is adopted instead of the top template; Method 3: If the top template exists in the corresponding BV, it is used directly.

[0141] Fifth case: If only the left template of the current block exists, there are three ways: Method 1: The left template does not exist in the corresponding BV and is not used directly; Method 2: If the left template does not exist in the corresponding BV, the leftmost template width column in the reference block is adopted instead of the left template; Method 3: If the left template exists in the corresponding BV, it is used directly.

[0142] Sixth case: If the top template and left template of the current block both do not exist, the BVD combination in this case is ignored.

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

[0144] Furthermore, in the present embodiment, if both of the above two templates are available, processing is performed on these templates, including but not limited to weighted fusion of both templates, and the calculation method for the processing is as follows:

[0145] cost=w_0×above+w_1×left

[0146] Here, as the basis for weighted fusion, a fixed weighting coefficient can be selected, or a weighting coefficient can be assigned based on the sum of the absolute values ​​of the differences between the reconstructed luminance pixel values ​​of each template and the predicted luminance pixel values. The calculation formula for the latter weighting coefficient 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.

[0147]

number

[0148] As can be seen from this, in the embodiment of the present application, template prediction is performed based on the BVP and BVD combination list (candidate BVD) of the current block, and the cost (first cost value) of each BVD combination (candidate BVD) in the BVD combination list is calculated (i.e., the cost of the template region is calculated). For various combinations in the BVD combination list, costs can be calculated using templates. Specifically, the cost can be calculated using the reconstructed luminance pixel at the template position of the current block and the reconstructed luminance pixel at the position obtained by performing template prediction using the BV obtained by combining the BVP and BVD of the current block.

[0149] In the embodiment of the present application, not only luminance but also chromaticity, i.e., Cb and Cr components, can be used when calculating the cost (first cost value), although the present application is not particularly limited thereto.

[0150] Furthermore, in an embodiment of the present application, after calculating the first cost value of each candidate BVD, the candidate BVDs are sorted using the first cost value to obtain a sorted result. Here, the sorted result may be a candidate BVD list of the current block after sorting, or a candidate BVD set of the candidate BVDs with the smallest first cost value determined by sorting. The present application is not specifically limited thereto.

[0151] In addition, in the embodiment of the present application, if the sorting result is a candidate BVD list of the current block, correspondingly, the sorting execution process may be to sort the candidate BVDs based on the first cost value and determine the candidate BVD list of the current block, where the candidate BVD list includes at least one candidate BVD.

[0152] Furthermore, in an embodiment of the present application, when sorting candidate BVDs based on the first cost value to determine the candidate BVD list for the current block, one or more candidate BVDs can be sorted in order of the smallest matching error indicated by the first cost value based on a predetermined error criterion to determine the candidate BVD list.

[0153] As can be understood, in the embodiment of the present application, the sorting result may be a new list OrderedList (candidate BVD list of the current block) sorted in ascending (descending) order. For example, sorting methods such as bubble sort, selection sort, insertion sort, shell sort, merge sort, quick sort, radix sort, heap sort, counting sort, packet sort, etc. may be adopted.

[0154] Furthermore, in the present embodiment, the sorting result may further be a new list OrderedList (the candidate BVD list of the current block) sorted in a specific order.

[0155] For example, in an embodiment of the present application, when sorting candidate BVDs based on the first cost value to determine the candidate BVD list of the current block, if absBvdX and absBvdY are not both 0, the candidate BVDs are stored in a first array and a second array, respectively. Then, based on the first cost value, the first candidate BVD and the second candidate BVD can be determined from the first array, and the third candidate BVD and the fourth candidate BVD can be determined from the second array. Finally, based on the first cost value, a sorting process can be performed on the first candidate BVD, the second candidate BVD, the third candidate BVD, and the fourth candidate BVD to determine the candidate BVD list.

[0156] If both the horizontal and vertical components of the BVD exist, that is, if absBvdX and absBvdY are not both 0, the combination list (candidate BVD) is {(+BVD HOR ,+BVD VER ),(+BVD HOR ,-BVD VER ),(-BVD HOR ,-BVD VER ),(-BVD HOR ,+BVD VER )} and the 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 elements in the above two lists can be rearranged in any order.

[0157] Two arrays, posiGrp and negativeGrp, are defined, where posiGrp stores two BVD combinations with positive signs in the same component (horizontal), and negativeGrp stores two BVD combinations with negative signs in the same component (horizontal).

[0158] posiGrp={(+BVD HOR ,+BVD VER ),(+BVDHOR ,-BVD VER )},negaGrp={(-BVD HOR ,+BVD VER ),(-BVD HOR ,-BVD VER )}. The order of the elements in the two lists, posiGrp and negaGrp, can be rearranged in any order.

[0159] First comparison: Cost (+BVD HOR ,+BVD VER ) and Cost(+BVD HOR ,-BVD VER ) and set posiGrp[0] to the BVD combination with the smaller cost, and set posiGrp[1] to the BVD combination with the larger cost.

[0160] Second comparison: Cost(-BVD HOR ,+BVD VER ) and Cost(-BVD HOR ,-BVD VER ) and set negativeGrp[0] to the BVD combination with the smaller cost, and set negativeGrp[1] to the BVD combination with the larger cost.

[0161] Third comparison: Compare the magnitude of the Cost corresponding to posiGrp[0] and negaGrp[0].

[0162] In addition, in the embodiment of the present application, when sorting the first, second, third, and fourth candidate BVDs based on the first cost value to determine the candidate BVD list, one available method is as follows: if the first cost value of the first candidate BVD is less than or equal to the first cost 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. If the first cost value of the first candidate BVD is greater than the first cost 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.

[0163] Correspondingly, the final sorting process may be as follows: in the third comparison, if the Cost corresponding to posiGrp[0]≦the Cost corresponding to negaGrp[0], then place posiGrp[0] in the 0th position of the candidate BVD list OrderedList, place negaGrp[0] in the 1st position of the candidate BVD list OrderedList, place posiGrp[1] in the 2nd position of the candidate BVD list OrderedList, and place negaGrp[1] sort in the 3rd position of the candidate BVD list OrderedList.

[0164] In the third comparison, if the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0], place negativeGrp[0] in the 0th position of the candidate BVD list OrderedList, place posiGrp[0] in the 1st position of the candidate BVD list OrderedList, place negativeGrp[1] in the 2nd position of the candidate BVD list OrderedList, and place posiGrp[1] in the 3rd position of the candidate BVD list OrderedList.

[0165] Here, the candidate BVD at the 0th position of the candidate BVD list of the current block is the first candidate BVD in the candidate BVD list, the candidate BVD at the 1st position is the second candidate BVD in the candidate BVD list, the candidate BVD at the 2nd position is the third candidate BVD in the candidate BVD list, and the candidate BVD at the 3rd position is the fourth candidate BVD in the candidate BVD list.

[0166] In addition, in the embodiment of the present application, when sorting the first, second, third, and fourth candidate BVDs based on the first cost value and determining the candidate BVD list, another available method is as follows: if the first cost value of the first candidate BVD is less than or equal to the first cost 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. If the first cost value of the first candidate BVD is greater than the first cost 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.

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

[0168] In the third comparison, if the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0], place negativeGrp[0] in the 0th position of the candidate BVD list OrderedList, place posiGrp[0] in the 2nd position of the candidate BVD list OrderedList, place negativeGrp[1] in the 1st position of the candidate BVD list OrderedList, and place posiGrp[1] in the 3rd position of the candidate BVD list OrderedList.

[0169] Illustratively, in an embodiment of the present application, when sorting candidate BVDs based on the first cost value to determine a candidate BVD list for a current block, if absBvdX or absBvdY is equal to 0, the candidate BVD with the smallest first cost 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.

[0170] If only the horizontal or vertical component of the BVD exists, that is, if absBvdX or absBvdY is 0, a sorting process can be performed on the two candidate BVDs directly based on the first cost value to generate a candidate BVD list.

[0171] If only the vertical component of BVD exists, the combination list is {(0, +BVD VER ),(0,-BVD VER )} and the corresponding cost list is {Cost(0,+BVD VER ),Cost(0,-BVD VER )}. The order of the elements in the above two lists can be rearranged in any order.

[0172] The sorting process is as follows: Cost(0,+BVD VER ) and Cost(0,-BVD VER ) to compare their sizes.

[0173] Cost(0,+BVD VER)≦Cost(0,-BVD VER ), then (0,+BVD VER ) is placed at the 0th position of the candidate BVD list OrderedList, and (0,-BVD VER ) is placed at the first position of the candidate BVD list OrderedList.

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

[0175] If only the horizontal component of BVD exists, the combination list is {(+BVD HOR ,0),(-BVD HOR ,0)} and the corresponding cost list is {Cost(+BVD HOR ,0),Cost(-BVD HOR ,0)}. The order of the elements in the above two lists can be rearranged in any order.

[0176] The sorting process is as follows: Cost(+BVD HOR ,0) and Cost(-BVD HOR ,0) and compare their sizes.

[0177] Cost(+BVD HOR ,0)≦Cost(-BVD HOR ,0), then (+BVD HOR ,0) is placed at the 0th position of the candidate BVD list OrderedList, and (-BVD HOR ,0) is placed in the first position of the candidate BVD list OrderedList.

[0178] Cost(+BVD HOR ,0)>Cost(-BVD HOR ,0), then (-BVD HOR,0) is placed at the 0th position of the candidate BVD list OrderedList, and (+BVD HOR ,0) is placed in the first position of the candidate BVD list OrderedList.

[0179] In addition, in the embodiment of the present application, if the sorting result is a candidate BVD set of the current block, correspondingly, the sorting execution process may be to sort the candidate BVDs based on the first cost value and determine the candidate BVD set of the current block, where the candidate BVD set includes at least one candidate BVD.

[0180] Furthermore, when sorting the candidate BVDs based on the first cost value to determine the candidate BVD set for the current block, if absBvdX and absBvdY are not both 0, the candidate BVDs are stored in a first array and a second array, respectively; then, the fifth candidate BVD with the smallest first cost value is determined from the first array, and the sixth candidate BVD with the smallest first cost value is determined from the second array; and finally, the candidate BVD with the smallest first cost value among the fifth and sixth candidate BVDs can be determined as the minimum-cost BVD in the candidate BVD set.

[0181] If both horizontal and vertical components of BVD exist, i.e., absBvdX and absBvdY are not both 0, then assume that the combination list is {(+,+),(+,-),(-,-),(-,+)} and the corresponding cost list is {Cost(+,+),Cost(+,-),Cost(-,-),Cost(-,+)}. The order of the elements in the above two lists can be rearranged in any order.

[0182] Two arrays, posiGrp and negativeGrp, are defined. posiGrp stores the sign combinations of two BVDs with positive signs in the same component (horizontal), and negativeGrp stores the sign combinations of two BVDs with negative signs in the same component (horizontal).

[0183] Assume that posiGrp={(+,+),(+,-)} and negaGrp={(-,+),(-,-)}. The order of the elements in the two lists, posiGrp and negaGrp, can be rearranged in any order.

[0184] First comparison: Compare the magnitudes of Cost(+,+) and Cost(+,-), and set posiGrp[0] to the sign combination of the BVD with the smaller cost, and set posiGrp[1] to the sign combination of the BVD with the larger cost.

[0185] Second comparison: Compare the magnitudes of Cost(-,+) and Cost(-,-), and set negativeGrp[0] to the sign combination of the BVD with the smaller cost, and set negativeGrp[1] to the sign combination of the BVD with the larger cost.

[0186] Third comparison: Compare the magnitude of the Cost corresponding to posiGrp[0] and negaGrp[0].

[0187] This makes it possible to determine the code combination of one BVD with the smallest cost, that is, to determine the smallest cost BVD in the candidate BVD set.

[0188] If there is only a horizontal or vertical component of the BVD, i.e., if absBvdX or absBvdY is 0, the two candidate BVDs can be sorted directly based on the first cost value to determine the smallest cost BVD in the candidate BVD set.

[0189] Illustratively, in an embodiment of the present application, when sorting candidate BVDs based on the first cost value to determine a candidate BVD set for a current block, if absBvdX or absBvdY is equal to 0, the candidate BVD with the smallest first cost value among the candidate BVDs can be determined as the minimum-cost BVD in the candidate BVD set.

[0190] If only the vertical component of the BVD exists, assume that the combination list is {(+,+),(+,-)} and the corresponding cost list is {Cost(+,+),Cost(+,-)}. The order of the elements in the above two lists can be rearranged in any order. The comparison process is as follows: By comparing the magnitudes of Cost(+,+) and Cost(+,-), the code combination of the BVD with the smallest cost can be determined, that is, the smallest-cost BVD in the candidate BVD set can be determined.

[0191] If there is only a horizontal component of the BVD, assume that the combination list is {(+,+),(-,+)} and the corresponding cost list is {Cost(+,+),Cost(-,+)}. The order of the elements in the above two lists can be rearranged in any order. The comparison process is as follows: By comparing the magnitudes of Cost(+,+) and Cost(-,+), the code combination of the BVD with the smallest cost can be determined, that is, the smallest-cost BVD in the candidate BVD set can be determined.

[0192] In step 103, the BVD of the current block is determined based on the BVD code index information and the sorting result.

[0193] In the embodiment of the present application, the candidate BVDs of the current block are sorted based on the BVD absolute value of the current block, and the sorting result is determined. Then, the BVD of the current block can be determined based on the BVD code index information and the sorting result.

[0194] In the present embodiment, if the candidate BVD list of the current block obtained by the sorting process is an ascending (descending) list, it is possible to choose whether to indirectly obtain the true BVD code using the conversion list or to directly obtain the true BVD code by logical inference.

[0195] Here, when a true BVD code is indirectly obtained using a transformation list, the BVD combination list OrderedList can first be transformed into an index transformation list TransformedList according to the transformation rules.

[0196] For example, in the embodiment of the present application, a transformation process is performed on the candidate BVD list to determine an index transformation list (TransformedList).

[0197] Furthermore, in an embodiment of the present application, when determining the BVD of the current block based on the BVD code index information and the sorting result, if absBvdX and absBvdY are not both 0, when the value of the first bit of the BVD code 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 or third candidate BVD in the index conversion list, and then the candBvdY of the BVD of the current block can be determined based on the first or third candidate BVD.

[0198] Furthermore, in an embodiment of the present application, when determining the candBvdY of the BVD of the current block based on the first candidate BVD or the third candidate BVD, if the value of the second bit of the BVD code 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, and 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.

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

[0200] Furthermore, in an embodiment of the present application, when determining the candBvdY of the BVD of the current block based on the second candidate BVD or the fourth candidate BVD, if the value of the second bit of the BVD code 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, and 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.

[0201] That is, in the present embodiment, when both horizontal and vertical components of BVD are present, the symbol prediction index of BVD is 2 bits.

[0202] Assume that the sorted BVD combination list OrderedList is as follows:

[0203] [Table 8]

[0204] Using the following conversion rules, the sorted BVD combination list OrderedList is converted into a TransformedList (index-transformed list).

[0205] The BVD combination with the smallest cost after sorting is placed in the 0th position of the TransformedList list, i.e., (a1, a2) is placed in the 0th position of the TransformedList list. The BVD combination with the same sign as a1 is placed in the 2nd position of the TransformedList list, i.e., assuming that b1 has the same sign as a1, (b1, b2) is placed in the 2nd position of the TransformedList list. The BVD combination with the smaller cost and with the opposite sign to a1 is placed in the 1st position of the TransformedList list, i.e., (c1, c2) is placed in the 1st position of the TransformedList list. The BVD combination with the larger cost and with the opposite sign to a1 is placed in the 3rd position of the TransformedList list, i.e., (d1, d2) is placed in the 3rd position of the TransformedList list.

[0206] Then, the index transformation list TransformedList will look like this:

[0207] [Table 9]

[0208] For the index transformation list, obtain the true BVD code according to the following rules, where the analyzed code prediction index is equal to the index of the leftmost column of the table.

[0209] Analyze the 0th bit of the code prediction index.

[0210] If the 0th bit is 0, the horizontal component of the true BVD is equal to a1, and check its vertical component. If the 1st bit is 0, the vertical component of the true BVD is equal to a2, and if the 1st bit is 1, the vertical component of the true BVD is equal to -a2.

[0211] If the 0th bit is 1, the horizontal component of the true BVD is equal to -a1, and check the vertical component of the candidate BVD with index 1. If the 1st bit is 0, the vertical component of the true BVD is equal to c2, and if the 1st bit is 1, the vertical component of the true BVD is equal to -c2.

[0212] For example, assume that the sorted BVD combination list OrderedList is as follows:

[0213] [Table 10]

[0214] According to the transformation rules, the sorted BVD combination list OrderedList is transformed into TransformedList.

[0215] [Table 11] (1) Assuming that the analyzed bvsdIdx=0, the true BVD combination is -BVD HOR , vertical component is +BVD VER This becomes:

[0216] (2) Assuming that the analyzed bvsdIdx=2, the true BVD combination is -BVD HOR , the vertical component is -BVD VER This becomes:

[0217] (3) Assuming that the analyzed bvsdIdx=1, the true BVD combination is the horizontal component +BVD HOR , vertical component is +BVD VER This becomes:

[0218] (4) Assuming that the analyzed bvsdIdx=3, the true BVD combination is the horizontal component +BVD HOR , the vertical component is -BVD VER This becomes:

[0219] Furthermore, in an embodiment of the present application, when determining the BVD of the current block based on the BVD code index information and the sorting result, if absBvdX is 0, when the value of the BVD code 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, and when the value of the BVD code 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.

[0220] That is, in the present embodiment, if a vertical component of BVD exists, the symbol prediction index of BVD is 1 bit.

[0221] Assume that the sorted BVD combination list OrderedList is as follows:

[0222] [Table 12]

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

[0224] The index transformation list TransformedList is as follows:

[0225] [Table 13]

[0226] For the index transformation list, obtain the true BVD code according to the following rules, where the analyzed code prediction index is equal to the index of the leftmost column of the table.

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

[0228] For example, assume that the sorted BVD combination list OrderedList is as follows:

[0229] [Table 14]

[0230] The index transformation list TransformedList is as follows:

[0231] [Table 15]

[0232] (1) Assuming the code prediction index is as follows:

[0233] bvsdIdx=0 In this case, the horizontal component of the true BVD is 0 and the vertical component is +BVD VER is.

[0234] (2) Assuming the code prediction index is:

[0235] bvsdIdx=1 In this case, the horizontal component of the true BVD is 0 and the vertical component is -BVD VER is.

[0236] Furthermore, in an embodiment of the present application, when determining the BVD of the current block based on the BVD code index information and the sorting result, if absBvdY is 0, when the value of the BVD code 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, and when the value of the BVD code 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.

[0237] That is, in the present embodiment, if a horizontal component of BVD exists, the symbol prediction index of BVD is 1 bit.

[0238] Assume that the sorted BVD combination list OrderedList is as follows:

[0239] [Table 16]

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

[0241] The index transformation list TransformedList is as follows:

[0242] [Table 17]

[0243] For the index transformation list, obtain the true BVD code according to the following rules, where the analyzed code prediction index is equal to the index of the leftmost column of the table.

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

[0245] For example, assume that the sorted BVD combination list OrderedList is as follows:

[0246] [Table 18]

[0247] The index transformation list TransformedList is as follows:

[0248] [Table 19]

[0249] (1) Assuming the code prediction index is as follows:

[0250] bvsdIdx=0 In this case, the horizontal component of the true BVD is +BVD HOR and the vertical component is 0.

[0251] (2) Assuming the code prediction index is:

[0252] bvsdIdx=1 In this case, the horizontal component of the true BVD is -BVD HOR and the vertical component is 0.

[0253] Furthermore, in an embodiment of the present application, if logical inference is used to obtain the true BVD code, when determining the BVD of the current block based on the BVD code index information and the candidate BVD list, if absBvdX and absBvdY are not both 0, if the value of the first bit of the BVD code 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 it is determined that they are different. Then, the candidate BVD list is traversed to determine the first candidate BVD that has the same candBvdX as the BVD of the current block. If the value of the second bit of the BVD code 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 it is determined that they are different.

[0254] In the first case, both the horizontal and vertical components of the BVD are present, in which case the BVD code prediction index is 2 bits.

[0255] Assume that the sorted BVD combination list OrderedList is as follows:

[0256] [Table 20]

[0257] If the 0th bit of the code prediction index of the analyzed BVD 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, i.e., the inverse of a1. In this case, the horizontal component of the true BVD is determined to be e1. Next, 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 and assumed to be f2. If the 1st bit is 0, the vertical component of the true BVD is equal to f2. If the 1st bit is 1, the vertical component of the true BVD is equal to -f2, i.e., the inverse of f2. In this case, the vertical component of the true BVD is determined to be e2. In this way, the true BVD, i.e., the BVD whose horizontal component is e1 and whose vertical component is e2, is obtained.

[0258] For example, assume that the sorted BVD combination list OrderedList is as follows:

[0259] [Table 21]

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

[0261] In this case, the horizontal component of the true BVD is -BVD HOR and the vertical component is +BVD VER is.

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

[0263] In this case, the horizontal component of the true BVD is +BVD HOR and the vertical component is +BVD VER is.

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

[0265] In this case, the horizontal component of the true BVD is -BVD HOR and the vertical component is -BVD VER is.

[0266] (4) Assume that the 0th bit of the analyzed BVD symbol prediction index is 1 and the 1st bit is 1.

[0267] In this case, the horizontal component of the true BVD is +BVD HOR and the vertical component is -BVD VER is.

[0268] Furthermore, in the embodiment of the present application, if logical inference is used to obtain the true BVD code, when determining the BVD of the current block based on the BVD code index information and the candidate BVD list, if absBvdX is 0, when the value of the BVD code 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, and when the value of the BVD code 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.

[0269] In the second case, only the vertical component of the BVD is present, in which case the symbol prediction index of the BVD is 1 bit.

[0270] Assume that the sorted BVD combination list OrderedList is as follows:

[0271] [Table 22]

[0272] If the 0th bit of the code prediction index of the analyzed BVD is 0, the vertical component of the true BVD is equal to a2, and if the 0th bit is 1, the vertical component of the true BVD is equal to -a2, i.e., the inverse of a2, at this time, it is determined that the vertical component of the true BVD is e1 and the horizontal component is 0. In this way, the true BVD, i.e., the BVD whose horizontal component is 0 and whose vertical component is e2, is obtained.

[0273] For example, assume that the sorted BVD combination list OrderedList is as follows:

[0274] [Table 23]

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

[0276] In this case, the horizontal component of the true BVD is 0 and the vertical component is +BVD VER is.

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

[0278] In this case, the horizontal component of the true BVD is 0 and the vertical component is -BVD VER is.

[0279] Furthermore, in the embodiment of the present application, if logical inference is used to obtain the true BVD code, when determining the BVD of the current block based on the BVD code index information and the candidate BVD list, if absBvdY is 0, when the value of the BVD code 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, and when the value of the BVD code 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.

[0280] In the third case, only the horizontal component of the BVD is present, in which case the symbol prediction index of the BVD is 1 bit.

[0281] Assume that the sorted BVD combination list OrderedList is as follows:

[0282] [Table 24]

[0283] If the 0th bit of the code prediction index of the analyzed BVD is 0, the horizontal component of the true BVD is equal to a1, and if the 0th bit is 1, the horizontal component of the true BVD is equal to -a1, i.e., the inverse of a1, at this time, it is determined that the horizontal component of the true BVD is e1 and the vertical component is 0. In this way, the true BVD, i.e., the BVD whose horizontal component is e1 and whose vertical component is 0, is obtained.

[0284] For example, assume that the sorted BVD combination list OrderedList is as follows:

[0285] [Table 25]

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

[0287] In this case, the horizontal component of the true BVD is +BVD HOR and the vertical component is 0.

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

[0289] In this case, the horizontal component of the true BVD is -BVD HOR and the vertical component is 0.

[0290] In the present embodiment, if the candidate BVD list for the current block obtained by sorting is a list in a specific order, when determining the BVD for the current block, the candidate BVD indicated by the BVD code index information in the candidate BVD list can be directly determined as the BVD for the current block. Here, the sorted BVD combination list OrderedList can be directly substituted into 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 BVD code prediction index is the true BVD.

[0291] As can be understood, in the embodiment of the present application, when the candidate BVD list of the current block obtained by the sorting process is a list in a specific order, the encoding side can simultaneously encode two components corresponding to the BVDs, and correspondingly, the decoding side can directly determine the two components corresponding to the BVDs based on the BVD code index information.

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

[0293] Accordingly, in the embodiment of the present application, the decoding side analyzes the combination index (BVD code index information) to simultaneously obtain the horizontal and vertical components, while on the encoding side, the encoder can use a traversal method to determine the index (BVD code index information) to be transmitted.

[0294] As can be understood, in the embodiment of the present application, when the candidate BVD list determined by sorting the matching errors indicated by the first cost value in ascending order, i.e., the candidate BVD list of the current block is an ascending (descending) list, the candidate BVD indicated by the BVD code index information in the candidate BVD list can also be directly determined as the BVD of the current block.

[0295] In the first case, both the horizontal and vertical components of the BVD are present, in which case the BVD code prediction index is 2 bits.

[0296] Assume that the sorted BVD combination list OrderedList is as follows:

[0297] [Table 26]

[0298] In this case, the index transformation list TransformedList is as follows:

[0299] [Table 27]

[0300] For the index transformation list, obtain the true BVD code according to the following rules, where the analyzed code prediction index is equal to the index of the leftmost column of the table.

[0301] Analyze the 0th bit of the code prediction index: If the 0th bit is 0, the horizontal component of the true BVD is equal to a1, and check its vertical component. If the 1st bit is 0, the vertical component of the true BVD is equal to a2, and if the 1st bit is 1, the vertical component of the true BVD is equal to -a2.

[0302] If the 0th bit is 1, the horizontal component of the true BVD is equal to -a1, and check the vertical component of the candidate BVD with index 1. If the 1st bit is 0, the vertical component of the true BVD is equal to c2, and if the 1st bit is 1, the vertical component of the true BVD is equal to -c2.

[0303] For example, assume that the sorted BVD combination list OrderedList is as follows:

[0304] [Table 28]

[0305] In this case, the TransformedList is:

[0306] [Table 29]

[0307] (1) Assuming the analysis results are as follows:

[0308] bvsdIdx=0 In this case, the true BVD combination is the horizontal component -BVD HOR , vertical component is +BVD VER This becomes:

[0309] (2) Assuming the analysis results are as follows: bvsdIdx=2

[0310] In this case, the true BVD combination is the horizontal component -BVD HOR , the vertical component is -BVD VER This becomes:

[0311] (3) Assuming the analysis results are as follows: bvsdIdx=1

[0312] In this case, the true BVD combination is the horizontal component +BVD HOR , vertical component is +BVD VER This becomes:

[0313] (4) Assuming the analysis results are as follows: bvsdIdx=3

[0314] In this case, the true BVD combination is the horizontal component +BVD HOR , the vertical component is -BVD VER This becomes:

[0315] In the second case, only the vertical component of the BVD is present, in which case the symbol prediction index of the BVD is 1 bit.

[0316] Assume that the sorted BVD combination list OrderedList is as follows:

[0317] [Table 30]

[0318] In this case, the index transformation list TransformedList is as follows:

[0319] [Table 31]

[0320] For the index transformation list, obtain the true BVD code according to the following rules, where the analyzed code prediction index is equal to the index of the leftmost column of the table.

[0321] If the 0th bit is 0, the vertical component of the true BVD is equal to a2; otherwise, the vertical component of the true BVD is equal to -a2.

[0322] For example, assume that the sorted BVD combination list OrderedList is as follows:

[0323] [Table 32]

[0324] The TransformedList is as follows:

[0325] [Table 33]

[0326] (1) Assuming that the analyzed code prediction index is as follows: bvsdIdx=0

[0327] In this case, the horizontal component of the true BVD is 0 and the vertical component is +BVD VER is.

[0328] (2) Assuming that the analyzed code prediction index is as follows:

[0329] bvsdIdx=1 In this case, the horizontal component of the true BVD is 0 and the vertical component is -BVD VER is.

[0330] In the third case, only the horizontal component of the BVD is present, in which case the symbol prediction index of the BVD is 1 bit.

[0331] Assume that the sorted BVD combination list OrderedList is as follows:

[0332] [Table 34]

[0333] In this case, the index transformation list TransformedList is as follows:

[0334] [Table 35]

[0335] For the index conversion list, obtain the true BVD code according to the following rules, where the analyzed code prediction index is equal to the index of the leftmost column of the table.

[0336] If 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.

[0337] For example, assume that the sorted BVD combination list OrderedList is as follows:

[0338] [Table 36]

[0339] The TransformedList is as follows:

[0340] [Table 37]

[0341] (1) Assuming that the analyzed code prediction index is as follows: bvsdIdx=0

[0342] In this case, the horizontal component of the true BVD is +BVD HOR and the vertical component is 0.

[0343] (2) Assuming that the analyzed code prediction index is as follows: bvsdIdx=1

[0344] In this case, the horizontal component of the true BVD is -BVD HOR and the vertical component is 0.

[0345] Furthermore, in the present embodiment, when the sorting result after the sorting process is a candidate BVD set for the current block, the candidate BVD with the smallest template matching cost is determined after sorting, that is, the smallest cost BVD in the candidate BVD set is determined. At this time, if the value of bvsdIdx is bit0+bit1<<1, bit0 represents the horizontal component code and bit1 represents the vertical component code. In this case, the smallest BVD code combination (smallest cost BVD) determines the code when bit0 and bit1 are 0, and vice versa when they are 1.

[0346] In addition, in the embodiment of the present application, when determining the BVD of the current block based on the BVD code index information and the sorting result, if absBvdX and absBvdY are not both 0, when the value of the first bit of the BVD code 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, and then the candBvdY of the BVD of the current block can be determined based on the minimum-cost BVD in the candidate BVD set.

[0347] In addition, in the embodiment of the present application, when determining the BVD of the current block based on the BVD code index information and the sorting result, if absBvdX and absBvdY are not both 0, when the value of the first bit of the BVD code index information is 1, it is determined that candBvdX of the BVD of the current block has the opposite sign to candBvdX of the minimum-cost BVD in the candidate BVD set. Then, the candBvdY of the BVD of the current block can be determined based on the minimum-cost BVD in another array other than the array in which the minimum-cost BVD in the candidate BVD set is located.

[0348] Furthermore, in an embodiment of the present application, when determining the candBvdY of the BVD of the current block based on the minimum-cost BVD in the candidate BVD set, if the value of the second bit of the BVD code 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, and if the value of the second bit is 1, it is determined that the candBvdY of the BVD of the current block has the opposite sign to the candBvdY of the minimum-cost BVD in the candidate BVD set.

[0349] Furthermore, in an embodiment of the present application, when determining the candBvdY of the BVD of the current block based on the minimum-cost BVD in another array other than the array in which the minimum-cost BVD in the candidate BVD set is located, if the value of the second bit of the BVD code 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, and if the value of the second bit is 1, it is determined that the candBvdY of the BVD of the current block has the opposite sign to the candBvdY of the minimum-cost BVD in the other array.

[0350] In this embodiment, it is assumed that the signs of the horizontal and vertical components of the true BVD are bvdSign[0] and bvdSign[1], where a value of 0 indicates positive and a value of 1 indicates negative.

[0351] Illustratively, in an embodiment of the present application, when there are both horizontal and vertical components of the BVD, the two possible cases of the minimum cost BVD in the set of candidate BVDs determined after sorting are as follows:

[0352] (1) In the third comparison, if the Cost corresponding to posiGrp[0] is equal to or less than the Cost corresponding to negaGrp[0]: If the 0th bit is 0, then bvd_sign[0] = 0. If the 1st bit is 0, then bvd_sign[1] = posiGrp[0][1], and if the 1st bit is 1, then bvd_sign[1] = posiGrp[1][1].

[0353] If the 0th bit is 1, then bvd_sign[0]=1. If the 1st bit is 0, then bvd_sign[1]=negaGrp[0][1], and if the 1st bit is 1, then bvd_sign[1]=negaGrp[1][1].

[0354] (2) In the third comparison, if the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0]: If the 0th bit is 1, then bvd_sign[0] = 0. If the 1st bit is 0, then bvd_sign[1] = posiGrp[0][1], and if the 1st bit is 1, then bvd_sign[1] = posiGrp[1][1].

[0355] If the 0th bit is 0, then bvd_sign[0]=1. If the 1st bit is 0, then bvd_sign[1]=negaGrp[0][1], and if the 1st bit is 1, then bvd_sign[1]=negaGrp[1][1].

[0356] In this embodiment, when determining the BVD of the current block based on the BVD code index information and the sorting result, if absBvdX is 0, when the value of the BVD code 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, and when the value of the BVD code index information is 1, it is determined that the candBvdY of the BVD of the current block has the opposite sign to the candBvdY of the minimum-cost BVD in the candidate BVD set.

[0357] Illustratively, in an embodiment of the present application, when only vertical components of the BVD exist, the two possible cases of the minimum cost BVD in the set of candidate BVDs determined after sorting are as follows:

[0358] (1) If Cost(+,+)≦Cost(+,-): If the 0th bit is 0, then bvd_sign[1]=0. If the 0th bit is 1, then bvd_sign[1]=1.

[0359] (2) If Cost(+,+)>Cost(+,-): If the 0th bit is 0, then bvd_sign[1]=1. If the 0th bit is 1, then bvd_sign[1]=0.

[0360] In addition, in the embodiment of the present application, when determining the BVD of the current block based on the BVD code index information and the sorting result, if absBvdY is 0, when the value of the BVD code 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 minimum-cost BVD in the candidate BVD set, and when the value of the BVD code index information is 1, it is determined that the absBvdX of the BVD of the current block has the opposite sign to the absBvdX of the minimum-cost BVD in the candidate BVD set.

[0361] Illustratively, in an embodiment of the present application, when only horizontal components of BVDs exist, the two possible cases of the minimum cost BVD in the set of candidate BVDs determined after sorting are as follows:

[0362] (1) If Cost(+,+)≦Cost(-,+): If the 0th bit is 0, then bvd_sign[0]=0. If the 0th bit is 1, then bvd_sign[0]=1.

[0363] (2) If Cost(+,+)>Cost(-,+): If the 0th bit is 0, then bvd_sign[0]=1. If the 0th bit is 1, then bvd_sign[0]=0.

[0364] As can be seen, the method for determining the BVD of the current block based on the above candidate BVD set can omit the steps of establishing a list and obtaining a code prediction index. If both the horizontal and vertical components of the BVD exist, the true BVD code can be obtained on the decoding side through three comparisons, thereby reducing the complexity.

[0365] In step 104, a reconstruction value for the current block is determined based on the BVD of the current block.

[0366] In the embodiment of the present application, after determining the BVD of the current block based on the BVD code index information and the sorting result, the decoder can determine the reconstructed value of the current block by performing motion compensation using the BVD of the current block.

[0367] Illustratively, in the present embodiment, the overall process on the decoding side is as follows:

[0368] There are several methods as follows:

[0369] (1) The analysis of the BVD code is performed after the BVD magnitude analysis process.

[0370] [Table 38] [Table 39] [Table 40]

[0371] The code prediction index (ie, BVD code index information) bvdIdx is derived as follows.

[0372] If abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] are both TRUE, bvsdIdx = bvsd_idx.

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

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

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

[0376] [Table 41]

[0377] Alternatively, bvsd_idx can use four different probability models.

[0378] [Table 42]

[0379] Or, one can use a probability model and one can use bypass coding.

[0380] [Table 43] or [Table 44]

[0381] bvsd_idx_single can use different probability models based on the absolute value.

[0382] [Table 45]

[0383] compIdx=0...1, representing the horizontal or vertical component.

[0384] Alternatively, one independent probability model can be used.

[0385] [Table 46]

[0386] Alternatively, bypass coding can be used.

[0387] [Table 47]

[0388] (2) The BVD coding analysis process is performed during the bvd_coding() function that analyzes the BVD magnitude, i.e., after analyzing the flags abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1], which indicate whether the horizontal and vertical components of the BVD are zero.

[0389] [Table 48] [Table 49]

[0390] The code prediction index bvdIdx is derived as follows.

[0391] If abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] are both TRUE, bvsdIdx = bvsd_idx.

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

[0393] bvsd_idx can use two different probability models.

[0394] [Table 50]

[0395] Or, one can use a probability model and one can use bypass coding.

[0396] [Table 51] or [Table 52] bvsd_idx_single allows the use of independent probability models.

[0397] [Table 53] Alternatively, bypass coding can be used.

[0398] [Table 54]

[0399] (3) The BVD code analysis process is performed during the bvd_coding() function that analyzes the BVD absolute value, that is, after analyzing the flags abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1], which indicate whether the horizontal and vertical components of the BVD are zero. However, unlike (2), only one variable bvsd_idx is introduced, and the binarization of this variable is processed using CABAC. (The binarization and CABAC processing included in this process can also be realized in (1). That is, even if the BVD code analysis process is performed after the bvd_coding() function that analyzes the BVD absolute value, the following binarization process can be applied.)

[0400] [Table 55] [Table 56]

[0401] The code prediction index bvdIdx is derived as follows.

[0402] bvsdIdx=bvsd_idx The following describes the binarization process of bvsd_idx and its corresponding specific formats, including but not limited to the following several formats:

[0403] 1) Binarize bvsd_idx using fixed-length binarization.

[0404] In this case, there are two forms:

[0405] The first form is:

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

[0407] [Table 57]

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

[0409] [Table 58]

[0410] A brief explanation of the above process is as follows:

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

[0412] Otherwise, if either abs_bvd_greater0_flag[0] or abs_bvd_greater0_flag[1] is TRUE, bvsd_idx is 0 when the binary string after binarization of the parsed bvsd_idx is 0B, and bvsd_idx is 1 when the binary string after binarization of the parsed bvsd_idx is 1B.

[0413] In this case, the relationship between the context probability model of the bvsd_idx syntax element and binIdx is as follows:

[0414] If abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] are both TRUE: There may be two different probability models:

[0415] [Table 59]

[0416] Or, one can use a probability model and one can use bypass coding.

[0417] [Table 60] or [Table 61]

[0418] Otherwise, if either abs_bvd_greater0_flag[0] or abs_bvd_greater0_flag[1] is TRUE: Independent probability models can be used.

[0419] [Table 62] Alternatively, bypass coding can be used.

[0420] [Table 63] The second form is:

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

[0422] [Table 64]

[0423] In other words, if abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] are both TRUE, when the binary string after binarization of the parsed bvsd_idx is 00B, bvsd_idx is 0 when the binary string after binarization of the parsed bvsd_idx is 01B, bvsd_idx is 1 when the binary string after binarization of the parsed bvsd_idx is 10B, bvsd_idx is 2, and when the binary string after binarization of the parsed bvsd_idx is 11B, bvsd_idx is 3.

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

[0425] [Table 65]

[0426] That is, if the binary character string after binarization of the analyzed bvsd_idx is 00B, bvsd_idx is 0, and if the binary character string after binarization of the analyzed bvsd_idx is 01B, bvsd_idx is 1.

[0427] In this case, the relationship between the context probability model of the bvsd_idx syntax element and binIdx is as follows:

[0428] If abs_bvd_greater0_flag[0] and abs_bvd_greater0_flag[1] are both TRUE, it is the same as the first format.

[0429] Otherwise, if either abs_bvd_greater0_flag[0] or abs_bvd_greater0_flag[1] is TRUE: One or two probability models can be used.

[0430] [Table 66] or [Table 67] Alternatively, an independent probability model and bypass coding can be used together.

[0431] [Table 68]

[0432] Alternatively, both may use bypass coding.

[0433] [Table 69]

[0434] 2) Binarize bvsd_idx using truncated binarization.

[0435] [Table 70]

[0436] If the binary string after binarization of the parsed bvsd_idx is 00B, bvsd_idx is 0; if the binary string after binarization of the parsed bvsd_idx is 01B, bvsd_idx is 1; if the binary string after binarization of the parsed bvsd_idx is 100B, bvsd_idx is 2; if the binary string after binarization of the parsed bvsd_idx is 101B, bvsd_idx is 3.

[0437] In this case, the relationship between the context probability model of the bvsd_idx syntax element and binIdx is as follows:

[0438] Three probability models, two probability models, or one probability model can be used.

[0439] [Table 71] or [Table 72] or [Table 73]

[0440] Alternatively, bypass encoding can be used for any of the above binIdx, i.e. any combination of encodings is possible, only one example is shown here.

[0441] [Table 74]

[0442] 3) Binarize bvsd_idx using zeroth order Exp-Golomb binarization.

[0443] [Table 75]

[0444] If the binary string after binarization of the parsed bvsd_idx is 1B, bvsd_idx is 0; if the binary string after binarization of the parsed bvsd_idx is 010B, bvsd_idx is 1; if the binary string after binarization of the parsed bvsd_idx is 011B, bvsd_idx is 2; and if the binary string after binarization of the parsed bvsd_idx is 00100B, bvsd_idx is 3.

[0445] In this case, the relationship between the context probability model of the bvsd_idx syntax element and binIdx is as follows:

[0446] Any combination of probability models and bypass coding can be used, just two examples are given below.

[0447] [Table 76] or [Table 77]

[0448] In summary, the decoding method proposed in steps 101 to 104 above creates a BVD combination list for possible BVD codes and BVD absolute values, sorts the combination list using a template, and performs CABAC encoding using the true BVD code and the code prediction index obtained using the sorted list. Compared with bypass encoding, this method has higher coding efficiency and can reduce the bit rate required for BVD transmission in IBC.

[0449] It should be noted that the decoding method proposed by the embodiments of the present application can, on the one hand, fully utilize the similarity between the template and the current coding block to effectively sort the BVD code combination list, and, on the other hand, can perform coding using CABAC, which has higher coding efficiency compared with bypass coding.

[0450] An embodiment of the present application provides an encoding / decoding method, in which the decoding side decodes a bitstream, determines a BVD absolute value and BVD code index information of a current block, sorts candidate BVDs of the current block according to the BVD absolute value of the current block to determine the sorting result, determines a BVD of the current block according to the BVD code index information and the sorting result, and determines a reconstructed value of the current block according to the BVD of the current block. The encoding side sorts candidate BVDs of the current block according to the BVD absolute value of the current block to determine the sorting result, determines BVD code index information of the current block according to the BVD code information of the current block and the sorting result, and writes the BVD absolute value and BVD code index information into the bitstream. As can be seen, in the embodiment of the present application, an effective sorting process can be performed on the candidate BVDs of the current block based on the BVD absolute value of the current block. Therefore, during encoding, the sorting result can be used to determine and transmit BVD code index information. During decoding, the sorting result can be used to analyze the BVD code information of the current block. Furthermore, the CABAC encoding / decoding technology can be used to perform encoding / decoding processes on the BVD code information. This effectively reduces the bit rate required for BVD code transmission in IBC mode, and improves coding efficiency.

[0451] Based on the above embodiment, another embodiment of the present application proposes a decoding method, where in the decoder, when performing decoding processing, the input of BVD decoding can be bitstream information of BVD magnitude and code (BVD code index information), and the output of BVD decoding can be true information of BVD magnitude and code.

[0452] Here, FIG. 10 is a schematic diagram 2 of a decoding method in an embodiment of the present application. As shown in FIG. 10, the BVD decoding process includes: analyzing a BVD absolute value (step 201); analyzing a BVD code prediction index, i.e., analyzing BVD code index information (step 202); determining a candidate BVD for a current block by creating a BVD combination list for possible BVD codes and BVD absolute values ​​(step 203); performing template prediction based on the BVD and BVD combination list for the current block, and calculating the cost of each BVD combination in the BVD combination list, i.e., calculating the cost (first cost value) of the template region for the combination list (step 204); and sorting the list, deriving a true BVD based on the code prediction index and the sorted list, and performing motion compensation (step 205).

[0453] For the BVD magnitude analysis proposed in step 201, the decoder can directly analyze the true BVD magnitude from the bitstream, i.e., the decoder can determine the BVD magnitude of the current block by decoding the bitstream.

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

[0455] The decoder can then parse the binary numbers corresponding to the code prediction index from the bitstream using a decoding process that supports context-based adaptive binary arithmetic coding (CABAC) or bypass.

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

[0457] Regarding the process of determining candidate BVDs for the current block proposed in step 203, i.e., creating a BVD combination list (candidate BVDs or initial set) for the possible signs and BVD absolute values ​​of the BVDs, the BVD combination list can be created according to different cases, such as when only horizontal BVDs exist, when only vertical BVDs exist, and when both exist.

[0458] Determining the BVD combination list involves permuting and combining the possible codes of the BVD and multiplying the possible horizontal and vertical codes by the horizontal and vertical absolute value components of the BVD, respectively.

[0459] To better illustrate how to construct a BVD combination list (candidate BVDs or initial set), the following three simple classifications are taken as examples.

[0460] Classification example 1: BVD is divided into horizontal and vertical components. If the horizontal component is zero, only the vertical component is coded. Therefore, a combination list is created only for the vertical component code. Specifically, there are the following two cases:

[0461] First case: the horizontal components are all positive signs and are just placeholders, and the vertical components are first positive signs and then negative signs, thus creating a sign list, and then multiplying the created sign list by the absolute values ​​of the horizontal and vertical components of the BVD to get a combined list of BVD.

[0462] Second case: the horizontal components are all positive signs and are just placeholders, and the vertical components are first negative signs and then positive signs, to create a sign list, and then multiply the created sign list by the absolute values ​​of the horizontal and vertical components of the BVD to get a combined list of BVD.

[0463] Classification example 2: BVD is divided into horizontal and vertical components. If the vertical component is zero, only the horizontal component is coded. Therefore, a combination list is created only for the code of the horizontal component. Specifically, there are the following two cases:

[0464] First case: all vertical components are positive signs and are just placeholders, and horizontal components are first positive signs and then negative signs to create a sign list, and then multiply the created sign list by the absolute values ​​of the vertical and horizontal components of BVD to get a combined list of BVD.

[0465] Second case: the vertical components are all positive signs and are just placeholders, and the horizontal components are first negative signs and then positive signs to create a sign list, and then multiply the created sign list by the absolute values ​​of the vertical and horizontal components of the BVD to get a combined list of BVD.

[0466] Classification example 3: BVD is divided into horizontal and vertical components. If both components are non-zero, both must be coded. Therefore, the horizontal and vertical components are combined to create a BVD list. Specifically, it is divided into 24 cases, which are any permutation of the four combinations {+1,+1}, {+1,-1}, {-1,+1}, and {-1,-1}. Examples are given below.

[0467] At the 0th position of the list, both the horizontal and vertical components are positive, at the 1st position of the list, the horizontal component is positive and the vertical component is negative, at the 2nd position of the list, the horizontal component is negative and the vertical component is positive, and at the 3rd position of the list, both the horizontal and vertical components are negative, a code list is created, and then the created code list is multiplied by the absolute values ​​of the vertical and horizontal components of the BVD to obtain a BVD combination list.

[0468] In step 204, template prediction is performed based on the BVP and BVD combination list (candidate BVDs) of the current block, and the cost (first cost value) of each BVD combination (candidate BVD) in the BVD combination list is calculated. In other words, the cost of the template region is calculated by using a template to calculate the cost for each combination in the BVD combination list. Specifically, the cost can be calculated by using the reconstructed luminance pixel at the template position of the current block and the reconstructed luminance pixel at the position obtained by template prediction using the BV obtained by combining the BVP and BVD of the current block.

[0469] In the embodiment of the present application, not only luminance but also chromaticity, i.e., Cb and Cr components, can be used when calculating the cost (first cost value), although the present application is not particularly limited thereto.

[0470] When selecting a template (first template for the current block), it can be determined whether the pixel at the template position is available and contains reconstructed luminance information based on the availability of pixels in the neighboring regions of the current block. As shown in Figure 6, based on the relative positional relationship between the template and the current block, the template can be classified into template types such as top template, left template, top right template, bottom left template, and top left template. Here, the template sizes of different types for different coding blocks can be fixed to the same size or can be different.

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

[0472] When performing BV prediction for the current block, a new BV can be generated using the combination list of the BV and BVD of the current block. As shown in Figure 8, the current block is used to determine whether this BV is available (conditions for availability include that the reference block pointed to by the BV has already been reconstructed and does not exceed the search range and image boundary set by IBC). If the current BV is available, motion compensation is performed using the template of the current block and the new BV to obtain a template for the corresponding BV. As shown in Figure 9, the horizontal and vertical components of the BVD generate a total of four combined BVDs, and motion compensation is performed using each template. There are several cases for using templates when calculating the cost:

[0473] First case: If the top template and the left template of the current block both exist, and the top template and the left template both exist in the corresponding BV, then both the top template and the left template are available.

[0474] Second case: If both the top and left templates of the current block exist, but only the top template exists in the corresponding BV, there are two methods: Method 1: The left template does not exist in the corresponding BV, so it is not used directly, i.e., calculation is performed using only the top template; Method 2: If the left template does not exist in the corresponding BV, the leftmost template width column in the reference block is used instead of the left template, i.e., calculation is performed using the top template and the left template.

[0475] Third case: If both the top template and the left template of the current block exist, but only the left template exists in the corresponding BV, there are two methods: Method 1: The top template does not exist in the corresponding BV, so it is not used directly, i.e., calculation is performed using only the left template; Method 2: If the top template does not exist in the corresponding BV, the topmost template height row in the reference block is used instead of the top template, i.e., calculation is performed using the top template and the left template.

[0476] Fourth case: If only the top template of the current block exists, there are three ways: Method 1: The top template does not exist in the corresponding BV and is not used directly; Method 2: If the top template does not exist in the corresponding BV, the topmost template height row in the reference block is adopted instead of the top template; Method 3: If the top template exists in the corresponding BV, it is used directly.

[0477] Fifth case: If only the left template of the current block exists, there are three ways: Method 1: The left template does not exist in the corresponding BV and is not used directly; Method 2: If the left template does not exist in the corresponding BV, the leftmost template width column in the reference block is adopted instead of the left template; Method 3: If the left template exists in the corresponding BV, it is used directly.

[0478] Sixth case: If the top template and left template of the current block both do not exist, the BVD combination in this case is ignored.

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

[0480] When calculating the cost, i.e., when determining the first cost value, there may be multiple choices of cost functions for calculating the cost of the template region, i.e., multiple choices of predetermined error criteria, such as sum of absolute errors (SAD), sum of absolute transformed errors (SATD), sum of squared differences (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), rate-distortion optimization (RDO), etc.

[0481] Through the above steps, after calculating the cost (first cost value) of the template region in step 204, step 205 can be performed, that is, the combination list can be sorted based on the cost obtained in the template region, that is, the first cost value can be used to perform a sorting process on the candidate BVDs, and the true BVD can be obtained using the BVD code prediction index and the sorted list (candidate BVD list of the current block), and then motion compensation can be performed.

[0482] When sorting the combination list based on the cost obtained in the template area, i.e., when sorting the candidate BVDs based on the first cost value, a new list OrderedList (candidate BVD list of the current block) sorted in ascending (descending) order may be used, or a new list OrderedList sorted in a specific order may be adopted.

[0483] (1) A new list, OrderedList, sorted in ascending (descending) order.

[0484] 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 packet sort can be used.

[0485] (2) A new list, OrderedList, sorted in a specific order.

[0486] List one particular ordering method below, including but not limited to the following formats: First case: The combination list (candidate BVD) is {(+BVD HOR ,+BVD VER ),(+BVD HOR ,-BVD VER ),(-BVD HOR ,-BVD VER ),(-BVD HOR ,+BVD VER )} and the 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 elements in the above two lists can be rearranged in any order.

[0487] Two arrays, posiGrp and negativeGrp, are defined, where posiGrp stores two BVD combinations with positive signs in the same component (horizontal), and negativeGrp stores two BVD combinations with negative signs in the same component (horizontal).

[0488] posiGrp={(+BVD HOR ,+BVD VER ),(+BVD HOR ,-BVD VER )},negaGrp={(-BVD HOR ,+BVD VER ),(-BVD HOR ,-BVD VER )}. The order of the elements in the two lists, posiGrp and negaGrp, can be rearranged in any order.

[0489] First comparison: Cost (+BVD HOR ,+BVD VER ) and Cost(+BVD HOR ,-BVDVER ) and set posiGrp[0] to the BVD combination with the smaller cost, and set posiGrp[1] to the BVD combination with the larger cost.

[0490] Second comparison: Cost(-BVD HOR ,+BVD VER ) and Cost(-BVD HOR ,-BVD VER ) and set negativeGrp[0] to the BVD combination with the smaller cost, and set negativeGrp[1] to the BVD combination with the larger cost.

[0491] Third comparison: Compare the magnitude of the Cost corresponding to posiGrp[0] and negaGrp[0].

[0492] The final sorting process is as follows:

[0493] In the third comparison, if the cost corresponding to posiGrp[0] is less than or equal to the cost corresponding to negaGrp[0], place posiGrp[0] in the 0th position of the candidate BVD list OrderedList, place negaGrp[0] in the 1st position of the candidate BVD list OrderedList, place posiGrp[1] in the 2nd position of the candidate BVD list OrderedList, and place negaGrp[1] in the 3rd position of the candidate BVD list OrderedList.

[0494] In the third comparison, if the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0], place negativeGrp[0] in the 0th position of the candidate BVD list OrderedList, place posiGrp[0] in the 1st position of the candidate BVD list OrderedList, place negativeGrp[1] in the 2nd position of the candidate BVD list OrderedList, and place posiGrp[1] in the 3rd position of the candidate BVD list OrderedList.

[0495] Here, the candidate BVD at the 0th position in the candidate BVD list of the current block is the first candidate BVD in the candidate BVD list, the candidate BVD at the 1st position is the second candidate BVD in the candidate BVD list, the candidate BVD at the 2nd position is the third candidate BVD in the candidate BVD list, and the candidate BVD at the 3rd position is the fourth candidate BVD in the candidate BVD list.

[0496] Another sorting embodiment is as follows.

[0497] In the third comparison, if the cost corresponding to posiGrp[0] is less than or equal to the cost corresponding to negaGrp[0], place posiGrp[0] in the 0th position of the candidate BVD list OrderedList, place negaGrp[0] in the 2nd position of the candidate BVD list OrderedList, place posiGrp[1] in the 1st position of the candidate BVD list OrderedList, and place negaGrp[1] in the 3rd position of the candidate BVD list OrderedList.

[0498] In the third comparison, if the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0], place negativeGrp[0] in the 0th position of the candidate BVD list OrderedList, place posiGrp[0] in the 2nd position of the candidate BVD list OrderedList, place negativeGrp[1] in the 1st position of the candidate BVD list OrderedList, and place posiGrp[1] in the 3rd position of the candidate BVD list OrderedList.

[0499] Second case: The combination list is {(0,+BVD VER ),(0,-BVD VER )} and the corresponding cost list is {Cost(0,+BVD VER ),Cost(0,-BVD VER )}. The order of the elements in the above two lists can be rearranged in any order.

[0500] The sorting process is as follows: Cost(0,+BVD VER ) and Cost(0,-BVD VER ) to compare their sizes.

[0501] Cost(0,+BVD VER )≦Cost(0,-BVD VER ), then (0,+BVD VER ) is placed at the 0th position of the candidate BVD list OrderedList, and (0,-BVD VER ) is placed in the first position of the candidate BVD list OrderedList.

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

[0503] Third case: The combination list is {(+BVD HOR ,0),(-BVD HOR ,0)} and the corresponding cost list is {Cost(+BVD HOR ,0),Cost(-BVD HOR ,0)}. The order of the elements in the above two lists can be rearranged in any order.

[0504] The sorting process is as follows: Cost(+BVD HOR ,0) and Cost(-BVD HOR ,0) and compare their sizes.

[0505] Cost(+BVD HOR ,0)≦Cost(-BVD HOR ,0), then (+BVD HOR ,0) is placed at the 0th position of the candidate BVD list OrderedList, and (-BVD HOR,0) is placed in the first position of the candidate BVD list OrderedList.

[0506] Cost(+BVD HOR ,0)>Cost(-BVD HOR ,0), then (-BVD HOR ,0) is placed at the 0th position of the candidate BVD list OrderedList, and (+BVD HOR ,0) is placed in the first position of the candidate BVD list OrderedList.

[0507] After sorting the combination list based on the cost obtained in the template region, i.e., after performing a sorting process on the candidate BVDs based on the first cost value, the sorted result obtained may be a candidate BVD set for the current block, where the candidate BVDs can be sorted based on the first cost value to determine a candidate BVD set for the current block, where the candidate BVD set includes at least one candidate BVD.

[0508] If both horizontal and vertical components of BVD exist, i.e., absBvdX and absBvdY are not both 0, then assume that the combination list is {(+,+),(+,-),(-,-),(-,+)} and the corresponding cost list is {Cost(+,+),Cost(+,-),Cost(-,-),Cost(-,+)}. The order of the elements in the above two lists can be rearranged in any order.

[0509] Two arrays, posiGrp and negativeGrp, are defined. posiGrp stores the sign combinations of two BVDs with positive signs in the same component (horizontal), and negativeGrp stores the sign combinations of two BVDs with negative signs in the same component (horizontal).

[0510] Assume that posiGrp={(+,+),(+,-)} and negaGrp={(-,+),(-,-)}. The order of the elements in the two lists, posiGrp and negaGrp, can be rearranged in any order.

[0511] First comparison: Compare the magnitudes of Cost(+,+) and Cost(+,-), and set posiGrp[0] to the sign combination of the BVD with the smaller cost, and set posiGrp[1] to the sign combination of the BVD with the larger cost.

[0512] Second comparison: Compare the magnitudes of Cost(-,+) and Cost(-,-), and set negativeGrp[0] to the sign combination of the BVD with the smaller cost, and set negativeGrp[1] to the sign combination of the BVD with the larger cost.

[0513] Third comparison: Compare the magnitude of Cost corresponding to posiGrp[0] and negaGrp[0].

[0514] This makes it possible to determine the code combination of one BVD with the smallest cost, that is, to determine the smallest cost BVD in the candidate BVD set.

[0515] If only the vertical component of the BVD exists, assume that the combination list is {(+,+),(+,-)} and the corresponding cost list is {Cost(+,+),Cost(+,-)}. The order of the elements in the above two lists can be rearranged in any order. The comparison process is as follows: By comparing the magnitudes of Cost(+,+) and Cost(+,-), the code combination of the BVD with the smallest cost can be determined, that is, the smallest-cost BVD in the candidate BVD set can be determined.

[0516] If there is only a horizontal component of the BVD, assume that the combination list is {(+,+),(-,+)} and the corresponding cost list is {Cost(+,+),Cost(-,+)}. The order of the elements in the above two lists can be rearranged in any order. The comparison process is as follows: By comparing the magnitudes of Cost(+,+) and Cost(-,+), the code combination of the BVD with the smallest cost can be determined, that is, the smallest-cost BVD in the candidate BVD set can be determined.

[0517] When determining the true BVD using the BVD code prediction index (BVD code index information) and the sorted list (candidate BVD list for the current block), the sorted list (candidate BVD list for the current block) can be divided into three cases: when only the horizontal component of the BVD exists, when only the vertical component of the BVD exists, and when both the horizontal and vertical components of the BVD exist. Here, we will explain each of the three cases.

[0518] Here, for the new list OrderedList sorted in ascending (descending) order, there are two technical proposals: one is to indirectly obtain the true BVD code using a transformation list, and the other is to directly obtain the true BVD code using logical inference.

[0519] When using a transformation list to indirectly obtain a true BVD code, the decoder must first convert the BVD combination list OrderedList into an index transformation list TransformedList according to the transformation rules.

[0520] In the first case, both the horizontal and vertical components of the BVD are present, in which case the BVD code prediction index is 2 bits.

[0521] Assume that the sorted BVD combination list OrderedList is as follows:

[0522] [Table 78]

[0523] Using the following conversion rules, the sorted BVD combination list OrderedList is converted into a TransformedList (index-transformed list).

[0524] The BVD combination with the smallest cost after sorting is placed in the 0th position of the TransformedList list, i.e., (a1, a2) is placed in the 0th position of the TransformedList list. The BVD combination with the same sign as a1 is placed in the 2nd position of the TransformedList list. In other words, assuming that b1 has the same sign as a1, (b1, b2) is placed in the 2nd position of the TransformedList list. The BVD combination with the smaller cost and with the opposite sign to a1 is placed in the 1st position of the TransformedList list, i.e., (c1, c2) is placed in the 1st position of the TransformedList list. The BVD combination with the larger cost and with the opposite sign to a1 is placed in the 3rd position of the TransformedList list, i.e., (d1, d2) is placed in the 3rd position of the TransformedList list.

[0525] Then, the index transformation list TransformedList will look like this:

[0526] [Table 79]

[0527] For the index conversion list, obtain the true BVD code according to the following rules, where the analyzed code prediction index is equal to the index of the leftmost column of the table.

[0528] Analyze the 0th bit of the code prediction index.

[0529] If the 0th bit is 0, the horizontal component of the true BVD is equal to a1, and check its vertical component; if the 1st bit is 0, the vertical component of the true BVD is equal to a2, and if the 1st bit is 1, the vertical component of the true BVD is equal to -a2.

[0530] If the 0th bit is 1, the horizontal component of the true BVD is equal to -a1, and check the vertical component of the candidate BVD with index 1; if the 1st bit is 0, the vertical component of the true BVD is equal to c2, and if the 1st bit is 1, the vertical component of the true BVD is equal to -c2.

[0531] In the second case, only the vertical component of the BVD is present, in which case the symbol prediction index of the BVD is 1 bit.

[0532] Assume that the sorted BVD combination list OrderedList is as follows:

[0533] [Table 80]

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

[0535] The index transformation list TransformedList is as follows:

[0536] [Table 81]

[0537] For the index transformation list, obtain the true BVD code according to the following rules, where the analyzed code prediction index is equal to the index of the leftmost column of the table.

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

[0539] In the third case, only the horizontal component of the BVD is present, in which case the symbol prediction index of the BVD is 1 bit.

[0540] Assume that the sorted BVD combination list OrderedList is as follows:

[0541] [Table 82]

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

[0543] The index transformation list TransformedList is as follows:

[0544] [Table 83]

[0545] For the index transformation list, obtain the true BVD code according to the following rules, where the analyzed code prediction index is equal to the index of the leftmost column of the table.

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

[0547] When using logical inference to directly obtain the true BVD code, in the first case, both the horizontal and vertical components of BVD exist, and in this case, the code prediction index of BVD is 2 bits.

[0548] Assume that the sorted BVD combination list OrderedList is as follows:

[0549] [Table 84]

[0550] If the 0th bit of the code prediction index of the analyzed BVD 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, i.e., the inverse of a1. In this case, the horizontal component of the true BVD is determined to be e1. Next, 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 and assumed to be f2. If the 1st bit is 0, the vertical component of the true BVD is equal to f2. If the 1st bit is 1, the vertical component of the true BVD is equal to -f2, i.e., the inverse of f2. In this case, the vertical component of the true BVD is determined to be e2. In this way, the true BVD, i.e., the BVD whose horizontal component is e1 and whose vertical component is e2, is obtained.

[0551] In the second case, only the vertical component of the BVD is present, in which case the symbol prediction index of the BVD is 1 bit.

[0552] Assume that the sorted BVD combination list OrderedList is as follows:

[0553] [Table 85]

[0554] If the 0th bit of the code prediction index of the analyzed BVD is 0, the vertical component of the true BVD is equal to a2, and if the 0th bit is 1, the vertical component of the true BVD is equal to -a2, i.e., the inverse of a2, at this time, it is determined that the vertical component of the true BVD is e1 and the horizontal component is 0. In this way, the true BVD, i.e., the BVD whose horizontal component is 0 and whose vertical component is e2, is obtained.

[0555] In the third case, only the horizontal component of the BVD is present, in which case the symbol prediction index of the BVD is 1 bit.

[0556] Assume that the sorted BVD combination list OrderedList is as follows:

[0557] [Table 86]

[0558] If the 0th bit of the code prediction index of the analyzed BVD is 0, the horizontal component of the true BVD is equal to a1, and if the 0th bit is 1, the horizontal component of the true BVD is equal to -a1, i.e., the inverse of a1, at this time, it is determined that the horizontal component of the true BVD is e1 and the vertical component is 0. In this way, the true BVD, i.e., the BVD whose horizontal component is e1 and whose vertical component is 0, is obtained.

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

[0560] In the TransformedList, the BVD combination corresponding to the BVD code prediction index is the true BVD.

[0561] In the first case, both the horizontal and vertical components of the BVD are present, in which case the BVD code prediction index is 2 bits.

[0562] Assume that the sorted BVD combination list OrderedList is as follows:

[0563] [Table 87]

[0564] Then, the index transformation list TransformedList is as follows:

[0565] [Table 88]

[0566] For the index transformation list, obtain the true BVD code according to the following rules, where the analyzed code prediction index is equal to the index of the leftmost column of the table.

[0567] Analyze the 0th bit of the code prediction index.

[0568] If the 0th bit is 0, the horizontal component of the true BVD is equal to a1, and check its vertical component; if the 1st bit is 0, the vertical component of the true BVD is equal to a2, and if the 1st bit is 1, the vertical component of the true BVD is equal to -a2.

[0569] If the 0th bit is 1, the horizontal component of the true BVD is equal to -a1, and check the vertical component of the candidate BVD with index 1; if the 1st bit is 0, the vertical component of the true BVD is equal to c2, and if the 1st bit is 1, the vertical component of the true BVD is equal to -c2.

[0570] In the second case, only the vertical component of the BVD is present, in which case the symbol prediction index of the BVD is 1 bit.

[0571] Assume that the sorted BVD combination list OrderedList is as follows:

[0572] [Table 89]

[0573] Then, the index transformation list TransformedList is as follows:

[0574] [Table 90]

[0575] For the index transformation list, obtain the true BVD code according to the following rules, where the analyzed code prediction index is equal to the index of the leftmost column of the table.

[0576] If the 0th bit is 0, the vertical component of the true BVD is equal to a2; otherwise, the vertical component of the true BVD is equal to -a2.

[0577] In the third case, only the horizontal component of the BVD is present, in which case the symbol prediction index of the BVD is 1 bit.

[0578] Assume that the sorted BVD combination list OrderedList is as follows:

[0579] [Table 91]

[0580] Then, the index transformation list TransformedList is as follows:

[0581] [Table 92]

[0582] For the index transformation list, obtain the true BVD code according to the following rules, where the analyzed code prediction index is equal to the index of the leftmost column of the table.

[0583] If 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.

[0584] Furthermore, in the present embodiment, when the sorting result after the sorting process is a candidate BVD set for the current block, the candidate BVD with the smallest template matching cost is determined after sorting, that is, the smallest cost BVD in the candidate BVD set is determined. At this time, if the value of bvsdIdx is bit0+bit1<<1, bit0 represents the horizontal component code and bit1 represents the vertical component code. In this case, the smallest BVD code combination (smallest cost BVD) determines the code when bit0 and bit1 are 0, and vice versa when they are 1.

[0585] In this embodiment, it is assumed that the signs of the horizontal and vertical components of the true BVD are bvdSign[0] and bvdSign[1], where a value of 0 indicates positive and a value of 1 indicates negative.

[0586] First case: Both horizontal and vertical components of BVD are present.

[0587] (1) In the third comparison, if the Cost corresponding to posiGrp[0] is equal to or less than the Cost corresponding to negaGrp[0]: If the 0th bit is 0, then bvd_sign[0] = 0. If the 1st bit is 0, then bvd_sign[1] = posiGrp[0][1], and if the 1st bit is 1, then bvd_sign[1] = posiGrp[1][1].

[0588] If the 0th bit is 1, then bvd_sign[0]=1. If the 1st bit is 0, then bvd_sign[1]=negaGrp[0][1], and if the 1st bit is 1, then bvd_sign[1]=negaGrp[1][1].

[0589] (2) In the third comparison, if the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0]: If the 0th bit is 1, then bvd_sign[0] = 0. If the 1st bit is 0, then bvd_sign[1] = posiGrp[0][1], and if the 1st bit is 1, then bvd_sign[1] = posiGrp[1][1].

[0590] If the 0th bit is 0, then bvd_sign[0]=1. If the 1st bit is 0, then bvd_sign[1]=negaGrp[0][1], and if the 1st bit is 1, then bvd_sign[1]=negaGrp[1][1].

[0591] Second case: Only the vertical component of the BVD is present.

[0592] (1) If Cost(+,+)≦Cost(+,-): If the 0th bit is 0, then bvd_sign[1]=0. If the 0th bit is 1, then bvd_sign[1]=1.

[0593] (2) If Cost(+,+)>Cost(+,-): If the 0th bit is 0, then bvd_sign[1]=1. If the 0th bit is 1, then bvd_sign[1]=0.

[0594] Third case: Only the horizontal component of the BVD is present.

[0595] (1) If Cost(+,+)≦Cost(-,+): If the 0th bit is 0, then bvd_sign[0]=0. If the 0th bit is 1, then bvd_sign[0]=1.

[0596] (2) If Cost(+,+)>Cost(-,+): If the 0th bit is 0, then bvd_sign[0]=1. If the 0th bit is 1, then bvd_sign[0]=0.

[0597] As can be seen, the method of determining the BVD of the current block based on the above candidate BVD set can omit the steps of establishing the list and obtaining the code prediction index, and the decoding side can obtain the true BVD code through three comparisons.

[0598] For example, in the embodiment of the present application, taking the case where the CABAC model includes two probability models as an example, the analysis is performed after bvd_coding() described in (1) in the overall process of the decoding side of the main technical solution, and the overall process of the decoding side is as follows:

[0599] [Table 93] [Table 94] [Table 95]

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

[0601] If only abs_bvd_greater0_flag[0] is TRUE, bvd_sign_bin[0] is the 0th bit above.

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

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

[0604] abs_bvd[compIdx] = abs_bvd_greater0_flag[compIdx] * ( abs_bvd_minus1[ compIdx ]+ 1) [Table 96]

[0605] compIdx=0...1 indicates the horizontal or vertical component.

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

[0607] bvd[compIdx] = abs_bvd_greater0_flag[compIdx] * ( abs_bvd_minus1[ compIdx ]+ 1 ) * ( 1-2 * bvd_sign [ compIdx ] )

[0608] Furthermore, in the embodiments of the present application, a specific ordered list of candidate BVDs, OrderedList, is adopted to determine the set of candidate BVDs. In the solution proposed in the above embodiments of storing each candidate BVD using two arrays, if both horizontal and vertical components of the BVD exist, the order of the horizontal and vertical components can be reversed.

[0609] For example, in this embodiment, when both horizontal and vertical components of BVD exist, the combination list is assumed to be {(+,+),(+,-),(-,-),(-,+)} and the corresponding cost list is assumed to be {Cost(+,+),Cost(+,-),Cost(-,-),Cost(-,+)}. The order of elements in the above two lists can be rearranged in any order.

[0610] Two arrays, posiGrp and negativeGrp, are defined, where posiGrp stores the sign combinations of two BVDs with positive signs in the same component (vertical), and negativeGrp stores the sign combinations of two BVDs with negative signs in the same component (vertical).

[0611] Assume that posiGrp={(+,+),(-,+)} and negaGrp={(+,-),(-,-)}. The order of the elements in the two lists, posiGrp and negaGrp, can be rearranged in any order.

[0612] First comparison: Compare the magnitude of Cost(+,+) and Cost(-,+), and set posiGrp[0] to the BVD combination with the smaller cost, and set posiGrp[1] to the BVD combination with the larger cost.

[0613] Second comparison: Compare the magnitude of Cost(+,-) and Cost(-,-), and set negativeGrp[0] to the BVD combination with the smaller cost, and set negativeGrp[1] to the BVD combination with the larger cost.

[0614] Third comparison: Compare the magnitude of the Cost corresponding to posiGrp[0] and negaGrp[0].

[0615] (1) In the third comparison, if the Cost corresponding to posiGrp[0] is equal to or less than the Cost corresponding to negaGrp[0]: If the 0th bit is 0, then bvd_sign[1]=0. If the 1st bit is 0, then bvd_sign[0]=posiGrp[0][0], and if the 1st bit is 1, then bvd_sign[0]=posiGrp[1][0].

[0616] If the 0th bit is 1, then bvd_sign[1]=1. If the 1st bit is 0, then bvd_sign[0]=negaGrp[0][0], and if the 1st bit is 1, then bvd_sign[0]=negaGrp[1][0].

[0617] (2) In the third comparison, if the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0]: If the 0th bit is 1, then bvd_sign[1]=0. If the 1st bit is 0, then bvd_sign[0]=posiGrp[0][0], and if the 1st bit is 1, then bvd_sign[0]=posiGrp[1][0].

[0618] If the 0th bit is 0, then bvd_sign[1]=1. If the 1st bit is 0, then bvd_sign[0]=negaGrp[0][0], and if the 1st bit is 1, then bvd_sign[0]=negaGrp[1][0].

[0619] Furthermore, in the embodiment of the present application, when both horizontal and vertical components of a BVD exist, the order of the horizontal and vertical components can be determined according to a specific criterion in the operation process of swapping the order of the horizontal and vertical components, including, but not limited to, determining the order of the horizontal and vertical components based on the magnitude of the absolute values ​​of the horizontal and vertical components of the BVD.

[0620] Furthermore, in the present embodiment, the costs of the sorted BVD combination list (candidate BVD list) can be stored, and then re-sorted based on these stored costs. The specific process is as follows: If the cost difference between a candidate and its immediately preceding candidate in the list is less than a value λ, for example, |D1-D2|<λ, 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 RD criterion on the encoder side.

[0621] Illustratively, FIG. 11 is a schematic diagram of cost calculation, and as shown in FIG. 11, the algorithm for calculating the cost is defined as follows:

[0622] (1) Determine the minimum cost difference between a candidate and its predecessor among all candidates in the list. If the minimum cost difference is greater than or equal to λ, the list is considered sufficiently diverse and we stop re-sorting.

[0623] If this minimum cost difference is less than λ, the candidate is deemed redundant and moved to another position, which is sufficiently diverse compared to the previous candidate.

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

[0625] As can be seen, the encoding and decoding method proposed in this embodiment can effectively reduce the bit rate required for BVD code transmission in IBC mode. Specifically, a BVD combination list is created for possible BVD codes and BVD absolute values, the combination list is sorted using a template, and CABAC encoding is performed using the true BVD code and the code prediction index obtained using the sorted list. The proposed technique has higher coding efficiency than bypass coding and can reduce the bit rate required for BVD transmission in IBC mode.

[0626] In other words, the embodiments of the present application propose a new code transmission method for BVD in IBC, which can fully utilize the similarity between the template and the current coding block to effectively sort the BVD code combination list, and can further encode using CABAC, achieving higher coding efficiency compared to bypass coding.

[0627] An embodiment of the present application provides an encoding / decoding method, in which the decoding side decodes a bitstream, determines a BVD absolute value and BVD code index information of a current block, sorts candidate BVDs of the current block according to the BVD absolute value of the current block to determine the sorting result, determines a BVD of the current block according to the BVD code index information and the sorting result, and determines a reconstructed value of the current block according to the BVD of the current block. The encoding side sorts candidate BVDs of the current block according to the BVD absolute value of the current block to determine the sorting result, determines BVD code index information of the current block according to the BVD code information of the current block and the sorting result, and writes the BVD absolute value and BVD code index information into the bitstream. As can be seen, in the embodiment of the present application, an effective sorting process can be performed on the candidate BVDs of the current block based on the BVD absolute value of the current block. Therefore, during encoding, the sorting result can be used to determine and transmit BVD code index information. During decoding, the sorting result can be used to analyze the BVD code information of the current block. Furthermore, the CABAC encoding / decoding technology can be used to perform encoding / decoding processes on the BVD code information. This effectively reduces the bit rate required for BVD code transmission in IBC mode, and improves coding efficiency.

[0628] An embodiment of the present application proposes an encoding method, which can be applied to an encoder. FIG. 12 is a schematic diagram 1 of the encoding method in an embodiment of the present application. As shown in FIG. 12, the method in which the encoder performs encoding processing may include the following steps:

[0629] In step 301, a sorting process is performed on the candidate BVDs of the current block based on the BVD absolute value of the current block, and the sorting result is determined.

[0630] In an embodiment of the present application, the encoder first determines the BVD absolute value of the current block, and then performs a sorting process on the candidate BVDs of the current block based on the BVD absolute value of the current block, thereby determining the sorting result.

[0631] As can be seen, in the present embodiment, the BVD absolute value includes a first component absolute value absBvdX and a second component absolute value absBvdY, i.e., the BVD absolute value includes a horizontal component absolute value and a vertical component absolute value. Correspondingly, the BVD of the current block may include a first component candBvdX and a second component candBvdY, and similarly, the candidate BVD of the current block may also include a first component candBvdX and a second component candBvdY, i.e., the BVD may include a horizontal component and a vertical component.

[0632] Furthermore, in the embodiment of the present application, if absBvdX and absBvdY are not both 0, it can be determined that the number of bits of the BVD code index information is 2, and if absBvdX or absBvdY is 0, it can be determined that the number of bits of the BVD code index information is 1.

[0633] In addition to the fixed-length coding methods listed above, the embodiments of the present application may also employ variable-length coding methods to encode the BVD index information. For example, the BVD index information may be encoded using truncated unary coding, i.e., truncated binarization may be used to perform binarization. In this case, the number of bits of the BVD index information is not necessarily two.

[0634] That is, in the embodiment of the present application, when the truncated unary code is used to encode the BVD code index information (where the BVD code index information may be an index value in the candidate BVD list), the number of bits of the code index information corresponding to different candidate BVDs is not exactly the same, i.e., it is variable-length coding.

[0635] Furthermore, in the embodiment of the present application, after determining the BVD absolute value of the current block, the BVD absolute value can be used to determine a BVD combination list, where the BVD combination list includes any number of candidate BVDs of the current block, that is, the BVD absolute value can be used to determine candidate BVDs of the current block, which can also be understood as determining an initial set of candidate BVDs of the current block using the BVD absolute value.

[0636] In the present embodiment, a list of BVD combinations (candidate BVDs) can be created for possible BVD signs and BVD absolute values, including cases where only horizontal BVD exists, only vertical BVD exists, and both exist.

[0637] Furthermore, in the embodiment of the present application, generating a BVD combination list (candidate BVD) mainly involves permuting and combining possible BVD codes, and multiplying the possible horizontal and vertical codes by the horizontal absolute value components and vertical absolute value components of the BVD, respectively.

[0638] Illustratively, in an embodiment of the present application, when only vertical BVDs exist, ie, when absBvdX is 0, the candidate BVDs can be determined based on absBvdY.

[0639] For example, BVD is divided into horizontal and vertical components, and when the horizontal component is zero, only the vertical component is coded, so a combination list is created only for the code of the vertical component. Specifically, there are the following two cases:

[0640] First case: the horizontal components are all positive signs and are just placeholders, and the vertical components are first positive signs and then negative signs, to create a sign list, and then multiply the created sign list by the absolute values ​​of the horizontal and vertical components of the BVD to get a combined list of BVD.

[0641] { {+1,+1}, {+1,-1}, }; { { 0,+BVD VER}, { 0,-BVD VER}, }.

[0642] Second case: the horizontal components are all positive signs and are just placeholders, and the vertical components are first negative signs and then positive signs to create a sign list, and then multiply the created sign list by the absolute values ​​of the horizontal and vertical components of the BVD to get a combined list of BVD.

[0643] { {+1,-1}, {+1,+1}, }; { { 0,-BVD VER}, { 0,+BVD VER}, }.

[0644] Illustratively, in an embodiment of the present application, when only horizontal BVDs exist, ie, when absBvdY is 0, the candidate BVDs can be determined based on absBvdX.

[0645] For example, BVD is divided into horizontal and vertical components, and when the vertical component is zero, only the horizontal component is coded, so a combination list is created only for the code of the horizontal component. Specifically, there are the following two cases:

[0646] First case: all vertical components are positive signs and are just placeholders, and horizontal components are first positive signs and then negative signs to create a sign list, and then multiply the created sign list by the absolute values ​​of the vertical and horizontal components of BVD to get a combined list of BVD.

[0647] { {+1,+1}, {-1,+1}, }; { {+BVD HOR ,0}, {-BVD HOR ,0}, }.

[0648] In the second case, the vertical components are all positive signs and are just placeholders, and the horizontal components are first negative signs and then positive signs to create a sign list, and then multiply the created sign list by the absolute values ​​of the vertical and horizontal components of the BVD to get a combined list of BVD.

[0649] { {-1,+1}, {+1,+1}, }; { {-BVD HOR ,0}, {+BVD HOR ,0}, }.

[0650] Illustratively, in an embodiment of the present application, when both horizontal BVD and vertical BVD exist, ie, when absBvdX and absBvdY are not both 0, a candidate BVD can be determined based on absBvdX and absBvdY.

[0651] For example, BVD is divided into horizontal and vertical components. If both components are non-zero, they must be coded. Therefore, the horizontal and vertical components are combined to create a BVD list. Specifically, the list is divided into 24 cases, which are any permutation of the four combinations {+1,+1}, {+1,-1}, {-1,+1}, and {-1,-1}. Examples are given below.

[0652] At the 0th position of the list, both the horizontal and vertical components are positive, at the 1st position of the list, the horizontal component is positive and the vertical component is negative, at the 2nd position of the list, the horizontal component is negative and the vertical component is positive, and at the 3rd position of the list, both the horizontal and vertical components are negative, a code list is created, and then the created code list is multiplied by the absolute values ​​of the vertical and horizontal components of the BVD to obtain a BVD combination list.

[0653] { {+1,+1}, {+1,-1}, {-1,+1}, {-1,-1}, }; { {+BVD HOR ,+BVD VER}, {+BVD HOR ,-BVD VER}, {-BVD HOR ,+BVD VER}, {-BVD HOR ,-BVD VER}, }.

[0654] Furthermore, in the embodiment of the present application, after determining the BVD absolute value of the current block, a sorting process can be further performed on the candidate BVDs of the current block based on the BVD absolute value to determine the sorting result.

[0655] Furthermore, in the embodiments of the present application, when performing a sorting process on the candidate BVDs of the current block based on the BVD absolute value and determining the sorting result, a first cost value corresponding to one or more candidate BVDs of the current block can be determined based on the BVD absolute value, and then the candidate BVDs can be sorted based on the first cost value and the sorting result can be determined.

[0656] As can be appreciated, in an embodiment of the present application, one or more candidate BVDs may include BVDs with candBvdX set equal to −absBvdX or absBvdX, respectively, and candBvdY set equal to −absBvdY or absBvdY, respectively.

[0657] In addition, in an embodiment of the present application, when determining a first cost value corresponding to one or more candidate BVDs of the current block based on the BVD absolute value of the current block, a first matching template can be first determined based on the candidate BVDs, and then the matching error between the first template of the current block and the first matching template can be calculated based on a predetermined error criterion to determine the first cost value corresponding to the candidate BVDs.

[0658] For example, in the embodiment of the present application, when calculating the cost, i.e., when determining the first cost value, there are multiple options for the cost function for calculating the cost of the template region, that is, there are multiple options for the predetermined error criterion. For example, evaluation criteria such as sum of absolute error (SAD), sum of absolute transformed error (SATD), sum of squared differences (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), rate distortion optimization (RDO), etc. can be selected. The evaluation criteria mentioned in the following content can be selected from among the above criteria. Taking the evaluation criterion of SAD as an example, the calculation formula is as follows:

number

[0659] where predTempSizeW is the width of the template, predTempSizeH is the height of the template, predTemp[i][j] is the pixel point of the template in BV, and predTempC[i][j] is the pixel point of the template of the current block.

[0660] That is, in an embodiment of the present application, the predetermined error criterion may include any one of the following: sum of absolute error (SAD), sum of absolute transformed error (SATD), sum of squared differences (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), and rate-distortion optimization (RDO).

[0661] As can be seen, in the present embodiment, the first template comprises one or more sample values ​​in adjacent decoded regions of the current block.

[0662] For example, in an embodiment of the present application, when selecting a template (first template of a current block), it can be determined whether a pixel at the template position is available and contains reconstructed luminance information based on the availability of pixels in the neighboring regions of the current block. As shown in Figure 6, based on the relative positional relationship between the template and the current block, the template can be classified into template types such as top template, left template, top right template, bottom left template, and top left template. Here, the template sizes of different types of different coding blocks can be fixed to the same size or can be different.

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

[0664] In addition, in the 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 first determined, and then the candidate BV of the current block can be determined based on the BVP and the candidate BVD, where the candidate BV indicates the position of the first matching template, and then the first matching template can be determined based on the candidate BV.

[0665] For example, in an embodiment of the present application, assuming that the BVP includes a third component currBvpX and a fourth component currBvpY, when determining a candidate BV for a current block based on the BVP and a candidate BVD, the two-dimensional vector of the candidate BV can be set to (currBvpX+candBvdX, currBvpY+candBvdY), that is, the two-dimensional vector of the BV can be 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 the BVP.

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

[0667] For example, in an embodiment of the present application, starting from the position of the current point, an area indicated by the two-dimensional vector of the candidate BV that has the same shape and contains the same number of sample values ​​as the first template can be determined as the first matching template.

[0668] When performing BV prediction for the current block, a new BV can be generated using the combination list of the BV and BVD of the current block. As shown in Figure 8, the current block is used to determine whether this BV is available (conditions for availability include that the reference block pointed to by the BV has already been reconstructed and does not exceed the search range and image boundary set by IBC). If the current BV is available, motion compensation is performed using the template of the current block and the new BV to obtain a template for the corresponding BV. As shown in Figure 9, the horizontal and vertical components of the BVD generate a total of four combined BVDs, and motion compensation is performed using each template. There are several cases for using templates when calculating the cost:

[0669] First case: If the top template and the left template of the current block both exist, and the top template and the left template both exist in the corresponding BV, then both the top template and the left template are available.

[0670] Second case: If both the top template and the left template of the current block exist, but only the top template exists in the corresponding BV, there are two methods: Method 1: The left template does not exist in the corresponding BV, so it is not used directly, i.e., calculation is performed using only the top template; Method 2: If the left template does not exist in the corresponding BV, the leftmost template width column in the reference block is used instead of the left template, i.e., calculation is performed using the top template and the left template.

[0671] Third case: If both the top template and the left template of the current block exist, but only the left template exists in the corresponding BV, there are two methods: Method 1: The top template does not exist in the corresponding BV, so it is not used directly, i.e., calculation is performed using only the left template; Method 2: If the top template does not exist in the corresponding BV, the topmost template height row in the reference block is used instead of the top template, i.e., calculation is performed using the top template and the left template.

[0672] Fourth case: If only the top template of the current block exists, there are three ways: Method 1: The top template does not exist in the corresponding BV and is not used directly; Method 2: If the top template does not exist in the corresponding BV, the topmost template height row in the reference block is adopted instead of the top template; Method 3: If the top template exists in the corresponding BV, it is used directly.

[0673] Fifth case: If only the left template of the current block exists, there are three ways: Method 1: The left template does not exist in the corresponding BV and is not used directly; Method 2: If the left template does not exist in the corresponding BV, the leftmost template width column in the reference block is adopted instead of the left template; Method 3: If the left template exists in the corresponding BV, it is used directly.

[0674] Sixth case: If the top template and left template of the current block both do not exist, the BVD combination in this case is ignored.

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

[0676] Furthermore, in the present embodiment, if both of the above two templates are available, processing is performed on these templates, including, but not limited to, weighted fusion of both templates, where the weighted fusion criterion can be a fixed weighting factor or a weighting factor based on the sum of the absolute values ​​of the differences between the reconstructed luminance pixel values ​​and the predicted luminance pixel values ​​of each template.

[0677] As can be seen from this, in the embodiment of the present application, template prediction is performed based on the BVP and BVD combination list (candidate BVD) of the current block, and the cost (first cost value) of each BVD combination (candidate BVD) in the BVD combination list is calculated (i.e., the cost of the template region is calculated). For various combinations in the BVD combination list, costs can be calculated using a template. Specifically, the cost can be calculated using the reconstructed luminance pixel at the template position of the current block and the reconstructed luminance pixel at the position obtained by performing template prediction using the BV obtained by combining the BVP and BVD of the current block.

[0678] In the embodiment of the present application, not only luminance but also chromaticity, i.e., Cb and Cr components, can be used when calculating the cost (first cost value), although the present application is not particularly limited thereto.

[0679] Furthermore, in an embodiment of the present application, after calculating the first cost value of each candidate BVD, the candidate BVDs are sorted using the first cost value to obtain a sorted result. Here, the sorted result may be a candidate BVD list of the current block after sorting, or a candidate BVD set of the candidate BVDs with the smallest first cost value determined by sorting. The present application is not specifically limited thereto.

[0680] In addition, in the embodiment of the present application, if the sorting result is a candidate BVD list of the current block, correspondingly, the sorting execution process may be to sort the candidate BVDs based on the first cost value and determine the candidate BVD list of the current block, where the candidate BVD list includes at least one candidate BVD.

[0681] Furthermore, in an embodiment of the present application, when sorting candidate BVDs based on the first cost value to determine the candidate BVD list for the current block, one or more candidate BVDs can be sorted in order of the smallest matching error indicated by the first cost value based on a predetermined error criterion to determine the candidate BVD list.

[0682] As can be understood, in the embodiment of the present application, the sorting result may be a new list OrderedList (candidate BVD list of the current block) sorted in ascending (descending) order. For example, sorting methods such as bubble sort, selection sort, insertion sort, shell sort, merge sort, quick sort, radix sort, heap sort, counting sort, packet sort, etc. may be adopted.

[0683] Furthermore, in the present embodiment, the sorting result may further be a new list OrderedList (the candidate BVD list of the current block) sorted in a specific order.

[0684] For example, in an embodiment of the present application, when sorting candidate BVDs based on the first cost value to determine the candidate BVD list of the current block, if absBvdX and absBvdY are not both 0, the candidate BVDs are stored in a first array and a second array, respectively. Then, based on the first cost value, the first candidate BVD and the second candidate BVD can be determined from the first array, and the third candidate BVD and the fourth candidate BVD can be determined from the second array. Finally, based on the first cost value, a sorting process can be performed on the first candidate BVD, the second candidate BVD, the third candidate BVD, and the fourth candidate BVD to determine the candidate BVD list.

[0685] If both the horizontal and vertical components of the BVD exist, that is, if absBvdX and absBvdY are not both 0, the combination list (candidate BVD) is {(+BVD HOR ,+BVD VER ),(+BVD HOR ,-BVD VER ),(-BVD HOR ,-BVD VER ),(-BVD HOR ,+BVD VER )} and the 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 elements in the above two lists can be rearranged in any order.

[0686] Two arrays, posiGrp and negativeGrp, are defined, where posiGrp stores two BVD combinations with positive signs in the same component (horizontal), and negativeGrp stores two BVD combinations with negative signs in the same component (horizontal).

[0687] posiGrp={(+BVD HOR ,+BVD VER ),(+BVD HOR ,-BVD VER )},negaGrp={(-BVD HOR ,+BVD VER ),(-BVD HOR ,-BVD VER )}. The order of the elements in the two lists, posiGrp and negaGrp, can be rearranged in any order.

[0688] First comparison: Cost (+BVD HOR ,+BVD VER ) and Cost(+BVD HOR ,-BVD VER) and set posiGrp[0] to the BVD combination with the smaller cost, and set posiGrp[1] to the BVD combination with the larger cost.

[0689] Second comparison: Cost(-BVD HOR ,+BVD VER ) and Cost(-BVD HOR ,-BVD VER ) and set negativeGrp[0] to the BVD combination with the smaller cost, and set negativeGrp[1] to the BVD combination with the larger cost.

[0690] Third comparison: Compare the magnitude of the Cost corresponding to posiGrp[0] and negaGrp[0].

[0691] In addition, in the embodiment of the present application, when sorting the first, second, third, and fourth candidate BVDs based on the first cost value to determine the candidate BVD list, one available method is as follows: if the first cost value of the first candidate BVD is less than or equal to the first cost 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. If the first cost value of the first candidate BVD is greater than the first cost 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.

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

[0693] In the third comparison, if the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0], place negativeGrp[0] in the 0th position of the candidate BVD list OrderedList, place posiGrp[0] in the 1st position of the candidate BVD list OrderedList, place negativeGrp[1] in the 2nd position of the candidate BVD list OrderedList, and place posiGrp[1] in the 3rd position of the candidate BVD list OrderedList.

[0694] Here, the candidate BVD at the 0th position of the candidate BVD list of the current block is the first candidate BVD in the candidate BVD list, the candidate BVD at the 1st position is the second candidate BVD in the candidate BVD list, the candidate BVD at the 2nd position is the third candidate BVD in the candidate BVD list, and the candidate BVD at the 3rd position is the fourth candidate BVD in the candidate BVD list.

[0695] In addition, in the embodiment of the present application, when sorting the first, second, third, and fourth candidate BVDs based on the first cost value and determining the candidate BVD list, another available method is as follows: if the first cost value of the first candidate BVD is less than or equal to the first cost 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. If the first cost value of the first candidate BVD is greater than the first cost 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.

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

[0697] In the third comparison, if the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0], place negativeGrp[0] in the 0th position of the candidate BVD list OrderedList, place posiGrp[0] in the 2nd position of the candidate BVD list OrderedList, place negativeGrp[1] in the 1st position of the candidate BVD list OrderedList, and place posiGrp[1] in the 3rd position of the candidate BVD list OrderedList.

[0698] Illustratively, in an embodiment of the present application, when sorting candidate BVDs based on the first cost value to determine a candidate BVD list for a current block, if absBvdX or absBvdY is equal to 0, the candidate BVD with the smallest first cost 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.

[0699] If only the horizontal or vertical component of the BVD exists, that is, if absBvdX or absBvdY is 0, a sorting process can be performed on the two candidate BVDs directly based on the first cost value to generate a candidate BVD list.

[0700] If only the vertical component of BVD exists, the combination list is {(0, +BVD VER ),(0,-BVD VER )} and the corresponding cost list is {Cost(0,+BVD VER ),Cost(0,-BVD VER )}. The order of the elements in the above two lists can be rearranged in any order.

[0701] The sorting process is as follows: Cost(0,+BVD VER ) and Cost(0,-BVD VER ) to compare their sizes.

[0702] Cost(0,+BVD VER )≦Cost(0,-BVD VER ), then (0,+BVD VER ) is placed at the 0th position of the candidate BVD list OrderedList, and (0,-BVD VER ) is placed at the first position of the candidate BVD list OrderedList.

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

[0704] If only the horizontal component of BVD exists, the combination list is {(+BVD HOR ,0),(-BVD HOR ,0)} and the corresponding cost list is {Cost(+BVD HOR ,0),Cost(-BVD HOR ,0)}. The order of the elements in the above two lists can be rearranged in any order.

[0705] The sorting process is as follows: Cost(+BVD HOR ,0) and Cost(-BVD HOR ,0) and compare their sizes.

[0706] Cost(+BVD HOR ,0)≦Cost(-BVD HOR ,0), then (+BVD HOR ,0) is placed at the 0th position of the candidate BVD list OrderedList, and (-BVD HOR ,0) is placed in the first position of the candidate BVD list OrderedList.

[0707] Cost(+BVD HOR ,0)>Cost(-BVD HOR ,0), then (-BVD HOR ,0) is placed at the 0th position of the candidate BVD list OrderedList, and (+BVD HOR ,0) is placed in the first position of the candidate BVD list OrderedList.

[0708] In addition, in the embodiment of the present application, if the sorting result is a candidate BVD set of the current block, correspondingly, the sorting execution process may be to sort the candidate BVDs based on the first cost value and determine the candidate BVD set of the current block, where the candidate BVD set includes at least one candidate BVD.

[0709] Furthermore, when sorting the candidate BVDs based on the first cost value to determine the candidate BVD set for the current block, if absBvdX and absBvdY are not both 0, the candidate BVDs are stored in a first array and a second array, respectively; then, the fifth candidate BVD with the smallest first cost value is determined from the first array, and the sixth candidate BVD with the smallest first cost value is determined from the second array; and finally, the candidate BVD with the smallest first cost value among the fifth and sixth candidate BVDs can be determined as the minimum-cost BVD in the candidate BVD set.

[0710] If both horizontal and vertical components of BVD exist, i.e., absBvdX and absBvdY are not both 0, then assume that the combination list is {(+,+),(+,-),(-,-),(-,+)} and the corresponding cost list is {Cost(+,+),Cost(+,-),Cost(-,-),Cost(-,+)}. The order of the elements in the above two lists can be rearranged in any order.

[0711] Two arrays, posiGrp and negativeGrp, are defined. posiGrp stores the sign combinations of two BVDs with positive signs in the same component (horizontal), and negativeGrp stores the sign combinations of two BVDs with negative signs in the same component (horizontal).

[0712] Assume that posiGrp={(+,+),(+,-)} and negaGrp={(-,+),(-,-)}. The order of the elements in the two lists, posiGrp and negaGrp, can be rearranged in any order.

[0713] First comparison: Compare the magnitudes of Cost(+,+) and Cost(+,-), and set posiGrp[0] to the sign combination of the BVD with the smaller cost, and set posiGrp[1] to the sign combination of the BVD with the larger cost.

[0714] Second comparison: Compare the magnitudes of Cost(-,+) and Cost(-,-), and set negativeGrp[0] to the sign combination of the BVD with the smaller cost, and set negativeGrp[1] to the sign combination of the BVD with the larger cost.

[0715] Third comparison: Compare the magnitude of the Cost corresponding to posiGrp[0] and negaGrp[0].

[0716] This makes it possible to determine the code combination of one BVD with the smallest cost, that is, to determine the smallest cost BVD in the candidate BVD set.

[0717] If there is only a horizontal or vertical component of the BVD, i.e., if absBvdX or absBvdY is 0, the two candidate BVDs can be sorted directly based on the first cost value to determine the smallest cost BVD in the candidate BVD set.

[0718] Illustratively, in an embodiment of the present application, when sorting candidate BVDs based on the first cost value to determine a candidate BVD set for a current block, if absBvdX or absBvdY is equal to 0, the candidate BVD with the smallest first cost value among the candidate BVDs can be determined as the minimum-cost BVD in the candidate BVD set.

[0719] If only the vertical component of the BVD exists, assume that the combination list is {(+,+),(+,-)} and the corresponding cost list is {Cost(+,+),Cost(+,-)}. The order of the elements in the above two lists can be rearranged in any order. The comparison process is as follows: By comparing the magnitudes of Cost(+,+) and Cost(+,-), the code combination of the BVD with the smallest cost can be determined, that is, the smallest-cost BVD in the candidate BVD set can be determined.

[0720] If there is only a horizontal component of the BVD, assume that the combination list is {(+,+),(-,+)} and the corresponding cost list is {Cost(+,+),Cost(-,+)}. The order of the elements in the above two lists can be rearranged in any order. The comparison process is as follows: By comparing the magnitudes of Cost(+,+) and Cost(-,+), the code combination of the BVD with the smallest cost can be determined, that is, the smallest-cost BVD in the candidate BVD set can be determined.

[0721] In step 302, the BVD code index information of the current block is determined based on the BVD code information of the current block and the sorting result.

[0722] In the embodiment of the present application, the candidate BVDs of the current block are sorted based on the BVD absolute value of the current block, and the sorting result is determined. Then, the BVD code index information of the current block can be determined based on the BVD code information of the current block and the sorting result.

[0723] In addition, in the embodiment of the present application, if the candidate BVD list of the current block obtained by the sorting process is a list in ascending (descending) order, it is possible to select whether to indirectly obtain BVD code index information (code prediction index) using the conversion list, or to directly obtain BVD code index information by logical inference.

[0724] Here, when BVD code index information is obtained indirectly using a transformation list, the BVD combination list OrderedList can first be transformed into an index transformation list TransformedList according to a transformation rule.

[0725] For example, in the embodiment of the present application, a transformation process is performed on the candidate BVD list to determine an index transformation list (TransformedList).

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

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

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

[0729] That is, in the present embodiment, when both horizontal and vertical components of BVD are present, the symbol prediction index of BVD is 2 bits.

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

[0731] [Table 97]

[0732] Using the following conversion rules, the sorted BVD combination list OrderedList is converted into a TransformedList (index-transformed list).

[0733] The BVD combination with the smallest cost after sorting is placed in the 0th position of the TransformedList list, i.e., (a1, a2) is placed in the 0th position of the TransformedList list. The BVD combination with the same sign as a1 is placed in the 2nd position of the TransformedList list, i.e., assuming that b1 has the same sign as a1, (b1, b2) is placed in the 2nd position of the TransformedList list. The BVD combination with the smaller cost and with the opposite sign to a1 is placed in the 1st position of the TransformedList list, i.e., (c1, c2) is placed in the 1st position of the TransformedList list. The BVD combination with the larger cost and with the opposite sign to a1 is placed in the 3rd position of the TransformedList list, i.e., (d1, d2) is placed in the 3rd position of the TransformedList list.

[0734] Then, the index transformation list TransformedList will look like this:

[0735] [Table 98]

[0736] For the index conversion list, the code prediction index is obtained according to the following rules, where the code prediction index is equal to the index of the leftmost column of the table:

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

[0738] For candidate BVD at index 0: If the horizontal component a1 == e1 is satisfied, then the 0th bit is 0, then its vertical component is checked, if the vertical component a2 == e2 is satisfied, then the 1st bit is 0, otherwise the 1st bit is 1.

[0739] If the horizontal component a1 == e1 is not satisfied, the 0th bit is 1; then, check the vertical component of the candidate BVD with index 1; if the vertical component c2 == e2 is satisfied, the 1st bit is 0; otherwise, the 1st bit is 1.

[0740] The code prediction index is expressed as follows:

[0741] bvsdIdx=bit0+bit1<<1 For example, assume that the sorted BVD combination list OrderedList is as follows:

[0742] [Table 99]

[0743] Next, the sorted BVD combination list OrderedList is converted to TransformedList according to the above conversion rules.

[0744] [Table 100]

[0745] (1) The horizontal component of the true BVD is -BVD HOR and the vertical component is +BVD VER Assuming that, then: bvsdIdx=0

[0746] (2) The horizontal component of the true BVD is -BVD HOR and the vertical component is -BVD VER Assuming that, then: bvsdIdx=2

[0747] (3) The horizontal component of the true BVD is +BVD HOR and the vertical component is +BVD VER Assuming that, then: bvsdIdx=1

[0748] (4) The horizontal component of the true BVD is +BVD HOR and the vertical component is -BVD VER Assuming that, then: bvsdIdx=3

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

[0750] That is, when only the vertical component of the BVD is present, the symbol prediction index of the BVD is 1 bit.

[0751] Assume that the sorted BVD combination list OrderedList is as follows:

[0752] [Table 101]

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

[0754] The index transformation list TransformedList is as follows:

[0755] [Table 102]

[0756] For the index conversion list, the code prediction index is obtained according to the following rules, where the code prediction index is equal to the index of the leftmost column of the table:

[0757] Assume that the horizontal component of the true BVD is 0 and the vertical component is e2.

[0758] If a2==e2, then the 0th bit is 0, otherwise the 0th bit is 1.

[0759] The code prediction index is expressed as follows: bvsdIdx=bit0

[0760] For example, assume that the sorted BVD combination list OrderedList is as follows:

[0761] [Table 103]

[0762] The index transformation list TransformedList is as follows:

[0763] [Table 104]

[0764] (1) The horizontal component of the true BVD is 0, and the vertical component is +BVD. VER Assuming that, then: bvsdIdx=0

[0765] (2) The horizontal component of the true BVD is 0 and the vertical component is -BVD. VER Assuming that, then: bvsdIdx=1

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

[0767] That is, when only the horizontal component of BVD is present, the symbol prediction index of BVD is 1 bit.

[0768] Assume that the sorted BVD combination list OrderedList is as follows:

[0769] [Table 105]

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

[0771] The index transformation list TransformedList is as follows:

[0772] [Table 106]

[0773] For the index conversion list, the code prediction index is obtained according to the following conversion rules, where the code prediction index is equal to the index of the leftmost column of the table.

[0774] Assume that the horizontal component of the true BVD is e1 and the vertical component is 0.

[0775] If a1==e1, then the 0th bit is 0, otherwise the 0th bit is 1.

[0776] The code prediction index is expressed as follows: bvsdIdx=bit0

[0777] For example, assume that the sorted BVD combination list OrderedList is as follows:

[0778] [Table 107] The v index transformation list TransformedList is as follows:

[0779] [Table 108]

[0780] (1) The horizontal component of the true BVD is +BVD HOR and assuming the vertical component is 0, we get: bvsdIdx=0

[0781] (2) The horizontal component of the true BVD is -BVD HOR and assuming the vertical component is 0, we get: bvsdIdx=1

[0782] Furthermore, when directly obtaining BVD code index information through logical inference, if both horizontal and vertical components of the BVD exist, the BVD code index information of the current block is determined based on the BVD code information of the current block and the sorting result. If absBvdX and absBvdY are not both 0, if the first component code of the BVD code information of the current block is the same as the first component code of the first candidate BVD in the candidate BVD list, the first bit of the BVD code index information is determined to be 0; otherwise, the first bit is determined to be 1. Next, the candidate BVD list is traversed to determine the first candidate BVD having the same first component code as the BVD code information of the current block. If the second component code of the BVD code information of the current block is the same as the second component code of the first candidate BVD, the second bit of the BVD code index information is determined to be 0; otherwise, the second bit is determined to be 1.

[0783] As can be seen, in the first case, both the horizontal and vertical components of the BVD are present, and in this case the symbol prediction index of the BVD is 2 bits.

[0784] Assume that the sorted BVD combination list OrderedList is as follows:

[0785] [Table 109]

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

[0787] For the candidate BVD with index 0, if the horizontal component a1 == e1 is satisfied, then the 0th bit is 0, otherwise the 0th bit is 1. Then, starting from index 0, traverse the sorted list, and for the first BVD in the list that has the same horizontal component as that of the true BVD, check its vertical component. Assume the vertical component is f2, and if f2 == e2 is satisfied, then the 1st bit is 0, otherwise the 1st bit is 1. The code prediction index is expressed as follows: bvsdIdx=bit0+bit1<<1

[0788] Bit0 is the 0th bit and bit1 is the 1st bit.

[0789] For example, assume that the sorted BVD combination list OrderedList is as follows:

[0790] [Table 110]

[0791] (1) The horizontal component of the true BVD is -BVD HOR and the vertical component is +BVD VER Assume that:

[0792] In this case, the 0th bit is 0 and the 1st bit is 0. The code prediction index is expressed as follows: bvsdIdx=bit0+bit1<<1=0

[0793] (2) The horizontal component of the true BVD is -BVD HOR and the vertical component is -BVD VER Assume that:

[0794] In this case, the 0th bit is 0 and the 1st bit is 1. The code prediction index is expressed as follows: bvsdIdx=bit0+bit1<<1=2

[0795] (3) The horizontal component of the true BVD is +BVD HOR and the vertical component is +BVD VER Assume that:

[0796] In this case, the 0th bit is 1 and the 1st bit is 0. The code prediction index is expressed as follows: bvsdIdx=bit0+bit1<<1=1

[0797] (4) The horizontal component of the true BVD is +BVD HOR and the vertical component is -BVD VER Assume that:

[0798] In this case, the 0th bit is 1 and the 1st bit is 1. The code prediction index is expressed as follows: bvsdIdx=bit0+bit1<<1=3

[0799] Furthermore, when directly obtaining the BVD code index information through logical inference, if only the vertical component of the BVD exists, the BVD code index information of the current block is determined based on the BVD code information of the current block and the sorting result. If absBvdX is 0, if the second component code of the BVD code information of the current block is the same as the second component code of the first candidate BVD in the candidate BVD list, the BVD code index information is determined to be 0; otherwise, the BVD code index information is determined to be 1.

[0800] As can be seen, in the second case, only the vertical component of the BVD is present, and in this case the code prediction index of the BVD is 1 bit.

[0801] Assume that the sorted BVD combination list OrderedList is as follows:

[0802] [Table 111]

[0803] Assume that the horizontal component of the true BVD is 0 and the vertical component is e2.

[0804] If a2==e2, then the 0th bit is 0, otherwise the 0th bit is 1.

[0805] The code prediction index is expressed as follows:

[0806] bvsdIdx=bit0 For example, assume that the sorted BVD combination list OrderedList is as follows:

[0807] [Table 112] (1) The horizontal component of the true BVD is 0, and the vertical component is +BVD. VER Assume that:

[0808] The 0th bit is 0. The code prediction index is expressed as follows: bvsdIdx=bit0=0 (2) The horizontal component of the true BVD is 0 and the vertical component is -BVD. VER Assume that:

[0809] The 0th bit is 1. The code prediction index is expressed as follows: bvsdIdx=bit0=1

[0810] Furthermore, when directly obtaining the BVD code index information through logical inference, if only the horizontal component of the BVD exists, the BVD code index information of the current block is determined based on the BVD code information of the current block and the sorting result. If absBvdY is 0, if the first component code of the BVD code information of the current block is the same as the first component code of the first candidate BVD in the candidate BVD list, the BVD code index information is determined to be 0; otherwise, the BVD code index information is determined to be 1.

[0811] As can be seen, in the third case, only the horizontal component of the BVD exists, and in this case the symbol prediction index of the BVD is 1 bit.

[0812] Assume that the sorted BVD combination list OrderedList is as follows:

[0813] [Table 113]

[0814] Assume that the horizontal component of the true BVD is e1 and the vertical component is 0.

[0815] If a1==e1, then the 0th bit is 0, otherwise the 0th bit is 1.

[0816] The code prediction index is expressed as follows:

[0817] bvsdIdx=bit0 For example, assume that the sorted BVD combination list OrderedList is as follows:

[0818] [Table 114]

[0819] (1) The horizontal component of the true BVD is +BVD HORand assume the vertical component is 0.

[0820] The 0th bit is 0. The code prediction index is expressed as follows: bvsdIdx=bit0=0

[0821] (2) The horizontal component of the true BVD is -BVD HOR and assume the vertical component is 0.

[0822] The 0th bit is 1. The code prediction index is expressed as follows: bvsdIdx=bit0=1

[0823] In this embodiment, if the candidate BVD list of the current block obtained by sorting is a list in a specific order, the list index of the candidate BVD that corresponds to the horizontal and vertical component codes of the true BVD and has the same code can be directly determined as the BVD code index information (code prediction index) of the BVD. Here, the sorted BVD combination list OrderedList can be directly substituted into TransformedList, that is, the candidate BVD list OrderedList and the index transformation list TransformedList are the same.

[0824] As can be understood, in the embodiment of the present application, when the candidate BVD list of the current block obtained by the sorting process is a list in a specific order, the encoding side can directly encode the two components corresponding to the BVDs at the same time, and correspondingly, the decoding side can directly determine the two components corresponding to the BVDs together based on the BVD code index information.

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

[0826] Accordingly, in the embodiment of the present application, the decoding side analyzes the combination index (BVD code index information) to simultaneously obtain the horizontal and vertical components, while on the encoding side, the encoder can use a traversal method to determine the index (BVD code index information) to be transmitted.

[0827] As can be understood, in the embodiment of the present application, when the candidate BVD list determined by sorting the matching errors indicated by the first cost values ​​in ascending order, i.e., the candidate BVD list of the current block is an ascending (descending) list, the BVD code index information can also be set directly based on the index value of the candidate BVD in the list that has the same BVD code information as the current block.

[0828] For example, in an embodiment of the present application, when determining the BVD code index information of the current block based on the BVD code information of the current block and the sorting result, a candidate BVD having the same BVD code information as the current block is determined from the candidate BVD list, and then the BVD code index information can be set based on the index value of the candidate BVD.

[0829] In the first case, both the horizontal and vertical components of the BVD are present, in which case the BVD code prediction index is 2 bits.

[0830] Assume that the sorted BVD combination list OrderedList is as follows:

[0831] [Table 115]

[0832] Then, the index transformation list TransformedList is as follows:

[0833] [Table 116]

[0834] For the index conversion list, the code prediction index is obtained according to the following rules, where the code prediction index is equal to the index of the leftmost column of the table:

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

[0836] For candidate BVD with index 0: If the horizontal component a1 == e1 is satisfied, then the 0th bit is 0, then its vertical component is checked, if the vertical component a2 == e2 is satisfied, then the 1st bit is 0, otherwise the 1st bit is 1.

[0837] If the horizontal component a1 == e1 is not satisfied, the 0th bit is 1; then, check the vertical component of the candidate BVD with index 1; if the vertical component c2 == e2 is satisfied, the 1st bit is 0; otherwise, the 1st bit is 1.

[0838] The code prediction index is expressed as follows:

[0839] bvsdIdx=bit0+bit1<<1 For example, assume that the sorted BVD combination list OrderedList is as follows:

[0840] [Table 117]

[0841] In this case, the TransformedList is:

[0842] [Table 118]

[0843] (1) The horizontal component of the true BVD is -BVD HOR and the vertical component is +BVD VER Assuming that, then: bvsdIdx=0

[0844] (2) The horizontal component of the true BVD is -BVD HOR and the vertical component is -BVD VER Assuming that, then: bvsdIdx=2

[0845] (3) The horizontal component of the true BVD is +BVD HOR and the vertical component is +BVD VER Assuming that, then: bvsdIdx=1

[0846] (4) The horizontal component of the true BVD is +BVD HOR and the vertical component is -BVD VER Assuming that, then: bvsdIdx=3

[0847] In the second case, only the vertical component of the BVD is present, in which case the symbol prediction index of the BVD is 1 bit.

[0848] Assume that the sorted BVD combination list OrderedList is as follows:

[0849] [Table 119]

[0850] Then, the index transformation list TransformedList is as follows:

[0851] [Table 120]

[0852] For the index conversion list, the code prediction index is obtained according to the following rules, where the code prediction index is equal to the index of the leftmost column of the table:

[0853] Assume that the horizontal component of the true BVD is 0 and the vertical component is e2.

[0854] If a2==e2, then the 0th bit is 0, otherwise the 0th bit is 1.

[0855] The code prediction index is expressed as follows: bvsdIdx=bit0

[0856] For example, assume that the sorted BVD combination list OrderedList is as follows:

[0857] [Table 121]

[0858] The TransformedList is as follows:

[0859] [Table 122]

[0860] (1) The horizontal component of the true BVD is 0, and the vertical component is +BVD. VER Assuming that, then: bvsdIdx=0

[0861] (2) The horizontal component of the true BVD is 0 and the vertical component is -BVD. VER Assuming that, then: bvsdIdx=1

[0862] In the third case, only the horizontal component of the BVD is present, in which case the symbol prediction index of the BVD is 1 bit.

[0863] Assume that the sorted BVD combination list OrderedList is as follows:

[0864] [Table 123]

[0865] Then, the index transformation list TransformedList is as follows:

[0866] [Table 124]

[0867] For the index conversion list, the code prediction index is obtained according to the following rules, where the code prediction index is equal to the index of the leftmost column of the table:

[0868] Assume that the horizontal component of the true BVD is e1 and the vertical component is 0.

[0869] If a1==e1, then the 0th bit is 0, otherwise the 0th bit is 1.

[0870] The code prediction index is expressed as follows: bvsdIdx=bit0

[0871] For example, assume that the sorted BVD combination list OrderedList is as follows:

[0872] [Table 125]

[0873] The TransformedList is as follows:

[0874] [Table 126]

[0875] (1) The horizontal component of the true BVD is +BVD HOR and assuming the vertical component is 0, we get: bvsdIdx=0

[0876] (2) The horizontal component of the true BVD is -BVD HOR and assuming the vertical component is 0, we get: bvsdIdx=1

[0877] In this embodiment, when the sorting result is a candidate BVD set for the current block, the candidate BVD with the smallest template matching cost is determined after sorting, i.e., the smallest cost BVD in the candidate BVD set is determined. At this time, if the value of bvsdIdx is bit0+bit1<<1, i.e., bit0 represents the horizontal component code and bit1 represents the vertical component code, the smallest BVD code combination (smallest cost BVD) determines the code of bit0 and bit1 when the value is 0, and the code of bit0 and bit1 when the value is 1 is the opposite.

[0878] Furthermore, in the embodiment of the present application, when determining the BVD code index information of the current block based on the BVD code information of the current block and the sorting result, if absBvdX and absBvdY are not both 0, if the first component code of the BVD code information of the current block is the same as the first component code of the minimum-cost BVD in the candidate BVD set, it is determined that the value of the first bit of the BVD code index information is 0, and then the second bit of the BVD code index information of the current block can be determined based on the minimum-cost BVD in the candidate BVD set.

[0879] Furthermore, in an embodiment of the present application, when determining the BVD code index information of the current block based on the BVD code information of the current block and the sorting result, if absBvdX and absBvdY are not both 0, if the first component code of the BVD code information of the current block is different from the first component code of the minimum-cost BVD in the candidate BVD set, the value of the first bit of the BVD code index information is determined to be 1. Then, the second bit of the BVD code index information of the current block can be determined based on the minimum-cost BVD in another array other than the array in which the minimum-cost BVD in the candidate BVD set is located.

[0880] In the embodiment of the present application, when determining the second bit of the BVD code index information of the current block based on the minimum-cost BVD in the candidate BVD set, if the second component code of the BVD code information of the current block is the same as the second component code of the minimum-cost BVD in the candidate BVD set, the value of the second bit of the BVD code index information is determined to be 0; if the second component code of the BVD code information of the current block is different from the second component code of the minimum-cost BVD in the candidate BVD set, the value of the second bit of the BVD code index information is determined to be 1.

[0881] In addition, in the embodiment of the present application, when determining the second bit of the BVD code index information of the current block based on the minimum-cost BVD in another array other than the array in which the minimum-cost BVD in the candidate BVD set is located, if the second component code of the BVD code information of the current block is the same as the second component code of the minimum-cost BVD in the other array, the value of the second bit of the BVD code index information is determined to be 0, and if the second component code of the BVD code information of the current block is different from the second component code of the minimum-cost BVD in the other array, the value of the second bit of the BVD code index information is determined to be 1.

[0882] In this embodiment, it is assumed that the signs of the horizontal and vertical components of the true BVD are bvdSign[0] and bvdSign[1], where a value of 0 indicates positive and a value of 1 indicates negative.

[0883] Illustratively, in an embodiment of the present application, when there are both horizontal and vertical components of the BVD, the two possible cases of the minimum cost BVD in the set of candidate BVDs determined after sorting are as follows:

[0884] (1) In the third comparison, if the Cost corresponding to posiGrp[0] is equal to or less than the Cost corresponding to negaGrp[0]: If bvd_sign[0]=0, the 0th bit is 0. Then, determine whether bvd_sign[1] is equal to posiGrp[0][1], if so, the 1st bit is 0, otherwise the 1st bit is 1.

[0885] If bvd_sign[0]=1, the 0th bit is 1. Then determine whether bvd_sign[1] is equal to negativeGrp[0][1], if so, the 1st bit is 0, otherwise the 1st bit is 1.

[0886] (2) In the third comparison, if the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0]: If bvd_sign[0]=0, the 0th bit is 1. Then determine whether bvd_sign[1] is equal to posiGrp[0][1], if so, the 1st bit is 0, otherwise the 1st bit is 1.

[0887] If bvd_sign[0]=1, the 0th bit is 0. Then determine whether bvd_sign[1] is equal to negativeGrp[0][1], if so, the 1st bit is 0, otherwise the 1st bit is 1.

[0888] Furthermore, in the embodiment of the present application, when determining the BVD code index information of the current block based on the BVD code information of the current block and the sorting result, if absBvdX is 0, if the second component code of the BVD code information of the current block is the same as the second component code of the minimum-cost BVD in the candidate BVD set, the value of the BVD code index information is determined to be 0; otherwise, the value of the BVD code index information is determined to be 1.

[0889] Illustratively, in an embodiment of the present application, when only vertical components of the BVD exist, the two possible cases of the minimum cost BVD in the set of candidate BVDs determined after sorting are as follows:

[0890] (1) If Cost(+,+)≦Cost(+,-): If bvd_sign[1]=0, the 0th bit is 0. If bvd_sign[1]=1, the 0th bit is 1.

[0891] (2) If Cost(+,+)>Cost(+,-): If bvd_sign[1]=0, the 0th bit is 1. If bvd_sign[1]=1, the 0th bit is 0.

[0892] Furthermore, in the embodiment of the present application, when determining the BVD code index information of the current block based on the BVD code information of the current block and the sorting result, if absBvdY is 0, if the first component code of the BVD code information of the current block is the same as the first component code of the minimum-cost BVD in the candidate BVD set, the value of the BVD code index information is determined to be 0; otherwise, the value of the BVD code index information is determined to be 1.

[0893] Illustratively, in an embodiment of the present application, when only horizontal components of BVDs exist, the two possible cases of the minimum cost BVD in the set of candidate BVDs determined after sorting are as follows:

[0894] (1) If Cost(+,+)≦Cost(-,+): If bvd_sign[0]=0, the 0th bit is 0. If bvd_sign[0]=1, the 0th bit is 1.

[0895] (2) If Cost(+,+)>Cost(-,+): If bvd_sign[0]=0, the 0th bit is 1. If bvd_sign[0]=1, the 0th bit is 0.

[0896] As can be seen, the above method of determining the BVD code index information of the current block based on the candidate BVD set can omit the steps of establishing a list and obtaining a code prediction index. When both horizontal and vertical components of the BVD exist, the coding side can obtain the coding targets bit0 and bit1 through three comparisons, thereby reducing the complexity.

[0897] In step 303, the BVD magnitude and BVD code index information are written to the bitstream.

[0898] In the embodiment of the present application, the BVD code index information of the current block is determined based on the BVD code information of the current block and the sorting result, and then the BVD absolute value and the BVD code index information can be written into the bitstream.

[0899] Furthermore, in embodiments of the present application, the BVD magnitude and BVD code index information can be encoded using context-based adaptive binary arithmetic coding (CABAC), or the BVD magnitude and BVD code index information can be encoded using bypass mode.

[0900] In the present embodiment, it is necessary to write the BVD absolute value and the BVD code index information (code prediction index) into the bit stream. Here, the BVD code index information (code prediction index) can be first binarized.

[0901] For example, in an embodiment of the present application, if the code prediction index is 2 bits, it is coded as 00B when it is 0, as 01B when it is 1, as 10B when it is 2, and as 11B when it is 3. If the code prediction index is 1 bit, it is coded as 0B when it is 0, and as 1B when it is 1.

[0902] Then, context-based adaptive binary arithmetic coding (CABAC) or bypass can be used to encode each bit of the above converted binary number, i.e., the code prediction index of BVD can be written into the bitstream.

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

[0904] For example, different probability models can be used for the bits of the symbol prediction index of the BVD based on the magnitude of the absolute value of the horizontal or vertical component of the BVD.

[0905] (1) Suppose the threshold used for classification using the absolute value of the horizontal or vertical component of BVD is THR0 and there are two probability models. When the code prediction index is two bits, the 0th bit of this binary number is distinguished based on the magnitude relationship between the absolute value of the horizontal component of BVD and THR0. That is, if the absolute value of the horizontal component of BVD is equal to or less than THR0, the first probability model is used, and if the absolute value of the horizontal component of BVD is greater than THR0, the second probability model is used. The 1st bit of the above binary number is also distinguished based on the magnitude relationship between the absolute value of the vertical component of BVD and THR0. That is, if the absolute value of the vertical component of BVD is equal to or less than THR0, the first probability model is used, and if the absolute value of the vertical component of BVD is greater than THR0, the second probability model is used.

[0906] (2) Suppose the threshold used for classification using the absolute value of the horizontal component of BVD is THR0, the threshold used for classification using the absolute value of the vertical component is THR1, and there are four probability models in total. If the code prediction index is two bits, the zeroth bit of this binary number is distinguished based on the magnitude relationship between the absolute value of the horizontal component of BVD and THR0. That is, if the absolute value of the horizontal component of BVD is equal to or less than THR0, the first probability model is used. If the absolute value of the horizontal component of BVD is greater than THR0, the second probability model is used. And the first bit of the above binary number is distinguished based on the magnitude relationship between the absolute value of the vertical component of BVD and THR1. That is, if the absolute value of the vertical component of BVD is equal to or less than THR1, the third probability model is used. If the absolute value of the vertical component of BVD is greater than THR1, the fourth probability model is used.

[0907] In summary, the coding method proposed in steps 301 to 303 above creates a BVD combination list for possible BVD codes and BVD absolute values, sorts the combination list using a template, and performs CABAC coding using the true BVD code and the code prediction index obtained using the sorted list. Compared with bypass coding, this method has higher coding efficiency and can reduce the bit rate required for BVD transmission in IBC.

[0908] It should be noted that the coding method proposed by the embodiments of the present application can, on the one hand, fully utilize the similarity between the template and the current coding block to effectively sort the BVD code combination list, and, on the other hand, can perform coding using CABAC, which has higher coding efficiency than bypass coding.

[0909] Furthermore, in the encoding method proposed by the embodiments of the present application, for an encoder, when performing encoding processing, the BVD encoding input can be true information of the BVD absolute value and code, and the BVD encoding output can be bitstream information of the BVD absolute value and code (BVD code index information).

[0910] Here, FIG. 13 is a schematic diagram 2 of an encoding method in an embodiment of the present application. As shown in FIG. 13, the BVD encoding process includes: encoding the absolute value of the BVD (step 401); determining a candidate BVD for the current block by creating a BVD combination list for possible BVD codes and absolute values ​​of the BVD (step 402); performing template prediction based on the BVP and BVD combination list of the current block, and calculating the cost of each BVD combination in the BVD combination list (i.e., calculating the cost (first cost value) of the template region with respect to the combination list) (step 403); sorting the list, and obtaining a code prediction index (BVD code index information) using the true BVD code and the sorted list (step 404); and finally, encoding the BVD code prediction index (BVD code index information) (step 405).

[0911] In the embodiment of the present application, not only luminance but also chromaticity, i.e., Cb and Cr components, can be used when calculating the cost (first cost value), although the present application is not particularly limited thereto.

[0912] Furthermore, in the embodiments of the present application, when calculating the cost, if both of the two templates are available, the following processing is performed on the templates, including but not limited to performing weighted fusion on the two templates, where the basis for the weighted fusion can be a fixed weighting coefficient, or a weighting coefficient can be assigned based on the sum of the absolute values ​​of the pixel value differences between the reconstructed luminance and the predicted luminance of each template.

[0913] Furthermore, in the embodiment of the present application, the costs of the sorted BVD combination list (candidate BVD list) can be stored, and then re-sorted based on these stored costs. The specific process is as follows: If the cost difference between a candidate and its immediately preceding candidate in the list is less than a value λ, for example, |D1-D2|<λ, 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 RD criterion on the encoder side.

[0914] Illustratively, the algorithm for calculating the cost is defined as follows:

[0915] (1) For all candidates in the list, determine the minimum cost difference between a given candidate and its previous candidate. If the minimum cost difference is greater than or equal to λ, the list is considered sufficiently diverse and we stop re-sorting.

[0916] If this minimum cost difference is less than λ, the candidate is deemed redundant and moved to another position, which is sufficiently diverse compared to the previous candidate.

[0917] (2) The algorithm stops after a finite number of iterations. Furthermore, in the embodiments of the present application, a specific ordered list of candidate BVDs, OrderedList, is adopted to determine the set of candidate BVDs. In the solution proposed in the above embodiments of storing each candidate BVD using two arrays, if both horizontal and vertical components of the BVD exist, the order of the horizontal and vertical components can be reversed.

[0918] For example, in the present embodiment, it is assumed that the combination list is {(+,+),(+,-),(-,-),(-,+)} and the corresponding cost list is {Cost(+,+),Cost(+,-),Cost(-,-),Cost(-,+)}. The order of the elements in the above two lists can be rearranged in any order.

[0919] Two arrays, posiGrp and negativeGrp, are defined, where posiGrp stores the sign combinations of two BVDs with positive signs in the same component (vertical), and negativeGrp stores the sign combinations of two BVDs with negative signs in the same component (vertical).

[0920] Assume that posiGrp={(+,+),(-,+)} and negaGrp={(+,-),(-,-)}. The order of the elements in the two lists, posiGrp and negaGrp, can be rearranged in any order.

[0921] First comparison: Compare the magnitude of Cost(+,+) and Cost(-,+), and set posiGrp[0] to the BVD combination with the smaller cost, and set posiGrp[1] to the BVD combination with the larger cost.

[0922] Second comparison: Compare the magnitude of Cost(+,-) and Cost(-,-), and set negativeGrp[0] to the BVD combination with the smaller cost, and set negativeGrp[1] to the BVD combination with the larger cost.

[0923] Third comparison: Compare the magnitude of the Cost corresponding to posiGrp[0] and negaGrp[0].

[0924] (1) In the third comparison, if the Cost corresponding to posiGrp[0] is equal to or less than the Cost corresponding to negaGrp[0]: If bvd_sign[1]=0, the 0th bit is 0. Then, determine whether bvd_sign[0] is equal to posiGrp[0][0], if it is, the 1st bit is 0, otherwise the 1st bit is 1.

[0925] If bvd_sign[1]=1, then the 0th bit is 1. Then determine whether bvd_sign[0] is equal to negativeGrp[0][0], if so, then the 1st bit is 0, otherwise the 1st bit is 1.

[0926] (2) In the third comparison, if the Cost corresponding to posiGrp[0] is greater than the Cost corresponding to negaGrp[0]: If bvd_sign[1]=0, then the 0th bit is 1. Then determine whether bvd_sign[0] is equal to posiGrp[0][0], if so, then the 1st bit is 0, otherwise the 1st bit is 1.

[0927] If bvd_sign[1]=1, the 0th bit is 0. Then determine whether bvd_sign[0] is equal to negativeGrp[0][0], if so, the 1st bit is 0, otherwise the 1st bit is 1.

[0928] Furthermore, in the embodiment of the present application, when both horizontal and vertical components of a BVD exist, the order of the horizontal and vertical components can be determined according to a specific criterion in the operation process of swapping the order of the horizontal and vertical components, including, but not limited to, determining the order of the horizontal and vertical components based on the magnitude of the absolute values ​​of the horizontal and vertical components of the BVD.

[0929] An embodiment of the present application provides an encoding / decoding method, in which the decoding side decodes a bitstream, determines a BVD absolute value and BVD code index information of a current block, sorts candidate BVDs of the current block according to the BVD absolute value of the current block to determine the sorting result, determines a BVD of the current block according to the BVD code index information and the sorting result, and determines a reconstructed value of the current block according to the BVD of the current block. The encoding side sorts candidate BVDs of the current block according to the BVD absolute value of the current block to determine the sorting result, determines BVD code index information of the current block according to the BVD code information of the current block and the sorting result, and writes the BVD absolute value and BVD code index information into the bitstream. As can be seen, in the embodiment of the present application, an effective sorting process can be performed on the candidate BVDs of the current block based on the BVD absolute value of the current block. Therefore, during encoding, the sorting result can be used to determine and transmit BVD code index information. During decoding, the sorting result can be used to analyze the BVD code information of the current block. Furthermore, the CABAC encoding / decoding technology can be used to perform encoding / decoding processes on the BVD code information. This effectively reduces the bit rate required for BVD code transmission in IBC mode, and improves coding efficiency.

[0930] Based on the above embodiment, in another embodiment of the present application, based on the same inventive concept as the above embodiment, refer to FIG. 14, an exemplary structure diagram 1 of the configuration of the encoder is shown, and as shown in FIG. 14, the encoder 110 can include a first determination unit 111 and an encoding unit 112.

[0931] The first determination unit 111 is configured to perform a sorting process on the candidate BVDs of the current block based on the BVD absolute value of the current block, determine the sorting result, and determine BVD code index information of the current block based on the BVD code information of the current block and the sorting result.

[0932] The encoding unit 112 is configured to write the BVD magnitude and the BVD code index information into a bitstream.

[0933] In this embodiment, a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, etc. Of course, it should be understood that a "unit" may be modular or non-modular. Furthermore, each component in this embodiment may be integrated into a single processing unit, each unit may be a separate, independent physical unit, or two or more units may be integrated into a single unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional module.

[0934] When the integrated unit is realized in the form of a software functional module rather than being sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, an essential part of the technical solution of the present embodiment, i.e., a part contributing to the prior art, or all or part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media capable of storing program code, such as a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0935] Therefore, an embodiment of the present application provides a computer-readable storage medium applied to the encoder 110, the computer-readable storage medium storing a computer program, the computer program causing a first processor to perform the method in any of the above embodiments.

[0936] Based on the above configuration of the encoder 110 and the computer-readable storage medium, referring to FIG. 15, an exemplary structure diagram 2 of the encoder configuration is shown. As shown in FIG. 15, the encoder 110 may include a first memory 113, a first processor 114, a first communication interface 115, and a first bus system 116, where the first memory 113, the first processor 114, and the first communication interface 115 are coupled to each other by the first bus system 116. It can be understood that the first bus system 116 is used to realize communication between these components. In addition to a data bus, the first bus system 116 further includes a power bus, a control bus, and a status signal bus. However, for clarity, various buses are referred to as the first bus system 116 in FIG. 10.

[0937] The first communication interface 115 is configured to send and receive signals in the process of sending and receiving information to and from other external network elements.

[0938] The first memory 113 is configured to store a computer program executable by the first processor.

[0939] The first processor 114 is configured to execute the computer program to perform the following processes, including: performing a sorting process on candidate BVDs of the current block based on the BVD absolute value of the current block, determining a sorting result; determining BVD code index information of the current block based on the BVD code information of the current block and the sorting result; and writing the BVD absolute value and the BVD code index information into a bitstream.

[0940] It should be understood that first memory 113 in the present embodiment may be volatile or nonvolatile memory, or may include both volatile and nonvolatile memory. Here, nonvolatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM), used as an external cache. By way of example and not of 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), synchlink dynamic random access memory (SLDRAM), and direct memory bus random access memory (DRRAM), and the first memory 113 in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0941] The first processor 114 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be performed by a hardware-type integrated logic circuit or software-type instructions in the first processor 114. The first processor 114 may 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 device, a discrete gate or transistor logic device, a discrete hardware component, or the like, and may implement or execute each method, step, and logic block diagram disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like. The steps of the method disclosed in the embodiments of the present application may be performed directly 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 conventional storage medium such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, 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 performs the steps of the method in combination with its hardware.

[0942] As can be appreciated, the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For a hardware implementation, the processing unit can be implemented as one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processing (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field-Programmable Gate Arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units configured to perform the functions described herein, or a combination thereof. For a software implementation, the techniques described herein can be implemented by modules (processes, functions, etc.) that perform the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented within or external to the processor.

[0943] Illustratively, as another embodiment, the first processor 114 is further configured to execute the computer program to perform the method described in any one of the above embodiments.

[0944] FIG. 16 is an exemplary structural diagram 1 of the decoder configuration. As shown in FIG. 16, the decoder 120 includes a decoding unit 121 and a second determining unit 122.

[0945] The decoding unit 121 is configured to decode a bitstream.

[0946] The second determination unit 122 is configured to determine a BVD absolute value and BVD code index information of a current block, perform a sorting process on candidate BVDs of the current block based on the BVD absolute value of the current block, determine a sorting result, determine a BVD of the current block based on the BVD code index information and the sorting result, and determine a reconstructed value of the current block based on the BVD of the current block.

[0947] In this embodiment, a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, etc. Of course, it should be understood that a "unit" may be modular or non-modular. Furthermore, each component in this embodiment may be integrated into a single processing unit, or each unit may be a separate, independent physical unit, or two or more units may be integrated into a single unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional module.

[0948] When the integrated unit is realized in the form of a software functional module rather than being sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, an essential part of the technical solution of the present embodiment, i.e., a part contributing to the prior art, or all or part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media capable of storing program code, such as a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0949] Accordingly, an embodiment of the present application provides a computer-readable storage medium adapted to be applied to the decoder 120, the computer-readable storage medium storing a computer program, the computer program causing a first processor to perform the method of any of the above embodiments.

[0950] Based on the above-described configuration of the decoder 120 and the computer-readable storage medium, FIG. 17 illustrates an exemplary structure diagram 2 of the decoder configuration. As shown in FIG. 17, the decoder 120 may include a second memory 123, a second processor 124, a second communication interface 125, and a second bus system 126. The second memory 123, the second processor 124, and the second communication interface 125 are coupled to each other by the second bus system 126. As can be understood, the second bus system 126 is configured to realize communication connections between these components. In addition to the data bus, the second bus system 126 further includes a power bus, a control bus, and a status signal bus. However, for clarity, various buses are referred to as the second bus system 126 in FIG. 12.

[0951] The second communication interface 125 is configured to send and receive signals in the process of sending and receiving information to and from other external network elements.

[0952] The second memory 123 is configured to store a computer program executable by the second processor.

[0953] The second processor 124 is configured to execute the computer program to perform the following processes, including: decoding a bitstream; determining a BVD absolute value and BVD code index information of a current block; performing a sorting process on candidate BVDs of the current block based on the BVD absolute value of the current block and determining a sorting result; determining a BVD of the current block based on the BVD code index information and the sorting result; and determining a reconstructed value of the current block based on the BVD of the current block.

[0954] It should be understood that second memory 123 in the present embodiment may be volatile or nonvolatile memory, or may include both volatile and nonvolatile memory. Here, nonvolatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM) used as an external cache. By way of example and not of 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), synchlink dynamic random access memory (SLDRAM), and direct memory bus random access memory (DRRAM), and the second memory 123 in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0955] The second processor 124 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be performed by a hardware-type integrated logic circuit or software-type instructions in the second processor 124. The second processor 124 may 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 device, a discrete gate or transistor logic device, a discrete hardware component, or the like, and may implement or execute each method, step, and logic block diagram disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like. The steps of the method disclosed in the embodiments of the present application may be performed directly 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 conventional storage medium such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, 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 performs the steps of the above method in combination with its hardware.

[0956] As can be appreciated, the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For a hardware implementation, the processing unit can be implemented as one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processing (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field-Programmable Gate Arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units configured to perform the functions described herein, or a combination thereof. For a software implementation, the techniques described herein can be implemented by modules (processes, functions, etc.) that perform the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented within or external to the processor.

[0957] The present embodiment provides an encoder and a decoder, in which the decoding side decodes a bitstream, determines a BVD absolute value and BVD code index information of a current block, performs a sorting process on candidate BVDs of the current block according to the BVD absolute value of the current block and determines the sorting result, determines a BVD of the current block according to the BVD code index information and the sorting result, and determines a reconstructed value of the current block according to the BVD of the current block. The encoding side sorts the candidate BVDs of the current block according to the BVD absolute value of the current block and determines the sorting result, determines BVD code index information of the current block according to the BVD code information of the current block and the sorting result, and writes the BVD absolute value and the BVD code index information into the bitstream. As can be seen, in the embodiment of the present application, an effective sorting process can be performed on the candidate BVDs of the current block based on the BVD absolute value of the current block. Therefore, during encoding, the sorting result can be used to determine and transmit BVD code index information. During decoding, the sorting result can be used to analyze the BVD code information of the current block. Furthermore, the CABAC encoding / decoding technology can be used to perform encoding / decoding processes on the BVD code information. This effectively reduces the bit rate required for BVD code transmission in IBC mode, and improves coding efficiency.

[0958] It should be noted that in the examples of this application, the terms "comprise," "include," or any other variations thereof are intended to be non-exclusive inclusive, meaning that a process, method, article, or apparatus that includes a set of elements does not merely include those elements, but also includes other elements not expressly listed, as well as inherent elements of the process, method, article, or apparatus. Unless otherwise limited, an element qualified by the expression "comprises" does not exclude the presence of other similar elements in the process, method, article, or apparatus that includes that element.

[0959] The numbers of the above-mentioned embodiments of the present application do not indicate the superiority or inferiority of the embodiments, but are used for the convenience of explanation.

[0960] The methods disclosed in the several method embodiments provided herein can be combined in any manner without conflict to obtain new method embodiments.

[0961] The features disclosed in the several product embodiments provided herein may be combined in any non-conflicting manner to obtain new product embodiments.

[0962] Features disclosed in any method or apparatus embodiment provided herein may be combined in any non-conflicting manner to obtain new method or apparatus embodiments.

[0963] The above content is merely a specific embodiment of the present application, and the protection scope of the present application is not limited thereto. Any modifications or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims. [Industrial Applicability]

[0964] The present embodiment provides an encoding / decoding method, an encoder, a decoder, and a storage medium, in which the decoding side decodes a bitstream, determines a BVD absolute value and BVD code index information of a current block, sorts candidate BVDs of the current block based on the BVD absolute value of the current block to determine the sorting result, determines a BVD of the current block based on the BVD code index information and the sorting result, and determines a reconstructed value of the current block based on the BVD of the current block. The encoding side sorts candidate BVDs of the current block based on the BVD absolute value of the current block to determine the sorting result, determines BVD code index information of the current block based on the BVD code information of the current block and the sorting result, and writes the BVD absolute value and BVD code index information into the bitstream. As can be seen, in the embodiment of the present application, an effective sorting process can be performed on the candidate BVDs of the current block based on the BVD absolute value of the current block. Therefore, during encoding, the sorting result can be used to determine and transmit BVD code index information. During decoding, the sorting result can be used to analyze the BVD code information of the current block. Furthermore, the CABAC encoding / decoding technology can be used to perform encoding / decoding processes on the BVD code information. This effectively reduces the bit rate required for BVD code transmission in IBC mode, and improves coding efficiency.

Claims

1. A decoding method applied to a decoder, comprising: Decoding the bitstream to determine a block vector difference (BVD) absolute value and BVD code index information for the current block; performing a sorting process on the candidate BVDs of the current block according to the BVD absolute value of the current block, and determining a sorting result; determining a BVD of the current block based on the BVD code index information and the sorting result; determining a reconstructed value of the current block based on the BVD of the current block.

2. 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); The decoding method of claim 1 .

3. The decoding method comprises: If the absBvdX is equal to 0, determining the candidate BVD based on the absBvdY. The decoding method according to claim 2.

4. The decoding method comprises: If the absBvdY is equal to 0, determining the candidate BVD based on the absBvdX. The decoding method according to claim 2.

5. The decoding method comprises: If the absBvdX and the absBvdY are not both equal to 0, determining the candidate BVD based on the absBvdX and the absBvdY. The decoding method according to claim 2.

6. performing a sorting process on the candidate BVDs of the current block based on the BVD absolute value of the current block and determining a sorting result; determining a first cost value corresponding to one or more candidate BVDs of the current block based on the BVD absolute values; sorting the candidate BVDs based on the first cost value and determining the sorted result; The decoding method according to claim 2.

7. the one or more candidate BVDs include a BVD in which the candBvdX is set equal to -absBvdX or absBvdX, respectively, and the candBvdY is set equal to -absBvdY or absBvdY, respectively; 7. The decoding method according to claim 6.

8. Determining a first cost value corresponding to one or more candidate BVDs of the current block based on the BVD absolute value of the current block includes: determining a first matching template based on the candidate BVD; calculating a matching error between a first template of the current block and the first matching template based on a predetermined error criterion to determine a first cost value corresponding to the candidate BVD; The decoding method according to claim 7.

9. the first template includes one or more sample values ​​in a neighboring decoded region of the current block; The decoding method according to claim 8.

10. Determining a first matching template based on the candidate BVD includes: determining a block vector predictor (BVP) for the current block; determining a candidate BV of the current block based on the BVP and the candidate BVD, where the candidate BV is used to indicate the location of the first matching template; determining the first matching template based on the candidate BV; The decoding method according to claim 8.

11. The BVP includes a third component (currBvpX) and a fourth component (currBvpY), and determining a candidate BV of the current block based on the BVP and the candidate BVD includes: a two-dimensional vector of the candidate BV is set to (currBvpX+candBvdX, currBvpY+candBvdY); The decoding method according to claim 10.

12. Determining the first matching template based on the candidate BV includes: determining the first matching template based on a position of the current point and a two-dimensional vector of the candidate BV; The decoding method according to claim 11.

13. The decoding method comprises: determining, as the first matching template, a region indicated by the two-dimensional vector of the candidate BV and including the same shape and number of sample values ​​as the first template, using the position of the current point as a starting point. The decoding method according to claim 12.

14. the predetermined error criterion comprises one of: sum of absolute errors (SAD), sum of absolute transformed errors (SATD), sum of squared differences (SSE), mean absolute differences (MAD), mean absolute errors (MAE), mean squared errors (MSE), and rate distortion optimization (RDO); The decoding method according to claim 8.

15. The sorting result is a candidate BVD list of the current block, and the decoding method includes: further comprising: sorting the candidate BVDs based on the first cost value to determine a candidate BVD list for the current block, the candidate BVD list including at least one candidate BVD; The decoding method according to claim 8.

16. Sorting the candidate BVDs based on the first cost value to determine a candidate BVD list for the current block includes: determining the candidate BVD list by sorting the one or more candidate BVDs in descending order of matching error indicated by the first cost value based on the predetermined error criterion; 16. The decoding method of claim 15.

17. Sorting the candidate BVDs based on the first cost value to determine a candidate BVD list for the current block includes: If the absBvdX and the absBvdY are not both equal to 0, storing the candidate BVDs in a first array and a second array, respectively; determining a first candidate BVD and a second candidate BVD from the first array based on the first cost value, and determining a third candidate BVD and a fourth candidate BVD from the second array; performing a sorting process on the first candidate BVD, the second candidate BVD, the third candidate BVD, and the fourth candidate BVD based on the first cost value to determine the candidate BVD list; 16. The decoding method of claim 15.

18. The decoding method comprises: If the first cost value of the first candidate BVD is less than or equal to the first cost 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, setting the third candidate BVD as the first candidate BVD in the candidate BVD list, setting the first candidate BVD as the second candidate BVD in the candidate BVD list, setting the fourth candidate BVD as the third candidate BVD in the candidate BVD list, and setting the second candidate BVD as the fourth candidate BVD in the candidate BVD list.

18. The decoding method of claim 17.

19. The decoding method comprises: If the first cost value of the first candidate BVD is less than or equal to the first cost 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, setting the third candidate BVD as the first candidate BVD in the candidate BVD list, setting the fourth candidate BVD as the second candidate BVD in the candidate BVD list, setting the first candidate BVD as the third candidate BVD in the candidate BVD list, and setting the second candidate BVD as the fourth candidate BVD in the candidate BVD list.

18. The decoding method of claim 17.

20. Sorting the candidate BVDs based on the first cost 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, setting the candidate BVD having the smallest first cost value among the candidate BVDs as a first candidate BVD in the candidate BVD list, and setting another candidate BVD among the candidate BVDs as a second candidate BVD in the candidate BVD list.

16. The decoding method of claim 15.

21. The sorting result is a candidate BVD set of the current block, and the decoding method includes: further comprising: sorting the candidate BVDs based on the first cost value to determine a candidate BVD set for the current block, the candidate BVD set including at least one candidate BVD; The decoding method according to claim 8.

22. Sorting the candidate BVDs based on the first cost value to determine a candidate BVD set for the current block includes: If the absBvdX and the absBvdY are not both equal to 0, storing the candidate BVDs in a first array and a second array, respectively; determining a fifth candidate BVD having the smallest first cost value from the first array, and determining a sixth candidate BVD having the smallest first cost value from the second array; determining the candidate BVD having the smallest first cost value among the fifth candidate BVD and the sixth candidate BVD as the smallest cost BVD in the candidate BVD set; 22. The decoding method of claim 21.

23. Sorting the candidate BVDs based on the first cost 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, determine the candidate BVD having the smallest first cost value among the candidate BVDs as the smallest cost BVD in the candidate BVD set.

22. The decoding method of claim 21.

24. determining a BVD of the current block based on the BVD code index information and the sorting result, determining a candidate BVD in the candidate BVD list indicated by the BVD code index information as a BVD for the current block; 21. A decoding method according to any one of claims 16 to 20.

25. The decoding method comprises: performing a conversion process on the candidate BVD list to determine an index conversion list; 17. The decoding method of claim 16.

26. determining a BVD of the current block based on the BVD code index information and the sorting result, If both the absBvdX and the absBvdY are not 0, when the value of the first bit of the BVD code index information is 0, determining 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 of the index conversion list; determining candBvdY of the BVD of the current block based on the first candidate BVD or the third candidate BVD; 26. The decoding method of claim 25.

27. The decoding method comprises: determining that the candBvdY of the BVD of the current block is equal to the candBvdY of the first candidate BVD when the value of the second bit of the BVD code index information is 0; and determining, when the value of the second bit is 1, that the candBvdY of the BVD of the current block is the same as the candBvdY of the third candidate BVD.

27. The decoding method of claim 26.

28. determining a BVD of the current block based on the BVD code index information and the sorting result, If the absBvdX and the absBvdY are not both 0, when the value of the first bit of the BVD code index information is 1, determining that the first component code is the same as the first component code of the second candidate BVD or the fourth candidate BVD in the index conversion list; determining candBvdY of the BVD of the current block based on the second candidate BVD or the fourth candidate BVD; 26. The decoding method of claim 25.

29. The decoding method comprises: determining that the candBvdY of the BVD of the current block is equal to the candBvdY of the second candidate BVD when the value of the second bit of the BVD code index information is 0; and determining, when the value of the second bit is 1, that the candBvdY of the BVD of the current block is the same as the candBvdY of the fourth candidate BVD.

29. The decoding method of claim 28.

30. determining a BVD of the current block based on the BVD code index information and the sorting result, When the absBvdX is 0, determining that the candBvdY of the BVD of the current block is equal to the candBvdY of a first candidate BVD in the index conversion list when the value of the BVD code index information is 0, and determining that the candBvdY of the BVD of the current block is equal to the candBvdY of a second candidate BVD in the index conversion list when the value of the BVD code index information is 1.

26. The decoding method of claim 25.

31. determining a BVD of the current block based on the BVD code index information and the sorting result, When the absBvdY is 0, determining that the candBvdX of the BVD of the current block is equal to the candBvdX of a first candidate BVD in the index conversion list when the value of the BVD code index information is 0, and determining that the candBvdX of the BVD of the current block is equal to the candBvdX of a second candidate BVD in the index conversion list when the value of the BVD code index information is 1.

26. The decoding method of claim 25.

32. determining a BVD of the current block based on the BVD code index information and the candidate BVD list, If both the absBvdX and the absBvdY are not 0, when the value of the first bit of the BVD code index information is 0, the candBvdX of the BVD of the current block is equal to the candBvdX of the first candidate BVD of the candidate BVD list, and otherwise, they are different; traversing the candidate BVD list to determine the first candidate BVD that has the same candBvdX as the BVD of the current block; determining that the candBvdY of the BVD of the current block is the same as the candBvdY of the first candidate BVD when the value of the second bit of the BVD code index information is 0, and is different otherwise; 17. The decoding method of claim 16.

33. determining a BVD of the current block based on the BVD code index information and the candidate BVD list, When the absBvdX is 0, determining that the candBvdY of the BVD of the current block is the same as the candBvdY of a first candidate BVD in the candidate BVD list when the value of the BVD code index information is 0, and determining that the candBvdY of the BVD of the current block is the same as the candBvdY of a second candidate BVD in the candidate BVD list when the value of the BVD code index information is 1.

17. The decoding method of claim 16.

34. determining a BVD of the current block based on the BVD code index information and the candidate BVD list, When the absBvdY is 0, determining that the candBvdX of the BVD of the current block is the same as the candBvdX of a first candidate BVD in the candidate BVD list when the value of the BVD code index information is 0, and determining that the candBvdX of the BVD of the current block is the same as the candBvdX of a second candidate BVD in the candidate BVD list when the value of the BVD code index information is 1.

17. The decoding method of claim 16.

35. determining a BVD of the current block based on the BVD code index information and the sorting result, If the absBvdX and the absBvdY are not both 0, when the value of the first bit of the BVD code index information is 0, determining that the candBvdX of the BVD of the current block is equal to the candBvdX of the minimum cost BVD in the candidate BVD set; determining a candBvdY of the BVD of the current block based on a minimum cost BVD in the candidate BVD set; 22. The decoding method of claim 21.

36. determining a BVD of the current block based on the BVD code index information and the sorting result, If the absBvdX and the absBvdY are not both 0, when the value of the first bit of the BVD code index information is 1, determining 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; determining candBvdY of the BVD of the current block based on a minimum cost BVD in another array other than the array in which the minimum cost BVD in the candidate BVD set is located; 22. The decoding method of claim 21.

37. The decoding method comprises: determining that the candBvdY of the BVD of the current block is equal to the candBvdY of the minimum cost BVD in the candidate BVD set when the value of the second bit of the BVD code index information is 0; determining that the candBvdY of the BVD of the current block has an opposite sign to the candBvdY of the minimum cost BVD in the set of candidate BVDs when the value of the second bit is 1; 36. The decoding method of claim 35.

38. The decoding method comprises: When the value of the second bit of the BVD code index information is 0, determining that the candBvdY of the BVD of the current block is equal to the candBvdY of the minimum cost BVD in the other array; determining 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 when the value of the second bit is 1; 37. The decoding method of claim 36.

39. determining a BVD of the current block based on the BVD code index information and the sorting result, When the absBvdX is 0, determining 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 when the value of the BVD code index information is 0, and determining 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 when the value of the BVD code index information is 1.

22. The decoding method of claim 21.

40. determining a BVD of the current block based on the BVD code index information and the sorting result, When the absBvdY is 0, determining that the absBvdX of the BVD of the current block is the same as the absBvdX of the minimum cost BVD in the candidate BVD set when the value of the BVD code index information is 0, and determining that the absBvdX of the BVD of the current block has an opposite sign to the absBvdX of the minimum cost BVD in the candidate BVD set when the value of the BVD code index information is 1.

22. The decoding method of claim 21.

41. The decoding method comprises: The method further includes determining that the number of bits of the BVD code index information is 2 if both the absBvdX and the absBvdY are not 0, and determining that the number of bits of the BVD code index information is 1 if the absBvdX or the absBvdY is 0. The decoding method according to claim 2.

42. When the BVD code index information is encoded using a truncated unary code, the number of bits of the code index information corresponding to different candidate BVDs is not exactly the same. The decoding method according to claim 2.

43. 1. A coding method applied to an encoder, comprising: performing a sorting process on the candidate BVDs of the current block according to the BVD absolute value of the current block, and determining a sorting result; determining BVD code index information of the current block based on the BVD code information of the current block and the sorting result; and writing the BVD magnitude and the BVD code index information into a bitstream.

44. 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); 44. The encoding method of claim 43.

45. The encoding method comprises: If the absBvdX is equal to 0, determining the candidate BVD based on the absBvdY.

45. The encoding method of claim 44.

46. The encoding method comprises: If the absBvdY is equal to 0, determining the candidate BVD based on the absBvdX.

45. The encoding method of claim 44.

47. The encoding method comprises: If the absBvdX and the absBvdY are not both equal to 0, determining the candidate BVD based on the absBvdX and the absBvdY.

45. The encoding method of claim 44.

48. performing a sorting process on the candidate BVDs of the current block based on the BVD absolute value of the current block and determining a sorting result; determining a first cost value corresponding to one or more candidate BVDs of the current block based on the BVD absolute values; sorting the candidate BVDs based on the first cost value and determining the sorted result; 45. The encoding method of claim 44.

49. The encoding method comprises: the one or more candidate BVDs include a BVD in which the candBvdX is set equal to -absBvdX or absBvdX, respectively, and the candBvdY is set equal to -absBvdY or absBvdY, respectively; 49. The encoding method of claim 48.

50. Determining a first cost value corresponding to one or more candidate BVDs of the current block based on the BVD absolute value of the current block includes: determining a first matching template based on the candidate BVD; calculating a matching error between a first template of the current block and the first matching template based on a predetermined error criterion to determine a first cost value corresponding to the candidate BVD; 50. The encoding method of claim 49.

51. The encoding method comprises: the first template includes one or more sample values ​​in a neighboring decoded region of the current block; 51. The encoding method of claim 50.

52. Determining a first matching template based on the candidate BVD includes: determining a block vector predictor (BVP) for the current block; determining a candidate BV of the current block based on the BVP and the candidate BVD, where the candidate BV is used to indicate the location of the first matching template; determining the first matching template based on the candidate BV; 51. The encoding method of claim 50.

53. The BVP includes a third component (currBvpX) and a fourth component (currBvpY), and determining a candidate BV of the current block based on the BVP and the candidate BVD includes: a two-dimensional vector of the candidate BV is set to (currBvpX+candBvdX, currBvpY+candBvdY); 53. The encoding method of claim 52.

54. Determining the first matching template based on the candidate BV includes: determining the first matching template based on the position of the current point and a two-dimensional vector of the candidate BV; 54. The encoding method of claim 53.

55. The encoding method comprises: determining, as the first matching template, a region indicated by the two-dimensional vector of the candidate BV and including the same shape and number of sample values ​​as the first template, using the position of the current point as a starting point.

55. The encoding method of claim 54.

56. the predetermined error criterion comprises one of: sum of absolute errors (SAD), sum of absolute transformed errors (SATD), sum of squared differences (SSE), mean absolute differences (MAD), mean absolute errors (MAE), mean squared errors (MSE), and rate distortion optimization (RDO); 51. The encoding method of claim 50.

57. The sorting result is a candidate BVD list for the current block, and the encoding method includes: further comprising: sorting the candidate BVDs based on the first cost value to determine a candidate BVD list for the current block, the candidate BVD list including at least one candidate BVD; 51. The encoding method of claim 50.

58. Sorting the candidate BVDs based on the first cost value to determine a candidate BVD list for the current block includes: determining the candidate BVD list by sorting the one or more candidate BVDs in descending order of matching error indicated by the first cost value based on the predetermined error criterion; 58. The encoding method of claim 57.

59. Sorting the candidate BVDs based on the first cost value to determine a candidate BVD list for the current block includes: If the absBvdX and the absBvdY are not both equal to 0, storing the candidate BVDs in a first array and a second array, respectively; determining a first candidate BVD and a second candidate BVD from the first array based on the first cost value, and determining a third candidate BVD and a fourth candidate BVD from the second array; performing a sorting process on the first candidate BVD, the second candidate BVD, the third candidate BVD, and the fourth candidate BVD based on the first cost value to determine the candidate BVD list; 58. The encoding method of claim 57.

60. The encoding method comprises: If the first cost value of the first candidate BVD is less than or equal to the first cost 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, setting the third candidate BVD as the first candidate BVD in the candidate BVD list, setting the first candidate BVD as the second candidate BVD in the candidate BVD list, setting the fourth candidate BVD as the third candidate BVD in the candidate BVD list, and setting the second candidate BVD as the fourth candidate BVD in the candidate BVD list.

60. The encoding method of claim 59.

61. The encoding method comprises: If the first cost value of the first candidate BVD is less than or equal to the first cost 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, setting the third candidate BVD as the first candidate BVD in the candidate BVD list, setting the fourth candidate BVD as the second candidate BVD in the candidate BVD list, setting the first candidate BVD as the third candidate BVD in the candidate BVD list, and setting the second candidate BVD as the fourth candidate BVD in the candidate BVD list.

60. The encoding method of claim 59.

62. Sorting the candidate BVDs based on the first cost 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, setting the candidate BVD having the smallest first cost value among the candidate BVDs as a first candidate BVD in the candidate BVD list, and setting another candidate BVD among the candidate BVDs as a second candidate BVD in the candidate BVD list.

58. The encoding method of claim 57.

63. The sorting result is a candidate BVD set for the current block, and the encoding method includes: further comprising: sorting the candidate BVDs based on the first cost value to determine a candidate BVD set for the current block, the candidate BVD set including at least one candidate BVD; 51. The encoding method of claim 50.

64. Sorting the candidate BVDs based on the first cost value to determine a candidate BVD set for the current block includes: If the absBvdX and the absBvdY are not both equal to 0, storing the candidate BVDs in a first array and a second array, respectively; determining a fifth candidate BVD having the smallest first cost value from the first array, and determining a sixth candidate BVD having the smallest first cost value from the second array; determining the candidate BVD having the smallest first cost value among the fifth candidate BVD and the sixth candidate BVD as the smallest cost BVD in the candidate BVD set; 63. The encoding method of claim 62.

65. Sorting the candidate BVDs based on the first cost 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, determine the candidate BVD having the smallest first cost value among the candidate BVDs as the smallest cost BVD in the candidate BVD set.

64. The encoding method of claim 63.

66. determining BVD code index information of the current block based on the BVD code information of the current block and the sorting result, determining the candidate BVD from the candidate BVD list that matches the BVD code information of the current block; and setting the BVD code index information based on an index value of the candidate BVD.

63. Coding method according to any one of claims 56 to 62.

67. The encoding method comprises: performing a conversion process on the candidate BVD list to determine an index conversion list; 59. The encoding method of claim 58.

68. determining BVD code index information of the current block based on the BVD code information of the current block and the sorting result, and if both the absBvdX and the absBvdY are not 0, if a first component code of the BVD code information of the current block is the same as a first component code of a first candidate BVD in the index conversion list, determining a first bit of the BVD code index information as 0, otherwise determining the first bit as 1.

68. The encoding method of claim 67.

69. The encoding method comprises: If the first bit is determined to be 0, if a second component code of the BVD code information of the current block is the same as a second component code of a first candidate BVD in the index conversion list, determine the second bit of the BVD code index information as 0, otherwise determine the second bit as 1; If the first bit is determined to be 1, if a second component code of the BVD code information of the current block is the same as a second component code of a candidate BVD code having an index of 1 in the index conversion list, determining the second bit of the BVD code index information to be 0, otherwise determining the second bit to be 1.

68. The encoding method of claim 67.

70. determining BVD code index information of the current block based on the BVD code information of the current block and the sorting result, When the absBvdX is 0, if a second component code of the BVD code information of the current block is the same as a second component code of a first candidate BVD in the index conversion list, determining the BVD code index information to be 0, otherwise determining the BVD code index information to be 1.

68. The encoding method of claim 67.

71. determining BVD code index information of the current block based on the BVD code information of the current block and the sorting result, When the absBvdY is 0, if a first component code of the BVD code information of the current block is equal to a first component code of a first candidate BVD in the index conversion list, determining the BVD code index information as 0, otherwise determining the BVD code index information as 1.

68. The encoding method of claim 67.

72. determining BVD code index information of the current block based on the BVD code information of the current block and the sorting result, If both the absBvdX and the absBvdY are not 0, if a first component code of the BVD code information of the current block is the same as a first component code of a first candidate BVD in the candidate BVD list, determine a first bit of the BVD code index information as 0, otherwise determine the first bit as 1; traversing the candidate BVD list to determine a first candidate BVD having the same first component code as the BVD code information of the current block; If the second component code of the BVD code information of the current block is the same as the second component code of the first candidate BVD, determining the second bit of the BVD code index information as 0, otherwise determining the second bit as 1.

59. The encoding method of claim 58.

73. determining BVD code index information of the current block based on the BVD code information of the current block and the sorting result, When the absBvdX is 0, if a second component code of the BVD code information of the current block is the same as a second component code of a first candidate BVD in the candidate BVD list, determining the BVD code index information to be 0, otherwise determining the BVD code index information to be 1.

59. The encoding method of claim 58.

74. determining BVD code index information of the current block based on the BVD code information of the current block and the sorting result, When the absBvdY is 0, if a first component code of the BVD code information of the current block is equal to a first component code of a first candidate BVD in the candidate BVD list, determining the BVD code index information as 0, otherwise determining the BVD code index information as 1.

59. The encoding method of claim 58.

75. determining BVD code index information of the current block based on the BVD code information of the current block and the sorting result, If both the absBvdX and the absBvdY are not 0, determining that the value of the first bit of the BVD code index information is 0 if the first component code of the BVD code information of the current block is the same as the first component code of the minimum cost BVD in the candidate BVD set; determining a second bit of BVD code index information of the current block based on a minimum cost BVD in the candidate BVD set; 64. The encoding method of claim 63.

76. determining BVD code index information of the current block based on the BVD code information of the current block and the sorting result, If the absBvdX and the absBvdY are not both 0, determining that the value of the first bit of the BVD code index information is 1 if the first component code of the BVD code information of the current block is different from the first component code of the minimum cost BVD in the candidate BVD set; determining a second bit of BVD code index information of the current block based on a minimum-cost BVD in another array other than the array in which the minimum-cost BVD in the candidate BVD set is located; 64. The encoding method of claim 63.

77. The encoding method comprises: determining that a value of a second bit of the BVD code index information is 0 if a second component code of the BVD code information of the current block is the same as a second component code of a minimum cost BVD in the candidate BVD set; determining that a value of a second bit of the BVD code index information is 1 if a second component code of the BVD code information of the current block is different from a second component code of a minimum cost BVD in the candidate BVD set; 76. The encoding method of claim 75.

78. The encoding method comprises: determining that the value of the second bit of the BVD code index information is 0 if the second component code of the BVD code information of the current block is the same as the second component code of the minimum cost BVD in the other array; and determining that a value of a second bit of the BVD code index information is 1 if a second component code of the BVD code information of the current block is different from a second component code of the minimum cost BVD in the other array.

77. The encoding method of claim 76.

79. determining BVD code index information of the current block based on the BVD code information of the current block and the sorting result, If the absBvdX is 0, if a second component code of the BVD code information of the current block is the same as a second component code of a minimum cost BVD in the candidate BVD set, determining that the value of the BVD code index information is 0; otherwise, determining that the value of the BVD code index information is 1.

64. The encoding method of claim 63.

80. determining BVD code index information of the current block based on the BVD code information of the current block and the sorting result, When the absBvdY is 0, if a first component code of the BVD code information of the current block is the same as a first component code of a minimum cost BVD in the candidate BVD set, determining that the value of the BVD code index information is 0, and otherwise determining that the value of the BVD code index information is 1.

64. The encoding method of claim 63.

81. The encoding method comprises: encoding the BVD magnitude and the BVD code index information using context-based adaptive binary arithmetic coding (CABAC).

44. The encoding method of claim 43.

82. The encoding method comprises: encoding the BVD magnitude and the BVD code index information using a bypass mode.

44. The encoding method of claim 43.

83. 1. An encoder comprising: a first determining unit and an encoding unit; the first determining unit is configured to perform a sorting process on candidate BVDs of the current block according to a BVD absolute value of the current block, determine a sorting result, and determine BVD code index information of the current block according to BVD code information of the current block and the sorting result; The encoder, wherein the encoding unit is configured to write the BVD magnitude and the BVD code index information into a bitstream.

84. 1. An encoder comprising: a first memory and a first processor; the first memory is configured to store a computer program executable by the first processor; 80. An encoder wherein the first processor is configured to perform the encoding method of any one of claims 41 to 79 by executing the computer program.

85. A decoder comprising: a decoding unit and a second determining unit; the decoding unit is configured to decode a bitstream; the second determining unit determines a BVD magnitude and BVD code index information of a current block; a decoder configured to: perform a sorting process on candidate BVDs of a current block based on a BVD absolute value of the current block, determine a sorting result; determine a BVD of the current block based on the BVD code index information and the sorting result; and determine a reconstructed value of the current block based on the BVD of the current block.

86. A decoder comprising: a second memory and a second processor; the second memory is configured to store a computer program executable by the second processor; Decoder, wherein the second processor is configured to perform the decoding method of any one of claims 1 to 40 by executing the computer program.

87. A computer-readable storage medium having stored thereon a computer program for implementing the decoding method according to any one of claims 1 to 42 or the encoding method according to any one of claims 43 to 82.

Citation Information

Patent Citations

  • Intra-block copy block vector signaling for video coding

    JP2017519447A

  • Encoding and decoding symbols using prediction

    JP2025533421A

  • Intra block copy block vector signaling for video coding

    US20150373370A1

  • Sign Coding and Decoding Using Prediction

    US20240089458A1