WO2020001591A1 - Decoding and encoding methods and apparatus thereof - Google Patents

Decoding and encoding methods and apparatus thereof Download PDF

Info

Publication number
WO2020001591A1
WO2020001591A1 PCT/CN2019/093574 CN2019093574W WO2020001591A1 WO 2020001591 A1 WO2020001591 A1 WO 2020001591A1 CN 2019093574 W CN2019093574 W CN 2019093574W WO 2020001591 A1 WO2020001591 A1 WO 2020001591A1
Authority
WO
WIPO (PCT)
Prior art keywords
image block
motion vector
template
candidate
current image
Prior art date
Application number
PCT/CN2019/093574
Other languages
French (fr)
Chinese (zh)
Inventor
陈方栋
王莉
Original Assignee
杭州海康威视数字技术股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 杭州海康威视数字技术股份有限公司 filed Critical 杭州海康威视数字技术股份有限公司
Publication of WO2020001591A1 publication Critical patent/WO2020001591A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/573Motion compensation with multiple frame prediction using two or more reference frames in a given prediction direction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/107Selection of coding mode or of prediction mode between spatial and temporal predictive coding, e.g. picture refresh
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/12Selection from among a plurality of transforms or standards, e.g. selection between discrete cosine transform [DCT] and sub-band transform or selection between H.263 and H.264
    • H04N19/122Selection of transform size, e.g. 8x8 or 2x4x8 DCT; Selection of sub-band transforms of varying structure or type
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/513Processing of motion vectors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/567Motion estimation based on rate distortion criteria

Definitions

  • the present application relates to the technical field of video encoding and decoding, and in particular, to a decoding and encoding method and a device thereof.
  • a complete video encoding method may include prediction, transformation, quantization, entropy encoding, and filtering.
  • predictive coding includes intra coding and inter 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 encoded image to effectively remove the video time domain redundancy.
  • the coding process is performed on a block-by-block basis.
  • a template refers to decoding information of a fixed shape around the current image block (adjacent regions in the time or space domain).
  • the template is exactly the same at the encoding and decoding ends. Therefore, some operations performed by the template on the encoding side can obtain completely consistent results on the decoding side. In other words, the information derived by the encoder based on the template can be recovered losslessly at the decoder without the need to pass additional information, which can further reduce the number of transmitted bits.
  • the traditional template generation method has problems such as low decoding efficiency and large decoding delay.
  • the application provides a decoding and encoding method and a device thereof, which can help improve decoding efficiency, reduce decoding delay, and improve encoding and decoding performance.
  • This application provides a decoding method, which is applied to a decoding 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; The template of the current image block decodes the current image block.
  • the present application provides an encoding method, 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; The template of the current image block encodes the current image block to obtain an encoded bit stream corresponding to the current image block; and sends the encoded bit stream to a decoding end.
  • This application provides a decoding device, which includes a processor and a machine-readable storage medium.
  • the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; the processor is configured to execute the machine-executable instructions to implement the foregoing method steps.
  • This application provides an encoding end device, which includes a processor and a machine-readable storage medium.
  • the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; the processor is configured to execute the machine-executable instructions to implement the foregoing method steps.
  • a template of the current image block may be obtained according to the motion information of the candidate image block of the current image block, and the current image block may be decoded according to the template of the current image block.
  • the above method can quickly obtain the template of the current image block, which can effectively improve decoding efficiency, reduce decoding delay, and improve encoding and decoding performance.
  • FIG. 1 is a flowchart of an encoding method according to an embodiment of the present application.
  • 2A-2O are schematic diagrams of a template of a target image block in an embodiment of the present application.
  • 3A-3D are flowcharts of an encoding method in another embodiment of the present application.
  • FIG. 4 is a flowchart of a decoding method according to an embodiment of the present application.
  • FIG. 5 is a flowchart of a decoding method in another embodiment of the present application.
  • FIG. 6 is a structural diagram of a decoding device according to an embodiment of the present application.
  • FIG. 7 is a block diagram of an encoding device according to an embodiment of the present application.
  • FIG. 8 is a hardware structural diagram of a decoder device in an embodiment of the present application.
  • FIG. 9 is a hardware structural diagram of an encoding end device in an embodiment of the present application.
  • first, second, third, etc. may be used to describe various information in the embodiments of the present application, 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
  • 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 decoding and encoding is proposed in the embodiment of the present application.
  • the method may involve the following concepts:
  • Motion Vector In inter-frame coding, a motion vector is 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. For example, there is a strong time-domain correlation between image A of the current frame and image B of the reference frame.
  • image block A1 current image block
  • image block B1 reference image block
  • This relative displacement is also the motion vector of the image block A1.
  • each image block has a corresponding motion vector transmitted to the decoding end.
  • the motion vector of each image block is independently encoded and transmitted, it consumes a considerable number of bits.
  • 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 For encoding.
  • Motion information In order to accurately point to an image block, in addition to acquiring motion vectors, index information of a reference frame image is required to indicate which reference frame image is used. For the current frame image, a reference frame image list can usually be established. 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.
  • Template In video coding technology, the coding process is performed on an image-by-image block basis. When encoding the current image block, reconstruction information of the surrounding coded image blocks is available.
  • 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 and decoding ends. Therefore, some operations performed by the template on the encoding end can be used to obtain completely consistent results on the decoding end. In other words, the information derived by the encoder based on the template can be recovered losslessly at the decoder without the need to pass additional information, which can further reduce the number of transmitted bits.
  • Rate-Distortion Optimized There are two major indicators for evaluating coding efficiency: bit rate (also known as Bit Rate, Second, BPS) and PSNR (Peak Signal to Noise Ratio, peak signal-to-noise ratio). For the same video, the smaller the encoded bitstream, the greater the compression ratio; the larger the PSNR, the better the reconstructed image quality. In the mode selection, the discrimination formula is essentially a comprehensive evaluation of the two. For example, the cost of the model:
  • D Distortion
  • D Distortion
  • SSE Sud-Square Error index
  • the Lagrange multiplier
  • R the actual number of bits required for image block coding in this mode, including the sum of the bits required for coding mode information, motion information, and residuals.
  • Intra prediction refers to the use of reconstructed pixel values of spatially adjacent image blocks of the current image block (that is, in the same frame image as the current image block) for predictive encoding.
  • Inter prediction refers to the use of reconstructed pixel values of time-domain neighboring image blocks of the current image block (in a different frame image from the current image block) for predictive coding.
  • the method may include the following steps:
  • Step 101 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 are no restrictions on this candidate image block.
  • the encoder can directly obtain the motion information of the candidate image block, such as the candidate image block.
  • the motion vector and reference frame index are not limited.
  • Step 102 The encoder obtains a template of the current image block according to the motion information of the candidate image block.
  • Step 103 The encoding end encodes the current image block according to the template of the current image block to obtain an encoded bit stream corresponding to the current image block.
  • Encoding the current image block according to the template of the current image block to obtain the encoded bit stream corresponding to the current image block may include, but is not limited to: obtaining the original mode information of the current image block; obtaining based on the template and original mode information of the current image block, obtaining Target mode information of the current image block; encoding the current image block according to the target mode information to obtain a coded bit stream corresponding to the current image block.
  • the original mode information is the original motion vector
  • the target mode information is the target motion vector.
  • the original mode information is the original motion vector and the original reference frame
  • the target mode information is the target motion vector and the target reference frame.
  • the original mode information is The original prediction image block
  • the target mode information is the target prediction image block.
  • Step 104 The encoding end sends the encoded bit stream to the decoding end.
  • the encoding bit stream corresponding to the current image block sent by the encoding end to the decoding end may carry first instruction information, where the first instruction information is used to instruct the decoding end to base on the current image
  • the template and original mode information of the block obtain the target mode information of the current image block.
  • the bit stream corresponding to the current image block sent by the encoding end to the decoding end may carry second instruction information, and the second instruction information is used to instruct the decoding end to pair the original image information based on the original mode information. Decode the current image block.
  • the first instruction information or the second instruction information is notified 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 corresponding to the current image block.
  • the encoding end and the decoding end may also negotiate a decision strategy or define a decision strategy in a standard, and store the decision strategies on the encoding end and the decoding end, respectively.
  • the decision strategy may agree on first strategy information, and the first strategy information is used to indicate that target mode information of the current image block is obtained based on a template of the current image block and original mode information.
  • the decision strategy may agree on the second strategy information, and the second strategy information is used to instruct the current image block to be decoded based on the original mode information.
  • the decision strategy may agree on the third strategy information, and the third strategy information is the same strategy information as the candidate image block 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 corresponding to the current image block may not carry the first indication information and The second instruction information.
  • the encoded bit stream corresponding to the current image block may not carry the first indication information and The second instruction information.
  • the template of the current image block can be obtained according to the motion information of the candidate image block of the current image block, and the current image block is encoded according to the template of the current image block to obtain the encoded bit stream corresponding to the current image block.
  • the above method can quickly obtain the template of the current image block, which can effectively improve encoding efficiency, reduce encoding delay, and improve encoding performance.
  • 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 can be used to obtain the template of the current image block.
  • the encoding information may include, but is not limited to, reconstruction information and / or prediction information of neighboring 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, the intermediate value is prediction information, and the present disclosure does not limit the prediction information.
  • the generation of the template of the current image block needs to wait until the reconstruction stage, which greatly reduces the efficiency of encoding and decoding, and brings the delay of encoding and decoding.
  • the encoding information includes prediction information
  • the generation of the template of the current image block also needs to wait until the reconstruction stage, which greatly reduces the efficiency of encoding and decoding and brings about the delay of encoding and decoding. Therefore, the above-mentioned method will greatly affect the parallelism of encoding and decoding.
  • a template that can acquire a current image block according to the motion information (such as a motion vector and a reference frame index) of a candidate image block of the current image block is proposed.
  • both the encoding end and the decoding end can apply the method for obtaining a template of the current image block according to the motion information of the candidate image block.
  • 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 ’s A reference frame image; obtaining a reference image block of 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 blocks A2 and A3 are candidate image blocks of image block A1.
  • the reference frame index of the image block A2 is the index of the image B
  • the image block B2 corresponding to the image block A2 is selected from the image B ( As shown by the dashed arrows in the figure), the position of image block B2 in image B is the same as the position of image block A2 in image A; then, image block B2 can be moved according to the motion vector of image block A2, such as using The motion vector (3, 3) moves 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), and the image block B2' is the image block A2.
  • Reference image block Similarly, it can be determined that the reference image block of the image block A3 is the image block B3 '(as shown by the dotted arrow in the figure). Further, the template of the image block A1 may be determined according to the image blocks B2 'and B3', as shown in FIG. 2A.
  • 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.
  • acquiring the 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; A second template is determined based on the motion vector prediction mode and motion information of each second candidate image block; then, a template for the current image block is determined based on the first template and the second module.
  • determining the template of the current image block based on the first template and the second template may include, but is not limited to: determining the first template as the template of the current image block; or determining the second template as the template of the current image block; or , Determine the template of the current image block after stitching the first template and the second template.
  • 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 a template of the current image block. If N is a natural number greater than or equal to 1, and 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.
  • the first template may be determined according to the motion vector prediction mode and motion information of the M first candidate image blocks, and according to the N second candidate image blocks Determine the second template based on the motion vector prediction mode and motion information, and determine the template of the current image block according to the first template and the second template, which may specifically include determining the first template as the template of the current image block, or determining the second template A template of the current image block, or a template of the current image block determined 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.
  • the prediction mode of the adjacent image block is an inter mode or an intra mode
  • the prediction mode of the next adjacent image block is an 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 block on the upper side of the current image block, Or any one or more adjacent image blocks on the upper side of 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, the upper side of the current image block All second-neighbor image blocks, or the first second-neighbor image block above the current image block, or any one or more second-neighbor image blocks above the current image block.
  • the first candidate image block may further include adjacent image blocks in the intra mode, for example, the first intra mode on the upper side of the current image block. Adjacent image blocks of all images, adjacent image blocks of all intra-modes above 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 a neighboring image block and / or a next-neighbor 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 adjacent image block is an 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 block to the left of the current image 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 whose prediction mode is the inter mode, for example, the left side of the current image block All second-neighbor image blocks, or the first second-neighbor image block to the left of the current image block, or any one or more second-neighbor image blocks to the left of the current image block.
  • the second candidate image block may also include adjacent image blocks in the intra mode, for example, the first intra mode on the left side of the current image block. Adjacent image blocks of, the adjacent image blocks of all intra-modes to the left 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, temporal image adjacent blocks of the current image block (that is, different Adjacent image blocks in a frame image).
  • 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 composed of M sub-templates or P sub-templates, and P may be the first candidate image block of the inter-frame mode. Quantity, P is less than or equal to M. For example, if the M first candidate image blocks are all candidate image blocks of the inter-mode, the first template may include M sub-templates and be formed by splicing the M sub-templates.
  • the first template may include M sub-templates (that is, each candidate image block (Corresponding to a sub-template), and is composed of M sub-templates; or, the first template may include P sub-templates (that is, P sub-templates corresponding to P inter-mode candidate image blocks), and P sub-templates to make.
  • the first template may include a first sub-template, and 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, which may include, but 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 of the i-th candidate image block; according to the motion vector of the i-th candidate image block, the reference image block of the i-th candidate image block is determined from the reference frame image, and the reference image block and the i-th candidate image block The relative displacement of the candidate image block 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.
  • the i-th child template 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 of the
  • 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; according to the motion vector corresponding to 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 reference image block and The relative displacement of the i-th candidate image block matches the motion vector corresponding to the i-th candidate image block (including equal or approximately equal); according to the determined reference image block, the size of the first horizontal length and the first vertical length is obtained
  • the image block includes the i-th sub-template included in the first template.
  • the reference frame index and motion vector corresponding to the i-th candidate image block may be reference frame indexes 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 (configurable 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 (configurable 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 may include N sub-templates or R sub-templates, and is formed by splicing N sub-templates or R sub-templates, where R may be the second candidate for the inter-frame mode.
  • the number of image blocks, R is less than or equal to N.
  • the second template may include N sub-templates and be spliced from the N sub-templates.
  • the second template may include N sub-templates (that is, each candidate image block (Corresponding 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-mode candidate image blocks), and R sub-templates to make.
  • the second template may include a second sub-template, and 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 includes at least one neighboring image block or the next neighboring image block whose prediction mode is the inter mode
  • 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, which may include but 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 reference frame of the i-th candidate image block The index determines the reference frame image of the i-th candidate image block; according to the motion vector of the i-th candidate image block, the reference image block of the i-th candidate image block is determined from the reference frame image, and the reference image block and the i-th candidate image block The relative displacement of the candidate image block 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 a second template including I-th child template.
  • 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; according to the motion vector corresponding to 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 reference image block and The relative displacement of the i-th candidate image block matches the motion vector corresponding to the i-th candidate image block (including equal or approximately equal); according to the determined reference image block, the size of the second horizontal length and the second vertical length is obtained
  • the image block serves as an ith sub-template included in the second template.
  • the reference frame index and motion vector corresponding to the i-th candidate image block may be reference frame indexes 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.
  • acquiring a 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 each motion information, and For the obtaining method, refer to the foregoing embodiment; then, obtain the weight corresponding to each motion information, and obtain the template of the current image block 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 may be obtained in a weighted average manner.
  • the motion information corresponding to the current image block may include original motion information of the current image block.
  • 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 blocks A3 and A4 may be determined as the second candidate image block of the current image block A1. .
  • the image block A2 may be determined as the first 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. 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 respective motion information of the image blocks A2, A3, and A4.
  • a reference frame image of 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
  • the image block B2 is moved according to the motion vector of the image block A2 to obtain an image block.
  • A2's reference image block B2 ' the reference image block B3 'of the image block A3 and the reference image block B4' of the image block A4 can be obtained, as shown in FIG. 2C.
  • a template of the current image block A1 can be obtained from the reference image blocks B2 ', B3', and 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.
  • the horizontal length W of the upper template may be the horizontal length of the current image block A1, or the horizontal length of the candidate image block A2, or twice the horizontal length of the current image block A1, and the like
  • the vertical length S of the upper template It may be the vertical length of the candidate image block A2, or 1/3 of the vertical length of the candidate image block A2, or the like. Referring to FIG.
  • the horizontal length W of the template is the horizontal length of the candidate image block A2, that is, the horizontal length of the reference image block B2';
  • the vertical length S of the template It is 1/3 of the vertical length of the candidate image block A2, that is, 1/3 of the vertical 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.
  • the vertical length H of the left template may be the vertical length of the current image block A1 or the vertical length of the candidate image block A3
  • the horizontal length R of the left template may be the horizontal length of the candidate image block A3 or the candidate image.
  • the lateral length of the block A3 is 1/3 and so on.
  • the vertical length H of the template is the vertical length of the candidate image block A3
  • the horizontal length R of the template is 1 / of the horizontal length of the candidate image block A3.
  • the horizontal length of the i-th candidate image block is w i
  • the vertical length is S
  • the corresponding 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), as the i-th sub-template on the upper side.
  • 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 on the upper side Specifically, if the motion vector is MV and the reference frame index is idx, a rectangular block with a relative displacement of MV and a horizontal length of w i and a vertical length of S is found in the idx reference image of the current frame as the upper side. i child templates.
  • the current left image block has N candidate image block, the longitudinal length of the i-th candidate image blocks as H i, the lateral length is R, the determined prediction mode candidate image block.
  • the corresponding 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), as the i-th sub-template on the left.
  • 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 sub-template on the left.
  • the motion vector is MV
  • the reference frame index idx find the relative displacement of the lateral length of the MV R, a longitudinal length of a rectangular block of idx h i in the reference image of the current frame, a second left-side i child templates.
  • 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. 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.
  • a template of the current image block A1 can be obtained according to the respective motion information of the image blocks A2 and A3.
  • the reference frame image of the image block A2 can 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 motion vector of the image block A2 to obtain the image block A2 Reference picture block B2 '.
  • a reference image block B3 'of the image block A3 can be obtained.
  • a template of the current image block A1 can be obtained from 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.
  • the horizontal length W of the upper template may be the horizontal length of the current image block A1 or the horizontal length of the candidate image block A2
  • the vertical length S of the upper template may be the vertical length of the candidate image block A2 or the candidate image.
  • the length A3 of the block A2 is equal to 1/3.
  • FIG. 2F it is a schematic diagram of a template corresponding to 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.
  • the vertical length H of the left template can be the vertical length of the current image block A1 or the vertical length of the candidate image block A3
  • the horizontal length R of the left template can be the horizontal length of the candidate image block A3 or a candidate.
  • the horizontal length of the image block A3 is 1/3 and so on.
  • the prediction mode of the candidate image block is determined. If it is in the intra mode, the corresponding 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 is used as the corresponding 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 the corresponding upper Side 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 corresponding template is no longer generated; or it is filled according to the default value and used as the corresponding left template. If it is in the inter mode, obtain the motion information (such as the motion vector and reference frame index) of the candidate image block, and generate a template with a horizontal length R and a vertical length h based on the motion vector and the reference frame index, as the corresponding left template .
  • the motion information such as the motion vector and reference frame index
  • 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 horizontal length W of the upper template of the current image block A1 is taken as the horizontal length of the current image block A1
  • the vertical length H is taken as 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 in the inter-frame mode on the left side of the current image block.
  • the image blocks A3 and A4 in the inter mode can be determined as candidate images of the 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 image block A8 in the inter mode is the next-to-adjacent image block on the left of the current image block A1.
  • the next neighboring image block A8 in the inter mode is determined as a candidate image block of the current image block A1.
  • the next neighboring image block A6 in the inter mode may be determined as a candidate image block of the current image block A1.
  • a template of the current image block A1 is obtained. For details, please refer to the situation First, it is more to obtain sub-templates according to the respective motion information of image blocks A6 and A8. The template is finally shown in FIG. 2I.
  • 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 second-neighboring 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 is the next-neighbor image block on the left of the current image block A1, so ,
  • the next neighboring image block A5 in the inter mode may be determined as a candidate image block of the current image block A1.
  • a template of the current image block A1 can be obtained according to the respective motion information of the image blocks A4 and A5.
  • 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 blocks A3 and A4 in the inter mode can be determined as candidate images of the 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.
  • a template of the current image block A1 is obtained.
  • a template is obtained according to the respective motion information of the image blocks A5 and A7.
  • the template is finally shown in FIG. 2J.
  • the motion information of the adjacent image block A6 of the image block A5 can be determined as the motion information of the image block A5.
  • the corresponding sub-template can be obtained by using the motion information of the image block A5.
  • the motion information of the adjacent image block A8 of the image block A7 can be determined as the image block A7. Motion information, and use the motion information of image block A7 to obtain the corresponding template.
  • 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 is determined as a candidate image block of the current image block A1. If the first image block A3 on the left side is in the intra mode, even if an 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 can be determined as a candidate image block of the current image block A1.
  • a template of the current image block A1 can be obtained according to the respective motion information of the image blocks A2 and A3.
  • the motion information of the adjacent image block A4 of the image block A2 can be determined as the motion corresponding to the image block A2 Information, and use the motion information corresponding to the image block A2 to obtain the corresponding template.
  • the motion information of the adjacent image block A5 of image block A3 can be determined as the motion information corresponding to image block A3. And use the motion information corresponding to the image block A3 to obtain the corresponding template.
  • a motion vector may be used to represent a relative displacement between a current image block in a current frame image and a reference image block in a reference frame image.
  • image A is the current frame image
  • image block A1 is the current image block
  • image B is the reference frame image of image A
  • image block B1 is the reference image block of image block A1.
  • a motion search can be performed in image B to find image block B1 that best matches image block A1 and determine the image
  • the relative displacement between the block A1 and the image block B1, and the relative displacement is also the motion vector of the image block A1.
  • the motion vector is (-6, 4), which indicates that the image block B1 moves 6 pixels to the left in the horizontal direction and 4 pixels upwards in the vertical direction compared to the image block A1.
  • the encoded bit stream carries the motion vector (-6, 4) of the image block A1, instead of the reconstruction information and / or prediction information of the image block A1.
  • the decoder can obtain the motion vector (-6, 4) of image block A1.
  • the reference frame image B To determine the position of the reference image block B1, that is, to move 6 pixels to the left and 4 pixels upward at the position of the current image block A1, the position of the reference image block B1 is obtained. The position reads the reference image block B1, and reconstructs the image block A1 by using the reference image block B1.
  • the motion vector is carried in the encoded bit stream corresponding to the current image block A1 instead of the reconstruction information of the image block A1. And / or prediction information, thereby saving a lot of bits.
  • the motion vector of each image block also occupies more bits. Therefore, in order to further save the number of bits, the motion vector of the adjacent image block can also be used to determine the current image block A1.
  • Motion vector For example, in the current frame image A, the image block adjacent to the current image block A1 may include image blocks A2 and A3, and the motion vector list of the current image block A1 may include the motion vector A21 and image block A3 of the image block A2 Motion vector A31.
  • the encoded bit stream carries the index value of the original motion vector (for example, the index value of the motion vector A21 in the motion vector list) instead of the image block A1
  • the motion vector (-6, 4) is not the reconstruction information and / or prediction information of the image block A1.
  • the decoding end can obtain the index value of the original motion vector, and obtain the original motion vector A21 from the motion vector list according to the index value. Since the number of bits occupied by the index value is less than the number of bits occupied by the motion vector, further bits can be saved.
  • a target motion vector different from the original motion vector A21 is obtained according to the original motion vector A21, and the target motion vector is used as the image block A1.
  • Final motion vector since the target motion vector is the closest to the motion vector of the image block A1, compared with the method of “using the original motion vector A21 as the final motion vector of the image block A1 directly”, the above “taking the target motion vector as The method of "final motion vector of image block A1" can solve problems such as low prediction quality and prediction error.
  • the original mode information is the original motion vector of the current image block
  • the target mode information is the target motion vector of the current image block.
  • the encoding end can obtain the original motion vector of the current image block, and according to the original motion vector and the obtained
  • the template obtains the target motion vector of the current image block, which is different from the original motion vector.
  • the current image block is encoded according to the target motion vector to obtain an encoded bit stream corresponding to the current image block.
  • the encoder can send the encoded bit stream to the decoder.
  • the encoding end may first obtain the original motion vector of the current image block. Assuming that the motion vector list of the current image block A1 at the encoding end includes motion vectors A21, A31, A41, and A51 in turn, then select a motion from the motion vector list. The vector serves as 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, the motion vector list of the image block A1 can finally be obtained.
  • the process of the coding end obtaining the target motion vector according to the original motion vector and the obtained template can be referred to the following fourth and fifth embodiments.
  • the original motion vector A21 can be used to obtain the target motion vector of the image block A1
  • the target motion vector can be used as the final motion vector of the image block A1.
  • the process of encoding the current image block according to the target motion vector to obtain the encoded bit stream corresponding to the current image block and sending the encoded bit stream to the decoding end may include: after obtaining the target motion vector, The current image block can be encoded by using the target motion vector, and there is no limitation on this encoding method. After encoding is completed, an encoded bit stream corresponding to the current image block can be obtained, and the encoded bit stream is sent to the decoding end.
  • the encoding end may send an encoded bit stream to the decoding end according to the original motion vector and the target motion vector.
  • the encoding performance of the original motion vector and the encoding performance of the target motion vector can be obtained.
  • the encoded bit stream sent to the decoding end carries the first indication information.
  • the encoded bit stream sent to the decoding end carries the second indication information.
  • the above method is to notify the first instruction information or the second instruction information explicitly. In practical applications, the notification may also be performed implicitly, that is, the first instruction information or the second instruction information is not carried in the encoded bit stream corresponding to the current image block. Instructions.
  • the encoding end and the decoding end may also negotiate a decision strategy or define a decision strategy in a standard, and store the decision strategies at the encoding end and the decoding end, respectively.
  • the decision strategy may agree on the first strategy information, or agree on the second strategy information, or agree on the third strategy information.
  • the third policy information is the same policy information as the candidate image block of the current image block.
  • the encoded bitstream 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 instruction information and the second instruction information.
  • Information and second instruction information When the decision strategy agrees with the third strategy information, and the candidate image block uses the second strategy information, and the coding performance of the original motion vector is better than the coding performance of the target motion vector, the coding bitstream corresponding to the current image block may not carry the first indication.
  • Information and second instruction information When the decision strategy agrees with the third strategy information, and the candidate image block uses the second strategy information, and the coding performance of the original motion vector is better than the coding performance of the target motion vector, the coding bitstream corresponding to the current image block may not carry the first indication.
  • Information and second instruction information When the decision strategy agrees with the third strategy information, and the candidate image block uses the second strategy information, and the coding performance of the original motion vector is better than the coding performance of the target motion vector, the coding bitstream corresponding to the current image block may not carry the first indication.
  • 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; corresponding to the current image block sent to the decoding end
  • the indexed value is carried in the encoded bitstream of. 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 directly determining the final motion vector of the current image block based on the original motion vector, thereby effectively improving the motion vector.
  • Accuracy which in turn improves encoding performance.
  • the above method can quickly obtain the template of the current image block, and then obtain the target motion vector of the current image block according to the template, thereby effectively improving the encoding and decoding efficiency and reducing the encoding and decoding delay.
  • a template of the current image block can be obtained, and a target motion vector of the current image block can be obtained according to the template of the current image block.
  • Embodiment 4 is a diagrammatic representation of Embodiment 4:
  • the process of the encoder obtaining the target motion vector according to the original motion vector and the obtained template can be seen in FIG. 3A.
  • the process may include:
  • Step 311 The encoding end determines the original motion vector as a central motion vector.
  • Step 312 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.
  • Determining the edge motion vector corresponding to the central motion vector may include: moving the central motion vector (x, y) by an offset St in different directions to obtain edge motion vectors (x-St, y) in different directions, ( x + St, y), (x, y + St), (x, y-St).
  • the center motion vector (x, y) can be shifted to the left by an offset St to obtain an edge motion vector (x-St, y), and the center motion vector (x, y) can be shifted to the right by an offset Get the edge motion vector (x + St, y) by St; in the vertical direction, you can move the center motion vector (x, y) up by the offset St to get the edge motion vector (x, y + St) and move the center The vector (x, y) is moved downward by the offset St to obtain the edge motion vector (x, y-St).
  • the initial value of the offset St can be configured according to experience, for example, it can be 2, 4, 8, 16, and so on.
  • Step 313 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.
  • 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. performance.
  • 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 central 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 central motion vector according to the prediction performance of the central motion vector.
  • the encoding performance of the central motion vector may be determined based on the prediction performance and the actual number of bits required for encoding.
  • the above parameter information may be a brightness value, or 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. 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 corresponding to the template can be obtained.
  • the reference image block can be moved by using the central motion vector (3, 3) to obtain the image block X corresponding to the reference image block (for example, the reference image block is moved to the right by 3 3 pixels, move up 3 pixels, and mark the processed image block as image block X), and the image block X is the first target reference block, and the brightness value of each pixel point 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
  • RDO usually uses the following formula to determine the coding performance of the central motion vector:
  • J encoding performance
  • D prediction performance
  • is 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 encoding 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: 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 performance.
  • 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.
  • the encoding performance of the edge motion vector may be determined based on the prediction performance and the actual number of bits required for encoding.
  • the above parameter information may be a brightness value, or 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 314 The encoding 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 respective coding performance of the edge motion vector.
  • the coding end may select a 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 as the target motion vector.
  • a motion vector with the second best coding performance can be selected from the center motion vector and the edge motion vector 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 encoding performance is the center motion vector as (3, 3), that is, the original motion vector, the encoding end can also use the edge motion vector (such as edge motion vector (7, 3), etc.) with the best encoding performance. ) Is determined as the target motion vector.
  • Embodiment 5 is a diagrammatic representation of Embodiment 5:
  • the process of the encoder obtaining the target motion vector according to the original motion vector and the obtained template can be seen in FIG. 3B.
  • the process may include:
  • Step 321 The encoding end determines the original motion vector as a central motion vector.
  • Step 322 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 323 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.
  • Step 324 The encoder determines whether the iteration end condition of the target motion vector is satisfied. If yes, go to step 326; if no, go to step 325.
  • 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 St has been modified to a preset value, such as 1.
  • step 325 the encoder selects a motion vector with the best coding performance from the center motion vector and the edge motion vector as a new center motion vector, and returns to step 322.
  • the edge motion vector (7, 3) may be determined as the new central motion vector, and step 322 is performed again, and so on.
  • the value of the offset parameter St may be an initial value, such as 16.
  • the value of the offset parameter St is adjusted first, for example, adjusted to the last offset parameter St minus 2, or adjusted to half of the last offset parameter St. This article does not limit this, as long as the adjusted offset parameter St is smaller than the last offset parameter St, and subsequent adjustments are made to half of the last offset parameter St as an example. Therefore, when step 322 is performed a second time, the value of the offset parameter St is 8; when step 322 is performed a third time, the value of the offset parameter St is 4; and so on.
  • step 322 may be performed based on the adjusted offset parameter St. If so, the value of the offset parameter St can be set to 1, and step 322 is performed based on the offset parameter St (that is, the value 1), and when the execution proceeds to step 324, the judgment result is that the end of the iteration is satisfied condition.
  • Step 326 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 encoding performance of the edge motion vector.
  • Embodiment 6 is a diagrammatic representation of Embodiment 6
  • the encoding end can obtain the encoding performance of the original motion vector and the encoding performance of the target motion vector.
  • the encoding end obtaining the encoding performance of the original motion vector may include: determining the encoding performance of the original motion vector according to the parameter information of the template of the current image block and the parameter information of the 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 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.
  • the encoding performance of the original motion vector is determined based on the prediction performance and the actual number of bits required for encoding.
  • the above parameter information may be a brightness value, or a brightness value and a chrominance value.
  • the encoding end acquiring the encoding performance of the target motion vector 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.
  • 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 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, based on the predictive performance and the actual number of bits required for encoding, the encoding performance of the target motion vector is determined.
  • the above parameter information may be a brightness value, or a brightness value and a chrominance value.
  • the above process is similar to the fourth embodiment, except that when the third target reference block or the fourth target reference block is obtained, the reference image block corresponding to the template is moved based on the original motion vector or the target motion vector, rather than as in the third embodiment.
  • the reference image block corresponding to the template is moved based on the center motion vector.
  • Embodiment 7 is a diagrammatic representation of Embodiment 7:
  • the original mode information is the original motion vector and the original reference frame of the current image block
  • the target mode information is the target motion vector and the target reference frame of the current image block.
  • the encoder can obtain the original motion vector and the original reference frame of the current image block, and obtain the target motion vector (which can be different from the original motion vector) and the target reference according to the original motion vector, the original reference frame, and the obtained template. frame.
  • the current image block may be encoded according to the target motion vector and the target reference frame to obtain an encoded bit stream corresponding to the current image block, and the encoded bit stream is sent to the decoding end.
  • the encoding end may first obtain the original motion vector of the current image block. Assuming that the motion vector list of the current image block A1 at the encoding end includes motion vectors A21, A31, A41, and A51 in turn, then select a motion from the motion vector list. The vector serves as 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 process of obtaining the original reference frame of the current image block by the encoder there can be one or more reference frames (video frames with strong time-domain correlation), and one of them can be The reference frame is used as the original reference frame, and the remaining reference frames are candidate reference frames.
  • a target reference frame needs to be selected from the original reference frame and all candidate reference frames, and the target reference frame is the final reference frame of the current image block, and the target reference frame is used for subsequent processing.
  • the process for the encoder to obtain the target motion vector and the target reference frame according to the original motion vector, the original reference frame, and the obtained template can refer to the subsequent embodiments.
  • the motion vector A21 is determined as the original motion vector
  • the reference frame 1 is determined as the original reference frame
  • the reference frame 2 and the reference frame 3 are determined as candidate reference frames
  • the original motion vector A21, the reference frame 1, and the reference frame 2 are used.
  • reference frame 3 to obtain a target motion vector and a target reference frame.
  • the target motion vector may be used as the final motion vector of the current image block.
  • the target reference frame may be a reference frame in reference frame 1, reference frame 2, and reference frame 3.
  • the target reference frame is used as the final reference of the current image block. frame.
  • the process of encoding the current image block according to the target motion vector and the target reference frame to obtain an encoded bit stream corresponding to the current image block and sending the encoded bit stream to the decoding end may include, but is not limited to: After the encoder obtains the target motion vector and the target reference frame, it can use the target motion vector and the target reference frame to encode the current image block, and there is no limitation on this encoding method. After the encoding is completed, the encoding end can obtain the encoded bit stream corresponding to the current image block, and sends the encoded bit stream to the decoding end.
  • the encoding end may send an encoded bit stream to the decoding end according to the original motion vector and the target motion vector. Specifically, the encoding performance of the original motion vector and the encoding performance of the target motion vector can be obtained.
  • the encoded bit stream corresponding to the current image block sent to the decoding end carries the first indication information.
  • the encoded bit stream corresponding to the current image block sent to the decoding end carries the second indication information.
  • the above method is to notify the first instruction information or the second instruction information explicitly.
  • the first instruction information or the second instruction information may also be notified implicitly, that is, the encoded bit stream corresponding to the current image block is not included.
  • the first instruction information or the second instruction information is carried.
  • the encoding end and the decoding end may also negotiate a decision strategy or define a decision strategy in a standard, and store the decision strategy on the encoding end and the decoding end respectively.
  • the decision strategy may agree on the first policy information or agree on the second policy information.
  • Strategy information, or contracted third strategy information are the same policy information as the candidate image block of the current image block. Then, it can be determined based on the decision strategy in which case the first indication information or the second indication information may not be carried in the encoded bit stream corresponding to the current image block.
  • the third embodiment refer to the third embodiment.
  • 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; corresponding to the current image block sent to the decoding end
  • the indexed value is carried in the encoded bitstream of. 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 and the target reference frame can be obtained according to the original motion vector and the original reference frame, and the final motion vector of the current image block is determined according to the target motion vector, and the final reference frame of the current image block is determined according to the target reference frame.
  • the original reference frame is used to determine the final reference frame of the current image block, which can effectively improve the accuracy of the motion vector and improve coding performance.
  • the template of the current image block can be quickly obtained according to the motion information of the candidate image block, the codec efficiency can be effectively improved and the codec delay can be reduced.
  • the template of the current image block can be obtained before the reconstruction phase.
  • Embodiment 8 is a diagrammatic representation of Embodiment 8
  • the encoder obtains the target motion vector and the target reference frame according to the original motion vector, the original reference frame, and the template.
  • the implementation process can be shown in FIG. 3C.
  • Step 331 The encoder obtains a candidate motion vector of the original reference frame based on the template of the current image block and the original motion vector.
  • the candidate motion vector may be different from the original motion vector.
  • the encoding end obtains candidate motion vectors of the original reference frame based on the template of the current image block and the original motion vector, which may include, but is not limited to, the encoding end determines the original motion vector as the center motion vector, and determines the center motion vector.
  • the edge motion vector is different from the center motion vector; the encoding end obtains the encoding performance of the center motion vector according to the template of the current image block, and obtains the encoding performance of each edge motion vector according to the template of the current image block; then, encoding The end may determine the candidate motion vector of the original reference frame from the center motion vector and the edge motion vector according to the coding performance of the center motion vector and the coding performance of each edge motion vector.
  • Step 332 The encoder obtains the initial motion vector of each candidate reference frame according to the original motion vector.
  • the encoder obtains the initial motion vector of the candidate reference frame according to the original motion vector, which may include: according to the distance between the frame where the current image block is located and the original reference frame (such as the frame between the frame where the current image block is located and the original reference frame). Number), the distance between the frame where the current image block is located and the candidate reference frame, and the original motion vector to obtain the initial motion vector of the candidate reference frame.
  • the original motion vector is motion vector 1
  • the candidate reference frame is reference frame 2 and reference frame 3
  • the distance between the frame where the current image block is located (hereinafter referred to as the current frame) and reference frame 1
  • the distance between the current frame and the reference frame 2 is d2
  • the distance between the current frame and the reference frame 3 is d3
  • the initial motion vector of the reference frame 2 is the motion vector 1 * (d2 / d1)
  • the initial motion vector of the reference frame 3 is the motion vector 1 * (d3 / d1)
  • the subsequent motion vector is referred to as the motion vector 3.
  • Step 333 The encoder obtains the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame.
  • the encoding end obtains the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame, which may include, but is not limited to, determining the initial motion vector of the candidate reference frame as the center motion vector, and determining the center motion
  • the edge motion vector corresponding to the vector, which is different from the center motion vector obtain the encoding performance of the center motion vector according to the template of the current image block, and obtain the encoding performance of each edge motion vector according to the template of the current image block; then, According to the coding performance of the central motion vector and the coding performance of each edge motion vector, a candidate motion vector of the candidate reference frame is determined from the central motion vector and the edge motion vector.
  • the candidate motion vector of the candidate reference frame can be obtained according to the initial motion vector of the candidate reference frame, that is, each candidate reference frame corresponds to one candidate motion vector.
  • the process of the encoder obtaining the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame may refer to the fourth embodiment or the fifth embodiment, but replaces the target motion vector in the fourth or the fifth embodiment.
  • the original motion vector in the fourth or fifth embodiment may be replaced with the initial motion vector of the candidate reference frame.
  • step 334 the encoder selects the candidate motion vector with the best coding performance as the target motion vector from the candidate motion vectors of the original reference frame and the candidate motion vectors of each candidate reference frame.
  • the encoding end can obtain the coding performance of each candidate motion vector.
  • the motion vector may be replaced with a candidate motion vector.
  • the coding end obtains the coding performance of each candidate motion vector, it can select the candidate motion vector with the best coding performance as the target motion vector.
  • Step 335 The encoding end determines the reference frame corresponding to the target motion vector as the target reference frame.
  • the encoding end may determine the original reference frame as the target reference frame, and when the target motion vector corresponds to the candidate reference frame, the encoding end may determine the candidate reference frame as the target reference frame.
  • a target reference frame is selected from the original reference frame and all candidate reference frames, and the target reference frame is the final reference frame of the current image block.
  • Select the target motion vector that is, the candidate motion vector with the best coding performance from the candidate motion vectors of the original reference frame and the candidate motion vectors of all candidate reference frames.
  • the target motion vector is the final motion vector of the current image block, and select The reference frame corresponding to the target motion vector is used as the target reference frame.
  • the original mode information may be the original prediction image block
  • the target mode information may be the target prediction image block
  • the encoding end may obtain the target prediction image block according to the original prediction image block.
  • the reference frame image of the current image block in order to transmit the current image block of the current frame image, can be queried first, that is, the reference frame image can be queried through the reference frame index, and then, from the reference A predicted image block matching the current image block is found in the frame image, and the current image block is encoded based on the difference between the current image block and the predicted image block, thereby reducing the bit transmission amount.
  • the predicted image block in the reference frame image is referred to as the original predicted image block
  • the target predicted image block is obtained according to the original predicted image block
  • the current image block is encoded based on the difference between the current image block and the target predicted image block.
  • the target prediction image block is an image block obtained by using a local illumination compensation algorithm
  • the brightness difference between the original prediction image block and the current image block can be eliminated, so that the current image block is processed based on the difference between the current image block and the target prediction image block.
  • the encoding end may obtain the original prediction image block of the current image block, and obtain the target prediction image block according to the original prediction image block and the obtained template. Encode the current image block according to the target predicted image block to obtain an encoded bit stream corresponding to the current image block, and send the encoded bit stream to the decoding end.
  • the process of obtaining the original predicted image block of the current image block by the encoding end may include, but is not limited to: the encoding end first obtains the reference frame index of the current image block, and queries the reference of the current image block through the reference frame index. A frame image, from which the original predicted image block matching the current image block is queried from the reference frame image.
  • the process of obtaining the target predicted image block by the encoding end according to the original predicted image block and the obtained template can refer to the subsequent embodiments.
  • the process of encoding the current image block according to the target predicted image block to obtain the encoded bit stream corresponding to the current image block and sending the encoded bit stream to the decoding end may include: obtaining the target predicted image block After that, the current image block can be encoded based on the difference between the current image block and the target predicted image block. There is no restriction on this encoding method. After encoding is completed, the encoded bit stream corresponding to the current image block is obtained, and the encoded bit stream is sent to Decoding end.
  • the encoding end uses the target prediction image block to encode the current image block (that is, to encode the current image block based on the difference between the current image block and the target prediction image block)
  • the encoding end sends the encoding bit corresponding to the current image block to the decoding end.
  • the stream carries first indication information; when the encoding end uses the original prediction image block to encode the current image block (that is, to encode the current image block based on the difference between the current image block and the original prediction image block), the encoding end sends to the decoding end
  • the coded bit stream corresponding to the current image block of the second image carries second indication information.
  • the first indication information or the second indication information is notified explicitly.
  • the first indication information or the second indication information may also be notified implicitly, that is, the encoded bit stream corresponding to the current image block is not included.
  • the first instruction information or the second instruction information is carried.
  • the encoding end and the decoding end may also negotiate a decision strategy or define a decision strategy in a standard, and store the decision strategies at the encoding end and the decoding end, respectively.
  • the decision strategy may agree on the first strategy information, or agree on the second strategy information, or agree on the third strategy information.
  • the third policy information is the same policy information as the candidate image block of the current image block.
  • the first indication information or the second indication information may not be carried in the encoded bit stream corresponding to the current image block. If the decision strategy agrees with the second strategy information, and the encoding end uses the original predicted image block to encode the current image block, the first indication information or the second indication information may not be carried in the encoded bit stream corresponding to the current image block. If the decision strategy agrees with the third strategy information, and the candidate image block of the current image block uses the first policy information, and the encoding end uses the target prediction image block to encode the current image block, it may not be carried in the encoded bit stream corresponding to the current image block.
  • the first instruction information or the second instruction information may be carried in the encoded bit stream corresponding to the current image block.
  • the decision strategy agrees with the third strategy information, and the candidate image block of the current image block uses the second strategy information, and the encoding end uses the original predicted image block to encode the current image block, it may not be carried in the encoded bit stream corresponding to the current image block.
  • Embodiment 10 is a diagrammatic representation of Embodiment 10:
  • the process of obtaining the target predicted image block by the encoding end according to the original predicted image block and the obtained template can be shown in FIG. 3D.
  • Step 341 The encoder obtains a motion vector of the current image block and a reference frame index corresponding to the motion vector.
  • the motion vector of the current image block may be the original motion vector in the foregoing embodiment, or the target motion vector in the foregoing embodiment, or may be the final motion vector in the foregoing embodiment, which is not limited as long as The motion vector of the current image block can be obtained.
  • the reference frame index corresponding to the motion vector is also the index of the reference frame of the current image block.
  • Step 342 The encoder obtains the reference block corresponding to the template according to the motion vector and the reference frame index of the current image block. For example, a reference frame image is queried by using the reference frame index, and a reference image block matching the current image block is queried from the reference frame image. Then, the reference image block is moved by using the motion vector of the current image block. It is the reference block corresponding to the template, which will be referred to as TMP.
  • Step 343 The encoding end obtains a transform coefficient according to a template of the current image block and a reference block corresponding to the template. Specifically, the encoding end may obtain a transformation coefficient according to parameter information of each pixel of a template of the current image block and parameter information of each pixel of a reference block corresponding to the template.
  • the parameter information may include, but is not limited to, a brightness value.
  • TM i represents the brightness value of the i-th pixel in the template of the current image block
  • TMP i represents the brightness value of the i-th pixel in the reference block corresponding to the template
  • M represents the total number of pixels of the template
  • a and b are transformation coefficients.
  • Step 344 The encoding end performs illumination compensation on the original prediction image block according to the transform coefficient to obtain the target prediction image block.
  • the target prediction image block may be aX + b, where X represents the original prediction image block.
  • Embodiment 11 is a diagrammatic representation of Embodiment 11:
  • FIG. 4 is a schematic flowchart of a decoding method, which is applied to a decoding end, the method may include the following steps:
  • Step 401 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.
  • Step 402 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. For details, refer to the related content in the second embodiment.
  • Step 403 The decoding end decodes the current image block according to the template of the current image block.
  • the decoding end decodes the current image block according to the template of the current image block, which may include but is not limited to: obtaining the original mode information of the current image block; obtaining the current image block based on the template of the current image block and the original mode information
  • the target mode information of; the current image block is decoded according to the target mode information.
  • the original mode information is the original motion vector
  • the target mode information is the target motion vector.
  • the original mode information is the original motion vector and the original reference frame
  • the target mode information is the target motion vector and the target reference frame.
  • the original mode information is The original prediction image block
  • the target mode information is the target prediction image block.
  • the decoding end may also obtain a coded bit stream corresponding to the current image block, which may be sent by the encoding end. Yes, it can also be obtained after the decoding end encodes the current image block.
  • the decoding end may receive the encoded bit stream corresponding to the current image block from the encoding end. If the encoded bit stream carries first indication information, the first indication information is used to instruct to obtain the current image block based on the current image block template and the original mode information.
  • the target mode information of the target image block, the motion information of the candidate image block of the current image block is obtained according to the first instruction information, and the template of the current image block is obtained according to the motion information of the candidate image block.
  • the decoding end may receive the encoded bit stream corresponding to the current image block from the encoding end. If the encoded bit stream carries second instruction information, the second instruction information is used to indicate that the encoded bit stream is based on the original mode information corresponding to the current image block. When decoding is performed, the original mode information of the current image block is obtained according to the second instruction information, and the current image block is decoded based on the original mode information.
  • the above manner is to notify the first indication information or the second indication information in an explicit manner.
  • the encoding end may also notify the strategy corresponding to the first indication information or the second indication information in an implicit manner, that is, the current image.
  • the encoded bitstream corresponding to the block does not carry the first indication information or the second indication information.
  • the decoding end may also 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 second strategy information is set to obtain the original mode information, and the current image block is decoded based on the original mode information; or, the strategy of the candidate image block of the current image block may also be obtained according to the locally preset third policy information, and based on the The obtained strategy decodes the current image block.
  • the first policy information is used to indicate that target mode information of the current image block is obtained based on the template and original mode information of the current image block; the second policy information is used to indicate that the current image block is decoded based on the original mode information of the current image block;
  • the third policy information is used to indicate that the same policy information as the neighboring image blocks of the current image block is adopted.
  • the encoding end and the decoding end may also negotiate a decision strategy or define a decision strategy in a standard, and store the decision strategy on the encoding end and the decoding end respectively.
  • the decision strategy may agree on the first policy information or agree on the second policy information.
  • the first indication information and the second indication information are not carried in the encoded bit stream corresponding to the current image block, when the decision policy agrees with the first policy information, the current image block is obtained according to the locally preset first policy information.
  • the template of the current image block can be obtained according to the motion information of the candidate image block of the current image block, and the current image block is decoded according to the template of the current image block. Because the above method can quickly obtain the template of the current image block, it can effectively improve decoding efficiency, reduce decoding delay, and improve decoding performance.
  • Embodiment 12 is a diagrammatic representation of Embodiment 12
  • 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 of the candidate image block according to the reference frame index, obtain a reference image block of the candidate image block from the reference frame image according to the motion vector, and obtain the reference image block according to the reference image block.
  • the 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 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 a neighboring image block and / or a next-neighbor 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 adjacent image block is an 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; Determine the second template according to the motion vector prediction mode and motion information; then, determine the template of the current image block according to the first template and the second template. Specifically, it may be: determining the first template as a template of the current image block; or determining the second template as the template of the current image block; or determining the current image block after splicing the first template and the second template. template.
  • the above first template may include M sub-templates or P sub-templates, and is composed of M sub-templates or P sub-templates, where P is the number of first candidate image blocks in the inter mode; when M When equal to 1, 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 a 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 a motion vector prediction mode and motion information of a candidate image block on the left side of the current image block.
  • acquiring a 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 each motion information and acquiring each motion The weight corresponding to the information, and obtain the template of the current image block according to the weight corresponding to each motion information and the template corresponding to the motion information.
  • the motion information corresponding to the current image block may include original motion information of the current image block.
  • the processing procedure of the twelfth embodiment is similar to that of the second embodiment.
  • Embodiment 13 is a diagrammatic representation of Embodiment 13:
  • the original mode information is the original motion vector of the current image block
  • the target mode information is the target motion vector of the current image block.
  • the decoder can obtain the original motion vector of the current image block, and obtain a target motion vector according to the original motion vector and the obtained template, and the target motion vector is different from the original motion vector.
  • the decoding end decodes the current image block according to the target motion vector.
  • the decoding end determines the target motion vector as the final motion vector of the current image block, and uses the final motion vector of the current image block to decode the current image block. There is no restriction on this decoding process.
  • the process of obtaining the original motion vector of the current image block by the decoding end may further include: receiving an encoded bit stream corresponding to the current image block from the encoding end, where the encoded bit stream carries the index value of the original motion vector;
  • the motion vector corresponding to the index value is selected from the list as the original motion vector of the current image block. If the index value is 1, the first motion vector in the motion vector list is obtained as 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 of the current image block, or the default motion vector is determined as the original motion vector.
  • the decoding end may also parse the first indication information or the second indication information from the encoded bit stream corresponding to the current image block.
  • the encoded bitstream carries the first instruction information
  • the target motion vector of the current image block can be obtained according to the original motion vector and the obtained template, and the current image block is decoded by using the target motion vector;
  • the encoded bitstream carries the second instruction information At this time, the current image block can be decoded according to the original motion vector.
  • 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 effectively improving the motion vector.
  • Accuracy improving decoding performance.
  • a template of the current image block may be acquired according to the motion information of the candidate image block, and a target motion vector may be acquired based on the template of the current image block and the original motion vector. Since the above method can quickly obtain a template of the current image block, and then obtain a target motion vector based on the template, it can effectively 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.
  • Embodiment 14 is a diagrammatic representation of Embodiment 14:
  • the process for the decoder to obtain the target motion vector according to the original motion vector and the obtained template is shown in FIG. 5 and may include:
  • Step 501 The decoding end determines the original motion vector as a central motion vector.
  • Step 502 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 St to obtain edge motion vectors (x-St, y) in different directions, ( x + St, y), (x, y + St), (x, y-St).
  • Step 503 The decoder obtains the coding performance of the central motion vector according to the template of the current image block, and obtains the coding performance of each 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.
  • 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.
  • 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.
  • 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 504 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 coding performance of each edge motion vector.
  • the decoding end may select a 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 as the target motion vector.
  • a motion vector with the second best coding performance can be selected from the center motion vector and the edge motion vector as the target motion vector.
  • Embodiment 5 For the decoding end to obtain the target motion vector according to the original motion vector and the obtained template, Embodiment 5 can also be adopted, but the execution subject is changed from the encoding end to the decoding end.
  • the original mode information is the original motion vector and the original reference frame of the current image block
  • the target mode information is the target motion vector and the target reference frame of the current image block.
  • the decoder can obtain the original motion vector and original reference frame of the current image block, and obtain the target motion vector of the current image block based on the template, original motion vector, and original reference frame of the current image block (the target motion vector can be compared with the original motion Vector is different) and the target reference frame, and the current image block is decoded according to the target motion vector and the target reference frame.
  • the decoding end obtains the target motion vector and the target reference frame of the current image block based on the template, the original motion vector, and the original reference frame of the current image block, which may include, but is not limited to, obtaining the target image based on the template and the original motion vector of the current image block.
  • the initial motion vector of the candidate reference frame according to the original motion vector may include, but is not limited to, the distance between the frame where the current image block is located and the original reference frame, the distance between the frame where the current image block is located and the candidate reference frame, and the original motion vector. To obtain the initial motion vector of the candidate reference frame.
  • obtaining a candidate motion vector of the original reference frame based on a template of the current image block and the original motion vector may include, but is not limited to, determining the original motion vector as a central motion vector and determining that the central motion vector corresponds to the central motion vector.
  • the edge motion vector is different from the center motion vector; then, obtain the encoding performance of the center motion vector according to the template of the current image block, and obtain the encoding performance of each edge motion vector according to the template of the current image block; Then, according to the coding performance of the central motion vector and the coding performance of each edge motion vector, a candidate motion vector of the original reference frame may be determined from the central motion vector and the edge motion vector.
  • obtaining the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame may include, but is not limited to, determining the initial motion vector of the candidate reference frame as a center motion vector, and determining a motion with the center.
  • Vector corresponding edge motion vector which is different from the center motion vector; obtain the coding performance of the center motion vector and the coding performance of each edge motion vector according to the template of the current image block; according to the coding performance of the center motion vector and each edge motion
  • the coding performance of the vector is to determine the candidate motion vector of the candidate reference frame from the center motion vector and the edge motion vector.
  • the original mode information may be an original prediction image block
  • the target mode information may be a target prediction image block.
  • the decoder can obtain the original predicted image block of the current image block, obtain the target predicted image block of the current image block based on the template of the current image block and the original predicted image block, and decode the current image block according to the target predicted image block .
  • the decoding end obtains the target predicted image block of the current image block based on the template of the current image block and the original predicted image block, which may include, but is not limited to, the decoding end obtains the transformation coefficient according to the template of the current image block and the reference block corresponding to the template. ; Then, perform illumination compensation on the original predicted image block according to the transform coefficient to obtain the target predicted image block of the current image block.
  • the decoding end may also obtain the motion vector of the current image block and the reference frame index corresponding to the motion vector; then, A reference block corresponding to the template is obtained according to the motion vector of the current image block and the reference frame index.
  • the decoding end obtains the transformation coefficient according to the template of the current image block and the reference block corresponding to the template, which may include but is not limited to: according to parameter information of each pixel of the template of the current image block, and the reference block corresponding to the template
  • the parameter information of each pixel is used to obtain the transformation coefficient.
  • the parameter information may include a brightness value.
  • Embodiment 17 is a diagrammatic representation of Embodiment 17:
  • an embodiment of the present application further provides a decoding device, which is applied to the decoding end.
  • FIG. 6 it is a structural diagram of the device.
  • the device includes: an obtaining module 61, configured to: Acquiring motion information of a candidate image block of the current image block, and acquiring a template of the current image block according to the motion information of the candidate image block; a decoding module 62, configured to perform current analysis on the current image according to the template of the current image block The block is decoded.
  • the decoding module 62 When the decoding module 62 decodes the current image block according to the template of the current image block, the decoding module 62 is specifically configured to: obtain original mode information of the current image block; based on the template and the current image block The original mode information acquires target mode information of the current image block; and decodes the current image block according to the target mode information.
  • the decoding device further includes a receiving module for receiving an encoded bit stream corresponding to a current image block from an encoding end. If the encoded bitstream carries first indication information, the first indication information is used to instruct to obtain target mode information of the current image block based on the template of the current image block and the original mode information, the obtaining The module 61 is further configured to acquire motion information of a candidate image block of the current image block according to the first instruction information, and acquire a template of the current image block according to the motion information of the candidate image block.
  • the decoding module 62 is further configured to use the second indication information according to the second indication information. To obtain the original mode information, and decode the current image block based on the original mode information.
  • the obtaining module 61 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 policy information is used to instruct to obtain target mode information of the current image block based on a template of the current image block and the original mode information.
  • the decoding module 62 is further configured to obtain the original mode information according to the locally preset second policy information, and decode the current image block based on the original mode information.
  • the second policy information is used to instruct to decode a current image block based on the original mode information.
  • the decoding module 62 is further configured to decode the current image block according to the locally preset third policy information.
  • the third policy information is the same policy information as the candidate image block of the current image block.
  • the decoding module 62 is based on the template and The obtaining of the target mode information of the current image block by the original mode information is specifically used to determine the original motion vector as a central motion vector; determine an edge motion vector corresponding to the central motion vector, and the edge motion vector Different from the central motion vector; obtaining the coding performance of the central motion vector and the coding performance of each of the edge motion vectors according to the template; the coding performance of the central motion vector and the coding of each of the edge motion vectors according to the template Performance, determining the target motion vector from the center motion vector and each of the edge motion vectors.
  • the decoding module 62 is based on the When obtaining the target mode information of the current image block by using the template and the original mode information of the current image block, the method is specifically configured to obtain the original reference frame based on the template of the current image block and the original motion vector.
  • the candidate motion vector of the candidate obtain the initial motion vector of each candidate reference frame according to the original motion vector; obtain the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame; Among the motion vectors and the candidate motion vectors of each of the candidate reference frames, a candidate motion vector with the best coding performance is selected as the target motion vector, and a reference frame corresponding to the target motion vector is determined as the target reference frame.
  • the decoding module 62 When the decoding module 62 obtains an initial motion vector of a candidate reference frame according to the original motion vector, the decoding module 62 is specifically configured to: according to a distance between a frame where the current image block is located and the original reference frame, a frame where the current image block is located, and the candidate reference frame And the original motion vector to obtain the initial motion vector of the candidate reference frame.
  • the decoding module 62 When the decoding module 62 obtains the candidate motion vector of the original reference frame based on the template of the current image block and the original motion vector, the decoding module 62 is specifically configured to: determine the original motion vector as a center motion vector; 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 each of the edge motion vectors according to the template; The coding performance of the central motion vector and the coding performance of each of the edge motion vectors are described, and a candidate motion vector of the original reference frame is determined from the central motion vector and the edge motion vector.
  • the decoding module 62 When the decoding module 62 obtains the candidate motion vector of the candidate reference frame according to the initial motion vector, the decoding module 62 is specifically configured to: determine the initial motion vector of the candidate reference frame as a central motion vector; and determine that the initial motion vector corresponds to the central motion vector.
  • the edge motion vector is different from the center motion vector; obtains the encoding performance of the center motion vector and the encoding performance of each of the edge motion vectors according to the template; and the encoding according to the center motion vector Performance and coding performance of each of the edge motion vectors, and determining the candidate motion vector corresponding to the candidate reference frame from the center motion vector and the edge motion vector.
  • the decoding module 62 acquires the current image based on the template of the current image block and the original mode information
  • the target mode information of the block is specifically used to: obtain a transform coefficient according to the template and a reference block corresponding to the template; perform illumination compensation on the original predicted image block according to the transform coefficient to obtain the target predicted image block .
  • the decoding module 62 is further configured to: obtain a motion vector of the current image block and a reference frame index corresponding to the motion vector; and obtain a corresponding one of the templates according to the motion vector of the current image block and the reference frame index. Reference block.
  • the decoding module 62 obtains the transform coefficients according to the template and the reference block corresponding to the template, and is specifically configured to: according to parameter information of each pixel of the template, and each pixel of the reference block corresponding to the template. Parameter information to obtain the transformation coefficient.
  • the parameter information includes a brightness value.
  • the candidate image blocks 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 of 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 the left side of the current image block
  • the obtaining module 61 is specifically configured to determine the motion vector prediction mode and motion information of the M first candidate image blocks A first template; determining a second template according to a motion vector prediction mode and motion information of N second candidate image blocks; determining the first template as a template of the current image block, or determining the second template Determine the template of the current image block, or determine 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 on the left side of the current image block and / or a second neighboring image block.
  • the prediction mode of the adjacent image block is an inter mode or an intra mode; the prediction mode of the next adjacent image block is an inter mode.
  • the first template When M is greater than 1, the first template includes M sub-templates or P sub-templates, and is formed by splicing the M sub-templates or P sub-templates, where P is the first candidate for the inter-frame mode
  • the motion information includes a motion vector and a reference frame index of the first candidate image block
  • the obtaining module 61 determines the first according to the motion vector prediction mode and motion information of the M first candidate image blocks.
  • the template is specifically used for: 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, according to the reference A frame index determines a reference frame image of the i-th candidate image block; and determining a reference image block of the i-th candidate image block from the reference frame image according to a motion vector of the i-th candidate image block, The relative displacement between the reference image block and the i-th candidate image block matches the motion vector of the i-th candidate image block; according to the reference image block, the size is obtained as a first horizontal length and a first vertical
  • the image block of length is used as the ith sub-template included in the first template.
  • the obtaining module 61 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 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 filled with a default value, and an image with a size of a first horizontal length and a first vertical length is obtained The block serves as an ith sub-template included in the first template.
  • a reference frame corresponding to the i-th candidate image block is determined according to a reference frame index corresponding to the i-th candidate image block An image; determining a reference image block corresponding to the i-th candidate image block from the reference frame image according to a motion vector corresponding to the i-th candidate image block, the reference image block and the i-th candidate image block The relative displacement of the image block matches the motion vector corresponding to the i-th candidate image block; and according to the reference image block, obtaining an image block with a size of a first horizontal length and a first vertical length as the first template includes: I-th child template.
  • the reference frame index and motion vector corresponding to the i-th candidate image block are reference frame indexes 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, 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 N is greater than 1, the second template includes N sub-templates or R sub-templates, and is formed by splicing the N sub-templates or R sub-templates, and R is the second candidate of the inter-frame mode.
  • the motion information includes a motion vector and a reference frame index of the second candidate image block
  • the acquisition module 61 determines a second vector based on the motion vector prediction mode and motion information of the N second candidate image blocks.
  • the template is specifically used for: 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 ith candidate image block is an inter mode, according to the reference A frame index determines a reference frame image of the i-th candidate image block; and determining a reference image block of the i-th candidate image block from the reference frame image according to a motion vector of the i-th candidate image block,
  • the relative displacement between the reference image block and the i-th candidate image block matches the motion vector of the i-th candidate image block; according to the reference image block, the size is obtained as a second horizontal length and a second vertical
  • the image block of length is used as the ith sub-template included in the second template.
  • the obtaining module 61 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 The block serves as an ith sub-template included in the second template.
  • a reference frame corresponding to the i-th candidate image block is determined according to a reference frame index corresponding to the i-th candidate image block An image; determining a reference image block corresponding to the i-th candidate image block from the reference frame image according to a motion vector corresponding to the i-th candidate image block, the reference image block and the i-th candidate image block The relative displacement of the image block matches the motion vector corresponding to the i-th candidate image block; according to the determined reference image block, an image block having a second horizontal length and a second vertical length is obtained as the first
  • the template includes the i-th child template.
  • the reference frame index and motion vector corresponding to the i-th candidate image block are reference frame indexes 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, or the horizontal length of the current image block satisfies a sixth proportional relationship, or is equal to a third preset length;
  • the two vertical lengths satisfy a seventh proportional relationship with the vertical length of the second candidate image block, or satisfy an eighth proportional relationship with the vertical length of the current image block, or are equal to a fourth preset length.
  • the acquiring module 61 is specifically configured to acquire a template of the current image block according to the motion information of the candidate image block: when the current image block corresponds to multiple motion information, acquire a template corresponding to each motion information, and acquire 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 a template corresponding to the motion information.
  • an embodiment of the present application further proposes an encoding device, which is applied to the encoding end.
  • an encoding device which is applied to the encoding end.
  • FIG. 7 it is a structural diagram of the device.
  • the device includes:
  • An obtaining module 71 is configured to obtain motion information of a candidate image block of the current image block, and obtain a template of the current image block according to the motion information of the candidate image block; an encoding module 72 is configured to obtain a template according to the current image block. The template encodes the current image block to obtain an encoded bit stream corresponding to the current image block; and a sending module 73 is configured to send the encoded bit stream to a decoding end.
  • the encoding module 72 encodes the current image block according to the template of the current image block to obtain an encoded bit stream corresponding to the current image block, and is specifically configured to: obtain original mode information of the current image block; based on the Obtaining the target mode information of the current image block by using the template and the original mode information of the current image block; encoding the current image block according to the target mode information to obtain an encoded bit stream corresponding to the current image block.
  • the sending module 73 When the current image block is encoded according to the target mode information, the sending module 73 carries the first instruction information to the encoded bit stream corresponding to the current image block sent by the decoding end, where the first instruction information is used to indicate The template of the current image block and the original mode information obtain target mode information of the current image block.
  • the sending module 73 carries second instruction information to the encoded bit stream corresponding to the current image block sent by the decoding end, where the second instruction information is used to indicate The original mode information is used to decode the current image block.
  • the encoding module 72 is based on the template and The obtaining of the target mode information of the current image block by the original mode information is specifically used to determine the original motion vector as a central motion vector; determine an edge motion vector corresponding to the central motion vector, and the edge motion vector Different from the central motion vector; obtaining the coding performance of the central motion vector and the coding performance of each of the edge motion vectors according to the template; the coding performance of the central motion vector and the coding of each of the edge motion vectors according to the template Performance, determining the target motion vector from the center motion vector and the edge motion vector.
  • the encoding module 72 is based on the When obtaining the target mode information of the current image block by using the template and the original mode information of the current image block, the method is specifically configured to obtain the original reference frame based on the template of the current image block and the original motion vector.
  • the candidate motion vector of the candidate obtain the initial motion vector of each candidate reference frame according to the original motion vector; obtain the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame; A candidate motion vector with the best coding performance is selected from the motion vectors and the candidate motion vectors of each of the candidate reference frames as the target motion vector, and a reference frame corresponding to the target motion vector is determined as the target reference frame.
  • the encoding module 72 When the encoding module 72 obtains the initial motion vector of each candidate reference frame according to the original motion vector, the encoding module 72 is specifically configured to: according to the distance between the frame where the current image block is located and the original reference frame, the frame where the current image block is located, and the candidate reference The distance of the frame and the original motion vector are used to obtain the initial motion vector of the candidate reference frame.
  • the encoding module 72 When the encoding module 72 obtains the candidate motion vector of the original reference frame based on the template of the current image block and the original motion vector, the encoding module 72 is specifically configured to: determine the original motion vector as a center motion vector; 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 each of the edge motion vectors according to the template; The coding performance of the central motion vector and the coding performance of each of the edge motion vectors are described, and a candidate motion vector of the original reference frame is determined from the central motion vector and the edge motion vector.
  • the encoding module 72 When the encoding module 72 obtains the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame, the encoding module 72 is specifically configured to: determine the initial motion vector of the candidate reference frame as a central motion vector; The edge motion vector corresponding to the central motion vector; the edge motion vector is different from the central motion vector; obtaining the encoding performance of the central motion vector and the encoding performance of each of the edge motion vectors according to the template; according to the center The coding performance of a motion vector and the coding performance of each of the edge motion vectors are determined from the center motion vector and the edge motion vector, and the candidate motion vector corresponding to the candidate reference frame.
  • the encoding module 72 obtains the current image based on the template of the current image block and the original mode information
  • the target mode information of the block is specifically used to: obtain a transform coefficient according to the template and a reference block corresponding to the template; perform illumination compensation on the original predicted image block according to the transform coefficient to obtain the target predicted image block .
  • the encoding module 72 is further configured to: obtain a motion vector of the current image block and a reference frame index corresponding to the motion vector; and obtain a corresponding one of the templates according to the motion vector of the current image block and the reference frame index. Reference block.
  • the encoding module 72 obtains the transform coefficients according to the template and the reference block corresponding to the template, and is specifically configured to: according to parameter information of each pixel of the template and each pixel of the reference block corresponding to the template. Parameter information to obtain the transformation coefficient.
  • the parameter information includes a brightness value.
  • 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
  • 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 image A template of the block, or a template of the current image block determined 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 on the left side of the current image block and / or a second neighboring image block.
  • the prediction mode of the adjacent image block is an inter mode or an intra mode; the prediction mode of the next adjacent image block is an inter mode.
  • the first template When M is greater than 1, the first template includes M sub-templates or P sub-templates, and is formed by splicing the M sub-templates or P sub-templates, where P is the first candidate for the inter-frame mode
  • 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 of the i-th candidate image block; and determining a reference image block of 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 image block The relative displacement with the i-th candidate image block matches the motion vector of the i-th candidate image block; according to the reference image block, an image block having a size of a first horizontal length and a first vertical length is obtained as
  • the first template includes an i-th sub-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 The block serves as an ith sub-template included in the first template.
  • a reference frame corresponding to the i-th candidate image block is determined according to a reference frame index corresponding to the i-th candidate image block An image; determining a reference image block corresponding to the i-th candidate image block from the reference frame image according to a motion vector corresponding to the i-th candidate image block, the reference image block and the i-th candidate image block The relative displacement of the image block matches the motion vector corresponding to the i-th candidate image block; and according to the reference image block, obtaining an image block with a size of a first horizontal length and a first vertical length as the first template includes: I-th child template.
  • the reference frame index and motion vector corresponding to the i-th candidate image block are reference frame indexes 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, 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 N is greater than 1, the second template includes N sub-templates or R sub-templates, and is formed by splicing the N sub-templates or R sub-templates, and R is the second candidate of the inter-frame mode.
  • 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. : 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, determine the according to the reference frame index A reference frame image of the i-th candidate image block; and determining a reference image block of 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 image block The relative displacement with the i-th candidate image block is matched with the motion vector of the i-th candidate image block; according to the reference image block, an image block having a size of a second horizontal length and a second vertical length is obtained as
  • the second template includes an i-th sub-template.
  • 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 The block serves as an ith sub-template included in the second template.
  • a reference frame corresponding to the i-th candidate image block is determined according to a reference frame index corresponding to the i-th candidate image block An image; determining a reference image block corresponding to the i-th candidate image block from the reference frame image according to a motion vector corresponding to the i-th candidate image block, the reference image block and the i-th candidate image block The relative displacement of the image block matches the motion vector corresponding to the i-th candidate image block; obtaining, according to the reference image block, an image block with a size of a second horizontal length and a second vertical length as the first template includes: I-th child template.
  • the reference frame index and motion vector corresponding to the i-th candidate image block are reference frame indexes 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, 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 acquiring module 71 is specifically configured to acquire the template of the current image block according to the motion information of the candidate image block: when the current image block corresponds to multiple motion information, acquire a template corresponding to each motion information, and acquire A weight corresponding to each motion information, and a template of the current image block is obtained according to a weight corresponding to each motion information and a template corresponding to the motion information.
  • the processor 81 includes a processor 81 and a machine-readable storage medium 82.
  • the machine-readable storage medium 82 stores machine-executable instructions that can be executed by the processor 81.
  • the processor 81 is configured to execute a machine-executable instruction. Instructions to implement the decoding method disclosed in the above examples of this application.
  • an embodiment of the present application further provides a machine-readable storage medium.
  • the machine-readable storage medium stores a number of computer instructions.
  • the present invention can be implemented. Apply for the decoding method disclosed in the above example.
  • 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 encoding method disclosed in the above example of this application.
  • an embodiment of the present application further provides a machine-readable storage medium.
  • the machine-readable storage medium stores a number of computer instructions.
  • the present invention can be implemented. Apply for the encoding method disclosed in the above example.
  • 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.
  • 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 operating steps can be performed on the computer or other programmable device to produce a computer-implemented process, thereby being on the computer or other programmable device
  • the executed instructions provide steps for implementing the functions specified in one or more flowcharts and / or one or more blocks of the block diagrams.

Abstract

The present application provides a decoding method, an encoding method, and a corresponding apparatus, an example of the method comprising: acquiring motion information of a candidate image block of a present image block; acquiring a template of the present image block according to the motion information of the candidate image block; and decoding the present image block according to the template of the present image block.

Description

一种解码、编码方法及其设备Decoding and encoding method and equipment 技术领域Technical field
本申请涉及视频编解码技术领域,尤其涉及一种解码、编码方法及其设备。The present application relates to the technical field of video encoding and decoding, and in particular, to a decoding and encoding method and a device thereof.
背景技术Background technique
为了达到节约空间的目的,视频中的图像都是经过编码后才传输的,完整的视频编码方法可以包括预测、变换、量化、熵编码、滤波等过程。其中,预测编码包括帧内编码和帧间编码。帧间编码是利用视频时域的相关性,使用邻近已编码图像的像素预测当前图像的像素,以有效去除视频时域冗余。In order to achieve the purpose of saving space, the images in the video are transmitted after being encoded. A complete video encoding method may include prediction, transformation, quantization, entropy encoding, and filtering. Among them, predictive coding includes intra coding and inter 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 encoded image to effectively remove the video time domain redundancy.
在视频编码技术中,编码过程是按照逐个图像块进行的。在进行当前图像块的编码时,周围已编码图像块的重建信息是可被利用的,而模板(Template)是指当前图像块周围(时域或空域的相邻区域)固定形状的解码信息。在编码端和解码端,模板是完全一样的。因此,在编码端利用模板进行的一些操作,在解码端可获得完全一致的结果。也就是说,编码端基于模板推导的信息可以在解码端无损恢复,而不需要传递额外信息,从而可进一步减少传输比特数。In video coding technology, the coding process is performed on a block-by-block basis. When encoding the current image block, reconstruction information of surrounding coded image blocks is available, and a template (Template) refers to decoding information of a fixed shape around the current image block (adjacent regions in the time or space domain). The template is exactly the same at the encoding and decoding ends. Therefore, some operations performed by the template on the encoding side can obtain completely consistent results on the decoding side. In other words, the information derived by the encoder based on the template can be recovered losslessly at the decoder without the need to pass additional information, which can further reduce the number of transmitted bits.
但是,传统的模板生成方式,存在解码效率低,解码时延大等问题。However, the traditional template generation method has problems such as low decoding efficiency and large decoding delay.
发明内容Summary of the invention
本申请提供了一种解码、编码方法及其设备,可以有利于提高解码效率,降低解码时延,提高编解码性能。The application provides a decoding and encoding method and a device thereof, which can help improve decoding efficiency, reduce decoding delay, and improve encoding and decoding performance.
本申请提供一种解码方法,应用于解码端,所述方法包括:获取当前图像块的候选图像块的运动信息;根据所述候选图像块的运动信息获取所述当前图像块的模板;根据所述当前图像块的所述模板对所述当前图像块进行解码。This application provides a decoding method, which is applied to a decoding 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; The template of the current image block decodes the current image block.
本申请提供一种编码方法,应用于编码端,所述方法包括:获取当前图像块的候选图像块的运动信息;根据所述候选图像块的运动信息获取所述当前图像块的模板;根据所述当前图像块的所述模板对所述当前图像块进行编码,得到所述当前图像块对应的编码比特流;将所述编码比特流发送给解码端。The present application provides an encoding method, 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; The template of the current image block encodes the current image block to obtain an encoded bit stream corresponding to the current image block; and sends the encoded bit stream to a decoding end.
本申请提供一种解码端设备,所述解码端设备包括处理器和机器可读存储介质。其中,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令;所述处理器用于执行机器可执行指令,以实现上述的方法步骤。This application provides a decoding device, which includes a processor and a machine-readable storage medium. The machine-readable storage medium stores machine-executable instructions that can be executed by the processor; the processor is configured to execute the machine-executable instructions to implement the foregoing method steps.
本申请提供一种编码端设备,所述编码端设备包括处理器和机器可读存储介质。其中,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令;所述处理器用于执行机器可执行指令,以实现上述的方法步骤。This application provides an encoding end device, which includes a processor and a machine-readable storage medium. The machine-readable storage medium stores machine-executable instructions that can be executed by the processor; the processor is configured to execute the machine-executable instructions to implement the foregoing method steps.
由以上技术方案可见,本申请实施例中,可以根据当前图像块的候选图像块的运动信息获取当前图像块的模板,并根据当前图像块的模板对当前图像块进行解码。上述方 式由于可以快速得到当前图像块的模板,从而可以有效提高解码效率、降低解码时延并提高编解码性能。As can be seen from the above technical solutions, in the embodiment of the present application, a template of the current image block may be obtained according to the motion information of the candidate image block of the current image block, and the current image block may be decoded according to the template of the current image block. The above method can quickly obtain the template of the current image block, which can effectively improve decoding efficiency, reduce decoding delay, and improve encoding and decoding performance.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是本申请一种实施方式中的编码方法的流程图。FIG. 1 is a flowchart of an encoding method according to an embodiment of the present application.
图2A-图2O是本申请一种实施方式中的目标图像块的模板示意图。2A-2O are schematic diagrams of a template of a target image block in an embodiment of the present application.
图3A-图3D是本申请另一种实施方式中的编码方法的流程图。3A-3D are flowcharts of an encoding method in another embodiment of the present application.
图4是本申请一种实施方式中的解码方法的流程图。FIG. 4 is a flowchart of a decoding method according to an embodiment of the present application.
图5是本申请另一种实施方式中的解码方法的流程图。FIG. 5 is a flowchart of a decoding method in another embodiment of the present application.
图6是本申请一种实施方式中的解码装置的结构图。FIG. 6 is a structural diagram of a decoding device according to an embodiment of the present application.
图7是本申请一种实施方式中的编码装置的结构图。FIG. 7 is a block diagram of an encoding device according to an embodiment of the present application.
图8是本申请一种实施方式中的解码端设备的硬件结构图。FIG. 8 is a hardware structural diagram of a decoder device in an embodiment of the present application.
图9是本申请一种实施方式中的编码端设备的硬件结构图。FIG. 9 is a hardware structural diagram of an encoding end device in an embodiment of the present application.
具体实施方式detailed description
在本申请实施例使用的术语仅仅是出于描述特定实施例的目的,而非限制本申请。本申请和权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其它含义。还应当理解,本文中使用的术语“和/或”是指包含一个或多个相关联的列出项目的任何或所有可能组合。The terminology used in the embodiments of the present application is for the purpose of describing particular embodiments only, and is not intended to limit the present application. The singular forms "a", "the" and "the" used in this application and the claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to any or all possible combinations that include one or more of the associated listed items.
应当理解,尽管在本申请实施例可能采用术语第一、第二、第三等来描述各种信息,但这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本申请范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used to describe various information in the embodiments of the present application, these terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the 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. Depending on the context, the word "if" can be interpreted as "at" or "at ..." or "in response to a determination".
本申请实施例中提出一种解码、编码方法,该方法可以涉及如下概念:A method for decoding and encoding is proposed in the embodiment of the present application. The method may involve the following concepts:
运动矢量(Motion Vector,MV):在帧间编码中,使用运动矢量表示当前帧图像的当前图像块与参考帧图像的参考图像块之间的相对位移。例如,当前帧的图像A与参考帧的图像B存在很强的时域相关性,在传输图像A的图像块A1(当前图像块)时,可以在图像B中进行运动搜索,找到与图像块A1最匹配的图像块B1(参考图像块),并确定图像块A1与图像块B1之间的相对位移。该相对位移也就是图像块A1的运动矢量。其中,每个图像块都有相应的运动矢量传送到解码端。如果对每个图像块的运动矢量进行独立编码和传输,则消耗相当多的比特。为降低用于编码运动矢量的比特数,可以利用相邻图像块之间的空间相关性,根据相邻已编码图像块的运动矢量对当前待编码图像块的运动矢量进行预测,然后对预测差进行编码。Motion Vector (MV): In inter-frame coding, a motion vector is 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. For example, there is a strong time-domain correlation between image A of the current frame and image B of the reference frame. When transmitting image block A1 (current image block) of image A, you can perform a motion search in image B to find the image block A1 best matches image block B1 (reference image block), and determines the relative displacement between image block A1 and image block B1. This relative displacement is also the motion vector of the image block A1. Among them, each image block has a corresponding motion vector transmitted to the decoding end. If the motion vector of each image block is independently encoded and transmitted, it consumes a considerable number of bits. 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 For encoding.
运动信息(Motion Information):为了准确指向图像块,除了获取运动矢量,还需要参考帧图像的索引信息来表示使用哪个参考帧图像。对于当前帧图像,通常可以建立 一个参考帧图像列表,参考帧索引表示当前图像块采用了参考帧图像列表中的第几个参考帧图像。可以将运动矢量、参考帧索引等与运动相关的信息统称为运动信息。Motion information (Information): In order to accurately point to an image block, in addition to acquiring motion vectors, index information of a reference frame image is required to indicate which reference frame image is used. For the current frame image, a reference frame image list can usually be established. 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.
模板(Template):在视频编码技术中,编码过程是按照逐个图像块进行的。在进行当前图像块的编码时,周围已编码图像块的重建信息是可被利用的。模板指当前图像块周围(时域或空域的相邻区域)固定形状的编码/解码信息。在编码端和解码端,模板是完全一样的。因此,在编码端利用模板进行的一些操作,在解码端可利用该模板获得完全一致的结果。也就是说,编码端基于模板推导的信息可以在解码端无损恢复,而不需要传递额外信息,从而可进一步减少传输比特数。Template: In video coding technology, the coding process is performed on an image-by-image block basis. When encoding the current image block, reconstruction information of the surrounding coded image blocks is available. 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 and decoding ends. Therefore, some operations performed by the template on the encoding end can be used to obtain completely consistent results on the decoding end. In other words, the information derived by the encoder based on the template can be recovered losslessly at the decoder without the need to pass additional information, which can further reduce the number of transmitted bits.
率失真原则(Rate-Distortion Optimized):评价编码效率的有两大指标:码率(又称比特率,Bit Per Second,BPS)和PSNR(Peak Signal to Noise Ratio,峰值信噪比)。对于同一视频,编码比特流越小,则压缩率越大;PSNR越大,则重建图像质量越好。在模式选择时,判别公式实质上也就是对二者的综合评价。例如,模式对应的代价:Rate-Distortion Optimized: There are two major indicators for evaluating coding efficiency: bit rate (also known as Bit Rate, Second, BPS) and PSNR (Peak Signal to Noise Ratio, peak signal-to-noise ratio). For the same video, the smaller the encoded bitstream, the greater the compression ratio; the larger the PSNR, the better the reconstructed image quality. In the mode selection, the discrimination formula is essentially a comprehensive evaluation of the two. For example, the cost of the model:
J(mode)=D+λ*R。J (mode) = D + λ * R.
其中,D表示Distortion(失真),通常可以使用SSE(Sum-Square Error)指标来进行衡量,SSE是指重建图像块与源图像的差值的均方和;λ是拉格朗日乘子,R就是该模式下图像块编码所需的实际比特数,包括编码模式信息、运动信息、残差等所需的比特总和。Among them, D represents Distortion (distortion), which can usually be measured using the SSE (Sum-Square Error) index. SSE refers to the mean square sum of the difference between the reconstructed image block and the source image; λ is the Lagrange multiplier, R is the actual number of bits required for image block coding in this mode, including the sum of the bits required for coding mode information, motion information, and residuals.
帧内预测(intra prediction)是指,可以利用当前图像块的空域相邻图像块(即与当前图像块处于同一帧图像)的重建像素值进行预测编码。Intra prediction (intraprediction) refers to the use of reconstructed pixel values of spatially adjacent image blocks of the current image block (that is, in the same frame image as the current image block) for predictive encoding.
帧间预测(inter prediction)是指,可以利用当前图像块的时域相邻图像块(与当前图像块处于不同帧图像)的重建像素值进行预测编码。Inter prediction (inter prediction) refers to the use of reconstructed pixel values of time-domain neighboring image blocks of the current image block (in a different frame image from the current image block) for predictive coding.
以下结合几个具体的实施例,对本公开提供的解码方法、编码方法进行详细说明。The following describes in detail the decoding method and the encoding method provided by the present disclosure in combination with several specific embodiments.
实施例一:Embodiment one:
参见图1所示,为编码方法的流程示意图,该方法可以包括以下步骤:Referring to FIG. 1, which is a schematic flowchart of an encoding method, the method may include the following steps:
步骤101,编码端获取当前图像块的候选图像块的运动信息。Step 101: 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 are no restrictions on this candidate image block.
在对当前图像块进行编码时,由于当前图像块的候选图像块已经完成编码,即候选图像块的运动信息为已知,因此,编码端可以直接获取候选图像块的运动信息,如候选图像块的运动矢量和参考帧索引等,对此不做限制。When encoding the current image block, since the candidate image block of the current image block has been encoded, that is, the motion information of the candidate image block is known, the encoder can directly obtain the motion information of the candidate image block, such as the candidate image block. The motion vector and reference frame index are not limited.
步骤102,编码端根据候选图像块的运动信息获取当前图像块的模板。Step 102: The encoder obtains a template of the current image block according to the motion information of the candidate image block.
本步骤102的处理过程,可以参见后续实施例。For the processing procedure of this step 102, refer to the subsequent embodiments.
步骤103,编码端根据当前图像块的模板对当前图像块进行编码,得到该当前图像块对应的编码比特流。Step 103: The encoding end encodes the current image block according to the template of the current image block to obtain an encoded bit stream corresponding to the current image block.
根据当前图像块的模板对当前图像块进行编码,得到当前图像块对应的编码比特流, 可以包括但不限于:获取当前图像块的原始模式信息;基于当前图像块的模板和原始模式信息,获取当前图像块的目标模式信息;根据该目标模式信息对当前图像块进行编码,得到当前图像块对应的编码比特流。其中,原始模式信息为原始运动矢量,目标模式信息为目标运动矢量;或者,原始模式信息为原始运动矢量和原始参考帧,目标模式信息为目标运动矢量和目标参考帧;或者,原始模式信息为原始预测图像块,目标模式信息为目标预测图像块。当然,上述只是示例,对此不做限制。Encoding the current image block according to the template of the current image block to obtain the encoded bit stream corresponding to the current image block may include, but is not limited to: obtaining the original mode information of the current image block; obtaining based on the template and original mode information of the current image block, obtaining Target mode information of the current image block; encoding the current image block according to the target mode information to obtain a coded bit stream corresponding to the current image block. The original mode information is the original motion vector, and the target mode information is the target motion vector. Or, the original mode information is the original motion vector and the original reference frame, and the target mode information is the target motion vector and the target reference frame. Or, the original mode information is The original prediction image block, and the target mode information is the target prediction image block. Of course, the above is only an example, and there is no limitation on this.
步骤104,编码端将该编码比特流发送给解码端。Step 104: The encoding end sends the encoded bit stream to the decoding end.
当编码端根据目标模式信息对当前图像块进行编码时,编码端向解码端发送的当前图像块对应的编码比特流可携带第一指示信息,该第一指示信息用于指示解码端基于当前图像块的模板和原始模式信息获取当前图像块的目标模式信息。当编码端根据原始模式信息对当前图像块进行编码时,编码端向解码端发送的当前图像块对应的比特流可携带第二指示信息,第二指示信息用于指示解码端基于原始模式信息对当前图像块进行解码。When the encoding end encodes the current image block according to the target mode information, the encoding bit stream corresponding to the current image block sent by the encoding end to the decoding end may carry first instruction information, where the first instruction information is used to instruct the decoding end to base on the current image The template and original mode information of the block obtain the target mode information of the current image block. When the encoding end encodes the current image block according to the original mode information, the bit stream corresponding to the current image block sent by the encoding end to the decoding end may carry second instruction information, and the second instruction information is used to instruct the decoding end to pair the original image information based on the original mode information. Decode the current image block.
上述方式是采用显式方式通知第一指示信息或者第二指示信息。在实际应用中,还可以采用隐式方式通知,即不在当前图像块对应的编码比特流中携带第一指示信息或者第二指示信息。具体的,编码端和解码端还可以协商决策策略或者在标准定义决策策略,并将所述决策策略分别存储在编码端和解码端。例如,决策策略可以约定第一策略信息,第一策略信息用于指示基于当前图像块的模板和原始模式信息获取当前图像块的目标模式信息。或者,决策策略可以约定第二策略信息,第二策略信息用于指示基于原始模式信息对当前图像块进行解码。或者,决策策略可以约定第三策略信息,第三策略信息为采用与当前图像块的候选图像块相同的策略信息。In the above manner, the first instruction information or the second instruction information is notified in an explicit manner. In practical applications, 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 corresponding to the current image block. Specifically, the encoding end and the decoding end may also negotiate a decision strategy or define a decision strategy in a standard, and store the decision strategies on the encoding end and the decoding end, respectively. For example, the decision strategy may agree on first strategy information, and the first strategy information is used to indicate that target mode information of the current image block is obtained based on a template of the current image block and original mode information. Alternatively, the decision strategy may agree on the second strategy information, and the second strategy information is used to instruct the current image block to be decoded based on the original mode information. Alternatively, the decision strategy may agree on the third strategy information, and the third strategy information is the same strategy information as the candidate image block of the current image block.
在此基础上,当决策策略约定第一策略信息,且编码端根据目标模式信息对当前图像块进行编码时,则当前图像块对应的编码比特流中可以不携带第一指示信息和第二指示信息。当决策策略约定第二策略信息,且编码端根据原始模式信息对当前图像块进行编码时,则当前图像块对应的编码比特流中可以不携带第一指示信息和第二指示信息。当决策策略约定第三策略信息,且候选图像块采用第一策略信息、编码端根据目标模式信息对当前图像块进行编码时,当前图像块对应的编码比特流中可以不携带第一指示信息和第二指示信息。当决策策略约定第三策略信息,且候选图像块采用第二策略信息、编码端根据原始模式信息对当前图像块进行编码时,当前图像块对应的编码比特流中可以不携带第一指示信息和第二指示信息。On this basis, when the decision strategy agrees with the first strategy information and the encoding end encodes the current image block according to the target mode information, the encoded bit stream corresponding to the current image block may not carry the first indication information and the second indication information. When the decision strategy agrees on the second strategy information and the encoding end encodes the current image block according to the original mode information, the encoded bit stream corresponding to the current image block may not carry the first indication information and the second indication information. When the decision strategy agrees on the third strategy information, and the candidate image block uses the first strategy information, and the encoding end encodes the current image block according to the target mode information, the encoded bit stream corresponding to the current image block may not carry the first indication information and The second instruction information. When the decision strategy agrees with the third strategy information, and the candidate image block adopts the second strategy information, and the encoding end encodes the current image block according to the original mode information, the encoded bit stream corresponding to the current image block may not carry the first indication information and The second instruction information.
由以上可见,可以根据当前图像块的候选图像块的运动信息获取当前图像块的模板,并根据当前图像块的模板对当前图像块进行编码,得到当前图像块对应的编码比特流。上述方式由于可以快速得到当前图像块的模板,可以有效提高编码效率,降低编码时延,提高编码性能。It can be seen from the above that the template of the current image block can be obtained according to the motion information of the candidate image block of the current image block, and the current image block is encoded according to the template of the current image block to obtain the encoded bit stream corresponding to the current image block. The above method can quickly obtain the template of the current image block, which can effectively improve encoding efficiency, reduce encoding delay, and improve encoding performance.
实施例二:Embodiment two:
在视频编码过程中,对每帧图像的每个图像块逐一编码,在对当前图像块编码时,若当前图像块周围的相邻图像块已经重建完成,则可以利用相邻图像块的编码信息对当前图像块进行重建。例如,可以利用当前图像块的相邻图像块的编码信息获取当前图像 块的模板。该编码信息可以包括但不限于相邻图像块的重建信息和/或预测信息。该重建信息可以包括但不限于亮度值、色度值等。该预测信息可以是能够获取重建信息的中间值,例如,若能够利用中间值获取到亮度值,则该中间值是预测信息,本公开对此预测信息不做限制。In the video encoding process, each image block of each frame of image is encoded one by one. When encoding the current image block, if the adjacent image blocks around the current image block have been reconstructed, the encoding information of the adjacent image blocks can be used. Reconstruct the current image block. For example, the encoding information of the neighboring image blocks of the current image block can be used to obtain the template of the current image block. The encoding information may include, but is not limited to, reconstruction information and / or prediction information of neighboring 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, the intermediate value is prediction information, and the present disclosure does not limit the prediction information.
其中,若编码信息包括重建信息,则当前图像块的模板的生成需要等到重建阶段,大大降低了编解码的效率,带来编解码的时延。而若编码信息包括预测信息,则当前图像块的模板的生成也需要等到重建阶段,也大大降低了编解码的效率,带来编解码的时延。因此,上述方式会导致编解码的并行度受到较大影响。Among them, if the encoding information includes reconstruction information, the generation of the template of the current image block needs to wait until the reconstruction stage, which greatly reduces the efficiency of encoding and decoding, and brings the delay of encoding and decoding. If the encoding information includes prediction information, the generation of the template of the current image block also needs to wait until the reconstruction stage, which greatly reduces the efficiency of encoding and decoding and brings about the delay of encoding and decoding. Therefore, the above-mentioned method will greatly affect the parallelism of encoding and decoding.
针对上述发现,在本实施例中,提出了可以根据当前图像块的候选图像块的运动信息(如运动矢量和参考帧索引等)获取当前图像块的模板。并且,编码端和解码端均可应用该根据候选图像块的运动信息获取当前图像块的模板的方法。In view of the above findings, in this embodiment, a template that can acquire a current image block according to the motion information (such as a motion vector and a reference frame index) of a candidate image block of the current image block is proposed. In addition, both the encoding end and the decoding end can apply the method for obtaining a template of the current image block according to the motion information of the candidate image block.
其中,根据候选图像块的运动信息获取当前图像块的模板,可以包括:当候选图像块的运动信息包括候选图像块的运动矢量和参考帧索引时,根据该参考帧索引确定该候选图像块的参考帧图像;根据该运动矢量从该参考帧图像中获取该候选图像块的参考图像块,并根据该参考图像块获取该当前图像块的模板。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 ’s A reference frame image; obtaining a reference image block of 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.
例如,参见图2A所示,假设图像块A1是当前图像块,而图像块A2和A3是图像块A1的候选图像块。若图像块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’确定图像块A1的模板,参见图2A所示。For example, referring to FIG. 2A, assume that image block A1 is the current image block, and image blocks A2 and A3 are candidate image blocks of image block A1. If the reference frame index of the image block A2 is the index of the image B, it can be determined that the reference frame image of the image block A2 is the image B according to the reference frame index; then, the image block B2 corresponding to the image block A2 is selected from the image B ( As shown by the dashed arrows in the figure), the position of image block B2 in image B is the same as the position of image block A2 in image A; then, image block B2 can be moved according to the motion vector of image block A2, such as using The motion vector (3, 3) moves 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), and the image block B2' is the image block A2. Reference image block. Similarly, it can be determined that the reference image block of the image block A3 is the image block B3 '(as shown by the dotted arrow in the figure). Further, the template of the image block A1 may be determined according to the image blocks B2 'and B3', as shown in FIG. 2A.
在一个例子中,候选图像块可以包括M个第一候选图像块和N个第二候选图像块,M为大于或等于1的自然数,N为大于或等于0的自然数,或者,M为大于或等于0的自然数,N为大于或等于1的自然数。第一候选图像块为当前图像块上侧的候选图像块,第二候选图像块为当前图像块左侧的候选图像块。在这种情况下,根据候选图像块的运动信息获取当前图像块的模板,可以包括但不限于:根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板;根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板;然后,基于第一模板和第二模块确定当前图像块的模板。其中,基于第一模板和第二模板确定当前图像块的模板,可以包括但不限于:将第一模板确定为当前图像块的模板;或者,将第二模板确定为当前图像块的模板;或者,将第一模板和第二模板拼接之后确定为当前图像块的模板。In one example, 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, and the second candidate image block is a candidate image block on the left side of the current image block. In this case, acquiring the 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; A second template is determined based on the motion vector prediction mode and motion information of each second candidate image block; then, a template for the current image block is determined based on the first template and the second module. Wherein, determining the template of the current image block based on the first template and the second template may include, but is not limited to: determining the first template as the template of the current image block; or determining the second template as the template of the current image block; or , Determine the template of the current image block after stitching the first template and the second template.
若M为大于或等于1的自然数,N为0,则可以根据M个第一候选图像块的运动矢量预测模式和运动信息确定第一模板,并将第一模板确定为当前图像块的模板。若N为大于或等于1的自然数,M为0,则可以根据N个第二候选图像块的运动矢量预测模式和运动信息确定第二模板,并将第二模板确定为当前图像块的模板。若M为大于或等 于1的自然数,N为大于或等于1的自然数,则可以根据M个第一候选图像块的运动矢量预测模式和运动信息确定第一模板,根据N个第二候选图像块的运动矢量预测模式和运动信息确定第二模板,并根据第一模板和第二模板确定当前图像块的模板,具体可以包括将第一模板确定为当前图像块的模板、或将第二模板确定为当前图像块的模板、或将第一模板和第二模板拼接之后确定为当前图像块的模板。If M is a natural number greater than or equal to 1, and N is 0, 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 a template of the current image block. If N is a natural number greater than or equal to 1, and 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. If M is a natural number greater than or equal to 1, and N is a natural number greater than or equal to 1, the first template may be determined according to the motion vector prediction mode and motion information of the M first candidate image blocks, and according to the N second candidate image blocks Determine the second template based on the motion vector prediction mode and motion information, and determine the template of the current image block according to the first template and the second template, which may specifically include determining the first template as the template of the current image block, or determining the second template A template of the current image block, or a template of the current image block determined 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. The prediction mode of the adjacent image block is an inter mode or an intra mode, and the prediction mode of the next adjacent image block is an 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 block on the upper side of the current image block, Or any one or more adjacent image blocks on the upper side of the current image block. In addition, when the adjacent image blocks on the upper side of the current image block are all in the intra mode, the first candidate image block may further include at least one second neighboring image block whose prediction mode is the inter mode, for example, the upper side of the current image block All second-neighbor image blocks, or the first second-neighbor image block above the current image block, or any one or more second-neighbor image blocks above the current image block. In addition, when there are adjacent image blocks in the intra mode on the upper side of the current image block, the first candidate image block may further include adjacent image blocks in the intra mode, for example, the first intra mode on the upper side of the current image block. Adjacent image blocks of all images, adjacent image blocks of all intra-modes above the current image block, and so on. Of course, the above is only an example of the first candidate image block, which is not limited thereto.
第二候选图像块包括当前图像块左侧的相邻图像块和/或次邻图像块。其中,相邻图像块的预测模式为帧间模式或者帧内模式,次邻图像块的预测模式为帧间模式。第二候选图像块可以包括至少一个预测模式为帧间模式的相邻图像块,例如,当前图像块左侧的所有相邻图像块、或当前图像块左侧的第一个相邻图像块、或当前图像块左侧的任意一个或多个相邻图像块。此外,当当前图像块左侧的相邻图像块均为帧内模式时,第二候选图像块还可以包括至少一个预测模式为帧间模式的次邻图像块,例如,当前图像块左侧的所有次邻图像块、或当前图像块左侧的第一个次邻图像块、或当前图像块左侧的任意一个或多个次邻图像块。此外,当当前图像块左侧存在帧内模式的相邻图像块时,第二候选图像块还可以包括帧内模式的相邻图像块,例如,当前图像块左侧的第一个帧内模式的相邻图像块、当前图像块左侧的所有帧内模式的相邻图像块等。当然,上述只是第二候选图像块的示例,对此不做限制。The second candidate image block includes a neighboring image block and / or a next-neighbor 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 next adjacent image block is an 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 block to the left of the current image block, Or any one or more adjacent image blocks to the left of the current image block. In addition, when the adjacent image blocks on the left side of the current image block are in the intra mode, the second candidate image block may further include at least one second-neighbor image block whose prediction mode is the inter mode, for example, the left side of the current image block All second-neighbor image blocks, or the first second-neighbor image block to the left of the current image block, or any one or more second-neighbor image blocks to the left of the current image block. In addition, when there are adjacent image blocks in the intra mode on the left side of the current image block, the second candidate image block may also include adjacent image blocks in the intra mode, for example, the first intra mode on the left side of the current image block. Adjacent image blocks of, the adjacent image blocks of all intra-modes to the left of the current image block, and so on. Of course, 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, temporal image adjacent blocks of the current image block (that is, different Adjacent image blocks in a frame image). 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).
在一个例子中,当M大于1时,第一模板可以包括M个子模板或者P个子模板,且由M个子模板或者P个子模板拼接而成,P可以为帧间模式的第一候选图像块的数量,P小于或等于M。例如,若M个第一候选图像块均为帧间模式的候选图像块,则第一模板可以包括M个子模板,且由M个子模板拼接而成。又例如,若M个第一候选图像块包括P个帧间模式的候选图像块、并包括M-P个帧内模式的候选图像块,则第一模板可以包括M个子模板(即每个候选图像块对应一个子模板),且由M个子模板拼接而成;或者,第一模板可以包括P个子模板(即P个帧间模式的候选图像块对应的P个 子模板),且由P个子模板拼接而成。In one example, when M is greater than 1, the first template may include M sub-templates or P sub-templates, and is composed of M sub-templates or P sub-templates, and P may be the first candidate image block of the inter-frame mode. Quantity, P is less than or equal to M. For example, if the M first candidate image blocks are all candidate image blocks of the inter-mode, the first template may include M sub-templates and be formed by splicing the M sub-templates. For another example, if 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 (Corresponding to a sub-template), and is composed of M sub-templates; or, the first template may include P sub-templates (that is, P sub-templates corresponding to P inter-mode candidate image blocks), and P sub-templates to make.
当M等于1时,则第一模板可以包括第一子模板,该第一子模板可以是根据当前图像块上侧的任意一个候选图像块的运动矢量预测模式和运动信息确定的。其中,由于第一候选图像块包括至少一个预测模式为帧间模式的相邻图像块或次邻图像块,因此,M等于1时,第一模板包括的是帧间模式的相邻图像块或次邻图像块对应的第一子模板。When M is equal to 1, the first template may include a first sub-template, and 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. Wherein, since 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, when M is equal to 1, the first template includes the neighboring image blocks of the inter mode or The first sub-template corresponding to the next neighboring image block.
在一个例子中,运动信息可以包括第一候选图像块的运动矢量和参考帧索引,基于此,根据M个第一候选图像块的运动矢量预测模式和运动信息确定第一模板,可以包括但不限于:In one example, the motion information may include a motion vector and a reference frame index of the first candidate image block. Based on this, the first template is determined according to the motion vector prediction mode and motion information of the M first candidate image blocks, which may include, but not Limited to:
情况一、针对M个第一候选图像块中的第i个候选图像块,当确定第i个候选图像块的运动矢量预测模式为帧间模式时,则根据第i个候选图像块的参考帧索引确定第i个候选图像块的参考帧图像;根据第i个候选图像块的运动矢量,从该参考帧图像中确定第i个候选图像块的参考图像块,该参考图像块与第i个候选图像块的相对位移与第i个候选图像块的运动矢量相匹配;然后,可以根据确定的参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为第一模板包括的第i个子模板。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 of the i-th candidate image block; according to the motion vector of the i-th candidate image block, the reference image block of the i-th candidate image block is determined from the reference frame image, and the reference image block and the i-th candidate image block The relative displacement of the candidate image block 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. The i-th child template.
情况二、针对M个第一候选图像块中的第i个候选图像块,当确定第i个候选图像块的运动矢量预测模式为帧内模式时,则将第i个候选图像块按照默认值(如默认像素值,可以是根据经验预先配置的亮度值)填充,基于默认值填充后的图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为第一模板包括的第i个子模板。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.
情况三、针对M个第一候选图像块中的第i个候选图像块,当确定第i个候选图像块的运动矢量预测模式为帧内模式时,根据第i个候选图像块对应的参考帧索引确定第i个候选图像块对应的参考帧图像;根据第i个候选图像块对应的运动矢量,从该参考帧图像中确定第i个候选图像块对应的参考图像块,该参考图像块与第i个候选图像块的相对位移与第i个候选图像块对应的运动矢量相匹配(包含相等或近似相等);根据确定的参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为第一模板包括的第i个子模板。其中,第i个候选图像块对应的参考帧索引和运动矢量,可以是第i个候选图像块的相邻图像块的参考帧索引和运动矢量。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; according to the motion vector corresponding to 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 reference image block and The relative displacement of the i-th candidate image block matches the motion vector corresponding to the i-th candidate image block (including equal or approximately equal); according to the determined reference image block, the size of the first horizontal length and the first vertical length is obtained The image block includes the i-th sub-template included in the first template. The reference frame index and motion vector corresponding to the i-th candidate image block may be reference frame indexes and motion vectors of neighboring image blocks of the i-th candidate image block.
其中,第一横向长度与第一候选图像块的横向长度满足第一比例关系(如1:1,1:2,2:1等,对此不做限制),或者与当前图像块的横向长度满足第二比例关系(如1:1,1:2,2:1等),或者等于第一预设长度(可根据经验配置)。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 (configurable according to experience).
其中,第一纵向长度与第一候选图像块的纵向长度满足第三比例关系(如1:1,1:2,2:1等),或者与当前图像块的纵向长度满足第四比例关系(如1:1,1:2,2:1等),或者等于第二预设长度(即根据经验配置的长度)。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).
其中,第一比例关系、第二比例关系、第三比例关系和第四比例关系之间可以设置为相同,也可以不同。第一预设长度和第二预设长度可以设置为相同,也可以不同。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.
在一个例子中,当N大于1时,则第二模板可以包括N个子模板或者R个子模板,且由N个子模板或者R个子模板拼接而成,其中,R可以为帧间模式的第二候选图像块的数量,R小于或等于N。例如,若N个第二候选图像块均为帧间模式的候选图像块, 则第二模板可以包括N个子模板,且由N个子模板拼接而成。又例如,若N个第二候选图像块包括R个帧间模式的候选图像块、并包括N-R个帧内模式的候选图像块,则第二模板可以包括N个子模板(即每个候选图像块对应一个子模板),且由N个子模板拼接而成;或者,第二模板可以包括R个子模板(即R个帧间模式的候选图像块对应的R个子模板),且由R个子模板拼接而成。In one example, when N is greater than 1, the second template may include N sub-templates or R sub-templates, and is formed by splicing N sub-templates or R sub-templates, where R may be the second candidate for the inter-frame mode. The number of image blocks, R is less than or equal to N. For example, if the N second candidate image blocks are all candidate image blocks of the inter-mode, the second template may include N sub-templates and be spliced from the N sub-templates. For another example, if the N second candidate image blocks include R inter-mode candidate image blocks and include NR intra-mode candidate image blocks, the second template may include N sub-templates (that is, each candidate image block (Corresponding 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-mode candidate image blocks), and R sub-templates to make.
当N等于1时,则第二模板可以包括第二子模板,该第二子模板可以是根据当前图像块左侧的任意一个候选图像块的运动矢量预测模式和运动信息确定的。其中,由于第二候选图像块包括至少一个预测模式为帧间模式的相邻图像块或次邻图像块,因此,N等于1时,第二模板包括的是帧间模式的相邻图像块或次邻图像块对应的第二子模板。When N is equal to 1, the second template may include a second sub-template, and 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. Wherein, 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.
在一个例子中,运动信息可以包括第二候选图像块的运动矢量和参考帧索引,基于此,根据N个第二候选图像块的运动矢量预测模式和运动信息确定第二模板,可以包括但不限于:In one example, the motion information may include a motion vector and a reference frame index of the second candidate image block. Based on this, the second template is determined according to the motion vector prediction mode and motion information of the N second candidate image blocks, which may include but not Limited to:
情况一、针对N个第二候选图像块中的第i个候选图像块,当确定第i个候选图像块的运动矢量预测模式为帧间模式时,则根据第i个候选图像块的参考帧索引确定第i个候选图像块的参考帧图像;根据第i个候选图像块的运动矢量,从该参考帧图像中确定第i个候选图像块的参考图像块,该参考图像块与第i个候选图像块的相对位移,与第i个候选图像块的运动矢量相匹配;然后,可以根据确定的参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为第二模板包括的第i个子模板。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 reference frame of the i-th candidate image block The index determines the reference frame image of the i-th candidate image block; according to the motion vector of the i-th candidate image block, the reference image block of the i-th candidate image block is determined from the reference frame image, and the reference image block and the i-th candidate image block The relative displacement of the candidate image block 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 a second template including I-th child template.
情况二、针对N个第二候选图像块中的第i个候选图像块,当确定第i个候选图像块的运动矢量预测模式为帧内模式时,则将第i个候选图像块按照默认值(如默认像素值,可以是根据经验预先配置的亮度值)填充,基于默认值填充后的图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为第二模板包括的第i个子模板。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.
情况三、针对N个第二候选图像块中的第i个候选图像块,当确定第i个候选图像块的运动矢量预测模式为帧内模式时,根据第i个候选图像块对应的参考帧索引确定第i个候选图像块对应的参考帧图像;根据第i个候选图像块对应的运动矢量,从该参考帧图像中确定第i个候选图像块对应的参考图像块,该参考图像块与第i个候选图像块的相对位移与第i个候选图像块对应的运动矢量相匹配(包含相等或近似相等);根据确定的参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为第二模板包括的第i个子模板。其中,第i个候选图像块对应的参考帧索引和运动矢量,可以是第i个候选图像块的相邻图像块的参考帧索引和运动矢量。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; according to the motion vector corresponding to 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 reference image block and The relative displacement of the i-th candidate image block matches the motion vector corresponding to the i-th candidate image block (including equal or approximately equal); according to the determined reference image block, the size of the second horizontal length and the second vertical length is obtained The image block serves as an ith sub-template included in the second template. The reference frame index and motion vector corresponding to the i-th candidate image block may be reference frame indexes and motion vectors of neighboring image blocks of the i-th candidate image block.
其中,第二横向长度与第二候选图像块的横向长度满足第五比例关系(如1:1,1:2,2:1等,对此不做限制),或者与当前图像块的横向长度满足第六比例关系(如1:1,1:2,2:1等),或者等于第三预设长度(根据经验配置)。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).
其中,第二纵向长度与第二候选图像块的纵向长度满足第七比例关系(如1:1,1:2,2:1等),或者与当前图像块的纵向长度满足第八比例关系(如1:1,1:2,2:1等),或者等于第四预设长度(即根据经验配置的长度)。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).
其中,第五比例关系、第六比例关系、第七比例关系和第八比例关系之间可以设置 为相同,也可以不同。第三预设长度和第四预设长度可以设置为相同,也可以不同。Among them, 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.
在一个例子中,根据候选图像块的运动信息获取当前图像块的模板,还可以包括但不限于:当当前图像块对应多个运动信息时,获取每个运动信息对应的模板,每个模板的获取方式参见上述实施例;然后,获取每个运动信息对应的权重,并根据每个运动信息对应的权重以及该运动信息对应的模板获取当前图像块的模板。例如,基于每个运动信息对应的权重以及该运动信息对应的模板,可利用加权平均方式获取当前图像块的模板。其中,当前图像块对应的运动信息可包括当前图像块的原始运动信息。In one example, acquiring a 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 each motion information, and For the obtaining method, refer to the foregoing embodiment; then, obtain the weight corresponding to each motion information, and obtain the template of the current image block 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 may be obtained in a weighted average manner. The motion information corresponding to the current image block may include original motion information of the current image block.
例如,当前图像块对应运动信息A和运动信息B,采用上述实施例获取运动信息A对应的模板TA,并采用上述实施例获取运动信息B对应的模板TB。For example, 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, and the template TB corresponding to the motion information B is obtained by using the foregoing embodiment.
然后,可以获取运动信息A的权重W1和运动信息B的权重W2,这样,当前图像块的模板可以为(TA*W1+TB*W2)/2。Then, the weight W1 of the motion information A and the weight W2 of the motion information B can be obtained. In this way, the template of the current image block can be (TA * W1 + TB * W2) / 2.
以下结合几个具体情况,对当前图像块的模板进行详细说明。The following describes the template of the current image block in detail in combination with several specific situations.
情况一:候选图像块可以包括当前图像块上侧的所有帧间模式的相邻图像块,以及当前图像块左侧的所有帧间模式的相邻图像块。Case 1: 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.
例如,参见图2B所示,对于当前图像块A1,若左侧存在帧间模式的相邻图像块A3和A4,则可以将图像块A3和A4确定为当前图像块A1的第二候选图像块。类似的,若上侧存在帧间模式的相邻图像块A2,则可以将图像块A2确定为当前图像块A1的第一候选图像块。For example, referring to FIG. 2B, for the current image block A1, if there are adjacent image blocks A3 and A4 in the inter mode on the left, the image blocks A3 and A4 may be determined as the second candidate image block of the current image block A1. . Similarly, if there is an adjacent image block A2 in the inter mode on the upper side, the image block A2 may be determined as the first candidate image block of the current image block A1.
若左侧没有可用图像块,或者左侧的可用图像块均是帧内模式,则说明当前图像块A1的左侧没有候选图像块。类似的,若上侧没有可用图像块,或者上侧的可用图像块均是帧内模式,则说明当前图像块A1的上侧没有候选图像块。若左侧和上侧均没有候选图像块,则可以说明当前图像块A1没有候选图像块。If there are no available image blocks on the left or the available image blocks on the left are in intra mode, it means that there is no candidate image block on the left side of the current image block A1. Similarly, if there are no available image blocks on the upper side or the available image blocks on the upper side are all in the intra mode, it means that there is no candidate image block on the upper side of the current image block A1. If there are no candidate image blocks on the left and upper sides, it can be explained that there is no candidate image block in the current image block A1.
若当前图像块A1没有候选图像块,则不再采用本实施例的技术方案,而是采用传统方式。若当前图像块A1有候选图像块,如左侧的候选图像块和/或上侧的候选图像块,则采用本实施例的技术方案。If there is no candidate image block in the current image block A1, the technical solution of this embodiment is no longer adopted, but a conventional method is adopted. 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.
在一个例子中,在确定出候选图像块A2、A3和A4后,就可以根据图像块A2、A3和A4各自的运动信息,获取当前图像块A1的模板。例如,可以根据参考帧索引确定图像块A2的参考帧图像,从该参考帧图像中选取与图像块A2对应的图像块B2,根据图像块A2的运动矢量对图像块B2进行移动,得到图像块A2的参考图像块B2’。同理,可以得到图像块A3的参考图像块B3’,图像块A4的参考图像块B4’,参见图2C所示。然后,可以根据参考图像块B2’、B3’和B4’获得当前图像块A1的模板。In one example, after the candidate image blocks A2, A3, and A4 are determined, the template of the current image block A1 can be obtained according to the respective motion information of the image blocks A2, A3, and A4. For example, a reference frame image of 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 moved according to the motion vector of the image block A2 to obtain an image block. A2's reference image block B2 '. Similarly, the reference image block B3 'of the image block A3 and the reference image block B4' of the image block A4 can be obtained, as shown in FIG. 2C. Then, a template of the current image block A1 can be obtained from the reference image blocks B2 ', B3', and B4 '.
在一个例子中,假设当前图像块A1上侧模板的横向长度为W,纵向长度为S,W的取值可以根据经验配置,S的取值可以根据经验配置,对于W和S的取值均不做限制。例如,上侧模板的横向长度W可以为当前图像块A1的横向长度、或者为候选图像块A2的横向长度、或者为当前图像块A1的横向长度的2倍等,上侧模板的纵向长度S可以为候选图像块A2的纵向长度、或者为候选图像块A2的纵向长度的1/3等。参见图2D所示,以参考图像块B2’对应的模板为例,该模板的横向长度W为候选图像块A2 的横向长度,即为参考图像块B2’的横向长度;该模板的纵向长度S为候选图像块A2的纵向长度的1/3,即为参考图像块B2’的纵向长度的1/3。In one example, it is assumed that 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. For example, the horizontal length W of the upper template may be the horizontal length of the current image block A1, or the horizontal length of the candidate image block A2, or twice the horizontal length of the current image block A1, and the like, and the vertical length S of the upper template It may be the vertical length of the candidate image block A2, or 1/3 of the vertical length of the candidate image block A2, or the like. Referring to FIG. 2D, taking a template corresponding to the reference image block B2 'as an example, the horizontal length W of the template is the horizontal length of the candidate image block A2, that is, the horizontal length of the reference image block B2'; the vertical length S of the template It is 1/3 of the vertical length of the candidate image block A2, that is, 1/3 of the vertical length of the reference image block B2 '.
假设当前图像块A1左侧模板的横向长度为R,纵向长度为H,R的取值可以根据经验配置,H的取值可以根据经验配置,对于R和H的取值均不做限制。例如,左侧模板的纵向长度H可以为当前图像块A1的纵向长度、或者为候选图像块A3的纵向长度,左侧模板的横向长度R可以为候选图像块A3的横向长度、或者为候选图像块A3的横向长度的1/3等。参见图2D所示,以参考图像块B3’对应的模板为例,该模板的纵向长度H为候选图像块A3的纵向长度,该模板的横向长度R为候选图像块A3的横向长度的1/3。It is assumed that 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. There are no restrictions on the values of R and H. For example, the vertical length H of the left template may be the vertical length of the current image block A1 or the vertical length of the candidate image block A3, and the horizontal length R of the left template may be the horizontal length of the candidate image block A3 or the candidate image. The lateral length of the block A3 is 1/3 and so on. Referring to FIG. 2D, taking a template corresponding to the reference image block B3 'as an example, the vertical length H of the template is the vertical length of the candidate image block A3, and the horizontal length R of the template is 1 / of the horizontal length of the candidate image block A3. 3.
同理,参考图像块B4’对应的模板也可以参见图2D所示。Similarly, the template corresponding to the reference image block B4 'can also be shown in FIG. 2D.
在一个例子中,假设当前图像块上侧有M个候选图像块,第i个候选图像块的横向长度为w i,纵向长度为S,则判断该候选图像块的预测模式。 In one example, assuming that there are M candidate image blocks on the upper side of the current image block, the horizontal length of the i-th candidate image block is w i , and the vertical length is S, then the prediction mode of the candidate image block is determined.
若为帧内模式,则不再生成相应的子模板;或者,按照默认值(如默认像素值,可以是根据经验预先配置的亮度值)填充,作为上侧第i个子模板。If it is in the intra mode, the corresponding 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), as the i-th sub-template on the upper side.
若为帧间模式,则获取第i个候选图像块的运动信息(如运动矢量和参考帧索引等),基于该运动矢量和该参考帧索引生成横向长度为w i,纵向长度为S的模板,作为上侧第i个子模板。具体的,若运动矢量为MV,参考帧索引为idx,则在当前帧的第idx个参考图像中找到相对位移为MV的横向长度为w i,纵向长度为S的矩形块,作为上侧第i个子模板。 If it is in the inter mode, 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. , As the i-th sub-template on the upper side. Specifically, if the motion vector is MV and the reference frame index is idx, a rectangular block with a relative displacement of MV and a horizontal length of w i and a vertical length of S is found in the idx reference image of the current frame as the upper side. i child templates.
假设当前图像块左侧有N个候选图像块,第i个候选图像块的纵向长度为h i,横向长度为R,则判断该候选图像块的预测模式。 Suppose the current left image block has N candidate image block, the longitudinal length of the i-th candidate image blocks as H i, the lateral length is R, the determined prediction mode candidate image block.
若为帧内模式,则不再生成相应的子模板;或者,按照默认值(如默认像素值,可以是根据经验预先配置的亮度值)填充,作为左侧第i个子模板。If it is in the intra mode, the corresponding 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), as the i-th sub-template on the left.
若为帧间模式,则获取第i个候选图像块的运动信息(如运动矢量和参考帧索引等),基于该运动矢量和该参考帧索引生成横向长度为R,纵向长度为h i的模板,作为左侧第i个子模板。具体的,若运动矢量为MV,参考帧索引为idx,则在当前帧的第idx个参考图像中找到相对位移为MV的横向长度为R,纵向长度为h i的矩形块,作为左侧第i个子模板。 If the inter mode, 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 sub-template on the left. Specifically, if the motion vector is MV, the reference frame index idx, find the relative displacement of the lateral length of the MV R, a longitudinal length of a rectangular block of idx h i in the reference image of the current frame, a second left-side i child templates.
进一步的,上侧模板可以由上侧的所有子模板拼接而成,左侧模板可以由左侧的所有子模板拼接而成,上侧模板和左侧模板就拼接成当前图像块的模板。Further, 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, and the upper template and the left template are stitched into the template of the current image block.
情况二:候选图像块可以包括当前图像块上侧的第一个帧间模式的相邻图像块,以及当前图像块左侧的第一个帧间模式的相邻图像块。Case 2: 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.
例如,参见图2E所示,对于当前图像块A1,若左侧的第一个图像块A3是帧间模式,则可以将图像块A3确定为当前图像块A1的候选图像块。若上侧的第一个图像块A2是帧间模式,则可以将图像块A2确定为当前图像块A1的候选图像块。For example, referring to FIG. 2E, for the current image block A1, if the first image block A3 on the left side is in an inter mode, 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.
若左侧没有可用图像块,或者,左侧的第一个图像块是帧内模式,则当前图像块A1 的左侧没有候选图像块。若上侧没有可用图像块,或者,上侧的第一个图像块是帧内模式,则当前图像块A1的上侧没有候选图像块。若左侧和上侧均没有候选图像块,则当前图像块A1没有候选图像块。If there are no image blocks available on the left, or the first image block on the left is in intra mode, there are no candidate image blocks on the left side of the current image block A1. If there are no image blocks available on the upper side, or if the first image block on the upper side is in intra mode, then there is no candidate image block on the upper side of the current image block A1. If there are no candidate image blocks on the left and upper sides, the current image block A1 has no candidate image blocks.
进一步的,若当前图像块A1没有候选图像块,则不再采用本实施例的技术方案,而是采用传统方式。若当前图像块A1有候选图像块,如左侧的候选图像块和/或上侧的候选图像块,则采用本实施例的技术方案。Further, if there is no candidate image block in the current image block A1, the technical solution of this embodiment is no longer adopted, but a conventional method is adopted. 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.
在确定出候选图像块A2和A3后,可以根据图像块A2和A3各自的运动信息,获取当前图像块A1的模板。例如,可以根据参考帧索引确定图像块A2的参考帧图像,从参考帧图像中选取与图像块A2对应的图像块B2,根据图像块A2的运动矢量对图像块B2进行移动,得到图像块A2的参考图像块B2’。同理,可以得到图像块A3的参考图像块B3’。就此,可以根据参考图像块B2’和参考图像块B3’获得当前图像块A1的模板。After the candidate image blocks A2 and A3 are determined, a template of the current image block A1 can be obtained according to the respective motion information of the image blocks A2 and A3. For example, the reference frame image of the image block A2 can 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, and the image block B2 is moved according to the motion vector of the image block A2 to obtain the image block A2 Reference picture block B2 '. Similarly, a reference image block B3 'of the image block A3 can be obtained. In this regard, a template of the current image block A1 can be obtained from the reference image block B2 'and the reference image block B3'.
在一个例子中,假设当前图像块A1上侧模板的横向长度为W,纵向长度为S,W的取值可以根据经验配置,S的取值可以根据经验配置,对于W和S的取值均不做限制。例如,上侧模板的横向长度W可以为当前图像块A1的横向长度、或者为候选图像块A2的横向长度,上侧模板的纵向长度S可以为候选图像块A2的纵向长度、或者为候选图像块A2的纵向长度的1/3等。参见图2F所示,为参考图像块B2’对应的模板示意图。In one example, it is assumed that 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. For example, the horizontal length W of the upper template may be the horizontal length of the current image block A1 or the horizontal length of the candidate image block A2, and the vertical length S of the upper template may be the vertical length of the candidate image block A2 or the candidate image. The length A3 of the block A2 is equal to 1/3. Referring to FIG. 2F, it is a schematic diagram of a template corresponding to the reference image block B2 '.
假设当前图像块A1左侧模板的横向长度为R,纵向长度为H,R的取值可以根据经验配置,H的取值可以根据经验配置,对于R和H的取值均不做限制。例如,左侧模板的纵向长度H可以为当前图像块A1的纵向长度、或者为候选图像块A3的纵向长度等,左侧模板的横向长度R可以为候选图像块A3的横向长度、或者为候选图像块A3的横向长度的1/3等。在此基础上,参见图2F所示,为参考图像块B3’对应的模板示意图。It is assumed that 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. There are no restrictions on the values of R and H. For example, the vertical length H of the left template can be the vertical length of the current image block A1 or the vertical length of the candidate image block A3, and the horizontal length R of the left template can be the horizontal length of the candidate image block A3 or a candidate. The horizontal length of the image block A3 is 1/3 and so on. Based on this, referring to FIG. 2F, it is a schematic diagram of a template corresponding to the reference image block B3 '.
在一个例子中,假设当前图像块上侧有M个候选图像块,第一个候选图像块的横向长度为w、纵向长度为S,则判断该候选图像块的预测模式。若为帧内模式,则不再生成相应的模板;或者,按照默认值(如默认像素值,可以是根据经验预先配置的亮度值)填充,作为相应的上侧模板。若为帧间模式,则获取该候选图像块的运动信息(如运动矢量和参考帧索引等),基于运动矢量和参考帧索引生成横向长度为w,纵向长度为S的模板,作为相应的上侧模板。In one example, assuming that there are M candidate image blocks on the upper side of the current image block, and the horizontal length of the first candidate image block is w and the vertical length is S, the prediction mode of the candidate image block is determined. If it is in the intra mode, the corresponding 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 is used as the corresponding 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 the corresponding upper Side template.
假设当前图像块左侧有N个候选图像块,第一个候选图像块的纵向长度为h,横向长度为R,则判断该候选图像块的预测模式。若为帧内模式,则不再生成相应的模板;或按照默认值填充,作为相应的左侧模板。若为帧间模式,获取该候选图像块的运动信息(如运动矢量和参考帧索引),基于运动矢量和参考帧索引生成横向长度为R,纵向长度为h的模板,作为相应的左侧模板。Assuming that there are N candidate image blocks on the left side of the current image block, and the vertical length of the first candidate image block is h and the horizontal length is R, the prediction mode of the candidate image block is determined. If it is in the intra mode, the corresponding template is no longer generated; or it is filled according to the default value and used as the corresponding left template. If it is in the inter mode, obtain the motion information (such as the motion vector and reference frame index) of the candidate image block, and generate a template with a horizontal length R and a vertical length h based on the motion vector and the reference frame index, as the corresponding left template .
情况三:候选图像块可以包括当前图像块上侧的第一个帧间模式的相邻图像块,以及当前图像块左侧的第一个帧间模式的相邻图像块。Case 3: 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.
与情况二的图2F相比,在情况三中,参见图2G所示,当前图像块A1上侧模板的横向长度W取值为当前图像块A1的横向长度,当前图像块A1左侧模板的纵向长度H取值为当前图像块A1的纵向长度,其它过程与情况二类似。Compared with FIG. 2F in the second case, in the third case, as shown in FIG. 2G, the horizontal length W of the upper template of the current image block A1 is taken as the horizontal length of the current image block A1, and The vertical length H is taken as the vertical length of the current image block A1, and other processes are similar to the second case.
情况四:候选图像块可以包括当前图像块上侧的帧间模式的相邻图像块、当前图像块上侧的帧间模式的次邻图像块(即相邻图像块为帧内模式时,选择该相邻图像块对应的与当前图像块是次邻的图像块)、当前图像块左侧的帧间模式的相邻图像块、当前图像块左侧的帧间模式的次邻图像块。Case 4: 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 in the inter-frame mode on the left side of the current image block.
例如,参见图2H所示,对于当前图像块A1,左侧存在帧间模式的相邻图像块A3和A4,则可以将帧间模式的图像块A3和A4确定为当前图像块A1的候选图像块。类似的,上侧存在帧间模式的相邻图像块A2,则可以将帧间模式的图像块A2确定为当前图像块A1的候选图像块。For example, referring to FIG. 2H, for the current image block A1, there are adjacent image blocks A3 and A4 in the inter mode on the left side, then the image blocks A3 and A4 in the inter mode can be determined as candidate images of the current image block A1. Piece. Similarly, if there is an adjacent image block A2 in the inter mode on the upper side, the image block A2 in the inter mode can be determined as a candidate image block of the current image block A1.
此外,左侧存在帧内模式的相邻图像块A7,且图像块A7左侧存在帧间模式的图像块A8,即图像块A8是当前图像块A1左侧的次邻图像块,因此,可以将帧间模式的次邻图像块A8确定为当前图像块A1的候选图像块。In addition, there is an adjacent image block A7 in the intra mode on the left side, and there is an image block A8 in the inter mode on the left side of the image block A7, that is, the image block A8 is the next-to-adjacent image block on the left of the current image block A1. The next neighboring image block A8 in the inter mode is determined as a candidate image block of the current image block A1.
类似的,上侧存在帧内模式的相邻图像块A5,且图像块A5上侧存在帧间模式的图像块A6,即图像块A6是当前图像块A1上侧的次邻图像块,因此,可以将帧间模式的次邻图像块A6确定为当前图像块A1的候选图像块。Similarly, there is an adjacent image block A5 in the intra mode on the upper side, and there is an image block A6 in the inter mode on the upper side of the image block A5, that is, the image block A6 is a second-neighbor image block on the upper side of the current image block A1. Therefore, The next neighboring image block A6 in the inter mode may be determined as a candidate image block of the current image block A1.
在确定出候选图像块为图像块A2、A3、A4、A6和A8后,根据图像块A2、A3、A4、A6和A8各自的运动信息,获取当前图像块A1的模板,具体获取方式参见情况一,只是多了根据图像块A6和A8各自的运动信息获取子模板,模板最终参见图2I所示。After determining that the candidate image blocks are image blocks A2, A3, A4, A6, and A8, according to the respective motion information of the image blocks A2, A3, A4, A6, and A8, a template of the current image block A1 is obtained. For details, please refer to the situation First, it is more to obtain sub-templates according to the respective motion information of image blocks A6 and A8. The template is finally shown in FIG. 2I.
情况五:若当前图像块上侧的第一个相邻图像块为帧内模式,且该第一个相邻图像块上侧的图像块为帧间模式,则候选图像块可以包括当前图像块上侧的帧间模式的次邻图像块。此外,若当前图像块左侧的第一个相邻图像块为帧内模式,且该第一个相邻图像块左侧的图像块为帧间模式,则候选图像块可以包括当前图像块左侧的帧间模式的次邻图像块。Case 5: If the first adjacent image block above the current image block is in intra mode and the image block above the first adjacent image block is in inter mode, the candidate image block may include the current image block The next neighboring image block in the inter mode. In addition, if the first adjacent image block to the left of the current image block is in intra mode and the image block to the left of the first adjacent image block is in inter mode, the candidate image block may include the current image block left The next neighboring image block of the inter-frame mode.
例如,参见图2K所示,对于当前图像块A1,若上侧的第一个图像块A2是帧内模式,且图像块A2上侧存在帧间模式的图像块A4,即图像块A4是当前图像块A1上侧的次邻图像块,因此,可以将帧间模式的次邻图像块A4确定为当前图像块A1的候选图像块。For example, referring to FIG. 2K, for the current image block A1, if the first image block A2 on the upper side is in the intra mode, and the image block A4 in the inter mode exists on the upper side of the image block A2, that is, the image block A4 is the current The second-neighboring image block on the upper side of the image block A1, therefore, the second-neighboring image block A4 in the inter mode can be determined as a candidate image block of the current image block A1.
此外,若左侧的第一个图像块A3是帧内模式,且图像块A3左侧存在帧间模式的图像块A5,即图像块A5是当前图像块A1左侧的次邻图像块,因此,可以将帧间模式的次邻图像块A5确定为当前图像块A1的候选图像块。In addition, if the first image block A3 on the left side is in the intra mode, and there is an image block A5 on the left side of the image block A3 in the inter mode, that is, the image block A5 is the next-neighbor image block on the left of the current image block A1, so , The next neighboring image block A5 in the inter mode may be determined as a candidate image block of the current image block A1.
在确定出候选图像块A4和A5后,可以根据图像块A4和A5各自的运动信息,获取当前图像块A1的模板,具体获取方式参见情况二和情况三,模板最终参见图2L或者图2M所示。After the candidate image blocks A4 and A5 are determined, a template of the current image block A1 can be obtained according to the respective motion information of the image blocks A4 and A5. For specific acquisition methods, refer to Cases 2 and 3. For the template, see Figure 2L or Figure 2M. Show.
情况六:候选图像块可以包括当前图像块上侧的帧间模式的相邻图像块、当前 图像块上侧的帧内模式的相邻图像块、当前图像块左侧的帧间模式的相邻图像块、当前图像块左侧的帧内模式的相邻图像块。Case 6: 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. Image block, adjacent image block in intra mode to the left of the current image block.
例如,参见图2H所示,对于当前图像块A1,左侧存在帧间模式的相邻图像块A3和A4,则可以将帧间模式的图像块A3和A4确定为当前图像块A1的候选图像块。类似的,上侧存在帧间模式的相邻图像块A2,则可以将帧间模式的图像块A2确定为当前图像块A1的候选图像块。For example, referring to FIG. 2H, for the current image block A1, there are adjacent image blocks A3 and A4 in the inter mode on the left side, then the image blocks A3 and A4 in the inter mode can be determined as candidate images of the current image block A1. Piece. Similarly, if there is an adjacent image block A2 in the inter mode on the upper side, the image block A2 in the inter mode can be determined as a candidate image block of the current image block A1.
左侧存在帧内模式的相邻图像块A7,可以将帧内模式的图像块A7确定为当前图像块A1的候选图像块。上侧存在帧内模式的相邻图像块A5,可以将帧内模式的图像块A5确定为当前图像块A1的候选图像块。There is an adjacent image block A7 in the intra mode on the left side, and the image block A7 in the intra mode can be determined as a candidate image block of the current image block A1. There is an adjacent image block A5 in the intra mode on the upper side, and the image block A5 in the intra mode can be determined as a candidate image block of the current image block A1.
在确定出候选图像块A2、A3、A4、A5和A7后,根据图像块A2、A3、A4、A5和A7各自的运动信息,获取当前图像块A1的模板,具体获取方式参见情况一,只是多了根据图像块A5和A7各自的运动信息获取模板,模板最终参见图2J所示。After determining the candidate image blocks A2, A3, A4, A5, and A7, according to the respective motion information of the image blocks A2, A3, A4, A5, and A7, a template of the current image block A1 is obtained. For the specific acquisition method, see Case 1, except A template is obtained according to the respective motion information of the image blocks A5 and A7. The template is finally shown in FIG. 2J.
在根据图像块A5的运动信息获取模板时,由于图像块A5是帧内模式,不具有运动信息,因此,可以将图像块A5的相邻图像块A6的运动信息确定为图像块A5的运动信息,在得到图像块A5的运动信息后,就可以利用图像块A5的运动信息获取相应的子模板,具体获取方式参见情况一。When obtaining a template based on the motion information of the image block A5, since the image block A5 is an intra mode and does not have motion information, the motion information of the adjacent image block A6 of the image block A5 can be determined as the motion information of the image block A5. After obtaining the motion information of the image block A5, the corresponding sub-template can be obtained by using the motion information of the image block A5. For the specific acquisition method, refer to Case 1.
同理,在根据图像块A7的运动信息获取模板时,由于图像块A7是帧内模式,不具有运动信息,因此可以将图像块A7的相邻图像块A8的运动信息确定为图像块A7的运动信息,并利用图像块A7的运动信息获取相应的模板。Similarly, when obtaining a template based on the motion information of the image block A7, since the image block A7 is an intra mode and does not have motion information, the motion information of the adjacent image block A8 of the image block A7 can be determined as the image block A7. Motion information, and use the motion information of image block A7 to obtain the corresponding template.
情况七:若当前图像块上侧的第一个相邻图像块为帧内模式,且该第一个相邻图像块上侧的图像块为帧间模式,则候选图像块可以包括当前图像块上侧的第一个帧内模式的相邻图像块。此外,若当前图像块左侧的第一个相邻图像块为帧内模式,且该第一个相邻图像块左侧的图像块为帧间模式,则候选图像块可以包括当前图像块左侧的第一个帧内模式的相邻图像块。Case 7: If the first adjacent image block above the current image block is in intra mode and the image block above the first adjacent image block is in inter mode, the candidate image block may include the current image block Adjacent image blocks of the first intra mode on the upper side. In addition, if the first adjacent image block to the left of the current image block is in intra mode and the image block to the left of the first adjacent image block is in inter mode, the candidate image block may include the current image block left Adjacent image blocks of the first intra mode on the side.
例如,参见图2K所示,对于当前图像块A1,若上侧第一个图像块A2是帧内模式,即使图像块A2上侧存在帧间模式的图像块A4,也可将帧内模式的图像块A2确定为当前图像块A1的候选图像块。若左侧第一个图像块A3是帧内模式,即使图像块A3左侧存在帧间模式的图像块A5,也可将帧内模式的图像块A3确定为当前图像块A1的候选图像块。For example, referring to FIG. 2K, for the current image block A1, if the first image block A2 on the upper side is in the intra mode, even if the image block A4 in the inter mode exists on the upper side of the image block A2, the The image block A2 is determined as a candidate image block of the current image block A1. If the first image block A3 on the left side is in the intra mode, even if an 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 can be determined as a candidate image block of the current image block A1.
在确定出候选图像块A2和A3后,可以根据图像块A2和A3各自的运动信息,获取当前图像块A1的模板,具体获取方式参见情况二和情况三,模板最终参见图2N或者图2O所示。After the candidate image blocks A2 and A3 are determined, a template of the current image block A1 can be obtained according to the respective motion information of the image blocks A2 and A3. For specific acquisition methods, refer to Cases 2 and 3. For the template, see Figure 2N or Figure 2O. Show.
在根据图像块A2的运动信息获取模板时,由于图像块A2是帧内模式,不具有运动信息,因此,可以将图像块A2的相邻图像块A4的运动信息确定为图像块A2对应的运动信息,并利用图像块A2对应的运动信息获取相应的模板。在根据图像块A3的运动信息获取模板时,由于图像块A3是帧内模式,不具有运动信息,因此可以将图像块A3的相邻图像块A5的运动信息确定为图像块A3对应的运动信息,并利用图像块 A3对应的运动信息获取相应的模板。When obtaining a template based on the motion information of the image block A2, since the image block A2 is an intra mode and does not have motion information, the motion information of the adjacent image block A4 of the image block A2 can be determined as the motion corresponding to the image block A2 Information, and use the motion information corresponding to the image block A2 to obtain the corresponding template. When obtaining a template based on the motion information of image block A3, since image block A3 is in the intra mode and does not have motion information, the motion information of the adjacent image block A5 of image block A3 can be determined as the motion information corresponding to image block A3. And use the motion information corresponding to the image block A3 to obtain the corresponding template.
实施例三:Example three:
在帧间编码技术中,可以使用运动矢量表示当前帧图像中的当前图像块与参考帧图像中的参考图像块之间的相对位移。例如,图像A是当前帧图像,图像块A1是当前图像块,图像B是图像A的参考帧图像,图像块B1是图像块A1的参考图像块。由于图像A与图像B存在很强的时域相关性,在需要传输图像A的图像块A1时,可以在图像B中进行运动搜索,找到与图像块A1最匹配的图像块B1,并确定图像块A1与图像块B1之间的相对位移,该相对位移也就是图像块A1的运动矢量。In the inter-frame coding technology, a motion vector may be used to represent a relative displacement between a current image block in a current frame image and a reference image block in a reference frame image. For example, image A is the current frame image, image block A1 is the current image block, image B is the reference frame image of image A, and image block B1 is the reference image block of image block A1. Because there is a strong time-domain correlation between image A and image B, when image block A1 of image A needs to be transmitted, a motion search can be performed in image B to find image block B1 that best matches image block A1 and determine the image The relative displacement between the block A1 and the image block B1, and the relative displacement is also the motion vector of the image block A1.
例如,运动矢量为(-6,4),该运动矢量表示图像块B1与图像块A1相比,在水平方向上向左移动6个像素点,在垂直方向上向上移动4个像素点。For example, the motion vector is (-6, 4), which indicates that the image block B1 moves 6 pixels to the left in the horizontal direction and 4 pixels upwards in the vertical direction compared to the image block A1.
编码端向解码端发送图像块A1对应的编码比特流时,编码比特流携带的是图像块A1的运动矢量(-6,4),而不是图像块A1的重建信息和/或预测信息。解码端接收到图像块A1的编码比特流后,可以获得图像块A1的运动矢量(-6,4),基于当前图像块A1的位置和运动矢量(-6,4),在参考帧图像B中确定参考图像块B1的位置,即:在当前图像块A1的位置上向左移动6个像素点、向上移动4个像素点,得到的是参考图像块B1的位置,从参考图像块B1的位置读取参考图像块B1,利用参考图像块B1对图像块A1进行重建。由于参考图像块B1和当前图像块A1的相似度很高,因此利用参考图像块B1对当前图像块A1进行重建,可重建出相似度很高的图像。由于运动矢量占用的比特数小于图像块A1的重建信息和/或预测信息占用的比特数,因此通过在当前图像块A1对应的编码比特流中携带运动矢量、而不是携带图像块A1的重建信息和/或预测信息,从而节约大量比特。When the encoding end sends the encoded bit stream corresponding to the image block A1 to the decoding end, the encoded bit stream carries the motion vector (-6, 4) of the image block A1, instead of the reconstruction information and / or prediction information of the image block A1. After receiving the encoded bit stream of image block A1, the decoder can obtain the motion vector (-6, 4) of image block A1. Based on the current position and motion vector (-6, 4) of image block A1, the reference frame image B To determine the position of the reference image block B1, that is, to move 6 pixels to the left and 4 pixels upward at the position of the current image block A1, the position of the reference image block B1 is obtained. The position reads the reference image block B1, and reconstructs the image block A1 by using the reference image block B1. Because the similarity between the reference image block B1 and the current image block A1 is very high, using the reference image block B1 to reconstruct the current image block A1 can reconstruct a highly similar image. Since the number of bits occupied by the motion vector is less than the number of bits occupied by the reconstruction information and / or prediction information of the image block A1, the motion vector is carried in the encoded bit stream corresponding to the current image block A1 instead of the reconstruction information of the image block A1. And / or prediction information, thereby saving a lot of bits.
若当前帧图像A包括大量图像块,则每个图像块的运动矢量也会占用比较多的比特,因此,为了进一步节约比特数,还可以利用相邻图像块的运动矢量确定当前图像块A1的运动矢量。例如,在当前帧图像A中,与当前图像块A1相邻的图像块可以包括图像块A2和A3,在当前图像块A1的运动矢量列表中可以包括图像块A2的运动矢量A21和图像块A3的运动矢量A31。If the current frame image A includes a large number of image blocks, the motion vector of each image block also occupies more bits. Therefore, in order to further save the number of bits, the motion vector of the adjacent image block can also be used to determine the current image block A1. Motion vector. For example, in the current frame image A, the image block adjacent to the current image block A1 may include image blocks A2 and A3, and the motion vector list of the current image block A1 may include the motion vector A21 and image block A3 of the image block A2 Motion vector A31.
编码端在向解码端发送图像块A1对应的编码比特流时,编码比特流携带的是原始运动矢量的索引值(例如,运动矢量A21在运动矢量列表中的索引值),而不是图像块A1的运动矢量(-6,4),更不是图像块A1的重建信息和/或预测信息。解码端接收到图像块A1的编码比特流后,可以获得原始运动矢量的索引值,并根据该索引值从运动矢量列表中获取原始运动矢量A21。由于索引值占用的比特数小于运动矢量占用的比特数,因此可以进一步节约比特。When the encoding end sends the encoded bit stream corresponding to the image block A1 to the decoding end, the encoded bit stream carries the index value of the original motion vector (for example, the index value of the motion vector A21 in the motion vector list) instead of the image block A1 The motion vector (-6, 4) is not the reconstruction information and / or prediction information of the image block A1. After receiving the encoded bit stream of the image block A1, the decoding end can obtain the index value of the original motion vector, and obtain the original motion vector A21 from the motion vector list according to the index value. Since the number of bits occupied by the index value is less than the number of bits occupied by the motion vector, further bits can be saved.
本实施例中,不是直接将原始运动矢量A21作为图像块A1的最终运动矢量,而是根据原始运动矢量A21获取与原始运动矢量A21不同的目标运动矢量,并将该目标运动矢量作为图像块A1的最终运动矢量。显然,由于该目标运动矢量是与图像块A1的运动矢量最接近的,因此,与“将原始运动矢量A21直接作为图像块A1的最终运动矢量”的方式相比,上述“将目标运动矢量作为图像块A1的最终运动矢量”的方式,可以解决预测质量不高,预测错误等问题。In this embodiment, instead of directly using the original motion vector A21 as the final motion vector of the image block A1, a target motion vector different from the original motion vector A21 is obtained according to the original motion vector A21, and the target motion vector is used as the image block A1. Final motion vector. Obviously, since the target motion vector is the closest to the motion vector of the image block A1, compared with the method of “using the original motion vector A21 as the final motion vector of the image block A1 directly”, the above “taking the target motion vector as The method of "final motion vector of image block A1" can solve problems such as low prediction quality and prediction error.
本实施例中,原始模式信息为当前图像块的原始运动矢量,目标模式信息为当前图像块的目标运动矢量,编码端可以获取当前图像块的原始运动矢量,并根据该原始运动矢量和获取的模板得到当前图像块的目标运动矢量,该目标运动矢量与该原始运动矢量不同。根据该目标运动矢量对当前图像块进行编码,得到当前图像块对应的编码比特流。编码端可以将编码比特流发送给解码端。In this embodiment, the original mode information is the original motion vector of the current image block, and the target mode information is the target motion vector of the current image block. The encoding end can obtain the original motion vector of the current image block, and according to the original motion vector and the obtained The template obtains the target motion vector of the current image block, which is different from the original motion vector. The current image block is encoded according to the target motion vector to obtain an encoded bit stream corresponding to the current image block. The encoder can send the encoded bit stream to the decoder.
在一个例子中,编码端可以先获取当前图像块的原始运动矢量,假设当前图像块A1在编码端的运动矢量列表依次包括运动矢量A21、A31、A41和A51,则从运动矢量列表中选择一个运动矢量作为图像块A1的原始运动矢量。当然,上述方式只是示例,对此不做限制,例如,可以直接将默认运动矢量确定为原始运动矢量。In an example, the encoding end may first obtain the original motion vector of the current image block. Assuming that the motion vector list of the current image block A1 at the encoding end includes motion vectors A21, A31, A41, and A51 in turn, then select a motion from the motion vector list. The vector serves as the original motion vector of the image block A1. Of course, the above manner is only an example, and there is no limitation on this. For example, the default motion vector may be directly determined as the original motion vector.
其中,编码端从运动矢量列表中选择一个运动矢量,可以包括:编码端从运动矢量列表中选择第一个运动矢量;或者,从运动矢量列表中选择最后一个运动矢量;或者,从运动矢量列表中随机选择一个运动矢量;或者,采用hash(哈希)算法从运动矢量列表中选择一个运动矢量。当然,上述方式只是几个示例,对此不做限制,只要能够从运动矢量列表中选择运动矢量即可。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. Of course, 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.
运动矢量列表用于记录与当前图像块相邻的图像块的运动矢量。例如,在得到图像块A2的运动矢量A21后,可以将运动矢量A21记录到该运动矢量列表,在得到图像块A3的运动矢量A31后,可以将运动矢量A31记录到该运动矢量列表,以此类推,最终可以得到图像块A1的运动矢量列表。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, the motion vector list of the image block A1 can finally be obtained.
在一个例子中,编码端根据该原始运动矢量和获取的模板得到目标运动矢量的过程,可以参见后续实施例四和实施例五。例如,假设将运动矢量A21确定为原始运动矢量,则可以利用原始运动矢量A21获取图像块A1的目标运动矢量,并可将该目标运动矢量作为图像块A1的最终运动矢量。In an example, the process of the coding end obtaining the target motion vector according to the original motion vector and the obtained template can be referred to the following fourth and fifth embodiments. For example, assuming that the motion vector A21 is determined as the original motion vector, the original motion vector A21 can be used to obtain the target motion vector of the image block A1, and the target motion vector can be used as the final motion vector of the image block A1.
在一个例子中,编码端根据该目标运动矢量对当前图像块进行编码,得到当前图像块对应的编码比特流,并将编码比特流发送给解码端的过程,可以包括:在得到目标运动矢量后,可以利用目标运动矢量对当前图像块进行编码,对此编码方式不做限制。在编码完成后,可以得到当前图像块对应的编码比特流,并将编码比特流发送给解码端。In an example, the process of encoding the current image block according to the target motion vector to obtain the encoded bit stream corresponding to the current image block and sending the encoded bit stream to the decoding end may include: after obtaining the target motion vector, The current image block can be encoded by using the target motion vector, and there is no limitation on this encoding method. After encoding is completed, an encoded bit stream corresponding to the current image block can be obtained, and the encoded bit stream is sent to the decoding end.
其中,编码端可以根据原始运动矢量和目标运动矢量向解码端发送编码比特流。具体的,可以获取原始运动矢量的编码性能和目标运动矢量的编码性能。例如,当目标运动矢量的编码性能优于原始运动矢量的编码性能时,向解码端发送的编码比特流携带第一指示信息。当原始运动矢量的编码性能优于目标运动矢量的编码性能时,向解码端发送的编码比特流携带第二指示信息。The encoding end may send an encoded bit stream to the decoding end according to the original motion vector and the target motion vector. Specifically, the encoding performance of the original motion vector and the encoding performance of the target motion vector can be obtained. For example, when the encoding performance of the target motion vector is better than the encoding performance of the original motion vector, the encoded bit stream sent to the decoding end carries the first indication information. When the encoding performance of the original motion vector is better than the encoding performance of the target motion vector, the encoded bit stream sent to the decoding end carries the second indication information.
编码端获取原始运动矢量的编码性能和目标运动矢量的编码性能的过程,可以参见后续的实施例。For the process of obtaining the encoding performance of the original motion vector and the encoding performance of the target motion vector by the encoding end, refer to the subsequent embodiments.
上述方式是采用显式方式通知第一指示信息或者第二指示信息,在实际应用中,还可以采用隐式方式通知,即不在当前图像块对应的编码比特流中携带第一指示信息或者第二指示信息。具体的,编码端和解码端还可以协商决策策略或者在标准中定义决策策略,并将所述决策策略分别存储在编码端和解码端。例如,决策策略可以约定第一策 略信息,或者约定第二策略信息,或者约定第三策略信息。其中,第三策略信息为采用与当前图像块的候选图像块相同的策略信息。The above method is to notify the first instruction information or the second instruction information explicitly. In practical applications, the notification may also be performed implicitly, that is, the first instruction information or the second instruction information is not carried in the encoded bit stream corresponding to the current image block. Instructions. Specifically, the encoding end and the decoding end may also negotiate a decision strategy or define a decision strategy in a standard, and store the decision strategies at the encoding end and the decoding end, respectively. For example, the decision strategy may agree on the first strategy information, or agree on the second strategy information, or agree on the third strategy information. The third policy information is the same policy information as the candidate image block of the current image block.
当决策策略约定第一策略信息,且目标运动矢量的编码性能优于原始运动矢量的编码性能时,当前图像块对应的编码比特流中可以不携带第一指示信息和第二指示信息。当决策策略约定第二指示信息,且原始运动矢量的编码性能优于目标运动矢量的编码性能时,当前图像块对应的编码比特流中可以不携带第一指示信息和第二指示信息。当决策策略约定第三策略信息,且候选图像块采用第一策略信息、目标运动矢量的编码性能优于原始运动矢量的编码性能时,当前图像块对应的编码比特流中可以不携带第一指示信息和第二指示信息。当决策策略约定第三策略信息,且候选图像块采用第二策略信息、原始运动矢量的编码性能优于目标运动矢量的编码性能时,当前图像块对应的编码比特流中可以不携带第一指示信息和第二指示信息。When the decision strategy agrees with the first strategy information and the encoding performance of the target motion vector is better than the encoding performance of the original motion vector, the encoded bitstream corresponding to the current image block may not carry the first indication information and the second indication information. When the decision strategy stipulates the second instruction 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 the second instruction information. When the decision strategy agrees on the third strategy information, and the candidate image block adopts the first strategy information, and the coding performance of the target motion vector is better than the coding performance of the original motion vector, the coding bit stream corresponding to the current image block may not carry the first indication. Information and second instruction information. When the decision strategy agrees with the third strategy information, and the candidate image block uses the second strategy information, and the coding performance of the original motion vector is better than the coding performance of the target motion vector, the coding bitstream corresponding to the current image block may not carry the first indication. Information and second instruction information.
在一个例子中,编码端根据原始运动矢量和目标运动矢量向解码端发送编码比特流,还可以包括:获取原始运动矢量在运动矢量列表中的索引值;在向解码端发送的当前图像块对应的编码比特流中携带该索引值。例如,若原始运动矢量为运动矢量A21,且运动矢量A21是运动矢量列表的第一个运动矢量,则该索引值可以为1。In an example, 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; corresponding to the current image block sent to the decoding end The indexed value is carried in the encoded bitstream of. 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.
由以上可见,可以根据原始运动矢量获取目标运动矢量,并根据目标运动矢量确定当前图像块的最终运动矢量,而不是直接根据原始运动矢量确定当前图像块的最终运动矢量,从而可有效提高运动矢量的精度,进而提高编码性能。而且,在根据原始运动矢量获取目标运动矢量时,可以:根据候选图像块的运动信息获取当前图像块的模板,并根据所述当前图像块的模板获取所述当前图像块的目标运动矢量。上述方式可以快速得到当前图像块的模板,继而根据该模板得到当前图像块的目标运动矢量,从而可以有效提高编解码效率,减少编解码时延。例如,在重建阶段之前,就可以获取当前图像块的模板,并根据当前图像块的模板得到当前图像块的目标运动矢量。As can be seen from the above, 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 effectively improving the motion vector. Accuracy, which in turn improves encoding performance. Moreover, when acquiring the target motion vector according to the original motion vector, it is possible to: acquire a template of the current image block according to the motion information of the candidate image block, and acquire the target motion vector of the current image block according to the template of the current image block. The above method can quickly obtain the template of the current image block, and then obtain the target motion vector of the current image block according to the template, thereby effectively improving the encoding and decoding efficiency and reducing the encoding and decoding delay. For example, before the reconstruction phase, a template of the current image block can be obtained, and a target motion vector of the current image block can be obtained according to the template of the current image block.
实施例四:Embodiment 4:
在实施例三的基础上,编码端根据原始运动矢量和获取的模板得到目标运动矢量的过程,可以参见图3A所示,该流程可以包括:Based on the third embodiment, the process of the encoder obtaining the target motion vector according to the original motion vector and the obtained template can be seen in FIG. 3A. The process may include:
步骤311,编码端将原始运动矢量确定为中心运动矢量。Step 311: The encoding end determines the original motion vector as a central motion vector.
步骤312,编码端确定与该中心运动矢量对应的边缘运动矢量。其中,该边缘运动矢量可以与该中心运动矢量不同。Step 312: 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.
确定与该中心运动矢量对应的边缘运动矢量,可以包括:将该中心运动矢量(x,y)向不同方向移动偏移量St,得到不同方向的边缘运动矢量(x-St,y)、(x+St,y)、(x,y+St)、(x,y-St)。例如,在水平方向上,可以将中心运动矢量(x,y)向左移动偏移量St得到边缘运动矢量(x-St,y),将中心运动矢量(x,y)向右移动偏移量St得到边缘运动矢量(x+St,y);在垂直方向上,可以将中心运动矢量(x,y)向上移动偏移量St得到边缘运动矢量(x,y+St),将中心运动矢量(x,y)向下移动偏移量St得到边缘运动矢量(x,y-St)。Determining the edge motion vector corresponding to the central motion vector may include: moving the central motion vector (x, y) by an offset St in different directions to obtain edge motion vectors (x-St, y) in different directions, ( x + St, y), (x, y + St), (x, y-St). For example, in the horizontal direction, the center motion vector (x, y) can be shifted to the left by an offset St to obtain an edge motion vector (x-St, y), and the center motion vector (x, y) can be shifted to the right by an offset Get the edge motion vector (x + St, y) by St; in the vertical direction, you can move the center motion vector (x, y) up by the offset St to get the edge motion vector (x, y + St) and move the center The vector (x, y) is moved downward by the offset St to obtain the edge motion vector (x, y-St).
其中,偏移量St的初始值可以根据经验配置,如可以为2、4、8、16等。The initial value of the offset St can be configured according to experience, for example, it can be 2, 4, 8, 16, and so on.
假设中心运动矢量为(3,3),偏移量St为4,则得到边缘运动矢量(7,3)、(3,7)、(-1,3)、(3,-1)。Assuming that the center motion vector is (3, 3) and the offset St is 4, the edge motion vectors (7, 3), (3, 7), (-1, 3), and (3, -1) are obtained.
步骤313,编码端根据当前图像块的模板获得中心运动矢量的编码性能,并根据当前图像块的模板获得边缘运动矢量各自的编码性能。Step 313: 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. performance. 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. Specifically, the encoding end may determine the prediction performance of the central 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 central motion vector according to the prediction performance of the central motion vector. For example, the encoding performance of the central motion vector may be determined based on the prediction performance and the actual number of bits required for encoding.
其中,上述参数信息可以为亮度值,或者为亮度值和色度值。The above parameter information may be a brightness value, or a brightness value and a chrominance value.
假设参数信息为亮度值,为了确定中心运动矢量的编码性能,可以先获取当前图像块的模板的亮度值、第一目标参考块的亮度值。在得到当前图像块的模板后,可以获取模板的每个像素点的亮度值,并获取该模板对应的参考图像块。例如,假设中心运动矢量为(3,3),则可以利用中心运动矢量(3,3)移动该参考图像块,得到与参考图像块对应的图像块X(如对参考图像块向右移动3个像素点,向上移动3个像素点,将处理后的图像块记为图像块X),而图像块X就是第一目标参考块,且可以获取图像块X的每个像素点的亮度值。Assuming that the parameter information is a brightness value, in order to determine the coding performance of the central motion vector, 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. 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 corresponding to the template can be obtained. For example, if the central motion vector is (3, 3), the reference image block can be moved by using the central motion vector (3, 3) to obtain the image block X corresponding to the reference image block (for example, the reference image block is moved to the right by 3 3 pixels, move up 3 pixels, and mark the processed image block as image block X), and the image block X is the first target reference block, and the brightness value of each pixel point of the image block X can be obtained.
基于模板的每个像素点的亮度值、图像块X的每个像素点的亮度值,可以采用如下公式确定中心运动矢量的预测性能:Based on the brightness value of each pixel of the template and the brightness value of each pixel of the image block X, the prediction performance of the central motion vector can be determined using the following formula:
Figure PCTCN2019093574-appb-000001
Figure PCTCN2019093574-appb-000001
SAD是可用绝对差总和,用于表示中心运动矢量的预测性能。TM i表示模板的第i个像素点的亮度值,TMP i表示图像块X的第i个像素点的亮度值,M表示像素点的总数量。 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, and M represents the total number of pixels.
假设参数信息为亮度值和色度值,则利用如下公式确定中心运动矢量的亮度值预测性能SAD,Assuming that 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,
Figure PCTCN2019093574-appb-000002
Figure PCTCN2019093574-appb-000002
并采用如下公式确定中心运动矢量的色度值预测性能CSAD:The following formula is used to determine the chromaticity value prediction performance CSAD of the central motion vector:
Figure PCTCN2019093574-appb-000003
Figure PCTCN2019093574-appb-000003
亮度值预测性能SAD和色度值预测性能CSAD的平均值,就是中心运动矢量的预测性能。其中,CSAD是可用绝对差总和,用于表示中心运动矢量的色度值预测性能,CTM i表示模板第i个像素点的色度值,CTMP i表示图像块X第i个像素点的色度值,M c表示像素点总数量。 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. Among them, 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, and 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.
进一步的,在得到中心运动矢量的预测性能后,则可以根据该预测性能和编码所需的实际比特数,确定中心运动矢量的编码性能。例如,可以采用RDO(Rate Distortion Optimized,率失真原则)确定中心运动矢量的编码性能,而RDO通常采用如下公式确定中心运动矢量的编码性能:Further, after obtaining the prediction performance of the center motion vector, 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. For example, RDO (Rate Distortion Optimized, Rate-Distortion Principle) can be used to determine the coding performance of the central motion vector, and RDO usually uses the following formula to determine the coding performance of the central motion vector:
J=D+λ*R。J = D + λ * R.
其中,J表示编码性能,D表示预测性能,λ是拉格朗日乘子,是根据经验配置的数值,R是图像块编码所需的实际比特数,即编码比特流携带信息的比特总和。Among them, J represents encoding performance, D represents prediction performance, λ is a Lagrangian multiplier, which is a numerical value configured according to experience, and 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.
情况二,编码端根据当前图像块的模板获得边缘运动矢量的编码性能,可以包括但不限于:根据当前图像块的模板的参数信息和第二目标参考块的参数信息,确定边缘运动矢量的编码性能。其中,第二目标参考块可以为模板对应的参考图像块基于边缘运动矢量进行偏移之后获得的图像块。具体的,编码端可以根据模板的参数信息和第二目标参考块的参数信息,确定边缘运动矢量的预测性能,并根据边缘运动矢量的预测性能确定中心运动矢量的编码性能。例如,可以根据该预测性能和编码所需的实际比特数,确定边缘运动矢量的编码性能。In the second case, the encoding 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: 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 performance. 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. Specifically, 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, the encoding performance of the edge motion vector may be determined based on the prediction performance and the actual number of bits required for encoding.
其中,上述参数信息可以为亮度值,或者为亮度值和色度值。The above parameter information may be a brightness value, or 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. In one, 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.
步骤314,编码端根据中心运动矢量的编码性能和边缘运动矢量各自的编码性能,从中心运动矢量和边缘运动矢量中确定目标运动矢量。Step 314: The encoding 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 respective coding performance of the edge motion vector.
具体的,编码端可以从中心运动矢量和边缘运动矢量中选择编码性能最优的运动矢量。当该编码性能最优的运动矢量不是原始运动矢量时,可以将编码性能最优的运动矢量确定为目标运动矢量。当该编码性能最优的运动矢量是原始运动矢量时,可以从中心运动矢量和边缘运动矢量中选择编码性能次优的运动矢量作为目标运动矢量。Specifically, the coding end may select a motion vector with the best coding performance from the center motion vector and the edge motion vector. When the motion vector with the best coding performance is not the original motion vector, the motion vector with the best coding performance can be determined as the target motion vector. When the motion vector with the best coding performance is the original motion vector, a motion vector with the second best coding performance can be selected from the center motion vector and the edge motion vector as the target motion vector.
例如,若编码性能最优的运动矢量是边缘运动矢量(7,3),则编码端可以将边缘运动矢量(7,3)确定为目标运动矢量。若编码性能最优的运动矢量是中心运动矢量为(3,3),也就是原始运动矢量,则编码端还可以将编码性能次优的边缘运动矢量(如边缘运动矢量(7,3)等)确定为目标运动矢量。For example, if the motion vector with the best encoding performance is the edge motion vector (7, 3), the encoding end may determine the edge motion vector (7, 3) as the target motion vector. If the motion vector with the best encoding performance is the center motion vector as (3, 3), that is, the original motion vector, the encoding end can also use the edge motion vector (such as edge motion vector (7, 3), etc.) with the best encoding performance. ) Is determined as the target motion vector.
实施例五:Embodiment 5:
在实施例三的基础上,编码端根据该原始运动矢量和获取的模板得到目标运动矢量的过程,可以参见图3B所示,该流程可以包括:Based on the third embodiment, the process of the encoder obtaining the target motion vector according to the original motion vector and the obtained template can be seen in FIG. 3B. The process may include:
步骤321,编码端将原始运动矢量确定为中心运动矢量。Step 321: The encoding end determines the original motion vector as a central motion vector.
步骤322,编码端确定与该中心运动矢量对应的边缘运动矢量。其中,该边缘运动矢量可以与该中心运动矢量不同。Step 322: 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.
步骤323,编码端根据当前图像块的模板获得中心运动矢量的编码性能,并根据 当前图像块的模板获得边缘运动矢量各自的编码性能。Step 323: 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.
步骤324,编码端判断是否满足目标运动矢量的迭代结束条件。如果是,则可以执行步骤326;如果否,则可以执行步骤325。Step 324: The encoder determines whether the iteration end condition of the target motion vector is satisfied. If yes, go to step 326; if no, go to step 325.
其中,迭代结束条件可以包括但不限于:迭代次数达到次数阈值,或者执行时间达到时间阈值,或者,偏移量参数St已经被修改为预设数值,如1。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 St has been modified to a preset value, such as 1.
当然,上述只是迭代结束条件的几个示例,对此迭代结束条件不做限制。Of course, the above are just a few examples of iteration end conditions, and there are no restrictions on this iteration end condition.
步骤325,编码端从中心运动矢量和边缘运动矢量中选择编码性能最优的运动矢量作为新的中心运动矢量,并返回步骤322。In step 325, the encoder selects a motion vector with the best coding performance from the center motion vector and the edge motion vector as a new center motion vector, and returns to step 322.
例如,若编码性能最优的运动矢量是边缘运动矢量(7,3),则可以将边缘运动矢量(7,3)确定为新的中心运动矢量,并重新执行步骤322,以此类推。For example, if the motion vector with the best coding performance is the edge motion vector (7, 3), the edge motion vector (7, 3) may be determined as the new central motion vector, and step 322 is performed again, and so on.
当第一次执行步骤322时,偏移量参数St的取值可以为初始值,如可以为16。当再次执行步骤322时,先对偏移量参数St的取值进行调整,如调整为上次偏移量参数St减去2,或者调整为上次偏移量参数St的一半等。本文对此不做限制,只要调整后的偏移量参数St小于上次偏移量参数St即可,后续以调整为上次偏移量参数St的一半为例。因此,当第二次执行步骤322时,则偏移量参数St的取值为8;当第三次执行步骤322时,则偏移量参数St的取值为4;以此类推。When step 322 is performed for the first time, the value of the offset parameter St may be an initial value, such as 16. When step 322 is performed again, the value of the offset parameter St is adjusted first, for example, adjusted to the last offset parameter St minus 2, or adjusted to half of the last offset parameter St. This article does not limit this, as long as the adjusted offset parameter St is smaller than the last offset parameter St, and subsequent adjustments are made to half of the last offset parameter St as an example. Therefore, when step 322 is performed a second time, the value of the offset parameter St is 8; when step 322 is performed a third time, the value of the offset parameter St is 4; and so on.
其中,在对偏移量参数St的取值进行调整后,先判断调整后的偏移量参数St是否小于等于预设数值,如1。如果否,则可以基于调整后的偏移量参数St执行步骤322。如果是,则可以将偏移量参数St的取值设置为1,并基于该偏移量参数St(即取值1)执行步骤322,而在执行到步骤324时,判断结果为满足迭代结束条件。After adjusting the value of the offset parameter St, first determine whether the adjusted offset parameter St is less than or equal to a preset value, such as 1. If not, step 322 may be performed based on the adjusted offset parameter St. If so, the value of the offset parameter St can be set to 1, and step 322 is performed based on the offset parameter St (that is, the value 1), and when the execution proceeds to step 324, the judgment result is that the end of the iteration is satisfied condition.
步骤326,编码端根据中心运动矢量的编码性能和边缘运动矢量各自的编码性能,从中心运动矢量和边缘运动矢量中确定目标运动矢量。Step 326: 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 encoding performance of the edge motion vector.
实施例六:Embodiment 6:
在实施例三的基础上,编码端可以获取原始运动矢量的编码性能和目标运动矢量的编码性能。编码端获取原始运动矢量的编码性能,可以包括:根据当前图像块的模板的参数信息和第三目标参考块的参数信息,确定原始运动矢量的编码性能。其中,第三目标参考块为模板对应的参考图像块基于原始运动矢量进行偏移之后获得的图像块。具体的,可以根据模板的参数信息和第三目标参考块的参数信息,确定原始运动矢量的预测性能,并根据该预测性能确定原始运动矢量的编码性能。例如,根据该预测性能和编码所需的实际比特数,确定原始运动矢量的编码性能。其中,上述参数信息可以为亮度值,或者为亮度值和色度值。Based on the third embodiment, the encoding end can obtain the encoding performance of the original motion vector and the encoding performance of the target motion vector. The encoding end obtaining the encoding performance of the original motion vector may include: determining the encoding performance of the original motion vector according to the parameter information of the template of the current image block and the parameter information of the 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. Specifically, 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, the encoding performance of the original motion vector is determined based on the prediction performance and the actual number of bits required for encoding. The above parameter information may be a brightness value, or a brightness value and a chrominance value.
编码端获取目标运动矢量的编码性能,可以包括但不限于:根据当前图像块的模板的参数信息和第四目标参考块的参数信息,确定目标运动矢量的编码性能。其中,第四目标参考块为模板对应的参考图像块基于目标运动矢量进行偏移之后获得的图像块。具体的,可以根据模板的参数信息和第四目标参考块的参数信息,确定目标运动矢量的预测性能,并根据该预测性能确定目标运动矢量的编码性能。例如,根据该预测性 能和编码所需的实际比特数,确定目标运动矢量的编码性能。其中,上述参数信息可以为亮度值,或者为亮度值和色度值。The encoding end acquiring the encoding performance of the target motion vector 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. 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. Specifically, 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, based on the predictive performance and the actual number of bits required for encoding, the encoding performance of the target motion vector is determined. The above parameter information may be a brightness value, or a brightness value and a chrominance value.
上述过程与实施例四类似,区别在于:在得到第三目标参考块或者第四目标参考块时,是基于原始运动矢量或者目标运动矢量移动模板对应的参考图像块,而不是如实施例三中所述基于中心运动矢量移动模板对应的参考图像块。The above process is similar to the fourth embodiment, except that when the third target reference block or the fourth target reference block is obtained, the reference image block corresponding to the template is moved based on the original motion vector or the target motion vector, rather than as in the third embodiment. The reference image block corresponding to the template is moved based on the center motion vector.
实施例七:Embodiment 7:
本实施例中,原始模式信息为当前图像块的原始运动矢量和原始参考帧,目标模式信息为当前图像块的目标运动矢量和目标参考帧。基于此,编码端可以获取当前图像块的原始运动矢量和原始参考帧,并根据该原始运动矢量、该原始参考帧和获取的模板,得到目标运动矢量(可以与原始运动矢量不同)和目标参考帧。然后,可以根据该目标运动矢量和目标参考帧对当前图像块进行编码,得到当前图像块对应的编码比特流,并将编码比特流发送给解码端。In this embodiment, the original mode information is the original motion vector and the original reference frame of the current image block, and the target mode information is the target motion vector and the target reference frame of the current image block. Based on this, the encoder can obtain the original motion vector and the original reference frame of the current image block, and obtain the target motion vector (which can be different from the original motion vector) and the target reference according to the original motion vector, the original reference frame, and the obtained template. frame. Then, the current image block may be encoded according to the target motion vector and the target reference frame to obtain an encoded bit stream corresponding to the current image block, and the encoded bit stream is sent to the decoding end.
在一个例子中,编码端可以先获取当前图像块的原始运动矢量,假设当前图像块A1在编码端的运动矢量列表依次包括运动矢量A21、A31、A41和A51,则从运动矢量列表中选择一个运动矢量作为图像块A1的原始运动矢量。当然,上述方式只是示例,对此不做限制,例如,可以直接将默认运动矢量确定为原始运动矢量。In an example, the encoding end may first obtain the original motion vector of the current image block. Assuming that the motion vector list of the current image block A1 at the encoding end includes motion vectors A21, A31, A41, and A51 in turn, then select a motion from the motion vector list. The vector serves as the original motion vector of the image block A1. Of course, the above manner is only an example, and there is no limitation on this. For example, the default motion vector may be directly determined as the original motion vector.
在一个例子中,编码端获取当前图像块的原始参考帧的过程,对于当前图像块来说,可以有一个或者多个参考帧(具有很强时域相关性的视频帧),可以将其中一个参考帧作为原始参考帧,而剩余的参考帧均为候选参考帧。在本实施例中,需要从原始参考帧和所有候选参考帧中选取出目标参考帧,而目标参考帧也就是当前图像块最终的参考帧,并使用该目标参考帧进行后续处理。In an example, the process of obtaining the original reference frame of the current image block by the encoder. For the current image block, there can be one or more reference frames (video frames with strong time-domain correlation), and one of them can be The reference frame is used as the original reference frame, and the remaining reference frames are candidate reference frames. In this embodiment, a target reference frame needs to be selected from the original reference frame and all candidate reference frames, and the target reference frame is the final reference frame of the current image block, and the target reference frame is used for subsequent processing.
在一个例子中,编码端根据原始运动矢量、原始参考帧和获取的模板,得到目标运动矢量和目标参考帧的过程,可以参见后续实施例。例如,将运动矢量A21确定为原始运动矢量,将参考帧1确定为原始参考帧,将参考帧2和参考帧3确定为候选参考帧,则利用原始运动矢量A21、参考帧1、参考帧2和参考帧3获取目标运动矢量和目标参考帧。其中,目标运动矢量可作为当前图像块的最终运动矢量,该目标参考帧可以为参考帧1、参考帧2和参考帧3中的某个参考帧,且目标参考帧作为当前图像块的最终参考帧。In an example, the process for the encoder to obtain the target motion vector and the target reference frame according to the original motion vector, the original reference frame, and the obtained template can refer to the subsequent embodiments. For example, if the motion vector A21 is determined as the original motion vector, the reference frame 1 is determined as the original reference frame, and the reference frame 2 and the reference frame 3 are determined as candidate reference frames, the original motion vector A21, the reference frame 1, and the reference frame 2 are used. And reference frame 3 to obtain a target motion vector and a target reference frame. The target motion vector may be used as the final motion vector of the current image block. The target reference frame may be a reference frame in reference frame 1, reference frame 2, and reference frame 3. The target reference frame is used as the final reference of the current image block. frame.
在一个例子中,编码端根据该目标运动矢量和目标参考帧对当前图像块进行编码,得到当前图像块对应的编码比特流,并将编码比特流发送给解码端的过程,可以包括但不限于:编码端在得到目标运动矢量和目标参考帧后,可以利用目标运动矢量和目标参考帧对当前图像块进行编码,对此编码方式不做限制。在编码完成后,编码端可以得到当前图像块对应的编码比特流,并将所述编码比特流发送给解码端。In an example, the process of encoding the current image block according to the target motion vector and the target reference frame to obtain an encoded bit stream corresponding to the current image block and sending the encoded bit stream to the decoding end may include, but is not limited to: After the encoder obtains the target motion vector and the target reference frame, it can use the target motion vector and the target reference frame to encode the current image block, and there is no limitation on this encoding method. After the encoding is completed, the encoding end can obtain the encoded bit stream corresponding to the current image block, and sends the encoded bit stream to the decoding end.
其中,编码端可以根据原始运动矢量和目标运动矢量向解码端发送编码比特流。具体的,可以获取原始运动矢量的编码性能和目标运动矢量的编码性能。当目标运动矢量的编码性能优于原始运动矢量的编码性能时,向解码端发送的当前图像块对应的编码比特流中携带第一指示信息。当原始运动矢量的编码性能优于目标运动矢量的编码性能 时,向解码端发送的当前图像块对应的编码比特流中携带第二指示信息。The encoding end may send an encoded bit stream to the decoding end according to the original motion vector and the target motion vector. Specifically, the encoding performance of the original motion vector and the encoding performance of the target motion vector can be obtained. When the encoding performance of the target motion vector is better than the encoding performance of the original motion vector, the encoded bit stream corresponding to the current image block sent to the decoding end carries the first indication information. When 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 sent to the decoding end carries the second indication information.
其中,编码端获取原始运动矢量的编码性能和目标运动矢量的编码性能的过程,可以参见上述的实施例六。For the process of obtaining the encoding performance of the original motion vector and the encoding performance of the target motion vector by the encoding end, refer to the foregoing sixth embodiment.
上述方式是采用显式方式通知第一指示信息或者第二指示信息,在实际应用中,还可以采用隐式方式通知第一指示信息或者第二指示信息,即不在当前图像块对应的编码比特流中携带第一指示信息或者第二指示信息。具体的,编码端和解码端还可以协商决策策略或者在标准中定义决策策略,并将所述决策策略分别存储在编码端和解码端,如决策策略可以约定第一策略信息、或者约定第二策略信息、或者约定第三策略信息。其中,第三策略信息为采用与当前图像块的候选图像块相同的策略信息。然后,可以基于决策策略确定在哪种情况下可以不在当前图像块对应的编码比特流中携带第一指示信息或者第二指示信息,详细处理参见实施例三。The above method is to notify the first instruction information or the second instruction information explicitly. In practical applications, the first instruction information or the second instruction information may also be notified implicitly, that is, the encoded bit stream corresponding to the current image block is not included. The first instruction information or the second instruction information is carried. Specifically, the encoding end and the decoding end may also negotiate a decision strategy or define a decision strategy in a standard, and store the decision strategy on the encoding end and the decoding end respectively. For example, the decision strategy may agree on the first policy information or agree on the second policy information. Strategy information, or contracted third strategy information. The third policy information is the same policy information as the candidate image block of the current image block. Then, it can be determined based on the decision strategy in which case the first indication information or the second indication information may not be carried in the encoded bit stream corresponding to the current image block. For detailed processing, refer to the third embodiment.
在一个例子中,编码端根据原始运动矢量和目标运动矢量向解码端发送编码比特流,还可以包括:获取原始运动矢量在运动矢量列表中的索引值;在向解码端发送的当前图像块对应的编码比特流中携带该索引值。例如,若原始运动矢量为运动矢量A21,且运动矢量A21是运动矢量列表的第一个运动矢量,则该索引值可以为1。In an example, 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; corresponding to the current image block sent to the decoding end The indexed value is carried in the encoded bitstream of. 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.
由以上可见,可以根据原始运动矢量和原始参考帧获取目标运动矢量和目标参考帧,并根据目标运动矢量确定当前图像块的最终运动矢量,根据目标参考帧确定当前图像块的最终参考帧,而不是直接将原始运动矢量确定为当前图像块的最终运动矢量,利用原始参考帧确定当前图像块的最终参考帧,从而可有效提高运动矢量的精度,并提高编码性能。而且,由于可以根据候选图像块的运动信息快速得到当前图像块的模板,从而可以有效提高编解码效率,减少编解码时延,如在重建阶段之前,就可以获取当前图像块的模板。It can be seen from the above that the target motion vector and the target reference frame can be obtained according to the original motion vector and the original reference frame, and the final motion vector of the current image block is determined according to the target motion vector, and the final reference frame of the current image block is determined according to the target reference frame. Instead of directly determining the original motion vector as the final motion vector of the current image block, the original reference frame is used to determine the final reference frame of the current image block, which can effectively improve the accuracy of the motion vector and improve coding performance. In addition, since the template of the current image block can be quickly obtained according to the motion information of the candidate image block, the codec efficiency can be effectively improved and the codec delay can be reduced. For example, the template of the current image block can be obtained before the reconstruction phase.
实施例八:Embodiment 8:
在实施例七的基础上,编码端根据原始运动矢量、原始参考帧和模板,得到目标运动矢量和目标参考帧,实现流程可以参见图3C所示。Based on the seventh embodiment, the encoder obtains the target motion vector and the target reference frame according to the original motion vector, the original reference frame, and the template. The implementation process can be shown in FIG. 3C.
步骤331,编码端基于当前图像块的模板和原始运动矢量获取原始参考帧的候选运动矢量,该候选运动矢量可以与该原始运动矢量不同。Step 331: The encoder obtains a candidate motion vector of the original reference frame based on the template of the current image block and the original motion vector. The candidate motion vector may be different from the original motion vector.
在一个例子中,编码端基于当前图像块的模板和原始运动矢量获取原始参考帧的候选运动矢量,可以包括但不限于:编码端将原始运动矢量确定为中心运动矢量,并确定与中心运动矢量对应的边缘运动矢量,边缘运动矢量与中心运动矢量不同;编码端根据当前图像块的模板获得中心运动矢量的编码性能,并根据当前图像块的模板获得各个边缘运动矢量的编码性能;然后,编码端可以根据中心运动矢量的编码性能和各个边缘运动矢量的编码性能,从中心运动矢量和边缘运动矢量中确定原始参考帧的候选运动矢量。In an example, the encoding end obtains candidate motion vectors of the original reference frame based on the template of the current image block and the original motion vector, which may include, but is not limited to, the encoding end determines the original motion vector as the center motion vector, and determines the center motion vector. Corresponding edge motion vector, the edge motion vector is different from the center motion vector; the encoding end obtains the encoding performance of the center motion vector according to the template of the current image block, and obtains the encoding performance of each edge motion vector according to the template of the current image block; then, encoding The end may determine the candidate motion vector of the original reference frame from the center motion vector and the edge motion vector according to the coding performance of the center motion vector and the coding performance of each edge motion vector.
其中,编码端根据原始运动矢量获取原始参考帧的候选运动矢量的过程,可以参见实施例四或者实施例五,只是将实施例四或者实施例五中的目标运动矢量,替换为原始参考帧的候选运动矢量即可。For the process of obtaining the candidate motion vector of the original reference frame by the encoding end according to the original motion vector, refer to the fourth or fifth embodiment, and only replace the target motion vector in the fourth or fifth embodiment with the original reference frame. Candidate motion vectors are sufficient.
步骤332,编码端根据原始运动矢量获取各个候选参考帧的初始运动矢量。Step 332: The encoder obtains the initial motion vector of each candidate reference frame according to the original motion vector.
在一个例子中,编码端根据原始运动矢量获取候选参考帧的初始运动矢量,可以包括:根据当前图像块所在帧与原始参考帧的距离(如当前图像块所在帧与原始参考帧之间的帧数)、当前图像块所在帧与所述候选参考帧的距离和原始运动矢量,获取所述候选参考帧的初始运动矢量。In one example, the encoder obtains the initial motion vector of the candidate reference frame according to the original motion vector, which may include: according to the distance between the frame where the current image block is located and the original reference frame (such as the frame between the frame where the current image block is located and the original reference frame). Number), the distance between the frame where the current image block is located and the candidate reference frame, and the original motion vector to obtain the initial motion vector of the candidate reference frame.
例如,假设原始运动矢量为运动矢量1,原始参考帧为参考帧1,候选参考帧为参考帧2和参考帧3,当前图像块所在帧(后续简称为当前帧)与参考帧1的距离为d1,当前帧与参考帧2的距离为d2,当前帧与参考帧3的距离为d3,则:参考帧2的初始运动矢量为运动矢量1*(d2/d1),后续记为运动矢量2,参考帧3的初始运动矢量为运动矢量1*(d3/d1),后续记为运动矢量3。For example, suppose the original motion vector is motion vector 1, the original reference frame is reference frame 1, the candidate reference frame is reference frame 2 and reference frame 3, and the distance between the frame where the current image block is located (hereinafter referred to as the current frame) and reference frame 1 is d1, the distance between the current frame and the reference frame 2 is d2, and the distance between the current frame and the reference frame 3 is d3, then: the initial motion vector of the reference frame 2 is the motion vector 1 * (d2 / d1), and it is subsequently recorded as the motion vector 2 , The initial motion vector of the reference frame 3 is the motion vector 1 * (d3 / d1), and the subsequent motion vector is referred to as the motion vector 3.
步骤333,编码端根据候选参考帧的初始运动矢量获取候选参考帧的候选运动矢量。Step 333: The encoder obtains the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame.
在一个例子中,编码端根据候选参考帧的初始运动矢量获取候选参考帧的候选运动矢量,可以包括但不限于:将该候选参考帧的初始运动矢量确定为中心运动矢量,并确定与中心运动矢量对应的边缘运动矢量,该边缘运动矢量与该中心运动矢量不同;根据当前图像块的模板获得中心运动矢量的编码性能,并根据当前图像块的模板获得各个边缘运动矢量的编码性能;然后,根据中心运动矢量的编码性能和各个边缘运动矢量的编码性能,从中心运动矢量和边缘运动矢量中确定该候选参考帧的候选运动矢量。其中,针对每个候选参考帧,可以根据该候选参考帧的初始运动矢量获取该候选参考帧的候选运动矢量,即每个候选参考帧对应一个候选运动矢量。In one example, the encoding end obtains the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame, which may include, but is not limited to, determining the initial motion vector of the candidate reference frame as the center motion vector, and determining the center motion The edge motion vector corresponding to the vector, which is different from the center motion vector; obtain the encoding performance of the center motion vector according to the template of the current image block, and obtain the encoding performance of each edge motion vector according to the template of the current image block; then, According to the coding performance of the central motion vector and the coding performance of each edge motion vector, a candidate motion vector of the candidate reference frame is determined from the central motion vector and the edge motion vector. For each candidate reference frame, the candidate motion vector of the candidate reference frame can be obtained according to the initial motion vector of the candidate reference frame, that is, each candidate reference frame corresponds to one candidate motion vector.
其中,编码端根据候选参考帧的初始运动矢量获取该候选参考帧的候选运动矢量的过程,可以参见实施例四或实施例五,只是将实施例四或实施例五中的目标运动矢量,替换为候选参考帧的候选运动矢量,将实施例四或实施例五中的原始运动矢量,替换为候选参考帧的初始运动矢量即可。The process of the encoder obtaining the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame may refer to the fourth embodiment or the fifth embodiment, but replaces the target motion vector in the fourth or the fifth embodiment. For the candidate motion vector of the candidate reference frame, the original motion vector in the fourth or fifth embodiment may be replaced with the initial motion vector of the candidate reference frame.
步骤334,编码端从原始参考帧的候选运动矢量以及各个候选参考帧的候选运动矢量中,选择编码性能最优的候选运动矢量作为目标运动矢量。In step 334, the encoder selects the candidate motion vector with the best coding performance as the target motion vector from the candidate motion vectors of the original reference frame and the candidate motion vectors of each candidate reference frame.
例如,编码端得到原始参考帧的候选运动矢量以及各个候选参考帧的候选运动矢量后,可以获取每个候选运动矢量的编码性能,具体获取方式参见上述实施例四,只是将实施例四的中心运动矢量替换为候选运动矢量即可。编码端在得到每个候选运动矢量的编码性能后,就可以选择编码性能最优的候选运动矢量作为目标运动矢量。For example, after obtaining the candidate motion vectors of the original reference frame and the candidate motion vectors of each candidate reference frame, the encoding end can obtain the coding performance of each candidate motion vector. For specific acquisition methods, refer to the foregoing fourth embodiment. The motion vector may be replaced with a candidate motion vector. After the coding end obtains the coding performance of each candidate motion vector, it can select the candidate motion vector with the best coding performance as the target motion vector.
步骤335,编码端将目标运动矢量对应的参考帧确定为目标参考帧。Step 335: The encoding end determines the reference frame corresponding to the target motion vector as the target reference frame.
例如,当目标运动矢量对应原始参考帧时,编码端可以将该原始参考帧确定为目标参考帧,当目标运动矢量对应候选参考帧时,编码端可以将该候选参考帧确定为目标参考帧。For example, when the target motion vector corresponds to the original reference frame, the encoding end may determine the original reference frame as the target reference frame, and when the target motion vector corresponds to the candidate reference frame, the encoding end may determine the candidate reference frame as the target reference frame.
本实施例中,从原始参考帧和所有候选参考帧中选取目标参考帧,而目标参考帧也就是当前图像块最终的参考帧。从原始参考帧的候选运动矢量和所有候选参考帧各自的候选运动矢量中选取目标运动矢量(即编码性能最优的候选运动矢量),该目标运 动矢量就是当前图像块最终的运动矢量,并选择目标运动矢量对应的参考帧作为目标参考帧。In this embodiment, a target reference frame is selected from the original reference frame and all candidate reference frames, and the target reference frame is the final reference frame of the current image block. Select the target motion vector (that is, the candidate motion vector with the best coding performance) from the candidate motion vectors of the original reference frame and the candidate motion vectors of all candidate reference frames. The target motion vector is the final motion vector of the current image block, and select The reference frame corresponding to the target motion vector is used as the target reference frame.
实施例九:Embodiment Nine:
本实施例中,原始模式信息可以为原始预测图像块,目标模式信息可以为目标预测图像块,编码端可以根据原始预测图像块获取目标预测图像块。In this embodiment, the original mode information may be the original prediction image block, the target mode information may be the target prediction image block, and the encoding end may obtain the target prediction image block according to the original prediction image block.
具体的,在帧间编码技术中,为了传输当前帧图像的当前图像块,可以先查询到当前图像块的参考帧图像,即可以通过参考帧索引查询到该参考帧图像,然后,从该参考帧图像中查询到与当前图像块匹配的预测图像块,并基于当前图像块与该预测图像块的差对当前图像块进行编码,从而减少比特传输量。Specifically, in the inter-frame coding technology, in order to transmit the current image block of the current frame image, the reference frame image of the current image block can be queried first, that is, the reference frame image can be queried through the reference frame index, and then, from the reference A predicted image block matching the current image block is found in the frame image, and the current image block is encoded based on the difference between the current image block and the predicted image block, thereby reducing the bit transmission amount.
由于当前图像块与预测图像块之间可能存在亮度差别,直接对当前图像块与预测图像块的差对当前图像块进行编码时,可能存在编码效果较差,编码性能较低等问题。Because there may be a brightness difference between the current image block and the predicted image block, when the current image block is directly encoded with the difference between the current image block and the predicted image block, there may be problems such as poor encoding effect and low encoding performance.
本实施例中,将参考帧图像中的预测图像块称为原始预测图像块,根据原始预测图像块获取目标预测图像块,并基于当前图像块与目标预测图像块的差对当前图像块进行编码,而不是直接基于当前图像块与原始预测图像块的差对当前图像块进行编码。由于目标预测图像块是采用局部光照补偿算法得到的图像块,能够消除原始预测图像块与当前图像块之间的亮度差别,使得在基于当前图像块与目标预测图像块的差对当前图像块进行编码时,可以有效解决编码效果较差,编码性能较低等问题。In this embodiment, the predicted image block in the reference frame image is referred to as the original predicted image block, the target predicted image block is obtained according to the original predicted image block, and the current image block is encoded based on the difference between the current image block and the target predicted image block. Instead of directly encoding the current image block based on the difference between the current image block and the original predicted image block. Because the target prediction image block is an image block obtained by using a local illumination compensation algorithm, the brightness difference between the original prediction image block and the current image block can be eliminated, so that the current image block is processed based on the difference between the current image block and the target prediction image block. When encoding, it can effectively solve the problems of poor encoding effect and low encoding performance.
在本实施例中,编码端可以获取当前图像块的原始预测图像块,根据原始预测图像块和获取的模板得到目标预测图像块。根据目标预测图像块对当前图像块进行编码,得到当前图像块对应的编码比特流,并将编码比特流发送给解码端。In this embodiment, the encoding end may obtain the original prediction image block of the current image block, and obtain the target prediction image block according to the original prediction image block and the obtained template. Encode the current image block according to the target predicted image block to obtain an encoded bit stream corresponding to the current image block, and send the encoded bit stream to the decoding end.
在一个例子中,编码端获取当前图像块的原始预测图像块的过程,可以包括但不限于:编码端先获取当前图像块的参考帧索引,并通过该参考帧索引查询到当前图像块的参考帧图像,从该参考帧图像中查询到与当前图像块匹配的原始预测图像块。In an example, the process of obtaining the original predicted image block of the current image block by the encoding end may include, but is not limited to: the encoding end first obtains the reference frame index of the current image block, and queries the reference of the current image block through the reference frame index. A frame image, from which the original predicted image block matching the current image block is queried from the reference frame image.
在一个例子中,编码端根据原始预测图像块和获取的模板,得到目标预测图像块的过程,可以参见后续实施例。In an example, the process of obtaining the target predicted image block by the encoding end according to the original predicted image block and the obtained template can refer to the subsequent embodiments.
在一个例子中,编码端根据该目标预测图像块对当前图像块进行编码,得到当前图像块对应的编码比特流,并将编码比特流发送给解码端的过程,可以包括:在得到目标预测图像块后,可以基于当前图像块与目标预测图像块的差对当前图像块进行编码,对此编码方式不做限制,在编码完成后,得到当前图像块对应的编码比特流,将编码比特流发送给解码端。In an example, the process of encoding the current image block according to the target predicted image block to obtain the encoded bit stream corresponding to the current image block and sending the encoded bit stream to the decoding end may include: obtaining the target predicted image block After that, the current image block can be encoded based on the difference between the current image block and the target predicted image block. There is no restriction on this encoding method. After encoding is completed, the encoded bit stream corresponding to the current image block is obtained, and the encoded bit stream is sent to Decoding end.
当编码端采用目标预测图像块对当前图像块进行编码(即基于当前图像块与目标预测图像块的差对当前图像块进行编码)时,编码端向解码端发送的当前图像块对应的编码比特流中携带第一指示信息;当编码端采用原始预测图像块对当前图像块进行编码(即基于当前图像块与原始预测图像块的差对当前图像块进行编码)时,编码端向解码端发送的当前图像块对应的编码比特流中携带第二指示信息。When the encoding end uses the target prediction image block to encode the current image block (that is, to encode the current image block based on the difference between the current image block and the target prediction image block), the encoding end sends the encoding bit corresponding to the current image block to the decoding end. The stream carries first indication information; when the encoding end uses the original prediction image block to encode the current image block (that is, to encode the current image block based on the difference between the current image block and the original prediction image block), the encoding end sends to the decoding end The coded bit stream corresponding to the current image block of the second image carries second indication information.
上述方式是采用显式方式通知第一指示信息或者第二指示信息,在实际应用中, 还可以采用隐式方式通知第一指示信息或者第二指示信息,即不在当前图像块对应的编码比特流中携带第一指示信息或者第二指示信息。具体的,编码端和解码端还可以协商决策策略或者在标准中定义决策策略,并将所述决策策略分别存储在编码端和解码端。例如,决策策略可以约定第一策略信息、或者约定第二策略信息、或者约定第三策略信息。其中,第三策略信息为采用与当前图像块的候选图像块相同的策略信息。In the above manner, the first indication information or the second indication information is notified explicitly. In practical applications, the first indication information or the second indication information may also be notified implicitly, that is, the encoded bit stream corresponding to the current image block is not included. The first instruction information or the second instruction information is carried. Specifically, the encoding end and the decoding end may also negotiate a decision strategy or define a decision strategy in a standard, and store the decision strategies at the encoding end and the decoding end, respectively. For example, the decision strategy may agree on the first strategy information, or agree on the second strategy information, or agree on the third strategy information. The third policy information is the same policy information as the candidate image block of the current image block.
若决策策略约定第一策略信息,且编码端采用目标预测图像块对当前图像块进行编码,则可不在当前图像块对应的编码比特流中携带第一指示信息或者第二指示信息。若决策策略约定第二策略信息,且编码端采用原始预测图像块对当前图像块进行编码,则可不在当前图像块对应的编码比特流中携带第一指示信息或者第二指示信息。若决策策略约定第三策略信息,且当前图像块的候选图像块采用第一策略信息、编码端采用目标预测图像块对当前图像块进行编码,则可不在当前图像块对应的编码比特流中携带第一指示信息或者第二指示信息。若决策策略约定第三策略信息,且当前图像块的候选图像块采用第二策略信息、编码端采用原始预测图像块对当前图像块进行编码,则可不在当前图像块对应的编码比特流中携带第一指示信息或者第二指示信息。If the decision strategy agrees with the first strategy information, and the encoding end uses the target prediction image block to encode the current image block, the first indication information or the second indication information may not be carried in the encoded bit stream corresponding to the current image block. If the decision strategy agrees with the second strategy information, and the encoding end uses the original predicted image block to encode the current image block, the first indication information or the second indication information may not be carried in the encoded bit stream corresponding to the current image block. If the decision strategy agrees with the third strategy information, and the candidate image block of the current image block uses the first policy information, and the encoding end uses the target prediction image block to encode the current image block, it may not be carried in the encoded bit stream corresponding to the current image block. The first instruction information or the second instruction information. If the decision strategy agrees with the third strategy information, and the candidate image block of the current image block uses the second strategy information, and the encoding end uses the original predicted image block to encode the current image block, it may not be carried in the encoded bit stream corresponding to the current image block. The first instruction information or the second instruction information.
实施例十:Embodiment 10:
在实施例九的基础上,编码端根据原始预测图像块和获取的模板,得到目标预测图像块的过程,其实现流程可以参见图3D所示。On the basis of the ninth embodiment, the process of obtaining the target predicted image block by the encoding end according to the original predicted image block and the obtained template. The implementation process can be shown in FIG. 3D.
步骤341,编码端获取当前图像块的运动矢量和该运动矢量对应的参考帧索引。其中,当前图像块的运动矢量可以为上述实施例中的原始运动矢量,也可以为上述实施例中的目标运动矢量,还可以为上述实施例中的最终运动矢量,对此不做限制,只要能够得到当前图像块的运动矢量即可。此外,该运动矢量对应的参考帧索引也就是当前图像块的参考帧的索引。Step 341: The encoder obtains a motion vector of the current image block and a reference frame index corresponding to the motion vector. The motion vector of the current image block may be the original motion vector in the foregoing embodiment, or the target motion vector in the foregoing embodiment, or may be the final motion vector in the foregoing embodiment, which is not limited as long as The motion vector of the current image block can be obtained. In addition, the reference frame index corresponding to the motion vector is also the index of the reference frame of the current image block.
步骤342,编码端根据当前图像块的运动矢量和参考帧索引获得模板对应的参考块。例如,通过该参考帧索引查询到参考帧图像,并从参考帧图像中查询到与当前图像块匹配的参考图像块,然后,利用当前图像块的运动矢量对该参考图像块进行移动,得到的就是模板对应的参考块,后续记为TMP。Step 342: The encoder obtains the reference block corresponding to the template according to the motion vector and the reference frame index of the current image block. For example, a reference frame image is queried by using the reference frame index, and a reference image block matching the current image block is queried from the reference frame image. Then, the reference image block is moved by using the motion vector of the current image block. It is the reference block corresponding to the template, which will be referred to as TMP.
步骤343,编码端根据当前图像块的模板和该模板对应的参考块,获取变换系数。具体的,编码端可以根据当前图像块的模板的各像素的参数信息、该模板对应的参考块的各像素的参数信息,获取变换系数。其中,该参数信息可以包括但不限于亮度值。Step 343: The encoding end obtains a transform coefficient according to a template of the current image block and a reference block corresponding to the template. Specifically, the encoding end may obtain a transformation coefficient according to parameter information of each pixel of a template of the current image block and parameter information of each pixel of a reference block corresponding to the template. The parameter information may include, but is not limited to, a brightness value.
例如,参见如下公式:For example, see the following formula:
Figure PCTCN2019093574-appb-000004
Figure PCTCN2019093574-appb-000004
TM i表示当前图像块的模板中的第i个像素的亮度值,TMP i表示模板对应的参考块中的第i个像素的亮度值,M表示模板的像素总数,a和b为变换系数。通过调整变换系数a和b的取值,可以使SSE的取值也发生变化。当SSE的取值最小时,变换系数a和b的取值就是目标值,即获得了变换系数a和b的取值。其中,可以采用最小二乘法使SSE取值最小,继而获得变换系数a和b的取值。当然,也可以采用其它算法,对此 不做限制。 TM i represents the brightness value of the i-th pixel in the template of the current image block, TMP i represents the brightness value of the i-th pixel in the reference block corresponding to the template, M represents the total number of pixels of the template, and a and b are transformation coefficients. By adjusting the values of the transformation coefficients a and b, the value of the SSE can also be changed. When the value of SSE is the smallest, the values of the transformation coefficients a and b are the target values, that is, the values of the transformation coefficients a and b are obtained. Among them, the least square method can be used to minimize the value of SSE, and then obtain the values of the transformation coefficients a and b. Of course, other algorithms can also be used, which is not limited.
步骤344,编码端根据变换系数对原始预测图像块进行光照补偿,得到目标预测图像块。例如,目标预测图像块可以为aX+b,X表示原始预测图像块。Step 344: The encoding end performs illumination compensation on the original prediction image block according to the transform coefficient to obtain the target prediction image block. For example, the target prediction image block may be aX + b, where X represents the original prediction image block.
实施例十一:Embodiment 11:
参见图4所示,为解码方法的流程示意图,应用于解码端,该方法可以包括以下步骤:Referring to FIG. 4, which is a schematic flowchart of a decoding method, which is applied to a decoding end, the method may include the following steps:
步骤401,解码端获取当前图像块的候选图像块的运动信息。Step 401: 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.
步骤402,解码端根据候选图像块的运动信息获取当前图像块的模板。Step 402: 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. For details, refer to the related content in the second embodiment.
步骤403,解码端根据当前图像块的模板对当前图像块进行解码。Step 403: The decoding end decodes the current image block according to the template of the current image block.
在一个例子中,解码端根据当前图像块的模板对当前图像块进行解码,可以包括但不限于:获取当前图像块的原始模式信息;基于当前图像块的模板和该原始模式信息获取当前图像块的目标模式信息;根据该目标模式信息对当前图像块进行解码。其中,原始模式信息为原始运动矢量,目标模式信息为目标运动矢量;或者,原始模式信息为原始运动矢量和原始参考帧,目标模式信息为目标运动矢量和目标参考帧;或者,原始模式信息为原始预测图像块,目标模式信息为目标预测图像块。当然,上述只是示例,对此不做限制。In one example, the decoding end decodes the current image block according to the template of the current image block, which may include but is not limited to: obtaining the original mode information of the current image block; obtaining the current image block based on the template of the current image block and the original mode information The target mode information of; the current image block is decoded according to the target mode information. The original mode information is the original motion vector, and the target mode information is the target motion vector. Or, the original mode information is the original motion vector and the original reference frame, and the target mode information is the target motion vector and the target reference frame. Or, the original mode information is The original prediction image block, and the target mode information is the target prediction image block. Of course, the above is only an example, and there is no limitation on this.
在一个例子中,在基于当前图像块的模板和该原始模式信息获取当前图像块的目标模式信息之前,解码端还可以获取当前图像块对应的编码比特流,该编码比特流可以是编码端发送的,也可以是解码端对当前图像块进行编码后得到的。In one example, before obtaining the target mode information of the current image block based on the template of the current image block and the original mode information, the decoding end may also obtain a coded bit stream corresponding to the current image block, which may be sent by the encoding end. Yes, it can also be obtained after the decoding end encodes the current image block.
例如,解码端可以接收来自编码端的当前图像块对应的编码比特流,若编码比特流携带第一指示信息,该第一指示信息用于指示基于当前图像块的模板和原始模式信息获取当前图像块的目标模式信息,则根据第一指示信息获取当前图像块的候选图像块的运动信息,并根据候选图像块的运动信息获取当前图像块的模板。For example, the decoding end may receive the encoded bit stream corresponding to the current image block from the encoding end. If the encoded bit stream carries first indication information, the first indication information is used to instruct to obtain the current image block based on the current image block template and the original mode information. The target mode information of the target image block, the motion information of the candidate image block of the current image block is obtained according to the first instruction information, and the template of the current image block is obtained according to the motion information of the candidate image block.
又例如,解码端可以接收来自编码端的当前图像块对应的编码比特流,若编码比特流携带第二指示信息,该第二指示信息用于指示基于当前图像块对应的原始模式信息对编码比特流进行解码,则根据第二指示信息获取当前图像块的原始模式信息,并基于原始模式信息对当前图像块进行解码。As another example, the decoding end may receive the encoded bit stream corresponding to the current image block from the encoding end. If the encoded bit stream carries second instruction information, the second instruction information is used to indicate that the encoded bit stream is based on the original mode information corresponding to the current image block. When decoding is performed, the original mode information of the current image block is obtained according to the second instruction information, and the current image block is decoded based on the original mode information.
其中,上述方式是采用显式方式通知第一指示信息或者第二指示信息,在实际应用中,编码端还可以采用隐式方式通知第一指示信息或者第二指示信息对应的策略,即当前图像块对应的编码比特流中未携带第一指示信息或者第二指示信息。基于此,解码端还可以根据本地预设的第一策略信息获取当前图像块的候选图像块的运动信息,并根据候选图像块的运动信息获取当前图像块的模板;或者,还可以根据本地预设的第二 策略信息获取原始模式信息,并基于原始模式信息对当前图像块进行解码;或者,还可以根据本地预设的第三策略信息获取当前图像块的候选图像块的策略,并基于所获取的策略对当前图像块进行解码。其中,第一策略信息用于指示基于当前图像块的模板和原始模式信息获取当前图像块的目标模式信息;第二策略信息用于指示基于当前图像块的原始模式信息对当前图像块进行解码;第三策略信息用于指示采用与当前图像块的相邻图像块相同的策略信息。Wherein, the above manner is to notify the first indication information or the second indication information in an explicit manner. In practical applications, the encoding end may also notify the strategy corresponding to the first indication information or the second indication information in an implicit manner, that is, the current image. The encoded bitstream corresponding to the block does not carry the first indication information or the second indication information. Based on this, the decoding end may also 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 second strategy information is set to obtain the original mode information, and the current image block is decoded based on the original mode information; or, the strategy of the candidate image block of the current image block may also be obtained according to the locally preset third policy information, and based on the The obtained strategy decodes the current image block. The first policy information is used to indicate that target mode information of the current image block is obtained based on the template and original mode information of the current image block; the second policy information is used to indicate that the current image block is decoded based on the original mode information of the current image block; The third policy information is used to indicate that the same policy information as the neighboring image blocks of the current image block is adopted.
具体的,编码端和解码端还可以协商决策策略或者在标准中定义决策策略,并将所述决策策略分别存储在编码端和解码端,如决策策略可以约定第一策略信息、或约定第二策略信息、或约定第三策略信息。在此基础上,若当前图像块对应的编码比特流中未携带第一指示信息和第二指示信息,当决策策略约定第一策略信息时,根据本地预设的第一策略信息获取当前图像块的候选图像块的运动信息,并根据候选图像块的运动信息获取当前图像块的模板;当决策策略约定第二策略信息时,则根据本地预设的第二策略信息获取原始模式信息,并基于原始模式信息对当前图像块进行解码;当决策策略约定第三策略信息,若候选图像块采用第一策略信息,则获取当前图像块的候选图像块的运动信息,并根据候选图像块的运动信息获取当前图像块的模板;当决策策略约定第三策略信息,若候选图像块采用第二策略信息,则获取原始模式信息,并基于原始模式信息对当前图像块进行解码。Specifically, the encoding end and the decoding end may also negotiate a decision strategy or define a decision strategy in a standard, and store the decision strategy on the encoding end and the decoding end respectively. For example, the decision strategy may agree on the first policy information or agree on the second policy information. Strategy information, or contracted third strategy information. On this basis, if the first indication information and the second indication information are not carried in the encoded bit stream corresponding to the current image block, when the decision policy agrees with the first policy information, the current image block is obtained according to the locally preset first policy information. The candidate image block ’s motion information, and obtain the template of the current image block according to the candidate image block ’s motion information; when the decision policy agrees with the second policy information, the original mode information is obtained according to the locally preset second policy information, and based on The original mode information decodes the current image block; when the decision strategy agrees on the third policy information, if the candidate image block adopts 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 candidate image block. Obtain a template of the current image block; when the decision strategy agrees on the third policy information, if the candidate image block adopts the second policy information, obtain the original mode information, and decode the current image block based on the original mode information.
由以上可见,可以根据当前图像块的候选图像块的运动信息获取当前图像块的模板,并根据当前图像块的模板对当前图像块进行解码。由于上述方式可以快速得到当前图像块的模板,从而可以有效提高解码效率,降低解码时延,并提高解码性能。It can be seen from the above that the template of the current image block can be obtained according to the motion information of the candidate image block of the current image block, and the current image block is decoded according to the template of the current image block. Because the above method can quickly obtain the template of the current image block, it can effectively improve decoding efficiency, reduce decoding delay, and improve decoding performance.
实施例十二:Embodiment 12:
本实施例中,与采用重建信息和预测信息生成模板的方式不同,可以根据当前图像块的候选图像块的运动信息(如运动矢量和参考帧索引等)获取当前图像块的模板。具体的,解码端可以则根据该参考帧索引确定该候选图像块的参考帧图像,根据该运动矢量从该参考帧图像中获取该候选图像块的参考图像块,并根据该参考图像块获取该当前图像块的模板。In this embodiment, different from the method of generating a template by using reconstruction information and prediction information, 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. Specifically, the decoding end may then determine a reference frame image of the candidate image block according to the reference frame index, obtain a reference image block of the candidate image block from the reference frame image according to the motion vector, and obtain the reference image block according to the reference image block. The template of the current image block.
其中,候选图像块可以包括M个第一候选图像块和N个第二候选图像块,M为大于或等于1的自然数,N为大于或等于0的自然数,或者,M为大于或等于0的自然数,N为大于或等于1的自然数。第一候选图像块为当前图像块上侧的候选图像块,第二候选图像块为当前图像块左侧的候选图像块。第一候选图像块包括当前图像块上侧的相邻图像块和/或次邻图像块;相邻图像块的预测模式为帧间模式或者帧内模式;次邻图像块的预测模式为帧间模式。第二候选图像块包括当前图像块左侧的相邻图像块和/或次邻图像块。其中,相邻图像块的预测模式为帧间模式或者帧内模式;次邻图像块的预测模式为帧间模式。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, and 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 a neighboring image block and / or a next-neighbor 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 adjacent image block is an inter mode.
根据候选图像块的运动信息获取当前图像块的模板,可以包括但不限于:根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板;根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板;然后,根据第一模板和第二模板确定当前图像块的模板。其中,可具体为:将第一模板确定为当前图像块的模板; 或者,将第二模板确定为当前图像块的模板;或者,将第一模板和第二模板拼接之后确定为当前图像块的模板。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; Determine the second template according to the motion vector prediction mode and motion information; then, determine the template of the current image block according to the first template and the second template. Specifically, it may be: determining the first template as a template of the current image block; or determining the second template as the template of the current image block; or determining the current image block after splicing the first template and the second template. template.
当M大于1时,则上述第一模板可以包括M个子模板或者P个子模板,且由M个子模板或P个子模板拼接而成,P为帧间模式的第一候选图像块的数量;当M等于1时,则第一模板可以包括第一子模板,第一子模板是根据当前图像块上侧的一个候选图像块的运动矢量预测模式和运动信息确定的。当N大于1时,则第二模板可以包括N个子模板或者R个子模板,且由N个子模板或R个子模板拼接而成,R为帧间模式的第二候选图像块的数量;当N等于1时,则第二模板可以包括第二子模板,第二子模板是根据当前图像块左侧的一个候选图像块的运动矢量预测模式和运动信息确定的。When M is greater than 1, the above first template may include M sub-templates or P sub-templates, and is composed of M sub-templates or P sub-templates, where P is the number of first candidate image blocks in the inter mode; when M When equal to 1, 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 a candidate image block on the upper side of the current image block. When N is greater than 1, 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 a motion vector prediction mode and motion information of a candidate image block on the left side of the current image block.
在一个例子中,根据候选图像块的运动信息获取当前图像块的模板,还可以包括但不限于:当当前图像块对应多个运动信息时,获取每个运动信息对应的模板,获取每个运动信息对应的权重,并根据每个运动信息对应的权重以及该运动信息对应的模板获取当前图像块的模板。其中,当前图像块对应的运动信息可包括当前图像块的原始运动信息。In an example, acquiring a 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 each motion information and acquiring each motion The weight corresponding to the information, and obtain the template of the current image block according to the weight corresponding to each motion information and the template corresponding to the motion information. The motion information corresponding to the current image block may include original motion information of the current image block.
其中,实施例十二的处理过程与实施例二类似。The processing procedure of the twelfth embodiment is similar to that of the second embodiment.
实施例十三:Embodiment 13:
本实施例中,原始模式信息为当前图像块的原始运动矢量,目标模式信息为当前图像块的目标运动矢量。在此基础上,解码端可以获取当前图像块的原始运动矢量,并根据该原始运动矢量和获取的模板得到目标运动矢量,该目标运动矢量与该原始运动矢量不同。解码端根据该目标运动矢量对当前图像块进行解码。In this embodiment, the original mode information is the original motion vector of the current image block, and the target mode information is the target motion vector of the current image block. On this basis, the decoder can obtain the original motion vector of the current image block, and obtain a target motion vector according to the original motion vector and the obtained template, and the target motion vector is different from the original motion vector. The decoding end decodes the current image block according to the target motion vector.
例如,解码端将目标运动矢量确定为当前图像块的最终运动矢量,并利用当前图像块的最终运动矢量对当前图像块进行解码,对此解码过程不做限制。For example, the decoding end determines the target motion vector as the final motion vector of the current image block, and uses the final motion vector of the current image block to decode the current image block. There is no restriction on this decoding process.
其中,解码端根据该原始运动矢量和获取的模板得到目标运动矢量的处理过程,可以参见后续的实施例。For the process of obtaining the target motion vector by the decoder based on the original motion vector and the obtained template, refer to the subsequent embodiments.
在一个例子中,解码端获取当前图像块的原始运动矢量的过程,还可以包括:接收来自编码端的当前图像块对应的编码比特流,该编码比特流携带原始运动矢量的索引值;从运动矢量列表中选取与该索引值对应的运动矢量作为当前图像块的原始运动矢量。如索引值为1时,则获取运动矢量列表的第一个运动矢量作为当前图像块的原始运动矢量。其中,运动矢量列表用于记录与当前图像块相邻的图像块的运动矢量,解码端维护的运动矢量列表与编码端维护的运动矢量列表相同。当然,上述方式只是示例,如可以将当前图像块的候选图像块的运动矢量确定为当前图像块的原始运动矢量,或将默认运动矢量确定为原始运动矢量。In an example, the process of obtaining the original motion vector of the current image block by the decoding end may further include: receiving an encoded bit stream corresponding to the current image block from the encoding end, where the encoded bit stream carries the index value of the original motion vector; The motion vector corresponding to the index value is selected from the list as the original motion vector of the current image block. If the index value is 1, the first motion vector in the motion vector list is obtained as 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. Of course, the above manner is only an example. For example, the motion vector of the candidate image block of the current image block may be determined as the original motion vector of the current image block, or the default motion vector is determined as the original motion vector.
在一个例子中,解码端还可以从当前图像块对应的编码比特流中解析出第一指示信息或者第二指示信息。当编码比特流携带第一指示信息时,可以根据原始运动矢量和获取的模板得到当前图像块的目标运动矢量,并利用目标运动矢量对当前图像块进行解码;当编码比特流携带第二指示信息时,可以根据原始运动矢量对当前图像块进行解码。In one example, the decoding end may also parse the first indication information or the second indication information from the encoded bit stream corresponding to the current image block. When the encoded bitstream carries the first instruction information, the target motion vector of the current image block can be obtained according to the original motion vector and the obtained template, and the current image block is decoded by using the target motion vector; when the encoded bitstream carries the second instruction information At this time, the current image block can be decoded according to the original motion vector.
由以上可见,可以根据原始运动矢量获取目标运动矢量,并根据目标运动矢量确定当前图像块的最终运动矢量,而不是直接根据原始运动矢量确定当前图像块的最终运动矢量,从而可以有效提高运动矢量的精度,提高解码性能。而且,在根据原始运动矢量获取目标运动矢量时,可以根据候选图像块的运动信息获取当前图像块的模板,并基于当前图像块的模板和原始运动矢量获取目标运动矢量。由于上述方式可以快速得到当前图像块的模板,继而根据该模板得到目标运动矢量,可以有效提高解码效率,减少解码时延。例如,在解码的重建阶段之前,就可以获取当前图像块的模板,并根据模板得到目标运动矢量。As can be seen from the above, 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 effectively improving the motion vector. Accuracy, improving decoding performance. Furthermore, when acquiring a target motion vector according to the original motion vector, a template of the current image block may be acquired according to the motion information of the candidate image block, and a target motion vector may be acquired based on the template of the current image block and the original motion vector. Since the above method can quickly obtain a template of the current image block, and then obtain a target motion vector based on the template, it can effectively 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.
实施例十四:Embodiment 14:
在实施例十三的基础上,针对解码端根据原始运动矢量和获取的模板得到目标运动矢量的过程,其流程参见图5所示,可以包括:Based on the thirteenth embodiment, the process for the decoder to obtain the target motion vector according to the original motion vector and the obtained template. The process is shown in FIG. 5 and may include:
步骤501,解码端将原始运动矢量确定为中心运动矢量。Step 501: The decoding end determines the original motion vector as a central motion vector.
步骤502,解码端确定与该中心运动矢量对应的边缘运动矢量。其中,该边缘运动矢量可以与该中心运动矢量不同。Step 502: 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.
其中,确定与中心运动矢量对应的边缘运动矢量,可以包括:将中心运动矢量(x,y)向不同方向移动偏移量St,得到不同方向的边缘运动矢量(x-St,y)、(x+St,y)、(x,y+St)、(x,y-St)。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 St to obtain edge motion vectors (x-St, y) in different directions, ( x + St, y), (x, y + St), (x, y-St).
步骤503,解码端根据当前图像块的模板获得中心运动矢量的编码性能,并根据当前图像块的模板获得各个边缘运动矢量的编码性能。Step 503: The decoder obtains the coding performance of the central motion vector according to the template of the current image block, and obtains the coding performance of each 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. 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.
其中,解码端根据当前图像块的模板获得边缘运动矢量的编码性能,可以包括但不限于:解码端可以根据当前图像块的模板的参数信息和第二目标参考块的参数信息,确定边缘运动矢量的编码性能。其中,第二目标参考块为模板对应的参考图像块基于边缘运动矢量进行偏移之后获得的图像块。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. 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.
步骤504,解码端根据中心运动矢量的编码性能和各个边缘运动矢量的编码性能,从中心运动矢量和边缘运动矢量中确定目标运动矢量。Step 504: 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 coding performance of each edge motion vector.
具体的,解码端可以从中心运动矢量和边缘运动矢量中选择编码性能最优的运动矢量。当该编码性能最优的运动矢量不是原始运动矢量时,可以将该编码性能最优的运动矢量确定为目标运动矢量。当该编码性能最优的运动矢量是原始运动矢量时,可以从中心运动矢量和边缘运动矢量中选择编码性能次优的运动矢量作为目标运动矢量。Specifically, the decoding end may select a motion vector with the best coding performance from the center motion vector and the edge motion vector. When the motion vector with the best coding performance is not the original motion vector, the motion vector with the best coding performance can be determined as the target motion vector. When the motion vector with the best coding performance is the original motion vector, a motion vector with the second best coding performance can be selected from the center motion vector and the edge motion vector as the target motion vector.
步骤501-步骤504的详细处理流程,可以参见实施例四,只是执行主体从编码端变更为解码端,其它处理流程相同。For the detailed processing flow of steps 501 to 504, refer to Embodiment 4, except that the execution body is changed from the encoding end to the decoding end, and other processing flows are the same.
针对解码端根据原始运动矢量和获取的模板得到目标运动矢量,还可以采用实 施例五,只是执行主体从编码端变为解码端。For the decoding end to obtain the target motion vector according to the original motion vector and the obtained template, Embodiment 5 can also be adopted, but the execution subject is changed from the encoding end to the decoding end.
实施例十五:Embodiment fifteen:
本实施例中,原始模式信息为当前图像块的原始运动矢量和原始参考帧,目标模式信息为当前图像块的目标运动矢量和目标参考帧。基于此,解码端可以获取当前图像块的原始运动矢量和原始参考帧,基于当前图像块的模板、原始运动矢量和原始参考帧,得到当前图像块的目标运动矢量(目标运动矢量可以与原始运动矢量不同)和目标参考帧,并根据该目标运动矢量和目标参考帧对当前图像块进行解码。In this embodiment, the original mode information is the original motion vector and the original reference frame of the current image block, and the target mode information is the target motion vector and the target reference frame of the current image block. Based on this, the decoder can obtain the original motion vector and original reference frame of the current image block, and obtain the target motion vector of the current image block based on the template, original motion vector, and original reference frame of the current image block (the target motion vector can be compared with the original motion Vector is different) and the target reference frame, and the current image block is decoded according to the target motion vector and the target reference frame.
其中,解码端基于当前图像块的模板、原始运动矢量和原始参考帧,得到当前图像块的目标运动矢量和目标参考帧,可以包括但不限于:基于当前图像块的模板和原始运动矢量获取该原始参考帧的候选运动矢量;根据该原始运动矢量获取各个候选参考帧的初始运动矢量;根据候选参考帧的初始运动矢量获取候选参考帧的候选运动矢量;然后,可以从原始参考帧的候选运动矢量以及各个候选参考帧的候选运动矢量中选择编码性能最优的候选运动矢量作为目标运动矢量,将目标运动矢量对应的参考帧确定为目标参考帧。The decoding end obtains the target motion vector and the target reference frame of the current image block based on the template, the original motion vector, and the original reference frame of the current image block, which may include, but is not limited to, obtaining the target image based on the template and the original motion vector of the current image block. Candidate motion vector of the original reference frame; Get the initial motion vector of each candidate reference frame according to the original motion vector; Get the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame; Then, the candidate motion of the original reference frame can be obtained Among the vectors and candidate motion vectors of each candidate reference frame, a candidate motion vector with the best coding performance is selected as the target motion vector, and a reference frame corresponding to the target motion vector is determined as the target reference frame.
其中,根据原始运动矢量获取候选参考帧的初始运动矢量,可以包括但不限于:根据当前图像块所在帧与原始参考帧的距离、当前图像块所在帧与该候选参考帧的距离和原始运动矢量,获取该候选参考帧的初始运动矢量。The initial motion vector of the candidate reference frame according to the original motion vector may include, but is not limited to, the distance between the frame where the current image block is located and the original reference frame, the distance between the frame where the current image block is located and the candidate reference frame, and the original motion vector. To obtain the initial motion vector of the candidate reference frame.
在一个例子中,基于当前图像块的模板和原始运动矢量获取该原始参考帧的候选运动矢量,可以包括但不限于:将该原始运动矢量确定为中心运动矢量,并确定与该中心运动矢量对应的边缘运动矢量,该边缘运动矢量与该中心运动矢量不同;然后,根据当前图像块的模板获得该中心运动矢量的编码性能,并根据当前图像块的模板获得该各个边缘运动矢量的编码性能;然后,可以根据该中心运动矢量的编码性能和各个边缘运动矢量的编码性能,从该中心运动矢量和边缘运动矢量中确定原始参考帧的候选运动矢量。In an example, obtaining a candidate motion vector of the original reference frame based on a template of the current image block and the original motion vector may include, but is not limited to, determining the original motion vector as a central motion vector and determining that the central motion vector corresponds to the central motion vector. The edge motion vector is different from the center motion vector; then, obtain the encoding performance of the center motion vector according to the template of the current image block, and obtain the encoding performance of each edge motion vector according to the template of the current image block; Then, according to the coding performance of the central motion vector and the coding performance of each edge motion vector, a candidate motion vector of the original reference frame may be determined from the central motion vector and the edge motion vector.
在一个例子中,根据候选参考帧的初始运动矢量获取候选参考帧的候选运动矢量,可以包括但不限于:将所述候选参考帧的初始运动矢量确定为中心运动矢量,并确定与该中心运动矢量对应的边缘运动矢量,该边缘运动矢量与中心运动矢量不同;根据当前图像块的模板获得中心运动矢量的编码性能和各个边缘运动矢量的编码性能;根据中心运动矢量的编码性能和各个边缘运动矢量的编码性能,从中心运动矢量和边缘运动矢量中确定候选参考帧的候选运动矢量。In one example, obtaining the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame may include, but is not limited to, determining the initial motion vector of the candidate reference frame as a center motion vector, and determining a motion with the center. Vector corresponding edge motion vector, which is different from the center motion vector; obtain the coding performance of the center motion vector and the coding performance of each edge motion vector according to the template of the current image block; according to the coding performance of the center motion vector and each edge motion The coding performance of the vector is to determine the candidate motion vector of the candidate reference frame from the center motion vector and the edge motion vector.
其中,针对实施例十五的详细实现流程,可以参见上述实施例七和实施例八,只是执行主体从编码端变为解码端。For the detailed implementation process of the fifteenth embodiment, reference may be made to the foregoing seventh embodiment and the eighth embodiment, but the execution subject is changed from the encoding end to the decoding end.
实施例十六:Embodiment Sixteen:
本实施例中,原始模式信息可以为原始预测图像块,目标模式信息可以为目标预测图像块。基于此,解码端可以获取当前图像块的原始预测图像块,基于当前图像块的模板和原始预测图像块获取当前图像块的目标预测图像块,并根据该目标预测图像块对当前图像块进行解码。In this embodiment, the original mode information may be an original prediction image block, and the target mode information may be a target prediction image block. Based on this, the decoder can obtain the original predicted image block of the current image block, obtain the target predicted image block of the current image block based on the template of the current image block and the original predicted image block, and decode the current image block according to the target predicted image block .
其中,解码端基于当前图像块的模板和原始预测图像块获取当前图像块的目标预测图像块,可以包括但不限于:解码端根据当前图像块的模板和该模板对应的参考块,获取变换系数;然后,根据该变换系数对原始预测图像块进行光照补偿,得到当前图像块的目标预测图像块。The decoding end obtains the target predicted image block of the current image block based on the template of the current image block and the original predicted image block, which may include, but is not limited to, the decoding end obtains the transformation coefficient according to the template of the current image block and the reference block corresponding to the template. ; Then, perform illumination compensation on the original predicted image block according to the transform coefficient to obtain the target predicted image block of the current image block.
在一个例子中,在解码端根据当前图像块的模板和该模板对应的参考块,获取变换系数之前,解码端还可以获取当前图像块的运动矢量和该运动矢量对应的参考帧索引;然后,根据当前图像块的运动矢量和该参考帧索引获得模板对应的参考块。In one example, before the decoding end obtains the transform coefficient according to the template of the current image block and the reference block corresponding to the template, the decoding end may also obtain the motion vector of the current image block and the reference frame index corresponding to the motion vector; then, A reference block corresponding to the template is obtained according to the motion vector of the current image block and the reference frame index.
在一个例子中,解码端根据当前图像块的模板和该模板对应的参考块,获取变换系数,可以包括但不限于:根据当前图像块的模板的各像素的参数信息、该模板对应的参考块的各像素的参数信息,获取变换系数。其中,参数信息可以包括亮度值。In one example, the decoding end obtains the transformation coefficient according to the template of the current image block and the reference block corresponding to the template, which may include but is not limited to: according to parameter information of each pixel of the template of the current image block, and the reference block corresponding to the template The parameter information of each pixel is used to obtain the transformation coefficient. The parameter information may include a brightness value.
其中,针对实施例十六的详细实现流程,可以参见上述实施例九和实施例十,只是执行主体从编码端变为解码端。For the detailed implementation process of the sixteenth embodiment, reference may be made to the ninth embodiment and the tenth embodiment described above, but the execution body is changed from the encoding end to the decoding end.
实施例十七:Embodiment 17:
基于与上述方法同样的申请构思,本申请实施例还提出一种解码装置,应用于解码端,如图6所示,为所述装置的结构图,所述装置包括:获取模块61,用于获取当前图像块的候选图像块的运动信息,并根据所述候选图像块的运动信息获取所述当前图像块的模板;解码模块62,用于根据所述当前图像块的所述模板对当前图像块进行解码。Based on the same application concept as the above method, an embodiment of the present application further provides a decoding device, which is applied to the decoding end. As shown in FIG. 6, it is a structural diagram of the device. The device includes: an obtaining module 61, configured to: Acquiring motion information of a candidate image block of the current image block, and acquiring a template of the current image block according to the motion information of the candidate image block; a decoding module 62, configured to perform current analysis on the current image according to the template of the current image block The block is decoded.
所述解码模块62根据所述当前图像块的所述模板对当前图像块进行解码时具体用于:获取所述当前图像块的原始模式信息;基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的目标模式信息;根据所述目标模式信息对所述当前图像块进行解码。When the decoding module 62 decodes the current image block according to the template of the current image block, the decoding module 62 is specifically configured to: obtain original mode information of the current image block; based on the template and the current image block The original mode information acquires target mode information of the current image block; and decodes the current image block according to the target mode information.
所述解码装置还包括接收模块,用于接收来自编码端的当前图像块对应的编码比特流。若所述编码比特流携带第一指示信息,所述第一指示信息用于指示基于所述当前图像块的模板和所述原始模式信息获取所述当前图像块的目标模式信息,则所述获取模块61还用于根据所述第一指示信息,获取当前图像块的候选图像块的运动信息,并根据所述候选图像块的运动信息获取所述当前图像块的模板。The decoding device further includes a receiving module for receiving an encoded bit stream corresponding to a current image block from an encoding end. If the encoded bitstream carries first indication information, the first indication information is used to instruct to obtain target mode information of the current image block based on the template of the current image block and the original mode information, the obtaining The module 61 is further configured to acquire motion information of a candidate image block of the current image block according to the first instruction information, and acquire a template of the current image block according to the motion information of the candidate image block.
若所述编码比特流携带第二指示信息,所述第二指示信息用于指示基于所述原始模式信息对当前图像块进行解码,则所述解码模块62还用于根据所述第二指示信息,获取所述原始模式信息,并基于所述原始模式信息对所述当前图像块进行解码。If the encoded bitstream carries second indication information, the second indication information is used to instruct the current image block to be decoded based on the original mode information, the decoding module 62 is further configured to use the second indication information according to the second indication information. To obtain the original mode information, and decode the current image block based on the original mode information.
所述获取模块61还用于根据本地预设的第一策略信息,获取当前图像块的候选图像块的运动信息,并根据所述候选图像块的运动信息获取所述当前图像块的所述模板。其中,所述第一策略信息用于指示基于所述当前图像块的模板和所述原始模式信息获取所述当前图像块的目标模式信息。The obtaining module 61 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 policy information is used to instruct to obtain target mode information of the current image block based on a template of the current image block and the original mode information.
所述解码模块62还用于根据本地预设的第二策略信息,获取所述原始模式信息,并基于所述原始模式信息对所述当前图像块进行解码。其中,所述第二策略信息用于指示基于所述原始模式信息对当前图像块进行解码。The decoding module 62 is further configured to obtain the original mode information according to the locally preset second policy information, and decode the current image block based on the original mode information. The second policy information is used to instruct to decode a current image block based on the original mode information.
所述解码模块62还用于根据本地预设的第三策略信息对所述当前图像块进行解码。其中,所述第三策略信息为采用与当前图像块的候选图像块相同的策略信息。The decoding module 62 is further configured to decode the current image block according to the locally preset third policy information. The third policy information is the same policy information as the candidate image block of the current image block.
若所述原始模式信息为所述当前图像块的原始运动矢量,所述目标模式信息为所述当前图像块的目标运动矢量,则所述解码模块62基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的目标模式信息时具体用于:将所述原始运动矢量确定为中心运动矢量;确定与所述中心运动矢量对应的边缘运动矢量,所述边缘运动矢量与所述中心运动矢量不同;根据所述模板获得所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能;根据所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能,从所述中心运动矢量和各个所述边缘运动矢量中确定所述目标运动矢量。If the original mode information is the original motion vector of the current image block, and the target mode information is the target motion vector of the current image block, the decoding module 62 is based on the template and The obtaining of the target mode information of the current image block by the original mode information is specifically used to determine the original motion vector as a central motion vector; determine an edge motion vector corresponding to the central motion vector, and the edge motion vector Different from the central motion vector; obtaining the coding performance of the central motion vector and the coding performance of each of the edge motion vectors according to the template; the coding performance of the central motion vector and the coding of each of the edge motion vectors according to the template Performance, determining the target motion vector from the center motion vector and each of the edge motion vectors.
若所述原始模式信息为所述当前图像块的原始运动矢量和原始参考帧,所述目标模式信息为所述当前图像块的目标运动矢量和目标参考帧,则所述解码模块62基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的目标模式信息时具体用于:基于所述当前图像块的所述模板和所述原始运动矢量获取所述原始参考帧的候选运动矢量;根据所述原始运动矢量获取各个候选参考帧的初始运动矢量;根据所述候选参考帧的初始运动矢量获取所述候选参考帧的候选运动矢量;从所述原始参考帧的候选运动矢量以及各个所述候选参考帧的候选运动矢量中选择编码性能最优的候选运动矢量作为所述目标运动矢量,并将所述目标运动矢量对应的参考帧确定为所述目标参考帧。If the original mode information is the original motion vector and the original reference frame of the current image block, and the target mode information is the target motion vector and the target reference frame of the current image block, the decoding module 62 is based on the When obtaining the target mode information of the current image block by using the template and the original mode information of the current image block, the method is specifically configured to obtain the original reference frame based on the template of the current image block and the original motion vector. The candidate motion vector of the candidate; obtain the initial motion vector of each candidate reference frame according to the original motion vector; obtain the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame; Among the motion vectors and the candidate motion vectors of each of the candidate reference frames, a candidate motion vector with the best coding performance is selected as the target motion vector, and a reference frame corresponding to the target motion vector is determined as the target reference frame.
所述解码模块62根据所述原始运动矢量获取候选参考帧的初始运动矢量时具体用于:根据当前图像块所在帧与所述原始参考帧的距离、当前图像块所在帧与所述候选参考帧的距离和所述原始运动矢量,获取所述候选参考帧的所述初始运动矢量。When the decoding module 62 obtains an initial motion vector of a candidate reference frame according to the original motion vector, the decoding module 62 is specifically configured to: according to a distance between a frame where the current image block is located and the original reference frame, a frame where the current image block is located, and the candidate reference frame And the original motion vector to obtain the initial motion vector of the candidate reference frame.
所述解码模块62基于所述当前图像块的所述模板和所述原始运动矢量获取所述原始参考帧的候选运动矢量时具体用于:将所述原始运动矢量确定为中心运动矢量;确定与所述中心运动矢量对应的边缘运动矢量,所述边缘运动矢量与所述中心运动矢量不同;根据所述模板获得所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能;根据所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述原始参考帧的候选运动矢量。When the decoding module 62 obtains the candidate motion vector of the original reference frame based on the template of the current image block and the original motion vector, the decoding module 62 is specifically configured to: determine the original motion vector as a center motion vector; 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 each of the edge motion vectors according to the template; The coding performance of the central motion vector and the coding performance of each of the edge motion vectors are described, and a candidate motion vector of the original reference frame is determined from the central motion vector and the edge motion vector.
所述解码模块62根据所述初始运动矢量获取所述候选参考帧的候选运动矢量时具体用于:将所述候选参考帧的初始运动矢量确定为中心运动矢量;确定与所述中心运动矢量对应的边缘运动矢量;所述边缘运动矢量与所述中心运动矢量不同;根据所述模板获得所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能;根据所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述候选参考帧对应的所述候选运动矢量。When the decoding module 62 obtains the candidate motion vector of the candidate reference frame according to the initial motion vector, the decoding module 62 is specifically configured to: determine the initial motion vector of the candidate reference frame as a central motion vector; and determine that the initial motion vector corresponds to the central motion vector. The edge motion vector is different from the center motion vector; obtains the encoding performance of the center motion vector and the encoding performance of each of the edge motion vectors according to the template; and the encoding according to the center motion vector Performance and coding performance of each of the edge motion vectors, and determining the candidate motion vector corresponding to the candidate reference frame from the center motion vector and the edge motion vector.
若所述原始模式信息为原始预测图像块,所述目标模式信息为目标预测图像块,则所述解码模块62基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的目标模式信息时具体用于:根据所述模板和所述模板对应的参考块,获取变换系数;根据所述变换系数对所述原始预测图像块进行光照补偿,得到所述目标预测图像 块。If the original mode information is an original prediction image block and the target mode information is a target prediction image block, the decoding module 62 acquires the current image based on the template of the current image block and the original mode information The target mode information of the block is specifically used to: obtain a transform coefficient according to the template and a reference block corresponding to the template; perform illumination compensation on the original predicted image block according to the transform coefficient to obtain the target predicted image block .
所述解码模块62还用于:获取当前图像块的运动矢量和所述运动矢量对应的参考帧索引;根据所述当前图像块的所述运动矢量和所述参考帧索引获得所述模板对应的参考块。The decoding module 62 is further configured to: obtain a motion vector of the current image block and a reference frame index corresponding to the motion vector; and obtain a corresponding one of the templates according to the motion vector of the current image block and the reference frame index. Reference block.
所述解码模块62根据所述模板和所述模板对应的参考块,获取所述变换系数时具体用于:根据所述模板的各像素的参数信息、所述模板对应的参考块的各像素的参数信息,获取所述变换系数。其中,所述参数信息包括亮度值。The decoding module 62 obtains the transform coefficients according to the template and the reference block corresponding to the template, and is specifically configured to: according to parameter information of each pixel of the template, and each pixel of the reference block corresponding to the template. Parameter information to obtain the transformation coefficient. The parameter information includes a brightness value.
在一个例子中,所述候选图像块包括M个第一候选图像块和N个第二候选图像块,M为大于或等于1的自然数,N为大于或等于0的自然数,或者,M为大于或等于0的自然数,N为大于或等于1的自然数;所述第一候选图像块为所述当前图像块上侧的候选图像块,所述第二候选图像块为所述当前图像块左侧的候选图像块;所述获取模块61根据所述候选图像块的运动信息获取所述当前图像块的模板时具体用于:根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板;根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板;将所述第一模板确定为所述当前图像块的模板,或者,将所述第二模板确定为所述当前图像块的模板,或者,将所述第一模板和所述第二模板拼接之后确定为所述当前图像块的模板。In one example, the candidate image blocks 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 of 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 the left side of the current image block When obtaining the template of the current image block according to the motion information of the candidate image block, the obtaining module 61 is specifically configured to determine the motion vector prediction mode and motion information of the M first candidate image blocks A first template; determining a second template according to a motion vector prediction mode and motion information of N second candidate image blocks; determining the first template as a template of the current image block, or determining the second template Determine the template of the current image block, or determine the template of the current image block after stitching the first template and the second template.
在一个例子中,所述第一候选图像块包括所述当前图像块上侧的相邻图像块和/或次邻图像块;所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式;所述第二候选图像块包括所述当前图像块左侧的相邻图像块和/或次邻图像块。其中,所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式。In an example, 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 on the left side of the current image block and / or a second neighboring image block. The prediction mode of the adjacent image block is an inter mode or an intra mode; the prediction mode of the next adjacent image block is an inter mode.
当所述M大于1时,所述第一模板包括M个子模板或者P个子模板,且由所述M个子模板或所述P个子模板拼接而成,所述P为帧间模式的第一候选图像块的数量;当M等于1时,所述第一模板包括第一子模板,所述第一子模板是根据所述当前图像块上侧的一个候选图像块的运动矢量预测模式和运动信息确定的。When M is greater than 1, the first template includes M sub-templates or P sub-templates, and is formed by splicing the M sub-templates or P sub-templates, where P is the first candidate for the inter-frame mode The number of image blocks; when M is equal to 1, the first template includes a first sub-template, and the first sub-template is based on a motion vector prediction mode and motion information of a candidate image block above the current image block definite.
在一个例子中,所述运动信息包括所述第一候选图像块的运动矢量和参考帧索引,所述获取模块61根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板时具体用于:针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,根据所述参考帧索引确定所述第i个候选图像块的参考帧图像;根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块的运动矢量相匹配;根据所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板。In an example, the motion information includes a motion vector and a reference frame index of the first candidate image block, and the obtaining module 61 determines the first according to the motion vector prediction mode and motion information of the M first candidate image blocks. The template is specifically used for: 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, according to the reference A frame index determines a reference frame image of the i-th candidate image block; and determining a reference image block of the i-th candidate image block from the reference frame image according to a motion vector of the i-th candidate image block, The relative displacement between the reference image block and the i-th candidate image block matches the motion vector of the i-th candidate image block; according to the reference image block, the size is obtained as a first horizontal length and a first vertical The image block of length is used as the ith sub-template included in the first template.
所述获取模块61根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板时具体用于:针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,将所述第i个候选图像块按照默认值填充,并获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模 板包括的第i个子模板。或者,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块对应的运动矢量相匹配;根据所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板。其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。The obtaining module 61 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 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 filled with a default value, and an image with a size of a first horizontal length and a first vertical length is obtained The block serves as an ith sub-template included in the first template. Alternatively, when it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode, a reference frame corresponding to the i-th candidate image block is determined according to a reference frame index corresponding to the i-th candidate image block An image; determining a reference image block corresponding to the i-th candidate image block from the reference frame image according to a motion vector corresponding to the i-th candidate image block, the reference image block and the i-th candidate image block The relative displacement of the image block matches the motion vector corresponding to the i-th candidate image block; and according to the reference image block, obtaining an image block with a size of a first horizontal length and a first vertical length as the first template includes: I-th child template. The reference frame index and motion vector corresponding to the i-th candidate image block are reference frame indexes 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, 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.
当所述N大于1时,所述第二模板包括N个子模板或者R个子模板,且由所述N个子模板或所述R个子模板拼接而成,所述R为帧间模式的第二候选图像块的数量;当N等于1时,所述第二模板包括第二子模板,所述第二子模板是根据所述当前图像块左侧的一个候选图像块的运动矢量预测模式和运动信息确定的。When N is greater than 1, the second template includes N sub-templates or R sub-templates, and is formed by splicing the N sub-templates or R sub-templates, and R is the second candidate of the inter-frame mode. The number of image blocks; when N is equal to 1, the second template includes a second sub-template that is based on a motion vector prediction mode and motion information of a candidate image block to the left of the current image block definite.
在一个例子中,所述运动信息包括所述第二候选图像块的运动矢量和参考帧索引,所述获取模块61根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板时具体用于:针对所述N个第二候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,根据所述参考帧索引确定所述第i个候选图像块的参考帧图像;根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块的运动矢量相匹配;根据所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板。In an example, the motion information includes a motion vector and a reference frame index of the second candidate image block, and the acquisition module 61 determines a second vector based on the motion vector prediction mode and motion information of the N second candidate image blocks. The template is specifically used for: 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 ith candidate image block is an inter mode, according to the reference A frame index determines a reference frame image of the i-th candidate image block; and determining a reference image block of the i-th candidate image block from the reference frame image according to a motion vector of the i-th candidate image block, The relative displacement between the reference image block and the i-th candidate image block matches the motion vector of the i-th candidate image block; according to the reference image block, the size is obtained as a second horizontal length and a second vertical The image block of length is used as the ith sub-template included in the second template.
所述获取模块61根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板时具体用于:针对所述N个第二候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,将所述第i个候选图像块按照默认值填充,并获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板。或者,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块对应的运动矢量相匹配;根据确定的所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第一模板包括的第i个子模板。其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。The obtaining module 61 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 The block serves as an ith sub-template included in the second template. Alternatively, when it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode, a reference frame corresponding to the i-th candidate image block is determined according to a reference frame index corresponding to the i-th candidate image block An image; determining a reference image block corresponding to the i-th candidate image block from the reference frame image according to a motion vector corresponding to the i-th candidate image block, the reference image block and the i-th candidate image block The relative displacement of the image block matches the motion vector corresponding to the i-th candidate image block; according to the determined reference image block, an image block having a second horizontal length and a second vertical length is obtained as the first The template includes the i-th child template. The reference frame index and motion vector corresponding to the i-th candidate image block are reference frame indexes 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, or the horizontal length of the current image block satisfies a sixth proportional relationship, or is equal to a third preset length; The two vertical lengths satisfy a seventh proportional relationship with the vertical length of the second candidate image block, or satisfy an eighth proportional relationship with the vertical length of the current image block, or are equal to a fourth preset length.
所述获取模块61根据所述候选图像块的运动信息获取所述当前图像块的模板时具体用于:当所述当前图像块对应多个运动信息时,获取每个运动信息对应的模板,获取每个运动信息对应的权重,并根据每个运动信息对应的权重和所述运动信息对应的模板获取所述当前图像块的模板。The acquiring module 61 is specifically configured to acquire a template of the current image block according to the motion information of the candidate image block: when the current image block corresponds to multiple motion information, acquire a template corresponding to each motion information, and acquire 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 a template corresponding to the motion information.
基于与上述方法同样的申请构思,本申请实施例还提出一种编码装置,应用于编码端,如图7所示,为所述装置的结构图,所述装置包括:Based on the same application concept as the above method, an embodiment of the present application further proposes an encoding device, which is applied to the encoding end. As shown in FIG. 7, it is a structural diagram of the device. The device includes:
获取模块71,用于获取当前图像块的候选图像块的运动信息,并根据所述候选图像块的运动信息获取所述当前图像块的模板;编码模块72,用于根据所述当前图像块的所述模板对当前图像块进行编码,得到当前图像块对应的编码比特流;发送模块73,用于将所述编码比特流发送给解码端。An obtaining module 71 is configured to obtain motion information of a candidate image block of the current image block, and obtain a template of the current image block according to the motion information of the candidate image block; an encoding module 72 is configured to obtain a template according to the current image block. The template encodes the current image block to obtain an encoded bit stream corresponding to the current image block; and a sending module 73 is configured to send the encoded bit stream to a decoding end.
所述编码模块72根据所述当前图像块的所述模板对当前图像块进行编码,得到当前图像块对应的编码比特流时具体用于:获取所述当前图像块的原始模式信息;基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的目标模式信息;根据所述目标模式信息对当前图像块进行编码,得到当前图像块对应的编码比特流。The encoding module 72 encodes the current image block according to the template of the current image block to obtain an encoded bit stream corresponding to the current image block, and is specifically configured to: obtain original mode information of the current image block; based on the Obtaining the target mode information of the current image block by using the template and the original mode information of the current image block; encoding the current image block according to the target mode information to obtain an encoded bit stream corresponding to the current image block.
当根据所述目标模式信息对当前图像块进行编码时,所述发送模块73向解码端发送的当前图像块对应的编码比特流携带第一指示信息,所述第一指示信息用于指示基于所述当前图像块的模板和所述原始模式信息获取所述当前图像块的目标模式信息。When the current image block is encoded according to the target mode information, the sending module 73 carries the first instruction information to the encoded bit stream corresponding to the current image block sent by the decoding end, where the first instruction information is used to indicate The template of the current image block and the original mode information obtain target mode information of the current image block.
当根据所述原始模式信息对当前图像块进行编码时,所述发送模块73向解码端发送的当前图像块对应的编码比特流携带第二指示信息,所述第二指示信息用于指示基于所述原始模式信息对当前图像块进行解码。When the current image block is encoded according to the original mode information, the sending module 73 carries second instruction information to the encoded bit stream corresponding to the current image block sent by the decoding end, where the second instruction information is used to indicate The original mode information is used to decode the current image block.
若所述原始模式信息为所述当前图像块的原始运动矢量,所述目标模式信息为所述当前图像块的目标运动矢量,则所述编码模块72基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的目标模式信息时具体用于:将所述原始运动矢量确定为中心运动矢量;确定与所述中心运动矢量对应的边缘运动矢量,所述边缘运动矢量与所述中心运动矢量不同;根据所述模板获得所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能;根据所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量。If the original mode information is the original motion vector of the current image block, and the target mode information is the target motion vector of the current image block, the encoding module 72 is based on the template and The obtaining of the target mode information of the current image block by the original mode information is specifically used to determine the original motion vector as a central motion vector; determine an edge motion vector corresponding to the central motion vector, and the edge motion vector Different from the central motion vector; obtaining the coding performance of the central motion vector and the coding performance of each of the edge motion vectors according to the template; the coding performance of the central motion vector and the coding of each of the edge motion vectors according to the template Performance, determining the target motion vector from the center motion vector and the edge motion vector.
若所述原始模式信息为所述当前图像块的原始运动矢量和原始参考帧,所述目标模式信息为所述当前图像块的目标运动矢量和目标参考帧,则所述编码模块72基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的目标模式信息时具体用于:基于所述当前图像块的所述模板和所述原始运动矢量获取所述原始参考帧的候选运动矢量;根据所述原始运动矢量获取各个候选参考帧的初始运动矢量;根据所述候选参考帧的初始运动矢量获取所述候选参考帧的候选运动矢量;从所述原始参考帧的候选运动矢量以及各个所述候选参考帧各自的候选运动矢量中选择编码性能最优的 候选运动矢量作为所述目标运动矢量,将所述目标运动矢量对应的参考帧确定为所述目标参考帧。If the original mode information is the original motion vector and the original reference frame of the current image block, and the target mode information is the target motion vector and the target reference frame of the current image block, the encoding module 72 is based on the When obtaining the target mode information of the current image block by using the template and the original mode information of the current image block, the method is specifically configured to obtain the original reference frame based on the template of the current image block and the original motion vector. The candidate motion vector of the candidate; obtain the initial motion vector of each candidate reference frame according to the original motion vector; obtain the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame; A candidate motion vector with the best coding performance is selected from the motion vectors and the candidate motion vectors of each of the candidate reference frames as the target motion vector, and a reference frame corresponding to the target motion vector is determined as the target reference frame.
所述编码模块72根据所述原始运动矢量获取各个候选参考帧的初始运动矢量时具体用于:根据当前图像块所在帧与所述原始参考帧的距离、当前图像块所在帧与所述候选参考帧的距离和所述原始运动矢量,获取所述候选参考帧的所述初始运动矢量。When the encoding module 72 obtains the initial motion vector of each candidate reference frame according to the original motion vector, the encoding module 72 is specifically configured to: according to the distance between the frame where the current image block is located and the original reference frame, the frame where the current image block is located, and the candidate reference The distance of the frame and the original motion vector are used to obtain the initial motion vector of the candidate reference frame.
所述编码模块72基于所述当前图像块的所述模板和所述原始运动矢量获取所述原始参考帧的候选运动矢量时具体用于:将所述原始运动矢量确定为中心运动矢量;确定与所述中心运动矢量对应的边缘运动矢量,所述边缘运动矢量与所述中心运动矢量不同;根据所述模板获得所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能;根据所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述原始参考帧的候选运动矢量。When the encoding module 72 obtains the candidate motion vector of the original reference frame based on the template of the current image block and the original motion vector, the encoding module 72 is specifically configured to: determine the original motion vector as a center motion vector; 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 each of the edge motion vectors according to the template; The coding performance of the central motion vector and the coding performance of each of the edge motion vectors are described, and a candidate motion vector of the original reference frame is determined from the central motion vector and the edge motion vector.
所述编码模块72根据所述候选参考帧的初始运动矢量获取所述候选参考帧的候选运动矢量时具体用于:将所述候选参考帧的初始运动矢量确定为中心运动矢量;确定与所述中心运动矢量对应的边缘运动矢量;所述边缘运动矢量与所述中心运动矢量不同;根据所述模板获得所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能;根据所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述候选参考帧对应的所述候选运动矢量。When the encoding module 72 obtains the candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame, the encoding module 72 is specifically configured to: determine the initial motion vector of the candidate reference frame as a central motion vector; The edge motion vector corresponding to the central motion vector; the edge motion vector is different from the central motion vector; obtaining the encoding performance of the central motion vector and the encoding performance of each of the edge motion vectors according to the template; according to the center The coding performance of a motion vector and the coding performance of each of the edge motion vectors are determined from the center motion vector and the edge motion vector, and the candidate motion vector corresponding to the candidate reference frame.
若所述原始模式信息为原始预测图像块,所述目标模式信息为目标预测图像块,则所述编码模块72基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的目标模式信息时具体用于:根据所述模板和所述模板对应的参考块,获取变换系数;根据所述变换系数对所述原始预测图像块进行光照补偿,得到所述目标预测图像块。If the original mode information is an original predicted image block and the target mode information is a target predicted image block, the encoding module 72 obtains the current image based on the template of the current image block and the original mode information The target mode information of the block is specifically used to: obtain a transform coefficient according to the template and a reference block corresponding to the template; perform illumination compensation on the original predicted image block according to the transform coefficient to obtain the target predicted image block .
所述编码模块72还用于:获取当前图像块的运动矢量和所述运动矢量对应的参考帧索引;根据所述当前图像块的所述运动矢量和所述参考帧索引获得所述模板对应的参考块。The encoding module 72 is further configured to: obtain a motion vector of the current image block and a reference frame index corresponding to the motion vector; and obtain a corresponding one of the templates according to the motion vector of the current image block and the reference frame index. Reference block.
所述编码模块72根据所述模板和所述模板对应的参考块,获取所述变换系数时具体用于:根据所述模板的各像素的参数信息、所述模板对应的参考块的各像素的参数信息,获取所述变换系数。其中,所述参数信息包括亮度值。The encoding module 72 obtains the transform coefficients according to the template and the reference block corresponding to the template, and is specifically configured to: according to parameter information of each pixel of the template and each pixel of the reference block corresponding to the template. Parameter information to obtain the transformation coefficient. The parameter information includes a brightness value.
所述候选图像块包括M个第一候选图像块和N个第二候选图像块,M为大于或等于1的自然数,N为大于或等于0的自然数,或者,M为大于或等于0的自然数,N为大于或等于1的自然数。所述第一候选图像块为所述当前图像块上侧的候选图像块,所述第二候选图像块为所述当前图像块左侧的候选图像块。所述获取模块71根据所述候选图像块的运动信息获取所述当前图像块的模板时具体用于:根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板;根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板;将所述第一模板确定为所述当前图像块的模板,或者将所述第二模板确定为所述当前图像块的模板,或者将所述第一模板和所述第二模板拼接之后确定为所述当前图像块的模板。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. When the obtaining module 71 obtains a template of the current image block according to the motion information of the candidate 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 image A template of the block, or a template of the current image block determined after stitching the first template and the second template.
在一个例子中,所述第一候选图像块包括所述当前图像块上侧的相邻图像块和/或次邻图像块;所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式;所述第二候选图像块包括所述当前图像块左侧的相邻图像块和/或次邻图像块。其中,所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式。In an example, 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 on the left side of the current image block and / or a second neighboring image block. The prediction mode of the adjacent image block is an inter mode or an intra mode; the prediction mode of the next adjacent image block is an inter mode.
当所述M大于1时,所述第一模板包括M个子模板或者P个子模板,且由所述M个子模板或所述P个子模板拼接而成,所述P为帧间模式的第一候选图像块的数量;当M等于1时,所述第一模板包括第一子模板,所述第一子模板是根据所述当前图像块上侧的一个候选图像块的运动矢量预测模式和运动信息确定的。When M is greater than 1, the first template includes M sub-templates or P sub-templates, and is formed by splicing the M sub-templates or P sub-templates, where P is the first candidate for the inter-frame mode The number of image blocks; when M is equal to 1, the first template includes a first sub-template, and the first sub-template is based on a motion vector prediction mode and motion information of a candidate image block above the current image block definite.
所述运动信息包括所述第一候选图像块的运动矢量和参考帧索引,所述获取模块71根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板时具体用于:针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,根据所述参考帧索引确定所述第i个候选图像块的参考帧图像;根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块的运动矢量相匹配;根据所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板。The motion information includes a motion vector and a reference frame index of the first candidate image block, and 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 of the i-th candidate image block; and determining a reference image block of 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 image block The relative displacement with the i-th candidate image block matches the motion vector of the i-th candidate image block; according to the reference image block, an image block having a size of a first horizontal length and a first vertical length is obtained as The first template includes an i-th sub-template.
所述获取模块71根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板时具体用于:针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,将所述第i个候选图像块按照默认值填充,并获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板。或者,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块对应的运动矢量相匹配;根据所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板。其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。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 The block serves as an ith sub-template included in the first template. Alternatively, when it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode, a reference frame corresponding to the i-th candidate image block is determined according to a reference frame index corresponding to the i-th candidate image block An image; determining a reference image block corresponding to the i-th candidate image block from the reference frame image according to a motion vector corresponding to the i-th candidate image block, the reference image block and the i-th candidate image block The relative displacement of the image block matches the motion vector corresponding to the i-th candidate image block; and according to the reference image block, obtaining an image block with a size of a first horizontal length and a first vertical length as the first template includes: I-th child template. The reference frame index and motion vector corresponding to the i-th candidate image block are reference frame indexes 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, 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.
当所述N大于1时,所述第二模板包括N个子模板或者R个子模板,且由所述N个子模板或所述R个子模板拼接而成,所述R为帧间模式的第二候选图像块的数量;当N等于1时,所述第二模板包括第二子模板,所述第二子模板是根据所述当前图像块左侧的一个候选图像块的运动矢量预测模式和运动信息确定的。When N is greater than 1, the second template includes N sub-templates or R sub-templates, and is formed by splicing the N sub-templates or R sub-templates, and R is the second candidate of the inter-frame mode. The number of image blocks; when N is equal to 1, the second template includes a second sub-template that is based on a motion vector prediction mode and motion information of a candidate image block to the left of the current image block definite.
所述运动信息包括所述第二候选图像块的运动矢量和参考帧索引,所述获取模 块71根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板时具体用于:针对所述N个第二候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,根据所述参考帧索引确定所述第i个候选图像块的参考帧图像;根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块的运动矢量相匹配;根据所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板。The motion information includes a motion vector and a reference frame index of the second candidate image block, and 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 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, determine the according to the reference frame index A reference frame image of the i-th candidate image block; and determining a reference image block of 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 image block The relative displacement with the i-th candidate image block is matched with the motion vector of the i-th candidate image block; according to the reference image block, an image block having a size of a second horizontal length and a second vertical length is obtained as The second template includes an i-th sub-template.
所述获取模块71根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板时具体用于:针对所述N个第二候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,将所述第i个候选图像块按照默认值填充,并获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板。或者,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块对应的运动矢量相匹配;根据所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第一模板包括的第i个子模板。其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。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 The block serves as an ith sub-template included in the second template. Alternatively, when it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode, a reference frame corresponding to the i-th candidate image block is determined according to a reference frame index corresponding to the i-th candidate image block An image; determining a reference image block corresponding to the i-th candidate image block from the reference frame image according to a motion vector corresponding to the i-th candidate image block, the reference image block and the i-th candidate image block The relative displacement of the image block matches the motion vector corresponding to the i-th candidate image block; obtaining, according to the reference image block, an image block with a size of a second horizontal length and a second vertical length as the first template includes: I-th child template. The reference frame index and motion vector corresponding to the i-th candidate image block are reference frame indexes 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, 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.
所述获取模块71根据所述候选图像块的运动信息获取所述当前图像块的模板时具体用于:当所述当前图像块对应多个运动信息时,获取每个运动信息对应的模板,获取每个运动信息对应的权重,根据每个运动信息对应的权重和所述运动信息对应的模板获取所述当前图像块的模板。The acquiring module 71 is specifically configured to acquire the template of the current image block according to the motion information of the candidate image block: when the current image block corresponds to multiple motion information, acquire a template corresponding to each motion information, and acquire A weight corresponding to each motion information, and a template of the current image block is obtained according to a weight corresponding to each motion information and a template corresponding to the motion information.
本申请实施例提供的解码端设备,从硬件层面而言,其硬件架构示意图具体可以参见图8所示。包括:处理器81和机器可读存储介质82,其中:所述机器可读存储介质82存储有能够被所述处理器81执行的机器可执行指令;所述处理器81用于执行机器可执行指令,以实现本申请上述示例公开的解码方法。For a decoding end device provided by an embodiment of the present application, a hardware architecture schematic diagram of the decoding end device can be specifically shown in FIG. 8. The processor 81 includes a processor 81 and a machine-readable storage medium 82. The machine-readable storage medium 82 stores machine-executable instructions that can be executed by the processor 81. The processor 81 is configured to execute a machine-executable instruction. Instructions to implement the decoding method disclosed in the above examples of this application.
基于与上述方法同样的申请构思,本申请实施例还提供一种机器可读存储介质,所述机器可读存储介质上存储有若干计算机指令,所述计算机指令被处理器执行时,能够实现本申请上述示例公开的解码方法。Based on the same application concept as the above method, an embodiment of the present application further provides a machine-readable storage medium. The machine-readable storage medium stores a number of computer instructions. When the computer instructions are executed by a processor, the present invention can be implemented. Apply for the decoding method disclosed in the above example.
本申请实施例提供的编码端设备,从硬件层面而言,其硬件架构示意图具体可以参见图9所示。包括:处理器91和机器可读存储介质92,其中:所述机器可读存储介质92存储有能够被所述处理器91执行的机器可执行指令;所述处理器91用于执行机器可执行指令,以实现本申请上述示例公开的编码方法。In terms of hardware, the schematic diagram of the hardware architecture of the encoding device provided in the embodiment of this application can be specifically shown in FIG. 9. 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 encoding method disclosed in the above example of this application.
基于与上述方法同样的申请构思,本申请实施例还提供一种机器可读存储介质,所述机器可读存储介质上存储有若干计算机指令,所述计算机指令被处理器执行时,能够实现本申请上述示例公开的编码方法。Based on the same application concept as the above method, an embodiment of the present application further provides a machine-readable storage medium. The machine-readable storage medium stores a number of computer instructions. When the computer instructions are executed by a processor, the present invention can be implemented. Apply for the encoding method disclosed in the above example.
其中,上述机器可读存储介质可以是任何电子、磁性、光学或其它物理存储装置,可以包含或存储信息,如可执行指令、数据,等等。例如,机器可读存储介质可以是:RAM(Radom Access Memory,随机存取存储器)、易失存储器、非易失性存储器、闪存、存储驱动器(如硬盘驱动器)、固态硬盘、任何类型的存储盘(如光盘、DVD等),或者类似的存储介质,或者它们的组合。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. For example, 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.
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可以由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其它可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其它可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。This application is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present application. It should be understood that each process and / or block in the flowcharts and / or block diagrams, and combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine such that the instructions generated by the processor of the computer or other programmable data processing device are used to generate instructions Means for implementing the functions specified in one or more flowcharts and / or one or more blocks of the block diagrams.
而且,这些计算机程序指令也可以存储在能引导计算机或其它可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或者多个流程和/或方框图一个方框或者多个方框中指定的功能。Furthermore, 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.
此外,这些计算机程序指令也可装载到计算机或其它可编程数据处理设备上,使得在计算机或者其它可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其它可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。In addition, these computer program instructions can also be loaded on a computer or other programmable data processing device, so that a series of operating steps can be performed on the computer or other programmable device to produce a computer-implemented process, thereby being on the computer or other programmable device The executed instructions provide steps for implementing the functions specified in one or more flowcharts and / or one or more blocks of the block diagrams.
以上所述仅为本申请的实施例而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。The above are only examples of the present application and are not intended to limit the present application. For those skilled in the art, this application may have various modifications and changes. Any modification, equivalent replacement, and improvement made within the spirit and principle of this application shall be included in the scope of claims of this application.

Claims (49)

  1. 一种解码方法,应用于解码端,所述方法包括:A decoding method applied to a decoding end, the method includes:
    获取所述当前图像块的候选图像块的运动信息;Acquiring motion information of a candidate image block of the current image block;
    根据所述候选图像块的运动信息获取所述当前图像块的模板;Obtaining a template of the current image block according to the motion information of the candidate image block;
    根据所述当前图像块的所述模板对所述当前图像块进行解码。Decoding the current image block according to the template of the current image block.
  2. 根据权利要求1所述的方法,其特征在于,根据所述当前图像块的所述模板对所述当前图像块进行解码,包括:The method according to claim 1, wherein decoding the current image block according to the template of the current image block comprises:
    获取所述当前图像块的所述原始模式信息;Acquiring the original mode information of the current image block;
    基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的所述目标模式信息;Acquiring the target mode information of the current image block based on the template of the current image block and the original mode information;
    根据所述目标模式信息对所述当前图像块进行解码。Decoding the current image block according to the target mode information.
  3. 根据权利要求1所述的方法,其特征在于,The method according to claim 1, wherein:
    在基于所述当前图像块的所述模板,根据所述原始模式信息获取所述当前图像块的目标模式信息之前,所述方法还包括:Before acquiring the target mode information of the current image block based on the template of the current image block and according to the original mode information, the method further includes:
    接收来自编码端的所述当前图像块对应的编码比特流;Receiving an encoded bit stream corresponding to the current image block from an encoding end;
    响应于所述编码比特流携带第一指示信息,其中,所述第一指示信息用于指示基于所述当前图像块的模板和所述原始模式信息获取所述当前图像块的目标模式信息;Responsive to the encoded bitstream carrying first indication information, wherein the first indication information is used to instruct to obtain target mode information of the current image block based on a template of the current image block and the original mode information;
    根据所述第一指示信息,获取当前图像块的候选图像块的运动信息;根据所述候选图像块的运动信息获取所述当前图像块的模板。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.
  4. 根据权利要求1所述的方法,其特征在于,在基于所述当前图像块的所述模板,根据所述原始模式信息获取所述当前图像块的目标模式信息之前,所述方法还包括:The method according to claim 1, wherein before obtaining the target mode information of the current image block based on the template of the current image block and according to the original mode information, the method further comprises:
    接收来自编码端的编码比特流;Receive the encoded bit stream from the encoding end;
    响应于所述编码比特流携带第二指示信息,其中,所述第二指示信息用于指示基于所述原始模式信息对所述当前图像块进行解码;In response to the encoded bit stream carrying second indication information, wherein the second indication information is used to instruct to decode the current image block based on the original mode information;
    根据所述第二指示信息,获取所述原始模式信息,基于所述原始模式信息对所述当前图像块进行解码。Acquiring the original mode information according to the second instruction information, and decoding the current image block based on the original mode information.
  5. 根据权利要求1所述的方法,其特征在于,在基于所述当前图像块的所述模板,根据所述原始模式信息获取所述当前图像块的目标模式信息之前,所述方法还包括:The method according to claim 1, wherein before obtaining the target mode information of the current image block based on the template of the current image block and according to the original mode information, the method further comprises:
    根据本地预设的第一策略信息,获取当前图像块的候选图像块的运动信息;根据所述候选图像块的运动信息获取所述当前图像块的所述模板,其中,所述第一策略信息用于指示基于所述当前图像块的模板,根据所述原始模式信息获取所述当前图像块的所述目标模式信息;或者,Acquiring the motion information of the candidate image block of the current image block according to the first preset policy information locally; acquiring the template of the current image block according to the motion information of the candidate image block, wherein the first policy information For instructing to acquire a target mode information of the current image block based on the template of the current image block according to the original mode information; or
    根据本地预设的第二策略信息,获取所述原始模式信息,基于所述原始模式信息对所述当前图像块进行解码,其中,所述第二策略信息用于指示基于所述原始模式信息对所述当前图像块进行解码;或者,Acquiring the original mode information according to locally preset second policy information, and decoding the current image block based on the original mode information, wherein the second policy information is used to indicate that the Decoding the current image block; or,
    根据本地预设的第三策略信息,参考所述当前图像块的候选图像块所采用的策略信息,对所述当前图像块进行解码;其中,所述第三策略信息表示采用与所述当前图像块的候选图像块相同的策略信息。Decoding the current image block according to locally preset third policy information with reference to the policy information used by the candidate image block of the current image block; wherein the third policy information indicates that Candidate image blocks have the same policy information.
  6. 根据权利要求2所述的方法,其特征在于,The method according to claim 2, wherein:
    所述原始模式信息为所述当前图像块的原始运动矢量,The original mode information is an original motion vector of the current image block,
    所述目标模式信息为所述当前图像块的目标运动矢量;The target mode information is a target motion vector of the current image block;
    基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的所述目标模式信息,具体包括:Obtaining the target mode information of the current image block based on the template and the original mode information of the current image block specifically includes:
    将所述原始运动矢量确定为中心运动矢量;Determining the original motion vector as a central motion vector;
    确定与所述中心运动矢量对应的边缘运动矢量,所述边缘运动矢量与所述中心运动矢量不同;Determining an edge motion vector corresponding to the central motion vector, the edge motion vector being different from the central motion vector;
    根据所述模板获得所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能;Obtaining the encoding performance of the central motion vector and the encoding performance of each of the edge motion vectors according to the template;
    根据所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量。The target motion vector is determined from the center motion vector and the edge motion vector according to the coding performance of the center motion vector and the coding performance of each of the edge motion vectors.
  7. 根据权利要求2所述的方法,其特征在于,The method according to claim 2, wherein:
    所述原始模式信息为所述当前图像块的原始运动矢量和原始参考帧,The original mode information is an original motion vector and an original reference frame of the current image block,
    所述目标模式信息为所述当前图像块的目标运动矢量和目标参考帧;The target mode information is a target motion vector and a target reference frame of the current image block;
    基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的所述目标模式信息,具体包括:Obtaining the target mode information of the current image block based on the template and the original mode information of the current image block specifically includes:
    基于所述当前图像块的所述模板和所述原始运动矢量获取所述原始参考帧的候选运动矢量;Obtaining a candidate motion vector of the original reference frame based on the template of the current image block and the original motion vector;
    针对多个候选帧中的每个候选帧,For each candidate frame among multiple candidate frames,
    根据所述原始运动矢量获取所述候选参考帧的初始运动矢量;Obtaining an initial motion vector of the candidate reference frame according to the original motion vector;
    根据所述候选参考帧的所述初始运动矢量获取所述候选参考帧的候选运动矢量;Obtaining a candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame;
    从所述原始参考帧的候选运动矢量以及所述多个候选参考帧各自的候选运动矢量中,选择编码性能最优的候选运动矢量作为所述目标运动矢量;Selecting, from the candidate motion vectors of the original reference frame and the candidate motion vectors of the plurality of candidate reference frames, the candidate motion vector with the best coding performance as the target motion vector;
    将所述目标运动矢量对应的参考帧确定为所述目标参考帧。A reference frame corresponding to the target motion vector is determined as the target reference frame.
  8. 根据权利要求7所述的方法,其特征在于,根据所述原始运动矢量获取所述候选参考帧对应的所述初始运动矢量,包括:The method according to claim 7, wherein acquiring the initial motion vector corresponding to the candidate reference frame according to the original motion vector comprises:
    根据所述当前图像块所在帧与所述原始参考帧的距离、所述当前图像块所在帧与所述候选参考帧的距离和所述原始运动矢量,获取所述候选参考帧的所述初始运动矢量。Obtaining the initial motion of the candidate reference frame according to the distance between the frame where the current image block is located and the original reference frame, the distance between the frame where the current image block is located and the candidate reference frame, and the original motion vector Vector.
  9. 根据权利要求7所述的方法,其特征在于,基于所述当前图像块的所述模板和所述原始运动矢量获取所述原始参考帧的候选运动矢量,包括:The method according to claim 7, wherein obtaining the candidate motion vector of the original reference frame based on the template of the current image block and the original motion vector comprises:
    将所述原始运动矢量确定为中心运动矢量;Determining the original motion vector as a central motion vector;
    确定与所述中心运动矢量对应的边缘运动矢量,所述边缘运动矢量与所述中心运动矢量不同;Determining an edge motion vector corresponding to the central motion vector, the edge motion vector being different from the central motion vector;
    根据所述模板获得所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能;Obtaining the encoding performance of the central motion vector and the encoding performance of each of the edge motion vectors according to the template;
    根据所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述原始参考帧的候选运动矢量。According to the coding performance of the central motion vector and the coding performance of each of the edge motion vectors, a candidate motion vector of the original reference frame is determined from the central motion vector and the edge motion vector.
  10. 根据权利要求7或8所述的方法,其特征在于,根据所述候选参考帧的所述初始运动矢量获取所述候选参考帧对应的所述候选运动矢量,包括:The method according to claim 7 or 8, wherein acquiring the candidate motion vector corresponding to the candidate reference frame according to the initial motion vector of the candidate reference frame comprises:
    将所述候选参考帧的所述初始运动矢量确定为中心运动矢量;Determining the initial motion vector of the candidate reference frame as a central motion vector;
    确定与所述中心运动矢量对应的边缘运动矢量;所述边缘运动矢量与所述中心运动矢量不同;Determining an edge motion vector corresponding to the central motion vector; the edge motion vector is different from the central motion vector;
    根据所述模板获得所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能;Obtaining the encoding performance of the central motion vector and the encoding performance of each of the edge motion vectors according to the template;
    根据所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述候选参考帧对应的所述候选运动矢量。According to the coding performance of the central motion vector and the coding performance of each of the edge motion vectors, the candidate motion vector corresponding to the candidate reference frame is determined from the central motion vector and the edge motion vector.
  11. 根据权利要求2所述的方法,其特征在于,The method according to claim 2, wherein:
    所述原始模式信息为原始预测图像块,The original mode information is an original predicted image block,
    所述目标模式信息为目标预测图像块,The target mode information is a target prediction image block,
    基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的所述目标模式信息,具体包括:Obtaining the target mode information of the current image block based on the template and the original mode information of the current image block specifically includes:
    根据所述模板和所述模板对应的参考块,获取变换系数;Obtaining transform coefficients according to the template and a reference block corresponding to the template;
    根据所述变换系数对所述原始预测图像块进行光照补偿,得到所述目标预测图像块。Illumination compensation is performed on the original prediction image block according to the transform coefficient to obtain the target prediction image block.
  12. 根据权利要求11所述的方法,其特征在于,根据所述模板和所述模板对应的参考块,获取所述变换系数之前,还包括:The method according to claim 11, wherein before acquiring the transform coefficient according to the template and a reference block corresponding to the template, further comprising:
    获取所述当前图像块的运动矢量和所述运动矢量对应的参考帧索引;Acquiring a motion vector of the current image block and a reference frame index corresponding to the motion vector;
    根据所述当前图像块的所述运动矢量和所述参考帧索引获得所述模板对应的参考块。Obtaining a reference block corresponding to the template according to the motion vector and the reference frame index of the current image block.
  13. 根据权利要求11所述的方法,其特征在于,根据所述模板和所述模板对应的参考块,获取所述变换系数,包括:The method according to claim 11, wherein obtaining the transform coefficient according to the template and a reference block corresponding to the template comprises:
    根据所述模板的各像素的参数信息、所述模板对应的参考块的各像素的参数信息,获取所述变换系数;Obtaining the transformation coefficient according to parameter information of each pixel of the template and parameter information of each pixel of a reference block corresponding to the template;
    其中,所述参数信息包括亮度值。The parameter information includes a brightness value.
  14. 根据权利要求1至13中任一项所述的方法,其特征在于,The method according to any one of claims 1 to 13, characterized in that:
    所述候选图像块包括M个第一候选图像块和N个第二候选图像块,M为大于或等于1的自然数,N为大于或等于0的自然数,或者,M为大于或等于0的自然数,N为大于或等于1的自然数;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,
    所述第二候选图像块为所述当前图像块左侧的候选图像块;The second candidate image block is a candidate image block to the left of the current image block;
    根据所述候选图像块的运动信息获取所述当前图像块的模板,包括:Obtaining a template of the current image block according to the motion information of the candidate image block includes:
    根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板;Determining a first template according to a motion vector prediction mode and motion information of the M first candidate image blocks;
    根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板;Determine a second template according to the motion vector prediction mode and motion information of the N second candidate image blocks;
    将所述第一模板确定为所述当前图像块的模板,或者将所述第二模板确定为所述当前图像块的模板,或者将所述第一模板和所述第二模板拼接之后确定为所述当前图像块的模板。Determining the first template as a template of the current image block, or determining the second template as a template of the current image block, or stitching the first template and the second template as A template of the current image block.
  15. 根据权利要求14所述的方法,其特征在于,The method according to claim 14, wherein:
    所述第一候选图像块包括所述当前图像块上侧的相邻图像块和/或次邻图像块;所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式;The first candidate image block includes an adjacent image block and / or a second-neighbor image block on the upper side of the current image block; a prediction mode of the adjacent image block is an inter mode or an intra mode; and the second neighbor The prediction mode of the image block is an inter mode;
    所述第二候选图像块包括所述当前图像块左侧的相邻图像块和/或次邻图像块;所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式。The second candidate image block includes an adjacent image block and / or a second-neighbor image block to the left of the current image block; a prediction mode of the adjacent image block is an inter mode or an intra mode; and the second neighbor The prediction mode of an image block is an inter mode.
  16. 根据权利要求14所述的方法,其特征在于,The method according to claim 14, wherein:
    当所述M大于1时,所述第一模板包括M个子模板或者P个子模板,且由所述M个子模板或所述P个子模板拼接而成,所述P为帧间模式的第一候选图像块的数量;When M is greater than 1, the first template includes M sub-templates or P sub-templates, and is formed by splicing the M sub-templates or P sub-templates, where P is the first candidate for the inter-frame mode The number of image blocks;
    当所述M等于1时,所述第一模板包括第一子模板,所述第一子模板是根据所述当前图像块上侧的一个候选图像块的运动矢量预测模式和运动信息确定的。When M is equal to 1, the first template includes a first sub-template, and the first sub-template is determined according to a motion vector prediction mode and motion information of a candidate image block on an upper side of the current image block.
  17. 根据权利要求16所述的方法,其特征在于,The method according to claim 16, wherein:
    所述运动信息包括所述第一候选图像块的运动矢量和参考帧索引,The motion information includes a motion vector and a reference frame index of the first candidate image block,
    根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板,包括:Determining the first template according to the motion vector prediction mode and motion information of the M first candidate image blocks includes:
    针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,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,
    根据所述参考帧索引确定所述第i个候选图像块的参考帧图像;Determining a reference frame image of the i-th candidate image block according to the reference frame index;
    根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块的运动矢量相匹配;Determining a reference image block of the i-th candidate image block from the reference frame image according to a motion vector of the i-th candidate image block, the relative of the reference image block and the i-th candidate image block The displacement matches the motion vector of the i-th candidate image block;
    根据所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板。According to the reference image block, an image block having a first horizontal length and a first vertical length is obtained as an i-th sub-template included in the first template.
  18. 根据权利要求16所述的方法,其特征在于,根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板,包括:The method according to claim 16, wherein determining the first template according to a motion vector prediction mode and motion information of the M first candidate image blocks comprises:
    针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,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,
    将所述第i个候选图像块按照默认值填充,并Fill the i-th candidate image block with a default value, and
    获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板;Acquiring an image block having a first horizontal length and a first vertical length as an i-th sub-template included in the first template;
    或者,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,Alternatively, when it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode,
    根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;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;
    根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块对应的运动矢量相匹配;Determining a reference image block corresponding to the i-th candidate image block from the reference frame image according to a motion vector corresponding to the i-th candidate image block, the reference image block and the i-th candidate image block The relative displacement of is matched with the motion vector corresponding to the i-th candidate image block;
    根据所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板;Obtaining, according to the reference image block, an image block having a first horizontal length and a first vertical length as an i-th sub-template included in the first template;
    其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。The reference frame index and motion vector corresponding to the i-th candidate image block are reference frame indexes and motion vectors of neighboring image blocks of the i-th candidate image block.
  19. 根据权利要求17或18所述的方法,其特征在于,The method according to claim 17 or 18, wherein:
    所述第一横向长度与所述第一候选图像块的横向长度满足第一比例关系,或者与所述当前图像块的横向长度满足第二比例关系,或者等于第一预设长度;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 vertical length satisfies a third proportional relationship with the vertical length of the first candidate image block, or satisfies a fourth proportional relationship with the vertical length of the current image block, or is equal to a second preset length.
  20. 根据权利要求14所述的方法,其特征在于,The method according to claim 14, wherein:
    当所述N大于1时,所述第二模板包括N个子模板或者R个子模板,且由所述N个子模板或所述R个子模板拼接而成,所述R为帧间模式的第二候选图像块的数量;When N is greater than 1, the second template includes N sub-templates or R sub-templates, and is formed by splicing the N sub-templates or R sub-templates, and R is the second candidate of the inter-frame mode. The number of image blocks;
    当所述N等于1时,所述第二模板包括第二子模板,所述第二子模板是根据所述当前图像块左侧的一个候选图像块的运动矢量预测模式和运动信息确定的。When N is equal to 1, the second template includes a second sub-template, and the second sub-template is determined according to a motion vector prediction mode and motion information of a candidate image block on the left side of the current image block.
  21. 根据权利要求20所述的方法,其特征在于,The method according to claim 20, wherein:
    所述运动信息包括所述第二候选图像块的运动矢量和参考帧索引,The motion information includes a motion vector and a reference frame index of the second candidate image block,
    根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板,包括:Determining the second template according to the motion vector prediction mode and motion information of the N second candidate image blocks, including:
    针对所述N个第二候选图像块中的第i个候选图像块,For the ith candidate image block among the N second candidate image blocks,
    当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,根据所述参考帧索引确定所述第i个候选图像块的参考帧图像;When it is determined that the motion vector prediction mode of the i-th candidate image block is an inter mode, determining a reference frame image of the i-th candidate image block according to the reference frame index;
    根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块的运动矢量相匹配;Determining a reference image block of the i-th candidate image block from the reference frame image according to a motion vector of the i-th candidate image block, the The displacement matches the motion vector of the i-th candidate image block;
    根据所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板。According to the reference image block, an image block having a second horizontal length and a second vertical length is obtained as an i-th sub-template included in the second template.
  22. 根据权利要求21所述的方法,其特征在于,根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板,还包括:The method according to claim 21, wherein determining the second template according to a motion vector prediction mode and motion information of the N second candidate image blocks further comprises:
    当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,When it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode,
    将所述第i个候选图像块按照默认值填充,并Fill the i-th candidate image block with a default value, and
    获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板;Acquiring an image block having a second horizontal length and a second vertical length as an i-th sub-template included in the second template;
    或者,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,Alternatively, when it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode,
    根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;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;
    根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块对应的运动矢量相匹配;Determining a reference image block corresponding to the i-th candidate image block from the reference frame image according to a motion vector corresponding to the i-th candidate image block, the reference image block and the i-th candidate image block The relative displacement of is matched with the motion vector corresponding to the i-th candidate image block;
    根据所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第一模板包括的第i个子模板;Obtaining, according to the reference image block, an image block having a second horizontal length and a second vertical length as an i-th sub-template included in the first template;
    其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。The reference frame index and motion vector corresponding to the i-th candidate image block are reference frame indexes and motion vectors of neighboring image blocks of the i-th candidate image block.
  23. 根据权利要求21或22所述的方法,其特征在于,The method according to claim 21 or 22, wherein:
    所述第二横向长度与所述第二候选图像块的横向长度满足第五比例关系,或者与所述当前图像块的横向长度满足第六比例关系,或者等于第三预设长度;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.
  24. 根据权利要求14至23中任一项所述的方法,其特征在于,根据所述候选图像块的运动信息获取所述当前图像块的模板,包括:The method according to any one of claims 14 to 23, wherein acquiring a template of the current image block according to the motion information of the candidate image block comprises:
    当所述当前图像块对应多个运动信息时,获取每个运动信息对应的模板,其中,当前图像块对应的运动信息可包括当前图像块的原始运动信息;When the current image block corresponds to a plurality of motion information, obtaining a template corresponding to each motion information, wherein the motion information corresponding to the current image block may include the original motion information of the current image block;
    获取每个运动信息对应的权重,并Obtain the weight corresponding to each sport information, and
    根据每个运动信息对应的权重以及所述运动信息对应的模板获取所述当前图像块的模板。A template of the current image block is obtained according to a weight corresponding to each motion information and a template corresponding to the motion information.
  25. 一种编码方法,应用于编码端,所述方法包括:An encoding method applied to an encoding end, the method including:
    获取当前图像块的候选图像块的运动信息;Acquiring motion information of a candidate image block of the current image block;
    根据所述候选图像块的运动信息获取所述当前图像块的模板;Obtaining a template of the current image block according to the motion information of the candidate image block;
    根据所述当前图像块的所述模板对所述当前图像块进行编码。Encoding the current image block according to the template of the current image block.
  26. 根据权利要求25所述的方法,其特征在于,根据所述当前图像块的所述模板对所述当前图像块进行编码,包括:The method according to claim 25, wherein encoding the current image block according to the template of the current image block comprises:
    获取所述当前图像块的原始模式信息;Acquiring original mode information of the current image block;
    基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的目标模式信息;Acquiring target mode information of the current image block based on the template of the current image block and the original mode information;
    根据所述目标模式信息对所述当前图像块进行编码,得到所述当前图像块对应的编码比特流。Encode the current image block according to the target mode information to obtain an encoded bit stream corresponding to the current image block.
  27. 根据权利要求26所述的方法,其特征在于,所述方法还包括:The method according to claim 26, further comprising:
    当根据所述目标模式信息对所述当前图像块进行编码时,向解码端发送的所述当前图像块对应的编码比特流携带第一指示信息,所述第一指示信息用于指示基于所述当前图像块的模板和所述原始模式信息获取所述当前图像块的目标模式信息。When the current image block is encoded according to the target mode information, the encoded bitstream corresponding to the current image block sent to the decoding end carries first indication information, where the first indication information is used to indicate The template of the current image block and the original mode information acquire target mode information of the current image block.
  28. 根据权利要求26所述的方法,其特征在于,所述方法还包括:The method according to claim 26, further comprising:
    当根据所述原始模式信息对所述当前图像块进行编码时,向解码端发送的所述当前图像块对应的编码比特流携带第二指示信息的编码比特流,所述第二指示信息用于指示基于所述原始模式信息对所述当前图像块进行解码。When the current image block is encoded according to the original mode information, the encoded bit stream corresponding to the current image block sent to the decoding end carries the encoded bit stream of the second instruction information, where the second instruction information is used for And instructing to decode the current image block based on the original mode information.
  29. 根据权利要求26所述的方法,其特征在于,The method according to claim 26, wherein:
    所述原始模式信息为所述当前图像块的原始运动矢量,The original mode information is an original motion vector of the current image block,
    所述目标模式信息为所述当前图像块的目标运动矢量;The target mode information is a target motion vector of the current image block;
    基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的目标模式信息,具体包括:Obtaining target mode information of the current image block based on the template and the original mode information of the current image block specifically includes:
    将所述原始运动矢量确定为中心运动矢量;Determining the original motion vector as a central motion vector;
    确定与所述中心运动矢量对应的边缘运动矢量,所述边缘运动矢量与所述中心运动矢量不同;Determining an edge motion vector corresponding to the central motion vector, the edge motion vector being different from the central motion vector;
    根据所述模板获得所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能;Obtaining the encoding performance of the central motion vector and the encoding performance of each of the edge motion vectors according to the template;
    根据所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述目标运动矢量。The target motion vector is determined from the center motion vector and the edge motion vector according to the coding performance of the center motion vector and the coding performance of each of the edge motion vectors.
  30. 根据权利要求26所述的方法,其特征在于,The method according to claim 26, wherein:
    所述原始模式信息为所述当前图像块的原始运动矢量和原始参考帧,The original mode information is an original motion vector and an original reference frame of the current image block,
    所述目标模式信息为所述当前图像块的目标运动矢量和目标参考帧;The target mode information is a target motion vector and a target reference frame of the current image block;
    基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的目标模式信息,具体包括:Obtaining target mode information of the current image block based on the template and the original mode information of the current image block specifically includes:
    基于所述当前图像块的所述模板和所述原始运动矢量获取所述原始参考帧的候选运动矢量;Obtaining a candidate motion vector of the original reference frame based on the template of the current image block and the original motion vector;
    针对多个候选帧中的每个候选帧,For each candidate frame among multiple candidate frames,
    根据所述原始运动矢量获取所述候选参考帧的初始运动矢量;Obtaining an initial motion vector of the candidate reference frame according to the original motion vector;
    根据所述候选参考帧的所述初始运动矢量获取所述候选参考帧的候选运动矢量;Obtaining a candidate motion vector of the candidate reference frame according to the initial motion vector of the candidate reference frame;
    从所述原始参考帧的候选运动矢量以及所述多个候选参考帧各自的候选运动矢量中,选择编码性能最优的候选运动矢量作为所述目标运动矢量;Selecting, from the candidate motion vectors of the original reference frame and the candidate motion vectors of the plurality of candidate reference frames, the candidate motion vector with the best coding performance as the target motion vector;
    将所述目标运动矢量对应的参考帧确定为所述目标参考帧。A reference frame corresponding to the target motion vector is determined as the target reference frame.
  31. 根据权利要求30所述的方法,其特征在于,根据所述原始运动矢量获取所述候选参考帧对应的所述初始运动矢量,包括:The method according to claim 30, wherein acquiring the initial motion vector corresponding to the candidate reference frame according to the original motion vector comprises:
    根据当前图像块所在帧与所述原始参考帧的距离、当前图像块所在帧与所述候选参考帧的距离和所述原始运动矢量,获取所述候选参考帧的所述初始运动矢量。Obtaining the initial motion vector of the candidate reference frame according to the distance between the frame where the current image block is located and the original reference frame, the distance between the frame where the current image block is located and the candidate reference frame, and the original motion vector.
  32. 根据权利要求30所述的方法,其特征在于,基于所述当前图像块的所述模板和所述原始运动矢量获取所述原始参考帧的候选运动矢量,包括:The method according to claim 30, wherein obtaining a candidate motion vector of the original reference frame based on the template of the current image block and the original motion vector comprises:
    将所述原始运动矢量确定为中心运动矢量;Determining the original motion vector as a central motion vector;
    确定与所述中心运动矢量对应的边缘运动矢量,所述边缘运动矢量与所述中心运动矢量不同;Determining an edge motion vector corresponding to the central motion vector, the edge motion vector being different from the central motion vector;
    根据所述模板获得所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能;Obtaining the encoding performance of the central motion vector and the encoding performance of each of the edge motion vectors according to the template;
    根据所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述原始参考帧的候选运动矢量。According to the coding performance of the central motion vector and the coding performance of each of the edge motion vectors, a candidate motion vector of the original reference frame is determined from the central motion vector and the edge motion vector.
  33. 根据权利要求30或31所述的方法,其特征在于,根据所述候选参考帧的所述初始运动矢量获取所述候选参考帧对应的所述候选运动矢量,包括:The method according to claim 30 or 31, wherein acquiring the candidate motion vector corresponding to the candidate reference frame according to the initial motion vector of the candidate reference frame comprises:
    将所述候选参考帧的初始运动矢量确定为中心运动矢量;Determining an initial motion vector of the candidate reference frame as a central motion vector;
    确定与所述中心运动矢量对应的边缘运动矢量;所述边缘运动矢量与所述中心运动矢量不同;Determining an edge motion vector corresponding to the central motion vector; the edge motion vector is different from the central motion vector;
    根据所述模板获得所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能;Obtaining the encoding performance of the central motion vector and the encoding performance of each of the edge motion vectors according to the template;
    根据所述中心运动矢量的编码性能和各个所述边缘运动矢量的编码性能,从所述中心运动矢量和所述边缘运动矢量中确定所述候选参考帧对应的所述候选运动矢量。According to the coding performance of the central motion vector and the coding performance of each of the edge motion vectors, the candidate motion vector corresponding to the candidate reference frame is determined from the central motion vector and the edge motion vector.
  34. 根据权利要求26所述的方法,其特征在于,The method according to claim 26, wherein:
    所述原始模式信息为原始预测图像块,The original mode information is an original predicted image block,
    所述目标模式信息为目标预测图像块,The target mode information is a target prediction image block,
    基于所述当前图像块的所述模板和所述原始模式信息获取所述当前图像块的所述目标模式信息,具体包括:Obtaining the target mode information of the current image block based on the template and the original mode information of the current image block specifically includes:
    根据所述模板和所述模板对应的参考块,获取变换系数;Obtaining transform coefficients according to the template and a reference block corresponding to the template;
    根据所述变换系数对所述原始预测图像块进行光照补偿,得到所述目标预测图 像块。Illumination compensation is performed on the original prediction image block according to the transform coefficient to obtain the target prediction image block.
  35. 根据权利要求34所述的方法,其特征在于,根据所述模板和所述模板对应的参考块,获取所述变换系数之前,还包括:The method according to claim 34, wherein before acquiring the transform coefficient according to the template and a reference block corresponding to the template, further comprising:
    获取所述当前图像块的运动矢量和所述运动矢量对应的参考帧索引;Acquiring a motion vector of the current image block and a reference frame index corresponding to the motion vector;
    根据所述当前图像块的所述运动矢量和所述参考帧索引获得所述模板对应的参考块。Obtaining a reference block corresponding to the template according to the motion vector and the reference frame index of the current image block.
  36. 根据权利要求34所述的方法,其特征在于,根据所述模板和所述模板对应的参考块,获取所述变换系数,包括:The method according to claim 34, wherein obtaining the transformation coefficient according to the template and a reference block corresponding to the template comprises:
    根据所述模板的各像素的参数信息、所述模板对应的参考块的各像素的参数信息,获取所述变换系数;Obtaining the transformation coefficient according to parameter information of each pixel of the template and parameter information of each pixel of a reference block corresponding to the template;
    其中,所述参数信息包括亮度值。The parameter information includes a brightness value.
  37. 根据权利要求26至36中任一项所述的方法,其特征在于,The method according to any one of claims 26 to 36, wherein
    所述候选图像块包括M个第一候选图像块和N个第二候选图像块,M为大于或等于1的自然数,N为大于或等于0的自然数,或者,M为大于或等于0的自然数,N为大于或等于1的自然数;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,
    所述第二候选图像块为所述当前图像块左侧的候选图像块;The second candidate image block is a candidate image block to the left of the current image block;
    根据所述候选图像块的运动信息获取所述当前图像块的模板,包括:Obtaining a template of the current image block according to the motion information of the candidate image block includes:
    根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板;Determining a first template according to a motion vector prediction mode and motion information of the M first candidate image blocks;
    根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板;Determine a second template according to the motion vector prediction mode and motion information of the N second candidate image blocks;
    将所述第一模板确定为所述当前图像块的模板,或者将所述第二模板确定为所述当前图像块的模板,或者将所述第一模板和所述第二模板拼接之后确定为所述当前图像块的模板。Determining the first template as a template of the current image block, or determining the second template as a template of the current image block, or stitching the first template and the second template as A template of the current image block.
  38. 根据权利要求37所述的方法,其特征在于,The method according to claim 37, wherein:
    所述第一候选图像块包括所述当前图像块上侧的相邻图像块和/或次邻图像块;所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式;The first candidate image block includes an adjacent image block and / or a second-neighbor image block on the upper side of the current image block; a prediction mode of the adjacent image block is an inter mode or an intra mode; and the second neighbor The prediction mode of the image block is an inter mode;
    所述第二候选图像块包括所述当前图像块左侧的相邻图像块和/或次邻图像块;所述相邻图像块的预测模式为帧间模式或者帧内模式;所述次邻图像块的预测模式为帧间模式。The second candidate image block includes an adjacent image block and / or a second-neighbor image block to the left of the current image block; a prediction mode of the adjacent image block is an inter mode or an intra mode; and the second neighbor The prediction mode of an image block is an inter mode.
  39. 根据权利要求37所述的方法,其特征在于,The method according to claim 37, wherein:
    当所述M大于1时,所述第一模板包括M个子模板或者P个子模板,且由所述M个子模板或所述P个子模板拼接而成,所述P为帧间模式的第一候选图像块的数量;When M is greater than 1, the first template includes M sub-templates or P sub-templates, and is formed by splicing the M sub-templates or P sub-templates, where P is the first candidate for the inter-frame mode The number of image blocks;
    当所述M等于1时,所述第一模板包括第一子模板,所述第一子模板是根据所述当前图像块上侧的一个候选图像块的运动矢量预测模式和运动信息确定的。When M is equal to 1, the first template includes a first sub-template, and the first sub-template is determined according to a motion vector prediction mode and motion information of a candidate image block on an upper side of the current image block.
  40. 根据权利要求39所述的方法,其特征在于,The method according to claim 39, wherein:
    所述运动信息包括所述第一候选图像块的运动矢量和参考帧索引,The motion information includes a motion vector and a reference frame index of the first candidate image block,
    根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板,包括:Determining the first template according to the motion vector prediction mode and motion information of the M first candidate image blocks includes:
    针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,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,
    根据所述参考帧索引确定所述第i个候选图像块的参考帧图像;Determining a reference frame image of the i-th candidate image block according to the reference frame index;
    根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第i个候选图像块的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块的运动矢量相匹配;Determining a reference image block of the i-th candidate image block from the reference frame image according to a motion vector of the i-th candidate image block, the relative of the reference image block and the i-th candidate image block The displacement matches the motion vector of the i-th candidate image block;
    根据所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板。According to the reference image block, an image block having a first horizontal length and a first vertical length is obtained as an i-th sub-template included in the first template.
  41. 根据权利要求40所述的方法,其特征在于,根据M个第一候选图像块的运动矢量预测模式和运动信息,确定第一模板,还包括:The method according to claim 40, wherein determining the first template according to a motion vector prediction mode and motion information of the M first candidate image blocks further comprises:
    针对所述M个第一候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,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,
    将所述第i个候选图像块按照默认值填充,并Fill the i-th candidate image block with a default value, and
    获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板;Acquiring an image block having a first horizontal length and a first vertical length as an i-th sub-template included in the first template;
    或者,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,Alternatively, when it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode,
    根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;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;
    根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块对应的运动矢量相匹配;Determining a reference image block corresponding to the i-th candidate image block from the reference frame image according to a motion vector corresponding to the i-th candidate image block, the reference image block and the i-th candidate image block The relative displacement of is matched with the motion vector corresponding to the i-th candidate image block;
    根据所述参考图像块,获取尺寸为第一横向长度和第一纵向长度的图像块作为所述第一模板包括的第i个子模板;Obtaining, according to the reference image block, an image block having a first horizontal length and a first vertical length as an i-th sub-template included in the first template;
    其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。The reference frame index and motion vector corresponding to the i-th candidate image block are reference frame indexes and motion vectors of neighboring image blocks of the i-th candidate image block.
  42. 根据权利要求40或41所述的方法,其特征在于,The method according to claim 40 or 41, wherein:
    所述第一横向长度与所述第一候选图像块的横向长度满足第一比例关系,或者与所述当前图像块的横向长度满足第二比例关系,或者等于第一预设长度;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.
  43. 根据权利要求37所述的方法,其特征在于,The method according to claim 37, wherein:
    当所述N大于1时,所述第二模板包括N个子模板或者R个子模板,且由所述N个子模板或所述R个子模板拼接而成,所述R为帧间模式的第二候选图像块的数量;When N is greater than 1, the second template includes N sub-templates or R sub-templates, and is formed by splicing the N sub-templates or R sub-templates, and R is the second candidate of the inter-frame mode. The number of image blocks;
    当所述N等于1时,所述第二模板包括第二子模板,所述第二子模板是根据所述当前图像块左侧的一个候选图像块的运动矢量预测模式和运动信息确定的。When N is equal to 1, the second template includes a second sub-template, and the second sub-template is determined according to a motion vector prediction mode and motion information of a candidate image block on the left side of the current image block.
  44. 根据权利要求43所述的方法,其特征在于,The method according to claim 43, wherein:
    所述运动信息包括所述第二候选图像块的运动矢量和参考帧索引,The motion information includes a motion vector and a reference frame index of the second candidate image block,
    根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板,包括:Determining the second template according to the motion vector prediction mode and motion information of the N second candidate image blocks, including:
    针对所述N个第二候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧间模式时,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 ith candidate image block is an inter mode,
    根据所述参考帧索引确定所述第i个候选图像块的参考帧图像;Determining a reference frame image of the i-th candidate image block according to the reference frame index;
    根据所述第i个候选图像块的运动矢量,从所述参考帧图像中确定所述第 i个候选图像块的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块的运动矢量相匹配;Determining a reference image block of the i-th candidate image block from the reference frame image according to a motion vector of the i-th candidate image block, the relative of the reference image block and the i-th candidate image block The displacement matches the motion vector of the i-th candidate image block;
    根据所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板。According to the reference image block, an image block having a second horizontal length and a second vertical length is obtained as an i-th sub-template included in the second template.
  45. 根据权利要求43所述的方法,其特征在于,根据N个第二候选图像块的运动矢量预测模式和运动信息,确定第二模板,还包括:The method according to claim 43, wherein determining the second template according to the motion vector prediction mode and motion information of the N second candidate image blocks further comprises:
    针对所述N个第二候选图像块中的第i个候选图像块,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,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 ith candidate image block is an intra mode,
    将所述第i个候选图像块按照默认值填充,并Fill the i-th candidate image block with a default value, and
    获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第二模板包括的第i个子模板;Acquiring an image block having a second horizontal length and a second vertical length as an i-th sub-template included in the second template;
    或者,当确定所述第i个候选图像块的运动矢量预测模式为帧内模式时,Alternatively, when it is determined that the motion vector prediction mode of the i-th candidate image block is an intra mode,
    根据所述第i个候选图像块对应的参考帧索引确定所述第i个候选图像块对应的参考帧图像;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;
    根据所述第i个候选图像块对应的运动矢量,从所述参考帧图像中确定所述第i个候选图像块对应的参考图像块,所述参考图像块与所述第i个候选图像块的相对位移与所述第i个候选图像块对应的运动矢量相匹配;Determining a reference image block corresponding to the i-th candidate image block from the reference frame image according to a motion vector corresponding to the i-th candidate image block, the reference image block and the i-th candidate image block The relative displacement of is matched with the motion vector corresponding to the i-th candidate image block;
    根据所述参考图像块,获取尺寸为第二横向长度和第二纵向长度的图像块作为所述第一模板包括的第i个子模板;Obtaining, according to the reference image block, an image block having a second horizontal length and a second vertical length as an i-th sub-template included in the first template;
    其中,所述第i个候选图像块对应的参考帧索引和运动矢量,是所述第i个候选图像块的相邻图像块的参考帧索引和运动矢量。The reference frame index and motion vector corresponding to the i-th candidate image block are reference frame indexes and motion vectors of neighboring image blocks of the i-th candidate image block.
  46. 根据权利要求44或45所述的方法,其特征在于,The method according to claim 44 or 45, wherein:
    所述第二横向长度与所述第二候选图像块的横向长度满足第五比例关系,或者与所述当前图像块的横向长度满足第六比例关系,或者等于第三预设长度;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.
  47. 根据权利要求37至46中任一项所述的方法,其特征在于,根据所述候选图像块的运动信息获取所述当前图像块的模板,包括:The method according to any one of claims 37 to 46, wherein obtaining a template of the current image block according to the motion information of the candidate image block comprises:
    当所述当前图像块对应多个运动信息时,获取每个运动信息对应的模板,其中,当前图像块对应的运动信息可包括当前图像块的原始运动信息;When the current image block corresponds to a plurality of motion information, obtaining a template corresponding to each motion information, wherein the motion information corresponding to the current image block may include the original motion information of the current image block;
    获取每个运动信息对应的权重,并Obtain the weight corresponding to each sport information, and
    根据每个运动信息对应的权重以及所述运动信息对应的模板获取所述当前图像块的模板。A template of the current image block is obtained according to a weight corresponding to each motion information and a template corresponding to the motion information.
  48. 一种解码端设备,包括:A decoding device includes:
    处理器;和Processor; and
    机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令;A machine-readable storage medium storing machine-executable instructions executable by the processor;
    其中,所述处理器用于执行所述机器可执行指令,以实现权利要求1-24任一所述的方法步骤。The processor is configured to execute the machine-executable instructions to implement the method steps of any one of claims 1-24.
  49. 一种编码端设备,包括:An encoding end device includes:
    处理器;和Processor; and
    机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令;A machine-readable storage medium storing machine-executable instructions executable by the processor;
    其中,所述处理器用于执行机器可执行指令,以实现权利要求25-47任一所述的方法步骤。The processor is configured to execute machine-executable instructions to implement the method steps of any one of claims 25-47.
PCT/CN2019/093574 2018-06-28 2019-06-28 Decoding and encoding methods and apparatus thereof WO2020001591A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810692041.X 2018-06-28
CN201810692041.XA CN110662033B (en) 2018-06-28 2018-06-28 Decoding and encoding method and device thereof

Publications (1)

Publication Number Publication Date
WO2020001591A1 true WO2020001591A1 (en) 2020-01-02

Family

ID=68984489

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/093574 WO2020001591A1 (en) 2018-06-28 2019-06-28 Decoding and encoding methods and apparatus thereof

Country Status (2)

Country Link
CN (1) CN110662033B (en)
WO (1) WO2020001591A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023044916A1 (en) * 2021-09-27 2023-03-30 Oppo广东移动通信有限公司 Intra prediction method, encoder, decoder, and encoding and decoding system
CN116800956A (en) * 2022-01-07 2023-09-22 杭州海康威视数字技术股份有限公司 Image encoding and decoding method, device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5818969A (en) * 1995-05-12 1998-10-06 Intel Corporation Intelligent start for motion estimation search
CN1497981A (en) * 2002-07-16 2004-05-19 ���ǵ�����ʽ���� Method and device for code and decode motion vector
KR100928325B1 (en) * 2007-10-15 2009-11-25 세종대학교산학협력단 Image encoding and decoding method and apparatus
CN101895675A (en) * 2010-07-26 2010-11-24 杭州海康威视软件有限公司 Motion detection method and device
CN102177716A (en) * 2008-10-09 2011-09-07 株式会社Ntt都科摩 Moving image encoding device, moving image decoding device, moving image encoding method, moving image decoding method, moving image encoding program, moving image decoding program, moving image processing system and moving image processing method

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5869493B2 (en) * 2009-12-08 2016-02-24 トムソン ライセンシングThomson Licensing Method and apparatus for adaptive residual update of template matching prediction for video encoding and decoding
CN102215386B (en) * 2010-04-09 2013-03-27 华为技术有限公司 Video image block processing method and device
KR101456499B1 (en) * 2010-07-09 2014-11-03 삼성전자주식회사 Method and apparatus for encoding and decoding motion vector
EP3301919A1 (en) * 2016-10-03 2018-04-04 Thomson Licensing Method and apparatus for encoding and decoding motion information
CN108134939B (en) * 2016-12-01 2020-08-07 北京金山云网络技术有限公司 Motion estimation method and device
CN106604035B (en) * 2017-01-22 2019-10-18 北京君泊网络科技有限责任公司 A method of the estimation for Video coding and compression

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5818969A (en) * 1995-05-12 1998-10-06 Intel Corporation Intelligent start for motion estimation search
CN1497981A (en) * 2002-07-16 2004-05-19 ���ǵ�����ʽ���� Method and device for code and decode motion vector
KR100928325B1 (en) * 2007-10-15 2009-11-25 세종대학교산학협력단 Image encoding and decoding method and apparatus
CN102177716A (en) * 2008-10-09 2011-09-07 株式会社Ntt都科摩 Moving image encoding device, moving image decoding device, moving image encoding method, moving image decoding method, moving image encoding program, moving image decoding program, moving image processing system and moving image processing method
CN101895675A (en) * 2010-07-26 2010-11-24 杭州海康威视软件有限公司 Motion detection method and device

Also Published As

Publication number Publication date
CN110662033B (en) 2021-11-23
CN110662033A (en) 2020-01-07

Similar Documents

Publication Publication Date Title
JP5937717B2 (en) Video decoding method and apparatus
US8098731B2 (en) Intraprediction method and apparatus using video symmetry and video encoding and decoding method and apparatus
US8554001B2 (en) Image encoding/decoding system using graph based pixel prediction and encoding system and method
TWI639330B (en) Method and apparatus of video coding with interpolated reference pictures
WO2020057559A1 (en) Decoding and encoding method and device therefor
US9591313B2 (en) Video encoder with transform size preprocessing and methods for use therewith
US20160057444A1 (en) Method and apparatus for encoding or decoding an image with inter layer motion information prediction according to motion information compression scheme
US9294765B2 (en) Video encoder with intra-prediction pre-processing and methods for use therewith
US9979976B2 (en) Light-weight video coding system and decoder for light-weight video coding system
KR20220098284A (en) Limited memory access window for motion vector refinement
CN111698500B (en) Encoding and decoding method, device and equipment
TWI790662B (en) Encoding and decoding method, apparatus and device thereof
WO2019080892A1 (en) Method and device for determining motion vector of affine coding block
WO2020001591A1 (en) Decoding and encoding methods and apparatus thereof
WO2020001624A1 (en) Method and apparatus for determining motion vector
WO2020010741A1 (en) Video encoder, video decoder, and corresponding method
WO2020253728A1 (en) Encoding method and device
WO2020007306A1 (en) Decoding and encoding method and device
TWI748522B (en) Video encoder, video decoder, and related methods
WO2020063598A1 (en) A video encoder, a video decoder and corresponding methods
Jubran et al. Sequence-level reference frames in video coding
WO2010061515A1 (en) Dynamic image encoding device, encoding method, dynamic image decoding device, and decoding method
WO2019196650A1 (en) Method and apparatus for determining motion vector, and device thereof
Ates Enhanced low bitrate H. 264 video coding using decoder-side super-resolution and frame interpolation
KR101525325B1 (en) Intra prediction mode determination method and apparatus

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

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

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19825547

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19825547

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)