Disclosure of Invention
The disclosure provides a motion vector list construction method, a device, an electronic apparatus, a computer readable storage medium and a computer program product, so as to at least solve the problem that an inter-frame prediction scheme of a geometric partition mode (Geometric partitioning mode, GPM) in the related art can only utilize prediction information of one direction to perform prediction, and reduce the accuracy of a GPM prediction result. The technical scheme of the present disclosure is as follows:
According to a first aspect of embodiments of the present disclosure, a motion vector list construction method is provided, which includes obtaining a frame to be encoded, determining a current encoding unit based on the frame to be encoded, constructing an initial motion vector candidate list of the current encoding unit according to motion information of a prediction unit corresponding to the current encoding unit, where the motion information of the prediction unit includes unidirectional prediction motion information and bidirectional prediction motion information, determining a direction prediction type of a first candidate motion vector in the initial motion vector candidate list, and constructing a target motion vector candidate list based on the direction prediction type and the first candidate motion vector, where the target motion vector candidate list is used for video encoding of the frame to be encoded.
In an exemplary embodiment of the disclosure, the constructing an initial motion vector candidate list of the current coding unit according to motion information of a prediction unit corresponding to the current coding unit includes obtaining motion information of the prediction unit, where the motion information of the prediction unit includes a first prediction motion vector and a second prediction motion vector, obtaining a preconfigured maximum length of the initial list, and constructing the initial motion vector candidate list according to the maximum length of the initial list, the first prediction motion vector and the second prediction motion vector.
In one exemplary embodiment of the disclosure, the obtaining the motion information of the prediction unit includes taking a coding unit spatially adjacent to the current coding unit as a spatial prediction unit, taking a motion vector corresponding to the spatial prediction unit as the first prediction motion vector, taking a coding unit temporally adjacent to the current coding unit as a temporal prediction unit, and taking a motion vector corresponding to the spatial prediction unit as the second prediction motion vector.
In an exemplary embodiment of the disclosure, the constructing the initial motion vector candidate list according to the initial list maximum length, the first predicted motion vector and the second predicted motion vector includes filling the first predicted motion vector and the second predicted motion vector into the initial motion vector candidate list, determining a first current list length of the initial motion vector candidate list after the motion vector filling operation, and filling a specified motion vector into the initial motion vector candidate list when the first current list length is smaller than the initial list maximum length until the first current list length is equal to the initial list maximum length, so as to obtain the initial motion vector candidate list.
In one exemplary embodiment of the disclosure, the constructing a target motion vector candidate list based on the direction prediction type and the first candidate motion vector includes obtaining a pre-configured maximum target list length, and constructing a target motion vector candidate list based on the maximum target list length, the direction prediction type, and the first candidate motion vector.
In an exemplary embodiment of the disclosure, the constructing a target motion vector candidate list according to the maximum length of the target list, the direction prediction type and the first candidate motion vector includes using the first candidate motion vector as a second candidate motion vector when the direction prediction type is a unidirectional prediction motion vector, performing splitting processing on the first candidate motion vector to obtain two unidirectional prediction motion vectors when the direction prediction type is a bidirectional prediction motion vector, using the obtained unidirectional prediction motion vector as the second candidate motion vector, and constructing the target motion vector candidate list based on the second candidate motion vector and the maximum length of the target list.
In an exemplary embodiment of the disclosure, the constructing the target motion vector candidate list based on the second candidate motion vector and the maximum target list length includes determining an existing candidate motion vector currently existing in the target motion vector candidate list, discarding the second candidate motion vector when the second candidate motion vector is identical to the existing candidate motion vector, filling the second candidate motion vector into the target motion vector candidate list when the second candidate motion vector is different from the existing candidate motion vector, determining a second current list length of the target motion vector candidate list after a motion vector filling operation, and filling a designated motion vector into the target motion vector candidate list when the second current list length is smaller than the maximum target list length until the second current list length is equal to the maximum target list length, thereby obtaining the target motion vector candidate list.
In an exemplary embodiment of the present disclosure, the method further includes obtaining candidate motion vectors included in the target motion vector candidate list, determining a rate distortion cost corresponding to each candidate motion vector, determining a target candidate motion vector from a plurality of candidate motion vectors according to the rate distortion cost, and transmitting a target index corresponding to the target candidate motion vector to a decoding end.
According to a second aspect of the embodiment of the present disclosure, a motion vector list construction device is provided, which includes a current coding unit determining module configured to obtain a frame to be coded, determine a current coding unit based on the frame to be coded, an initial list constructing module configured to construct an initial motion vector candidate list of the current coding unit according to motion information of a prediction unit corresponding to the current coding unit, where the motion information of the prediction unit includes unidirectional prediction motion information and bidirectional prediction motion information, a direction type determining module configured to determine a direction prediction type of a first candidate motion vector in the initial motion vector candidate list, and a target list constructing module configured to construct a target motion vector candidate list based on the direction prediction type and the first candidate motion vector, where the target motion vector candidate list is used for video coding of the frame to be coded.
In one exemplary embodiment of the disclosure, the initial list construction module includes an initial list construction unit configured to acquire motion information of the prediction unit, where the motion information of the prediction unit includes a first predicted motion vector and a second predicted motion vector, acquire a preconfigured maximum length of the initial list, and construct the initial motion vector candidate list according to the maximum length of the initial list, the first predicted motion vector, and the second predicted motion vector.
In one exemplary embodiment of the present disclosure, the initial list construction unit includes a reference information determination subunit configured to use a coding unit spatially adjacent to the current coding unit as a spatial prediction unit, use a motion vector corresponding to the spatial prediction unit as the first predicted motion vector, use a coding unit temporally adjacent to the current coding unit as a temporal prediction unit, and use a motion vector corresponding to the spatial prediction unit as the second predicted motion vector.
In an exemplary embodiment of the present disclosure, the initial list construction unit includes an initial list construction subunit, configured to populate the first predicted motion vector and the second predicted motion vector into the initial motion vector candidate list, determine a first current list length of the initial motion vector candidate list after a motion vector population operation, and populate a specified motion vector into the initial motion vector candidate list when the first current list length is less than the initial list maximum length until the first current list length is equal to the initial list maximum length, thereby obtaining the initial motion vector candidate list.
In one exemplary embodiment of the disclosure, the target list construction module includes a target list construction unit configured to obtain a pre-configured maximum target list length and construct a target motion vector candidate list according to the maximum target list length, the direction prediction type and the first candidate motion vector.
In an exemplary embodiment of the disclosure, the target list construction unit includes a target list construction subunit, configured to take the first candidate motion vector as a second candidate motion vector when the direction prediction type is a unidirectional prediction motion vector, split the first candidate motion vector to obtain two unidirectional prediction motion vectors when the direction prediction type is a bidirectional prediction motion vector, take the obtained unidirectional prediction motion vector as the second candidate motion vector, and construct the target motion vector candidate list based on the second candidate motion vector and the maximum length of the target list.
In an exemplary embodiment of the present disclosure, the object list construction subunit is configured to perform determining an existing candidate motion vector currently existing in the object motion vector candidate list, discarding the second candidate motion vector when the second candidate motion vector is identical to the existing candidate motion vector, padding the second candidate motion vector into the object motion vector candidate list when the second candidate motion vector is different from the existing candidate motion vector, determining a second current list length of the object motion vector candidate list after a motion vector padding operation, and padding a specified motion vector into the object motion vector candidate list when the second current list length is less than the object list maximum length until the second current list length is equal to the object list maximum length, thereby obtaining the object motion vector candidate list.
In an exemplary embodiment of the disclosure, the motion vector list construction device further includes a target index determining module, configured to obtain candidate motion vectors included in the target motion vector candidate list, determine rate distortion costs corresponding to the candidate motion vectors, determine a target candidate motion vector from a plurality of candidate motion vectors according to the rate distortion costs, and transmit a target index corresponding to the target candidate motion vector to a decoding end.
According to a third aspect of the present disclosure, there is provided an electronic device comprising a processor, a memory for storing processor-executable instructions, wherein the processor is configured to execute the instructions to implement the motion vector list construction method of any one of the above.
According to a fourth aspect of the present disclosure, there is provided a computer-readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform the motion vector list construction method of any one of the above.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the motion vector list construction method of any one of the above.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
on one hand, the construction process of the GPM mode motion vector candidate list is optimized, bi-directional prediction motion information is reserved, and the bi-directional prediction motion information is sequentially added into the GPM motion vector candidate list, so that the accuracy of a prediction result is improved, and the coding cost of a motion vector is reduced. On the other hand, the constructed target motion vector candidate list is used for video coding, so that the overall coding efficiency of the video sequence can be improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
In inter prediction, referring to fig. 1, fig. 1 is a schematic diagram of reference blocks and motion information of a current frame in a reference frame in inter prediction. From fig. 1, it can be seen from the inter prediction process of fig. 1 that the motion vector obtained in motion estimation plays a very important role in the overall inter prediction, and more accurate motion vector prediction can bring about more accurate pixel prediction values and lower encoding costs. Two modes, merge mode (Merge) and advanced motion vector prediction (Advanced Motion Vector Prediction, AMVP) mode, are used for motion vectors in the correlation scheme.
Rectangular division is mostly adopted in related video coding standards to obtain non-overlapping coding blocks, and the rectangular blocks are used as a maximum unit for prediction and reconstruction coding. Rectangular block division of the three-fork tree and the four-fork tree based on the binary tree is flexible and efficient, but the rectangular division is difficult to describe the real boundary of an irregular moving object through one motion vector, so that the expression capability of the rectangular block division on the edge of the irregular moving object is insufficient, and complex video content is difficult to adapt. The geometric partitioning mode GPM is therefore further proposed.
The GPM divides one encoded block into two sub-blocks P0 and P1 by a straight line, which is represented by an angle parameter and a distance parameter. However, the GPM mode only supports unidirectional prediction, so as to divide two sub-regions to respectively perform unidirectional prediction, thereby achieving the purpose similar to bidirectional prediction. Referring to fig. 2, fig. 2 is a schematic view of the Merge candidate list derivation of the GPM mode according to the related scheme. The GPM divides the current block into two non-rectangular subareas, each subarea uses an inter prediction Merge mode to derive respective motion vector candidates, and then motion compensation is carried out to obtain two prediction blocks, which are equivalent to the fact that the two divided subareas have independent prediction values. However, the motion vector candidates derived from the Merge mode are both unidirectional and bidirectional, and the GPM mode is actually a bi-directional prediction composed of two unidirectional predictions, so that the GPM mode is filled with the GPM candidate list by taking motion information in one direction of the Merge bi-directional candidates according to a certain rule.
After the motion vector is obtained from the motion vector candidate list, if the motion vector is bidirectional motion information, the unidirectional information is taken according to a certain rule to predict. In fact, the advantage of bi-directional prediction is that the information of multiple reference frames is utilized, so that the error of unidirectional prediction can be relieved, and the prediction accuracy is higher. Therefore, only the prediction information in one direction is taken, the advantages of the motion vector candidates are not fully exerted, and the accuracy of the GPM prediction result is reduced. Particularly when the candidates of the prior order are bi-directional prediction, a part of motion information is removed, and the prediction accuracy and the motion vector coding cost are greatly influenced.
Based on this, according to an embodiment of the present disclosure, a motion vector list construction method, a motion vector list construction apparatus, an electronic device, a computer-readable storage medium, and a computer program product are proposed.
Fig. 3 is a flowchart illustrating a motion vector list construction method according to an exemplary embodiment, and as shown in fig. 3, the motion vector list construction method may be used in a computer device, wherein the computer device described in the present disclosure may include a mobile terminal device such as a mobile phone, a tablet computer, a notebook computer, a palm computer, a Personal digital assistant (Personal DIGITAL ASSISTANT, PDA), and a fixed terminal device such as a desktop computer. The present exemplary embodiment is illustrated with the method applied to a computer device, and it is understood that the method may also be applied to a server, and may also be applied to a system including a computer device and a server, and implemented through interaction of the computer device and the server. The method specifically comprises the following steps.
Step S310, a frame to be encoded is obtained, and a current encoding unit is determined based on the frame to be encoded.
Step S320, an initial motion vector candidate list of the current coding unit is constructed according to the motion information of the prediction unit corresponding to the current coding unit, wherein the motion information of the prediction unit comprises unidirectional prediction motion information and bidirectional prediction motion information.
Step S330 determines the direction prediction type of the first candidate motion vector in the initial motion vector candidate list.
Step S340, constructing a target motion vector candidate list based on the direction prediction type and the first candidate motion vector.
According to the motion vector list construction method in the present exemplary embodiment, on one hand, the motion vector candidate list construction process of the GPM mode is optimized, bi-directional prediction motion information is reserved, and the bi-directional prediction motion information is sequentially added to the GPM motion vector candidate list, so that accuracy of a prediction result is improved, and coding cost of a motion vector is reduced. On the other hand, the constructed target motion vector candidate list is used for video coding, so that the overall coding efficiency of the video sequence can be improved.
Next, a motion vector list construction method in the present exemplary embodiment will be further described.
In step S310, a frame to be encoded is acquired, and a current encoding unit is determined based on the frame to be encoded.
In one exemplary embodiment of the present disclosure, the frame to be encoded may be a video frame to be subjected to an encoding process. The current coding unit may be a coding unit currently being coded in the frame to be coded.
In the video coding process, a frame to be coded can be obtained from a video frame sequence to be coded, and after the frame to be coded is obtained, the current coding unit is determined from the frame to be coded because the coding process is performed in a blocking mode. For example, the current Coding Unit may be a Coding Unit (CU), or a smaller Unit obtained by dividing the Coding Unit, or a macroblock, or a sub-block obtained by dividing the macroblock, etc., and in the actual Coding process, the size of the Coding Unit may be determined according to the Coding requirement.
In step S320, an initial motion vector candidate list of the current coding unit is constructed according to motion information of a prediction unit corresponding to the current coding unit, where the motion information of the prediction unit includes unidirectional prediction motion information and bidirectional prediction motion information.
In one exemplary embodiment of the present disclosure, the prediction unit may be a reference unit corresponding to the current coding unit, e.g., the prediction unit may be a reference block spatially or temporally adjacent to the current coding unit, the prediction unit having the same size as the current coding unit. The motion information of the prediction unit may be motion information of a reference block of the current frame in the reference frame, which is determined through motion information estimation in the inter prediction process. The initial motion vector candidate list may be a candidate motion vector list constructed according to motion information of the prediction unit. The unidirectional predicted motion information may be unidirectional motion information predicted based on a motion information estimation process, such as a predicted block where only a single direction exists in the current block, and only unidirectional predicted motion information is determined. The bi-directional predicted motion information may be bi-directional motion information predicted in the motion information estimation process, for example, a predicted block having two directions exists in the current block, and the bi-directional predicted motion information may be determined.
For the current coding unit, motion information of a prediction unit corresponding to the current coding unit can be determined, the motion information of the obtained prediction unit is an estimated motion vector after motion information estimation, and a motion vector predicted value (Motion Vector Prediction, MVP) can be derived from the motion information of the prediction unit and used for constructing an initial motion vector candidate list. Taking the Merge mode as an example, the motion of the prediction unit may include unidirectional prediction motion information and bidirectional prediction motion information through an inter prediction process.
In an exemplary embodiment of the present disclosure, for step S320, an initial motion vector candidate list of a current coding unit is constructed according to motion information of a prediction unit corresponding to the current coding unit, including obtaining motion information of the prediction unit, the motion information of the prediction unit including a first predicted motion vector and a second predicted motion vector, obtaining a preconfigured maximum length of the initial list, and constructing the initial motion vector candidate list according to the maximum length of the initial list, the first predicted motion vector and the second predicted motion vector.
The first prediction motion vector may be a motion vector determined based on motion information of a spatial prediction unit corresponding to the current coding unit. The second prediction motion vector may be a motion vector determined based on motion information of a temporal prediction unit corresponding to the current coding unit. The maximum length of the initial list may be the maximum length set by the initial motion vector candidate list, and may be represented by L1.
Since inter prediction is to predict pixels of a current image using pixels adjacent to a coded image using correlation of a video time domain or a video spatial domain, motion information of a prediction unit obtained for a prediction unit of the current coding unit includes a first prediction motion vector determined based on spatial domain correlation and a second prediction motion vector determined based on temporal domain correlation.
Before constructing the candidate list, a preset maximum length L1 of the initial list may be obtained, and the first predicted motion vector and the second predicted motion vector are sequentially filled into the initial motion vector candidate list, so as to construct the initial motion vector candidate list with the length L1. The initial motion vector candidate list constructed through the steps comprises unidirectional prediction motion vectors and bidirectional prediction motion vectors, and serves as a basis for constructing the target motion vector candidate list.
In one exemplary embodiment of the present disclosure, obtaining motion information of a prediction unit includes taking a coding unit spatially adjacent to a current coding unit as a spatial prediction unit, taking a motion vector corresponding to the spatial prediction unit as a first prediction motion vector, taking a coding unit temporally adjacent to the current coding unit as a temporal prediction unit, and taking a motion vector corresponding to the spatial prediction unit as a second prediction motion vector.
The spatial prediction unit may be a prediction unit spatially adjacent to the current coding unit. The temporal prediction unit may be a prediction unit temporally adjacent to the current coding unit.
In inter prediction, two modes, namely a Merge mode and an AMVP mode, are used for motion vectors, and compared with the AMVP mode, the Merge mode mainly derives MVP based on some spatial domain information and co-located time domain information, and can be directly used for motion compensation after deriving a motion vector predicted value, and no additional motion vector difference value (Motion Vector Difference, MVD) is required to be transmitted, so that the coding cost is lower, and the use ratio in the coding process is higher. In this embodiment, the procedure of constructing the initial motion vector candidate list is described by taking the Merge mode as an example.
Referring to fig. 4, fig. 4 is a schematic diagram illustrating the derivation of the Merge mode time-space domain neighboring block motion information according to an exemplary embodiment. In fig. 4, A1, B1, A0, B0, and B2 are each adjacent blocks to the current coding unit (current block), and therefore, A1, B1, A0, B0, and B2 may be used as spatial prediction units corresponding to the current coding unit, and a motion vector corresponding to the spatial prediction unit may be obtained as a first prediction motion vector.
With continued reference to fig. 4, when determining the time-domain neighboring block, a reference frame corresponding to the current frame in which the current block is located may be determined first, and then a reference block (i.e., a time-domain prediction unit) corresponding to the current block is determined from the reference frames. As with the current block C1 in fig. 4, a temporal neighboring block at the C1 or C1 position in the reference frame may be used as a temporal prediction unit. And after the time domain prediction unit is determined, acquiring a motion vector corresponding to the time domain prediction unit as a second prediction motion vector. Through inter prediction, a candidate motion vector for constructing an initial motion vector candidate list can be determined, and the last predicted motion vector includes unidirectional candidate motion information and bidirectional candidate motion information.
In an exemplary embodiment of the disclosure, constructing an initial motion vector candidate list according to an initial list maximum length, a first predicted motion vector and a second predicted motion vector includes filling the first predicted motion vector and the second predicted motion vector into the initial motion vector candidate list, determining a first current list length of the initial motion vector candidate list after a motion vector filling operation, and filling a specified motion vector into the initial motion vector candidate list until the first current list length is equal to the initial list maximum length when the first current list length is smaller than the initial list maximum length, thereby obtaining the initial motion vector candidate list.
The first current list length may be a length of an initial motion vector candidate list after performing a list filling operation based on the first predicted motion vector and the second predicted motion vector. The specified motion vector may be a pre-configured specified type of motion vector, e.g., the specified motion vector may be a zero vector, the specified motion vector may also be another type of motion vector, and the specified motion vector may be configured according to the fill requirement.
After determining the first predicted motion vector and the second predicted motion vector, the motion vectors may be sequentially filled into an initial motion vector candidate list. With continued reference to fig. 4, the merge mode may add motion information (i.e., the first predicted motion vector) of the current block spatial neighboring block to the initial motion vector candidate list in the order of B1- > A1- > B1- > A0- > B2. Then, the motion vector of the temporally neighboring block at the C1 or C1 position in the reference frame (i.e., the second predicted motion vector) is added to the initial motion vector candidate list.
In the above process, unidirectional candidates and bidirectional candidates are not distinguished, and may be sequentially filled into the list according to the above sequence, and if the initial motion vector candidate list length is less than L1 after the first predicted motion vector and the second predicted motion vector are filled, the designated motion vector (such as zero vector) may be continuously filled into the initial motion vector candidate list until the candidate list length reaches L1. Through the steps, an initial motion vector candidate list containing unidirectional candidate motion information and bidirectional candidate motion information can be constructed.
It should be noted that only one (e.g., B1- > A1- > B1- > A0- > B2) motion vector filling order is given in this embodiment, and in some other exemplary embodiments of the present disclosure, the foregoing predicted motion vector may also be filled into the initial motion vector candidate list by using another filling order, and the filling order of the motion vector is not limited in any way in this disclosure.
In step S330, a direction prediction type of the first candidate motion vector in the initial motion vector candidate list is determined.
In one exemplary embodiment of the present disclosure, the first candidate motion vector may be a candidate motion vector included in the initial motion vector candidate list. The direction prediction type may be a direction prediction type corresponding to the first candidate motion vector, including unidirectional prediction motion vectors and bidirectional prediction motion vectors.
After the initial motion vector candidate list (i.e., the initial Merge candidate list) is constructed, the direction prediction type of each first candidate motion vector in the list can be obtained, and then the target motion vector candidate list is constructed based on the initial motion vector candidate list, such as converting the initial motion vector candidate list into a target motion vector candidate list with unidirectional prediction.
In step S340, a target motion vector candidate list is constructed based on the direction prediction type and the first candidate motion vector, the target motion vector candidate list being used for video encoding of the frame to be encoded.
In an exemplary embodiment of the present disclosure, the target motion vector candidate list may be a motion vector candidate list constructed after unidirectional predictive conversion of motion information in the initial motion vector candidate list.
Aiming at the problem that the filling mode of the GPM candidate list is optimized according to the method that the advantages of the GPM candidate list are not fully exerted and the accuracy of the GPM prediction result is reduced because the GPM candidate list is filled by only taking motion information in one direction in the GPM mode, the method comprises the steps of converting candidate motion vectors of the initial motion vector candidate list after obtaining the initial motion vector candidate list constructed based on the Merge mode, converting bidirectional Merge candidate motion vectors into continuous unidirectional candidate motion vectors, filling the GPM candidate list, obtaining a target motion vector candidate list finally, and carrying out video coding of a frame to be coded according to the constructed target motion vector candidate list.
In one exemplary embodiment of the present disclosure, for step S340, constructing a target motion vector candidate list based on a direction prediction type and a first candidate motion vector includes acquiring a pre-configured maximum length of the target list, and constructing the target motion vector candidate list based on the maximum length of the target list, the direction prediction type and the first candidate motion vector. The maximum length of the target list may be the maximum length set by the target motion vector candidate list, and may be represented by L2.
In this embodiment, the length of the target motion vector candidate list (GPM candidate list) is defined as the maximum length L2 of the target list, and then the initial motion vector candidate list obtained by construction is converted into the target motion vector candidate list (i.e., GPM unidirectional prediction candidate list). Specifically, the direction prediction type of the first candidate motion vector in the initial motion vector candidate list needs to be judged, both the bi-directional prediction motion vectors in the initial motion vector candidate list are converted into unidirectional prediction motion vectors, and the unidirectional prediction motion vectors are refilled into the target motion vector candidate list.
In an exemplary embodiment of the disclosure, a target motion vector candidate list is constructed according to a maximum length of the target list, a direction prediction type and a first candidate motion vector, and the method comprises the steps of taking the first candidate motion vector as a second candidate motion vector when the direction prediction type is a unidirectional prediction motion vector, carrying out splitting processing on the first candidate motion vector to obtain two unidirectional prediction motion vectors when the direction prediction type is a bidirectional prediction motion vector, taking the obtained unidirectional prediction motion vector as the second candidate motion vector, and constructing the target motion vector candidate list based on the second candidate motion vector and the maximum length of the target list.
The unidirectional prediction motion vector may be a motion vector obtained by selecting only one reference frame in one direction for motion estimation. The bi-directional predicted motion vector may be a motion vector obtained by selecting only two directional reference frames for motion estimation. The second candidate motion vector may be a candidate motion vector for populating the target motion vector candidate list.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating a Merge candidate list population rule of a GPM mode according to an exemplary embodiment. When a target motion vector candidate list is constructed, the initial Merge list is scanned sequentially, a first candidate motion vector in the initial motion vector candidate list is obtained, and the direction prediction type of the first candidate motion vector is judged one by one. If the first candidate motion vector is a unidirectional prediction candidate, the first candidate motion vector is directly taken as a second candidate motion vector. If the first candidate motion vector is a bi-prediction candidate, splitting the bi-prediction candidate first candidate motion vector into two uni-prediction motion vectors as two second candidate motion vectors.
After the first candidate motion vector is split based on the direction prediction type to generate a second candidate motion vector, the obtained second candidate motion vector can be sequentially filled into a new list until the new list is filled, namely, the maximum length of the target list is reached, and the target motion vector candidate list is obtained. The target motion vector candidate list constructed by the steps can retain the motion information of two directions of the bidirectional candidate, and avoid discarding a part of the motion information.
In one exemplary embodiment of the present disclosure, constructing a target motion vector candidate list based on a second candidate motion vector and a target list maximum length includes determining an existing candidate motion vector currently existing in the target motion vector candidate list, discarding the second candidate motion vector when the second candidate motion vector is identical to the existing candidate motion vector, padding the second candidate motion vector to the target motion vector candidate list when the second candidate motion vector is different from the existing candidate motion vector, determining a second current list length of the target motion vector candidate list after a motion vector padding operation, and padding a designated motion vector into the target motion vector candidate list when the second current list length is less than the target list maximum length until the second current list length is equal to the target list maximum length, thereby obtaining the target motion vector candidate list.
Wherein the existing candidate motion vector may be a candidate motion vector that currently exists in the target motion vector candidate list. The second current list length may be a length of the target motion vector candidate list after the list filling operation using the second candidate motion vector.
With continued reference to fig. 5, prior to filling the second candidate motion vector into the target motion vector candidate list, an existing candidate motion vector currently existing in the new list may be acquired first, and it may be determined whether the second candidate motion vector to be filled is identical to the existing candidate motion vector. And if the second candidate motion vector is different from the existing candidate motion vector, filling the second candidate motion vector into a target motion vector candidate list. That is, when constructing the new target list, each candidate MV is filled, it is required to check the candidate MV with the candidate MVs already in the list, determine whether the same MV already exists in the list, and if the repeated candidate already exists in the list, discard the candidate and continue to scan and fill until the length of the target motion vector candidate list reaches L2. By searching the candidate motion information, more different candidate MVs can be contained in the target motion vector candidate list, so that the candidate motion vectors have differences and are used for subsequent rate-distortion cost calculation.
After all the second candidate motion vectors are padded to the target motion vector candidate list, the current length of the target motion vector candidate list (i.e., the second current list length) after the motion vector padding operation may be determined. If the second current list length is smaller than the maximum target list length, filling the target motion vector candidate list with a specified motion vector (such as a zero vector) until the second current list length is equal to the maximum target list length L2, and obtaining the target motion vector candidate list.
For example, in fig. 5, the padding pattern is the same as the repeated candidates, and the non-padding is the invalid motion information. The motion vector indexed 0 in the Merge list is a bi-directional candidate motion vector, consisting of candidate motion vector 0 and candidate motion vector 1. According to the list construction method, when candidate motion vectors 0 and 1 are filled into a GPM list, the candidate motion vectors are required to be split into independent unidirectional prediction motion vector 0 and unidirectional prediction motion vector 1, and candidate motion vector 2 with index 1 is a unidirectional candidate motion vector and can be directly filled into the GPM list. But candidate motion vector 2 is discarded since candidate motion vector 2 and candidate motion vector 1 are repetitive. Similarly, candidate motion vector 5 in the Merge list is repeated with candidate motion vector 0, candidate motion vector 5 is discarded, candidate motion vector 7 is repeated with candidate motion vector 3, candidate motion vector 7 is discarded, and finally the GPM list shown in FIG. 5 is obtained.
It should be noted that, in the above embodiment, only a Merge list filling order after the bi-directional candidate information is reserved is provided, specifically, filling is performed according to the original Merge list order, if the bi-directional candidate motion information is unidirectional, the information in the direction is directly taken for filling, if the bi-directional prediction candidate motion information is split into two unidirectional motion information, and filling is performed sequentially.
Besides the original Merge sequence, all bi-directional prediction candidates can be used for filling, and if the candidate list is not full, the uni-directional prediction candidate filling is continuously used. Similarly, all unidirectional candidate fills may be used first, and if the candidate list is not full, then bi-prediction candidate fills may be used continuously. The present disclosure does not set any limit to the order of filling the target motion vector candidate list.
In one exemplary embodiment of the present disclosure, candidate motion vectors included in a target motion vector candidate list are acquired, rate-distortion costs corresponding to the candidate motion vectors are determined, the target candidate motion vector is determined from a plurality of candidate motion vectors according to the rate-distortion costs, and a target index corresponding to the target candidate motion vector is transmitted to a decoding end.
Wherein the candidate motion vector may be a plurality of candidate MVs currently contained in the target motion vector candidate list. The target candidate motion vector may be a motion vector having a minimum rate distortion cost among the plurality of candidate motion vectors. The target index may be a list index to which the target candidate motion vector corresponds.
After a target motion vector candidate list is constructed, GPM unidirectional prediction is carried out by using candidate motion vectors in the target motion vector candidate list, the rate distortion cost corresponding to each candidate motion vector in the list is determined, the rate distortion cost of each candidate motion vector is compared through rate distortion optimization (Rate Distortion Optimization, RDO), the candidate motion vector with the minimum cost is selected from a plurality of candidate motion vectors based on the rate distortion cost to serve as a target candidate motion vector (namely an optimal GPM Merge candidate), the target index corresponding to the target candidate motion vector is determined, and the target index is transmitted to a decoding end, so that video encoding and decoding can be carried out by adopting the motion vector with the minimum rate distortion cost in the follow-up process.
In summary, the motion vector list construction method of the present disclosure obtains a frame to be encoded, determines a current encoding unit based on the frame to be encoded, constructs an initial motion vector candidate list of the current encoding unit according to motion information of a prediction unit corresponding to the current encoding unit, wherein the motion information of the prediction unit includes unidirectional prediction motion information and bidirectional prediction motion information, determines a direction prediction type of a first candidate motion vector in the initial motion vector candidate list, constructs a target motion vector candidate list based on the direction prediction type and the first candidate motion vector, and the target motion vector candidate list is used for video encoding of the frame to be encoded. On one hand, the construction process of the GPM mode motion vector candidate list is optimized, bi-directional prediction motion information is reserved, and the bi-directional prediction motion information is sequentially added into the GPM motion vector candidate list, so that the accuracy of a prediction result is improved, and the coding cost of a motion vector is reduced. On the other hand, the constructed target motion vector candidate list is used for video coding, so that the overall coding efficiency of the video sequence can be improved. On the other hand, when the target motion vector candidate list is constructed, the candidate motion vectors are subjected to the duplicate checking treatment, so that the difference of the candidate motion vectors in the list can be ensured, and the accuracy of a subsequent rate-distortion cost calculation result is improved.
Fig. 6 is a block diagram of a motion vector list construction apparatus according to an exemplary embodiment. Referring to fig. 6, the motion vector list construction apparatus 600 includes a current coding unit determination module 610, an initial list construction module 620, a direction type determination module 630, and a target list construction module 640.
Specifically, the current coding unit determining module 610 is configured to obtain a frame to be coded, determine a current coding unit based on the frame to be coded, the initial list constructing module 620 is configured to construct an initial motion vector candidate list of the current coding unit according to motion information of a prediction unit corresponding to the current coding unit, the motion information of the prediction unit includes unidirectional prediction motion information and bidirectional prediction motion information, the direction type determining module 630 is configured to determine a direction prediction type of a first candidate motion vector in the initial motion vector candidate list, and the target list constructing module 640 is configured to construct a target motion vector candidate list based on the direction prediction type and the first candidate motion vector, where the target motion vector candidate list is used for video coding of the frame to be coded.
In one exemplary embodiment of the present disclosure, the initial list construction module 620 includes an initial list construction unit configured to obtain motion information of a prediction unit, where the motion information of the prediction unit includes a first predicted motion vector and a second predicted motion vector, obtain a preconfigured maximum length of the initial list, and construct an initial motion vector candidate list according to the maximum length of the initial list, the first predicted motion vector, and the second predicted motion vector.
In one exemplary embodiment of the present disclosure, the initial list construction unit includes a reference information determination subunit for taking a coding unit spatially adjacent to the current coding unit as a spatial prediction unit, taking a motion vector corresponding to the spatial prediction unit as a first predicted motion vector, taking a coding unit temporally adjacent to the current coding unit as a temporal prediction unit, and taking a motion vector corresponding to the spatial prediction unit as a second predicted motion vector.
In one exemplary embodiment of the present disclosure, the initial list construction unit includes an initial list construction subunit, configured to populate a first predicted motion vector and a second predicted motion vector into an initial motion vector candidate list, determine a first current list length of the initial motion vector candidate list after a motion vector population operation, and populate an assigned motion vector into the initial motion vector candidate list when the first current list length is less than a maximum initial list length until the first current list length is equal to the maximum initial list length, to obtain an initial motion vector candidate list.
In one exemplary embodiment of the present disclosure, the target list construction module 640 includes a target list construction unit for acquiring a pre-configured target list maximum length, and constructing a target motion vector candidate list according to the target list maximum length, the direction prediction type, and the first candidate motion vector.
In an exemplary embodiment of the present disclosure, the target list construction unit includes a target list construction subunit configured to take a first candidate motion vector as a second candidate motion vector when the direction prediction type is a unidirectional prediction motion vector, split the first candidate motion vector to obtain two unidirectional prediction motion vectors when the direction prediction type is a bidirectional prediction motion vector, take the obtained unidirectional prediction motion vector as the second candidate motion vector, and construct a target motion vector candidate list based on the second candidate motion vector and a maximum length of the target list.
In an exemplary embodiment of the present disclosure, the object list construction subunit is configured to perform determining an existing candidate motion vector currently existing in the object motion vector candidate list, discarding the second candidate motion vector when the second candidate motion vector is the same as the existing candidate motion vector, padding the second candidate motion vector to the object motion vector candidate list when the second candidate motion vector is different from the existing candidate motion vector, determining a second current list length of the object motion vector candidate list after the motion vector padding operation, and padding the specified motion vector into the object motion vector candidate list when the second current list length is less than the object list maximum length until the second current list length is equal to the object list maximum length, thereby obtaining the object motion vector candidate list.
In an exemplary embodiment of the present disclosure, the motion vector list construction apparatus 600 further includes a target index determining module, configured to obtain candidate motion vectors included in the target motion vector candidate list, determine a rate distortion cost corresponding to each candidate motion vector, determine a target candidate motion vector from a plurality of candidate motion vectors according to the rate distortion cost, and transmit a target index corresponding to the target candidate motion vector to a decoding end.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
An electronic device 700 according to such an embodiment of the present disclosure is described below with reference to fig. 7. The electronic device 700 shown in fig. 7 is merely an example and should not be construed to limit the functionality and scope of use of embodiments of the present disclosure in any way.
As shown in fig. 7, the electronic device 700 is embodied in the form of a general purpose computing device. The components of the electronic device 700 may include, but are not limited to, the at least one processing unit 710 described above, the at least one storage unit 720 described above, a bus 730 connecting the various system components (including the storage unit 720 and the processing unit 710), and a display unit 740.
Wherein the storage unit stores program code that is executable by the processing unit 710 such that the processing unit 710 performs steps according to various exemplary embodiments of the present disclosure described in the above-described "exemplary methods" section of the present specification.
The memory unit 720 may include readable media in the form of volatile memory units, such as Random Access Memory (RAM) 721 and/or cache memory 722, and may further include Read Only Memory (ROM) 723.
The storage unit 720 may include a program/utility 724 having a set (at least one) of program modules 725, such program modules 725 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
Bus 730 may represent one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 700 may also communicate with one or more external devices 770 (e.g., keyboard, pointing device, bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 700, and/or any device (e.g., router, modem, etc.) that enables the electronic device 700 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 750. Also, electronic device 700 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, through network adapter 760. As shown, network adapter 760 communicates with other modules of electronic device 700 over bus 730. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 700, including, but not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
In an exemplary embodiment, a computer readable storage medium is also provided, e.g., a memory, comprising instructions executable by a processor of an apparatus to perform the above-described motion vector list construction method. Alternatively, the computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
In an exemplary embodiment, a computer program product is also provided, comprising a computer program, which when executed by a processor implements the method for constructing a motion vector list according to any one of the above.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.