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

By expanding the search range of motion vectors through a multi-stage search strategy, the problem of limited search range in DMVR technology is solved, thereby improving the accuracy and performance of image decoding.

CN121644827APending 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

The existing DMVR technology has a limited search range, resulting in inaccurate motion vector offsets, which affects the accuracy of image decoding, and it fails to effectively utilize relevant information of the current block to correct the offsets.

Method used

A multi-stage search strategy is adopted. By obtaining candidate offsets of the initial motion vector, calculating the decoding difference, and finally determining the target search offset, the search range of motion information is expanded and the relevance is improved.

Benefits of technology

By employing a multi-stage search strategy, the search range of motion vectors is expanded, improving the accuracy and performance of image decoding and enhancing the correlation between the block to be decoded and the search offset.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121644827A_ABST
    Figure CN121644827A_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: acquiring a plurality of first candidate offsets at a first preset position based on an initial motion vector; obtaining a first decoding difference of each first candidate offset; determining a first search offset of the first search stage; acquiring a plurality of second candidate offsets at a second preset position based on the first search offset; obtaining a second decoding difference of each second candidate offset; determining a second search offset of a second search stage; and obtaining a target search offset based on the first search offset and the second search offset, and decoding the to-be-decoded block by using a predicted value of the target search offset. Through the image decoding method, the motion information search range can be effectively expanded, so that the image decoding performance is improved, the correlation with the to-be-decoded block is enhanced, and the image decoding accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image encoding and decoding technology, and 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 Technology

[0002] Video image data is relatively large, so it is usually necessary to compress the video pixel data (RGB, YUV, etc.). The compressed data is called the video stream. The video stream is transmitted to the user's end via wired or wireless network for decoding and viewing. The entire video encoding process includes block partitioning, prediction, transform, quantization, and encoding.

[0003] Currently, DMVR (Decoder-side motion vector refinement) technology is used for inter-frame prediction. However, the maximum search range of DMVR is only 2, which severely limits its performance. In addition, DMVR determines the offset only by minimizing the difference between forward and backward prediction values. Since it does not involve information related to the current block, the obtained offset may be biased, resulting in low image decoding accuracy. Summary of the Invention

[0004] To address the aforementioned technical problems, this application proposes an image decoding method, an image encoding method, an image decoding device, an image encoding device, and a computer storage medium.

[0005] To address the aforementioned technical problems, this application proposes an image decoding method, which includes:

[0006] Obtain the block to be decoded, and the initial motion vector of the block to be decoded, wherein the initial motion vector is a forward motion vector and a backward motion vector;

[0007] In response to the first search phase, several first candidate offsets are obtained at a first preset position based on the initial motion vector;

[0008] Obtain the first decoding difference for each first candidate offset;

[0009] Based on the minimum value of the first decoding difference, the first search offset of the first search stage is determined;

[0010] In response to the second search phase, several second candidate offsets are obtained at a second preset position based on the first search offset;

[0011] Obtain the second decoding difference for each second candidate offset;

[0012] Based on the minimum value of the second decoding difference, the second search offset of the second search phase is determined;

[0013] The target search offset is obtained based on the second search offset and the second search offset, and the predicted value of the target search offset is used to decode the block to be decoded.

[0014] To address the aforementioned technical problems, this application also proposes an image encoding method, which includes:

[0015] Obtain the block to be encoded and the initial motion vector of the block to be encoded, wherein the initial motion vector is a forward motion vector and a backward motion vector;

[0016] In response to the first search phase, several first candidate offsets are obtained at a first preset position based on the initial motion vector;

[0017] Obtain the first decoding difference for each first candidate offset;

[0018] Based on the minimum value of the first decoding difference, the first search offset of the first search stage is determined;

[0019] In response to the second search phase, several second candidate offsets are obtained at a second preset position based on the first search offset;

[0020] Obtain the second decoding difference for each second candidate offset;

[0021] Based on the minimum value of the second decoding difference, the second search offset of the second search phase is determined;

[0022] The target search offset is obtained based on the second search offset and the second search offset, and the predicted value of the target search offset is used to encode the block to be encoded.

[0023] To address the aforementioned technical problems, this application also proposes an image decoding 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 decoding method described above.

[0024] 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 as described above.

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

[0026] Compared with the prior art, the beneficial effects of this application are as follows: the image decoding device acquires the block to be decoded and the initial motion vector of the block to be decoded, wherein the initial motion vector is a forward motion vector and a backward motion vector; in response to the first search stage, a plurality of first candidate offsets are acquired based on the initial motion vector at a first preset position; a first decoding difference is acquired for each first candidate offset; a first search offset for the first search stage is determined based on the minimum value of the first decoding difference; in response to the second search stage, a plurality of second candidate offsets are acquired based on the first search offset at a second preset position; a second decoding difference is acquired for each second candidate offset; a second search offset for the second search stage is determined based on the minimum value of the second decoding difference; a target search offset is acquired based on the first search offset and the second search offset, and the block to be decoded is decoded using the predicted value of the target search offset. Through the above image decoding method, the multi-stage search effectively expands the motion information search range, thereby improving image decoding performance; the calculation of the decoding difference between the block to be decoded and the search offset enhances the correlation with the block to be decoded, thereby improving the accuracy of image decoding. Attached Figure Description

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

[0028] in:

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

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

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

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

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

[0034] Figure 6 This is a flowchart illustrating the multi-stage DMVR search encoding and decoding process provided in this application;

[0035] Figure 7 This is a schematic diagram of an embodiment of the template shape provided in this application;

[0036] Figure 8 This is a schematic diagram of an embodiment of the predicted location provided in this application;

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

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

[0039] Figure 11 This is a schematic diagram of a specific embodiment of the template shape provided in this application;

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

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

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

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

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

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

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

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

[0048] 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).

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

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

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

[0052] Currently, the DMVR technology used in decoding mainly refines the motion vector of the coded block by minimizing the forward and backward prediction values. The general process of DMVR technology is as follows:

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

[0054] (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.

[0055] (3) Sub-block MV refinement. 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.

[0056] The specific process is as follows:

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

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

[0059]

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

[0061]

[0062]

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

[0064]

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

[0066] (1) Sub-block pre-compensation: The schematic diagram of sub-block pre-compensation is shown below. Figure 2 As shown, Figure 2 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.

[0067] (2) Integer pixel search.

[0068] 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 3 As shown, the sub-block MV is represented by the colored dots in the figure. Among them, Figure 3 This is a schematic diagram of an embodiment of the DMVR offset candidate point provided in this application.

[0069] 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).

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

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

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

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

[0074] 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:

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

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

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

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

[0079] (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].

[0080] (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).

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

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

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

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

[0085] The current DMVR has the following problems:

[0086] (1) The maximum search range is only 2, which severely limits the performance of DMVR.

[0087] (2) Determining the offset solely by minimizing the difference between forward and backward predictions may result in a biased offset since no information related to the current block is involved.

[0088] (3) The offset determined by DMVR is only used to correct the prediction value of the current block and is not used for subsequent coding blocks, which also limits the performance of DMVR.

[0089] To address the current problems with DMVR, this application designs a new search strategy that expands the DMVR search range without significantly increasing computational complexity; further introduces relevant information of the current block to improve the accuracy of DMVR offsets; and allows the motion vectors refined by DMVR to be used in subsequent encoded blocks.

[0090] Please refer to the details. Figure 5 and Figure 6 , Figure 5 This is a flowchart illustrating an embodiment of the image decoding method provided in this application. Figure 6 This is a flowchart illustrating the multi-stage DMVR search encoding and decoding process provided in this application.

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

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

[0093] like Figure 6As shown, the encoding and decoding method for multi-stage DMVR search proposed in this application aims to obtain more accurate DMVR offsets, thereby improving prediction performance. Please refer to the encoding process of this application. Figure 6 The flowchart on the left and the decoding process can be found in the following document. Figure 6 The flowchart on the right. In the encoding and decoding process, the refinement and adjustment process of DMVR can be divided into 1) MV processing, sub-block division and sub-block MV acquisition, etc.; 2) sub-block MV refinement; 3) obtaining prediction values ​​based on refined MV.

[0094] It should be noted that the image decoding method of this application may only involve the DMVR sub-block MV refinement process and the DMVR syntax (existing DMVR does not require syntax), as shown in the flowchart. Figure 6 As shown in the shaded area, the other parts are the same as the existing technology, which has been described in detail in the above introduction to DMVR technology, and will not be repeated here.

[0095] This application proposes a multi-stage MV refinement scheme for the sub-block MV refinement process, which specifically includes the following design aspects:

[0096] (1) Multi-stage MV refinement technology: This part designs a variety of MV refinement strategies.

[0097] (2) Multi-stage DMVR application and syntax design: This section describes how to apply the multi-stage DMVR scheme in the encoding and decoding process, and how the multi-stage DMVR application scheme is expressed in the bitstream through syntax.

[0098] The multi-stage MV refinement technique proposed in this application will be introduced below:

[0099] The multi-stage MV refinement technique proposed in this application includes at least N (N>=2) stages of MV refinement, and the refined MV or offset of the previous stage can be used as the starting point for the MV refinement of the subsequent stages.

[0100] For each stage of MV refinement techniques, two aspects are included: refinement criteria and refinement search strategies.

[0101] The MV refinement criteria provided in this application include, but are not limited to: criteria based on template differences, criteria based on differences between forward and backward predicted values, and criteria based on both template differences and differences between forward and backward predicted values. The methods for calculating these differences include, but are not limited to, SAD (Sum of Absolute Differences), SSD (Sum of Squared Differences), and SATD (Sum of Absolute Transformed Differences).

[0102] The criteria based on template differences: Template differences include, but are not limited to, the pixel value differences between the current template and the predicted template. The current template is the current block, i.e., the reconstructed pixels surrounding the block to be decoded. The predicted template is the reference block or the predicted block, i.e., the search offset found during the search phase points to pixels surrounding the predicted block. The shape of the template includes, but is not limited to: left-side template, top-side template, left-side and top-side template, and L-shaped template (including left side, top side, and top-left corner), etc. Please refer to [link / reference] for details. Figure 7 , Figure 7 This is a schematic diagram of an embodiment of the template shape provided in this application.

[0103] The criterion is based on the difference between forward and backward predicted values: that is, the difference in pixel values ​​between the forward and backward predicted blocks.

[0104] Criteria based on template difference and forward and backward prediction difference: This criterion includes both template difference and forward and backward prediction difference.

[0105] The refined search strategy provided in this application is as follows: each stage can perform M (M>=1) rounds of refined search in a preset candidate set. The refined search is based on a preset position, and the preset position with the best refinement criterion is used as the search result (the search result of each stage should be the sum of the search results of M rounds, and the search result of each round is used as the starting point of the next round of search).

[0106] The preset candidate set is not limited and can be any subset of the set of pixels in the pre-compensation region.

[0107] The preset positions include, but are not limited to, cross-shaped preset positions, rectangular preset positions, hexagonal preset positions, etc. Figure 8 As shown, the rhombus represents adjacent pixels, and the pentagram represents the starting position. Figure 8 This is a schematic diagram of an embodiment of the predicted position provided in this application. The overall image decoding process will be further described below in conjunction with multi-stage MV refinement technology:

[0108] like Figure 5 As shown, the specific steps are as follows:

[0109] Step S11: Obtain the block to be decoded and its initial motion vector, wherein the initial motion vector is a forward motion vector and a backward motion vector.

[0110] In this embodiment, the image decoding device determines the block to be decoded and the initial motion vector (MV) of the block to be encoded based on the decoded bitstream. The initial MV can be a forward MV and a backward MV.

[0111] Both the block to be decoded and the initial MV can be obtained by parsing from the syntax of the decoded bitstream.

[0112] Step S12: In response to the first search phase, obtain several first candidate offsets at the first preset position based on the initial motion vector.

[0113] In this embodiment of the application, the image decoding device, in the first search phase, takes the predicted block as the search starting point and follows the... Figure 8 Search at any of the preset positions shown to obtain several first candidate offsets and a first candidate block determined based on the first candidate offsets.

[0114] Step S13: Obtain the first decoding difference for each first candidate offset.

[0115] In the embodiments of this application, the refinement criteria used by the image decoding device to calculate the first decoding difference include, but are not limited to: a criterion based on template difference, a criterion based on forward and backward prediction value difference, or a criterion based on both template difference and forward and backward prediction value difference.

[0116] It should be noted that during the search process, for images not located in the preset candidate set at a preset position and / or where image boundary constraints are found, the thinning criterion for that position can be omitted from the calculation. Instead, that position can be directly counted as having the worst thinning criterion, thus ensuring that the search results are always within the preset candidate set and reducing the computational load of the thinning criterion. The preset candidate set involved in this application is as follows: Figure 2 The pre-compensation region shown includes the motion compensation region and the padding region, or the preset candidate set can be... Figure 2 Any subset of the pre-compensation region shown.

[0117] The following example illustrates the use of a template-based difference criterion:

[0118] The image decoding device acquires the current template pixel value of the block to be decoded, i.e., the set of pixel values ​​of the template region of the block to be decoded, and the predicted template pixel value of the first candidate offset, i.e., the set of pixel values ​​of the predicted template region of the first candidate block pointed to by the first candidate offset. Then, the image decoding device calculates the pixel value difference between the current template pixel value and the predicted template pixel value, i.e., the template difference. The calculation method of the difference includes, but is not limited to, SAD (Sum of Absolute Differences), SSD (Sum of Squared Differences), SATD (Sum of Absolute Transform Differences), etc.

[0119] It should be noted that the template shape of the block template region to be decoded is the same as the template shape of the predicted template region, and this can be achieved by using methods such as... Figure 7 Any template shape in the template.

[0120] Step S14: Determine the first search offset for the first search phase based on the minimum value of the first decoding difference.

[0121] In this embodiment of the application, the image decoding device uses the candidate offset corresponding to the minimum value among all decoding differences calculated in step S13 as the first search offset of the first stage search offset.

[0122] It should be noted that the first search phase may include multiple rounds of search. The starting point of the first round of search is the predicted block, and the starting point of subsequent rounds of search is the search result of the previous round. Each round of search may employ the same or different search schemes, including but not limited to: refinement criteria and refinement search strategies.

[0123] Step S15: In response to the second search phase, obtain several second candidate offsets at a second preset position based on the first search offset.

[0124] In this embodiment of the application, the image decoding device, in the second search phase, uses the first search offset as the search starting point and follows the... Figure 8 Search at any of the preset positions shown to obtain several second candidate offsets.

[0125] It should be noted that the preset position for the second search phase can be selected from the preset position for the first search phase. Figure 8 The same preset position, or different preset positions.

[0126] Step S16: Obtain the second decoding difference for each second candidate offset.

[0127] Step S17: Based on the minimum value of the second decoding difference, determine the second search offset for the second search phase.

[0128] In the embodiments of this application, the search process of steps S16 and S17 is basically the same as that of steps S13 and S14, and will not be described again here.

[0129] Furthermore, to avoid repetitive position calculations, the image decoding device can save the results of the refinement criteria from previous stages or rounds. If the preset position for a subsequent stage or round has already been calculated, it can be retrieved from the previously saved results.

[0130] Step S18: Obtain the target search offset based on the first search offset and the second search offset, and use the predicted value of the target search offset to decode the block to be decoded.

[0131] In this embodiment, when planning a multi-stage search task, the image decoding device determines whether the second search offset of the second search stage meets the termination search condition. If so, the subsequent search stages are terminated, and the second search offset and the first search offset are used as the final search offset. The termination search condition can be whether the refinement criteria for the second-stage search offset reach a preset value, such as being less than a preset difference value.

[0132] It should be noted that both the first search offset and the second search offset involved in this application are relative offsets. That is, the first search offset is the offset relative to the initial motion vector, and the second search offset is the offset relative to the first search offset. Therefore, the image decoding device needs to add the first search offset and the second search offset together to obtain the final absolute offset for image decoding.

[0133] Furthermore, the above logic is the judgment made by the image decoding device regarding the termination condition after completing all stages and rounds of the search task. To further reduce computational complexity, this application can also determine during the search process whether the refinement criteria of the search position or the search result have reached a preset value, and / or if the search result has not changed relative to the previous stage or round, then terminate the search early and take the search result as the final search result.

[0134] For example, if the image decoding device determines that the decoding difference of the second-stage search target block obtained in one round of search task is less than or equal to a preset difference value, it terminates the search task of the second search stage and obtains the second search offset based on all the second-stage search offsets of the search tasks executed in the second search stage.

[0135] For example, if the image decoding device determines that the second-stage search offset obtained in one round of search task is 0, it terminates the search task in the second search stage and obtains the second search offset based on all the second-stage search offsets of the search tasks already executed in the second search stage.

[0136] For example, the image decoding device can also determine that the decoding difference of the first-stage search target block obtained in one round of search task is less than or equal to a preset difference value, terminate the search task of the first search stage and the search task of the second search stage, obtain the first search offset based on all the first-stage search offsets of the search tasks executed in the first search stage, and use it as the final search offset for image decoding.

[0137] For example, if the image decoding device determines that the first-stage search offset obtained in one round of search task is 0, it terminates the search task in the first search stage and the search task in the second search stage. Based on all the first-stage search offsets of the search tasks executed in the first search stage, it obtains the first search offset and uses it as the final search offset for image decoding.

[0138] Furthermore, this application also provides an MV storage strategy, which, in order to further extend DMVR performance, allows the storage of DMVR-refined MVs in the codec, unlike the current DMVR technology, which can only store MVs before DMVR refinement.

[0139] In this application, an image decoding device acquires a block to be decoded and an initial motion vector of the block to be decoded, wherein the initial motion vector is a forward motion vector and a backward motion vector; in response to a first search phase, a plurality of first candidate offsets are acquired based on the initial motion vector at a first preset position; a first decoding difference is acquired for each first candidate offset; a first search offset for the first search phase is determined based on the minimum value of the first decoding difference; in response to a second search phase, a plurality of second candidate offsets are acquired based on the first search offset at a second preset position; a second decoding difference is acquired for each second candidate offset; a second search offset for the second search phase is determined based on the minimum value of the second decoding difference; a target search offset is acquired based on the first search offset and the second search offset, and the block to be decoded is decoded using the predicted value of the target search offset. Through the above image decoding method, the multi-stage search effectively expands the motion information search range, thereby improving image decoding performance; and the calculation of the decoding difference between the block to be decoded and the search offset enhances the correlation with the block to be decoded, thereby improving the accuracy of image decoding.

[0140] Furthermore, the image decoding method of this application is also applicable to the pixel-by-pixel search strategy of DMVR, that is, when the integer pixel search result meets the preset range limit, a pixel-by-pixel search is performed; otherwise, a pixel-by-pixel search is not performed.

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

[0142] like Figure 9 As shown, the specific steps are as follows:

[0143] Step S21: Determine whether the first search offset and / or the second search offset are within the pixel-level search range of the initial motion vector.

[0144] In this embodiment, the image decoding device determines whether the integer pixel search result, such as the second-stage search offset in the above embodiment, is within the pixel-level search range of the prediction block. Figure 4 As shown in the color candidate positions, the center of the color position is the initial starting point, i.e., the prediction block. In other embodiments, the center of the color position may also be the first-stage search result or the search result of other preceding stages.

[0145] It should be noted that since the second-stage search offset is a relative offset, the image decoding device can also determine whether the target search offset obtained by adding the first search offset and the second search offset is within the pixel-by-pixel search range of the initial motion vector, and perform pixel-by-pixel search as in steps S22 and S23.

[0146] The image decoding device can also determine whether the first search offset is within the pixel-by-pixel search range of the initial motion vector, and perform pixel-by-pixel searches as in steps S22 and S23.

[0147] When the image decoding device determines that the second-stage search offset is in the color candidate position, it meets the pixel-by-pixel search condition and proceeds to step S22.

[0148] Step S22: Obtain the pixel offset of the second search offset through the error surface model.

[0149] In this embodiment of the application, the image decoding device obtains the difference in the second-stage search offset (SAD). center And obtain the difference SAD between adjacent blocks of the second-stage search offset. left SAD right SAD top SAD bottom .

[0150] The image decoding device calculates the pixel offsets deltaX and deltaY using the following formulas:

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

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

[0153] Step S23: The offset after offsetting by the pixel offset based on the second search offset is used as the final search offset for the second search stage.

[0154] In this embodiment of the application, the image decoding device uses the pixel offset to offset the second-stage search offset to obtain the final search offset of the second search stage.

[0155] Furthermore, the image decoding method of this application is also applicable to the chromaticity search strategy of DMVR, that is, the chromaticity search results are usually obtained directly based on the color space and luminance search results. In order to avoid the carry problem in the calculation process, the range of the calculated chromaticity search results can be limited.

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

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

[0158] Step S31: Based on the color format of the block to be decoded, obtain the ratio of chroma offset to luminance offset.

[0159] In the embodiments of this application, the above process searches for the brightness search offset of the block to be decoded and its brightness search offset.

[0160] In this embodiment of the application, if the 420 color format is used, the ratio of chroma offset to luminance offset is 1 / 2.

[0161] Step S32: Obtain the chromaticity search offset based on the ratio and luminance search offset.

[0162] In this embodiment, the image decoding device scales the luminance search offset according to a ratio to obtain the chrominance search offset.

[0163] Step S33: Decode the block to be decoded based on the predicted values ​​of the luminance search offset and the chrominance search offset.

[0164] Furthermore, in this embodiment of the application, if the chroma search offset calculated in the above steps exceeds the maximum chroma offset, in order to avoid carry-over issues in the calculation process, the image decoding device uses the maximum chroma offset instead of the calculated chroma search offset to obtain the chroma search offset.

[0165] Specifically, in response to a chroma search candidate offset being less than a chroma maximum offset, the image decoding device determines the chroma search offset from the chroma search candidate offset. In response to a chroma search candidate offset being greater than or equal to a chroma maximum offset, the image decoding device obtains the chroma search offset from the chroma maximum offset.

[0166] In one specific implementation, namely Example 1, the multi-stage MV thinning technology used by the image decoding device is: N=2, that is, MV thinning is performed in two stages; in this embodiment, the motion compensation region size is further expanded, and the sizes of each pre-compensated region are as follows: Figure 2 As shown.

[0167] The refinement criterion adopted by the image decoding device is that both stages use a criterion based on the difference between forward and backward prediction values.

[0168] The image decoding device employs the following refined search strategy:

[0169] Phase 1 MV Refinement Search Strategy: M=1, using a preset rectangular position, i.e., performing one round of refinement search within the preset rectangular position; since only one round of search is performed, the preset candidate set is the same as the preset position. Assume the offset of the search result in the first round is (-1,-1), i.e., shifted horizontally to the left by 1 pixel and vertically upward by 1 pixel.

[0170] Phase 2 MV Refinement Search Strategy: M=3, employing a cross-shaped preset position, i.e., performing 3 rounds of cross-shaped preset position refinement search; the preset candidate set is the same as existing technologies, including... Figure 3 The image shows 21 preset candidate positions, where blue indicates the search starting point (in this embodiment, the search starting point should be the search result of the first stage). Assume the offset of the search result in the second round is (-1, 0), that is, a horizontal offset of 1 pixel to the left, with no vertical offset.

[0171] The image decoding device employs a pixel-by-pixel search strategy: if the search result (i.e., the offset) in the second stage is within one pixel (e.g., ... Figure 4 As shown in the color candidate position, the color position center is defined as the first stage search result in this embodiment, and may also be the initial starting point in other embodiments. Then, a pixel-by-pixel search is performed. In this embodiment, the second stage offset (-1,0) is within the defined range of 1 pixel, so a pixel-by-pixel search is required.

[0172] The image decoding device employs a chroma pixel search strategy as follows: if a 420 color format is used, the chroma offset should be half of the luminance. Since the maximum luminance offset in this embodiment is 3, the chroma offset may reach 2 after calculation. In order not to increase bandwidth or reduce inaccurate chroma prediction, the maximum chroma offset is limited to 1.

[0173] The image decoding device adopts the following MV storage strategy: through two stages of MV refinement, the final offset is (-2, -1). Assuming the initial MV is (10, 5), the refined MV is (8, 4). Therefore, the vector (8, 4) is stored in the codec.

[0174] In another specific implementation, namely Example 2, this embodiment is similar to the previous specific implementation, employing a two-stage MV refinement. However, the first stage uses a refinement search based on template differences. Specifically, the template used is as follows: Figure 11 As shown, an L-shaped template with a size of 1 pixel is used.

[0175] The following section continues with the application and syntactic design of multi-stage DMVR:

[0176] Multi-stage DMVR application solutions include, but are not limited to:

[0177] (1) Replace existing DMVR technology: that is, replace existing DMVR technology with the scheme designed in this application.

[0178] (2) Added DMVR technology: that is, add one or more DMVR technologies designed in this application.

[0179] Multi-stage DMVR syntax design includes, but is not limited to: 1) multi-stage DMVR switch syntax; 2) multi-stage DMVR scheme syntax; 3) multi-stage DMVR syntax encoding.

[0180] (1) Multi-stage DMVR switch syntax: used to express whether the DMVR scheme proposed in this proposal is enabled in the codec. The 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.

[0181] (2) Syntax of Multi-Stage DMVR Scheme: It is understood that the execution of DMVR can be determined based on preset conditions, or a specific DMVR scheme can be executed based on preset conditions. Alternatively, rate-distortion optimization (at the encoding end) can be used to select whether to execute DMVR or a specific DMVR scheme. When selecting through rate-distortion optimization, this includes, but is not limited to, using DMVR pattern syntax to indicate whether and how to execute the proposed DMVR scheme.

[0182] DMVR mode syntax: When there is only one DMVR scheme, it is used to express whether to execute the DMVR scheme. However, when there is more than one DMVR scheme, it is used to express whether to execute DMVR and which DMVR scheme to execute.

[0183] (3) Multi-stage DMVR syntactic coding: 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 coding methods include, but are not limited to, high-entropy coding, bypass coding, etc. The coding methods are described in the standard text as descriptors. For specific meanings, refer to the corresponding standard text.

[0184] In one specific implementation, namely Example 3, the multi-stage DMVR application used by the image decoding device is: replacing the existing DMVR technology. Using Example 1 to replace the existing DMVR technology, there is only one DMVR scheme, and the DMVR is executed directly when the conditions are met, therefore no syntax is required.

[0185] In another specific implementation, namely in embodiment 4, the multi-stage DMVR application of the image decoding device is as follows: the existing DMVR technology is replaced by embodiment 1, and the DMVR technology in embodiment 2 is added. The conditions for applying DMVR remain unchanged. At this time, there are two DMVR schemes, and they are selected by rate-distortion optimization.

[0186] Multi-stage DMVR switch syntax: `sps_msdmvr_enable` is used to indicate whether the multi-stage DMVR scheme is enabled and encoded for transmission in SPS, as shown in the table below:

[0187]

[0188] When sps_msdmvr_enable = 0, it means that the multi-stage DMVR adjustment scheme is not enabled; when sps_msdmvr_enable = 1, it means that the multi-stage DMVR adjustment scheme is enabled.

[0189] Multi-stage DMVR scheme syntax: When sps_msdmvr_enable=1, the multi-stage DMVR mode syntax msdmvr_mode in the encoding unit syntax structure is used to indicate how to execute the multi-stage DMVR scheme, as shown in the table below.

[0190] When msdmvr_mode = 0, it indicates that the multi-stage DMVR scheme in Example 1 is executed; when msdmvr_mode = 1, it indicates that the multi-stage DMVR scheme in Example 2 is executed.

[0191] At the encoding end, the rate-distortion costs of two schemes are compared using rate-distortion optimization techniques to determine the optimal multi-stage DMVR scheme, and the syntax is written into the bitstream according to the corresponding syntax requirements; at the decoding end, the corresponding syntax is decoded to determine how to execute the multi-stage DMVR scheme.

[0192]

[0193] The image decoding method of this application can effectively expand the DMVR search range, thereby improving the DMVR compression performance; it can enhance the correlation with the current block, thereby making the DMVR more accurate; and it allows the codec to store the adjusted motion vector, thereby improving the motion vector of subsequent coded blocks.

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

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

[0196] Step S31: Obtain the block to be encoded and its initial motion vector, wherein the initial motion vector is a forward motion vector and a backward motion vector.

[0197] Step S32: In response to the first search phase, obtain several first candidate offsets at the first preset position based on the initial motion vector.

[0198] Step S33: Obtain the first decoding difference for each first candidate offset.

[0199] Step S34: Based on the minimum value of the first decoding difference, determine the first search offset for the first search stage.

[0200] Step S35: In response to the second search phase, obtain several second candidate offsets at a second preset position based on the first search offset.

[0201] Step S36: Obtain the second decoding difference for each second candidate offset.

[0202] Step S37: Based on the minimum value of the second decoding difference, determine the second search offset for the second search phase.

[0203] Step S38: Obtain the target search offset based on the first search offset and the second search offset, and encode the block to be encoded using the predicted value of the target search offset.

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

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

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

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

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

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

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

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

[0212] This application also provides a computer storage medium; please refer to the following: Figure 15 , Figure 15 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.

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

[0214] 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 a to-be-decoded block and an initial motion vector of the to-be-decoded block, wherein the initial motion vector is a forward motion vector and a backward motion vector; in response to a first search stage, obtaining a plurality of first candidate offsets based on the initial motion vector at a first preset position; obtaining a first decoding difference of each first candidate offset; determining a first search offset of the first search stage based on a minimum value of the first decoding difference; in response to a second search stage, obtaining a plurality of second candidate offsets based on the first search offset at a second preset position; obtaining a second decoding difference of each second candidate offset; determining a second search offset of the second search stage based on a minimum value of the second decoding difference; obtaining a target search offset based on the first search offset and the second search offset, and decoding the to-be-decoded block by using a prediction value of the target search offset.

2. The image decoding method of claim 1, wherein the image decoding method further comprises: obtaining a prediction region of the to-be-decoded block based on the initial motion vector and a pre-compensation region extended based on the prediction region; wherein the first candidate offset and the second candidate offset are both in the pre-compensation region.

3. The image decoding method of claim 2, wherein the first candidate offset and the second candidate offset are both in a preset candidate set region, and the preset candidate set region is a pixel subset of the pre-compensation region.

4. The image decoding method of claim 1, wherein the first decoding difference and the second decoding difference are obtained by using any one of the following difference calculation methods: obtaining a current template pixel value of the to-be-decoded block and a prediction template pixel value of a candidate offset, and obtaining a pixel value difference of the candidate offset based on the current template pixel value and the prediction template pixel value; and / or, obtaining a pixel value difference of a forward prediction pixel value of a forward candidate offset and a backward prediction pixel value of a backward candidate offset; wherein the first decoding difference and the second decoding difference are calculated by using the same or different difference calculation methods.

5. The image decoding method of claim 4, wherein the shape of the template is any one of the following: a left template, an upper template, a left and upper template, and an L-shaped template.

6. The image decoding method of claim 1, wherein the first preset position and the second preset position are any one of the following: a cross-shaped prediction setting, a rectangular preset position, and a hexagonal preset position; wherein the first preset position and the second preset position use the same or different preset positions.

7. The image decoding method of claim 1, wherein the first search stage and / or the second search stage comprises a plurality of rounds of search tasks, and the starting offset of each round of search task is the result offset of the previous round of search task or the result offset of the previous search stage. ​ ​ ​ ​ ​ ​ 8. The image decoding method of claim 1 or 7, wherein determining the second search offset of the second search stage based on the minimum of the second decoding differences comprises: terminating the search task of the second search stage in response to the decoding difference of the second stage search offset obtained in one round of the search task being less than or equal to a preset difference value, and obtaining the second search offset based on all the second stage search offsets of the search tasks performed in the second search stage. terminating the search task of the second search stage in response to the second stage search offset obtained in one round of the search task being 0, and obtaining the second search offset based on all the second stage search offsets of the search tasks performed in the second search stage.

9. The image decoding method of claim 1 or 7, wherein determining the first search offset of the first search stage based on the minimum of the first decoding differences comprises: terminating the search task of the first search stage and the search task of the second search stage in response to the decoding difference of the first stage search offset obtained in one round of the search task being less than or equal to a preset difference value, and obtaining the first search offset based on all the first stage search offsets of the search tasks performed in the first search stage; terminating the search task of the first search stage and the search task of the second search stage in response to the first stage search offset obtained in one round of the search task being 0, and obtaining the first search offset based on all the first stage search offsets of the search tasks performed in the first search stage. The image decoding method further comprises: decoding the to-be-decoded block based on the prediction value of the first search offset.

10. The image decoding method of claim 1, wherein after determining the second search offset of the second search stage based on the minimum of the second decoding differences, the image decoding method further comprises: determining whether the first search offset and / or the second search offset is within a sub-pixel search range of the initial motion vector; obtaining a sub-pixel offset of the second search offset through an error surface model if yes; and taking the offset of the second search offset offset by the sub-pixel offset as a final search offset of the second search stage.

11. The image decoding method of claim 1, wherein the second search offset is a luma search offset; and the image decoding method further comprises: obtaining a ratio of a chroma offset to a luma offset based on a color format of the to-be-decoded block; obtaining a chroma search offset based on the ratio and the luma search offset; and decoding the to-be-decoded block based on the prediction value of the luma search offset and the prediction value of the chroma search offset.

12. The image decoding method of claim 11, wherein the color format of the to-be-decoded block comprises a YUV format. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ The color difference search offset is obtained based on the ratio and the luminance search offset, and the color difference search offset comprises: The color difference search candidate offset is obtained based on the ratio and the luminance search offset; The color difference search offset is obtained based on the color difference search candidate offset in response to the color difference search candidate offset being less than a color difference maximum offset; The color difference search offset is obtained based on the color difference maximum offset in response to the color difference search candidate offset being greater than or equal to the color difference maximum offset.

13. The image decoding method of claim 1, wherein the image decoding method further comprises: The target search offset is stored.

14. The image decoding method of claim 1, wherein the image decoding method further comprises: A multi-stage motion vector refinement switch syntax is obtained; A multi-stage motion vector refinement scheme syntax is obtained in response to a value of the multi-stage motion vector refinement switch syntax indicating that a multi-stage motion vector refinement scheme is enabled; A motion vector refinement scheme is obtained based on a value of the multi-stage motion vector refinement scheme syntax. The image encoding method comprises: An initial motion vector of a to-be-encoded block is obtained, wherein the initial motion vector is a forward motion vector and a backward motion vector; 15. An image coding method characterized by, A plurality of first candidate offsets are obtained based on the initial motion vector at a first preset position in response to a first search stage; A first decoding difference of each first candidate offset is obtained; A first search offset of the first search stage is determined based on a minimum value of the first decoding differences; A plurality of second candidate offsets are obtained based on the first search offset at a second preset position in response to a second search stage; A second decoding difference of each second candidate offset is obtained; A second search offset of the second search stage is determined based on a minimum value of the second decoding differences; A target search offset is obtained based on the first search offset and the second search offset, and the to-be-encoded block is encoded using a prediction value of the target search offset. The image decoding apparatus comprises a memory and a processor coupled to the memory; 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 14.

16. An image decoding apparatus characterized by comprising: The image encoding apparatus comprises a memory and a processor coupled to the memory; 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 15.

17. An image coding apparatus characterized by 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 14 and / or the image encoding method according to claim 15. ​ 18. A computer storage medium, characterized in that, ​