Image decoding method, image encoding method, image decoding device, image encoding device and computer storage medium

By acquiring and reordering the initial motion information candidate list of image decoding blocks and calculating the template cost using the template region, the problem of insufficient motion information in the prior art is solved, and the accuracy of image decoding is improved.

CN121644832APending Publication Date: 2026-03-10ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

In existing technologies, the candidate list is based on template sorting and searching, which results in a small amount of effective motion information and makes it impossible to obtain accurate motion information, thus affecting the accuracy of image decoding.

Method used

By obtaining the initial motion information candidate list of the block to be decoded, including historical candidate motion information, calculating the template cost using the current template region and the predicted template region, reordering the candidate list, and obtaining the target motion information for decoding based on the reordered motion information.

Benefits of technology

The accuracy of image decoding is improved by adjusting the candidate order search method to obtain more effective motion information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121644832A_ABST
    Figure CN121644832A_ABST
Patent Text Reader

Abstract

The invention provides an image decoding method, an image encoding method, an image decoding device, an image encoding device and a computer storage medium. The image decoding method comprises the following steps: an initial motion information candidate list at least comprises historical candidate motion information; obtaining a current template area of the block to be decoded and a prediction template area of each piece of candidate motion information in the initial motion information candidate list; obtaining the template cost of each piece of candidate motion information; reordering the initial motion information candidate list based on the template cost to obtain a rearranged motion information candidate list; obtaining target motion information based on the syntax of the to-be-decoded block; and obtaining a predicted value by using the target motion information, and decoding the to-be-decoded block according to the predicted value. According to the image decoding method, more accurate motion information and more effective candidates can be obtained by adjusting the candidate sequence search method for the candidate list containing the historical motion information, and the accuracy of image decoding is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image coding, in particular to an image decoding method, an image encoding method, an image decoding device, an image encoding device and a computer storage medium. BACKGROUND

[0002] Video image data is relatively large, and usually needs to be compressed. The compressed data is referred to as a video bitstream. The video bitstream is transmitted to a user end through a wired or wireless network and then decoded and watched. The entire video encoding process includes block division, prediction, transformation, quantization, encoding and the like.

[0003] In the prior art, the candidate list based on template sorting and searching is only used for sorting and searching the candidate list constructed by the existing spatial candidate construction method and the temporal candidate construction method, so that the number of effective candidate motion information is small, accurate motion information cannot be obtained, and the accuracy of image decoding is affected. SUMMARY

[0004] To solve the above technical problems, the present application provides an image decoding method, an image encoding method, an image decoding device, an image encoding device and a computer storage medium.

[0005] To solve the above technical problems, the present application provides an image decoding method, which comprises:

[0006] Obtaining an initial motion information candidate list of a to-be-decoded block, wherein the initial motion information candidate list at least includes historical candidate motion information;

[0007] Obtaining a current template region of the to-be-decoded block and a prediction template region of each candidate motion information in the initial motion information candidate list;

[0008] Based on the current template region and the prediction template region, obtaining a template cost of each candidate motion information;

[0009] Resorting the initial motion information candidate list based on the template cost to obtain a reordered motion information candidate list;

[0010] Based on the syntax of the to-be-decoded block, obtaining target motion information in the reordered motion information candidate list;

[0011] Obtaining a prediction value by using the target motion information, and decoding the to-be-decoded block according to the prediction value.

[0012] To solve the above technical problems, the present application provides another image decoding method, which comprises:

[0013] obtain an initial motion information candidate list of a to-be-decoded block, wherein the initial motion information candidate list at least comprises historical candidate motion information;

[0014] obtain a motion information index based on syntax of the to-be-decoded block;

[0015] in response to the motion information index being an index of the initial motion information candidate list, obtain target motion information in the initial motion information candidate list based on the motion information index;

[0016] obtain a prediction value by using the target motion information, and correct the prediction value according to a preset inter-frame prediction correction method;

[0017] decode the to-be-decoded block according to the corrected prediction value.

[0018] To solve the above technical problems, the present application provides an image encoding method, which comprises:

[0019] obtain an initial motion information candidate list of a to-be-encoded block, wherein the initial motion information candidate list at least comprises historical candidate motion information;

[0020] obtain a current template region of the to-be-encoded block and a prediction template region of each candidate motion information in the initial motion information candidate list;

[0021] obtain a template cost of each candidate motion information based on the current template region and the prediction template region;

[0022] reorder the initial motion information candidate list based on the template cost to obtain a reordered motion information candidate list;

[0023] obtain target motion information with minimum rate-distortion in the reordered motion information candidate list;

[0024] obtain a prediction value by using the target motion information, and encode the to-be-encoded block according to the prediction value.

[0025] To solve the above technical problems, the present application further provides an image decoding device, which comprises a memory and a processor coupled with the memory; wherein the memory is used for storing program data, and the processor is used for executing the program data to realize the image decoding method as described above.

[0026] To address the aforementioned technical problems, this application also proposes an image encoding apparatus, which includes a memory and a processor coupled to the memory; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the image encoding method described above.

[0027] To address the aforementioned technical problems, this application also proposes a computer storage medium for storing program data, which, when executed by a computer, is used to implement the aforementioned image decoding method and / or image encoding method.

[0028] Compared with existing technologies, the beneficial effects of this application are as follows: the image decoding device obtains an initial motion information candidate list for a block to be decoded, wherein the initial motion information candidate list includes at least historical candidate motion information; obtains the current template region of the block to be decoded, and the predicted template region of each candidate motion information in the initial motion information candidate list; obtains the template cost of each candidate motion information based on the current template region and the predicted template region; reorders the initial motion information candidate list based on the template cost to obtain a rearranged motion information candidate list; obtains target motion information in the rearranged motion information candidate list based on the syntax of the block to be decoded; obtains a prediction value using the target motion information, and decodes the block to be decoded according to the prediction value. Through the above image decoding method, the method of adjusting the candidate order search of the candidate list containing historical motion information can obtain more accurate motion information and more effective candidates, thereby improving the accuracy of image decoding. Attached Figure Description

[0029] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] in:

[0031] Figure 1 This is a schematic diagram of an embodiment of the encoding / decoding process provided in this application;

[0032] Figure 2 This is a schematic diagram of an embodiment of the template area provided in this application;

[0033] Figure 3 This is a schematic diagram of an embodiment of the search location provided in this application;

[0034] Figure 4 This is a flowchart illustrating the interPF technology provided in this application;

[0035] Figure 5 This is a schematic diagram of the BGC technology provided in this application;

[0036] Figure 6 This is a schematic diagram of the DMVR subblock pre-compensation provided in this application;

[0037] Figure 7 This is a schematic diagram of an embodiment of the DMVR offset candidate point provided in this application;

[0038] Figure 8 This is a schematic diagram of an embodiment of the DMVR pixel sub-candidate provided in this application;

[0039] Figure 9 This is a schematic diagram of the overall process of the image encoding and decoding method provided in this application;

[0040] Figure 10 This is a flowchart illustrating an embodiment of the image decoding method provided in this application;

[0041] Figure 11 This is a schematic diagram of another embodiment of the template area provided in this application;

[0042] Figure 12 This is a flowchart illustrating another embodiment of the image decoding method provided in this application;

[0043] Figure 13 This is a flowchart illustrating an embodiment of the image encoding method provided in this application;

[0044] Figure 14 This is a schematic diagram of an embodiment of the image decoding device provided in this application;

[0045] Figure 15 This is a schematic diagram of an embodiment of the image encoding device provided in this application;

[0046] Figure 16 This is a schematic diagram of the structure of an embodiment of the computer storage medium provided in this application. Detailed Implementation

[0047] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0048] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0049] Please see Figure 1 , Figure 1 This is a schematic diagram of an embodiment of the encoding / decoding process provided in this application. Figure 1 As shown, the overall encoding and decoding process is as follows: the encoding process starts from the input video frame and ends at the bitstream, while the decoding process starts from the bitstream and ends at the reconstructed frame. The dashed lines represent the common encoding and decoding processes, while the solid arrows indicating "bitstream → entropy decoding → inverse quantization & inverse transform" represent the decoding-specific processes. The remaining solid arrows represent the encoding-specific processes.

[0050] In video encoding, the most commonly used color encoding methods include YUV and RGB. This application uses the YUV color encoding method. Y represents luminance, which is the grayscale value of the image; U and V (i.e., Cb and Cr) represent chrominance, which describes the color and saturation of the image. Each Y luminance block corresponds to one Cb and one Cr chrominance block, and each chrominance block corresponds to only one luminance block. Taking a 4:2:0 sampling format as an example, an N*M block corresponds to a luminance block of size N*M, and the corresponding two chrominance blocks are both (N / 2)*(M / 2) in size, with the chrominance block being 1 / 4 the size of the luminance block. For a 4:4:4 sampling format, the luminance block and chrominance block are the same size.

[0051] Block partitioning: In video encoding, the input is a series of image frames. However, to encode a single frame, it needs to be divided into several LCUs (largest coding units). Then, each coding unit is recursively divided into CUs (coding units) of different sizes. Video encoding is performed using CUs as units. The smallest coding unit is called the SCU (smallest coding unit).

[0052] Intra-frame / Inter-frame prediction: Generally, the luminance and chrominance signal values ​​of adjacent pixels are quite similar and have a strong correlation. If the number of samples is used directly to represent luminance and chrominance information, there is a lot of spatial redundancy in the data. If redundant data is removed before encoding, the average number of bits per pixel will decrease, which means data compression is performed to reduce spatial redundancy.

[0053] Transformation: After the prediction of the current block is completed, the true value and the predicted value of the current block are subtracted to obtain a residual block. The residual block represents the difference between the true image and the predicted image of the current block. Then, a transformation is performed on the residual block, such as using DCT (Discrete Cosine Transform) or DST (Discrete Sine Transform). Since most images have many flat regions and regions with slow content transformation, and the correlation between adjacent pixels is very strong, the transformation can reduce these correlations and transform the dispersed distribution of image energy in the spatial domain into a relatively concentrated distribution in the transform domain, thus removing spatial redundancy.

[0054] Quantization: Quantization is the process of mapping continuous signal values ​​to multiple discrete amplitude values, achieving a many-to-one mapping of signal values. After transformation, the transform coefficients of the residual data have a large range of values. Quantization can effectively reduce the range of signal values, thus achieving better compression. Because quantization discretizes continuous values ​​into various quantization intervals, it is the root cause of image distortion.

[0055] The current decoding technique using inter-frame template matching is a template-based prediction method. It constructs a candidate list of motion vectors (MVs) using a method similar to skip / direct, and then performs sorting and searching processes based on their template region costs. The specific process is as follows:

[0056] 1) Using the existing method for generating the MVP (Motion Vector Prediction) list, the first 4 are selected as candidate MVPs for TM (this technique is currently only used for B-frames, and the 4 candidates are temporal candidate, bidirectional spatial candidate, backward spatial candidate, and forward spatial candidate). Then, the MVPs are deduplicated, and the MVP list is sorted using a template (the smaller the template cost, the shorter the codeword is assigned), and the MVPs are adjusted to integer pixel positions by rounding down.

[0057] 2) Construct a structure based on the reconstructed pixels surrounding the current block, such as... Figure 2 The template shown is 4 pixels wide, and a template matching search is performed for each available direction of the MVP. Among them,Figure 2 This is a schematic diagram of an embodiment of the template area provided in this application.

[0058] 3) During template matching, first use the hexagonal search shown in the figure below 30 times (using the SAD (Sum of Absolute Difference) method to calculate the template cost; the point with the minimum template cost in each search is used as the center point for the next search; if the center point is optimal, the current hexagonal search is terminated), then use... Figure 3 The optimal MV is obtained by performing a single search within the square. Figure 3 This is a schematic diagram of an embodiment of the search location provided in this application.

[0059] 4) Use the template matching optimized MV as the final MV of the current block and generate the prediction block of the current block.

[0060] 5) The index of the best MVP after template sorting is encoded in the bitstream using variable-length code.

[0061] Currently, the inter-frame prediction in the inter-frame merge candidate construction technology used in decoding is mainly divided into two types: one is the AMVP (Advanced Motion Vector Prediction) mode, which requires motion search and transmission of MVD (MV difference); the other is the merge mode, which builds a candidate list and inherits adjacent motion information in the spatial or temporal domains without transmitting MVD.

[0062] In the AVS3 standard, there are several modes that do not require the transmission of MVD, namely skip / direct, ETMVP (Efficient Temporal Motion Vector Prediction), and UMVE (Ultimate Motion Vector Expression), etc. All of these require the construction of a candidate list of motion information. The specific related technologies are as follows:

[0063] The skip / direct methods for constructing MV candidate lists include spatial candidates, temporal candidates, MVAP (Motion Vector Angle Prediction), and HMVP (History-based Motion Vector Prediction). The specific methods for HMVP are as follows:

[0064] HMVP Candidate Addition (Duplicate Check): When adding an HMVP candidate to the skip / direct candidate list, the HMVP candidates are traversed in reverse order, and vector information is checked for duplicates with the time-domain and spatial-domain candidates (profile=0x32 or 0x30 skips TMVP duplicate checking). If the HMVP candidate is not duplicated, it is added; otherwise, it is not added.

[0065] HMVP Maintenance and Updates: The HMVP candidate list is a NumOfHmvpCand (0-8) list, and it is maintained and updated according to the FIFO (First-In, First-Out) principle. If the current inter-frame coded block is in Affine, AWP, MVAP, ETMVP, or SBTMVP mode, the HMVP list is not updated; otherwise, the HMVP list is updated, and the process is as follows:

[0066] 1. If the current MV does not exist in the HMVP list: If the HMVP list is not full, increment the length of the HMVP list by 1 and add the current MV to the end of the HMVP list; otherwise, remove the first candidate from the HMVP list, shift all candidates in the list one position forward, and add the current MV to the end of the list.

[0067] 2. If the current MV already exists in the HMVP list: First, remove the candidate corresponding to the current MV from the HMVP list. Then, move the candidate from the corresponding position to the effective length of the HMVP list forward by one position. Finally, add the current MV to the end of the effective length.

[0068] Currently, the interPF (Inter-Frame Prediction Filtering) technology used in decoding has two filtering modes, and the choice between the two modes is transmitted in the block-level syntax. If interPF is selected, this operation is performed on both luma and chroma.

[0069] Method 1: Use the inter-frame predicted pixel and the weighted average of the pixel values ​​at five locations: its left, right, top, and bottom, to obtain the final predicted value.

[0070] Method 2: Use the inter-frame predicted pixel and the three pixels to its left and above to obtain the final predicted value.

[0071] Step 1: Obtain the reference pixel of the current block.

[0072] Reference pixels are obtained using the same method as those obtained in intra-frame prediction. A row of reference pixels with a width twice the length is obtained at the top, and a column of reference pixels with a height twice the length is obtained at the left.

[0073] Step 2: Based on inter_pf_index, choose to perform a weighted average of 3 or 5 values.

[0074] like Figure 4As shown, when inter_pf_index is 0, the five values ​​are weighted averages, meaning the Plane mode (using 4 pixels) is weighted with the inter-frame prediction result. Among them, Figure 4 This is a flowchart illustrating the interPF technology provided in this application.

[0075] When inter_pf_index is 1, the three values ​​are weighted and averaged using the same method as intraPF.

[0076] (1) When inter_pf_index is 0, it is assumed that the lower left pixel can represent the pixel below the pixel and the upper right pixel can represent the pixel to the right of the pixel. The left and right pixels of the pixel are weighted by distance, and the upper and lower pixels of the pixel are weighted by distance. The average of the two is then calculated to obtain the Plane mode prediction result. This result is then weighted with the inter-frame prediction in a 3:5 ratio. The specific weighting formula is as follows:

[0077]

[0078] (2) When inter_pf_index is 1, the current pixel is weighted using the reference pixels above and to the left of it, according to the weights obtained from the lookup table. The specific formula and table are as follows:

[0079] predMatrixTmp[x][y]=Clip1((f[x]*leftPel[y+1]+f[y]*topPel[x+1]+(64–f[x]–f[y])*predMatrixBgc[x][y]+32)>>6)

[0080] Table 1 Intra-frame prediction boundary filter coefficients

[0081]

[0082] The current decoding technology uses Interframe Predictor (IPC) with three modes, represented by InterPcIndex, which can take values ​​of 0, 1, or 2. 0 indicates that the calculation model uses both top and left reference pixels. 1 indicates that the calculation model uses only the top reference pixel. 2 indicates that the calculation model uses only the left reference pixel.

[0083] If the reference pixels used in a certain mode do not exist, the reference pixels are filled with 1<<(Bitdepth–1); otherwise, the reference pixels are filled in the same way as intra-frame prediction.

[0084] The specific IPC correction steps are described below:

[0085] (1) First, determine the pixel range for solving the IPC model parameters. Let the maximum (width, height) of the IPC parameter range be (ML, NL). For MVAP and sbTMVP modes, ML = 8, NL = 8; for other modes, ML = 16, NL = 16. For the chroma component, ML and NL are scaled proportionally based on the color space. For example, in a 420p color space, the chroma should be half the luminance. Therefore, for MVAP and sbTMVP, ML = 4, NL = 4; for other modes, ML = 8, NL = 8.

[0086] (2) Locate the pixels at the top and left for the specific locations used to calculate the model.

[0087] The process of obtaining pixels at specific locations can be divided into three cases:

[0088] 1) InterPcIndex = 0, both the upper and left reference pixels exist, and the two upper reference pixels and two predicted pixels, as well as the two left reference pixels and two predicted pixels, are obtained.

[0089] The specific process is as follows: different positions are determined based on whether the aspect ratio is greater than 1.

[0090]

[0091] 2) If InterPcIndex = 0, the left reference pixel does not exist; or if InterPcIndex = 1, the upper reference pixel exists. Only the upper reference pixel is obtained, resulting in 4 reference pixels and 4 predicted pixels.

[0092] The specific process is as follows:

[0093]

[0094]

[0095] 3) If InterPcIndex = 0, the upper reference pixel does not exist; or if InterPcIndex = 2, the left reference pixel exists. Only the left reference pixel is obtained, resulting in 4 reference pixels and 4 predicted pixels.

[0096] The specific process is as follows:

[0097]

[0098] (3) Computational model and application model.

[0099] Sort the four reference pixels according to their pixel values, with the first two being the two largest pixel values ​​and the last two being the two smallest pixel values. Average these values ​​to obtain yMax and yMin. Average the predicted pixels at the corresponding positions to obtain xMax and xMin. Obtain (xMax, yMax) and (xMin, yMin). Substitute the two samples into the formula y = ax + b to calculate a and b.

[0100] yMax = a·xMax + b

[0101] yMin = a·xMin + b

[0102] The specific process for calculating a and b is as follows:

[0103] Let diffX=xMax–xMin and diffY=yMax–yMin.

[0104] 1) The model calculation and application for the luminance component are as follows:

[0105]

[0106]

[0107] The process of deriving the corrected predicted values ​​is as follows:

[0108]

[0109] 2) For the chromaticity component, the model is not calculated, nor is the y=ax+b model applied.

[0110]

[0111] The final chroma diffX is obtained through the above process. If diffX is less than or equal to 1 << (Bitdepth - 8) or diffY is less than or equal to 1 << (Bitdepth - 8), then predMatrixInter[x][y] = Clip1((yMin + yMax) / 2), (x = 0 ~ K-1, y = 0 ~ L-1). In other cases, the chroma does not undergo the IPC process.

[0112] The TscpmTable is as follows:

[0113] int g_aiTscpmDivTable64

[64] =

[0114] {

[0115] 65536, 32768, 21845, 16384, 13107, 10922, 9362, 8192, 7281, 6553, 5957, 5461, 5041, 4681, 4369, 4096, 3855, 3640

[0116] 3449, 3276, 3120, 2978, 2849, 2730, 2621, 2520, 2427, 2340, 2259, 2184, 2114, 2048, 1985, 1927, 1872, 1820

[0117] 1771, 1724, 1680, 1638, 1598, 1560, 1524, 1489, 1456, 1424, 1394, 1365, 1337, 1310, 1285, 1260, 1236, 1213

[0118] 1191, 1170, 1149, 1129, 1110, 1092, 1074, 1057, 1040, 1024

[0119] }

[0120] The BGC (Bi-directional Gradient Correction) technology currently used for decoding is as follows:

[0121] In bidirectional inter-frame prediction, such as Figure 5 As shown, for two reference prediction blocks after motion compensation, to obtain the prediction value of the current block, BIO (Bi-directional Optical Flow) or ordinary averaging operations are usually performed. However, since the errors of the two reference prediction blocks relative to the pixel values ​​of the current prediction block are randomly differentiated, it cannot be guaranteed that the prediction values ​​of the two prediction blocks are of equal importance. Therefore, the original prediction value of the current block can be obtained by adding or subtracting the difference between the prediction values ​​of the two prediction blocks. In merge mode, the BGC flag is obtained through inheritance and no syntax is required; in AMVP, it is obtained through rate-distortion optimization techniques and the corresponding syntax is transmitted.

[0122] in, Figure 5 This is a schematic diagram illustrating the principle of the BGC technology provided in this application.

[0123] The DMVR (Decoder-Side Motion Vector Refinement) technology currently used in decoding primarily refines the motion vectors of the coded block by minimizing the forward and backward prediction values. The general process of DMVR technology is as follows:

[0124] (1) MV (Motion Vector) processing: trim the range, amplitude, etc. of the MV.

[0125] (2) Sub-block division and sub-block MV acquisition: The coded block is divided into at least one sub-block, and the sub-block MV is obtained through the processed MV.

[0126] (3) Sub-block MV refinement search. Traverse each sub-block. First, perform motion pre-compensation based on the sub-block position and sub-block MV to obtain the pre-compensated block; then, perform integer pixel search and fractional pixel search within the pre-compensation range to obtain the offset of the sub-block MV; finally, obtain the final prediction block based on the offset of the sub-block MV and the pre-compensated block.

[0127] The specific process is as follows:

[0128] The input to the DMVR includes motion information `motionInfo(interPredRefMode, mvE0, mvE1, RefIndexL0, RefIndexL1)`, the top-left sample position (xCb, yCb), width `nNbW`, and height `nNbH`. Here, `interPredRefMode` is the prediction mode, `mvE0` and `mvE1` are the forward and backward motion vectors of the current block, and `RefIndexL0` and `RefIndexL1` are the forward and backward reference indices.

[0129] Step 1 (MV processing, including range clipping, amplitude clipping, etc.). First, restrict the range of the horizontal components of motion vectors mvE0 and mvE1 to ((-LcuSize-4–xCb)<<2) to ((PicWidthInLuma+LcuSize+4–xCb–nNbW)<<2), and the range of the vertical components to ((-LcuSize-4–yCb)<<2) and ((PicHeightInLuma+LcuSize+4–yCb–nNbH)<<2); then, restrict the horizontal and vertical components of motion vectors mvE0 and mvE1 to -32768 to 32767; finally, obtain the initial motion vectors sMV0 and sMV1 from mvE0 and mvE1.

[0130]

[0131]

[0132] Step 2 (Sub-block partitioning and sub-block MV acquisition). Let subW and subH be the width and height of the sub-block, respectively. Divide the current block's brightness image into subWNum subWNum non-overlapping and adjacent sub-blocks. Calculate the top-left corner sample position (xCbSub, yCbSub) of the i-th sub-block, and the sub-block's motion vectors ssubMV0 and ssubMV1. The value of i ranges from 0 to subWNum-1.

[0133]

[0134] Step 3 (Sub-block MV Constraints). Constrain the sub-block motion vectors ssubMV0 and ssubMV1 using (xCb, yCb), (xCbSub, yCbSub), and (subW, subH).

[0135]

[0136]

[0137] Step 4 (Sub-block MV Refinement). Traverse each sub-block and refine the MV for each sub-block, as follows:

[0138] (1) Sub-block pre-compensation: The schematic diagram of sub-block pre-compensation is shown below. Figure 6 As shown, Figure 6 This is a schematic diagram of the DMVR sub-block pre-compensation provided in this application. The sub-block prediction region is obtained by motion compensation based on the sub-block motion vectors ssubMV0 and ssubMV1. The motion compensation region is the adjacent pixels extended during sub-block compensation prediction (i.e., the sub-block prediction region is the pixels whose motion vectors point to the reference region, and the motion compensation region is the pixels whose motion vectors point to the reference region and extend therefrom). The padding region is the pixels obtained by filling the boundary pixels of the motion compensation region (i.e., filling the boundary pixels of the motion compensation region). The size of the motion region is based on the number of taps nTabs, nTabs / 2-1 on the left and nTabs / 2+1 on the right. In the prior art, the nTabs for luminance is 12 and the nTabs for chrominance is 6.

[0139] (2) Integer pixel search.

[0140] 1) Calculation of SAD (Sum of Absolute Difference) for candidate locations: Calculate the SAD of 21 integer pixel motion vector offsets of sMVD candidate points, such as... Figure 7 As shown, the sub-block MV is represented by the colored dots in the figure. Among them, Figure 7 This is a schematic diagram of an embodiment of the DMVR offset candidate point provided in this application.

[0141] Where SAD is the sum of absolute differences between the forward and backward predicted values, and the offsets of the forward and backward predicted values ​​are mirror images of each other with respect to the starting point. For example, if the forward MV is offset by (1, 0), then the backward MV is offset by (-1, 0).

[0142] 2) Optimal sMVD candidate search: The optimal SAD point is searched among 21 candidates based on SAD gradient descent.

[0143] Starting from the sub-block MV, the search proceeds for a maximum of 3 rounds. In each round, the search is performed in four directions (up, down, left, and right) centered on the previous round's sMVD point to obtain the optimal sMVD. If SAD is 0 and the optimal sMVD is an unoffset point, the search process is terminated prematurely.

[0144] 3) Pixel-by-pixel search.

[0145] 1) Pixel-by-pixel search condition: If the optimal sMVD is within a 1-pixel range, such as Figure 8 If the color candidate points are shown, then a pixel-by-pixel search is performed. Figure 8 This is a schematic diagram of an embodiment of a DMVR pixel candidate provided in this application.

[0146] 2) Pixel-by-pixel search process: The pixel-by-pixel search is based on error surface calculation. This search process assumes that local pixel values ​​are continuous, thereby establishing the SAD cost surface, i.e., the error surface model. The calculation expression for the pixel offset can be obtained from the error surface model as follows:

[0147] deltaX = (SAD) left -SAD right ) / ((SAD left +SAD right –2*SAD center )*2)

[0148] deltaY=(SAD top -SAD bottom ) / ((SAD top +SAD bottom –2*SAD center )*2)

[0149] Among them, deltaX and deltaY are calculated with a precision of 1 / 16, and the maximum value is 1 / 2.

[0150] Step 5 (Sub-block motion compensation).

[0151] (1) Sub-block MV range clipping: The x-components of sMV0 and sMV1 are restricted to [(-lcuSize–xCb)<<2, (picW+lcuSize–xCb–nNbW)<<2], and the y-components are restricted to [(-lcuSize–yCb)<<2, (picH+lcuSize–xCb–nNbW)<<2].

[0152] (2) Sub-block motion compensation: The final motion compensation of the sub-block is performed based on the integer pixel sMVD and the sub-pixel deltaX, deltaY, so as to obtain the final predicted value of the sub-block (the final sub-block compensation is not performed through the reference frame, but through the sub-block pre-compensation sample in the previous step).

[0153] In addition, the DMVR procedure is only applicable in the following situations:

[0154] DMVR prediction modes supported: Merge mode only.

[0155] Disable DMVR forecasting tools: non-Affine forecasting tools, non-UMVE forecasting tools, non-ETMVP forecasting tools, non-AWP forecasting tools, and non-InterPC forecasting tools.

[0156] Other constraints: the reference frame must satisfy bidirectional prediction, the reference frame POC (picture order counts) must be mirror-symmetric with respect to the current frame POC, and the current coding block must have W>=8 and H>=8.

[0157] To address the problems existing in current image decoding technologies, this application provides a template-based candidate adjustment encoding and decoding method incorporating historical candidates. Specifically, it includes a method for determining and constructing a candidate list, a method for sorting and searching candidates based on templates, a predictive block filtering method, and a grammatical representation method. The encoding and decoding process of the scheme is as follows: Figure 9 As shown. Among them, Figure 9 This is a schematic diagram of the overall process of the image encoding and decoding method provided in this application.

[0158] like Figure 9 As shown, in the encoding process, firstly, a candidate list of MVs is constructed (containing at least historical motion information, i.e., HMVP). Then, the candidate MVs are rearranged based on the template, and only the top M rearranged candidates are retained. Then, these rearranged MV candidates are traversed, and the MV candidates are refined based on the template. Then, the predicted value is obtained based on the refined MV. Then, the predicted value is corrected, and finally, syntactic encoding is performed.

[0159] It is understandable that at the encoding end, the best MV candidate (the unrearranged candidate list) or the best rearranged MV candidate can be selected based on rate-distortion optimization technology and transmitted to the decoding end through syntax. At the decoding end, the target MV (i.e. the best rearranged MV candidate determined by the encoding end) is determined directly based on syntax.

[0160] In addition, whether to perform candidate list rearrangement, whether to refine the search of MV candidates based on templates, and whether to perform prediction value correction are all optional steps. Therefore, it can be expressed by syntax whether to perform these steps (at this time, rate-distortion optimization technology can be used to determine whether to perform these steps and transmit the corresponding syntax to the decoding end) or to directly perform some steps by default or not perform some steps by default.

[0161] For complete Figure 9 The proposed improvements to the aforementioned solution are as follows:

[0162] (1) Candidate list construction.

[0163] (2) Template-based candidate ranking and template-based MV refinement search.

[0164] (3) Prediction correction.

[0165] (4) Application of the scheme and syntactic expression.

[0166] Please refer to the details. Figure 10 , Figure 10 This is a flowchart illustrating an embodiment of the image decoding method provided in this application.

[0167] The image decoding method of this application is applied to an image decoding device, which can be a server, a terminal device, or a system in which the server and the terminal device cooperate with each other. Accordingly, the various parts of the image decoding device, such as each unit, subunit, template, and sub-template, can all be set in the server, all in the terminal device, or separately in the server and the terminal device.

[0168] Furthermore, the aforementioned server can be either hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software programs or software templates, such as software or software templates used to provide distributed servers, or as a single software program or software template; no specific limitations are made here.

[0169] like Figure 10 As shown, the specific steps are as follows:

[0170] Step S11: Obtain the initial motion information candidate list of the block to be decoded, wherein the initial motion information candidate list includes at least historical candidate motion information.

[0171] In this embodiment, the image decoding device constructs an initial motion information candidate list for the block to be decoded. The candidate construction method for the initial motion information candidate list can use one or more existing candidate construction methods, or it can use a new candidate construction method. Specifically, the candidate construction methods include, but are not limited to: spatial domain candidates, temporal domain candidates, and historical candidates. The candidate construction method of this application must at least include historical candidates, and on this basis, add temporal domain candidates and / or spatial domain candidates.

[0172] It should be noted that this application requires adding historical candidate motion information to the initial motion information candidate list in order to generate more effective candidate motion information, i.e., candidate motion vectors.

[0173] Specifically, historical candidates need to be added to the candidate list from the historical movement information list. The specific methods of adding them include, but are not limited to, the following:

[0174] Retrieve several candidates from the historical movement information list and add them to the candidate list in the order they were retrieved.

[0175] Retrieve several candidates from the historical movement information list and add them to the candidate list in reverse order of retrieval.

[0176] Several candidates are obtained from the historical motion information list. The obtained motion information is clustered, and the obtained cluster centers are added to the candidate list as candidates.

[0177] Furthermore, the image decoding device can also perform deduplication during the candidate image construction process. Deduplication methods include, but are not limited to:

[0178] During the process of adding historical candidates to the candidate list, the historical candidates to be added to the list are checked for duplicates with the non-historical candidates already filled in the candidate list. If duplicates are found, the new candidate will not be added to the list.

[0179] After filling the candidate list with time-domain and spatial-domain candidates, check for duplicates in some and all candidates and remove duplicate candidates that are ranked later.

[0180] In one specific implementation, namely Example 1, the specific construction process of the initial motion information candidate list is as follows:

[0181] (1) First, use the temporal candidate construction method. Add one temporal candidate to the candidate list.

[0182] If the current frame is a B-frame, the current block uses the conventional TMVP (Temporal Motion Vector Prediction) candidate construction method. If a forward reference exists for the backward co-op block, the temporal motion vector mvT of the forward prediction of the co-op block is obtained, and mvT is scaled using the forward and backward co-op frames as targets to obtain MVT0 and MVT1. If a forward reference does not exist for the backward co-op block, the forward and backward reference co-op frames are used as target reference frames, and MVT0 and MVT1 are obtained using the default method. The default method is the conventional method for constructing MVPs in AMVP.

[0183] (2) Then use the spatial candidate construction method. Add 1 or 3 spatial candidates to the candidate list.

[0184] When the current frame is B-frame, three candidates are constructed based on adjacent blocks in the order of bidirectional, backward, and forward, and added to the skip / direct candidate list.

[0185] After constructing the temporal and spatial candidates, the first two candidates in the list are checked for duplicates. If the motion information of the first two candidates is the same, only the first or second candidate and the last two candidates are included.

[0186] (3) Then use the HMVP candidate construction method. For example, from the historical motion information list, traverse the HMVPs in the historical motion information list in reverse order. If an HMVP is not repeated with the previous non-historical candidate, then add the HMVP candidate to the candidate list.

[0187] Step S12: Obtain the current template region of the block to be decoded, and the predicted template region of each candidate motion information in the initial motion information candidate list.

[0188] In this embodiment of the application, the image decoding device obtains the current template region of the block to be decoded, and the predicted template region of each candidate motion information.

[0189] In this application, the template region is the region composed of pixels surrounding the pixel block. For example, the current template region is the region composed of pixels surrounding the block to be decoded, and the prediction template region is the region composed of pixels surrounding the prediction block.

[0190] Specifically, the template area of ​​this application can be selected from one or more pixel areas among several rows of pixel areas above the pixel block, several columns of pixel areas to the left, and the pixel area in the upper left corner of the pixel block. Please refer to the details. Figure 11 , Figure 11 This is a schematic diagram of another embodiment of the template area provided in this application.

[0191] Furthermore, Figure 11The different template region selections shown can serve as different sub-patterns, including but not limited to one or more of the following:

[0192] (1) Only use the template pixels that can be obtained from the area above the block.

[0193] (2) Only the template pixels that can be obtained from the left side of the block.

[0194] (3) Use the template pixels that can be obtained from the area above and to the left of the block.

[0195] (4) Template pixels that can be obtained using the area above, to the left and to the top left corner of the block (L-shaped template area).

[0196] Step S13: Based on the current template region and the predicted template region, obtain the template cost of each candidate motion information.

[0197] In this embodiment, the image decoding device calculates the template cost of the current template region and each predicted template region as the template cost of the candidate motion information corresponding to each predicted template region. The template cost can be considered as the pixel difference between the current template region and the predicted template region.

[0198] Specifically, the methods used in this application to calculate template cost include, but are not limited to: SAD (Sum of Absolute Difference), SSD (Sum of Squared Difference), and SATD (Sum of Absolute Transformed Difference).

[0199] Step S14: Reorder the initial motion information candidate list based on template cost to obtain the rearranged motion information candidate list.

[0200] In this embodiment, the image decoding device reorders all motion information in the initial motion information candidate list according to the template cost. The candidate motion information can be arranged in descending or ascending order of template cost to generate a rearranged motion information candidate list.

[0201] Furthermore, assuming the initial candidate list of motion information contains N candidate motion information items, these N candidate motion information items are rearranged based on template cost, and then the top M rearranged candidates are selected to form a rearranged motion information candidate list. Here, M <= N, meaning the candidate list used for MV refinement search can be a part or all of the entire rearranged candidate list.

[0202] It should be noted that when the number of valid candidates is less than N, only the valid number of candidates are rearranged; when the number of valid candidates is less than M, only the valid number of rearranged candidates are included.

[0203] In one specific implementation, the image decoding device may obtain the candidate list for rearranging motion information using the following scheme:

[0204] (1) Obtain a candidate motion information from the initial motion information candidate list and put it into the rearranged motion information candidate list.

[0205] (2) Obtain another candidate motion information from the initial motion information candidate list, put it into the rearranged motion information candidate list, and sort the candidate motion information and the already put candidate motion information in ascending order.

[0206] (3) Traverse all candidate motion information in the initial motion information candidate list until all candidate motion information is placed into the rearranged motion information candidate list and sorted.

[0207] It should be noted that when the number of candidates in the rearranged motion information list is less than the number of candidates in the initial motion information list, the image decoding device will exceed the number of candidates in the rearranged motion information list after executing step (2), and the candidate motion information that is ranked later will be removed from the rearranged motion information candidate list.

[0208] Step S15: Based on the syntax of the block to be decoded, obtain the target motion information from the candidate list of rearranged motion information.

[0209] In this embodiment, the image decoding device parses the syntax of the block to be decoded and obtains the motion information index of the best rearranged candidate motion information from the candidate list of rearranged motion information. The image decoding device directly determines the target motion information based on this motion information index.

[0210] Step S16: Obtain the predicted value using the target motion information, and decode the block to be decoded according to the predicted value.

[0211] In this embodiment, the image decoding device obtains a prediction block or reference block of the block to be decoded based on the target motion information, and the pixel value of the reference block is the prediction value of the block to be decoded. The image decoding device decodes the block to be decoded according to the prediction value to obtain a decoded image or a reconstructed image.

[0212] Furthermore, the image decoding device refines the target motion information using the MV refinement strategy in DMVR technology based on the target motion information determined in step S15, obtaining more accurate final motion information. Finally, the image decoding device obtains the prediction block or reference block of the block to be decoded based on the final motion information, and its pixel value is the predicted value of the block to be decoded.

[0213] It should be noted that the template regions used in the candidate rearrangement process and the refinement search process can be the same or different.

[0214] In one specific implementation, namely Example 2, the image decoding device rearranges the candidate list based on the L-shaped template region (in ascending order of template cost), and the calculation method for calculating the template cost is SAD.

[0215] Based on Example 1, assuming the candidate list includes 12 (N=12) candidates, after rearrangement, only the first 5 (M=5) candidates are retained for MV refinement search.

[0216] Understandably, for the encoding end, these 5 rearrangement candidates can be traversed and a refined MV search can be performed to select the best rearrangement candidate based on rate-distortion cost, and then syntactically encoded into the bitstream; for the decoding end, the syntax is directly decoded to determine the best rearrangement candidate from the 5 rearrangement candidates, and a refined MV search is performed.

[0217] Furthermore, the image decoding device can also correct the predicted value determined in step S17. The correction methods include, but are not limited to, interPF (inter-frame prediction filtering), IPC (inter-frame prediction correction), BGC (gradient-based prediction correction), DMVR (decoding-based prediction correction), and other inter-frame prediction correction methods.

[0218] It should be noted that the inter-frame prediction correction method used for prediction correction can be determined by the prediction correction syntax in the syntax of the block to be decoded, which will specify the prediction value correction scheme.

[0219] In this application, an image decoding device acquires an initial motion information candidate list for a block to be decoded, wherein the initial motion information candidate list includes at least historical candidate motion information; acquires the current template region of the block to be decoded, and the predicted template region of each candidate motion information in the initial motion information candidate list; acquires the template cost of each candidate motion information based on the current template region and the predicted template region; reorders the initial motion information candidate list based on the template cost to acquire a rearranged motion information candidate list; acquires target motion information from the rearranged motion information candidate list based on the syntax of the block to be decoded; acquires a prediction value using the target motion information; and decodes the block to be decoded according to the prediction value. Through the above image decoding method, the method of adjusting the candidate order search of the candidate list containing historical motion information can obtain more accurate motion information and more effective candidates, thereby improving the accuracy of image decoding.

[0220] Please refer to the details. Figure 12 , Figure 12This is a flowchart illustrating another embodiment of the image decoding method provided in this application.

[0221] like Figure 12 As shown, the specific steps are as follows:

[0222] Step S21: Obtain the initial motion information candidate list of the block to be decoded, wherein the initial motion information candidate list includes at least historical candidate motion information.

[0223] Step S22: Obtain the motion information index based on the syntax of the block to be decoded.

[0224] Step S23: In response to the motion information index being the index of the initial motion information candidate list, obtain the target motion information from the initial motion information candidate list based on the motion information index.

[0225] In the embodiments of this application, the image decoding device can directly obtain the predicted value through the MV in the candidate list, or obtain the predicted value based on the rearranged MV in the candidate list, or obtain the predicted value based on the refined MV.

[0226] It should be noted that all three types of MVs mentioned above can be directly obtained from the candidate list by using the index obtained from the decoding syntax parsing.

[0227] Step S24: Obtain the predicted value using the target motion information, and correct the predicted value according to the preset inter-frame prediction correction method.

[0228] Step S25: Decode the block to be decoded according to the corrected prediction value.

[0229] In one specific implementation, namely Example 3, if the predicted value is obtained directly based on the MV of the candidate list, or directly based on the MV of the rearranged candidate list, or based on the refined MV, the syntax is used to determine whether to perform IPC and / or IPF. At the encoding end, the cost of this prediction mode is determined by rate-distortion optimization technology, and the best method is selected to determine whether to perform IPC and / or IPF. At the decoding end, the syntax is used to determine whether to perform IPC or IPF.

[0230] In another specific implementation, namely Example 4, if the predicted value is obtained directly based on the MV of the candidate list, or directly based on the MV in the rearranged candidate list, or based on the refined MV, the application conditions are further used to determine whether to perform BGC and / or DMVR (no syntax required). The application conditions are the same as those in the prior art, and will not be repeated here.

[0231] The image decoding method of this application includes four steps: candidate list construction, candidate list rearrangement, MV refinement search, and prediction value correction. For the latter three steps, it is optional whether to perform them, or to perform some steps by default, or not to perform some steps by default. Therefore, the combination of these steps can form multiple schemes.

[0232] The application of the image decoding scheme provided in this application in encoding and decoding includes, but is not limited to:

[0233] (1) Replace the existing solution: that is, replace the existing solution with the solution designed in this proposal.

[0234] (2) New technical solutions: that is, adding one or more solutions designed in this proposal.

[0235] The syntactic expressions related to the image decoding method in this application include, but are not limited to, the following three aspects.

[0236] 1) Switch syntax: Used to express whether the scheme proposed in this proposal is enabled in the codec. Switch syntax can be transmitted in syntax structures including but not limited to: Video Parameter Set (VPS), Sequence Parameter Set (SPS), Picture Parameter Set (PPS), Picture Header (PH), coding unit, etc.

[0237] 2) Scheme Syntax: This means that for optional schemes or steps, the decision to execute a scheme or steps can be based on preset conditions, or a specific scheme or steps can be executed based on preset conditions. Alternatively, rate-distortion optimization (at the encoding end) can be used to select whether to execute a scheme or certain steps. When using rate-distortion optimization, this includes, but is not limited to, using scheme syntax, candidate index syntax, candidate rearrangement syntax, template index, IPC, and interPF syntax.

[0238] Solution syntax: When there is only one solution, it is used to express whether to execute the solution; when there are multiple solutions, it is used to express which solution to execute.

[0239] Candidate index syntax: For candidate lists and rearranged candidate lists, it is used to express which candidate has been selected.

[0240] Candidate rearrangement syntax: Used to express whether the candidate list should be rearranged.

[0241] Template index syntax: Used to express which specific template region was used when multiple template regions are used for template-based candidate rearrangement and / or template-based MV refinement search.

[0242] IPC syntax: used to indicate whether to perform IPC prediction correction and which IPC method to execute.

[0243] InterPF syntax: Used to express whether to perform InterPF prediction correction and which interPF method to execute.

[0244] 3) Syntactic encoding: Syntactic binarization methods include unary codes, truncated unary codes, truncated Rice codes, signed fixed-length codes, unsigned fixed-length codes, exponential Golomb codes, etc. Syntactic encoding methods include, but are not limited to, high-entropy codes, bypass codes, etc. The encoding methods are described in the standard text as descriptors. For specific meanings, please refer to the corresponding standard text.

[0245] In one specific implementation, namely Example 5, a candidate list is constructed based on Example 1, and a refined MV search is performed based on Example 2. This scheme is used to replace the template-based refined MV search technology in the prior art.

[0246] In this embodiment, the switch syntax `sps_inter_tm_enable` is used to express whether the scheme designed in this proposal is enabled. When `sps_inter_tm_enable = 0`, it means that the scheme is not enabled; when `sps_inter_tm_enable = 1`, it means that the scheme is enabled.

[0247]

[0248] In this embodiment, when `sps_inter_tm_enable` = 1, the `inter_tm_flag` in the encoding unit syntax structure is used as the scheme syntax to express whether the scheme is executed. When `inter_tm_flag` = 0, it means the scheme is not executed; when `inter_tm_flag` = 1, it means the scheme is executed. When `inter_tm_flag` = 1, the candidate index syntax `inter_tm_idx` (with a value of 0 to 4) further expresses the selection of the `inter_tm_idx`-th candidate in the rearranged candidate list.

[0249] Understandably, at the encoding end, rate-distortion optimization techniques (comparing rate-distortion costs) are used to select the best rearrangement candidate from five candidates (and perform MV refinement search). This is then compared with other prediction tools to determine whether to execute the scheme. The best result is written to the bitstream in syntactic form. For example, if the best candidate in this scheme is 3 with a rate-distortion cost of 1000, and the best rate-distortion cost of other predictions is 1200, then the best result should be the scheme with candidate 3. In this case, the encoding end encodes the value of `inter_tm_flag` as 1 and the value of `inter_tm_idx` as 3. At the decoding end, syntactic decoding is used directly to determine whether to execute the scheme and which candidate under that scheme to execute.

[0250]

[0251] In another specific implementation, namely Example 6, based on the predicted values ​​after Example 5, the predicted values ​​are further corrected based on Example 3. In this case, the syntax is described as follows:

[0252] The `inter_pf_flag` syntax is used to express whether to perform interPF prediction correction. When `inter_pf_flag = 0`, it means not to perform; when `inter_pf_flag = 1`, it means not to perform. Furthermore, `inter_pf_index` is used to express whether to perform the interPF method at the `inter_pf_index`th position.

[0253] The `inter_pc_flag` syntax is used to express whether to perform the `inter_pc_flag` prediction correction. When `inter_pc_flag = 0`, it means not to perform the correction; when `inter_pc_flag = 1`, it means not to perform the correction. Furthermore, `inter_pc_index` is used to express whether to perform the IPC method in the `inter_pc_index`th iteration.

[0254]

[0255]

[0256] In another specific implementation, namely Embodiment 7, two solutions are provided. Solution 1 is the solution in Embodiment 2, and Solution 2 is similar to Embodiment 2 but without refining the MV search. Solution 1 is used to replace the template-based MV refinement search technology in the prior art, and Solution 2 is a newly added technical solution.

[0257] The syntax is similar to that of Example 5, except that an inter_search_flag is added to the encoding unit data structure to indicate whether to perform a refined search. inter_search_flag = 1 indicates that a refined search is performed, and inter_search_flag = 0 indicates that a refined search is not performed.

[0258]

[0259] This application proposes a method for adjusting the candidate order search of a candidate list containing HMVP based on template cost. When constructing the candidate list, HMVP candidates are included, which can generate more effective candidates. Searching based on these candidates can obtain more accurate motion information, uncover more coding performance, and save more coding bits.

[0260] The proposed solution can further refine the predicted values, thereby providing more accurate predictions.

[0261] Please continue reading. Figure 13 , Figure 13 This is a flowchart illustrating an embodiment of the image encoding method provided in this application.

[0262] like Figure 13 As shown, the specific steps are as follows:

[0263] Step S31: Obtain the initial motion information candidate list of the block to be encoded, wherein the initial motion information candidate list includes at least historical candidate motion information.

[0264] Step S32: Obtain the current template region of the block to be encoded, and the predicted template region of each candidate motion information in the initial motion information candidate list.

[0265] Step S33: Based on the current template region and the predicted template region, obtain the template cost of each candidate motion information.

[0266] Step S34: Reorder the initial motion information candidate list based on template cost to obtain the rearranged motion information candidate list.

[0267] Step S35: Obtain the target motion information with the minimum rate distortion from the rearranged motion information candidate list.

[0268] Step S36: Obtain the predicted value using the target motion information, and encode the block to be encoded according to the predicted value.

[0269] It should be noted that, as Figure 9As shown, the processes of constructing the MV candidate list, rearranging the MV candidate list based on the template and retaining only the first M rearranged MV candidates, refining the MV candidates based on the template, obtaining the predicted value based on the refined MV, and correcting the predicted value are basically the same in both the encoding and decoding ends, and will not be repeated here.

[0270] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0271] To implement the above image decoding method, this application also proposes an image decoding apparatus, which can be found in detail below. Figure 14 , Figure 14 This is a schematic diagram of an embodiment of the image decoding device provided in this application.

[0272] The image decoding device 400 of this embodiment includes a processor 41, a memory 42, an input / output device 43, and a bus 44.

[0273] The processor 41, memory 42, and input / output device 43 are respectively connected to the bus 44. The memory 42 stores program data, and the processor 41 is used to execute the program data to implement the image decoding method described in the above embodiments.

[0274] In this embodiment, processor 41 can also be referred to as a CPU (Central Processing Unit). Processor 41 may be an integrated circuit chip with signal processing capabilities. Processor 41 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor, or processor 41 can be any conventional processor.

[0275] To implement the above image encoding method, this application also proposes an image encoding apparatus, for details please refer to [link / reference needed]. Figure 15 , Figure 15 This is a schematic diagram of an embodiment of the image encoding device provided in this application.

[0276] The image encoding device 500 of this embodiment includes a processor 51, a memory 52, an input / output device 53, and a bus 54.

[0277] The processor 51, memory 52, and input / output device 53 are respectively connected to the bus 54. The memory 52 stores program data, and the processor 51 is used to execute the program data to implement the image encoding method described in the above embodiments.

[0278] This application also provides a computer storage medium; please refer to the following: Figure 16 , Figure 16 This is a schematic diagram of a computer storage medium according to an embodiment of the present application. The computer storage medium 600 stores a computer program 61. When the computer program 61 is executed by the processor, it is used to implement the image decoding method and / or image encoding method of the above embodiment.

[0279] When the embodiments of this application are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0280] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. An image decoding method characterized by, The image decoding method comprises: obtaining an initial motion information candidate list of a to-be-decoded block, wherein the initial motion information candidate list at least comprises historical candidate motion information; obtaining a current template region of the to-be-decoded block and a prediction template region of each candidate motion information in the initial motion information candidate list; obtaining a template cost of each candidate motion information based on the current template region and the prediction template region; reordering the initial motion information candidate list based on the template cost to obtain a reordered motion information candidate list; obtaining target motion information in the reordered motion information candidate list based on syntax of the to-be-decoded block; obtaining a prediction value by using the target motion information and decoding the to-be-decoded block according to the prediction value.

2. The image decoding method of claim 1, wherein the obtaining the prediction value by using the target motion information and decoding the to-be-decoded block according to the prediction value comprises: performing a refinement search by using the target motion information to obtain final motion information; and obtaining the prediction value by using the final motion information and decoding the to-be-decoded block according to the prediction value.

3. The image decoding method of claim 2, wherein the obtaining the prediction value by using the final motion information and decoding the to-be-decoded block according to the prediction value comprises: obtaining the prediction value by using the final motion information and correcting the prediction value according to a preset inter-prediction correction method; and decoding the to-be-decoded block according to the corrected prediction value.

4. The image decoding method of claim 1, wherein the obtaining the prediction value by using the target motion information and decoding the to-be-decoded block according to the prediction value comprises: obtaining the prediction value by using the target motion information and correcting the prediction value according to a preset inter-prediction correction method; and decoding the to-be-decoded block according to the corrected prediction value.

5. The image decoding method of claim 4, wherein the preset inter-prediction correction method is any one of the following methods: inter-prediction value filtering, inter-prediction value correction, gradient-based prediction value correction, and decoding-end-based prediction value correction.

6. The image decoding method of claim 1, wherein the current template region is any one of the following regions: a template pixel composition region of an upper region of the to-be-decoded block, a template pixel composition region of a left region of the to-be-decoded block, a template pixel composition region of the upper region and the left region of the to-be-decoded block, and a template pixel composition region of the upper region, the left region and a top-left corner region of the to-be-decoded block.

7. The image decoding method of claim 1, wherein the image decoding method further comprises: obtaining template-based candidate adjustment switch syntax; in response to a value of the template-based candidate adjustment switch syntax representing starting of a template-based candidate adjustment scheme, obtaining template-based candidate adjustment scheme syntax; and obtaining a template-based candidate adjustment scheme based on a value of the template-based candidate adjustment scheme syntax. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 8. The image decoding method of claim 6, wherein, based on the value of the template-based candidate adjustment scheme syntax, the image decoding method further comprises: in response to the value of the candidate index syntax representing selection of a reordered motion information candidate list, obtaining a motion information index syntax; based on the motion information index syntax, obtaining a target motion information from the reordered motion information candidate list.

9. The image decoding method of claim 1, wherein the reordered motion information candidate list comprises a preset number of candidate motion information of the initial motion information candidate list, and the preset number of candidate motion information is the candidate motion information arranged from small to large after the initial motion information candidate list is sorted according to template cost; and wherein a number of motion information of the reordered motion information candidate list is less than or equal to a number of motion information of the initial motion information candidate list. The image decoding method comprises: obtaining an initial motion information candidate list of a to-be-decoded block, wherein the initial motion information candidate list comprises at least historical candidate motion information; based on the syntax of the to-be-decoded block, obtaining a motion information index; 10. An image decoding method, characterized by, in response to the motion information index being an index of the initial motion information candidate list, obtaining a target motion information from the initial motion information candidate list based on the motion information index; using the target motion information to obtain a prediction value, and correcting the prediction value according to a preset inter-frame prediction correction method; decoding the to-be-decoded block according to the corrected prediction value.

11. The image decoding method of claim 10, wherein the image decoding method further comprises: obtaining a current template region of the to-be-decoded block and a prediction template region of each candidate motion information in the initial motion information candidate list; based on the current template region and the prediction template region, obtaining a template cost of each candidate motion information; based on the template cost, reordering the initial motion information candidate list to obtain a reordered motion information candidate list; after the image decoding method obtains the motion information index based on the syntax of the to-be-decoded block, the image decoding method further comprises: in response to the motion information index being an index of the reordered motion information candidate list, obtaining a target motion information from the reordered motion information candidate list based on the motion information index.

12. The image decoding method of claim 10, wherein the image decoding method, in response to the motion information index being an index of the reordered motion information candidate list, obtains a target motion information from the reordered motion information candidate list based on the motion information index, comprises: in response to the motion information index being an index of the reordered motion information candidate list, obtaining a candidate target motion information from the reordered motion information candidate list based on the motion information index; using the candidate target motion information to perform a refinement search to obtain the target motion information.

13. The image decoding method of claim 10, wherein the image decoding method further comprises: ​ ​ ​ ​ ​ ​ obtaining a prediction modification syntax in a syntax of the to-be-decoded block; determining the preset inter-frame prediction modification method based on a value of the prediction modification syntax.

14. An image coding method characterized by, The image encoding method comprises: obtaining an initial motion information candidate list of a to-be-encoded block, wherein the initial motion information candidate list at least comprises historical candidate motion information; obtaining a current template region of the to-be-encoded block and a prediction template region of each candidate motion information in the initial motion information candidate list; obtaining a template cost of each candidate motion information based on the current template region and the prediction template region; reordering the initial motion information candidate list based on the template cost to obtain a reordered motion information candidate list; obtaining target motion information with minimum rate-distortion in the reordered motion information candidate list; encoding the to-be-encoded block according to a prediction value obtained by using the target motion information.

15. An image decoding apparatus characterized by comprising: The image decoding apparatus comprises a memory and a processor coupled with the memory; wherein the memory is configured to store program data, and the processor is configured to execute the program data to implement the image decoding method according to any one of claims 1 to 13.

16. An image coding apparatus characterized by comprising: The image encoding apparatus comprises a memory and a processor coupled with the memory; wherein the memory is configured to store program data, and the processor is configured to execute the program data to implement the image encoding method according to claim 14.

17. A computer storage medium, comprising, The computer storage medium is configured to store program data, and the program data, when executed by a computer, is configured to implement the image decoding method according to any one of claims 1 to 13 and / or the image encoding method according to claim 14.