Video Coding Method and Apparatus, Bitstream, Decoder, Encoder, and Storage Medium

JP2025520866A5Pending Publication Date: 2025-08-01GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
JP2024577033
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2022-07-01
Filing Date
2022-08-24
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

The existing video coding technologies, such as Merge mode and adaptive reordering of merge candidates with template matching (ARMC-TM), face challenges in further improving coding performance due to inefficiencies in selecting and ordering motion information candidates.

Method used

A method that determines an initial motion information candidate list including both first and second types of motion information candidates, orders these candidates based on motion information of adjacent and non-adjacent blocks, and ensures that N second type candidates participate in the ordering to reduce bit usage and enhance inter-prediction accuracy.

Benefits of technology

This approach reduces bit usage and improves coding efficiency by allowing high-matching second type candidates to be positioned earlier in the list, enhancing inter-prediction accuracy and overall decoding performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a coding method and apparatus, a bitstream, a decoder, an encoder, and a storage medium. The decoding method includes the following. Determine an initial motion information candidate list for the current block. The initial motion information candidate list includes a first type of motion information candidate and a second type of motion information candidate. Based on the motion information of adjacent blocks and / or non-adjacent blocks of the current block, the first type of motion information candidate is determined, and based on a reference image index set by a preset rule and a motion vector having a preset value, the second type of motion information candidate is constructed. Perform ordering on the partial motion information candidates in the initial motion information candidate list to determine the motion information candidate list for the current block. The partial motion information candidates include at least one first type of motion information candidate and N second type of motion information candidates, where N is a positive integer. Decode the bitstream to determine the motion information candidate index for the current block. Based on the motion information candidate index and the motion information candidate list for the current block, determine the inter prediction value for the current block. Decode the bitstream to determine the residual value for the current block. Based on the residual value and the inter prediction value for the current block, determine the reconstructed value for the current block.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Reference to Related Applications This application is filed based on PCT International Application No. PCT / CN2022 / 103418 filed on July 1, 2022, claims the priority of the PCT international application, and all its contents are incorporated herein by reference.

[0002] Embodiments of this application relate to the field of coding, and more specifically, to video coding methods and devices, bitstreams, decoders, and encoders.

Background Art

[0003] The Merge mode is an inter-coding mode that directly uses the reference picture index and motion vector (MV) for motion vector prediction (MVP) as the motion vector information of the current block. In the Merge mode, it is necessary to construct a merge candidate list. On the encoding side, through rate-distortion optimization, one merge candidate in the merge candidate list is selected as the optimal merge candidate for the current block, and the index of the selected optimal merge candidate in the merge candidate list is encoded and signaled (i.e., written) to the bitstream to represent the MV and reference picture index of the current block. On the decoding side, the syntax elements are analyzed to determine whether to use the Merge mode. In the Merge mode, further, the syntax elements are analyzed to obtain the index of the optimal merge candidate of the current block in the merge candidate list, obtain the optimal merge candidate of the current block based on the merge candidate list, and further obtain the predicted block of the current block. Next, the residual block is decoded, and operations such as transformation, quantization, and entropy coding are performed on the residual block to complete the reconstruction of the current block.

[0004] Also, adaptive reordering of merge candidates with template matching (also referred to as ARMC-TM or ARMC) is a technique that performs reordering on an initial merge candidate list based on template matching costs. Based on this, after the construction of the merge candidate list is completed, in the ARMC technique, the merge candidates in the merge candidate list are ordered according to the ascending order of the template matching costs. Generally, in the ARMC technique, the order of the optimal merge candidate finally selected on the encoding side in the merge candidate list is made as early as possible, the coding efficiency of the index of the optimal merge candidate is improved, and the coding efficiency can be improved. However, with the development of technology, how to further improve the coding performance with the ARMC technique still remains a technical problem to be solved in this field.

Summary of the Invention

[0005] Embodiments of the present application provide a video coding method and apparatus, a bitstream, a decoder, an encoder, and a storage medium. Thereby, the coding performance can be further improved.

[0006] In a first aspect, embodiments of the present application provide a video decoding method. The method is applied to a decoder and includes the following. Determine an initial motion information candidate list for the current block. The initial motion information candidate list includes a first type of motion information candidate and a second type of motion information candidate. Based on the motion information of adjacent blocks and / or non-adjacent blocks of the current block, the first type of motion information candidate is determined, and based on a reference picture index set by a preset rule and a motion vector having a preset value, the second type of motion information candidate is constructed. Perform ordering on the partial motion information candidates in the initial motion information candidate list to determine the motion information candidate list for the current block. The partial motion information candidates include at least one type-1 motion information candidate and N type-2 motion information candidates, where N is a positive integer. Decode the bitstream to determine the motion information candidate index for the current block. Based on the motion information candidate index and the motion information candidate list for the current block, determine the inter prediction value for the current block. Decode the bitstream to determine the residual value for the current block. Based on the residual value and the inter prediction value for the current block, determine the reconstructed value for the current block.

[0007] Thus, the partial motion information candidates participating in the ordering in the current block's initial motion information candidate list include not only at least one first type of motion information candidate, but also N second type of motion information candidates. Therefore, on the one hand, for the encoding side, the following situation can be avoided. When all of the second type of motion information candidates in the current block's initial motion information candidate list participate in the ordering, if a certain candidate among the second type of motion information candidates is selected as the motion information candidate of the current block, the number of bits required for the corresponding candidate index increases. In other words, in the embodiments of the present application, the N second type of motion information candidates in the current block's initial motion information candidate list also participate in the ordering. When a certain candidate among the second type of motion information candidates participating in the ordering is selected as the motion information candidate of the current block, since the index of that candidate may be small, the number of bits required for coding can be reduced, and the coding efficiency can be improved. On the other hand, for the decoding side, the following situation can be avoided. All of the second type of motion information candidates in the current block's initial motion information candidate list are located at the end of the list. Since the second type of motion information candidates have a large rate-distortion cost, they are not selected as the motion information candidates of the current block. However, the degree of matching between the reference block corresponding to a certain motion information candidate among the second type of motion information candidates and the current block is high. If the second type of motion information candidates are not selected, the accuracy of the inter prediction decreases. In other words, in the embodiments of the present application, the N second type of motion information candidates in the current block's initial motion information candidate list also participate in the ordering. As a result, there is an opportunity for the second type of motion information candidates corresponding to the reference blocks with a high degree of matching with the current block to be arranged at the front, increasing the chance that the motion information candidates are selected as the motion information candidates of the current block, increasing the probability of improving the accuracy of the inter prediction, that is, improving the decoding performance.

[0008] In a second aspect, embodiments of the present application provide a video encoding method. The method is applied to an encoder and includes the following content. Determine the initial motion information candidate list of the current block. The initial motion information candidate list includes the first type of motion information candidate and the second type of motion information candidate. Based on the motion information of the adjacent blocks and / or non-adjacent blocks of the current block, the first type of motion information candidate is determined, and based on the reference image index set by a preset rule and the motion vector having a preset value, the second type of motion information candidate is constructed. Perform sorting on the partial motion information candidates in the initial motion information candidate list to determine the motion information candidate list of the current block. The partial motion information candidates include at least one first type of motion information candidate and N second type of motion information candidates, where N is a positive integer. Based on the determined motion information candidate list of the current block, determine the motion information candidate index of the current block. Encode the motion information candidate index of the current block and signal the encoded bits to the bitstream.

[0009] In a third aspect, an embodiment of the present application provides a video decoding apparatus. The video decoding apparatus is applied to a decoder and includes a first determination module, a first sorting module, a decoding module, a second determination module, and a third determination module. The first determination module is configured to determine the initial motion information candidate list of the current block. The initial motion information candidate list includes the first type of motion information candidate and the second type of motion information candidate. Based on the motion information of the adjacent blocks and / or non-adjacent blocks of the current block, the first type of motion information candidate is determined, and based on the reference image index set by a preset rule and the motion vector having a preset value, the second type of motion information candidate is constructed. The first ordering module is configured to perform ordering on the partial motion information candidates in the initial motion information candidate list to determine the motion information candidate list of the current block. The partial motion information candidates include at least one first type of motion information candidate and N second type of motion information candidates, where N is a positive integer. The decoding module is configured to decode the bitstream to determine the motion information candidate index of the current block. The second determination module is configured to determine the inter prediction value of the current block based on the motion information candidate index and the motion information candidate list of the current block. The decoding module is further configured to decode the bitstream to determine the residual value of the current block. The third determination module is configured to determine the reconstructed value of the current block based on the residual value and the inter prediction value of the current block.

[0010] In a fourth aspect, an embodiment of the present application provides a video encoding apparatus. The video encoding apparatus is applied to an encoder and includes a fourth determination module, a second ordering module, a fifth determination module, and an encoding module. The fourth determination module is configured to determine the initial motion information candidate list of the current block. The initial motion information candidate list includes a first type of motion information candidate and a second type of motion information candidate. The first type of motion information candidate is determined based on the motion information of the adjacent blocks and / or non-adjacent blocks of the current block, and the second type of motion information candidate is constructed based on a reference picture index set by a preset rule and a motion vector having a preset value. The second ordering module is configured to perform ordering on the partial motion information candidates in the initial motion information candidate list to determine the motion information candidate list of the current block. The partial motion information candidates include at least one first type of motion information candidate and N second type of motion information candidates, where N is a positive integer. The fifth determination module is configured to determine a motion information candidate index of the current block based on the determined list of motion information candidates of the current block. The encoding module is configured to encode the motion information candidate index of the current block and signal the encoded bits to a bitstream.

[0011] In a fifth aspect, an embodiment of the present application provides a decoder. The decoder includes a first memory and a first processor. The first memory is configured to store a computer program executable by the first processor. When the first processor executes the computer program, it is configured to execute the video decoding method described in the embodiment of the present application.

[0012] In a sixth aspect, an embodiment of the present application provides an encoder. The encoder includes a second memory and a second processor. The second memory is configured to store a computer program executable by the second processor. When the second processor executes the computer program, it is configured to execute the video encoding method described in the embodiment of the present application.

[0013] In a seventh aspect, an embodiment of the present application provides a bitstream. The bitstream is generated by encoding a motion information candidate index of the current block into bits. The motion information candidate index of the current block is obtained by the video encoding method described in the embodiment of the present application.

[0014] In an eighth aspect, an embodiment of the present application provides an electronic device. The electronic device includes a processor and a computer-readable storage medium. The processor is suitable for executing a computer program. A computer program is stored in the computer-readable storage medium. When the computer program is executed by the processor, the video decoding method described in the embodiment of the present application is realized, or when the computer program is executed by the processor, the video encoding method described in the embodiment of the present application is realized.

[0015] In a ninth aspect, an embodiment of the present application provides a computer-readable storage medium. A computer program is stored in the computer-readable storage medium. When the computer program is executed, the video decoding method described in the embodiment of the present application is realized, or the video encoding method described in the embodiment of the present application is realized.

[0016] It should be noted that the above general description and the detailed description to be described later are merely exemplary and explanatory, and do not limit the present application.

Brief Description of Drawings

[0017] The drawings here are incorporated into the specification and form a part of the specification. These drawings show embodiments that conform to the present application and are used to explain the technical solution of the present application together with the specification. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can obtain other drawings from these drawings without creative efforts.

[0018] The illustrated flowchart is merely an exemplary explanation and does not necessarily include all contents and operations / steps, nor is it necessarily executed in the described order. For example, some operations / steps may be separated, or some operations / steps may be combined or partially combined. Therefore, the actual execution order may vary according to the actual situation.

Figure 1

Figure 2

Figure 3

Figure 4

Figure 5

Figure 6

Figure 7

Figure 8

Figure 9

Figure 10

Figure 11

Figure 12

Figure 13

Figure 14

Figure 15

Figure 16

Figure 17

Figure 18

Figure 19

Figure 20

DETAILED DESCRIPTION OF THE INVENTION

[0019] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the following will further describe the specific technical solutions of the present application in more detail with reference to the drawings in the embodiments of the present application. The following embodiments are used to explain the present application, but not to limit the scope of the present application.

[0020] All technical and scientific terms used in this specification have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present application belongs, unless otherwise specifically defined. The terms used in this specification are for the purpose of explaining the embodiments of the present application and are not intended to limit the present application.

[0021] In the following description, it relates to "some embodiments", "this embodiment", "the embodiments of this application" and their examples, all of which describe a subset of all possible embodiments. "Some embodiments" may be the same subset or different subsets of all possible embodiments, and it can be understood that they may be combined with each other as long as there is no contradiction.

[0022] Hereinafter, with reference to the drawings, the technical solutions in the embodiments of this application will be described.

[0023] The solution according to the embodiments of this application can be applied to the technical field of digital video coding. For example, the technical field includes, but is not limited to, the field of image coding, the field of video coding, the field of hardware video coding, the field of dedicated circuit video coding, and the field of real-time video coding. Also, the solution according to the embodiments of this application can be combined with the audio video coding standard (AVS), the second-generation AVS standard (AVS2), or the third-generation AVS standard (AVS3). By way of example, it includes, but is not limited to, the H.264 / audio video coding (AVC) standard, the H.265 / high efficiency video coding (HEVC) standard, and the H.266 / versatile video coding (VVC) standard. Further, with the solution according to the embodiments of this application, lossy compression or lossless compression can be performed on an image. The lossless compression may be visually lossless compression or mathematically lossless compression.

[0024] A block-based hybrid coding framework is used in video coding standards. Specifically, each image in a video is divided into square largest coding units (LCUs) or coding tree units (CTUs) of the same size (e.g., 128×128, 64×64, etc.). Each largest coding unit or coding tree unit can also be divided into rectangular coding units (CUs) based on rules. The coding unit may further be divided into a prediction unit (PU), a transform unit (TU), etc. The hybrid coding framework includes modules such as prediction, transform, quantization, entropy coding, and loop filter. The prediction module includes intra prediction and inter prediction. Inter prediction includes motion estimation and motion compensation. Since there is a strong correlation between adjacent samples in a video image, in video coding technology, the intra prediction method is used to eliminate the spatial redundancy between adjacent samples. In intra prediction, only the information of the same image is referred to predict the sample information within the current divided block. Since there is a strong similarity between adjacent images in a video, in video coding technology, the inter prediction method can be used to eliminate the temporal redundancy between adjacent images and improve the coding efficiency. In inter prediction, by referring to the image information of different frames, motion estimation can be used to search for the motion vector information that best matches the current divided block. Through transformation, the predicted image block is transformed into the frequency domain to perform energy redistribution. By combining transformation and quantization, information that is not sensitive to the human eye can be removed and is used to eliminate visual redundancy.Entropy coding can be used to remove character redundancy based on the current context model and the probability information of the binary bit stream.

[0025] In the process of digital video encoding, the encoder first reads a black-and-white image or a color image from the original video sequence, and then can encode the black-and-white image or the color image. Here, the black-and-white image can include samples of the luma component, and the color image can include samples of the chroma component. Optionally, the color image can further include samples of the luma component. The color format of the original video sequence can be, for example, the luma-chroma (YCbCr, YUV) format or the red-green-blue (RGB) format. Specifically, after reading the black-and-white image or the color image, the encoder divides it into blocks, generates a predicted block of the current block by performing intra prediction or inter prediction on the current block, subtracts the predicted block from the original block of the current block to obtain a residual block, transforms and quantizes the residual block to obtain a quantized coefficient matrix, and entropy-codes the quantized coefficient matrix and outputs it to a bit stream. In the process of digital video decoding, the decoding side generates a predicted block of the current block by performing intra prediction or inter prediction on the current block. Also, the decoding side decodes the bit stream to obtain a quantized coefficient matrix, inverse quantizes and inverse-transforms the quantized coefficient matrix to obtain a residual block, adds the predicted block and the residual block to obtain a reconstructed block. The reconstructed block can be used to form a reconstructed image. The decoding side loop filters the reconstructed image based on the image or block to obtain a decoded image.

[0026] The current block can be, for example, the current coding unit (CU) or the current prediction unit (PU).

[0027] Note that on the encoding side as well, in order to obtain the decoded image, processing similar to that on the decoding side is necessary. The decoded image can be a reference image for inter prediction of subsequent images. Block partitioning information, prediction, transformation, quantization, entropy coding, loop filtering, and other mode information or parameter information determined on the encoding side are output to the bitstream as necessary. The decoding side analyzes and analyzes the existing information to determine the same block partitioning information, prediction, transformation, quantization, entropy coding, loop filtering, and other mode information or parameter information as on the encoding side. Thereby, it is ensured that the decoded image obtained on the encoding side is the same as the decoded image obtained on the decoding side. The decoded image obtained on the encoding side is usually also called the reconstructed image. During prediction, the current block may be divided into prediction units, and during transformation, the current block may be divided into transformation units. The division of the prediction unit and the transformation unit may be the same or different. Of course, the above is only the basic flow of the video codec in the block-based hybrid coding framework. With the development of technology, some modules or some steps in the flow in the framework may be optimized. This application is applicable to the basic flow of the video codec in the block-based hybrid coding framework.

[0028] To facilitate understanding, first, the encoding framework according to this application will be briefly described.

[0029] FIG. 1 is a block diagram showing an encoding framework 100 according to an embodiment of this application.

[0030] As shown in FIG. 1, the encoding framework 100 may include an intra prediction unit 180, an inter prediction unit 170, a residual unit 110, a transform and quantization unit 120, an entropy encoding unit 130, an inverse transform and inverse quantization unit 140, and a loop filtering unit 150. Optionally, the encoding framework 100 may further include a decoded image buffer unit 160. The encoding framework 100 is also referred to as a hybrid framework encoding mode.

[0031] The intra prediction unit 180 or the inter prediction unit 170 can predict an image block waiting for coding and output a prediction block. The residual unit 110 can calculate a residual block, that is, the difference between the prediction block and the image block waiting for coding, based on the prediction block and the image block waiting for coding. The transform and quantization unit 120 is used to perform operations such as transform and quantization on the residual block, thereby removing information that is not sensitive to the human eye and eliminating visual redundancy. Optionally, the residual block before being transformed and quantized by the transform and quantization unit 120 may be called a temporal residual block, and the temporal residual block after being transformed and quantized by the transform and quantization unit 120 may be called a frequency residual block or a frequency-domain residual block. The entropy encoding unit 130 can output a bitstream based on the quantized transform coefficient output by the transform and quantization unit 120 after receiving the quantized transform coefficient. For example, the entropy encoding unit 130 can remove character redundancy based on a target context model and probability information of a binary bitstream. For example, the entropy encoding unit 130 can be used for context-based adaptive binary arithmetic coding (CABAC). The entropy encoding unit 130 may also be called a header information encoding unit. Optionally, in the present application, the image block waiting for coding may also be called an original image block or a target image block. The prediction block may also be called a prediction image block or an image prediction block, and may also be called a prediction signal or prediction information.The reconstruction block may also be referred to as a reconstructed image block or an image reconstruction block, and may also be referred to as a reconstruction signal or reconstruction information. Further, on the encoding side, the image block waiting for encoding may also be referred to as an encoding block or an encoding image block. On the decoding side, the image block waiting for encoding may also be referred to as a decoding block or a decoding image block. The image block waiting for encoding may be a CTU or a CU.

[0032] In the encoding framework 100, the difference between the prediction block and the image block waiting for encoding is calculated to obtain a residual block, and processes such as transformation and quantization are performed on the residual block, and the residual block is transmitted to the decoding side. Accordingly, after receiving and analyzing the bitstream on the decoding side, a residual block is obtained through steps such as inverse transformation and inverse quantization, and a reconstruction block is obtained by adding the residual block to the prediction block obtained by being predicted by the decoding side.

[0033] Note that the inverse transform and inverse quantization unit 140, loop filtering unit 150, and decoded image buffer unit 160 within the encoding framework 100 can be used to form a decoder. The intra prediction unit 180 or the inter prediction unit 170 can predict an image block waiting for coding based on existing reconstructed blocks, and as a result, it can be ensured that the encoding side utilizes the reference image in the same manner as the decoding side. In other words, the encoder can replicate the processing loop of the decoder, thereby generating the same prediction as the decoding side. Specifically, the quantized transform coefficients are inverse-transformed and inverse-quantized by the inverse transform and inverse quantization unit 140, and the approximate residual block on the decoding side is replicated. After a prediction block is added to this approximate residual block, through the loop filtering unit 150, it is possible to smoothly filter the effects such as block-based processing and blocking artifacts due to quantization. The image block output from the loop filtering unit 150 can be stored in the decoded image buffer unit 160 for use in subsequent image prediction.

[0034] It should be understood that FIG. 1 is merely an example of this application and should not be construed as a limitation of this application.

[0035] For example, the loop filtering unit 150 within the encoding framework 100 can include a deblocking filter (DBF) and a sample adaptive offset (SAO) filter. The role of the DBF is to remove blocking artifacts, and the role of the SAO is to remove the ringing effect. In other embodiments of the present application, a neural-network-based loop filtering algorithm can be used in the encoding framework 100 to improve the compression efficiency of video. Or, the encoding framework 100 can be a deep learning neural-network-based video coding hybrid framework. In one embodiment, based on the deblocking filter and the SAO filter, a convolutional neural network-based model can be used to calculate the result after sample filtering. The network structure in the luminance component of the loop filtering unit 150 and the network structure in the chrominance component may be the same or different. Considering that more visual information is included in the luminance component, the luminance component can be used to guide the filtering of the chrominance component to improve the reconstruction quality of the chrominance component.

[0036] The related content of intra prediction and inter prediction will be described below.

[0037] In inter prediction, the image information of different images can be referenced, and the temporal redundancy is eliminated by using motion estimation to search for the motion vector information that best matches the image block waiting for coding. The images used for inter prediction can be P-frames and / or B-frames. A P-frame refers to a forward predicted image, and a B-frame refers to a bi-directionally predicted image.

[0038] In intra prediction, in order to eliminate spatial redundancy, only the information of the same image is referred to, and the sample information within the image block waiting to be coded is predicted. The image used for intra prediction may be an I frame. For example, according to the coding order from left to right and from top to bottom, the upper left image block, the upper image block, and the left image block can be used as reference information to predict the image block waiting to be coded. The image block waiting to be coded can also be used as the reference information for the next image block. In this way, the entire image can be predicted. When the input digital video is in a color format such as the YUV4:2:0 format, each 4 pixels of each image frame of the digital video consists of 4 Y components and 2 UV components. In the encoding framework, the Y component (i.e., the luminance block) and the UV component (i.e., the chrominance block) can be encoded respectively. Similarly, the decoding side can decode according to the format.

[0039] For the intra prediction process, in intra prediction, an angle prediction mode and a non-angle prediction mode are used to perform prediction on the image block waiting to be coded to obtain a prediction block. Based on the rate-distortion information calculated from the prediction block and the image block waiting to be coded, the optimal prediction mode of the image block waiting to be coded is selected, and the prediction mode can be transmitted to the decoding side via the bitstream. The decoding side can obtain the prediction mode through parsing, obtain the prediction block of the target decoding block through prediction, and add the prediction block to the temporal residual block obtained by the transmission of the bitstream to obtain the reconstructed block.

[0040] Through the development of digital video coding standards over the years, the non-angular prediction mode is relatively stable and includes the average value mode and the planar mode. The angular prediction mode has been increasing with the evolution of digital video coding standards. Taking the H series of international digital video coding standards as an example, the H.264 / AVC standard only has 8 types of angular prediction modes and 1 type of non-angular prediction mode. In H.265 / HEVC, it is extended to 33 types of angular prediction modes and 2 types of non-angular prediction modes. In H.266 / VVC, the intra prediction mode is further extended, and there are 67 types of conventional prediction modes and non-conventional prediction modes, namely matrix weighted intra-frame prediction (MIP) modes for luminance blocks. These 67 types of conventional prediction modes include the planar mode, the DC mode, and 65 types of angular prediction modes. The planar mode is usually used to process blocks with gradually changing textures, the DC mode is usually used to process flat regions as the name implies, and the angular prediction mode is usually used to process blocks with relatively obvious angular textures.

[0041] Note that in this application, the current block used for intra prediction may be a square block or a rectangular block.

[0042] Furthermore, since all intra prediction blocks are square, the usage probabilities of each angular prediction mode are equal. When the length and width of the current block are not equal, for a horizontal block (where the width is greater than the height), the usage probability of the upper reference sample is greater than that of the left reference sample, and for a vertical block (where the height is greater than the width), the usage probability of the upper reference sample is less than that of the left reference sample. When predicting a rectangular block, the conventional angular prediction mode is changed to a wide-angle prediction mode. When predicting a rectangular block using the wide-angle prediction mode, the prediction angle range of the current block is larger than the prediction angle range when predicting a rectangular block using the conventional angular prediction mode. Optionally, when using the wide-angle prediction mode, the index of the conventional angular prediction mode can still be used to transmit the signal. Accordingly, after receiving the signal, the decoding side can change the conventional angular prediction mode to the wide-angle prediction mode. Thereby, the total number of intra prediction modes and the intra mode encoding method may not change.

[0043] Furthermore, based on the size of the current block, the intra prediction mode to be executed can be determined or selected. For example, based on the size of the current block, a wide-angle prediction mode can be determined or selected to perform intra prediction on the current block. For example, when the current block is a rectangular block (with different width and height), the wide-angle prediction mode can be used to perform intra prediction on the current block. The ratio of the width to the height of the current block (i.e., the aspect ratio) can be used to determine the angular prediction mode to be replaced and the angular prediction mode after replacement in the wide-angle prediction mode. For example, when predicting the current block, as the angular prediction mode after replacement, any intra prediction mode with an angle not exceeding the diagonal of the current block (from the lower left corner to the upper right corner of the current block) can be selected.

[0044] FIG. 2 is a block diagram showing a decoding framework 200 according to an embodiment of the present application.

[0045] As shown in FIG. 2, the decoding framework 200 may include an entropy decoding unit 210, an inverse transform and inverse quantization unit 220, a residual unit 230, an intra prediction unit 240, an inter prediction unit 250, a loop filtering unit 260, and a decoded image buffer unit 270. The entropy decoding unit 210 receives and analyzes a bitstream to obtain a prediction block and a frequency domain residual block. For the frequency domain residual block, steps such as inverse transform and inverse quantization can be performed through the inverse transform and inverse quantization unit 220 to obtain a temporal residual block. The residual unit 230 can obtain a reconstructed block by adding the prediction block obtained by being predicted by the intra prediction unit 240 or the inter prediction unit 250 to the temporal residual block obtained after inverse transform and inverse quantization are performed through the inverse transform and inverse quantization unit 220.

[0046] To facilitate the understanding of the technical solution of this application, the related content will be described below.

[0047] (1) MV prediction process in merge mode.

[0048] The Merge mode is an inter-coding mode that directly uses the reference picture index and motion vector (MV) for motion vector prediction (MVP) as the motion vector information of the current block. In the Merge mode, it is necessary to construct a merge candidate list. On the encoding side, through rate-distortion optimization, one merge candidate in the merge candidate list is selected as the optimal merge candidate for the current block, and the index of the selected optimal merge candidate in the merge candidate list is encoded and signaled (i.e., written) to the bitstream to represent the MV and reference picture index of the current block. On the decoding side, the syntax elements are analyzed to determine whether to use the Merge mode. In the Merge mode, further, the syntax elements are analyzed to obtain the index of the optimal merge candidate of the current block in the merge candidate list, obtain the optimal merge candidate of the current block based on the merge candidate list, and further obtain the predicted block of the current block. Next, the residual block is decoded, and operations such as transformation, quantization, and entropy coding are performed on the residual block to complete the reconstruction of the current block.

[0049] Also, the adaptive reordering of merge candidates by template matching (also referred to as ARMC-TM or ARMC) is a technique that performs reordering on the initial merge candidate list based on the template matching cost. Based on this, after the construction of the merge candidate list is completed, in the ARMC technique, the merge candidates in the merge candidate list are ordered in ascending order of the template matching cost. Generally, in the ARMC technique, the order of the optimal merge candidate finally selected on the encoding side in the merge candidate list is made as early as possible to improve the coding efficiency of the index of the optimal merge candidate and improve the coding efficiency.

[0050] FIG. 3 is a schematic diagram showing the MV prediction process 310 in the Merge mode according to an embodiment of the present application.

[0051] As shown in FIG. 3, the MV prediction process 310 in the merge mode may include the following.

[0052] S311: Construct a merge candidate list.

[0053] Exemplarily, constructing a merge candidate list may include constructing an input to the merge candidate list and constructing an output of the merge candidate list. Taking the current block as the current luminance coding block as an example, the input to the merge candidate list includes the position (xCb, yCb) of the upper left corner sample of the current luminance coding block, the width cbWidth of the current luminance coding block, and the height cbHeight of the current luminance coding block with respect to the upper left corner luminance sample of the current image. The output of the merge candidate list includes the merge candidate list mergeCandList and the number numOrigMergeCand of merge candidates in the merge candidate list before the zero motion vector merge candidate is filled.

[0054] Exemplarily, the merge candidate list may include at least one of a spatial merge candidate, a temporal merge candidate, a non-neighbouring spatial merge candidate, a history-based merge candidate, a pairwise average merge candidate, and a zero motion vector merge candidate. Note that all of the above merge candidates may participate in the construction of the merge candidate list, or only some of the above merge candidates may participate in the construction of the merge candidate list, and the present application is not specifically limited thereto.

[0055] Exemplarily, the number of merge candidates in the merge candidate list is recorded by three parameters: numCurrMergeCand, numOrigMergeCand, and MaxNumMergeCand. MaxNumMergeCand represents the maximum number of merge candidates allowed in the merge candidate list, numCurrMergeCand represents the number of merge candidates already added to the list recorded during the construction of the merge candidate list, and numOrigMergeCand represents the number of merge candidates in the merge candidate list before the zero motion vector merge candidates are filled.

[0056] S312: Perform reordering on the merge candidate list using the ARMC technique.

[0057] For the current merge candidate waiting for ordering, first obtain the template matching cost of the current merge candidate by calculating the template matching cost, and then perform ordering on the current merge candidate based on the template matching cost of the current merge candidate. For example, perform ordering on the numSortMVP merge candidates based on the template matching costs of the numSortMVP merge candidates in the merge candidate list.

[0058] S313: Determine the optimal merge candidate based on the candidate index obtained by being analyzed by the decoding side.

[0059] On the encoder side, the encoder selects an optimal merge candidate from the reordered merge candidate list based on rate distortion optimization, and transmits the candidate index corresponding to the optimal merge candidate in the bitstream. On the decoder side, the decoder obtains the candidate index corresponding to the optimal merge candidate transmitted in the bitstream by parsing, i.e., merge_idx[xCb][yCb], and selects the optimal merge candidate N from the reordered merge candidate list based on the candidate index corresponding to the optimal merge candidate. Taking the current block being the current luma coding block as an example, (xCb, yCb) represents the position of the current luma coding block, and N = mergeCandList[ merge_idx[ xCb ][ yCb ] ].

[0060] S314: Improve the optimal merge candidate using template matching (TM) technology or decoder-side motion vector refinement (DMVR) technology on the multi-pass decoder side.

[0061] S315: Perform motion compensation on the current block using the improved optimal merge candidate.

[0062] Exemplarily, using the improved optimal MVP, find the optimal matching block in the reference image, process the sample values of the optimal matching block to obtain the predicted sample values of the current block. When performing motion compensation on the current block using the improved optimal merge candidate, the compensation effect can be improved. Of course, S314 may also be an optional step, that is, the decoding side may directly perform motion compensation on the current block using the optimal merge candidate without improving the optimal merge candidate. The present application is not specifically limited thereto.

[0063] (2) Method for constructing the merge candidate list.

[0064] FIG. 4 is an exemplary flowchart showing a method 320 for constructing a merge candidate list according to an embodiment of the present application.

[0065] As shown in FIG. 4, the method 320 for constructing a merge candidate list can include the following.

[0066] S321: Add a spatial merge candidate.

[0067] During the construction of the merge candidate list, first, a spatial merge candidate is added.

[0068] For example, a spatial merge candidate can be constructed using the reference picture index and MV of an image block adjacent to the left side of the current block and / or an image block adjacent to the upper side of the current block.

[0069] FIG. 5 is an exemplary flowchart showing a spatial merge candidate according to an embodiment of the present application.

[0070] As shown in FIG. 5, the image block B1 represents the rightmost image block directly above the current block, the image block A1 represents the lowermost image block directly to the left of the current block, the image block B0 represents the image block closest to the upper right of the current block, the image block A0 represents the image block closest to the lower left of the current block, and the image block B2 represents the image block closest to the upper left of the current block. B1, A1, B0, A0, and B2 are sequentially inspected and added in the order of B1→A1→B0→A0→B2, and at most four spatial merge candidates are selected for the merge candidate list. If the image block B1, A1, B0, A0, or B2 is unavailable, for example, if all are in the intra coding mode or there are duplicate MVs in the redundant inspection, the image block is not added to the merge candidate list.

[0071] Since the image block adjacent to the left side of the current block and / or the image block adjacent to the upper side of the current block is an encoded or decoded image block, a spatial merge candidate can be constructed directly based on the reference image index and MV of the encoded or decoded image block.

[0072] Exemplarily, the redundancy check method can be executed in two ways.

[0073] In the first redundancy check method, if the MV value of the spatial merge candidate is the same as the MV value of a certain specific merge candidate already existing in the merge candidate list, and the reference image index of the spatial merge candidate is the same as the reference image index of the above certain specific merge candidate, the spatial merge candidate is considered redundant and not added to the merge candidate list. Optionally, in the normal merge mode, usually, the redundancy check is performed in this way.

[0074] In the second redundancy check method, if the reference image index of the spatial merge candidate is the same as the reference image index of a certain specific merge candidate already existing in the merge candidate list, and the MV of the spatial merge candidate is close to the MV of the above certain specific merge candidate, the spatial merge candidate is considered redundant and not added to the merge candidate list. Optionally, in the TM merge mode, usually, the redundancy check is performed in this way.

[0075] Exemplarily, when the reference picture index of a spatial merge candidate is the same as the reference picture index of a certain merge candidate already existing in the merge candidate list, and the difference between the MV of the spatial merge candidate and the MV of the certain merge candidate is equal to or less than a preset threshold, it is determined that there is redundancy between the spatial merge candidate and the certain merge candidate. Optionally, the preset threshold can be set based on the number of samples S in the current block. For example, when S < 64, the threshold is set to 1 << 4. When 64 <= S < 256, the threshold is set to 2 << 4. When S >= 256, the threshold is set to 4 << 4. x << y represents shifting x to the left by y bits in binary format. Specifically, the most significant bit is shifted out, and the empty positions of the least significant bits are filled with 0s. <= represents being less than or equal to, < represents being less than, and >= represents being greater than or equal to.

[0076] Exemplarily, the spatial merge candidate may be a merge candidate including a bidirectional MV.

[0077] In a situation where a spatial merge candidate includes bidirectional MVs (e.g., a first MV and a second MV), the reference picture index of the first MV of the spatial merge candidate is the same as the reference picture index of the first MV of a certain specific merge candidate, the reference picture index of the second MV of the spatial merge candidate is the same as the reference picture index of the second MV of the certain specific merge candidate, and when both the horizontal difference and the vertical difference between the first MV of the spatial merge candidate and the first MV of the certain specific merge candidate, and the horizontal difference and the vertical difference between the second MV of the spatial merge candidate and the second MV of the certain specific merge candidate are smaller than a preset threshold, it is determined that there is redundancy between the spatial merge candidate and the certain specific merge candidate. In other words, there exists a certain specific merge candidate in the merge candidate list, and both the horizontal difference and the vertical difference between the first MV of the certain specific merge candidate and the first MV of the spatial merge candidate, and the horizontal difference and the vertical difference between the second MV of the certain specific merge candidate and the second MV of the spatial merge candidate are smaller than the preset threshold, and the reference picture index of the first MV of the certain specific merge candidate is the same as the reference picture index of the first MV of the spatial merge candidate, and the reference picture index of the second MV of the certain specific merge candidate is the same as the reference picture index of the second MV of the spatial merge candidate. In this case, it can be determined that there is redundancy between the spatial merge candidate and the certain specific merge candidate.

[0078] Exemplarily, the spatial merge candidate may be a merge candidate including the first MV (or the second MV).

[0079] In a situation where the spatial merge candidate includes the first MV (or the second MV), the reference picture index of the first MV (or the second MV) of the spatial merge candidate is the same as the reference picture index of the first MV (or the second MV) of a certain specific merge candidate, and when both the horizontal difference and the vertical difference between the first MV (or the second MV) of the spatial merge candidate and the first MV (or the second MV) of the certain specific merge candidate are smaller than a preset threshold value, it is determined that there is redundancy between the spatial merge candidate and the certain specific merge candidate. In other words, there exists a certain specific merge candidate in the merge candidate list, and when both the horizontal difference and the vertical difference between the first MV (or the second MV) of the certain specific merge candidate and the first MV (or the second MV) of the spatial merge candidate are smaller than a preset threshold value, and the reference picture index of the first MV (or the second MV) of the certain specific merge candidate is the same as the reference picture index of the first MV (or the second MV) of the spatial merge candidate, it can be determined that there is redundancy between the spatial merge candidate and the certain specific merge candidate.

[0080] Exemplarily, after completing the inspection and addition of the spatial merge candidate, the value of numCurrMergeCand can be recorded and updated, and the value of numOrigMergeCand can also be updated.

[0081] S322: Add the temporal merge candidate.

[0082] After completing the addition of the spatial merge candidate, select the temporal merge candidate and add it to the merge candidate list. Exemplarily, after completing the inspection and addition of the spatial merge candidate, the value of numCurrMergeCand can be recorded and updated, and the value of numOrigMergeCand can also be updated. If numCurrMergeCand is smaller than MaxNumMergeCand, the temporal merge candidate can continue to be added.

[0083] Exemplarily, a preset number of temporal merge candidates can be added to the merge candidate list.

[0084] Exemplarily, when adding a temporal merge candidate, it is necessary to perform a redundancy check on the temporal merge candidate and the candidates already existing in the merge candidate list. The specific inspection method may be the same as or different from the redundancy inspection method for spatial merge candidates. To avoid duplication, the description will not be repeated here.

[0085] Exemplarily, after completing the inspection and addition of temporal merge candidates, the value of numCurrMergeCand can be recorded and updated, and the value of numOrigMergeCand can also be updated.

[0086] Exemplarily, the temporal merge candidates may be obtained or derived from the input and output angles.

[0087] Input: Information of the current block.

[0088] Taking the example that the current block is a luminance coding block, the input may further include the position (xCb, yCb) of the luminance coding block, the width cbWidth of the luminance coding block, the height cbHeight of the luminance coding block, and the reference image index refIdxLXCol. X is 0 or 1.

[0089] Output: Temporal merge candidates.

[0090] The reference image index of the temporal merge candidate is the input reference image index.

[0091] When adding a temporal merge candidate, it is possible to input a merge candidate list without the added temporal merge candidate and output a merge candidate list with the added temporal merge candidate. That is, the temporal merge candidate can be added from the perspective of input and output. The input merge candidate list can include the reference image indexes refIdxL0N (index of reference image L0) and refIdxL1N (index of reference image L1) corresponding to each merge candidate in the merge candidate list, the prediction list usage flags predFlagL0N (used to indicate whether to use reference image L0) and predFlagL1N (used to indicate whether to use reference image L1) corresponding to each merge candidate, the motion vectors mvL0N (MV of the merge candidate with respect to the reference block in reference image L0) and mvL1N (MV of the merge candidate with respect to the reference block in reference image L1) corresponding to each merge candidate, and the number numCurrMergeCand of merge candidates in the input merge candidate list.

[0092] Exemplarily, the MV of the temporal merge candidate can be constructed using the MV of the collocated image block in the collocated image of the current image.

[0093] Note that the collocated image of the current image may be an encoded image adjacent to the current image in the temporal domain. Optionally, the collocated image of the current image can be indicated by the syntax element collocated_ref_idx in the header information of the current image, or an encoded image adjacent to the current image in the temporal domain. Accordingly, the collocated image block may be an image block corresponding to the reference position of the current block in the collocated image. For example, the collocated image block may be an image block at the reference position of the current block in the collocated image.

[0094] FIG. 6 is a schematic diagram showing the reference position according to an embodiment of the present application.

[0095] As shown in FIG. 6, when the image block at the C0 position in the collocated image of the current image is unavailable, or when the coding mode for the image block at the C0 position does not meet the requirements, the image block at the C1 position in the collocated image of the current image is used as the collocated image block.

[0096] Note that this application does not specifically limit the method of adding time merge candidates. For example, the C0 position and the C1 position in FIG. 6 are only examples of this application and should not be understood as limitations to this application. For example, in other alternative embodiments, the reference position may include other positions or a plurality of positions. Accordingly, when adding time merge candidates, motion vector information (i.e., merge candidates) at some preset positions may be used to add time merge candidates. Sorting may be performed on the motion vector information within a preset candidate range based on the template matching cost, and some motion vector information with a small template matching cost may be selected to add time merge candidates. Alternatively, without performing sorting, the template matching costs of the motion vector information within the preset candidate range may be compared, and directly, some motion vector information such as the motion vector information with the minimum template matching cost and the motion vector information with the second smallest template matching cost may be selected to add time merge candidates.

[0097] Generally, since the time interval between the current image and the reference image of the current image is different from the time interval between the collocated image and the reference image of the collocated image, generally, the MV of the collocated image block cannot be directly used for the time merge candidate, and corresponding scaling adjustment needs to be performed according to the positional relationship with the reference image.

[0098] FIG. 7 is a schematic diagram showing the relationship between the MV of the collocated image block and the MV of the time merge candidate according to the embodiment of this application.

[0099] As shown in FIG. 7, assume that the time interval between the current image and the reference image of the current image is tb, and the time interval between the collocated image and the reference image of the collocated image is td. For example, both tb and td may be POC (picture order count) differences. In this case, the temporal merge candidate of the current block is calculated as follows. JPEG2025520866000002.jpg19150MV col is the MV of the collocated image block. MVP cur indicates the MV of the temporal merge candidate of the current block.

[0100] Exemplarily, when the current image in which the current block is located is a P frame, a unidirectional prediction temporal merge candidate can be constructed and added to the merge candidate list. When the current image is a B frame, a bidirectional prediction temporal merge candidate is constructed and added to the merge candidate list. Note that the unidirectional prediction temporal merge candidate may include the first MV (or the second MV), and the bidirectional prediction temporal merge candidate may include the bidirectional MV. For the method of deriving the MV in each direction of the first MV (or the second MV) and the bidirectional MV, reference can be made to the method of deriving the MV of the temporal merge candidate described above. To avoid duplication, the description will not be repeated here.

[0101] S323: Add non-adjacent spatial merge candidates.

[0102] Exemplarily, after the inspection and addition of the temporal merge candidates are completed, the value of numCurrMergeCand can be recorded and updated, and the value of numOrigMergeCand can also be updated. If numCurrMergeCand is smaller than MaxNumMergeCand, continue to add non-adjacent spatial merge candidates. For the spatial merge candidates, only the motion information (i.e., MV and reference image index) of the adjacent blocks of the current block is used. For the non-adjacent spatial merge candidates, the motion information (i.e., MV and reference image index) of the representative non-adjacent blocks at the peripheral positions of the current block can be used.

[0103] Exemplarily, a preset number of non - adjacent spatial merge candidates can be added to the merge candidate list.

[0104] Exemplarily, when adding non - adjacent spatial merge candidates, it is necessary to perform a redundancy check on the non - adjacent spatial merge candidates and the candidates already existing in the merge candidate list. The specific inspection method may be the same as or different from the redundancy inspection method of spatial merge candidates. To avoid duplication, the description will not be repeated here.

[0105] Exemplarily, after completing the inspection and addition of non - adjacent spatial merge candidates, the value of numCurrMergeCand can be recorded and updated, and the value of numOrigMergeCand can also be updated.

[0106] FIG. 8 is a schematic diagram showing the positions of non - adjacent blocks for constructing non - adjacent spatial merge candidates according to an embodiment of the present application.

[0107] As shown in FIG. 8, the adjacent blocks for constructing spatial merge candidates can include the image block at position 1 to the image block at position 5, and the non - adjacent blocks for constructing non - adjacent spatial merge candidates can include the image block at position 6 to the image block at position 23.

[0108] Note that this application does not specifically limit the method of adding non - adjacent space merge candidates. For example, positions 1 to 23 in FIG. 8 are merely examples of this application and should not be understood as limitations on this application. For example, in other alternative embodiments, the positions of non - adjacent blocks for constructing non - adjacent space merge candidates may include other positions. Accordingly, when adding non - adjacent space merge candidates, motion vector information at some preset positions may be used to add non - adjacent space merge candidates. Ordering may be performed on the motion vector information within a preset candidate range based on the template matching cost, and some motion vector information with a small template matching cost may be selected to add non - adjacent space merge candidates. Also, without performing ordering, the template matching costs of the motion vector information within the preset candidate range may be compared, and directly, some motion vector information such as the motion vector information with the minimum template matching cost, the motion vector information with the second - smallest template matching cost, etc. may be selected to add non - adjacent space merge candidates.

[0109] S324: Add history - based merge candidates.

[0110] Exemplarily, after completing the inspection and addition of non - adjacent space merge candidates, record and update the value of numCurrMergeCand, and also update the value of numOrigMergeCand. If numCurrMergeCand is smaller than MaxNumMergeCand, continue to add history - based merge candidates.

[0111] Exemplarily, for constructing a history-based merge candidate list, the motion information of previously coded blocks (i.e., MV and reference picture index) is stored in a list with a specified maximum length, which means that the history-based merge candidate list is continuously updated along with the coding process. After each picture block using inter-coding is encoded or decoded, its motion information (i.e., MV and reference picture index) is regarded as a new candidate and added to the end of the history-based merge candidate list. Next, a redundancy check is performed on the candidates already existing in the history-based merge candidate list. If the newly added candidate overlaps with the candidates already existing in the list, the candidates already existing in the history-based merge candidate list are deleted. Finally, the maximum length of the history-based merge candidate list is maintained according to the first-in-first-out principle. That is, if the number of candidates in the history-based merge candidate list after a new candidate is added is greater than the maximum length, the earliest candidate is deleted. The life cycle of the history-based merge candidate list is each CTU row, i.e., the history-based merge candidate list is cleared whenever a new CTU row is reached.

[0112] Based on the above, after completing the inspection and addition of non-adjacent spatial merge candidates, if there are empty positions in the merge candidate list, a redundancy check is performed on the candidates in the history-based merge candidate list one by one from the end (the latest) to the front, and non-redundant candidates are added to the subsequent empty positions in the merge candidate list until the options in the history-based merge candidate list are exhausted or the merge candidate list is full.

[0113] Exemplarily, after completing the inspection and addition of non-adjacent spatial merge candidates, the value of numCurrMergeCand is recorded and updated, and the value of numOrigMergeCand is also updated.

[0114] S325: Add pairwise average merge candidates.

[0115] Exemplarily, after completing the inspection and addition of history-based merge candidates, the value of numCurrMergeCand can be recorded and updated, and the value of numOrigMergeCand can also be updated. If numCurrMergeCand is smaller than MaxNumMergeCand, pairwise average merge candidates are continuously added. That is, after completing the inspection and addition of non-adjacent spatial merge candidates, if there is an empty position in the merge candidate list, the merge candidate list is continuously supplemented with pairwise average merge candidates.

[0116] Exemplarily, when adding pairwise average merge candidates, it is necessary to perform redundant inspections on the pairwise average merge candidates and the candidates already existing in the merge candidate list. The specific inspection method may be the same as or different from the redundant inspection method for spatial merge candidates. To avoid duplication, the description will not be repeated here.

[0117] Exemplarily, pairwise average merge candidates are obtained based on the first two candidates in the merge candidate list.

[0118] If both Cand0 and Cand1 exist, the MV of the pairwise average merge candidate is calculated as follows. JPEG2025520866000003.jpg14150mvAvgLX represents the pairwise average merge candidate, LX represents the reference image index, X is 0 or 1, mvCand0LX is the MV of the first merge candidate with the reference image index LX in the merge candidate list, mvCand1LX is the MV of the second merge candidate with the reference image index LX in the merge candidate list, + represents the vector addition operation, and >> represents the right shift operation.

[0119] If only Cand0 exists, the MV of the pairwise average merge candidate is calculated as follows. mvAvgLX = mvCand0LX.

[0120] If only Cand1 exists, the MV of the pairwise average merge candidate is calculated as follows. mvAvgLX = mvCand1LX.

[0121] Exemplarily, when the current image where the current block is located is a P-frame, a unidirectional prediction average merge candidate is constructed. When the current image is a B-frame, a bidirectional prediction average merge candidate is constructed. Note that the unidirectional prediction average merge candidate can include the first MV (or the second MV), and the bidirectional prediction average merge candidate can include the bidirectional MV. For the method of deriving the MV in each direction of the first MV (or the second MV) and the bidirectional MV, reference can be made to the method of deriving the MV of the average merge candidate described above. To avoid duplication, the description will not be repeated here.

[0122] Exemplarily, after completing the inspection and addition of the pairwise average merge candidate, the value of numCurrMergeCand is recorded and updated, and the value of numOrigMergeCand is also updated. In this case, the final value of numOrigMergeCand that records the number of merge candidates in the merge candidate list before the zero motion vector merge candidate is filled can be obtained.

[0123] S326: Add a zero motion vector merge candidate.

[0124] Exemplarily, after completing the inspection and addition of the pairwise average merge candidate, the value of numCurrMergeCand is recorded and updated, and the value of numOrigMergeCand is also updated. If numCurrMergeCand is still smaller than MaxNumMergeCand, continue to add zero motion vector merge candidates.

[0125] Exemplarily, zero motion vector merge candidates can be added based on the input and output angles.

[0126] Input: Merge candidate list, reference image indexes refIdxL0N (index of reference image L0) and refIdxL1N (index of reference image L1) corresponding to each merge candidate in the merge candidate list, prediction list usage flags predFlagL0N (used to indicate whether to use reference image L0) and predFlagL1N (used to indicate whether to use reference image L1) corresponding to each merge candidate, motion vectors mvL0N (MV of the merge candidate with respect to the reference block in reference image L0) and mvL1N (MV of the merge candidate with respect to the reference block in reference image L1) corresponding to each merge candidate, number of merge candidates numCurrMergeCand in the merge candidate list.

[0127] Output: Merge candidate list, number of merge candidates numCurrMergeCand in the merge candidate list, reference image indexes refIdxL0zeroCandm (index of reference image L0) and refIdxL1zeroCandm (index of reference image L1) corresponding to each zero motion vector merge candidate newly added to the merge candidate list, prediction list usage flags predFlagL0zeroCandm (used to indicate whether to use reference image L0) and predFlagL1zeroCandm (used to indicate whether to use reference image L1) corresponding to each zero motion vector merge candidate, motion vectors mvL0zeroCandm (MV of each zero motion vector merge candidate with respect to the reference block in reference image L0) and mvL1zeroCandm (MV of each zero motion vector merge candidate with respect to the reference block in reference image L0).

[0128] Exemplarily, when numCurrMergeCand is smaller than MaxNumMergeCand, a unidirectional or bidirectional zero motion vector merge candidate with a value of (0, 0) is filled into the merge candidate list. The reference picture index corresponding to the first zero motion vector merge candidate is 0, and zero motion vector merge candidates are constructed based on each reference picture corresponding to L0 or L1 in ascending order of the reference picture index until the number of merge candidates in the merge candidate list reaches a predetermined number. When the reference picture index reaches the maximum index in ascending order and the number of merge candidates in the merge candidate list has not reached the predetermined number, the reference picture indices of the subsequently added zero motion vector merge candidates are all 0, or restarted from 0 to the maximum index in ascending order.

[0129] Note that in the process of adding zero motion vector merge candidates, no redundancy check is performed. The purpose is that the number of candidates filled into the merge candidate list can reach MaxNumMergeCand. The number numZeroMergeCand of the filled zero motion vector merge candidates is equal to numCurrMergeCand - numOrigMergeCand.

[0130] (3) Reordering of the merge candidate list by the ARMC technique.

[0131] In the ARMC technique, reordering is performed on the merge candidates in the merge candidate list based on the template matching cost. The ARMC technique is applied to the normal merge mode, Affine merge mode, or TM merge mode. In the TM merge mode, ARMC can be performed before the candidate TM improvement.

[0132] After constructing the merge candidate list, when reordering the merge candidate list using the ARMC technique, the merge candidates in the merge candidate list may be divided into several subgroups. For example, in the normal merge mode and the TM merge mode, the size of the subgroup is 5, and in the Affine merge mode, the size of the subgroup is 3. The merge candidates in each subgroup are ordered in ascending order based on the template matching cost. The template matching cost is the sum of absolute differences (SAD) value between the template of the current block and the template of the reference block for the merge candidate. Of course, the matching cost is not limited to SAD. To improve the matching accuracy, the sum of absolute transformed differences (SATD), the sum of squares for error (SSE), the mean square error (MSE), or other more complex costs may be used. This application is not specifically limited thereto.

[0133] Exemplarily, the template of the current block includes the reconstructed samples in the row above the current block and the reconstructed samples in the column to the left of the current block.

[0134] Exemplarily, when bidirectional prediction is used for the merge candidate, the template of the reference block for the merge candidate is also obtained by bidirectional prediction.

[0135] FIG. 9 is a schematic diagram showing the template of the reference block for the merge candidate and the template of the current block according to an embodiment of the present application.

[0136] As shown in FIG. 9, the template of the current block includes the reconstructed samples in the row above the current block and the reconstructed samples in the column to the left of the current block. When bidirectional prediction is used for the merge candidate, the first reference block template includes the reconstructed samples in the row above the first reference block and the reconstructed samples in the column to the left of the first reference block in the first reference image, and the second reference block template includes the reconstructed samples in the row above the second reference block and the reconstructed samples in the column to the left of the second reference block in the second reference image. When calculating the template matching cost of the merge candidate, first, the average value of the first reference block template and the second reference block template can be calculated. Then, based on the obtained average value and the template of the current block, an SAD value can be obtained, and the obtained SAD value can be used as the template matching cost of the merge candidate.

[0137] Exemplarily, for each merge candidate based on a sub-block of size equal to Wsub×Hsub, the template of the reference block for the merge candidate may include an upper reference template and a left reference template. The upper reference template includes the templates of Wsub×1 reference sub-blocks, and the left reference template includes the templates of 1×Hsub reference sub-blocks.

[0138] FIG. 10 is another schematic diagram showing the template of the reference block for the merge candidate and the template of the current block according to an embodiment of the present application.

[0139] As shown in FIG. 10, the template of the current block includes the reconstruction samples in the row above the current block and the reconstruction samples in the column to the left of the current block. For each merge candidate based on sub-blocks equal in size to 4×4, the template of the reference block for the merge candidate may include an upper reference template and a left reference template. The upper reference template includes the templates of 4×1 reference sub-blocks, and the left reference template includes the templates of 1×4 reference sub-blocks. The template of 4×1 reference sub-blocks includes the reference sub-block of sub-block A (i.e., A ref), the reference sub-block of sub-block B (i.e., B ref), the reference sub-block of sub-block C (i.e., C ref), and the reference sub-block of sub-block D (i.e., D ref). The template of 1×4 reference sub-blocks includes the reference sub-block of sub-block A (i.e., A ref), the reference sub-block of sub-block E (i.e., E ref), the reference sub-block of sub-block F (i.e., F ref), and the reference sub-block of sub-block G (i.e., G ref). For example, the upper reference template is a template obtained by splicing the upper templates of 4×1 reference sub-blocks, and the left reference template is a template obtained by splicing the left templates of 1×4 reference sub-blocks. Based on this, after obtaining the template of the reference block by splicing, the SAD between the template of the reference block and the template of the current block can be obtained, and it can be used as the template matching cost of the merge candidate.

[0140] Of course, in other alternative embodiments, it is also possible to calculate the template matching cost of the merge candidate in other ways, and the present application is not specifically limited thereto.

[0141] In other alternative embodiments, the ARMC technology can also be extended to a combined inter and intra prediction (CIIP) mode, a bilateral matching (BM) merge mode, and an intra block copy (IBC) mode, which is not specifically limited in this application.

[0142] Hereinafter, an exemplary description will be given of the derivation algorithm for ARMC.

[0143] 1. Derivation algorithm for the number of candidates participating in ARMC ordering.

[0144] Exemplarily, the derivation algorithm for the number of candidates numSortMVP participating in ARMC ordering may be implemented as follows.

[0145] Input: The number of merge candidates numOrigMergeCand in the merge candidate list before zero motion vector merge candidates are filled.

[0146] Output: The number of merge candidates numSortMVP participating in ARMC ordering.

[0147] The value of numSortMVP is set equal to numOrigMergeCand output when constructing the merge candidate list, and numOrigMergeCand records the number of merge candidates in the merge candidate list before zero motion vector merge candidates are filled.

[0148] 2. Derivation algorithm for the reordered merge candidate list.

[0149] Exemplarily, the derivation algorithm for the reordered merge candidate list may be implemented as follows.

[0150] Inputs to the ARMC module: Information of the current block, the merge candidate list before ordering, the number numOrigMergeCand of merge candidates in the merge candidate list before zero motion vector merge candidates are filled.

[0151] Taking the current block as the current luminance coding block as an example, the inputs to the ARMC module can include the position (xCb, yCb) of the current luminance coding block, the width cbWidth of the luminance coding block, and the height cbHeight of the luminance coding block.

[0152] Output of the ARMC module: The reordered merge candidate list mergeCandList.

[0153] 3. Algorithm for deriving the reordered merge candidate list.

[0154] Exemplarily, the algorithm for deriving the reordered merge candidate list may be implemented as follows.

[0155] Inputs to the ARMC module: Information of the current block, the merge candidate list before ordering, the number numSortMVP of merge candidates participating in the ARMC ordering.

[0156] Taking the current block as the current luminance coding block as an example, the inputs to the ARMC module can include the position (xCb, yCb) of the current luminance coding block, the width cbWidth of the luminance coding block, and the height cbHeight of the luminance coding block.

[0157] Output of the ARMC module: The reordered merge candidate list mergeCandList.

[0158] Note that different values can be given to numSortMVP in different scenes. When performing sorting for all merge candidates, numSortMVP is set equal to MaxNumMergeCand. When performing sorting only for the merge candidates in the merge candidate list before the zero motion vector merge candidates are filtered, numSortMVP is set equal to numOrigMergeCand. When performing sorting for a predetermined number of merge candidates in the merge candidate list, numSortMVP can be set to other preset values. This application is not specifically limited thereto.

[0159] That is, in one embodiment, first, based on the derivation algorithm of the number of candidates participating in the ARMC sorting, the number of candidates participating in the ARMC sorting is determined, and then, based on the derivation algorithm of the re-ordered merge candidate list, the re-ordered merge candidate list can be derived. In another embodiment, the derivation step of the number numSortMVP of candidates participating in the ARMC sorting may be weakened and may be an optional step, that is, the re-ordered merge candidate list can be derived. In this case, the number numSortMVP of merge candidates participating in the ARMC sorting can be used as an input parameter, and can also be directly set equal to numOrigMergeCand or other corresponding values.

[0160] 4. Derivation algorithm for the template matching cost of the current merge candidate.

[0161] Exemplarily, the derivation algorithm for the template matching cost of the current merge candidate may be realized as follows.

[0162] Input: Information of the current block and the current merge candidate.

[0163] Taking the case where the current block is the current luminance coding block as an example, the input to the ARMC module can include the position (xCb, yCb) of the current luminance coding block, the width cbWidth of the luminance coding block, and the height cbHeight of the luminance coding block.

[0164] Output: The template matching cost of the current merge candidate.

[0165] In a specific embodiment, a preset area above and to the left of the current block is used as the template of the current block. Based on the reference image index and MV indicated by the current merge candidate, and also based on xCb and yCb, the template of the reference block is determined. Next, the template matching cost between the template of the reference block and the template of the current block is calculated. For example, the sum of absolute differences (SAD) can be mentioned. To improve the matching accuracy, the sum of absolute transformed differences (SATD), the sum of squared errors (SSE), the mean squared error (MSE), or other more complex costs may be used. Return to the calculated template matching cost of the current merge candidate.

[0166] (4) Improvements to the ARMC technology in the embodiments of the present application.

[0167] To ensure the construction effect of the merge candidate list, the ARMC technology may be extended to the construction process of the merge candidate list. Before adding the temporal merge candidates, several candidates with relatively small template matching costs can be selected from a plurality of temporal merge candidates using the ARMC technology, and then added to the merge candidate list. Similarly, before adding the non-adjacent spatial merge candidates, several candidates with relatively small template matching costs can be selected from a plurality of non-adjacent temporal merge candidates using the ARMC technology, and then added to the merge candidate list.

[0168] Furthermore, after constructing the merge candidate list, when reordering the merge candidate list using the ARMC technique, discard the idea of grouping and directly perform ordering on the entire merge candidate list to obtain a merge candidate list on which ARMC ordering has been performed.

[0169] FIG. 11 is a schematic diagram showing reordering based on the template matching cost for the entire merge candidate list by the ARMC technique according to an embodiment of the present application.

[0170] As shown in FIG. 11, assume that the merge candidate list sequentially includes merge candidates 0 to 9, and merge candidates 0 to 4 are merge candidates added before the zero motion vector merge candidate is added, and merge candidates 5 to 9 are the last added zero motion vector merge candidates. When directly performing ordering on the entire merge candidate list, the merge candidate list on which ARMC ordering has been performed sequentially includes merge candidate 0, merge candidates 5 to 9, merge candidate 1, merge candidate 2, merge candidate 4, and merge candidate 3.

[0171] However, since the end of the merge candidate list is filled with zero motion vector merge candidates, after performing ARMC ordering on the entire merge candidate list using the ARMC technique, there may be a plurality of zero motion vector merge candidates arranged at the beginning of the list. However, the arrangement of a plurality of zero motion vector merge candidates at the beginning of the list affects the coding efficiency of the candidate indexes of the optimal merge candidates. In view of the above, in the present application, the zero motion vector merge candidates filled at the end of the merge candidate list may not participate in the ARMC ordering, that is, it is considered to perform ARMC ordering only on the merge candidates other than the zero motion vector merge candidates in the merge candidate list. Thereby, it is possible to avoid the arrangement of a plurality of zero motion vector merge candidates at the beginning of the reordered list, and further reduce the influence on the coding efficiency of the candidate indexes of the optimal merge candidates. Also, it is no longer necessary to obtain and calculate templates for some of the zero motion vector merge candidates filled last, reducing the computational complexity of the ARMC technique.

[0172] FIG. 12 is a schematic diagram showing ARMC ordering for merge candidates other than zero motion vector merge candidates in a merge candidate list according to an embodiment of the present application using the ARMC technique.

[0173] As shown in FIG. 12, assume that the merge candidate list sequentially includes merge candidates 0 to 9, and merge candidates 0 to 4 are merge candidates added before the zero motion vector merge candidates are added, and merge candidates 5 to 9 are the zero motion vector merge candidates added last. When ARMC ordering is performed only on merge candidates 0 to 4 in the merge candidate list, the merge candidate list after ARMC ordering sequentially includes merge candidate 0, merge candidate 1, merge candidate 2, merge candidate 4, merge candidate 3, and merge candidates 5 to 9.

[0174] However, there are still the following problems with performing the ARMC ordering only on merge candidates other than zero motion vector merge candidates in the merge candidate list.

[0175] 1. During the construction of the merge candidate list, if there is no zero motion vector merge candidate for a merge candidate added before the zero motion vector merge candidate is filled into the merge candidate list, after performing the ARMC ordering in this way, the zero motion vector merge candidate will not participate in the ARMC ordering. When the encoder selects a zero motion vector merge candidate as the optimal MVP based on the merge candidate list on which the ARMC ordering has been performed, the number of bits required to encode the candidate index corresponding to the optimal merge candidate increases, and the coding performance deteriorates.

[0176] 2. Although the matching degree between the reference block corresponding to the zero motion vector merge candidate and the current block is high, the zero motion vector merge candidate filled into the merge candidate list does not participate in the ARMC ordering, that is, the zero motion vector merge candidate is located at the end of the merge candidate list after the ARMC ordering. Therefore, the zero motion vector merge candidate is not selected as the optimal MVP, and the prediction accuracy of the MV of the current block decreases. As a result, the deviation between the predicted value and the original value of the current block increases, and the coding performance may deteriorate.

[0177] In view of the above, the embodiments of the present application provide a video encoding method and a video decoding method. The video encoding method includes the following steps 101 to 104.

[0178] Step 101: The encoder determines the initial motion information candidate list of the current block. The initial motion information candidate list includes the first type of motion information candidates and the second type of motion information candidates. Based on the motion information of the adjacent blocks and / or the non-adjacent blocks of the current block, the first type of motion information candidates are determined, and based on the reference image index set by a preset rule and the motion vector having a preset value, the second type of motion information candidates are constructed.

[0179] Step 102: The encoder performs ordering on the partial motion information candidates in the initial motion information candidate list to determine the motion information candidate list of the current block. The partial motion information candidates include at least one first type of motion information candidate and N second type of motion information candidates, where N is a positive integer.

[0180] Step 103: The encoder determines the motion information candidate index of the current block based on the determined motion information candidate list of the current block.

[0181] Step 104: The encoder encodes the motion information candidate index of the current block and signals the encoded bits to the bitstream.

[0182] In an embodiment of the present application, the partial motion information candidates participating in the ordering in the initial motion information candidate list of the current block include not only at least one first type of motion information candidate, but also N second type of motion information candidates. Therefore, the following situation can be avoided. When all of the second type of motion information candidates in the initial motion information candidate list of the current block participate in the ordering, if a certain candidate among the second type of motion information candidates is selected as the motion information candidate of the current block, the number of bits required for the corresponding candidate index increases. In other words, in the embodiment of the present application, the N second type of motion information candidates in the initial motion information candidate list of the current block also participate in the ordering. When a certain candidate among the second type of motion information candidates participating in the ordering is selected as the motion information candidate of the current block, since the index of the candidate may be small, the number of bits required for coding can be reduced, and the coding efficiency can be improved.

[0183] The video decoding method includes the following steps 111 to 116.

[0184] Step 111: The decoder determines the initial motion information candidate list of the current block. The initial motion information candidate list includes a first type of motion information candidate and a second type of motion information candidate. Based on the motion information of the adjacent blocks and / or non-adjacent blocks of the current block, the first type of motion information candidate is determined, and based on the reference picture index set by a preset rule and the motion vector having a preset value, the second type of motion information candidate is constructed.

[0185] Step 112: The decoder performs an ordering on the partial motion information candidates in the initial motion information candidate list to determine the motion information candidate list of the current block. The partial motion information candidates include at least one first type of motion information candidate and N second type of motion information candidates, and N is a positive integer.

[0186] Step 113: The decoder decodes the bitstream to determine the motion information candidate index of the current block.

[0187] Step 114: The decoder determines the inter-prediction value of the current block based on the motion information candidate index and the motion information candidate list of the current block.

[0188] Step 115: The decoder decodes the bitstream to determine the residual value of the current block.

[0189] Step 116: The decoder determines the reconstructed value of the current block based on the residual value and the inter-prediction value of the current block.

[0190] In the embodiments of the present application, the partial motion information candidates participating in the ordering in the initial motion information candidate list of the current block include not only at least one first type of motion information candidate, but also N second type of motion information candidates. Therefore, the following situations can be avoided. All of the second type of motion information candidates in the initial motion information candidate list of the current block are located at the end of the list. Since the second type of motion information candidates have a large rate-distortion cost, they are not selected as the motion information candidates of the current block. However, the degree of matching between the reference block corresponding to a certain motion information candidate among the second type of motion information candidates and the current block is high. The non-selection of the second type of motion information candidates reduces the accuracy of inter-prediction. In other words, in the embodiments of the present application, the N second type of motion information candidates in the initial motion information candidate list of the current block also participate in the ordering. Thereby, the second type of motion information candidates corresponding to the reference blocks with a high degree of matching with the current block have an opportunity to be arranged at the front, increasing the chance that the motion information candidates are selected as the motion information candidates of the current block, increasing the probability of improving the accuracy of inter-prediction, that is, improving the decoding performance.

[0191] Hereinafter, further selectable embodiments of the above steps, related nouns, etc. will be described respectively.

[0192] In an embodiment of the present application, the types of motion information candidates included in the first type of motion information candidates are not limited, and may be at least one of spatial motion information candidates, temporal motion information candidates, non-adjacent spatial motion information candidates, history-based motion information candidates, and pairwise average motion information candidates. The motion information candidate is also called a merge candidate.

[0193] In some embodiments, the values of the two components of the motion vector having a preset value are both equal to 0. Therefore, the second type of motion information candidate may be called a zero motion vector merge candidate.

[0194] In some embodiments, the N second type of motion information candidates in the partial motion information candidates are the N second type of motion information candidates sequentially added to the initial motion information candidate list during the construction of the initial motion information candidate list.

[0195] Furthermore, in some embodiments, the N second type of motion information candidates in the partial motion information candidates are the N second type of motion information candidates ordered after the first type of motion information candidates in the initial motion information candidate list.

[0196] In some embodiments, the partial motion information candidates include all of the first type of motion information candidates in the initial motion information candidate list.

[0197] In some embodiments, N is a preset value. For example, the value of N is 1, 2, or 3. Also, for example, the value of N is less than or equal to the number of reference images permitted for use. Further, for example, the value of N is smaller than the number of the second type of motion information candidates in the initial motion information candidate list. The number of the second type of motion information candidates is 2 or more.

[0198] In some embodiments, there is no redundancy between the N second-type motion information candidates and the first-type motion information candidate. The N second-type motion information candidates in the partial motion information candidates are second-type motion information candidates in the initial motion information candidate list that do not satisfy the first condition. Further, in some embodiments, the first condition is that the motion vector of the second-type motion information candidate is equal to the motion vector of the first-type motion information candidate, and the reference image index of the second-type motion information candidate is equal to the reference image index of the first-type motion information candidate. Or, in some other embodiments, the first condition is that the second-type motion information candidate is close to the first-type motion information candidate in the partial motion information candidates. That the second-type motion information candidate is close to the first-type motion information candidate in the partial motion information candidates includes that the reference image index of the second-type motion information candidate is equal to the reference image index of the first-type motion information candidate, and at least one of the following conditions is satisfied, the absolute value of the difference between the vertical component of the motion vector of the second-type motion information candidate and the vertical component of the motion vector of the first-type motion information candidate is less than the first threshold, the absolute value of the difference between the horizontal component of the motion vector of the second-type motion information candidate and the horizontal component of the motion vector of the first-type motion information candidate is less than the second threshold, and at least one of the conditions is satisfied.

[0199] From another perspective, the N second-type motion information candidates in the partial motion information candidates are the second-type motion information candidates that satisfy the fourth condition in the initial motion information candidate list. In some embodiments, the fourth condition is that the second-type motion information candidate is different from the first-type motion information candidate in the partial motion information candidates. That the second-type motion information candidate is different from the first-type motion information candidate in the partial motion information candidates means that the motion vector of the second-type motion information candidate is not equal to the motion vector of the first-type motion information candidate, or the reference image index of the second-type motion information candidate is not equal to the reference image index of the first-type motion information candidate, or the motion vector of the second-type motion information candidate is not equal to the motion vector of the first-type motion information candidate and the reference image index of the second-type motion information candidate is not equal to the reference image index of the first-type motion information candidate.

[0200] In some other embodiments, the fourth condition is that the second-type motion information candidate is not close to the first-type motion information candidate in the partial motion information candidates. That the second-type motion information candidate is not close to the first-type motion information candidate in the partial motion information candidates means that the reference image index of the second-type motion information candidate is equal to the reference image index of the first-type motion information candidate and at least one of the following conditions is satisfied: The absolute value of the difference between the vertical component of the motion vector of the second-type motion information candidate and the vertical component of the motion vector of the first-type motion information candidate is greater than the first threshold. The absolute value of the difference between the horizontal component of the motion vector of the second-type motion information candidate and the horizontal component of the motion vector of the first-type motion information candidate is greater than the second threshold. At least one of the conditions holds.

[0201] In some other embodiments, the N second-type motion information candidates in the partial motion information candidates are the second-type motion information candidates that satisfy the second condition in the initial motion information candidate list.

[0202] Furthermore, in some embodiments, the second type of motion information candidate that satisfies the second condition includes the first second type of motion information candidate in the new order after the adaptive reordering for the second type of motion information candidate in the initial motion information candidate list.

[0203] In some other embodiments, the second type of motion information candidate that satisfies the second condition includes the second type of motion information candidate having the minimum template matching error in the initial motion information candidate list.

[0204] In some embodiments, the current block includes at least a first number of samples. Further, in some embodiments, the first number is 16.

[0205] In some other embodiments, the size of the current block satisfies a preset third condition.

[0206] Furthermore, in some embodiments, the third condition is that the width and height of the current block are less than or equal to a first preset size. For example, the first preset size is 128×128.

[0207] Furthermore, in some other embodiments, the third condition is that the width and height of the current block are greater than or equal to a second preset size. For example, the second preset size is 4×4.

[0208] Furthermore, in some other embodiments, the third condition is that the width and height of the current block are less than or equal to a first preset size and the width and height of the current block are greater than or equal to a second preset size. For example, the first preset size is 128×128 and the second preset size is 4×4.

[0209] In some embodiments, determining an order for partial motion information candidates in the initial motion information candidate list to determine the motion information candidate list for the current block includes determining a template matching error for the partial motion information candidates and performing an order for the partial motion information candidates based on the template matching error.

[0210] Furthermore, in some embodiments, determining a template matching error for the partial motion information candidates includes determining a template for the current block, determining a corresponding template in a reference image indicated by a reference image index of the partial motion candidate based on a motion vector of the partial motion information candidate, and determining a template matching error based on the template and the corresponding template.

[0211] Furthermore, in some embodiments, determining a template matching error based on the template and the corresponding template includes calculating an error between the template and the corresponding template based on a preset error criterion.

[0212] For example, the error criterion is one of SAD, SATD, MSE, and sum of squared differences (SSD). Accordingly, performing an order for the partial motion information candidates based on the template matching error includes performing an order for the partial motion information candidates in ascending order of the template matching error.

[0213] Furthermore, for example, the error criterion is one of a peak signal-to-noise ratio (PSNR) and a structural similarity (SSIM). Accordingly, performing ordering on the partial motion information candidates based on the template matching error includes performing ordering on the partial motion information candidates in descending order of the template matching error.

[0214] In some embodiments, the partial motion information candidates are M motion information candidates, and M is an integer greater than 1. Accordingly, determining the motion information candidate list of the current block includes determining that the motion information candidate indexes corresponding to the ordered partial motion information candidates in the motion information candidate list of the current block are from 0 to M-1.

[0215] In some embodiments, the method further includes determining other motion information candidates in the motion information candidate list of the current block other than the ordered partial motion information candidates.

[0216] In some embodiments, the motion information candidate indexes corresponding to other unordered motion information candidates or ordered other motion information candidates in the motion information candidate list of the current block are greater than the motion information candidate indexes corresponding to the ordered partial motion information candidates.

[0217] In some embodiments, the method further includes performing ordering on other motion information candidates in the same way as the method of performing ordering on the partial motion information candidates.

[0218] FIG. 13 is an exemplary flowchart showing an ordering method 400 according to an embodiment of the present application. Note that the ordering method 400 can be executed by an ordering device. For example, when the ordering device is a unit or module in a decoder or a decoding framework, the ordering method 400 can be executed by the decoder or the decoding framework 200 shown in FIG. 2. Further, for example, when the ordering device is a unit or module in an encoder or an encoding framework, the ordering method can be executed by the encoder or the encoding framework 100 shown in FIG. 1. For convenience of explanation, the ordering device will be described as an example hereinafter.

[0219] As shown in FIG. 13, the above ordering method 400 may include some or all of the following.

[0220] S410: Determine a first number of merge candidates participating in the ordering in the first merge candidate list based on zero motion vector merge candidates in the first merge candidate list.

[0221] S420: Perform ordering on the merge candidates in the first merge candidate list based on the first number to obtain a second merge candidate list.

[0222] Considering the zero motion vector merge candidates in the first merge candidate list, determine the first number of merge candidates participating in the ordering in the first merge candidate list. In other words, instead of directly determining the first number based on all the merge candidates in the first merge candidate list or from the angles of the non-zero motion vector merge candidates in the first merge candidate list, determine the first number based on the zero motion vector merge candidates in the first merge candidate list. This is advantageous in avoiding the situation where all zero motion vector merge candidates in the first merge candidate list either all participate in the ordering or none of them participate in the ordering. The accuracy of the second merge candidate list can be improved, and further coding performance can be improved.

[0223] In the embodiments of the present application, the first merge candidate list may be the merge candidate list related above, and the second merge candidate list may be an ordered merge candidate list. Therefore, for the specific embodiments of the merge candidate list, the related content according to S320 above can be referred to. Also, the present application aims to improve the number of merge candidates participating in the ordering when performing the ordering on the merge candidates in the first merge candidate list. For other principles related to ordering (for example, the derivation of the matching cost algorithm and the derivation of the ordered merge candidate list), the related content according to S312 can be referred to. Also, after obtaining the second merge candidate list, for the application of the second merge candidate list, the related content according to S314 and S315 above can be referred to. To avoid duplication, the description is omitted here.

[0224] In some embodiments, S410 may include the following content. Determine the first number based on whether there is redundancy between the Nth zero motion vector merge candidate in the first merge candidate list and the merge candidates before the Nth zero motion vector merge candidate in the first merge candidate list.

[0225] Exemplarily, when introducing a redundancy check for zero motion vector merge candidates in the first merge candidate list, after determining N first, the redundancy check can be performed only on the Nth zero motion vector merge candidate. Next, based on whether there is redundancy between the Nth zero motion vector merge candidate in the first merge candidate list and the merge candidates before the Nth zero motion vector merge candidate in the first merge candidate list, the first number is determined.

[0226] Exemplarily, the value of N is an integer greater than or equal to 1.

[0227] Exemplarily, the value of N is smaller than the total number of zero motion vector merge candidates in the first merge candidate list. That is, the Nth zero motion vector merge candidate is a zero motion vector merge candidate other than the last zero motion vector merge candidate in the first merge candidate list.

[0228] Exemplarily, based on whether there is redundancy between the Nth zero motion vector merge candidate and the merge candidates before the Nth zero motion vector merge candidate in the first merge candidate list, it is possible to determine whether to consider the first zero motion vector merge candidate to the Nth zero motion vector merge candidate, or whether the first zero motion vector merge candidate to the Nth zero motion vector merge candidate participates in the ordering.

[0229] Of course, in other alternative embodiments, based on whether there is redundancy between the Nth zero motion vector merge candidate and the merge candidates before the Nth zero motion vector merge candidate in the first merge candidate list, it is possible to determine whether to consider the first to the N-1th zero motion vector merge candidates, or whether the first to the N-1th zero motion vector merge candidates participate in the ordering. Further, based on whether there is redundancy between the Nth zero motion vector merge candidate and the merge candidates before the Nth zero motion vector merge candidate in the first merge candidate list, it is possible to determine whether to consider the Nth zero motion vector merge candidate, or whether the Nth zero motion vector merge candidate participates in the ordering.

[0230] Exemplarily, the first number derivation algorithm can be implemented as follows.

[0231] Input: the first merge candidate list and the Nth zero motion vector merge candidate.

[0232] Output: the number of merge candidates participating in the ordering, i.e., the first number.

[0233] The value of the first number is set to be equal to M+N-1 or M+N. M represents the number of merge candidates included in the first merge candidate list before the zero motion vector merge candidate is added to the first merge candidate list.

[0234] Note that N has different selectable values, for example, it may be 1, 2, or other numerical values.

[0235] In some embodiments, if there is redundancy between the Nth zero motion vector merge candidate and a merge candidate before the Nth zero motion vector merge candidate in the first merge candidate list, M + N - 1 is determined as the first number. Otherwise, M + N is determined as the first number. M represents the number of merge candidates included in the first merge candidate list before the zero motion vector merge candidate is added to the first merge candidate list.

[0236] Exemplarily, the Nth zero motion vector merge candidate may be referred to as the (M + N)th merge candidate in the first merge candidate list.

[0237] Exemplarily, M represents the number of merge candidates included in the first merge candidate list before the zero motion vector merge candidate is added to the first merge candidate list. More specifically, "before the zero motion vector merge candidate is added" may refer to "before the zero motion vector merge candidate is added after the addition of spatial merge candidates, temporal merge candidates, non-adjacent spatial merge candidates, history-based merge candidates, and pairwise average merge candidates is completed". In other words, M may be the number of merge candidates in the first merge candidate list after the addition of spatial merge candidates, temporal merge candidates, non-adjacent spatial merge candidates, history-based merge candidates, and pairwise average merge candidates to the first merge candidate list is completed.

[0238] Exemplarily, M may be referred to as numOrigMergeCand according to the above, and the first number may be referred to as numSortMVP, which is the number of merge candidates participating in the sorting according to the above. When performing a redundancy check on the numOrigMergeCand+N-th merge candidate (i.e., the N-th zero motion vector merge candidate) in the first merge candidate list, a redundancy check can be performed on the first numOrigMergeCand+N-1 merge candidates and the numOrigMergeCand+N-th merge candidate in the first merge candidate list. If there is redundancy, numSortMVP is set equal to numOrigMergeCand+N-1. If there is no redundancy, numSortMVP is set equal to numOrigMergeCand+N.

[0239] Exemplarily, taking N = 1 as an example, if there is redundancy between the first zero motion vector merge candidate and the merge candidates before the first zero motion vector merge candidate in the first merge candidate list, M is determined as the first number. Otherwise, M+1 is determined as the first number. M represents the number of merge candidates included in the first merge candidate list before zero motion vector merge candidates are added to the first merge candidate list.

[0240] In this embodiment, when there is no redundancy between the N-th zero motion vector merge candidate and the merge candidates before the N-th zero motion vector merge candidate in the first merge candidate list, the N-th zero motion vector merge candidate and the merge candidates before the N-th zero motion vector merge candidate in the first merge candidate list are both sorted to obtain a second merge candidate list. This is advantageous for avoiding problems caused by all zero motion vector merge candidates participating in the sorting, and it is also possible to ensure that zero motion vector merge candidates have the opportunity to participate in the sorting. As a result, zero motion vector merge candidates can be used as optimal merge candidates for post-processing and motion compensation, which can improve the quality to a certain extent and further improve the coding performance.

[0241] FIG. 14 is a schematic diagram showing an ARMC ordering based on a first number for a first merge candidate list according to an embodiment of the present application.

[0242] As shown in FIG. 14, the first merge candidate list sequentially includes merge candidates 0 to 9. Assume that merge candidates 0 to 4 are merge candidates added before the zero motion vector merge candidate is added, and merge candidates 5 to 9 are the last added zero motion vector merge candidates.

[0243] When the Nth zero motion vector merge candidate is the first zero motion vector merge candidate, that is, when N = 1, based on whether there is redundancy between the first zero motion vector merge candidate in the first merge candidate list and the merge candidates before the first zero motion vector merge candidate in the first merge candidate list, the number numSortMVP of merge candidates participating in the ordering is determined. For example, if there is redundancy between the first zero motion vector merge candidate and the merge candidates before the first zero motion vector merge candidate in the first merge candidate list, numSortMVP is determined to be 5 + 1 - 1 = 5. Otherwise, numSortMVP is determined to be 5 + 1 = 6. If numSortMVP is 6, ARMC ordering is performed on merge candidates 0 to 5. As shown in FIG. 14, the second merge candidate list after ARMC ordering sequentially includes merge candidate 0, merge candidate 5, merge candidate 1, merge candidate 2, merge candidate 4, and merge candidate 3, merge candidates 6 to 9.

[0244] In this embodiment, when there is no redundancy between the merge candidate already existing in the first merge candidate list and the first zero motion vector merge candidate, the first filled zero motion vector merge candidate and the previously added non-zero motion vector merge candidate are sorted in ARMC order to obtain the final second merge candidate list. That is, the first filled zero motion vector merge candidate (merge candidate 5) and the non-zero motion vector merge candidates already added to the first merge candidate list (i.e., merge candidates 0 to 4) are sorted in ascending order of the template matching cost. Thereby, not only can the zero motion vector merge candidates filled in the first merge candidate list be used, but also all of the zero motion vector merge candidates in the first merge candidate list can be avoided from participating in the ARMC sorting. The prediction accuracy of the MV of the current block is improved, and further, the coding performance of the current block is improved.

[0245] In some embodiments, when M + N is less than or equal to K, a first number is determined based on whether there is redundancy between the Nth zero motion vector merge candidate and the merge candidates before the Nth zero motion vector merge candidate in the first merge candidate list. K is the maximum number of allowed merge candidates in the first merge candidate list.

[0246] Exemplarily, M may be referred to as numOrigMergeCand according to the above, the first number may be referred to as numSortMVP, which is the number of merge candidates participating in the above sorting, the maximum number of merge candidates in the first merge candidate list may be denoted as MaxNumMergeCand, and the total number of zero motion vector merge candidates in the first merge candidate list may be denoted as numZeroMergeCand. In this case, when performing a redundancy check on the (numOrigMergeCand + N)-th merge candidate (i.e., the N-th zero motion vector merge candidate) in the first merge candidate list, if numOrigMergeCand + N is less than or equal to MaxNumMergeCand, or if numZeroMergeCand is greater than or equal to N, a redundancy check is performed on the (numOrigMergeCand + N)-th merge candidate (i.e., the N-th zero motion vector merge candidate) in the first merge candidate list. Otherwise, it is determined that no redundancy check is performed on the (numOrigMergeCand + N)-th merge candidate (i.e., the N-th zero motion vector merge candidate) in the first merge candidate list.

[0247] In some embodiments, N is determined based on the number of reference images available for the current block, and / or N is predefined.

[0248] Exemplarily, N is equal to the number of reference images available for the current block.

[0249] Exemplarily, the reference image indices of the zero motion vector merge candidates participating in the sorting are different. For example, the reference image indices are 0, 1, 2, etc.

[0250] Since the reference picture indexes of zero motion vector merge candidates filled in the first merge candidate list are not necessarily the same, there are certain differences among the zero motion vector merge candidates filled in the first merge candidate list. Here, N is set to be determined based on the number of reference pictures available for the current block. Thereby, it is possible to sort together several zero motion vector merge candidates with different reference picture indexes filled in the first merge candidate list and non-zero motion vector merge candidates in the first merge candidate list. Thereby, the prediction accuracy of the MV of the current block can be improved, and further, the coding performance of the current block can be improved.

[0251] Of course, in other alternative embodiments, the first number can also be determined or updated by redundant checking for some or all of the zero motion vector merge candidates in the first merge candidate list. This application is not specifically limited thereto.

[0252] As an example, based on the addition order of the zero motion vector merge candidates in the first merge candidate list, redundant checking can be performed on the zero motion vector merge candidates in the first merge candidate list. The first number is determined based on the order of the current zero motion vector merge candidate in the first merge candidate list until it is detected that the current zero motion vector merge candidate is the first zero motion vector merge candidate in the first merge candidate list that has no redundancy with the merge candidates before the current zero motion vector merge candidate in the first merge candidate list.

[0253] For example, based on the addition order of zero motion vector merge candidates in the first merge candidate list, redundant checks can be performed on the zero motion vector merge candidates in the first merge candidate list. M+N is determined as the first number until it is detected that the current zero motion vector merge candidate is the first zero motion vector merge candidate in the first merge candidate list that has no redundancy with the merge candidates before the current zero motion vector merge candidate in the first merge candidate list. M represents the number of merge candidates included in the first merge candidate list before the zero motion vector merge candidate is added to the first merge candidate list. N represents that the current zero motion vector merge candidate is the Nth zero motion vector merge candidate in the first merge candidate list. In other words, if the current zero motion vector merge candidate is the first zero motion vector merge candidate in the first merge candidate list that has no redundancy with the merge candidates before the current zero motion vector merge candidate in the first merge candidate list, both the current zero motion vector merge candidate and the merge candidates before the current zero motion vector merge candidate in the first merge candidate list can participate in the ordering. Or, if there is redundancy between the first N-1 zero motion vector merge candidates in the first merge candidate list and the merge candidates before the Nth zero motion vector merge candidate in the first merge candidate list, and there is no redundancy between the Nth zero motion vector merge candidate and the merge candidates before the Nth zero motion vector merge candidate in the first merge candidate list, M+N is determined as the first number. M represents the number of merge candidates included in the first merge candidate list before the zero motion vector merge candidate is added to the first merge candidate list. N represents that the current zero motion vector merge candidate is the Nth zero motion vector merge candidate in the first merge candidate list.

[0254] Furthermore, for example, based on the addition order of zero motion vector merge candidates in the first merge candidate list, a redundancy check can be performed on the zero motion vector merge candidates in the first merge candidate list. Determine whether there is redundancy between the current zero motion vector merge candidate and the merge candidates before the current zero motion vector merge candidate in the first merge candidate list. If there is no such redundancy, update the first number to be the number of merge candidates before the current zero motion vector merge candidate in the first merge candidate list plus one. That is, the current zero motion vector merge candidate and all the merge candidates before the current zero motion vector merge candidate all participate in the ordering, and the update of the first number stops. If there is such redundancy, update the first number to be the number of merge candidates included in the first merge candidate list before the current zero motion vector merge candidate is added to the first merge candidate list plus one, and continue to update the first number based on the redundancy check for the next zero motion vector merge candidate of the current zero motion vector merge candidate.

[0255] As another example, the first number can be determined or updated by performing a redundancy check on each zero motion vector merge candidate in the first merge candidate list.

[0256] For example, a redundancy check may be performed on each zero motion vector merge candidate in the first merge candidate list. For example, if there is no redundancy between the current zero motion vector merge candidate and the merge candidate before the current zero motion vector merge candidate in the first merge candidate list, the current zero motion vector merge candidate is determined to be a non-redundant zero motion vector merge candidate. Otherwise, the current zero motion vector merge candidate is determined to be a redundant zero motion vector merge candidate. Based on this, the sum of the number of non-redundant zero motion vector merge candidates and the number of non-zero motion vector merge candidates in the first merge candidate list can be determined as the first number. In this case, in the embodiments of the present application, the order of the zero motion vector merge candidates other than the non-redundant zero motion vector merge candidates in the first merge candidate list (i.e., the zero motion vector merge candidates that do not participate in the ordering) in the second merge candidate list is not specifically limited. For example, the relative order of the zero motion vector merge candidates that do not participate in the ordering in the first zero merge candidate list is the same as the relative order of the zero motion vector merge candidates that do not participate in the ordering in the second zero merge candidate list, and the zero motion vector merge candidates that do not participate in the ordering are located after the merge candidates that participate in the ordering.

[0257] In some embodiments, if the merge candidate before the Nth zero motion vector merge candidate in the first merge candidate list meets a preset condition, there is redundancy between the Nth zero motion vector merge candidate and the merge candidate before the Nth zero motion vector merge candidate in the first merge candidate list. Otherwise, there is no redundancy between the Nth zero motion vector merge candidate and the merge candidate before the Nth zero motion vector merge candidate in the first merge candidate list.

[0258] The preset condition is that the merge candidate before the Nth zero motion vector merge candidate includes at least one of the following. That is, A merge candidate having a reference picture index that is the same as the reference picture index of the N-th zero motion vector merge candidate and an MV that is the same as the motion vector (MV) of the N-th zero motion vector merge candidate. A merge candidate having a reference picture index that is the same as the reference picture index of the N-th zero motion vector merge candidate and an MV such that the difference between the MV of the N-th zero motion vector merge candidate and the MV is equal to or less than a first threshold value. A merge candidate having a reference picture index that is the same as the reference picture index of the N-th zero motion vector merge candidate and a reliability of the MV such that the difference between the reliability of the MV of the N-th zero motion vector merge candidate and the reliability of the MV is equal to or greater than a second threshold value. A merge candidate having an MV that is the same as the MV of the N-th zero motion vector merge candidate. A merge candidate having an MV such that the difference between the MV and the MV of the N-th zero motion vector merge candidate is equal to or less than a first threshold value. A merge candidate having a reliability of the MV such that the difference between the reliability of the MV and the reliability of the MV of the N-th zero motion vector merge candidate is equal to or greater than a second threshold value. includes at least one of the above.

[0259] In other words, the redundancy check method for the N-th zero motion vector merge candidate can be executed in four ways.

[0260] In the first redundancy check method, when the MV value of the N-th zero motion vector merge candidate is the same as the MV value of a certain specific merge candidate already existing in the first merge candidate list, and the reference picture index of the N-th zero motion vector merge candidate is the same as the reference picture index of the above certain specific merge candidate, the N-th zero motion vector merge candidate is regarded as redundant. Otherwise, the N-th zero motion vector merge candidate is regarded as non-redundant. Optionally, in the normal merge mode, usually, the redundancy check is performed in this way.

[0261] In the second redundancy checking method, if the reference picture index of the Nth zero motion vector merge candidate is the same as the reference picture index of a certain specific merge candidate already existing in the first merge candidate list, and the MV of the Nth zero motion vector merge candidate is close to the MV of the above certain specific merge candidate, the Nth zero motion vector merge candidate is regarded as redundant. Otherwise, the Nth zero motion vector merge candidate is regarded as non-redundant. Optionally, in the TM merge mode, usually, redundancy checking is performed in this way.

[0262] In the third redundancy checking method, if the reference picture index of the Nth zero motion vector merge candidate is the same as the reference picture index of a certain specific merge candidate already existing in the first merge candidate list, and the reliability of the MV of the Nth zero motion vector merge candidate is far from the reliability of the MV of the above certain specific merge candidate, the Nth zero motion vector merge candidate is regarded as redundant. Otherwise, the Nth zero motion vector merge candidate is regarded as non-redundant.

[0263] In the fourth redundancy checking method, if the MV value of the Nth zero motion vector merge candidate is the same as the MV value of a certain specific merge candidate already existing in the first merge candidate list, the Nth zero motion vector merge candidate is regarded as redundant. Otherwise, the Nth zero motion vector merge candidate is regarded as non-redundant.

[0264] In the fifth redundancy checking method, if the MV of the Nth zero motion vector merge candidate is close to the MV of a certain specific merge candidate already existing in the first merge candidate list, the Nth zero motion vector merge candidate is regarded as redundant. Otherwise, the Nth zero motion vector merge candidate is regarded as non-redundant.

[0265] In the sixth redundancy check method, if the reliability of the MV of the Nth zero motion vector merge candidate is far from the reliability of the MV of a certain specific merge candidate, the Nth zero motion vector merge candidate is considered redundant. Otherwise, the Nth zero motion vector merge candidate is considered not redundant.

[0266] Note that the difference between the MV of the merge candidate before the Nth zero motion vector merge candidate and the MV of the Nth zero motion vector merge candidate may be the difference obtained by subtracting the MV of the Nth zero motion vector merge candidate from the MV of the merge candidate before the Nth zero motion vector merge candidate, or may be the difference obtained by subtracting the MV of the merge candidate before the Nth zero motion vector merge candidate from the MV of the Nth zero motion vector merge candidate. For example, when the MV of the merge candidate before the Nth zero motion vector merge candidate is larger than the MV of the Nth zero motion vector merge candidate, the above difference may be the difference obtained by subtracting the MV of the Nth zero motion vector merge candidate from the MV of the merge candidate before the Nth zero motion vector merge candidate. Further, for example, when the MV of the merge candidate before the Nth zero motion vector merge candidate is smaller than the MV of the Nth zero motion vector merge candidate, the above difference may be the difference obtained by subtracting the MV of the merge candidate before the Nth zero motion vector merge candidate from the MV of the Nth zero motion vector merge candidate. Similarly, the difference between the reliability of the MV of the merge candidate before the Nth zero motion vector merge candidate and the reliability of the MV of the Nth zero motion vector merge candidate may be the difference obtained by subtracting the reliability of the MV of the Nth zero motion vector merge candidate from the reliability of the MV of the merge candidate before the Nth zero motion vector merge candidate, or may be the difference obtained by subtracting the reliability of the MV of the merge candidate before the Nth zero motion vector merge candidate from the reliability of the MV of the Nth zero motion vector merge candidate. For example, when the reliability of the MV of the merge candidate before the Nth zero motion vector merge candidate is larger than the reliability of the MV of the Nth zero motion vector merge candidate, the above difference may be the difference obtained by subtracting the reliability of the MV of the Nth zero motion vector merge candidate from the reliability of the MV of the merge candidate before the Nth zero motion vector merge candidate.Further, for example, when the reliability of the MV of the merge candidate before the Nth zero motion vector merge candidate is smaller than the reliability of the MV of the Nth zero motion vector merge candidate, the above difference may be a difference obtained by subtracting the reliability of the MV of the merge candidate before the Nth zero motion vector merge candidate from the reliability of the MV of the Nth zero motion vector merge candidate. In the present application, it is not specifically limited thereto.

[0267] Of course, in other alternative embodiments, the above preset conditions may be other conditions, and the present application is not specifically limited thereto.

[0268] For example, the preset condition may be that the merge candidate before the Nth zero motion vector merge candidate includes at least one of the following. That is, a merge candidate having a reference picture index that is the same as the reference picture index of the Nth zero motion vector merge candidate and an MV whose absolute value of the difference from the MV of the Nth zero motion vector merge candidate is equal to or less than a first threshold value, a merge candidate having a reference picture index that is the same as the reference picture index of the Nth zero motion vector merge candidate and a reliability of the MV whose absolute value of the difference from the reliability of the MV of the Nth zero motion vector merge candidate is equal to or greater than a second threshold value, a merge candidate having an MV whose absolute value of the difference from the MV of the Nth zero motion vector merge candidate is equal to or less than a first threshold value, a merge candidate having a reliability of the MV whose absolute value of the difference from the reliability of the MV of the Nth zero motion vector merge candidate is equal to or greater than a second threshold value, including at least one of them.

[0269] Note that whether there is redundancy between the MV of the N-th zero motion vector merge candidate and the MV of a certain merge candidate already existing in the first merge candidate list is only used for the determination of the first number and does not affect the construction of the first merge candidate list. That is, regardless of whether there is redundancy between the MV of the N-th zero motion vector merge candidate and the MV of a certain merge candidate already existing in the first merge candidate list, it is necessary to add the N-th zero motion vector merge candidate to the first merge candidate list.

[0270] Exemplarily, a merge candidate having an MV that is the same as the MV of the N-th zero motion vector merge candidate may be a merge candidate in which both the component MVx and the component MVy are 0.

[0271] In some embodiments, the first threshold is determined based on and / or predefined by the size of the current block, and the second threshold is determined based on and / or predefined by the size of the current block.

[0272] Exemplarily, based on the number of samples S in the current block, the threshold can be set. For example, when S < 64, the first threshold is 1 << 4. When 64 <= S < 256, the first threshold is 2 << 4. When S >= 256, the first threshold is 4 << 4. x << y represents shifting x to the left by y bits in binary format. Specifically, the upper bits are shifted out and the empty positions of the lower bits are filled with 0. <= represents being less than or equal to, < represents being less than, and >= represents being greater than or equal to.

[0273] In some embodiments, the difference between the MV and the MV of the N-th zero motion vector merge candidate being less than or equal to the first threshold includes the following. When the Nth zero motion vector merge candidate includes the first MV and the second MV, both the horizontal difference and the vertical difference between the first MV of the first merge candidate before the Nth zero motion vector merge candidate and the first MV of the Nth zero motion vector merge candidate are both less than or equal to the first threshold value, and both the horizontal difference and the vertical difference between the second MV of the first merge candidate and the second MV of the Nth zero motion vector merge candidate are both less than or equal to the first threshold value. When the Nth zero motion vector merge candidate includes the first MV, both the horizontal difference and the vertical difference between the first MV of the first merge candidate and the first MV of the Nth zero motion vector merge candidate are both less than or equal to the first threshold value. When the Nth zero motion vector merge candidate includes the second MV, both the horizontal difference and the vertical difference between the second MV of the first merge candidate and the second MV of the Nth zero motion vector merge candidate are both less than or equal to the first threshold value.

[0274] Exemplarily, the first MV is the List 0 MV (mvL0), and the second MV is the List 1 MV (MVL1).

[0275] Exemplarily, in a situation where the Nth zero motion vector merge candidate includes the first MV and the second MV, the reference picture index of the first MV of the Nth zero motion vector merge candidate is the same as the reference picture index of the first MV of a certain specific merge candidate, and the reference picture index of the second MV of the Nth zero motion vector merge candidate is the same as the reference picture index of the second MV of a certain specific merge candidate. If both the horizontal difference and the vertical difference between the first MV of the Nth zero motion vector merge candidate and the first MV of a certain specific merge candidate, and the horizontal difference and the vertical difference between the second MV of the Nth zero motion vector merge candidate and the second MV of a certain specific merge candidate are smaller than a preset threshold, it is determined that there is redundancy between the Nth zero motion vector merge candidate and a certain specific merge candidate. In other words, there exists a certain specific merge candidate in the first merge candidate list, and both the horizontal difference and the vertical difference between the first MV of a certain specific merge candidate and the first MV of the Nth zero motion vector merge candidate, and the horizontal difference and the vertical difference between the second MV of a certain specific merge candidate and the second MV of the Nth zero motion vector merge candidate are smaller than a preset threshold, and the reference picture index of the first MV of a certain specific merge candidate is the same as the reference picture index of the first MV of the Nth zero motion vector merge candidate, and the reference picture index of the second MV of a certain specific merge candidate is the same as the reference picture index of the second MV of the Nth zero motion vector merge candidate. In this case, it can be determined that there is redundancy between the Nth zero motion vector merge candidate and a certain specific merge candidate.

[0276] Exemplarily, in a situation where the Nth zero motion vector merge candidate includes the first MV (or the second MV), the reference picture index of the first MV (or the second MV) of the Nth zero motion vector merge candidate is the same as the reference picture index of the first MV (or the second MV) of a certain specific merge candidate, and both the horizontal difference and the vertical difference between the first MV (or the second MV) of the Nth zero motion vector merge candidate and the first MV (or the second MV) of a certain specific merge candidate are smaller than a preset threshold, it is determined that there is redundancy between the Nth zero motion vector merge candidate and a certain specific merge candidate. In other words, there exists a certain specific merge candidate in the first merge candidate list, and both the horizontal difference and the vertical difference between the first MV (or the second MV) of a certain specific merge candidate and the first MV (or the second MV) of the Nth zero motion vector merge candidate are smaller than a preset threshold, and the reference picture index of the first MV (or the second MV) of a certain specific merge candidate is the same as the reference picture index of the first MV (or the second MV) of the Nth zero motion vector merge candidate. In this case, it can be determined that there is redundancy between the Nth zero motion vector merge candidate and a certain specific merge candidate.

[0277] In some embodiments, after adding a zero motion vector merge candidate to the first merge candidate list, it is determined whether there is redundancy between the Nth zero motion vector merge candidate and a merge candidate before the Nth zero motion vector merge candidate in the first merge candidate list.

[0278] FIG. 15 is a schematic diagram showing an inspection process 510 for performing a redundancy inspection on a zero motion vector merge candidate after adding a zero motion vector merge candidate to the first merge candidate list according to an embodiment of the present application.

[0279] As shown in FIG. 15, after adding a zero motion vector merge candidate to the first merge candidate list, the inspection process for performing a redundancy inspection on the zero motion vector merge candidate may include the following content.

[0280] S511: Add spatial merge candidates.

[0281] S512: Add temporal merge candidates.

[0282] S513: Add non-adjacent spatial merge candidates.

[0283] S514: Add history-based merge candidates.

[0284] S515: Add pairwise average merge candidates.

[0285] S516: Add zero motion vector merge candidates.

[0286] Regarding S511 to S516, reference can be made to S321 to S326 described above. To avoid duplication, the description will not be repeated here.

[0287] S517: Determine whether there is redundancy between the first added zero motion vector merge candidate and the merge candidate in the first merge candidate list before the first zero motion vector merge candidate is added.

[0288] S518: Set the number of merge candidates participating in the ordering to be equal to the number of merge candidates in the first merge candidate list before the first zero motion vector merge candidate is added.

[0289] S519: Set the number of merge candidates participating in the ordering to be equal to the number obtained by adding 1 to the number of merge candidates in the first merge candidate list before the first zero motion vector merge candidate is added.

[0290] For S516 to S519, when it is necessary to add zero motion vector merge candidates to construct the first merge candidate list, first add the first zero motion vector merge candidate, and then continue to add another zero motion vector merge candidate until the addition of zero motion vector merge candidates is completed. After that, determine whether there is redundancy between the first zero motion vector merge candidate and the merge candidates added before the first zero motion vector merge candidate is added to the first merge candidate list. If there is no redundancy between the first zero motion vector merge candidate and the merge candidates added before the first zero motion vector merge candidate is added to the first merge candidate list, determine that the number of merge candidates participating in the ordering is M + 1. If there is redundancy between the first zero motion vector merge candidate and the merge candidates added before the first zero motion vector merge candidate is added to the first merge candidate list, determine that the number of merge candidates participating in the ordering is M.

[0291] Of course, in FIG. 15, the Nth zero motion vector merge candidate is taken as an example of the first zero motion vector merge candidate. However, in other alternative embodiments, N may be other numerical values and is not limited thereto in this application.

[0292] In some embodiments, simultaneously with adding the Nth zero motion vector merge candidate, determine whether there is redundancy between the Nth zero motion vector merge candidate and the merge candidates before the Nth zero motion vector merge candidate in the first merge candidate list.

[0293] FIG. 16 is a schematic diagram showing an inspection process 520 for performing a redundancy check on a zero motion vector merge candidate while adding the zero motion vector merge candidate to the first merge candidate list according to an embodiment of the present application.

[0294] After completing the addition of zero motion vector merge candidates to the first merge candidate list, as shown in FIG. 16, the inspection process 510 for performing redundancy inspection on the zero motion vector merge candidates can include the following.

[0295] S521: Add spatial merge candidates.

[0296] S522: Add temporal merge candidates.

[0297] S523: Add non-adjacent spatial merge candidates.

[0298] S524: Add history-based merge candidates.

[0299] S525: Add pairwise average merge candidates.

[0300] Regarding S521 to S525, reference can be made to S321 to S325 described above. To avoid duplication, the description will not be repeated here.

[0301] S526: Add the first zero motion vector merge candidate.

[0302] S527: Determine whether there is redundancy between the added first zero motion vector merge candidate and the merge candidates in the first merge candidate list before the first zero motion vector merge candidate is added.

[0303] S528: Set the number of merge candidates participating in the ordering to be equal to the number of merge candidates in the first merge candidate list before the first zero motion vector merge candidate is added.

[0304] S529: Set the number of merge candidates participating in the ordering to be equal to the number obtained by adding 1 to the number of merge candidates in the first merge candidate list before the first zero motion vector merge candidate is added.

[0305] S530: Continue to add zero motion vector merge candidates.

[0306] For S526 to S530, when it is necessary to add zero motion vector merge candidates to construct the first merge candidate list, first add the first zero motion vector merge candidate, and then determine whether there is redundancy between the first zero motion vector merge candidate and the merge candidates added before the first zero motion vector merge candidate is added to the first merge candidate list. If there is no redundancy between the first zero motion vector merge candidate and the merge candidates added before the first zero motion vector merge candidate is added to the first merge candidate list, determine that the number of merge candidates participating in the ordering is M + 1. If there is redundancy between the first zero motion vector merge candidate and the merge candidates added before the first zero motion vector merge candidate is added to the first merge candidate list, determine that the number of merge candidates participating in the ordering is M. Then, continue to add another zero motion vector merge candidate.

[0307] Of course, in FIG. 16, the Nth zero motion vector merge candidate is taken as an example of the first zero motion vector merge candidate. However, in other alternative embodiments, N may be other numerical values, and the present application is not limited thereto.

[0308] In some embodiments, the above S410 may include the following content. Determine a first number based on the cost of the zero motion vector merge candidate in the first merge candidate list.

[0309] Exemplarily, the cost of the zero motion vector merge candidate in the first merge candidate list may be the cost when predicting the current block using the zero motion vector merge candidate in the first merge candidate list.

[0310] Exemplarily, first, based on the cost of zero motion vector merge candidates in the first merge candidate list, zero motion vector merge candidates participating in the ordering are determined, and then, based on the number of zero motion vector merge candidates participating in the ordering and the number of non-zero motion vector merge candidates in the first merge candidate list, the first number can be determined. For example, the sum of the number of zero motion vector merge candidates participating in the ordering and the number of non-zero motion vector merge candidates in the first merge candidate list can be determined as the first number.

[0311] In some embodiments, first, based on the cost of zero motion vector merge candidates in the first merge candidate list, G zero motion vector merge candidates with the minimum cost are determined, and then, M + G can be determined as the first number. M represents the number of merge candidates included in the first merge candidate list before zero motion vector merge candidates are added to the first merge candidate list.

[0312] Exemplarily, based on the SAD of zero motion vector merge candidates in the first merge candidate list, the cost of zero motion vector merge candidates in the first merge candidate list can be determined. For example, the smaller the SAD of zero motion vector merge candidates in the first merge candidate list, the smaller the cost of zero motion vector merge candidates in the first merge candidate list.

[0313] Exemplarily, based on the PSNR of zero motion vector merge candidates in the first merge candidate list, the cost of zero motion vector merge candidates in the first merge candidate list can be determined. For example, the larger the PSNR of zero motion vector merge candidates in the first merge candidate list, the smaller the cost of zero motion vector merge candidates in the first merge candidate list.

[0314] Exemplarily, first, based on the costs of zero motion vector merge candidates in the first merge candidate list, G zero motion vector merge candidates with the minimum costs are determined as the zero motion vector merge candidates participating in the ordering, and then M + G can be determined as the first number.

[0315] Exemplarily, based on the costs of zero motion vector merge candidates with different reference picture indices in the first merge candidate list, G zero motion vector merge candidates with the minimum costs are determined, and M + G can be determined as the first number. M represents the number of merge candidates included in the first merge candidate list before zero motion vector merge candidates are added to the first merge candidate list.

[0316] Note that in the present application, the order of zero motion vector merge candidates other than the G zero motion vector merge candidates with the minimum costs in the first merge candidate list (i.e., zero motion vector merge candidates not participating in the ordering) in the second merge candidate list is not specifically limited. For example, the relative order of zero motion vector merge candidates not participating in the ordering in the first zero merge candidate list is the same as the relative order of zero motion vector merge candidates not participating in the ordering in the second zero merge candidate list, and the zero motion vector merge candidates not participating in the ordering are located after the merge candidates participating in the ordering.

[0317] Exemplarily, G is predefined.

[0318] Exemplarily, the above algorithm for deriving the first number may be implemented as follows.

[0319] Input: M (or M and G).

[0320] Output: The number of merge candidates participating in the ordering, i.e., the first number.

[0321] The value of the first number is set equal to M + G. M represents the number of merge candidates included in the first merge candidate list before zero motion vector merge candidates are added to the first merge candidate list.

[0322] In some embodiments, an ordering is performed on the zero motion vector merge candidates in the first merge candidate list based on the cost of the zero motion vector merge candidates in the first merge candidate list. If the zero motion vector merge candidates in the first merge candidate list are ordered in ascending order of cost, the first G zero motion vector merge candidates in the order of the zero motion vector merge candidates in the first merge candidate list are determined as the G zero motion vector merge candidates. If the zero motion vector merge candidates in the first merge candidate list are ordered in descending order of cost, the last G zero motion vector merge candidates in the order of the zero motion vector merge candidates in the first merge candidate list are determined as the G zero motion vector merge candidates.

[0323] Exemplarily, first, an ordering is performed on the costs of the zero motion vector merge candidates with different reference image indices in the first merge candidate list, and the zero motion vector merge candidate with the minimum template matching cost is selected. Next, an ordering is performed on the zero motion vector merge candidate with the minimum matching cost and the non-zero motion vector merge candidates in the first merge candidate list to obtain a second merge candidate list.

[0324] In some embodiments, when M + G is less than or equal to K, the first number is determined based on the cost of the zero motion vector merge candidates in the first merge candidate list. K is the maximum number of allowed merge candidates in the first merge candidate list.

[0325] Exemplarily, M may be referred to as numOrigMergeCand as described above, the first number may be referred to as numSortMVP, which is the number of merge candidates participating in the above-mentioned ordering, the maximum number of merge candidates in the first merge candidate list may be denoted as MaxNumMergeCand, and the total number of zero motion vector merge candidates in the first merge candidate list may be denoted as numZeroMergeCand. In this case, if numOrigMergeCand + G is less than or equal to MaxNumMergeCand, or if numZeroMergeCand is greater than or equal to G, numSortMVP can be determined based on the cost of the zero motion vector merge candidates in the first merge candidate list.

[0326] In some embodiments, S410 may include the following. Determine the first number based on whether the first merge candidate list includes zero motion vector merge candidates.

[0327] Exemplarily, first, determine the zero motion vector merge candidates participating in the ordering based on whether the first merge candidate list includes zero motion vector merge candidates. Next, the first number can be determined based on the number of zero motion vector merge candidates participating in the ordering and the number of non-zero motion vector merge candidates in the first merge candidate list. For example, the sum of the number of zero motion vector merge candidates participating in the ordering and the number of non-zero motion vector merge candidates in the first merge candidate list can be determined as the first number.

[0328] In some embodiments, if M + J is less than or equal to K, determine M + J as the first number. M represents the number of merge candidates included in the first merge candidate list before zero motion vector merge candidates are added to the first merge candidate list. J is a preset value.

[0329] Exemplarily, M may be referred to as numOrigMergeCand as described above, the first number may be referred to as numSortMVP, the number of merge candidates participating in the above-described ordering, and the maximum number of merge candidates in the first merge candidate list may be denoted as MaxNumMergeCand. If numOrigMergeCand + J is less than or equal to MaxNumMergeCand, or if numZeroMergeCand is greater than or equal to J, numSortMVP is set equal to numOrigMergeCand + J. In this case, J zero motion vector merge candidates including the first zero motion vector merge candidate participate in the ordering.

[0330] Exemplarily, J is determined based on the number of reference images available for the current block, and / or J is predefined.

[0331] Exemplarily, J is equal to the number of reference images available for the current block.

[0332] Exemplarily, the reference image indices of the zero motion vector merge candidates participating in the ordering are different. For example, the reference image indices are 0, 1, 2, etc.

[0333] Since the reference image indices of the zero motion vector merge candidates filled in the first merge candidate list are not necessarily the same, there is a certain difference between the zero motion vector merge candidates filled in the first merge candidate list. Here, J is set to be determined based on the number of reference images available for the current block. Thereby, several zero motion vector merge candidates with different reference image indices filled in the first merge candidate list and the non-zero motion vector merge candidates in the first merge candidate list can be ordered together. Thereby, the prediction accuracy of the MV of the current block can be improved, and further, the coding performance of the current block can be improved.

[0334] Exemplarily, the derivation algorithm of the first number may be implemented as follows.

[0335] Input: M (or M and J).

[0336] Output: The number of merge candidates participating in the ordering, i.e., the first number.

[0337] The value of the first number is set equal to M + J. M represents the number of merge candidates included in the first merge candidate list before zero motion vector merge candidates are added to the first merge candidate list.

[0338] In some embodiments, the method 400 may further include the following. Determine whether to determine the first number based on zero motion vector merge candidates in the first merge candidate list.

[0339] Exemplarily, if the usage condition for determining the first number based on zero motion vector merge candidates in the first merge candidate list is satisfied, determine the first number based on zero motion vector merge candidates in the first merge candidate list. Otherwise, determine the first number in another way.

[0340] In some embodiments, based on the merge mode used for the current block, determine whether to determine the first number based on zero motion vector merge candidates in the first merge candidate list.

[0341] Exemplarily, if the merge mode used for the current block satisfies the usage condition for determining the first number based on zero motion vector merge candidates in the first merge candidate list, determine the first number based on zero motion vector merge candidates in the first merge candidate list. Otherwise, determine the first number in another way.

[0342] In some embodiments, when the merge mode used for the current block is a preset merge mode, a first number is determined based on the zero motion vector merge candidates in the first merge candidate list.

[0343] Exemplarily, the preset merge mode may include, but is not limited to, a normal merge mode, a TM merge mode, and a BM merge mode. Of course, in other alternative embodiments, the preset merge mode may be other merge modes, and the present application does not specifically limit it.

[0344] In some embodiments, based on the size of the current block, it is determined whether to determine a first number based on the zero motion vector merge candidates in the first merge candidate list.

[0345] Exemplarily, when the size of the current block meets the usage condition for determining a first number based on the zero motion vector merge candidates in the first merge candidate list, a first number is determined based on the zero motion vector merge candidates in the first merge candidate list. Otherwise, the first number is determined by other methods.

[0346] In some embodiments, when the size of the current block is a preset size, a first number is determined based on the zero motion vector merge candidates in the first merge candidate list.

[0347] Exemplarily, the preset size includes, but is not limited to, a block of 4×4 or more (or including at least 16 pixels), a block of 128×128 or less, and a block larger than 4×4 and smaller than 128×128. Of course, in other alternative embodiments, the preset size may be other sizes, and the present application does not specifically limit it.

[0348] In some embodiments, the first number is the number of merge candidates participating in the ARMC.

[0349] Exemplarily, after determining the first number, an ARMC ordering can be performed on the merge candidates participating in the ordering in the first merge candidate list based on the first number to obtain a second merge candidate list. Of course, in other alternative embodiments, other techniques can also be used to perform an ARMC ordering on the merge candidates participating in the ordering in the first merge candidate list to obtain a second merge candidate list. The present application is not specifically limited thereto.

[0350] In some embodiments, ARMC refers to an order according to the ascending order of the template matching cost of the merge candidates.

[0351] Exemplarily, the template matching cost is the sum of absolute differences (SAD) value between the template of the current block and the template of the reference block for the merge candidate. Of course, the matching cost is not limited to SAD. In order to improve the matching accuracy, the sum of absolute differences of transformed coefficients (SATD), sum of squared errors (SSE), mean squared error (MSE), or other more complex costs may be used. The present application is not specifically limited thereto. For the template of the current block and the template of the reference block, the related content described above can be referred to. To avoid repetition, the description is not repeated here.

[0352] Based on another aspect of the present application, the embodiments of the present application further provide a decoding method. The method includes the following content. Based on the ordering method according to the embodiments of the present application, an ordering is performed on the first merge candidate list to obtain a second merge candidate list. The bitstream is analyzed to obtain a candidate index. The candidate index indicates the optimal merge candidate of the current block in the second merge candidate list. The current block is predicted based on the optimal merge candidate.

[0353] Exemplarily, the decoder obtains a candidate index corresponding to the optimal merge candidate transmitted in the bitstream by parsing, i.e., merge_idx[xCb][yCb], and selects the optimal merge candidate N from the reordered merge candidate list (the second merge candidate list) based on the candidate index corresponding to the optimal merge candidate. Taking the current block being the current luma coding block as an example, (xCb, yCb) represents the position of the current luma coding block, and N = mergeCandList[ merge_idx[ xCb ][ yCb ] ].

[0354] Based on another aspect of the present application, an embodiment of the present application further provides an encoding method. The method includes the following. Determine a first merge candidate list. Perform ordering on the first merge candidate list based on the ordering method according to the embodiment of the present application to obtain a second merge candidate list. Determine the optimal merge candidate of the current block based on the second merge candidate list. Encode the optimal merge candidate.

[0355] Exemplarily, the encoder determines the merge candidate with the minimum cost as the optimal merge candidate based on the rate-distortion cost of the merge candidates in the second merge candidate list.

[0356] Exemplarily, the encoder selects the optimal merge candidate from the reordered merge candidate list (i.e., the second merge candidate list) based on rate-distortion optimization and transmits the candidate index corresponding to the optimal merge candidate in the bitstream. For example, the encoder selects the optimal merge candidate with the minimum rate-distortion cost from the second merge candidate list based on the rate-distortion cost of each merge candidate in the second merge candidate list and transmits the candidate index corresponding to the optimal merge candidate in the bitstream.

[0357] For the specific embodiments of determining the first merge candidate list in the decoding method and the encoding method, reference can be made to the relevant content related to S311 and S320 in the above 310. For the specific implementation of the decoder predicting the current block based on the optimal merge candidate, reference can be made to the relevant content related to S313 - S315 in the above 310. To avoid repetition, the description will not be repeated here.

[0358] As described above, the preferred embodiments of the present application have been described in detail with reference to the accompanying drawings. However, the present application is not limited to the detailed content of the above embodiments. Within the scope of the technical idea of the present application, various simple modifications can be made to the technical solutions of the present application, and all these simple modifications belong to the protection scope of the present application. For example, each specific technical feature described in the above specific embodiments can be combined by any appropriate means without contradiction. To avoid unnecessary repetition, various possible combinations will not be described again in the present application. Also, for example, among various different embodiments of the present application, any combination should be regarded as disclosed in the present application as long as it does not conflict with the idea of the present application. It should be understood that in various method embodiments of the present application, the magnitude of the sequence number of each process above does not mean the execution order. The execution order of each process should be determined by its function and internal logic and should not constitute any limitation to the implementation process of the embodiments of the present application.

[0359] The method embodiments of the present application have been described in detail above. Hereinafter, the apparatus embodiments of the present application will be described in detail with reference to FIGS. 17 to 18.

[0360] FIG. 17 is a block diagram showing a video encoding apparatus 170 according to an embodiment of the present application. As shown in FIG. 17, the video encoding apparatus 170 includes a fourth determination module 1701, a second ordering module 1702, a fifth determination module 1703, and an encoding module 1704. The fourth determination module 1701 is configured to determine an initial motion information candidate list for a current block. The initial motion information candidate list includes a first type of motion information candidate and a second type of motion information candidate. Based on the motion information of adjacent blocks and / or non-adjacent blocks of the current block, the first type of motion information candidate is determined. Based on a reference image index set by a preset rule and a motion vector having a preset value, the second type of motion information candidate is constructed. The second ordering module 1702 is configured to perform an ordering on partial motion information candidates in the initial motion information candidate list to determine a motion information candidate list for the current block. The partial motion information candidates include at least one first type of motion information candidate and N second type of motion information candidates, where N is a positive integer. The fifth determination module 1703 is configured to determine a motion information candidate index for the current block based on the determined motion information candidate list for the current block. The encoding module 1704 is configured to encode the motion information candidate index for the current block and signal the encoded bits to a bitstream.

[0361] FIG. 18 is a block diagram showing a video decoding apparatus 180 according to an embodiment of the present application. As shown in FIG. 18, the video decoding apparatus 180 includes a first determination module 1801, a first ordering module 1802, a decoding module 1803, a second determination module 1804, and a third determination module 1805. The first determination module 1801 is configured to determine an initial motion information candidate list for a current block. The initial motion information candidate list includes a first type of motion information candidate and a second type of motion information candidate. Based on the motion information of adjacent blocks and / or non-adjacent blocks of the current block, the first type of motion information candidate is determined. Based on a reference image index set by a preset rule and a motion vector having a preset value, the second type of motion information candidate is constructed. The first ordering module 1802 is configured to perform ordering on the partial motion information candidates in the initial motion information candidate list to determine the motion information candidate list of the current block. The partial motion information candidates include at least one first type of motion information candidate and N second type of motion information candidates, where N is a positive integer. The decoding module 1803 is configured to decode the bitstream to determine the motion information candidate index of the current block. The second determination module 1804 is configured to determine the inter prediction value of the current block based on the motion information candidate index and the motion information candidate list of the current block. The decoding module 1803 is further configured to decode the bitstream to determine the residual value of the current block. The third determination module 1805 is configured to determine the reconstructed value of the current block based on the residual value and the inter prediction value of the current block.

[0362] The description of the above device embodiment is similar to the description of the above method embodiment, and the above device embodiment has beneficial effects similar to those of the method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.

[0363] It should be noted that in the embodiments of the present application, the division of the modules of the device is exemplary and is only a division of logic functions. When actually implemented, it may have another division form. In addition, each functional unit according to each embodiment of the present application may be integrated into one processing unit, each unit may physically exist alone, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware, in the form of a software function module, or in the form of a combination of software and hardware.

[0364] In addition, in the embodiments of the present application, when the above method is implemented in the form of a software function module and sold or used as an independent product, it may be stored in a computer-readable storage medium. According to this understanding, for the technical solutions of the embodiments of the present application, the essential parts, or the parts that can contribute to the prior art, can be expressed as software products. This computer software product is stored in a storage medium and includes a plurality of instructions for causing an electronic device to execute all or part of the methods described in the embodiments of the present application. The storage medium includes various types of media that can store program codes, such as a universal serial bus (USB) flash drive, a mobile hard disk, a read only memory (ROM), a magnetic disk, or an optical disk. Thus, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0365] Embodiments of the present application provide a computer-readable storage medium. A computer program is stored in this computer-readable storage medium. When the computer program is executed, a video encoding method or a video decoding method is executed.

[0366] Embodiments of the present application provide a decoder. As shown in FIG. 19, the decoder 190 includes a first communication interface 1901, a first memory 1902, and a first processor 1903. Each component is coupled together via a first bus system 1904. As can be understood, the first bus system 1904 is used to realize the connection and communication between these components. The first bus system 1904 further includes a power bus, a control bus, and a status signal bus in addition to a data bus. However, for clarity of explanation, in FIG. 19, various buses are marked as the first bus system 1904. The first communication interface 1901 is used to transmit and receive signals in the process of transmitting and receiving information with other external network elements. The first memory 1902 is used to store a computer program executable by the first processor 1903. When executing the computer program, the first processor 1903 is used to perform the following. Determine the initial motion information candidate list for the current block. The initial motion information candidate list includes the first type of motion information candidates and the second type of motion information candidates. Based on the motion information of the adjacent blocks and / or non-adjacent blocks of the current block, the first type of motion information candidates are determined, and based on the reference image index set by a preset rule and the motion vector having a preset value, the second type of motion information candidates are constructed. Perform ordering on the partial motion information candidates in the initial motion information candidate list to determine the motion information candidate list for the current block. The partial motion information candidates include at least one first type of motion information candidate and N second type of motion information candidates, where N is a positive integer. Decode the bitstream to determine the motion information candidate index for the current block. Based on the motion information candidate index and the motion information candidate list of the current block, determine the inter-prediction value of the current block. Decode the bitstream to determine the residual value of the current block. Based on the residual value and the inter-prediction value of the current block, determine the reconstruction value of the current block.

[0367] As can be understood, the first memory 1902 of the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both a volatile memory and a non-volatile memory. The non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM) that functions as an external cache. By way of example and not limitation, various RAMs are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced SDRAM (ESDRAM), synch-link DRAM (SLDRAM), direct rambus RAM (DRRAM). The first memory 1902 of the systems and methods described in the present application can include these and any other suitable types of memory, but is not limited thereto.

[0368] The first processor 1903 can be an integrated circuit chip having signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit in the form of hardware of the first processor 1903 or an instruction in the form of software. The above first processor 1903 can be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The processor can implement or execute various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or any ordinary processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly executed and completed by a hardware decoding processor, or can be executed and completed by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the technical field such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, register, etc. The storage medium is located in the first memory 1902. The first processor 1903 reads the information in the first memory 1902 and completes the steps of the above method in combination with the hardware of the processor.

[0369] It can be understood that these embodiments described in the present application can be implemented by hardware, software, firmware, middleware, microcode, or a combination thereof. When implemented by hardware, the processing unit can be one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units used to execute the functions described in the present application, or a combination thereof. When implemented by software, the technology described in the present application can be implemented by modules (e.g., procedures, functions, etc.) for executing the functions described in the present application. The software code is stored in a memory and executed by a processor. The memory can be implemented inside or outside the processor.

[0370] Optionally, as another embodiment, the first processor 1903 is further configured to execute any of the method embodiments on the decoder 50 side when executing a computer program.

[0371] Embodiments of the present application provide an encoder. As shown in FIG. 20, the encoder 200 can include a second communication interface 2001, a second memory 2002, and a second processor 2003. Each component is coupled together via a second bus system 2004. As can be understood, the second bus system 2004 is used to realize the connection and communication between these components. The second bus system 2004 further includes a power bus, a control bus, and a status signal bus in addition to a data bus. However, for clarity of explanation, in FIG. 20, the various buses are marked as the second bus system 2004. The second communication interface 2001 is used to transmit and receive signals in the process of transmitting and receiving information with other external network elements. The second memory 2002 is used to store computer programs executable by the second processor 2003. When executing a computer program, the second processor 2003 is used to perform the following. Based on the differences between samples in the first image, order the samples to obtain a first list. Based on the index numbers of the samples in the first list and the bit depth of the first component, obtain the sample values of the first component having the same position coordinates as the samples in the second image.

[0372] Optionally, as another embodiment, the second processor 2003 is further configured to execute the method embodiment on the encoder 20 side when executing a computer program.

[0373] Note that the second memory 2002 is similar to the first memory 1902 in terms of hardware functions, and the second processor 2003 is similar to the first processor 1903 in terms of hardware functions, and detailed descriptions thereof are omitted.

[0374] Note that the descriptions of the above storage medium and device embodiments are similar to the descriptions of the above method embodiments, and the above storage medium and device embodiments have beneficial effects similar to those of the method embodiments. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0375] The main solution of this technology is as follows.

[0376] Step a: During the addition of zero MVP candidates (1.6), determine a subset of a preset number (denoted as N) of zero MVPs from all the added zero MVPs (in the main solution, N = 1).

[0377] Step b: Introduce redundancy checking, and sequentially determine whether there is redundancy between the MVP in the zero MVP subset and each candidate in the merge MVP candidate list before the zero MVP candidates are filled. If there is no redundancy, add 1 to the number of ARMC-ordered MVPs. In this case, perform ordering for this zero MVP candidate and the MVP candidate that already exists in the list before the zero MVP is filled. If there is redundancy, continue to make judgments for subsequent zero MVPs within the zero MVP subset until the end.

[0378] The redundancy checking method can be executed in two ways.

[0379] In the first redundancy checking method, if the MV value of the candidate MVP is the same as the MV value of a certain specific MVP candidate already existing in the MVP list, and the reference image index of the candidate MVP is the same as the reference image index of the above-mentioned certain specific MVP candidate, the candidate MVP is considered redundant. In this case, the addition of this candidate is abandoned. In the normal merge mode, usually, redundancy checking is performed in this way.

[0380] In the second redundancy checking method, if the MV of the candidate MVP is close to the MV of the MVP candidate already existing in the MVP list, the candidate MVP is considered redundant. In this case, the addition of this candidate is abandoned. In the TM merge mode, usually, redundancy checking is performed in this way. A specific embodiment is as follows.

[0381] First, based on the number of samples S in the current block, a preset threshold is set. For example, when S < 64, the threshold is set to 1 << 4. When 64 <= S < 256, the threshold is set to 2 << 4. When S >= 256, the threshold is set to 4 << 4.

[0382] The meaning of the operator is as follows.

[0383] x << y represents shifting x left by y bits in binary form. The most significant bits are shifted out, and the vacated positions of the least significant bits are filled with 0s.

[0384] <= represents being less than or equal to.

[0385] < represents being less than.

[0386] >= represents being greater than or equal to.

[0387] Next, in the situation where the MVP candidate is bidirectional, if both the horizontal difference and the vertical difference of the forward MVs, as well as the horizontal difference and the vertical difference of the backward MVs, are all smaller than a preset threshold, and all the reference picture indexes of the forward MVs are the same, and all the reference picture indexes of the backward MVs are the same, the candidate is considered redundant and is not added to the candidate list.

[0388] In the situation where the candidate is unidirectional, if both the horizontal difference and the vertical difference of the unidirectional MVs are all smaller than a preset threshold, and all the reference picture indexes of the unidirectional MVs are the same, the candidate is considered redundant and is not added to the candidate list.

[0389] Step c: Finally, based on the number of MVP candidates participating in the ARMC ordering that have been finally determined, execute the ARMC ordering.

[0390] To fully utilize the zero-MVP candidates filled in the candidate list and improve the prediction accuracy of the MV, the following ARMC improvement method is proposed. Before the zero-MVP candidates are filled in the candidate list, if there is no redundancy between the zero-MVP candidates waiting to be filled and the candidates already existing in the list, perform ARMC ordering on the first zero-MVP candidate filled in the list and the non-zero-MVP candidates added previously to obtain the final MVP candidate list. That is, if Cand0, Cand1, Cand2, Cand3, and Cand4 are all not zero-MVPs, perform ordering on the first zero-MVP candidate (Cand5) filled in the list and the MVP candidates (Cand0, Cand1, Cand2, Cand3, Cand4) added to the head of the list in ascending order of the template matching cost.

[0391] If numOrigMergeCand is smaller than MaxNumMergeCand (or if numZeroMergeCand is greater than 0), perform redundancy checking on the (numOrigMergeCand + 1)-th MVP (which is a constructed zero-MVP) candidate in the list.

[0392] The redundancy checking method can be performed in two ways.

[0393] In the first redundancy checking method, if the MV value of the candidate MVP is the same as the MV value of a certain specific MVP candidate already existing in the MVP list, and the reference image index of the candidate MVP is the same as the reference image index of the above certain specific MVP candidate, the candidate MVP is considered redundant, and in this case, the addition of the candidate is abandoned. In the normal merge mode, usually, redundancy checking is performed in this way.

[0394] In the second redundancy checking method, if the MV of the candidate MVP is close to the MV of the MVP candidates already existing in the MVP list, the candidate MVP is considered redundant, and in this case, the addition of the candidate is abandoned. In the TM merge mode, usually, redundancy checking is performed in this way. A specific embodiment is as follows.

[0395] First, based on the number of samples S in the current block, a preset threshold value is set. For example, when S < 64, the threshold value is set to 1 << 4. When 64 <= S < 256, the threshold value is set to 2 << 4. When S >= 256, the threshold value is set to 4 << 4.

[0396] The meaning of the operator is as follows.

[0397] x << y represents shifting x to the left by y bits in binary format. The upper bits are shifted out, and the vacated positions of the lower bits are filled with 0s.

[0398] <= represents being as follows.

[0399] < represents being less than.

[0400] >= represents being greater than or equal to.

[0401] Next, in the situation where the MVP candidate is bidirectional, if both the horizontal difference and the vertical difference of the forward MV (forward MV) and the horizontal difference and the vertical difference of the backward MV (backward MV) are smaller than the preset threshold value, and all the reference picture indexes of the forward MV are the same, and all the reference picture indexes of the backward MV are the same, the candidate is considered redundant and is not added to the candidate list.

[0402] In the situation where the candidate is unidirectional, if both the horizontal difference and the vertical difference of the unidirectional MV are smaller than the preset threshold value, and all the reference picture indexes of the unidirectional MV are the same, the candidate is considered redundant and is not added to the candidate list.

[0403] Specifically, redundancy checking is performed on the first numOrigMergeCand MVPs in the MVP list and the (numOrigMergeCand + 1)-th MVP.

[0404] If the redundant condition is satisfied, the variable numSortMVP is set equal to numOrigMergeCand.

[0405] If the redundant condition is not satisfied, the variable numSortMVP is set equal to numOrigMergeCand + 1.

[0406] According to the above-described technical solution according to the embodiment of the present application, the prediction accuracy of the MV can be improved. By optimizing the ARMC technology, if there is no redundancy between the zero MVP candidates waiting to be filled and the candidates already existing in the list before the zero MVP candidates in the candidate list are filled, the ARMC ordering is performed on the first filled zero MVP candidate in the list and the non-zero MVP candidate added previously to obtain the final candidate list. Fully considering the problem caused by the participation of multiple zero MVP candidates in the ARMC ordering, and the zero MVP candidates added to the merge candidate list have the opportunity to be sorted at the beginning of the list based on the template matching cost. Therefore, there is a chance that the zero MVP is selected as the optimal MV and used for post-processing and motion compensation, and the quality is improved to a certain extent. According to this method, the coding performance can be further improved.

[0407] The above method further includes the following extension solutions 1 to 7.

[0408] In extension solution 1, the number of zero vectors participating in the ARMC ordering in the main solution is expanded.

[0409] In the implementation method of the main solution, the first zero MVP candidate among the zero MVP candidates filled in the merge candidate list is selected, and for the first zero MVP candidate and the non-zero MVP candidate at the head of the list, ARMC sorting is performed. Since the reference image indexes of the zero MVP candidates filled in the candidate list are not necessarily the same, there are certain differences among the zero MVP candidates filled in the list. The number N of zero MVP candidates participating in the ARMC sorting is expanded. N may be a number greater than 1.

[0410] Several zero MVP candidates with different reference image indexes filled in the merge candidate list are selected, and for these several zero MVP candidates and the non-zero MVP candidate at the head of the list, ARMC sorting is performed to obtain the final merge candidate list. In this case, the reference image indexes of the zero MVPs participating in the sorting are different. For example, the reference image indexes are 0, 1, and / or 2, etc.

[0411] Also, in some embodiments, the number numSortMVP of candidates participating in the ARMC sorting can be derived. When numOrigMergeCand + N is less than or equal to MaxNumMergeCand (or numZeroMergeCand is greater than or equal to N), a redundancy check is performed on the MVP (a constructed zero MVP) vector at the (numOrigMergeCand + N)th position in the list. Specifically, a redundancy check is performed on the first numOrigMergeCand + N - 1 MVPs in the MVP list and the (numOrigMergeCand + N)th MVP.

[0412] When the redundancy condition is met, the variable numSortMVP is set equal to numOrigMergeCand + N - 1.

[0413] When the redundancy condition is not met, the variable numSortMVP is set equal to numOrigMergeCand + N.

[0414] In Extension Option 2, it is optimized to add a zero vector to the merge MVP candidate list in the main option.

[0415] In the main option, zero MV vectors with reference indices Idx of 0, 1, and 2 are sequentially added to the merge MVP list. In this extension option, the addition of zero MVP vectors is optimized. The specific optimization algorithm is as follows. First, based on the template matching cost, perform ARMC sorting on zero MVP candidates with different reference image indices that are filled at the end of the candidate list, and then select the zero MVP candidate with the minimum template matching cost. For the zero MVP candidate with the minimum matching cost and the MVP candidate at the head of the list, perform ARMC sorting to obtain the final merge candidate list.

[0416] In Extension Option 3, redundant checking is extended.

[0417] In the main option, redundant checking is performed on the zero MVP candidates attempting to participate in ARMC and the candidates before the list is filled with zero MVPs. If there is no redundancy, this zero MVP candidate participates in the ARMC sorting. In the implementation of this extension option, redundant checking is not performed as follows.

[0418] In this case, deriving the number numSortMVP of candidates participating in ARMC sorting is directly changed to deriving the number numSortMVP of candidates participating in ARMC sorting as follows.

[0419] If numOrigMergeCand + N is less than or equal to MaxNumMergeCand (or numZeroMergeCand is greater than or equal to N), the variable numSortMVP is set equal to numOrigMergeCand + N. In this case, directly perform ARMC sorting on the MVP including the first zero MVP.

[0420] In Extension Option 4, redundant checking is extended.

[0421] The redundant inspection of zero MVP candidates added in S516 shown in FIG. 15 can be simplified as follows. Regardless of the value of the reference image index, if both of the two component MVx and MVy of the MVP candidates already existing in a list are 0, it is considered that the zero MVP candidates already exist, and there is no need to add zero MVP candidates later to participate in the ARMC ordering.

[0422] In extension scenario 5, each of the main scenario, extension scenario 1, and extension scenario 2 can be selectively combined with each of extension scenario 3 and extension scenario 4.

[0423] In extension scenario 6, the condition for the filled zero MVP in the main scenario to participate in ARMC becomes stricter. For example, it is used only in some merge modes, for example, only in normal Merge and / or TMmerge and / or BMmerge.

[0424] It is also possible to limit the block size under this condition. This condition is used only for blocks that meet a preset size condition, for example, blocks with a block size larger than 4×4 (or containing at least 16 pixels), or only for blocks with a block size smaller than 128×128, or only for blocks with a block size larger than 4×4 and smaller than 128×128.

[0425] In extension scenario 7, as shown in FIG. 16, the main scenario may be executed in the following order.

[0426] When adding zero MVP candidates during the construction of the merge list, first add the first zero MVP candidate, and then perform a redundancy check on the zero MVP candidate and the candidates added before it in the list. If the zero MVP candidate is not redundant, increment the number of candidates participating in the ARMC by 1. If the zero MVP candidate is redundant, the number of candidates participating in the ARMC remains the same as the value before the zero MVP candidate is added. Finally, continue to add other zero MVP candidates. After completing the above steps, call the step S311 in Figure 3 to proceed with the ARMC operation.

[0427] Note that the "one embodiment" or "an embodiment" or "some embodiments" referred to in the specification means that the specific features, structures, or characteristics related to the embodiment are included in at least one embodiment of this application. Therefore, the "in one embodiment" or "in an embodiment" or "in some embodiments" that appear in various places in this specification do not necessarily indicate the same embodiment. In addition, these specific features, structures, or characteristics can be combined in one or more embodiments in any appropriate manner. It should be understood that in various embodiments of this application, the magnitude of the sequence number of each of the above processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic and should not constitute any limitation to the implementation process of the embodiments of this application. The sequence numbers of the embodiments of this application are for the purpose of explanation and do not indicate the superiority or inferiority of the embodiments. The descriptions of the above embodiments tend to emphasize the differences between the embodiments. For the same or similar parts of each embodiment, reference can be made to each other. For the sake of brevity, the description is omitted here.

[0428] The term "and / or" in this specification is used to explain the relationship of the related objects and indicates that there are three types of relationships. For example, in the case of object A and / or object B, it indicates three situations: only object A exists, object A and object B exist simultaneously, and only object B exists.

[0429] In addition, in this specification, terms such as "including", "comprising" or other variants are intended to cover non-exclusive inclusion. Therefore, a process, method, article or device including a series of elements may include not only the listed elements but also other elements not explicitly listed, or other elements inherent to the process, method, article or device. Unless otherwise limited, the presence of another same element in a process, method, article or device including elements limited by the phrase "comprising..." is not excluded.

[0430] In some embodiments according to this application, it should be understood that the disclosed devices and methods can be implemented in other forms. For example, the above embodiments are merely illustrative. For example, the division of modules is only a division of logical functions, and when actually implemented, it may have other division forms. For example, a plurality of modules or components can be combined, integrated into another system, or some of its features can be ignored or not executed. Furthermore, the couplings, direct couplings or communication connections between each component shown or considered may be indirect couplings or communication connections through some interfaces, devices, or modules, and may be in electrical, mechanical or other forms.

[0431] The modules described as separate components may or may not be physically separated. The components shown as modules may or may not be physical modules. That is, they may be located in one place or distributed over a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the technical solution of this embodiment.

[0432] In addition, each functional module according to each embodiment of the present application may be integrated into one processing unit, each module may be regarded as a single unit alone, or two or more modules may be integrated into one unit. The above integrated module can be realized in the form of hardware or a combination of hardware and software functional units.

[0433] Those skilled in the art can understand that some or all of the steps in the above method embodiments can be completed by a program instructing relevant hardware. The above program can be stored in a computer-readable storage medium. When the above program is executed, the steps of the above method embodiments are executed. The above storage medium includes various media capable of storing program codes, such as a mobile storage device, a read-only memory (ROM), a magnetic disk, or an optical disk.

[0434] Alternatively, if the above integrated unit of the present application is realized as a software functional module and sold or used as an independent product, it may be stored in a computer-readable storage medium. According to this understanding, for the technical solutions of the embodiments of the present application, the essential part or the part that can contribute to the prior art can be expressed as a software product. This computer software product is stored in a storage medium and includes a plurality of instructions for causing an electronic device to execute all or part of the methods described in each embodiment of the present application. The storage medium includes various media capable of storing program codes, such as a mobile storage device, a read-only memory (ROM), a magnetic disk, or an optical disk.

[0435] The methods disclosed in some method embodiments according to the present application can be arbitrarily combined to obtain new method embodiments as long as there is no contradiction.

[0436] The features disclosed in some product embodiments according to the present application can be arbitrarily combined to obtain new product embodiments as long as there is no contradiction.

[0437] The features disclosed in some method or apparatus embodiments according to this application can be arbitrarily combined, without contradiction, to obtain new method embodiments or apparatus embodiments.

[0438] The above are only embodiments of this application, and the protection scope of this application is not limited thereto. All changes or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the protection scope of this application. Therefore, the protection scope of this application should be determined by the scope of the claims.

Claims

1. A video decoding method applied to a decoder, comprising: determining an initial motion information candidate list for a current block, wherein the initial motion information candidate list includes a first type of motion information candidate and a second type of motion information candidate, and the first type of motion information candidate is determined based on motion information of adjacent blocks and / or non-adjacent blocks of the current block, and the second type of motion information candidate is constructed based on a reference picture index set by a preset rule and a motion vector having a preset value; performing sorting on partial motion information candidates in the initial motion information candidate list to determine a motion information candidate list for the current block, wherein the partial motion information candidates include at least one first type of motion information candidate and N second type of motion information candidates, and N is a positive integer; decoding a bitstream to determine a motion information candidate index for the current block; determining an inter prediction value for the current block based on the motion information candidate index for the current block and the motion information candidate list; decoding a bitstream to determine a residual value for the current block; determining a reconstructed value for the current block based on the residual value for the current block and the inter prediction value; and characterized by the above.

2. Values of two components of the motion vector having the preset value are both equal to 0. The video decoding method according to claim 1, characterized by the above.

3. The N second type of motion information candidates in the partial motion information candidates are N second type of motion information candidates sequentially added to the initial motion information candidate list during construction of the initial motion information candidate list. The video decoding method according to claim 1, characterized by the above.

4. The N second type of motion information candidates in the partial motion information candidates are N second type of motion information candidates sorted after the first type of motion information candidates in the initial motion information candidate list. The video decoding method according to claim 3, characterized by the above.

5. The partial motion information candidates include all of the first type of motion information candidates in the initial motion information candidate list. The video decoding method according to claim 3, characterized in that...

6. N is a preset value, and / or the value of N is 1, 2, or 3, and / or the value of N is less than or equal to the number of reference images for which use is permitted, and / or the value of N is smaller than the number of second type motion information candidates in the initial motion information candidate list, The video decoding method according to claim 1, characterized in that...

7. The N second type motion information candidates in the partial motion information candidates are second type motion information candidates in the initial motion information candidate list for which the first condition is not satisfied, or the N second type motion information candidates in the partial motion information candidates are second type motion information candidates in the initial motion information candidate list for which the second condition is satisfied, The video decoding method according to claim 1, characterized in that...

8. The first condition is that the motion vector of the second type motion information candidate is equal to the motion vector of the first type motion information candidate and the reference image index of the second type motion information candidate is equal to the reference image index of the first type motion information candidate, The video decoding method according to claim 7, characterized in that...

9. The first condition is that the second type motion information candidate is close to the first type motion information candidate in the partial motion information candidates, The fact that the second type motion information candidate is close to the first type motion information candidate in the partial motion information candidates includes that the reference image index of the second type motion information candidate is equal to the reference image index of the first type motion information candidate and at least one of the following conditions is satisfied, the absolute value of the difference between the vertical component of the motion vector of the second type motion information candidate and the vertical component of the motion vector of the first type motion information candidate is smaller than a first threshold value, the absolute value of the difference between the horizontal component of the motion vector of the second type motion information candidate and the horizontal component of the motion vector of the first type motion information candidate is smaller than a second threshold value, at least one of the conditions holds, The video decoding method according to claim 7, characterized in that...

10. Performing ordering on the partial motion information candidates in the initial motion information candidate list to determine the motion information candidate list for the current block is determining the template matching error of the partial motion information candidates, Performing ordering on the partial motion information candidates based on the template matching error, including The video decoding method according to claim 1, characterized in that.

11. Determining the template matching error of the partial motion information candidates includes determining the template of the current block, based on the motion vector of the partial motion information candidate, determining the corresponding template of the template in the reference image indicated by the reference image index of the partial motion candidate in the reference image, determining the template matching error based on the template and the corresponding template, including The video decoding method according to claim 10, characterized in that.

12. A video encoding method applied to an encoder, determining an initial motion information candidate list for the current block, the initial motion information candidate list including a first type of motion information candidate and a second type of motion information candidate, the first type of motion information candidate being determined based on the motion information of adjacent blocks and / or non-adjacent blocks of the current block, and the second type of motion information candidate being constructed based on a reference image index set by a preset rule and a motion vector having a preset value, performing ordering on the partial motion information candidates in the initial motion information candidate list to determine the motion information candidate list for the current block, the partial motion information candidates including at least one first type of motion information candidate and N second type of motion information candidates, where N is a positive integer, determining the motion information candidate index for the current block based on the determined motion information candidate list for the current block, encoding the motion information candidate index for the current block and signaling the encoded bits to a bitstream, including A video encoding method, characterized in that.

13. A video decoding device applied to a decoder, the video decoding device includes a first determination module, a first ordering module, a decoding module, a second determination module, and a third determination module, The first determination module is configured to determine an initial motion information candidate list of a current block, the initial motion information candidate list includes a first type of motion information candidate and a second type of motion information candidate, and based on the motion information of adjacent blocks and / or non-adjacent blocks of the current block, the first type of motion information candidate is determined, and based on a reference image index set by a preset rule and a motion vector having a preset value, the second type of motion information candidate is constructed. The first ordering module is configured to perform an ordering on partial motion information candidates in the initial motion information candidate list to determine a motion information candidate list of the current block, the partial motion information candidates include at least one first type of motion information candidate and N second type of motion information candidates, and N is a positive integer. The decoding module is configured to decode a bitstream to determine a motion information candidate index of the current block. The second determination module is configured to determine an inter prediction value of the current block based on the motion information candidate index of the current block and the motion information candidate list. The decoding module is further configured to decode a bitstream to determine a residual value of the current block. The third determination module is configured to determine a reconstructed value of the current block based on the residual value of the current block and the inter prediction value. A video decoding apparatus characterized by the above.

14. A video encoding apparatus applied to an encoder, The video encoding apparatus includes a fourth determination module, a second ordering module, a fifth determination module, and an encoding module. The fourth determination module is configured to determine an initial motion information candidate list of a current block. The initial motion information candidate list includes a first type of motion information candidate and a second type of motion information candidate. Based on the motion information of adjacent blocks and / or non-adjacent blocks of the current block, the first type of motion information candidate is determined. Based on a reference image index set by a preset rule and a motion vector having a preset value, the second type of motion information candidate is constructed. The second ordering module is configured to perform ordering on partial motion information candidates in the initial motion information candidate list to determine a motion information candidate list of the current block. The partial motion information candidates include at least one first type of motion information candidate and N second type of motion information candidates, where N is a positive integer. The fifth determination module is configured to determine a motion information candidate index of the current block based on the determined motion information candidate list of the current block. The encoding module is configured to encode the motion information candidate index of the current block and signal the encoded bits to a bitstream. A video encoding apparatus, characterized by the above.

15. A bitstream generated by encoding a motion information candidate index of a current block into bits, wherein the motion information candidate index of the current block is obtained by the video encoding method according to Claim 12. A bitstream, characterized by the above.