WO2020001624A1 - 一种运动矢量确定方法和设备 - Google Patents

一种运动矢量确定方法和设备 Download PDF

Info

Publication number
WO2020001624A1
WO2020001624A1 PCT/CN2019/093709 CN2019093709W WO2020001624A1 WO 2020001624 A1 WO2020001624 A1 WO 2020001624A1 CN 2019093709 W CN2019093709 W CN 2019093709W WO 2020001624 A1 WO2020001624 A1 WO 2020001624A1
Authority
WO
WIPO (PCT)
Prior art keywords
image block
motion vector
template
candidate image
candidate
Prior art date
Application number
PCT/CN2019/093709
Other languages
English (en)
French (fr)
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 WO2020001624A1 publication Critical patent/WO2020001624A1/zh

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/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

Definitions

  • the present disclosure relates to the technical field of video codecs, and in particular, to a method and a device for determining a motion vector.
  • Video encoding may include prediction, transformation, quantization, entropy encoding, and filtering.
  • predictive coding includes intra-frame coding and inter-frame coding.
  • Inter-frame coding uses the correlation of the video time domain to predict the pixels of the current image by using the pixels adjacent to the coded image to effectively remove the video time domain redundancy.
  • a motion vector (Motion Vector, MV) can be used to represent the relative displacement between the current image block of the current frame image and the reference image block of the reference frame image. For example, there is a strong time-domain correlation between the video image A of the current frame and the video image B of the reference frame.
  • the video image B can be moved. Search to find the image block B1 (that is, the reference image block) that most closely matches the image block A1, and determine the relative displacement between the image block A1 and the image block B1, which is also the motion vector of the image block A1.
  • the encoding end may send the motion vector to the decoding end, instead of sending the image block A1 to the decoding end, the decoding end may obtain the image block A1 according to the motion vector and the image block B1. Obviously, since the number of bits occupied by the motion vector is less than the number of bits occupied by the image block A1, the above manner can save a large number of bits.
  • the transmission of the motion vector of each image block will also occupy more bits.
  • the spatial correlation between candidate image blocks can also be used to predict the motion vector of the image blocks.
  • the motion vector of the image block A2 adjacent to the image block A1 may be determined as the motion vector of the image block A1.
  • the encoding end can send the index value of the motion vector of the image block A2 to the decoding end, and the decoding end can determine the motion vector of the image block A2, which is the motion vector of the image block A1, based on the index value. Since the number of bits occupied by the index value of the motion vector of the image block A2 is smaller than the number of bits occupied by the motion vector, the above manner can further save bits.
  • the motion vector of image block A2 is determined as the motion of image block A1 Vector, there are problems such as low prediction quality and prediction error.
  • the present disclosure provides a method and a device for determining a motion vector, which can help improve the accuracy of the motion vector and improve the coding performance.
  • the present disclosure provides a method for determining a motion vector, which is applied to a decoder.
  • the method includes: acquiring motion information of a candidate image block of a current image block; and acquiring a template of the current image block according to the motion information of the candidate image block; Obtaining a target motion vector based on the template according to the original motion vector corresponding to the current image block and the obtained template; and determining a final motion vector of the current image block based on the target motion vector.
  • the present disclosure provides a method for determining a motion vector, which is applied to an encoding end.
  • the method includes: acquiring motion information of a candidate image block of a current image block; acquiring a template of the current image block according to the motion information of the candidate image block; According to the original motion vector corresponding to the current image block and the obtained template, a target motion vector based on the template is obtained; and an encoded bit stream is sent to a decoding end according to the original motion vector and the target motion vector.
  • the present disclosure provides a decoding device, including: a processor and a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; and the processor is configured to execute the machine-executable An instruction is executed to implement the motion vector determination method steps described above.
  • the present disclosure provides an encoding-side device, including: a processor and a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; and the processor is configured to execute the machine-executable An instruction is executed to implement the motion vector determination method steps described above.
  • the target motion vector can be obtained according to the original motion vector, and the final motion vector of the current image block is determined according to the target motion vector, instead of determining the final motion vector of the current image block according to the original motion vector. , Thereby improving the accuracy of the motion vector and improving the coding performance.
  • a template of the current image block may be obtained according to the motion information of the candidate image block, and a target motion vector may be obtained according to the template of the current image block.
  • the foregoing method may quickly obtain the current image block. Template, and then obtain the target motion vector based on the template, which can improve decoding efficiency and reduce decoding delay. For example, before the decoding reconstruction phase, a template of the current image block can be obtained, and a target motion vector can be obtained according to the template.
  • FIG. 1 is a schematic diagram of a motion vector in an embodiment of the present disclosure.
  • FIG. 2 is a flowchart of a method for determining a motion vector in an embodiment of the present disclosure.
  • 3A-3O are schematic diagrams of templates of a current image block in an embodiment of the present disclosure.
  • 4A and 4B are flowcharts of a method for determining a motion vector in another embodiment of the present disclosure.
  • FIG. 5 is a flowchart of a method for determining a motion vector in another embodiment of the present disclosure.
  • 6A and 6B are flowcharts of a method for determining a motion vector in another embodiment of the present disclosure.
  • FIG. 7 is a structural diagram of a motion vector determination device in an embodiment of the present disclosure.
  • FIG. 8 is a structural diagram of a motion vector determination device in another embodiment of the present disclosure.
  • FIG. 9 is a hardware structural diagram of a decoder device in an embodiment of the present disclosure.
  • FIG. 10 is a hardware structure diagram of an encoding-side device in an embodiment of the present disclosure.
  • first, second, third, etc. may be used to describe various information in the embodiments of the present disclosure, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other.
  • first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information.
  • word “if” can be interpreted as "at” or “at " or "in response to a determination”.
  • a method for determining a motion vector is provided in an embodiment of the present disclosure.
  • the method may involve the following concepts:
  • Motion Vector In inter-frame coding, the motion vector is used to represent the relative displacement between the current image block of the current frame image and the reference image block of the reference frame image. Each image block has a corresponding motion vector. Send to the decoder. If the motion vector of each image block is independently encoded and transmitted, it consumes a considerable number of bits, especially when the number of image blocks is very large. In order to reduce the number of bits used to encode the motion vector, the spatial correlation between adjacent image blocks can be used to predict the motion vector of the current image block to be encoded according to the motion vector of the adjacent encoded image block, and then the prediction difference is Encoding, this can effectively reduce the number of bits representing the motion vector.
  • Motion Information Since the motion vector indicates the position offset between the current image block and a reference image block, in order to accurately obtain the information pointing to the image block, in addition to the motion vector, it is necessary to refer to the index information of the frame image to indicate which one to use Reference frame image.
  • a reference frame image list can usually be established, and the reference frame index indicates that the current image block uses the reference frame image in the reference frame image list.
  • Motion-related information such as motion vectors and reference frame indexes can be collectively referred to as motion information.
  • the coding process is performed on an image-by-image block basis.
  • the reconstruction information of the surrounding encoded image blocks can be used.
  • the template refers to the encoding / decoding information of a fixed shape around the current image block (adjacent areas in the time domain or the spatial domain).
  • the template is exactly the same at the encoding end and the decoding end. Therefore, some operations performed by the template at the encoding end can be used to obtain completely consistent results at the decoding end, that is, the information derived by the encoding end based on the template can be Lossless recovery at the decoding end without the need to pass additional information, thereby further reducing the number of transmitted bits.
  • Rate-Distortion Optimized There are two major indicators for evaluating coding efficiency: code rate (also known as Bit Rate, Second, BPS) and PSNR (Peak Signal to Noise Ratio), bit stream The smaller the compression ratio is, the larger the PSNR is, the better the reconstructed image quality is.
  • code rate also known as Bit Rate, Second, BPS
  • PSNR Peak Signal to Noise Ratio
  • SSE Sud-Square Error
  • the mean square sum of the difference of the image ⁇ is a Lagrangian multiplier
  • R is the actual number of bits required for image block encoding in this encoding mode, including the bits required for encoding mode information, motion information, prediction residuals, etc. sum.
  • Intra prediction The reconstructed pixel values of spatially adjacent image blocks (such as in the same frame as the current image block) of the current image block can be used for predictive coding, and interprediction: the current image can be used The reconstructed pixel values of time-domain neighboring image blocks of the block (such as images in different frames from the current image block) are predictively encoded.
  • a method for determining a motion vector is provided in an embodiment of the present disclosure, and can be applied to an inter-frame coding technology.
  • a motion vector may be used to represent a relative displacement between a current image block of a current frame image and a reference image block of a reference frame image.
  • video image A is a current frame image
  • image block A1 is a current image block
  • video image B is a reference frame image of video image A
  • image block B1 is a reference image block of image block A1.
  • motion search can be performed in video image B to find image block B1 that best matches image block A1 And determine the relative displacement between image block A1 and image block B1, and the relative displacement is also the motion vector of image block A1.
  • the motion vector is (-6, 4), which indicates that the image block B1 is moved 6 pixels to the left relative to the image block A1 in the horizontal direction and 4 pixels upwards relative to the image block A1 in the vertical direction. point.
  • the encoded bit stream carries the motion vector (-6, 4) of the image block A1, not the image block A1.
  • the decoder can obtain the motion vector (-6, 4) of image block A1. Based on the position and motion vector (-6, 4) of image block A1, determine the image block B1 in video image B Position, that is: from the position of image block A1, move 6 pixels to the left and up 4 pixels to get the position of image block B1, read image block B1 from the position of image block B1, and use the image block B1 reconstructs the image block A1.
  • the similarity between the image block B1 and the image block A1 is very high, using the image block B1 to reconstruct the image block A1 can reconstruct an image with a high degree of similarity. Since the number of bits occupied by the motion vector is less than the number of bits occupied by the image block A1, a large number of bits are saved by carrying the motion vector in the encoded bit stream instead of carrying the image block A1.
  • the motion vector determines the motion vector of the image block A1.
  • an image block adjacent to image block A1 may include: image block A2, image block A3, image block A4, and image block A5, and the motion vector list includes the motion vector A21 of image block A2, The motion vector A31 of the image block A3, the motion vector A41 of the image block A4, and the motion vector A51 of the image block A5.
  • a motion vector can be selected from the motion vector list. Assume that the motion vector A21 is selected, and the motion vector A21 is used as the original motion vector. The original motion vector A21 is used to obtain the target motion vector, and the target motion vector is used as the image. Final motion vector for block A1.
  • a target motion vector different from the original motion vector A21 is obtained based on the original motion vector A21, and the target motion vector is different from the image block A1.
  • the motion vector is closest, so the target motion vector can be used as the final motion vector of the image block A1.
  • the above method of “using the target motion vector as the final motion vector of the image block A1” can solve the problem of low prediction quality and prediction. Problems such as errors.
  • the encoded bit stream carries the index value of the original motion vector A21 (that is, the index value in the motion vector list), rather than the motion vector of the image block A1 (-6, 4), not even image block A1.
  • the decoder can obtain the index value of the original motion vector A21, and obtain the original motion vector A21 from the motion vector list according to the index value, and obtain the target motion vector according to the original motion vector A21, which is the target motion vector.
  • the final motion vector of the image block A1 so as to obtain the final motion vector of the image block A1.
  • the bits can be further saved.
  • the decoded information (such as reconstruction information or prediction information) of the adjacent image block of the current image block can be used to obtain the template of the current image block, and the template of the current image block and the original motion can be used.
  • Vector gets target motion vector.
  • the decoded information of the adjacent image block is reconstruction information
  • the generation of the template of the current image block needs to wait until the decoding and reconstruction stage, which greatly reduces the decoding efficiency and brings the decoding delay.
  • the decoding information is prediction information, so the generation of the template of the current image block also needs to wait until the decoding and reconstruction stage, which greatly reduces the decoding efficiency and brings the decoding delay. Therefore, the above-mentioned manner will greatly affect the parallelism of decoding.
  • a better template generation method is proposed. Different from the method of using reconstruction information and prediction information to generate a template, it can be based on the motion information (such as motion vector) of the candidate image block of the current image block. And reference frame index, etc.) to obtain the template of the current image block. Then, the target motion vector can be obtained according to the template of the current image block and the original motion vector, thereby improving efficiency.
  • the motion information such as motion vector
  • reference frame index etc.
  • FIG. 2 is a schematic flowchart of a method for determining a motion vector
  • the method may include:
  • Step 201 The encoder obtains motion information of a candidate image block of the current image block.
  • the candidate image block of the current image block may include, but is not limited to, a spatial-domain candidate image block of the current image block; or a time-domain candidate image block of the current image block; there is no limitation on this candidate image block.
  • the candidate image block of the current image block has been encoded, that is, the motion information of the candidate image block is known, so the encoding end can directly obtain the motion information of the candidate image block, such as the candidate There are no restrictions on the motion vector and reference frame index of the image block.
  • Step 202 The encoder obtains a template of the current image block according to the motion information of the candidate image block.
  • Step 203 The encoding end obtains a template-based target motion vector according to the original motion vector corresponding to the current image block and the obtained template, and the target motion vector may be different from the original motion vector.
  • the original motion vector of the current image block may be obtained first.
  • the motion vector list at the encoding end includes motion vector A21, motion vector A31, motion vector A41, and motion vector A51 in sequence.
  • a motion vector can be selected from the motion vector list, and the selected motion vector is the original motion vector of the image block A1.
  • the above manner is only an example, and there is no limitation on this.
  • the default motion vector may be directly determined as the original motion vector.
  • the encoding end selects a motion vector from the motion vector list, which may include: the encoding end selects the first motion vector from the motion vector list; or, selects the last motion vector from the motion vector list; or, selects the motion vector from the motion vector list.
  • a motion vector is randomly selected in the method; or a motion vector is selected from the motion vector list using a hash algorithm.
  • the above method is only a few examples, and there is no limitation on this, as long as the motion vector can be selected from the motion vector list.
  • the motion vector list is used to record a motion vector of an image block adjacent to the current image block. For example, after obtaining the motion vector A21 of the image block A2, the motion vector A21 may be recorded in the motion vector list, and after obtaining the motion vector A31 of the image block A3, the motion vector A31 may be recorded in the motion vector list, so as to By analogy, in the end, the motion vector list of image block A1 can be obtained.
  • Step 204 The encoding end sends an encoded bit stream to the decoding end according to the original motion vector and the target motion vector.
  • the encoding end can obtain the encoding performance of the original motion vector and the encoding performance of the target motion vector.
  • the encoded bit stream corresponding to the current image block sent to the decoding end may carry first indication information, which is used to instruct the decoding end to determine based on the template The final motion vector of the current image block.
  • the encoded bitstream corresponding to the current image block sent to the decoding end may carry second instruction information, and the second instruction information is used to indicate that the The original motion vector determines the final motion vector of the current image block.
  • the foregoing manner is to notify the first indication information or the second indication information in an explicit manner.
  • the notification may also be performed in an implicit manner, that is, the first indication information or the second indication information is not carried in the encoded bit stream.
  • the encoding end and the decoding end can also negotiate a motion vector decision strategy or store the encoding vector and the decoding end by defining a policy in a standard.
  • the motion vector decision strategy may be first strategy information, where the first strategy information is used to indicate that a final motion vector of the current image block is determined based on a template; or, second strategy information, which is used to indicate that the current image block is based on the current image.
  • the original motion vector corresponding to the block determines the final motion vector of the current image block; or, the third policy information indicates that the same policy information as the candidate image block of the current image block is used to determine the final of the current image block.
  • Motion vector may be first strategy information, where the first strategy information is used to indicate that a final motion vector of the current image block
  • the encoded bit stream corresponding to the current image block may not carry the first indication information and the second indication information.
  • the encoded bit stream corresponding to the current image block may not carry the first indication information and the second indication information.
  • the encoded bit stream may not carry the first The indication information and the second indication information; when the neighboring image block adopts the second policy information and the encoding performance of the original motion vector is better than the encoding performance of the target motion vector, the encoded bit stream corresponding to the current image block may not carry the first Instruction information and second instruction information.
  • the encoding end sends the encoded bit stream to the decoding end according to the original motion vector and the target motion vector, and may further include: obtaining an index value of the original motion vector in the motion vector list of the current image block; The encoded bit stream of the index value. For example, if the original motion vector is motion vector A21 and motion vector A21 is the first motion vector in the motion vector list, the index value may be 1.
  • the target motion vector can be obtained based on the original motion vector and the final motion vector of the current image block can be determined based on the target motion vector, instead of determining the final motion vector of the current image block based on the original motion vector, thereby improving the motion vector's Accuracy improves encoding performance.
  • a template of the current image block may be obtained according to the motion information of the candidate image block, and a target motion vector may be obtained according to the template of the current image block.
  • the foregoing method may quickly obtain the current image block. Template, and then obtain the target motion vector based on the template, which can improve decoding efficiency and reduce decoding delay. For example, before the decoding reconstruction phase, a template of the current image block can be obtained, and a target motion vector can be obtained according to the template of the current image block.
  • each image block of each frame of image is encoded one by one.
  • the encoding information of the adjacent image blocks can be used. Reconstruct the current image block.
  • the encoding information of the neighboring image blocks of the current image block may be used to obtain the template of the current image block.
  • the encoding information may include, but is not limited to, reconstruction information of adjacent image blocks and / or prediction information of adjacent image blocks.
  • the reconstruction information may include, but is not limited to, a luminance value, a chrominance value, and the like; the prediction information may be an intermediate value capable of obtaining reconstruction information. For example, if a luminance value can be obtained using the intermediate value A, the intermediate value A is prediction information. This prediction information is not limited.
  • the template generation of the current image block needs to wait until the reconstruction stage, which greatly reduces the decoding efficiency and brings decoding delay; while the encoding information is prediction information, the The generation also needs to wait until the reconstruction stage, which greatly reduces the decoding efficiency and brings decoding delay. Therefore, the above-mentioned method will greatly affect the parallelism of encoding and decoding.
  • a better template generation method is proposed. Different from the method of using reconstruction information and prediction information to generate a template, it can be based on the motion information (such as motion vector) of the candidate image block of the current image block. And reference frame index, etc.)
  • the method of obtaining the template of the current image block, and the method of obtaining the template of the current image block according to the motion information of the candidate image block can be applied at the encoding end and the decoding end.
  • Obtaining a template of the current image block according to the motion information of the candidate image block may include: when the motion information of the candidate image block includes a motion vector of the candidate image block and a reference frame index, determining the candidate image block corresponding to the reference frame index A reference frame image according to the motion vector; obtaining a reference image block corresponding to the candidate image block from the reference frame image according to the motion vector, and obtaining a template of the current image block according to the reference image block.
  • image block A1 is the current image block
  • image block A2 and image block A3 are candidate image blocks of image block A1.
  • image block A2 if the reference frame index of image block A2 is the index of video image B, it can be determined that the reference frame image corresponding to image block A2 is video image B according to the reference frame index; then, select from video image B and Image block B2 corresponding to image block A2, that is, the position of image block B2 in video image B is the same as the position of image block A2 in video image A; then, image block B2 can be moved according to the motion vector of image block A2 For example, if the motion vector (3, 3) is used to move the image block B2 to obtain the image block B2 'corresponding to the image block B2 (such as moving 3 pixels to the right and 3 pixels upward), the image block B2' is the image Reference image block corresponding to block A2.
  • the reference image block corresponding to the image block A3 is the image block B3 '.
  • the template of the image block A2 may be determined according to the image block B2 'and the image block B3', as shown in FIG. 3A.
  • the candidate image block may include M first candidate image blocks and N second candidate image blocks, where M is a natural number greater than or equal to 1, N is a natural number greater than or equal to 0, or M is greater than or A natural number equal to 0, and N is a natural number greater than or equal to 1.
  • the first candidate image block is a candidate image block on the upper side of the current image block
  • the second candidate image block is a candidate image block on the left side of the current image block.
  • Obtaining a template of the current image block according to the motion information of the candidate image block may include, but is not limited to, determining the first template according to the motion vector prediction mode and the motion information of the M first candidate image blocks; and determining the second candidate image block according to the N second candidate image blocks.
  • a motion vector prediction mode and motion information to determine a second template Then, the first template is determined as the template of the current image block; or the second template is determined as the template of the current image block; or the first template and the second template are stitched and determined as the template of the current image block.
  • a first template may be determined according to the motion vector prediction mode and motion information of the M first candidate image blocks, and the first template may be determined as the current image block Template.
  • N is a natural number greater than or equal to 1
  • M is 0, a second template may be determined according to the motion vector prediction mode and motion information of the N second candidate image blocks, and the second template may be determined as a template of the current image block. .
  • a first template may be determined based on the motion vector prediction mode and motion information of the M first candidate image blocks, and according to the N second candidate images Block motion vector prediction mode and motion information, determine the second template, determine the first template as the template of the current image block; or determine the second template as the template of the current image block; or stitch the first template and the second template It is then determined as the template of the current image block.
  • the first candidate image block includes an adjacent image block and / or a second-neighboring image block on the upper side of the current image block; the prediction mode of the adjacent image block is an inter mode or an intra mode; the prediction mode of the second-neighbor image block is Inter mode.
  • the first candidate image block may include at least one adjacent image block whose prediction mode is inter mode, for example, all adjacent image blocks on the upper side of the current image block, or the first adjacent image on the upper side of the current image block. Block, or any one or more adjacent image blocks above the current image block.
  • the first candidate image block may further include at least one second neighboring image block whose prediction mode is the inter mode, for example, on the upper side of the current image block. All neighboring image blocks of, or the first neighboring image block above the current image block, or any one or more neighboring image blocks above the current image block.
  • the first candidate image block may further include adjacent image blocks in the intra mode, for example, in the first frame on the upper side of the current image block. The adjacent image blocks of the mode, the adjacent image blocks of all intra modes on the upper side of the current image block, and so on.
  • the above is only an example of the first candidate image block, which is not limited thereto.
  • the second candidate image block includes an adjacent image block and / or a second-neighboring image block on the left side of the current image block; the prediction mode of the adjacent image block is an inter mode or an intra mode; and the prediction mode of the second-neighbor image block is Inter mode.
  • the second candidate image block may include at least one adjacent image block whose prediction mode is inter mode, for example, all adjacent image blocks to the left of the current image block, or the first adjacent image to the left of the current image block. Block, or any one or more adjacent image blocks to the left of the current image block.
  • the second candidate image block may further include at least one second-neighbor image block with a prediction mode of inter mode, for example, the left side of the current image block All neighboring image blocks of, or the first neighboring image block to the left of the current image block, or any one or more neighboring image blocks to the left of the current image block.
  • the second candidate image block may further include adjacent image blocks in the intra mode, for example, in the first frame on the left side of the current image block. The neighboring image blocks of the pattern, the neighboring image blocks of all intra modes on the left side of the current image block, and so on.
  • the above is only an example of the second candidate image block, which is not limited.
  • the adjacent image blocks of the current image block include, but are not limited to, spatially adjacent image blocks of the current image block (that is, adjacent image blocks in the same frame of image); or time-domain adjacent image blocks of the current image block ( (Ie, adjacent image blocks in different frame images).
  • the second-neighbor image block of the current image block includes, but is not limited to, the spatially-neighbor image block of the current image block (that is, the second-neighbor image block in the same frame image); or the time-domain next-neighbor image block of the current image block (that is, different The next-most neighboring image block in the frame image).
  • the first template when M is greater than 1, the first template may include M sub-templates or P sub-templates, and is stitched from M sub-templates or P sub-templates, and P may be the first candidate image block of the inter-frame mode. , P is less than or equal to M.
  • the first template when the M first candidate image blocks are all candidate image blocks of the inter mode, the first template may include M sub-templates, and the M sub-templates are stitched together.
  • the M first candidate image blocks include P inter-mode candidate image blocks and include MP intra-mode candidate image blocks
  • the first template when the M first candidate image blocks include P inter-mode candidate image blocks and include MP intra-mode candidate image blocks, the first template may include M sub-templates (that is, each candidate image Block corresponds to one sub-template) and is composed of M sub-templates.
  • the first template may include P sub-templates (that is, P sub-templates corresponding to P inter-mode candidate image blocks), and the P
  • the first template may include a first sub-template, which may be determined according to a motion vector prediction mode and motion information of a first candidate image block on the upper side of the current image block; or The first sub-template may be determined according to a motion vector prediction mode and motion information of any candidate image block on the upper side of the current image block.
  • the first candidate image block includes at least one neighboring image block or a second neighboring image block whose prediction mode is the inter mode
  • the first template includes the neighboring image blocks of the inter mode or The first sub-template corresponding to the next neighboring image block.
  • the motion information may include a motion vector and a reference frame index of the first candidate image block.
  • the first template is determined according to the motion vector prediction mode and motion information of the M first candidate image blocks, and may include: not limited to:
  • Case 1 For the i-th candidate image block among the M first candidate image blocks, when it is determined that the motion vector prediction mode of the i-th candidate image block is an inter mode, the reference frame of the i-th candidate image block is used The index determines the reference frame image corresponding to the i-th candidate image block; according to the motion vector of the i-th candidate image block, the reference image block corresponding to the i-th candidate image block is determined from the reference frame image, and the reference image block and the first The relative position offset of the i candidate image blocks matches the motion vector of the ith candidate image block; then, according to the determined reference image block, an image block having a size of the first horizontal length and the first vertical length can be obtained as
  • the first template includes an i-th sub-template.
  • Case 2 For the i-th candidate image block among the M first candidate image blocks, when it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode, the i-th candidate image block is set to a default value (Such as the default pixel value, which can be a brightness value that is pre-configured based on experience) padding, based on the image blocks filled with the default values, to obtain image blocks of the first horizontal length and the first vertical length as the i-th included in the first template Child templates.
  • a default value Such as the default pixel value, which can be a brightness value that is pre-configured based on experience
  • Case 3 For the i-th candidate image block among the M first candidate image blocks, when it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode, according to the reference frame corresponding to the i-th candidate image block The index determines the reference frame image corresponding to the i-th candidate image block; and determines the reference image block corresponding to the i-th candidate image block from the reference frame image according to the motion vector corresponding to the i-th candidate image block.
  • the relative position offset of the candidate image blocks matches the motion vector corresponding to the i-th candidate image block (for example, equal or approximately equal); according to the determined reference image block, the size is obtained as the first horizontal length and the first vertical length
  • the image block as the i-th sub-template included in the first template; wherein the reference frame index and motion vector corresponding to the i-th candidate image block are reference frame indices and motion vectors of neighboring image blocks of the i-th candidate image block .
  • the first horizontal length and the horizontal length of the first candidate image block satisfy a first proportional relationship (such as 1: 1, 1: 2, 2: 1, etc., which is not limited), or the horizontal length of the current image block Meet the second proportional relationship (such as 1: 1, 1: 2, 2: 1, etc.), or be equal to the first preset length (configured according to experience).
  • a first proportional relationship such as 1: 1, 1: 2, 2: 1, etc., which is not limited
  • the horizontal length of the current image block Meet the second proportional relationship (such as 1: 1, 1: 2, 2: 1, etc.), or be equal to the first preset length (configured according to experience).
  • the first vertical length and the vertical length of the first candidate image block satisfy a third proportional relationship (such as 1: 1, 1: 2, 2: 1, etc.), or the vertical length of the current image block satisfies a fourth proportional relationship ( (Such as 1: 1, 1: 2, 2: 1, etc.), or equal to a second preset length (that is, a length configured according to experience).
  • a third proportional relationship such as 1: 1, 1: 2, 2: 1, etc.
  • a fourth proportional relationship (Such as 1: 1, 1: 2, 2: 1, etc.), or equal to a second preset length (that is, a length configured according to experience).
  • the first proportional relationship, the second proportional relationship, the third proportional relationship, and the fourth proportional relationship may be set to be the same or different.
  • the first preset length and the second preset length may be set to be the same or different.
  • the second template when N is greater than 1, may include N sub-templates or R sub-templates, and is spliced from N sub-templates or R sub-templates, and R may be a second candidate image block of the inter-frame mode. Number, R is less than or equal to N.
  • the second template when the N second candidate image blocks are all candidate image blocks in the inter mode, the second template may include N sub-templates, and is formed by splicing the N sub-templates.
  • the second template may include N sub-templates (that is, each candidate image Block corresponds to one sub-template) and is formed by splicing N sub-templates, or the second template may include R sub-templates (that is, R sub-templates corresponding to R inter-frame mode candidate image blocks), and is spliced by R sub-templates Made.
  • the second template may include a second sub-template, which may be determined according to a motion vector prediction mode and motion information of a first candidate image block on the left side of the current image block; or The second sub-template may be determined according to a motion vector prediction mode and motion information of any candidate image block on the left side of the current image block.
  • the second candidate image block since the second candidate image block includes at least one neighboring image block or the next neighboring image block whose prediction mode is the inter mode, when N is equal to 1, the second template includes the neighboring image blocks of the inter mode or The second sub-template corresponding to the next-neighbor image block.
  • the motion information may include a motion vector and a reference frame index of the second candidate image block.
  • the second template is determined according to the motion vector prediction mode and motion information of the N second candidate image blocks, and may include: not limited to:
  • Case 1 For the i-th candidate image block of the N second candidate image blocks, when it is determined that the motion vector prediction mode of the i-th candidate image block is an inter mode, the i-th candidate image is determined according to the reference frame index Reference frame image corresponding to the block; according to the motion vector of the i-th candidate image block, a reference image block corresponding to the i-th candidate image block is determined from the reference frame image, and the relative of the reference image block to the i-th candidate image block The position offset matches the motion vector of the i-th candidate image block; then, according to the determined reference image block, an image block having a size of the second horizontal length and the second vertical length can be obtained as the i-th included in the second template Child templates.
  • Case 2 For the i-th candidate image block of the N second candidate image blocks, when it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode, the i-th candidate image block is set to a default value (Such as the default pixel value, which can be a brightness value pre-configured according to experience) padding, based on the image blocks filled with the default values, to obtain image blocks of the second horizontal length and the second vertical length as the i-th included in the second template Child templates.
  • a default value Sud as the default pixel value, which can be a brightness value pre-configured according to experience
  • Case 3 For the i-th candidate image block of the N second candidate image blocks, when it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode, according to the reference frame corresponding to the i-th candidate image block The index determines the reference frame image corresponding to the i-th candidate image block; and determines the reference image block corresponding to the i-th candidate image block from the reference frame image according to the motion vector corresponding to the i-th candidate image block.
  • the relative position offset of the candidate image blocks matches the motion vector corresponding to the i-th candidate image block (for example, equal or approximately equal); according to the determined reference image block, the size is obtained as the second horizontal length and the second vertical length
  • the image block as the i-th sub-template included in the second template; wherein the reference frame index and motion vector corresponding to the i-th candidate image block are reference frame indices and motion vectors of neighboring image blocks of the i-th candidate image block .
  • the second horizontal length and the horizontal length of the second candidate image block satisfy a fifth proportional relationship (such as 1: 1, 1: 2, 2: 1, etc., which is not limited), or the horizontal length of the current image block Meet the sixth proportional relationship (such as 1: 1, 1: 2, 2: 1, etc.), or be equal to the third preset length (configured according to experience).
  • a fifth proportional relationship such as 1: 1, 1: 2, 2: 1, etc., which is not limited
  • the horizontal length of the current image block Meet the sixth proportional relationship (such as 1: 1, 1: 2, 2: 1, etc.), or be equal to the third preset length (configured according to experience).
  • the second vertical length and the vertical length of the second candidate image block satisfy a seventh proportional relationship (such as 1: 1, 1: 2, 2: 1, etc.), or the vertical length of the current image block satisfies an eighth proportional relationship ( (Such as 1: 1, 1: 2, 2: 1, etc.), or equal to the fourth preset length (that is, a length configured according to experience).
  • the fifth proportional relationship, the sixth proportional relationship, the seventh proportional relationship, and the eighth proportional relationship may be set to be the same or different.
  • the third preset length and the fourth preset length may be set to be the same or different.
  • obtaining the template of the current image block according to the motion information of the candidate image block may further include but is not limited to: when the current image block corresponds to multiple motion information (including the original motion vector of the current image block), according to each The motion information acquires a template corresponding to the motion information.
  • a weight corresponding to each motion information is obtained, and a template of the current image block is obtained according to the weight corresponding to each motion information and the template corresponding to the motion information. For example, based on the weight corresponding to each motion information and the template corresponding to the motion information, a template of the current image block is obtained based on a weighted average method.
  • the current image block corresponds to the motion information A and the motion information B
  • the template TA corresponding to the motion information A is obtained by using the foregoing embodiment
  • the template TB corresponding to the motion information B is obtained by using the foregoing embodiment.
  • the weight W1 of the motion information A and the weight W2 of the motion information B can be obtained.
  • the template of the current image block can be (TA * W1 + TB * W2) / 2.
  • the candidate image block may include adjacent image blocks of all inter-modes on the upper side of the current image block, and adjacent image blocks of all inter-modes on the left side of the current image block.
  • the image block A3 and image block A4 in the inter mode can be determined as Candidate image block for current image block A1.
  • the image block A2 in the inter mode can be determined as a candidate image block of the current image block A1.
  • the technical solution of this embodiment is no longer adopted, but a conventional method is adopted, and details are not described herein again. If the current image block A1 has candidate image blocks, such as the left candidate image block and / or the upper candidate image block, the technical solution of this embodiment is adopted.
  • the candidate image blocks are the image block A2, the image block A3, and the image block A4, it can be obtained according to the motion information of the image block A2, the motion information of the image block A3, and the motion information of the image block A4.
  • a reference frame image corresponding to the image block A2 may be determined according to the reference frame index.
  • An image block B2 corresponding to the image block A2 is selected from the reference frame image, and the image block B2 is selected according to the motion vector of the image block A2. Move to obtain the reference image block B2 'corresponding to the image block A2.
  • the reference image block B3' corresponding to the image block A3 and the reference image block B4 'corresponding to the image block A4 can be obtained, as shown in FIG. 3C. . Then, a template of the current image block A1 can be obtained from the reference image block B2 ', the reference image block B3', and the reference image block B4 '.
  • the horizontal length of the upper template of the current image block A1 is W and the vertical length is S.
  • the value of W can be configured based on experience, the value of S can be configured according to experience, and the values of W and S are both No restrictions.
  • W may be the horizontal length of the current image block A1, the horizontal length of the candidate image block A2, twice the horizontal length of the current image block A1, etc.
  • S may be the vertical length of the candidate image block A2, and is a candidate image block A2 is 1/3 of the longitudinal length.
  • FIG. 3D a template corresponding to the reference image block B2 'is shown. In FIG.
  • W is taken as the horizontal length of the candidate image block A2 as an example, that is, W is the horizontal length of the reference image block B2 ′;
  • S is taken as the 1/3 of the longitudinal length of the candidate image block A2 as an example, that is, S is 1/3 of the longitudinal length of the reference image block B2 '.
  • the horizontal length of the template on the left side of the current image block A1 is R and the vertical length is H.
  • the value of R can be configured based on experience, and the value of H can be configured based on experience.
  • H may be the vertical length of the current image block A1, the vertical length of the candidate image block A3, R may be the horizontal length of the candidate image block A3, and 1/3 of the horizontal length of the candidate image block A3.
  • a template corresponding to the reference image block B3 ' is shown, with H as the vertical length of the candidate image block A3 as an example, and R as the 1/3 of the horizontal length of the candidate image block A3 as example.
  • the template corresponding to the reference image block B4 'can also be referred to as shown in FIG. 3D, which is not repeated here.
  • the prediction mode of the candidate image block is determined.
  • the sub-template is no longer generated, or it is filled according to the default value (such as the default pixel value, which can be a brightness value pre-configured according to experience), and is used as the ith sub-template of the upper template (the first template).
  • the default value such as the default pixel value, which can be a brightness value pre-configured according to experience
  • the motion information (such as a motion vector and a reference frame index) of the i-th candidate image block is obtained, and a template with a horizontal length w i and a vertical length S is generated based on the motion vector and the reference frame index.
  • a template with a horizontal length w i and a vertical length S is generated based on the motion vector and the reference frame index.
  • the i-th sub-template of the upper template Specifically, if the motion vector is MV and the reference frame index is idx, then in the idx reference image of the current frame, a rectangular block with a relative position offset of MV and a horizontal length of w i and a vertical length of S is taken as the above.
  • the i-th child template of the side template is taken as the above.
  • the i-th candidate for the image block, i H is assumed that the longitudinal length, lateral length is R, the determined prediction mode candidate image block.
  • the sub-template is no longer generated, or it is filled according to the default value (such as the default pixel value, which can be a brightness value pre-configured according to experience), and is used as the i-th sub-template of the left template (second template).
  • the default value such as the default pixel value, which can be a brightness value pre-configured according to experience
  • the motion information is acquired i-th candidate image blocks (e.g., motion vector and reference frame index, etc.), to generate a transverse length R based on the motion vector and the reference frame index, the longitudinal length of template h i As the i-th child template of the template on the left.
  • the motion vector is MV
  • the reference frame index idx find the relative positions of the lateral offset is MV length R, a longitudinal length of a rectangular block of idx h i in the reference image of the current frame, as the left The i-th child template of the side template.
  • the upper template can be stitched from all the sub templates on the upper side
  • the left template can be stitched from all the sub templates on the left
  • the upper template and the left template are stitched into the template of the current image block.
  • the candidate image block may include a neighboring image block of the first inter mode on the upper side of the current image block, and a neighboring image block of the first inter mode on the left of the current image block.
  • the image block A3 may be determined as a candidate image block of the current image block A1. If the first image block A2 on the upper side is in an inter mode, the image block A2 may be determined as a candidate image block of the current image block A1.
  • the current image block A1 has no candidate image blocks.
  • the technical solution of this embodiment is no longer adopted, but a conventional method is adopted, and details are not described herein again. If the current image block A1 has candidate image blocks, such as the left candidate image block and / or the upper candidate image block, the technical solution of this embodiment is adopted.
  • the template of the current image block A1 can be obtained according to the motion information of the image block A2 and the motion information of the image block A3.
  • the reference frame image corresponding to the image block A2 may be determined according to the reference frame index
  • the image block B2 corresponding to the image block A2 is selected from the reference frame image
  • the image block B2 is moved according to the neighboring motion vector of the image block A2 to obtain
  • the reference image block B2 'corresponding to the image block A2 can be obtained by the same way.
  • the reference image block B3' corresponding to the image block A3 can be obtained, and a template can be obtained according to the reference image block B2 'and the reference image block B3'.
  • the horizontal length of the upper template of the current image block A1 is W and the vertical length is S.
  • the value of W can be configured based on experience, the value of S can be configured according to experience, and the values of W and S are both No restrictions.
  • W may be the horizontal length of the current image block A1, the horizontal length of the candidate image block A2, S may be the vertical length of the candidate image block A2, and 1/3 of the vertical length of the candidate image block A2.
  • FIG. 3F a template corresponding to the reference image block B2 'is shown.
  • the horizontal length of the template on the left side of the current image block A1 is R and the vertical length is H.
  • the value of R can be configured based on experience, and the value of H can be configured based on experience.
  • H may be the vertical length of the current image block A1, the vertical length of the candidate image block A3, etc.
  • R may be the horizontal length of the candidate image block A3, and 1/3 of the horizontal length of the candidate image block A3, and so on.
  • FIG. 3F a template corresponding to the reference image block B3 'is shown.
  • the candidate image is judged The prediction mode of the block. If it is in the intra mode, the template is no longer generated, or it is filled according to the default value (such as the default pixel value, which may be a brightness value pre-configured according to experience), and used as the upper template. If it is in the inter mode, the motion information (such as the motion vector and the reference frame index) of the candidate image block is obtained, and a template with a horizontal length of w and a vertical length of S is generated based on the motion vector and the reference frame index as an upper template. .
  • the default value such as the default pixel value, which may be a brightness value pre-configured according to experience
  • the prediction mode of the candidate image block is determined. If it is in the intra mode, the template is no longer generated, or it is filled according to the default value as the left template.
  • motion information such as a motion vector and a reference frame index
  • a template having a horizontal length of R and a vertical length of h is generated based on the motion vector and the reference frame index as a left-side template.
  • the candidate image block may include a neighboring image block of the first inter mode on the upper side of the current picture block, and a neighboring image block of the first inter mode on the left of the current picture block.
  • the lateral length W of the upper template of the current image block A1 is set to the horizontal length of the current image block A1, and the left side of the current image block A1
  • the vertical length H of the template is set to the vertical length of the current image block A1.
  • the candidate image block may include the adjacent image block in the inter mode on the upper side of the current image block, and the next adjacent image block in the inter mode on the upper side of the current image block (that is, when the adjacent image block is in the intra mode, select The adjacent image block corresponds to the current image block that is the second-neighboring image block), the adjacent image block in the inter mode on the left side of the current image block, and the second-neighbor image block on the left side of the current image block.
  • the image block A3 and the image block A4 in the inter mode can be determined.
  • the image block A2 in the inter mode can be determined as a candidate image block of the current image block A1.
  • image block A7 there are adjacent image blocks in the intra mode on the left, such as image block A7, and there is an image block A8 in the inter mode on the left of image block A7, that is, image block A8 is the next-to-adjacent image block on the left of the current image block A1. Therefore, the image block A8 in the inter mode can be determined as a candidate image block of the current image block A1.
  • image block A5 there are adjacent image blocks in the intra mode on the upper side, such as image block A5, and there is an image block A6 in the inter mode on the upper side of image block A5, that is, image block A6 is the next-neighbor image on the upper side of the current image block A1. Therefore, the image block A6 in the inter mode can be determined as a candidate image block of the current image block A1.
  • the candidate image block is an image block A2, an image block A3, an image block A4, an image block A6, and an image block A8, according to the motion information of the image block A2, the motion information of the image block A3, the motion information of the image block A4, Obtain the template of the current image block A1 from the motion information of the image block A6 and the motion information of the image block A8.
  • the template is obtained based on the motion information of the image block A6 and the motion information of the image block A8. This is not repeated here, and the template is finally shown in FIG. 3I.
  • the candidate image block may include the current image block The next neighboring image block in the inter mode.
  • the candidate image block may include the current image block left The next neighboring image block of the inter-frame mode.
  • the image block A4 in the inter mode can be determined as a candidate image block of the current image block A1.
  • the image block A5 in the inter mode may be determined as a candidate image block of the current image block A1.
  • the template of the current image block A1 can be obtained according to the motion information of the image block A4 and the motion information of the image block A5. For details, please refer to Cases 2 and 3. The details are not repeated here, and the template is finally shown in FIG. 3K or FIG. 3L.
  • the candidate image block may include an adjacent image block in an inter mode on the upper side of the current image block, an adjacent image block in an intra mode on the upper side of the current image block, and an adjacent inter mode in the left side of the current image block.
  • the image block A3 and the image block A4 in the inter mode can be determined.
  • the image block A2 in the inter mode can be determined as a candidate image block of the current image block A1.
  • image block A7 There are adjacent image blocks in the intra mode on the left, such as image block A7.
  • the image block A7 in the intra mode can be determined as a candidate image block of the current image block A1.
  • the image block A5 in the intra mode can be determined as a candidate image block of the current image block A1.
  • the candidate image block is an image block A2, an image block A3, an image block A4, an image block A5, and an image block A7, according to the motion information of the image block A2, the motion information of the image block A3, the motion information of the image block A4, For the motion information of image block A5 and the motion information of image block A7, obtain the template of the current image block A1.
  • the template is obtained based on the motion information of image block A5 and the motion information of image block A7. This is not repeated here, and the template is finally shown in FIG. 3M.
  • a template when obtaining a template based on the motion information of image block A5, since image block A5 is in the intra mode and does not have motion information, the neighboring image blocks of image block A5 (that is, image block A6) The motion information is determined as the motion information of the image block A5. After the motion information of the image block A5 is obtained, a template can be obtained by using the motion information of the image block A5. For details, see Case 1.
  • the motion information of the adjacent image block (that is, the image block A8) of the image block A7 can be determined. Is the motion information of the image block A5, and the template is obtained by using the motion information of the image block A5.
  • the candidate image block may include the current image block Adjacent image blocks of the first intra mode on the upper side.
  • the candidate image block may include the current image block left Adjacent image blocks of the first intra mode on the side.
  • the image block A2 in the intra mode is determined as Candidate image block for current image block A1. If the first image block A3 on the left side is in the intra mode, and the image block A5 in the inter mode exists on the left side of the image block A3, the image block A3 in the intra mode is determined as a candidate image block of the current image block A1.
  • the template of the current image block A1 can be obtained according to the motion information of the image block A2 and the motion information of the image block A3.
  • the template is finally shown in FIG. 3N or 3O.
  • the neighboring image blocks of image block A2 (that is, image block A4)
  • the motion information is determined as the motion information of the image block A2, and a template is obtained using the motion information of the image block A2.
  • the motion information of an adjacent image block of the image block A3 (that is, the image block A5) can be determined as an image block A3's motion information, and use the motion information of image block A3 to obtain a template.
  • step 203 the encoding end obtains the target motion vector based on the template according to the original motion vector corresponding to the current image block and the obtained template.
  • the implementation process can be shown in FIG. 4A and can include:
  • Step 401 The encoding end determines the original motion vector as a central motion vector.
  • Step 402 The encoding end determines an edge motion vector corresponding to the central motion vector.
  • the edge motion vector may be different from the center motion vector.
  • the determining of the edge motion vector corresponding to the central motion vector by the encoding end may include: moving the central motion vector (x, y) by an offset S in different directions, thereby obtaining edge motion vectors (xS, y) in different directions. ), Edge motion vector (x + S, y), edge motion vector (x, y + S), edge motion vector (x, yS).
  • the center motion vector (x, y) can be shifted to the left by an offset S to obtain the edge motion vector (xS, y); in the horizontal direction, the center motion vector (x, y) can be Move the offset S to the right to get the edge motion vector (x + S, y); in the vertical direction, you can move the center motion vector (x, y) up by the offset S to get the edge motion vector (x, y) + S); in the vertical direction, the center motion vector (x, y) can be shifted downward by the offset S to obtain the edge motion vector (x, yS).
  • the initial value of the offset S can be configured according to experience, for example, it can be 2, 4, 8, 16, and so on.
  • the edge motion vector is the edge motion vector (7, 3), the edge motion vector (3, 7), and the edge motion vector (-1, 3). , Edge motion vector (3, -1).
  • Step 403 The encoder obtains the encoding performance of the central motion vector according to the template of the current image block, and obtains the encoding performance of the edge motion vector according to the template of the current image block.
  • Case 1 The encoding end obtains the encoding performance of the central motion vector according to the template of the current image block, which may include, but is not limited to, determining the encoding of the central motion vector according to the parameter information of the template of the current image block and the parameter information of the first target reference block.
  • the first target reference block may be an image block obtained after the reference image block corresponding to the template is offset based on the central motion vector.
  • the encoding end may determine the prediction performance of the center motion vector according to the parameter information of the template and the parameter information of the first target reference block, and determine the encoding performance of the center motion vector according to the prediction performance of the center motion vector.
  • the prediction performance and the actual number of bits required for encoding determine the encoding performance of the central motion vector.
  • the foregoing parameter information may be a brightness value; or may be a brightness value and a chrominance value.
  • the brightness value of the template of the current image block and the brightness value of the first target reference block may be obtained first. For example, after obtaining the template of the current image block, the brightness value of each pixel of the template can be obtained, and the reference image block of the template can be obtained.
  • the central motion vector ( 3, 3) Move the reference image block to obtain an image block X corresponding to the reference image block (for example, move the reference image block to the right by 3 pixels and move it upward by 3 pixels, and record the processed image block as an image Block X), and the image block X is the first target reference block, and the brightness value of each pixel of the image block X can be obtained.
  • the prediction performance of the central motion vector can be determined using the following formula:
  • SAD is the sum of available absolute differences used to represent the prediction performance of the central motion vector.
  • TM i represents the brightness value of the i-th pixel of the template
  • TMP i represents the brightness value of the i-th pixel of the image block X
  • M represents the total number of pixels.
  • the parameter information is a luminance value and a chrominance value
  • the following formula is used to determine the brightness value prediction performance SAD of the central motion vector
  • the average of the luma value prediction performance SAD and the chroma value prediction performance CSAD is the prediction performance of the center motion vector.
  • CSAD is the sum of the available absolute differences, which is used to represent the chrominance value prediction performance of the central motion vector
  • CTM i represents the chrominance value of the i-th pixel point of the template
  • CTMP i represents the chrominance of the i-th pixel point of the image block X Value
  • M c represents the total number of pixels.
  • the encoding performance of the center motion vector may be determined according to the prediction performance and the actual number of bits required for encoding.
  • RDO Rate Distortion Optimized, Rate-Distortion Principle
  • J encoding performance
  • D prediction performance
  • a Lagrangian multiplier, which is a numerical value configured according to experience
  • R is an actual number of bits required for image block encoding, that is, a sum of bits of information carried by an encoded bit stream.
  • the encoder obtains the encoding performance of the edge motion vector according to the template of the current image block, which may include, but is not limited to, determining the encoding of the edge motion vector according to the parameter information of the template of the current image block and the parameter information of the second target reference block.
  • the second target reference block may be an image block obtained after the reference image block corresponding to the template is offset based on the edge motion vector.
  • the encoding end may determine the prediction performance of the edge motion vector according to the parameter information of the template and the parameter information of the second target reference block, and determine the encoding performance of the center motion vector according to the prediction performance of the edge motion vector; for example, it may be based on the The prediction performance and the actual number of bits required for encoding determine the encoding performance of the edge motion vector.
  • the foregoing parameter information may be a brightness value; or may be a brightness value and a chrominance value.
  • Case 2 is similar to Case 1, except that in Case 2, the reference image block of the template is moved using the edge motion vector to obtain the second target reference block, and the encoding performance of the edge motion vector is obtained using the second target reference block.
  • the reference image block of the template is moved using the central motion vector to obtain a first target reference block, and the coding performance of the central motion vector is obtained using the first target reference block.
  • Step 404 The encoding end determines a target motion vector from the center motion vector and the edge motion vector according to the encoding performance of the center motion vector and the edge motion vector.
  • the encoding end may select a motion vector with the best encoding performance from the center motion vector and the edge motion vector.
  • the motion vector with the best encoding performance may be determined. Is the target motion vector; when the motion vector with the best encoding performance is the original motion vector, the encoding end can select the motion vector with the best encoding performance from the center motion vector and the edge motion vector, and the motion vector with the best encoding performance Determined as the target motion vector.
  • the encoding end may determine the edge motion vector (7, 3) as the target motion vector. If the motion vector with the best coding performance is the center motion vector of (3, 3), that is, the original motion vector, the coding end can also use the motion vector with the best coding performance (such as the edge motion vector (7, 3), etc.) Determined as the target motion vector.
  • Embodiment 4 is a diagrammatic representation of Embodiment 4:
  • step 203 the encoding end obtains the target motion vector based on the template according to the original motion vector corresponding to the current image block and the obtained template.
  • the implementation process can be shown in FIG. 4A and can include:
  • Step 411 The encoding end determines the original motion vector as the central motion vector.
  • Step 412 The encoding end determines an edge motion vector corresponding to the central motion vector.
  • the edge motion vector may be different from the center motion vector.
  • Step 413 The encoder obtains the encoding performance of the central motion vector according to the template of the current image block, and obtains the encoding performance of the edge motion vector according to the template of the current image block.
  • steps 411 to 413 reference may be made to steps 401 to 403, and details are not described herein again.
  • Step 414 The encoder determines whether the iteration end condition of the target motion vector is satisfied.
  • step 416 If yes, go to step 416; if not, go to step 415.
  • the iteration end condition may include, but is not limited to, the number of iterations reaching the number threshold, or the execution time reaching the time threshold, or the offset parameter S has been modified to a preset value, such as 1.
  • Step 415 The encoder selects a motion vector with the best coding performance from the center motion vector and the edge motion vector, determines the motion vector with the best coding performance as a new center motion vector, and returns to step 412.
  • the edge motion vector (7, 3) may be determined as the new central motion vector, and step 412 is performed again, and so on.
  • the value of the offset parameter S may be an initial value, such as 16.
  • the value of the offset parameter S is adjusted first, such as adjusted to the last offset parameter S minus 2, or adjusted to half of the last offset parameter S, etc.
  • the value of the offset parameter S is 8; when step 412 is executed for the third time, the value of the offset parameter S is 4; and so on.
  • step 412 After adjusting the value of the offset parameter S, it is first determined whether the adjusted offset parameter S is less than or equal to a preset value, such as 1. If not, step 412 may be performed based on the adjusted offset parameter S, and the process is not described again. If yes, the value of the offset parameter S can be set to 1, and step 412 is performed based on the offset parameter S (that is, the value 1), and when the execution proceeds to step 414, the judgment result is that the end of the iteration is satisfied condition.
  • a preset value such as 1.
  • Step 416 The encoding end determines the target motion vector from the center motion vector and the edge motion vector according to the encoding performance of the center motion vector and the edge motion vector.
  • step 416 For the processing in step 416, refer to step 404, and details are not described herein again.
  • Embodiment 5 is a diagrammatic representation of Embodiment 5:
  • the encoding performance of the original motion vector and the encoding performance of the target motion vector may be obtained.
  • the encoding end obtains the encoding performance of the original motion vector, which may include but is not limited to: according to the parameter information of the template of the current image block and the third target
  • the parameter information of the reference block determines the encoding performance of the original motion vector.
  • the third target reference block is an image block obtained after the reference image block corresponding to the template is offset based on the original motion vector.
  • the prediction performance of the original motion vector may be determined according to the parameter information of the template and the parameter information of the third target reference block, and the encoding performance of the original motion vector may be determined according to the prediction performance; for example, according to the prediction performance and encoding requirements
  • the actual number of bits determines the encoding performance of the original motion vector.
  • the foregoing parameter information may be a brightness value; or a brightness value and a chrominance value.
  • the encoding end obtains the encoding performance of the target motion vector, which may include but is not limited to: determining the encoding performance of the target motion vector according to the parameter information of the template of the current image block and the parameter information of the fourth target reference block, where the fourth target reference block is a template
  • the corresponding reference image block is an image block obtained after the target motion vector is shifted.
  • the prediction performance of the target motion vector may be determined according to the parameter information of the template and the parameter information of the fourth target reference block, and the encoding performance of the target motion vector may be determined according to the prediction performance; for example, according to the prediction performance and encoding requirements
  • the actual number of bits determines the encoding performance of the target motion vector.
  • the foregoing parameter information may be a brightness value; or a brightness value and a chrominance value.
  • the above process is similar to the third embodiment, except that when the third target reference block or the fourth target reference block is obtained, the reference image block of the template is moved using the original motion vector or the target motion vector, instead of using the central motion vector to move the template.
  • the reference image blocks are not repeated here.
  • Embodiment 6 is a diagrammatic representation of Embodiment 6
  • the method may include:
  • Step 501 The decoder obtains motion information of a candidate image block of the current image block.
  • the candidate image block of the current image block may include, but is not limited to, a spatial-domain candidate image block of the current image block; or a time-domain candidate image block of the current image block; there is no limitation on this candidate image block.
  • Step 502 The decoder obtains a template of the current image block according to the motion information of the candidate image block.
  • the method for the decoder to obtain the template of the current image block according to the motion information of the candidate image block is the same as that of the encoder.
  • the method for the decoder to obtain the template of the current image block according to the motion information of the candidate image block is the same as that of the encoder.
  • Step 503 The decoding end obtains a template-based target motion vector according to the original motion vector corresponding to the current image block and the obtained template, and the target motion vector may be different from the original motion vector.
  • the decoding end may also obtain the encoded bit stream of the current image block.
  • the encoded bit stream may be sent by the encoding end or the decoding end. It is obtained after encoding the bit stream, and there is no limitation on this.
  • the encoding end sends the encoded bit stream as an example.
  • the decoding end may receive an encoded bit stream from the encoding end.
  • the encoded bit stream carries first indication information
  • the first indication information is used to indicate that the final motion vector of the current image block is determined based on the template.
  • the decoding end may receive an encoded bit stream from the encoding end, and when the encoded bit stream carries second indication information, the second indication information is used to indicate that the final motion vector of the current image block is determined based on the original motion vector corresponding to the current image block. , Obtaining an original motion vector corresponding to the current image block according to the second instruction information, and determining a final motion vector of the current image block according to the original motion vector.
  • the foregoing manner is to notify the first indication information or the second indication information in an explicit manner.
  • the notification may also be performed in an implicit manner, that is, the encoded bitstream does not carry the first indication information or the second indication information.
  • the decoder can determine the method of acquiring the final motion vector of the current image block according to the motion vector decision strategy agreed with the encoder.
  • the decoding end may obtain the motion information of the candidate image block of the current image block according to the locally preset first policy information, and obtain the template of the current image block according to the motion information of the candidate image block.
  • the first policy information is used to indicate The template determines the final motion vector of the current image block; or, the original motion vector corresponding to the current image block can be obtained according to the locally preset second strategy information; the final motion vector of the current image block is determined based on the original motion vector, and the second strategy
  • the information is used to indicate that the final motion vector of the current image block is determined based on the original motion vector corresponding to the current image block; or, third strategy information may be obtained, which indicates that the same strategy as that of the adjacent image block of the current image block is adopted
  • the information determines the final motion vector of the current image block; then, according to the third policy information, the final motion vector of the current image block is determined.
  • the encoding end and the decoding end can negotiate a motion vector decision strategy or store the encoding end and the decoding end by defining a policy in a standard.
  • the motion vector decision strategy can be agreed first strategy information; or agreed second strategy information; or Agree on the third strategy information.
  • the motion vector decision strategy is the agreed first strategy information
  • the motion information of the candidate image block of the current image block is obtained according to the locally preset first strategy information
  • the template of the current image block is obtained according to the motion information of the candidate image block.
  • the motion vector decision strategy is the agreed second policy information
  • the original motion vector corresponding to the current image block is obtained according to the locally preset second policy information
  • the final motion vector of the current image block is determined according to the original motion vector
  • the motion vector decision strategy is the third strategy information
  • the strategy information of the neighboring image block of the current image block is the first strategy information
  • the motion information of the candidate image block of the current image block is obtained, and the motion information of the candidate image block is obtained according to the motion information of the candidate image block.
  • the decoding end may also receive an encoded bit stream from the encoding end.
  • the encoded bit stream carries the original motion vector in The index value in the motion vector list; the decoder can select a motion vector corresponding to the index value from the motion vector list; and determine the selected motion vector as the original motion vector corresponding to the current image block. If the index value is 1, the first motion vector of the motion vector list is obtained, and the motion vector is the original motion vector of the current image block.
  • the motion vector list is used to record the motion vectors of image blocks adjacent to the current image block.
  • the motion vector list maintained by the decoder is the same as the motion vector list maintained by the encoder.
  • the above manner is only an example.
  • the motion vector of the candidate image block of the current image block may be determined as the original motion vector corresponding to the current image block.
  • the decoding end obtains a template-based target motion vector based on the original motion vector corresponding to the current image block and the obtained template.
  • Step 504 The decoding end determines the final motion vector of the current image block according to the target motion vector.
  • the target motion vector may be determined as the final motion vector of the current image block.
  • the target motion vector can be obtained based on the original motion vector and the final motion vector of the current image block can be determined based on the target motion vector, instead of directly determining the final motion vector of the current image block based on the original motion vector, thereby improving the motion vector. Accuracy, improving decoding performance.
  • a template of the current image block can be obtained according to the motion information of the candidate image block, and the target motion vector is obtained based on the template of the current image block based on the original motion vector; the above method can quickly obtain the current The template of the image block, and then obtaining the target motion vector according to the template, can improve the decoding efficiency and reduce the decoding delay.
  • a template of the current image block can be obtained, and a target motion vector can be obtained according to the template.
  • Embodiment 7 is a diagrammatic representation of Embodiment 7:
  • a template of the current image block may be obtained according to motion information (such as a motion vector and a reference frame index) of a candidate image block of the current image block.
  • the decoding end may then determine a reference frame image corresponding to the candidate image block according to the reference frame index; obtain a reference image block corresponding to the candidate image block from the reference frame image according to the motion vector, and according to the reference image Block to get the template of the current image block.
  • the candidate image block may include M first candidate image blocks and N second candidate image blocks, where M is a natural number greater than or equal to 1, N is a natural number greater than or equal to 0, or M is a greater than or equal to 0 Natural numbers, N is a natural number greater than or equal to 1.
  • the first candidate image block is a candidate image block on the upper side of the current image block
  • the second candidate image block is a candidate image block on the left side of the current image block.
  • the first candidate image block includes an adjacent image block and / or a second-neighboring image block on the upper side of the current image block; the prediction mode of the adjacent image block is an inter mode or an intra mode; the prediction mode of the next-neighbor image block is inter mode.
  • the second candidate image block includes an adjacent image block and / or a second-neighboring image block on the left side of the current image block; the prediction mode of the adjacent image block is an inter mode or an intra mode; the prediction mode of the next-neighbor image block is inter mode.
  • Obtaining a template of the current image block according to the motion information of the candidate image block may include, but is not limited to, determining the first template according to the motion vector prediction mode and the motion information of the M first candidate image blocks; and determining the second candidate image block according to the N second candidate image blocks.
  • a motion vector prediction mode and motion information to determine a second template Then, the first template is determined as the template of the current image block; or the second template is determined as the template of the current image block; or the first template and the second template are stitched and determined as the template of the current image block.
  • the first template when M is greater than 1, may include M sub-templates or P sub-templates, and is stitched from M sub-templates or P sub-templates, where P is the first candidate image block of the inter mode.
  • the first template may include a first sub-template, and the first sub-template is determined according to a motion vector prediction mode and motion information of the first candidate image block on the upper side of the current image block.
  • the second template may include N sub-templates or R sub-templates, and is formed by concatenating N sub-templates or R sub-templates, where R is the number of second candidate image blocks in the inter mode; when N is equal to At 1, the second template may include a second sub-template, and the second sub-template is determined according to the motion vector prediction mode and motion information of the first candidate image block on the left side of the current image block.
  • acquiring the template of the current image block according to the motion information of the candidate image block may further include but is not limited to: when the current image block corresponds to multiple motion information, acquiring a template corresponding to the motion information according to each motion information. A weight corresponding to each motion information is obtained, and a template of a current image block is obtained according to a weight corresponding to each motion information and a template corresponding to the motion information.
  • the processing process of the seventh embodiment is similar to that of the second embodiment, and details are not described herein again.
  • Embodiment 8 is a diagrammatic representation of Embodiment 8
  • step 503 the decoder obtains the target motion vector based on the template according to the original motion vector corresponding to the current image block and the obtained template.
  • the implementation process can be shown in FIG. 6A, and can include:
  • Step 601 The decoding end determines the original motion vector as a central motion vector.
  • Step 602 The decoder determines an edge motion vector corresponding to the central motion vector.
  • the edge motion vector may be different from the center motion vector.
  • determining the edge motion vector corresponding to the central motion vector may include: moving the central motion vector (x, y) in different directions by an offset S to obtain an edge motion vector (xS, y) and an edge motion vector in different directions. (x + S, y), edge motion vector (x, y + S), edge motion vector (x, yS).
  • Step 603 The decoder obtains the encoding performance of the central motion vector according to the template of the current image block, and obtains the encoding performance of the edge motion vector according to the template of the current image block.
  • the decoding end obtains the encoding performance of the central motion vector according to the template of the current image block, which may include, but is not limited to, the decoding end may determine the central motion vector according to the parameter information of the template of the current image block and the parameter information of the first target reference block. Encoding performance, wherein the first target reference block is an image block obtained after the reference image block corresponding to the template is shifted based on the central motion vector.
  • the decoding end obtains the encoding performance of the edge motion vector according to the template of the current image block, which may include, but is not limited to, the decoding end may determine the edge motion vector according to the parameter information of the template of the current image block and the parameter information of the second target reference block. Encoding performance, wherein the second target reference block is an image block obtained after the reference image block corresponding to the template is offset based on the edge motion vector.
  • Step 604 The decoding end determines a target motion vector from the center motion vector and the edge motion vector according to the coding performance of the center motion vector and the edge motion vector.
  • the decoder can select the motion vector with the best coding performance from the center motion vector and the edge motion vector.
  • the motion vector with the best coding performance can be determined. Is the target motion vector; when the motion vector with the best coding performance is the original motion vector, the decoder can select the motion vector with the second best coding performance from the center motion vector and the edge motion vector, and set the motion vector with the second best coding performance. Determined as the target motion vector.
  • steps 601 to 604 refer to the third embodiment, except that the execution body is changed from the encoding end to the decoding end.
  • the other processing flows are the same, and are not repeated here.
  • step 503 the decoding end obtains a template-based target motion vector according to the original motion vector corresponding to the current image block and the obtained template.
  • the implementation process can be shown in FIG. 6B, and can include:
  • Step 611 The decoding end determines the original motion vector as a central motion vector.
  • Step 612 The decoder determines an edge motion vector corresponding to the central motion vector.
  • the edge motion vector may be different from the center motion vector.
  • Step 613 The decoder obtains the encoding performance of the central motion vector according to the template of the current image block, and obtains the encoding performance of the edge motion vector according to the template of the current image block.
  • Step 614 The decoder determines whether the iteration end condition of the target motion vector is satisfied.
  • step 616 may be performed; if not, step 615 may be performed.
  • Step 615 The decoder selects a motion vector with the best coding performance from the center motion vector and the edge motion vector, determines the motion vector with the best coding performance as the center motion vector, and returns to step 612.
  • Step 616 The decoding end determines a target motion vector from the center motion vector and the edge motion vector according to the coding performance of the center motion vector and the edge motion vector.
  • Embodiment 10 is a diagrammatic representation of Embodiment 10:
  • an embodiment of the present disclosure also proposes a motion vector determining device, which is applied to the decoding end.
  • FIG. 7 it is a structural diagram of the device, and the device includes:
  • An obtaining module 71 is configured to obtain motion information of a candidate image block of the current image block; obtain a template of the current image block according to the motion information of the candidate image block; and obtain an original motion vector corresponding to the current image block and the acquired
  • the template obtains a target motion vector based on the template;
  • a determining module 72 is configured to determine a final motion vector of the current image block according to the target motion vector.
  • the obtaining module 71 is further configured to receive an encoded bit stream corresponding to the current image block from an encoding end, where the encoded bit stream carries first indication information, and the first indication information is used to instruct to determine the current based on a template.
  • a final motion vector of the image block acquiring motion information of a candidate image block of the current image block according to the first instruction information, and acquiring a template of the current image block according to the motion information of the candidate image block.
  • the obtaining module 71 is further configured to: receive an encoded bit stream corresponding to the current image block from the encoding end, where the encoded bit stream carries second instruction information, and the second instruction information is used to indicate that the The original motion vector determines the final motion vector of the current image block; the original motion vector corresponding to the current image block is obtained according to the second instruction information; the final motion of the current image block is determined according to the original motion vector Vector.
  • the obtaining module 71 is further configured to obtain the motion information of the candidate image block of the current image block according to the locally preset first policy information, and obtain the template of the current image block according to the motion information of the candidate image block;
  • the first strategy information is used to instruct to determine a final motion vector of the current image block based on a template; or to obtain an original motion vector corresponding to the current image block according to locally preset second policy information; and according to the original motion Vector to determine the final motion vector of the current image block;
  • the second policy information is used to instruct to determine the final motion vector of the current image block based on the original motion vector corresponding to the current image block; or, to obtain third policy information
  • the third policy information indicates that a final motion vector of the current image block is determined by using the same policy information as a neighboring image block of the current image block; and a final motion vector of the current image block is determined according to the third policy information.
  • the obtaining module 71 is further configured to: receive an encoded bit stream corresponding to the current image block from an encoding end, where the encoded bit stream carries an index value of an original motion vector in a motion vector list; and select from the motion vector list A motion vector corresponding to the index value; determining the selected motion vector as an original motion vector corresponding to the current image block; or determining a motion vector of a candidate image block of the current image block as the current image block Corresponding original motion vector.
  • the candidate image block includes M first candidate image blocks and N second candidate image blocks, where M is a natural number greater than or equal to 1, N is a natural number greater than or equal to 0, or M is a natural number greater than or equal to 0 , N is a natural number greater than or equal to 1; the first candidate image block is a candidate image block on the upper side of the current image block, and the second candidate image block is a candidate image block on the left side of the current image block;
  • the acquiring module 71 is specifically configured to: determine the first template according to the motion vector prediction mode and motion information of the M first candidate image blocks; Determine a second template of the motion vector prediction mode and motion information of the N second candidate image blocks; determine the first template as a template of the current image block; or determine the second template as the current template A template of an image block; or, determining the template of the current image block after stitching the first template and the second template.
  • the first candidate image block includes an adjacent image block and / or a second-neighboring image block on the upper side of the current image block; and the prediction mode of the adjacent image block is an inter mode or an intra mode.
  • the prediction mode of the second neighboring image block is an inter mode; the second candidate image block includes a neighboring image block and / or a second neighboring image block to the left of the current image block;
  • the prediction mode is an inter mode or an intra mode; the prediction mode of the next neighboring image block is an inter mode.
  • the first template when the M is greater than 1, includes M sub-templates or P sub-templates, and is formed by splicing the M sub-templates or the P sub-templates, where P is an inter-frame
  • the vector prediction mode and motion information are determined.
  • the motion information includes a motion vector and a reference frame index of the first candidate image block
  • the obtaining module 71 is specifically configured to determine the first template according to the motion vector prediction modes and motion information of the M first candidate image blocks. : For the ith candidate image block of the M first candidate image blocks, when it is determined that the motion vector prediction mode of the ith candidate image block is an inter mode, determine the reference frame index according to the reference frame index A reference frame image corresponding to the i-th candidate image block; and determining a reference image block corresponding to the i-th candidate image block from the reference frame image according to a motion vector of the i-th candidate image block, the reference The relative position offset between the image block and the i-th candidate image block matches the motion vector of the i-th candidate image block; according to the determined reference image block, the size is obtained as a first lateral length and a first An image block of a vertical length is used as an ith sub-template included in the first template.
  • the obtaining module 71 is specifically configured to determine the first template according to the motion vector prediction mode and motion information of the M first candidate image blocks, and for the i-th candidate image block of the M first candidate image blocks, When it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode, the i-th candidate image block is filled with a default value, and an image with a size of a first horizontal length and a first vertical length is obtained Block as the i-th sub-template included in the first template; or determining a reference frame image corresponding to the i-th candidate image block according to a reference frame index corresponding to the i-th candidate image block; according to the i-th A motion vector corresponding to each candidate image block, and a reference image block corresponding to the i-th candidate image block is determined from the reference frame image, and the relative position of the reference image block and the i-th candidate image block is offset Match the motion vector corresponding to the i-th candidate image block; and obtain, according to the determined reference image
  • the first horizontal length and the horizontal length of the first candidate image block satisfy a first proportional relationship, or the horizontal length of the current image block satisfies a second proportional relationship, or is equal to a first preset length;
  • the first longitudinal length and the longitudinal length of the first candidate image block satisfy a third proportional relationship, or the longitudinal length of the current image block satisfies a fourth proportional relationship, or is equal to a second preset length.
  • the second template when the N is greater than 1, includes N sub-templates or R sub-templates, and is formed by splicing the N sub-templates or the R sub-templates, where R is an inter-frame
  • the vector prediction mode and motion information are determined.
  • the motion information includes a motion vector and a reference frame index of the second candidate image block
  • the obtaining module 71 is specifically configured to determine the second template according to the motion vector prediction mode and motion information of the N second candidate image blocks.
  • the obtaining module 71 is specifically configured to determine the second template according to the motion vector prediction mode and motion information of the N second candidate image blocks: for the ith candidate image block of the N second candidate image blocks, When it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode, the i-th candidate image block is filled with a default value, and an image with a size of a second horizontal length and a second vertical length is obtained Block as the i-th sub-template included in the second template; or determining a reference frame image corresponding to the i-th candidate image block according to a reference frame index corresponding to the i-th candidate image block; according to the i-th A motion vector corresponding to each candidate image block, and a reference image block corresponding to the i-th candidate image block is determined from the reference frame image, and the relative position of the reference image block and the i-th candidate image block is offset Match the motion vector corresponding to the i-th candidate image block; and according to the determined reference image block, obtain an image
  • the second horizontal length and the horizontal length of the second candidate image block satisfy a fifth proportional relationship, or the horizontal length of the current image block satisfies a sixth proportional relationship, or is equal to a third preset length;
  • the second vertical length and the vertical length of the second candidate image block satisfy a seventh proportional relationship, or the vertical length of the current image block satisfies an eighth proportional relationship, or is equal to a fourth preset length.
  • the acquisition module 71 is specifically configured to: when the current image block corresponds to multiple motion information, acquire the corresponding motion information according to each motion information. Obtaining a weight corresponding to each motion information, and obtaining a template of the current image block according to the weight corresponding to each motion information and the template corresponding to the motion information.
  • the acquisition module 71 is specifically configured to: determine the original motion vector as a central motion vector; determine An edge motion vector corresponding to the center motion vector, the edge motion vector being different from the center motion vector; obtaining the encoding performance of the center motion vector and the encoding performance of the edge motion vector according to the template; The coding performance of the center motion vector and the coding performance of the edge motion vector are described, and the target motion vector is determined from the center motion vector and the edge motion vector.
  • the acquisition module 71 is specifically configured to move the central motion vector (x, y) by an offset S in different directions to obtain edge motion vectors (xS, y), edge motion vector (x + S, y), edge motion vector (x, y + S), and edge motion vector (x, yS).
  • the obtaining module 71 When the obtaining module 71 obtains the encoding performance of the central motion vector and the encoding performance of the edge motion vector according to the template, the obtaining module 71 is specifically configured to: according to the parameter information of the template of the current image block and the first target reference block. Parameter information to determine the encoding performance of the central motion vector, wherein the first target reference block is an image block obtained after the reference image block corresponding to the template is offset based on the central motion vector; according to the current The parameter information of the template of the image block and the parameter information of the second target reference block determine the encoding performance of the edge motion vector, and the second target reference block is a reference image block corresponding to the template based on the edge motion vector. Image patches obtained after offset.
  • the obtaining module 71 determines the target motion vector from the center motion vector and the edge motion vector according to the coding performance of the center motion vector and the edge motion vector, the obtaining module 71 is specifically configured to: The motion vector with the best coding performance is selected from the center motion vector and the edge motion vector; and when the motion vector with the best coding performance is not the original motion vector, the motion vector with the best coding performance is determined as the target motion.
  • Vector when the motion vector with the best encoding performance is the original motion vector, select the motion vector with the best encoding performance from the center motion vector and the edge motion vector, and determine the motion vector with the best encoding performance Is the target motion vector.
  • the obtaining module 71 is further configured to determine whether the iteration end condition of the target motion vector is satisfied; if so, according to the encoding performance of the central motion vector and the encoding performance of the edge motion vector, the The target motion vector is determined from the edge motion vector; if not, the motion vector with the best coding performance is selected from the center motion vector and the edge motion vector, and the motion vector with the best coding performance is determined as The center motion vector, and return to perform an operation of determining an edge motion vector corresponding to the center motion vector.
  • an embodiment of the present disclosure further proposes a motion vector determining device, which is applied to the encoding end. See FIG. 8 for a structural diagram of the device, where the device includes:
  • An acquiring module 81 is configured to acquire motion information of a candidate image block of the current image block; acquire a template of the current image block according to the motion information of the candidate image block; and obtain an original motion vector corresponding to the current image block and the acquired The template to obtain a target motion vector based on the template;
  • a sending module 82 is configured to send an encoded bit stream to a decoding end according to the original motion vector and the target motion vector.
  • the candidate image block includes M first candidate image blocks and N second candidate image blocks, where M is a natural number greater than or equal to 1, N is a natural number greater than or equal to 0, or M is a natural number greater than or equal to 0 , N is a natural number greater than or equal to 1; the first candidate image block is a candidate image block above the current image block, and the second candidate image block is a candidate image block to the left of the current image block;
  • the acquiring module 81 is specifically configured to: determine the first template according to the motion vector prediction mode and motion information of the M first candidate image blocks; Determine a second template of the motion vector prediction mode and motion information of the N second candidate image blocks; determine the first template as a template of the current image block; or determine the second template as the current template A template of an image block; or, determining the template of the current image block after stitching the first template and the second template.
  • the first candidate image block includes an adjacent image block and / or a second-neighboring image block on the upper side of the current image block; and the prediction mode of the adjacent image block is an inter mode or an intra mode.
  • the prediction mode of the second neighboring image block is an inter mode; the second candidate image block includes a neighboring image block and / or a second neighboring image block to the left of the current image block;
  • the prediction mode is an inter mode or an intra mode; the prediction mode of the next neighboring image block is an inter mode.
  • the first template when the M is greater than 1, includes M sub-templates or P sub-templates, and is formed by splicing the M sub-templates or the P sub-templates, where P is an inter-frame
  • the vector prediction mode and motion information are determined.
  • the motion information includes a motion vector and a reference frame index of the first candidate image block
  • the obtaining module 81 is specifically configured to determine the first template according to the motion vector prediction modes and motion information of the M first candidate image blocks. : For the ith candidate image block of the M first candidate image blocks, when it is determined that the motion vector prediction mode of the ith candidate image block is an inter mode, determine the reference frame index according to the reference frame index A reference frame image corresponding to the i-th candidate image block; and determining a reference image block corresponding to the i-th candidate image block from the reference frame image according to a motion vector of the i-th candidate image block, the reference The relative position offset between the image block and the i-th candidate image block matches the motion vector of the i-th candidate image block; according to the determined reference image block, the size is obtained as a first lateral length and a first An image block of a vertical length is used as an ith sub-template included in the first template.
  • the obtaining module 81 is specifically configured to determine the first template according to the motion vector prediction mode and motion information of the M first candidate image blocks, and for the i-th candidate image block of the M first candidate image blocks, When it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode, the i-th candidate image block is filled with a default value, and an image with a size of a first horizontal length and a first vertical length is obtained Block as the i-th sub-template included in the first template; or determining a reference frame image corresponding to the i-th candidate image block according to a reference frame index corresponding to the i-th candidate image block; according to the i-th A motion vector corresponding to each candidate image block, and a reference image block corresponding to the i-th candidate image block is determined from the reference frame image, and the relative position of the reference image block and the i-th candidate image block is offset Match the motion vector corresponding to the i-th candidate image block; and obtain, according to the determined reference image
  • the first horizontal length and the horizontal length of the first candidate image block satisfy a first proportional relationship, or the horizontal length of the current image block satisfies a second proportional relationship, or is equal to a first preset length;
  • a longitudinal length satisfies a third proportional relationship with the longitudinal length of the first candidate image block, or satisfies a fourth proportional relationship with the longitudinal length of the current image block, or is equal to a second preset length.
  • the second template when the N is greater than 1, includes N sub-templates or R sub-templates, and is formed by splicing the N sub-templates or the R sub-templates, where R is an inter-frame
  • the vector prediction mode and motion information are determined.
  • the motion information includes a motion vector and a reference frame index of the second candidate image block
  • the obtaining module 81 is specifically configured to determine the second template according to the motion vector prediction mode and motion information of the N second candidate image blocks.
  • the obtaining module 81 is specifically configured to determine the second template according to the motion vector prediction mode and the motion information of the N second candidate image blocks: for the ith candidate image block of the N second candidate image blocks, When it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode, the i-th candidate image block is filled with a default value, and an image with a size of a second horizontal length and a second vertical length is obtained Block as the i-th sub-template included in the second template; or determining a reference frame image corresponding to the i-th candidate image block according to a reference frame index corresponding to the i-th candidate image block; according to the i-th A motion vector corresponding to each candidate image block, and a reference image block corresponding to the i-th candidate image block is determined from the reference frame image, and the relative position of the reference image block and the i-th candidate image block is offset Match the motion vector corresponding to the i-th candidate image block; and according to the determined reference image block, obtain an
  • the second horizontal length and the horizontal length of the second candidate image block satisfy a fifth proportional relationship, or the horizontal length of the current image block satisfies a sixth proportional relationship, or is equal to a third preset length;
  • the second longitudinal length and the longitudinal length of the second candidate image block satisfy a seventh proportional relationship, and the longitudinal length of the second candidate image block and the current image block satisfy an eighth proportional relationship, or are equal to a fourth preset length.
  • the acquiring module 81 is specifically configured to acquire a template of the current image block according to the motion information of the candidate image block, and when the current image block corresponds to multiple motion information, acquire the corresponding motion information according to each motion information. Obtaining a weight corresponding to each motion information, and obtaining a template of the current image block according to the weight corresponding to each motion information and the template corresponding to the motion information.
  • the acquisition module 81 is specifically configured to: determine the original motion vector as a central motion vector; determine An edge motion vector corresponding to the center motion vector, the edge motion vector being different from the center motion vector; obtaining the encoding performance of the center motion vector and the encoding performance of the edge motion vector according to the template; The coding performance of the center motion vector and the coding performance of the edge motion vector are described, and the target motion vector is determined from the center motion vector and the edge motion vector.
  • the acquisition module 81 is specifically configured to move the central motion vector (x, y) in different directions by an offset S to obtain edge motion vectors (xS, y), edge motion vector (x + S, y), edge motion vector (x, y + S), and edge motion vector (x, yS).
  • the obtaining module 81 When the obtaining module 81 obtains the encoding performance of the central motion vector and the encoding performance of the edge motion vector according to the template, the obtaining module 81 is specifically configured to: according to parameter information of the template of the current image block and the first target reference block Parameter information to determine the encoding performance of the central motion vector, wherein the first target reference block is an image block obtained after the reference image block corresponding to the template is offset based on the central motion vector; according to the current The parameter information of the template of the image block and the parameter information of the second target reference block determine the encoding performance of the edge motion vector, and the second target reference block is a reference image block corresponding to the template based on the edge motion vector. Image patches obtained after offset.
  • the acquiring module 81 is specifically configured to determine the target motion vector from the center motion vector and the edge motion vector according to the encoding performance of the center motion vector and the edge motion vector, and is used to: The motion vector with the best coding performance is selected from the center motion vector and the edge motion vector; and when the motion vector with the best coding performance is not the original motion vector, the motion vector with the best coding performance is determined as the target motion.
  • Vector when the motion vector with the best encoding performance is the original motion vector, select the motion vector with the best encoding performance from the center motion vector and the edge motion vector, and determine the motion vector with the best encoding performance Is the target motion vector.
  • the obtaining module 81 is further configured to: determine whether an iteration end condition of a target motion vector is satisfied; if so, according to the encoding performance of the central motion vector and the encoding performance of the edge motion vector, the The target motion vector is determined from the edge motion vector; if not, the motion vector with the best coding performance is selected from the center motion vector and the edge motion vector, and the motion vector with the best coding performance is determined as The center motion vector, and return to perform an operation of determining an edge motion vector corresponding to the center motion vector.
  • the sending module 82 When the sending module 82 sends an encoded bit stream to a decoding end according to the original motion vector and the target motion vector, the sending module 82 is specifically configured to: obtain the encoding performance of the original motion vector and the encoding performance of the target motion vector; When the encoding performance of the target motion vector is better than the encoding performance of the original motion vector, the encoding bit stream carrying the first indication information is sent to the decoding end, and the first indication information is used to instruct to determine the current image block based on the template Final motion vector.
  • the sending module 82 When the sending module 82 sends an encoded bit stream to a decoding end according to the original motion vector and the target motion vector, the sending module 82 is specifically configured to: obtain the encoding performance of the original motion vector and the encoding performance of the target motion vector; When the encoding performance of the original motion vector is better than the encoding performance of the target motion vector, the encoding bit stream carrying the second instruction information is sent to the decoding end, and the second instruction information is used to indicate the determination based on the original motion vector corresponding to the current image block. A final motion vector of the current image block.
  • the sending module 82 When the sending module 82 sends the encoded bit stream to the decoding end according to the original motion vector and the target motion vector, the sending module 82 is specifically configured to: obtain an index value of the original motion vector in the motion vector list; and send the carrying bitstream to the decoding end. The encoded bit stream of the index value.
  • the sending module 82 obtains the encoding performance of the original motion vector is specifically used to determine the encoding performance of the original motion vector according to parameter information of a template of the current image block and parameter information of a third target reference block,
  • the third target reference block is an image block obtained after the reference image block corresponding to the template is offset based on the original motion vector;
  • the obtaining, by the sending module 82, the encoding performance of the target motion vector is specifically used to determine the encoding performance of the target motion vector according to parameter information of a template of the current image block and parameter information of a fourth target reference block,
  • the fourth target reference block is an image block obtained after the reference image block corresponding to the template is offset based on the target motion vector.
  • the processor 91 includes a processor 91 and a machine-readable storage medium 92.
  • the machine-readable storage medium 92 stores machine-executable instructions that can be executed by the processor 91.
  • the processor 91 is configured to execute machine-executable instructions. Instructions to implement the motion vector determination method disclosed in the above example.
  • an embodiment of the present disclosure further provides a machine-readable storage medium.
  • the machine-readable storage medium stores a number of computer instructions.
  • the present disclosure can be implemented.
  • the processor 93 includes a processor 93 and a machine-readable storage medium 94.
  • the machine-readable storage medium 94 stores machine-executable instructions that can be executed by the processor 93.
  • the processor 93 is configured to execute machine-executable instructions. The method for determining a motion vector disclosed in the above example is implemented.
  • an embodiment of the present disclosure further provides a machine-readable storage medium.
  • the machine-readable storage medium stores a number of computer instructions.
  • the present disclosure can be implemented.
  • the machine-readable storage medium may be any electronic, magnetic, optical, or other physical storage device, and may contain or store information, such as executable instructions, data, and so on.
  • the machine-readable storage medium may be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard drive), solid state hard disk, any type of storage disk (Such as optical discs, DVDs, etc.), or similar storage media, or a combination thereof.
  • the system, device, module, or unit described in the foregoing embodiments may be specifically implemented by a computer chip or entity, or a product with a certain function.
  • a typical implementation device is a computer, and the specific form of the computer may be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email sending and receiving device, and a game control Desk, tablet computer, wearable device, or a combination of any of these devices.
  • the embodiments of the present disclosure may be provided as a method, a system, or a computer program product. Therefore, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.
  • computer-usable storage media including but not limited to disk memory, CD-ROM, optical memory, etc.
  • these computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured article including an instruction device,
  • the instruction device implements the functions specified in a flowchart or a plurality of processes and / or a block or a plurality of blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing device, so that a series of operation steps can be performed on the computer or other programmable device to generate a computer-implemented process, which can be executed on the computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more flowcharts and / or one or more blocks of the block diagrams.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

本公开提供一种运动矢量确定方法和设备,该方法包括:获取当前图像块的候选图像块的运动信息;根据所述候选图像块的运动信息获取所述当前图像块的模板;根据所述当前图像块对应的原始运动矢量和获取的所述模板,得到基于所述模板的目标运动矢量;根据所述目标运动矢量确定所述当前图像块的最终运动矢量。通过本公开的技术方案,在解码的重建阶段之前,就可以获取当前图像块的模板,可以提高解码效率,减少解码时延。

Description

一种运动矢量确定方法和设备 技术领域
本公开涉及视频编解码技术领域,尤其涉及一种运动矢量确定方法和设备。
背景技术
为了达到节约空间的目的,视频图像都是经过编码后才传输的,视频编码可以包括预测、变换、量化、熵编码、滤波等过程。其中,预测编码包括帧内编码和帧间编码,帧间编码是利用视频时域的相关性,使用邻近已编码图像的像素预测当前图像的像素,以有效去除视频时域冗余。
在帧间编码中,可以使用运动矢量(Motion Vector,MV)表示当前帧图像的当前图像块与参考帧图像的参考图像块之间的相对位移。例如,当前帧的视频图像A与参考帧的视频图像B存在很强的时域相关性,在需要传输视频图像A的图像块A1(当前图像块)时,则可以在视频图像B中进行运动搜索,找到与图像块A1最匹配的图像块B1(即参考图像块),并确定图像块A1与图像块B1之间的相对位移,该相对位移也就是图像块A1的运动矢量。
编码端可以将运动矢量发送给解码端,不是将图像块A1发送给解码端,解码端可以根据运动矢量和图像块B1得到图像块A1。显然,由于运动矢量占用的比特数小于图像块A1占用的比特数,因此,上述方式可以节约大量比特。
但是,若将视频图像A划分成大量图像块,则传输每个图像块的运动矢量也会占用比较多的比特。为了进一步的节约比特,还可以利用候选图像块之间的空间相关性,预测图像块的运动矢量。例如,可以将与图像块A1相邻的图像块A2的运动矢量,确定为图像块A1的运动矢量。基于此,编码端可以将图像块A2的运动矢量的索引值发送给解码端,而解码端可以基于该索引值确定图像块A2的运动矢量,就是图像块A1的运动矢量。由于图像块A2的运动矢量的索引值占用的比特数小于运动矢量占用的比特数,因此,上述方式可以进一步节约比特。
由于图像块A1的运动与图像块A2的运动可能存在差异,即图像块A2的运动矢量与图像块A1的运动矢量可能并不一致,因此,将图像块A2的运动矢量确定为图像块A1的运动矢量,存在预测质量不高,预测错误等问题。
发明内容
本公开提供了一种运动矢量确定方法和设备,可以有利于提高运动矢量的精度,提高编码性能。
本公开提供一种运动矢量确定方法,应用于解码端,所述方法包括:获取当前图像块的候选图像块的运动信息;根据所述候选图像块的运动信息获取所述当前图像块的模板;根据所述当前图像块对应的原始运动矢量和获取的所述模板,得到基于所述模板的目标运动矢量;根据所述目标运动矢量确定所述当前图像块的最终运动矢量。
本公开提供一种运动矢量确定方法,应用于编码端,所述方法包括:获取当前图像块的候选图像块的运动信息;根据所述候选图像块的运动信息获取所述当前图像块的模板;根据所述当前图像块对应的原始运动矢量和获取的所述模板,得到基于所述模板的目标运动矢量;根据所述原始运动矢量和所述目标运动矢量向解码端发送编码比特流。
本公开提供一种解码端设备,包括:处理器和机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令;所述处理器用于执行机器可执行指令,以实现上述的运动矢量确定方法步骤。
本公开提供一种编码端设备,包括:处理器和机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令;所述处理器用于执行机器可执行指令,以实现上述的运动矢量确定方法步骤。
由以上技术方案可见,本公开实施例中,可以根据原始运动矢量获取目标运动矢量,并根据目标运动矢量确定当前图像块的最终运动矢量,而不是根据原始运动矢量确定当前图像块的最终运动矢量,从而提高运动矢量的精度,提高编码性能。而且,在根据原始运动矢量获取目标运动矢量时,可以根据候选图像块的运动信息获取当前图像块的模板,并根据所述当前图像块的模板获取目标运动矢量,上述方式可以快速得到当前图像块的模板,继而根据该模板得到目标运动矢量,可以提高解码效率,减少解码时延。例如,在解码的重建阶段之前,就可以获取当前图像块的模板,并根据模板得到目标运动矢量。
附图说明
为了更加清楚地说明本公开实施例或者现有技术中的技术方案,下面将对本公开实施例或者现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据本公开实施例的这些附图获得其他的附图。
图1是本公开一种实施方式中的运动矢量的示意图。
图2是本公开一种实施方式中的运动矢量确定方法的流程图。
图3A-图3O是本公开一种实施方式中的当前图像块的模板示意图。
图4A和图4B是本公开另一种实施方式中的运动矢量确定方法的流程图。
图5是本公开另一种实施方式中的运动矢量确定方法的流程图。
图6A和图6B是本公开另一种实施方式中的运动矢量确定方法的流程图。
图7是本公开一种实施方式中的运动矢量确定装置的结构图。
图8是本公开另一种实施方式中的运动矢量确定装置的结构图。
图9是本公开一种实施方式中的解码端设备的硬件结构图。
图10是本公开一种实施方式中的编码端设备的硬件结构图。
具体实施方式
在本公开实施例使用的术语仅仅是出于描述特定实施例的目的,而非限制本公开。本公开和权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其它含义。还应当理解,本文中使用的术语“和/或”是指包含一个或多个相关联的列出项目的任何或所有可能组合。
应当理解,尽管在本公开实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本公开范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,此外,所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
本公开实施例中提出一种运动矢量确定方法,该方法可以涉及如下概念:
运动矢量(Motion Vector,MV):在帧间编码中,使用运动矢量表示当前帧图像的当前图像块与参考帧图像的参考图像块之间的相对位移,每个图像块都有相应的运动矢量传送到解码端。如果对每个图像块的运动矢量进行独立编码和传输,则消耗相当多的比特,尤其在图像块的数量非常大的情况下。为了降低用于编码运动矢量的比特数,可以利用相邻图像块之间的空间相关性,根据相邻已编码图像块的运动矢量对当前待编码图像块的运动矢量进行预测,然后对预测差进行编码,这样可以有效降低表示运动矢量的比特数。
运动信息(Motion Information):由于运动矢量表示当前图像块与某个参考图像块的位置偏移,为了准确获取指向图像块的信息,除了运动矢量,还需要参考帧图像的索引信息来表示使用哪个参考帧图像。在视频编码技术中,对于当前帧图像,通常可以建立一个参考帧图像列表,参考帧索引则表示当前图像块采用了参考帧图像列表中的第几个参考帧图像。可以将运动矢量、参考帧索引等与运动相关的信息统称为运动信息。
模板(Template):在视频编码技术中,编码过程是按照逐个图像块进行的,在进行当前图像块的编码时,周围已编码图像块的重建信息是可被利用的。模板指当前图像块周围(时域或空域的相邻区域)固定形状的编码/解码信息。在编码端和解码端,模板是完全一样的,因此,在编码端利用模板进行的一些操作,在解码端可利用该模板获得完全一致的结果,也就是说,编码端基于模板推导的信息可以在解码端无损恢复,而不需要传递额外信息,从而进一步减少传输比特数。
率失真原则(Rate-Distortion Optimized):评价编码效率有两大指标:码率(又称为比特率,Bit Per Second,BPS)和PSNR(Peak Signal to Noise Ratio,峰值信噪比),比特流越小,则压缩率越大,PSNR越大,则重建图像质量越好,在编码模式选择时,判别公式实质上也就是对二者的综合评价。例如,编码模式对应的代价:J(mode)=D+λ*R,其中,D表示Distortion(失真),通常可以使用SSE指标来衡量,SSE(Sum-Square Error)是指重建图像块与源图像的差值的均方和;λ是拉格朗日乘子,R就是该编码模式下图像块编码所需的实际比特数,包括编码模式信息、运动信息、预测残差等所需的比特总和。
帧内预测(intra prediction):可以利用当前图像块的空域相邻图像块(如与当前图像块处于同一帧图像)的重建像素值进行预测编码,帧间预测(inter prediction):可以利用当前图像块的时域相邻图像块(如与当前图像块处于不同帧图像)的重建像素值进行预测编码。
本公开实施例中提出一种运动矢量确定方法,可以应用于帧间编码技术中。在帧间编码技术中,可以使用运动矢量表示当前帧图像的当前图像块与参考帧图像的参考图像块之间的相对位移。参见图1所示,视频图像A是当前帧图像,图像块A1是当前图像块,视频图像B是视频图像A的参考帧图像,图像块B1是图像块A1的参考图像块。由于视频图像A与视频图像B存在很强的时域相关性,在需要传输视频图像A的图像块A1时,可以在视频图像B中进行运动搜索,找到与图像块A1最匹配的图像块B1,并确定图像块A1与图像块B1之间的相对位移,该相对位移也就是图像块A1的运动矢量。例如,运动矢量为(-6,4),该运动矢量表示图像块B1在水平方向上相对于图像块A1向左移动6个像素点,在垂直方向上相对于图像块A1向上移动4个像素点。
编码端向解码端发送编码比特流时,编码比特流携带的是图像块A1的运动矢量(-6,4),不是图像块A1。解码端接收到编码比特流后,可以获得图像块A1的运动矢量(-6,4),基于图像块A1的位置和运动矢量(-6,4),在视频图像B中确定图像块B1的位置,即:从图像块A1的位置,向左移动6个像素点,向上移动4个像素点,得到的是图像块B1的位置,从图像块B1的位置读取图像块B1,利用图像块B1对图像块A1进行重建。由于图像块B1和图像块A1的相似度很高,因此利用图像块B1对图像块A1进行重建,可重建出相似度很高的图像。由于运动矢量占用的比特数小于图像块A1占用的比特数,因此通过在编码比特流携带运动矢量,而不是携带图像块A1,从而节约大量比特。
进一步的,若视频图像A包括大量图像块,则每个图像块的运动矢量也会占用比较多的比特,因此,为了进一步的节约比特数,本公开实施例中,还可以利用相邻图像块的运动矢量确定图像块A1的运动矢量。例如,在视频图像A中,与图像块A1相邻的图像块可以包括:图像块A2、图像块A3、图像块A4和图像块A5,在运动矢量列表中包括图像块A2的运动矢量A21、图像块A3的运动矢量A31、图像块A4的运动矢量A41和图像块A5的运动矢量A51。
为了确定图像块A1的运动矢量,可以从运动矢量列表选择一个运动矢量,假设选择运动矢量A21,将运动矢量A21作为原始运动矢量,利用原始运动矢量A21获取目标运动矢量,该目标运动矢量作为图像块A1的最终运动矢量。
在一个例子中,不是直接将原始运动矢量A21作为图像块A1的最终运动矢量,而是根据原始运动矢量A21获取与原始运动矢量A21不同的目标运动矢量,该目标运动矢量是与图像块A1的运动矢量最接近的,因此,可以将该目标运动矢量作为图像块A1的最终运动矢量。显然,与“将原始运动矢量A21直接作为图像块A1的最终运动矢量”的方式相比,上述“将目标运动矢量作为图像块A1的最终运动矢量”的方式,可以解决预测质量不高,预测错误等问题。
进一步,编码端在向解码端发送编码比特流时,编码比特流携带的是原始运动矢量 A21的索引值(即运动矢量列表中的索引值),而不是图像块A1的运动矢量(-6,4),更不是图像块A1。解码端接收到编码比特流后,可以获得原始运动矢量A21的索引值,根据该索引值从运动矢量列表中获取原始运动矢量A21,根据原始运动矢量A21获取目标运动矢量,该目标运动矢量也就是图像块A1的最终运动矢量,从而得到图像块A1的最终运动矢量。显然,由于索引值占用的比特数小于运动矢量占用的比特数,因此可以进一步节约比特。
在根据原始运动矢量获取目标运动矢量时,可以利用当前图像块的相邻图像块的已解码信息(如重建信息或者预测信息)获取当前图像块的模板,并根据当前图像块的模板和原始运动矢量获取目标运动矢量。但是,若相邻图像块的已解码信息是重建信息,则当前图像块的模板的生成需要等到解码重建阶段,大大降低了解码的效率,带来解码的时延;若相邻图像块的已解码信息是预测信息,则当前图像块的模板的生成也需要等到解码重建阶段,大大降低了解码的效率,带来解码的时延。因此,上述方式会导致解码的并行度受到较大影响。
针对上述发现,在本实施例中,提出了一种更优的模板生成方式,与采用重建信息和预测信息生成模板的方式不同,可以根据当前图像块的候选图像块的运动信息(如运动矢量和参考帧索引等)获取当前图像块的模板,然后,可以根据当前图像块的模板和原始运动矢量获取目标运动矢量,从而提升效率。
以下结合几个具体的实施例,对上述运动矢量确定方法进行详细说明。
实施例一:
参见图2所示,为运动矢量确定方法的流程示意图,该方法可以包括:
步骤201,编码端获取当前图像块的候选图像块的运动信息。
其中,当前图像块的候选图像块可以包括但不限于:当前图像块的空域候选图像块;或者,当前图像块的时域候选图像块;对此候选图像块不做限制。
其中,在对当前图像块进行编码时,由于当前图像块的候选图像块已经完成编码,即候选图像块的运动信息为已知,因此,编码端可以直接获取候选图像块的运动信息,如候选图像块的运动矢量和参考帧索引等,对此不做限制。
步骤202,编码端根据候选图像块的运动信息获取当前图像块的模板。
其中,本步骤202的处理过程,可以参见后续实施例,在此不再赘述。
步骤203,编码端根据当前图像块对应的原始运动矢量和获取的模板,得到基于模板的目标运动矢量,该目标运动矢量与该原始运动矢量可以不同。
步骤203之前,可以先获取当前图像块的原始运动矢量,例如,假设当前图像块是图像块A1,在编码端的运动矢量列表依次包括运动矢量A21、运动矢量A31、运动矢量A41和运动矢量A51,则可以从运动矢量列表中选择一个运动矢量,而选择的运动矢量就是图像块A1的原始运动矢量。当然,上述方式只是示例,对此不做限制,例如,可以直接将默认运动矢量确定为原始运动矢量。
其中,编码端从运动矢量列表中选择一个运动矢量,可以包括:编码端从运动矢量 列表中选择第一个运动矢量;或者,从运动矢量列表中选择最后一个运动矢量;或者,从运动矢量列表中随机选择一个运动矢量;或者,采用hash(哈希)算法从运动矢量列表中选择一个运动矢量。当然,上述方式只是几个示例,对此不做限制,只要能够从运动矢量列表中选择运动矢量即可。
其中,运动矢量列表用于记录与当前图像块相邻的图像块的运动矢量。例如,在得到图像块A2的运动矢量A21后,可以将运动矢量A21记录到该运动矢量列表,在得到图像块A3的运动矢量A31后,可以将运动矢量A31记录到该运动矢量列表,以此类推,最终,可以得到图像块A1的运动矢量列表。
其中,本步骤203的处理过程,可以参见后续实施例,在此不再赘述。
步骤204,编码端根据原始运动矢量和目标运动矢量向解码端发送编码比特流。
具体的,编码端可以获取原始运动矢量的编码性能和目标运动矢量的编码性能。当目标运动矢量的编码性能优于原始运动矢量的编码性能时,向解码端发送的当前图像块对应的编码比特流可携带第一指示信息,该第一指示信息用于指示解码端基于模板确定当前图像块的最终运动矢量。当原始运动矢量的编码性能优于目标运动矢量的编码性能时,向解码端发送的当前图像块对应的编码比特流可携带第二指示信息,第二指示信息用于指示基于当前图像块对应的原始运动矢量确定当前图像块的最终运动矢量。
其中,上述方式是采用显式方式通知第一指示信息或者第二指示信息,在实际应用中,还可以采用隐式方式通知,即不在编码比特流中携带第一指示信息或者第二指示信息。具体的,编码端和解码端还可以协商运动矢量决策策略或者通过在标准定义策略,存储在编码端和解码端。例如,运动矢量决策策略可以为第一策略信息,第一策略信息用于指示基于模板确定所述当前图像块的最终运动矢量;或者,第二策略信息,第二策略信息用于指示基于当前图像块对应的原始运动矢量确定所述当前图像块的最终运动矢量;或者,第三策略信息,所述第三策略信息表示采用与当前图像块的候选图像块相同的策略信息确定当前图像块的最终运动矢量。
当运动矢量决策策略为约定第一策略信息,且目标运动矢量的编码性能优于原始运动矢量的编码性能时,则当前图像块对应的编码比特流中可以不携带第一指示信息和第二指示信息。当运动矢量决策策略为约定第二策略信息,且原始运动矢量的编码性能优于目标运动矢量的编码性能时,则当前图像块对应的编码比特流中可以不携带第一指示信息和第二指示信息。又例如,当运动矢量决策策略为第三策略信息,相邻图像块采用第一策略信息,且目标运动矢量的编码性能优于原始运动矢量的编码性能时,编码比特流中可以不携带第一指示信息和第二指示信息;当相邻图像块采用第二策略信息,且原始运动矢量的编码性能优于目标运动矢量的编码性能时,当前图像块对应的编码比特流中可以不携带第一指示信息和第二指示信息。
在一个例子中,编码端根据原始运动矢量和目标运动矢量向解码端发送编码比特流,还可以包括:获取原始运动矢量在当前图像块的运动矢量列表中的索引值;向解码端发送携带该索引值的编码比特流。例如,若原始运动矢量为运动矢量A21,且运动矢量A21是运动矢量列表的第一个运动矢量,则该索引值可以为1。
其中,编码端获取该原始运动矢量的编码性能和该目标运动矢量的编码性能的过程,可以参见后续的实施例,在本实施例一中不再详加赘述。
由以上技术方案可见,可以根据原始运动矢量获取目标运动矢量,并根据目标运动矢量确定当前图像块的最终运动矢量,而不是根据原始运动矢量确定当前图像块的最终运动矢量,从而提高运动矢量的精度,提高编码性能。而且,在根据原始运动矢量获取目标运动矢量时,可以根据候选图像块的运动信息获取当前图像块的模板,并根据所述当前图像块的模板获取目标运动矢量,上述方式可以快速得到当前图像块的模板,继而根据该模板得到目标运动矢量,可以提高解码效率,减少解码时延。例如,在解码的重建阶段之前,就可以获取当前图像块的模板,并根据当前图像块的模板得到目标运动矢量。
实施例二:
在视频编码过程中,对每帧图像的每个图像块逐一编码,在对当前图像块编码时,若当前图像块周围的相邻图像块已经重建完成,则可以利用相邻图像块的编码信息对当前图像块进行重建。例如,可以利用当前图像块的相邻图像块的编码信息获取当前图像块的模板。该编码信息可以包括但不限于:相邻图像块的重建信息和/或相邻图像块的预测信息。该重建信息可以包括但不限于亮度值、色度值等;预测信息可以是能够获取重建信息的中间值,例如,若能够利用中间值A获取到亮度值,则中间值A是预测信息,对此预测信息不做限制。
但是,若编码信息包括重建信息,则当前图像块的模板的生成需要等到重建阶段,大大降低了解码的效率,带来解码的时延;而编码信息是预测信息,则当前图像块的模板的生成也需要等到重建阶段,大大降低了解码的效率,带来解码的时延。因此,上述方式会导致编解码的并行度受到较大影响。
针对上述发现,在本实施例中,提出了一种更优的模板生成方式,与采用重建信息和预测信息生成模板的方式不同,可以根据当前图像块的候选图像块的运动信息(如运动矢量和参考帧索引等)获取当前图像块的模板,根据候选图像块的运动信息获取当前图像块的模板的方法均可应用在编码端和解码端。
其中,根据候选图像块的运动信息获取当前图像块的模板,可以包括:当候选图像块的运动信息包括候选图像块的运动矢量和参考帧索引时,根据该参考帧索引确定该候选图像块对应的参考帧图像;根据该运动矢量从该参考帧图像中获取与该候选图像块对应的参考图像块,并根据该参考图像块获取该当前图像块的模板。
例如,参见图3A所示,假设图像块A1是当前图像块,而图像块A2和图像块A3是图像块A1的候选图像块。针对图像块A2,若图像块A2的参考帧索引为视频图像B的索引,则可以根据该参考帧索引确定图像块A2对应的参考帧图像是视频图像B;然后,从视频图像B中选取与图像块A2对应的图像块B2,即图像块B2在视频图像B中的位置,与图像块A2在视频图像A中的位置相同;然后,可以根据图像块A2的运动矢量对图像块B2进行移动,如利用运动矢量(3,3)移动图像块B2,得到与图像块B2对应的图像块B2’(如向右移动3个像素点,向上移动3个像素点),图像块B2’就是图像块A2对应的参考图像块。同理,可以确定与图像块A3对应的参考图像块是图 像块B3’。进一步的,可以根据图像块B2’和图像块B3’确定图像块A2的模板,参见图3A所示。
在一个例子中,候选图像块可以包括M个第一候选图像块和N个第二候选图像块,M为大于或等于1的自然数,N为大于或等于0的自然数,或者,M为大于或等于0的自然数,N为大于或等于1的自然数。第一候选图像块为当前图像块上侧的候选图像块,第二候选图像块为当前图像块左侧的候选图像块。
根据候选图像块的运动信息获取当前图像块的模板,可以包括但不限于:根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板;根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板。然后,将第一模板确定为当前图像块的模板;或者,将第二模板确定为当前图像块的模板;或者,将第一模板和第二模板拼接之后确定为当前图像块的模板。
例如,当M为大于或等于1的自然数,N为0时,可以根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板,并将第一模板确定为当前图像块的模板。当N为大于或等于1的自然数,M为0时,可以根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板,并将第二模板确定为当前图像块的模板。当M为大于或等于1的自然数,N为大于或等于1的自然数,则可以根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板,根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板,将第一模板确定为当前图像块的模板;或将第二模板确定为当前图像块的模板;或将第一模板和第二模板拼接之后确定为当前图像块的模板。
其中,第一候选图像块包括当前图像块上侧的相邻图像块和/或次邻图像块;相邻图像块的预测模式为帧间模式或者帧内模式;次邻图像块的预测模式为帧间模式。例如,第一候选图像块可以包括至少一个预测模式为帧间模式的相邻图像块,例如,当前图像块上侧的所有相邻图像块、或当前图像块上侧的第一个相邻图像块、或当前图像块上侧的任意一个或多个相邻图像块。此外,当当前图像块上侧的相邻图像块均为帧内模式时,则第一候选图像块还可以包括至少一个预测模式为帧间模式的次邻图像块,例如,当前图像块上侧的所有次邻图像块,或当前图像块上侧的第一个次邻图像块,或当前图像块上侧的任意一个或多个次邻图像块。此外,当当前图像块上侧存在帧内模式的相邻图像块时,则第一候选图像块还可以包括帧内模式的相邻图像块,例如,当前图像块上侧的第一个帧内模式的相邻图像块,当前图像块上侧的所有帧内模式的相邻图像块等。当然,上述只是第一候选图像块的示例,对此不做限制。
其中,第二候选图像块包括当前图像块左侧的相邻图像块和/或次邻图像块;相邻图像块的预测模式为帧间模式或者帧内模式;次邻图像块的预测模式为帧间模式。例如,第二候选图像块可以包括至少一个预测模式为帧间模式的相邻图像块,例如,当前图像块左侧的所有相邻图像块、或当前图像块左侧的第一个相邻图像块、或当前图像块左侧的任意一个或多个相邻图像块。此外,当当前图像块左侧的相邻图像块均为帧内模式时,则第二候选图像块还可以包括至少一个预测模式为帧间模式的次邻图像块,例如,当前图像块左侧的所有次邻图像块,或当前图像块左侧的第一个次邻图像块,或当前图像块 左侧的任意一个或多个次邻图像块。此外,当当前图像块左侧存在帧内模式的相邻图像块时,则第二候选图像块还可以包括帧内模式的相邻图像块,例如,当前图像块左侧的第一个帧内模式的相邻图像块,当前图像块左侧的所有帧内模式的相邻图像块等。当然,上述只是第二候选图像块的示例,对此不做限制。
其中,当前图像块的相邻图像块包括但不限于:当前图像块的空域相邻图像块(即同一帧图像中的相邻图像块);或者,当前图像块的时域相邻图像块(即不同帧图像中的相邻图像块)。当前图像块的次邻图像块包括但不限于:当前图像块的空域次邻图像块(即同一帧图像中的次邻图像块);或者,当前图像块的时域次邻图像块(即不同帧图像中的次邻图像块)。
在一个例子中,当M大于1时,则第一模板可以包括M个子模板或者P个子模板,且由M个子模板或者P个子模板拼接而成,P可以为帧间模式的第一候选图像块的数量,P小于或等于M。例如,当M个第一候选图像块均为帧间模式的候选图像块时,则第一模板可以包括M个子模板,且由M个子模板拼接而成。又例如,当M个第一候选图像块包括P个帧间模式的候选图像块、并包括M-P个帧内模式的候选图像块时,则第一模板可以包括M个子模板(即每个候选图像块对应一个子模板),且由M个子模板拼接而成,或者,第一模板可以包括P个子模板(即P个帧间模式的候选图像块对应的P个子模板),且由P个子模板拼接而成。
此外,当M等于1时,则第一模板可以包括第一子模板,该第一子模板可以是根据当前图像块上侧的首个候选图像块的运动矢量预测模式和运动信息确定的;或者,第一子模板可以是根据当前图像块上侧的任意一个候选图像块的运动矢量预测模式和运动信息确定的。其中,由于第一候选图像块包括至少一个预测模式为帧间模式的相邻图像块或次邻图像块,因此,M等于1时,第一模板包括的是帧间模式的相邻图像块或次邻图像块对应的第一子模板。
在一个例子中,运动信息可以包括第一候选图像块的运动矢量和参考帧索引,基于此,根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板,可以包括但不限于:
情况一、针对M个第一候选图像块中的第i个候选图像块,当确定第i个候选图像块的运动矢量预测模式为帧间模式时,则根据第i个候选图像块的参考帧索引确定第i个候选图像块对应的参考帧图像;根据第i个候选图像块的运动矢量,从该参考帧图像中确定第i个候选图像块对应的参考图像块,该参考图像块与第i个候选图像块的相对位置偏移,与第i个候选图像块的运动矢量相匹配;然后,可以根据确定的参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为第一模板包括的第i个子模板。
情况二、针对M个第一候选图像块中的第i个候选图像块,当确定第i个候选图像块的运动矢量预测模式为帧内模式时,则将第i个候选图像块按照默认值(如默认像素值,可以是根据经验预先配置的亮度值)填充,基于默认值填充后的图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为第一模板包括的第i个子模板。
情况三、针对M个第一候选图像块中的第i个候选图像块,当确定第i个候选图像块的运动矢量预测模式为帧内模式时,根据第i个候选图像块对应的参考帧索引确定第 i个候选图像块对应的参考帧图像;根据第i个候选图像块对应的运动矢量,从参考帧图像中确定第i个候选图像块对应的参考图像块,参考图像块与第i个候选图像块的相对位置偏移与第i个候选图像块对应的运动矢量相匹配(例如,相等或近似相等);根据确定的参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为第一模板包括的第i个子模板;其中,第i个候选图像块对应的参考帧索引和运动矢量,是第i个候选图像块的相邻图像块的参考帧索引和运动矢量。
其中,第一横向长度与第一候选图像块的横向长度满足第一比例关系(如1:1,1:2,2:1等,对此不做限制),或者与当前图像块的横向长度满足第二比例关系(如1:1,1:2,2:1等),或者等于第一预设长度(根据经验配置)。
其中,第一纵向长度与第一候选图像块的纵向长度满足第三比例关系(如1:1,1:2,2:1等),或者与当前图像块的纵向长度满足第四比例关系(如1:1,1:2,2:1等),或者等于第二预设长度(即根据经验配置的长度)。
其中,第一比例关系、第二比例关系、第三比例关系和第四比例关系可以设置为相同,也可以不同。第一预设长度和第二预设长度可以设置为相同,也可以不同。
在一个例子中,当N大于1时,则第二模板可以包括N个子模板或者R个子模板,且由N个子模板或者R个子模板拼接而成,R可以为帧间模式的第二候选图像块的数量,R小于或等于N。例如,当N个第二候选图像块均为帧间模式的候选图像块时,第二模板可以包括N个子模板,且由N个子模板拼接而成。又例如,当N个第二候选图像块包括R个帧间模式的候选图像块、并包括N-R个帧内模式的候选图像块时,则第二模板可以包括N个子模板(即每个候选图像块对应一个子模板),且由N个子模板拼接而成,或者,第二模板可以包括R个子模板(即R个帧间模式的候选图像块对应的R个子模板),且由R个子模板拼接而成。
此外,当N等于1时,则第二模板可以包括第二子模板,该第二子模板可以是根据当前图像块左侧的首个候选图像块的运动矢量预测模式和运动信息确定的;或者,第二子模板可以是根据当前图像块左侧的任意一个候选图像块的运动矢量预测模式和运动信息确定的。其中,由于第二候选图像块包括至少一个预测模式为帧间模式的相邻图像块或次邻图像块,因此,N等于1时,第二模板包括的是帧间模式的相邻图像块或次邻图像块对应的第二子模板。
在一个例子中,运动信息可以包括第二候选图像块的运动矢量和参考帧索引,基于此,根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板,可以包括但不限于:
情况一、针对N个第二候选图像块中的第i个候选图像块,当确定第i个候选图像块的运动矢量预测模式为帧间模式时,则根据参考帧索引确定第i个候选图像块对应的参考帧图像;根据第i个候选图像块的运动矢量,从该参考帧图像中确定第i个候选图像块对应的参考图像块,该参考图像块与第i个候选图像块的相对位置偏移,与第i个候选图像块的运动矢量相匹配;然后,可以根据确定的参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为第二模板包括的第i个子模板。
情况二、针对N个第二候选图像块中的第i个候选图像块,当确定第i个候选图像块的运动矢量预测模式为帧内模式时,则将第i个候选图像块按照默认值(如默认像素值,可以是根据经验预先配置的亮度值)填充,基于默认值填充后的图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为第二模板包括的第i个子模板。
情况三、针对N个第二候选图像块中的第i个候选图像块,当确定第i个候选图像块的运动矢量预测模式为帧内模式时,根据第i个候选图像块对应的参考帧索引确定第i个候选图像块对应的参考帧图像;根据第i个候选图像块对应的运动矢量,从参考帧图像中确定第i个候选图像块对应的参考图像块,参考图像块与第i个候选图像块的相对位置偏移与第i个候选图像块对应的运动矢量相匹配(例如,相等或近似相等);根据确定的参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为第二模板包括的第i个子模板;其中,第i个候选图像块对应的参考帧索引和运动矢量,是第i个候选图像块的相邻图像块的参考帧索引和运动矢量。
其中,第二横向长度与第二候选图像块的横向长度满足第五比例关系(如1:1,1:2,2:1等,对此不做限制),或者与当前图像块的横向长度满足第六比例关系(如1:1,1:2,2:1等),或者等于第三预设长度(根据经验配置)。
其中,第二纵向长度与第二候选图像块的纵向长度满足第七比例关系(如1:1,1:2,2:1等),或者与当前图像块的纵向长度满足第八比例关系(如1:1,1:2,2:1等),或者等于第四预设长度(即根据经验配置的长度)。
其中,第五比例关系、第六比例关系、第七比例关系和第八比例关系可以设置为相同,也可以不同。第三预设长度和第四预设长度可以设置为相同,也可以不同。
在一个例子中,根据候选图像块的运动信息获取当前图像块的模板,还可以包括但不限于:当当前图像块对应多个运动信息(包括当前图像块的原始运动矢量)时,根据每个运动信息获取该运动信息对应的模板,每个模板的获取方式参见上述实施例。然后,获取每个运动信息对应的权重,并根据每个运动信息对应的权重以及该运动信息对应的模板获取当前图像块的模板。例如,基于每个运动信息对应的权重以及该运动信息对应的模板,基于加权平均方式获取当前图像块的模板。
例如,当前图像块对应运动信息A和运动信息B,采用上述实施例获取运动信息A对应的模板TA,并采用上述实施例获取运动信息B对应的模板TB。
然后,可以获取运动信息A的权重W1和运动信息B的权重W2,这样,当前图像块的模板可以为(TA*W1+TB*W2)/2。
以下结合几个具体情况,对当前图像块的模板进行详细说明。
情况一:候选图像块可以包括当前图像块上侧的所有帧间模式的相邻图像块,以及,当前图像块左侧的所有帧间模式的相邻图像块。
参见图3B所示,对于当前图像块A1,若左侧存在帧间模式的相邻图像块,如图像块A3和图像块A4,则可以将帧间模式的图像块A3和图像块A4确定为当前图像块A1的候选图像块。类似的,若上侧存在帧间模式的相邻图像块,如图像块A2,则可以将帧间模式的图像块A2确定为当前图像块A1的候选图像块。
其中,若左侧没有可用图像块,或者,虽然左侧有可用图像块,但是可用图像块均是帧内模式,则可以说明当前图像块A1的左侧没有候选图像块。类似的,若上侧没有可用图像块,或者,虽然上侧有可用图像块,但是可用图像块均是帧内模式,则可以说明当前图像块A1的上侧没有候选图像块。若左侧和上侧均没有候选图像块,则可以说明当前图像块A1没有候选图像块。
此外,若当前图像块A1没有候选图像块,则不再采用本实施例的技术方案,而是采用传统方式,对此不再赘述。若当前图像块A1有候选图像块,如左侧的候选图像块和/或上侧的候选图像块,则采用本实施例的技术方案。
在一个例子中,在确定出候选图像块为图像块A2、图像块A3和图像块A4后,就可以根据图像块A2的运动信息、图像块A3的运动信息和图像块A4的运动信息,获取当前图像块A1的模板。例如,针对图像块A2,可以根据参考帧索引确定图像块A2对应的参考帧图像,从该参考帧图像中选取与图像块A2对应的图像块B2,根据图像块A2的运动矢量对图像块B2进行移动,得到与图像块A2对应的参考图像块B2’,同理,可以得到与图像块A3对应的参考图像块B3’,与图像块A4对应的参考图像块B4’,参见图3C所示。然后,可以根据参考图像块B2’、参考图像块B3’和参考图像块B4’获得当前图像块A1的模板。
在一个例子中,假设当前图像块A1上侧模板的横向长度为W,纵向长度为S,W的取值可以根据经验配置,S的取值可以根据经验配置,对于W和S的取值均不做限制。例如,W可以为当前图像块A1的横向长度,为候选图像块A2的横向长度,为当前图像块A1的横向长度的2倍等,S可以为候选图像块A2的纵向长度,为候选图像块A2的纵向长度的1/3等。在此基础上,参见图3D,示出了参考图像块B2’对应的模板。在图3D中,是以W为候选图像块A2的横向长度为例,即W为参考图像块B2’的横向长度;是以S为候选图像块A2的纵向长度的1/3为例,即S为参考图像块B2’的纵向长度的1/3。
假设当前图像块A1左侧模板的横向长度为R,纵向长度为H,R的取值可以根据经验配置,H的取值可以根据经验配置,对于R和H的取值均不做限制。例如,H可以为当前图像块A1的纵向长度,为候选图像块A3的纵向长度,R可以为候选图像块A3的横向长度,为候选图像块A3的横向长度的1/3等。在此基础上,参见图3D,示出了参考图像块B3’对应的模板,是以H为候选图像块A3的纵向长度为例,以R为候选图像块A3的横向长度的1/3为例。
同理,参考图像块B4’对应的模板也可以参见图3D所示,在此不再赘述。
在一个例子中,假设当前图像块上侧有M个不同模式的候选图像块,则针对第i个候选图像块,假设其横向长度为w i,则判断该候选图像块的预测模式。
若为帧内模式,则不再生成子模板,或者,按照默认值(如默认像素值,可以是根据经验预先配置的亮度值)填充,作为上侧模板(第一模板)的第i个子模板。
若为帧间模式,则获取第i个候选图像块的运动信息(如运动矢量和参考帧索引等),基于该运动矢量和该参考帧索引生成横向长度为w i,纵向长度为S的模板,作为 上侧模板的第i个子模板。具体的,若运动矢量为MV,参考帧索引为idx,则在当前帧的第idx个参考图像中找到相对位置偏移为MV的横向长度为w i,纵向长度为S的矩形块,作为上侧模板的第i个子模板。
假设当前图像块左侧有N个不同模式的候选图像块,则针对第i个候选图像块,假设纵向长度为h i,横向长度为R,则判断该候选图像块的预测模式。
若为帧内模式,则不再生成子模板,或者,按照默认值(如默认像素值,可以是根据经验预先配置的亮度值)填充,作为左侧模板(第二模板)的第i个子模板。
若为帧间模式,则获取第i个候选图像块的运动信息(如运动矢量和参考帧索引等),基于该运动矢量和该参考帧索引生成横向长度为R,纵向长度为h i的模板,作为左侧模板的第i个子模板。具体的,若运动矢量为MV,参考帧索引为idx,则在当前帧的第idx个参考图像中找到相对位置偏移为MV的横向长度为R,纵向长度为h i的矩形块,作为左侧模板的第i个子模板。
进一步的,上侧模板可以由上侧的所有子模板拼接而成,左侧模板可以由左侧的所有子模板拼接而成,上侧模板和左侧模板就拼接成当前图像块的模板。
情况二:候选图像块可以包括当前图像块上侧的第一个帧间模式的相邻图像块,以及,当前图像块左侧的第一个帧间模式的相邻图像块。
参见图3E所示,对于当前图像块A1,若左侧的第一个图像块A3是帧间模式,则可以将图像块A3确定为当前图像块A1的候选图像块。若上侧的第一个图像块A2是帧间模式,则可以将图像块A2确定为当前图像块A1的候选图像块。
其中,若左侧没有可用图像块,或者,左侧的第一个图像块是帧内模式,则当前图像块A1的左侧没有候选图像块。若上侧没有可用图像块,或者,上侧的第一个图像块是帧内模式,则当前图像块A1的上侧没有候选图像块。若左侧和上侧均没有候选图像块,则当前图像块A1没有候选图像块。
进一步的,若当前图像块A1没有候选图像块,则不再采用本实施例的技术方案,而是采用传统方式,对此不再赘述。若当前图像块A1有候选图像块,如左侧的候选图像块和/或上侧的候选图像块,则采用本实施例的技术方案。
在确定出候选图像块为图像块A2和图像块A3后,可以根据图像块A2的运动信息和图像块A3的运动信息,获取当前图像块A1的模板。例如,可以根据参考帧索引确定图像块A2对应的参考帧图像,从参考帧图像中选取与图像块A2对应的图像块B2,根据图像块A2的相邻运动矢量对图像块B2进行移动,得到与图像块A2对应的参考图像块B2’,同理,可以得到与图像块A3对应的参考图像块B3’,可以根据参考图像块B2’和参考图像块B3’获得模板。
在一个例子中,假设当前图像块A1上侧模板的横向长度为W,纵向长度为S,W的取值可以根据经验配置,S的取值可以根据经验配置,对于W和S的取值均不做限制。例如,W可以为当前图像块A1的横向长度,为候选图像块A2的横向长度,S可以为候选图像块A2的纵向长度,为候选图像块A2的纵向长度的1/3等。参见图3F所示,示出了参考图像块B2’对应的模板。
假设当前图像块A1左侧模板的横向长度为R,纵向长度为H,R的取值可以根据经验配置,H的取值可以根据经验配置,对于R和H的取值均不做限制。例如,H可以为当前图像块A1的纵向长度,为候选图像块A3的纵向长度等,R可以为候选图像块A3的横向长度,为候选图像块A3的横向长度的1/3等。在此基础上,参见图3F所示,示出了参考图像块B3’对应的模板。
在一个例子中,假设当前图像块上侧有M个不同模式的候选图像块,则针对上侧的第一个候选图像块,假设其横向长度为w,纵向长度为S,则判断该候选图像块的预测模式。若为帧内模式,则不再生成模板,或者,按照默认值(如默认像素值,可以是根据经验预先配置的亮度值)填充,作为上侧模板。若为帧间模式,则获取该候选图像块的运动信息(如运动矢量和参考帧索引等),基于运动矢量和参考帧索引生成横向长度为w,纵向长度为S的模板,作为上侧模板。
假设当前图像块左侧有N个不同模式的候选图像块,针对左侧的第一个候选图像块,假设纵向长度为h,横向长度为R,则判断该候选图像块的预测模式。若为帧内模式,则不再生成模板,或按照默认值填充,作为左侧模板。若为帧间模式,获取该候选图像块的运动信息(如运动矢量和参考帧索引),基于运动矢量和参考帧索引生成横向长度为R,纵向长度为h的模板,作为左侧模板。
情况三:候选图像块可以包括当前图像块上侧的第一个帧间模式的相邻图像块,以及,当前图像块左侧的第一个帧间模式的相邻图像块。
参见图3G所示,与情况二的图3F相比,在情况三中,当前图像块A1上侧模板的横向长度W,其取值为当前图像块A1的横向长度,当前图像块A1左侧模板的纵向长度H,其取值为当前图像块A1的纵向长度,其它过程与情况二类似,不再赘述。
情况四:候选图像块可以包括当前图像块上侧的帧间模式的相邻图像块、当前图像块上侧的帧间模式的次邻图像块(即相邻图像块为帧内模式时,选择该相邻图像块对应的与当前图像块是次邻的图像块)、当前图像块左侧的帧间模式的相邻图像块、当前图像块左侧的次邻图像块。
例如,参见图3H所示,对于当前图像块A1,左侧存在帧间模式的相邻图像块,如图像块A3和图像块A4,则可以将帧间模式的图像块A3和图像块A4确定为当前图像块A1的候选图像块。类似的,上侧存在帧间模式的相邻图像块,如图像块A2,则可以将帧间模式的图像块A2确定为当前图像块A1的候选图像块。
此外,左侧存在帧内模式的相邻图像块,如图像块A7,且图像块A7左侧存在帧间模式的图像块A8,即图像块A8是当前图像块A1左侧的次邻图像块,因此,可以将帧间模式的图像块A8确定为当前图像块A1的候选图像块。
类似的,上侧存在帧内模式的相邻图像块,如图像块A5,且图像块A5上侧存在帧间模式的图像块A6,即图像块A6是当前图像块A1上侧的次邻图像块,因此,可以将帧间模式的图像块A6确定为当前图像块A1的候选图像块。
在确定出候选图像块为图像块A2、图像块A3、图像块A4、图像块A6和图像块A8后,根据图像块A2的运动信息、图像块A3的运动信息、图像块A4的运动信息、 图像块A6的运动信息和图像块A8的运动信息,获取当前图像块A1的模板,具体获取方式参见情况一,只是多了根据图像块A6的运动信息和图像块A8的运动信息获取模板,在此不再赘述,模板最终参见图3I所示。
情况五:若当前图像块上侧的第一个相邻图像块为帧内模式,且该第一个相邻图像块上侧的图像块为帧间模式,则候选图像块可以包括当前图像块上侧的帧间模式的次邻图像块。此外,若当前图像块左侧的第一个相邻图像块为帧内模式,且该第一个相邻图像块左侧的图像块为帧间模式,则候选图像块可以包括当前图像块左侧的帧间模式的次邻图像块。
参见图3J所示,对于当前图像块A1,若上侧的第一个图像块A2是帧内模式,且图像块A2上侧存在帧间模式的图像块A4,即图像块A4是当前图像块A1上侧的次邻图像块,因此,可以将帧间模式的图像块A4确定为当前图像块A1的候选图像块。
此外,若左侧的第一个图像块A3是帧内模式,且图像块A3左侧存在帧间模式的图像块A5,即图像块A5是当前图像块A1左侧的次邻图像块,因此,可以将帧间模式的图像块A5确定为当前图像块A1的候选图像块。
在确定出候选图像块为图像块A4和图像块A5后,可以根据图像块A4的运动信息和图像块A5的运动信息,获取当前图像块A1的模板,具体获取方式参见情况二和情况三,在此不再赘述,模板最终参见图3K或者图3L所示。
情况六:候选图像块可以包括当前图像块上侧的帧间模式的相邻图像块、当前图像块上侧的帧内模式的相邻图像块、当前图像块左侧的帧间模式的相邻图像块、当前图像块左侧的帧内模式的相邻图像块。
例如,参见图3H所示,对于当前图像块A1,左侧存在帧间模式的相邻图像块,如图像块A3和图像块A4,则可以将帧间模式的图像块A3和图像块A4确定为当前图像块A1的候选图像块。类似的,上侧存在帧间模式的相邻图像块,如图像块A2,则可以将帧间模式的图像块A2确定为当前图像块A1的候选图像块。
左侧存在帧内模式的相邻图像块,如图像块A7,可以将帧内模式的图像块A7确定为当前图像块A1的候选图像块。上侧存在帧内模式的相邻图像块,如图像块A5,可以将帧内模式的图像块A5确定为当前图像块A1的候选图像块。
在确定出候选图像块为图像块A2、图像块A3、图像块A4、图像块A5和图像块A7后,根据图像块A2的运动信息、图像块A3的运动信息、图像块A4的运动信息、图像块A5的运动信息和图像块A7的运动信息,获取当前图像块A1的模板,具体获取方式参见情况一,只是多了根据图像块A5的运动信息和图像块A7的运动信息获取模板,在此不再赘述,模板最终参见图3M所示。
需要注意的是,在根据图像块A5的运动信息获取模板时,由于图像块A5是帧内模式,不具有运动信息,因此,可以将图像块A5的相邻图像块(即图像块A6)的运动信息确定为图像块A5的运动信息,在得到图像块A5的运动信息后,就可以利用图像块A5的运动信息获取模板,具体获取方式参见情况一。
同理,在根据图像块A7的运动信息获取模板时,由于图像块A7是帧内模式, 不具有运动信息,因此可以将图像块A7的相邻图像块(即图像块A8)的运动信息确定为图像块A5的运动信息,并利用图像块A5的运动信息获取模板。
情况七:若当前图像块上侧的第一个相邻图像块为帧内模式,且该第一个相邻图像块上侧的图像块为帧间模式,则候选图像块可以包括当前图像块上侧的第一个帧内模式的相邻图像块。此外,若当前图像块左侧的第一个相邻图像块为帧内模式,且该第一个相邻图像块左侧的图像块为帧间模式,则候选图像块可以包括当前图像块左侧的第一个帧内模式的相邻图像块。
参见图3J所示,对于当前图像块A1,若上侧第一个图像块A2是帧内模式,图像块A2上侧存在帧间模式的图像块A4,将帧内模式的图像块A2确定为当前图像块A1的候选图像块。若左侧第一个图像块A3是帧内模式,图像块A3左侧存在帧间模式的图像块A5,将帧内模式的图像块A3确定为当前图像块A1的候选图像块。
在确定出候选图像块为图像块A2和图像块A3后,可以根据图像块A2的运动信息和图像块A3的运动信息,获取当前图像块A1的模板,具体获取方式参见情况二和情况三,在此不再赘述,模板最终参见图3N或者3O所示。
需要注意的是,在根据图像块A2的运动信息获取模板时,由于图像块A2是帧内模式,不具有运动信息,因此,可以将图像块A2的相邻图像块(即图像块A4)的运动信息确定为图像块A2的运动信息,并利用图像块A2的运动信息获取模板。在根据图像块A3的运动信息获取模板时,由于图像块A3是帧内模式,不具有运动信息,因此可以将图像块A3的相邻图像块(即图像块A5)的运动信息确定为图像块A3的运动信息,并利用图像块A3的运动信息获取模板。
实施例三:
在步骤203中,编码端根据当前图像块对应的原始运动矢量和获取的模板,得到基于模板的目标运动矢量,其实现流程可以参见图4A所示,可以包括:
步骤401,编码端将原始运动矢量确定为中心运动矢量。
步骤402,编码端确定与该中心运动矢量对应的边缘运动矢量。
其中,该边缘运动矢量可以与该中心运动矢量不同。
其中,编码端确定与该中心运动矢量对应的边缘运动矢量,可以包括:将该中心运动矢量(x,y)向不同方向移动偏移量S,从而得到不同方向的边缘运动矢量(x-S,y)、边缘运动矢量(x+S,y)、边缘运动矢量(x,y+S)、边缘运动矢量(x,y-S)。例如,在水平方向上,可以将中心运动矢量(x,y)向左移动偏移量S,得到边缘运动矢量(x-S,y);在水平方向上,可以将中心运动矢量(x,y)向右移动偏移量S,得到边缘运动矢量(x+S,y);在垂直方向上,可以将中心运动矢量(x,y)向上移动偏移量S,得到边缘运动矢量(x,y+S);在垂直方向上,可以将中心运动矢量(x,y)向下移动偏移量S,得到边缘运动矢量(x,y-S)。
其中,偏移量S的初始值可以根据经验配置,如可以为2、4、8、16等。
假设中心运动矢量为(3,3),偏移量S为4,则边缘运动矢量为边缘运动矢 量(7,3)、边缘运动矢量(3,7)、边缘运动矢量(-1,3)、边缘运动矢量(3,-1)。
步骤403,编码端根据当前图像块的模板获得中心运动矢量的编码性能,并根据当前图像块的模板获得边缘运动矢量的编码性能。
情况一,编码端根据当前图像块的模板获得中心运动矢量的编码性能,可以包括但不限于:根据当前图像块的模板的参数信息和第一目标参考块的参数信息,确定中心运动矢量的编码性能,第一目标参考块可以为模板对应的参考图像块基于中心运动矢量进行偏移之后获得的图像块。具体的,编码端可以根据模板的参数信息和第一目标参考块的参数信息,确定中心运动矢量的预测性能,并根据中心运动矢量的预测性能确定中心运动矢量的编码性能;例如,可以根据该预测性能和编码所需的实际比特数,确定中心运动矢量的编码性能。
其中,上述参数信息可以为亮度值;或者,可以为亮度值和色度值。
假设参数信息为亮度值,为了确定中心运动矢量的编码性能,可以先获取当前图像块的模板的亮度值、第一目标参考块的亮度值。例如,在得到当前图像块的模板后,可以获取模板的每个像素点的亮度值,并获取该模板的参考图像块,假设中心运动矢量为(3,3),则可以利用中心运动矢量(3,3)移动该参考图像块,得到与参考图像块对应的图像块X(如对参考图像块向右移动3个像素点,向上移动3个像素点,将处理后的图像块记为图像块X),而图像块X就是第一目标参考块,且可以获取图像块X的每个像素点的亮度值。
基于模板的每个像素点的亮度值、图像块X的每个像素点的亮度值,可以采用如下公式确定中心运动矢量的预测性能:
Figure PCTCN2019093709-appb-000001
SAD是可用绝对差总和,用于表示中心运动矢量的预测性能。TM i表示模板的第i个像素点的亮度值,TMP i表示图像块X的第i个像素点的亮度值,M表示像素点的总数量。
假设参数信息为亮度值和色度值,则利用如下公式确定中心运动矢量的亮度值预测性能SAD,
Figure PCTCN2019093709-appb-000002
并采用如下公式确定中心运动矢量的色度值预测性能:
Figure PCTCN2019093709-appb-000003
亮度值预测性能SAD和色度值预测性能CSAD的平均值,就是中心运动矢量的预测性能。其中,CSAD是可用绝对差总和,用于表示中心运动矢量的色度值预测性能,CTM i表示模板第i个像素点的色度值,CTMP i表示图像块X第i个像素点的色度值,M c表 示像素点总数量。
进一步的,在得到中心运动矢量的预测性能后,则可以根据该预测性能和编码所需的实际比特数,确定中心运动矢量的编码性能。例如,可以采用RDO(Rate Distortion Optimized,率失真原则)确定中心运动矢量的编码性能,而RDO通常采用如下公式确定中心运动矢量的编码性能:J=D+λ*R。其中,J表示编码性能,D表示预测性能,λ是拉格朗日乘子,是根据经验配置的数值,R是图像块编码所需的实际比特数,即编码比特流携带信息的比特总和。
情况二,编码端根据当前图像块的模板获得边缘运动矢量的编码性能,可以包括但不限于:根据当前图像块的模板的参数信息和第二目标参考块的参数信息,确定边缘运动矢量的编码性能,第二目标参考块可以为模板对应的参考图像块基于边缘运动矢量进行偏移之后获得的图像块。具体的,编码端可以根据模板的参数信息和第二目标参考块的参数信息,确定边缘运动矢量的预测性能,并根据边缘运动矢量的预测性能确定中心运动矢量的编码性能;例如,可以根据该预测性能和编码所需的实际比特数,确定边缘运动矢量的编码性能。
其中,上述参数信息可以为亮度值;或者,可以为亮度值和色度值。
情况二与情况一类似,区别在于:在情况二中,利用边缘运动矢量移动模板的参考图像块,得到第二目标参考块,并利用第二目标参考块获得边缘运动矢量的编码性能,而情况一中,利用中心运动矢量移动模板的参考图像块,得到第一目标参考块,并利用第一目标参考块获得中心运动矢量的编码性能。
步骤404,编码端根据中心运动矢量的编码性能和边缘运动矢量的编码性能,从中心运动矢量和边缘运动矢量中确定目标运动矢量。
具体的,编码端可以从中心运动矢量和边缘运动矢量中选择编码性能最优的运动矢量;当该编码性能最优的运动矢量不是原始运动矢量时,可以将该编码性能最优的运动矢量确定为目标运动矢量;当该编码性能最优的运动矢量是原始运动矢量时,编码端可以从中心运动矢量和边缘运动矢量中选择编码性能次优的运动矢量,并将编码性能次优的运动矢量确定为目标运动矢量。
例如,若编码性能最优的运动矢量是边缘运动矢量(7,3),则编码端可以将边缘运动矢量(7,3)确定为目标运动矢量。若编码性能最优的运动矢量是中心运动矢量为(3,3),也就是原始运动矢量,则编码端还可以将编码性能次优的运动矢量(如边缘运动矢量(7,3)等)确定为目标运动矢量。
实施例四:
在步骤203中,编码端根据当前图像块对应的原始运动矢量和获取的模板,得到基于模板的目标运动矢量,其实现流程可以参见图4A所示,可以包括:
步骤411,编码端将原始运动矢量确定为中心运动矢量。
步骤412,编码端确定与该中心运动矢量对应的边缘运动矢量。
其中,该边缘运动矢量可以与该中心运动矢量不同。
步骤413,编码端根据当前图像块的模板获得中心运动矢量的编码性能,并根据当前图像块的模板获得边缘运动矢量的编码性能。
其中,步骤411-步骤413可以参见步骤401-步骤403,在此不再赘述。
步骤414,编码端判断是否满足目标运动矢量的迭代结束条件。
如果是,则可以执行步骤416;如果否,则可以执行步骤415。
其中,迭代结束条件可以包括但不限于:迭代次数达到次数阈值,或者,执行时间达到时间阈值,或者,偏移量参数S已经被修改为预设数值,如1。
当然,上述只是迭代结束条件的几个示例,对此迭代结束条件不做限制。
步骤415,编码端从中心运动矢量和边缘运动矢量中选择编码性能最优的运动矢量,将编码性能最优的运动矢量确定为新的中心运动矢量,并返回步骤412。
例如,若编码性能最优的运动矢量是边缘运动矢量(7,3),则可以将边缘运动矢量(7,3)确定为新的中心运动矢量,并重新执行步骤412,以此类推。
当第一次执行步骤412时,偏移量参数S的取值可以为初始值,如可以为16。当再次执行步骤412时,先对偏移量参数S的取值进行调整,如调整为上次偏移量参数S减去2,或者,调整为上次偏移量参数S的一半等,对此不做限制,只要调整后的偏移量参数S小于上次偏移量参数S即可,后续以调整为上次偏移量参数S的一半为例。因此,当第二次执行步骤412时,则偏移量参数S的取值为8;当第三次执行步骤412时,则偏移量参数S的取值为4;以此类推。
其中,在对偏移量参数S的取值进行调整后,先判断调整后的偏移量参数S是否小于等于预设数值,如1。如果否,则可以基于调整后的偏移量参数S执行步骤412,对此过程不再赘述。如果是,则可以将偏移量参数S的取值设置为1,并基于该偏移量参数S(即取值1)执行步骤412,而在执行到步骤414时,判断结果为满足迭代结束条件。
步骤416,编码端根据中心运动矢量的编码性能和边缘运动矢量的编码性能,从中心运动矢量和边缘运动矢量中确定目标运动矢量。
其中,步骤416的处理可以参见步骤404,在此不再重复赘述。
实施例五:
在步骤204中,可以获取原始运动矢量的编码性能和目标运动矢量的编码性能,编码端获取原始运动矢量的编码性能,可以包括但不限于:根据当前图像块的模板的参数信息和第三目标参考块的参数信息,确定原始运动矢量的编码性能,第三目标参考块为模板对应的参考图像块基于原始运动矢量进行偏移之后获得的图像块。具体的,可以根据模板的参数信息和第三目标参考块的参数信息,确定原始运动矢量的预测性能,并根据该预测性能确定原始运动矢量的编码性能;例如,根据该预测性能和编码所需的实 际比特数,确定原始运动矢量的编码性能。其中,上述参数信息可以为亮度值;或者,亮度值和色度值。
编码端获取目标运动矢量的编码性能,可以包括但不限于:根据当前图像块的模板的参数信息和第四目标参考块的参数信息,确定目标运动矢量的编码性能,第四目标参考块为模板对应的参考图像块基于目标运动矢量进行偏移之后获得的图像块。具体的,可以根据模板的参数信息和第四目标参考块的参数信息,确定目标运动矢量的预测性能,并根据该预测性能确定目标运动矢量的编码性能;例如,根据该预测性能和编码所需的实际比特数,确定目标运动矢量的编码性能。其中,上述参数信息可以为亮度值;或者,亮度值和色度值。
上述过程与实施例三类似,区别在于:在得到第三目标参考块或者第四目标参考块时,是利用原始运动矢量或者目标运动矢量移动模板的参考图像块,而不是利用中心运动矢量移动模板的参考图像块,在此不再重复赘述。
实施例六:
参见图5所示,为运动矢量确定方法的流程示意图,该方法可以包括:
步骤501,解码端获取当前图像块的候选图像块的运动信息。
其中,当前图像块的候选图像块可以包括但不限于:当前图像块的空域候选图像块;或者,当前图像块的时域候选图像块;对此候选图像块不做限制。
步骤502,解码端根据候选图像块的运动信息获取当前图像块的模板。
其中,解码端根据候选图像块的运动信息获取当前图像块的模板的方法与编码端相同,具体可参见实施例二的相关内容,在此不再赘述。
步骤503,解码端根据当前图像块对应的原始运动矢量和获取的模板,得到基于模板的目标运动矢量,该目标运动矢量与该原始运动矢量可以不同。
在一个例子中,解码端获取当前图像块的候选图像块的运动信息前,解码端还可以获取该当前图像块的编码比特流,该编码比特流可以是编码端发送的,也可以是解码端对比特流进行编码后得到的,对此不做限制,以编码端发送编码比特流为例。
其中,解码端可以接收来自编码端的编码比特流,当该编码比特流携带第一指示信息时,该第一指示信息用于指示基于模板确定当前图像块的最终运动矢量,可以根据第一指示信息,获取当前图像块的候选图像块的运动信息,并根据候选图像块的运动信息获取当前图像块的模板,即执行上述步骤501-503。
其中,解码端可以接收来自编码端的编码比特流,当该编码比特流携带第二指示信息,该第二指示信息用于指示基于当前图像块对应的原始运动矢量确定当前图像块的最终运动矢量时,根据第二指示信息,获取当前图像块对应的原始运动矢量,并根据该原始运动矢量,确定当前图像块的最终运动矢量。
其中,上述方式是采用显式方式通知第一指示信息或者第二指示信息,在实际应用中,还可以采用隐式方式通知,即编码比特流中未携带第一指示信息或者第二指示信息。在这种情况下,解码端可以根据与编码端共同约定的运动矢量决策策略来决定当 前图像块的最终运动矢量的获取方式。例如,解码端可以根据本地预设的第一策略信息,获取当前图像块的候选图像块的运动信息,并根据候选图像块的运动信息获取当前图像块的模板,第一策略信息用于指示基于模板确定当前图像块的最终运动矢量;或者,可以根据本地预设的第二策略信息,获取当前图像块对应的原始运动矢量;根据原始运动矢量,确定当前图像块的最终运动矢量,第二策略信息用于指示基于当前图像块对应的原始运动矢量确定当前图像块的最终运动矢量;或者,可以获取第三策略信息,该第三策略信息表示采用与当前图像块的相邻图像块相同的策略信息确定当前图像块的最终运动矢量;然后,根据该第三策略信息,确定当前图像块的最终运动矢量。
具体的,编码端和解码端可以协商运动矢量决策策略或者通过在标准定义策略,存储在编码端和解码端,如运动矢量决策策略可以为约定第一策略信息;或约定第二策略信息;或约定第三策略信息。
当运动矢量决策策略为约定第一策略信息时,则根据本地预设的第一策略信息,获取当前图像块的候选图像块的运动信息,并根据候选图像块的运动信息获取当前图像块的模板;当运动矢量决策策略为约定第二策略信息时,则根据本地预设的第二策略信息,获取当前图像块对应的原始运动矢量;根据原始运动矢量,确定当前图像块的最终运动矢量;当运动矢量决策策略为第三策略信息时,若当前图像块的相邻图像块的策略信息为第一策略信息,则获取当前图像块的候选图像块的运动信息,并根据候选图像块的运动信息获取当前图像块的模板;若当前图像块的相邻图像块的策略信息为第二策略信息,则获取当前图像块对应的原始运动矢量;根据原始运动矢量,确定当前图像块的最终运动矢量。
在一个例子中,在根据当前图像块对应的原始运动矢量和获取的模板,得到基于模板的目标运动矢量之前,解码端还可以接收来自编码端的编码比特流,该编码比特流携带原始运动矢量在运动矢量列表中的索引值;解码端可以从运动矢量列表中选取与该索引值对应的运动矢量;将选取的运动矢量确定为当前图像块对应的原始运动矢量。如索引值为1时,则获取运动矢量列表的第一个运动矢量,该运动矢量是当前图像块的原始运动矢量。其中,运动矢量列表用于记录与当前图像块相邻的图像块的运动矢量,解码端维护的运动矢量列表与编码端维护的运动矢量列表相同。当然,上述方式只是示例,如可以将当前图像块的候选图像块的运动矢量确定为当前图像块对应的原始运动矢量。
其中,解码端根据当前图像块对应的原始运动矢量和获取的模板,得到基于模板的目标运动矢量的处理过程,可以参见后续实施例,在此不再赘述。
步骤504,解码端根据目标运动矢量确定当前图像块的最终运动矢量,例如,可以将目标运动矢量确定为当前图像块的最终运动矢量。
由以上技术方案可见,可以根据原始运动矢量获取目标运动矢量,并根据目标运动矢量确定当前图像块的最终运动矢量,而不是直接根据原始运动矢量确定当前图像块的最终运动矢量,从而提高运动矢量的精度,提高解码性能。而且,在根据原始运动矢量获取目标运动矢量时,可以根据候选图像块的运动信息获取当前图像块的模板,基于当前图像块的模板,根据原始运动矢量获取目标运动矢量;上述方式可以快速得到当 前图像块的模板,继而根据该模板得到目标运动矢量,可以提高解码效率,减少解码时延。例如,在解码的重建阶段之前,就可以获取当前图像块的模板,并根据模板得到目标运动矢量。
实施例七:
本实施例中,与采用重建信息和预测信息生成模板的方式不同,可以根据当前图像块的候选图像块的运动信息(如运动矢量和参考帧索引等)获取当前图像块的模板。具体的,解码端可以则根据该参考帧索引确定该候选图像块对应的参考帧图像;根据该运动矢量从该参考帧图像中获取与该候选图像块对应的参考图像块,并根据该参考图像块获取该当前图像块的模板。
其中,候选图像块可以包括M个第一候选图像块和N个第二候选图像块,M为大于或等于1的自然数,N为大于或等于0的自然数,或者,M为大于或等于0的自然数,N为大于或等于1的自然数。第一候选图像块为当前图像块上侧的候选图像块,第二候选图像块为当前图像块左侧的候选图像块。第一候选图像块包括当前图像块上侧的相邻图像块和/或次邻图像块;相邻图像块的预测模式为帧间模式或者帧内模式;次邻图像块的预测模式为帧间模式。第二候选图像块包括当前图像块左侧的相邻图像块和/或次邻图像块;相邻图像块的预测模式为帧间模式或者帧内模式;次邻图像块的预测模式为帧间模式。
根据候选图像块的运动信息获取当前图像块的模板,可以包括但不限于:根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板;根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板。然后,将第一模板确定为当前图像块的模板;或者,将第二模板确定为当前图像块的模板;或者,将第一模板和第二模板拼接之后确定为当前图像块的模板。
在一个例子中,当M大于1时,则上述第一模板可以包括M个子模板或者P个子模板,且由M个子模板或P个子模板拼接而成,P为帧间模式的第一候选图像块的数量;当M等于1时,则第一模板可以包括第一子模板,第一子模板是根据当前图像块上侧的首个候选图像块的运动矢量预测模式和运动信息确定的。当N大于1时,则第二模板可以包括N个子模板或者R个子模板,且由N个子模板或R个子模板拼接而成,R为帧间模式的第二候选图像块的数量;当N等于1时,则第二模板可以包括第二子模板,第二子模板是根据当前图像块左侧的首个候选图像块的运动矢量预测模式和运动信息确定的。
在一个例子中,根据候选图像块的运动信息获取当前图像块的模板,还可以包括但不限于:当当前图像块对应多个运动信息时,根据每个运动信息获取该运动信息对应的模板。获取每个运动信息对应的权重,并根据每个运动信息对应的权重以及该运动信息对应的模板获取当前图像块的模板。
其中,实施例七的处理过程与实施例二类似,在此不再重复赘述。
实施例八:
在步骤503中,解码端根据当前图像块对应的原始运动矢量和获取的模板,得 到基于模板的目标运动矢量,其实现流程可以参见图6A所示,可以包括:
步骤601,解码端将原始运动矢量确定为中心运动矢量。
步骤602,解码端确定与该中心运动矢量对应的边缘运动矢量。
其中,该边缘运动矢量可以与该中心运动矢量不同。
其中,确定与中心运动矢量对应的边缘运动矢量,可以包括:将中心运动矢量(x,y)向不同方向移动偏移量S,得到不同方向的边缘运动矢量(x-S,y)、边缘运动矢量(x+S,y)、边缘运动矢量(x,y+S)、边缘运动矢量(x,y-S)。
步骤603,解码端根据当前图像块的模板获得中心运动矢量的编码性能,并根据当前图像块的模板获得边缘运动矢量的编码性能。
其中,解码端根据当前图像块的模板获得中心运动矢量的编码性能,可以包括但不限于:解码端可以根据当前图像块的模板的参数信息和第一目标参考块的参数信息,确定中心运动矢量的编码性能,其中,第一目标参考块为模板对应的参考图像块基于中心运动矢量进行偏移之后获得的图像块。
其中,解码端根据当前图像块的模板获得边缘运动矢量的编码性能,可以包括但不限于:解码端可以根据当前图像块的模板的参数信息和第二目标参考块的参数信息,确定边缘运动矢量的编码性能,其中,第二目标参考块为模板对应的参考图像块基于边缘运动矢量进行偏移之后获得的图像块。
步骤604,解码端根据中心运动矢量的编码性能和边缘运动矢量的编码性能,从中心运动矢量和边缘运动矢量中确定目标运动矢量。
具体的,解码端可以从中心运动矢量和边缘运动矢量中选择编码性能最优的运动矢量;当该编码性能最优的运动矢量不是原始运动矢量时,可以将该编码性能最优的运动矢量确定为目标运动矢量;当该编码性能最优的运动矢量是原始运动矢量时,解码端可以从中心运动矢量和边缘运动矢量中选择编码性能次优的运动矢量,并将编码性能次优的运动矢量确定为目标运动矢量。
步骤601-步骤604的详细处理流程,可以参见实施例三,只是执行主体从编码端变更为解码端,其它处理流程相同,在此不再重复赘述。
实施例九:
在步骤503中,解码端根据当前图像块对应的原始运动矢量和获取的模板,得到基于模板的目标运动矢量,其实现流程可以参见图6B所示,可以包括:
步骤611,解码端将原始运动矢量确定为中心运动矢量。
步骤612,解码端确定与该中心运动矢量对应的边缘运动矢量。
其中,该边缘运动矢量可以与该中心运动矢量不同。
步骤613,解码端根据当前图像块的模板获得中心运动矢量的编码性能,并根据当前图像块的模板获得边缘运动矢量的编码性能。
步骤614,解码端判断是否满足目标运动矢量的迭代结束条件。
如果是,则可以执行步骤616;如果否,则可以执行步骤615。
步骤615,解码端从中心运动矢量和边缘运动矢量中选择编码性能最优的运动矢量,将编码性能最优的运动矢量确定为中心运动矢量,并返回步骤612。
步骤616,解码端根据中心运动矢量的编码性能和边缘运动矢量的编码性能,从中心运动矢量和边缘运动矢量中确定目标运动矢量。
步骤611-步骤616的详细处理流程,可以参见实施例四,只是执行主体从编码端变更为解码端,其它处理流程相同,在此不再重复赘述。
实施例十:
基于与上述方法同样的构思,本公开实施例还提出一种运动矢量确定装置,应用于解码端,如图7所示,为所述装置的结构图,所述装置包括:
获取模块71,用于获取当前图像块的候选图像块的运动信息;根据所述候选图像块的运动信息获取所述当前图像块的模板;根据所述当前图像块对应的原始运动矢量和获取的所述模板,得到基于所述模板的目标运动矢量;确定模块72,用于根据所述目标运动矢量确定所述当前图像块的最终运动矢量。
所述获取模块71还用于:接收来自编码端的所述当前图像块对应的编码比特流,所述编码比特流携带第一指示信息,所述第一指示信息用于指示基于模板确定所述当前图像块的最终运动矢量;根据所述第一指示信息,获取当前图像块的候选图像块的运动信息,根据所述候选图像块的运动信息获取所述当前图像块的模板。
所述获取模块71还用于:接收来自编码端的所述当前图像块对应的编码比特流,所述编码比特流携带第二指示信息,所述第二指示信息用于指示基于当前图像块对应的原始运动矢量确定所述当前图像块的最终运动矢量;根据所述第二指示信息,获取所述当前图像块对应的原始运动矢量;根据所述原始运动矢量,确定所述当前图像块的最终运动矢量。
所述获取模块71还用于:根据本地预设的第一策略信息,获取当前图像块的候选图像块的运动信息,根据所述候选图像块的运动信息获取所述当前图像块的模板;所述第一策略信息用于指示基于模板确定所述当前图像块的最终运动矢量;或者,根据本地预设的第二策略信息,获取所述当前图像块对应的原始运动矢量;根据所述原始运动矢量,确定所述当前图像块的最终运动矢量;所述第二策略信息用于指示基于当前图像块对应的原始运动矢量确定所述当前图像块的最终运动矢量;或者,获取第三策略信息,所述第三策略信息表示采用与当前图像块的相邻图像块相同的策略信息确定所述当前图像块的最终运动矢量;根据所述第三策略信息,确定所述当前图像块的最终运动矢量。
所述获取模块71还用于:接收来自编码端的所述当前图像块对应的编码比特流,所述编码比特流携带原始运动矢量在运动矢量列表中的索引值;从运动矢量列表中选取与所述索引值对应的运动矢量;将选取的所述运动矢量确定为所述当前图像块对应的原始运动矢量;或者,将所述当前图像块的候选图像块的运动矢量确定为所述当前图像块 对应的原始运动矢量。
所述候选图像块包括M个第一候选图像块和N个第二候选图像块,M为大于或等于1的自然数,N为大于或等于0的自然数,或者,M为大于或等于0的自然数,N为大于或等于1的自然数;所述第一候选图像块为所述当前图像块上侧的候选图像块,所述第二候选图像块为所述当前图像块左侧的候选图像块;所述获取模块71根据所述候选图像块的运动信息获取所述当前图像块的模板时具体用于:根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板;根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板;将所述第一模板确定为所述当前图像块的模板;或者,将所述第二模板确定为所述当前图像块的模板;或者,将所述第一模板和所述第二模板拼接之后确定为所述当前图像块的模板。
在一个例子中,所述第一候选图像块包括所述当前图像块上侧的相邻图像块和/或次邻图像块;所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式;所述第二候选图像块包括所述当前图像块左侧的相邻图像块和/或次邻图像块;所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式。
在一个例子中,当所述M大于1时,所述第一模板包括M个子模板或者P个子模板,且由所述M个子模板或所述P个子模板拼接而成,所述P为帧间模式的第一候选图像块的数量;当M等于1时,所述第一模板包括第一子模板,所述第一子模板是根据所述当前图像块上侧的首个候选图像块的运动矢量预测模式和运动信息确定的。
所述运动信息包括所述第一候选图像块的运动矢量和参考帧索引,所述获取模块71根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板时具体用于:针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,根据所述参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块的运动矢量相匹配;根据确定的所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板。
所述获取模块71根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板时具体用于:针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,将所述第i个候选图像块按照默认值填充,并获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板;或者,根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块对应的运动矢量相匹配;根据确定的所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板;其中,所述第i个候选图像块对应的参考帧索引和运 动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。
所述第一横向长度与所述第一候选图像块的横向长度满足第一比例关系,或者与所述当前图像块的横向长度满足第二比例关系,或者等于第一预设长度;
所述第一纵向长度与所述第一候选图像块的纵向长度满足第三比例关系,或者与所述当前图像块的纵向长度满足第四比例关系,或者等于第二预设长度。
在一个例子中,当所述N大于1时,所述第二模板包括N个子模板或者R个子模板,且由所述N个子模板或所述R个子模板拼接而成,所述R为帧间模式的第二候选图像块的数量;当N等于1时,所述第二模板包括第二子模板,所述第二子模板是根据所述当前图像块左侧的首个候选图像块的运动矢量预测模式和运动信息确定的。
所述运动信息包括所述第二候选图像块的运动矢量和参考帧索引,所述获取模块71根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板时具体用于:针对所述N个第二候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,根据所述参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块的运动矢量相匹配;根据确定的所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板。
所述获取模块71根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板时具体用于:针对所述N个第二候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,将所述第i个候选图像块按照默认值填充,并获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板;或者,根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块对应的运动矢量相匹配;根据确定的所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第一模板包括的第i个子模板;其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。
所述第二横向长度与所述第二候选图像块的横向长度满足第五比例关系,或者与所述当前图像块的横向长度满足第六比例关系,或者等于第三预设长度;
所述第二纵向长度与所述第二候选图像块的纵向长度满足第七比例关系,或者与所述当前图像块的纵向长度满足第八比例关系,或者等于第四预设长度。
所述获取模块71根据所述候选图像块的运动信息获取所述当前图像块的模板时具体用于:当所述当前图像块对应多个运动信息时,根据每个运动信息获取该运动信息对应的模板;获取每个运动信息对应的权重,根据每个运动信息对应的权重和所述运动信息对应的模板获取所述当前图像块的模板。
所述获取模块71根据所述当前图像块对应的原始运动矢量和获取的所述模板,得到基于所述模板的目标运动矢量时具体用于:将所述原始运动矢量确定为中心运动矢量;确定与所述中心运动矢量对应的边缘运动矢量,所述边缘运动矢量与所述中心运动矢量不同;根据所述模板获得所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能;根据所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量。
所述获取模块71确定与所述中心运动矢量对应的边缘运动矢量时具体用于:将中心运动矢量(x,y)向不同方向移动偏移量S,得到不同方向的边缘运动矢量(x-S,y)、边缘运动矢量(x+S,y)、边缘运动矢量(x,y+S)、边缘运动矢量(x,y-S)。
所述获取模块71根据所述模板获得所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能时具体用于:根据所述当前图像块的模板的参数信息和第一目标参考块的参数信息,确定所述中心运动矢量的编码性能,其中,所述第一目标参考块为所述模板对应的参考图像块基于所述中心运动矢量进行偏移之后获得的图像块;根据所述当前图像块的模板的参数信息和第二目标参考块的参数信息,确定所述边缘运动矢量的编码性能,所述第二目标参考块为所述模板对应的参考图像块基于所述边缘运动矢量进行偏移之后获得的图像块。
所述获取模块71根据所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量时具体用于:从所述中心运动矢量和所述边缘运动矢量中选择编码性能最优的运动矢量;当编码性能最优的运动矢量不是所述原始运动矢量时,将编码性能最优的运动矢量确定为所述目标运动矢量;当编码性能最优的运动矢量是所述原始运动矢量时,从所述中心运动矢量和所述边缘运动矢量中选择编码性能次优的运动矢量,并将编码性能次优的运动矢量确定为所述目标运动矢量。
所述获取模块71还用于:判断是否满足目标运动矢量的迭代结束条件;如果是,则根据所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量;如果否,则从所述中心运动矢量和所述边缘运动矢量中选择编码性能最优的运动矢量,并将编码性能最优的运动矢量确定为所述中心运动矢量,并返回执行确定与所述中心运动矢量对应的边缘运动矢量的操作。
基于与上述方法同样的构思,本公开实施例还提出一种运动矢量确定装置,应用于编码端,参见图8所示,为所述装置的结构图,所述装置包括:
获取模块81,用于获取当前图像块的候选图像块的运动信息;根据所述候选图像块的运动信息获取所述当前图像块的模板;根据所述当前图像块对应的原始运动矢量和获取的所述模板,得到基于所述模板的目标运动矢量;
发送模块82,用于根据所述原始运动矢量和所述目标运动矢量向解码端发送编码比特流。
所述候选图像块包括M个第一候选图像块和N个第二候选图像块,M为大于或等于1的自然数,N为大于或等于0的自然数,或者,M为大于或等于0的自然数,N 为大于或等于1的自然数;所述第一候选图像块为所述当前图像块上侧的候选图像块,所述第二候选图像块为所述当前图像块左侧的候选图像块;所述获取模块81根据所述候选图像块的运动信息获取所述当前图像块的模板时具体用于:根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板;根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板;将所述第一模板确定为所述当前图像块的模板;或者,将所述第二模板确定为所述当前图像块的模板;或者,将所述第一模板和所述第二模板拼接之后确定为所述当前图像块的模板。
在一个例子中,所述第一候选图像块包括所述当前图像块上侧的相邻图像块和/或次邻图像块;所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式;所述第二候选图像块包括所述当前图像块左侧的相邻图像块和/或次邻图像块;所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式。
在一个例子中,当所述M大于1时,所述第一模板包括M个子模板或者P个子模板,且由所述M个子模板或所述P个子模板拼接而成,所述P为帧间模式的第一候选图像块的数量;当M等于1时,所述第一模板包括第一子模板,所述第一子模板是根据所述当前图像块上侧的首个候选图像块的运动矢量预测模式和运动信息确定的。
所述运动信息包括所述第一候选图像块的运动矢量和参考帧索引,所述获取模块81根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板时具体用于:针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,根据所述参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块的运动矢量相匹配;根据确定的所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板。
所述获取模块81根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板时具体用于:针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,将所述第i个候选图像块按照默认值填充,并获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板;或者,根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块对应的运动矢量相匹配;根据确定的所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板;其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。
所述第一横向长度与所述第一候选图像块的横向长度满足第一比例关系,或者与所述当前图像块的横向长度满足第二比例关系,或者等于第一预设长度;所述第一纵 向长度与所述第一候选图像块的纵向长度满足第三比例关系,或者与所述当前图像块的纵向长度满足第四比例关系,或者等于第二预设长度。
在一个例子中,当所述N大于1时,所述第二模板包括N个子模板或者R个子模板,且由所述N个子模板或所述R个子模板拼接而成,所述R为帧间模式的第二候选图像块的数量;当N等于1时,所述第二模板包括第二子模板,所述第二子模板是根据所述当前图像块左侧的首个候选图像块的运动矢量预测模式和运动信息确定的。
所述运动信息包括所述第二候选图像块的运动矢量和参考帧索引,所述获取模块81根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板时具体用于:针对所述N个第二候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,根据所述参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块的运动矢量相匹配;根据确定的所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板。
所述获取模块81根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板时具体用于:针对所述N个第二候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,将所述第i个候选图像块按照默认值填充,并获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板;或者,根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块对应的运动矢量相匹配;根据确定的所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第一模板包括的第i个子模板;其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。
所述第二横向长度与所述第二候选图像块的横向长度满足第五比例关系,或者与所述当前图像块的横向长度满足第六比例关系,或者等于第三预设长度;
所述第二纵向长度与所述第二候选图像块的纵向长度满足第七比例关系,者与所述当前图像块的纵向长度满足第八比例关系,或者等于第四预设长度。
所述获取模块81根据所述候选图像块的运动信息获取所述当前图像块的模板时具体用于:当所述当前图像块对应多个运动信息时,根据每个运动信息获取该运动信息对应的模板;获取每个运动信息对应的权重,根据每个运动信息对应的权重和所述运动信息对应的模板获取所述当前图像块的模板。
所述获取模块81根据所述当前图像块对应的原始运动矢量和获取的所述模板,得到基于所述模板的目标运动矢量时具体用于:将所述原始运动矢量确定为中心运动矢量;确定与所述中心运动矢量对应的边缘运动矢量,所述边缘运动矢量与所述中心运动矢量不同;根据所述模板获得所述中心运动矢量的编码性能和所述边缘运动矢量的编码 性能;根据所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量。
所述获取模块81确定与所述中心运动矢量对应的边缘运动矢量时具体用于:将中心运动矢量(x,y)向不同方向移动偏移量S,得到不同方向的边缘运动矢量(x-S,y)、边缘运动矢量(x+S,y)、边缘运动矢量(x,y+S)、边缘运动矢量(x,y-S)。
所述获取模块81根据所述模板获得所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能时具体用于:根据所述当前图像块的模板的参数信息和第一目标参考块的参数信息,确定所述中心运动矢量的编码性能,其中,所述第一目标参考块为所述模板对应的参考图像块基于所述中心运动矢量进行偏移之后获得的图像块;根据所述当前图像块的模板的参数信息和第二目标参考块的参数信息,确定所述边缘运动矢量的编码性能,所述第二目标参考块为所述模板对应的参考图像块基于所述边缘运动矢量进行偏移之后获得的图像块。
所述获取模块81根据所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量时具体用于:从所述中心运动矢量和所述边缘运动矢量中选择编码性能最优的运动矢量;当编码性能最优的运动矢量不是所述原始运动矢量时,将编码性能最优的运动矢量确定为所述目标运动矢量;当编码性能最优的运动矢量是所述原始运动矢量时,从所述中心运动矢量和所述边缘运动矢量中选择编码性能次优的运动矢量,并将编码性能次优的运动矢量确定为所述目标运动矢量。
所述获取模块81还用于:判断是否满足目标运动矢量的迭代结束条件;如果是,则根据所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量;如果否,则从所述中心运动矢量和所述边缘运动矢量中选择编码性能最优的运动矢量,并将编码性能最优的运动矢量确定为所述中心运动矢量,并返回执行确定与所述中心运动矢量对应的边缘运动矢量的操作。
所述发送模块82根据所述原始运动矢量和所述目标运动矢量向解码端发送编码比特流时具体用于:获取所述原始运动矢量的编码性能和所述目标运动矢量的编码性能;当所述目标运动矢量的编码性能优于所述原始运动矢量的编码性能时,向解码端发送携带第一指示信息的编码比特流,所述第一指示信息用于指示基于模板确定所述当前图像块的最终运动矢量。
所述发送模块82根据所述原始运动矢量和所述目标运动矢量向解码端发送编码比特流时具体用于:获取所述原始运动矢量的编码性能和所述目标运动矢量的编码性能;当所述原始运动矢量的编码性能优于所述目标运动矢量的编码性能时,向解码端发送携带第二指示信息的编码比特流,第二指示信息用于指示基于当前图像块对应的原始运动矢量确定所述当前图像块的最终运动矢量。
所述发送模块82根据所述原始运动矢量和所述目标运动矢量向解码端发送编码比特流时具体用于:获取所述原始运动矢量在运动矢量列表中的索引值;向解码端发送携带所述索引值的编码比特流。
所述发送模块82获取所述原始运动矢量的编码性能时具体用于:根据所述当前图像块的模板的参数信息和第三目标参考块的参数信息,确定所述原始运动矢量的编码性能,其中,所述第三目标参考块为所述模板对应的参考图像块基于所述原始运动矢量进行偏移之后获得的图像块;
所述发送模块82获取所述目标运动矢量的编码性能时具体用于:根据所述当前图像块的模板的参数信息和第四目标参考块的参数信息,确定所述目标运动矢量的编码性能,其中,所述第四目标参考块为所述模板对应的参考图像块基于所述目标运动矢量进行偏移之后获得的图像块。
本公开实施例提供的解码端设备,从硬件层面而言,其硬件架构示意图具体可以参见图9所示。包括:处理器91和机器可读存储介质92,其中:所述机器可读存储介质92存储有能够被所述处理器91执行的机器可执行指令;所述处理器91用于执行机器可执行指令,以实现上述示例公开的运动矢量确定方法。
基于与上述方法同样的构思,本公开实施例还提供一种机器可读存储介质,所述机器可读存储介质上存储有若干计算机指令,所述计算机指令被处理器执行时,能够实现本公开上述示例公开的运动矢量确定方法。
本公开实施例提供的编码端设备,从硬件层面而言,其硬件架构示意图具体可以参见图10所示。包括:处理器93和机器可读存储介质94,所述机器可读存储介质94存储有能够被所述处理器93执行的机器可执行指令;所述处理器93用于执行机器可执行指令,以实现上述示例公开的运动矢量确定方法。
基于与上述方法同样的构思,本公开实施例还提供一种机器可读存储介质,所述机器可读存储介质上存储有若干计算机指令,所述计算机指令被处理器执行时,能够实现本公开上述示例公开的运动矢量确定方法。
其中,上述机器可读存储介质可以是任何电子、磁性、光学或其它物理存储装置,可以包含或存储信息,如可执行指令、数据,等等。例如,机器可读存储介质可以是:RAM(Radom Access Memory,随机存取存储器)、易失存储器、非易失性存储器、闪存、存储驱动器(如硬盘驱动器)、固态硬盘、任何类型的存储盘(如光盘、DVD等),或者类似的存储介质,或者它们的组合。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本公开时可以把各单元的功能在同一个或多个软件和/或硬件中实现。
本领域内的技术人员应明白,本公开的实施例可提供为方法、系统、或计算机程序产品。因此,本公开可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本公开实施例可采用在一个或多个其中包含有计算机可用 程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本公开是参照根据本公开实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可以由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其它可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其它可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
而且,这些计算机程序指令也可以存储在能引导计算机或其它可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或者多个流程和/或方框图一个方框或者多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其它可编程数据处理设备上,使得在计算机或者其它可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其它可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
以上所述仅为本公开的实施例而已,并不用于限制本公开。对于本领域技术人员来说,本公开可以有各种更改和变化。凡在本公开的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本公开的权利要求范围之内。

Claims (45)

  1. 一种运动矢量确定方法,应用于解码端,包括:
    获取当前图像块的候选图像块的运动信息;
    根据所述候选图像块的运动信息获取所述当前图像块的模板;
    根据所述当前图像块对应的原始运动矢量和获取的所述模板,得到基于所述模板的目标运动矢量;
    根据所述目标运动矢量确定所述当前图像块的最终运动矢量。
  2. 根据权利要求1所述的方法,其特征在于,
    所述获取当前图像块的候选图像块的运动信息之前,所述方法还包括:
    接收来自编码端的所述当前图像块对应的编码比特流,所述编码比特流携带第一指示信息,所述第一指示信息用于指示基于模板确定所述当前图像块的最终运动矢量;
    根据所述第一指示信息,获取当前图像块的候选图像块的运动信息,根据所述候选图像块的运动信息获取所述当前图像块的模板。
  3. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    接收来自编码端的所述当前图像块对应的编码比特流,所述编码比特流携带第二指示信息,所述第二指示信息用于指示基于当前图像块对应的原始运动矢量确定所述当前图像块的最终运动矢量;
    根据所述第二指示信息,获取所述当前图像块对应的原始运动矢量;
    根据所述原始运动矢量,确定所述当前图像块的最终运动矢量。
  4. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    根据本地预设的第一策略信息,获取当前图像块的候选图像块的运动信息,根据所述候选图像块的运动信息获取所述当前图像块的模板;所述第一策略信息用于指示基于模板确定所述当前图像块的最终运动矢量;或者,
    根据本地预设的第二策略信息,获取所述当前图像块对应的原始运动矢量;根据所述原始运动矢量,确定所述当前图像块的最终运动矢量;所述第二策略信息用于指示基于当前图像块对应的原始运动矢量确定所述当前图像块的最终运动矢量;或者,
    获取第三策略信息,所述第三策略信息表示采用与当前图像块的相邻图像块相同的策略信息确定所述当前图像块的最终运动矢量;
    根据所述第三策略信息,确定所述当前图像块的最终运动矢量。
  5. 根据权利要求1至4中任一项所述的方法,其特征在于,
    所述根据所述当前图像块对应的原始运动矢量和获取的所述模板,得到基于所述模板的目标运动矢量之前,所述方法还包括:
    接收来自编码端的所述当前图像块对应的编码比特流,所述编码比特流携带原始运动矢量在运动矢量列表中的索引值;从运动矢量列表中选取与所述索引值对应的运动矢量;
    将选取的所述运动矢量确定为所述当前图像块对应的原始运动矢量。
  6. 根据权利要求1至4中任一项所述的方法,其特征在于,
    在所述根据所述当前图像块对应的原始运动矢量和获取的所述模板,得到基于所述模板的目标运动矢量之前,所述方法还包括:
    将所述当前图像块的候选图像块的运动矢量确定为所述当前图像块对应的原始运 动矢量。
  7. 根据权利要求1至6中任一项所述的方法,其特征在于,所述候选图像块包括M个第一候选图像块和N个第二候选图像块,M为大于或等于1的自然数,N为大于或等于0的自然数,或者,M为大于或等于0的自然数,N为大于或等于1的自然数;所述第一候选图像块为所述当前图像块上侧的候选图像块,所述第二候选图像块为所述当前图像块左侧的候选图像块;
    所述根据所述候选图像块的运动信息获取所述当前图像块的模板,包括:
    根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板;
    根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板;
    将所述第一模板确定为所述当前图像块的模板;或者,
    将所述第二模板确定为所述当前图像块的模板;或者,
    将所述第一模板和所述第二模板拼接之后确定为所述当前图像块的模板。
  8. 根据权利要求7所述的方法,其特征在于,
    所述第一候选图像块包括所述当前图像块上侧的相邻图像块和/或次邻图像块;所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式;所述第二候选图像块包括所述当前图像块左侧的相邻图像块和/或次邻图像块;所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式。
  9. 根据权利要求7所述的方法,其特征在于,当所述M大于1时,所述第一模板包括M个子模板或者P个子模板,且由所述M个子模板或所述P个子模板拼接而成,所述P为帧间模式的第一候选图像块的数量;
    当M等于1时,所述第一模板包括第一子模板,所述第一子模板是根据所述当前图像块上侧的一个候选图像块的运动矢量预测模式和运动信息确定的。
  10. 根据权利要求9所述的方法,其特征在于,所述运动信息包括所述第一候选图像块的运动矢量和参考帧索引,所述根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板,包括:
    针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,根据所述参考帧索引确定所述第i个候选图像块对应的参考帧图像;
    根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块的运动矢量相匹配;
    根据确定的所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板。
  11. 根据权利要求9所述的方法,其特征在于,所述根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板,包括:
    针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,将所述第i个候选图像块按照默认值填充,并获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板;或者,
    根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块对应的运动矢量相匹配;根据确定的所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板;
    其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。
  12. 根据权利要求10或11所述的方法,其特征在于,
    所述第一横向长度与所述第一候选图像块的横向长度满足第一比例关系,或者与所述当前图像块的横向长度满足第二比例关系,或者等于第一预设长度;
    所述第一纵向长度与所述第一候选图像块的纵向长度满足第三比例关系,或者与所述当前图像块的纵向长度满足第四比例关系,或者等于第二预设长度。
  13. 根据权利要求7所述的方法,其特征在于,当所述N大于1时,所述第二模板包括N个子模板或者R个子模板,且由所述N个子模板或所述R个子模板拼接而成,所述R为帧间模式的第二候选图像块的数量;
    当N等于1时,所述第二模板包括第二子模板,所述第二子模板是根据所述当前图像块左侧的一个候选图像块的运动矢量预测模式和运动信息确定的。
  14. 根据权利要求13所述的方法,其特征在于,所述运动信息包括所述第二候选图像块的运动矢量和参考帧索引,所述根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板,包括:
    针对所述N个第二候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,根据所述参考帧索引确定所述第i个候选图像块对应的参考帧图像;
    根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块的运动矢量相匹配;
    根据确定的所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板。
  15. 根据权利要求13所述的方法,其特征在于,所述根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板,包括:
    针对所述N个第二候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,将所述第i个候选图像块按照默认值填充,并获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板;或者,
    根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块对应的运动矢量相匹配;根据确定的所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第一模板包括的第i个子模 板;
    其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。
  16. 根据权利要求14或15所述的方法,其特征在于,
    所述第二横向长度与所述第二候选图像块的横向长度满足第五比例关系,或者与所述当前图像块的横向长度满足第六比例关系,或者等于第三预设长度;
    所述第二纵向长度与所述第二候选图像块的纵向长度满足第七比例关系,或者与所述当前图像块的纵向长度满足第八比例关系,或者等于第四预设长度。
  17. 根据权利要求1至16中任一项所述的方法,其特征在于,
    所述根据所述候选图像块的运动信息获取所述当前图像块的模板,包括:
    当所述当前图像块对应多个运动信息时,根据每个运动信息获取该运动信息对应的模板;
    获取每个运动信息对应的权重,并根据每个运动信息对应的权重以及所述运动信息对应的模板获取所述当前图像块的模板。
  18. 根据权利要求1所述的方法,其特征在于,根据所述当前图像块对应的原始运动矢量和获取的所述模板,得到基于所述模板的目标运动矢量,包括:
    将所述原始运动矢量确定为中心运动矢量;
    确定与所述中心运动矢量对应的边缘运动矢量,所述边缘运动矢量与所述中心运动矢量不同;
    根据所述模板获得所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能;
    根据所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量。
  19. 根据权利要求18所述的方法,其特征在于,
    确定与所述中心运动矢量对应的边缘运动矢量,包括:将中心运动矢量(x,y)向不同方向移动偏移量S,得到不同方向的边缘运动矢量(x-S,y)、边缘运动矢量(x+S,y)、边缘运动矢量(x,y+S)、边缘运动矢量(x,y-S)。
  20. 根据权利要求18所述的方法,其特征在于,所述根据所述模板获得所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,包括:
    根据所述当前图像块的模板的参数信息和第一目标参考块的参数信息,确定所述中心运动矢量的编码性能,其中,所述第一目标参考块为所述模板对应的参考图像块基于所述中心运动矢量进行偏移之后获得的图像块;
    根据所述当前图像块的模板的参数信息和第二目标参考块的参数信息,确定所述边缘运动矢量的编码性能,其中,所述第二目标参考块为所述模板对应的参考图像块基于所述边缘运动矢量进行偏移之后获得的图像块。
  21. 根据权利要求18所述的方法,其特征在于,
    根据所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量,包括:
    从所述中心运动矢量和所述边缘运动矢量中选择编码性能最优的运动矢量;
    当编码性能最优的运动矢量不是所述原始运动矢量时,将编码性能最优的运动矢量确定为所述目标运动矢量;当编码性能最优的运动矢量是所述原始运动矢量时,从所述 中心运动矢量和所述边缘运动矢量中选择编码性能次优的运动矢量,并将编码性能次优的运动矢量确定为所述目标运动矢量。
  22. 根据权利要求18所述的方法,其特征在于,
    根据所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量之前,还包括:
    判断是否满足目标运动矢量的迭代结束条件;
    如果是,则执行根据所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量的操作;
    如果否,则从所述中心运动矢量和所述边缘运动矢量中选择编码性能最优的运动矢量,并将编码性能最优的运动矢量确定为所述中心运动矢量,并返回执行确定与所述中心运动矢量对应的边缘运动矢量的操作。
  23. 一种运动矢量确定方法,其特征在于,应用于编码端,包括:
    获取当前图像块的候选图像块的运动信息;
    根据所述候选图像块的运动信息获取所述当前图像块的模板;
    根据所述当前图像块对应的原始运动矢量和获取的所述模板,得到基于所述模板的目标运动矢量;
    根据所述原始运动矢量和所述目标运动矢量向解码端发送编码比特流。
  24. 根据权利要求23所述的方法,其特征在于,所述候选图像块包括M个第一候选图像块和N个第二候选图像块,M为大于或等于1的自然数,N为大于或等于0的自然数,或者,M为大于或等于0的自然数,N为大于或等于1的自然数;所述第一候选图像块为所述当前图像块上侧的候选图像块,所述第二候选图像块为所述当前图像块左侧的候选图像块;
    所述根据所述候选图像块的运动信息获取所述当前图像块的模板,包括:
    根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板;
    根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板;
    将所述第一模板确定为所述当前图像块的模板;或者,
    将所述第二模板确定为所述当前图像块的模板;或者,
    将所述第一模板和所述第二模板拼接之后确定为所述当前图像块的模板。
  25. 根据权利要求24所述的方法,其特征在于,
    所述第一候选图像块包括所述当前图像块上侧的相邻图像块和/或次邻图像块;所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式;所述第二候选图像块包括所述当前图像块左侧的相邻图像块和/或次邻图像块;所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式。
  26. 根据权利要求24所述的方法,其特征在于,当所述M大于1时,所述第一模板包括M个子模板或者P个子模板,且由所述M个子模板或所述P个子模板拼接而成,所述P为帧间模式的第一候选图像块的数量;
    当M等于1时,所述第一模板包括第一子模板,所述第一子模板是根据所述当前图像块上侧的一个候选图像块的运动矢量预测模式和运动信息确定的。
  27. 根据权利要求26所述的方法,其特征在于,所述运动信息包括所述第一候选 图像块的运动矢量和参考帧索引,所述根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板,包括:
    针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,根据所述参考帧索引确定所述第i个候选图像块对应的参考帧图像;
    根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块的运动矢量相匹配;
    根据确定的所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板。
  28. 根据权利要求26所述的方法,其特征在于,所述根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板,包括:
    针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,将所述第i个候选图像块按照默认值填充,并获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板;或者,
    根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块对应的运动矢量相匹配;根据确定的所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板;
    其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。
  29. 根据权利要求27或28所述的方法,其特征在于,
    所述第一横向长度与所述第一候选图像块的横向长度满足第一比例关系,或者与所述当前图像块的横向长度满足第二比例关系,或者等于第一预设长度;
    所述第一纵向长度与所述第一候选图像块的纵向长度满足第三比例关系,或者与所述当前图像块的纵向长度满足第四比例关系,或者等于第二预设长度。
  30. 根据权利要求24所述的方法,其特征在于,当所述N大于1时,所述第二模板包括N个子模板或者R个子模板,且由所述N个子模板或所述R个子模板拼接而成,所述R为帧间模式的第二候选图像块的数量;
    当N等于1时,所述第二模板包括第二子模板,所述第二子模板是根据所述当前图像块左侧的一个候选图像块的运动矢量预测模式和运动信息确定的。
  31. 根据权利要求30所述的方法,其特征在于,所述运动信息包括所述第二候选图像块的运动矢量和参考帧索引,所述根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板,包括:
    针对所述N个第二候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,根据所述参考帧索引确定所述第i个候选图像块对应的参考帧图像;
    根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块的运动矢量相匹配;
    根据确定的所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板。
  32. 根据权利要求30所述的方法,其特征在于,所述根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板,包括:
    针对所述N个第二候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,将所述第i个候选图像块按照默认值填充,并获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板;或者,
    根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位置偏移与所述第i个候选图像块对应的运动矢量相匹配;根据确定的所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第一模板包括的第i个子模板;
    其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。
  33. 根据权利要求31或32所述的方法,其特征在于,
    所述第二横向长度与所述第二候选图像块的横向长度满足第五比例关系,或者与所述当前图像块的横向长度满足第六比例关系,或者等于第三预设长度;
    所述第二纵向长度与所述第二候选图像块的纵向长度满足第七比例关系,或者与所述当前图像块的纵向长度满足第八比例关系,或者等于第四预设长度。
  34. 根据权利要求23至33中任一项所述的方法,其特征在于,
    所述根据所述候选图像块的运动信息获取所述当前图像块的模板,包括:
    当所述当前图像块对应多个运动信息时,根据每个运动信息获取该运动信息对应的模板;
    获取每个运动信息对应的权重,并根据每个运动信息对应的权重以及所述运动信息对应的模板获取所述当前图像块的模板。
  35. 根据权利要求23所述的方法,其特征在于,根据所述当前图像块对应的原始运动矢量和获取的所述模板,得到基于所述模板的目标运动矢量,包括:
    将所述原始运动矢量确定为中心运动矢量;
    确定与所述中心运动矢量对应的边缘运动矢量,所述边缘运动矢量与所述中心运动矢量不同;
    根据所述模板获得所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能;
    根据所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量。
  36. 根据权利要求35所述的方法,其特征在于,
    确定与所述中心运动矢量对应的边缘运动矢量,包括:将中心运动矢量(x,y)向 不同方向移动偏移量S,得到不同方向的边缘运动矢量(x-S,y)、边缘运动矢量(x+S,y)、边缘运动矢量(x,y+S)、边缘运动矢量(x,y-S)。
  37. 根据权利要求35所述的方法,其特征在于,所述根据所述模板获得所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,包括:
    根据所述当前图像块的模板的参数信息和第一目标参考块的参数信息,确定所述中心运动矢量的编码性能,其中,所述第一目标参考块为所述模板对应的参考图像块基于所述中心运动矢量进行偏移之后获得的图像块;
    根据所述当前图像块的模板的参数信息和第二目标参考块的参数信息,确定所述边缘运动矢量的编码性能,其中,所述第二目标参考块为所述模板对应的参考图像块基于所述边缘运动矢量进行偏移之后获得的图像块。
  38. 根据权利要求35所述的方法,其特征在于,
    根据所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量,包括:
    从所述中心运动矢量和所述边缘运动矢量中选择编码性能最优的运动矢量;
    当编码性能最优的运动矢量不是所述原始运动矢量时,将编码性能最优的运动矢量确定为所述目标运动矢量;当编码性能最优的运动矢量是所述原始运动矢量时,从所述中心运动矢量和所述边缘运动矢量中选择编码性能次优的运动矢量,并将编码性能次优的运动矢量确定为所述目标运动矢量。
  39. 根据权利要求35所述的方法,其特征在于,
    根据所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量之前,还包括:
    判断是否满足目标运动矢量的迭代结束条件;
    如果是,则执行根据所述中心运动矢量的编码性能和所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量的操作;
    如果否,则从所述中心运动矢量和所述边缘运动矢量中选择编码性能最优的运动矢量,并将编码性能最优的运动矢量确定为所述中心运动矢量,并返回执行确定与所述中心运动矢量对应的边缘运动矢量的操作。
  40. 根据权利要求23所述的方法,其特征在于,所述根据所述原始运动矢量和所述目标运动矢量向解码端发送编码比特流,包括:
    获取所述原始运动矢量的编码性能和所述目标运动矢量的编码性能;
    当所述目标运动矢量的编码性能优于所述原始运动矢量的编码性能时,向解码端发送携带第一指示信息的编码比特流,所述第一指示信息用于指示基于模板确定所述当前图像块的最终运动矢量。
  41. 根据权利要求23所述的方法,其特征在于,所述根据所述原始运动矢量和所述目标运动矢量向解码端发送编码比特流,包括:
    获取所述原始运动矢量的编码性能和所述目标运动矢量的编码性能;
    当所述原始运动矢量的编码性能优于所述目标运动矢量的编码性能时,向解码端发送携带第二指示信息的编码比特流,所述第二指示信息用于指示基于当前图像块对应的原始运动矢量确定所述当前图像块的最终运动矢量。
  42. 根据权利要求23所述的方法,其特征在于,所述根据所述原始运动矢量和所 述目标运动矢量向解码端发送编码比特流,包括:
    获取所述原始运动矢量在运动矢量列表中的索引值;
    向解码端发送携带所述索引值的编码比特流。
  43. 根据权利要求40或41所述的方法,其特征在于,
    获取所述原始运动矢量的编码性能,包括:
    根据所述当前图像块的模板的参数信息和第三目标参考块的参数信息,确定所述原始运动矢量的编码性能,其中,所述第三目标参考块为所述模板对应的参考图像块基于所述原始运动矢量进行偏移之后获得的图像块;
    获取所述目标运动矢量的编码性能,包括:
    根据所述当前图像块的模板的参数信息和第四目标参考块的参数信息,确定所述目标运动矢量的编码性能,其中,所述第四目标参考块为所述模板对应的参考图像块基于所述目标运动矢量进行偏移之后获得的图像块。
  44. 一种解码端设备,包括:处理器和机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令;所述处理器用于执行机器可执行指令,以实现权利要求1-22任一所述的方法步骤。
  45. 一种编码端设备,包括:处理器和机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令;所述处理器用于执行机器可执行指令,以实现权利要求23-43任一所述的方法步骤。
PCT/CN2019/093709 2018-06-28 2019-06-28 一种运动矢量确定方法和设备 WO2020001624A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810692034.XA CN110662074B (zh) 2018-06-28 2018-06-28 一种运动矢量确定方法和设备
CN201810692034.X 2018-06-28

Publications (1)

Publication Number Publication Date
WO2020001624A1 true WO2020001624A1 (zh) 2020-01-02

Family

ID=68985404

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/093709 WO2020001624A1 (zh) 2018-06-28 2019-06-28 一种运动矢量确定方法和设备

Country Status (2)

Country Link
CN (1) CN110662074B (zh)
WO (1) WO2020001624A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112312131B (zh) * 2020-12-31 2021-04-06 腾讯科技(深圳)有限公司 一种帧间预测方法、装置、设备及计算机可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3646845B2 (ja) * 1998-03-03 2005-05-11 Kddi株式会社 ビデオ符号化装置
CN102215386A (zh) * 2010-04-09 2011-10-12 华为技术有限公司 视频图像块处理方法及装置
CN102215387A (zh) * 2010-04-09 2011-10-12 华为技术有限公司 视频图像处理方法以及编/解码器
CN102611886A (zh) * 2011-01-22 2012-07-25 华为技术有限公司 一种运动预测或补偿方法

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101686393B (zh) * 2008-09-28 2012-10-17 华为技术有限公司 应用于模板匹配的快速运动搜索方法及装置
KR101456499B1 (ko) * 2010-07-09 2014-11-03 삼성전자주식회사 움직임 벡터의 부호화 방법 및 장치, 그 복호화 방법 및 장치
US20120082228A1 (en) * 2010-10-01 2012-04-05 Yeping Su Nested entropy encoding
SG11201703454XA (en) * 2014-11-18 2017-06-29 Mediatek Inc Method of bi-prediction video coding based on motion vectors from uni-prediction and merge candidate
CN108134939B (zh) * 2016-12-01 2020-08-07 北京金山云网络技术有限公司 一种运动估计方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3646845B2 (ja) * 1998-03-03 2005-05-11 Kddi株式会社 ビデオ符号化装置
CN102215386A (zh) * 2010-04-09 2011-10-12 华为技术有限公司 视频图像块处理方法及装置
CN102215387A (zh) * 2010-04-09 2011-10-12 华为技术有限公司 视频图像处理方法以及编/解码器
CN102611886A (zh) * 2011-01-22 2012-07-25 华为技术有限公司 一种运动预测或补偿方法

Also Published As

Publication number Publication date
CN110662074B (zh) 2021-11-23
CN110662074A (zh) 2020-01-07

Similar Documents

Publication Publication Date Title
JP5937717B2 (ja) 映像復号化方法及び装置
US8098731B2 (en) Intraprediction method and apparatus using video symmetry and video encoding and decoding method and apparatus
WO2020057559A1 (zh) 一种解码、编码方法及其设备
TWI688257B (zh) 視訊編解碼之方法及裝置
US8229233B2 (en) Method and apparatus for estimating and compensating spatiotemporal motion of image
JP5367097B2 (ja) 動きベクトル予測符号化方法、動きベクトル予測復号方法、動画像符号化装置、動画像復号装置およびそれらのプログラム
JP5306485B2 (ja) 動きベクトル予測符号化方法、動きベクトル予測復号方法、動画像符号化装置、動画像復号装置およびそれらのプログラム
US9979976B2 (en) Light-weight video coding system and decoder for light-weight video coding system
US11025913B2 (en) Encoding video using palette prediction and intra-block copy
WO2020001591A1 (zh) 一种解码、编码方法及其设备
WO2020001624A1 (zh) 一种运动矢量确定方法和设备
JP2018511237A (ja) コンテンツ適応型bピクチャパターンビデオエンコーディング
WO2020007306A1 (zh) 一种解码、编码方法和设备
CN112565747B (zh) 一种解码、编码方法、装置及其设备
CN113794883B (zh) 一种编解码方法、装置及其设备
Jubran et al. Sequence-level reference frames in video coding
CN113766234B (zh) 一种解码、编码方法、装置及其设备
WO2019196650A1 (zh) 一种运动矢量确定方法、装置及其设备
CN113709486B (zh) 一种编解码方法、装置及其设备

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: 19826358

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: 19826358

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19826358

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19826358

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 22.06.2021)