WO2019169949A1 - Method for generating predicted motion vector and related apparatus - Google Patents

Method for generating predicted motion vector and related apparatus Download PDF

Info

Publication number
WO2019169949A1
WO2019169949A1 PCT/CN2019/070629 CN2019070629W WO2019169949A1 WO 2019169949 A1 WO2019169949 A1 WO 2019169949A1 CN 2019070629 W CN2019070629 W CN 2019070629W WO 2019169949 A1 WO2019169949 A1 WO 2019169949A1
Authority
WO
WIPO (PCT)
Prior art keywords
motion vector
prediction
candidate motion
block
candidate
Prior art date
Application number
PCT/CN2019/070629
Other languages
French (fr)
Chinese (zh)
Inventor
陈旭
郑建铧
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2019169949A1 publication Critical patent/WO2019169949A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/157Assigned coding mode, i.e. the coding mode being predefined or preselected to be further used for selection of another element or parameter
    • H04N19/159Prediction type, e.g. intra-frame, inter-frame or bidirectional frame prediction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/513Processing of motion vectors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/513Processing of motion vectors
    • H04N19/517Processing of motion vectors by encoding
    • H04N19/52Processing of motion vectors by encoding by predictive encoding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/56Motion estimation with initialisation of the vector search, e.g. estimating a good candidate to initiate a search
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/567Motion estimation based on rate distortion criteria
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/573Motion compensation with multiple frame prediction using two or more reference frames in a given prediction direction

Definitions

  • the present invention relates to the field of video codec, and more particularly to a method for predicting motion vector generation and related devices.
  • hybrid coding structures are commonly used for encoding and decoding video sequences.
  • the coding end of the hybrid coding structure generally includes: a prediction module, a transformation module, a quantization module, and an entropy coding module;
  • the decoding end of the hybrid coding structure generally includes: an entropy decoding module, an inverse quantization module, an inverse transform module, and a prediction compensation module.
  • images of a video sequence are typically divided into image blocks for encoding. A frame of image is divided into blocks of images that are encoded and decoded using the above modules. The combination of these encoding and decoding modules can effectively remove redundant information of the video sequence and ensure that the encoded image of the video sequence is obtained at the decoding end.
  • the prediction module is used by the encoding end to obtain the prediction block information of the image block of the video sequence coded image, and further determines whether the residual of the image block needs to be obtained according to the specific mode, and the prediction compensation module is used by the decoding end to obtain the current decoded image block.
  • the prediction block information is further determined according to a specific mode whether the current decoded image block is obtained according to the decoded image block residual.
  • the prediction module usually includes two techniques of intra prediction and inter prediction.
  • the intra prediction technique uses the spatial pixel information of the current image block to remove redundant information of the current image block to obtain a residual.
  • the advanced motion vector prediction (AMVP) mode of the inter prediction technique and the non-SKIP mode in the merge mode (Merge) mode use the pixel information of the coded image adjacent to the current image to remove the current image block (referred to as the current block for short).
  • the redundant information obtains the residual, and the SKIP mode in the merge mode does not depend on the image block residual, and the current decoded image block can be obtained directly according to the predicted block information.
  • the coded image adjacent to the current image is referred to as a reference image.
  • the motion vectors of neighboring blocks in the time domain or the air domain are directly used as candidate MVs in the candidate list created by them.
  • the motion of the neighboring block does not necessarily coincide with the current block, that is, the motion vector of the neighboring block may be different from the actual motion vector of the current block, so the current block may not obtain the best reference based directly on these candidate mvs. Image block.
  • the embodiment of the present invention provides a method for generating a motion vector and a related device.
  • the embodiment of the present invention is implemented to facilitate obtaining the best reference image block of the current block in the codec process, and then constructing a reconstructed block with the current block.
  • an embodiment of the present invention provides a method for generating a motion vector predictor, the method comprising: constructing a candidate motion vector set of a block to be processed; and determining at least two according to a first candidate motion vector in the candidate motion vector set.
  • First reference motion vectors the first reference motion vectors are used to determine a reference block of the to-be-processed block in a first reference image of the to-be-processed block; respectively calculating at least two of the determined reference blocks a pixel difference value or rate-distortion value between one or more first neighbor reconstructed blocks and one or more second neighbor reconstructed blocks of the block to be processed, wherein The first adjacent reconstructed block and the second adjacent reconstructed block have the same shape and the same size; according to the pixel difference value or the rate distortion value of the at least two first reference motion vectors is the smallest A first reference motion vector obtains a first predicted motion vector of the to-be-processed block.
  • the candidate motion vector set may include a plurality of candidate motion vectors of the current block, and the candidate motion vector may be referred to as a candidate predicted motion vector.
  • the candidate motion vector may further include a plurality of candidate motion vectors of the current block.
  • Reference image information is a Merge candidate list constructed based on the Merge mode, or an AMVP candidate list constructed based on the AMVP mode.
  • the candidate motion vector set of the current block may be constructed according to a preset rule, for example, according to a neighboring block in the current block airspace, or a time domain reference block corresponding to the current block, or a neighboring block adjacent to the current block.
  • the predicted motion vectors of the corresponding time domain reference blocks are used as candidate motion vectors, and the candidate list is constructed based on the candidate Merge mode or the AMVP mode based on the candidate motion vectors.
  • the candidate motion vectors in the candidate list are also updated based on the template matching manner.
  • the template matching process in the embodiment of the present invention specifically includes: selecting a first candidate motion vector in the candidate list, where the first candidate motion vector represents a reference block in the current image to the reference image block in the first reference image (referred to as a reference block for short) Predicted motion vector.
  • Determining a search range in the first reference image performing a search around the first reference block according to the search range, obtaining at least one first reference image block (which may be simply referred to as a reference block, but for the candidate motion vector)
  • the determined reference block is differentiated, which may also be referred to simply as an image block, and the current block determines a motion vector to each of the first image blocks, and the motion vector is a reference motion vector. That is, based on the first candidate motion vector, at least two first reference motion vectors may be determined: one of the reference motion vectors is the first candidate motion vector itself determined by the reference block, and the other at least one first
  • the reference motion vector is a reference motion vector determined by the at least one image block.
  • the at least one (specifically, two or more) first image blocks may be used.
  • An image block having the smallest pixel value or rate distortion generation value is determined, and a reference motion vector corresponding to the image block is used as a new candidate motion vector.
  • the decoding end may directly use the new candidate motion vector as the predicted motion vector to obtain the prediction block of the current block (for unidirectional prediction, The prediction block is the reconstructed block of the current block; for bidirectional prediction, the prediction block can be used for the reconstructed block that ultimately constitutes the current block).
  • the new candidate motion vector may be replaced with the candidate motion vector selected in the template matching stage in the replacement candidate list, thereby implementing the update of the candidate list.
  • the encoding end may traverse all the candidate motion vectors in the list according to the rate distortion generation value based on the updated candidate list, and determine an optimal candidate motion vector as the predicted motion vector of the current block (for example, based on the Merge candidate list).
  • the predicted motion vector is the optimal MV
  • the predicted motion vector obtained based on the AMVP candidate list is the optimal MVP
  • the predicted block of the current block is obtained based on the predicted motion vector (for the unidirectional prediction, the prediction block is the weight of the current block) Construction block; for bidirectional prediction, the prediction block can be used to finally form a reconstructed block of the current block).
  • the video codec system can verify whether the adjacent reconstructed block of the reference image block in a certain range (or even the entire reference image) in the reference image of the current block is compared with the template matching manner.
  • the neighboring reconstructed block of the current block has a good match, and the candidate motion vector of the candidate list constructed based on the Merge or AMVP mode is updated, and the updated candidate list can ensure the best of the current block in the encoding and decoding process.
  • the reference image block is used to construct an accurate block of the current block.
  • the decoding end in addition to a motion vector that can directly minimize the pixel difference value or the rate distortion generation value (the candidate motion vector selected by the template matching or the reference corresponding to the image block)
  • the motion vector is directly used as the predicted motion vector. If one of the pixel difference values or the rate distortion generation value is the reference motion vector corresponding to a certain image block, the reference motion vector may be replaced by the template matching candidate list.
  • the selected candidate motion vector and (based on the index value), determines the replaced candidate motion vector (ie, the reference motion vector) as the predicted motion vector.
  • the method may be used by a decoding end, where the decoding end parses the code stream to obtain identification information and/or a candidate list before constructing the candidate motion vector set of the to-be-processed block.
  • An index value is determined based on the identification information and/or the index value to establish a candidate list based on which prediction mode (eg, Merge mode or AMVP mode), and which candidate motion vector in the candidate list is updated in template matching.
  • prediction mode eg, Merge mode or AMVP mode
  • the decoding end may obtain identification information (such as an identifier bit in the code stream code) and an index value of the candidate list by parsing the code stream.
  • the identifier information is used to indicate that the candidate motion vector set is constructed based on a Merge mode or an AMVP mode, and the index value is used to indicate a specific candidate motion vector in the candidate list. Therefore, the decoding end can quickly determine the prediction mode based on the identification information, and quickly select the candidate motion vector based on the index value to update using the template matching manner (or directly select the candidate motion vector as the predicted motion vector based on the index value to calculate the prediction. Block) to improve decoding efficiency.
  • the identification information (for example, the identifier bit in the code stream code) can be used to indicate the prediction mode used by the decoding current block, and can also be used to indicate the candidate constructed based on the prediction mode.
  • the index value of the list Specifically, when the identifier information is used to indicate that the prediction mode is the Merge mode, and is used to indicate the index information of the Merge mode, or when the identifier information is used to indicate that the prediction mode is the AVMP mode, Index information used to indicate the AMVP mode.
  • the decoding end can quickly determine the prediction mode based on the identification information, and quickly select the candidate motion vector to update by using template matching (or directly select the candidate motion vector as the predicted motion vector based on the indicated index value to calculate Prediction block) to improve decoding efficiency.
  • the identifier information (for example, an identifier bit in the code stream code) is used to indicate a prediction mode used by decoding the current block, and when the prediction mode indicated by the identifier information is an AMVP mode, The index value of the AMVP candidate list is simultaneously indicated; when the prediction mode indicated by the identifier information is the Merge mode, the decoding end uses the index value of the preset Merge mode. Therefore, the decoding end can quickly determine the prediction mode and determine the candidate motion vector based on the identification information, and use the template matching in the first candidate motion vector (or other pre-specified candidate motion vector) of the quick candidate list in the Merge mode. The way to update (or directly select the specified candidate motion vector as the predicted motion vector to calculate the prediction block), improve the decoding efficiency.
  • the prediction mode indicated by the identifier information is an AMVP mode
  • the index value of the AMVP candidate list is simultaneously indicated; when the prediction mode indicated by the identifier information is the Merge mode, the decoding end uses the index value of the preset Merge mode. Therefore
  • the decoding may obtain at least two pieces of identification information, one identification information is used to indicate that one direction adopts the Merge mode, and another identification information is used.
  • the AMVP mode is used to indicate the other direction.
  • one identification information is used to indicate that one direction adopts the Merge mode and an index value indicating the Merge candidate list
  • the other identification information is used to indicate that the other direction adopts the AMVP mode and the index value indicating the AMVP candidate list. Therefore, the decoding end can quickly determine the prediction mode based on the two identification information in the bidirectional prediction, and quickly select the candidate motion vector to update by using template matching (or directly select the candidate motion vector based on the indicated index value).
  • the prediction block is calculated as a predicted motion vector), and the decoding efficiency is improved.
  • the decoding may obtain at least two combinations ⁇ first identification information, An index value ⁇ , ⁇ second identification information, a second index value ⁇ , wherein in the ⁇ first identification information, the first index value ⁇ , the first identification information represents a prediction mode in a first direction, and the first index value represents the first In the index value of the candidate list in one direction; in the second identifier information, the second index value, the second identifier information indicates the prediction mode in the second direction, and the second index value indicates the index value of the candidate list in the second direction.
  • the decoding end can quickly determine the prediction modes in different directions in the bidirectional prediction based on the two combinations ⁇ first identification information, the first index value ⁇ , the ⁇ second identification information, the second index value ⁇ , and select the candidates in the candidate list.
  • the candidate motion vector is updated by using template matching (or the candidate motion vector is directly selected as the predicted motion vector based on the index value to calculate the prediction block of the corresponding direction), thereby improving the decoding efficiency.
  • the decoding end may also obtain an index value of the candidate list by parsing the code stream, and the index value of the candidate list may be used to indicate the prediction mode used for decoding the current block, and may also be used to indicate A specific candidate motion vector of the candidate list constructed based on the prediction mode. Therefore, the decoding end can quickly determine the prediction mode based on the index value of the candidate list, and quickly select the candidate motion vector to update using the template matching manner (or directly select the candidate motion vector as the predicted motion vector based on the index value to calculate the prediction block. ), improve decoding efficiency.
  • the bidirectional prediction includes a first direction prediction and a second direction prediction, where the first direction prediction is based on a prediction of a first reference frame list, and the second direction prediction is based on a second reference. Prediction of the frame list.
  • the first reference frame list includes the first reference image
  • the second reference frame list includes a second reference image.
  • the prediction in one direction may also be referred to as forward prediction, and the prediction in another direction. Referred to as backward prediction.
  • the bidirectional prediction involved in the embodiments of the present invention includes at least two types.
  • One type is bidirectional prediction based on a hybrid prediction mode, and the other type is bidirectional prediction based on a prediction mode.
  • the hybrid prediction mode includes the Merge mode and the AMVP mode, that is, one direction of the bidirectional prediction adopts the Merge mode, and the other direction adopts the AMVP mode.
  • each direction can obtain a predicted motion vector, and then a prediction block is obtained based on the predicted motion vector, and finally the prediction blocks in the two directions are combined by a preset algorithm (for example, an algorithm for performing weighted averaging). To get the reconstructed block of the current block.
  • a preset algorithm for example, an algorithm for performing weighted averaging.
  • the two directions respectively adopt a prediction mode, wherein one direction (first direction) independently implements update of the candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the first
  • the predicted motion vector of the direction the other direction (the second direction) independently obtains the predicted motion vector of the second direction directly based on the constructed candidate list (ie, no template matching is performed).
  • the two directions respectively adopt a prediction mode, wherein one direction (first direction) independently implements update of the candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the first
  • the predicted motion vector of the direction the other direction (the second direction) also independently implements the update of the candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the predicted motion vector of the second direction.
  • the two directions respectively adopt a prediction mode, and one direction (such as the first direction) independently implements update of the candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the first
  • the predicted motion vector in one direction, and the other direction (such as the second direction) cooperatively uses the difference between the candidate motion vector in the first direction to update the candidate motion vector in the candidate list constructed in the second direction, and further A predicted motion vector in the second direction is obtained.
  • the implementation process of the second direction prediction includes: calculating a difference between the replaced first direction candidate motion vector and the first direction candidate motion vector before the replacement; and selecting, according to the difference value and the second direction candidate motion vector set
  • the second direction candidate motion vector in the second direction obtains a new candidate motion vector in the second direction, and replaces the new candidate motion vector in the second direction with the original candidate motion vector in the second direction in the candidate motion vector set to implement the second direction
  • the candidate motion vectors in the constructed candidate list are updated to obtain a predicted motion vector in the second direction.
  • the hybrid prediction mode provided by the embodiment of the present invention can also ensure that the best reference block of the current block is obtained in the codec process, and the codec efficiency is improved while ensuring that the best reference block of the current block is obtained.
  • a unidirectional prediction mode may be a Merge mode or an AMVP mode, based on which a candidate list for bidirectional prediction is included, the candidate list including candidate motion vector sums for first direction prediction Candidate motion vector for second direction prediction.
  • the process of obtaining the predicted motion vector in each direction may be the same or different; it may be independent or coordinated.
  • one of the directions independently implements the update of the first direction candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the predicted motion vector of the first direction
  • One direction independently obtains the predicted motion vector of the second direction based on the constructed candidate list (ie, no template matching is performed).
  • one of the directions independently implements the update of the first direction candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the predicted motion vector of the first direction
  • One direction also independently implements the update of the second candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the predicted motion vector of the second direction.
  • the two directions respectively adopt a prediction mode, and one direction (such as the first direction) independently implements update of the candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the first
  • the predicted motion vector in one direction, the other direction (such as the second direction) cooperatively uses the difference before and after the update of the first direction candidate motion vector, and updates the motion vector selected in the second direction to obtain the predicted motion vector in the second direction.
  • the implementation process of the second direction prediction includes: calculating a difference between the replaced first direction candidate motion vector and the first direction candidate motion vector before the replacement; according to the difference and the candidate motion vector set a second direction candidate motion vector, obtaining a new candidate motion vector in the second direction, and replacing the new candidate motion vector in the second direction with the original candidate motion vector in the second direction of the candidate motion vector set, to implement the second direction
  • the candidate motion vectors in the constructed candidate list are updated to obtain a predicted motion vector in the second direction.
  • the update of the candidate motion vector in another direction can be implemented based on the update result in one direction, thereby greatly improving the efficiency in the encoding and decoding process.
  • the manner in which the decoding end (or the encoding end) selects (the first direction) the first candidate motion vector from the candidate motion vector set may be various, including:
  • Manner 1 When the fourth candidate motion vector in the candidate motion vector set is generated by the second direction prediction, the fourth candidate motion vector is reduced or enlarged according to a proportional relationship to obtain the first candidate motion vector.
  • the proportional relationship includes a ratio of a first timing difference and a second timing difference, the first timing difference being an image sequence number of the reference image frame determined by the first candidate motion vector and the to-be-processed block a difference between image sequence numbers of the image frames in which the second time difference is an image sequence number of the reference image frame determined by the fourth candidate motion vector and an image sequence number of the image frame in which the to-be-processed block is located The difference.
  • the candidate motion vector selected from the previous (post) prediction is obtained by post- (or forward) prediction
  • the candidate motion vector for the pre- (post) prediction can be obtained by mapping as the selected one.
  • the candidate motion vector values are applied to subsequent steps.
  • Manner 2 determining, when the first candidate motion vector is generated by the bidirectional prediction, the at least two first reference motion vectors according to the fifth candidate motion vector, wherein the reference of the first candidate motion vector determination The block is obtained by weighting a first direction reference block determined according to the fifth candidate motion vector and a second direction reference block determined according to the sixth candidate motion vector, the fifth candidate motion vector being predicted by the first direction Generating, the sixth candidate motion vector is generated by the second direction prediction.
  • the candidate motion vector selected from the previous (or later) prediction is obtained by bidirectional prediction
  • the value of the candidate motion vector for the front (or back) prediction portion is selected as the selected one.
  • the candidate motion vector values are applied to subsequent steps.
  • the candidate motion vector is directly used as the selected candidate motion vector value to be applied to the subsequent step.
  • the manner of selecting the second candidate motion vector (the second direction) from the candidate motion vector set may also be multiple, and may be implemented by referring to the foregoing manner, and details are not described herein again.
  • the implementation of the above embodiment of the present invention can improve the accuracy and fault tolerance of the candidate motion vector selection process, thereby improving the accuracy and fault tolerance in the template matching process.
  • determining the at least two first reference motion vectors according to the first candidate motion vector in the candidate motion vector set including: according to the first candidate motion vector, a reference block of the to-be-processed block determined in the first reference image; searching at a neighboring position of the determined reference block with a target precision to obtain at least two candidate reference blocks, wherein each of the candidate reference blocks corresponds to one
  • the first reference motion vector, the target accuracy includes one of 4 pixel precision, 2 pixel precision, integer pixel precision, half pixel precision, 1/4 pixel precision, and 1/8 pixel precision.
  • the at least one adjacent reconstructed block of the current block, the at least one adjacent reconstructed block of the reference block, and the at least one adjacent reconstructed block of the image block have the same shape and The dimensions are equal.
  • At least one adjacent reconstructed block of the current block has a positional relationship 1 with the current block (eg, adjacent or close to an adjacency relationship within a certain range), at least one adjacent reconstructed block and a reference block of the reference block Having a positional relationship 2 (such as adjacent or close to a neighboring relationship within a certain range), at least one adjacent reconstructed block of the image block has a positional relationship 3 with the image block (eg, adjacent or close within a certain range)
  • the adjacency relationship, then, the positional relationship 1, the positional relationship 2, and the positional relationship 3 may be the same. However, in a possible embodiment, the positional relationship 1, the positional relationship 2, and the positional relationship 3 may also differ.
  • an embodiment of the present invention provides a method for generating a motion vector predictor, where the method may be used for bidirectional prediction in a hybrid prediction mode, where the hybrid prediction mode includes a Merge mode and an AMVP mode.
  • the bidirectional prediction includes a first direction prediction based on a prediction of a first reference frame list and a second direction prediction based on a prediction of a second reference frame list, the method The method includes: acquiring a first prediction mode, generating a first candidate motion vector set, where the first candidate motion vector set is used to generate a first direction prediction motion vector in the first direction prediction; acquiring a second prediction mode, generating a a second candidate motion vector set for generating a second direction prediction motion vector in the second direction prediction, wherein when the first prediction mode is an AMVP mode, the second The prediction mode is the Merge mode, or when the first prediction mode is the Merge mode, the second prediction mode is the AMVP mode.
  • the hybrid prediction mode provided by the embodiment of the present invention is a novel codec mode, and the hybrid prediction mode can also ensure that the best reference block of the current block is obtained in the codec process, and the best reference block of the current block is obtained. Improve the efficiency of codec in case.
  • the acquiring the first prediction mode, generating the first candidate motion vector set includes: using the Merge mode at the first The candidate motion vector used in the direction prediction generates the first candidate motion vector set.
  • the acquiring the first prediction mode, generating the first candidate motion vector set includes: using the AMVP mode at the first The candidate motion vector used in the direction prediction generates the first candidate motion vector set.
  • the acquiring the second prediction mode, generating the second candidate motion vector set includes: using the Merge mode in the second The candidate prediction vector used in the direction prediction generates the second candidate motion vector set.
  • the acquiring the second prediction mode, generating the second candidate motion vector set includes: using the AMVP mode in the second The candidate motion vector used in the direction prediction generates the second candidate motion vector set.
  • the codec end adopts a hybrid prediction mode, and then decoding may obtain at least two pieces of identification information, one identification information is used to indicate that one direction adopts the Merge mode, and another identification information is used for Indicates that the other direction uses AMVP mode.
  • one identification information is used to indicate that one direction adopts the Merge mode and an index value indicating the Merge candidate list, and the other identification information is used to indicate that the other direction adopts the AMVP mode and the index value indicating the AMVP candidate list. Therefore, the decoding end can quickly determine the prediction mode based on the two identification information in the bidirectional prediction, and quickly select the candidate motion vector to update by using template matching (or directly select the candidate motion vector based on the indicated index value).
  • the prediction block is calculated as a predicted motion vector), and the decoding efficiency is improved.
  • the codec end adopts a hybrid prediction mode (that is, the Merge mode and the AMVP mode are respectively adopted in different directions), then the decoding obtains at least two combinations ⁇ first identification information, first Index value ⁇ , ⁇ second identification information, second index value ⁇ , wherein in the ⁇ first identification information, the first index value ⁇ , the first identification information represents a prediction mode in the first direction, and the first index value represents the first In the index value of the candidate list of directions; in the second identifier information, the second index value, the second identifier information indicates a prediction mode in the second direction, and the second index value indicates an index value of the candidate list in the second direction.
  • a hybrid prediction mode that is, the Merge mode and the AMVP mode are respectively adopted in different directions
  • the decoding end can quickly determine the prediction modes in different directions in the bidirectional prediction based on the two combinations ⁇ first identification information, the first index value ⁇ , the ⁇ second identification information, the second index value ⁇ , and select the candidates in the candidate list.
  • the candidate motion vector is updated by using template matching (or the candidate motion vector is directly selected as the predicted motion vector based on the index value to calculate the prediction block of the corresponding direction), thereby improving the decoding efficiency.
  • the first identifier information when the first identifier information is used to indicate that the first prediction mode is the Merge mode, the first identifier information is further used to indicate index information of the Merge mode, or when the first identifier information is used by The first identifier information is further used to indicate index information of the AMVP mode when the first prediction mode is indicated as the AVMP mode.
  • the identifier information (the first identifier information or the second identifier information) is used to indicate a prediction mode used by the decoding current block, and when the prediction mode indicated by the identifier information is AMVP In the mode, the index value of the AMVP candidate list is simultaneously indicated; when the prediction mode indicated by the identifier information is the Merge mode, the decoding end may use the index value of the preset Merge mode. Therefore, the decoding end can quickly determine the prediction mode and determine the candidate motion vector based on the identification information, and use the template matching in the first candidate motion vector (or other pre-specified candidate motion vector) of the quick candidate list in the Merge mode. The way to update (or directly select the specified candidate motion vector as the predicted motion vector to calculate the prediction block), improve the decoding efficiency.
  • the method before the acquiring the second prediction mode and generating the second candidate motion vector set, the method further includes: after determining that the first prediction mode is the Merge mode, parsing the code stream to obtain the second identifier. Information, the second identification information is used to indicate index information of the AMVP mode.
  • the method before the acquiring the second prediction mode and generating the second candidate motion vector set, the method further includes: after determining that the first prediction mode is the AMVP mode, parsing the code stream to obtain the second identifier. Information, the second identification information is used to indicate index information of the Merge mode.
  • the decoding end determines that the first prediction mode is the AMVP mode, parsing the code stream to obtain the reference frame index and the motion vector difference information of the first direction prediction; or After determining that the second prediction mode is the AMVP mode, parsing the code stream to obtain the reference frame index and motion vector difference information of the second direction prediction.
  • the codec end in the bidirectional prediction may use the template matching manner provided by the embodiment of the present invention to update the candidate list.
  • the specific process refers to the description of the first aspect, and details are not described herein again.
  • an embodiment of the present invention provides an apparatus for generating a predicted motion vector, where the apparatus includes: a set generation module, configured to construct a candidate motion vector set of a block to be processed; and a template matching module, configured to Determining, by the first candidate motion vector in the set of candidate motion vectors, at least two first reference motion vectors, the first reference motion vector being used to determine that the to-be-processed block is in a first reference image of the to-be-processed block a reference block; the template matching module is further configured to separately calculate one or more first neighbor reconstructed blocks of the at least two determined reference blocks and one or more second neighbors of the to-be-processed block Reconstructing a pixel difference value or a rate distortion generation value between the blocks, wherein the first adjacent reconstructed block and the second adjacent reconstructed block have the same shape and the same size; the predicted motion vector generation module uses Obtaining the to-be-processed block according to a corresponding one of the at least two first reference motion vectors and
  • an embodiment of the present invention provides another apparatus for generating a predicted motion vector, where the apparatus is configured to perform bidirectional prediction of a to-be-processed block, where the bidirectional prediction includes a first direction prediction and a second direction prediction, where The first direction prediction is based on the prediction of the first reference frame list, and the second direction prediction is based on the prediction of the second reference frame list, the device comprising: a first set generation module, configured to acquire the first prediction mode, Generating a first candidate motion vector set, the first candidate motion vector set is used to generate a first direction prediction motion vector in the first direction prediction, and a second set generation module is configured to acquire a second prediction mode, generate a first a second candidate motion vector set for generating a second direction prediction motion vector in the second direction prediction, wherein when the first prediction mode is an AMVP mode, the second The prediction mode is the Merge mode, or when the first prediction mode is the Merge mode, the second prediction mode is the AMVP mode.
  • the various modules in the device are specifically for implementing
  • an embodiment of the present invention provides an apparatus for generating a predicted motion vector, where the apparatus includes: the device may be applied to an encoding side, or may be applied to a decoding side.
  • the device includes a processor, a memory, and the memory are connected (e.g., connected to each other through a bus).
  • the device may further include a transceiver, the transceiver is coupled to the processor and the memory, for receiving /send data.
  • the memory is used to store program code and video data.
  • the processor can be configured to read the program code stored in the memory and perform the method described in the first aspect.
  • the embodiment of the present invention provides another device for generating a predicted motion vector, where the device includes: the device may be applied to the encoding side, or may be applied to the decoding side.
  • the device includes a processor, a memory, and the memory are connected (e.g., connected to each other through a bus).
  • the device may further include a transceiver, the transceiver is coupled to the processor and the memory, for receiving /send data.
  • the memory is used to store program code and video data.
  • the processor can be configured to read the program code stored in the memory and perform the method described in the second aspect.
  • an embodiment of the present invention provides a video codec system, where the video codec system includes a source device and a destination device.
  • the source device and the destination device can be in a communicative connection.
  • the source device produces encoded video data. Therefore, the source device may be referred to as a video encoding device or a video encoding device.
  • the destination device can decode the encoded video data produced by the source device. Thus, the destination device may be referred to as a video decoding device or a video decoding device.
  • the source device and the destination device may be instances of a video codec device or a video codec device.
  • the method described in the first aspect and/or the second aspect may be applied to the video codec device or video codec device, that is, the video codec system may be used to implement the first aspect and/or the second aspect. The method described.
  • an embodiment of the present invention provides a computer readable storage medium, wherein the computer readable storage medium stores instructions that, when run on a computer, cause the computer to perform the method described in the first aspect above.
  • an embodiment of the present invention provides a computer readable storage medium, wherein the computer readable storage medium stores instructions that, when run on a computer, cause the computer to perform the method described in the second aspect above.
  • an embodiment of the present invention provides a computer program product comprising instructions, which when executed on a computer, cause the computer to perform the method described in the first aspect above.
  • an embodiment of the present invention provides a computer program product comprising instructions that, when run on a computer, cause the computer to perform the method of the second aspect described above.
  • the video codec system can verify whether the adjacent reconstructed block of the reference image block in a certain range (or even the entire reference image) in the reference image of the current block is compared with the template matching manner.
  • the neighboring reconstructed block of the current block has a good match, and the candidate motion vector of the candidate list constructed based on the Merge or AMVP mode is updated, and the updated candidate list can ensure the best of the current block in the encoding and decoding process.
  • the reference image block is used to construct an accurate block of the current block.
  • the embodiment of the present invention further provides a hybrid prediction mode, and based on the hybrid prediction mode, it may also be able to obtain an optimal reference block of the current block in the coding and decoding process, and improve in the case of ensuring that the best reference block of the current block is obtained.
  • the efficiency of codec is also able to obtain an optimal reference block of the current block in the coding and decoding process, and improve in the case of ensuring that the best reference block of the current block is obtained. The efficiency of codec.
  • FIG. 1 is a schematic structural diagram of a codec system according to an embodiment of the present invention.
  • FIG. 2 is a schematic block diagram of a video codec device or an electronic device according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a terminal according to an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of an AMVP candidate list according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a merge candidate list according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of still another AMVP candidate list according to an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of still another merge candidate list according to an embodiment of the present invention.
  • FIG. 8 is a schematic diagram of a scenario of a template matching manner according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic diagram of another scenario of a template matching manner according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic diagram of a codec process of a Merge mode according to an embodiment of the present invention.
  • FIG. 11 is a schematic diagram of a codec process of another Merge mode according to an embodiment of the present invention.
  • FIG. 12 is a schematic diagram of a codec process of an AMVP mode according to an embodiment of the present invention.
  • FIG. 13 is a schematic diagram of another encoding and decoding process of an AMVP mode according to an embodiment of the present invention.
  • 25-28 are schematic structural diagrams of some devices provided by an embodiment of the present invention.
  • FIG. 1 is a schematic block diagram of a video codec system 10 according to an embodiment of the present invention.
  • video codec system 10 includes source device 12 and destination device 14.
  • Source device 12 produces encoded video data.
  • source device 12 may be referred to as a video encoding device or a video encoding device.
  • Destination device 14 may decode the encoded video data produced by source device 12.
  • destination device 14 may be referred to as a video decoding device or a video decoding device.
  • Source device 12 and destination device 14 may be examples of video codec devices or video codec devices.
  • Source device 12 and destination device 14 may include a wide range of devices including desktop computers, mobile computing devices, notebook (eg, laptop) computers, tablet computers, set top boxes, smart phones, etc., televisions, cameras, display devices , digital media player, video game console, on-board computer, or the like.
  • Channel 16 may include one or more media and/or devices capable of moving encoded video data from source device 12 to destination device 14.
  • channel 16 may include one or more communication media that enable source device 12 to transmit encoded video data directly to destination device 14 in real time.
  • source device 12 may modulate the encoded video data in accordance with a communication standard (eg, a wireless communication protocol) and may transmit the modulated video data to destination device 14.
  • the one or more communication media may include wireless and/or wired communication media, such as a radio frequency (RF) spectrum or one or more physical transmission lines.
  • RF radio frequency
  • the one or more communication media may form part of a packet-based network (eg, a local area network, a wide area network, or a global network (eg, the Internet)).
  • the one or more communication media may include routers, switches, base stations, or other devices that facilitate communication from source device 12 to destination device 14.
  • channel 16 can include a storage medium that stores encoded video data generated by source device 12.
  • destination device 14 can access the storage medium via disk access or card access.
  • the storage medium may include a variety of locally accessible data storage media, such as Blu-ray Disc, DVD, CD-ROM, flash memory, or other suitable digital storage medium for storing encoded video data.
  • channel 16 can include a file server or another intermediate storage device that stores encoded video data generated by source device 12.
  • destination device 14 may access the encoded video data stored at a file server or other intermediate storage device via streaming or download.
  • the file server may be a server type capable of storing encoded video data and transmitting the encoded video data to the destination device 14.
  • the instance file server includes a web server (eg, for a website), a file transfer protocol (FTP) server, a network attached storage (NAS) device, and a local disk drive.
  • FTP file transfer protocol
  • NAS network attached storage
  • Destination device 14 can access the encoded video data via a standard data connection (e.g., an internet connection).
  • a standard data connection e.g., an internet connection.
  • An instance type of a data connection includes a wireless channel (eg, a Wi-Fi connection), a wired connection (eg, DSL, cable modem, etc.), or both, suitable for accessing encoded video data stored on a file server. combination.
  • the transmission of the encoded video data from the file server may be streaming, downloading, or a combination of both.
  • the technology of the present invention is not limited to a wireless application scenario.
  • the technology can be applied to video codecs supporting multiple multimedia applications such as aerial television broadcasting, cable television transmission, satellite television transmission, and streaming video. Transmission (eg, via the Internet), encoding of video data stored on a data storage medium, decoding of video data stored on a data storage medium, or other application.
  • video codec system 10 may be configured to support one-way or two-way video transmission to support applications such as video streaming, video playback, video broadcasting, and/or video telephony.
  • source device 12 includes a video source 18, a video encoder 20, and an output interface 22.
  • output interface 22 can include a modulator/demodulator (modem) and/or a transmitter.
  • Video source 18 may include a video capture device (eg, a video camera), a video archive containing previously captured video data, a video input interface to receive video data from a video content provider, and/or a computer for generating video data.
  • the video encoder 20 may encode video data from the video source 18. Specifically, the video encoder 20 is provided with a prediction module, a transform module, a quantization module, an entropy encoding module, and the like. In some examples, source device 12 transmits the encoded video data directly to destination device 14 via output interface 22. The encoded video data may also be stored on a storage medium or file server for later access by the destination device 14 for decoding and/or playback.
  • destination device 14 includes an input interface 28, a video decoder 30, and a display device 32.
  • input interface 28 includes a receiver and/or a modem.
  • Input interface 28 can receive the encoded video data via channel 16.
  • the video decoder 30 is configured to decode the code stream (video data) received by the input interface 28.
  • the video decoder 30 is provided with an entropy decoding module, an inverse quantization module, an inverse transform module, a prediction compensation module, and the like.
  • Display device 32 may be integral with destination device 14 or may be external to destination device 14. In general, display device 32 displays the decoded video data.
  • Display device 32 may include a variety of display devices such as liquid crystal displays (LCDs), plasma displays, organic light emitting diode (OLED) displays, or other types of display devices.
  • LCDs liquid crystal displays
  • OLED organic light emitting diode
  • Video encoder 20 and video decoder 30 may operate in accordance with a video compression standard (eg, the High Efficiency Video Codec H.265 standard) and may conform to the HEVC Test Model (HM).
  • a video compression standard eg, the High Efficiency Video Codec H.265 standard
  • HM HEVC Test Model
  • a textual description of the H.265 standard is published on April 29, 2015, ITU-T.265(V3) (04/2015), available for download from http://handle.itu.int/11.1002/1000/12455 The entire contents of the document are incorporated herein by reference.
  • FIG. 2 is a schematic block diagram of a video codec device or electronic device 50 according to an embodiment of the present invention.
  • the device or electronic device 50 may incorporate a codec according to an embodiment of the present invention.
  • FIG. 3 is a schematic structural diagram of an apparatus for video encoding according to an embodiment of the present invention. The units in Figures 2 and 3 will be explained below.
  • the electronic device 50 can be, for example, a mobile terminal or user equipment of a wireless communication system. It should be understood that embodiments of the invention may be practiced in any electronic device or device that may require encoding and decoding, or encoding, or decoding of a video image.
  • Device 50 can include a housing 30 for incorporating and protecting the device.
  • Device 50 may also include display 32 in the form of a liquid crystal display.
  • the display may be any suitable display technology suitable for displaying images or video.
  • Device 50 may also include a keypad 34.
  • any suitable data or user interface mechanism may be utilized.
  • the user interface can be implemented as a virtual keyboard or data entry system as part of a touch sensitive display.
  • the device may include a microphone 36 or any suitable audio input, which may be a digital or analog signal input.
  • the apparatus 50 may also include an audio output device, which in an embodiment of the invention may be any of the following: an earphone 38, a speaker, or an analog audio or digital audio output connection.
  • Device 50 may also include battery 40, and in other embodiments of the invention, the device may be powered by any suitable mobile energy device, such as a solar cell, fuel cell, or clock mechanism generator.
  • the device may also include an infrared port 42 for short-range line of sight communication with other devices.
  • device 50 may also include any suitable short range communication solution, such as a Bluetooth wireless connection or a USB/Firewire wired connection.
  • Device 50 may include a controller 56 or processor for controlling device 50.
  • Controller 56 may be coupled to memory 58, which may store data in the form of images and audio in an embodiment of the invention, and/or may also store instructions for execution on controller 56.
  • Controller 56 may also be coupled to codec circuitry 54 suitable for implementing encoding and decoding of audio and/or video data or assisted encoding and decoding by controller 56.
  • the apparatus 50 may also include a card reader 48 and a smart card 46, such as a UICC and a UICC reader, for providing user information and for providing authentication information for authenticating and authorizing users on the network.
  • a card reader 48 and a smart card 46 such as a UICC and a UICC reader, for providing user information and for providing authentication information for authenticating and authorizing users on the network.
  • Apparatus 50 may also include a radio interface circuit 52 coupled to the controller and adapted to generate, for example, a wireless communication signal for communicating with a cellular communication network, a wireless communication system, or a wireless local area network. Apparatus 50 may also include an antenna 44 coupled to radio interface circuitry 52 for transmitting radio frequency signals generated at radio interface circuitry 52 to other apparatus(s) and for receiving radio frequency signals from other apparatus(s).
  • a radio interface circuit 52 coupled to the controller and adapted to generate, for example, a wireless communication signal for communicating with a cellular communication network, a wireless communication system, or a wireless local area network.
  • Apparatus 50 may also include an antenna 44 coupled to radio interface circuitry 52 for transmitting radio frequency signals generated at radio interface circuitry 52 to other apparatus(s) and for receiving radio frequency signals from other apparatus(s).
  • device 50 includes a camera capable of recording or detecting a single frame, and codec 54 or controller receives the individual frames and processes them.
  • the device may receive video image data to be processed from another device prior to transmission and/or storage.
  • device 50 may receive images for encoding/decoding via a wireless or wired connection. The method described in the embodiments of the present invention is mainly applied to inter prediction in the corresponding codec process of the video encoder 20 and the video decoder 30.
  • the essence of the inter prediction is the current block of the current image (the current block indicates the image block currently required to be edited/decoded, and the current block may also be referred to as the to-be-processed block) in the reference image. Look for the most similar block (reference block). In order to obtain the reference block that best matches the current block, the Advanced Motion Vector Prediction (AMVP) mode and the Merge mode in the codec inter prediction mode are implemented in different ways.
  • AMVP Advanced Motion Vector Prediction
  • the AMVP mode For the AMVP mode, the AMVP mode first predicts an MV for the current block. This predicted motion vector is also called Motion Vector Prediction (MVP).
  • MVP Motion Vector Prediction
  • the MVP can be based on the neighboring block in the current block airspace, or the current block. The motion vector of the time domain reference block corresponding to the time domain reference block or the neighboring block of the current block is directly obtained. Because there are multiple neighboring blocks, there are multiple MVPs, and one MVP is essentially a candidate motion vector. (candidate mv), the AMVP mode sets these MVP groups into a candidate list. In this paper, the candidate list constructed by the AMVP mode is called an AMVP candidate list.
  • the encoding end selects an optimal MVP from the AMVP candidate list, determines the starting point of the search in the reference image according to the optimal MVP (the MVP is also a candidate MV), and then searches for the starting point in the reference image. Searching in a specific way in a specific range nearby and performing rate distortion generation value calculation, and finally calculating an optimal MV, the optimal MV determines the position of the actual reference block (predicted block) in the reference image, through the optimal MV and the optimal
  • the difference of the MVP is obtained by a motion vector difference (MVD), and the index value of the optimal MVP corresponding to the AMVP candidate list is encoded, and the index of the reference image is encoded.
  • MVD motion vector difference
  • the encoding end only needs to send the index of the MVD, the Merge candidate list and the index of the reference image to the decoding end in the code stream, thereby achieving the purpose of video data compression.
  • the decoding end decodes the index of the index value and the reference image in the MVD and the candidate list from the code stream, and on the other hand establishes an AMVP candidate list by itself, and obtains the optimal MVP through the index value, according to the MVD and the optimal one.
  • the MVP obtains the optimal MV, obtains the reference image according to the index of the reference image, uses the optimal MV and finds the actual reference block (predicted block) from the reference image, and then obtains the current block by performing motion compensation on the actual reference block (predicted block). Refactoring block.
  • the Merge mode is also used as the candidate motion vector according to the motion vector of the neighboring block in the current block airspace, or the time domain reference block corresponding to the current block, or the time domain reference block corresponding to the neighboring block in the current block.
  • Candidate mv because there are multiple neighboring blocks, so there are multiple candidate mvs.
  • the Merge mode builds a candidate list based on these candidate mvs.
  • the candidate list constructed by the Merge mode is called a Merge candidate list (the list length is different from the AMVP mode). .
  • the MV of the neighboring block is directly used as the predicted motion vector of the current block, that is, the current block shares an MV with the adjacent block (so there is no MVD at this time), and the reference image of the adjacent block is used as its own reference image. .
  • the Merge mode traverses all candidate MVs in the Merge candidate list, and performs rate distortion generation value calculation. Finally, a candidate MV with the lowest rate distortion value is selected as the optimal MV of the Merge mode, and the most MV in the Merge candidate list.
  • the index value of the MV is encoded, and the encoding end only needs to send the index of the Merge candidate list to the decoding end in the code stream, thereby achieving the purpose of video data compression.
  • the decoding end decodes the index of the Merge candidate list from the code stream, and on the other hand, establishes a Merge candidate list by itself, and determines a candidate MV in the Merge candidate list as the optimal MV by using the index value, and uses the adjacent block.
  • the reference image is used as its own reference image, and the actual reference block (predicted block) is found from the reference image by using the optimal MV, and then the reconstructed block of the current block is finally obtained by performing motion compensation on the actual reference block (predicted block).
  • the traditional AMVP mode or Merge mode is based on the candidate motion vectors of adjacent blocks to obtain the best reference image block.
  • the candidate motion vector of the neighboring block of the current block may not be the optimal predictive motion vector, that is, the actual reference block obtained by directly using the candidate motion vector of the mode in the conventional AMVP mode or the Merge mode implementation process. It is not necessarily the best reference block for the current block.
  • the embodiment of the present invention provides a prediction motion vector generation method, which implements improvement (update) on the candidate list constructed by the traditional AMVP mode or the Merge mode, based on the updated candidate list. It can guarantee the best reference block of the current block in the codec process.
  • the embodiment of the present invention further provides some hybrid prediction modes, and based on the hybrid prediction mode, it is also possible to ensure that the best reference block of the current block is obtained in the codec process.
  • the unidirectional prediction/bidirectional prediction, the constructed candidate list, and the method for updating the candidate motion vector and the candidate list based on the template matching manner, based on the template are first described below.
  • a matching codec process, a candidate list based on decoding information, and a way to select candidate motion vectors are first described below.
  • inter-frame unidirectional prediction referred to as unidirectional prediction
  • inter-frame bidirectional prediction referred to as bidirectional prediction
  • the unidirectional prediction refers to determining a first prediction motion vector of a current block based on a reference image of a single direction, thereby obtaining a prediction block of a current block in a single direction.
  • the unidirectional prediction may be referred to as forward prediction or backward prediction according to the relative relationship between the image sequence number of the reference image frame and the image sequence number of the current image frame.
  • the bidirectional prediction includes a first direction prediction and a second direction prediction, where the first direction prediction is to determine a first prediction motion vector of the current block based on the reference image of the first direction, thereby obtaining a first direction of the current block.
  • a prediction block wherein the reference image in the first direction is one of a first reference image frame set, the first reference image frame set includes a certain number of reference images; and the second direction prediction is based on a second direction a reference image to determine a second predicted motion vector of the current block, thereby obtaining a prediction block in the second direction of the current block, the reference image in the second direction being one of the second reference image frame set, the second The reference image frame set includes a certain number of reference images.
  • inter-frame bidirectional prediction can also be called forward backward prediction, that is, inter-frame bidirectional prediction includes forward prediction and backward prediction.
  • first direction prediction is forward prediction
  • second direction prediction is corresponding to backward prediction
  • first direction prediction is backward prediction
  • second direction prediction is corresponding to forward prediction.
  • FIG. 4 is an AMVP candidate list used in the AMVP mode according to an embodiment of the present invention.
  • the AMVP candidate list may be applied to forward prediction and may also be applied to backward prediction.
  • the AMVP candidate list can be applied to one-way prediction (forward prediction or backward prediction), to forward prediction in bidirectional prediction, or to backward prediction in bidirectional prediction.
  • the AMVP candidate list includes a set of multiple MVPs (each MVP is also a candidate MV), and the MVP may be based on a neighboring block in the current block airspace, or a time domain reference block corresponding to the current block, or a neighboring block adjacent to the current block.
  • the motion vector corresponding to the time domain reference block is directly obtained.
  • the AMVP candidate list includes MVP0, MVP1...MVPn, wherein the positions of each MVP in the candidate list respectively correspond to a specific candidate list index (which may be specifically referred to as an AMVP candidate list). Index), that is, each index is used to indicate a candidate MV of a corresponding position in the list, and the candidate list indexes corresponding to MVP0, MVP1, ... MVPn in the figure are index 0, index 1 ... index n, respectively.
  • the length of the AMVP candidate list constructed based on the AMVP mode is 2.
  • the AMVP candidate list includes two MVPs (MVP0 and MVP1), one of which may be a candidate motion vector obtained according to a neighboring block on the airspace, and correspondingly, another MVP may be A candidate motion vector obtained from neighboring blocks in the time domain.
  • an index value of 0 of the candidate list may be defined to indicate MVP0
  • an index value of 1 of the candidate list may be defined to indicate MVP1.
  • the embodiment of the present invention does not limit the specific value of the index value, that is, MVP0 and MVP1 may also be indicated by other defined index values.
  • FIG. 5 is a Merge candidate list used in the Merge mode according to an embodiment of the present invention.
  • the Merge candidate list may be applied to forward prediction or may be applied to backward prediction.
  • the Merge candidate list may be applied to one-way prediction (forward prediction or backward prediction), to forward prediction in bidirectional prediction, or to backward prediction in bidirectional prediction.
  • the Merge candidate list includes a set of multiple candidate MVs, and the candidate MV may be based on a neighboring block in the current block airspace, or a time domain reference block corresponding to the current block, or a time domain reference block corresponding to the neighboring block in the current block.
  • the motion vector is obtained directly.
  • the Merge candidate list shown in (a) of FIG. 5 includes pre (and/or) backward candidate MV0, candidate MV1 ... candidate MVn, wherein the position of each candidate MV in the candidate list corresponds to a specific candidate, respectively.
  • a list index (which may be referred to as an index of a Merge candidate list), that is, each index is used to indicate a candidate MV of a corresponding position in the list, and the candidate list index corresponding to the candidate MV0, the candidate MV1, and the MVn in the figure is respectively an index. 0, index 1...index n.
  • the candidate MV0, the candidate MV1, ..., MVn may be used to indicate a reference image used when constructing the current block (for example, a reference image directly using a neighboring block as a reference image of the current block).
  • the Merge candidate list length based on the Merge mode is 5.
  • the Merge candidate list includes five MVPs (candidate MV0, candidate MV1, candidate MV2, candidate MV3, candidate MV4), wherein the four candidate MVs may be based on neighboring blocks on the airspace.
  • the obtained candidate motion vector, the remaining one candidate MV is a candidate motion vector obtained from neighboring blocks in the time domain.
  • an index value 2, an index value 3, an index value, 4, an index value 5, and an index value 6 of the candidate list may be defined to indicate the candidate MV0, the candidate MV1, the candidate MV2, the candidate MV3, and the candidate MV4.
  • each MVP can also be indicated by other defined index values.
  • FIG. 6 is an AMVP candidate list used in the AMVP mode according to an embodiment of the present invention.
  • the AMVP candidate list can be applied to bidirectional prediction, that is, simultaneous application to forward prediction and backward prediction in bidirectional prediction. .
  • the AMVP candidate list includes a set of MVPs (including MVP10, MVP11...MVP1n) for first direction prediction and a set of MVPs (including MVP20, MVP21...MVP2n) for second direction prediction,
  • Each MVP may be directly obtained according to a motion vector of a neighboring block in the current block airspace, or a time domain reference block corresponding to the current block, or a time domain reference block corresponding to the neighboring block in the current block.
  • the candidate list index index 0, index 1 . . . index n may be used to indicate the MVP 10, the MVP 11 . . . MVP 1 n , respectively, or the candidate list indexes index 0 , index 1 . . .
  • index n may be used to indicate the MVP 20 , MVP 21 . . . MVP 2 n respectively. Instructions.
  • the index value used to indicate the first direction MVP and the index value used to indicate the second direction MVP may be the same or different.
  • the index value 0 may be used to simultaneously indicate the MVP 10 and the MVP 20, and the index value 0 and the index value 1 may be respectively used to indicate the MVP 10 and the MVP 20, respectively.
  • the candidate motion vector for the front (or backward) prediction in the AMVP candidate list may be simply referred to as the front (or back) candidate motion vector.
  • the candidate motion vector for the post (or forward) prediction in the AMVP candidate list may be simply referred to as the posterior (or front) candidate motion vector.
  • FIG. 7 is another Merge candidate list used in the Merge mode according to an embodiment of the present invention.
  • the Merge candidate list can be applied to bidirectional prediction, that is, simultaneous application to forward prediction and backward direction in bidirectional prediction. prediction.
  • the Merge candidate list includes a set of candidate MVs (including candidate MV10, candidate MV11...candidate MV1n) for first direction prediction and candidate MVs for second direction prediction (including candidate MV20, candidate)
  • each candidate MV may be directly obtained according to the motion vector of the neighboring block in the current block airspace, or the time domain reference block corresponding to the current block, or the time domain reference block corresponding to the neighboring block in the current block.
  • the candidate list index index 0, index 1 . . . index n may be used to indicate the candidate MV 10, the candidate MV 11 . . .
  • the index value used to indicate the first direction candidate MV and the index value used to indicate the second direction candidate MV may be the same or different.
  • the index value 0 may be used to simultaneously indicate the candidate MV 10 and the candidate MV 20
  • the index value 0 and the index value 1 may be respectively used to indicate the candidate MV 10 and the candidate MV 20, respectively.
  • the candidate motion vector for the front (or backward) prediction in the Merge candidate list may be simply referred to as the front (or back) candidate motion vector.
  • the candidate motion vector for the post (or forward) prediction in the Merge candidate list may also be simply referred to as the posterior (or front) candidate motion vector.
  • the template matching manner provided by the embodiment of the present invention can be used to update candidate motion vectors used in the AMVP mode or the Merge mode, and even to the AMVP mode or the Merge mode.
  • the candidate list is updated, and the updated candidate motion vector/candidate list can be implemented in the codec process of the AMVP mode or the Merge mode, and the obtained actual reference block is the best reference block of the current block, thereby ensuring the obtained current reference block.
  • the process of implementing template matching to update candidate motion vectors is described as follows: (1) In the candidate list constructed based on the AMVP mode or the Merge mode, one candidate motion vector is selected.
  • the candidate motion vector determines a reference image block (abbreviated as a reference block) on the reference image of the current block (2) determines a search range in the reference image determined by the candidate motion vector, and determines at least within the search range a reference motion vector different from the candidate motion vector, each of the at least one reference motion vector respectively corresponding to a reference image block (referred to as an image block) in the reference image indicated by the candidate motion vector, so as to be distinguished from The reference block determined by the candidate motion vector).
  • a reference image block abbreviated as a reference block
  • At least one adjacent reconstructed block of the current block, at least one adjacent reconstructed block of the reference block, and at least one adjacent reconstructed block of the image block have the same shape and are equal in size.
  • At least one adjacent reconstructed block of the current block has a positional relationship 1 with the current block (eg, adjacent or close within a certain range), and at least one adjacent reconstructed block of the reference block has a position between the referenced block and the reference block.
  • Relationship 2 (such as adjacent or close within a certain range)
  • at least one adjacent reconstructed block of the image block has a positional relationship 3 with the image block (eg, adjacent or close within a certain range)
  • the positional relationship 2 and the positional relationship 3 can be the same.
  • the positional relationship 1, the positional relationship 2 and the positional relationship 3 may also differ (4) from at least one adjacent reconstructed block of the at least one image block and at least one adjacent of the current block is already heavy a pixel difference value or a rate distortion value obtained between the blocks, and a pixel difference value or rate distortion value between at least one adjacent reconstructed block of the reference block and at least one adjacent reconstructed block of the current block, Determining a minimum pixel difference value or a rate distortion generation value, the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is either the candidate motion vector or one of the at least one reference motion vector.
  • the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is used as the new candidate motion vector. Specifically, if the motion vector is one of the at least one reference motion vector, the reference motion vector is used as a new candidate motion vector, and the original candidate motion vector is updated with the new candidate motion vector. If the motion vector is the original candidate motion vector, there is no need to update the candidate motion vector.
  • the above (1)(2)(3)(4) is the update process of the candidate motion vector using template matching.
  • the obtained motion vector is one of the at least one reference motion vector after performing (1)(2)(3)(4), the reference motion vector is taken as a new candidate motion vector.
  • the new candidate motion vector is replaced with the original candidate motion vector in the constructed candidate list, thereby realizing the update of the candidate list using template matching.
  • FIG. 8 shows a schematic diagram of template matching, in which a candidate motion vector is selected based on a candidate list constructed by an AMVP mode or a Merge mode, and the candidate motion vector is determined.
  • a reference motion vector i.e., reference motion vector 1 in the illustration
  • the reference motion vector 1 determines the image block 1 in the reference image.
  • the adjacent reconstructed blocks of the current block are A1 and A2
  • the adjacent reconstructed blocks of the reference block are B1 and B2
  • the adjacent reconstructed blocks of image block 1 are C1 and C2.
  • the shapes between ⁇ A1, A2 ⁇ , ⁇ B1, B2 ⁇ , ⁇ C1, C2 ⁇ are the same and equal in size, and they have the same positional relationship with the current block, the reference block, and the image block 1, respectively.
  • Calculate the pixel difference value or rate distortion value between ⁇ C1, C2 ⁇ of image block 1 and ⁇ A1, A2 ⁇ of the current block, and calculate ⁇ B1, B2 ⁇ of the reference block and ⁇ A1, A2 ⁇ of the current block The pixel difference value or rate distortion between generation values.
  • the motion vector corresponding to the smallest one of the two pixel difference values or the rate distortion cost value is used as the candidate motion vector, for example, the minimum pixel difference value or the motion vector corresponding to the rate distortion cost value is the reference motion vector 1, and the reference motion vector is used.
  • the candidate motion vector in the candidate list is replaced with the reference motion vector 1. It can be understood that if the minimum pixel difference value or the motion vector corresponding to the rate distortion cost value is the candidate motion vector, the candidate motion vector in the candidate list does not need to be updated.
  • FIG. 9 shows another schematic diagram of template matching.
  • a candidate motion vector is selected based on a candidate list constructed by the AMVP mode or the Merge mode, and the candidate motion vector is selected.
  • Determining a reference block in the reference image including two reference motion vectors (ie, reference motion vector 1 and reference motion vector 2 in the figure) in the search range determined in conjunction with the candidate motion vector, reference motion vector 1, reference motion
  • the vector 2 determines the image block 1 and the image block 2 in the reference image, respectively.
  • the adjacent reconstructed blocks of the current block are A1 and A2
  • the adjacent reconstructed blocks of the reference block are B1 and B2
  • the adjacent reconstructed blocks of image block 1 are C1 and C2
  • the adjacent of the image block 2 The reconstructed block is D1 and D2 and the shapes between ⁇ A1, A2 ⁇ , ⁇ B1, B2 ⁇ , ⁇ C1, C2 ⁇ , ⁇ D1, and D2 ⁇ are the same size and are respectively associated with the current block, the reference block, and the image block. 1.
  • Image blocks 2 have the same positional relationship.
  • Calculate the pixel difference value or rate distortion value between ⁇ C1, C2 ⁇ of image block 1 and ⁇ A1, A2 ⁇ of the current block calculate ⁇ D1, D2 ⁇ of image block 2 and ⁇ A1, A2 ⁇ of the current block
  • the pixel difference value or rate distortion generation value between the pixel and the pixel difference value or rate distortion generation value between ⁇ B1, B2 ⁇ of the reference block and ⁇ A1, A2 ⁇ of the current block are calculated.
  • the smallest one of the pixel difference value or the rate distortion cost value is selected as the candidate motion vector, for example, the minimum pixel difference value or the motion vector corresponding to the rate distortion cost value is the reference motion.
  • reference motion vector 1 or reference motion vector 2 is used as a new candidate motion vector, and the candidate motion vector in the candidate list is replaced with reference motion vector 1 or reference motion vector 2. It can be understood that if the minimum pixel difference value or the motion vector corresponding to the rate distortion cost value is the candidate motion vector, the candidate motion vector in the candidate list does not need to be updated.
  • updating the candidate list by using template matching may be updating one candidate motion vector in the candidate list, and may update multiple candidate motion vectors in the candidate list. It is also possible to update all candidate motion vectors in the candidate list.
  • a codec process for obtaining a reconstructed block of a current block based on a template matching manner in the Merge mode is described below.
  • the process may be divided into an encoding process and a decoding process.
  • FIG. 10 shows a specific encoding process of the Merge mode in the embodiment of the present invention.
  • a candidate list of the Merge mode ie, a Merge candidate list
  • the candidate list includes Candidate MV1, candidate MV2, etc., select candidate MV2 in the candidate list, and update the candidate MV2 by template matching (refer to the above description), obtain a reference motion vector, and use the reference motion vector as a new candidate motion.
  • the vector replaces the candidate MV2 in the candidate list, thereby implementing an update of the candidate list, the updated candidate list including the candidate MV1 and the reference motion vector.
  • the predicted motion vector is obtained in a conventional manner (the predicted motion vector here is the optimal MV), that is, the Merge mode traverses all candidate MVs in the candidate list (including the candidate MV1 and Refer to the motion vector), and perform rate distortion generation value calculation.
  • the optimal MV the Merge mode traverses all candidate MVs in the candidate list (including the candidate MV1 and Refer to the motion vector), and perform rate distortion generation value calculation.
  • select a candidate MV with the lowest rate distortion value as the optimal MV of the Merge mode and construct the prediction block of the current block based on the optimal MV (in one-way prediction)
  • the prediction block of the current block is the reconstructed block of the current block, and the index value of the optimal MV is encoded.
  • the prediction block of the current block is constructed based on the reference motion vector, and the index value corresponding to the reference motion vector is encoded.
  • the encoding end transmits the index value of the Merge candidate list to the decoding end in the code stream.
  • the decoding end constructs a Merge candidate list based on the same rules as the encoding end, and the candidate list includes the candidate MV1, the candidate MV2, and the like; on the other hand, parses the code stream sent from the encoding end to obtain a list of the Merge candidate. Index value, and update the candidate motion vector indicated by the index value by using template matching. For example, if the index value indicates the candidate MV2 in the candidate list, the candidate MV2 is updated by using template matching (refer to the above process). Description), get the reference motion vector.
  • the reference motion vector is replaced with a candidate MV2 in the candidate list as a new candidate motion vector, thereby implementing an update of the candidate list, the updated candidate list including the candidate MV1 and the reference motion vector .
  • the reference motion vector directly determined based on the index value is used as the predicted motion vector of the current block (the predicted motion vector is the optimal MV), and based on the predicted motion vector (optimal MV)
  • the prediction block of the current block is constructed (in the unidirectional prediction, the prediction block of the current block is the reconstructed block of the current block).
  • the reference motion vector may also be directly used as the predicted motion vector of the current block, and the prediction block of the current block is constructed based on the predicted motion vector.
  • the encoding end updates the Merge candidate list by using template matching, which may be updating one candidate motion vector in the candidate list, and may be multiple candidate motion vectors in the candidate list. To update, it is also possible to update all candidate motion vectors in the candidate list. However, at the decoding end, only the candidate MV indicated by the index value of the Merge candidate list is updated by using template matching, thereby improving the decoding efficiency of the decoding end.
  • FIG. 11 shows another specific encoding process of the Merge mode in the embodiment of the present invention. As shown in FIG. 12, the encoding end performs multiple candidate MVs (including candidate MV1 and candidate MV2) in the candidate list.
  • Updating determining the reference motion vector 2 as the predicted motion vector (optimal MV) of the current block based on the updated candidate list, implementing the prediction block of the current block based on the reference motion vector 2, and encoding the candidate list index corresponding to the reference motion vector 2.
  • the candidate motion vector in the candidate list can be directly selected according to the index of the candidate list as the predicted motion vector of the decoding end, and the candidate motion vector is not required to be updated.
  • a codec process for obtaining a reconstructed block of a current block based on a template matching manner in an AMVP mode is described below.
  • the process may be divided into an encoding process and a decoding process.
  • FIG. 12 shows a specific encoding process of the AMVP mode in the embodiment of the present invention.
  • a candidate list of AMVP modes ie, an AMVP candidate list
  • the candidate list includes MVP1, MVP2, etc., select MVP2 in the candidate list, update the MVP2 by using template matching (refer to the above description), obtain a reference motion vector, and replace the reference motion vector as a candidate candidate motion vector replacement candidate list.
  • MVP2 in the middle thereby implementing an update to the candidate list, the updated candidate list including the MVP1 and the reference motion vector.
  • the predicted motion vector is obtained in a conventional manner (the predicted motion vector here is the optimal MVP), that is, an optimal MVP is selected from the AMVP candidate list, according to the optimal
  • the MVP determines the starting point of the search in the reference image, and then searches in a specific manner in the vicinity of the search starting point and performs rate distortion generation value calculation, and finally calculates an optimal MV, and the optimal MV determines the current block.
  • the position of the prediction block in the reference image (in unidirectional prediction, the prediction block of the current block is the reconstructed block of the current block), and the motion vector difference MVD is obtained by the difference between the optimal MV and the optimal MVP And encoding the index value corresponding to the optimal MVP in the AMVP candidate list, and encoding the index of the reference image.
  • the optimal MVP is a reference motion vector (ie, the reference motion vector is the predicted motion vector)
  • a prediction block of the current block is constructed based on the reference motion vector, and an index value corresponding to the reference motion vector is encoded
  • the MVD is encoded to encode the reference motion.
  • the index of the corresponding reference image of the vector Then, the encoding end sends the encoded index value of the AMVP candidate list, the MVD and the index of the reference image to the decoding end in the code stream.
  • the decoding end constructs an AMVP candidate list based on the same rules as the encoding end, and the candidate list includes MVP1, MVP2, etc.; on the other hand, parses the code stream sent from the encoding end to obtain an index value of the Merge candidate list. And indexing the MVD and the reference image, and updating the candidate motion vector indicated by the index value by using template matching. For example, if the index value indicates MVP2 in the candidate list, the MVP2 is updated by using template matching (specific process Referring to the above description), a reference motion vector is obtained.
  • the reference motion vector is replaced with MVP2 in the candidate list as a new candidate motion vector, thereby implementing an update of the candidate list, the updated candidate list including MVP1 and the reference motion vector.
  • the reference motion vector directly determined based on the index value is used as the optimal MVP of the current block (the optimal MVP is the predicted motion vector of the current block), and then the optimal MVP is combined with the MVD.
  • the optimal MV of the current block determines the reference picture corresponding to the optimal MV based on the index of the reference image, and constructs a prediction block of the current block (in the unidirectional prediction, the prediction block of the current block is the reconstructed block of the current block).
  • the reference motion vector after the reference motion vector is obtained based on the template matching, the reference motion vector may be directly used as the optimal MV (predicted motion vector) of the current block, and the current implementation is based on the predicted motion vector.
  • the prediction block of the block after the reference motion vector is obtained based on the template matching, the reference motion vector may be directly used as the optimal MV (predicted motion vector) of the current block, and the current implementation is based on the predicted motion vector.
  • the prediction block of the block after the reference motion vector is obtained based on the template matching, the reference motion vector may be directly used as the optimal MV (predicted motion vector) of the current block, and the current implementation is based on the predicted motion vector.
  • the prediction block of the block after the reference motion vector is obtained based on the template matching, the reference motion vector may be directly used as the optimal MV (predicted motion vector) of the current block, and the current implementation is based on the predicted motion vector.
  • the prediction block of the block after the reference motion vector is obtained based on
  • the encoding end updates the AMVP candidate list by using template matching, which may be updating one candidate motion vector in the candidate list, and may update multiple candidate motion vectors in the candidate list. It is also possible to update all candidate motion vectors in the candidate list. However, at the decoding end, only the candidate MV indicated by the index value of the AMVP candidate list is updated by using template matching, thereby improving the decoding efficiency of the decoding end.
  • FIG. 13 shows another specific encoding process of the AMVP mode in the embodiment of the present invention. As shown in FIG.
  • the encoding end updates multiple MVPs (including MVP1 and MVP2) in the candidate list, based on The updated candidate list determines that the reference motion vector 2 is the predicted motion vector (optimal MVP) of the current block, and finally constructs the prediction block of the current block based on the reference motion vector 2, and encodes the candidate list index, MVD, and the corresponding reference motion vector 2 Reference image.
  • the MVP2 indicated by the template matching based on the received candidate list index
  • the predicted motion vector obtained by the encoding end based on the updated candidate list is not one of the updated candidate motion vectors, then at the decoding end, after receiving the index of the candidate list, The candidate motion vector in the candidate list is directly selected according to the index of the candidate list as the predicted motion vector of the decoding end, and the candidate motion vector is not updated.
  • a manner of constructing a candidate list based on decoding information in a decoding process for example, an entropy decoding process
  • selecting a candidate motion vector based on the decoding information will be described below.
  • the decoding end may determine which prediction mode is used by the current codec according to the identification information of the decoded candidate list and/or the index value of the candidate list, and/or which one of the candidate lists is selected.
  • Candidate motion vector may be determined which prediction mode is used by the current codec according to the identification information of the decoded candidate list and/or the index value of the candidate list, and/or which one of the candidate lists is selected.
  • the decoding end may obtain identification information (e.g., an identification bit in the code stream code) and an index value of the candidate list by parsing the code stream.
  • the identifier information is used to indicate that the candidate motion vector set is constructed based on a Merge mode or an AMVP mode, for example, an identifier bit of 0 indicates a Merge mode, and an identifier bit of 1 indicates an AMVP mode.
  • the index value of the candidate list is used to indicate a specific candidate motion vector in the candidate list, for example, the index value 0 represents the first candidate motion vector in the candidate list, and the index value 1 represents the second candidate motion vector in the candidate list. ,and many more.
  • the current decoding obtains a combination ⁇ identification bit 0, index value 1 ⁇ , it indicates that the prediction mode used for decoding the current block is the Merge mode, and the second decoding step selects the second of the Merge candidate list.
  • the second decoding step selects the second of the Merge candidate list.
  • the identification information (for example, the identifier bit in the code stream code) can be used to indicate the prediction mode used by the decoding current block, and can also be used to indicate the candidate constructed based on the prediction mode.
  • the index value of the list Specifically, when the identifier information is used to indicate that the prediction mode is the Merge mode, and is used to indicate the index information of the Merge mode, or when the identifier information is used to indicate that the prediction mode is the AVMP mode, Index information used to indicate the AMVP mode.
  • the identifier bit value is 0 or 1
  • the first MVP or the second MVP for indicating the candidate list of the AMVP mode
  • the identifier bit value is 2, 3, 4, 5, 6,
  • the first, second, third, fourth, and fifth candidate MVs for indicating the candidate list of the Merge mode, respectively.
  • the identifier information (for example, an identifier bit in the code stream code) is used to indicate a prediction mode used by decoding the current block, and when the prediction mode indicated by the identifier information is an AMVP mode, The index value of the AMVP candidate list is simultaneously indicated; when the prediction mode indicated by the identifier information is the Merge mode, the decoding end uses the index value of the preset Merge mode. For example, when the identifier bit value is 0 or 1, the first MVP or the second MVP for indicating the candidate list of the AMVP mode; when the identification bit value is a non-zero and non-specific value (for example) 2), it is used to indicate the Merge mode. In this case, in the subsequent decoding step, the decoding end directly selects the first candidate MV in the candidate list established by the Merge mode (may also be a candidate MV of any other preset index position). ).
  • the decoding may obtain at least two pieces of identification information, one identification information is used to indicate that one direction adopts the Merge mode, and another identification information is used.
  • the AMVP mode is used to indicate the other direction.
  • one identification information is used to indicate that one direction adopts the Merge mode and an index value indicating the Merge candidate list, and the other identification information is used to indicate that the other direction adopts the AMVP mode and the index value indicating the AMVP candidate list.
  • the decoding may obtain at least two combinations ⁇ first identification information, An index value ⁇ , ⁇ second identification information, a second index value ⁇ , wherein in the ⁇ first identification information, the first index value ⁇ , the first identification information represents a prediction mode in a first direction, and the first index value represents the first In the index value of the candidate list in one direction; in the second identifier information, the second index value, the second identifier information indicates the prediction mode in the second direction, and the second index value indicates the index value of the candidate list in the second direction.
  • the decoding end may also obtain an index value of the candidate list by parsing the code stream, and the index value of the candidate list may be used to indicate the prediction mode used for decoding the current block, and may also be used to indicate A specific candidate motion vector of the candidate list constructed based on the prediction mode. For example, when the index value is 0 or 1, the first MVP or the second MVP for indicating the candidate list of the AMVP mode; when the index values are 2, 3, 4, 5, and 6, respectively, The first, second, third, fourth, and fifth candidate MVs of the candidate list indicating the Merge mode.
  • the decoding may obtain at least two index values, wherein one index value is used to indicate that one direction adopts the Merge mode and indicates the Merge candidate list.
  • the specific candidate motion vector in the other, the other index value is used to indicate that the other direction adopts the AMVP mode and indicates the specific candidate motion vector in the AMVP candidate list.
  • the constructed candidate list Based on the unidirectional prediction/bidirectional prediction described above, the constructed candidate list, the method of updating the candidate motion vector and the candidate list based on the template matching manner, the template matching based codec process, the following description is provided by the embodiment of the present invention Predictive motion vector generation method.
  • FIG. 14 is a schematic flowchart diagram of a method for generating a motion vector predictor according to an embodiment of the present invention, where the method includes but is not limited to the following steps:
  • Step S101 Construct a candidate motion vector set of the current block.
  • the candidate motion vector set may include a plurality of candidate motion vectors of a current block, which may be referred to as a candidate predicted motion vector.
  • the reference image corresponding to the multiple candidate motion vectors of the current block may also be included. information.
  • the candidate motion vector set is a Merge candidate list constructed based on the Merge mode, or an AMVP candidate list constructed based on the AMVP mode.
  • the encoding end may construct a candidate motion vector set of the current block according to a preset rule (for example, a traditional manner), for example, according to a neighboring neighboring block in the current block airspace, or a time domain reference block corresponding to the current block, or The motion vectors of the time domain reference blocks corresponding to the neighboring blocks of the current block are used as candidate motion vectors, and the candidate list is constructed based on the preset Merge mode or the AMVP mode based on the candidate motion vectors.
  • a preset rule for example, a traditional manner
  • the prediction information or the index value obtained by decoding may be used to determine which prediction mode is used in the current codec, and then the corresponding candidate list is constructed.
  • the identifier information is used to indicate a prediction mode used by decoding the current block, and when the prediction mode indicated by the identifier information is an AMVP mode, the index value of the AMVP candidate list is simultaneously indicated; when the identifier information is used.
  • the predicted prediction mode is Merge mode
  • the decoding end uses the index value of the preset Merge mode.
  • the identification information may be used to indicate a prediction mode used by decoding the current block, and may also be used to indicate an index value of a candidate list constructed based on the prediction mode.
  • the decoding end can obtain the index information of the identification information and the candidate list by parsing the code stream.
  • the identifier information is used to indicate that the candidate motion vector set is constructed based on a Merge mode or an AMVP mode, and an index value of the candidate list is used to indicate a specific candidate motion vector in the candidate list.
  • the decoding end may also obtain an index value of the candidate list by parsing the code stream, and the index value of the candidate list may be used to indicate the prediction mode used for decoding the current block, and may also be used to indicate that the prediction mode is based on the prediction mode.
  • the specific candidate motion vector of the constructed candidate list may also obtain an index value of the candidate list by parsing the code stream, and the index value of the candidate list may be used to indicate the prediction mode used for decoding the current block, and may also be used to indicate that the prediction mode is based on the prediction mode.
  • the specific candidate motion vector of the constructed candidate list may also obtain an index value of the candidate list by parsing the code stream, and the index value of the candidate list may be used to indicate the prediction mode used for decoding the current block, and may also be used to indicate that the prediction mode is based on the prediction mode.
  • Step S102 Select a candidate motion vector in the candidate motion vector set, determine at least one reference motion vector based on the candidate motion vector, and use a reference motion vector to determine a reference of the current block in a reference image of the current block. Piece.
  • the reference block of the current block determined in the reference image according to the candidate motion vector includes: combining the candidate motion vector value, determining a search range in the reference image, with a target accuracy in the Searching for a neighboring position of the determined reference block to obtain a candidate reference block, wherein each of the candidate reference blocks corresponds to a reference motion vector, the target precision includes 4 pixel precision, 2 pixel precision, integer pixel precision, and half pixel precision One of 1/4 pixel precision and 1/8 pixel precision.
  • Step S103 Calculate a pixel difference value or a rate distortion value between at least one adjacent reconstructed block of at least one of the determined reference blocks and at least one adjacent reconstructed block of the current block, respectively.
  • the embodiment of the present invention implements the update of the candidate motion vector by using a template matching manner.
  • a template matching manner For the specific implementation manner, reference may be made to the related description in the foregoing, and details are not described herein again.
  • Step S104 Obtain a predicted motion vector of the current block according to the reference pixel motion value or the one reference motion vector with the lowest rate distortion value in the at least one reference motion vector.
  • the candidate motion vector in the candidate motion vector set may be replaced by using the corresponding one of the pixel difference value or the rate distortion generation value that is the smallest;
  • the predicted motion vector of the current block is obtained.
  • the predicted motion vector is the actual motion vector (actual MV) of the current block
  • the encoding end or the decoding end may obtain the prediction block of the current block according to the predicted motion vector (in the unidirectional prediction, the prediction block That is, the final reconstructed block; in the bidirectional prediction, the prediction block is used to obtain the reconstructed block of the current block based on a preset algorithm);
  • the predicted motion vector is the optimal MVP of the current block
  • the decoding end may obtain the actual MV according to the predicted motion vector, thereby obtaining a prediction block of the current block (in the unidirectional prediction, the prediction block is the final reconstructed block; in the bidirectional prediction, using the prediction block based on a preset algorithm Get the reconstructed block of the current block).
  • the candidate motion vector of the post (pre) prediction may also be directly based on Pre- (or) updating to the predicted update information
  • the specific process includes: calculating a difference between the candidate motion vector after the replacement of the predicted candidate list and the candidate motion vector before the replacement; and combining the difference sum (pre)predicted candidate motion vector, obtain a new candidate motion vector after (pre) prediction, and replace the original candidate motion vector with the (pre)predicted new candidate motion vector, thereby making the latter
  • the (pre)predicted candidate motion vector implementation update includes: calculating a difference between the candidate motion vector after the replacement of the predicted candidate list and the candidate motion vector before the replacement; and combining the difference sum (pre)predicted candidate motion vector, obtain a new candidate motion vector after (pre) prediction, and replace the original candidate motion vector with the (pre)predicted new candidate motion vector, thereby making the latter
  • the (pre)predicted candidate motion vector implementation update includes: calculating a difference between the candidate motion vector after the replacement of the predicted candidate list and the candidate motion vector before
  • the video codec system can verify whether the image block in a certain range (or even the entire reference image) in the reference image of the current block has a good match with the current block by using template matching.
  • the candidate motion vector of the candidate list constructed based on the Merge or AMVP mode is updated, and the updated candidate list can ensure that the best reference block of the current block is obtained in the encoding and decoding process, and finally the optimal reconstructed block is obtained.
  • FIG. 15 is a method for generating a motion vector predictor according to an embodiment of the present invention, which is described from the perspective of a coding end, and the method may be used in one-way prediction (forward prediction or backward prediction), and the method includes Not limited to the following steps:
  • Step S201 The encoding end constructs an AMVP candidate list or a Merge candidate list.
  • the candidate list is a candidate list that uses unidirectional prediction, refer to the related description of the embodiment of FIG. 4 or FIG. 5.
  • the candidate list constructed is a candidate list using bidirectional prediction, refer to the figure. 6 or the related description of the embodiment of FIG. 7, and details are not described herein again.
  • Step S202 The encoding end selects one candidate motion vector (ie, MVP or candidate MV) in the constructed AMVP candidate list or the Merge candidate list.
  • Step S203 The encoding end determines the search range in the reference image according to the selected candidate motion vector, the search range includes at least one motion vector value, and obtains a reference of the current block according to the at least one motion vector value in the search range. At least one image block in the image.
  • performing at least one image block by searching for a target accuracy in a neighboring position of the reference block determined by the candidate motion vector, where each image block corresponds to one reference motion vector, and the target precision includes 4 pixel precision, One of 2 pixel precision, integer pixel precision, half pixel precision, 1/4 pixel precision, and 1/8 pixel precision.
  • Step S204 The encoding end respectively calculates a pixel difference value or a rate distortion value between at least one adjacent reconstructed block of the current block and at least one adjacent reconstructed block of each image block, and calculates at least a current block.
  • these pixel difference values or rate distortion generation values one of the pixel difference value or the rate distortion generation value is selected, and the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is used as the candidate motion vector of the current block.
  • Step S205 If the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is different from the candidate motion vector selected in step 202, the encoding end uses the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value as the current A new candidate motion vector of the block is updated for the constructed AMVP candidate list or the Merge candidate list. Specifically, the motion vector corresponding to the minimum pixel difference value or the rate distortion value is used to replace the corresponding candidate motion vector in the AMVP candidate list or the Merge candidate list.
  • steps S201-S205 may be repeatedly performed to implement updating of multiple (or even all) candidate motion vectors in the AMVP candidate list or the Merge candidate list.
  • the forward candidate motion vector and the backward candidate motion indicated by the index value in the candidate list update process are updated.
  • Step S206 The encoding end obtains the predicted motion vector of the current block based on the updated AMVP candidate list or the Merge candidate list, and further obtains the reconstructed block of the current block based on the predicted motion vector of the current block, and sends the code stream to the decoding end. .
  • the predicted motion vector (optimal MVP) is determined based on the updated AMVP candidate list, thereby obtaining a reconstructed block of the current block, and encoding the corresponding block of the current block.
  • the motion vector difference information (MVD) encodes an index of the reference image corresponding to the reconstructed block, and encodes an index value of the AMVP candidate list corresponding to the optimal MVP.
  • the code stream sent by the encoding end to the decoding end includes the MVD, an index value of the AMVP candidate list, and an index of the reference image.
  • the predicted motion vector (optimal MV) is determined based on the updated Merge candidate list, thereby obtaining a reconstructed block of the current block, and encoding the optimal MV corresponding The index value of the Merge candidate list. It can be understood that the encoding end sends the index value of the Merge candidate list in the code stream to the decoding end.
  • FIG. 16 is a schematic diagram of a method for generating a motion vector according to an embodiment of the present invention.
  • the decoding end may be corresponding to the encoding end in the embodiment of FIG.
  • the method can be used in one-way prediction (forward prediction or backward prediction), and the method includes but is not limited to the following steps:
  • Step S301 The decoding end constructs an AMVP candidate list or a Merge candidate list.
  • the decoding end adopts a prediction mode consistent with the encoding end. That is to say, if the encoding end constructs the Merge candidate list based on the AMVP mode, the decoding end also constructs the Merge candidate list based on the AMVP mode, and the method of establishing the list is consistent with the encoding end; if the encoding end builds the Merge candidate list based on the Merge mode, then The decoding end also constructs a list of Merge candidates based on the Merge mode, and the method of creating the list is consistent with the encoding end. Specifically, if the candidate list is a candidate list that uses unidirectional prediction, refer to the related description of the embodiment of FIG. 4 or FIG. 5. If the candidate list constructed is a candidate list using bidirectional prediction, refer to the figure. 6 or the related description of the embodiment of FIG. 7, and details are not described herein again.
  • Step S302 The decoding end parses the code stream to obtain an index value of the AMVP candidate list or the Merge candidate list.
  • a candidate motion vector ie, an MVP or a candidate MV indicated by the index value in the AMVP candidate list or the Merge candidate list is selected based on the index value.
  • the decoding end decodes the index value of the AMVP candidate list in the process of parsing the code stream, decodes the index of the reference image, and obtains motion vector difference information (MVD). And selecting a candidate motion vector indicated by the index value in the AMVP candidate list based on the index value.
  • MMD motion vector difference information
  • the decoding end decodes the index value of the Merge candidate list during decoding of the code stream, and selects a candidate motion vector indicated by the index value in the Merge candidate list based on the index value. .
  • the index value obtained by decoding is 0 or 1
  • the 0 or 1 is used to indicate the first MVP or the second MVP of the candidate list of the AMVP mode
  • the decoded index value is 2, 3, 4 At 5, 6, the 2, 3, 4, 5, and 6 are used to indicate the first, second, third, fourth, and fifth candidate MVs of the candidate list of the Merge mode, respectively.
  • Step S303 The decoding end determines a search range in the reference image in combination with the selected candidate motion vector, the search range includes at least one motion vector value, and obtains a reference of the current block according to the at least one motion vector value in the search range. At least one image block in the image.
  • performing at least one image block by searching for a target accuracy in a neighboring position of the reference block determined by the candidate motion vector, where each image block corresponds to one reference motion vector, and the target precision includes 4 pixel precision, One of 2 pixel precision, integer pixel precision, half pixel precision, 1/4 pixel precision, and 1/8 pixel precision.
  • Step S304 respectively calculating a pixel difference value or a rate distortion value between at least one adjacent reconstructed block of the current block and at least one adjacent reconstructed block of each image block, and calculating at least one neighbor of the current block.
  • a pixel difference value or rate distortion cost value between at least one of the reconstructed block and the reference block corresponding to the candidate motion vector is adjacent to the reconstructed block.
  • one of the pixel difference value or the rate distortion generation value is selected, and the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is used as the candidate motion vector of the current block.
  • Step S305 If the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is different from the candidate motion vector selected in step 302, the encoding end uses the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value as the current A new candidate motion vector of the block is updated for the constructed AMVP candidate list or the Merge candidate list. Specifically, the motion vector corresponding to the minimum pixel difference value or the rate distortion value is used to replace the corresponding candidate motion vector in the AMVP candidate list or the Merge candidate list.
  • steps S301-S305 may be repeatedly performed to implement updating of multiple (or even all) candidate motion vectors in the AMVP candidate list or the Merge candidate list.
  • the forward candidate motion vector and the backward candidate motion indicated by the index value in the candidate list update process are updated.
  • Step S306 The decoding end determines, according to the index value of the candidate list, the candidate motion vector indicated by the index value in the updated AMVP candidate list or the Merge candidate list as the predicted motion vector, and further obtains the current based on the predicted motion vector of the current block. Reconstructed block of the block.
  • the Merge mode is adopted, and the Merge index value obtained by the decoding end is 0. Then, the decoding end constructs a Merge candidate list. After the completion of the construction, if the current block selects the candidate motion vector corresponding to the Merge candidate list index value of 0 in the Merge mode, the unidirectional prediction is performed, and the value of the candidate motion vector is (3, 5). And obtaining a reference image block (reference block) in the reference image according to the selected candidate motion vector. Focusing on the reference block and searching for the entire pixel precision in the range of the surrounding 1-pixel region, a plurality of reference image blocks (image blocks) of the same size as the reference block can be obtained.
  • the left block adjacent to the current block and/or the upper adjacent reconstructed block as a template, respectively, the reference block, each of the image blocks left adjacent and/or the upper adjacent reconstructed block, and the rate is matched.
  • the smallest distortion generation value is the updated reference image block, and the motion vector (new candidate MV) corresponding to the updated reference image block is (4, 5), that is, the predicted motion vector of the current block is (4, 5).
  • the current block is reconstructed with the updated reference image block, thereby obtaining a reconstructed block of the current block.
  • the AMVP mode is adopted, and the index value of the candidate list obtained by the decoding end is decoded.
  • the decoding end constructs an AMVP candidate list. After the completion of the construction, if the current block selects the candidate motion vector corresponding to the index value in the AMVP mode as a unidirectional prediction, and the candidate motion vector has a value of (3, 5), according to the selected candidate motion.
  • the vector gets a reference image block (reference block) in the reference image. Focusing on the reference block and searching for the entire pixel precision in the range of the surrounding 1-pixel region, a plurality of reference image blocks (image blocks) of the same size as the reference block can be obtained.
  • the lowest rate distortion generation value is the updated reference image block, and the motion vector (new MVP) corresponding to the updated reference image block is (4, 5), that is, the predicted motion vector of the current block is (4, 5). Based on (4, 5), the current block is reconstructed with the updated reference image block, thereby obtaining a reconstructed block of the current block.
  • the decoding end may skip the update of the candidate list, directly use the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value as the predicted motion vector, and then obtain the current block based on the predicted motion vector of the current block. Refactor the block.
  • a hybrid prediction mode is introduced which is applied to bidirectional prediction.
  • the hybrid prediction mode refers to adopting the Merge mode and the AMVP mode simultaneously in the bidirectional prediction process of the codec.
  • one direction prediction adopts the Merge mode for encoding and decoding
  • the other direction prediction adopts the AMVP mode.
  • a prediction motion vector generation method according to an embodiment of the present invention is described below based on the hybrid prediction mode. The method is described from the perspective of an encoding end. In this method, a direction prediction is performed by using a Merge mode to obtain a current block.
  • the process of the first prediction block includes steps S401-S404, and the process of the other direction prediction using the AMVP mode for encoding and decoding to obtain the second prediction block of the current block includes steps S405-S406, and finally, in step S407, the current block
  • the first prediction block and the second prediction block of the current block can finally obtain the reconstructed block of the current block by using a preset algorithm.
  • steps S401-S404 are described.
  • the Merge mode uses the template matching manner to update the candidate list in the front (or later, the same below) to obtain the first prediction block, as follows:
  • Step S401 The front (or back) prediction of the encoding end adopts the Merge mode, and the encoding end constructs a Merge candidate list based on the Merge mode, and the Merge candidate list is used for performing pre (or backward) prediction in the bidirectional prediction.
  • the front (or back) prediction of the encoding end adopts the Merge mode, and the encoding end constructs a Merge candidate list based on the Merge mode, and the Merge candidate list is used for performing pre (or backward) prediction in the bidirectional prediction.
  • Step S402 The encoding end selects a candidate motion vector in the Merge candidate list.
  • the candidate motion vector for the front (back) prediction may be obtained by mapping as the selected candidate motion vector.
  • the value is applied to the subsequent step S403.
  • the encoding end selects the candidate motion vector in the Merge candidate list as (-2, -2), and the (-2, -2) is based on the backward prediction.
  • the current block corresponds to the image sequence number in the image frame sequence is 4.
  • the backward predicted reference block corresponds to the image sequence number in the image frame sequence is 6, and the forward predicted reference block corresponds to the image sequence number in the image frame sequence is 3, then the current block and the forward predicted reference block
  • the candidate motion vector (1, 1) predicted in the forward direction, that is, (-2, -2) / -2 (1, 1).
  • the (1, 1) is applied as the selected candidate motion vector value to the subsequent step S403.
  • the selection of the candidate motion vector may also be interrupted, that is, re-in the Merge candidate. Select other candidate motion vectors from the list.
  • the selected candidate motion vector is obtained by bidirectional prediction
  • the value of the candidate motion vector for the front (or back) prediction portion is selected as the selected candidate motion vector value application.
  • the candidate motion vectors pre-selected by the encoding end in the Merge candidate list include motion vectors (1, 1) for pre (post) prediction and post (pre) prediction.
  • the encoding end finally applies the pre- (post)-predicted motion vector (1, 1) as the selected candidate motion vector value to the subsequent step S403.
  • the candidate motion vector is directly used as the selected candidate motion vector value to be applied to the subsequent step S403.
  • Step S403 The encoding end updates the candidate motion vector by using template matching.
  • the specific process includes: the encoding end selects a candidate motion vector of the Merge candidate list as an input, and the candidate motion vector corresponds to a reference block in the reference image. Determining a search range by combining a candidate motion vector, the search range includes at least one reference motion vector; obtaining an image block predicted in the reference image before (later) the current block according to the reference motion vector within the search range; respectively calculating the current block Pixel difference value or rate distortion value between at least one adjacent reconstructed block and at least one adjacent reconstructed block of each image block, and calculating at least one adjacent reconstructed block of the current block and candidate motion vector corresponding At least one of the reference blocks is adjacent to the pixel difference value or rate distortion generation value between the reconstructed blocks.
  • the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is used as the candidate motion vector of the current block, thereby The update of the candidate motion vector is implemented.
  • Step S404 The encoding end may replace the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value with the corresponding candidate motion vector in the Merge candidate list, thereby implementing updating of the Merge candidate list, based on the updated Merge candidate list.
  • a predicted motion vector also referred to as a first predicted motion vector
  • the first prediction block also referred to as The first prediction block
  • the AMVP mode uses the constructed candidate list directly in the prediction (or before, the same below) to obtain the second prediction block, as follows:
  • Step S405 The encoding end constructs an AMVP candidate list based on the AMVP mode.
  • the AMVP candidate list is used for post- (or forward) prediction in bi-directional prediction. For details, refer to the description of the embodiment of FIG. 6 , and details are not described herein again.
  • Step S406 The encoding end obtains a post (previous) prediction block (also referred to as a second prediction block) of the current block by using a conventional AMVP method based on the AMVP candidate list.
  • a post (previous) prediction block also referred to as a second prediction block
  • the specific process includes: the encoding end directly selects an optimal MVP from the AMVP candidate list, determines a starting point of searching in the reference image according to the optimal MVP, and then searches according to a specific manner within a specific range near the search starting point. The rate distortion generation value is calculated, and finally an optimal MV is obtained.
  • the optimal MV determines the position of the second prediction block, and the motion vector difference MVD is obtained by the difference between the optimal MV and the optimal MVP, and the most The optimal MVP encodes the index value in the AMVP candidate list, and encodes the index of the reference image.
  • step S407 the encoding end obtains the reconstructed block, and transmits the code stream to the decoding end. Specifically, after obtaining the first (back) direction first prediction block and the back (front) direction second prediction block, the encoding end processes the first prediction block and the second prediction block according to a preset algorithm. Thereby, a reconstructed block of the current block is obtained, for example, the first prediction block and the second prediction block are weighted and halved, thereby obtaining a reconstructed block of the current block.
  • the encoding end transmits a code stream to the decoding end, and the code stream correspondingly includes an index value of the Merge candidate list, an index value of the AMVP candidate list, an MVD, an index of the reference image, and the like.
  • the S401-S404 may be replaced by the AMVP mode.
  • the candidate list is updated in the template matching manner in the pre- (post) prediction, and the first prediction block is obtained.
  • -S406 is replaced with the Merge mode.
  • the second prediction block is obtained by using the constructed candidate list directly in the prediction.
  • FIG. 18 is a prediction motion vector generation method based on a hybrid prediction mode, which is applied to bidirectional prediction, and is described from the perspective of a decoding end, and the decoding end may correspond to the encoding end in FIG.
  • the decoding end parses the code stream to obtain an index value of the candidate list. It is then judged whether or not the following steps S501-S504 or S505-S506 are performed by whether the index value is a specific value.
  • the index value is used to indicate that the decoding end adopts the Merge mode before and after the prediction, and the decoding end further performs steps S501-S504; if the index value is not a specific value, The index value is used to indicate that the encoding end adopts the AMVP mode, and the decoding end further decodes the index of the reference image of the prediction direction and the motion vector difference information (MVD), and then performs steps S505-S506.
  • the index value is 0 or 1
  • the index value is used to indicate that the backward prediction adopts the AMVP mode (specifically used to indicate the first or the first of the candidate lists constructed by the AMVP mode.
  • the decoder also decodes the index of the backward predicted reference image and the MVD, and then performs the subsequent steps; if the index value is a specific value of 2, the index value is used to indicate that the forward prediction adopts the Merge mode. (Specificly used to indicate a specific candidate MV in the candidate list constructed by the Merge mode, such as the first candidate MV) to perform subsequent steps.
  • the index value is a specific value of 2
  • the index value is used to indicate that the forward prediction adopts the Merge mode. (Specificly used to indicate a specific candidate MV in the candidate list constructed by the Merge mode, such as the first candidate MV) to perform subsequent steps.
  • steps S501-S504 are described.
  • the Merge mode uses the template matching manner to update the candidate motion vector indicated by the index value in the candidate list in the pre- (or later, the same below) prediction, thereby obtaining the first prediction block, as follows:
  • Step S501 In the case that the decoded index value indicates that the Merge mode is used before (or after) the prediction, the decoding end determines that the pre- (or post-) prediction adopts the Merge mode, thereby constructing the Merge candidate list.
  • the specific construction of the list can be consistent with step S401 of the embodiment of FIG.
  • the decoding end may also determine the prediction direction corresponding to the Merge mode or the AMVP mode by decoding the candidate motion vector value. For example, the decoding end selects the candidate motion vector corresponding to the Merge candidate list index value of 3, and finds that the selected candidate motion vector is the forward predicted candidate motion vector, and determines that the forward prediction adopts the Merge mode. For another example, the decoding end selects the candidate motion vector corresponding to the AMVP candidate list index value of 0, and finds that the selected candidate motion vector is the backward predicted candidate motion vector, and determines that the backward prediction adopts the Merge mode.
  • Step S502 The decoding end selects a candidate motion vector corresponding to the index value in the Merge candidate list based on the index value obtained by the decoding. For example, if the index value is 2, and the 2 is used to indicate the first candidate MV in the Merge candidate list, then the first candidate MV in the Merge candidate list is selected.
  • Step S503 The decoding end updates the candidate motion vector by using template matching. For details, refer to the related description of step S403 in the embodiment of FIG. 17 , and details are not described herein again.
  • Step S504 The decoding end implements an update of the candidate MV selected in the Merge candidate list, and uses the updated candidate MV as a pre- (post) forward predicted motion vector (also referred to as a first predicted motion vector).
  • a pre- (post-) directed prediction block also referred to as a first prediction block
  • a pre- (rear) predicted motion vector is obtained in conjunction with the pre- (rear) predicted motion vector.
  • Steps S505-S506 are described below:
  • Step S505 After the index value indicated by the decoding indicates (or before) the AMVP mode is adopted for the prediction, the decoding end determines (or before) the prediction adopts the AMVP mode, and continues to decode to obtain the index of the reference image and the MVD and the like. Then build an AMVP candidate list.
  • the specific construction of the list can be consistent with step S405 of the embodiment of FIG.
  • Step S506 The decoding end decodes the post (previous) prediction block of the current block by using a conventional AMVP method based on the AMVP candidate list, the index of the decoded reference image, and the MVD information (also referred to as a second Forecast block).
  • step S507 after the decoding end obtains the first (back) direction first prediction block and the back (front) direction second prediction block, the first prediction block and the second method are performed based on a preset algorithm.
  • the prediction block is processed to obtain a reconstructed block of the current block.
  • the first prediction block and the second prediction block are subjected to weighted halving calculation, thereby obtaining a reconstructed block of the current block.
  • the S501-S504 may be replaced by the AMVP mode
  • the candidate list may be updated by using the template matching manner in the pre- (post) prediction to obtain the first prediction block (for example, The index value indicates that the AMVP mode is adopted in the forward prediction
  • the S505-S506 is replaced with the Merge mode.
  • the second prediction block is obtained by directly using the constructed candidate list in the backward (previous) prediction (for example, the index value indicates that the backward prediction is used. Merge mode), the specific implementation process can refer to the foregoing description, and will not be described here.
  • FIG. 19 is a method for generating a predicted motion vector of a hybrid prediction mode according to an embodiment of the present invention, which is described from the perspective of an encoding end.
  • the difference between the method embodiment and the embodiment of FIG. 17 includes forward prediction and The backward prediction uses different prediction modes (Merge mode and AMVP mode), and both the forward prediction and the backward prediction are used to update the candidate motion vector/update candidate list in the template matching manner.
  • Merge mode and AMVP mode different prediction modes
  • steps S601-S604 are described.
  • the Merge mode uses the template matching manner to update the candidate list in the front (or later, the same below) to obtain the first prediction block, as follows:
  • Step S601 The pre- (or post-) prediction of the encoding end adopts the Merge mode, and the encoding end constructs a Merge candidate list based on the Merge mode, and the Merge candidate list is used for performing pre- (or backward) prediction in the bidirectional prediction.
  • Step S602 The encoding end selects a candidate motion vector in the Merge candidate list.
  • step S402 of FIG. 17 For a specific implementation process, refer to the related description in step S402 of FIG. 17, and details are not described herein again.
  • Step S603 The encoding end updates the candidate motion vector by means of template matching.
  • Step S604 The encoding end obtains a pre (post) prediction block (also referred to as a first prediction block) based on the updated Merge candidate list before (behind) the current block.
  • a pre (post) prediction block also referred to as a first prediction block
  • Steps S605-S608 are described below.
  • the AMVP mode uses the template matching method to update the candidate list and obtain the second prediction block in the backward (or before, the same below) prediction, as follows:
  • Step S605 The encoding end constructs an AMVP candidate list based on the AMVP mode.
  • the AMVP candidate list is used for post- (or forward) prediction in bi-directional prediction.
  • Step S606 The encoding end selects a candidate motion vector in the AMVP candidate list.
  • the candidate motion vector for the post-previous prediction may be obtained by mapping as the selected candidate motion vector.
  • the value is applied to the subsequent step S607.
  • the encoding end selects the forward candidate motion vector in the AMVP candidate list as (-2, -2), the (-2, -2) is obtained based on the forward prediction, and the current block corresponds to the image serial number in the image frame sequence.
  • Timing (Picture Order Count, referred to as timing) is 4, the forward predicted reference block corresponds to the image sequence number in the image frame sequence is 2, and the backward predicted reference block corresponds to the image sequence number in the image frame sequence is 5, then
  • the (1, 1) is applied as the selected candidate motion vector value to the subsequent step S607.
  • the selection of the candidate motion vector may be interrupted, that is, re-initiated in the AMVP candidate. Select other candidate motion vectors from the list.
  • the candidate motion vector pre-selected from the post-pre-prediction is obtained by bidirectional prediction
  • the value of the bi-directional prediction for the post-previous prediction portion is finally selected.
  • the selected candidate motion vector value is applied to the subsequent step S607.
  • the post (pre) prediction the candidate motion vector preselected by the encoding end in the Merge candidate list is obtained by bidirectional prediction, which includes the motion vector (1, 1) for the pre (post) prediction.
  • the encoding end finally applies the post (pre)to the predicted motion vector (-2, -2) as the selected candidate motion vector value to Subsequent step S607.
  • the candidate motion vector is directly used as the selected candidate motion vector value to be applied to the subsequent step S607.
  • Step S607 The encoding end updates the candidate motion vector by using template matching.
  • the specific process includes, as an input, a candidate motion vector of an encoding end select AMVP candidate list, where the candidate motion vector corresponds to a reference block in the reference image. Determining a search range by combining candidate motion vectors, the search range includes at least one reference motion vector; and obtaining an image block in the reference image after the current block is obtained from the reference motion vector within the search range; respectively calculating the current block Pixel difference value or rate distortion value between at least one adjacent reconstructed block and at least one adjacent reconstructed block of each image block, and calculating at least one adjacent reconstructed block of the current block and candidate motion vector corresponding At least one of the reference blocks is adjacent to the pixel difference value or rate distortion generation value between the reconstructed blocks.
  • the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is used as the candidate motion vector of the current block, thereby The update of the candidate motion vector is implemented.
  • Step S608 The encoding end may replace the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value with the corresponding candidate motion vector in the AMVP candidate list, thereby implementing updating of the AMVP candidate list, based on the updated AMVP candidate list.
  • Obtaining a predicted motion vector also referred to as a second predicted motion vector
  • obtaining a post (pre)predicted block in combination with the predicted (previous) predicted motion vector also referred to as a
  • the second prediction block is used, and the index value corresponding to the prediction motion vector in the AMVP candidate list is encoded, and the index of the reference image corresponding to the prediction block is encoded, and the MVD is encoded.
  • the specific process can be implemented by referring to FIG. 12 to FIG. The description of the coding end of the example is not described here.
  • step S609 the encoding end obtains the reconstructed block, and transmits the code stream to the decoding end. Specifically, after obtaining the first (back) direction first prediction block and the back (front) direction second prediction block, the encoding end processes the first prediction block and the second prediction block according to a preset algorithm. To get the reconstructed block of the current block. Thereafter, the encoding end transmits a code stream to the decoding end, and the code stream correspondingly includes an index value of the Merge candidate list, an index value of the AMVP candidate list, an MVD, an index of the reference image, and the like.
  • FIG. 20 is a schematic diagram of a method for generating a motion vector predicting motion in a mixed prediction mode according to an embodiment of the present invention.
  • the decoding end of the method embodiment can be compared with the code end of the embodiment of FIG. correspond.
  • the difference between the method embodiment and the embodiment of FIG. 18 includes that different prediction modes (Merge mode and AMVP mode) are used for forward prediction and backward prediction, and template matching method is used to update candidates in both forward prediction and backward prediction. Motion vector/update candidate list.
  • steps S701-S704 are described.
  • the Merge mode uses the template matching manner to update the candidate motion vector indicated by the index value in the candidate list in the pre- (or later, the same below) prediction, thereby obtaining the first prediction block, as follows:
  • Step S701 The decoded index value indicates that the pre- (or post) prediction adopts the Merge mode, and the decoding end determines that the pre- (or post-) prediction adopts the Merge mode, thereby constructing the Merge candidate list.
  • Step S702 The decoding end selects a candidate motion vector corresponding to the index value in the Merge candidate list based on the decoding information (identification bit and/or index value, specifically referring to the foregoing description).
  • the candidate motion vector selected based on the decoded index value is obtained by post- (or forward) prediction
  • the candidate motion vector for the front (back) prediction may be obtained by mapping, as The selected candidate motion vector value is applied to subsequent step S703.
  • the decoding end selects the candidate motion vector as (-2, -2) in the Merge candidate list, and the (-2, -2) is obtained based on the backward prediction, and the current block corresponds to the image sequence number in the image frame sequence is 4,
  • the backward predicted reference block corresponds to the image sequence number in the image frame sequence is 6
  • the forward predicted reference block corresponds to the image sequence number in the image frame sequence is 3, then the current block and the forward predicted reference block
  • the forward predicted candidate motion vector (1, 1), ie (-2, -2) / -2 (1, 1).
  • the (1, 1) is applied as the selected candidate
  • the selection of the candidate motion vector may be interrupted, that is, Say, re-select other candidate motion vectors in the Merge candidate list.
  • the candidate motion vector selected based on the decoded index value is obtained by bidirectional prediction
  • the value of the candidate motion vector for the front (or back) prediction portion is selected as the selected
  • the candidate motion vector value is applied to the subsequent step S703.
  • the candidate motion vectors pre-selected by the decoding end in the Merge candidate list include motion vectors (1, 1) for pre (post) prediction and post (pre) prediction.
  • the encoding end finally applies the pre- (post)-predicted motion vector (1, 1) as the selected candidate motion vector value to the subsequent step S703.
  • the candidate motion vector selected based on the decoded index value is obtained by pre- (post) prediction
  • the candidate motion vector is directly used as the selected candidate motion vector value to be applied to subsequent steps. S703.
  • Step S703 The decoding end updates the candidate motion vector by means of template matching.
  • Step S704 The decoding end implements an update of the candidate MV selected in the Merge candidate list, and uses the updated candidate MV as a pre- (post) forward predicted motion vector (also referred to as a first predicted motion vector).
  • a pre- (post-) directed prediction block also referred to as a first prediction block is obtained in conjunction with the pre- (rear) predicted motion vector.
  • Steps S705-S708 are described below.
  • the AMVP mode uses the template matching manner to update the candidate list and obtain the second prediction block in the backward (or before, the same below) prediction, as follows:
  • Step S705 The decoding end determines the AMVP mode based on the decoding information (identification bit and/or index value, specifically referring to the foregoing description), and constructs an AMVP candidate list based on the AMVP mode.
  • the AMVP candidate list is used for post- (or forward) prediction in bi-directional prediction.
  • Step S706 The decoding end selects the candidate motion vector in the AMVP candidate list based on the decoding information (identification bit and/or index value, specifically referring to the foregoing description).
  • the candidate motion vector selected based on the decoded index value is obtained by pre- (or backward) prediction
  • the candidate motion vector for the post-previous prediction may be obtained by mapping, as The selected candidate motion vector value is applied to subsequent step S707.
  • the decoding end selects the forward candidate motion vector in the AMVP candidate list as (-2, -2), the (-2, -2) is obtained based on the forward prediction, and the current block corresponds to the image serial number in the image frame sequence.
  • the forward predicted reference block corresponds to the image sequence number in the image frame sequence is 2
  • the backward predicted reference block corresponds to the image sequence number in the image frame sequence is 5
  • the (1, 1) is applied as the selected candidate motion vector value to the subsequent step S707.
  • the selection of the candidate motion vector may be interrupted, that is, Said to re-select other candidate motion vectors in the AMVP candidate list.
  • the bidirectional prediction is finally selected for later ( The value of the front prediction section is applied to the subsequent step S707 as the selected candidate motion vector value.
  • the post (pre) prediction the candidate motion vector preselected by the decoding end in the Merge candidate list is obtained by bidirectional prediction, the candidate motion vector including the motion vector (1, 1) for the pre (post) prediction.
  • the decoding end For the motion vector (-2, -2) of the backward (front) direction prediction, the decoding end finally applies the post (pre)to the predicted motion vector (-2, -2) as the selected candidate motion vector value to Subsequent step S707.
  • the candidate motion vector is directly used as the selected candidate motion vector value to be applied to the subsequent step S707.
  • Step S707 The decoding end updates the candidate motion vector by means of template matching.
  • Step S708 The decoding end obtains a post (previous) prediction block (also referred to as a second prediction block) of the current block based on the AMVP candidate list, the index of the decoded reference image, and the MVD and the like.
  • a post (previous) prediction block also referred to as a second prediction block
  • step S709 after the decoding end obtains the first (back) direction first prediction block and the back (front) direction second prediction block, the first prediction block and the second method are performed based on a preset algorithm.
  • the prediction block is processed to obtain a reconstructed block of the current block.
  • FIG. 21 is yet another method for generating a motion vector predictor according to an embodiment of the present invention.
  • the method is described in the perspective of an encoding end.
  • the method may be used in an encoding end in bidirectional prediction, and the method includes but is not limited to the following steps:
  • Step S801 The encoding end constructs a Merge candidate list or an AMVP candidate list, and may refer to the related description of the embodiment of FIG. 6 or FIG. 7 respectively, and details are not described herein again.
  • the candidate list After constructing the Merge candidate list or the AMVP candidate list, the candidate list includes a forward candidate motion vector for forward prediction and a backward motion vector for backward prediction, for the front (back) candidate motion vector, The subsequent steps S802-S804, S805-S807 are performed (front) to the candidate motion vectors, which are described below.
  • steps S802-S804 are described:
  • Step S802 The encoding end selects the pre- (or following, the same below) candidate motion vector in the constructed candidate list.
  • Step S803 The encoding end updates the front (back) candidate motion vector by means of template matching.
  • Step S804 The encoding end obtains a front (back) prediction block (also referred to as a first prediction block) based on the front (rear) candidate motion vector in the updated candidate list before (behind) the current block.
  • a front (back) prediction block also referred to as a first prediction block
  • Steps S805-S807 are described below:
  • Step S805 The encoding end determines the post- (or before, the same below) candidate motion vector in the constructed candidate list.
  • Step S806 The encoding end updates the candidate motion vector by the preceding (backward) candidate motion vector pair before and after the update.
  • the replaced pre (post) candidate motion vector ie, the new pre (post) candidate motion vector obtained in step S803 and the pre (rear) candidate motion vector before replacement (i.e., the candidate motion vector selected in step S802); in combination with the difference and the posterior (front) candidate motion vector selected in step S805, a new posterior (front) candidate motion vector is obtained; And replacing the post (front) candidate motion vector determined in step S805 with the new post (pre) candidate motion vector, so that the candidate list is further updated.
  • Step S807 The encoding end obtains a post (pre)direction prediction block (also referred to as a second prediction block) based on the post (pre)direction candidate motion vector in the updated candidate list based on the current block (front).
  • a post (pre)direction prediction block also referred to as a second prediction block
  • Step S808 After obtaining the first (back) direction first prediction block and the back (front) direction second prediction block, the encoding end processes the first prediction block and the second prediction block according to a preset algorithm. , thereby obtaining a reconstructed block of the current block, and then transmitting the code stream to the decoding end.
  • the code stream includes an index value of the Merge candidate list; if the AMVP mode encoding is currently used, the code stream includes an index value of the AMVP candidate list, an index value of the reference image, and MVD information. .
  • FIG. 22 is still another method for generating a motion vector predictor according to an embodiment of the present invention, which is described from a decoding end.
  • the method may be used in a decoding end in bidirectional prediction.
  • the decoding end in the method may be the same as that in FIG.
  • the encoding end corresponds.
  • Step S901 The decoding end parses the code stream, and constructs a Merge candidate list or an AMVP candidate list according to the index value of the candidate list in the code stream. Reference may be made to the related description of the embodiment of FIG. 6 or FIG. 7 , and details are not described herein again.
  • the candidate list After constructing the Merge candidate list or the AMVP candidate list, the candidate list includes a forward candidate motion vector for forward prediction and a backward motion vector for backward prediction, for the front (back) candidate motion vector, (Front)
  • the subsequent steps S902-S904, S905-S907 are performed on the candidate motion vector, which are described separately below.
  • Step S902 The decoding end selects the pre- (or following, the same below) candidate motion vector in the constructed candidate list in combination with the decoded index value.
  • Step S903 The decoding end updates the front (back) candidate motion vector by means of template matching.
  • Step S904 The decoding end combines the decoding information to obtain a front (back) prediction block (also referred to as a first prediction block) based on the front (back) candidate motion vector in the updated candidate list before (behind) the current block. .
  • a front (back) prediction block also referred to as a first prediction block
  • Step S905 The decoding end determines the (or before, the same below) candidate motion vector in the constructed candidate list.
  • Step S906 The decoding end updates the candidate motion vector by the pre (post) to the candidate motion vector before and after the update.
  • the decoding side calculates the candidate front (rear) candidate motion vector (ie, the new pre (post) candidate motion vector obtained in step S903) and the pre (post) candidate motion vector before replacement in the candidate list. (i.e., the candidate motion vector selected in step S902); in combination with the difference and the posterior (front) candidate motion vector selected in step S905, a new posterior (front) candidate motion vector is obtained; And replacing the post (front) candidate motion vector determined in step S905 with the new post (pre) candidate motion vector, so that the candidate list is further updated.
  • the decoding end may calculate a difference between the replaced pre (post) candidate motion vector in the candidate list and the pre (re) candidate motion vector before replacement; calculate the difference and the candidate a sum of the posterior (anterior) candidate motion vectors in the motion vector set, obtaining a new post (front) candidate motion vector, replacing the post (pre) candidate motion vector with the original one in the candidate motion vector set Post (front) to candidate motion vectors.
  • the index value of the obtained Merge candidate list is 0.
  • the decoding end constructs a Merge list.
  • the current block selects a pre (post) candidate motion vector corresponding to the Merge candidate list index value of 0 in the Merge mode for performing the pre (post) prediction in the bidirectional prediction, and the The front (back) candidate motion vector is (3, 5), and the reference image block (ie, reference block) in the front (back) prediction process reference image is obtained according to the selected (3, 5).
  • the previous (back) is centered on the prediction reference image block, and the entire pixel precision is searched within the range of the surrounding 1-pixel region, and a number of new reference image blocks (ie, image blocks) of the same size as the reference block are obtained.
  • the minimum value of the matching rate distortion generation value is the updated reference image block, and the motion vector corresponding to the lowest rate distortion generation value is (4, 5).
  • the reference picture block whose decoding end utilization distortion generation value is the smallest is used as the current block front (back) direction prediction block, and the front (back) direction prediction motion vector of the current block is set to (4, 5).
  • the posterior (previous) candidate motion vector corresponding to the index value of 0 is (1, 4), and the pre-replacement candidate motion vector (3, 5) and the replaced prediction motion vector are combined. (4,5), the difference (1,0) is obtained, and the (previous) to the candidate motion vector is (1,4) combined with the difference (1,0) to obtain the updated (pre)predicted reference block corresponding to The predicted motion vector is (2, 4).
  • the index value of the obtained Merge candidate list is 0.
  • the decoding end constructs a Merge list.
  • the current block selects a pre (post) candidate motion vector corresponding to the Merge candidate list index value of 0 in the Merge mode for performing the pre (post) prediction in the bidirectional prediction, and the
  • the front (back) to reference image image serial number is 3, the current image highlights the serial number as 4, and the rear (front) reference image image serial number is 5.
  • the front (back) candidate motion vector is (3, 5), and the reference image block (ie, reference block) in the front (back) prediction process reference image is obtained according to the selected (3, 5).
  • the previous (back) is centered on the prediction reference image block, and the entire pixel precision is searched within the range of the surrounding 1-pixel region, and a number of new reference image blocks (ie, image blocks) of the same size as the reference block are obtained.
  • a number of new reference image blocks ie, image blocks
  • the minimum value of the matching rate distortion generation value is the updated reference image block, and the motion vector corresponding to the lowest rate distortion generation value is (4, 5).
  • the reference picture block whose decoding end utilization distortion generation value is the smallest is used as the current block front (back) direction prediction block, and the front (back) direction prediction motion vector of the current block is set to (4, 5).
  • the posterior (previous) candidate motion vector corresponding to the index value of 0 is (1, 4)
  • the pre-replacement candidate motion vector (3, 5) and the replaced prediction motion vector are combined.
  • the difference (-1,0) is obtained by the proportional mapping calculation
  • the (front) (the first) candidate motion vector is (1,4) combined with the difference (-1,0) to get the updated (front)
  • the predicted motion vector corresponding to the prediction reference block is (0, 4).
  • the decoding end may calculate a difference between the replaced front (rear) candidate motion vector and the pre-replacement (post) candidate motion vector in the candidate list; first multiply the difference by a pre- Setting a coefficient, and then performing a summation calculation on the backward (front) candidate motion vector in the candidate motion vector set to obtain a new post (pre)direction candidate motion vector, and the post (pre)toward candidate motion vector The vector replaces the original back (front) candidate motion vector in the set of candidate motion vectors.
  • the decoding end may calculate a front (rear) difference between the replaced front (rear) candidate motion vector and the pre-replacement (post) candidate motion vector in the candidate list;
  • the (post) difference value is mapped to the back (front) direction difference value, and the back (front) direction difference value is combined with the post (front) candidate motion vector in the candidate motion vector set to perform a summation calculation to obtain a new
  • the post (pre)to-candidate motion vector replaces the post-(pre) candidate motion vector with the original post (pre-) candidate motion vector in the candidate motion vector set.
  • the front (rear) candidate motion vector in the candidate list and the front (rear) candidate motion vector before the replacement may be calculated as (2, 4), and the current block corresponds to the current block.
  • the sequence image sequence number in the image frame sequence is 4, the forward prediction reference block corresponds to the image sequence number sequence in the image frame sequence is 2, and the backward predicted reference block corresponds to the image sequence number sequence in the image frame sequence.
  • the front ( After) the difference (2, 4) is mapped to the back (front) difference (-1, 0), and then the post (front) difference (-1, -2) and the back (front) are used.
  • the candidate motion vector performs a summation calculation to obtain a new post (pre)direction candidate motion vector, and replaces the post (pre)toward candidate motion vector with the original post (previous) candidate motion in the candidate motion vector set the amount.
  • the decoding end may calculate a front (rear) difference between the replaced front (rear) candidate motion vector and the pre-replacement (post) candidate motion vector in the candidate list;
  • the (post) difference value is mapped to the back (front) difference value, and then multiplied by the preset coefficient, and then combined with the posterior (front) candidate motion vector in the candidate motion vector set to obtain a new sum.
  • (front) to the candidate motion vector replacing the latter (front) candidate motion vector with the original back (front) candidate motion vector in the candidate motion vector set.
  • the proportional relationship between the obtained first time difference and the second time difference is greater than 0, Then define a preset coefficient of 1, or other preset positive values; if the proportional relationship is less than 0, define a preset coefficient of -1, or other preset negative values.
  • Step S907 The decoding end combines the decoding information, and obtains a post (previous) prediction block (also referred to as a second prediction block) based on the post (pre)direction candidate motion vector in the updated candidate list after the current block (front). .
  • a post (previous) prediction block also referred to as a second prediction block
  • Step S908 After the decoding end obtains the first (back) direction first prediction block and the back (front) direction second prediction block, the first prediction block and the second prediction block are processed according to a preset algorithm, Thereby the reconstructed block of the current block is obtained.
  • FIG. 23 is still another method for generating a motion vector predictor according to an embodiment of the present invention, which is described from the perspective of an encoding end.
  • the method can be used in the encoding end in bidirectional prediction, and the difference between the method embodiment and the embodiment in FIG.
  • the forward prediction and the backward prediction respectively adopt different prediction modes (ie, hybrid coding mode), and when the current (or later) direction adopts the Merge mode, the AMVP mode is adopted correspondingly (or before).
  • the specific description is as follows:
  • steps S1001-S1004 are described:
  • Step S1001 The pre- (or the following, the same below) prediction of the encoding end adopts the Merge mode, and the Merge candidate list is constructed based on the Merge mode.
  • Step S1002 The encoding end selects the front (back) candidate motion vector in the constructed Merge candidate list.
  • Step S1003 The encoding end updates the front (back) candidate motion vector by means of template matching.
  • Step S1004 The encoding end obtains a pre (post) prediction block (also referred to as a first prediction block) and encodes the pre (post) candidate motion vector in the updated Merge candidate list based on the current block (behind). A candidate list index corresponding to the first prediction block.
  • Steps S1005-S1007 are described below:
  • Step S1005 The post- (or before, the same below) prediction of the encoding end adopts the AMVP mode, and the AMVP candidate list is constructed based on the AMVP mode.
  • Step S1006 The encoding end selects the (or before, the same below) candidate motion vector in the constructed AMVP candidate list.
  • Step S1007 The encoding end updates the candidate motion vector by the preceding (backward) candidate motion vector pair before and after the update.
  • the encoding end calculates the replaced front (back) candidate motion vector (ie, the new pre (post) candidate motion vector obtained in step S1003) and the pre (post) candidate motion before replacement in the Merge candidate list. a difference between the vector (ie, the candidate motion vector selected in step S1002); in combination with the difference and the posterior (front) candidate motion vector selected in step S1006, a new posterior (front) candidate motion vector is obtained; Then, the post (previous) candidate motion vector selected in step S1006 in the AMVP candidate list is replaced with the new post (pre) candidate motion vector, so that the AMVP candidate list is further updated.
  • Step S1008 The encoding end obtains a post (previous) prediction block (also referred to as a second prediction block) from the post (pre)direction candidate motion vector in the updated AMVP candidate list based on the current block (front), and encodes a candidate list index corresponding to the second prediction block, an index of the reference image corresponding to the second prediction block, and MVD information.
  • a post (previous) prediction block also referred to as a second prediction block
  • Step S1009 After obtaining the first (back) direction first prediction block and the second (front) direction second prediction block, the encoding end processes the first prediction block and the second prediction block according to a preset algorithm. , thereby obtaining a reconstructed block of the current block, and then transmitting the code stream to the decoding end.
  • the code stream includes an index value of the Merge candidate list, an index value of the AMVP candidate list, an index value of the reference image, and MVD information.
  • FIG. 24 is still another method for generating a motion vector predictor according to an embodiment of the present invention, which is described from a decoding end.
  • the method may be used in a decoding end in bidirectional prediction, and the decoding end in the method may be the same as that in FIG.
  • the encoding end corresponds.
  • Step S1101 The decoding end parses the code stream, determines, according to the index value of the Merge candidate list in the code stream, that the pre- (or the following, the same below) prediction adopts the Merge mode, and constructs the Merge candidate list based on the Merge mode.
  • Step S1102 The decoding end selects the pre- (or following, the same below) candidate motion vector in the constructed Merge candidate list in combination with the decoded index value.
  • Step S1103 The decoding end updates the front (back) candidate motion vector by means of template matching.
  • Step S1104 The decoding end combines the decoding information, and obtains a pre (post) prediction block (also referred to as a first prediction block) based on the front (rear) candidate motion vector in the updated candidate list before (behind) the current block. .
  • a pre (post) prediction block also referred to as a first prediction block
  • Steps S1005-S1007 are described below:
  • Step S1105 The decoding end parses the code stream, and according to the index value of the AMVP candidate list in the code stream, determines that the AMVP mode is adopted for the prediction (or before, the same, the same below), and the AMVP candidate list is constructed based on the AMVP mode.
  • Step S1106 The decoding end selects the (previous) candidate motion vector in the constructed AMVP candidate list in combination with the decoded index value.
  • Step S1107 The decoding end updates the candidate motion vector by the preceding (backward) candidate motion vector pair before and after the update.
  • the decoding end calculates the replaced front (back) candidate motion vector (ie, the new pre (post) candidate motion vector obtained in step S1103) and the pre (post) candidate motion before replacement in the Merge candidate list. a difference between the vector (ie, the candidate motion vector selected in step S1102); in combination with the difference and the posterior (front) candidate motion vector selected in step S1106, a new posterior (front) candidate motion vector is obtained; Then, the new (front) candidate motion vector determined in step S1106 is replaced with the new post (pre) candidate motion vector, so that the candidate list is further updated.
  • Step S1108 The decoding end combines the decoding information, and obtains a post (pre)predicted block (also referred to as a second prediction block) based on the post (pre)direction candidate motion vector in the updated AMVP candidate list after the current block (front). ).
  • a post (pre)predicted block also referred to as a second prediction block
  • Step S1109 After the decoding end obtains the first (back) direction first prediction block and the back (front) direction second prediction block, the first prediction block and the second prediction block are processed according to a preset algorithm, Thereby the reconstructed block of the current block is obtained.
  • the video codec system can verify whether the image block in a certain range (or even the entire reference image) in the reference image of the current block has a good match with the current block by using template matching.
  • the candidate motion vector of the candidate list constructed based on the Merge or AMVP mode is updated, and the updated candidate list can be used to ensure that the best reference block of the current block is obtained during the encoding and decoding process.
  • the embodiment of the present invention further provides a hybrid prediction mode, and based on the hybrid prediction mode, it may also be able to obtain an optimal reference block of the current block in the coding and decoding process, and improve in the case of ensuring that the best reference block of the current block is obtained. The efficiency of codec.
  • an embodiment of the present invention provides an apparatus 1200 for generating a predicted motion vector, where the apparatus 1200 may be applied to an encoding side or may be applied to a decoding side.
  • the device 1200 includes a processor 1201 and a memory 1202.
  • the processor 1201 and the memory 1202 are connected to each other (e.g., connected to each other through a bus 1204).
  • the device 1200 may further include a transceiver 1203, and the transceiver 1203 is connected to the processing.
  • the device 1201 and the memory 1202 are configured to receive/transmit data.
  • the memory 1202 includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read only memory (EPROM), or A compact disc read-only memory (CD-ROM) for storing related program codes and video data.
  • RAM random access memory
  • ROM read-only memory
  • EPROM erasable programmable read only memory
  • CD-ROM compact disc read-only memory
  • the processor 1201 may be one or more central processing units (CPUs). In the case where the processor 1201 is a CPU, the CPU may be a single-core CPU or a multi-core CPU.
  • the processor 1201 is configured to read the program code stored in the memory 1202 and perform the following operations:
  • the prediction mode is a Merge mode or an AMVP mode
  • the processor 1201 may be used to perform the related methods described in the foregoing embodiments of FIG. 10 to FIG. 24, and details are not described herein for brevity of the description.
  • an embodiment of the present invention provides another apparatus 1300 for generating a predicted motion vector.
  • the apparatus 1300 may be applied to an encoding side or may be applied to a decoding side.
  • the device 1300 includes a processor 1301 and a memory 1302.
  • the processor 1301 and the memory 1302 are connected to each other (e.g., connected to each other through a bus 1304).
  • the device 1300 may further include a transceiver 1303, and the transceiver 1303 is connected to the processing.
  • the device 1301 and the memory 1302 are configured to receive/send data.
  • the memory 1302 includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read only memory (EPROM), or A compact disc read-only memory (CD-ROM) for storing related program codes and video data.
  • RAM random access memory
  • ROM read-only memory
  • EPROM erasable programmable read only memory
  • CD-ROM compact disc read-only memory
  • the processor 1301 may be one or more central processing units (CPUs). In the case where the processor 1301 is a CPU, the CPU may be a single core CPU or a multi-core CPU.
  • CPUs central processing units
  • the processor 1301 is configured to read program code stored in the stored memory 1302 to perform bidirectional prediction of a block to be processed, where the bidirectional prediction includes a first direction prediction and a second direction prediction, where the first direction prediction is based on A prediction of a reference frame list, the second direction prediction being based on a prediction of a second reference frame list.
  • the processor 1301 specifically performs the following operations:
  • Obtaining a first prediction mode generating a first candidate motion vector set, where the first candidate motion vector set is used to generate a first direction prediction motion vector in the first direction prediction;
  • the second prediction mode is the Merge mode, or when the first prediction mode is the Merge mode, the second prediction mode is the AMVP mode.
  • the processor 1301 may be used to perform the related methods described in the foregoing embodiments of FIG. 10 to FIG. 24, and for brevity of the description, details are not described herein again.
  • the embodiment of the present invention provides another apparatus 1400 for generating a predicted motion vector.
  • the apparatus 1400 includes:
  • a set generation module 1401, configured to construct a candidate motion vector set of the to-be-processed block
  • the template matching module 1402 is configured to determine, according to the first candidate motion vector in the candidate motion vector set, at least two first reference motion vectors, where the first reference motion vector is used to determine that the to-be-processed block is in the a reference block in the first reference image of the block to be processed;
  • the template matching module 1402 is further configured to respectively calculate between at least one first adjacent reconstructed block of the at least two determined reference blocks and at least one second adjacent reconstructed block of the to-be-processed block a pixel difference value or rate distortion rate-distortion value, wherein the at least one first neighbor reconstructed block and the at least one second neighbor reconstructed block have the same shape and are equal in size;
  • a prediction motion vector generation module 1403 configured to obtain, according to the corresponding one of the at least two first reference motion vectors, or the first reference motion vector with the lowest rate distortion value, A predictive motion vector.
  • the embodiment of the present invention provides another apparatus 1500 for generating a predicted motion vector.
  • the apparatus 1500 is configured to perform bidirectional prediction of a to-be-processed block, where the bidirectional prediction includes a first direction prediction.
  • the second direction prediction the first direction prediction is based on the prediction of the first reference frame list, and the second direction prediction is based on the prediction of the second reference frame list, where the device 1500 specifically includes:
  • a first set generation module 1501 configured to acquire a first prediction mode, and generate a first candidate motion vector set, where the first candidate motion vector set is used to generate a first direction prediction motion vector in the first direction prediction;
  • a second set generation module 1502 configured to acquire a second prediction mode, and generate a second candidate motion vector set, where the second candidate motion vector set is used to generate a second direction prediction motion vector in the second direction prediction,
  • the second prediction mode is the Merge mode, or when the first prediction mode is the Merge mode, the second prediction mode is the AMVP mode.
  • the computer program product comprises one or more computer instructions which, when loaded and executed on a computer, produce, in whole or in part, a process or function according to an embodiment of the invention.
  • the computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • the computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be from a network site, computer, server or data center Transmission to another network site, computer, server, or data center via wired (eg, coaxial cable, fiber optic, digital subscriber line) or wireless (eg, infrared, microwave, etc.).
  • the computer readable storage medium can be any available media that can be accessed by a computer, or can be a data storage device such as a server, data center, or the like that includes one or more available media.
  • the usable medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape, etc.), an optical medium (such as a DVD, etc.), or a semiconductor medium (such as a solid state hard disk) or the like.
  • a magnetic medium such as a floppy disk, a hard disk, a magnetic tape, etc.
  • an optical medium such as a DVD, etc.
  • a semiconductor medium such as a solid state hard disk

Abstract

Embodiments of the present invention provide a method for generating a predicted motion vector and a related apparatus. The method comprises: constructing a candidate motion vector set of a block to be processed; determining at least two first reference motion vectors according to a first candidate motion vector in the candidate motion vector set; respectively calculating a pixel difference value or a rate distortion cost value between a first adjacent reconstructed block of the at least two determined reference blocks and a second adjacent reconstructed block of the block to be processed; and obtaining, according to a first reference motion vector corresponding to the smallest pixel difference value or rate distortion cost value in the at least two first reference motion vectors, a first predicted motion vector of the block to be processed. The implementation of the embodiments of the present invention is advantageous for obtaining an optimal reference image block of a current block in a codec process, thereby constructing an accurately reconstructed block of the current block.

Description

预测运动矢量生成方法以及相关设备Prediction motion vector generation method and related device 技术领域Technical field
本发明涉及视频编解码领域,尤其涉及预测运动矢量生成方法以及相关设备。The present invention relates to the field of video codec, and more particularly to a method for predicting motion vector generation and related devices.
背景技术Background technique
在视频编码和解码框架中,混合编码结构通常用于视频序列的编码和解码。混合编码结构的编码端通常包括:预测模块、变换模块、量化模块和熵编码模块;混合编码结构的解码端通常包括:熵解码模块、反量化模块、反变换模块和预测补偿模块。在视频编码和解码框架中,视频序列的图像通常划分成图像块进行编码。一帧图像被划分成若干图像块,这些图像块使用上述模块进行编码和解码。这些编码和解码模块的组合可以有效去除视频序列的冗余信息,并能保证在解码端得到视频序列的编码图像。In video coding and decoding frameworks, hybrid coding structures are commonly used for encoding and decoding video sequences. The coding end of the hybrid coding structure generally includes: a prediction module, a transformation module, a quantization module, and an entropy coding module; the decoding end of the hybrid coding structure generally includes: an entropy decoding module, an inverse quantization module, an inverse transform module, and a prediction compensation module. In video coding and decoding frameworks, images of a video sequence are typically divided into image blocks for encoding. A frame of image is divided into blocks of images that are encoded and decoded using the above modules. The combination of these encoding and decoding modules can effectively remove redundant information of the video sequence and ensure that the encoded image of the video sequence is obtained at the decoding end.
在上述模块中,预测模块用于编码端获得视频序列编码图像的图像块的预测块信息,进而根据具体模式确定是否需要得到图像块的残差,预测补偿模块用于解码端获得当前解码图像块的预测块信息,再根据具体模式确定是否根据解码得到的图像块残差来获得当前解码图像块。预测模块通常包含帧内预测和帧间预测两种技术。其中,帧内预测技术利用当前图像块的空间像素信息去除当前图像块的冗余信息以获得残差。帧间预测技术的先进运动矢量预测(advanced motion vector prediction,AMVP)模式及合并(Merge)模式中的非SKIP模式利用当前图像邻近的已编解码图像的像素信息去除当前图像块(简称当前块)的冗余信息以获得残差,而合并模式中SKIP模式则不依赖于图像块残差,直接根据预测块信息即能获得当前解码图像块。其中,当前图像邻近的已编解码图像被称为参考图像。In the above module, the prediction module is used by the encoding end to obtain the prediction block information of the image block of the video sequence coded image, and further determines whether the residual of the image block needs to be obtained according to the specific mode, and the prediction compensation module is used by the decoding end to obtain the current decoded image block. The prediction block information is further determined according to a specific mode whether the current decoded image block is obtained according to the decoded image block residual. The prediction module usually includes two techniques of intra prediction and inter prediction. The intra prediction technique uses the spatial pixel information of the current image block to remove redundant information of the current image block to obtain a residual. The advanced motion vector prediction (AMVP) mode of the inter prediction technique and the non-SKIP mode in the merge mode (Merge) mode use the pixel information of the coded image adjacent to the current image to remove the current image block (referred to as the current block for short). The redundant information obtains the residual, and the SKIP mode in the merge mode does not depend on the image block residual, and the current decoded image block can be obtained directly according to the predicted block information. The coded image adjacent to the current image is referred to as a reference image.
AMVP模式或Merge模式实现过程中,都是直接利用时域或空域上相邻块的运动矢量作为其所建立候选列表中的候选MV。然而,相邻块的运动情况未必与当前块一致,也就是说相邻块的运动矢量与当前块的实际运动矢量可能会有所差别,所以当前块直接基于这些候选mv未必能获得最佳参考图像块。In the AMVP mode or the Merge mode implementation process, the motion vectors of neighboring blocks in the time domain or the air domain are directly used as candidate MVs in the candidate list created by them. However, the motion of the neighboring block does not necessarily coincide with the current block, that is, the motion vector of the neighboring block may be different from the actual motion vector of the current block, so the current block may not obtain the best reference based directly on these candidate mvs. Image block.
发明内容Summary of the invention
本发明实施例提供了预测运动矢量生成方法以及相关设备,实施本发明实施例,有利于实现在编解码过程中获得当前块的最佳参考图像块,进而构建出当前块准确的重构块。The embodiment of the present invention provides a method for generating a motion vector and a related device. The embodiment of the present invention is implemented to facilitate obtaining the best reference image block of the current block in the codec process, and then constructing a reconstructed block with the current block.
第一方面,本发明实施例提供了一种预测运动矢量生成方法,该方法包括:构建待处理块的候选运动矢量集合;根据所述候选运动矢量集合中的第一候选运动矢量,确定至少两个第一参考运动矢量,所述第一参考运动矢量用来确定所述待处理块在所述待处理块的第一参考图像中的参考块;分别计算至少两个所述确定的参考块的一个或多个第一邻近已重构块和所述待处理块的一个或多个第二邻近已重构块之间的像素差异值或者率失真(rate-distortion)代价值,其中,所述第一邻近已重构块和所述第二邻近已重构块的形状相同且尺寸相等;根据所述至少两个第一参考运动矢量中对应的所述像素差异值或者率失真代价值最小的一个第一参考运动矢量,获得所述待处理块的第一预测运动矢量。In a first aspect, an embodiment of the present invention provides a method for generating a motion vector predictor, the method comprising: constructing a candidate motion vector set of a block to be processed; and determining at least two according to a first candidate motion vector in the candidate motion vector set. First reference motion vectors, the first reference motion vectors are used to determine a reference block of the to-be-processed block in a first reference image of the to-be-processed block; respectively calculating at least two of the determined reference blocks a pixel difference value or rate-distortion value between one or more first neighbor reconstructed blocks and one or more second neighbor reconstructed blocks of the block to be processed, wherein The first adjacent reconstructed block and the second adjacent reconstructed block have the same shape and the same size; according to the pixel difference value or the rate distortion value of the at least two first reference motion vectors is the smallest A first reference motion vector obtains a first predicted motion vector of the to-be-processed block.
其中,所述候选运动矢量集合可包括当前块的多个候选运动矢量,候选运动矢量又可 称为候选预测运动矢量,在可能实施例中,还可以包括当前块的多个候选运动矢量对应的参考图像信息。具体的,所述候选运动矢量集合为基于Merge模式构建的Merge候选列表,或基于AMVP模式构建的AMVP候选列表。对于编码端和解码端,均可根据预设规则构建当前块的候选运动矢量集合,例如根据当前块空域上周边相邻块、或者当前块所对应时域参考块、或者当前块周边相邻块所对应时域参考块的预测运动矢量作为候选运动矢量,基于这些候选运动矢量基于预设的Merge模式或者AMVP模式构建候选列表。The candidate motion vector set may include a plurality of candidate motion vectors of the current block, and the candidate motion vector may be referred to as a candidate predicted motion vector. In a possible embodiment, the candidate motion vector may further include a plurality of candidate motion vectors of the current block. Reference image information. Specifically, the candidate motion vector set is a Merge candidate list constructed based on the Merge mode, or an AMVP candidate list constructed based on the AMVP mode. For the encoding end and the decoding end, the candidate motion vector set of the current block may be constructed according to a preset rule, for example, according to a neighboring block in the current block airspace, or a time domain reference block corresponding to the current block, or a neighboring block adjacent to the current block. The predicted motion vectors of the corresponding time domain reference blocks are used as candidate motion vectors, and the candidate list is constructed based on the candidate Merge mode or the AMVP mode based on the candidate motion vectors.
本发明实施例中,在构建Merge候选列表或者AMVP候选列表之后,还基于模板匹配的方式对候选列表中的候选运动矢量进行更新。本发明实施例中的模板匹配过程具体包括:选取候选列表中的第一候选运动矢量,第一候选运动矢量表示当前图像中的当前块到第一参考图像中的参考图像块(简称为参考块)的预测运动矢量。然后确定在所述第一参考图像中的搜索范围;根据该搜索范围在所述第一参考块周围进行搜索,得到至少一个第一参考图像块(可简称为参考块,但是为了与候选运动矢量所确定的参考块做区别,也可以简称为图像块),所述当前块到每个所述第一图像块分别确定了一个运动矢量,这种运动矢量为一种参考运动矢量。也就是说,基于第一候选运动矢量,可确定至少两个第一参考运动矢量:其中的一个参考运动矢量为由所述参考块所确定的第一候选运动矢量本身,另外的至少一个第一参考运动矢量为由所述至少一个图像块所确定的参考运动矢量。然后,分别计算所述当前块的至少一个邻近已重构块和所述至少一个第一图像块的至少一个邻近已重构块之间的像素差异值或率失真代价值,以及计算所述当前块的至少一个邻近已重构块和所述参考块的至少一个邻近已重构块之间的像素差异值或率失真代价值;从得到的这些像素差异值或率失真代价值中,选出像素差异值或率失真代价值最小的一个,使用所述像素差异值或代价值最小的一个所对应的运动矢量作为所述当前块的新的候选运动矢量。In the embodiment of the present invention, after constructing the Merge candidate list or the AMVP candidate list, the candidate motion vectors in the candidate list are also updated based on the template matching manner. The template matching process in the embodiment of the present invention specifically includes: selecting a first candidate motion vector in the candidate list, where the first candidate motion vector represents a reference block in the current image to the reference image block in the first reference image (referred to as a reference block for short) Predicted motion vector. Determining a search range in the first reference image; performing a search around the first reference block according to the search range, obtaining at least one first reference image block (which may be simply referred to as a reference block, but for the candidate motion vector) The determined reference block is differentiated, which may also be referred to simply as an image block, and the current block determines a motion vector to each of the first image blocks, and the motion vector is a reference motion vector. That is, based on the first candidate motion vector, at least two first reference motion vectors may be determined: one of the reference motion vectors is the first candidate motion vector itself determined by the reference block, and the other at least one first The reference motion vector is a reference motion vector determined by the at least one image block. And calculating, respectively, a pixel difference value or a rate distortion value between the at least one adjacent reconstructed block of the current block and the at least one adjacent reconstructed block of the at least one first image block, and calculating the current Selecting pixel difference values or rate distortion values between at least one adjacent reconstructed block of the block and at least one adjacent reconstructed block of the reference block; selecting from the obtained pixel difference values or rate distortion generation values One of the pixel difference value or the rate distortion generation value is the smallest, and the corresponding motion vector with the pixel difference value or the lowest value is used as the new candidate motion vector of the current block.
具体实施例中,如果所述像素差异值或代价值最小的一个对应的运动矢量并不是所述候选运动矢量,则在所述至少一个(具体可以是两个或者两个以上)第一图像块中确定一个所述像素差异值或者率失真代价值最小的图像块,该图像块所对应的参考运动矢量作为新的候选运动矢量。对于解码端,如果解析的索引值指示的就是所述新的候选运动矢量,那么解码端可直接将所述新的候选运动矢量作为预测运动矢量来获得当前块的预测块(对于单向预测,预测块即为当前块的重构块;对于双向预测,预测块可用于最终组成当前块的重构块)。对于编码端,可将所述新的候选运动矢量替换替换候选列表中在模板匹配阶段所选取的那个候选运动矢量,从而实现候选列表的更新。这样,编码端可基于更新后的候选列表,根据率失真代价值遍历列表中所有的候选运动矢量,从中确定一个最佳的候选运动矢量作为当前块的预测运动矢量(例如基于Merge候选列表所得的预测运动矢量为最优MV,基于AMVP候选列表所得的预测运动矢量为最优MVP),进而基于所述预测运动矢量得到当前块的预测块(对于单向预测,预测块即为当前块的重构块;对于双向预测,预测块可用于最终组成当前块的重构块)。In a specific embodiment, if the pixel difference value or a corresponding motion vector with the lowest value is not the candidate motion vector, the at least one (specifically, two or more) first image blocks may be used. An image block having the smallest pixel value or rate distortion generation value is determined, and a reference motion vector corresponding to the image block is used as a new candidate motion vector. For the decoding end, if the parsed index value indicates the new candidate motion vector, the decoding end may directly use the new candidate motion vector as the predicted motion vector to obtain the prediction block of the current block (for unidirectional prediction, The prediction block is the reconstructed block of the current block; for bidirectional prediction, the prediction block can be used for the reconstructed block that ultimately constitutes the current block). For the encoding end, the new candidate motion vector may be replaced with the candidate motion vector selected in the template matching stage in the replacement candidate list, thereby implementing the update of the candidate list. In this way, the encoding end may traverse all the candidate motion vectors in the list according to the rate distortion generation value based on the updated candidate list, and determine an optimal candidate motion vector as the predicted motion vector of the current block (for example, based on the Merge candidate list). The predicted motion vector is the optimal MV, and the predicted motion vector obtained based on the AMVP candidate list is the optimal MVP, and the predicted block of the current block is obtained based on the predicted motion vector (for the unidirectional prediction, the prediction block is the weight of the current block) Construction block; for bidirectional prediction, the prediction block can be used to finally form a reconstructed block of the current block).
可以看出,本发明实施例中,视频编解码系统可利用模板匹配的方式,验证当前块的参考图像中一定范围内(甚至整个参考图像内)的参考图像块的邻近已重构块是否与当前块的邻近已重构块有较好的匹配,对基于Merge或AMVP模式所构建的候选列表的候选运动矢量进行更新,基于更新后的候选列表能够保证编解码过程中获得当前块的最佳参考图像 块,进而构建出当前块准确的重构块。It can be seen that, in the embodiment of the present invention, the video codec system can verify whether the adjacent reconstructed block of the reference image block in a certain range (or even the entire reference image) in the reference image of the current block is compared with the template matching manner. The neighboring reconstructed block of the current block has a good match, and the candidate motion vector of the candidate list constructed based on the Merge or AMVP mode is updated, and the updated candidate list can ensure the best of the current block in the encoding and decoding process. The reference image block is used to construct an accurate block of the current block.
基于第一方面,在可能的实施方式中,对于解码端,也除了可直接将像素差异值或者率失真代价值最小的一个运动矢量(模板匹配时所选取的候选运动矢量或者图像块对应的参考运动矢量)直接作为预测运动矢量外,如果像素差异值或者率失真代价值最小的一个运动矢量就是某个图像块对应的参考运动矢量,那么也可以将该参考运动矢量替换候选列表中模板匹配时所选取的候选运动矢量,并(基于索引值)确定该替换后的候选运动矢量(即该参考运动矢量)作为预测运动矢量。Based on the first aspect, in a possible implementation, for the decoding end, in addition to a motion vector that can directly minimize the pixel difference value or the rate distortion generation value (the candidate motion vector selected by the template matching or the reference corresponding to the image block) The motion vector is directly used as the predicted motion vector. If one of the pixel difference values or the rate distortion generation value is the reference motion vector corresponding to a certain image block, the reference motion vector may be replaced by the template matching candidate list. The selected candidate motion vector, and (based on the index value), determines the replaced candidate motion vector (ie, the reference motion vector) as the predicted motion vector.
基于第一方面,在本发明可能的实施方式中,所述方法可用于解码端,在所述构建待处理块的候选运动矢量集合之前,解码端解析码流获得标识信息和/或候选列表的索引值,基于所述标识信息和/或索引值来确定基于哪种预测模式(例如Merge模式或AMVP模式)建立候选列表,以及在模板匹配中对候选列表中哪一个候选运动矢量进行更新。Based on the first aspect, in a possible implementation manner of the present invention, the method may be used by a decoding end, where the decoding end parses the code stream to obtain identification information and/or a candidate list before constructing the candidate motion vector set of the to-be-processed block. An index value is determined based on the identification information and/or the index value to establish a candidate list based on which prediction mode (eg, Merge mode or AMVP mode), and which candidate motion vector in the candidate list is updated in template matching.
在一可能实施方式中,解码端可以通过解析码流获得标识信息(例如码流代码中的标识位)和候选列表的索引值。所述标识信息用于指示所述候选运动矢量集合为基于Merge模式或者AMVP模式来构建,所述索引值用于指示候选列表中的具体的候选运动矢量。所以,解码端基于所述标识信息就能快速确定预测模式,基于索引值快速选取候选运动矢量使用模板匹配的方式来进行更新(或者直接基于索引值选取该候选运动矢量作为预测运动矢量来计算预测块),提高解码效率。In a possible implementation manner, the decoding end may obtain identification information (such as an identifier bit in the code stream code) and an index value of the candidate list by parsing the code stream. The identifier information is used to indicate that the candidate motion vector set is constructed based on a Merge mode or an AMVP mode, and the index value is used to indicate a specific candidate motion vector in the candidate list. Therefore, the decoding end can quickly determine the prediction mode based on the identification information, and quickly select the candidate motion vector based on the index value to update using the template matching manner (or directly select the candidate motion vector as the predicted motion vector based on the index value to calculate the prediction. Block) to improve decoding efficiency.
在一种可能实施方式中,所述标识信息(例如码流代码中的标识位)既可以用来指示解码当前块所采用的预测模式,同时还可以用来指示基于该预测模式所构建的候选列表的索引值。具体的,当所述标识信息用于指示所述预测模式为Merge模式时,还用于指示Merge模式的索引信息,或,当所述标识信息用于指示所述预测模式为AVMP模式时,还用于指示AMVP模式的索引信息。所以,解码端基于所述标识信息就能快速确定预测模式,以及快速选取候选运动矢量使用模板匹配的方式来进行更新(或者直接基于所指示的索引值选取该候选运动矢量作为预测运动矢量来计算预测块),提高解码效率。In a possible implementation manner, the identification information (for example, the identifier bit in the code stream code) can be used to indicate the prediction mode used by the decoding current block, and can also be used to indicate the candidate constructed based on the prediction mode. The index value of the list. Specifically, when the identifier information is used to indicate that the prediction mode is the Merge mode, and is used to indicate the index information of the Merge mode, or when the identifier information is used to indicate that the prediction mode is the AVMP mode, Index information used to indicate the AMVP mode. Therefore, the decoding end can quickly determine the prediction mode based on the identification information, and quickly select the candidate motion vector to update by using template matching (or directly select the candidate motion vector as the predicted motion vector based on the indicated index value to calculate Prediction block) to improve decoding efficiency.
在一种可能实施方式中,所述标识信息(例如码流代码中的标识位)用于指示解码当前块所采用的预测模式,并且,当所述标识信息指示的预测模式为AMVP模式时,同时指示AMVP候选列表的索引值;当所述标识信息指示的预测模式为Merge模式时,解码端使用预设的Merge模式的索引值。所以,解码端基于所述标识信息就能快速确定预测模式以及确定候选运动矢量,并在Merge模式中快速候选列表的第一个选取候选运动矢量(或者其他预先指定的候选运动矢量)使用模板匹配的方式来进行更新(或者直接选取指定的候选运动矢量作为预测运动矢量来计算预测块),提高解码效率。In a possible implementation manner, the identifier information (for example, an identifier bit in the code stream code) is used to indicate a prediction mode used by decoding the current block, and when the prediction mode indicated by the identifier information is an AMVP mode, The index value of the AMVP candidate list is simultaneously indicated; when the prediction mode indicated by the identifier information is the Merge mode, the decoding end uses the index value of the preset Merge mode. Therefore, the decoding end can quickly determine the prediction mode and determine the candidate motion vector based on the identification information, and use the template matching in the first candidate motion vector (or other pre-specified candidate motion vector) of the quick candidate list in the Merge mode. The way to update (or directly select the specified candidate motion vector as the predicted motion vector to calculate the prediction block), improve the decoding efficiency.
在一种可能实施方式中,在双向预测中,如果编解码端均采用混合预测模式,那么解码可获得至少两个标识信息,一个标识信息用于指示一个方向采用Merge模式,另一个标识信息用于指示另一个方向采用AMVP模式。或者,一个标识信息用于指示一个方向采用Merge模式以及指示Merge候选列表的索引值,另一个标识信息用于指示另一个方向采用AMVP模式以及指示AMVP候选列表的索引值。所以,解码端只需基于双向预测中的两个标识信息就能快速确定预测模式,以及快速选取候选运动矢量使用模板匹配的方式来进行更新(或者直接基于所指示的索引值选取该候选运动矢量作为预测运动矢量来计算预测块), 提高解码效率。In a possible implementation manner, in the bidirectional prediction, if the codec end adopts the hybrid prediction mode, the decoding may obtain at least two pieces of identification information, one identification information is used to indicate that one direction adopts the Merge mode, and another identification information is used. The AMVP mode is used to indicate the other direction. Alternatively, one identification information is used to indicate that one direction adopts the Merge mode and an index value indicating the Merge candidate list, and the other identification information is used to indicate that the other direction adopts the AMVP mode and the index value indicating the AMVP candidate list. Therefore, the decoding end can quickly determine the prediction mode based on the two identification information in the bidirectional prediction, and quickly select the candidate motion vector to update by using template matching (or directly select the candidate motion vector based on the indicated index value). The prediction block is calculated as a predicted motion vector), and the decoding efficiency is improved.
在一种可能实施方式中,在双向预测中,如果编解码端均采用混合预测模式(即不同方向分别采用Merge模式和AMVP模式),那么解码可获得至少两个组合{第一标识信息,第一索引值}、{第二标识信息,第二索引值},其中{第一标识信息,第一索引值}中,第一标识信息表示第一方向的预测模式,第一索引值表示该第一方向的候选列表的索引值;{第二标识信息,第二索引值}中,第二标识信息表示第二方向的预测模式,第二索引值表示该第二方向的候选列表的索引值。所以,解码端基于两个组合{第一标识信息,第一索引值}、{第二标识信息,第二索引值}就能快速确定双向预测中不同方向的预测模式,以及选取候选列表中的候选运动矢量使用模板匹配的方式来进行更新(或者直接基于索引值选取该候选运动矢量作为预测运动矢量来计算对应方向的预测块),提高解码效率。In a possible implementation manner, in the bidirectional prediction, if the codec side adopts the hybrid prediction mode (that is, the Merge mode and the AMVP mode are respectively adopted in different directions), the decoding may obtain at least two combinations {first identification information, An index value}, {second identification information, a second index value}, wherein in the {first identification information, the first index value}, the first identification information represents a prediction mode in a first direction, and the first index value represents the first In the index value of the candidate list in one direction; in the second identifier information, the second index value, the second identifier information indicates the prediction mode in the second direction, and the second index value indicates the index value of the candidate list in the second direction. Therefore, the decoding end can quickly determine the prediction modes in different directions in the bidirectional prediction based on the two combinations {first identification information, the first index value}, the {second identification information, the second index value}, and select the candidates in the candidate list. The candidate motion vector is updated by using template matching (or the candidate motion vector is directly selected as the predicted motion vector based on the index value to calculate the prediction block of the corresponding direction), thereby improving the decoding efficiency.
在一种可能实施方式中,解码端也可以通过解析码流得到候选列表的索引值,所述候选列表的索引值既可以用来指示解码当前块所采用的预测模式,同时还可以用来指示基于该预测模式所构建的候选列表的具体候选运动矢量。所以,解码端基于候选列表的索引值就能快速确定预测模式,以及快速选取候选运动矢量使用模板匹配的方式来进行更新(或者直接基于索引值选取该候选运动矢量作为预测运动矢量来计算预测块),提高解码效率。In a possible implementation manner, the decoding end may also obtain an index value of the candidate list by parsing the code stream, and the index value of the candidate list may be used to indicate the prediction mode used for decoding the current block, and may also be used to indicate A specific candidate motion vector of the candidate list constructed based on the prediction mode. Therefore, the decoding end can quickly determine the prediction mode based on the index value of the candidate list, and quickly select the candidate motion vector to update using the template matching manner (or directly select the candidate motion vector as the predicted motion vector based on the index value to calculate the prediction block. ), improve decoding efficiency.
其中,本发明实施例中,所述双向预测包括第一方向预测和第二方向预测,所述第一方向预测是基于第一参考帧列表的预测,所述第二方向预测是基于第二参考帧列表的预测。所述第一参考帧列表包括所述第一参考图像,所述第二参考帧列表包括第二参考图像,通常的,也可以将一个方向的预测称为前向预测,将另一个方向的预测简称为后向预测。In the embodiment of the present invention, the bidirectional prediction includes a first direction prediction and a second direction prediction, where the first direction prediction is based on a prediction of a first reference frame list, and the second direction prediction is based on a second reference. Prediction of the frame list. The first reference frame list includes the first reference image, and the second reference frame list includes a second reference image. Generally, the prediction in one direction may also be referred to as forward prediction, and the prediction in another direction. Referred to as backward prediction.
本发明实施例涉及的双向预测包括至少两种类型。其中一种类型是基于混合预测模式进行双向预测,另一种类型是基于一种预测模式进行双向预测。The bidirectional prediction involved in the embodiments of the present invention includes at least two types. One type is bidirectional prediction based on a hybrid prediction mode, and the other type is bidirectional prediction based on a prediction mode.
对于第一种类型,混合预测模式包括Merge模式和AMVP模式,也就是说,双向预测的一个方向采用Merge模式,另一个方向采用AMVP模式。For the first type, the hybrid prediction mode includes the Merge mode and the AMVP mode, that is, one direction of the bidirectional prediction adopts the Merge mode, and the other direction adopts the AMVP mode.
在这种类型中,每个方向分别可得到一个预测运动矢量,基于预测运动矢量进而分别得到一个预测块,最终将两个方向的预测块经过预设算法(例如进行加权平均的算法)进行组合,从而得到当前块的重构块。其中每个方向得到预测运动矢量的过程可以是相同的,也可以不同;可以是独立的,也可以互相协调的。In this type, each direction can obtain a predicted motion vector, and then a prediction block is obtained based on the predicted motion vector, and finally the prediction blocks in the two directions are combined by a preset algorithm (for example, an algorithm for performing weighted averaging). To get the reconstructed block of the current block. The process of obtaining the predicted motion vector in each direction may be the same or different; it may be independent or coordinated.
例如,两个方向分别采用一种预测模式,其中一个方向(第一方向)独立地基于本发明实施例提供的模板匹配方式来实现候选运动矢量的更新/候选列表的更新,从而得到该第一方向的预测运动矢量,另一个方向(第二方向)独立地直接基于所构建的候选列表得到该第二方向的预测运动矢量(即不进行模板匹配)。For example, the two directions respectively adopt a prediction mode, wherein one direction (first direction) independently implements update of the candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the first The predicted motion vector of the direction, the other direction (the second direction) independently obtains the predicted motion vector of the second direction directly based on the constructed candidate list (ie, no template matching is performed).
例如,两个方向分别采用一种预测模式,其中一个方向(第一方向)独立地基于本发明实施例提供的模板匹配方式来实现候选运动矢量的更新/候选列表的更新,从而得到该第一方向的预测运动矢量,另一个方向(第二方向)也独立地基于本发明实施例提供的模板匹配方式来实现候选运动矢量的更新/候选列表的更新,从而得到该第二方向的预测运动矢量。For example, the two directions respectively adopt a prediction mode, wherein one direction (first direction) independently implements update of the candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the first The predicted motion vector of the direction, the other direction (the second direction) also independently implements the update of the candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the predicted motion vector of the second direction. .
例如,两个方向分别采用一种预测模式,其中一个方向(如第一方向)独立地基于本发明实施例提供的模板匹配方式来实现候选运动矢量的更新/候选列表的更新,从而得到该 第一方向的预测运动矢量,另一个方向(如第二方向)协调地利用第一方向的候选运动矢量更新前后的差值,对第二方向所构建的候选列表中的候选运动矢量进行更新,进而得到第二方向的预测运动矢量。第二方向预测的实现过程包括:计算所述替换后的第一方向候选运动矢量与所述替换前的第一方向候选运动矢量的差值;根据所述差值和第二方向候选运动矢量集合中的第二方向候选运动矢量,获得第二方向新的候选运动矢量,将所述第二方向新的候选运动矢量替换候选运动矢量集合中第二方向原先的候选运动矢量,实现对第二方向所构建的候选列表中的候选运动矢量进行更新,进而得到第二方向的预测运动矢量。For example, the two directions respectively adopt a prediction mode, and one direction (such as the first direction) independently implements update of the candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the first The predicted motion vector in one direction, and the other direction (such as the second direction) cooperatively uses the difference between the candidate motion vector in the first direction to update the candidate motion vector in the candidate list constructed in the second direction, and further A predicted motion vector in the second direction is obtained. The implementation process of the second direction prediction includes: calculating a difference between the replaced first direction candidate motion vector and the first direction candidate motion vector before the replacement; and selecting, according to the difference value and the second direction candidate motion vector set The second direction candidate motion vector in the second direction obtains a new candidate motion vector in the second direction, and replaces the new candidate motion vector in the second direction with the original candidate motion vector in the second direction in the candidate motion vector set to implement the second direction The candidate motion vectors in the constructed candidate list are updated to obtain a predicted motion vector in the second direction.
可以看出,本发明实施例提供的混合预测模式也可以能够保证编解码过程中获得当前块的最佳参考块,在确保获得当前块的最佳参考块的情况下提高编解码的效率。It can be seen that the hybrid prediction mode provided by the embodiment of the present invention can also ensure that the best reference block of the current block is obtained in the codec process, and the codec efficiency is improved while ensuring that the best reference block of the current block is obtained.
对于第二种类型,一种单向预测模式可以是Merge模式或AMVP模式,基于该预测模式建立用于双向预测的候选列表,所述候选列表中包括用于第一方向预测的候选运动矢量和用于第二方向预测的候选运动矢量。其中每个方向得到预测运动矢量的过程可以是相同的,也可以不同;可以是独立的,也可以互相协调的。For the second type, a unidirectional prediction mode may be a Merge mode or an AMVP mode, based on which a candidate list for bidirectional prediction is included, the candidate list including candidate motion vector sums for first direction prediction Candidate motion vector for second direction prediction. The process of obtaining the predicted motion vector in each direction may be the same or different; it may be independent or coordinated.
例如,其中一个方向(第一方向)独立地基于本发明实施例提供的模板匹配方式来实现第一方向候选运动矢量的更新/候选列表的更新,从而得到该第一方向的预测运动矢量,另一个方向(第二方向)独立地直接基于所构建的候选列表得到该第二方向的预测运动矢量(即不进行模板匹配)。For example, one of the directions (the first direction) independently implements the update of the first direction candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the predicted motion vector of the first direction, and One direction (the second direction) independently obtains the predicted motion vector of the second direction based on the constructed candidate list (ie, no template matching is performed).
例如,其中一个方向(第一方向)独立地基于本发明实施例提供的模板匹配方式来实现第一方向候选运动矢量的更新/候选列表的更新,从而得到该第一方向的预测运动矢量,另一个方向(第二方向)也独立地基于本发明实施例提供的模板匹配方式来实现第二候选运动矢量的更新/候选列表的更新,从而得到该第二方向的预测运动矢量。For example, one of the directions (the first direction) independently implements the update of the first direction candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the predicted motion vector of the first direction, and One direction (the second direction) also independently implements the update of the second candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the predicted motion vector of the second direction.
例如,两个方向分别采用一种预测模式,其中一个方向(如第一方向)独立地基于本发明实施例提供的模板匹配方式来实现候选运动矢量的更新/候选列表的更新,从而得到该第一方向的预测运动矢量,另一个方向(如第二方向)协调地利用第一方向候选运动矢量更新前后的差值,对第二方向选运动矢量进行更新,进而得到第二方向的预测运动矢量。第二方向预测的实现过程包括:计算所述替换后的第一方向候选运动矢量与所述替换前的第一方向候选运动矢量的差值;根据所述差值和所述候选运动矢量集合中的第二方向候选运动矢量,获得第二方向新的候选运动矢量,将所述第二方向新的候选运动矢量替换候选运动矢量集合中第二方向原先的候选运动矢量,实现对第二方向所构建的候选列表中的候选运动矢量进行更新,进而得到第二方向的预测运动矢量。For example, the two directions respectively adopt a prediction mode, and one direction (such as the first direction) independently implements update of the candidate motion vector/update of the candidate list based on the template matching manner provided by the embodiment of the present invention, thereby obtaining the first The predicted motion vector in one direction, the other direction (such as the second direction) cooperatively uses the difference before and after the update of the first direction candidate motion vector, and updates the motion vector selected in the second direction to obtain the predicted motion vector in the second direction. . The implementation process of the second direction prediction includes: calculating a difference between the replaced first direction candidate motion vector and the first direction candidate motion vector before the replacement; according to the difference and the candidate motion vector set a second direction candidate motion vector, obtaining a new candidate motion vector in the second direction, and replacing the new candidate motion vector in the second direction with the original candidate motion vector in the second direction of the candidate motion vector set, to implement the second direction The candidate motion vectors in the constructed candidate list are updated to obtain a predicted motion vector in the second direction.
可以看出,本发明实施例在双向预测中,可以基于一个方向的更新结果实现另一个方向的候选运动矢量的更新,从而大大提高了编解码过程中的效率。It can be seen that in the bidirectional prediction, the update of the candidate motion vector in another direction can be implemented based on the update result in one direction, thereby greatly improving the efficiency in the encoding and decoding process.
基于第一方面,在可能的实施方式中,解码端(或编码端)从所述候选运动矢量集合中的选取(第一方向)第一候选运动矢量的方式可以有多种,包括:Based on the first aspect, in a possible implementation manner, the manner in which the decoding end (or the encoding end) selects (the first direction) the first candidate motion vector from the candidate motion vector set may be various, including:
方式一:当所述候选运动矢量集合中的第四候选运动矢量由所述第二方向预测生成时,根据比例关系缩小或放大所述第四候选运动矢量,以得到所述第一候选运动矢量;其中,所述比例关系包括第一时序差和第二时序差的比值,所述第一时序差为所述第一候选运动矢量所确定的参考图像帧的图像序列号和所述待处理块所在的图像帧的图像序列号的差 值,所述第二时序差为所述第四候选运动矢量所确定的参考图像帧的图像序列号和所述待处理块所在的图像帧的图像序列号的差值。具体的:当从所述候选运动矢量集合所选取的第四候选运动矢量由所述第二方向预测生成时,将所述第四候选运动矢量按第一比例关系映射为所述第一候选运动矢量;其中,所述第一候选运动矢量与所述第四候选运动矢量之间构成第一比例关系(所述第一比例关系是一种标量);第一候选运动矢量所确定的参考图像帧的时序和当前块所在的图像帧的时序之间构成第一时序差,所述第四候选运动矢量所确定的参考图像帧的时序和当前块所在的图像帧的时序之间构成第二时序差,所述第一时序差与所述第二时序差之间构成第二比例关系(所述第二比例关系是一种标量);所述第一比例关系和所述第二比例关系相同。Manner 1: When the fourth candidate motion vector in the candidate motion vector set is generated by the second direction prediction, the fourth candidate motion vector is reduced or enlarged according to a proportional relationship to obtain the first candidate motion vector. Wherein the proportional relationship includes a ratio of a first timing difference and a second timing difference, the first timing difference being an image sequence number of the reference image frame determined by the first candidate motion vector and the to-be-processed block a difference between image sequence numbers of the image frames in which the second time difference is an image sequence number of the reference image frame determined by the fourth candidate motion vector and an image sequence number of the image frame in which the to-be-processed block is located The difference. Specifically: when the fourth candidate motion vector selected from the candidate motion vector set is generated by the second direction prediction, mapping the fourth candidate motion vector to the first candidate motion according to a first proportional relationship a vector; wherein the first candidate motion vector and the fourth candidate motion vector form a first proportional relationship (the first proportional relationship is a scalar); the reference image frame determined by the first candidate motion vector Forming a first timing difference between the timing of the image frame in which the current block is located, and the timing difference between the timing of the reference image frame determined by the fourth candidate motion vector and the timing of the image frame in which the current block is located constitutes a second timing difference And forming a second proportional relationship between the first timing difference and the second timing difference (the second proportional relationship is a scalar); the first proportional relationship and the second proportional relationship are the same.
也就是说,如果前(后)向预测中选取的候选运动矢量为通过后(或前)向预测而得到的,可通过映射得到用于前(后)向预测的候选运动矢量,作为所选择的候选运动矢量值应用到后续步骤。That is to say, if the candidate motion vector selected from the previous (post) prediction is obtained by post- (or forward) prediction, the candidate motion vector for the pre- (post) prediction can be obtained by mapping as the selected one. The candidate motion vector values are applied to subsequent steps.
方式二:当所述第一候选运动矢量由所述双向预测生成时,根据第五候选运动矢量,确定所述至少两个第一参考运动矢量,其中,所述第一候选运动矢量确定的参考块由根据所述第五候选运动矢量确定的第一方向参考块和根据所述第六候选运动矢量确定的第二方向参考块加权获得,所述第五候选运动矢量由所述第一方向预测生成,所述第六候选运动矢量由所述第二方向预测生成。Manner 2: determining, when the first candidate motion vector is generated by the bidirectional prediction, the at least two first reference motion vectors according to the fifth candidate motion vector, wherein the reference of the first candidate motion vector determination The block is obtained by weighting a first direction reference block determined according to the fifth candidate motion vector and a second direction reference block determined according to the sixth candidate motion vector, the fifth candidate motion vector being predicted by the first direction Generating, the sixth candidate motion vector is generated by the second direction prediction.
也就是说,如果前(或后)向预测中选取的候选运动矢量是通过双向预测而得到的,则选取该候选运动矢量中用于前(或后)向预测部分的值,作为所选择的候选运动矢量值应用到后续步骤。That is, if the candidate motion vector selected from the previous (or later) prediction is obtained by bidirectional prediction, the value of the candidate motion vector for the front (or back) prediction portion is selected as the selected one. The candidate motion vector values are applied to subsequent steps.
如果选取的候选运动矢量就是通过前(后)向预测而得到,那么就直接采用该候选运动矢量作为所选择的候选运动矢量值应用到后续步骤。If the selected candidate motion vector is obtained by pre- (post) prediction, then the candidate motion vector is directly used as the selected candidate motion vector value to be applied to the subsequent step.
方式三:如果前(后)向预测中选取的候选运动矢量就是通过前(后)向预测而得到,那么就直接采用该候选运动矢量作为所选择的候选运动矢量值应用到后续步骤。Manner 3: If the candidate motion vector selected in the previous (post) prediction is obtained by the pre (post) prediction, the candidate motion vector is directly used as the selected candidate motion vector value to be applied to the subsequent step.
需要说明的是,在可能的实施方式中,从候选运动矢量集合中的选取(第二方向)第二候选运动矢量的方式也可以有多种,具体可参考上述方式实现,这里不再赘述。It should be noted that, in a possible implementation manner, the manner of selecting the second candidate motion vector (the second direction) from the candidate motion vector set may also be multiple, and may be implemented by referring to the foregoing manner, and details are not described herein again.
可以看出,实施本发明上述实施例可以提高候选运动矢量选取过程中的准确性和容错性,进而提高模板匹配过程中的准确性和容错性。It can be seen that the implementation of the above embodiment of the present invention can improve the accuracy and fault tolerance of the candidate motion vector selection process, thereby improving the accuracy and fault tolerance in the template matching process.
基于第一方面,在可能的实施方式中,根据所述候选运动矢量集合中的第一候选运动矢量,确定至少两个第一参考运动矢量,包括:根据所述第一候选运动矢量在所述第一参考图像中确定的所述待处理块的参考块;以目标精度在所述确定的参考块的邻近位置进行搜索得到至少两个候选参考块,其中,每个所述候选参考块对应一个所述第一参考运动矢量,所述目标精度包括4像素精度、2像素精度、整像素精度、半像素精度、1/4像素精度、1/8像素精度中的一种。实施本发明实施例有利于提高模板匹配过程中的搜索精度,进而提高模板匹配结果的准确性。Based on the first aspect, in a possible implementation, determining the at least two first reference motion vectors according to the first candidate motion vector in the candidate motion vector set, including: according to the first candidate motion vector, a reference block of the to-be-processed block determined in the first reference image; searching at a neighboring position of the determined reference block with a target precision to obtain at least two candidate reference blocks, wherein each of the candidate reference blocks corresponds to one The first reference motion vector, the target accuracy includes one of 4 pixel precision, 2 pixel precision, integer pixel precision, half pixel precision, 1/4 pixel precision, and 1/8 pixel precision. The implementation of the embodiments of the present invention is advantageous for improving the search precision in the template matching process, thereby improving the accuracy of the template matching result.
基于第一方面,在可能的实施方式中,当前块的至少一个邻近已重构块、参考块的至少一个邻近已重构块和图像块的至少一个邻近已重构块之间的形状相同且尺寸相等。假如,当前块的至少一个邻近已重构块与当前块之间具有位置关系1(如在一定范围内相邻或接 近如邻接关系)、参考块的至少一个邻近已重构块与参考块之间具有位置关系2(如在一定范围内相邻或接近如邻接关系)、图像块的至少一个邻近已重构块与该图像块之间具有位置关系3(如在一定范围内相邻或接近邻接关系),那么,位置关系1、位置关系2和位置关系3可以是相同的。但是,在可能的实施例中,位置关系1、位置关系2和位置关系3也可以有差异的。Based on the first aspect, in a possible implementation, the at least one adjacent reconstructed block of the current block, the at least one adjacent reconstructed block of the reference block, and the at least one adjacent reconstructed block of the image block have the same shape and The dimensions are equal. Supposing that at least one adjacent reconstructed block of the current block has a positional relationship 1 with the current block (eg, adjacent or close to an adjacency relationship within a certain range), at least one adjacent reconstructed block and a reference block of the reference block Having a positional relationship 2 (such as adjacent or close to a neighboring relationship within a certain range), at least one adjacent reconstructed block of the image block has a positional relationship 3 with the image block (eg, adjacent or close within a certain range) The adjacency relationship, then, the positional relationship 1, the positional relationship 2, and the positional relationship 3 may be the same. However, in a possible embodiment, the positional relationship 1, the positional relationship 2, and the positional relationship 3 may also differ.
第二方面,本发明实施例提供了又一种预测运动矢量的生成方法,所述方法可用于混合预测模式中的双向预测,所述混合预测模式包括Merge模式和AMVP模式。所述双向预测包括第一方向预测和第二方向预测,所述第一方向预测是基于第一参考帧列表的预测,所述第二方向预测是基于第二参考帧列表的预测,所述方法包括:获取第一预测模式,生成第一候选运动矢量集合,所述第一候选运动矢量集合用于在所述第一方向预测中生成第一方向预测运动矢量;获取第二预测模式,生成第二候选运动矢量集合,所述第二候选运动矢量集合用于在所述第二方向预测中生成第二方向预测运动矢量,其中,当所述第一预测模式为AMVP模式时,所述第二预测模式为Merge模式,或者,当所述第一预测模式为Merge模式时,所述第二预测模式为AMVP模式。In a second aspect, an embodiment of the present invention provides a method for generating a motion vector predictor, where the method may be used for bidirectional prediction in a hybrid prediction mode, where the hybrid prediction mode includes a Merge mode and an AMVP mode. The bidirectional prediction includes a first direction prediction based on a prediction of a first reference frame list and a second direction prediction based on a prediction of a second reference frame list, the method The method includes: acquiring a first prediction mode, generating a first candidate motion vector set, where the first candidate motion vector set is used to generate a first direction prediction motion vector in the first direction prediction; acquiring a second prediction mode, generating a a second candidate motion vector set for generating a second direction prediction motion vector in the second direction prediction, wherein when the first prediction mode is an AMVP mode, the second The prediction mode is the Merge mode, or when the first prediction mode is the Merge mode, the second prediction mode is the AMVP mode.
本发明实施例提供的混合预测模式是一种新型的编解码模式,基于混合预测模式也可以能够保证编解码过程中获得当前块的最佳参考块,在确保获得当前块的最佳参考块的情况下提高编解码的效率。The hybrid prediction mode provided by the embodiment of the present invention is a novel codec mode, and the hybrid prediction mode can also ensure that the best reference block of the current block is obtained in the codec process, and the best reference block of the current block is obtained. Improve the efficiency of codec in case.
基于第一方面,在可能的实施方式中,当所述第一预测模式为Merge模式时,所述获取第一预测模式,生成第一候选运动矢量集合,包括:使用Merge模式在所述第一方向预测中使用的候选运动矢量,生成所述第一候选运动矢量集合。Based on the first aspect, in a possible implementation, when the first prediction mode is the Merge mode, the acquiring the first prediction mode, generating the first candidate motion vector set, includes: using the Merge mode at the first The candidate motion vector used in the direction prediction generates the first candidate motion vector set.
基于第一方面,在可能的实施方式中,当所述第一预测模式为AMVP模式时,所述获取第一预测模式,生成第一候选运动矢量集合,包括:使用AMVP模式在所述第一方向预测中使用的候选运动矢量,生成所述第一候选运动矢量集合。Based on the first aspect, in a possible implementation, when the first prediction mode is the AMVP mode, the acquiring the first prediction mode, generating the first candidate motion vector set, includes: using the AMVP mode at the first The candidate motion vector used in the direction prediction generates the first candidate motion vector set.
基于第一方面,在可能的实施方式中,当所述第二预测模式为Merge模式时,所述获取第二预测模式,生成第二候选运动矢量集合,包括:使用Merge模式在所述第二方向预测中使用的候选预测矢量,生成所述第二候选运动矢量集合。Based on the first aspect, in a possible implementation, when the second prediction mode is the Merge mode, the acquiring the second prediction mode, generating the second candidate motion vector set, includes: using the Merge mode in the second The candidate prediction vector used in the direction prediction generates the second candidate motion vector set.
基于第一方面,在可能的实施方式中,当所述第二预测模式为AMVP模式时,所述获取第二预测模式,生成第二候选运动矢量集合,包括:使用AMVP模式在所述第二方向预测中使用的候选运动矢量,生成所述第二候选运动矢量集合。Based on the first aspect, in a possible implementation, when the second prediction mode is the AMVP mode, the acquiring the second prediction mode, generating the second candidate motion vector set, includes: using the AMVP mode in the second The candidate motion vector used in the direction prediction generates the second candidate motion vector set.
在一种可能实施方式中,在双向预测中,编解码端均采用混合预测模式,那么解码可获得至少两个标识信息,一个标识信息用于指示一个方向采用Merge模式,另一个标识信息用于指示另一个方向采用AMVP模式。或者,一个标识信息用于指示一个方向采用Merge模式以及指示Merge候选列表的索引值,另一个标识信息用于指示另一个方向采用AMVP模式以及指示AMVP候选列表的索引值。所以,解码端只需基于双向预测中的两个标识信息就能快速确定预测模式,以及快速选取候选运动矢量使用模板匹配的方式来进行更新(或者直接基于所指示的索引值选取该候选运动矢量作为预测运动矢量来计算预测块),提高解码效率。In a possible implementation manner, in the bidirectional prediction, the codec end adopts a hybrid prediction mode, and then decoding may obtain at least two pieces of identification information, one identification information is used to indicate that one direction adopts the Merge mode, and another identification information is used for Indicates that the other direction uses AMVP mode. Alternatively, one identification information is used to indicate that one direction adopts the Merge mode and an index value indicating the Merge candidate list, and the other identification information is used to indicate that the other direction adopts the AMVP mode and the index value indicating the AMVP candidate list. Therefore, the decoding end can quickly determine the prediction mode based on the two identification information in the bidirectional prediction, and quickly select the candidate motion vector to update by using template matching (or directly select the candidate motion vector based on the indicated index value). The prediction block is calculated as a predicted motion vector), and the decoding efficiency is improved.
在一种可能实施方式中,在双向预测中,编解码端均采用混合预测模式(即不同方向 分别采用Merge模式和AMVP模式),那么解码可获得至少两个组合{第一标识信息,第一索引值}、{第二标识信息,第二索引值},其中{第一标识信息,第一索引值}中,第一标识信息表示第一方向的预测模式,第一索引值表示该第一方向的候选列表的索引值;{第二标识信息,第二索引值}中,第二标识信息表示第二方向的预测模式,第二索引值表示该第二方向的候选列表的索引值。所以,解码端基于两个组合{第一标识信息,第一索引值}、{第二标识信息,第二索引值}就能快速确定双向预测中不同方向的预测模式,以及选取候选列表中的候选运动矢量使用模板匹配的方式来进行更新(或者直接基于索引值选取该候选运动矢量作为预测运动矢量来计算对应方向的预测块),提高解码效率。In a possible implementation manner, in the bidirectional prediction, the codec end adopts a hybrid prediction mode (that is, the Merge mode and the AMVP mode are respectively adopted in different directions), then the decoding obtains at least two combinations {first identification information, first Index value}, {second identification information, second index value}, wherein in the {first identification information, the first index value}, the first identification information represents a prediction mode in the first direction, and the first index value represents the first In the index value of the candidate list of directions; in the second identifier information, the second index value, the second identifier information indicates a prediction mode in the second direction, and the second index value indicates an index value of the candidate list in the second direction. Therefore, the decoding end can quickly determine the prediction modes in different directions in the bidirectional prediction based on the two combinations {first identification information, the first index value}, the {second identification information, the second index value}, and select the candidates in the candidate list. The candidate motion vector is updated by using template matching (or the candidate motion vector is directly selected as the predicted motion vector based on the index value to calculate the prediction block of the corresponding direction), thereby improving the decoding efficiency.
具体的,当所述第一标识信息用于指示所述第一预测模式为Merge模式时,所述第一标识信息还用于指示Merge模式的索引信息,或,当所述第一标识信息用于指示所述第一预测模式为AVMP模式时,所述第一标识信息还用于指示AMVP模式的索引信息。Specifically, when the first identifier information is used to indicate that the first prediction mode is the Merge mode, the first identifier information is further used to indicate index information of the Merge mode, or when the first identifier information is used by The first identifier information is further used to indicate index information of the AMVP mode when the first prediction mode is indicated as the AVMP mode.
具体的,在双向预测中的某个方向,标识信息(第一标识信息或者第二标识信息)用于指示解码当前块所采用的预测模式,并且,当所述标识信息指示的预测模式为AMVP模式时,同时指示AMVP候选列表的索引值;当所述标识信息指示的预测模式为Merge模式时,解码端可使用预设的Merge模式的索引值。所以,解码端基于所述标识信息就能快速确定预测模式以及确定候选运动矢量,并在Merge模式中快速候选列表的第一个选取候选运动矢量(或者其他预先指定的候选运动矢量)使用模板匹配的方式来进行更新(或者直接选取指定的候选运动矢量作为预测运动矢量来计算预测块),提高解码效率。Specifically, in a certain direction in the bidirectional prediction, the identifier information (the first identifier information or the second identifier information) is used to indicate a prediction mode used by the decoding current block, and when the prediction mode indicated by the identifier information is AMVP In the mode, the index value of the AMVP candidate list is simultaneously indicated; when the prediction mode indicated by the identifier information is the Merge mode, the decoding end may use the index value of the preset Merge mode. Therefore, the decoding end can quickly determine the prediction mode and determine the candidate motion vector based on the identification information, and use the template matching in the first candidate motion vector (or other pre-specified candidate motion vector) of the quick candidate list in the Merge mode. The way to update (or directly select the specified candidate motion vector as the predicted motion vector to calculate the prediction block), improve the decoding efficiency.
具体的,在解码端,在所述获取第二预测模式,生成第二候选运动矢量集合之前,还包括:在确定所述第一预测模式为Merge模式之后,解析所述码流获得第二标识信息,所述第二标识信息用于指示AMVP模式的索引信息。Specifically, before the acquiring the second prediction mode and generating the second candidate motion vector set, the method further includes: after determining that the first prediction mode is the Merge mode, parsing the code stream to obtain the second identifier. Information, the second identification information is used to indicate index information of the AMVP mode.
具体的,在解码端,在所述获取第二预测模式,生成第二候选运动矢量集合之前,还包括:在确定所述第一预测模式为AMVP模式之后,解析所述码流获得第二标识信息,所述第二标识信息用于指示Merge模式的索引信息。Specifically, before the acquiring the second prediction mode and generating the second candidate motion vector set, the method further includes: after determining that the first prediction mode is the AMVP mode, parsing the code stream to obtain the second identifier. Information, the second identification information is used to indicate index information of the Merge mode.
基于第一方面,在可能的实施方式中,解码端确定所述第一预测模式为AMVP模式之后,解析所述码流获得所述第一方向预测的参考帧索引和运动矢量差信息;或者,确定所述第二预测模式为AMVP模式之后,解析所述码流获得所述第二方向预测的参考帧索引和运动矢量差信息。Based on the first aspect, in a possible implementation, after the decoding end determines that the first prediction mode is the AMVP mode, parsing the code stream to obtain the reference frame index and the motion vector difference information of the first direction prediction; or After determining that the second prediction mode is the AMVP mode, parsing the code stream to obtain the reference frame index and motion vector difference information of the second direction prediction.
另外,在本发明可能的实施例中,双向预测中的编解码端可以利用本发明实施例所提供的模板匹配方式进行候选列表的更新,具体过程参考第一方面的描述,这里不再赘述。In addition, in a possible embodiment of the present invention, the codec end in the bidirectional prediction may use the template matching manner provided by the embodiment of the present invention to update the candidate list. The specific process refers to the description of the first aspect, and details are not described herein again.
第三方面,本发明实施例提供一种用于生成预测运动矢量的设备,所述设备包括:集合生成模块,用于构建待处理块的候选运动矢量集合;模板匹配模块,用于根据所述候选运动矢量集合中的第一候选运动矢量,确定至少两个第一参考运动矢量,所述第一参考运动矢量用来确定所述待处理块在所述待处理块的第一参考图像中的参考块;所述模板匹配模块还用于,分别计算至少两个所述确定的参考块的一个或多个第一邻近已重构块和所述待处理块的一个或多个第二邻近已重构块之间的像素差异值或者率失真代价值,其中,所述第一邻近已重构块和所述第二邻近已重构块的形状相同且尺寸相等;预测运动矢量生成模块,用于根据所述至少两个第一参考运动矢量中对应的所述像素差异值或者率失真代价 值最小的一个第一参考运动矢量,获得所述待处理块的第一预测运动矢量。具体的,所述设备中的各个模块用于实现第一方面所描述的方法。In a third aspect, an embodiment of the present invention provides an apparatus for generating a predicted motion vector, where the apparatus includes: a set generation module, configured to construct a candidate motion vector set of a block to be processed; and a template matching module, configured to Determining, by the first candidate motion vector in the set of candidate motion vectors, at least two first reference motion vectors, the first reference motion vector being used to determine that the to-be-processed block is in a first reference image of the to-be-processed block a reference block; the template matching module is further configured to separately calculate one or more first neighbor reconstructed blocks of the at least two determined reference blocks and one or more second neighbors of the to-be-processed block Reconstructing a pixel difference value or a rate distortion generation value between the blocks, wherein the first adjacent reconstructed block and the second adjacent reconstructed block have the same shape and the same size; the predicted motion vector generation module uses Obtaining the to-be-processed block according to a corresponding one of the at least two first reference motion vectors and the first reference motion vector having the lowest rate-distortion value The first predicted motion vector. Specifically, each module in the device is used to implement the method described in the first aspect.
第四方面,本发明实施例提供又一种用于生成预测运动矢量的设备,所述设备用于进行待处理块的双向预测,所述双向预测包括第一方向预测和第二方向预测,所述第一方向预测是基于第一参考帧列表的预测,所述第二方向预测是基于第二参考帧列表的预测,所述设备包括:第一集合生成模块,用于获取第一预测模式,生成第一候选运动矢量集合,所述第一候选运动矢量集合用于在所述第一方向预测中生成第一方向预测运动矢量;第二集合生成模块,用于获取第二预测模式,生成第二候选运动矢量集合,所述第二候选运动矢量集合用于在所述第二方向预测中生成第二方向预测运动矢量,其中,当所述第一预测模式为AMVP模式时,所述第二预测模式为Merge模式,或者,当所述第一预测模式为Merge模式时,所述第二预测模式为AMVP模式。所述设备中的各个模块具体用于实现第二方面所描述的方法。In a fourth aspect, an embodiment of the present invention provides another apparatus for generating a predicted motion vector, where the apparatus is configured to perform bidirectional prediction of a to-be-processed block, where the bidirectional prediction includes a first direction prediction and a second direction prediction, where The first direction prediction is based on the prediction of the first reference frame list, and the second direction prediction is based on the prediction of the second reference frame list, the device comprising: a first set generation module, configured to acquire the first prediction mode, Generating a first candidate motion vector set, the first candidate motion vector set is used to generate a first direction prediction motion vector in the first direction prediction, and a second set generation module is configured to acquire a second prediction mode, generate a first a second candidate motion vector set for generating a second direction prediction motion vector in the second direction prediction, wherein when the first prediction mode is an AMVP mode, the second The prediction mode is the Merge mode, or when the first prediction mode is the Merge mode, the second prediction mode is the AMVP mode. The various modules in the device are specifically for implementing the method described in the second aspect.
第五方面,本发明实施例提供一种用于生成预测运动矢量的设备,该设备包括:设备可以是应用于编码侧,也可以是应用于解码侧。该设备包括处理器、存储器,所述处理器和存储器相连接(如通过总线相互连接),在可能的实施方式中,该设备还可包括收发器,收发器连接处理器和存储器,用于接收/发送数据。存储器用于存储程序代码和视频数据。处理器可用于读取所存储器中存储的程序代码,执行第一方面所描述的方法。In a fifth aspect, an embodiment of the present invention provides an apparatus for generating a predicted motion vector, where the apparatus includes: the device may be applied to an encoding side, or may be applied to a decoding side. The device includes a processor, a memory, and the memory are connected (e.g., connected to each other through a bus). In a possible implementation, the device may further include a transceiver, the transceiver is coupled to the processor and the memory, for receiving /send data. The memory is used to store program code and video data. The processor can be configured to read the program code stored in the memory and perform the method described in the first aspect.
第六方面,本发明实施例提供又一种用于生成预测运动矢量的设备,该设备包括:设备可以是应用于编码侧,也可以是应用于解码侧。该设备包括处理器、存储器,所述处理器和存储器相连接(如通过总线相互连接),在可能的实施方式中,该设备还可包括收发器,收发器连接处理器和存储器,用于接收/发送数据。存储器用于存储程序代码和视频数据。处理器可用于读取所存储器中存储的程序代码,执行第二方面所描述的方法。In a sixth aspect, the embodiment of the present invention provides another device for generating a predicted motion vector, where the device includes: the device may be applied to the encoding side, or may be applied to the decoding side. The device includes a processor, a memory, and the memory are connected (e.g., connected to each other through a bus). In a possible implementation, the device may further include a transceiver, the transceiver is coupled to the processor and the memory, for receiving /send data. The memory is used to store program code and video data. The processor can be configured to read the program code stored in the memory and perform the method described in the second aspect.
第七方面,本发明实施例提供了一种视频编解码系统,该视频编解码系统包括源装置及目的地装置。源装置与目的地装置可进行通信连接。源装置产生经编码视频数据。因此,源装置可被称作视频编码装置或视频编码设备。目的地装置可解码由源装置产生的经编码视频数据。因此,目的地装置可被称作视频解码装置或视频解码设备。源装置及目的地装置可为视频编解码装置或视频编解码设备的实例。第一方面或和/或第二方面所描述的方法会应用在该视频编解码装置或视频编解码设备,也就是说,所述视频编解码系统可用于实现第一方面和/或第二方面所描述的方法。In a seventh aspect, an embodiment of the present invention provides a video codec system, where the video codec system includes a source device and a destination device. The source device and the destination device can be in a communicative connection. The source device produces encoded video data. Therefore, the source device may be referred to as a video encoding device or a video encoding device. The destination device can decode the encoded video data produced by the source device. Thus, the destination device may be referred to as a video decoding device or a video decoding device. The source device and the destination device may be instances of a video codec device or a video codec device. The method described in the first aspect and/or the second aspect may be applied to the video codec device or video codec device, that is, the video codec system may be used to implement the first aspect and/or the second aspect. The method described.
第八方面,本发明实施例提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述第一方面所述的方法。In an eighth aspect, an embodiment of the present invention provides a computer readable storage medium, wherein the computer readable storage medium stores instructions that, when run on a computer, cause the computer to perform the method described in the first aspect above.
第九方面,本发明实施例提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述第二方面所述的方法。According to a ninth aspect, an embodiment of the present invention provides a computer readable storage medium, wherein the computer readable storage medium stores instructions that, when run on a computer, cause the computer to perform the method described in the second aspect above.
第十方面,本发明实施例提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面所述的方法。In a tenth aspect, an embodiment of the present invention provides a computer program product comprising instructions, which when executed on a computer, cause the computer to perform the method described in the first aspect above.
第十一方面,本发明实施例提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第二方面所述的方法。In an eleventh aspect, an embodiment of the present invention provides a computer program product comprising instructions that, when run on a computer, cause the computer to perform the method of the second aspect described above.
可以看出,本发明实施例中,视频编解码系统可利用模板匹配的方式,验证当前块的 参考图像中一定范围内(甚至整个参考图像内)的参考图像块的邻近已重构块是否与当前块的邻近已重构块有较好的匹配,对基于Merge或AMVP模式所构建的候选列表的候选运动矢量进行更新,基于更新后的候选列表能够保证编解码过程中获得当前块的最佳参考图像块,进而构建出当前块准确的重构块。另外,本发明实施例还提供了混合预测模式,基于所述混合预测模式也可以能够保证编解码过程中获得当前块的最佳参考块,在确保获得当前块的最佳参考块的情况下提高编解码的效率。It can be seen that, in the embodiment of the present invention, the video codec system can verify whether the adjacent reconstructed block of the reference image block in a certain range (or even the entire reference image) in the reference image of the current block is compared with the template matching manner. The neighboring reconstructed block of the current block has a good match, and the candidate motion vector of the candidate list constructed based on the Merge or AMVP mode is updated, and the updated candidate list can ensure the best of the current block in the encoding and decoding process. The reference image block is used to construct an accurate block of the current block. In addition, the embodiment of the present invention further provides a hybrid prediction mode, and based on the hybrid prediction mode, it may also be able to obtain an optimal reference block of the current block in the coding and decoding process, and improve in the case of ensuring that the best reference block of the current block is obtained. The efficiency of codec.
附图说明DRAWINGS
图1是本发明实施例提供的一种编解码系统的结构示意图;1 is a schematic structural diagram of a codec system according to an embodiment of the present invention;
图2是本发明实施例提供的一种视频编解码装置或电子设备的示意性框图;2 is a schematic block diagram of a video codec device or an electronic device according to an embodiment of the present invention;
图3是本发明实施例提供的一种终端的示意图;3 is a schematic diagram of a terminal according to an embodiment of the present invention;
图4是本发明实施例提供的一种AMVP候选列表的示意图;4 is a schematic diagram of an AMVP candidate list according to an embodiment of the present invention;
图5是本发明实施例提供的一种merge候选列表的示意图;FIG. 5 is a schematic diagram of a merge candidate list according to an embodiment of the present invention; FIG.
图6是本发明实施例提供的又一种AMVP候选列表的示意图;FIG. 6 is a schematic diagram of still another AMVP candidate list according to an embodiment of the present invention;
图7是本发明实施例提供的又一种merge候选列表的示意图;FIG. 7 is a schematic diagram of still another merge candidate list according to an embodiment of the present invention; FIG.
图8是本发明实施例提供的一种模板匹配方式的场景示意图;FIG. 8 is a schematic diagram of a scenario of a template matching manner according to an embodiment of the present disclosure;
图9是本发明实施例提供的又一种模板匹配方式的场景示意图;FIG. 9 is a schematic diagram of another scenario of a template matching manner according to an embodiment of the present disclosure;
图10是本发明实施例提供的一种Merge模式的编解码过程示意图;10 is a schematic diagram of a codec process of a Merge mode according to an embodiment of the present invention;
图11是本发明实施例提供的又一种Merge模式的编解码过程示意图;11 is a schematic diagram of a codec process of another Merge mode according to an embodiment of the present invention;
图12是本发明实施例提供的一种AMVP模式的编解码过程示意图;FIG. 12 is a schematic diagram of a codec process of an AMVP mode according to an embodiment of the present invention;
图13是本发明实施例提供的又一种AMVP模式的编解码过程示意图;FIG. 13 is a schematic diagram of another encoding and decoding process of an AMVP mode according to an embodiment of the present invention; FIG.
图14-24是本发明实施例提供的一些预测运动矢量生成方法的流程示意图;14-24 are schematic flowcharts of some methods for generating a motion vector predictor according to an embodiment of the present invention;
图25-28是本发明实施例提供的一些设备的结构示意图。25-28 are schematic structural diagrams of some devices provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面结合本发明实施例中的附图对本发明实施例进行描述。本发明的实施方式部分使用的术语仅用于对本发明的具体实施例进行解释,而非旨在限定本发明。The embodiments of the present invention are described below in conjunction with the accompanying drawings in the embodiments of the present invention. The terms used in the embodiments of the present invention are only used to explain the specific embodiments of the present invention, and are not intended to limit the present invention.
首先介绍本发明实施例所应用的系统框架,首先参见图1,图1是本发明实施例提供的一种视频编解码系统10的示意性框图。如图1所示,视频编解码系统10包含源装置12及目的地装置14。源装置12产生经编码视频数据。因此,源装置12可被称作视频编码装置或视频编码设备。目的地装置14可解码由源装置12产生的经编码视频数据。因此,目的地装置14可被称作视频解码装置或视频解码设备。源装置12及目的地装置14可为视频编解码装置或视频编解码设备的实例。源装置12及目的地装置14可包括广泛范围的装置,包含台式计算机、移动计算装置、笔记本(例如,膝上型)计算机、平板计算机、机顶盒、智能电话等手持机、电视、相机、显示装置、数字媒体播放器、视频游戏控制台、车载计算机,或其类似者。The system frame to which the embodiment of the present invention is applied is first introduced. Referring first to FIG. 1, FIG. 1 is a schematic block diagram of a video codec system 10 according to an embodiment of the present invention. As shown in FIG. 1, video codec system 10 includes source device 12 and destination device 14. Source device 12 produces encoded video data. Thus, source device 12 may be referred to as a video encoding device or a video encoding device. Destination device 14 may decode the encoded video data produced by source device 12. Thus, destination device 14 may be referred to as a video decoding device or a video decoding device. Source device 12 and destination device 14 may be examples of video codec devices or video codec devices. Source device 12 and destination device 14 may include a wide range of devices including desktop computers, mobile computing devices, notebook (eg, laptop) computers, tablet computers, set top boxes, smart phones, etc., televisions, cameras, display devices , digital media player, video game console, on-board computer, or the like.
目的地装置14可经由信道16接收来自源装置12的编码后的视频数据。信道16可包括能够将经编码视频数据从源装置12移动到目的地装置14的一个或多个媒体及/或装置。 在一个实例中,信道16可包括使源装置12能够实时地将编码后的视频数据直接发射到目的地装置14的一个或多个通信媒体。在此实例中,源装置12可根据通信标准(例如,无线通信协议)来调制编码后的视频数据,且可将调制后的视频数据发射到目的地装置14。所述一个或多个通信媒体可包含无线及/或有线通信媒体,例如射频(RF)频谱或一根或多根物理传输线。所述一个或多个通信媒体可形成基于包的网络(例如,局域网、广域网或全球网络(例如,因特网))的部分。所述一个或多个通信媒体可包含路由器、交换器、基站,或促进从源装置12到目的地装置14的通信的其它设备。Destination device 14 may receive the encoded video data from source device 12 via channel 16. Channel 16 may include one or more media and/or devices capable of moving encoded video data from source device 12 to destination device 14. In one example, channel 16 may include one or more communication media that enable source device 12 to transmit encoded video data directly to destination device 14 in real time. In this example, source device 12 may modulate the encoded video data in accordance with a communication standard (eg, a wireless communication protocol) and may transmit the modulated video data to destination device 14. The one or more communication media may include wireless and/or wired communication media, such as a radio frequency (RF) spectrum or one or more physical transmission lines. The one or more communication media may form part of a packet-based network (eg, a local area network, a wide area network, or a global network (eg, the Internet)). The one or more communication media may include routers, switches, base stations, or other devices that facilitate communication from source device 12 to destination device 14.
在另一实例中,信道16可包含存储由源装置12产生的编码后的视频数据的存储媒体。在此实例中,目的地装置14可经由磁盘存取或卡存取来存取存储媒体。存储媒体可包含多种本地存取式数据存储媒体,例如蓝光光盘、DVD、CD-ROM、快闪存储器,或用于存储经编码视频数据的其它合适数字存储媒体。In another example, channel 16 can include a storage medium that stores encoded video data generated by source device 12. In this example, destination device 14 can access the storage medium via disk access or card access. The storage medium may include a variety of locally accessible data storage media, such as Blu-ray Disc, DVD, CD-ROM, flash memory, or other suitable digital storage medium for storing encoded video data.
在另一实例中,信道16可包含文件服务器或存储由源装置12产生的编码后的视频数据的另一中间存储装置。在此实例中,目的地装置14可经由流式传输或下载来存取存储于文件服务器或其它中间存储装置处的编码后的视频数据。文件服务器可以是能够存储编码后的视频数据且将所述编码后的视频数据发射到目的地装置14的服务器类型。实例文件服务器包含web服务器(例如,用于网站)、文件传送协议(FTP)服务器、网络附加存储(NAS)装置,及本地磁盘驱动器。In another example, channel 16 can include a file server or another intermediate storage device that stores encoded video data generated by source device 12. In this example, destination device 14 may access the encoded video data stored at a file server or other intermediate storage device via streaming or download. The file server may be a server type capable of storing encoded video data and transmitting the encoded video data to the destination device 14. The instance file server includes a web server (eg, for a website), a file transfer protocol (FTP) server, a network attached storage (NAS) device, and a local disk drive.
目的地装置14可经由标准数据连接(例如,因特网连接)来存取编码后的视频数据。数据连接的实例类型包含适合于存取存储于文件服务器上的编码后的视频数据的无线信道(例如,Wi-Fi连接)、有线连接(例如,DSL、缆线调制解调器等),或两者的组合。编码后的视频数据从文件服务器的发射可为流式传输、下载传输或两者的组合。Destination device 14 can access the encoded video data via a standard data connection (e.g., an internet connection). An instance type of a data connection includes a wireless channel (eg, a Wi-Fi connection), a wired connection (eg, DSL, cable modem, etc.), or both, suitable for accessing encoded video data stored on a file server. combination. The transmission of the encoded video data from the file server may be streaming, downloading, or a combination of both.
本发明的技术不限于无线应用场景,示例性的,可将所述技术应用于支持以下应用等多种多媒体应用的视频编解码:空中电视广播、有线电视发射、卫星电视发射、流式传输视频发射(例如,经由因特网)、存储于数据存储媒体上的视频数据的编码、存储于数据存储媒体上的视频数据的解码,或其它应用。在一些实例中,视频编解码系统10可经配置以支持单向或双向视频发射,以支持例如视频流式传输、视频播放、视频广播及/或视频电话等应用。The technology of the present invention is not limited to a wireless application scenario. Illustratively, the technology can be applied to video codecs supporting multiple multimedia applications such as aerial television broadcasting, cable television transmission, satellite television transmission, and streaming video. Transmission (eg, via the Internet), encoding of video data stored on a data storage medium, decoding of video data stored on a data storage medium, or other application. In some examples, video codec system 10 may be configured to support one-way or two-way video transmission to support applications such as video streaming, video playback, video broadcasting, and/or video telephony.
在图1的实例中,源装置12包含视频源18、视频编码器20及输出接口22。在一些实例中,输出接口22可包含调制器/解调器(调制解调器)及/或发射器。视频源18可包含视频俘获装置(例如,视频相机)、含有先前俘获的视频数据的视频存档、用以从视频内容提供者接收视频数据的视频输入接口,及/或用于产生视频数据的计算机图形系统,或上述视频数据源的组合。In the example of FIG. 1, source device 12 includes a video source 18, a video encoder 20, and an output interface 22. In some examples, output interface 22 can include a modulator/demodulator (modem) and/or a transmitter. Video source 18 may include a video capture device (eg, a video camera), a video archive containing previously captured video data, a video input interface to receive video data from a video content provider, and/or a computer for generating video data. A graphics system, or a combination of the above video data sources.
视频编码器20可编码来自视频源18的视频数据,具体的,视频编码器20中设置有预测模块、变换模块、量化模块和熵编码模块等等。在一些实例中,源装置12经由输出接口22将编码后的视频数据直接发射到目的地装置14。编码后的视频数据还可存储于存储媒体或文件服务器上以供目的地装置14稍后存取以用于解码及/或播放。The video encoder 20 may encode video data from the video source 18. Specifically, the video encoder 20 is provided with a prediction module, a transform module, a quantization module, an entropy encoding module, and the like. In some examples, source device 12 transmits the encoded video data directly to destination device 14 via output interface 22. The encoded video data may also be stored on a storage medium or file server for later access by the destination device 14 for decoding and/or playback.
在图1的实例中,目的地装置14包含输入接口28、视频解码器30及显示装置32。在一些实例中,输入接口28包含接收器及/或调制解调器。输入接口28可经由信道16接收 编码后的视频数据。视频解码器30用于解码输入接口28所接收的码流(视频数据),具体的,视频解码器30中设置有熵解码模块、反量化模块、反变换模块和预测补偿模块等等。显示装置32可与目的地装置14整合或可在目的地装置14外部。一般来说,显示装置32显示解码后的视频数据。显示装置32可包括多种显示装置,例如液晶显示器(LCD)、等离子体显示器、有机发光二极管(OLED)显示器或其它类型的显示装置。In the example of FIG. 1, destination device 14 includes an input interface 28, a video decoder 30, and a display device 32. In some examples, input interface 28 includes a receiver and/or a modem. Input interface 28 can receive the encoded video data via channel 16. The video decoder 30 is configured to decode the code stream (video data) received by the input interface 28. Specifically, the video decoder 30 is provided with an entropy decoding module, an inverse quantization module, an inverse transform module, a prediction compensation module, and the like. Display device 32 may be integral with destination device 14 or may be external to destination device 14. In general, display device 32 displays the decoded video data. Display device 32 may include a variety of display devices such as liquid crystal displays (LCDs), plasma displays, organic light emitting diode (OLED) displays, or other types of display devices.
视频编码器20及视频解码器30可根据视频压缩标准(例如,高效率视频编解码H.265标准)而操作,且可遵照HEVC测试模型(HM)。H.265标准的文本描述ITU-TH.265(V3)(04/2015)于2015年4月29号发布,可从http://handle.itu.int/11.1002/1000/12455下载,所述文件的全部内容以引用的方式并入本文中。Video encoder 20 and video decoder 30 may operate in accordance with a video compression standard (eg, the High Efficiency Video Codec H.265 standard) and may conform to the HEVC Test Model (HM). A textual description of the H.265 standard is published on April 29, 2015, ITU-T.265(V3) (04/2015), available for download from http://handle.itu.int/11.1002/1000/12455 The entire contents of the document are incorporated herein by reference.
参见图2,图2是本发明实施例提供的一种视频编解码装置或电子设备50的示意性框图,该装置或者电子设备50可以并入根据本发明的实施例的编码解码器。图3是根据本发明实施例的一种用于视频编码的装置的结构示意图。下面将说明图2和图3中的单元。Referring to FIG. 2, FIG. 2 is a schematic block diagram of a video codec device or electronic device 50 according to an embodiment of the present invention. The device or electronic device 50 may incorporate a codec according to an embodiment of the present invention. FIG. 3 is a schematic structural diagram of an apparatus for video encoding according to an embodiment of the present invention. The units in Figures 2 and 3 will be explained below.
电子设备50可以例如是无线通信系统的移动终端或者用户设备。应理解,可以在可能需要对视频图像进行编码和解码,或者编码,或者解码的任何电子设备或者装置内实施本发明的实施例。The electronic device 50 can be, for example, a mobile terminal or user equipment of a wireless communication system. It should be understood that embodiments of the invention may be practiced in any electronic device or device that may require encoding and decoding, or encoding, or decoding of a video image.
装置50可以包括用于并入和保护设备的壳30。装置50还可以包括形式为液晶显示器的显示器32。在本发明的其它实施例中,显示器可以是适合于显示图像或者视频的任何适当的显示器技术。装置50还可以包括小键盘34。在本发明的其它实施例中,可以运用任何适当的数据或者用户接口机制。例如,可以实施用户接口为虚拟键盘或者数据录入系统作为触敏显示器的一部分。装置可以包括麦克风36或者任何适当的音频输入,该音频输入可以是数字或者模拟信号输入。装置50还可以包括如下音频输出设备,该音频输出设备在本发明的实施例中可以是以下各项中的任何一项:耳机38、扬声器或者模拟音频或者数字音频输出连接。装置50也可以包括电池40,在本发明的其它实施例中,设备可以由任何适当的移动能量设备,比如太阳能电池、燃料电池或者时钟机构生成器供电。装置还可以包括用于与其它设备的近程视线通信的红外线端口42。在其它实施例中,装置50还可以包括任何适当的近程通信解决方案,比如蓝牙无线连接或者USB/火线有线连接。 Device 50 can include a housing 30 for incorporating and protecting the device. Device 50 may also include display 32 in the form of a liquid crystal display. In other embodiments of the invention, the display may be any suitable display technology suitable for displaying images or video. Device 50 may also include a keypad 34. In other embodiments of the invention, any suitable data or user interface mechanism may be utilized. For example, the user interface can be implemented as a virtual keyboard or data entry system as part of a touch sensitive display. The device may include a microphone 36 or any suitable audio input, which may be a digital or analog signal input. The apparatus 50 may also include an audio output device, which in an embodiment of the invention may be any of the following: an earphone 38, a speaker, or an analog audio or digital audio output connection. Device 50 may also include battery 40, and in other embodiments of the invention, the device may be powered by any suitable mobile energy device, such as a solar cell, fuel cell, or clock mechanism generator. The device may also include an infrared port 42 for short-range line of sight communication with other devices. In other embodiments, device 50 may also include any suitable short range communication solution, such as a Bluetooth wireless connection or a USB/Firewire wired connection.
装置50可以包括用于控制装置50的控制器56或者处理器。控制器56可以连接到存储器58,该存储器在本发明的实施例中可以存储形式为图像的数据和音频的数据,和/或也可以存储用于在控制器56上实施的指令。控制器56还可以连接到适合于实现音频和/或视频数据的编码和解码或者由控制器56实现的辅助编码和解码的编码解码器电路54。 Device 50 may include a controller 56 or processor for controlling device 50. Controller 56 may be coupled to memory 58, which may store data in the form of images and audio in an embodiment of the invention, and/or may also store instructions for execution on controller 56. Controller 56 may also be coupled to codec circuitry 54 suitable for implementing encoding and decoding of audio and/or video data or assisted encoding and decoding by controller 56.
装置50还可以包括用于提供用户信息并且适合于提供用于在网络认证和授权用户的认证信息的读卡器48和智能卡46,例如UICC和UICC读取器。The apparatus 50 may also include a card reader 48 and a smart card 46, such as a UICC and a UICC reader, for providing user information and for providing authentication information for authenticating and authorizing users on the network.
装置50还可以包括无线电接口电路52,该无线电接口电路连接到控制器并且适合于生成例如用于与蜂窝通信网络、无线通信系统或者无线局域网通信的无线通信信号。装置50还可以包括天线44,该天线连接到无线电接口电路52用于向其它(多个)装置发送在无线电接口电路52生成的射频信号并且用于从其它(多个)装置接收射频信号。 Apparatus 50 may also include a radio interface circuit 52 coupled to the controller and adapted to generate, for example, a wireless communication signal for communicating with a cellular communication network, a wireless communication system, or a wireless local area network. Apparatus 50 may also include an antenna 44 coupled to radio interface circuitry 52 for transmitting radio frequency signals generated at radio interface circuitry 52 to other apparatus(s) and for receiving radio frequency signals from other apparatus(s).
在本发明的一些实施例中,装置50包括能够记录或者检测单帧的相机,编码解码器 54或者控制器接收到这些单帧并对它们进行处理。在本发明的一些实施例中,装置可以在传输和/或存储之前从另一设备接收待处理的视频图像数据。在本发明的一些实施例中,装置50可以通过无线或者有线连接接收图像用于编码/解码。本发明实施例所描述的方法主要应用于视频编码器20和视频解码器30相应的编解码过程中的帧间预测。In some embodiments of the invention, device 50 includes a camera capable of recording or detecting a single frame, and codec 54 or controller receives the individual frames and processes them. In some embodiments of the invention, the device may receive video image data to be processed from another device prior to transmission and/or storage. In some embodiments of the invention, device 50 may receive images for encoding/decoding via a wireless or wired connection. The method described in the embodiments of the present invention is mainly applied to inter prediction in the corresponding codec process of the video encoder 20 and the video decoder 30.
在本发明实施例所涉及的编解码中,帧间预测的实质是为当前图像的当前块(当前块表示当前需要编/解码的图像块,当前块也可以称为待处理块)在参考图像中寻找一块最相似块(参考块)。为了能得到与当前块最佳匹配的参考块,编解码端帧间预测模式中的高级运动矢量预测(Advanced Motion Vector Prediction,AMVP)模式与合并(Merge)模式采用了不同方式实现。In the codec according to the embodiment of the present invention, the essence of the inter prediction is the current block of the current image (the current block indicates the image block currently required to be edited/decoded, and the current block may also be referred to as the to-be-processed block) in the reference image. Look for the most similar block (reference block). In order to obtain the reference block that best matches the current block, the Advanced Motion Vector Prediction (AMVP) mode and the Merge mode in the codec inter prediction mode are implemented in different ways.
对于AMVP模式,AMVP模式先为当前块预测出一个MV,这个预测运动矢量又称为运动矢量预测值(Motion Vector Prediction,MVP),MVP可以根据当前块空域上周边相邻块、或者当前块所对应时域参考块、或者当前块周边相邻块所对应时域参考块的运动矢量直接得到,因为相邻块有多个,因此MVP也会有多个,一个MVP实质上就是一个候选运动矢量(候选mv),AMVP模式将这些MVP组建成一个候选列表,本文将AMVP模式构建的候选列表称为AMVP候选列表。编码端在建立该AMVP候选列表后,从AMVP候选列表中选择出一个最优MVP,根据最优MVP(MVP也是一个候选MV)来确定在参考图像中搜索的起始点,然后在搜索起始点的附近特定范围内按照特定方式进行搜索并进行率失真代价值计算,最后计算得到一个最优MV,最优MV确定了参考图像中实际参考块(预测块)的位置,通过最优MV与最优MVP的差值求得运动矢量差值(motion vector difference,MVD),并对该最优MVP对应在AMVP候选列表中的索引值进行编码,对参考图像的索引进行编码。编码端只需在码流中向解码端发送该MVD、Merge候选列表的索引和参考图像的索引,达到了视频数据压缩的目的。解码端一方面从码流中解码得到出该MVD和候选列表中的索引值和参考图像的索引,另一方面自己建立AMVP候选列表,通过该索引值得到最优MVP,根据MVD和最优的MVP得到最优MV,根据参考图像的索引得到参考图像,利用最优MV并从参考图像中找到实际参考块(预测块),进而通过对实际参考块(预测块)进行运动补偿最终得到当前块的重构块。For the AMVP mode, the AMVP mode first predicts an MV for the current block. This predicted motion vector is also called Motion Vector Prediction (MVP). The MVP can be based on the neighboring block in the current block airspace, or the current block. The motion vector of the time domain reference block corresponding to the time domain reference block or the neighboring block of the current block is directly obtained. Because there are multiple neighboring blocks, there are multiple MVPs, and one MVP is essentially a candidate motion vector. (candidate mv), the AMVP mode sets these MVP groups into a candidate list. In this paper, the candidate list constructed by the AMVP mode is called an AMVP candidate list. After establishing the AMVP candidate list, the encoding end selects an optimal MVP from the AMVP candidate list, determines the starting point of the search in the reference image according to the optimal MVP (the MVP is also a candidate MV), and then searches for the starting point in the reference image. Searching in a specific way in a specific range nearby and performing rate distortion generation value calculation, and finally calculating an optimal MV, the optimal MV determines the position of the actual reference block (predicted block) in the reference image, through the optimal MV and the optimal The difference of the MVP is obtained by a motion vector difference (MVD), and the index value of the optimal MVP corresponding to the AMVP candidate list is encoded, and the index of the reference image is encoded. The encoding end only needs to send the index of the MVD, the Merge candidate list and the index of the reference image to the decoding end in the code stream, thereby achieving the purpose of video data compression. On the one hand, the decoding end decodes the index of the index value and the reference image in the MVD and the candidate list from the code stream, and on the other hand establishes an AMVP candidate list by itself, and obtains the optimal MVP through the index value, according to the MVD and the optimal one. The MVP obtains the optimal MV, obtains the reference image according to the index of the reference image, uses the optimal MV and finds the actual reference block (predicted block) from the reference image, and then obtains the current block by performing motion compensation on the actual reference block (predicted block). Refactoring block.
对于Merge模式,Merge模式同样会根据当前块空域上周边相邻块、或者当前块所对应时域参考块、或者当前块周边相邻块所对应时域参考块的运动矢量,作为候选运动矢量(候选mv),因为相邻块有多个,所以候选mv也有多个,Merge模式基于这些候选mv构建候选列表,本文将Merge模式构建的候选列表称为Merge候选列表(列表长度不同于AMVP模式)。Merge模式中直接用相邻块的MV作为当前块的预测运动矢量,即当前块与相邻块共用一个MV(所以此时不存在MVD),并使用相邻块的参考图像作为自己的参考图像。Merge模式遍历Merge候选列表中的所有候选MV,并进行率失真代价值计算,最终选取率失真代价值最小的一个候选MV作为该Merge模式的最优MV,并对Merge候选列表中的所述最优MV的索引值进行编码,编码端只需在码流中向解码端发送该Merge候选列表的索引,达到了视频数据压缩的目的。解码端一方面从码流中解码得到出该Merge候选列表的索引,另一方面自己建立Merge候选列表,通过该索引值确定Merge候选列表中的一个候选MV为最 优MV,并使用相邻块的参考图像作为自己的参考图像,利用最优MV并从参考图像中找到实际参考块(预测块),进而通过对实际参考块(预测块)进行运动补偿最终得到当前块的重构块。For the Merge mode, the Merge mode is also used as the candidate motion vector according to the motion vector of the neighboring block in the current block airspace, or the time domain reference block corresponding to the current block, or the time domain reference block corresponding to the neighboring block in the current block. Candidate mv), because there are multiple neighboring blocks, so there are multiple candidate mvs. The Merge mode builds a candidate list based on these candidate mvs. The candidate list constructed by the Merge mode is called a Merge candidate list (the list length is different from the AMVP mode). . In the Merge mode, the MV of the neighboring block is directly used as the predicted motion vector of the current block, that is, the current block shares an MV with the adjacent block (so there is no MVD at this time), and the reference image of the adjacent block is used as its own reference image. . The Merge mode traverses all candidate MVs in the Merge candidate list, and performs rate distortion generation value calculation. Finally, a candidate MV with the lowest rate distortion value is selected as the optimal MV of the Merge mode, and the most MV in the Merge candidate list. The index value of the MV is encoded, and the encoding end only needs to send the index of the Merge candidate list to the decoding end in the code stream, thereby achieving the purpose of video data compression. On the one hand, the decoding end decodes the index of the Merge candidate list from the code stream, and on the other hand, establishes a Merge candidate list by itself, and determines a candidate MV in the Merge candidate list as the optimal MV by using the index value, and uses the adjacent block. The reference image is used as its own reference image, and the actual reference block (predicted block) is found from the reference image by using the optimal MV, and then the reconstructed block of the current block is finally obtained by performing motion compensation on the actual reference block (predicted block).
传统的AMVP模式或者Merge模式都是直接基于相邻块的候选运动矢量来获取最佳的参考图像块。但是,当前块的相邻块的候选运动矢量可能并不是最佳的预测运动矢量,也就是说,传统的AMVP模式或者Merge模式实现过程中,直接利用该模式的候选运动矢量得到的实际参考块未必是当前块的最佳参考块。为了解决传统的AMVP模式或者Merge模式的技术缺陷,本发明实施例提供了预测运动矢量生成方法,实现对传统AMVP模式或Merge模式所构建的候选列表进行改进(更新),基于更新后的候选列表能够保证编解码过程中获得当前块的最佳参考块。另外,本发明实施例还提供了一些混合预测模式,基于所述混合预测模式也可以能够保证编解码过程中获得当前块的最佳参考块。The traditional AMVP mode or Merge mode is based on the candidate motion vectors of adjacent blocks to obtain the best reference image block. However, the candidate motion vector of the neighboring block of the current block may not be the optimal predictive motion vector, that is, the actual reference block obtained by directly using the candidate motion vector of the mode in the conventional AMVP mode or the Merge mode implementation process. It is not necessarily the best reference block for the current block. In order to solve the technical defect of the traditional AMVP mode or the Merge mode, the embodiment of the present invention provides a prediction motion vector generation method, which implements improvement (update) on the candidate list constructed by the traditional AMVP mode or the Merge mode, based on the updated candidate list. It can guarantee the best reference block of the current block in the codec process. In addition, the embodiment of the present invention further provides some hybrid prediction modes, and based on the hybrid prediction mode, it is also possible to ensure that the best reference block of the current block is obtained in the codec process.
为了便于本发明技术方案的理解,下面首先描述本发明实施例涉及的单向预测/双向预测、所构建的候选列表、以及基于模板匹配方式对候选运动矢量以及候选列表进行更新的方法、基于模板匹配的编解码过程、基于解码信息来构建候选列表以及选取候选运动矢量的方式。In order to facilitate the understanding of the technical solutions of the present invention, the unidirectional prediction/bidirectional prediction, the constructed candidate list, and the method for updating the candidate motion vector and the candidate list based on the template matching manner, based on the template, are first described below. A matching codec process, a candidate list based on decoding information, and a way to select candidate motion vectors.
首先,描述本发明实施例涉及的帧间单向预测(简称单向预测)和帧间双向预测(简称双向预测)。First, inter-frame unidirectional prediction (referred to as unidirectional prediction) and inter-frame bidirectional prediction (referred to as bidirectional prediction) according to an embodiment of the present invention are described.
所述单向预测是指基于单个方向的参考图像来确定当前块的第一预测运动矢量,进而得到当前块的在单个方向的预测块。通常的,可根据参考图像帧的图像序列号与当前图像帧的图像序列号的相对关系,又可相应的将单向预测称为前向预测或者后向预测。The unidirectional prediction refers to determining a first prediction motion vector of a current block based on a reference image of a single direction, thereby obtaining a prediction block of a current block in a single direction. Generally, the unidirectional prediction may be referred to as forward prediction or backward prediction according to the relative relationship between the image sequence number of the reference image frame and the image sequence number of the current image frame.
所述双向预测包括第一方向预测和第二方向预测,所述第一方向预测为基于第一方向的参考图像来确定当前块的第一预测运动矢量,进而得到当前块的在第一方向的预测块,其中,所述第一方向的参考图像为第一参考图像帧集合中的一个,所述第一参考图像帧集合包括一定数量的参考图像;所述第二方向预测为基于第二方向的参考图像来确定当前块的第二预测运动矢量,进而得到当前块的在第二方向的预测块,所述第二方向的参考图像为第二参考图像帧集合中的一个,所述第二参考图像帧集合包括一定数量的参考图像。基于第一预测运动矢量得到的预测块和基于第二预测运动矢量得到的预测块按预设算法进行处理,就能最终得到当前块的重构块,例如将第一预测运动矢量得到的预测块和基于第二预测运动矢量得到的预测块进行加权平均来得到当前块的重构块。通常的,也可以将帧间双向预测称为前向后向预测,也就是说,帧间双向预测包括前向预测和后向预测,这样情况下,当第一方向预测为前向预测,那么第二方向预测相应为后向预测;当第一方向预测为后向预测,那么第二方向预测相应为前向预测。The bidirectional prediction includes a first direction prediction and a second direction prediction, where the first direction prediction is to determine a first prediction motion vector of the current block based on the reference image of the first direction, thereby obtaining a first direction of the current block. a prediction block, wherein the reference image in the first direction is one of a first reference image frame set, the first reference image frame set includes a certain number of reference images; and the second direction prediction is based on a second direction a reference image to determine a second predicted motion vector of the current block, thereby obtaining a prediction block in the second direction of the current block, the reference image in the second direction being one of the second reference image frame set, the second The reference image frame set includes a certain number of reference images. The prediction block obtained based on the first prediction motion vector and the prediction block obtained based on the second prediction motion vector are processed according to a preset algorithm, thereby finally obtaining a reconstructed block of the current block, for example, a prediction block obtained by the first predicted motion vector. And performing weighted averaging on the prediction block obtained based on the second predicted motion vector to obtain a reconstructed block of the current block. In general, inter-frame bidirectional prediction can also be called forward backward prediction, that is, inter-frame bidirectional prediction includes forward prediction and backward prediction. In this case, when the first direction prediction is forward prediction, then The second direction prediction is corresponding to backward prediction; when the first direction prediction is backward prediction, then the second direction prediction is corresponding to forward prediction.
其次,描述本发明实施例涉及的候选列表。Next, a candidate list related to an embodiment of the present invention will be described.
参见图4,图4是本发明实施例涉及的AMVP模式所采用的一种AMVP候选列表,该AMVP候选列表可应用于前向预测中,也可以应用于后向预测中。具体的,该AMVP候选列表可应用于单向预测(前向预测或者后向预测),也可应用于双向预测中的前向预测,或者应用于 双向预测中的后向预测。Referring to FIG. 4, FIG. 4 is an AMVP candidate list used in the AMVP mode according to an embodiment of the present invention. The AMVP candidate list may be applied to forward prediction and may also be applied to backward prediction. Specifically, the AMVP candidate list can be applied to one-way prediction (forward prediction or backward prediction), to forward prediction in bidirectional prediction, or to backward prediction in bidirectional prediction.
所述AMVP候选列表包括多个MVP(每个MVP也是候选MV)的集合,MVP可以根据当前块空域上周边相邻块、或者当前块所对应时域参考块、或者当前块周边相邻块所对应时域参考块的运动矢量直接得到。如图4中的(a)所示,AMVP候选列表包括MVP0、MVP1…MVPn,其中,每个MVP在候选列表中的位置分别对应于一个具体的候选列表索引(具体可称为AMVP候选列表的索引),亦即每个索引用于指示列表中的对应位置的候选MV,如图中MVP0、MVP1…MVPn对应的候选列表索引分别为index 0、index 1…index n。The AMVP candidate list includes a set of multiple MVPs (each MVP is also a candidate MV), and the MVP may be based on a neighboring block in the current block airspace, or a time domain reference block corresponding to the current block, or a neighboring block adjacent to the current block. The motion vector corresponding to the time domain reference block is directly obtained. As shown in (a) of FIG. 4, the AMVP candidate list includes MVP0, MVP1...MVPn, wherein the positions of each MVP in the candidate list respectively correspond to a specific candidate list index (which may be specifically referred to as an AMVP candidate list). Index), that is, each index is used to indicate a candidate MV of a corresponding position in the list, and the candidate list indexes corresponding to MVP0, MVP1, ... MVPn in the figure are index 0, index 1 ... index n, respectively.
在一种应用场景中,基于AMVP模式构建的AMVP候选列表长度为2。如图4中的(b)所示,AMVP候选列表中包含2个MVP(MVP0和MVP1),其中一个MVP可以是根据空域上相邻块得到的候选运动矢量,相应的,另一个MVP可以是根据时域上相邻块得到的候选运动矢量。另外,可定义候选列表的索引值0来指示MVP0,可定义候选列表的索引值1来指示MVP1。当然,本发明实施例并不限定索引值的具体数值,也就是说MVP0和MVP1也可以用定义的其他索引值进行指示。In an application scenario, the length of the AMVP candidate list constructed based on the AMVP mode is 2. As shown in (b) of FIG. 4, the AMVP candidate list includes two MVPs (MVP0 and MVP1), one of which may be a candidate motion vector obtained according to a neighboring block on the airspace, and correspondingly, another MVP may be A candidate motion vector obtained from neighboring blocks in the time domain. In addition, an index value of 0 of the candidate list may be defined to indicate MVP0, and an index value of 1 of the candidate list may be defined to indicate MVP1. Certainly, the embodiment of the present invention does not limit the specific value of the index value, that is, MVP0 and MVP1 may also be indicated by other defined index values.
参见图5,图5是本发明实施例涉及的Merge模式所采用的一种Merge候选列表,该Merge候选列表可应用于前向预测中,也可以应用于后向预测中。具体的,该Merge候选列表可应用于单向预测(前向预测或者后向预测),也可应用于双向预测中的前向预测,或者应用于双向预测中的后向预测。Referring to FIG. 5, FIG. 5 is a Merge candidate list used in the Merge mode according to an embodiment of the present invention. The Merge candidate list may be applied to forward prediction or may be applied to backward prediction. Specifically, the Merge candidate list may be applied to one-way prediction (forward prediction or backward prediction), to forward prediction in bidirectional prediction, or to backward prediction in bidirectional prediction.
所述Merge候选列表包括多个候选MV的集合,候选MV可以根据当前块空域上周边相邻块、或者当前块所对应时域参考块、或者当前块周边相邻块所对应时域参考块的运动矢量直接得到。如图5中的(a)所示Merge候选列表包括前(和/或)后向候选MV0、候选MV1…候选MVn,其中,每个候选MV在候选列表中的位置分别对应于一个具体的候选列表索引(具体可称为Merge候选列表的索引),亦即每个索引用于指示列表中的对应位置的候选MV,如图中候选MV0、候选MV1…候选MVn对应的候选列表索引分别为index 0、index 1…index n。另外,本分发明实施例中,所述候选MV0、候选MV1…候选MVn可用于指示构建当前块时所采用的参考图像(例如直接采用邻近块的参考图像作为当前块的参考图像)。The Merge candidate list includes a set of multiple candidate MVs, and the candidate MV may be based on a neighboring block in the current block airspace, or a time domain reference block corresponding to the current block, or a time domain reference block corresponding to the neighboring block in the current block. The motion vector is obtained directly. The Merge candidate list shown in (a) of FIG. 5 includes pre (and/or) backward candidate MV0, candidate MV1 ... candidate MVn, wherein the position of each candidate MV in the candidate list corresponds to a specific candidate, respectively. A list index (which may be referred to as an index of a Merge candidate list), that is, each index is used to indicate a candidate MV of a corresponding position in the list, and the candidate list index corresponding to the candidate MV0, the candidate MV1, and the MVn in the figure is respectively an index. 0, index 1...index n. In addition, in the embodiment of the present invention, the candidate MV0, the candidate MV1, ..., MVn may be used to indicate a reference image used when constructing the current block (for example, a reference image directly using a neighboring block as a reference image of the current block).
在一种应用场景中,基于Merge模式构建的Merge候选列表长度为5。如图5中的(b)所示,Merge候选列表中包含5个MVP(候选MV0、候选MV1、候选MV2、候选MV3、候选MV4),其中的4个候选MV可以是根据空域上相邻块所得到的候选运动矢量,剩下的1个候选MV根据时域上相邻块得到的候选运动矢量。另外,可定义候选列表的索引值2、索引值3、索引值、4、索引值5、索引值6来指示候选MV0、候选MV1、候选MV2、候选MV3、候选MV4。当然,本发明实施例并不限定各个索引值的具体数值,也就是说各个MVP也可以用定义的其他索引值进行指示。In an application scenario, the Merge candidate list length based on the Merge mode is 5. As shown in (b) of FIG. 5, the Merge candidate list includes five MVPs (candidate MV0, candidate MV1, candidate MV2, candidate MV3, candidate MV4), wherein the four candidate MVs may be based on neighboring blocks on the airspace. The obtained candidate motion vector, the remaining one candidate MV is a candidate motion vector obtained from neighboring blocks in the time domain. In addition, an index value 2, an index value 3, an index value, 4, an index value 5, and an index value 6 of the candidate list may be defined to indicate the candidate MV0, the candidate MV1, the candidate MV2, the candidate MV3, and the candidate MV4. Certainly, the embodiment of the present invention does not limit the specific value of each index value, that is, each MVP can also be indicated by other defined index values.
参见图6,图6是本发明实施例涉及的AMVP模式所采用的一种AMVP候选列表,该AMVP候选列表可应用于双向预测中,即同时应用于双向预测中的前向预测和后向预测。Referring to FIG. 6, FIG. 6 is an AMVP candidate list used in the AMVP mode according to an embodiment of the present invention. The AMVP candidate list can be applied to bidirectional prediction, that is, simultaneous application to forward prediction and backward prediction in bidirectional prediction. .
如图6所示,所述AMVP候选列表包括用于第一方向预测的MVP(包括MVP10、MVP11…MVP1n)的集合和用于第二方向预测的MVP(包括MVP20、MVP21…MVP2n)的集合,各个MVP可以根据当前块空域上周边相邻块、或者当前块所对应时域参考块、或者当前块周边相邻块所对应时域参考块的运动矢量直接得到。这样情况下,可以分别采用候选列表 索引index 0、index 1…index n来指示MVP10、MVP11…MVP1n,也可以用分别采用候选列表索引index 0、index 1…index n来指示MVP20、MVP21…MVP2n来指示。在具体的实施例中,用于指示第一方向MVP的索引值和用于指示第二方向MVP的索引值可以相同,也可以是不同的。例如可以采用索引值0来同时指示MVP10和MVP20,也可以分别采用索引值0和索引值1来分别指示MVP10和MVP20。As shown in FIG. 6, the AMVP candidate list includes a set of MVPs (including MVP10, MVP11...MVP1n) for first direction prediction and a set of MVPs (including MVP20, MVP21...MVP2n) for second direction prediction, Each MVP may be directly obtained according to a motion vector of a neighboring block in the current block airspace, or a time domain reference block corresponding to the current block, or a time domain reference block corresponding to the neighboring block in the current block. In this case, the candidate list index index 0, index 1 . . . index n may be used to indicate the MVP 10, the MVP 11 . . . MVP 1 n , respectively, or the candidate list indexes index 0 , index 1 . . . index n may be used to indicate the MVP 20 , MVP 21 . . . MVP 2 n respectively. Instructions. In a specific embodiment, the index value used to indicate the first direction MVP and the index value used to indicate the second direction MVP may be the same or different. For example, the index value 0 may be used to simultaneously indicate the MVP 10 and the MVP 20, and the index value 0 and the index value 1 may be respectively used to indicate the MVP 10 and the MVP 20, respectively.
本发明后文实施例中,当第一方向为前(或后)向时,AMVP候选列表中用于前(或后)向预测的候选运动矢量可简称为前(或后)向候选运动矢量;当第二方向为后(或前)向时,AMVP候选列表中用于后(或前)向预测的候选运动矢量可简称为后(或前)向候选运动矢量。In the following embodiments of the present invention, when the first direction is the front (or back) direction, the candidate motion vector for the front (or backward) prediction in the AMVP candidate list may be simply referred to as the front (or back) candidate motion vector. When the second direction is the back (or front) direction, the candidate motion vector for the post (or forward) prediction in the AMVP candidate list may be simply referred to as the posterior (or front) candidate motion vector.
参见图7,图7是本发明实施例涉及的Merge模式所采用的又一种Merge候选列表,该Merge候选列表可应用于双向预测中,即同时应用于双向预测中的前向预测和后向预测。Referring to FIG. 7, FIG. 7 is another Merge candidate list used in the Merge mode according to an embodiment of the present invention. The Merge candidate list can be applied to bidirectional prediction, that is, simultaneous application to forward prediction and backward direction in bidirectional prediction. prediction.
如图7所示,所述Merge候选列表包括用于第一方向预测的候选MV(包括候选MV10、候选MV11…候选MV1n)的集合和用于第二方向预测的候选MV(包括候选MV20、候选MV21…候选MV2n)的集合,各个候选MV可以根据当前块空域上周边相邻块、或者当前块所对应时域参考块、或者当前块周边相邻块所对应时域参考块的运动矢量直接得到。这样情况下,可以分别采用候选列表索引index 0、index 1…index n来指示候选MV10、候选MV11…候选MV1n,也可以用分别采用候选列表索引index 0、index 1…index n来指示候选MV20、候选MV21…候选MV2n来指示。在具体的实施例中,用于指示第一方向候选MV的索引值和用于指示第二方向候选MV的索引值可以相同,也可以是不同的。例如可以采用索引值0来同时指示候选MV10和候选MV20,也可以分别采用索引值0和索引值1来分别指示候选MV10和候选MV20。As shown in FIG. 7, the Merge candidate list includes a set of candidate MVs (including candidate MV10, candidate MV11...candidate MV1n) for first direction prediction and candidate MVs for second direction prediction (including candidate MV20, candidate) For the set of MV21...candidate MV2n), each candidate MV may be directly obtained according to the motion vector of the neighboring block in the current block airspace, or the time domain reference block corresponding to the current block, or the time domain reference block corresponding to the neighboring block in the current block. . In this case, the candidate list index index 0, index 1 . . . index n may be used to indicate the candidate MV 10, the candidate MV 11 . . . MV 1 n , respectively, or the candidate list index index 0 , index 1 . . . index n may be used to indicate the candidate MV 20 , The candidate MV21...candidate MV2n is indicated. In a specific embodiment, the index value used to indicate the first direction candidate MV and the index value used to indicate the second direction candidate MV may be the same or different. For example, the index value 0 may be used to simultaneously indicate the candidate MV 10 and the candidate MV 20, and the index value 0 and the index value 1 may be respectively used to indicate the candidate MV 10 and the candidate MV 20, respectively.
本发明后文实施例中,当第一方向为前(或后)向时,Merge候选列表中用于前(或后)向预测的候选运动矢量可简称为前(或后)向候选运动矢量;当第二方向为后(或前)向时,Merge候选列表中用于后(或前)向预测的候选运动矢量也可简称为后(或前)向候选运动矢量。In the following embodiments of the present invention, when the first direction is the front (or back) direction, the candidate motion vector for the front (or backward) prediction in the Merge candidate list may be simply referred to as the front (or back) candidate motion vector. When the second direction is the back (or front) direction, the candidate motion vector for the post (or forward) prediction in the Merge candidate list may also be simply referred to as the posterior (or front) candidate motion vector.
再次,描述本发明实施例涉及的模板匹配方式。Again, the template matching method involved in the embodiment of the present invention is described.
为了解决传统的AMVP模式或者Merge模式的技术缺陷,本发明实施例提供的模板匹配方式可用于实现对AMVP模式或者Merge模式所采用的候选运动矢量进行更新,乃至对AMVP模式或Merge模式所构建的候选列表进行更新,基于更新后的候选运动矢量/候选列表能够实现在AMVP模式或者Merge模式的编解码过程中,所得到的实际参考块为当前块的最佳参考块,从而保证所得到的当前块的重构块的正确性。实现模板匹配对候选运动矢量进行更新的过程描述如下:(1)在基于AMVP模式或者Merge模式所构建的候选列表中,选择一个候选运动矢量。该候选运动矢量确定了当前块在参考图像上的参考图像块(简称为参考块)(2)在所述候选运动矢量确定的参考图像中确定一个搜索范围,在所述搜索范围内,确定至少一个不同于该候选运动矢量的参考运动矢量,该至少一个参考运动矢量中的每一个分别对应于一个在候选运动矢量所指示的参考图像中的参考图像块(简称为图像块,以便于区别于候选运动矢量所确定的参考块)。(3)分别计算该至少一个图像块的至少一个邻近已 重构块和当前块的至少一个邻近已重构块之间的像素差异值或者率失真(rate-distortion)代价值,以及计算参考块的至少一个邻近已重构块和当前块的至少一个邻近已重构块之间的像素差异值或者率失真代价值。其中,当前块的至少一个邻近已重构块、参考块的至少一个邻近已重构块和图像块的至少一个邻近已重构块之间的形状相同且尺寸相等。假如,当前块的至少一个邻近已重构块与当前块之间具有位置关系1(如在一定范围内相邻或接近)、参考块的至少一个邻近已重构块与参考块之间具有位置关系2(如在一定范围内相邻或接近)、图像块的至少一个邻近已重构块与该图像块之间具有位置关系3(如在一定范围内相邻或接近),那么,位置关系1、位置关系2和位置关系3可以是相同的。但是,在可能的实施例中,位置关系1、位置关系2和位置关系3也可以有差异的(4)从至少一个图像块的至少一个邻近已重构块和当前块的至少一个邻近已重构块之间得到的像素差异值或者率失真代价值,以及参考块的至少一个邻近已重构块和当前块的至少一个邻近已重构块之间的像素差异值或者率失真代价值中,确定一个最小像素差异值或者率失真代价值,该最小像素差异值或者率失真代价值所对应的运动矢量或者是该候选运动矢量,或者是所述至少一个参考运动矢量中的某一个。具体的,可通过计算重构块间的像素差异值、计算预设系数与获得运动矢量信息所需要的比特数目(譬如获取当前块运动矢量差所消耗的编解码比特数)的乘积,将两者进行求和计算得到率失真代价值。(4)使用该最小像素差异值或者率失真代价值所对应的运动矢量来作为新的候选运动矢量。具体的,如果该运动矢量为所述至少一个参考运动矢量中的某一个,则将这个参考运动矢量作为新的候选运动矢量,使用新的候选运动矢量对原先所选择的候选运动矢量进行更新。如果该运动矢量就是原先的候选运动矢量,不需要对该候选运动矢量进行更新。这样,上述(1)(2)(3)(4)就是使用模板匹配对候选运动矢量的更新过程。可以理解的,如果进行(1)(2)(3)(4)后,所得到运动矢量为所述至少一个参考运动矢量中的某一个,则将这个参考运动矢量作为新的候选运动矢量,并将这个新的候选运动矢量替换掉所构建的候选列表中的该原先的候选运动矢量,从而实现了使用模板匹配对候选列表的更新。In order to solve the technical defect of the traditional AMVP mode or the Merge mode, the template matching manner provided by the embodiment of the present invention can be used to update candidate motion vectors used in the AMVP mode or the Merge mode, and even to the AMVP mode or the Merge mode. The candidate list is updated, and the updated candidate motion vector/candidate list can be implemented in the codec process of the AMVP mode or the Merge mode, and the obtained actual reference block is the best reference block of the current block, thereby ensuring the obtained current reference block. The correctness of the reconstructed block of the block. The process of implementing template matching to update candidate motion vectors is described as follows: (1) In the candidate list constructed based on the AMVP mode or the Merge mode, one candidate motion vector is selected. The candidate motion vector determines a reference image block (abbreviated as a reference block) on the reference image of the current block (2) determines a search range in the reference image determined by the candidate motion vector, and determines at least within the search range a reference motion vector different from the candidate motion vector, each of the at least one reference motion vector respectively corresponding to a reference image block (referred to as an image block) in the reference image indicated by the candidate motion vector, so as to be distinguished from The reference block determined by the candidate motion vector). (3) separately calculating pixel difference values or rate-distortion values between at least one adjacent reconstructed block of the at least one image block and at least one adjacent reconstructed block of the current block, and calculating a reference block A pixel difference value or a rate distortion value between at least one adjacent reconstructed block and at least one adjacent reconstructed block of the current block. Wherein at least one adjacent reconstructed block of the current block, at least one adjacent reconstructed block of the reference block, and at least one adjacent reconstructed block of the image block have the same shape and are equal in size. Suppose that at least one adjacent reconstructed block of the current block has a positional relationship 1 with the current block (eg, adjacent or close within a certain range), and at least one adjacent reconstructed block of the reference block has a position between the referenced block and the reference block. Relationship 2 (such as adjacent or close within a certain range), at least one adjacent reconstructed block of the image block has a positional relationship 3 with the image block (eg, adjacent or close within a certain range), then the positional relationship 1. The positional relationship 2 and the positional relationship 3 can be the same. However, in a possible embodiment, the positional relationship 1, the positional relationship 2 and the positional relationship 3 may also differ (4) from at least one adjacent reconstructed block of the at least one image block and at least one adjacent of the current block is already heavy a pixel difference value or a rate distortion value obtained between the blocks, and a pixel difference value or rate distortion value between at least one adjacent reconstructed block of the reference block and at least one adjacent reconstructed block of the current block, Determining a minimum pixel difference value or a rate distortion generation value, the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is either the candidate motion vector or one of the at least one reference motion vector. Specifically, by calculating the pixel difference value between the reconstructed blocks, calculating the preset coefficient and the number of bits required to obtain the motion vector information, such as the number of codec bits consumed to obtain the current block motion vector difference, The summation calculation yields the rate distortion generation value. (4) The motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is used as the new candidate motion vector. Specifically, if the motion vector is one of the at least one reference motion vector, the reference motion vector is used as a new candidate motion vector, and the original candidate motion vector is updated with the new candidate motion vector. If the motion vector is the original candidate motion vector, there is no need to update the candidate motion vector. Thus, the above (1)(2)(3)(4) is the update process of the candidate motion vector using template matching. It can be understood that if the obtained motion vector is one of the at least one reference motion vector after performing (1)(2)(3)(4), the reference motion vector is taken as a new candidate motion vector. The new candidate motion vector is replaced with the original candidate motion vector in the constructed candidate list, thereby realizing the update of the candidate list using template matching.
举例来说,参见图8,图8示出了一种模板匹配的示意图,在该模板匹配过程中,基于AMVP模式或者Merge模式所构建的候选列表选择一个候选运动矢量,该候选运动矢量确定了在参考图像中的参考块,在结合该候选运动矢量确定的搜索范围中包括一个参考运动矢量(即图示中参考运动矢量1),参考运动矢量1确定了在参考图像中的图像块1。在模板匹配中,当前块的邻近已重构块为A1和A2,参考块的邻近已重构块为B1和B2,图像块1的邻近已重构块为C1和C2。{A1,A2}、{B1,B2}、{C1,C2}之间的形状相同且尺寸相等,且它们分别与当前块、参考块、图像块1之间具有相同的位置关系。计算图像块1的{C1,C2}和当前块的{A1,A2}之间的像素差异值或者率失真代价值,以及计算参考块的{B1,B2}和当前块的{A1,A2}之间的像素差异值或者率失真代价值。采用这两种像素差异值或者率失真代价值中最小的一个对应的运动矢量作为候选运动矢量,比如最小像素差异值或者率失真代价值对应的运动矢量为参考运动矢量1,则将参考运动矢量1作为新的候选运动矢量,使用参考运动矢量1替换候选列表中的该候选运动矢量。可以理解的,如果最小像素差异值或者率失真代价值对应的运动矢量为该候选运动矢量,则不需要对候选列表中的该候选运动矢量进行更新。For example, referring to FIG. 8, FIG. 8 shows a schematic diagram of template matching, in which a candidate motion vector is selected based on a candidate list constructed by an AMVP mode or a Merge mode, and the candidate motion vector is determined. In the reference block in the reference image, a reference motion vector (i.e., reference motion vector 1 in the illustration) is included in the search range determined in conjunction with the candidate motion vector, and the reference motion vector 1 determines the image block 1 in the reference image. In template matching, the adjacent reconstructed blocks of the current block are A1 and A2, the adjacent reconstructed blocks of the reference block are B1 and B2, and the adjacent reconstructed blocks of image block 1 are C1 and C2. The shapes between {A1, A2}, {B1, B2}, {C1, C2} are the same and equal in size, and they have the same positional relationship with the current block, the reference block, and the image block 1, respectively. Calculate the pixel difference value or rate distortion value between {C1, C2} of image block 1 and {A1, A2} of the current block, and calculate {B1, B2} of the reference block and {A1, A2} of the current block The pixel difference value or rate distortion between generation values. The motion vector corresponding to the smallest one of the two pixel difference values or the rate distortion cost value is used as the candidate motion vector, for example, the minimum pixel difference value or the motion vector corresponding to the rate distortion cost value is the reference motion vector 1, and the reference motion vector is used. As a new candidate motion vector, the candidate motion vector in the candidate list is replaced with the reference motion vector 1. It can be understood that if the minimum pixel difference value or the motion vector corresponding to the rate distortion cost value is the candidate motion vector, the candidate motion vector in the candidate list does not need to be updated.
又举例来说,参见图9,图9示出了又一种模板匹配的示意图,在该模板匹配过程中,基于AMVP模式或者Merge模式所构建的候选列表选择一个候选运动矢量,该候选运动矢量确定了在参考图像中的参考块,在结合该候选运动矢量确定的搜索范围中包括两个参考运动矢量(即图示中参考运动矢量1和参考运动矢量2),参考运动矢量1、参考运动矢量2分别确定了在参考图像中的图像块1、图像块2。在模板匹配中,当前块的邻近已重构块为A1和A2,参考块的邻近已重构块为B1和B2,图像块1的邻近已重构块为C1和C2,图像块2的邻近已重构块为D1和D2,{A1,A2}、{B1,B2}、{C1,C2}、{D1和D2}之间的形状相同尺寸相等且分别与当前块、参考块、图像块1、图像块2之间具有相同的位置关系。计算图像块1的{C1,C2}和当前块的{A1,A2}之间的像素差异值或者率失真代价值,计算图像块2的{D1,D2}和当前块的{A1,A2}之间的像素差异值或者率失真代价值,以及计算参考块的{B1,B2}和当前块的{A1,A2}之间的像素差异值或者率失真代价值。从像素差异值或者率失真代价值中,选择像素差异值或者率失真代价值中最小的一个对应的运动矢量作为候选运动矢量,比如最小像素差异值或者率失真代价值对应的运动矢量为参考运动矢量1或参考运动矢量2,则将参考运动矢量1或参考运动矢量2作为新的候选运动矢量,使用参考运动矢量1或参考运动矢量2替换候选列表中的该候选运动矢量。可以理解的,如果最小像素差异值或者率失真代价值对应的运动矢量为该候选运动矢量,则不需要对候选列表中的该候选运动矢量进行更新。For example, referring to FIG. 9, FIG. 9 shows another schematic diagram of template matching. In the template matching process, a candidate motion vector is selected based on a candidate list constructed by the AMVP mode or the Merge mode, and the candidate motion vector is selected. Determining a reference block in the reference image, including two reference motion vectors (ie, reference motion vector 1 and reference motion vector 2 in the figure) in the search range determined in conjunction with the candidate motion vector, reference motion vector 1, reference motion The vector 2 determines the image block 1 and the image block 2 in the reference image, respectively. In template matching, the adjacent reconstructed blocks of the current block are A1 and A2, the adjacent reconstructed blocks of the reference block are B1 and B2, and the adjacent reconstructed blocks of image block 1 are C1 and C2, and the adjacent of the image block 2 The reconstructed block is D1 and D2, and the shapes between {A1, A2}, {B1, B2}, {C1, C2}, {D1, and D2} are the same size and are respectively associated with the current block, the reference block, and the image block. 1. Image blocks 2 have the same positional relationship. Calculate the pixel difference value or rate distortion value between {C1, C2} of image block 1 and {A1, A2} of the current block, calculate {D1, D2} of image block 2 and {A1, A2} of the current block The pixel difference value or rate distortion generation value between the pixel and the pixel difference value or rate distortion generation value between {B1, B2} of the reference block and {A1, A2} of the current block are calculated. From the pixel difference value or the rate distortion cost value, the smallest one of the pixel difference value or the rate distortion cost value is selected as the candidate motion vector, for example, the minimum pixel difference value or the motion vector corresponding to the rate distortion cost value is the reference motion. Vector 1 or reference motion vector 2, then reference motion vector 1 or reference motion vector 2 is used as a new candidate motion vector, and the candidate motion vector in the candidate list is replaced with reference motion vector 1 or reference motion vector 2. It can be understood that if the minimum pixel difference value or the motion vector corresponding to the rate distortion cost value is the candidate motion vector, the candidate motion vector in the candidate list does not need to be updated.
需要说明的是,在本发明具体实施例中,使用模板匹配对候选列表进行更新可以是对候选列表中的一个候选运动矢量进行更新,可以是对候选列表中的多个候选运动矢量进行更新,还可以是对候选列表中的所有候选运动矢量进行更新。It should be noted that, in the specific embodiment of the present invention, updating the candidate list by using template matching may be updating one candidate motion vector in the candidate list, and may update multiple candidate motion vectors in the candidate list. It is also possible to update all candidate motion vectors in the candidate list.
下面描述本发明实施例所涉及的在Merge模式中基于模板匹配的方式来获得当前块的重构块的编解码过程,该过程可分为编码过程和解码过程。A codec process for obtaining a reconstructed block of a current block based on a template matching manner in the Merge mode according to an embodiment of the present invention is described below. The process may be divided into an encoding process and a decoding process.
参见图10,图10示出了本发明实施例中Merge模式的一种具体编码过程,如图10所示,在编码端,构建Merge模式的候选列表(即Merge候选列表),该候选列表包括候选MV1、候选MV2等,选择候选列表中的候选MV2,对该候选MV2使用模板匹配的方式进行更新(具体过程参考上文描述),得到参考运动矢量,将该参考运动矢量作为新的候选运动矢量替换候选列表中的候选MV2,从而实现对候选列表的更新,更新后的候选列表包括候选MV1和该参考运动矢量。然后,对于更新后的候选列表,采用传统的方式来获得预测运动矢量(这里的预测运动矢量即为最优MV),也就是说,Merge模式遍历候选列表中的所有候选MV(包括候选MV1和参考运动矢量),并进行率失真代价值计算,最终选取率失真代价值最小的一个候选MV作为该Merge模式的最优MV,并基于最优MV构建当前块的预测块(在单向预测中,当前块的预测块即为当前块的重构块),并对所述最优MV的索引值进行编码。例如最优MV为参考运动矢量,则基于参考运动矢量构建当前块的预测块,并编码参考运动矢量对应的索引值。编码端在码流中向解码端发送该Merge候选列表的索引值。Referring to FIG. 10, FIG. 10 shows a specific encoding process of the Merge mode in the embodiment of the present invention. As shown in FIG. 10, on the encoding end, a candidate list of the Merge mode (ie, a Merge candidate list) is constructed, and the candidate list includes Candidate MV1, candidate MV2, etc., select candidate MV2 in the candidate list, and update the candidate MV2 by template matching (refer to the above description), obtain a reference motion vector, and use the reference motion vector as a new candidate motion. The vector replaces the candidate MV2 in the candidate list, thereby implementing an update of the candidate list, the updated candidate list including the candidate MV1 and the reference motion vector. Then, for the updated candidate list, the predicted motion vector is obtained in a conventional manner (the predicted motion vector here is the optimal MV), that is, the Merge mode traverses all candidate MVs in the candidate list (including the candidate MV1 and Refer to the motion vector), and perform rate distortion generation value calculation. Finally, select a candidate MV with the lowest rate distortion value as the optimal MV of the Merge mode, and construct the prediction block of the current block based on the optimal MV (in one-way prediction) The prediction block of the current block is the reconstructed block of the current block, and the index value of the optimal MV is encoded. For example, if the optimal MV is a reference motion vector, the prediction block of the current block is constructed based on the reference motion vector, and the index value corresponding to the reference motion vector is encoded. The encoding end transmits the index value of the Merge candidate list to the decoding end in the code stream.
在解码端,解码端一方面基于与编码端同样的规则构建Merge候选列表,该候选列表包括候选MV1、候选MV2等;另一方面,解析从编码端发送过来的码流,得到Merge候选列表的索引值,并对索引值所指示的候选运动矢量使用模板匹配的方式进行更新,例如, 索引值指示候选列表中的候选MV2,则对候选MV2使用模板匹配的方式进行更新(具体过程参考上文描述),得到参考运动矢量。之后,在一种可能实施例中,将该参考运动矢量作为新的候选运动矢量替换候选列表中的候选MV2,从而实现对候选列表的更新,更新后的候选列表包括候选MV1和该参考运动矢量。然后,对于更新后的候选列表,将基于索引值直接确定的该参考运动矢量作为当前块的预测运动矢量(该预测运动矢量即为最优MV),并基于该预测运动矢量(最优MV)构建当前块的预测块(在单向预测中,当前块的预测块即为当前块的重构块)。在另一种可能实施例中,在基于模板匹配得到参考运动矢量后,也可以直接将该参考运动矢量作为当前块的预测运动矢量,并基于该预测运动矢量构建当前块的预测块。On the decoding side, the decoding end constructs a Merge candidate list based on the same rules as the encoding end, and the candidate list includes the candidate MV1, the candidate MV2, and the like; on the other hand, parses the code stream sent from the encoding end to obtain a list of the Merge candidate. Index value, and update the candidate motion vector indicated by the index value by using template matching. For example, if the index value indicates the candidate MV2 in the candidate list, the candidate MV2 is updated by using template matching (refer to the above process). Description), get the reference motion vector. Thereafter, in a possible embodiment, the reference motion vector is replaced with a candidate MV2 in the candidate list as a new candidate motion vector, thereby implementing an update of the candidate list, the updated candidate list including the candidate MV1 and the reference motion vector . Then, for the updated candidate list, the reference motion vector directly determined based on the index value is used as the predicted motion vector of the current block (the predicted motion vector is the optimal MV), and based on the predicted motion vector (optimal MV) The prediction block of the current block is constructed (in the unidirectional prediction, the prediction block of the current block is the reconstructed block of the current block). In another possible embodiment, after the reference motion vector is obtained based on the template matching, the reference motion vector may also be directly used as the predicted motion vector of the current block, and the prediction block of the current block is constructed based on the predicted motion vector.
需要说明的是,在本发明具体实施例中,编码端使用模板匹配对Merge候选列表进行更新可以是对候选列表中的一个候选运动矢量进行更新,可以是对候选列表中的多个候选运动矢量进行更新,还可以是对候选列表中的所有候选运动矢量进行更新。但是在解码端,只需对Merge候选列表的索引值所指示的候选MV使用模板匹配进行更新,从而提高了解码端的解码效率。参见图11,图11示出了本发明实施例中Merge模式的又一种具体编码过程,如图12所示,编码端对候选列表中的多个候选MV(包括候选MV1和候选MV2)进行更新,基于更新后的候选列表确定参考运动矢量2为当前块的预测运动矢量(最优MV),基于参考运动矢量2实现构建当前块的预测块,编码参考运动矢量2对应的候选列表索引。在解码端,只需基于所接收的候选列表索引,对其所指示的候选MV2使用模板匹配进行更新,从而得到参考运动矢量2,基于参考运动矢量2实现构建当前块的预测块。It should be noted that, in the specific embodiment of the present invention, the encoding end updates the Merge candidate list by using template matching, which may be updating one candidate motion vector in the candidate list, and may be multiple candidate motion vectors in the candidate list. To update, it is also possible to update all candidate motion vectors in the candidate list. However, at the decoding end, only the candidate MV indicated by the index value of the Merge candidate list is updated by using template matching, thereby improving the decoding efficiency of the decoding end. Referring to FIG. 11, FIG. 11 shows another specific encoding process of the Merge mode in the embodiment of the present invention. As shown in FIG. 12, the encoding end performs multiple candidate MVs (including candidate MV1 and candidate MV2) in the candidate list. Updating, determining the reference motion vector 2 as the predicted motion vector (optimal MV) of the current block based on the updated candidate list, implementing the prediction block of the current block based on the reference motion vector 2, and encoding the candidate list index corresponding to the reference motion vector 2. At the decoding end, it is only necessary to update the candidate MV2 indicated by the template matching based on the received candidate list index, thereby obtaining the reference motion vector 2, and constructing the prediction block of the current block based on the reference motion vector 2.
还需要说明的是,本发明可能实施例中,如果编码端基于更新后的候选列表所得到的预测运动矢量并不是所更新的候选运动矢量中的一个,那么在解码端,接收候选列表的索引之后,可直接根据候选列表的索引来选择候选列表中的候选运动矢量,作为解码端的预测运动矢量,而不需要再对该候选运动矢量进行更新。It should be noted that, in a possible embodiment of the present invention, if the predicted motion vector obtained by the encoding end based on the updated candidate list is not one of the updated candidate motion vectors, then at the decoding end, the index of the candidate list is received. Then, the candidate motion vector in the candidate list can be directly selected according to the index of the candidate list as the predicted motion vector of the decoding end, and the candidate motion vector is not required to be updated.
下面描述本发明实施例所涉及的在AMVP模式中基于模板匹配的方式来获得当前块的重构块的编解码过程,该过程可分为编码过程和解码过程。A codec process for obtaining a reconstructed block of a current block based on a template matching manner in an AMVP mode according to an embodiment of the present invention is described below. The process may be divided into an encoding process and a decoding process.
参见图12,图12示出了本发明实施例中AMVP模式的一种具体编码过程,如图12所示,在编码端,构建AMVP模式的候选列表(即AMVP候选列表),该候选列表包括MVP1、MVP2等,选择候选列表中的MVP2,对该MVP2使用模板匹配的方式进行更新(具体过程参考上文描述),得到参考运动矢量,将该参考运动矢量作为新的候选运动矢量替换候选列表中的MVP2,从而实现对候选列表的更新,更新后的候选列表包括MVP1和该参考运动矢量。然后,对于更新后的候选列表,采用传统的方式来获得预测运动矢量(这里的预测运动矢量即为最优MVP),也就是说,从AMVP候选列表中选择出一个最优MVP,根据最优MVP来确定在参考图像中搜索的起始点,然后在搜索起始点的附近特定范围内按照特定方式进行搜索并进行率失真代价值计算,最后计算得到一个最优MV,最优MV确定了当前块在参考图像中的预测块的位置(在单向预测中,当前块的预测块即为当前块的重构块),并通过最优MV与最优MVP的差值求得运动矢量差值MVD,并对该最优MVP对应在AMVP候选列表中的索引值进行编码,对参考图像的索引进行编码。例如最优MVP为参考运动矢量(即参考运动 矢量就是所述预测运动矢量),则基于参考运动矢量构建当前块的预测块,并编码参考运动矢量对应的索引值,编码MVD,编码该参考运动矢量对应的参考图像的索引。然后,编码端在码流中向解码端发送编码后的该AMVP候选列表的索引值、MVD和参考图像的索引。Referring to FIG. 12, FIG. 12 shows a specific encoding process of the AMVP mode in the embodiment of the present invention. As shown in FIG. 12, at the encoding end, a candidate list of AMVP modes (ie, an AMVP candidate list) is constructed, and the candidate list includes MVP1, MVP2, etc., select MVP2 in the candidate list, update the MVP2 by using template matching (refer to the above description), obtain a reference motion vector, and replace the reference motion vector as a candidate candidate motion vector replacement candidate list. MVP2 in the middle, thereby implementing an update to the candidate list, the updated candidate list including the MVP1 and the reference motion vector. Then, for the updated candidate list, the predicted motion vector is obtained in a conventional manner (the predicted motion vector here is the optimal MVP), that is, an optimal MVP is selected from the AMVP candidate list, according to the optimal The MVP determines the starting point of the search in the reference image, and then searches in a specific manner in the vicinity of the search starting point and performs rate distortion generation value calculation, and finally calculates an optimal MV, and the optimal MV determines the current block. The position of the prediction block in the reference image (in unidirectional prediction, the prediction block of the current block is the reconstructed block of the current block), and the motion vector difference MVD is obtained by the difference between the optimal MV and the optimal MVP And encoding the index value corresponding to the optimal MVP in the AMVP candidate list, and encoding the index of the reference image. For example, if the optimal MVP is a reference motion vector (ie, the reference motion vector is the predicted motion vector), a prediction block of the current block is constructed based on the reference motion vector, and an index value corresponding to the reference motion vector is encoded, and the MVD is encoded to encode the reference motion. The index of the corresponding reference image of the vector. Then, the encoding end sends the encoded index value of the AMVP candidate list, the MVD and the index of the reference image to the decoding end in the code stream.
在解码端,解码端一方面基于与编码端同样的规则构建AMVP候选列表,该候选列表包括MVP1、MVP2等;另一方面,解析从编码端发送过来的码流,得到Merge候选列表的索引值、MVD和参考图像的索引,并对索引值所指示的候选运动矢量使用模板匹配的方式进行更新,例如,索引值指示候选列表中的MVP2,则对MVP2使用模板匹配的方式进行更新(具体过程参考上文描述),得到参考运动矢量。之后,在一种可能实施例中,将该参考运动矢量作为新的候选运动矢量替换候选列表中的MVP2,从而实现对候选列表的更新,更新后的候选列表包括MVP1和该参考运动矢量。然后,对于更新后的候选列表,将基于索引值直接确定的该参考运动矢量作为当前块的最优MVP(该最优MVP即为当前块的预测运动矢量),然后,最优MVP结合MVD得到当前块的最优MV,基于参考图像的索引确定最优MV对应的参考图像,进行构建当前块的预测块(在单向预测中,当前块的预测块即为当前块的重构块)。在另一种可能实施例中,在基于模板匹配得到参考运动矢量后,也可以直接将该参考运动矢量作为当前块的最优MV(预测运动矢量),并基于该预测运动矢量最终实现构建当前块的预测块。On the decoding side, the decoding end constructs an AMVP candidate list based on the same rules as the encoding end, and the candidate list includes MVP1, MVP2, etc.; on the other hand, parses the code stream sent from the encoding end to obtain an index value of the Merge candidate list. And indexing the MVD and the reference image, and updating the candidate motion vector indicated by the index value by using template matching. For example, if the index value indicates MVP2 in the candidate list, the MVP2 is updated by using template matching (specific process Referring to the above description), a reference motion vector is obtained. Thereafter, in a possible embodiment, the reference motion vector is replaced with MVP2 in the candidate list as a new candidate motion vector, thereby implementing an update of the candidate list, the updated candidate list including MVP1 and the reference motion vector. Then, for the updated candidate list, the reference motion vector directly determined based on the index value is used as the optimal MVP of the current block (the optimal MVP is the predicted motion vector of the current block), and then the optimal MVP is combined with the MVD. The optimal MV of the current block determines the reference picture corresponding to the optimal MV based on the index of the reference image, and constructs a prediction block of the current block (in the unidirectional prediction, the prediction block of the current block is the reconstructed block of the current block). In another possible embodiment, after the reference motion vector is obtained based on the template matching, the reference motion vector may be directly used as the optimal MV (predicted motion vector) of the current block, and the current implementation is based on the predicted motion vector. The prediction block of the block.
同理,在本发明具体实施例中,编码端使用模板匹配对AMVP候选列表进行更新可以是对候选列表中的一个候选运动矢量进行更新,可以是对候选列表中的多个候选运动矢量进行更新,还可以是对候选列表中的所有候选运动矢量进行更新。但是在解码端,只需对AMVP候选列表的索引值所指示的候选MV使用模板匹配进行更新,从而提高了解码端的解码效率。参见图13,图13示出了本发明实施例中AMVP模式的又一种具体编码过程,如图13所示,编码端对候选列表中的多个MVP(包括MVP1、MVP2)进行更新,基于更新后的候选列表确定参考运动矢量2为当前块的预测运动矢量(最优MVP),基于参考运动矢量2最终实现构建当前块的预测块,编码参考运动矢量2对应的候选列表索引、MVD和参考图像。在解码端,只需基于所接收的候选列表索引,对其所指示的MVP2使用模板匹配进行更新,从而得到参考运动矢量2,基于参考运动矢量2、MVD和参考图像最终实现构建当前块的预测块。Similarly, in the specific embodiment of the present invention, the encoding end updates the AMVP candidate list by using template matching, which may be updating one candidate motion vector in the candidate list, and may update multiple candidate motion vectors in the candidate list. It is also possible to update all candidate motion vectors in the candidate list. However, at the decoding end, only the candidate MV indicated by the index value of the AMVP candidate list is updated by using template matching, thereby improving the decoding efficiency of the decoding end. Referring to FIG. 13, FIG. 13 shows another specific encoding process of the AMVP mode in the embodiment of the present invention. As shown in FIG. 13, the encoding end updates multiple MVPs (including MVP1 and MVP2) in the candidate list, based on The updated candidate list determines that the reference motion vector 2 is the predicted motion vector (optimal MVP) of the current block, and finally constructs the prediction block of the current block based on the reference motion vector 2, and encodes the candidate list index, MVD, and the corresponding reference motion vector 2 Reference image. At the decoding end, it is only necessary to update the MVP2 indicated by the template matching based on the received candidate list index, thereby obtaining the reference motion vector 2, and finally constructing the prediction of the current block based on the reference motion vector 2, the MVD and the reference image. Piece.
同理,本发明可能实施例中,如果编码端基于更新后的候选列表所得到的预测运动矢量并不是所更新的候选运动矢量中的一个,那么在解码端,接收候选列表的索引之后,可直接根据候选列表的索引来选择候选列表中的候选运动矢量,作为解码端的预测运动矢量,而不需要再对该候选运动矢量进行更新。Similarly, in a possible embodiment of the present invention, if the predicted motion vector obtained by the encoding end based on the updated candidate list is not one of the updated candidate motion vectors, then at the decoding end, after receiving the index of the candidate list, The candidate motion vector in the candidate list is directly selected according to the index of the candidate list as the predicted motion vector of the decoding end, and the candidate motion vector is not updated.
下面描述解码过程(例如熵解码过程)中基于解码信息来构建候选列表、基于解码信息来选取候选运动矢量的方式。A manner of constructing a candidate list based on decoding information in a decoding process (for example, an entropy decoding process) and selecting a candidate motion vector based on the decoding information will be described below.
在本发明可能实施例中,解码端可根据解码所得候选列表的标识信息和/或候选列表的索引值来确定当前编解码采用哪一种预测模式,和/或,选取候选列表中的哪一个候选运动矢量。In a possible embodiment of the present invention, the decoding end may determine which prediction mode is used by the current codec according to the identification information of the decoded candidate list and/or the index value of the candidate list, and/or which one of the candidate lists is selected. Candidate motion vector.
在一可能实施方式中,解码端可以通过解析码流获得标识信息(例如码流代码中的标 识位)和候选列表的索引值。所述标识信息用于指示所述候选运动矢量集合为基于Merge模式或者AMVP模式来构建,例如标识位为0表示Merge模式,标识位为1表示AMVP模式。所述候选列表的索引值用于指示候选列表中的具体的候选运动矢量,例如索引值0表示候选列表中的第一个候选运动矢量,索引值1表示候选列表中的第二个候选运动矢量,等等。可以理解的,这种情况下,如果当前解码得到组合{标识位0,索引值1},则说明解码当前块所采用的预测模式为Merge模式,后续解码步骤中选取Merge候选列表中的第二个候选MV。In a possible implementation, the decoding end may obtain identification information (e.g., an identification bit in the code stream code) and an index value of the candidate list by parsing the code stream. The identifier information is used to indicate that the candidate motion vector set is constructed based on a Merge mode or an AMVP mode, for example, an identifier bit of 0 indicates a Merge mode, and an identifier bit of 1 indicates an AMVP mode. The index value of the candidate list is used to indicate a specific candidate motion vector in the candidate list, for example, the index value 0 represents the first candidate motion vector in the candidate list, and the index value 1 represents the second candidate motion vector in the candidate list. ,and many more. It can be understood that, in this case, if the current decoding obtains a combination {identification bit 0, index value 1}, it indicates that the prediction mode used for decoding the current block is the Merge mode, and the second decoding step selects the second of the Merge candidate list. Candidate MVs.
在一种可能实施方式中,所述标识信息(例如码流代码中的标识位)既可以用来指示解码当前块所采用的预测模式,同时还可以用来指示基于该预测模式所构建的候选列表的索引值。具体的,当所述标识信息用于指示所述预测模式为Merge模式时,还用于指示Merge模式的索引信息,或,当所述标识信息用于指示所述预测模式为AVMP模式时,还用于指示AMVP模式的索引信息。例如,所述标识位数值为0或1时,用于指示AMVP模式的候选列表的第一个MVP或第二个MVP;当所述标识位数值为2、3、4、5、6时,分别用于指示Merge模式的候选列表的第一、二、三、四、五个候选MV。In a possible implementation manner, the identification information (for example, the identifier bit in the code stream code) can be used to indicate the prediction mode used by the decoding current block, and can also be used to indicate the candidate constructed based on the prediction mode. The index value of the list. Specifically, when the identifier information is used to indicate that the prediction mode is the Merge mode, and is used to indicate the index information of the Merge mode, or when the identifier information is used to indicate that the prediction mode is the AVMP mode, Index information used to indicate the AMVP mode. For example, when the identifier bit value is 0 or 1, the first MVP or the second MVP for indicating the candidate list of the AMVP mode; when the identifier bit value is 2, 3, 4, 5, 6, The first, second, third, fourth, and fifth candidate MVs for indicating the candidate list of the Merge mode, respectively.
在一种可能实施方式中,所述标识信息(例如码流代码中的标识位)用于指示解码当前块所采用的预测模式,并且,当所述标识信息指示的预测模式为AMVP模式时,同时指示AMVP候选列表的索引值;当所述标识信息指示的预测模式为Merge模式时,解码端使用预设的Merge模式的索引值。例如,所述标识位数值为0或1时,用于指示AMVP模式的候选列表的第一个MVP或第二个MVP;当所述标识位数值为非0且非1的特定数值时(例如2),则用于指示Merge模式,这种情况下,后续解码步骤中解码端直接选取Merge模式所建立的候选列表中的第一个候选MV(还可以是其他任意预设索引位置的候选MV)。In a possible implementation manner, the identifier information (for example, an identifier bit in the code stream code) is used to indicate a prediction mode used by decoding the current block, and when the prediction mode indicated by the identifier information is an AMVP mode, The index value of the AMVP candidate list is simultaneously indicated; when the prediction mode indicated by the identifier information is the Merge mode, the decoding end uses the index value of the preset Merge mode. For example, when the identifier bit value is 0 or 1, the first MVP or the second MVP for indicating the candidate list of the AMVP mode; when the identification bit value is a non-zero and non-specific value (for example) 2), it is used to indicate the Merge mode. In this case, in the subsequent decoding step, the decoding end directly selects the first candidate MV in the candidate list established by the Merge mode (may also be a candidate MV of any other preset index position). ).
在一种可能实施方式中,在双向预测中,如果编解码端均采用混合预测模式,那么解码可获得至少两个标识信息,一个标识信息用于指示一个方向采用Merge模式,另一个标识信息用于指示另一个方向采用AMVP模式。或者,一个标识信息用于指示一个方向采用Merge模式以及指示Merge候选列表的索引值,另一个标识信息用于指示另一个方向采用AMVP模式以及指示AMVP候选列表的索引值。In a possible implementation manner, in the bidirectional prediction, if the codec end adopts the hybrid prediction mode, the decoding may obtain at least two pieces of identification information, one identification information is used to indicate that one direction adopts the Merge mode, and another identification information is used. The AMVP mode is used to indicate the other direction. Alternatively, one identification information is used to indicate that one direction adopts the Merge mode and an index value indicating the Merge candidate list, and the other identification information is used to indicate that the other direction adopts the AMVP mode and the index value indicating the AMVP candidate list.
在一种可能实施方式中,在双向预测中,如果编解码端均采用混合预测模式(即不同方向分别采用Merge模式和AMVP模式),那么解码可获得至少两个组合{第一标识信息,第一索引值}、{第二标识信息,第二索引值},其中{第一标识信息,第一索引值}中,第一标识信息表示第一方向的预测模式,第一索引值表示该第一方向的候选列表的索引值;{第二标识信息,第二索引值}中,第二标识信息表示第二方向的预测模式,第二索引值表示该第二方向的候选列表的索引值。In a possible implementation manner, in the bidirectional prediction, if the codec side adopts the hybrid prediction mode (that is, the Merge mode and the AMVP mode are respectively adopted in different directions), the decoding may obtain at least two combinations {first identification information, An index value}, {second identification information, a second index value}, wherein in the {first identification information, the first index value}, the first identification information represents a prediction mode in a first direction, and the first index value represents the first In the index value of the candidate list in one direction; in the second identifier information, the second index value, the second identifier information indicates the prediction mode in the second direction, and the second index value indicates the index value of the candidate list in the second direction.
在一种可能实施方式中,解码端也可以通过解析码流得到候选列表的索引值,所述候选列表的索引值既可以用来指示解码当前块所采用的预测模式,同时还可以用来指示基于该预测模式所构建的候选列表的具体候选运动矢量。例如,所述索引值为0或1时,用于指示AMVP模式的候选列表的第一个MVP或第二个MVP;当所述索引值为2、3、4、5、6时,分别用于指示Merge模式的候选列表的第一、二、三、四、五个候选MV。在一种可能实施方式中,在双向预测中,如果编解码端均采用混合预测模式,那么解码可获得至少两个索 引值,其中一个索引值用于指示一个方向采用Merge模式以及指示Merge候选列表中的具体候选运动矢量,另一个索引值用于指示另一个方向采用AMVP模式以及指示AMVP候选列表中的具体候选运动矢量。In a possible implementation manner, the decoding end may also obtain an index value of the candidate list by parsing the code stream, and the index value of the candidate list may be used to indicate the prediction mode used for decoding the current block, and may also be used to indicate A specific candidate motion vector of the candidate list constructed based on the prediction mode. For example, when the index value is 0 or 1, the first MVP or the second MVP for indicating the candidate list of the AMVP mode; when the index values are 2, 3, 4, 5, and 6, respectively, The first, second, third, fourth, and fifth candidate MVs of the candidate list indicating the Merge mode. In a possible implementation manner, in the bidirectional prediction, if the codec end adopts the hybrid prediction mode, the decoding may obtain at least two index values, wherein one index value is used to indicate that one direction adopts the Merge mode and indicates the Merge candidate list. The specific candidate motion vector in the other, the other index value is used to indicate that the other direction adopts the AMVP mode and indicates the specific candidate motion vector in the AMVP candidate list.
需要说明的是,上述具体实施方式中仅仅为参考示例,不代表对本发明实施例的限制。It should be noted that the above specific embodiments are merely examples, and do not represent limitations of the embodiments of the present invention.
基于上文描述的单向预测/双向预测、所构建的候选列表、基于模板匹配方式对候选运动矢量以及候选列表进行更新的方法、基于模板匹配的编解码过程,下面描述本发明实施例所提供的预测运动矢量生成方法。Based on the unidirectional prediction/bidirectional prediction described above, the constructed candidate list, the method of updating the candidate motion vector and the candidate list based on the template matching manner, the template matching based codec process, the following description is provided by the embodiment of the present invention Predictive motion vector generation method.
参见图14,图14是本发明实施例提供的一种预测运动矢量生成方法的流程示意图,该方法包括但不限于如下步骤:Referring to FIG. 14, FIG. 14 is a schematic flowchart diagram of a method for generating a motion vector predictor according to an embodiment of the present invention, where the method includes but is not limited to the following steps:
步骤S101:构建当前块的候选运动矢量集合。所述候选运动矢量集合可包括当前块的多个候选运动矢量,候选运动矢量又可称为候选预测运动矢量,在可能实施例中,还可以包括当前块的多个候选运动矢量对应的参考图像信息。具体的,所述候选运动矢量集合为基于Merge模式构建的Merge候选列表,或基于AMVP模式构建的AMVP候选列表。Step S101: Construct a candidate motion vector set of the current block. The candidate motion vector set may include a plurality of candidate motion vectors of a current block, which may be referred to as a candidate predicted motion vector. In a possible embodiment, the reference image corresponding to the multiple candidate motion vectors of the current block may also be included. information. Specifically, the candidate motion vector set is a Merge candidate list constructed based on the Merge mode, or an AMVP candidate list constructed based on the AMVP mode.
具体的,对于编码端,编码端可根据预设规则(例如传统方式)构建当前块的候选运动矢量集合,例如根据当前块空域上周边相邻块、或者当前块所对应时域参考块、或者当前块周边相邻块所对应时域参考块的运动矢量作为候选运动矢量,基于这些候选运动矢量基于预设的Merge模式或者AMVP模式构建候选列表。Specifically, for the encoding end, the encoding end may construct a candidate motion vector set of the current block according to a preset rule (for example, a traditional manner), for example, according to a neighboring neighboring block in the current block airspace, or a time domain reference block corresponding to the current block, or The motion vectors of the time domain reference blocks corresponding to the neighboring blocks of the current block are used as candidate motion vectors, and the candidate list is constructed based on the preset Merge mode or the AMVP mode based on the candidate motion vectors.
在解码端,可根据解码所得标识信息或者索引值来确定当前编解码采用哪一种预测模式,进而再构建相应的候选列表。At the decoding end, the prediction information or the index value obtained by decoding may be used to determine which prediction mode is used in the current codec, and then the corresponding candidate list is constructed.
举例来说,所述标识信息用于指示解码当前块所采用的预测模式,并且,当所述标识信息指示的预测模式为AMVP模式时,同时指示AMVP候选列表的索引值;当所述标识信息指示的预测模式为Merge模式时,解码端使用预设的Merge模式的索引值。For example, the identifier information is used to indicate a prediction mode used by decoding the current block, and when the prediction mode indicated by the identifier information is an AMVP mode, the index value of the AMVP candidate list is simultaneously indicated; when the identifier information is used. When the predicted prediction mode is Merge mode, the decoding end uses the index value of the preset Merge mode.
举例来说,所述标识信息既可以用来指示解码当前块所采用的预测模式,同时还可以用来指示基于该预测模式所构建的候选列表的索引值。For example, the identification information may be used to indicate a prediction mode used by decoding the current block, and may also be used to indicate an index value of a candidate list constructed based on the prediction mode.
举例来说,解码端可以通过解析码流获得标识信息和候选列表的索引值。所述标识信息用于指示所述候选运动矢量集合为基于Merge模式或者AMVP模式来构建,所述候选列表的索引值用于指示候选列表中的具体的候选运动矢量。For example, the decoding end can obtain the index information of the identification information and the candidate list by parsing the code stream. The identifier information is used to indicate that the candidate motion vector set is constructed based on a Merge mode or an AMVP mode, and an index value of the candidate list is used to indicate a specific candidate motion vector in the candidate list.
举例来说,解码端也可以通过解析码流得到候选列表的索引值,所述候选列表的索引值既可以用来指示解码当前块所采用的预测模式,同时还可以用来指示基于该预测模式所构建的候选列表的具体候选运动矢量。For example, the decoding end may also obtain an index value of the candidate list by parsing the code stream, and the index value of the candidate list may be used to indicate the prediction mode used for decoding the current block, and may also be used to indicate that the prediction mode is based on the prediction mode. The specific candidate motion vector of the constructed candidate list.
上述实施例的相关实现方式以及其他可能实施例的实现方式还可以参考前文的相关描述,这里不一一详述。For related implementations of the foregoing embodiments and implementations of other possible embodiments, reference may be made to the related descriptions of the foregoing, which are not described in detail herein.
步骤S102:选取所述候选运动矢量集合中的候选运动矢量,基于所述候选运动矢量确定至少一个参考运动矢量,参考运动矢量用来确定所述当前块在所述当前块的参考图像中的参考块。Step S102: Select a candidate motion vector in the candidate motion vector set, determine at least one reference motion vector based on the candidate motion vector, and use a reference motion vector to determine a reference of the current block in a reference image of the current block. Piece.
具体的,根据所述候选运动矢量在所述参考图像中确定的所述当前块的参考块包括:结合所述候选运动矢量值,确定在所述参考图像中的搜索范围,以目标精度在所述确定的 参考块的邻近位置进行搜索得到候选参考块,其中,每个所述候选参考块对应一个参考运动矢量,所述目标精度包括4像素精度、2像素精度、整像素精度、半像素精度、1/4像素精度、1/8像素精度中的一种。Specifically, the reference block of the current block determined in the reference image according to the candidate motion vector includes: combining the candidate motion vector value, determining a search range in the reference image, with a target accuracy in the Searching for a neighboring position of the determined reference block to obtain a candidate reference block, wherein each of the candidate reference blocks corresponds to a reference motion vector, the target precision includes 4 pixel precision, 2 pixel precision, integer pixel precision, and half pixel precision One of 1/4 pixel precision and 1/8 pixel precision.
步骤S103:分别计算至少一个所述确定的参考块的至少一个邻近已重构块和所述当前块的至少一个邻近已重构块之间的像素差异值或者率失真代价值。具体的,本发明实施例采用模板匹配的方式实现候选运动矢量的更新,具体实现方式可参考前文中的相关描述,这里不再赘述。Step S103: Calculate a pixel difference value or a rate distortion value between at least one adjacent reconstructed block of at least one of the determined reference blocks and at least one adjacent reconstructed block of the current block, respectively. Specifically, the embodiment of the present invention implements the update of the candidate motion vector by using a template matching manner. For the specific implementation manner, reference may be made to the related description in the foregoing, and details are not described herein again.
步骤S104根据所述至少一个参考运动矢量中对应的所述像素差异值或者率失真代价值最小的一个参考运动矢量,获得所述当前块的预测运动矢量。Step S104: Obtain a predicted motion vector of the current block according to the reference pixel motion value or the one reference motion vector with the lowest rate distortion value in the at least one reference motion vector.
具体实施例中,可使用所述对应的所述像素差异值或者率失真代价值最小的一个参考运动矢量替换所述候选运动矢量集合中的所述候选运动矢量;从包含所述替换后的第一候选运动矢量的候选运动矢量集合中,获得所述当前块的预测运动矢量。其中,对于Merge模式,所述预测运动矢量为当前块的实际运动矢量(实际MV),编码端或解码端可根据所述预测运动矢量得到当前块的预测块(在单向预测中,预测块即为最终的重构块;在双向预测中,使用预测块基于预设算法来得到当前块的重构块);对于AMVP模式,所述预测运动矢量为当前块的最优MVP,编码端或解码端可根据所述预测运动矢量得到实际MV,进而得到当前块的预测块(在单向预测中,预测块即为最终的重构块;在双向预测中,使用预测块基于预设算法来得到当前块的重构块)。In a specific embodiment, the candidate motion vector in the candidate motion vector set may be replaced by using the corresponding one of the pixel difference value or the rate distortion generation value that is the smallest; In the candidate motion vector set of a candidate motion vector, the predicted motion vector of the current block is obtained. For the Merge mode, the predicted motion vector is the actual motion vector (actual MV) of the current block, and the encoding end or the decoding end may obtain the prediction block of the current block according to the predicted motion vector (in the unidirectional prediction, the prediction block That is, the final reconstructed block; in the bidirectional prediction, the prediction block is used to obtain the reconstructed block of the current block based on a preset algorithm); for the AMVP mode, the predicted motion vector is the optimal MVP of the current block, and the encoding end or The decoding end may obtain the actual MV according to the predicted motion vector, thereby obtaining a prediction block of the current block (in the unidirectional prediction, the prediction block is the final reconstructed block; in the bidirectional prediction, using the prediction block based on a preset algorithm Get the reconstructed block of the current block).
在本发明实施例的一种双向预测场景中,当前(或)向预测的候选运动矢量得到更新(例如采用模板匹配的方式得到更新)后,后(前)预测的候选运动矢量也可以直接基于前(或)向预测的更新信息实现更新,具体过程包括:计算前(或)向预测的候选列表替换后的候选运动矢量与替换前的候选运动矢量的差值;结合所述差值和后(前)预测的候选运动矢量,获得后(前)预测的新的候选运动矢量,采用后(前)预测的新的候选运动矢量替换后(前)预测的原先的候选运动矢量,从而使得后(前)预测的候选运动矢量实现更新。In a bi-predictive scenario of the embodiment of the present invention, after the current (or updated) candidate motion vector is updated (for example, updated by template matching), the candidate motion vector of the post (pre) prediction may also be directly based on Pre- (or) updating to the predicted update information, the specific process includes: calculating a difference between the candidate motion vector after the replacement of the predicted candidate list and the candidate motion vector before the replacement; and combining the difference sum (pre)predicted candidate motion vector, obtain a new candidate motion vector after (pre) prediction, and replace the original candidate motion vector with the (pre)predicted new candidate motion vector, thereby making the latter The (pre)predicted candidate motion vector implementation update.
可以看出,本发明实施例中,视频编解码系统可利用模板匹配的方式,验证当前块的参考图像中一定范围内(甚至整个参考图像内)的图像块是否与当前块有较好的匹配,对基于Merge或AMVP模式所构建的候选列表的候选运动矢量进行更新,基于更新后的候选列表能够保证编解码过程中获得当前块的最佳参考块,最终得到最佳的重构块。It can be seen that, in the embodiment of the present invention, the video codec system can verify whether the image block in a certain range (or even the entire reference image) in the reference image of the current block has a good match with the current block by using template matching. The candidate motion vector of the candidate list constructed based on the Merge or AMVP mode is updated, and the updated candidate list can ensure that the best reference block of the current block is obtained in the encoding and decoding process, and finally the optimal reconstructed block is obtained.
下面详细描述本发明实施例提供的预测运动矢量生成方法的具体实现方式。A specific implementation manner of the predicted motion vector generation method provided by the embodiment of the present invention is described in detail below.
参见图15,图15是本发明实施例提供的一种预测运动矢量生成方法,从编码端的角度进行描述,该方法可用于单向预测(前向预测或者后向预测)中,该方法包括但不限于如下步骤:Referring to FIG. 15, FIG. 15 is a method for generating a motion vector predictor according to an embodiment of the present invention, which is described from the perspective of a coding end, and the method may be used in one-way prediction (forward prediction or backward prediction), and the method includes Not limited to the following steps:
步骤S201:编码端构建AMVP候选列表或Merge候选列表。Step S201: The encoding end constructs an AMVP candidate list or a Merge candidate list.
具体的,若所构建的候选列表是采用单向预测的候选列表,则可参考图4或图5实施例的相关描述,若所构建的候选列表是采用双向预测的候选列表,则可参考图6或图7实施例的相关描述,这里不再赘述。Specifically, if the candidate list is a candidate list that uses unidirectional prediction, refer to the related description of the embodiment of FIG. 4 or FIG. 5. If the candidate list constructed is a candidate list using bidirectional prediction, refer to the figure. 6 or the related description of the embodiment of FIG. 7, and details are not described herein again.
步骤S202:编码端选取所构建的AMVP候选列表或Merge候选列表中的一个候选运动矢量(即MVP或候选MV)。Step S202: The encoding end selects one candidate motion vector (ie, MVP or candidate MV) in the constructed AMVP candidate list or the Merge candidate list.
步骤S203:编码端结合所选取的候选运动矢量确定在参考图像中的搜索范围,所述搜索范围内包含至少一个运动矢量值,根据搜索范围内的所述至少一个运动矢量值得到当前块的参考图像中的至少一个图像块。Step S203: The encoding end determines the search range in the reference image according to the selected candidate motion vector, the search range includes at least one motion vector value, and obtains a reference of the current block according to the at least one motion vector value in the search range. At least one image block in the image.
具体的,以目标精度在所述候选运动矢量确定的参考块的邻近位置进行搜索得到至少一个图像块,其中,每个所述图像块对应一个参考运动矢量,所述目标精度包括4像素精度、2像素精度、整像素精度、半像素精度、1/4像素精度、1/8像素精度中的一种。Specifically, performing at least one image block by searching for a target accuracy in a neighboring position of the reference block determined by the candidate motion vector, where each image block corresponds to one reference motion vector, and the target precision includes 4 pixel precision, One of 2 pixel precision, integer pixel precision, half pixel precision, 1/4 pixel precision, and 1/8 pixel precision.
步骤S204:编码端分别计算所述当前块的至少一个邻近已重构块和每个图像块的至少一个邻近已重构块之间的像素差异值或率失真代价值,以及计算当前块的至少一个邻近已重构块和候选运动矢量对应的参考块的至少一个邻近已重构块之间的像素差异值或率失真代价值。在这些像素差异值或率失真代价值中,选出像素差异值或率失真代价值最小的一个,将该最小像素差异值或率失真代价值对应的运动矢量作为当前块的候选运动矢量。Step S204: The encoding end respectively calculates a pixel difference value or a rate distortion value between at least one adjacent reconstructed block of the current block and at least one adjacent reconstructed block of each image block, and calculates at least a current block. A pixel difference value or rate distortion cost value between at least one adjacent reconstructed block of a reference block corresponding to the reconstructed block and the candidate motion vector. Among these pixel difference values or rate distortion generation values, one of the pixel difference value or the rate distortion generation value is selected, and the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is used as the candidate motion vector of the current block.
步骤S205:如果该最小像素差异值或率失真代价值对应的运动矢量与步骤202中所选取的候选运动矢量不同,则编码端将该最小像素差异值或率失真代价值对应的运动矢量作为当前块的新的候选运动矢量,对所构建的所述AMVP候选列表或Merge候选列表进行更新。具体的,使用该最小像素差异值或率失真代价值对应的运动矢量对所述AMVP候选列表或Merge候选列表中对应的候选运动矢量进行替换。Step S205: If the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is different from the candidate motion vector selected in step 202, the encoding end uses the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value as the current A new candidate motion vector of the block is updated for the constructed AMVP candidate list or the Merge candidate list. Specifically, the motion vector corresponding to the minimum pixel difference value or the rate distortion value is used to replace the corresponding candidate motion vector in the AMVP candidate list or the Merge candidate list.
需要说明的是,上述步骤S201-S205的具体实现过程可参考图8-图9实施例的相关描述,这里不再赘述。It should be noted that the specific implementation process of the foregoing steps S201-S205 may refer to the related description of the embodiments in FIG. 8 to FIG. 9, and details are not described herein again.
还需要说明的是,本发明实施例还可以重复执行上述步骤S201-S205,以使所述AMVP候选列表或Merge候选列表中的多个(甚至全部)候选运动矢量实现更新。It should be noted that, in the embodiment of the present invention, the foregoing steps S201-S205 may be repeatedly performed to implement updating of multiple (or even all) candidate motion vectors in the AMVP candidate list or the Merge candidate list.
本发明可能实施例中,若所构建的是用于双向预测的AMVP候选列表或Merge候选列表,则在候选列表更新过程中,对索引值指示的前向的候选运动矢量和后向的候选运动矢量均进行更新。In a possible embodiment of the present invention, if the AMVP candidate list or the Merge candidate list for bidirectional prediction is constructed, the forward candidate motion vector and the backward candidate motion indicated by the index value in the candidate list update process. The vectors are updated.
步骤S206:编码端基于所述更新后的AMVP候选列表或Merge候选列表,得到当前块的预测运动矢量,进而基于当前块的预测运动矢量得到当前块的重构块,并向解码端发送码流。Step S206: The encoding end obtains the predicted motion vector of the current block based on the updated AMVP candidate list or the Merge candidate list, and further obtains the reconstructed block of the current block based on the predicted motion vector of the current block, and sends the code stream to the decoding end. .
具体的,如果编码端所使用的预测模式为AMVP模式,则基于所述更新后的AMVP候选列表确定预测运动矢量(最优MVP),进而得到当前块的重构块,并编码当前块对应的运动矢量差值信息(MVD),编码所述重构块对应的参考图像的索引,编码所述最优MVP对应的AMVP候选列表的索引值。可以理解的,编码端向解码端发送的码流中包含所述MVD、所述AMVP候选列表的索引值、所述参考图像的索引。Specifically, if the prediction mode used by the encoding end is the AMVP mode, the predicted motion vector (optimal MVP) is determined based on the updated AMVP candidate list, thereby obtaining a reconstructed block of the current block, and encoding the corresponding block of the current block. The motion vector difference information (MVD) encodes an index of the reference image corresponding to the reconstructed block, and encodes an index value of the AMVP candidate list corresponding to the optimal MVP. It can be understood that the code stream sent by the encoding end to the decoding end includes the MVD, an index value of the AMVP candidate list, and an index of the reference image.
具体的,如果编码端所使用的预测模式为Merge模式,则基于所述更新后的Merge候选列表确定预测运动矢量(最优MV),进而得到当前块的重构块,并编码最优MV对应的Merge候选列表的索引值。可以理解的,编码端向解码端发送码流中包含所述Merge候选列表的索引值。Specifically, if the prediction mode used by the encoding end is the Merge mode, the predicted motion vector (optimal MV) is determined based on the updated Merge candidate list, thereby obtaining a reconstructed block of the current block, and encoding the optimal MV corresponding The index value of the Merge candidate list. It can be understood that the encoding end sends the index value of the Merge candidate list in the code stream to the decoding end.
需要说明的是,本发明实施例的上述步骤S201-步骤S206的实现过程还可参考图10- 图11实施例或图12-图13实施例中中编码端的相关描述,这里不再赘述。It should be noted that the implementation process of the foregoing steps S201 to S206 of the embodiment of the present invention may also refer to the related description of the coding end in the embodiment of FIG. 10 to FIG. 11 or the embodiment of FIG. 12 to FIG. 13 , and details are not described herein again.
还需要说明的是,编码端中没有详细描述的相关步骤还可参考前文的相关描述。为了说明书的简洁,这里不一一展开描述。It should also be noted that related steps not detailed in the encoding end may also refer to the related descriptions above. For the sake of brevity of the description, the description will not be repeated here.
参见图16,图16是本发明实施例提供的一种预测运动矢量生成方法,从解码端的角度进行描述,该解码端可对应于图15实施例中的编码端。该方法可用于单向预测(前向预测或者后向预测)中,该方法包括但不限于如下步骤:Referring to FIG. 16, FIG. 16 is a schematic diagram of a method for generating a motion vector according to an embodiment of the present invention. The decoding end may be corresponding to the encoding end in the embodiment of FIG. The method can be used in one-way prediction (forward prediction or backward prediction), and the method includes but is not limited to the following steps:
步骤S301:解码端构建AMVP候选列表或Merge候选列表。Step S301: The decoding end constructs an AMVP candidate list or a Merge candidate list.
可以理解的,本发明实施例中,解码端采用与编码端一致的预测模式。也就是说,如果编码端基于AMVP模式构建Merge候选列表,那么解码端同样也会基于AMVP模式构建Merge候选列表,建立列表的方法与编码端一致;如果编码端基于Merge模式构建Merge候选列表,那么解码端同样也会基于Merge模式构建Merge候选列表,建立列表的方法与编码端一致。具体的,若所构建的候选列表是采用单向预测的候选列表,则可参考图4或图5实施例的相关描述,若所构建的候选列表是采用双向预测的候选列表,则可参考图6或图7实施例的相关描述,这里不再赘述。It can be understood that, in the embodiment of the present invention, the decoding end adopts a prediction mode consistent with the encoding end. That is to say, if the encoding end constructs the Merge candidate list based on the AMVP mode, the decoding end also constructs the Merge candidate list based on the AMVP mode, and the method of establishing the list is consistent with the encoding end; if the encoding end builds the Merge candidate list based on the Merge mode, then The decoding end also constructs a list of Merge candidates based on the Merge mode, and the method of creating the list is consistent with the encoding end. Specifically, if the candidate list is a candidate list that uses unidirectional prediction, refer to the related description of the embodiment of FIG. 4 or FIG. 5. If the candidate list constructed is a candidate list using bidirectional prediction, refer to the figure. 6 or the related description of the embodiment of FIG. 7, and details are not described herein again.
步骤S302:解码端解析码流得到AMVP候选列表或Merge候选列表的索引值。基于该索引值选取在AMVP候选列表或Merge候选列表中该索引值所指示的候选运动矢量(即MVP或候选MV)。Step S302: The decoding end parses the code stream to obtain an index value of the AMVP candidate list or the Merge candidate list. A candidate motion vector (ie, an MVP or a candidate MV) indicated by the index value in the AMVP candidate list or the Merge candidate list is selected based on the index value.
具体的,如果编码端和解码端均采用AMVP模式,那么解码端在解析所述码流过程中,解码得到AMVP候选列表的索引值,解码得到参考图像的索引,解码得到运动矢量差信息(MVD),基于该索引值选取在AMVP候选列表中该索引值指示的候选运动矢量。Specifically, if both the encoding end and the decoding end adopt the AMVP mode, the decoding end decodes the index value of the AMVP candidate list in the process of parsing the code stream, decodes the index of the reference image, and obtains motion vector difference information (MVD). And selecting a candidate motion vector indicated by the index value in the AMVP candidate list based on the index value.
如果编码端和解码端均采用Merge模式,那么解码端在解码所述码流过程中,解码得到Merge候选列表的索引值,基于该索引值选取在Merge候选列表中该索引值指示的候选运动矢量。If both the encoding end and the decoding end adopt the Merge mode, the decoding end decodes the index value of the Merge candidate list during decoding of the code stream, and selects a candidate motion vector indicated by the index value in the Merge candidate list based on the index value. .
例如,当解码所得的索引值为0或1时,所述0或1用于指示AMVP模式的候选列表的第一个MVP或第二个MVP;当解码所得的索引值为2、3、4、5、6时,所述2、3、4、5、6分别用于指示Merge模式的候选列表的第一、二、三、四、五个候选MV。For example, when the index value obtained by decoding is 0 or 1, the 0 or 1 is used to indicate the first MVP or the second MVP of the candidate list of the AMVP mode; when the decoded index value is 2, 3, 4 At 5, 6, the 2, 3, 4, 5, and 6 are used to indicate the first, second, third, fourth, and fifth candidate MVs of the candidate list of the Merge mode, respectively.
步骤S303:解码端结合所选取的候选运动矢量确定在参考图像中的搜索范围,所述搜索范围内包含至少一个运动矢量值,根据搜索范围内的所述至少一个运动矢量值得到当前块的参考图像中的至少一个图像块。Step S303: The decoding end determines a search range in the reference image in combination with the selected candidate motion vector, the search range includes at least one motion vector value, and obtains a reference of the current block according to the at least one motion vector value in the search range. At least one image block in the image.
具体的,以目标精度在所述候选运动矢量确定的参考块的邻近位置进行搜索得到至少一个图像块,其中,每个所述图像块对应一个参考运动矢量,所述目标精度包括4像素精度、2像素精度、整像素精度、半像素精度、1/4像素精度、1/8像素精度中的一种。Specifically, performing at least one image block by searching for a target accuracy in a neighboring position of the reference block determined by the candidate motion vector, where each image block corresponds to one reference motion vector, and the target precision includes 4 pixel precision, One of 2 pixel precision, integer pixel precision, half pixel precision, 1/4 pixel precision, and 1/8 pixel precision.
步骤S304:分别计算所述当前块的至少一个邻近已重构块和每个图像块的至少一个邻近已重构块之间的像素差异值或率失真代价值,以及计算当前块的至少一个邻近已重构块和候选运动矢量对应的参考块的至少一个邻近已重构块之间的像素差异值或率失真代价值。在这些像素差异值或率失真代价值中,选出像素差异值或率失真代价值最小的一个,将该最小像素差异值或率失真代价值对应的运动矢量作为当前块的候选运动矢量。Step S304: respectively calculating a pixel difference value or a rate distortion value between at least one adjacent reconstructed block of the current block and at least one adjacent reconstructed block of each image block, and calculating at least one neighbor of the current block. A pixel difference value or rate distortion cost value between at least one of the reconstructed block and the reference block corresponding to the candidate motion vector is adjacent to the reconstructed block. Among these pixel difference values or rate distortion generation values, one of the pixel difference value or the rate distortion generation value is selected, and the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is used as the candidate motion vector of the current block.
步骤S305:如果该最小像素差异值或率失真代价值对应的运动矢量与步骤302中所选取的候选运动矢量不同,则编码端将该最小像素差异值或率失真代价值对应的运动矢量作为当前块的新的候选运动矢量,对所构建的所述AMVP候选列表或Merge候选列表进行更新。具体的,使用该最小像素差异值或率失真代价值对应的运动矢量对所述AMVP候选列表或Merge候选列表中对应的候选运动矢量进行替换。Step S305: If the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is different from the candidate motion vector selected in step 302, the encoding end uses the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value as the current A new candidate motion vector of the block is updated for the constructed AMVP candidate list or the Merge candidate list. Specifically, the motion vector corresponding to the minimum pixel difference value or the rate distortion value is used to replace the corresponding candidate motion vector in the AMVP candidate list or the Merge candidate list.
需要说明的是,上述步骤S301-S305的具体实现过程可参考图8-图9实施例的相关描述,这里不再赘述。It should be noted that the specific implementation process of the foregoing steps S301-S305 may refer to the related description of the embodiment of FIG. 8 to FIG. 9, and details are not described herein again.
还需要说明的是,本发明实施例还可以重复执行上述步骤S301-S305,以使所述AMVP候选列表或Merge候选列表中的多个(甚至全部)候选运动矢量实现更新。It should be noted that, in the embodiment of the present invention, the foregoing steps S301-S305 may be repeatedly performed to implement updating of multiple (or even all) candidate motion vectors in the AMVP candidate list or the Merge candidate list.
本发明可能实施例中,若所构建的是用于双向预测的AMVP候选列表或Merge候选列表,则在候选列表更新过程中,对索引值指示的前向的候选运动矢量和后向的候选运动矢量均进行更新。In a possible embodiment of the present invention, if the AMVP candidate list or the Merge candidate list for bidirectional prediction is constructed, the forward candidate motion vector and the backward candidate motion indicated by the index value in the candidate list update process. The vectors are updated.
步骤S306:解码端基于候选列表的索引值,确定在更新后的AMVP候选列表或Merge候选列表中所述索引值所指示的候选运动矢量作为预测运动矢量,进而基于当前块的预测运动矢量得到当前块的重构块。Step S306: The decoding end determines, according to the index value of the candidate list, the candidate motion vector indicated by the index value in the updated AMVP candidate list or the Merge candidate list as the predicted motion vector, and further obtains the current based on the predicted motion vector of the current block. Reconstructed block of the block.
举例来说,本发明实施例采用Merge模式,解码端得到的Merge索引值为0。然后,解码端构建Merge候选列表,构建完成后,如果当前块在Merge模式下选取Merge候选列表索引值为0所对应的候选运动矢量为单向预测,且候选运动矢量的值为(3,5),根据选取的候选运动矢量得到参考图像中的参考图像块(参考块)。以参考块为中心,在周边1像素区域范围内以整像素精度搜索,可得若干与参考块同等大小的参考图像块(图像块)。以当前块左相邻及/或上相邻已重构块作为模板,分别与所述参考块、每个所述图像块左相邻及/或上相邻已重构块进行匹配,取率失真代价值最小者为更新的参考图像块,更新的参考图像块所对应的运动矢量(新的候选MV)为(4,5),即当前块的预测运动矢量为(4,5)。基于(4,5),利用更新的参考图像块对当前块进行重构,从而获得当前块的重构块。For example, in the embodiment of the present invention, the Merge mode is adopted, and the Merge index value obtained by the decoding end is 0. Then, the decoding end constructs a Merge candidate list. After the completion of the construction, if the current block selects the candidate motion vector corresponding to the Merge candidate list index value of 0 in the Merge mode, the unidirectional prediction is performed, and the value of the candidate motion vector is (3, 5). And obtaining a reference image block (reference block) in the reference image according to the selected candidate motion vector. Focusing on the reference block and searching for the entire pixel precision in the range of the surrounding 1-pixel region, a plurality of reference image blocks (image blocks) of the same size as the reference block can be obtained. Matching the left block adjacent to the current block and/or the upper adjacent reconstructed block as a template, respectively, the reference block, each of the image blocks left adjacent and/or the upper adjacent reconstructed block, and the rate is matched. The smallest distortion generation value is the updated reference image block, and the motion vector (new candidate MV) corresponding to the updated reference image block is (4, 5), that is, the predicted motion vector of the current block is (4, 5). Based on (4, 5), the current block is reconstructed with the updated reference image block, thereby obtaining a reconstructed block of the current block.
又举例来说,本发明实施例采用AMVP模式,解码端解码得到的候选列表的索引值。解码端构建AMVP候选列表,构建完成后,如果当前块在AMVP模式下选取索引值所对应的候选运动矢量为单向预测,且候选运动矢量的值为(3,5),根据选取的候选运动矢量得到参考图像中的参考图像块(参考块)。以参考块为中心,在周边1像素区域范围内以整像素精度搜索,可得若干与参考块同等大小的参考图像块(图像块)。以当前块左相邻及/或上相邻已重构块作为模板,分别与所述参考块、以及每个所述图像块左相邻及/或上相邻已重构块进行匹配,取率失真代价值最小者为更新的参考图像块,更新的参考图像块所对应的运动矢量(新的MVP)为(4,5),即当前块的预测运动矢量为(4,5)。基于(4,5),利用更新的参考图像块对当前块进行重构,从而获得当前块的重构块。For example, in the embodiment of the present invention, the AMVP mode is adopted, and the index value of the candidate list obtained by the decoding end is decoded. The decoding end constructs an AMVP candidate list. After the completion of the construction, if the current block selects the candidate motion vector corresponding to the index value in the AMVP mode as a unidirectional prediction, and the candidate motion vector has a value of (3, 5), according to the selected candidate motion. The vector gets a reference image block (reference block) in the reference image. Focusing on the reference block and searching for the entire pixel precision in the range of the surrounding 1-pixel region, a plurality of reference image blocks (image blocks) of the same size as the reference block can be obtained. Matching with the reference block and the left adjacent and/or upper adjacent reconstructed block of each of the image blocks respectively, using the current block left adjacent and/or upper adjacent reconstructed block as a template, The lowest rate distortion generation value is the updated reference image block, and the motion vector (new MVP) corresponding to the updated reference image block is (4, 5), that is, the predicted motion vector of the current block is (4, 5). Based on (4, 5), the current block is reconstructed with the updated reference image block, thereby obtaining a reconstructed block of the current block.
本发明可能实施例中,解码端也可以略过候选列表的更新,直接使用最小像素差异值或率失真代价值对应的运动矢量作为预测运动矢量,进而基于当前块的预测运动矢量得到当前块的重构块。In a possible embodiment of the present invention, the decoding end may skip the update of the candidate list, directly use the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value as the predicted motion vector, and then obtain the current block based on the predicted motion vector of the current block. Refactor the block.
需要说明的是,本发明实施例的上述步骤S301-步骤S306的实现过程还可参考图10-图11实施例或图12-图13实施例中解码端的相关描述,这里不再赘述。It should be noted that, in the implementation process of the foregoing steps S301 to S306 of the embodiment of the present invention, reference may be made to the description of the decoding end in the embodiment of FIG. 10 to FIG. 11 or the embodiment of FIG. 12 to FIG. 13 , and details are not described herein again.
还需要说明的是,解码端中没有详细描述的相关步骤可参考编码端中相关步骤的描述,以及参考前文的相关描述。为了说明书的简洁,这里不一一展开描述。It should also be noted that the relevant steps not described in detail in the decoding end may refer to the description of the relevant steps in the encoding end, and refer to the related description in the foregoing. For the sake of brevity of the description, the description will not be repeated here.
参见图17,图17中引入了一种混合预测模式,该混合预测模式应用于双向预测中。所述混合预测模式是指在编解码的双向预测过程中同时采用Merge模式和AMVP模式,具体的,在所述双向预测中,一个方向预测采用Merge模式进行编解码,另一个方向预测采用AMVP模式。可以理解的,当一个方向预测简称为前向预测时,另一个方向预测相应可简称为后向预测。下面基于所述混合预测模式描述本发明实施例提供的一种预测运动矢量生成方法,该方法从编码端的角度进行描述,在该方法中,一个方向预测采用Merge模式进行编解码来得到当前块的第一预测块的过程包括步骤S401-S404,另一个方向预测采用AMVP模式进行编解码来得到当前块的第二预测块的过程包括步骤S405-S406,最后,在步骤S407中,所述当前块的第一预测块和所述当前块的第二预测块通过预设算法就可以最终得到当前块的重构块。下面对这些步骤进行具体描述。Referring to Figure 17, a hybrid prediction mode is introduced which is applied to bidirectional prediction. The hybrid prediction mode refers to adopting the Merge mode and the AMVP mode simultaneously in the bidirectional prediction process of the codec. Specifically, in the bidirectional prediction, one direction prediction adopts the Merge mode for encoding and decoding, and the other direction prediction adopts the AMVP mode. . It can be understood that when one direction prediction is simply referred to as forward prediction, the other direction prediction may be referred to as backward prediction. A prediction motion vector generation method according to an embodiment of the present invention is described below based on the hybrid prediction mode. The method is described from the perspective of an encoding end. In this method, a direction prediction is performed by using a Merge mode to obtain a current block. The process of the first prediction block includes steps S401-S404, and the process of the other direction prediction using the AMVP mode for encoding and decoding to obtain the second prediction block of the current block includes steps S405-S406, and finally, in step S407, the current block The first prediction block and the second prediction block of the current block can finally obtain the reconstructed block of the current block by using a preset algorithm. These steps are described in detail below.
首先描述步骤S401-S404。在步骤S401-S404中,Merge模式在前(或后,下同)向预测中采用模板匹配方式更新候选列表进而得到第一预测块,具体如下:First, steps S401-S404 are described. In steps S401-S404, the Merge mode uses the template matching manner to update the candidate list in the front (or later, the same below) to obtain the first prediction block, as follows:
步骤S401:编码端的前(或后)向预测采用Merge模式,编码端基于Merge模式构建Merge候选列表,所述Merge候选列表用于进行双向预测中的前(或后)向预测。具体可参考图5实施例的描述,这里不再赘述。Step S401: The front (or back) prediction of the encoding end adopts the Merge mode, and the encoding end constructs a Merge candidate list based on the Merge mode, and the Merge candidate list is used for performing pre (or backward) prediction in the bidirectional prediction. For details, refer to the description of the embodiment of FIG. 5, and details are not described herein again.
步骤S402:编码端在Merge候选列表中选取候选运动矢量。Step S402: The encoding end selects a candidate motion vector in the Merge candidate list.
在一具体应用场景中,如果选取的候选运动矢量为通过后(或前)向预测而得到的,可通过映射得到用于前(后)向预测的候选运动矢量,作为所选择的候选运动矢量值应用到后续步骤S403。例如,编码端在Merge候选列表中选取候选运动矢量为(-2,-2),该(-2,-2)基于后向预测得到,当前块对应于图像帧序列中的图像序列号为4,后向预测的参考块对应于图像帧序列中的图像序列号为6,前向预测的参考块对应于图像帧序列中的图像序列号为3,那么,当前块与前向预测的参考块的时序差(简称为第二时序差)为1(即4-3=1),当前块与后向预测的参考块的时序差(简称为第一时序差)为-2(即4-6=-2),所以,可以根据第一时序差与第二时序差之间的比例关系(-2/1=-2),将用于后向预测的(-2,-2)映射成为用于前向预测的候选运动矢量(1,1),即(-2,-2)/-2=(1,1)。将所述(1,1)作为所选择的候选运动矢量值应用到后续步骤S403。In a specific application scenario, if the selected candidate motion vector is obtained by post- (or forward) prediction, the candidate motion vector for the front (back) prediction may be obtained by mapping as the selected candidate motion vector. The value is applied to the subsequent step S403. For example, the encoding end selects the candidate motion vector in the Merge candidate list as (-2, -2), and the (-2, -2) is based on the backward prediction. The current block corresponds to the image sequence number in the image frame sequence is 4. The backward predicted reference block corresponds to the image sequence number in the image frame sequence is 6, and the forward predicted reference block corresponds to the image sequence number in the image frame sequence is 3, then the current block and the forward predicted reference block The timing difference (referred to as the second timing difference) is 1 (ie, 4-3=1), and the timing difference between the current block and the backward predicted reference block (referred to as the first timing difference) is -2 (ie, 4-6) =-2), therefore, the (-2,-2) mapping for backward prediction can be used according to the proportional relationship between the first timing difference and the second timing difference (-2/1=-2). The candidate motion vector (1, 1) predicted in the forward direction, that is, (-2, -2) / -2 = (1, 1). The (1, 1) is applied as the selected candidate motion vector value to the subsequent step S403.
另外,在可能的实施例中,如果所选取的候选运动矢量为通过后(或前)向预测而得到的,也可以对该候选运动矢量的选择进行中断处理,也就是说,重新在Merge候选列表中选取其他的候选运动矢量。In addition, in a possible embodiment, if the selected candidate motion vector is obtained by post- (or forward) prediction, the selection of the candidate motion vector may also be interrupted, that is, re-in the Merge candidate. Select other candidate motion vectors from the list.
在一具体应用场景中,如果选取的候选运动矢量是通过双向预测而得到的,则选取该候选运动矢量中用于前(或后)向预测部分的值,作为所选择的候选运动矢量值应用到后续步骤S403。例如前(或后)向预测中,编码端在Merge候选列表中预选取的候选运动矢量包括用于前(后)向预测的运动矢量(1,1)和用于后(前)向预测的运动矢量(-2,-2),则编码端最终采用前(后)向预测的运动矢量(1,1)作为所选择的候选运动矢量值应用到后续步骤S403。In a specific application scenario, if the selected candidate motion vector is obtained by bidirectional prediction, the value of the candidate motion vector for the front (or back) prediction portion is selected as the selected candidate motion vector value application. Go to the subsequent step S403. For example, in the pre- (or post-) prediction, the candidate motion vectors pre-selected by the encoding end in the Merge candidate list include motion vectors (1, 1) for pre (post) prediction and post (pre) prediction. For the motion vector (-2, -2), the encoding end finally applies the pre- (post)-predicted motion vector (1, 1) as the selected candidate motion vector value to the subsequent step S403.
在一具体应用场景中,如果选取的候选运动矢量就是通过前(后)向预测而得到,那么就直接采用该候选运动矢量作为所选择的候选运动矢量值应用到后续步骤S403。In a specific application scenario, if the selected candidate motion vector is obtained by pre- (post) prediction, the candidate motion vector is directly used as the selected candidate motion vector value to be applied to the subsequent step S403.
步骤S403:编码端利用模板匹配的方式对该候选运动矢量进行更新。Step S403: The encoding end updates the candidate motion vector by using template matching.
具体过程包括,编码端选取Merge候选列表的候选运动矢量作为输入,所述候选运动矢量对应于参考图像中的参考块。结合候选运动矢量确定搜索范围,所述搜索范围内包含至少一个参考运动矢量;根据搜索范围内参考运动矢量得到当前块前(后)向预测在参考图像中的图像块;分别计算所述当前块的至少一个邻近已重构块和每个图像块的至少一个邻近已重构块之间的像素差异值或率失真代价值,以及计算当前块的至少一个邻近已重构块和候选运动矢量对应的参考块的至少一个邻近已重构块之间的像素差异值或率失真代价值。在这些像素差异值或率失真代价值中,选出像素差异值或率失真代价值最小的一个,将该最小像素差异值或率失真代价值对应的运动矢量作为当前块的候选运动矢量,从而实现对候选运动矢量进行更新。The specific process includes: the encoding end selects a candidate motion vector of the Merge candidate list as an input, and the candidate motion vector corresponds to a reference block in the reference image. Determining a search range by combining a candidate motion vector, the search range includes at least one reference motion vector; obtaining an image block predicted in the reference image before (later) the current block according to the reference motion vector within the search range; respectively calculating the current block Pixel difference value or rate distortion value between at least one adjacent reconstructed block and at least one adjacent reconstructed block of each image block, and calculating at least one adjacent reconstructed block of the current block and candidate motion vector corresponding At least one of the reference blocks is adjacent to the pixel difference value or rate distortion generation value between the reconstructed blocks. In the pixel difference value or the rate distortion generation value, one of the pixel difference value or the rate distortion generation value is selected, and the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is used as the candidate motion vector of the current block, thereby The update of the candidate motion vector is implemented.
具体实现过程还可参考图8-图9实施例的描述,这里不再赘述。For a specific implementation process, reference may be made to the description of the embodiments in FIG. 8 to FIG. 9 , and details are not described herein again.
步骤S404:编码端可将该最小像素差异值或率失真代价值对应的运动矢量替换所述Merge候选列表中对应的候选运动矢量,从而实现对Merge候选列表的更新,基于更新后的Merge候选列表得到当前块前(后)向的预测运动矢量(又可称为第一预测运动矢量),结合所述前(后)向的预测运动矢量得到前(后)向的预测块(又可称为第一预测块),并对预测运动矢量对应在Merge候选列表中的索引值进行编码。具体过程可参考图10-图11实施例的编码端相关描述,这里不再赘述。Step S404: The encoding end may replace the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value with the corresponding candidate motion vector in the Merge candidate list, thereby implementing updating of the Merge candidate list, based on the updated Merge candidate list. Obtaining a predicted motion vector (also referred to as a first predicted motion vector) of the front (back) direction of the current block, and obtaining a front (back) directed block in combination with the predicted motion vector of the front (back) direction (also referred to as The first prediction block) and encodes the index value corresponding to the predicted motion vector in the Merge candidate list. For a specific process, reference may be made to the description of the coding end of the embodiment of FIG. 10 to FIG. 11 , and details are not described herein again.
其次,描述步骤S405-S406。AMVP模式在后(或前,下同)向预测中直接使用所构建的候选列表得到第二预测块,具体如下:Next, steps S405-S406 are described. The AMVP mode uses the constructed candidate list directly in the prediction (or before, the same below) to obtain the second prediction block, as follows:
步骤S405:编码端基于AMVP模式构建AMVP候选列表。所述AMVP候选列表用于进行双向预测中的后(或前)向预测。具体可参考图6实施例的描述,这里不再赘述。Step S405: The encoding end constructs an AMVP candidate list based on the AMVP mode. The AMVP candidate list is used for post- (or forward) prediction in bi-directional prediction. For details, refer to the description of the embodiment of FIG. 6 , and details are not described herein again.
步骤S406:编码端基于所述AMVP候选列表采用传统的AMVP方式得到当前块的后(前)向的预测块(又可称为第二预测块)。Step S406: The encoding end obtains a post (previous) prediction block (also referred to as a second prediction block) of the current block by using a conventional AMVP method based on the AMVP candidate list.
具体过程包括:编码端直接从AMVP候选列表中选择出一个最优MVP,根据最优MVP来确定在参考图像中搜索的起始点,然后在搜索起始点的附近特定范围内按照特定方式进行搜索并进行率失真代价值计算,最后计算得到一个最优MV,最优MV确定了第二预测块的位置,通过最优MV与最优MVP的差值求得运动矢量差值MVD,并对该最优MVP对应在AMVP候选列表中的索引值进行编码,对参考图像的索引进行编码。The specific process includes: the encoding end directly selects an optimal MVP from the AMVP candidate list, determines a starting point of searching in the reference image according to the optimal MVP, and then searches according to a specific manner within a specific range near the search starting point. The rate distortion generation value is calculated, and finally an optimal MV is obtained. The optimal MV determines the position of the second prediction block, and the motion vector difference MVD is obtained by the difference between the optimal MV and the optimal MVP, and the most The optimal MVP encodes the index value in the AMVP candidate list, and encodes the index of the reference image.
最后,在步骤S407中:编码端得到重构块,向解码端发送码流。具体的,在得到前(后)向的第一预测块和后(前)向的第二预测块后,编码端基于预设算法对所述第一预测块和所述第二预测块进行处理,从而得到当前块的重构块,例如将第一预测块和第二预测块进行加权平分计算,从而得到当前块的重构块。之后,编码端向解码端发送码流,所述码流相应地包括Merge候选列表的索引值、AMVP候选列表的索引值、MVD、参考图像的索引等。Finally, in step S407, the encoding end obtains the reconstructed block, and transmits the code stream to the decoding end. Specifically, after obtaining the first (back) direction first prediction block and the back (front) direction second prediction block, the encoding end processes the first prediction block and the second prediction block according to a preset algorithm. Thereby, a reconstructed block of the current block is obtained, for example, the first prediction block and the second prediction block are weighted and halved, thereby obtaining a reconstructed block of the current block. Thereafter, the encoding end transmits a code stream to the decoding end, and the code stream correspondingly includes an index value of the Merge candidate list, an index value of the AMVP candidate list, an MVD, an index of the reference image, and the like.
需要说明的是,上述步骤S401-S404和步骤S405-S406之间没有必然的先后顺序,也就是说,S401-S404可以在S405-S406之前或之后进行,S401-S404和S405-S406也可以同时进行。It should be noted that there is no necessary sequence between the above steps S401-S404 and steps S405-S406, that is, S401-S404 can be performed before or after S405-S406, and S401-S404 and S405-S406 can also be simultaneously get on.
还需要说明的是,在本发明另一种实施例中,还可以将S401-S404替换为AMVP模式在前(后)向预测中采用模板匹配方式更新候选列表进而得到第一预测块,将S405-S406替换为Merge模式在后(前)向预测中直接使用所构建的候选列表得到第二预测块,具体实现过程可参考前文的描述,这里不再赘述。It should be noted that, in another embodiment of the present invention, the S401-S404 may be replaced by the AMVP mode. The candidate list is updated in the template matching manner in the pre- (post) prediction, and the first prediction block is obtained. -S406 is replaced with the Merge mode. The second prediction block is obtained by using the constructed candidate list directly in the prediction. The specific implementation process may refer to the foregoing description, and details are not described herein again.
还需要说明的是,编码端中没有详细描述的相关步骤还可参考前文的相关描述。为了说明书的简洁,这里不一一展开描述。It should also be noted that related steps not detailed in the encoding end may also refer to the related descriptions above. For the sake of brevity of the description, the description will not be repeated here.
参见图18,图18为基于一种混合预测模式的预测运动矢量生成方法,应用于双向预测中,从解码端的角度进行描述,该解码端可对应于图17中的编码端。Referring to FIG. 18, FIG. 18 is a prediction motion vector generation method based on a hybrid prediction mode, which is applied to bidirectional prediction, and is described from the perspective of a decoding end, and the decoding end may correspond to the encoding end in FIG.
在熵解码的过程中,解码端解析码流,得到候选列表的索引值。然后通过索引值是否为特定值来判断执行下述步骤S501-S504还是S505-S506。具体实施例中,若索引值为特定值,则该索引值用于指示解码端前(后)向预测采用Merge模式,解码端进而执行步骤S501-S504;若索引值不为特定值,则该索引值用于指示编码端采用AMVP模式,则解码端还对该预测方向的参考图像的索引以及运动矢量差信息(MVD)进行解码,进而执行步骤S505-S506。举例来说,在可能应用场景中,如果索引值为0或1,则该索引值用于指示后向预测采用AMVP模式(具体用于指示AMVP模式所构建的候选列表中的第一个或者第二个MVP),则解码端还对该后向预测的参考图像的索引以及MVD进行解码,进而执行后续步骤;如果索引值为特定值2,则该索引值用于指示前向预测采用Merge模式(具体用于指示Merge模式所构建的候选列表中的特定候选MV,如第一个候选MV)进而执行后续步骤。上述示例仅仅用于解释本发明的方案而非限定。下面对这些步骤进行具体描述。In the process of entropy decoding, the decoding end parses the code stream to obtain an index value of the candidate list. It is then judged whether or not the following steps S501-S504 or S505-S506 are performed by whether the index value is a specific value. In a specific embodiment, if the index value is a specific value, the index value is used to indicate that the decoding end adopts the Merge mode before and after the prediction, and the decoding end further performs steps S501-S504; if the index value is not a specific value, The index value is used to indicate that the encoding end adopts the AMVP mode, and the decoding end further decodes the index of the reference image of the prediction direction and the motion vector difference information (MVD), and then performs steps S505-S506. For example, in a possible application scenario, if the index value is 0 or 1, the index value is used to indicate that the backward prediction adopts the AMVP mode (specifically used to indicate the first or the first of the candidate lists constructed by the AMVP mode. The two MVPs, the decoder also decodes the index of the backward predicted reference image and the MVD, and then performs the subsequent steps; if the index value is a specific value of 2, the index value is used to indicate that the forward prediction adopts the Merge mode. (Specificly used to indicate a specific candidate MV in the candidate list constructed by the Merge mode, such as the first candidate MV) to perform subsequent steps. The above examples are merely illustrative of the invention and are not limiting. These steps are described in detail below.
首先描述步骤S501-S504。在步骤S501-S504中,Merge模式在前(或后,下同)向预测中采用模板匹配方式更新候选列表中索引值所指示的候选运动矢量,进而得到第一预测块,具体如下:First, steps S501-S504 are described. In steps S501-S504, the Merge mode uses the template matching manner to update the candidate motion vector indicated by the index value in the candidate list in the pre- (or later, the same below) prediction, thereby obtaining the first prediction block, as follows:
步骤S501:在解码得到的索引值指示前(或后)向预测采用Merge模式的情况下,解码端确定前(或后)向预测采用Merge模式,进而构建Merge候选列表。列表的具体构建方式可与图17实施例步骤S401一致。Step S501: In the case that the decoded index value indicates that the Merge mode is used before (or after) the prediction, the decoding end determines that the pre- (or post-) prediction adopts the Merge mode, thereby constructing the Merge candidate list. The specific construction of the list can be consistent with step S401 of the embodiment of FIG.
本发明可能实施例中,解码端也可通过解码候选运动矢量值来确定Merge模式或AMVP模式所对应的预测方向。例如,解码端选取Merge候选列表索引值为3所对应的候选运动矢量,发现所选取的候选运动矢量为前向预测的候选运动矢量,则确定前向预测采用Merge模式。又例如,解码端选取AMVP候选列表索引值为0所对应的候选运动矢量,发现所选取的候选运动矢量为后向预测的候选运动矢量,则确定后向预测采用Merge模式。In a possible embodiment of the present invention, the decoding end may also determine the prediction direction corresponding to the Merge mode or the AMVP mode by decoding the candidate motion vector value. For example, the decoding end selects the candidate motion vector corresponding to the Merge candidate list index value of 3, and finds that the selected candidate motion vector is the forward predicted candidate motion vector, and determines that the forward prediction adopts the Merge mode. For another example, the decoding end selects the candidate motion vector corresponding to the AMVP candidate list index value of 0, and finds that the selected candidate motion vector is the backward predicted candidate motion vector, and determines that the backward prediction adopts the Merge mode.
步骤S502:解码端基于解码所得的索引值,在Merge候选列表中选取索引值对应的候选运动矢量。例如索引值为2,所述2用于指示Merge候选列表中的第一个候选MV,则选取Merge候选列表中的所述第一个候选MV。Step S502: The decoding end selects a candidate motion vector corresponding to the index value in the Merge candidate list based on the index value obtained by the decoding. For example, if the index value is 2, and the 2 is used to indicate the first candidate MV in the Merge candidate list, then the first candidate MV in the Merge candidate list is selected.
步骤S503:解码端利用模板匹配的方式对该候选运动矢量进行更新。具体可参考图17实施例步骤S403的相关描述,这里不再赘述。Step S503: The decoding end updates the candidate motion vector by using template matching. For details, refer to the related description of step S403 in the embodiment of FIG. 17 , and details are not described herein again.
步骤S504:解码端实现对Merge候选列表中所选择的候选MV的更新,将所述更新后的候选MV作为当前块前(后)向的预测运动矢量(又可称为第一预测运动矢量),结合所述 前(后)向的预测运动矢量得到前(后)向的预测块(又可称为第一预测块)。具体过程可参考图10-图11实施例的解码端相关描述,这里不再赘述。Step S504: The decoding end implements an update of the candidate MV selected in the Merge candidate list, and uses the updated candidate MV as a pre- (post) forward predicted motion vector (also referred to as a first predicted motion vector). A pre- (post-) directed prediction block (also referred to as a first prediction block) is obtained in conjunction with the pre- (rear) predicted motion vector. For a specific process, reference may be made to the description of the decoding end of the embodiment of FIG. 10 to FIG. 11 , and details are not described herein again.
下面描述步骤S505-S506:Steps S505-S506 are described below:
步骤S505:在解码得到的索引值指示后(或前)向预测采用AMVP模式的情况下,解码端确定后(或前)向预测采用AMVP模式,继续解码得到参考图像的索引以及MVD等信息,进而构建AMVP候选列表。列表的具体构建方式可与图17实施例步骤S405一致。Step S505: After the index value indicated by the decoding indicates (or before) the AMVP mode is adopted for the prediction, the decoding end determines (or before) the prediction adopts the AMVP mode, and continues to decode to obtain the index of the reference image and the MVD and the like. Then build an AMVP candidate list. The specific construction of the list can be consistent with step S405 of the embodiment of FIG.
步骤S506:解码端基于所述AMVP候选列表,以及所解码的参考图像的索引以及MVD等信息,采用传统的AMVP方式解码得到当前块的后(前)向的预测块(又可称为第二预测块)。Step S506: The decoding end decodes the post (previous) prediction block of the current block by using a conventional AMVP method based on the AMVP candidate list, the index of the decoded reference image, and the MVD information (also referred to as a second Forecast block).
最后,在步骤S507中:解码端在得到前(后)向的第一预测块和后(前)向的第二预测块后,基于预设算法对所述第一预测块和所述第二预测块进行处理,从而得到当前块的重构块。例如将第一预测块和第二预测块进行加权平分计算,从而得到当前块的重构块。Finally, in step S507, after the decoding end obtains the first (back) direction first prediction block and the back (front) direction second prediction block, the first prediction block and the second method are performed based on a preset algorithm. The prediction block is processed to obtain a reconstructed block of the current block. For example, the first prediction block and the second prediction block are subjected to weighted halving calculation, thereby obtaining a reconstructed block of the current block.
需要说明的是,上述步骤S501-S504和步骤S505-S506之间没有必然的先后顺序,也就是说,S501-S504可以在S505-S506之前或之后进行,S501-S504和S505-S506也可以同时进行。It should be noted that there is no necessary sequence between the above steps S501-S504 and steps S505-S506, that is, S501-S504 can be performed before or after S505-S506, and S501-S504 and S505-S506 can also be simultaneously get on.
还需要说明的是,在本发明另一种实施例中,还可以将S501-S504相应替换为AMVP模式在前(后)向预测中采用模板匹配方式更新候选列表进而得到第一预测块(例如索引值指示前向预测中采用AMVP模式),将S505-S506替换为Merge模式在后(前)向预测中直接使用所构建的候选列表得到第二预测块(例如索引值指示后向预测中采用Merge模式),具体实现过程可参考前文的描述,这里不再赘述。It should be noted that, in another embodiment of the present invention, the S501-S504 may be replaced by the AMVP mode, and the candidate list may be updated by using the template matching manner in the pre- (post) prediction to obtain the first prediction block (for example, The index value indicates that the AMVP mode is adopted in the forward prediction, and the S505-S506 is replaced with the Merge mode. The second prediction block is obtained by directly using the constructed candidate list in the backward (previous) prediction (for example, the index value indicates that the backward prediction is used. Merge mode), the specific implementation process can refer to the foregoing description, and will not be described here.
还需要说明的是,解码端中没有详细描述的相关步骤可参考编码端中相关步骤的描述,以及参考前文的相关描述。为了说明书的简洁,这里不一一展开描述。It should also be noted that the relevant steps not described in detail in the decoding end may refer to the description of the relevant steps in the encoding end, and refer to the related description in the foregoing. For the sake of brevity of the description, the description will not be repeated here.
参见图19,图19是本发明实施例提供的又一种混合预测模式的预测运动矢量生成方法,从编码端的角度进行描述,该方法实施例与图17实施例的区别包括,前向预测和后向预测所采用不同的预测模式(Merge模式和AMVP模式),在前向预测和后向预测中均采用模板匹配方式更新候选运动矢量/更新候选列表。下面对这些步骤进行简单描述。Referring to FIG. 19, FIG. 19 is a method for generating a predicted motion vector of a hybrid prediction mode according to an embodiment of the present invention, which is described from the perspective of an encoding end. The difference between the method embodiment and the embodiment of FIG. 17 includes forward prediction and The backward prediction uses different prediction modes (Merge mode and AMVP mode), and both the forward prediction and the backward prediction are used to update the candidate motion vector/update candidate list in the template matching manner. These steps are briefly described below.
首先描述步骤S601-S604。在步骤S601-S604中,Merge模式在前(或后,下同)向预测中采用模板匹配方式更新候选列表进而得到第一预测块,具体如下:First, steps S601-S604 are described. In steps S601-S604, the Merge mode uses the template matching manner to update the candidate list in the front (or later, the same below) to obtain the first prediction block, as follows:
步骤S601:编码端的前(或后)向预测采用Merge模式,编码端基于Merge模式构建Merge候选列表,所述Merge候选列表用于进行双向预测中的前(或后)向预测。Step S601: The pre- (or post-) prediction of the encoding end adopts the Merge mode, and the encoding end constructs a Merge candidate list based on the Merge mode, and the Merge candidate list is used for performing pre- (or backward) prediction in the bidirectional prediction.
步骤S602:编码端在Merge候选列表中选取候选运动矢量。Step S602: The encoding end selects a candidate motion vector in the Merge candidate list.
具体的实现过程可参考图17步骤S402中的相关描述,这里不再赘述。For a specific implementation process, refer to the related description in step S402 of FIG. 17, and details are not described herein again.
步骤S603:编码端利用模板匹配的方式对该候选运动矢量进行更新。Step S603: The encoding end updates the candidate motion vector by means of template matching.
步骤S604:编码端基于当前块前(后)向更新后的Merge候选列表得到前(后)向预测块(又可称为第一预测块)。Step S604: The encoding end obtains a pre (post) prediction block (also referred to as a first prediction block) based on the updated Merge candidate list before (behind) the current block.
下面描述步骤S605-S608,在步骤S605-S606中,AMVP模式在后(或前,下同)向预测中采用模板匹配方式更新候选列表进而得到第二预测块,具体如下:Steps S605-S608 are described below. In steps S605-S606, the AMVP mode uses the template matching method to update the candidate list and obtain the second prediction block in the backward (or before, the same below) prediction, as follows:
步骤S605:编码端基于AMVP模式构建AMVP候选列表。所述AMVP候选列表用于进行双向预测中的后(或前)向预测。Step S605: The encoding end constructs an AMVP candidate list based on the AMVP mode. The AMVP candidate list is used for post- (or forward) prediction in bi-directional prediction.
步骤S606:编码端在AMVP候选列表中选取候选运动矢量。Step S606: The encoding end selects a candidate motion vector in the AMVP candidate list.
在一具体应用场景中,如果选取的候选运动矢量为通过前(或后)向预测而得到的,可通过映射得到用于后(前)向预测的候选运动矢量,作为所选择的候选运动矢量值应用到后续步骤S607。例如,编码端在AMVP候选列表中选取前向候选运动矢量为(-2,-2),该(-2,-2)基于前向预测得到,当前块对应于图像帧序列中的图像序列号(Picture Order Count,简称时序)为4,前向预测的参考块对应于图像帧序列中的图像序列号为2,后向预测的参考块对应于图像帧序列中的图像序列号为5,那么,当前块与后向预测的参考块的时序差(可简称为第二时序差)为1(即4-5=-1),当前块与前向预测的参考块的时序差(可简称为第一时序差)为2(即4-2=2),所以,可以根据第一时序差与第二时序差之间的比例关系(2/-1=-2),将用于前向预测的(-2,-2)映射成为用于后向预测的候选运动矢量(1,1),即(-2,-2)/-2=(1,1)。将所述(1,1)作为所选择的候选运动矢量值应用到后续步骤S607。In a specific application scenario, if the selected candidate motion vector is obtained by pre- (or backward) prediction, the candidate motion vector for the post-previous prediction may be obtained by mapping as the selected candidate motion vector. The value is applied to the subsequent step S607. For example, the encoding end selects the forward candidate motion vector in the AMVP candidate list as (-2, -2), the (-2, -2) is obtained based on the forward prediction, and the current block corresponds to the image serial number in the image frame sequence. (Picture Order Count, referred to as timing) is 4, the forward predicted reference block corresponds to the image sequence number in the image frame sequence is 2, and the backward predicted reference block corresponds to the image sequence number in the image frame sequence is 5, then The timing difference between the current block and the backward predicted reference block (which may be simply referred to as the second timing difference) is 1 (ie, 4-5=-1), and the timing difference between the current block and the forward predicted reference block (may be simply referred to as The first timing difference) is 2 (ie, 4-2=2), so it can be used for forward prediction according to the proportional relationship between the first timing difference and the second timing difference (2/-1=-2). The (-2, -2) mapping becomes a candidate motion vector (1, 1) for backward prediction, that is, (-2, -2) / -2 = (1, 1). The (1, 1) is applied as the selected candidate motion vector value to the subsequent step S607.
另外,在可能的实施例中,如果所选取的候选运动矢量为通过前(或后)向预测而得到的,也可以对该候选运动矢量的选择进行中断处理,也就是说,重新在AMVP候选列表中选取其他的候选运动矢量。In addition, in a possible embodiment, if the selected candidate motion vector is obtained by pre- (or backward) prediction, the selection of the candidate motion vector may be interrupted, that is, re-initiated in the AMVP candidate. Select other candidate motion vectors from the list.
在一具体应用场景双向预测过程中,如果后(前)向预测预选取的候选运动矢量是通过双向预测而得到的,则最终选取该双向预测中用于后(前)向预测部分的值,作为所选择的候选运动矢量值应用到后续步骤S607。例如后(前)向预测,编码端在Merge候选列表中预选取的候选运动矢量是通过双向预测而得到,该候选运动矢量包括用于前(后)向预测的运动矢量(1,1)和用于后(前)向预测的运动矢量(-2,-2),则编码端最终采用后(前)向预测的运动矢量(-2,-2)作为所选择的候选运动矢量值应用到后续步骤S607。In a bi-directional prediction process of a specific application scenario, if the candidate motion vector pre-selected from the post-pre-prediction is obtained by bidirectional prediction, the value of the bi-directional prediction for the post-previous prediction portion is finally selected. The selected candidate motion vector value is applied to the subsequent step S607. For example, the post (pre) prediction, the candidate motion vector preselected by the encoding end in the Merge candidate list is obtained by bidirectional prediction, which includes the motion vector (1, 1) for the pre (post) prediction. For the motion vector (-2, -2) of the backward (front) direction prediction, the encoding end finally applies the post (pre)to the predicted motion vector (-2, -2) as the selected candidate motion vector value to Subsequent step S607.
在一具体应用场景中,如果选取的候选运动矢量就是通过后(前)向预测而得到,那么就直接采用该候选运动矢量作为所选择的候选运动矢量值应用到后续步骤S607。In a specific application scenario, if the selected candidate motion vector is obtained by post- (pre-) prediction, the candidate motion vector is directly used as the selected candidate motion vector value to be applied to the subsequent step S607.
步骤S607:编码端利用模板匹配的方式对该候选运动矢量进行更新。Step S607: The encoding end updates the candidate motion vector by using template matching.
具体过程包括,编码端选AMVP候选列表的候选运动矢量作为输入,所述候选运动矢量对应于参考图像中的参考块。结合候选运动矢量确定搜索范围,所述搜索范围内包含至少一个参考运动矢量;根据搜索范围内参考运动矢量得到当前块后(前)向预测在参考图像中的图像块;分别计算所述当前块的至少一个邻近已重构块和每个图像块的至少一个邻近已重构块之间的像素差异值或率失真代价值,以及计算当前块的至少一个邻近已重构块和候选运动矢量对应的参考块的至少一个邻近已重构块之间的像素差异值或率失真代价值。在这些像素差异值或率失真代价值中,选出像素差异值或率失真代价值最小的一个,将该最小像素差异值或率失真代价值对应的运动矢量作为当前块的候选运动矢量,从而实现对候选运动矢量进行更新。The specific process includes, as an input, a candidate motion vector of an encoding end select AMVP candidate list, where the candidate motion vector corresponds to a reference block in the reference image. Determining a search range by combining candidate motion vectors, the search range includes at least one reference motion vector; and obtaining an image block in the reference image after the current block is obtained from the reference motion vector within the search range; respectively calculating the current block Pixel difference value or rate distortion value between at least one adjacent reconstructed block and at least one adjacent reconstructed block of each image block, and calculating at least one adjacent reconstructed block of the current block and candidate motion vector corresponding At least one of the reference blocks is adjacent to the pixel difference value or rate distortion generation value between the reconstructed blocks. In the pixel difference value or the rate distortion generation value, one of the pixel difference value or the rate distortion generation value is selected, and the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value is used as the candidate motion vector of the current block, thereby The update of the candidate motion vector is implemented.
具体实现过程还可参考图8-图9实施例的描述,这里不再赘述。For a specific implementation process, reference may be made to the description of the embodiments in FIG. 8 to FIG. 9 , and details are not described herein again.
步骤S608:编码端可将该最小像素差异值或率失真代价值对应的运动矢量替换所述AMVP候选列表中对应的候选运动矢量,从而实现对AMVP候选列表的更新,基于更新后的AMVP候选列表得到当前块后(前)向的预测运动矢量(又可称为第二预测运动矢量),结 合所述后(前)向的预测运动矢量得到后(前)的预测块(又可称为第二预测块),并对预测运动矢量对应在AMVP候选列表中的索引值进行编码,以及对预测块对应的参考图像的索引进行编码,对MVD进行编码,具体过程可参考图12-图13实施例的编码端相关描述,这里不再赘述。Step S608: The encoding end may replace the motion vector corresponding to the minimum pixel difference value or the rate distortion cost value with the corresponding candidate motion vector in the AMVP candidate list, thereby implementing updating of the AMVP candidate list, based on the updated AMVP candidate list. Obtaining a predicted motion vector (also referred to as a second predicted motion vector) after the current (front) direction of the current block, and obtaining a post (pre)predicted block in combination with the predicted (previous) predicted motion vector (also referred to as a The second prediction block is used, and the index value corresponding to the prediction motion vector in the AMVP candidate list is encoded, and the index of the reference image corresponding to the prediction block is encoded, and the MVD is encoded. The specific process can be implemented by referring to FIG. 12 to FIG. The description of the coding end of the example is not described here.
最后,在步骤S609:编码端得到重构块,向解码端发送码流。具体的,在得到前(后)向的第一预测块和后(前)向的第二预测块后,编码端基于预设算法对所述第一预测块和所述第二预测块进行处理,从而得到当前块的重构块。之后,编码端向解码端发送码流,所述码流相应地包括Merge候选列表的索引值、AMVP候选列表的索引值、MVD、参考图像的索引等。Finally, in step S609, the encoding end obtains the reconstructed block, and transmits the code stream to the decoding end. Specifically, after obtaining the first (back) direction first prediction block and the back (front) direction second prediction block, the encoding end processes the first prediction block and the second prediction block according to a preset algorithm. To get the reconstructed block of the current block. Thereafter, the encoding end transmits a code stream to the decoding end, and the code stream correspondingly includes an index value of the Merge candidate list, an index value of the AMVP candidate list, an MVD, an index of the reference image, and the like.
还需要说明的是,编码端中没有详细描述的相关步骤还可参考前文的相关描述。为了说明书的简洁,这里不一一展开描述。It should also be noted that related steps not detailed in the encoding end may also refer to the related descriptions above. For the sake of brevity of the description, the description will not be repeated here.
参见图20,图20是本发明实施例提供的又一种混合预测模式的预测运动矢量生成方法,从解码端的角度进行描述,该方法实施例的解码端可与图19实施例的编码端相对应。该方法实施例与图18实施例的区别包括,前向预测和后向预测所采用不同的预测模式(Merge模式和AMVP模式),在前向预测和后向预测中均采用模板匹配方式更新候选运动矢量/更新候选列表。下面对这些步骤进行简单描述。Referring to FIG. 20, FIG. 20 is a schematic diagram of a method for generating a motion vector predicting motion in a mixed prediction mode according to an embodiment of the present invention. The decoding end of the method embodiment can be compared with the code end of the embodiment of FIG. correspond. The difference between the method embodiment and the embodiment of FIG. 18 includes that different prediction modes (Merge mode and AMVP mode) are used for forward prediction and backward prediction, and template matching method is used to update candidates in both forward prediction and backward prediction. Motion vector/update candidate list. These steps are briefly described below.
首先描述步骤S701-S704。在步骤S701-S704中,Merge模式在前(或后,下同)向预测中采用模板匹配方式更新候选列表中索引值所指示的候选运动矢量,进而得到第一预测块,具体如下:First, steps S701-S704 are described. In steps S701-S704, the Merge mode uses the template matching manner to update the candidate motion vector indicated by the index value in the candidate list in the pre- (or later, the same below) prediction, thereby obtaining the first prediction block, as follows:
步骤S701:解码得到的索引值指示前(或后)向预测采用Merge模式的情况下,解码端确定前(或后)向预测采用Merge模式,进而构建Merge候选列表。Step S701: The decoded index value indicates that the pre- (or post) prediction adopts the Merge mode, and the decoding end determines that the pre- (or post-) prediction adopts the Merge mode, thereby constructing the Merge candidate list.
步骤S702:解码端基于解码信息(标识位和/或索引值,具体参考前文描述),在Merge候选列表中选取索引值对应的候选运动矢量。Step S702: The decoding end selects a candidate motion vector corresponding to the index value in the Merge candidate list based on the decoding information (identification bit and/or index value, specifically referring to the foregoing description).
在一具体应用场景中,如果基于解码所得的索引值选取的候选运动矢量为通过后(或前)向预测而得到的,可通过映射得到用于前(后)向预测的候选运动矢量,作为所选择的候选运动矢量值应用到后续步骤S703。例如解码端在Merge候选列表中选取候选运动矢量为(-2,-2),该(-2,-2)基于后向预测得到,当前块对应于图像帧序列中的图像序列号为4,后向预测的参考块对应于图像帧序列中的图像序列号为6,前向预测的参考块对应于图像帧序列中的图像序列号为3,那么,当前块与前向预测的参考块的时序差(简称为第二时序差)为1(即4-3=1),当前块与后向预测的参考块的时序差(简称为第一时序差)为-2(即4-6=-2),所以,可以根据第一时序差与第二时序差之间的比例关系(-2/1=-2),将用于后向预测的(-2,-2)映射成为用于前向预测的候选运动矢量(1,1),即(-2,-2)/-2=(1,1)。将所述(1,1)作为所选择的候选运动矢量值应用到后续步骤S703。In a specific application scenario, if the candidate motion vector selected based on the decoded index value is obtained by post- (or forward) prediction, the candidate motion vector for the front (back) prediction may be obtained by mapping, as The selected candidate motion vector value is applied to subsequent step S703. For example, the decoding end selects the candidate motion vector as (-2, -2) in the Merge candidate list, and the (-2, -2) is obtained based on the backward prediction, and the current block corresponds to the image sequence number in the image frame sequence is 4, The backward predicted reference block corresponds to the image sequence number in the image frame sequence is 6, and the forward predicted reference block corresponds to the image sequence number in the image frame sequence is 3, then the current block and the forward predicted reference block The timing difference (referred to as the second timing difference) is 1 (ie, 4-3=1), and the timing difference between the current block and the backward predicted reference block (referred to as the first timing difference) is -2 (ie, 4-6= -2), therefore, (-2, -2) mapping for backward prediction can be used for the proportional relationship between the first timing difference and the second timing difference (-2/1 = -2) The forward predicted candidate motion vector (1, 1), ie (-2, -2) / -2 = (1, 1). The (1, 1) is applied as the selected candidate motion vector value to the subsequent step S703.
另外,在可能的实施例中,如果基于解码所得的索引值所选取的候选运动矢量为通过后(或前)向预测而得到的,也可以对该候选运动矢量的选择进行中断处理,也就是说,重新在Merge候选列表中选取其他的候选运动矢量。In addition, in a possible embodiment, if the candidate motion vector selected based on the decoded index value is obtained by post- (or forward) prediction, the selection of the candidate motion vector may be interrupted, that is, Say, re-select other candidate motion vectors in the Merge candidate list.
在一具体应用场景中,如果基于解码所得的索引值选取的候选运动矢量是通过双向预 测而得到的,则选取该候选运动矢量中用于前(或后)向预测部分的值,作为所选择的候选运动矢量值应用到后续步骤S703。例如前(或后)向预测中,解码端在Merge候选列表中预选取的候选运动矢量包括用于前(后)向预测的运动矢量(1,1)和用于后(前)向预测的运动矢量(-2,-2),则编码端最终采用前(后)向预测的运动矢量(1,1)作为所选择的候选运动矢量值应用到后续步骤S703。In a specific application scenario, if the candidate motion vector selected based on the decoded index value is obtained by bidirectional prediction, the value of the candidate motion vector for the front (or back) prediction portion is selected as the selected The candidate motion vector value is applied to the subsequent step S703. For example, in the pre- (or post-) prediction, the candidate motion vectors pre-selected by the decoding end in the Merge candidate list include motion vectors (1, 1) for pre (post) prediction and post (pre) prediction. For the motion vector (-2, -2), the encoding end finally applies the pre- (post)-predicted motion vector (1, 1) as the selected candidate motion vector value to the subsequent step S703.
在一具体应用场景中,如果基于解码所得的索引值选取的候选运动矢量就是通过前(后)向预测而得到,那么就直接采用该候选运动矢量作为所选择的候选运动矢量值应用到后续步骤S703。In a specific application scenario, if the candidate motion vector selected based on the decoded index value is obtained by pre- (post) prediction, the candidate motion vector is directly used as the selected candidate motion vector value to be applied to subsequent steps. S703.
步骤S703:解码端利用模板匹配的方式对该候选运动矢量进行更新。Step S703: The decoding end updates the candidate motion vector by means of template matching.
步骤S704:解码端实现对Merge候选列表中所选择的候选MV的更新,将所述更新后的候选MV作为当前块前(后)向的预测运动矢量(又可称为第一预测运动矢量),结合所述前(后)向的预测运动矢量得到前(后)向的预测块(又可称为第一预测块)。Step S704: The decoding end implements an update of the candidate MV selected in the Merge candidate list, and uses the updated candidate MV as a pre- (post) forward predicted motion vector (also referred to as a first predicted motion vector). A pre- (post-) directed prediction block (also referred to as a first prediction block) is obtained in conjunction with the pre- (rear) predicted motion vector.
下面描述步骤S705-S708,在步骤S705-S,706中,AMVP模式在后(或前,下同)向预测中采用模板匹配方式更新候选列表进而得到第二预测块,具体如下:Steps S705-S708 are described below. In steps S705-S, 706, the AMVP mode uses the template matching manner to update the candidate list and obtain the second prediction block in the backward (or before, the same below) prediction, as follows:
步骤S705:解码端基于解码信息(标识位和/或索引值,具体参考前文描述)确定AMVP模式,基于AMVP模式构建AMVP候选列表。所述AMVP候选列表用于进行双向预测中的后(或前)向预测。Step S705: The decoding end determines the AMVP mode based on the decoding information (identification bit and/or index value, specifically referring to the foregoing description), and constructs an AMVP candidate list based on the AMVP mode. The AMVP candidate list is used for post- (or forward) prediction in bi-directional prediction.
步骤S706:解码端基于解码信息(标识位和/或索引值,具体参考前文描述)在AMVP候选列表中选取候选运动矢量。Step S706: The decoding end selects the candidate motion vector in the AMVP candidate list based on the decoding information (identification bit and/or index value, specifically referring to the foregoing description).
在一具体应用场景中,如果基于解码所得的索引值选取的候选运动矢量为通过前(或后)向预测而得到的,可通过映射得到用于后(前)向预测的候选运动矢量,作为所选择的候选运动矢量值应用到后续步骤S707。例如,解码端在AMVP候选列表中选取前向候选运动矢量为(-2,-2),该(-2,-2)基于前向预测得到,当前块对应于图像帧序列中的图像序列号为4,前向预测的参考块对应于图像帧序列中的图像序列号为2,后向预测的参考块对应于图像帧序列中的图像序列号为5,那么,当前块与后向预测的参考块的时序差(可简称为第二时序差)为1(即4-5=-1),当前块与前向预测的参考块的时序差(可简称为第一时序差)为2(即4-2=2),所以,可以根据第一时序差与第二时序差之间的比例关系(2/-1=-2),将用于前向预测的(-2,-2)映射成为用于后向预测的候选运动矢量(1,1),即(-2,-2)/-2=(1,1)。将所述(1,1)作为所选择的候选运动矢量值应用到后续步骤S707。In a specific application scenario, if the candidate motion vector selected based on the decoded index value is obtained by pre- (or backward) prediction, the candidate motion vector for the post-previous prediction may be obtained by mapping, as The selected candidate motion vector value is applied to subsequent step S707. For example, the decoding end selects the forward candidate motion vector in the AMVP candidate list as (-2, -2), the (-2, -2) is obtained based on the forward prediction, and the current block corresponds to the image serial number in the image frame sequence. 4, the forward predicted reference block corresponds to the image sequence number in the image frame sequence is 2, and the backward predicted reference block corresponds to the image sequence number in the image frame sequence is 5, then the current block and the backward predicted The timing difference of the reference block (which may be simply referred to as the second timing difference) is 1 (ie, 4-5=-1), and the timing difference between the current block and the forward-predicted reference block (which may be simply referred to as the first timing difference) is 2 ( That is, 4-2=2), so, according to the proportional relationship between the first timing difference and the second timing difference (2/-1=-2), (-2, -2) for forward prediction The mapping becomes a candidate motion vector (1, 1) for backward prediction, that is, (-2, -2) / -2 = (1, 1). The (1, 1) is applied as the selected candidate motion vector value to the subsequent step S707.
另外,在可能的实施例中,如果基于解码所得的索引值所选取的候选运动矢量为通过前(或后)向预测而得到的,也可以对该候选运动矢量的选择进行中断处理,也就是说,重新在AMVP候选列表中选取其他的候选运动矢量。In addition, in a possible embodiment, if the candidate motion vector selected based on the decoded index value is obtained by pre- (or backward) prediction, the selection of the candidate motion vector may be interrupted, that is, Said to re-select other candidate motion vectors in the AMVP candidate list.
在一具体应用场景双向预测过程中,如果在后(前)向预测中基于解码所得的索引值预选取的候选运动矢量是通过双向预测而得到的,则最终选取该双向预测中用于后(前)向预测部分的值,作为所选择的候选运动矢量值应用到后续步骤S707。例如后(前)向预测,解码端在Merge候选列表中预选取的候选运动矢量是通过双向预测而得到,该候选运动矢量包括用于前(后)向预测的运动矢量(1,1)和用于后(前)向预测的运动矢量(-2,-2),则解码端最终采用后(前)向预测的运动矢量(-2,-2)作为所选择的候选运动矢量值应 用到后续步骤S707。In a bi-directional prediction process of a specific application scenario, if the candidate motion vector pre-selected based on the decoded index value in the post-pre (forecast) prediction is obtained by bidirectional prediction, the bidirectional prediction is finally selected for later ( The value of the front prediction section is applied to the subsequent step S707 as the selected candidate motion vector value. For example, the post (pre) prediction, the candidate motion vector preselected by the decoding end in the Merge candidate list is obtained by bidirectional prediction, the candidate motion vector including the motion vector (1, 1) for the pre (post) prediction. For the motion vector (-2, -2) of the backward (front) direction prediction, the decoding end finally applies the post (pre)to the predicted motion vector (-2, -2) as the selected candidate motion vector value to Subsequent step S707.
在一具体应用场景中,如果选取的候选运动矢量就是通过后(前)向预测而得到,那么就直接采用该候选运动矢量作为所选择的候选运动矢量值应用到后续步骤S707。In a specific application scenario, if the selected candidate motion vector is obtained by post- (pre-) prediction, the candidate motion vector is directly used as the selected candidate motion vector value to be applied to the subsequent step S707.
步骤S707:解码端利用模板匹配的方式对该候选运动矢量进行更新。Step S707: The decoding end updates the candidate motion vector by means of template matching.
步骤S708:解码端基于所述AMVP候选列表,以及所解码的参考图像的索引以及MVD等信息,得到当前块的后(前)向的预测块(又可称为第二预测块)。Step S708: The decoding end obtains a post (previous) prediction block (also referred to as a second prediction block) of the current block based on the AMVP candidate list, the index of the decoded reference image, and the MVD and the like.
最后,在步骤S709中:解码端在得到前(后)向的第一预测块和后(前)向的第二预测块后,基于预设算法对所述第一预测块和所述第二预测块进行处理,从而得到当前块的重构块。Finally, in step S709, after the decoding end obtains the first (back) direction first prediction block and the back (front) direction second prediction block, the first prediction block and the second method are performed based on a preset algorithm. The prediction block is processed to obtain a reconstructed block of the current block.
还需要说明的是,解码端中没有详细描述的相关步骤可参考编码端中相关步骤的描述,以及参考前文的相关描述。为了说明书的简洁,这里不一一展开描述。It should also be noted that the relevant steps not described in detail in the decoding end may refer to the description of the relevant steps in the encoding end, and refer to the related description in the foregoing. For the sake of brevity of the description, the description will not be repeated here.
参见图21,图21是本发明实施例提供的又一种预测运动矢量生成方法,从编码端的角度进行描述,该方法可用于双向预测中的编码端,该方法包括但不限于如下步骤:Referring to FIG. 21, FIG. 21 is yet another method for generating a motion vector predictor according to an embodiment of the present invention. The method is described in the perspective of an encoding end. The method may be used in an encoding end in bidirectional prediction, and the method includes but is not limited to the following steps:
步骤S801:编码端构建Merge候选列表或者AMVP候选列表,可相应参考图6或图7实施例的相关描述,这里不再赘述。Step S801: The encoding end constructs a Merge candidate list or an AMVP candidate list, and may refer to the related description of the embodiment of FIG. 6 or FIG. 7 respectively, and details are not described herein again.
在构建Merge候选列表或者AMVP候选列表后,该候选列表中包括用于前向预测的前向候选运动矢量以及用于后向预测的后向运动矢量,针对前(后)向候选运动矢量、后(前)向候选运动矢量执行后续步骤S802-S804、S805-S807,下面分别对这两个过程进行描述。After constructing the Merge candidate list or the AMVP candidate list, the candidate list includes a forward candidate motion vector for forward prediction and a backward motion vector for backward prediction, for the front (back) candidate motion vector, The subsequent steps S802-S804, S805-S807 are performed (front) to the candidate motion vectors, which are described below.
首先描述步骤S802-S804:First, steps S802-S804 are described:
步骤S802:编码端在所构建的候选列表中,选取前(或后,下同)向候选运动矢量。Step S802: The encoding end selects the pre- (or following, the same below) candidate motion vector in the constructed candidate list.
步骤S803:编码端利用模板匹配的方式对该前(后)向候选运动矢量进行更新。Step S803: The encoding end updates the front (back) candidate motion vector by means of template matching.
步骤S804:编码端基于当前块前(后)向更新后的候选列表中的前(后)向候选运动矢量得到前(后)向预测块(又可称为第一预测块)。Step S804: The encoding end obtains a front (back) prediction block (also referred to as a first prediction block) based on the front (rear) candidate motion vector in the updated candidate list before (behind) the current block.
下面描述步骤S805-S807:Steps S805-S807 are described below:
步骤S805:编码端在所构建的候选列表中,确定后(或前,下同)向候选运动矢量。Step S805: The encoding end determines the post- (or before, the same below) candidate motion vector in the constructed candidate list.
步骤S806:编码端利用前(后)向更新前后的候选运动矢量对后(前)向候选运动矢量进行更新。Step S806: The encoding end updates the candidate motion vector by the preceding (backward) candidate motion vector pair before and after the update.
具体的,编码端计算候选列表中,替换后的前(后)向候选运动矢量(即步骤S803所得的新的前(后)向候选运动矢量)与替换前的前(后)向候选运动矢量(即步骤S802中所选取的候选运动矢量)的差值;结合所述差值和在步骤S805所选择的后(前)向候选运动矢量,得到新的后(前)向候选运动矢量;然后,用所述新的后(前)向候选运动矢量替换步骤S805中所确定的后(前)向候选运动矢量,从而使得该候选列表进一步得到更新。Specifically, in the encoding end calculation candidate list, the replaced pre (post) candidate motion vector (ie, the new pre (post) candidate motion vector obtained in step S803) and the pre (rear) candidate motion vector before replacement (i.e., the candidate motion vector selected in step S802); in combination with the difference and the posterior (front) candidate motion vector selected in step S805, a new posterior (front) candidate motion vector is obtained; And replacing the post (front) candidate motion vector determined in step S805 with the new post (pre) candidate motion vector, so that the candidate list is further updated.
步骤S807:编码端基于当前块后(前)向更新后的候选列表中的后(前)向候选运动矢量得到后(前)向预测块(又可称为第二预测块)。Step S807: The encoding end obtains a post (pre)direction prediction block (also referred to as a second prediction block) based on the post (pre)direction candidate motion vector in the updated candidate list based on the current block (front).
步骤S808:编码端在得到前(后)向的第一预测块和后(前)向的第二预测块后,基于预设算法对所述第一预测块和所述第二预测块进行处理,从而得到当前块的重构块,进而向解码端发送码流。可以理解的,如果当前采用Merge模式编码,则码流中包括Merge 候选列表的索引值;如果当前采用AMVP模式编码,则码流中包括AMVP候选列表的索引值、参考图像的索引值以及MVD信息。Step S808: After obtaining the first (back) direction first prediction block and the back (front) direction second prediction block, the encoding end processes the first prediction block and the second prediction block according to a preset algorithm. , thereby obtaining a reconstructed block of the current block, and then transmitting the code stream to the decoding end. It can be understood that if the Merge mode encoding is currently used, the code stream includes an index value of the Merge candidate list; if the AMVP mode encoding is currently used, the code stream includes an index value of the AMVP candidate list, an index value of the reference image, and MVD information. .
还需要说明的是,编码端中没有详细描述的相关步骤还可参考前文的相关描述。为了说明书的简洁,这里不一一展开描述。It should also be noted that related steps not detailed in the encoding end may also refer to the related descriptions above. For the sake of brevity of the description, the description will not be repeated here.
参见图22,图22是本发明实施例提供的又一种预测运动矢量生成方法,从解码端进行描述,该方法可用于双向预测中的解码端,该方法中的解码端可与图21中的编码端相对应。Referring to FIG. 22, FIG. 22 is still another method for generating a motion vector predictor according to an embodiment of the present invention, which is described from a decoding end. The method may be used in a decoding end in bidirectional prediction. The decoding end in the method may be the same as that in FIG. The encoding end corresponds.
步骤S901:解码端解析码流,根据码流中候选列表的索引值,构建Merge候选列表或者AMVP候选列表。可相应参考图6或图7实施例的相关描述,这里不再赘述。Step S901: The decoding end parses the code stream, and constructs a Merge candidate list or an AMVP candidate list according to the index value of the candidate list in the code stream. Reference may be made to the related description of the embodiment of FIG. 6 or FIG. 7 , and details are not described herein again.
在构建Merge候选列表或者AMVP候选列表后,该候选列表中包括用于前向预测的前向候选运动矢量以及用于后向预测的后向运动矢量,针对前(后)向候选运动矢量、后(前)向候选运动矢量执行后续步骤S902-S904、S905-S907,下面分别对这两个过程进行描述。After constructing the Merge candidate list or the AMVP candidate list, the candidate list includes a forward candidate motion vector for forward prediction and a backward motion vector for backward prediction, for the front (back) candidate motion vector, (Front) The subsequent steps S902-S904, S905-S907 are performed on the candidate motion vector, which are described separately below.
首先描述步骤S902-S904:First, steps S902-S904 are described:
步骤S902:解码端结合解码所得的索引值在所构建的候选列表中选取前(或后,下同)向候选运动矢量。Step S902: The decoding end selects the pre- (or following, the same below) candidate motion vector in the constructed candidate list in combination with the decoded index value.
步骤S903:解码端利用模板匹配的方式对该前(后)向候选运动矢量进行更新。Step S903: The decoding end updates the front (back) candidate motion vector by means of template matching.
步骤S904:解码端结合解码信息,基于当前块前(后)向更新后的候选列表中的前(后)向候选运动矢量得到前(后)向预测块(又可称为第一预测块)。Step S904: The decoding end combines the decoding information to obtain a front (back) prediction block (also referred to as a first prediction block) based on the front (back) candidate motion vector in the updated candidate list before (behind) the current block. .
下面描述步骤S905-S907:Steps S905-S907 are described below:
步骤S905:解码端在所构建的候选列表中,确定后(或前,下同)向候选运动矢量。Step S905: The decoding end determines the (or before, the same below) candidate motion vector in the constructed candidate list.
步骤S906:解码端利用前(后)向更新前后的候选运动矢量对后(前)向候选运动矢量进行更新。Step S906: The decoding end updates the candidate motion vector by the pre (post) to the candidate motion vector before and after the update.
具体的,解码端计算候选列表中,替换后的前(后)向候选运动矢量(即步骤S903所得的新的前(后)向候选运动矢量)与替换前的前(后)向候选运动矢量(即步骤S902中所选取的候选运动矢量)的差值;结合所述差值和在步骤S905所选择的后(前)向候选运动矢量,得到新的后(前)向候选运动矢量;然后,用所述新的后(前)向候选运动矢量替换步骤S905中所确定的后(前)向候选运动矢量,从而使得该候选列表进一步得到更新。Specifically, the decoding side calculates the candidate front (rear) candidate motion vector (ie, the new pre (post) candidate motion vector obtained in step S903) and the pre (post) candidate motion vector before replacement in the candidate list. (i.e., the candidate motion vector selected in step S902); in combination with the difference and the posterior (front) candidate motion vector selected in step S905, a new posterior (front) candidate motion vector is obtained; And replacing the post (front) candidate motion vector determined in step S905 with the new post (pre) candidate motion vector, so that the candidate list is further updated.
在可能的实施例中,解码端可计算所述候选列表中替换后的前(后)候选运动矢量与替换前的前(后)候选运动矢量的差值;计算所述差值和所述候选运动矢量集合中的后(前)向候选运动矢量的和,获得新的后(前)向候选运动矢量,将所述后(前)向候选运动矢量替换所述候选运动矢量集合中的原先的后(前)向候选运动矢量。In a possible embodiment, the decoding end may calculate a difference between the replaced pre (post) candidate motion vector in the candidate list and the pre (re) candidate motion vector before replacement; calculate the difference and the candidate a sum of the posterior (anterior) candidate motion vectors in the motion vector set, obtaining a new post (front) candidate motion vector, replacing the post (pre) candidate motion vector with the original one in the candidate motion vector set Post (front) to candidate motion vectors.
举例来说,在一应用场景中,解码得到的Merge候选列表的索引值0。解码端构建Merge列表,构建完成后,当前块在Merge模式下选取Merge候选列表索引值为0所对应的前(后)候选运动矢量用以进行双向预测中的前(后)向预测,且该前(后)向候选运动矢量为(3,5),根据选取的(3,5)得到前(后)向预测过程参考图像中的参考图像块(即参考块)。以前(后)向预测参考图像块为中心,在周边1像素区域范围内以整像素精度搜索,可得若干与参考块同等大小的新的参考图像块(即图像块)。以当前块左相邻及/或上相邻已解构块作为模 板,与前(后)向预测参考块、以及前(后)向预测图像块左相邻及/或上相邻已解构块分别进行匹配取率失真代价值最小者为更新的参考图像块,率失真代价值最小者所对应的运动矢量为(4,5)。解码端利用率失真代价值最小者的参考图像块作为当前块前(后)向预测块,以及设置当前块的前(后)向预测运动矢量为(4,5)。在候选列表中,索引值为0所对应的后(前)向候选运动矢量为(1,4),结合前(后)向替换前候选运动矢量(3,5)及替换后的预测运动矢量(4,5),得到差值(1,0),后(前)向候选运动矢量为(1,4)结合差值(1,0)得到更新的后(前)向预测参考块所对应的预测运动矢量为(2,4)。For example, in an application scenario, the index value of the obtained Merge candidate list is 0. The decoding end constructs a Merge list. After the completion of the construction, the current block selects a pre (post) candidate motion vector corresponding to the Merge candidate list index value of 0 in the Merge mode for performing the pre (post) prediction in the bidirectional prediction, and the The front (back) candidate motion vector is (3, 5), and the reference image block (ie, reference block) in the front (back) prediction process reference image is obtained according to the selected (3, 5). The previous (back) is centered on the prediction reference image block, and the entire pixel precision is searched within the range of the surrounding 1-pixel region, and a number of new reference image blocks (ie, image blocks) of the same size as the reference block are obtained. Taking the left neighboring and/or upper adjacent deconstructed block of the current block as a template, respectively, with the front (back) prediction reference block and the front (back) prediction image block left adjacent and/or the upper adjacent deconstructed block respectively The minimum value of the matching rate distortion generation value is the updated reference image block, and the motion vector corresponding to the lowest rate distortion generation value is (4, 5). The reference picture block whose decoding end utilization distortion generation value is the smallest is used as the current block front (back) direction prediction block, and the front (back) direction prediction motion vector of the current block is set to (4, 5). In the candidate list, the posterior (previous) candidate motion vector corresponding to the index value of 0 is (1, 4), and the pre-replacement candidate motion vector (3, 5) and the replaced prediction motion vector are combined. (4,5), the difference (1,0) is obtained, and the (previous) to the candidate motion vector is (1,4) combined with the difference (1,0) to obtain the updated (pre)predicted reference block corresponding to The predicted motion vector is (2, 4).
举例来说,在一应用场景中,解码得到的Merge候选列表的索引值0。解码端构建Merge列表,构建完成后,当前块在Merge模式下选取Merge候选列表索引值为0所对应的前(后)候选运动矢量用以进行双向预测中的前(后)向预测,且该前(后)向参考图像图像序列号为3,当前图像突显该序列号为4,后(前)向参考图像图像序列号为5。前(后)向候选运动矢量为(3,5),根据选取的(3,5)得到前(后)向预测过程参考图像中的参考图像块(即参考块)。以前(后)向预测参考图像块为中心,在周边1像素区域范围内以整像素精度搜索,可得若干与参考块同等大小的新的参考图像块(即图像块)。以当前块左相邻及/或上相邻已解构块作为模板,与前(后)向预测参考块、以及前(后)向预测图像块左相邻及/或上相邻已解构块分别进行匹配取率失真代价值最小者为更新的参考图像块,率失真代价值最小者所对应的运动矢量为(4,5)。解码端利用率失真代价值最小者的参考图像块作为当前块前(后)向预测块,以及设置当前块的前(后)向预测运动矢量为(4,5)。在候选列表中,索引值为0所对应的后(前)向候选运动矢量为(1,4),结合前(后)向替换前候选运动矢量(3,5)及替换后的预测运动矢量(4,5),通过比例映射计算得到差值(-1,0),后(前)向候选运动矢量为(1,4)结合差值(-1,0)得到更新的后(前)向预测参考块所对应的预测运动矢量为(0,4)。For example, in an application scenario, the index value of the obtained Merge candidate list is 0. The decoding end constructs a Merge list. After the completion of the construction, the current block selects a pre (post) candidate motion vector corresponding to the Merge candidate list index value of 0 in the Merge mode for performing the pre (post) prediction in the bidirectional prediction, and the The front (back) to reference image image serial number is 3, the current image highlights the serial number as 4, and the rear (front) reference image image serial number is 5. The front (back) candidate motion vector is (3, 5), and the reference image block (ie, reference block) in the front (back) prediction process reference image is obtained according to the selected (3, 5). The previous (back) is centered on the prediction reference image block, and the entire pixel precision is searched within the range of the surrounding 1-pixel region, and a number of new reference image blocks (ie, image blocks) of the same size as the reference block are obtained. Taking the left neighboring and/or upper adjacent deconstructed block of the current block as a template, respectively, with the front (back) prediction reference block and the front (back) prediction image block left adjacent and/or the upper adjacent deconstructed block respectively The minimum value of the matching rate distortion generation value is the updated reference image block, and the motion vector corresponding to the lowest rate distortion generation value is (4, 5). The reference picture block whose decoding end utilization distortion generation value is the smallest is used as the current block front (back) direction prediction block, and the front (back) direction prediction motion vector of the current block is set to (4, 5). In the candidate list, the posterior (previous) candidate motion vector corresponding to the index value of 0 is (1, 4), and the pre-replacement candidate motion vector (3, 5) and the replaced prediction motion vector are combined. (4,5), the difference (-1,0) is obtained by the proportional mapping calculation, and the (front) (the first) candidate motion vector is (1,4) combined with the difference (-1,0) to get the updated (front) The predicted motion vector corresponding to the prediction reference block is (0, 4).
在可能的实施例中,解码端可计算所述候选列表中替换后的前(后)候选运动矢量与替换前的前(后)候选运动矢量的差值;先将所述差值乘以预设系数,再将其结合所述候选运动矢量集合中的后(前)向候选运动矢量进行求和计算,获得新的后(前)向候选运动矢量,将所述后(前)向候选运动矢量替换所述候选运动矢量集合中的原先的后(前)向候选运动矢量。In a possible embodiment, the decoding end may calculate a difference between the replaced front (rear) candidate motion vector and the pre-replacement (post) candidate motion vector in the candidate list; first multiply the difference by a pre- Setting a coefficient, and then performing a summation calculation on the backward (front) candidate motion vector in the candidate motion vector set to obtain a new post (pre)direction candidate motion vector, and the post (pre)toward candidate motion vector The vector replaces the original back (front) candidate motion vector in the set of candidate motion vectors.
在可能的实施例中,解码端可计算所述候选列表中替换后的前(后)候选运动矢量与替换前的前(后)候选运动矢量的前(后)差值;再将所述前(后)差值映射为后(前)向差值,再将所述后(前)向差值结合所述候选运动矢量集合中的后(前)向候选运动矢量进行求和计算,获得新的后(前)向候选运动矢量,将所述后(前)向候选运动矢量替换所述候选运动矢量集合中的原先的后(前)向候选运动矢量。例如,例如,可计算所述候选列表中替换后的前(后)候选运动矢量与替换前的前(后)候选运动矢量的前(后)向差值为(2,4),当前块对应于图像帧序列中的时序图像序列号为4,前向预测的参考块对应于图像帧序列中的图像序列号时序为2,后向预测的参考块对应于图像帧序列中的图像序列号时序为5,那么,当前块与后向预测的参考块的时序差(可简称为第二时序差)为1(即-5=-1),当前块与前向预测的参考块的时序差(可简称为第一时序差)为-2(即-2=2),所以,可以根据第一时序差与第二时序差之间的比例关系(2/-1=-2),将前(后)向差值(2, 4)映射成为用于后(前)向差值(-1,0),然后使用后(前)向差值(-1,-2)和后(前)向候选运动矢量进行求和计算,获得新的后(前)向候选运动矢量,将所述后(前)向候选运动矢量替换所述候选运动矢量集合中的原先的后(前)向候选运动矢量。In a possible embodiment, the decoding end may calculate a front (rear) difference between the replaced front (rear) candidate motion vector and the pre-replacement (post) candidate motion vector in the candidate list; The (post) difference value is mapped to the back (front) direction difference value, and the back (front) direction difference value is combined with the post (front) candidate motion vector in the candidate motion vector set to perform a summation calculation to obtain a new The post (pre)to-candidate motion vector replaces the post-(pre) candidate motion vector with the original post (pre-) candidate motion vector in the candidate motion vector set. For example, for example, the front (rear) candidate motion vector in the candidate list and the front (rear) candidate motion vector before the replacement may be calculated as (2, 4), and the current block corresponds to the current block. The sequence image sequence number in the image frame sequence is 4, the forward prediction reference block corresponds to the image sequence number sequence in the image frame sequence is 2, and the backward predicted reference block corresponds to the image sequence number sequence in the image frame sequence. 5, then, the timing difference between the current block and the backward predicted reference block (which may be simply referred to as the second timing difference) is 1 (ie, -5=-1), and the timing difference between the current block and the forward predicted reference block ( It can be abbreviated as the first timing difference) to be -2 (that is, -2=2). Therefore, according to the proportional relationship between the first timing difference and the second timing difference (2/-1=-2), the front ( After) the difference (2, 4) is mapped to the back (front) difference (-1, 0), and then the post (front) difference (-1, -2) and the back (front) are used. The candidate motion vector performs a summation calculation to obtain a new post (pre)direction candidate motion vector, and replaces the post (pre)toward candidate motion vector with the original post (previous) candidate motion in the candidate motion vector set the amount.
在可能的实施例中,解码端可计算所述候选列表中替换后的前(后)候选运动矢量与替换前的前(后)候选运动矢量的前(后)差值;再将所述前(后)差值映射为后(前)向差值,之后再乘以预设系数,再结合所述候选运动矢量集合中的后(前)向候选运动矢量进行求和计算,获得新的后(前)向候选运动矢量,将所述后(前)向候选运动矢量替换所述候选运动矢量集合中的原先的后(前)向候选运动矢量。其中,在可能实现方式中,如果将所述前(后)差值映射为后(前)向差值的过程中,所得的第一时序差与第二时序差之间的比例关系大于0,则定义预设系数为1,或者为其他预设正值;如果该比例关系小于0,则定义预设系数为-1,或者为其他预设负值。In a possible embodiment, the decoding end may calculate a front (rear) difference between the replaced front (rear) candidate motion vector and the pre-replacement (post) candidate motion vector in the candidate list; The (post) difference value is mapped to the back (front) difference value, and then multiplied by the preset coefficient, and then combined with the posterior (front) candidate motion vector in the candidate motion vector set to obtain a new sum. (front) to the candidate motion vector, replacing the latter (front) candidate motion vector with the original back (front) candidate motion vector in the candidate motion vector set. Wherein, in a possible implementation manner, if the front (back) difference value is mapped to the backward (front) difference value, the proportional relationship between the obtained first time difference and the second time difference is greater than 0, Then define a preset coefficient of 1, or other preset positive values; if the proportional relationship is less than 0, define a preset coefficient of -1, or other preset negative values.
步骤S907:解码端结合解码信息,基于当前块后(前)向更新后的候选列表中的后(前)向候选运动矢量得到后(前)向预测块(又可称为第二预测块)。Step S907: The decoding end combines the decoding information, and obtains a post (previous) prediction block (also referred to as a second prediction block) based on the post (pre)direction candidate motion vector in the updated candidate list after the current block (front). .
步骤S908:解码端得到前(后)向的第一预测块和后(前)向的第二预测块后,基于预设算法对所述第一预测块和所述第二预测块进行处理,从而得到当前块的重构块。Step S908: After the decoding end obtains the first (back) direction first prediction block and the back (front) direction second prediction block, the first prediction block and the second prediction block are processed according to a preset algorithm, Thereby the reconstructed block of the current block is obtained.
还需要说明的是,解码端中没有详细描述的相关步骤可参考编码端中相关步骤的描述,还可参考前文的相关描述。为了说明书的简洁,这里不一一展开描述。It should be noted that the relevant steps that are not described in detail in the decoding end may refer to the description of related steps in the encoding end, and may also refer to the related description in the foregoing. For the sake of brevity of the description, the description will not be repeated here.
参见图23,图23是本发明实施例提供的又一种预测运动矢量生成方法,从编码端的角度进行描述,该方法可用双向预测中的编码端,该方法实施例与图21实施例的区别在于,所述方法中的前向预测和后向预测分别采用不同的预测模式(即混合编码模式),当前(或后)向采用Merge模式时,后(或前)向相应采取AMVP模式。具体描述如下:Referring to FIG. 23, FIG. 23 is still another method for generating a motion vector predictor according to an embodiment of the present invention, which is described from the perspective of an encoding end. The method can be used in the encoding end in bidirectional prediction, and the difference between the method embodiment and the embodiment in FIG. In the method, the forward prediction and the backward prediction respectively adopt different prediction modes (ie, hybrid coding mode), and when the current (or later) direction adopts the Merge mode, the AMVP mode is adopted correspondingly (or before). The specific description is as follows:
首先描述步骤S1001-S1004:First, steps S1001-S1004 are described:
步骤S1001:编码端的前(或后,下同)预测采用Merge模式,基于Merge模式构建Merge候选列表。Step S1001: The pre- (or the following, the same below) prediction of the encoding end adopts the Merge mode, and the Merge candidate list is constructed based on the Merge mode.
步骤S1002:编码端在所构建的Merge候选列表中,选取前(后)向候选运动矢量。Step S1002: The encoding end selects the front (back) candidate motion vector in the constructed Merge candidate list.
步骤S1003:编码端利用模板匹配的方式对该前(后)向候选运动矢量进行更新。Step S1003: The encoding end updates the front (back) candidate motion vector by means of template matching.
步骤S1004:编码端基于当前块前(后)向更新后的Merge候选列表中的前(后)向候选运动矢量得到前(后)向预测块(又可称为第一预测块),并编码第一预测块对应的候选列表索引。Step S1004: The encoding end obtains a pre (post) prediction block (also referred to as a first prediction block) and encodes the pre (post) candidate motion vector in the updated Merge candidate list based on the current block (behind). A candidate list index corresponding to the first prediction block.
下面描述步骤S1005-S1007:Steps S1005-S1007 are described below:
步骤S1005:编码端的后(或前,下同)预测采用AMVP模式,基于AMVP模式构建AMVP候选列表。Step S1005: The post- (or before, the same below) prediction of the encoding end adopts the AMVP mode, and the AMVP candidate list is constructed based on the AMVP mode.
步骤S1006:编码端在所构建的AMVP候选列表中,选取后(或前,下同)向候选运动矢量。Step S1006: The encoding end selects the (or before, the same below) candidate motion vector in the constructed AMVP candidate list.
步骤S1007:编码端利用前(后)向更新前后的候选运动矢量对后(前)向候选运动矢量进行更新。Step S1007: The encoding end updates the candidate motion vector by the preceding (backward) candidate motion vector pair before and after the update.
具体的,编码端计算Merge候选列表中,替换后的前(后)向候选运动矢量(即步骤 S1003所得的新的前(后)向候选运动矢量)与替换前的前(后)向候选运动矢量(即步骤S1002中所选取的候选运动矢量)的差值;结合所述差值和在步骤S1006所选择的后(前)向候选运动矢量,得到新的后(前)向候选运动矢量;然后,用所述新的后(前)向候选运动矢量替换AMVP候选列表中步骤S1006中所选择的后(前)向候选运动矢量,从而使得该AMVP候选列表进一步得到更新。Specifically, the encoding end calculates the replaced front (back) candidate motion vector (ie, the new pre (post) candidate motion vector obtained in step S1003) and the pre (post) candidate motion before replacement in the Merge candidate list. a difference between the vector (ie, the candidate motion vector selected in step S1002); in combination with the difference and the posterior (front) candidate motion vector selected in step S1006, a new posterior (front) candidate motion vector is obtained; Then, the post (previous) candidate motion vector selected in step S1006 in the AMVP candidate list is replaced with the new post (pre) candidate motion vector, so that the AMVP candidate list is further updated.
步骤S1008:编码端基于当前块后(前)向更新后的AMVP候选列表中的后(前)向候选运动矢量得到后(前)向预测块(又可称为第二预测块),并编码第二预测块对应的候选列表索引、编码第二预测块对应的参考图像的索引以及MVD信息。Step S1008: The encoding end obtains a post (previous) prediction block (also referred to as a second prediction block) from the post (pre)direction candidate motion vector in the updated AMVP candidate list based on the current block (front), and encodes a candidate list index corresponding to the second prediction block, an index of the reference image corresponding to the second prediction block, and MVD information.
步骤S1009:编码端在得到前(后)向的第一预测块和后(前)向的第二预测块后,基于预设算法对所述第一预测块和所述第二预测块进行处理,从而得到当前块的重构块,进而向解码端发送码流。可以理解的,码流中包括Merge候选列表的索引值、AMVP候选列表的索引值、参考图像的索引值以及MVD信息。Step S1009: After obtaining the first (back) direction first prediction block and the second (front) direction second prediction block, the encoding end processes the first prediction block and the second prediction block according to a preset algorithm. , thereby obtaining a reconstructed block of the current block, and then transmitting the code stream to the decoding end. It can be understood that the code stream includes an index value of the Merge candidate list, an index value of the AMVP candidate list, an index value of the reference image, and MVD information.
还需要说明的是,编码端中没有详细描述的相关步骤还可参考前文的相关描述。为了说明书的简洁,这里不一一展开描述。It should also be noted that related steps not detailed in the encoding end may also refer to the related descriptions above. For the sake of brevity of the description, the description will not be repeated here.
参见图24,图24是本发明实施例提供的又一种预测运动矢量生成方法,从解码端进行描述,该方法可用于双向预测中的解码端,该方法中的解码端可与图23中的编码端相对应。Referring to FIG. 24, FIG. 24 is still another method for generating a motion vector predictor according to an embodiment of the present invention, which is described from a decoding end. The method may be used in a decoding end in bidirectional prediction, and the decoding end in the method may be the same as that in FIG. The encoding end corresponds.
首先描述步骤S1101-S1104:First, steps S1101-S1104 are described:
步骤S1101:解码端解析码流,根据码流中Merge候选列表的索引值,确定前(或后,下同)向预测采用Merge模式,基于Merge模式构建Merge候选列表。Step S1101: The decoding end parses the code stream, determines, according to the index value of the Merge candidate list in the code stream, that the pre- (or the following, the same below) prediction adopts the Merge mode, and constructs the Merge candidate list based on the Merge mode.
步骤S1102:解码端结合解码所得的索引值在所构建的Merge候选列表中选取前(或后,下同)向候选运动矢量。Step S1102: The decoding end selects the pre- (or following, the same below) candidate motion vector in the constructed Merge candidate list in combination with the decoded index value.
步骤S1103:解码端利用模板匹配的方式对该前(后)向候选运动矢量进行更新。Step S1103: The decoding end updates the front (back) candidate motion vector by means of template matching.
步骤S1104:解码端结合解码信息,基于当前块前(后)向更新后的候选列表中的前(后)向候选运动矢量得到前(后)向预测块(又可称为第一预测块)。Step S1104: The decoding end combines the decoding information, and obtains a pre (post) prediction block (also referred to as a first prediction block) based on the front (rear) candidate motion vector in the updated candidate list before (behind) the current block. .
下面描述步骤S1005-S1007:Steps S1005-S1007 are described below:
步骤S1105:解码端解析码流,根据码流中AMVP候选列表的索引值,确定后(或前,下同)向预测采用AMVP模式,基于AMVP模式构建AMVP候选列表。Step S1105: The decoding end parses the code stream, and according to the index value of the AMVP candidate list in the code stream, determines that the AMVP mode is adopted for the prediction (or before, the same, the same below), and the AMVP candidate list is constructed based on the AMVP mode.
步骤S1106:解码端结合解码所得的索引值在所构建的AMVP候选列表中选取后(前)向候选运动矢量。Step S1106: The decoding end selects the (previous) candidate motion vector in the constructed AMVP candidate list in combination with the decoded index value.
步骤S1107:解码端利用前(后)向更新前后的候选运动矢量对后(前)向候选运动矢量进行更新。Step S1107: The decoding end updates the candidate motion vector by the preceding (backward) candidate motion vector pair before and after the update.
具体的,解码端计算Merge候选列表中,替换后的前(后)向候选运动矢量(即步骤S1103所得的新的前(后)向候选运动矢量)与替换前的前(后)向候选运动矢量(即步骤S1102中所选取的候选运动矢量)的差值;结合所述差值和在步骤S1106所选择的后(前)向候选运动矢量,得到新的后(前)向候选运动矢量;然后,用所述新的后(前)向候选运动矢量替换步骤S1106中所确定的后(前)向候选运动矢量,从而使得该候选列表进一 步得到更新。Specifically, the decoding end calculates the replaced front (back) candidate motion vector (ie, the new pre (post) candidate motion vector obtained in step S1103) and the pre (post) candidate motion before replacement in the Merge candidate list. a difference between the vector (ie, the candidate motion vector selected in step S1102); in combination with the difference and the posterior (front) candidate motion vector selected in step S1106, a new posterior (front) candidate motion vector is obtained; Then, the new (front) candidate motion vector determined in step S1106 is replaced with the new post (pre) candidate motion vector, so that the candidate list is further updated.
步骤S1108:解码端结合解码信息,基于当前块后(前)向更新后的AMVP候选列表中的后(前)向候选运动矢量得到后(前)向预测块(又可称为第二预测块)。Step S1108: The decoding end combines the decoding information, and obtains a post (pre)predicted block (also referred to as a second prediction block) based on the post (pre)direction candidate motion vector in the updated AMVP candidate list after the current block (front). ).
步骤S1109:解码端得到前(后)向的第一预测块和后(前)向的第二预测块后,基于预设算法对所述第一预测块和所述第二预测块进行处理,从而得到当前块的重构块。Step S1109: After the decoding end obtains the first (back) direction first prediction block and the back (front) direction second prediction block, the first prediction block and the second prediction block are processed according to a preset algorithm, Thereby the reconstructed block of the current block is obtained.
还需要说明的是,解码端中没有详细描述的相关步骤可参考编码端中相关步骤的描述,还可参考前文的相关描述。为了说明书的简洁,这里不一一展开描述。It should be noted that the relevant steps that are not described in detail in the decoding end may refer to the description of related steps in the encoding end, and may also refer to the related description in the foregoing. For the sake of brevity of the description, the description will not be repeated here.
可以看出,本发明实施例中,视频编解码系统可利用模板匹配的方式,验证当前块的参考图像中一定范围内(甚至整个参考图像内)的图像块是否与当前块有较好的匹配,对基于Merge或AMVP模式所构建的候选列表的候选运动矢量进行更新,基于更新后的候选列表能够保证编解码过程中获得当前块的最佳参考块。另外,本发明实施例还提供了混合预测模式,基于所述混合预测模式也可以能够保证编解码过程中获得当前块的最佳参考块,在确保获得当前块的最佳参考块的情况下提高编解码的效率。It can be seen that, in the embodiment of the present invention, the video codec system can verify whether the image block in a certain range (or even the entire reference image) in the reference image of the current block has a good match with the current block by using template matching. The candidate motion vector of the candidate list constructed based on the Merge or AMVP mode is updated, and the updated candidate list can be used to ensure that the best reference block of the current block is obtained during the encoding and decoding process. In addition, the embodiment of the present invention further provides a hybrid prediction mode, and based on the hybrid prediction mode, it may also be able to obtain an optimal reference block of the current block in the coding and decoding process, and improve in the case of ensuring that the best reference block of the current block is obtained. The efficiency of codec.
上文描述了本发明实施例的编解码系统以及相关方法,下面进一步描述本发明实施例所涉及的相关设备。The codec system and related methods of the embodiments of the present invention are described above, and related devices related to the embodiments of the present invention are further described below.
参见图25,本发明实施例提供了一种用于生成预测运动矢量的设备1200,设备1200可以是应用于编码侧,也可以是应用于解码侧。设备1200包括处理器1201、存储器1202,所述处理器1201、存储器1202相连接(如通过总线1204相互连接),在可能的实施方式中,设备1200还可包括收发器1203,收发器1203连接处理器1201和存储器1202,用于接收/发送数据。Referring to FIG. 25, an embodiment of the present invention provides an apparatus 1200 for generating a predicted motion vector, where the apparatus 1200 may be applied to an encoding side or may be applied to a decoding side. The device 1200 includes a processor 1201 and a memory 1202. The processor 1201 and the memory 1202 are connected to each other (e.g., connected to each other through a bus 1204). In a possible implementation, the device 1200 may further include a transceiver 1203, and the transceiver 1203 is connected to the processing. The device 1201 and the memory 1202 are configured to receive/transmit data.
存储器1202包括但不限于是随机存储记忆体(random access memory,RAM)、只读存储器(read-only memory,ROM)、可擦除可编程只读存储器(erasable programmable read only memory,EPROM)、或便携式只读存储器(compact disc read-only memory,CD-ROM),该存储器1202用于存储相关程序代码及视频数据。The memory 1202 includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read only memory (EPROM), or A compact disc read-only memory (CD-ROM) for storing related program codes and video data.
处理器1201可以是一个或多个中央处理器(central processing unit,CPU),在处理器1201是一个CPU的情况下,该CPU可以是单核CPU,也可以是多核CPU。The processor 1201 may be one or more central processing units (CPUs). In the case where the processor 1201 is a CPU, the CPU may be a single-core CPU or a multi-core CPU.
该处理器1201用于读取所存储器1202中存储的程序代码,执行以下操作:The processor 1201 is configured to read the program code stored in the memory 1202 and perform the following operations:
基于预测模式构建待处理块的候选运动矢量集合;所述预测模式为Merge模式或AMVP模式;Constructing a candidate motion vector set of the to-be-processed block based on the prediction mode; the prediction mode is a Merge mode or an AMVP mode;
根据所述候选运动矢量集合中的第一候选运动矢量,确定至少两个第一参考运动矢量,所述第一参考运动矢量用来确定所述待处理块在所述待处理块的第一参考图像中的参考块;Determining, according to the first candidate motion vector in the set of candidate motion vectors, at least two first reference motion vectors, the first reference motion vector being used to determine a first reference of the to-be-processed block in the to-be-processed block a reference block in the image;
分别计算至少两个所述确定的参考块的至少一个第一邻近已重构块和所述待处理块的至少一个第二邻近已重构块之间的像素差异值或者率失真rate-distortion代价值,其中,所述至少一个第一邻近已重构块和所述至少一个第二邻近已重构块的形状相同且尺寸相等;Calculating a pixel difference value or rate distortion rate-distortion generation between at least one first adjacent reconstructed block of at least two of the determined reference blocks and at least one second adjacent reconstructed block of the to-be-processed block, respectively Value, wherein the at least one first adjacent reconstructed block and the at least one second adjacent reconstructed block are identical in shape and of equal size;
根据所述至少两个第一参考运动矢量中对应的所述像素差异值或者率失真代价值最小 的一个第一参考运动矢量,获得所述待处理块的第一预测运动矢量。Obtaining a first predicted motion vector of the to-be-processed block according to a corresponding one of the at least two first reference motion vectors or a first reference motion vector having a lowest rate-distortion value.
需要说明的是,在具体的实施例中,处理器1201可用于执行上述图10-图24实施例描述的相关方法,为了说明书的简洁,这里将不再赘述。It should be noted that, in a specific embodiment, the processor 1201 may be used to perform the related methods described in the foregoing embodiments of FIG. 10 to FIG. 24, and details are not described herein for brevity of the description.
参见图26,本发明实施例提供了又一种用于生成预测运动矢量的设备1300,设备1300可以是应用于编码侧,也可以是应用于解码侧。设备1300包括处理器1301、存储器1302,所述处理器1301、存储器1302相连接(如通过总线1304相互连接),在可能的实施方式中,设备1300还可包括收发器1303,收发器1303连接处理器1301和存储器1302,用于接收/发送数据。Referring to FIG. 26, an embodiment of the present invention provides another apparatus 1300 for generating a predicted motion vector. The apparatus 1300 may be applied to an encoding side or may be applied to a decoding side. The device 1300 includes a processor 1301 and a memory 1302. The processor 1301 and the memory 1302 are connected to each other (e.g., connected to each other through a bus 1304). In a possible implementation, the device 1300 may further include a transceiver 1303, and the transceiver 1303 is connected to the processing. The device 1301 and the memory 1302 are configured to receive/send data.
存储器1302包括但不限于是随机存储记忆体(random access memory,RAM)、只读存储器(read-only memory,ROM)、可擦除可编程只读存储器(erasable programmable read only memory,EPROM)、或便携式只读存储器(compact disc read-only memory,CD-ROM),该存储器1302用于存储相关程序代码及视频数据。The memory 1302 includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read only memory (EPROM), or A compact disc read-only memory (CD-ROM) for storing related program codes and video data.
处理器1301可以是一个或多个中央处理器(central processing unit,CPU),在处理器1301是一个CPU的情况下,该CPU可以是单核CPU,也可以是多核CPU。The processor 1301 may be one or more central processing units (CPUs). In the case where the processor 1301 is a CPU, the CPU may be a single core CPU or a multi-core CPU.
该处理器1301用于读取所存储器1302中存储的程序代码,以进行待处理块的双向预测,所述双向预测包括第一方向预测和第二方向预测,所述第一方向预测是基于第一参考帧列表的预测,所述第二方向预测是基于第二参考帧列表的预测。处理器1301具体执行以下操作:The processor 1301 is configured to read program code stored in the stored memory 1302 to perform bidirectional prediction of a block to be processed, where the bidirectional prediction includes a first direction prediction and a second direction prediction, where the first direction prediction is based on A prediction of a reference frame list, the second direction prediction being based on a prediction of a second reference frame list. The processor 1301 specifically performs the following operations:
获取第一预测模式,生成第一候选运动矢量集合,所述第一候选运动矢量集合用于在所述第一方向预测中生成第一方向预测运动矢量;Obtaining a first prediction mode, generating a first candidate motion vector set, where the first candidate motion vector set is used to generate a first direction prediction motion vector in the first direction prediction;
获取第二预测模式,生成第二候选运动矢量集合,所述第二候选运动矢量集合用于在所述第二方向预测中生成第二方向预测运动矢量,Obtaining a second prediction mode, generating a second candidate motion vector set, where the second candidate motion vector set is used to generate a second direction prediction motion vector in the second direction prediction,
其中,当所述第一预测模式为AMVP模式时,所述第二预测模式为Merge模式,或者,当所述第一预测模式为Merge模式时,所述第二预测模式为AMVP模式。When the first prediction mode is the AMVP mode, the second prediction mode is the Merge mode, or when the first prediction mode is the Merge mode, the second prediction mode is the AMVP mode.
需要说明的是,在具体的实施例中,处理器1301可用于执行上述图10-图24实施例描述的相关方法,为了说明书的简洁,这里将不再赘述。It should be noted that, in a specific embodiment, the processor 1301 may be used to perform the related methods described in the foregoing embodiments of FIG. 10 to FIG. 24, and for brevity of the description, details are not described herein again.
基于同样的发明构思,本发明实施例提供了又一种用于生成预测运动矢量的设备1400,参见图27,设备1400包括:Based on the same inventive concept, the embodiment of the present invention provides another apparatus 1400 for generating a predicted motion vector. Referring to FIG. 27, the apparatus 1400 includes:
集合生成模块1401,用于构建待处理块的候选运动矢量集合;a set generation module 1401, configured to construct a candidate motion vector set of the to-be-processed block;
模板匹配模块1402,用于根据所述候选运动矢量集合中的第一候选运动矢量,确定至少两个第一参考运动矢量,所述第一参考运动矢量用来确定所述待处理块在所述待处理块的第一参考图像中的参考块;The template matching module 1402 is configured to determine, according to the first candidate motion vector in the candidate motion vector set, at least two first reference motion vectors, where the first reference motion vector is used to determine that the to-be-processed block is in the a reference block in the first reference image of the block to be processed;
所述模板匹配模块1402还用于,分别计算至少两个所述确定的参考块的至少一个第一邻近已重构块和所述待处理块的至少一个第二邻近已重构块之间的像素差异值或者率失真rate-distortion代价值,其中,所述至少一个第一邻近已重构块和所述至少一个第二邻近已重构块的形状相同且尺寸相等;The template matching module 1402 is further configured to respectively calculate between at least one first adjacent reconstructed block of the at least two determined reference blocks and at least one second adjacent reconstructed block of the to-be-processed block a pixel difference value or rate distortion rate-distortion value, wherein the at least one first neighbor reconstructed block and the at least one second neighbor reconstructed block have the same shape and are equal in size;
预测运动矢量生成模块1403,用于根据所述至少两个第一参考运动矢量中对应的所述 像素差异值或者率失真代价值最小的一个第一参考运动矢量,获得所述待处理块的第一预测运动矢量。a prediction motion vector generation module 1403, configured to obtain, according to the corresponding one of the at least two first reference motion vectors, or the first reference motion vector with the lowest rate distortion value, A predictive motion vector.
需要说明的是,通过前述图10-图24实施例的相关描述,本领域技术人员可以知道设备1400所包含的各个模块的实现方法,所以为了说明书的简洁,这里将不再赘述。It should be noted that, through the related descriptions of the foregoing embodiments of FIG. 10 to FIG. 24, those skilled in the art may know the implementation methods of the modules included in the device 1400, and therefore, for brevity of the description, details are not described herein again.
基于同样的发明构思,本发明实施例提供了又一种用于生成预测运动矢量的设备1500,参见图28,设备1500用于进行待处理块的双向预测,所述双向预测包括第一方向预测和第二方向预测,所述第一方向预测是基于第一参考帧列表的预测,所述第二方向预测是基于第二参考帧列表的预测,所述设备1500具体包括:Based on the same inventive concept, the embodiment of the present invention provides another apparatus 1500 for generating a predicted motion vector. Referring to FIG. 28, the apparatus 1500 is configured to perform bidirectional prediction of a to-be-processed block, where the bidirectional prediction includes a first direction prediction. And the second direction prediction, the first direction prediction is based on the prediction of the first reference frame list, and the second direction prediction is based on the prediction of the second reference frame list, where the device 1500 specifically includes:
第一集合生成模块1501,用于获取第一预测模式,生成第一候选运动矢量集合,所述第一候选运动矢量集合用于在所述第一方向预测中生成第一方向预测运动矢量;a first set generation module 1501, configured to acquire a first prediction mode, and generate a first candidate motion vector set, where the first candidate motion vector set is used to generate a first direction prediction motion vector in the first direction prediction;
第二集合生成模块1502,用于获取第二预测模式,生成第二候选运动矢量集合,所述第二候选运动矢量集合用于在所述第二方向预测中生成第二方向预测运动矢量,a second set generation module 1502, configured to acquire a second prediction mode, and generate a second candidate motion vector set, where the second candidate motion vector set is used to generate a second direction prediction motion vector in the second direction prediction,
其中,当所述第一预测模式为AMVP模式时,所述第二预测模式为Merge模式,或者,当所述第一预测模式为Merge模式时,所述第二预测模式为AMVP模式。When the first prediction mode is the AMVP mode, the second prediction mode is the Merge mode, or when the first prediction mode is the Merge mode, the second prediction mode is the AMVP mode.
需要说明的是,通过前述图10-图24实施例的相关描述,本领域技术人员可以知道设备1500所包含的各个模块的实现方法,所以为了说明书的简洁,这里将不再赘述。It should be noted that, through the related descriptions of the foregoing embodiments of FIG. 10 to FIG. 24, those skilled in the art may know the implementation methods of the modules included in the device 1500, and therefore, for brevity of the description, details are not described herein again.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods to implement the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。A person skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the system, the device and the unit described above can refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者任意组合来实现。当使用软件实现时,可以全部或者部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令,在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络或其他可编程装置。所述计算机指令可存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网络站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、微波等)方式向另一个网络站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质,也可以是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如软盘、硬盘、磁带等)、光介质(例如DVD等)、或者半导体介质(例如固态硬盘)等等。In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination. When implemented in software, it may be implemented in whole or in part in the form of a computer program product. The computer program product comprises one or more computer instructions which, when loaded and executed on a computer, produce, in whole or in part, a process or function according to an embodiment of the invention. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be from a network site, computer, server or data center Transmission to another network site, computer, server, or data center via wired (eg, coaxial cable, fiber optic, digital subscriber line) or wireless (eg, infrared, microwave, etc.). The computer readable storage medium can be any available media that can be accessed by a computer, or can be a data storage device such as a server, data center, or the like that includes one or more available media. The usable medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape, etc.), an optical medium (such as a DVD, etc.), or a semiconductor medium (such as a solid state hard disk) or the like.
在上述实施例中,对各个实施例的描述各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above embodiments, the descriptions of the various embodiments are focused on, and the parts that are not detailed in a certain embodiment may be referred to the related descriptions of other embodiments.

Claims (48)

  1. 一种预测运动矢量的生成方法,其特征在于,包括:A method for generating a motion vector predicting, comprising:
    构建待处理块的候选运动矢量集合;Constructing a candidate motion vector set of the block to be processed;
    根据所述候选运动矢量集合中的第一候选运动矢量,确定至少两个第一参考运动矢量,所述第一参考运动矢量用来确定所述待处理块在所述待处理块的第一参考图像中的参考块;Determining, according to the first candidate motion vector in the set of candidate motion vectors, at least two first reference motion vectors, the first reference motion vector being used to determine a first reference of the to-be-processed block in the to-be-processed block a reference block in the image;
    分别计算至少两个所述确定的参考块的一个或多个第一邻近已重构块和所述待处理块的一个或多个第二邻近已重构块之间的像素差异值或者率失真rate-distortion代价值,其中,所述第一邻近已重构块和所述第二邻近已重构块的形状相同且尺寸相等;Calculating pixel difference values or rate distortions between one or more first neighbor reconstructed blocks of the at least two of the determined reference blocks and one or more second neighbor reconstructed blocks of the block to be processed, respectively Rate-distortion generation value, wherein the first adjacent reconstructed block and the second adjacent reconstructed block have the same shape and are equal in size;
    根据所述至少两个第一参考运动矢量中对应的所述像素差异值或者率失真代价值最小的一个第一参考运动矢量,获得所述待处理块的第一预测运动矢量。Obtaining a first predicted motion vector of the to-be-processed block according to a corresponding one of the at least two first reference motion vectors or a first reference motion vector having a lowest rate-distortion value.
  2. 根据权利要求1所述的方法,其特征在于,所述方法用于编码所述待处理块,所述根据所述至少两个第一参考运动矢量中对应的所述像素差异值或者率失真代价值最小的一个第一参考运动矢量,获得所述待处理块的预测运动矢量,包括:The method according to claim 1, wherein the method is configured to encode the to-be-processed block, and the pixel difference value or rate distortion generation corresponding to the at least two first reference motion vectors The first reference motion vector having the smallest value, obtaining the predicted motion vector of the to-be-processed block, includes:
    用所述对应的所述像素差异值或者率失真代价值最小的一个第一参考运动矢量替换所述候选运动矢量集合中的所述第一候选运动矢量,得到更新后的候选运动矢量集合;Replacing the first candidate motion vector in the candidate motion vector set with the corresponding one of the pixel difference value or the first reference motion vector having the smallest rate distortion value, to obtain an updated candidate motion vector set;
    从所述更新后的候选运动矢量集合中,获得所述待处理块的第一预测运动矢量。Obtaining, from the updated candidate motion vector set, a first predicted motion vector of the to-be-processed block.
  3. 根据权利要求2所述的方法,其特征在于,所述从所述更新后的候选运动矢量集合中,获得所述待处理块的预测运动矢量,包括:The method according to claim 2, wherein the obtaining the predicted motion vector of the to-be-processed block from the updated candidate motion vector set comprises:
    从所述更新后的候选运动矢量集合中,根据率失真代价值,选择出所述待处理块的第一预测运动矢量。From the updated candidate motion vector set, a first predicted motion vector of the to-be-processed block is selected according to a rate distortion cost value.
  4. 根据权利要求1所述的方法,其特征在于,所述方法用于解码所述待处理块;所述根据所述至少两个第一参考运动矢量中对应的所述像素差异值或者率失真代价值最小的一个第一参考运动矢量,获得所述待处理块的第一预测运动矢量,包括:The method according to claim 1, wherein the method is configured to decode the to-be-processed block; and the pixel difference value or rate distortion generation corresponding to the at least two first reference motion vectors A first reference motion vector having the smallest value, obtaining the first predicted motion vector of the to-be-processed block, comprising:
    将所述对应的所述像素差异值或者率失真代价值最小的一个第一参考运动矢量作为所述待处理块的第一预测运动矢量。A first reference motion vector that minimizes the corresponding pixel difference value or rate distortion value is used as the first predicted motion vector of the to-be-processed block.
  5. 根据权利要求4所述的方法,其特征在于,在所述构建待处理块的候选运动矢量集合之前,所述方法还包括:The method according to claim 4, wherein before the constructing the set of candidate motion vectors of the block to be processed, the method further comprises:
    解析码流获得标识信息,所述标识信息用于指示所述候选运动矢量集合为Merge模式所采用的候选运动矢量集合或者AMVP模式所采用的候选运动矢量集合;The analytic code stream obtains identification information, where the identifier information is used to indicate that the candidate motion vector set is a candidate motion vector set adopted by the Merge mode or a candidate motion vector set adopted by the AMVP mode;
    对应的,所述构建待处理块的候选运动矢量集合,包括:Correspondingly, the candidate motion vector set for constructing the to-be-processed block includes:
    当所述标识信息指示所述候选运动矢量集合为Merge模式所采用的候选运动矢量集合时,构建所述待处理块在Merge模式下所采用的候选运动矢量集合;And when the identifier information indicates that the candidate motion vector set is a candidate motion vector set adopted by the Merge mode, constructing a candidate motion vector set adopted by the to-be-processed block in the Merge mode;
    当所述标识信息指示所述候选运动矢量集合为AMVP模式所采用的候选运动矢量集合时,构建所述待处理块在AMVP模式下所采用的候选运动矢量集合。And when the identifier information indicates that the candidate motion vector set is a candidate motion vector set adopted by the AMVP mode, constructing a candidate motion vector set adopted by the to-be-processed block in the AMVP mode.
  6. 根据权利要求4所述的方法,其特征在于,所述方法用于解码所述待处理块,还包括:The method according to claim 4, wherein the method is used to decode the to-be-processed block, further comprising:
    解析所述码流获得索引信息,根据所述索引信息确定所述第一候选运动矢量。Parsing the code stream to obtain index information, and determining the first candidate motion vector according to the index information.
  7. 根据权利要求1-6任一项所述的方法,其特征在于,所述候选运动矢量集合用于对所述待处理块进行双向预测,所述双向预测包括第一方向预测和第二方向预测,所述第一方向预测是基于第一参考帧列表的预测,所述第二方向预测是基于第二参考帧列表的预测。The method according to any one of claims 1 to 6, wherein the candidate motion vector set is used for bidirectional prediction of the to-be-processed block, the bidirectional prediction including first direction prediction and second direction prediction The first direction prediction is based on a prediction of a first reference frame list, and the second direction prediction is based on a prediction of a second reference frame list.
  8. 根据权利要求7所述的方法,其特征在于,所述第一参考帧列表包括所述第一参考图像,所述第二参考帧列表包括第二参考图像;所述方法还包括:The method according to claim 7, wherein the first reference frame list comprises the first reference image, and the second reference frame list comprises a second reference image; the method further comprises:
    计算所述对应的所述像素差异值或者率失真代价值最小的一个第一参考运动矢量与所述第一候选运动矢量的差值;Calculating a difference between the first reference motion vector having the smallest pixel difference value or the rate distortion value and the first candidate motion vector;
    根据所述差值和所述候选运动矢量集合中的第二候选运动矢量,获得第三候选运动矢量,所述第二候选运动矢量用来确定所述待处理块在所述第二参考图像中的参考块。Obtaining, according to the difference value and the second candidate motion vector in the candidate motion vector set, a third candidate motion vector, where the second candidate motion vector is used to determine that the to-be-processed block is in the second reference image Reference block.
  9. 根据权利要求8所述的方法,其特征在于,所述方法用于编码所述待处理块;在所述获得第三候选运动矢量之后,所述方法还包括:The method according to claim 8, wherein the method is used to encode the to-be-processed block; after the obtaining the third candidate motion vector, the method further comprises:
    用所述第三候选运动矢量替换所述候选运动矢量集合中的所述第二候选运动矢量。Replacing the second candidate motion vector in the candidate motion vector set with the third candidate motion vector.
  10. 根据权利要求8所述的方法,其特征在于,所述方法用于解码所述待处理块;在所述获得第三候选运动矢量之后,所述方法还包括:The method according to claim 8, wherein the method is used to decode the to-be-processed block; after the obtaining the third candidate motion vector, the method further comprises:
    将所述第三候选运动矢量作为所述待处理块的第二预测运动矢量。The third candidate motion vector is used as a second predicted motion vector of the to-be-processed block.
  11. 根据权利要求7所述的方法,其特征在于,所述第一参考帧列表包括所述第一参考图像,所述第二参考帧列表包括第二参考图像;所述方法还包括:The method according to claim 7, wherein the first reference frame list comprises the first reference image, and the second reference frame list comprises a second reference image; the method further comprises:
    根据所述候选运动矢量集合中的第二候选运动矢量,确定至少两个第二参考运动矢量,所述第二参考运动矢量用来确定所述待处理块在所述第二参考图像中的参考块;Determining at least two second reference motion vectors according to a second candidate motion vector in the candidate motion vector set, the second reference motion vector being used to determine a reference of the to-be-processed block in the second reference image Piece;
    分别计算至少两个所述确定的参考块的一个或多个第三邻近已重构块和所述待处理块的一个或多个第四邻近已重构块之间的像素差异值或者率失真代价值,其中,所述第三邻近已重构块和所述第四邻近已重构块形状相同且尺寸相等;Calculating pixel difference values or rate distortions between one or more third neighboring reconstructed blocks of at least two of the determined reference blocks and one or more fourth neighboring reconstructed blocks of the to-be-processed block, respectively Generation value, wherein the third adjacent reconstructed block and the fourth adjacent reconstructed block have the same shape and are equal in size;
    根据所述至少两个第二参考运动矢量中对应的所述像素差异值或者率失真代价值最小的一个第二参考运动矢量,获得所述待处理块的第二预测运动矢量。Obtaining a second predicted motion vector of the to-be-processed block according to the corresponding one of the at least two second reference motion vectors or the second reference motion vector with the lowest rate-distortion value.
  12. 根据权利要求9所述的方法,其特征在于,所述根据所述至少两个第二参考运动矢量中对应的所述像素差异值或者率失真代价值最小的一个第二参考运动矢量,获得所述 待处理块的预测运动矢量,包括:The method according to claim 9, wherein the obtaining the second reference motion vector according to the pixel difference value or the rate distortion generation value of the at least two second reference motion vectors is the smallest. The predicted motion vector of the processing block, including:
    用所述对应的所述像素差异值或者率失真代价值最小的一个第二参考运动矢量替换所述候选运动矢量集合中的所述第二候选运动矢量,得到再更新后的候选运动矢量集合;Replacing the second candidate motion vector in the candidate motion vector set with the corresponding one of the pixel difference value or the second reference motion vector having the smallest rate distortion value, to obtain a re-updated candidate motion vector set;
    从所述再更新后的候选运动矢量集合中,获得所述待处理块的第二预测运动矢量。Obtaining, from the re-updated candidate motion vector set, a second predicted motion vector of the to-be-processed block.
  13. 根据权利要求7至12任一项所述的方法,其特征在于,在根据所述候选运动矢量集合中的第一候选运动矢量,确定至少两个第一参考运动矢量之前,包括:The method according to any one of claims 7 to 12, wherein before determining the at least two first reference motion vectors according to the first candidate motion vector in the candidate motion vector set, the method comprises:
    当所述候选运动矢量集合中的第四候选运动矢量由所述第二方向预测生成时,根据比例关系缩小或放大所述第四候选运动矢量,以得到所述第一候选运动矢量;When the fourth candidate motion vector in the candidate motion vector set is generated by the second direction prediction, the fourth candidate motion vector is reduced or enlarged according to a proportional relationship to obtain the first candidate motion vector;
    其中,所述比例关系包括第一时序差和第二时序差的比值,所述第一时序差为所述第一候选运动矢量所确定的参考图像帧的图像序列号和所述待处理块所在的图像帧的图像序列号的差值,所述第二时序差为所述第四候选运动矢量所确定的参考图像帧的图像序列号和所述待处理块所在的图像帧的图像序列号的差值。The ratio relationship includes a ratio of a first timing difference and a second timing difference, where the first timing difference is an image sequence number of the reference image frame determined by the first candidate motion vector and the to-be-processed block a difference between image sequence numbers of the image frames, the second timing difference being an image sequence number of the reference image frame determined by the fourth candidate motion vector and an image sequence number of the image frame in which the to-be-processed block is located Difference.
  14. 根据权利要求7至12任一项所述的方法,其特征在于,根据所述候选运动矢量集合中的第一候选运动矢量,确定至少两个第一参考运动矢量,包括:The method according to any one of claims 7 to 12, wherein determining at least two first reference motion vectors according to the first candidate motion vector in the candidate motion vector set comprises:
    当所述第一候选运动矢量由所述双向预测生成时,根据第五候选运动矢量,确定所述至少两个第一参考运动矢量,其中,所述第一候选运动矢量确定的参考块由根据所述第五候选运动矢量确定的第一方向参考块和根据所述第六候选运动矢量确定的第二方向参考块加权获得,所述第五候选运动矢量由所述第一方向预测生成,所述第六候选运动矢量由所述第二方向预测生成。Determining, according to the fifth candidate motion vector, the at least two first reference motion vectors, when the first candidate motion vector is generated by the bidirectional prediction, wherein the reference block determined by the first candidate motion vector is determined according to And obtaining, by the first direction reference block determined by the fifth candidate motion vector, and the second direction reference block determined according to the sixth candidate motion vector, where the fifth candidate motion vector is generated by the first direction prediction, The sixth candidate motion vector is generated by the second direction prediction.
  15. 根据权利要求1至14任一项所述的方法,其特征在于,根据所述候选运动矢量集合中的第一候选运动矢量,确定至少两个第一参考运动矢量,包括:The method according to any one of claims 1 to 14, wherein determining at least two first reference motion vectors according to the first candidate motion vector in the candidate motion vector set comprises:
    根据所述第一候选运动矢量在所述第一参考图像中确定的所述待处理块的参考块;a reference block of the to-be-processed block determined in the first reference image according to the first candidate motion vector;
    以目标精度在所述确定的参考块的邻近位置进行搜索得到至少两个候选参考块,其中,每个所述候选参考块对应一个所述第一参考运动矢量,所述目标精度包括4像素精度、2像素精度、整像素精度、半像素精度、1/4像素精度、1/8像素精度中的一种。Searching at a neighboring position of the determined reference block with target precision to obtain at least two candidate reference blocks, wherein each of the candidate reference blocks corresponds to one of the first reference motion vectors, the target accuracy includes 4 pixel precision One of 2 pixel precision, integer pixel precision, half pixel precision, 1/4 pixel precision, and 1/8 pixel precision.
  16. 根据权利要求1至15任一项所述的方法,其特征在于,包括:所述至少一个第一邻近已重构块和所述第一参考运动矢量确定的参考块之间具有第一位置关系,所述第二邻近块和所述待处理块之间具有第二位置关系,所述第一位置关系与所述第二位置关系相同。The method according to any one of claims 1 to 15, comprising: having a first positional relationship between the at least one first adjacent reconstructed block and the reference block determined by the first reference motion vector a second positional relationship between the second neighboring block and the to-be-processed block, the first positional relationship being the same as the second positional relationship.
  17. 一种预测运动矢量的生成方法,其特征在于,所述方法用于待处理块的双向预测,所述双向预测包括第一方向预测和第二方向预测,所述第一方向预测是基于第一参考帧列表的预测,所述第二方向预测是基于第二参考帧列表的预测,所述方法包括:A method for generating a motion vector predicting, wherein the method is used for bidirectional prediction of a block to be processed, the bidirectional prediction comprising a first direction prediction and a second direction prediction, the first direction prediction being based on the first Referring to the prediction of the frame list, the second direction prediction is based on a prediction of a second reference frame list, the method comprising:
    获取第一预测模式,生成第一候选运动矢量集合,所述第一候选运动矢量集合用于在所述第一方向预测中生成第一方向预测运动矢量;Obtaining a first prediction mode, generating a first candidate motion vector set, where the first candidate motion vector set is used to generate a first direction prediction motion vector in the first direction prediction;
    获取第二预测模式,生成第二候选运动矢量集合,所述第二候选运动矢量集合用于在所述第二方向预测中生成第二方向预测运动矢量,Obtaining a second prediction mode, generating a second candidate motion vector set, where the second candidate motion vector set is used to generate a second direction prediction motion vector in the second direction prediction,
    其中,当所述第一预测模式为AMVP模式时,所述第二预测模式为Merge模式,或者,当所述第一预测模式为Merge模式时,所述第二预测模式为AMVP模式。When the first prediction mode is the AMVP mode, the second prediction mode is the Merge mode, or when the first prediction mode is the Merge mode, the second prediction mode is the AMVP mode.
  18. 根据权利要求17所述的方法,其特征在于,当所述第一预测模式为Merge模式时,所述获取第一预测模式,生成第一候选运动矢量集合,包括:The method according to claim 17, wherein when the first prediction mode is the Merge mode, the acquiring the first prediction mode and generating the first candidate motion vector set comprises:
    使用Merge模式在所述第一方向预测中使用的候选运动矢量,生成所述第一候选运动矢量集合。The first candidate motion vector set is generated using a candidate motion vector used by the Merge mode in the first direction prediction.
  19. 根据权利要求17所述的方法,其特征在于,当所述第二预测模式为Merge模式时,所述获取第二预测模式,生成第二候选运动矢量集合,包括:The method according to claim 17, wherein when the second prediction mode is the Merge mode, the acquiring the second prediction mode and generating the second candidate motion vector set comprises:
    使用Merge模式在所述第二方向预测中使用的候选预测矢量,生成所述第二候选运动矢量集合。The second candidate motion vector set is generated using a candidate prediction vector used by the Merge mode in the second direction prediction.
  20. 根据权利要求17所述的方法,其特征在于,所述方法用于解码所述待处理块,在所述获取第一预测模式,生成第一候选运动矢量集合之前,还包括:The method according to claim 17, wherein the method is used to decode the to-be-processed block, and before the acquiring the first prediction mode to generate the first candidate motion vector set, the method further includes:
    解析码流获得第一标识信息,所述第一标识信息用于指示所述第一预测模式为Merge模式或者AMVP模式。The first coded information is used to indicate that the first prediction mode is a Merge mode or an AMVP mode.
  21. 根据所述权利要求20所述的方法,其特征在于,所述第一标识信息用于指示所述第一预测模式为Merge模式或者AMVP模式,包括:所述第一标识信息用于指示所述第一预测模式为Merge模式,或者,所述第一标识信息用于指示基于Merge模式生成的所述第一候选运动矢量集合的索引信息,或者,所述第一标识信息用于指示所述第一预测模式为AVMP模式,或者,所述第一标识信息用于指示基于AMVP模式生成的所述第一候选运动矢量集合的索引信息。The method according to claim 20, wherein the first identification information is used to indicate that the first prediction mode is a Merge mode or an AMVP mode, and the first identifier information is used to indicate the The first prediction mode is the Merge mode, or the first identifier information is used to indicate index information of the first candidate motion vector set generated based on the Merge mode, or the first identifier information is used to indicate the first A prediction mode is an AVMP mode, or the first identification information is used to indicate index information of the first candidate motion vector set generated based on the AMVP mode.
  22. 根据权利要求20所述的方法,其特征在于,包括:当所述第一标识信息用于指示所述第一预测模式为Merge模式时,使用预设的Merge模式的索引信息。The method according to claim 20, comprising: when the first identification information is used to indicate that the first prediction mode is a Merge mode, using index information of a preset Merge mode.
  23. 根据权利要求22所述的方法,其特征在于,所述预设的Merge模式的索引信息为Merge模式的第一个候选运动矢量。The method according to claim 22, wherein the index information of the preset Merge mode is the first candidate motion vector of the Merge mode.
  24. 根据权利要求20所述的方法,其特征在于,在所述获取第二预测模式,生成第二候选运动矢量集合之前,还包括:The method according to claim 20, further comprising: before the acquiring the second prediction mode and generating the second candidate motion vector set, further comprising:
    在确定所述第一预测模式为Merge模式之后,解析所述码流获得第二标识信息,所述第二标识信息用于指示所述第二预测模式的索引信息,其中,所述第二预测模式为AMVP模式。After determining that the first prediction mode is the Merge mode, parsing the code stream to obtain second identification information, where the second identification information is used to indicate index information of the second prediction mode, where the second prediction The mode is AMVP mode.
  25. 根据权利要求20所述的方法,其特征在于,在所述获取第二预测模式,生成第二候选运动矢量集合之前,还包括:The method according to claim 20, further comprising: before the acquiring the second prediction mode and generating the second candidate motion vector set, further comprising:
    在确定所述第一预测模式为AMVP模式之后,解析所述码流获得第二标识信息,所述第二标识信息用于指示所述第二预测模式的索引信息,其中,所述第二预测模式为Merge模式。After determining that the first prediction mode is the AMVP mode, parsing the code stream to obtain second identification information, where the second identification information is used to indicate index information of the second prediction mode, where the second prediction The mode is Merge mode.
  26. 根据权利要求17至25任一项所述的方法,其特征在于,包括:确定所述第一预测模式为AMVP模式之后,解析所述码流获得所述第一方向预测的参考帧索引和运动矢量差信息;或者,确定所述第二预测模式为AMVP模式之后,解析所述码流获得所述第二方向预测的参考帧索引和运动矢量差信息。The method according to any one of claims 17 to 25, comprising: after determining that the first prediction mode is an AMVP mode, parsing the code stream to obtain a reference frame index and motion of the first direction prediction The vector difference information; or, after determining that the second prediction mode is the AMVP mode, parsing the code stream to obtain the reference frame index and motion vector difference information of the second direction prediction.
  27. 一种用于生成预测运动矢量的设备,其特征在于,所述设备包括:An apparatus for generating a predicted motion vector, the apparatus comprising:
    集合生成模块,用于构建待处理块的候选运动矢量集合;a set generation module, configured to construct a candidate motion vector set of the to-be-processed block;
    模板匹配模块,用于根据所述候选运动矢量集合中的第一候选运动矢量,确定至少两个第一参考运动矢量,所述第一参考运动矢量用来确定所述待处理块在所述待处理块的第一参考图像中的参考块;a template matching module, configured to determine, according to the first candidate motion vector in the candidate motion vector set, at least two first reference motion vectors, where the first reference motion vector is used to determine that the to-be-processed block is in the to-be-processed Processing a reference block in the first reference image of the block;
    所述模板匹配模块还用于,分别计算至少两个所述确定的参考块的一个或多个第一邻近已重构块和所述待处理块的一个或多个第二邻近已重构块之间的像素差异值或者率失真rate-distortion代价值,其中,所述第一邻近已重构块和所述第二邻近已重构块的形状相同且尺寸相等;The template matching module is further configured to separately calculate one or more first neighbor reconstructed blocks of the at least two determined reference blocks and one or more second neighbor reconstructed blocks of the to-be-processed block a pixel difference value or rate distortion rate-distortion generation value, wherein the first adjacent reconstructed block and the second adjacent reconstructed block have the same shape and are equal in size;
    预测运动矢量生成模块,用于根据所述至少两个第一参考运动矢量中对应的所述像素差异值或者率失真代价值最小的一个第一参考运动矢量,获得所述待处理块的第一预测运动矢量。a prediction motion vector generation module, configured to obtain, according to the corresponding one of the at least two first reference motion vectors, or the first reference motion vector with the lowest rate distortion value, the first of the to-be-processed blocks Predict motion vectors.
  28. 根据权利要求27所述的设备,其特征在于,所述设备用于解码所述待处理块;所述预测运动矢量生成模块用于根据所述至少两个第一参考运动矢量中对应的所述像素差异值或者率失真代价值最小的一个第一参考运动矢量,获得所述待处理块的第一预测运动矢量,包括:The device according to claim 27, wherein the device is configured to decode the to-be-processed block; and the predicted motion vector generating module is configured to: according to the corresponding one of the at least two first reference motion vectors Obtaining a first reference motion vector of the to-be-processed block by using a first reference motion vector with a pixel difference value or a rate distortion generation value, including:
    所述预测运动矢量生成模块用于,将所述对应的所述像素差异值或者率失真代价值最小的一个第一参考运动矢量作为所述待处理块的第一预测运动矢量。The predicted motion vector generation module is configured to use, as a first predicted motion vector of the to-be-processed block, a first reference motion vector that minimizes the corresponding pixel difference value or rate distortion generation value.
  29. 根据权利要求26或27所述的设备,其特征在于,所述设备用于解码所述待处理块;所述设备还包括解析模块;The device according to claim 26 or 27, wherein the device is configured to decode the to-be-processed block; the device further comprises a parsing module;
    所述解析模块用于,解析码流获得标识信息,所述标识信息用于指示所述候选运动矢量集合为Merge模式所采用的候选运动矢量集合或者AMVP模式所采用的候选运动矢量集合;The parsing module is configured to: the parsing code stream obtains the identifier information, where the identifier information is used to indicate that the candidate motion vector set is a candidate motion vector set used by the Merge mode or a candidate motion vector set used by the AMVP mode;
    当所述标识信息指示所述候选运动矢量集合为Merge模式所采用的候选运动矢量集合 时,所述集合生成模块用于构建所述待处理块在Merge模式下所采用的候选运动矢量集合;When the identifier information indicates that the candidate motion vector set is a candidate motion vector set adopted by the Merge mode, the set generating module is configured to construct a candidate motion vector set adopted by the to-be-processed block in the Merge mode;
    当所述标识信息指示所述候选运动矢量集合为AMVP模式所采用的候选运动矢量集合时,所述集合生成模块用于构建所述待处理块在AMVP模式下所采用的候选运动矢量集合。When the identifier information indicates that the candidate motion vector set is a candidate motion vector set adopted by the AMVP mode, the set generation module is configured to construct a candidate motion vector set adopted by the to-be-processed block in the AMVP mode.
  30. 根据权利要求27至29任一项所述的设备,其特征在于,所述解析模块还用于,解析所述码流获得索引信息,根据所述索引信息确定所述第一候选运动矢量。The device according to any one of claims 27 to 29, wherein the parsing module is further configured to parse the code stream to obtain index information, and determine the first candidate motion vector according to the index information.
  31. 根据权利要求27至30任一项所述的设备,其特征在于,所述候选运动矢量集合用于对所述待处理块进行双向预测,所述双向预测包括第一方向预测和第二方向预测,所述第一方向预测是基于第一参考帧列表的预测,所述第二方向预测是基于第二参考帧列表的预测。The device according to any one of claims 27 to 30, wherein the candidate motion vector set is used for bidirectional prediction of the to-be-processed block, the bidirectional prediction including first direction prediction and second direction prediction The first direction prediction is based on a prediction of a first reference frame list, and the second direction prediction is based on a prediction of a second reference frame list.
  32. 根据权利要求31所述的设备,其特征在于,所述第一参考帧列表包括所述第一参考图像,所述第二参考帧列表包括第二参考图像,所述预测运动矢量生成模块还用于:The device according to claim 31, wherein the first reference frame list comprises the first reference image, the second reference frame list comprises a second reference image, and the predicted motion vector generation module further uses to:
    计算所述对应的所述像素差异值或者率失真代价值最小的一个第一参考运动矢量替换后的第一候选运动矢量与所述替换前的第一候选运动矢量的差值;Calculating a difference between the first candidate motion vector replaced by the first reference motion vector and the first candidate motion vector before the replacement, where the corresponding pixel difference value or rate distortion value is the smallest;
    根据所述差值和所述候选运动矢量集合中的第二候选运动矢量,获得第三候选运动矢量,所述第二候选运动矢量用来确定所述待处理块在所述第二参考图像中的参考块将所述第三候选运动矢量作为所述待处理快的第二预测运动矢量。Obtaining, according to the difference value and the second candidate motion vector in the candidate motion vector set, a third candidate motion vector, where the second candidate motion vector is used to determine that the to-be-processed block is in the second reference image The reference block uses the third candidate motion vector as the second predicted motion vector that is fast to be processed.
  33. 根据权利要求31所述的设备,其特征在于,所述第一参考帧列表包括所述第一参考图像,所述第二参考帧列表包括第二参考图像;The device according to claim 31, wherein the first reference frame list comprises the first reference image, and the second reference frame list comprises a second reference image;
    所述模板匹配模块还用于,根据所述候选运动矢量集合中的第二候选运动矢量,确定至少两个第二参考运动矢量,所述第二参考运动矢量用来确定所述待处理块在所述第二参考图像中的参考块;The template matching module is further configured to: determine, according to the second candidate motion vector in the candidate motion vector set, at least two second reference motion vectors, where the second reference motion vector is used to determine that the to-be-processed block is a reference block in the second reference image;
    所述模板匹配模块还用于,分别计算至少两个所述确定的参考块的一个或多个第三邻近已重构块和所述待处理块的一个或多个第四邻近已重构块之间的像素差异值或者率失真代价值,其中,所述第三邻近已重构块和所述第四邻近已重构块形状相同且尺寸相等;The template matching module is further configured to separately calculate one or more third adjacent reconstructed blocks of the at least two determined reference blocks and one or more fourth adjacent reconstructed blocks of the to-be-processed block a pixel difference value or a rate distortion generation value, wherein the third neighbor reconstructed block and the fourth neighbor reconstructed block have the same shape and are equal in size;
    所述预测运动矢量生成模块还用于,根据所述至少两个第二参考运动矢量中对应的所述像素差异值或者率失真代价值最小的一个第二参考运动矢量,获得所述待处理块的第二预测运动矢量。The predicted motion vector generation module is further configured to obtain the to-be-processed block according to the corresponding one of the at least two second reference motion vectors or the second reference motion vector with the lowest rate-distortion value. The second predicted motion vector.
  34. 根据权利要求33所述的设备,其特征在于,所述预测运动矢量生成模块根据所述至少两个第二参考运动矢量中对应的所述像素差异值或者率失真代价值最小的一个第二参考运动矢量,获得所述待处理块的预测运动矢量,包括:The device according to claim 33, wherein the predicted motion vector generation module is configured to select a second reference corresponding to the pixel difference value or the rate distortion value of the at least two second reference motion vectors. a motion vector, obtaining a predicted motion vector of the to-be-processed block, comprising:
    所述预测运动矢量生成模块用于,使用所述对应的所述像素差异值或者率失真代价值最小的一个第二参考运动矢量替换所述候选运动矢量集合中的所述第二候选运动矢量,得到再更新后的候选运动矢量集合;The predicted motion vector generation module is configured to replace the second candidate motion vector in the candidate motion vector set with the corresponding one of the pixel difference value or a second reference motion vector with a lowest rate distortion value. Obtaining a candidate motion vector set after re-updating;
    从所述得到再更新后的候选运动矢量集合中,获得所述待处理块的第二预测运动矢量。Obtaining, from the obtained re-updated candidate motion vector set, a second predicted motion vector of the to-be-processed block.
  35. 根据权利要求31至34任一项所述的设备,其特征在于,所述模板匹配模块用于根据所述候选运动矢量集合中的第一候选运动矢量,确定至少两个第一参考运动矢量之前,包括:The device according to any one of claims 31 to 34, wherein the template matching module is configured to determine at least two first reference motion vectors according to a first candidate motion vector in the candidate motion vector set. ,include:
    所述模板匹配模块用于,当所述候选运动矢量集合中的第四候选运动矢量由所述第二方向预测生成时,根据比例关系缩小或放大所述第四候选运动矢量,以得到所述第一候选运动矢量;The template matching module is configured to: when the fourth candidate motion vector in the candidate motion vector set is generated by the second direction prediction, reduce or enlarge the fourth candidate motion vector according to a proportional relationship to obtain the First candidate motion vector;
    其中,所述比例关系包括第一时序差和第二时序差的比值,所述第一时序差为所述第一候选运动矢量所确定的参考图像帧的图像序列号和所述待处理块所在的图像帧的图像序列号的差值,所述第二时序差为所述第四候选运动矢量所确定的参考图像帧的图像序列号和所述待处理块所在的图像帧的图像序列号的差值。The ratio relationship includes a ratio of a first timing difference and a second timing difference, where the first timing difference is an image sequence number of the reference image frame determined by the first candidate motion vector and the to-be-processed block a difference between image sequence numbers of the image frames, the second timing difference being an image sequence number of the reference image frame determined by the fourth candidate motion vector and an image sequence number of the image frame in which the to-be-processed block is located Difference.
  36. 根据权利要求31至34任一项所述的设备,其特征在于,所述模板匹配模块用于根据所述候选运动矢量集合中的第一候选运动矢量,确定至少两个第一参考运动矢量,包括:The device according to any one of claims 31 to 34, wherein the template matching module is configured to determine at least two first reference motion vectors according to a first candidate motion vector in the candidate motion vector set. include:
    所述模板匹配模块用于,当所述第一候选运动矢量由所述双向预测生成时,根据第五候选运动矢量,确定所述至少两个第一参考运动矢量,其中,所述第一候选运动矢量确定的参考块由根据所述第五候选运动矢量确定的第一方向参考块和根据所述第六候选运动矢量确定的第二方向参考块加权获得,所述第五候选运动矢量由所述第一方向预测生成,所述第六候选运动矢量由所述第二方向预测生成。The template matching module is configured to: when the first candidate motion vector is generated by the bidirectional prediction, determine the at least two first reference motion vectors according to a fifth candidate motion vector, where the first candidate The motion vector determined reference block is obtained by weighting a first direction reference block determined according to the fifth candidate motion vector and a second direction reference block determined according to the sixth candidate motion vector, the fifth candidate motion vector The first direction prediction generation is generated, and the sixth candidate motion vector is generated by the second direction prediction.
  37. 根据权利要求27至36任一项所述的设备,其特征在于,所述模板匹配模块用于根据所述候选运动矢量集合中的第一候选运动矢量,确定至少两个第一参考运动矢量,包括:The device according to any one of claims 27 to 36, wherein the template matching module is configured to determine at least two first reference motion vectors according to a first candidate motion vector in the candidate motion vector set. include:
    所述模板匹配模块用于,根据所述第一候选运动矢量在所述第一参考图像中确定的所述待处理块的参考块;The template matching module is configured to: reference a block of the to-be-processed block determined in the first reference image according to the first candidate motion vector;
    以目标精度在所述确定的参考块的邻近位置进行搜索得到至少两个候选参考块,其中,每个所述候选参考块对应一个所述第一参考运动矢量,所述目标精度包括4像素精度、2像素精度、整像素精度、半像素精度、1/4像素精度、1/8像素精度中的一种。Searching at a neighboring position of the determined reference block with target precision to obtain at least two candidate reference blocks, wherein each of the candidate reference blocks corresponds to one of the first reference motion vectors, the target accuracy includes 4 pixel precision One of 2 pixel precision, integer pixel precision, half pixel precision, 1/4 pixel precision, and 1/8 pixel precision.
  38. 根据权利要求27至37任一项所述的设备,其特征在于,包括:所述至少一个第一邻近已重构块和所述第一参考运动矢量确定的参考块之间具有第一位置关系,所述第二邻近块和所述待处理块之间具有第二位置关系,所述第一位置关系与所述第二位置关系相同。The apparatus according to any one of claims 27 to 37, comprising: a first positional relationship between the at least one first adjacent reconstructed block and the reference block determined by the first reference motion vector a second positional relationship between the second neighboring block and the to-be-processed block, the first positional relationship being the same as the second positional relationship.
  39. 一种用于生成预测运动矢量的设备,其特征在于,所述设备用于进行待处理块的双向预测,所述双向预测包括第一方向预测和第二方向预测,所述第一方向预测是基于第 一参考帧列表的预测,所述第二方向预测是基于第二参考帧列表的预测,所述设备包括:An apparatus for generating a predicted motion vector, wherein the apparatus is configured to perform bidirectional prediction of a block to be processed, the bidirectional prediction including a first direction prediction and a second direction prediction, where the first direction prediction is Based on the prediction of the first reference frame list, the second direction prediction is based on a prediction of a second reference frame list, the device comprising:
    第一集合生成模块,用于获取第一预测模式,生成第一候选运动矢量集合,所述第一候选运动矢量集合用于在所述第一方向预测中生成第一方向预测运动矢量;a first set generating module, configured to acquire a first prediction mode, and generate a first candidate motion vector set, where the first candidate motion vector set is used to generate a first direction prediction motion vector in the first direction prediction;
    第二集合生成模块,用于获取第二预测模式,生成第二候选运动矢量集合,所述第二候选运动矢量集合用于在所述第二方向预测中生成第二方向预测运动矢量,a second set generating module, configured to acquire a second prediction mode, and generate a second candidate motion vector set, where the second candidate motion vector set is used to generate a second direction predicted motion vector in the second direction prediction,
    其中,当所述第一预测模式为AMVP模式时,所述第二预测模式为Merge模式,或者,当所述第一预测模式为Merge模式时,所述第二预测模式为AMVP模式。When the first prediction mode is the AMVP mode, the second prediction mode is the Merge mode, or when the first prediction mode is the Merge mode, the second prediction mode is the AMVP mode.
  40. 根据权利要求39所述的设备,其特征在于,当所述第一预测模式为Merge模式时,所述第一集合生成模块获取第一预测模式,生成第一候选运动矢量集合,包括:The device according to claim 39, wherein, when the first prediction mode is the Merge mode, the first set generation module acquires a first prediction mode, and generates a first candidate motion vector set, including:
    所述第一集合生成模块用于,使用Merge模式在所述第一方向预测中使用的候选运动矢量,生成所述第一候选运动矢量集合。The first set generation module is configured to generate the first candidate motion vector set by using a candidate motion vector used by the Merge mode in the first direction prediction.
  41. 根据权利要求39所述的设备,其特征在于,当所述第二预测模式为Merge模式时,所述第二集合生成模块用于获取第二预测模式,生成第二候选运动矢量集合,包括:The device according to claim 39, wherein when the second prediction mode is the Merge mode, the second set generation module is configured to acquire a second prediction mode, and generate a second candidate motion vector set, including:
    所述第二集合生成模块用于,使用Merge模式在所述第二方向预测中使用的候选预测矢量,生成所述第二候选运动矢量集合。The second set generation module is configured to generate the second candidate motion vector set by using a candidate prediction vector used by the Merge mode in the second direction prediction.
  42. 根据权利要求39所述的设备,其特征在于,所述设备用于解码所述待处理块;所述设备还包括解析模块,所述解析模块用于解析码流获得第一标识信息,所述第一标识信息用于指示所述第一预测模式为Merge模式或者AMVP模式。The device according to claim 39, wherein the device is configured to decode the to-be-processed block; the device further includes a parsing module, where the parsing module is configured to parse the code stream to obtain first identification information, The first identification information is used to indicate that the first prediction mode is a Merge mode or an AMVP mode.
  43. 根据所述权利要求42所述的设备,其特征在于,包括:所述第一标识信息用于指示所述第一预测模式为Merge模式或者AMVP模式,包括:所述第一标识信息用于指示所述第一预测模式为Merge模式,或者,所述第一标识信息用于指示基于Merge模式生成的所述第一候选运动矢量集合的索引信息,或者,所述第一标识信息用于指示所述第一预测模式为AVMP模式,或者,所述第一标识信息用于指示基于AMVP模式生成的所述第一候选运动矢量集合的索引信息。The device according to claim 42, characterized in that the first identifier information is used to indicate that the first prediction mode is a Merge mode or an AMVP mode, and the first identifier information is used to indicate The first prediction mode is a Merge mode, or the first identifier information is used to indicate index information of the first candidate motion vector set generated based on the Merge mode, or the first identifier information is used to indicate The first prediction mode is an AVMP mode, or the first identifier information is used to indicate index information of the first candidate motion vector set generated based on the AMVP mode.
  44. 根据权利要求42所述的设备,其特征在于,所述解析模块还用于,当所述第一标识信息用于指示所述第一预测模式为Merge模式时,使用预设的Merge模式的索引信息。The device according to claim 42, wherein the parsing module is further configured to: when the first identifier information is used to indicate that the first prediction mode is a Merge mode, use an index of a preset Merge mode. information.
  45. 根据权利要求44所述的设备,其特征在于,所述预设的Merge模式的索引信息为Merge模式的第一个候选运动矢量。The device according to claim 44, wherein the index information of the preset Merge mode is the first candidate motion vector of the Merge mode.
  46. 根据权利要求42所述的设备,其特征在于,所述解析模块还用于,在确定所述第一预测模式为Merge模式之后,解析所述码流获得第二标识信息,所述第二标识信息用于 指示AMVP所述第二预测模式的索引信息,其中,所述第二预测模式为AMVP模式。The device according to claim 42, wherein the parsing module is further configured to: after determining that the first prediction mode is a Merge mode, parsing the code stream to obtain second identification information, the second identifier The information is used to indicate index information of the second prediction mode of the AMVP, wherein the second prediction mode is an AMVP mode.
  47. 根据权利要求42所述的设备,其特征在于,所述解析模块还用于,在确定所述第一预测模式为AMVP模式之后,解析所述码流获得第二标识信息,所述第二标识信息用于指示Merge所述第二预测模式的索引信息,其中,所述第二预测模式为Merge模式。The device according to claim 42, wherein the parsing module is further configured to: after determining that the first prediction mode is an AMVP mode, parsing the code stream to obtain second identification information, the second identifier The information is used to indicate the index information of the second prediction mode of the Merge, wherein the second prediction mode is the Merge mode.
  48. 根据权利要求39至47任一项所述的设备,其特征在于,所述解析模块还用于,确定所述第一预测模式为AMVP模式之后,解析所述码流获得所述第一方向预测的参考帧索引和运动矢量差信息;或者,确定所述第二预测模式为AMVP模式之后,解析所述码流获得所述第二方向预测的参考帧索引和运动矢量差信息。The device according to any one of claims 39 to 47, wherein the parsing module is further configured to: after determining that the first prediction mode is an AMVP mode, parsing the code stream to obtain the first direction prediction Reference frame index and motion vector difference information; or, after determining that the second prediction mode is the AMVP mode, parsing the code stream to obtain the reference frame index and motion vector difference information of the second direction prediction.
PCT/CN2019/070629 2018-03-07 2019-01-07 Method for generating predicted motion vector and related apparatus WO2019169949A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810188482.6A CN110248188A (en) 2018-03-07 2018-03-07 Predicted motion vector generation method and relevant device
CN201810188482.6 2018-03-07

Publications (1)

Publication Number Publication Date
WO2019169949A1 true WO2019169949A1 (en) 2019-09-12

Family

ID=67845540

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/070629 WO2019169949A1 (en) 2018-03-07 2019-01-07 Method for generating predicted motion vector and related apparatus

Country Status (2)

Country Link
CN (1) CN110248188A (en)
WO (1) WO2019169949A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111163322B (en) * 2020-01-08 2022-08-30 绍兴文理学院 Encoding and decoding method for mapping index based on historical motion vector
WO2022061573A1 (en) * 2020-09-23 2022-03-31 深圳市大疆创新科技有限公司 Motion search method, video coding device, and computer-readable storage medium
CN112702601B (en) * 2020-12-17 2023-03-10 北京达佳互联信息技术有限公司 Method and apparatus for determining motion vector for inter prediction
WO2023131045A1 (en) * 2022-01-05 2023-07-13 维沃移动通信有限公司 Inter-frame prediction method and device, and readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104363449A (en) * 2014-10-31 2015-02-18 华为技术有限公司 Method and relevant device for predicting pictures
CN107113424A (en) * 2014-11-18 2017-08-29 联发科技股份有限公司 Bidirectional predictive video coding method based on the motion vector from single directional prediction and merging candidate

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101686393B (en) * 2008-09-28 2012-10-17 华为技术有限公司 Fast-motion searching method and fast-motion searching device applied to template matching
CN101931803B (en) * 2009-06-26 2013-01-09 华为技术有限公司 Method, device and equipment for acquiring motion information of video image and template constructing method
WO2017048008A1 (en) * 2015-09-17 2017-03-23 엘지전자 주식회사 Inter-prediction method and apparatus in video coding system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104363449A (en) * 2014-10-31 2015-02-18 华为技术有限公司 Method and relevant device for predicting pictures
CN107113424A (en) * 2014-11-18 2017-08-29 联发科技股份有限公司 Bidirectional predictive video coding method based on the motion vector from single directional prediction and merging candidate

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
CHEN, CHUNCHI ET AL.: "EE 3: Generalized bi-prediction", JOINT VIDEO EXPLORATION TEAM (JVET) OF ITU-T SG 16 WP 3, 15 October 2016 (2016-10-15), Chengdu, CN *
CHEN, XU ET AL.: "Decoder-Side Motion Vector Refinement Based on Bilateral Template Matching", JOINT VIDEO EXPLORATION TEAM (JVET) OF ITU-T SG 16 WP3- JVET-D0029, 1 October 2016 (2016-10-01) - 15 October 2016 (2016-10-15), Chengdu, CN, pages 1; 2, XP030150254 *
LIN, YONGBING: "Enhanced Template Matching in FRUC Mode", JOINT VIDEO EXPLORATION TEAM (JVET) OF ITU-T SG 16 WP 3, 12 January 2017 (2017-01-12), Meeting: Geneva, CH, pages 1 - 3, XP055615329 *

Also Published As

Publication number Publication date
CN110248188A (en) 2019-09-17

Similar Documents

Publication Publication Date Title
WO2019169949A1 (en) Method for generating predicted motion vector and related apparatus
JP6874947B2 (en) Motion vector prediction method and device
JP6881788B2 (en) Video coding method, video decoding method, and terminal
WO2018058622A1 (en) Method and device for image coding and decoding for inter-frame prediction
RU2577181C2 (en) Method and device for video signal encoding
CN109218733B (en) Method for determining prediction motion vector prediction and related equipment
CN110545425B (en) Inter-frame prediction method, terminal equipment and computer storage medium
US11412210B2 (en) Inter prediction method and apparatus for video coding
CN113709458B (en) Displacement vector prediction method, device and equipment in video coding and decoding
KR20230155621A (en) Motion vector prediction method and apparatus, encoder, and decoder
CN109565601B (en) Template matching-based prediction method and device
JP2023100767A (en) Picture encoding and decoding method and device for video sequence
JP7388610B2 (en) Video encoding method, video decoding method, and terminal
JP6968228B2 (en) Methods and equipment for image coding and decoding via inter-prediction
WO2018120290A1 (en) Prediction method and device based on template matching
AU2018440297B2 (en) Method and apparatus for coding image of video sequence, and terminal device
CN116347082A (en) Method and device for encoding multimedia resources, electronic equipment and storage medium
BR112019006146B1 (en) VIDEO ENCODING METHOD, VIDEO DECODING METHOD, AND TERMINAL

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19764366

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19764366

Country of ref document: EP

Kind code of ref document: A1