Decoding method, coding method, electronic equipment and computer readable storage medium
By obtaining the motion vector adjustment starting point and adjustment scheme of the current block in the video frame, the target motion vector is determined, which solves the problem of insufficient bitstream compression performance in the existing technology and achieves the effect of reducing transmission overhead and improving encoding and decoding efficiency.
Patent Information
- Application Number
- CN202411062501.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2026-02-10
AI Technical Summary
The current technology has insufficient bitstream compression performance in the video encoding and decoding process, resulting in high transmission overhead.
By obtaining the motion vector adjustment starting point and adjustment scheme of the current block in the video frame, the target motion vector is determined based on the motion vector prediction value. The current block is then decoded using the target motion vector, reducing the amount of data transmitted and improving the compression performance of the bitstream.
It reduces resource consumption and transmission overhead in the encoding and decoding process, and improves the compression performance of the bitstream.
Smart Images

Figure CN121509675A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of video coding, in particular to a decoding method, an encoding method, an electronic device and a computer readable storage medium. BACKGROUND
[0002] Video image data is relatively large, and usually needs to be compressed. The compressed data is called a code stream. In the coding process, the video frame is usually predicted to reduce the redundant data between the video frames, and then the code stream is obtained by re-encoding. However, in the prior art, the compression performance in the coding process still has defects, and the transmission overhead is high. Therefore, how to improve the compression performance of the code stream and reduce the transmission overhead has become a problem to be solved. SUMMARY
[0003] The technical problem solved by the present application is to provide a decoding method, an encoding method, an electronic device and a computer readable storage medium, which can improve the compression performance of the code stream and reduce the transmission overhead.
[0004] To solve the above technical problem, the first aspect of the present application provides a decoding method, comprising: obtaining a motion vector adjustment starting point of a current block in a video frame; wherein the motion vector adjustment starting point corresponds to a motion vector prediction value of the current block; obtaining a motion vector adjustment scheme of the current block, determining motion vector adjustment values of all stages based on the motion vector adjustment scheme; wherein the motion vector adjustment scheme comprises an acquisition manner of the motion vector adjustment values of at least part of the stages; determining a target motion vector of the current block based on the motion vector adjustment starting point and the motion vector adjustment values of all stages, and decoding the current block to obtain a decoded block using the target motion vector.
[0005] To solve the above technical problem, the second aspect of the present application provides an encoding method, comprising: obtaining a motion vector adjustment starting point of a current block in a video frame; wherein the motion vector adjustment starting point corresponds to a motion vector prediction value of the current block; obtaining motion vector adjustment values of all stages and an acquisition manner of at least part of the motion vector adjustment values from the motion vector adjustment starting point, determining a motion vector adjustment scheme of the current block based on the motion vector adjustment values of all stages and the acquisition manner of at least part of the motion vector adjustment values; and generating a code stream corresponding to the current block based on the current block, the motion vector adjustment starting point corresponding to the current block and the motion vector adjustment scheme.
[0006] To address the aforementioned technical problems, a third aspect of this application provides an electronic device comprising: a memory and a processor coupled to each other, wherein the memory stores program data, and the processor invokes the program data to execute the method described in the first or second aspect.
[0007] To address the aforementioned technical problems, a fourth aspect of this application provides a computer-readable storage medium storing program data thereon, wherein the program data, when executed by a processor, implements the method described in the first or second aspect.
[0008] The above scheme obtains the motion vector prediction value of the current block in the video frame, determines the motion vector adjustment starting point corresponding to the motion vector prediction value, obtains the motion vector adjustment scheme for the current block, and determines the motion vector adjustment value corresponding to each stage based on the motion vector adjustment scheme. Among them, the motion vector adjustment values of at least some stages are obtained based on the method of obtaining the motion vector adjustment values. Therefore, during transmission, only the method of obtaining the motion vector adjustment values of the corresponding stages needs to be transmitted, thereby reducing the amount of data to be transmitted, improving the compression performance of the bitstream, reducing the resources consumed during bitstream transmission, and reducing transmission overhead. Based on the motion vector adjustment values of all stages, adjustment is performed starting from the motion vector adjustment starting point to obtain the target motion vector of the current block. The target motion vector is used to predict the current block, thereby decoding the current block to obtain the decoded block, reducing the overhead of the encoding and decoding process. Attached Figure Description
[0009] 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 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. Wherein:
[0010] Figure 1 This is a flowchart illustrating one embodiment of the decoding method of this application;
[0011] Figure 2 This is a flowchart illustrating another embodiment of the decoding method of this application;
[0012] Figure 3 This is a schematic diagram of an application scenario corresponding to an embodiment of the template of the current block or reference block of this application;
[0013] Figure 4 This is a schematic diagram of an application scenario corresponding to a partial reference range of this application;
[0014] Figure 5 This is a schematic diagram illustrating an application scenario of one embodiment of the square predetermined position search in this application;
[0015] Figure 6 This is a schematic diagram illustrating an application scenario of one embodiment of the hexagonal predetermined position search in this application;
[0016] Figure 7 This is a flowchart illustrating one embodiment of the coding method of this application;
[0017] Figure 8 This is a schematic diagram of the structure of one embodiment of the electronic device of this application;
[0018] Figure 9 This is a schematic diagram of one embodiment of the computer-readable storage medium of this application. Detailed Implementation
[0019] 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 some embodiments of this application, not all embodiments, and different implementation methods can be adaptively combined. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0020] In this paper, the terms "system" and "network" are often used interchangeably. The term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this paper means two or more.
[0021] The decoding and encoding methods provided in this application are used for encoding and decoding video frames, and the corresponding execution subject is a terminal capable of processing video image data.
[0022] Please see Figure 1 , Figure 1 This is a flowchart illustrating one embodiment of the decoding method of this application, which includes:
[0023] S101: Obtain the motion vector adjustment starting point of the current block in the video frame; wherein, the motion vector adjustment starting point corresponds to the motion vector prediction value of the current block.
[0024] Specifically, the motion vector prediction (MVP) value of the current block in the video frame is obtained, and the starting point for motion vector adjustment corresponding to the motion vector prediction value is determined.
[0025] In some implementation scenarios, the motion vector prediction value of the current block in the video frame is obtained based on inter-frame prediction, and the position indicated by the motion vector prediction value is used as the starting point for motion vector adjustment.
[0026] In some implementation scenarios, the motion vector prediction value of the current block in the video frame is obtained based on intra-frame prediction, and the position indicated by the motion vector prediction value is used as the starting point for motion vector adjustment.
[0027] In some implementation scenarios, a motion vector prediction candidate list corresponding to the current block is obtained. The motion vector prediction candidate list has a preset construction rule. The prediction value with the lowest cost is obtained from the motion vector prediction candidate list and used as the motion vector prediction value of the current block. The position indicated by the motion vector prediction value is used as the starting point for motion vector adjustment.
[0028] S102: Obtain the motion vector adjustment scheme for the current block, and determine the motion vector adjustment values for all stages based on the motion vector adjustment scheme; wherein, the motion vector adjustment scheme includes the method of obtaining the motion vector adjustment values for at least some stages.
[0029] Specifically, the motion vector adjustment scheme for the current block is obtained, and based on the motion vector adjustment scheme, the motion vector adjustment value corresponding to each stage is determined. Among these, the motion vector adjustment values for at least some stages are obtained based on the method of obtaining the motion vector adjustment values.
[0030] Understandably, in the prior art, the direct transmission of motion vector adjustment values is transmitted through encoding, which consumes a large number of bits and is not conducive to improving compression efficiency. In the transmission process, this application only needs to transmit the acquisition method of the motion vector adjustment values at the corresponding stage, thereby reducing the amount of data to be transmitted, improving the compression performance of the bitstream, reducing the resources consumed during bitstream transmission, and reducing transmission overhead.
[0031] In some implementation scenarios, the motion vector adjustment scheme of the current block includes a stage, and the motion vector adjustment scheme includes a method for obtaining the motion vector adjustment value of the corresponding stage. Based on the method for obtaining the corresponding stage, the motion vector adjustment value of the corresponding stage is obtained. In this way, the transmission overhead is reduced and the encoding and decoding efficiency is improved by transmitting the motion vector adjustment value in a stage without direct transmission.
[0032] In some implementation scenarios, the motion vector adjustment scheme of the current block includes multiple stages, and the motion vector adjustment scheme includes the acquisition method of motion vector adjustment values for all stages. Based on the acquisition method of each stage, the motion vector adjustment value of each stage is acquired in stages, thereby improving the accuracy of encoding and decoding and reducing transmission overhead by transmitting motion vector adjustment values indirectly through multiple stages.
[0033] In some implementation scenarios, the motion vector adjustment scheme of the current block includes multiple stages, and the motion vector adjustment scheme includes the acquisition method of motion vector adjustment values of other stages before the final stage. The motion vector adjustment value of the final stage is directly transmitted. Based on the acquisition method of each stage before the final stage, the motion vector adjustment value of each stage is acquired in stages, and the motion vector adjustment value of the final stage is decoded. In this way, by transmitting the motion vector adjustment value in at least some stages in a way that is not directly transmitted, the amount of data of motion vector adjustment value directly transmitted in the final stage is reduced, thus balancing coding efficiency and coding accuracy.
[0034] S103: Based on the motion vector adjustment starting point and the motion vector adjustment values of all stages, determine the target motion vector of the current block, and use the target motion vector to decode the current block to obtain the decoded block.
[0035] Specifically, based on the motion vector adjustment values of all stages, adjustments are made starting from the motion vector adjustment starting point to obtain the target motion vector of the current block. The target motion vector is then used to predict the current block, thereby decoding the current block and reducing the overhead of the encoding and decoding process.
[0036] In some implementation scenarios, the starting point of the computational vector adjustment corresponding to the predicted motion vector value is used as the initial position. Adjustments are made in stages based on the motion vector adjustment values obtained at each stage until the termination position is reached. The target motion vector of the current block is then determined, and the current block is predicted using this target motion vector. Decoding then yields the decoded block for the current block. When the motion vector adjustment scheme includes multiple stages, the position indicated by the motion vector adjustment value of the previous stage is used as the starting point for the motion vector adjustment of the next stage.
[0037] In some implementation scenarios, the starting point of the operation vector adjustment corresponding to the motion vector prediction value is taken as the starting position. The total adjustment value is determined based on the motion vector adjustment values of all stages. The ending position is obtained based on the starting position and the total adjustment value. The target motion vector of the current block is determined. The target motion vector is used to predict the current block and decode it to obtain the decoded block of the current block.
[0038] The above scheme obtains the motion vector prediction value of the current block in the video frame, determines the motion vector adjustment starting point corresponding to the motion vector prediction value, obtains the motion vector adjustment scheme for the current block, and determines the motion vector adjustment value corresponding to each stage based on the motion vector adjustment scheme. Among them, the motion vector adjustment values of at least some stages are obtained based on the method of obtaining the motion vector adjustment values. Therefore, during transmission, only the method of obtaining the motion vector adjustment values of the corresponding stages needs to be transmitted, thereby reducing the amount of data to be transmitted, improving the compression performance of the bitstream, reducing the resources consumed during bitstream transmission, and reducing transmission overhead. Based on the motion vector adjustment values of all stages, adjustment is performed starting from the motion vector adjustment starting point to obtain the target motion vector of the current block. The target motion vector is used to predict the current block, thereby decoding the current block to obtain the decoded block, reducing the overhead of the encoding and decoding process.
[0039] Please see Figure 2 , Figure 2 This is a flowchart illustrating another embodiment of the decoding method of this application, the method comprising:
[0040] S201: Obtain the motion vector adjustment starting point of the current block in the video frame; wherein, the motion vector adjustment starting point corresponds to the motion vector prediction value of the current block.
[0041] Specifically, the adjustment start point syntax of the current block in the bitstream is interpreted. Based on the value of the adjustment start point syntax, the motion vector prediction candidate list corresponding to the current block is obtained, and the motion vector prediction value of the current block is obtained from the motion vector prediction candidate list. Based on the motion vector prediction value of the current block, the motion vector adjustment start point is determined.
[0042] Understandably, the bitstream obtained during the encoding stage contains an adjustment start point syntax that indicates how to obtain the motion vector adjustment start point. The adjustment start point syntax of the current block in the bitstream is interpreted to obtain the value of the adjustment start point syntax. Based on the value of the adjustment start point syntax, it is determined how to construct the motion vector prediction candidate list corresponding to the current block. Based on the value of the adjustment start point syntax, it is determined how to obtain the corresponding prediction value from the motion vector prediction candidate list as the motion vector prediction value of the current block. Thus, through syntax transmission and parsing, the motion vector prediction candidate list is accurately constructed and the motion vector prediction value of the current block is obtained from it.
[0043] Furthermore, the position indicated by the predicted motion vector value of the current block is obtained, and the position indicated by the predicted motion vector value is used as the starting point for motion vector adjustment.
[0044] In some implementation scenarios, the adjustment starting point syntax includes list construction syntax and candidate index syntax. Based on the value of the adjustment starting point syntax, a motion vector prediction candidate list corresponding to the current block is obtained, and the motion vector prediction value of the current block is obtained from the motion vector prediction candidate list. This includes: obtaining the motion vector prediction candidate list corresponding to the current block based on the value of the list construction syntax, and rearranging and / or refining the prediction values in the motion vector prediction candidate list; and obtaining the motion vector prediction value of the current block from the processed motion vector prediction candidate list based on the value of the candidate index syntax.
[0045] Specifically, the values of the list construction syntax are obtained to determine how to construct the motion vector prediction candidate list, thereby obtaining the motion vector prediction candidate list corresponding to the current block. The motion vector prediction candidate list can be constructed based on existing technologies or independently based on preset construction rules; this application does not impose specific restrictions on this.
[0046] Furthermore, the predicted values in the motion vector prediction candidate list are rearranged and / or their precision is adjusted to modify the list according to rules, thus avoiding the impact of changes in the order of predicted values during the encoding and decoding stages. Specifically, when candidate predicted values exist, they can be rearranged in a certain way, including but not limited to template-based and distance-based candidate rearrangement.
[0047] Understandably, the value of the candidate index syntax is obtained to determine the position of the current block's motion vector prediction value in the motion vector prediction candidate list, thereby obtaining the current block's motion vector prediction value.
[0048] It should be noted that template-based candidate reordering involves using the neighboring pixels of the current block as the current template and the neighboring pixels of the reference block pointed to by the candidate value as the reference template. The cost between the current template and the reference template is obtained (including but not limited to absolute residual and SAD, absolute transform and SATD, mean squared error MSE, etc.), and the candidate values are sorted based on the cost of each candidate value. Distance-based candidate reordering involves calculating the distance between the reference block position and the current block position, and sorting the candidate values based on the distance of each candidate value. The reordered candidate list may retain only a preset number of candidate values.
[0049] Optionally, please refer to Figure 3 , Figure 3 This is a schematic diagram illustrating an application scenario corresponding to an implementation of the template of the current block or reference block of this application, such as... Figure 3As shown, the adjacent pixel region of the template includes, but is not limited to, regions with only left adjacent pixels, only top adjacent pixels, left and top adjacent pixels, left and top adjacent pixels, and top-left adjacent pixels. When the template selection is the default selection, no syntax transmission is required. When the template includes multiple options, the bitstream includes template selection syntax to indicate which template to use at the decoding end.
[0050] Furthermore, the precision processing methods include, but are not limited to, fixed precision and multiple precision. Fixed precision means processing the candidate value to a preset precision. Multiple precision means providing a set of multiple precisions and selecting the appropriate precision from among them.
[0051] Understandably, rearrangement and precision processing can be performed individually or both, and the encoding and decoding stages should be consistent.
[0052] Optionally, when there are multiple candidate values, the candidate values can be deduplicated. That is, in order of appearance, if a later candidate value is the same as a previous candidate value, the later candidate value is removed.
[0053] To facilitate understanding and explanation, this application provides some specific embodiments based on the solutions in the above implementation scenarios to illustrate how to construct a candidate list for motion vector prediction, but this application does not impose specific restrictions on the specific combination methods.
[0054] Example 1: A motion vector prediction candidate list is constructed based on the motion vector prediction derivation method of adjacent blocks or the motion vector prediction derivation method based on history. The motion vector prediction candidate list includes only one candidate value, and the candidate value is adjusted to integer pixel precision.
[0055] Example 2: The motion vector prediction candidate list is constructed as shown in Table 1. For P-frames, the order is 1 temporal candidate, 1 spatial candidate, and validNum motion vector angle prediction (MVAP) candidates (validNum is the number of valid MVAP modes). The remaining positions are filled with history-based motion vector prediction (HMVP) candidates. The process is similar for B-frames. NumOfMvapCand is the maximum number of motion vector angle prediction (MVAP) candidates, and NumOfHmvpCand is the maximum number of HMVP candidates allowed in the Sequence Parameter Set (SPS).
[0056] Additionally, if the merge candidate list is still not complete after all candidates have been added, it will be filled using the last HMVP candidate or the last empty space candidate (when the current HMVP is closed).
[0057] Table 1: Candidate List for Motion Vector Prediction
[0058]
[0059] Furthermore, the adjacent reconstructed pixels in a 4x4 grid around the current block are used as the current template, and the adjacent reconstructed pixels in a 4x4 grid around the reference block are used as the reference template, that is... Figure 3 The third template form obtains the cost between the current template and the reference template, sorts the candidate values based on the cost of each candidate value, and retains only the first 4 candidate values in the motion vector candidate prediction list. Then, the candidate values are adjusted to integer pixel precision and the obtained candidate values are deduplicated.
[0060] Understandably, if multiple candidates remain after these steps, the encoder can select the best candidate by comparing costs, and the decoder can determine the best candidate by syntax.
[0061] Optionally, rearrangement and precision processing can be set as default operations, in which case no syntax transmission is required. When rearrangement and precision processing are not set as default operations, rearrangement template syntax and precision processing syntax can be generated at the encoding end. The rearrangement template syntax indicates which template is used when rearranging candidate values. The precision processing syntax indicates which precision is used when processing candidate values in a multi-precision manner.
[0062] S202: Decipher the adjustment scheme syntax of the current block in the bitstream and obtain the stage syntax of the motion vector adjustment scheme of the current block at each stage.
[0063] Specifically, the adjustment scheme syntax of the current block in the bitstream is interpreted to determine the stage syntax corresponding to the motion vector adjustment scheme of the current block in each stage. The stage syntax corresponding to each stage is used to instruct the decoder to obtain the motion vector adjustment value of the corresponding stage.
[0064] It should be noted that each stage with a matching acquisition method corresponds to a motion vector adjustment candidate set. The motion vector adjustment scheme includes at least one stage. The acquisition method for the first stage of the motion vector adjustment scheme, as well as other stages between the first and last stages, is as follows: the motion vector adjustment value is obtained by searching the motion vector adjustment candidate set for the corresponding stage. When the motion vector adjustment scheme includes multiple stages, the acquisition method for the last stage is as follows: the motion vector adjustment value is obtained by searching the motion vector adjustment candidate set for the corresponding stage, or the motion vector adjustment value corresponding to the last stage is directly transmitted. The motion vector adjustment value corresponding to the last stage is obtained based on the motion vector adjustment values before the last stage.
[0065] It is understandable that the motion vector adjustment scheme has a predetermined number of stages. Both the encoding and decoding processes follow the rules of the motion vector adjustment scheme. In different implementation scenarios, the motion vector adjustment scheme includes at least one stage. The first stage of the motion vector adjustment scheme and the other stages between the first and last stages are all indirect transmission methods. That is, the motion vector adjustment value is obtained by searching the motion vector adjustment candidate set of the corresponding stage, thereby reducing transmission overhead. Therefore, when the motion vector adjustment scheme has only one stage, it must be an indirect transmission method.
[0066] Furthermore, in different implementation scenarios, the final stage corresponds to two optional transmission methods: either indirect transmission or direct transmission. The motion vector adjustment value for the final stage is obtained based on the motion vector adjustment values prior to the final stage. Directly transmitting the motion vector adjustment value of the final stage involves significantly less data than directly transmitting the motion vector adjustment values from all stages.
[0067] S203: For each stage, determine the motion vector adjustment value for the current stage based on the stage syntax of the current stage.
[0068] Specifically, for each stage, the stage syntax of the current stage is obtained. Based on the stage syntax, the motion vector adjustment value of the current stage is obtained according to the transmission method indicated by the stage syntax. Thus, based on the stages included in the motion vector adjustment scheme, the motion vector adjustment value of each stage is obtained stage by stage based on the stage syntax, ensuring the accuracy of the motion vector adjustment value of each stage.
[0069] It should be noted that the acquisition method in different implementation scenarios may include at least one of template cost search, index number search, and local range search.
[0070] Optionally, the predetermined search positions include, but are not limited to, linear predetermined positions, hexagonal predetermined positions, square predetermined positions, and full predetermined positions. A linear predetermined position corresponds to several positions along a predetermined direction starting from the starting point; a hexagonal predetermined position corresponds to several positions forming a hexagon around the starting point; a square predetermined position corresponds to several positions forming a square around the starting point; and a full predetermined position corresponds to using the entire set of motion vector adjustment candidates as the predetermined search positions. The predetermined positions may or may not include the starting point position.
[0071] In some implementation scenarios, the acquisition method includes template cost search and determining the motion vector adjustment value of the current stage based on the stage syntax of the current stage. This includes: in response to determining that the current stage is template cost search based on the stage syntax of the current stage, obtaining a motion vector adjustment candidate set for the current stage; wherein, multiple adjustment values in the motion vector adjustment candidate set correspond to preset distances and preset directions; and determining the motion vector adjustment value of the current stage based on the template cost between the current template corresponding to the current block and the reference template of the reference block to which the adjustment value points.
[0072] Specifically, when the current stage is determined to be template cost-based search based on the stage syntax of the current stage, a motion vector adjustment candidate set for the current stage is obtained. Each adjustment value in the motion vector adjustment candidate set corresponds to a preset distance and a preset direction. In other words, the adjustment values in the motion vector adjustment candidate set are limited to preset directions, and the corresponding preset distance is taken from the preset direction.
[0073] Optionally, the preset distance includes 8 pixels: {1 / 4, 1 / 2, 1, 2, 4, 8, 16, 32}, and the preset direction includes 8 directions: {horizontal left, diagonally up, vertically up, anti-diagonally up, horizontal right, diagonally down, vertically down, anti-diagonally down}. The values of the preset distance and preset direction can be customized in different implementation scenarios, and this application does not impose specific restrictions on them.
[0074] Furthermore, based on the template cost between the current template corresponding to the current block and the reference template of the reference block to which the adjustment value points, an adjustment value whose template cost meets preset conditions is selected as the motion vector adjustment value for the current stage. Here, the current template corresponds to the adjacent reconstructed pixels corresponding to the current block, and the reference target corresponds to the adjacent reconstructed pixels corresponding to the reference block.
[0075] It is understandable that the data size of the current template is smaller than that of the current block, the data size of the reference template is smaller than that of the reference block, and the corresponding template can be directly obtained at the decoding end without syntactic transmission. By comparing template costs, the complexity of adjusting value search and the resources consumed during the search can be effectively reduced.
[0076] Optionally, determining the motion vector adjustment value for the current stage based on the template cost between the current template corresponding to the current block and the reference template of the reference block to which the adjustment value points includes: taking the position pointed to by the motion vector adjustment value of the current stage as the starting point, searching for adjustment values in a preset direction in the motion vector adjustment candidate set; determining the search direction based on the template cost between the current template and the reference template of the reference block to which the adjustment value points in the preset direction; searching for adjustment values within a preset distance in the search direction; and determining the motion vector adjustment value for the current stage based on the template cost between the current template and the reference template of the reference block to which the adjustment value points in the preset distance.
[0077] Specifically, the position pointed to by the current motion vector adjustment value is taken as the starting point. With the starting point as the center, the adjustment value in the preset direction is searched in the motion vector adjustment candidate set. Based on the template cost between the current template and the reference template of the reference block pointed to by the adjustment value in the preset direction, the search direction with the lowest template cost is determined, so as to select the optimal search direction first.
[0078] Furthermore, the adjustment value within a preset distance is searched in the search direction. Based on the template cost between the current template and the reference template of the reference block pointed to by the adjustment value corresponding to the preset distance, the preset distance with the lowest template cost is determined, thereby obtaining the motion vector adjustment value of the current stage with higher accuracy.
[0079] In some implementation scenarios, the acquisition method includes searching based on index numbers and determining the motion vector adjustment value for the current stage based on the stage syntax of the current stage. This includes: in response to determining that the current stage is a search based on index numbers according to the stage syntax of the current stage, obtaining a set of motion vector adjustment candidates for the current stage; wherein, multiple adjustment values in the motion vector adjustment candidate set correspond to preset distances and preset directions, each preset distance corresponds to a distance index, and each preset direction corresponds to a direction index; based on the stage syntax of the current stage, determining the selection distance corresponding to the preset distance and the selection direction corresponding to the preset direction, and determining the motion vector adjustment value for the current stage based on the selection distance and selection direction.
[0080] Specifically, when the current stage is determined to be a search based on index number based on the stage syntax of the current stage, the motion vector adjustment candidate set of the current stage is obtained. Among them, multiple adjustment values in the motion vector adjustment candidate set correspond to their own preset distance and preset direction, and each preset distance corresponds to a distance index and each preset direction corresponds to a direction index. That is to say, a unique adjustment value in the motion vector adjustment candidate set can be locked based on a single distance index and a single direction index.
[0081] Optionally, the preset distances include 8 pixel distances: {1 / 4, 1 / 2, 1, 2, 4, 8, 16, 32}, and the preset directions include 8 directions: {horizontal left, diagonally up, vertically up, anti-diagonally up, horizontal right, diagonally down, vertically down, anti-diagonally down}. The distance indices are shown in Table 2, and the direction indices are shown in Table 3.
[0082] Table 2: Distance Index Lookup Table
[0083] Distance index 0 1 2 3 4 5 6 7 Pre-set distance 1 / 4 1 / 2 1 2 4 8 16 32
[0084] Table 3: Direction Index Reference Table
[0085]
[0086]
[0087] Furthermore, based on the stage syntax of the current stage, the selection distance corresponding to the preset distance and the selection direction corresponding to the preset direction of the current stage are determined. Then, the adjustment value in the motion vector adjustment candidate set is locked based on the selection distance and selection direction to obtain the motion vector adjustment value of the current stage. Thus, the accuracy of the motion vector adjustment value is ensured through index information.
[0088] Optionally, the stage syntax also includes distance index syntax and direction index syntax. Based on the stage syntax of the current stage, the selection distance corresponding to the preset distance and the selection direction corresponding to the preset direction are determined. Based on the selection distance and selection direction, the motion vector adjustment value of the current stage is determined, including: determining the selection distance of the motion vector adjustment value of the current stage based on the value of the distance index syntax, determining the selection direction of the motion vector adjustment value of the current stage based on the value of the direction index syntax, obtaining the adjustment value indicated by the selection distance and selection direction from the motion vector adjustment candidate set, and determining the motion vector adjustment value of the current stage.
[0089] Specifically, the distance index syntax is used to express the specific distance when numbering motion vector adjustment candidates by distance, and the scheme index syntax is used to express the specific direction when numbering motion vector adjustment candidates by direction. Based on the value of the distance index syntax, the selection distance of the motion vector adjustment value at the current stage is determined, and based on the value of the direction index syntax, the selection direction of the motion vector adjustment value at the current stage is determined. Thus, the selection distance is determined by the transmission of the distance index syntax, and the selection direction is determined by the transmission of the direction index syntax, so as to obtain accurate index information at the decoding end. Based on the selection distance and selection direction, the adjustment value in the motion vector adjustment candidate set is locked, and the motion vector adjustment value at the current stage is obtained.
[0090] In some implementation scenarios, the acquisition method includes determining the motion vector adjustment value of the current stage based on local range search and the stage syntax of the current stage. This includes: in response to determining that the current stage is based on local range search according to the stage syntax of the current stage, determining the prediction region based on the position pointed to by the motion vector adjustment value of the current stage, and obtaining the motion compensation region corresponding to the prediction region; wherein, the motion compensation region includes the prediction region and other regions that at least partially surround the prediction region; and determining the motion vector adjustment value of the current stage based on the template cost between the current template corresponding to the current block and the reference template of the reference block pointed to by the adjustment value in the motion compensation region.
[0091] Specifically, when the current stage is determined to be a local range search based on the stage syntax of the current stage, the prediction region including the position pointed to by the motion vector adjustment value of the current stage is determined based on the position pointed to by the motion vector adjustment value of the current stage. That is, the position pointed to by the motion vector adjustment value of the current stage is located within the prediction region, and the motion compensation region corresponding to the prediction region is obtained. The motion compensation region includes the prediction region and other regions that at least partially surround the prediction region.
[0092] Furthermore, based on the template cost between the current template corresponding to the current block and the reference template of the reference block pointed to by the adjustment value within the motion compensation region, the adjustment value with the minimum template cost within the motion compensation region is determined, thus obtaining the motion vector adjustment value for the current stage. The motion compensation region corresponds to a wider search range, thereby improving the accuracy of the adjustment value search. Moreover, during cost comparison, the decoding end can directly obtain the corresponding template without syntactic transmission. Template cost comparison effectively reduces the complexity of the adjustment value search and the resources consumed during the search.
[0093] Optionally, please refer to Figure 4 , Figure 4 This is a schematic diagram of an application scenario corresponding to a local reference range of this application, where the candidate set is adjusted based on the motion vector of the local reference range, such as... Figure 4The predicted region shown is the area where the reference block pointed to by the motion vector adjustment value is located (assuming a size of 16*16). The motion compensation region is the area that includes the predicted region and a part of the extra region (used for pixel interpolation, assumed to be a top height and left width of 3, and a right width and bottom height of 5).
[0094] Specifically, to limit the bandwidth increase caused by the local reference range, padding is used when the reference block pointed to by the motion vector adjustment value exceeds the motion compensation area (i.e., pixels at the range boundary are used as pixels outside the range). Figure 4 The filled area is shown schematically in the diagram.
[0095] Optionally, determining the motion vector adjustment value for the current stage based on the template cost between the current template corresponding to the current block and the reference template of the reference block pointed to by the adjustment value in the motion compensation region includes: taking a specified position in the prediction region as the starting point, searching for the adjustment value at a first predetermined position in the motion compensation region in multiple rounds; determining a candidate position based on the template cost between the current template and the reference template of the reference block pointed to by the adjustment value at the first predetermined position; searching for the adjustment value at a second predetermined position at the candidate position; and determining the motion vector adjustment value for the current stage based on the template cost between the current template and the reference template of the reference block pointed to by the adjustment value at the second predetermined position.
[0096] Specifically, taking a designated location in the prediction region as the starting point, the adjustment value at the first predetermined location is searched multiple times within the motion compensation region. Based on the template cost between the current template and the reference template of the reference block pointed to by the adjustment value at the first predetermined location, the location with the lowest cost is determined, thus obtaining candidate locations to improve the accuracy of candidate location selection. Then, the adjustment value at the second predetermined location is searched at subsequent locations. Based on the template cost between the reference template of the reference block pointed to by the current template and the adjustment value at the second predetermined location, the location with the lowest cost is determined, thus obtaining the motion vector adjustment value at the current stage. This process improves the accuracy of the motion vector adjustment value through multiple rounds of searching at different predetermined locations.
[0097] In some implementation scenarios, when the final stage corresponds to searching for motion vector adjustment values from the motion vector adjustment candidate set according to the acquisition method, the motion vector adjustment value of the current stage is determined based on the stage syntax of the current stage, including: obtaining the encoded adjustment value from the bitstream based on the stage syntax of the current stage, and determining the motion vector adjustment value of the current stage.
[0098] Specifically, based on the current stage's stage syntax region, the motion vector adjustment value for the final stage is determined and directly transmitted. The encoded adjustment value is obtained from the bitstream and decoded to obtain the motion vector adjustment value for the current stage. Thus, the motion vector adjustment value for the final stage can be directly obtained through direct transmission and decoding, improving the efficiency of obtaining the motion vector adjustment value for the final stage without significantly increasing transmission overhead.
[0099] It is understood that any of the above implementation scenarios can be freely combined. For ease of understanding and explanation, this application provides some specific embodiments based on the solutions in the above implementation scenarios to illustrate how to obtain motion vector adjustment values, but this application does not impose specific restrictions on the specific combination methods.
[0100] Example 3: The motion vector adjustment scheme corresponds to a stage. The motion vector adjustment candidate set is based on a predetermined position. The preset distance includes a total of 8 pixel distances: {1 / 4, 1 / 2, 1, 2, 4, 8, 16, 32}. The preset direction includes a total of 8 directions: {horizontal left, diagonal up, vertical up, anti-diagonal up, horizontal right, diagonal down, vertical down, anti-diagonal down}.
[0101] Further, please refer to Figure 5 , Figure 5 This is a schematic diagram illustrating an application scenario of one embodiment of the square predetermined position search in this application. Based on a template, motion vector adjustment candidates are determined. The current template is the four rows and four columns of adjacent reconstructed pixels surrounding the current block, and the reference template is the four rows and four columns of adjacent reconstructed pixels surrounding the reference position pointed to by the motion vector adjustment candidate. The template cost between the two is calculated. During the search, a square search is performed first, such as... Figure 5 As shown, the rhombus point is the preset position, the pentagram is the starting point, the search distance is 1 pixel, and the preset position does not include the search starting point. Then, a straight line search is performed (the direction of the preset position with the lowest cost in the square search is taken as the direction of the straight line search, assuming the direction is horizontal to the right). The preset distance is searched along the search direction (since the template cost of 1 pixel distance has been calculated in the square search, the template cost can be directly obtained here). The preset distance with the lowest cost is determined (assuming that the cost of 16 pixels in the preset distance is the lowest in the horizontal to the right direction, the motion vector adjustment candidate of the horizontal to the right 16 pixels distance is used as the final motion vector adjustment value).
[0102] Optionally, to reduce complexity, when the current block is bidirectionally predicted, only the motion vector adjustment for the forward or backward prediction is determined, and then the motion vector adjustment for the backward or forward prediction is determined based on the display order difference. For example, after determining the motion vector adjustment based on the forward reference frame, the motion vector adjustment for the backward reference frame is determined based on the display order difference between the forward and backward reference frames and the current frame. This can be expressed as mvaS = dPocS * mvaP / dPocP, where mvaS is the motion vector adjustment value of the backward reference frame, dPocS is the display order difference between the backward reference frame and the current frame, dPocP is the display order difference between the backward reference frame and the current frame, and mvaP is the motion vector adjustment value determined by the forward reference frame.
[0103] Example 4: The motion vector adjustment scheme corresponds to two stages. Stage 1 of Example 4 is the same as Stage 1 in Example 3, and will not be described again in this application. Stage 2: The motion vector adjustment value of the final stage is obtained by direct transmission. Specifically, at the encoding end, the motion vector adjustment value of the final stage can be obtained through motion search technology, and then the relevant syntax is encoded in the bitstream; at the decoding end, the motion vector adjustment value is obtained by decoding the corresponding syntax from the bitstream.
[0104] Example 5: The motion vector adjustment scheme corresponds to two stages. Stage 1: Motion vector adjustment candidate set: Based on a predetermined position, the motion vector adjustment candidate set includes a preset distance of 8 pixels: {1 / 4, 1 / 2, 1, 2, 4, 8, 16, 32}, and a preset direction of 8 directions: {horizontal left, diagonally upward, vertically upward, anti-diagonally upward, horizontal right, diagonally downward, vertically downward, anti-diagonally downward}. The distance and direction indices can be further referred to in Tables 2 and 3. At the encoding end, rate-distortion optimization technology is used to select the optimal motion vector adjustment distance and direction from these candidates, thereby determining the motion vector adjustment candidates. The determined motion vector adjustment candidates are then transmitted to the decoding end via syntax. At the decoding end, the motion vector adjustment candidates are determined syntactically. Stage 2: Obtain the motion vector adjustment value for the final stage using a direct transmission method.
[0105] Example 6: The motion vector adjustment scheme corresponds to two stages. Stage 1 of Example 6 is the same as Stage 1 in Example 5, and will not be repeated here. Stage 2: Based on the motion vector adjustment candidate set of the local reference range, such as... Figure 4The predicted region is the area where the motion vector adjustment value points to the reference block (assuming a size of 16*16). The motion compensation region includes the predicted region and a portion of additional region (used for pixel interpolation, assumed to have a top height and left width of 3, and a right width and bottom height of 5). The search range is (3+3)*(3+3), with the top left corner of the predicted region being the starting point for motion vector adjustment. The offset of the predicted region must be within the motion compensation region. The specific determination process involves first performing 30 rounds of hexagonal pre-defined position searches, followed by one square search, with the final search result serving as the motion vector adjustment value.
[0106] It should be noted that you should refer to [link / reference]. Figure 6 , Figure 6 This is a schematic diagram illustrating an application scenario of one embodiment of the hexagonal predetermined position search in this application. The hexagonal search schematic diagram is as follows: Figure 6 As shown (each grid in the image represents a 1-pixel distance), the preset position with the lowest cost is selected from the predetermined positions (including the search starting point) as the search result; it is understood that if the search result is still the search starting point, no further searches will be performed. Furthermore, square search can be viewed again... Figure 5 Unlike other embodiments, this embodiment includes a search starting point.
[0107] Example 7: The motion vector adjustment scheme corresponds to two stages. Stage 1 of Example 7 is the same as Stage 1 of Example 3, and will not be described again in this application. Stage 2 of Example 7 is the same as Stage 2 of Example 6, and will not be described again in this application.
[0108] It is understood that in other specific embodiments, the motion vector adjustment scheme may include more than two schemes, and the final stage may be to search for the motion vector adjustment candidate set of the corresponding stage to obtain the motion vector adjustment value, or to directly transmit the motion vector adjustment value corresponding to the final stage. This application will not elaborate on the combination form of specific embodiments.
[0109] It should be noted that the bitstream includes motion vector adjustment switch syntax. The first value of the motion vector adjustment switch syntax indicates that the step of obtaining the motion vector adjustment start point of the current block in the video frame is allowed during the decoding stage, and the second value of the motion vector adjustment switch syntax indicates that the step of obtaining the motion vector adjustment start point of the current block in the video frame is prohibited during the decoding stage. When the motion vector adjustment switch syntax adopts the first value, the bitstream also includes motion vector adjustment mode syntax. The first value of the motion vector adjustment mode syntax indicates that the step of obtaining the motion vector adjustment start point of the current block in the video frame is entered during the decoding stage, and the second value of the motion vector adjustment mode syntax indicates that the step of obtaining the motion vector adjustment start point of the current block in the video frame is not entered during the decoding stage.
[0110] Specifically, the bitstream is designed with a motion vector adjustment switch syntax indicating whether the use of the technical solution of this application is authorized. The first value of the motion vector adjustment switch syntax is used to indicate that the use of the technical solution of this application is authorized, thereby allowing access to the steps of this application. The second value of the motion vector adjustment switch syntax is used to indicate that the use of the technical solution of this application is not authorized, thereby prohibiting access to the steps of this application.
[0111] Furthermore, when the motion vector adjustment switch syntax in the bitstream adopts the first value, the bitstream also includes motion vector adjustment mode syntax for indicating whether the technical solution of this application is executed. The first value of the motion vector adjustment mode syntax is used to indicate that the technical solution of this application is executed, and the second value of the motion vector adjustment mode syntax is used to indicate that the technical solution of this application is not executed. Thus, the design of the motion vector adjustment switch syntax realizes the authorization of the solution, and the motion vector adjustment mode syntax realizes the switching between using and not using the solution, so as to facilitate the control of the technical solution of this application.
[0112] Optionally, the motion vector adjustment switch syntax can be transmitted in syntax structures including but not limited to video parameter sets (VPS), sequence parameter sets (SPS), picture parameter sets (PPS), picture heads (PH), and coding units.
[0113] Furthermore, the adjustment of the starting point syntax includes, but is not limited to, candidate index syntax, candidate reordering syntax, and precision processing syntax. Specifically, the candidate index syntax indicates that when an independent motion vector prediction candidate list is constructed and there are more than one candidate in the list, it is used to express the selection of a particular candidate from the candidate list; the candidate reordering syntax indicates whether the candidates in the motion vector prediction candidate list need to be reordered when the candidate list can be reordered or not; the reordering template syntax indicates which template is used when multiple templates exist during the reordering process; and the precision processing syntax indicates which precision is used when a multi-precision approach is used to process motion vector prediction candidates.
[0114] Furthermore, the adjustment scheme syntax includes, but is not limited to, distance index syntax, direction index syntax, region index syntax, and motion vector adjustment pattern syntax. Specifically, the distance index syntax expresses: when numbering motion vector adjustment candidates by distance, the distance index is used to express the specific selected distance; the scheme index syntax expresses: when numbering motion vector adjustment candidates by direction, the direction index is used to express the specific selected direction; the region index syntax expresses: when numbering motion vector adjustment candidates by region, the region index is used to express the specific selected region; the vector adjustment template syntax expresses: when using templates for vector adjustment, if multiple templates exist, it is used to express which template was used; and the motion vector adjustment pattern syntax expresses whether a multi-stage motion vector adjustment technique is executed. Additionally, when multiple multi-stage motion vector adjustment techniques exist simultaneously, it expresses which multi-stage motion vector adjustment technique is executed.
[0115] It is understandable that the modified scheme syntax can be transmitted in syntax structures including but not limited to video parameter sets (VPS), sequence parameter sets (SPS), image parameter sets (PPS), image headers (PH), and coding units.
[0116] It should be noted that different real-time scenarios correspond to specific syntax in the bitstream. For ease of understanding and explanation, this application, in conjunction with the content of the above embodiments 1-7, provides the following specific embodiments to illustrate the syntax that matches the implementation scenario.
[0117] Example 8: Obtaining the starting point of motion vector adjustment: based on [Example 1]; Multi-stage motion vector adjustment technology: based on [Example 4]; Application of multi-stage motion vector adjustment: adding this multi-stage motion vector adjustment scheme to the AMVP prediction mode. The syntax design includes motion vector adjustment switch syntax and motion vector adjustment mode syntax.
[0118] Understandably, the motion vector adjustment switch syntax `sps_msmvd_enable` is used to indicate whether the multi-stage motion vector adjustment scheme is authorized and encoded and transmitted in SPS, as shown in Table 4 below. When `sps_msmvd_enable = 0`, it means that the multi-stage motion vector adjustment scheme is not enabled; when `sps_msmvd_enable = 1`, it means that the multi-stage motion vector adjustment scheme is enabled.
[0119] Table 4: Example 8 Sequence Heading Sentence Method
[0120]
[0121]
[0122] Understandably, the motion vector adjustment mode syntax is as follows: when `sps_msmvd_enable = 1`, the multi-stage motion vector adjustment mode syntax `msmvd_flag` in the encoding unit syntax structure indicates whether the multi-stage motion vector adjustment scheme is executed, as shown in Table 5 below. When `msmvd_flag = 0`, it means the multi-stage motion vector adjustment scheme is not executed; when `msmvd_flag = 1`, it means the multi-stage motion vector adjustment scheme is executed.
[0123] Table 5: Syntax of Encoding Units in Example 8
[0124]
[0125] Example 9: Obtaining the starting point of motion vector adjustment: based on [Example 2]; Multi-stage motion vector adjustment technology: based on [Example 5]; Application of multi-stage motion vector adjustment: adding this multi-stage motion vector adjustment scheme to the AMVP prediction mode. The syntax design includes motion vector adjustment switch syntax, motion vector adjustment mode syntax, candidate index syntax, distance index syntax, and direction index syntax.
[0126] Understandably, the motion vector adjustment switch syntax `sps_msmvd_enable` is used to indicate whether the multi-stage motion vector adjustment scheme is enabled and encoded and transmitted in SPS. Motion vector adjustment mode syntax: When `sps_msmvd_enable = 1`, the multi-stage motion vector adjustment mode syntax `msmvd_flag` in the encoding unit syntax structure is used to indicate whether the multi-stage motion vector adjustment scheme is executed.
[0127] Understandably, the candidate index syntax is as follows: When msmvd_flag = 1, multiple candidates are stored in the MVP list in [Example 2]. Therefore, the MVP candidate index syntax msmvd_mvp_idx in the encoding unit syntax structure is used to indicate that the multi-stage motion vector adjustment scheme ultimately adopts the msmvd_mvd_idx-th MVP candidate; the distance index syntax is as follows: When msmvd_flag = 1, distance_idx is used to represent the distance index in [Example 5], indicating that the distance_idx-th preset distance is adopted; the direction index syntax is as follows: When msmvd_flag = 1, direction_idx is used to represent the direction index in [Example 5], indicating that the direction_idx-th preset direction is adopted; the candidate reordering syntax and precision processing syntax are as follows: Since MVP candidate reordering and MVP precision processing are performed by default in [Example 2], the relevant syntax does not need to be used. The final syntax is shown in Table 6.
[0128] Table 6: Syntax of Encoding Units in Example 9
[0129]
[0130] Example 10: Obtaining the starting point of motion vector adjustment: based on [Example 2]; Multi-stage motion vector adjustment technology: based on [Example 6] and [Example 7]; Application of multi-stage motion vector adjustment: adding these two multi-stage motion vector adjustment schemes to the Merge prediction mode. The syntax design includes motion vector adjustment switch syntax, motion vector adjustment mode syntax, candidate index syntax, distance index syntax, and direction index syntax.
[0131] Understandably, the motion vector adjustment switch syntax `sps_msmvd_enable` is used to indicate whether the multi-stage motion vector adjustment scheme is enabled and is encoded and transmitted in SPS. Motion vector adjustment mode syntax: When `sps_msmvd_enable = 1`, the multi-stage motion vector adjustment mode syntax `msmvd_mode_flag` in the encoding unit syntax structure indicates whether the multi-stage motion vector adjustment scheme is executed and which scheme is specifically executed. When `msmvd_mode_flag = 0`, it indicates that the multi-stage motion vector adjustment scheme is not executed; when `msmvd_mode_flag = 1`, it indicates that the multi-stage motion vector adjustment scheme in [Example 7] is executed; and when `msmvd_mode_flag = 2`, it indicates that the multi-stage motion vector adjustment scheme in [Example 6] is executed.
[0132] Understandably, the candidate index syntax is as follows: when msmvd_flag is not 0, the MVP candidate index syntax msmvd_mvp_idx in the encoding unit syntax structure indicates that the multi-stage motion vector adjustment scheme adopts the msmvd_mvd_idx-th MVP candidate; the distance index syntax is as follows: when msmvd_mode_flag = 1, distance_idx indicates that the distance_idx-th preset distance is adopted; the direction index syntax is as follows: when msmvd_mode_flag = 1, direction_idx indicates that the direction_idx-th preset direction is adopted. The final syntax is shown in Table 7.
[0133] Table 7: Syntax of Encoding Units in Example 10
[0134]
[0135] S204: Based on the motion vector adjustment starting point and the motion vector adjustment values of all stages, determine the target motion vector of the current block, and use the target motion vector to decode the current block to obtain the decoded block.
[0136] Specifically, based on the motion vector adjustment value of each stage, adjustments are made sequentially starting from the motion vector adjustment starting point to obtain the target motion vector of the current block; based on the target motion vector, the current block is predicted and decoded to obtain the decoded block of the current block.
[0137] It is understandable that after obtaining the motion vector adjustment value for each stage, the starting point of the motion vector adjustment is used as the starting position and the adjustment is carried out sequentially. The position indicated by the motion vector adjustment value of the previous stage is used as the starting point of the motion vector adjustment for the next stage, until the end position is obtained. The target motion vector of the current block is determined, so that the target motion vector has higher accuracy. Based on the target motion vector, the current block is predicted and decoded to obtain the decoded block of the current block, resulting in a more accurate decoded block.
[0138] In this embodiment, based on the value of the adjustment starting point syntax, the corresponding predicted value is obtained from the motion vector prediction candidate list as the motion vector prediction value of the current block. Through syntax transmission and parsing, the motion vector prediction candidate list is accurately constructed, and the motion vector prediction value of the current block is obtained from it. The position indicated by the motion vector prediction value of the current block is obtained, and this position is used as the motion vector adjustment starting point. The adjustment scheme syntax of the current block in the bitstream is interpreted, and the stage syntax corresponding to the motion vector adjustment scheme of the current block in each stage is determined. For each stage, the stage syntax of the current stage is obtained. Based on the stage syntax, according to the transmission method indicated by the stage syntax, the motion vector adjustment value of the current stage is obtained. Thus, based on the stages included in the motion vector adjustment scheme, the motion vector adjustment value of each stage is obtained stage by stage based on the stage syntax, ensuring the accuracy of the motion vector adjustment value of each stage. Based on the motion vector adjustment value of each stage, adjustments are performed sequentially starting from the motion vector adjustment starting point to obtain the target motion vector of the current block. Based on the target motion vector, the current block is predicted and decoded to obtain the decoded block of the current block.
[0139] Please see Figure 7 , Figure 7 This is a flowchart illustrating one embodiment of the coding method of this application, which includes:
[0140] S701: Obtain the motion vector adjustment start point of the current block in the video frame; wherein, the motion vector adjustment start point corresponds to the motion vector prediction value of the current block.
[0141] Specifically, the motion vector prediction value of the current block in the video frame is obtained, and the motion vector adjustment starting point corresponding to the motion vector prediction value is determined.
[0142] In some implementation scenarios, the motion vector prediction value of the current block in the video frame is obtained based on inter-frame prediction, and the position indicated by the motion vector prediction value is used as the starting point for motion vector adjustment.
[0143] In some implementation scenarios, the motion vector prediction value of the current block in the video frame is obtained based on intra-frame prediction, and the position indicated by the motion vector prediction value is used as the starting point for motion vector adjustment.
[0144] In some implementation scenarios, obtaining the motion vector adjustment starting point of the current block in a video frame includes: obtaining the motion vector prediction candidate list corresponding to the current block, rearranging and / or refining the prediction values in the motion vector prediction candidate list, obtaining the motion vector prediction value of the current block from the processed motion vector prediction candidate list, and determining the motion vector adjustment starting point based on the motion vector prediction value of the current block.
[0145] Specifically, the motion vector prediction candidate list corresponding to the current block is obtained, wherein the motion vector prediction candidate list is independently constructed based on preset construction rules.
[0146] Furthermore, the predicted values in the motion vector prediction candidate list are rearranged and / or precision-processed to adjust the motion vector prediction candidate list according to rules, avoiding the impact of changes in the order of predicted values during the encoding and decoding stages. When candidate predicted values exist, they can be rearranged in a certain way, including but not limited to template-based and distance-based candidate rearrangement. Precision processing methods include but are not limited to fixed precision and multi-precision. Rearrangement and precision processing can be performed individually or both, and the process must be consistent between the encoding and decoding stages.
[0147] Understandably, when multiple candidates are still retained after rearrangement and accuracy processing, the motion vector prediction value of the current block is obtained from the processed motion vector prediction candidate list based on cost comparison. The position indicated by the motion vector prediction value of the current block is obtained, and the position indicated by the motion vector prediction value is used as the starting point for motion vector adjustment, so as to improve the accuracy of the motion vector prediction value and the accuracy of the corresponding motion vector adjustment starting point.
[0148] S702: Starting from the motion vector adjustment starting point, obtain the motion vector adjustment values of all stages and the acquisition methods of at least some stages. Based on the motion vector adjustment values of all stages and the acquisition methods of at least some stages, determine the motion vector adjustment scheme of the current block.
[0149] Specifically, the stages of the motion vector adjustment scheme and how to transmit motion vector adjustment values in each stage can be predefined in different implementation scenarios. Then, according to the predefined stages, the starting point of motion vector adjustment is taken as the starting position, and the motion vector adjustment value of each stage is obtained in stages, and the acquisition method corresponding to the non-directly transmitted motion vector adjustment value is determined.
[0150] Furthermore, based on the predetermined vector adjustment values of all stages and the acquisition method of the motion vector adjustment values of indirect transmission, a specific motion vector adjustment scheme for the current block is jointly generated. Among them, the motion vector adjustment values of indirect transmission correspond to the acquisition method of the motion vector adjustment values of the corresponding stage.
[0151] It is understandable that the method of obtaining the motion vector adjustment value in the non-direct transmission is similar to the process of the decoder interpreting the syntax and searching for the motion vector adjustment value in the motion vector adjustment candidate set, which will not be described in detail in this application.
[0152] S703: Generate the bitstream corresponding to the current block based on the current block and its corresponding motion vector adjustment starting point and motion vector adjustment scheme.
[0153] Specifically, based on the current block and its corresponding motion vector adjustment starting point, as well as the motion vector adjustment scheme of the current block, a bitstream corresponding to the current block is generated so that the bitstream includes the indication information corresponding to the motion vector adjustment starting point and the motion vector adjustment scheme.
[0154] It is understood that the bitstream encoded by the above encoding method is compatible with the decoding method in any of the above embodiments.
[0155] In some implementation scenarios, the bitstream corresponding to the current block is generated based on the current block and its corresponding motion vector adjustment starting point and motion vector adjustment scheme. This includes: generating a list construction syntax based on the motion vector prediction candidate list corresponding to the motion vector prediction value; generating a candidate index syntax based on the position of the motion vector prediction value in the motion vector prediction candidate list; determining the stage syntax matching each stage based on the motion vector adjustment scheme; generating the adjustment scheme syntax corresponding to the motion vector adjustment scheme based on the stage syntax of all stages; and generating the bitstream corresponding to the current block based on the current block, the list construction syntax, the candidate index syntax, and the adjustment scheme syntax.
[0156] Specifically, based on the motion vector prediction candidate list corresponding to the motion vector prediction value, a list construction syntax is generated to indicate how to construct the motion vector prediction candidate list. Based on the position of the motion vector prediction value in the motion vector prediction candidate list, a candidate index syntax is generated to indicate how to obtain the prediction value at the corresponding position from the motion vector prediction candidate list.
[0157] Furthermore, based on the information of each stage included in the motion vector adjustment scheme, the stage syntax matching each stage is determined. The stage syntax is used to indicate the transmission method of the motion vector adjustment value of the corresponding stage, as well as the acquisition method of the indirect transmission of motion vector adjustment value. Based on the stage syntax of all stages, the adjustment scheme syntax corresponding to the motion vector adjustment scheme is finally obtained.
[0158] It is understandable that encoding the current block, along with the list construction syntax, candidate index syntax, and adjustment scheme syntax, yields the bitstream corresponding to the current block. This allows the bitstream to incorporate syntax that instructs the decoding end to perform decoding, reducing the overhead of bitstream transmission and ensuring that the decoding end can accurately decode.
[0159] It should be noted that, in different implementation scenarios, the syntax included in the bitstream may also include the motion vector adjustment switch syntax corresponding to the current block, and the stage syntax may also include distance index syntax and direction index syntax, with the specific content corresponding to the scenarios in the above embodiments.
[0160] Optionally, the syntactic coding includes syntactic binarization and selection matching syntactic coding methods. The syntactic binarization methods include unary codes, truncated unary codes, truncated Rice codes, signed fixed-length codes, unsigned fixed-length codes, and exponential Golomb codes. The syntactic coding methods include, but are not limited to, high-entropy coding and side-channel coding.
[0161] In this embodiment, the motion vector prediction value of the current block in the video frame is obtained, the motion vector adjustment starting point corresponding to the motion vector prediction value is determined, and the motion vector adjustment starting point is used as the starting position. The motion vector adjustment value of each stage is obtained in stages, and the acquisition method corresponding to the indirect transmission motion vector adjustment value is determined. Based on the predetermined vector adjustment values of all stages and the acquisition method of the indirect transmission motion vector adjustment value, a specific motion vector adjustment scheme for the current block is generated. Based on the current block, its corresponding motion vector adjustment starting point, and the motion vector adjustment scheme of the current block, the bitstream corresponding to the current block is generated so that the bitstream includes the indication information corresponding to the motion vector adjustment starting point and the motion vector adjustment scheme, reducing the overhead of bitstream transmission and ensuring that the decoding end can accurately decode.
[0162] Please see Figure 8 , Figure 8 This is a schematic diagram of the structure of an embodiment of the electronic device of this application. The electronic device 80 includes a memory 801 and a processor 802 coupled to each other. The memory 801 stores program data (not shown in the figure), and the processor 802 calls the program data to implement the method in any of the above embodiments. For the description of the relevant content, please refer to the detailed description of the above method embodiments, which will not be repeated here.
[0163] Please see Figure 9 , Figure 9 This is a schematic diagram of a computer-readable storage medium according to an embodiment of the present application. The computer-readable storage medium 90 stores program data 900. When the program data 900 is executed by a processor, it implements the method in any of the above embodiments. For a detailed description of the relevant content, please refer to the detailed description of the above method embodiments, which will not be repeated here.
[0164] It should be noted that the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0165] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0166] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this 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 of 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.
[0167] The above description is merely an embodiment of this application and does not limit the scope of protection of this application. Any equivalent structural or procedural transformations made based on the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of protection of this application.
Claims
1. A decoding method, characterized in that, The method includes: Obtain the motion vector adjustment starting point of the current block in the video frame; wherein, the motion vector adjustment starting point corresponds to the motion vector prediction value of the current block; Obtain the motion vector adjustment scheme for the current block, and determine the motion vector adjustment values for all stages based on the motion vector adjustment scheme; wherein, the motion vector adjustment scheme includes a method for obtaining the motion vector adjustment values for at least some stages; Based on the motion vector adjustment starting point and the motion vector adjustment values of all stages, the target motion vector of the current block is determined, and the decoded block of the current block is obtained by decoding using the target motion vector.
2. The decoding method according to claim 1, characterized in that, The step of obtaining the motion vector adjustment starting point of the current block in the video frame includes: The adjustment start point syntax of the current block in the bitstream is interpreted. Based on the value of the adjustment start point syntax, the motion vector prediction candidate list corresponding to the current block is obtained, and the motion vector prediction value of the current block is obtained from the motion vector prediction candidate list. Based on the predicted motion vector value of the current block, the starting point for motion vector adjustment is determined.
3. The decoding method according to claim 2, characterized in that, The starting point adjustment syntax includes list construction syntax and candidate index syntax. The step of obtaining a motion vector prediction candidate list corresponding to the current block based on the value of the starting point adjustment syntax, and obtaining the motion vector prediction value of the current block from the motion vector prediction candidate list, includes: Based on the list, construct the syntax value, obtain the motion vector prediction candidate list corresponding to the current block, and rearrange and / or process the prediction values in the motion vector prediction candidate list. Based on the value of the candidate index syntax, the motion vector prediction value of the current block is obtained from the processed motion vector prediction candidate list.
4. The decoding method according to claim 1, characterized in that, The step of obtaining the motion vector adjustment scheme for the current block, and determining the motion vector adjustment values for all stages based on the motion vector adjustment scheme, includes: Decipher the syntax of the adjustment scheme for the current block in the bitstream, and obtain the stage syntax of the motion vector adjustment scheme for the current block at each stage; For each stage, the motion vector adjustment value for the current stage is determined based on the stage syntax of the current stage.
5. The decoding method according to claim 4, characterized in that, The stage with the acquisition method corresponds to a motion vector adjustment candidate set. The motion vector adjustment scheme includes at least one stage. The acquisition method of the first stage of the motion vector adjustment scheme, and other stages between the first stage and the last stage, is as follows: the motion vector adjustment value is obtained by searching the motion vector adjustment candidate set of the corresponding stage. When the motion vector adjustment scheme includes multiple stages, the method of obtaining the final stage is as follows: the motion vector adjustment value is obtained by searching the motion vector adjustment candidate set of the corresponding stage, or the motion vector adjustment value corresponding to the final stage is directly transmitted, wherein the motion vector adjustment value corresponding to the final stage is obtained based on the motion vector adjustment values before the final stage.
6. The decoding method according to claim 5, characterized in that, The acquisition method includes template cost search, and the determination of the motion vector adjustment value for the current stage based on the stage syntax of the current stage includes: In response to determining the current stage as the template-based cost search based on the stage syntax of the current stage, the motion vector adjustment candidate set of the current stage is obtained; wherein, multiple adjustment values in the motion vector adjustment candidate set correspond to a preset distance and a preset direction; Based on the template cost between the current template corresponding to the current block and the reference template of the reference block to which the adjustment value points, the motion vector adjustment value for the current stage is determined.
7. The decoding method according to claim 6, characterized in that, The determination of the motion vector adjustment value for the current stage based on the template cost between the current template corresponding to the current block and the reference template of the reference block to which the adjustment value points includes: Taking the position pointed to by the motion vector adjustment value of the current stage as the starting point, search for the adjustment value in the motion vector adjustment candidate set in the preset direction, and determine the search direction based on the template cost between the current template and the reference template of the reference block pointed to by the adjustment value in the preset direction; The adjustment value within a preset distance is searched in the search direction. Based on the template cost between the current template and the reference template of the reference block pointed to by the adjustment value within the preset distance, the motion vector adjustment value for the current stage is determined.
8. The decoding method according to claim 5, characterized in that, The acquisition method includes searching based on index numbers, and determining the motion vector adjustment value for the current stage based on the stage syntax of the current stage includes: In response to determining the current stage as the index-based search based on the current stage's stage syntax, the motion vector adjustment candidate set for the current stage is obtained; wherein, multiple adjustment values in the motion vector adjustment candidate set correspond to preset distances and preset directions, each preset distance corresponds to a distance index, and each preset direction corresponds to a direction index; Based on the stage syntax of the current stage, determine the selection distance corresponding to the preset distance and the selection direction corresponding to the preset direction, and based on the selection distance and the selection direction, determine the motion vector adjustment value of the current stage.
9. The decoding method according to claim 8, characterized in that, The stage syntax further includes distance index syntax and direction index syntax. The stage syntax based on the current stage determines the selection distance corresponding to the preset distance and the selection direction corresponding to the preset direction. Based on the selection distance and the selection direction, it determines the motion vector adjustment value for the current stage, including: Based on the value of the distance index syntax, the selection distance of the motion vector adjustment value for the current stage is determined; based on the value of the direction index syntax, the selection direction of the motion vector adjustment value for the current stage is determined; the adjustment value indicated by the selection distance and the selection direction is obtained from the motion vector adjustment candidate set; and the motion vector adjustment value for the current stage is determined.
10. The decoding method according to claim 5, characterized in that, The acquisition method includes local range search, and the determination of the motion vector adjustment value for the current stage based on the stage syntax of the current stage includes: In response to determining the current stage as the local range search based on the stage syntax of the current stage, the prediction region is determined based on the position pointed to by the motion vector adjustment value of the current stage, and the motion compensation region corresponding to the prediction region is obtained; wherein, the motion compensation region includes the prediction region and other regions that at least partially surround the prediction region; Based on the template cost between the current template corresponding to the current block and the reference template of the reference block pointed to by the adjustment value in the motion compensation area, the motion vector adjustment value for the current stage is determined.
11. The decoding method according to claim 10, characterized in that, The determination of the motion vector adjustment value for the current stage based on the template cost between the current template corresponding to the current block and the reference template of the reference block pointed to by the adjustment value in the motion compensation region includes: Starting from a specified location in the predicted region, the adjustment value at the first predetermined location is searched multiple times within the motion compensation region. Based on the template cost between the current template and the reference template of the reference block pointed to by the adjustment value at the first predetermined location, a candidate location is determined. Search for the adjustment value at the second predetermined position at the candidate position, and determine the motion vector adjustment value for the current stage based on the template cost between the current template and the reference template of the reference block pointed to by the adjustment value at the second predetermined position.
12. The decoding method according to claim 5, characterized in that, When the final stage corresponds to obtaining the motion vector adjustment value from the motion vector adjustment candidate set according to the acquisition method, determining the motion vector adjustment value of the current stage based on the stage syntax of the current stage includes: Based on the current stage syntax, the encoded adjustment values are obtained from the bitstream to determine the motion vector adjustment values for the current stage.
13. The decoding method according to claim 1, characterized in that, The bitstream includes motion vector adjustment switch syntax. A first value of the motion vector adjustment switch syntax is used to indicate that the step of obtaining the motion vector adjustment start point of the current block in the video frame is allowed during the decoding stage, and a second value of the motion vector adjustment switch syntax is used to indicate that the step of obtaining the motion vector adjustment start point of the current block in the video frame is prohibited during the decoding stage. When the motion vector adjustment switch syntax adopts a first value, the bitstream also includes a motion vector adjustment mode syntax. The first value of the motion vector adjustment mode syntax is used to indicate the step of entering the motion vector adjustment starting point of the current block in the acquired video frame during the decoding stage. The second value of the motion vector adjustment mode syntax is used to indicate the step of not entering the motion vector adjustment starting point of the current block in the acquired video frame during the decoding stage.
14. The decoding method according to claim 1, characterized in that, The process of determining the target motion vector for the current block based on the motion vector adjustment starting point and the motion vector adjustment values for all stages, and then decoding the current block using the target motion vector to obtain the decoded block, includes: Based on the motion vector adjustment value at each stage, adjustments are made sequentially starting from the motion vector adjustment starting point to obtain the target motion vector of the current block; Based on the target motion vector, the current block is predicted and decoded to obtain the decoded block of the current block.
15. An encoding method, characterized in that, The method includes: Obtain the motion vector adjustment starting point of the current block in the video frame; wherein, the motion vector adjustment starting point corresponds to the motion vector prediction value of the current block; Starting from the motion vector adjustment starting point, obtain the motion vector adjustment values for all stages and the acquisition method of the motion vector adjustment values for at least some stages. Based on the motion vector adjustment values for all stages and the acquisition method of the motion vector adjustment values for at least some stages, determine the motion vector adjustment scheme for the current block. Based on the current block, its corresponding motion vector adjustment starting point, and the motion vector adjustment scheme, the bitstream corresponding to the current block is generated.
16. The encoding method according to claim 15, characterized in that, The step of obtaining the motion vector adjustment starting point of the current block in the video frame includes: Obtain the motion vector prediction candidate list corresponding to the current block, rearrange and / or process the prediction values in the motion vector prediction candidate list, and obtain the motion vector prediction value of the current block from the processed motion vector prediction candidate list; Based on the predicted motion vector value of the current block, the starting point for motion vector adjustment is determined.
17. The encoding method according to claim 16, characterized in that, The step of generating the bitstream corresponding to the current block based on the current block, its corresponding motion vector adjustment starting point, and the motion vector adjustment scheme includes: Based on the motion vector prediction candidate list corresponding to the predicted motion vector value, a list construction syntax is generated, and based on the position of the predicted motion vector value in the motion vector prediction candidate list, a candidate index syntax is generated. Based on the motion vector adjustment scheme, the stage syntax matching each stage is determined, and based on the stage syntax of all stages, the adjustment scheme syntax corresponding to the motion vector adjustment scheme is generated; Based on the current block, the list construction syntax, the candidate index syntax, and the adjustment scheme syntax, the bitstream corresponding to the current block is generated.
18. An electronic device, characterized in that, include: A memory and a processor are coupled to each other, wherein the memory stores program data and the processor invokes the program data to perform the method as described in any one of claims 1-14 or 15-17.
19. A computer-readable storage medium storing program data thereon, characterized in that, When the program data is executed by the processor, it implements the method as described in any one of claims 1-14 or 15-17.