Video encoding and decoding
Patent Information
- Authority / Receiving Office
- MY · MY
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2019-12-11
- Publication Date
- 2026-07-30
AI Technical Summary
In inter-frame prediction coding, the prediction effect of rectangular blocks is not good, resulting in large coding residuals, especially when there are foreground and background in the edge area of the object.
By dividing the current block into a first triangular sub-block and a second triangular sub-block, and obtaining its corresponding target motion information, this information is used for encoding processing to improve prediction accuracy and encoding performance.
It improves the prediction accuracy and coding performance and reduces the coding residual, especially the coding efficiency in the edge area of the object.
Abstract
Description
Video Encoding and Decoding Technical Field
[0001] This application relates to video encoding and decoding, and in particular to triangulation prediction coding. Background Technology
[0002] Typically, video coding methods can include processes such as prediction, transform, quantization, filtering, and entropy coding. Predictive coding can be divided into intra-frame predictive coding and inter-frame predictive coding. Inter-frame predictive coding refers to predictive coding using the reconstructed pixel values of temporally adjacent blocks (located in different frames) of the current block. Intra-frame predictive coding refers to predictive coding using the reconstructed pixel values of spatially adjacent blocks (located in the same frame) of the current block.
[0003] In inter-frame predictive coding, a motion vector (MV) can be used to represent the relative displacement between the current block of the current frame and the reference block of the reference frame. For example, if there is a strong temporal correlation between the current frame A and the reference frame B, when it is necessary to transmit the current block A1 of the current frame A, the reference block B1 that best matches the current block A1 can be searched in the reference frame B, and the relative displacement between the current block A1 and the reference block B1 can be determined as the motion vector of the current block A1.
[0004] A block corresponding to an object's edge may contain two different objects, such as a foreground object and a background object. In this case, if prediction is performed only on rectangular blocks, the prediction of some objects within the rectangular blocks may be poor, resulting in a large encoding residual.
[0005] Summary of the Invention
[0006] This application provides a video encoding / decoding method, which can be executed by a video encoder or a video decoder, and includes: if the current block meets specific conditions for enabling a triangular prediction mode and it is determined that the triangular prediction mode is enabled, then the current block is divided into a first triangular sub-block and a second triangular sub-block; acquiring first target motion information of the first triangular sub-block and second target motion information of the second triangular sub-block, wherein the first target motion information is different from the second target motion information; and performing encoding or decoding processing on the current block according to the first target motion information and the second target motion information.
[0007] This application provides a video decoder, which includes a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; when the processor executes the machine-executable instructions, it can implement the above-described method.
[0008] This application provides a video encoder, which includes a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; when the processor executes the machine-executable instructions, it can implement the above-described method.
[0009] This application provides a machine-readable storage medium storing computer instructions thereon, which, when executed by a processor, cause the processor to perform the above-described method. Attached Figure Description
[0010] Figure 1 is a schematic diagram of a video coding framework in one embodiment of this application;
[0011] Figure 2 is a flowchart of a video decoding method according to one embodiment of this application;
[0012] Figure 3 is a flowchart of a video encoding method according to one embodiment of this application;
[0013] Figures 4A and 4B are schematic diagrams of the current block division in one embodiment of this application;
[0014] Figures 5A-5C are schematic diagrams of candidate blocks in one embodiment of this application;
[0015] Figures 6A-6C are schematic diagrams of the division of sub-blocks in one embodiment of this application;
[0016] Figures 7A and 7B are schematic diagrams of motion information storage in one embodiment of this application;
[0017] Figure 8 is a schematic structural diagram of a video decoder in one embodiment of this application;
[0018] Figure 9 is a schematic structural diagram of a video encoder according to one embodiment of this application. Detailed Implementation
[0019] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the application. The singular forms “a,” “the,” and “the” as used in this application and claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to including one or more of the associated listed items or all possible combinations thereof.
[0020] It should be understood that although the terms first, second, third, etc., may be used to describe various information in embodiments of this application, such information should not be limited by these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. In addition, the word "if" as used can be interpreted as "when," "when," or "in response to."
[0021] The embodiments of this application may involve the following concepts:
[0022] Intra prediction utilizes the reconstructed pixel values of spatially adjacent blocks (within the same frame) of the current block for predictive coding. Several intra prediction modes have been proposed, each corresponding to a texture direction except for the DC mode. The predicted pixels of the current block can be generated from the reconstructed pixel values of the boundaries of adjacent blocks along its prediction direction. For example, if the image texture is horizontal, choosing the horizontal prediction mode can better predict image information.
[0023] Inter-prediction: Predictive coding is performed using the reconstructed pixel values of temporally adjacent blocks (located in different frames) of the current block. Major video coding standards employ block-based motion compensation techniques for inter-prediction, where the best-matching block in the reference frame is found for the current block; this process is called motion estimation (ME).
[0024] Motion Vector (MV): In inter-frame predictive coding, motion vectors are used to represent the relative displacement between the current coded block and its best-matching block in the reference frame. Each partitioned block has a corresponding motion vector to be transmitted to the decoder. Encoding and transmitting the motion vector for each block independently, especially when dividing into small blocks, consumes a considerable number of bits. To reduce the number of bits used to encode motion vectors, video coding utilizes the spatial correlation between adjacent image blocks. The motion vector of the current block to be encoded is predicted based on the motion vectors of adjacent encoded blocks, and then the prediction difference is encoded. This effectively reduces the number of bits required to represent the motion vector. In the process of encoding the motion vector of the current image block, the motion vector of the current macroblock is typically predicted first using the motion vectors of adjacent encoded blocks. Then, the difference between the predicted value (MVP, Motion Vector Prediction) and the actual estimated value (MVD) of the motion vector is encoded, thus effectively reducing the number of bits required to encode the MV.
[0025] Motion Information: Since motion vectors represent the displacement of the current image patch relative to a patch in a reference frame, in order to accurately obtain information about the pointed-to image patch, in addition to the motion vector, a reference frame index is also needed to indicate which reference frame the current image patch uses. In video coding techniques, a list of reference frames is typically established for the current frame, and the reference frame index is used to indicate which reference frame listed in that list the current image patch uses. Furthermore, many coding techniques support multiple reference frame lists, so an index is also needed to indicate which reference frame list is used; this index can be called the reference direction. In video coding techniques, motion vectors, reference frame indices, reference directions, and other motion-related coding information can be collectively referred to as motion information.
[0026] Rate-Distortion Optimized (RDO): Two main metrics are typically used to evaluate video coding efficiency: bitrate and Peak Signal-to-Noise Ratio (PSNR). A smaller bitrate results in a higher compression ratio; a higher PSNR results in better reconstructed image quality. Mode selection is usually based on a comprehensive evaluation of both. For example, the cost of a mode can be calculated using the following formula: J(mode) = D + λ*R, where D represents distortion, typically measured using the sum of squared differences (SSE) between the reconstructed and source image blocks; λ represents the Lagrange multiplier; and R represents the actual number of bits required to encode the image block in that mode, including the total number of bits needed to encode mode information, motion information, residuals, etc. Using the RDO principle to select coding modes usually ensures excellent coding performance.
[0027] Figure 1 schematically illustrates a video coding framework that can be used to implement the encoding end processing flow of the embodiments of this application. This video coding framework may include an intra-frame prediction module, a motion estimation / motion compensation module, a reference frame buffer, an intra-loop filtering module, a reconstruction module, a transform module, a quantization module, an inverse transform module, an inverse quantization module, an entropy encoder, etc. Similarly, a corresponding video decoding framework can be used to implement the decoding end processing flow of the embodiments of this application.
[0028] Some embodiments of this application are described in detail below with reference to the accompanying drawings.
[0029] Example 1
[0030] Figure 2 is a flowchart of a video decoding method according to an embodiment of this application. This method can be applied to a decoding end and may include steps 201 to 203.
[0031] In step 201, if the current block meets the specific conditions for enabling the triangular prediction mode and it is determined that the triangular prediction mode is enabled, the video decoder divides the current block into a first triangular sub-block and a second triangular sub-block. In other words, the current block can be divided into two triangular sub-blocks.
[0032] In step 202, the video decoder acquires the first target motion information of the first triangular sub-block and the second target motion information of the second triangular sub-block. The first target motion information and the second target motion information may be different.
[0033] In step 203, the video decoder performs decoding processing on the current block based on the first target motion information and the second target motion information.
[0034] Specifically, after receiving the encoded bitstream, the video decoder can decode the encoded data corresponding to the current block in the received encoded bitstream based on the first target motion information and the second target motion information.
[0035] In this embodiment of the application, if the current block meets the specific conditions for enabling the triangular prediction mode and it is determined that the triangular prediction mode is enabled, the current block is divided into a first triangular sub-block and a second triangular sub-block. The first target motion information of the first triangular sub-block and the second target motion information of the second triangular sub-block are used to predict the current block, which can improve prediction accuracy, improve prediction performance, improve coding performance, and reduce coding residuals.
[0036] Example 2
[0037] Referring to Figure 3, which is a flowchart of a video encoding method in an embodiment of this application, the method can be applied to the encoding end and may include steps 301 to 303.
[0038] In step 301, if the current block meets the specific conditions for enabling the triangular prediction mode and it is determined that the triangular prediction mode is enabled, the video encoder divides the current block into a first triangular sub-block and a second triangular sub-block. In other words, the current block can be divided into two triangular sub-blocks.
[0039] In step 302, the video encoder acquires the first target motion information of the first triangular sub-block and the second target motion information of the second triangular sub-block. The first target motion information and the second target motion information may be different.
[0040] In step 303, the video encoder encodes the current block based on the first target motion information and the second target motion information.
[0041] Specifically, the video encoder can encode the bitstream corresponding to the current block based on the motion information of the first target and the motion information of the second target to obtain the encoded bitstream.
[0042] In this embodiment of the application, if the current block meets the specific conditions for enabling the triangular prediction mode and it is determined that the triangular prediction mode is enabled, the current block is divided into a first triangular sub-block and a second triangular sub-block. The first target motion information of the first triangular sub-block and the second target motion information of the second triangular sub-block are used to predict the current block, which can improve prediction accuracy, improve prediction performance, improve coding performance, and reduce coding residuals.
[0043] Example 3
[0044] In steps 201 and 301, the video decoder / video encoder determines whether the current block meets the specific conditions for enabling the triangular prediction mode; if yes, the current block is divided into a first triangular sub-block and a second triangular sub-block; if no, the current block is not divided into a first triangular sub-block and a second triangular sub-block. Determining whether the current block meets the specific conditions may include: determining whether the frame type of the current frame in which the current block is located, the motion information mode of the current block, and / or the size information of the current block meets the specific conditions.
[0045] In one example, if the frame type of the current block is a B-frame or a non-I-frame, then the frame type can be determined to meet a specific condition. Alternatively, if the frame type of the current block allows intra-block copying, then the frame type can be determined to meet a specific condition.
[0046] In one example, if the motion information pattern of the current block is a merged pattern, then it can be determined that the motion information pattern meets specific conditions. Of course, it can also be determined that the motion information pattern meets specific conditions when the motion information pattern of the current block is another type of pattern (such as Advanced Motion Vector Prediction (AMVP) mode).
[0047] In one example, if the width of the current block is greater than or equal to the first value, and the height of the current block is greater than or equal to the second value, then the size information of the current block meets a specific condition. Alternatively, if the width of the current block is greater than or equal to the third value, or the height of the current block is greater than or equal to the fourth value, then the size information of the current block meets a specific condition. Alternatively, if the width of the current block is greater than or equal to the fifth value and less than or equal to the sixth value, and the height of the current block is greater than or equal to the seventh value and less than or equal to the eighth value, then the size information of the current block meets a specific condition. Alternatively, if the width of the current block is greater than or equal to the ninth value and less than or equal to the tenth value, or the height of the current block is greater than or equal to the eleventh value and less than or equal to the twelfth value, then the size information of the current block meets a specific condition. Alternatively, if the width of the current block is greater than or equal to the thirteenth value and less than or equal to the fourteenth value, the height of the current block is greater than or equal to the fifteenth value and less than or equal to the sixteenth value, and the area of the current block is greater than or equal to the seventeenth value and less than or equal to the eighteenth value, then the size information of the current block meets a specific condition.
[0048] The values mentioned above can be set based on experience, such as 8, 16, 32, 64, 128, etc. In one possible implementation, the first value can be 8, the second value can be 8, the third value can be 8, the fourth value can be 8, the fifth value can be 8, the sixth value can be 128, the seventh value can be 8, the eighth value can be 128, the ninth value can be 8, the tenth value can be 32, the eleventh value can be 8, the twelfth value can be 32, the thirteenth value can be 8, the fourteenth value can be 64, the fifteenth value can be 8, the sixteenth value can be 64, the seventeenth value can be 16, and the eighteenth value can be 1024.
[0049] Regarding steps 201 and 301, several specific examples are described below.
[0050] Example 1: If the current block satisfies all of the following conditions, then divide the current block into a first triangular sub-block and a second triangular sub-block; otherwise, do not divide the current block into a first triangular sub-block and a second triangular sub-block:
[0051] The current frame is a B-frame, meaning that the current frame is allowed to have two reference frame lists;
[0052] The current block's motion information mode is merge mode; and
[0053] The area (width * height) of the current block is greater than or equal to N * N, where N is, for example, 8.
[0054] Example 2: If the current block satisfies all of the following conditions, then divide the current block into a first triangular sub-block and a second triangular sub-block; otherwise, do not divide the current block into a first triangular sub-block and a second triangular sub-block:
[0055] The current frame is a non-I-frame, meaning that the current frame is allowed to have at least one reference frame list;
[0056] The current block's motion information mode is merge mode; and
[0057] The area (width * height) of the current block is greater than or equal to N * N, where N is, for example, 8.
[0058] Example 3: If the current block satisfies all of the following conditions, then divide the current block into a first triangular sub-block and a second triangular sub-block; otherwise, do not divide the current block into a first triangular sub-block and a second triangular sub-block:
[0059] The current frame is a B-frame, meaning that the current frame is allowed to have two reference frame lists;
[0060] The current block's motion information mode is merge mode; and
[0061] The width or height of the current block is greater than or equal to N, for example, 8.
[0062] Example 4: If the current block satisfies all of the following conditions, then divide the current block into a first triangular sub-block and a second triangular sub-block; otherwise, do not divide the current block into a first triangular sub-block and a second triangular sub-block:
[0063] The current frame is a non-I-frame, meaning that the current frame is allowed to have at least one reference frame list;
[0064] The current block's motion information mode is merge mode; and
[0065] The width or height of the current block is greater than or equal to N, for example, 8.
[0066] Example 5: If the current block satisfies all of the following conditions, then divide the current block into a first triangular sub-block and a second triangular sub-block; otherwise, do not divide the current block into a first triangular sub-block and a second triangular sub-block:
[0067] The current frame is a non-I-frame, meaning that the current frame is allowed to have at least one reference frame list;
[0068] The current block's motion information mode is merge mode;
[0069] The width or height of the current block is greater than or equal to N, where N is, for example, 8; and
[0070] The width or height of the current block is less than or equal to M, for example, M is 128.
[0071] Example 6: If the current block satisfies all of the following conditions, then divide the current block into a first triangular sub-block and a second triangular sub-block; otherwise, do not divide the current block into a first triangular sub-block and a second triangular sub-block:
[0072] The current frame is a non-I-frame, meaning that the current frame is allowed to have at least one reference frame list;
[0073] The current block's motion information mode is merge mode;
[0074] The width or height of the current block is greater than or equal to N, where N is, for example, 8; and
[0075] The area of the current block (i.e., width * height) is less than or equal to M * M, where M is, for example, 32.
[0076] Example 7: If the current block satisfies all of the following conditions, then divide the current block into a first triangular sub-block and a second triangular sub-block; otherwise, do not divide the current block into a first triangular sub-block and a second triangular sub-block:
[0077] The current frame is a non-I-frame, meaning that the current frame is allowed to have at least one reference frame list;
[0078] The current block's motion information mode is merge mode;
[0079] The width of the current block is within the range of [Wmin, Wmax], where Wmin is, for example, 8 and Wmax is, for example, 64.
[0080] The current block height is within the range [Hmin, Hmax], where Hmin is, for example, 8 and Hmax is, for example, 64; and
[0081] The area of the current block (i.e., width * height) is within the range of [Smin, Smax], where Smin is, for example, 16 and Smax is, for example, 1024.
[0082] Example 8: For any of Examples 1-7, the restriction on frame type can be modified to: intra-block copying is allowed for the current frame (i.e., searching for blocks similar to the current block within the decoded and reconstructed blocks of the current frame is allowed). For example, for Example 1, the listed condition can be changed to:
[0083] Intra-block copying is allowed in the current frame;
[0084] The current block's motion information mode is merge mode; and
[0085] The area (width * height) of the current block is greater than or equal to N * N, where N is, for example, 8.
[0086] Example 9: For any of Examples 1-8, the constraint on the motion information mode can be modified to: the motion information mode of the current block is the merge mode, and none of the sub-block partitioning mode, multiple hypothesis mode, or merge mode of encoding motion information difference is used. That is, when any of the sub-block partitioning mode, multiple hypothesis mode, or merge mode of encoding motion information difference is enabled for the current block, it is determined that the current block does not meet the specific condition, and therefore the current block is not divided into the first triangular sub-block and the second triangular sub-block.
[0087] Example 4
[0088] In steps 201 and 301, if the current block meets the specific conditions for enabling the triangular prediction mode and it is determined that the triangular prediction mode is enabled, the video decoder / video encoder divides the current block into a first triangular sub-block and a second triangular sub-block. Specifically, the current block can be divided into a first triangular sub-block and a second triangular sub-block according to the main diagonal method (i.e., a diagonal line forming an acute angle (e.g., 45 degrees) with the horizontal to the right), as shown in Figure 4A. Alternatively, the current block can be divided into a first triangular sub-block and a second triangular sub-block according to the secondary diagonal method (i.e., a diagonal line forming an obtuse angle (e.g., 135 degrees) with the horizontal to the right), as shown in Figure 4B.
[0089] For example, at the decoding / encoding end, the current block can be divided into a first triangular sub-block and a second triangular sub-block in the following way:
[0090] Method 1: The video encoder and video decoder, by default, divide the current block according to the main diagonal method as agreed in the protocol. Based on this, the video encoder can divide the current block into a first triangular sub-block and a second triangular sub-block according to the main diagonal method, and the video decoder can also divide the current block into a first triangular sub-block and a second triangular sub-block according to the main diagonal method.
[0091] Method 2: The video encoder and video decoder, by default, divide the current block using a secondary diagonal method according to the protocol. Based on this, the video encoder can divide the current block into a first triangular sub-block and a second triangular sub-block using the secondary diagonal method, and the video decoder can also divide the current block into a first triangular sub-block and a second triangular sub-block using the secondary diagonal method.
[0092] Method 3: The video encoder determines the rate-distortion cost 1 corresponding to the main diagonal partitioning and the rate-distortion cost 2 corresponding to the sub-diagonal partitioning. If rate-distortion cost 1 is less than rate-distortion cost 2, the video encoder partitions the current block into a first triangular sub-block and a second triangular sub-block according to the main diagonal method. The encoded bitstream sent by the video encoder to the decoder carries first indication information, which indicates that the current block should be partitioned according to the main diagonal method. The video decoder parses the encoded bitstream from the encoder. If the encoded bitstream carries the first indication information, the current block is partitioned into a first triangular sub-block and a second triangular sub-block according to the main diagonal method. On the other hand, if rate-distortion cost 1 is greater than rate-distortion cost 2, the video encoder partitions the current block into a first triangular sub-block and a second triangular sub-block according to the sub-diagonal method. The encoded bitstream sent by the video encoder to the decoder carries second indication information, which indicates that the current block should be partitioned according to the sub-diagonal method. The video decoder parses the encoded bitstream from the encoder. If the encoded bitstream carries second indication information, the current block is divided into a first triangular sub-block and a second triangular sub-block according to the sub-diagonal method.
[0093] Example 5
[0094] In steps 202 and 302, the video decoder / video encoder can obtain the first target motion information of the first triangular block and the second target motion information of the second triangular block in the following manner:
[0095] Method 1: Construct a first candidate motion information list, which may include multiple candidate motion information; select one candidate motion information from the first candidate motion information list as the first target motion information of the first triangular sub-block; exclude the first target motion information from the first candidate motion information list, and select one candidate motion information from the remaining candidate motion information in the first candidate motion information list as the second target motion information of the second triangular sub-block. In this way, it can be ensured that the first target motion information and the second target motion information are different.
[0096] In one example, to construct a first candidate motion information list, each candidate block corresponding to the current block can be obtained, and the motion information of each candidate block can be added to the first candidate motion information list. If the candidate block is a unidirectional prediction block, the motion information of the candidate block includes the unidirectional motion information of the candidate block; if the candidate block is a bidirectional prediction block, the motion information of the candidate block includes the first motion information of the candidate block (i.e., the L0 motion information of the candidate block) and / or the second motion information of the candidate block (i.e., the L1 motion information of the candidate block), but does not include the weighted motion information of the first motion information and the second motion information of the candidate block.
[0097] For example, referring to Figure 5A, the seven blocks shown can be used as candidate blocks corresponding to the current block. Blocks 1, 2, 3, 4, and 5 are candidate blocks in the current frame (i.e., spatial candidate blocks), while blocks 6 and 7 are candidate blocks in the reference frame (i.e., temporal candidate blocks). Motion information of these seven candidate blocks can be collected to construct a first candidate motion information list. If the length of the first candidate motion information list does not reach the preset maximum length MaxL (e.g., 7), motion information of several available spatially non-adjacent sub-blocks can be added to the end of the first candidate motion information list (i.e., spatially non-adjacent sub-blocks are also used as candidate blocks corresponding to the current block). Spatially non-adjacent sub-blocks refer to sub-blocks that have no boundary lines or intersection points with the current block.
[0098] In one example, after collecting motion information of candidate blocks, the collected motion information can be sorted in the order of unidirectional motion information, bidirectional predicted L0 motion information, and bidirectional predicted L1 motion information, or in the order of bidirectional predicted L0 motion information, bidirectional predicted L1 motion information, and unidirectional motion information. The collected motion information is then added to the first candidate motion information list one by one according to the sorting result.
[0099] In one example, each time motion information is added to the first candidate motion information list, it can be checked whether the number of candidate motion information in the first candidate motion information list has reached the upper limit value M. If so, the addition of motion information is rejected, and the motion information addition process ends. If not, motion information can continue to be added, and after the current motion information is added, the next motion information is added to the first candidate motion information list. The upper limit value M can be configured based on experience, for example, 5.
[0100] In one example, each time motion information is added to the first candidate motion information list, it can be checked whether the motion information is a duplicate of any existing motion information in the first candidate motion information list. If it is a duplicate, the motion information is rejected from being added to the first candidate motion information list; otherwise, it is added. This avoids the existence of two identical motion information entries in the first candidate motion information list. Alternatively, the check for duplicates can be omitted, and the motion information can be added directly to the first candidate motion information list.
[0101] In one example, if the number of candidate motion information in the first candidate motion information list is less than the upper limit value M after adding all the collected motion information to the first candidate motion information list, then zero motion information can be used to fill the first candidate motion information list.
[0102] In one example, when constructing the first candidate motion information list, each time motion information of candidate blocks for the current block is collected, there is no need to compare whether the motion information of the candidate blocks is consistent with the motion information already collected for the current block; instead, the motion information of the candidate blocks is collected directly.
[0103] The following describes several examples of constructing the first candidate motion information list in Method 1.
[0104] Example 1: From the candidate blocks corresponding to the current block, obtain motion information (such as motion vectors) in the positional order shown in Figure 5A. Sort the obtained motion information in the order of unidirectional motion vector, bidirectional predicted L0 motion vector, and bidirectional predicted L1 motion vector (the average of the L0 and L1 motion vectors without bidirectional prediction). Add the obtained motion information to the first candidate motion information list one by one according to the sorting result. During the filling process, if the number of candidate motion information in the first candidate motion information list reaches M (e.g., 5), stop filling. Continuous deduplication is required during filling to ensure that there is no duplicate motion information in the first candidate motion information list. When the filling process is completed and the number of candidate motion information is less than M, use zero motion vectors for filling.
[0105] Example 2: After acquiring motion information (such as motion vectors) from the candidate blocks corresponding to the current block in the positional order shown in Figure 5A, the acquired motion information is sorted in the following order: unidirectional motion vector, bidirectional predicted L0 motion vector, and bidirectional predicted L1 motion vector (the average of the L0 and L1 motion vectors without bidirectional prediction). The acquired motion information is then added to the first candidate motion information list one by one according to the sorting result. During the filling process, if the number of candidate motion information in the first candidate motion information list reaches M (e.g., 5), the motion information filling process is stopped. During the filling process, it is not necessary to check for duplicate motion information in the first candidate motion information list. When the number of candidate motion information is less than M after the filling process is completed, zero motion vectors are used for filling.
[0106] Example 3: After acquiring motion information (such as motion vectors) from the candidate blocks corresponding to the current block in the positional order shown in Figure 5A, the acquired motion information is sorted in the following order: bidirectional predicted L0 motion vector, bidirectional predicted L1 motion vector, and unidirectional motion vector (the average of the L0 and L1 motion vectors without bidirectional prediction). The acquired motion information is then added to the first candidate motion information list one by one according to the sorting result. During the filling process, if the number of candidate motion information in the first candidate motion information list reaches M (e.g., 5), the filling process stops. During the filling process, deduplication needs to be continuously performed to ensure that there is no duplicate motion information in the first candidate motion information list. When the number of candidate motion information is less than M after the filling process is completed, zero motion vectors are used for filling.
[0107] Example 4: Obtain motion information (such as motion vectors) from the candidate blocks corresponding to the current block, following the positional order shown in Figure 5A. If the candidate block is a unidirectional prediction block (i.e., it uses unidirectional motion information), directly add the unidirectional motion information to the first candidate motion information list in sequence. If the candidate block is a bidirectional prediction block (i.e., it uses bidirectional motion information), select L0 motion information or L1 motion information and add it to the first candidate motion information list in sequence. During the filling process, if the number of candidate motion information in the first candidate motion information list reaches M (e.g., 5), stop filling. During the filling process, continuous deduplication is required to ensure that there is no duplicate motion information in the first candidate motion information list. When the filling process is completed and the number of candidate motion information is less than M, use zero motion vectors for filling.
[0108] Example 5: If the length of the first candidate motion information list constructed after traversing all candidate blocks shown in Figure 5A does not reach the preset maximum length MaxL (e.g., 7), then add several available spatial non-adjacent sub-block motion information to the end of the first candidate motion information list. Here, spatial non-adjacent sub-blocks refer to sub-blocks that have no boundary lines or boundary points with the current block.
[0109] Example 6: After obtaining motion information (such as motion vectors) from the candidate blocks corresponding to the current block according to the positional order shown in Figure 5A, the obtained motion information is sorted in the order of unidirectional motion vectors, bidirectional predicted L0 motion vectors, and bidirectional predicted L1 motion vectors (the average of L0 and L1 motion vectors without bidirectional prediction). The obtained motion information is then added to the first candidate motion information list one by one according to the sorting result. During the filling process, if the number of candidate motion information in the first candidate motion information list reaches M (e.g., 5), the motion information filling process is stopped. During the filling process, for unidirectional motion vectors and bidirectional predicted L0 motion vectors, deduplication processing is required with the existing motion information in the first candidate motion information list to ensure that there is no duplicate motion information in the first candidate motion information list; however, for bidirectional predicted L1 motion vectors, considering the large number of motion information in the first candidate motion information list and the high cost of deduplication (requiring comparison with all motion information in the first candidate motion information list), deduplication processing is not performed.
[0110] Example 7: Adding motion information to the first candidate motion information list involves two processes: a motion information collection process, which collects motion information of candidate blocks, and a motion information addition process, which adds the motion information to the first candidate motion information list. The following describes an embodiment of the motion information collection process.
[0111] During the process of collecting motion information of candidate blocks, the motion information of the current candidate block can be compared with the previously collected motion information. If they are identical, the collection process of the motion information of the current candidate block is skipped. In this embodiment, the motion information of the current candidate block can be compared only with the motion information of candidate blocks that are closer to the current candidate block.
[0112] For example, referring to Figure 5A, firstly, the motion information of candidate block 1 is collected. Since candidate block 1 is the first candidate block, no comparison is needed, and the motion information of candidate block 1 is collected directly.
[0113] Then, when collecting motion information for candidate block 2, it can be determined whether candidate block 1 is available. If available, the motion information of candidate block 2 can be compared with that of candidate block 1 to see if they are completely identical. If they are completely identical, motion information collection for candidate block 2 is not performed; otherwise, motion information collection for candidate block 2 is performed.
[0114] Then, when collecting motion information for candidate block 3, it can be determined whether candidate block 2, which is closer to candidate block 3, is available. If available, the motion information of candidate block 3 can be compared with that of candidate block 2 to see if they are completely identical. If they are completely identical, motion information collection for candidate block 3 is not performed; otherwise, motion information collection for candidate block 3 is performed. It should be noted that the motion information of candidate block 3 is no longer compared with the motion information of candidate block 1, which is farther away from candidate block 3.
[0115] Then, when collecting motion information for candidate block 4, it can be determined whether candidate block 1, which is closer to candidate block 4, is available. If available, the motion information of candidate block 4 can be compared with that of candidate block 1 to see if they are completely identical. If they are completely identical, motion information collection for candidate block 4 is not performed; otherwise, motion information collection for candidate block 4 is performed. It should be noted that the motion information of candidate block 4 is no longer compared with the motion information of candidate blocks 2 and 3, which are farther away from candidate block 4.
[0116] Then, when collecting motion information for candidate block 5, it can be determined whether candidate block 1, which is closer to candidate block 5, is available. If available, the motion information of candidate block 5 can be compared with that of candidate block 1. If they are exactly the same, motion information collection for candidate block 5 is not performed. If they are different, it can be determined whether candidate block 2, which is closer to candidate block 5, is available. If available, the motion information of candidate block 5 can be compared with that of candidate block 2. If they are exactly the same, motion information collection for candidate block 5 is not performed; if they are different, motion information collection for candidate block 5 is performed. It should be noted that the motion information of candidate block 5 is no longer compared with the motion information of candidate blocks 3 and 4, which are farther away from candidate block 5.
[0117] Example 8: During the collection of motion information for candidate blocks, there is no need to compare the motion information of the current candidate block with the previously collected motion information; instead, the motion information of the current candidate block is collected directly. Even if the motion information of the current candidate block is exactly the same as the previously collected motion information, a deduplication operation can be performed later to prevent duplicate motion information from existing in the first candidate motion information list.
[0118] The following describes the process of selecting a candidate motion information from the first candidate motion information list as the first target motion information of the first triangular sub-block in Method 1.
[0119] Method a1: The video encoder can agree on a default first target motion information through a protocol. For example, the video encoder can default the first candidate motion information in the first candidate motion information list as the first target motion information of the first triangular sub-block. The video decoder can agree on a default first target motion information through a protocol. For example, the video decoder can default the first candidate motion information in the first candidate motion information list as the first target motion information of the first triangular sub-block.
[0120] Method a2: The video encoder can determine the rate-distortion cost corresponding to each candidate motion information in the first candidate motion information list, and use the candidate motion information corresponding to the minimum rate-distortion cost as the first target motion information of the first triangular sub-block. The encoded bitstream sent by the video encoder to the decoder can carry third indication information, which is used to indicate the index value of the first target motion information in the first candidate motion information list. The video decoder can parse the encoded bitstream from the encoder. If the encoded bitstream carries the third indication information, it uses the index value indicated by the third indication information to retrieve the corresponding candidate motion information from the first candidate motion information list and uses that candidate motion information as the first target motion information.
[0121] The following describes the process of selecting a candidate motion information from the first candidate motion information list as the second target motion information of the second triangular sub-block in Method 1.
[0122] Method b1: The video encoder can agree on a default second target motion information through a protocol. For example, the video encoder can default the second candidate motion information in the first candidate motion information list to the second target motion information of the second triangular sub-block. The video decoder can also agree on a default second target motion information through a protocol. For example, the video decoder can default the second candidate motion information in the first candidate motion information list to the second target motion information of the second triangular sub-block.
[0123] Method b2: The video encoder can exclude the first target motion information from the first candidate motion information list (i.e., not select the first target motion information from the first candidate motion information list). Based on this, the video encoder can determine the rate-distortion cost corresponding to each remaining candidate motion information in the first candidate motion information list (i.e., the candidate motion information remaining after excluding the first target motion information), and use the candidate motion information corresponding to the minimum rate-distortion cost as the second target motion information of the second triangular sub-block. The encoded bitstream sent by the video encoder to the decoder can carry fourth indication information, which is used to indicate the index value of the second target motion information in the first candidate motion information list. The video decoder can parse the encoded bitstream from the encoder. If the encoded bitstream carries the fourth indication information, it uses the index value indicated by the fourth indication information to retrieve the corresponding candidate motion information from the first candidate motion information list and uses that candidate motion information as the second target motion information.
[0124] Example 6
[0125] In steps 202 and 302, the video decoder / video encoder can obtain the first target motion information of the first triangular block and the second target motion information of the second triangular block in the following manner:
[0126] Method 2: Construct a second candidate motion information list corresponding to the first triangular sub-block, and construct a third candidate motion information list corresponding to the second triangular sub-block. The second candidate motion information list includes multiple candidate motion information, and the third candidate motion information list includes multiple candidate motion information. Select one candidate motion information from the second candidate motion information list as the first target motion information of the first triangular sub-block, and select one candidate motion information from the third candidate motion information list as the second target motion information of the second triangular sub-block. The first target motion information and the second target motion information are different.
[0127] In one example, to construct a second candidate motion information list corresponding to the first triangular sub-block, each first candidate block corresponding to the first triangular sub-block can be obtained, and the motion information of each first candidate block can be added to the second candidate motion information list. If the first candidate block is a unidirectional prediction block, the motion information of the first candidate block includes the unidirectional motion information of the first candidate block; if the first candidate block is a bidirectional prediction block, the motion information of the first candidate block includes the first motion information of the first candidate block (i.e., the L0 motion information of the first candidate block) and / or the second motion information of the first candidate block (i.e., the L1 motion information of the first candidate block), but does not include the weighted motion information of the first motion information and the second motion information of the first candidate block.
[0128] In one example, to construct a third candidate motion information list corresponding to the second triangular sub-block, each second candidate block corresponding to the second triangular sub-block can be obtained, and the motion information of each second candidate block can be added to the third candidate motion information list. If the second candidate block is a unidirectional prediction block, the motion information of the second candidate block includes the unidirectional motion information of the second candidate block; if the second candidate block is a bidirectional prediction block, the motion information of the second candidate block includes the first motion information of the second candidate block (i.e., the L0 motion information of the second candidate block) and / or the second motion information of the second candidate block (i.e., the L1 motion information of the second candidate block), but does not include the weighted motion information of the first motion information and the second motion information of the second candidate block.
[0129] If the current block is divided into a first triangular sub-block and a second triangular sub-block according to the sub-diagonal method, then the first triangular sub-block is the upper right triangular sub-block, and the second triangular sub-block is the lower left triangular sub-block. Based on this, the first candidate block corresponding to the first triangular sub-block may include, but is not limited to: the adjacent block above the current block, and temporal candidate blocks in other frames outside the current frame where the current block is located. The second candidate block corresponding to the second triangular sub-block may include, but is not limited to: the adjacent block to the left of the current block, and temporal candidate blocks in other frames outside the current frame where the current block is located.
[0130] For example, the blocks at the five positions shown in Figure 5B can be considered as the first candidate blocks corresponding to the first triangular sub-block, where blocks 2, 3, and 5 are candidate blocks in the current frame, while blocks 6 and 7 are candidate blocks in other frames (i.e., i ...
[0131] In one example, motion information of candidate blocks can be collected. If the candidate block is a one-way prediction block, the motion information of the candidate block includes the one-way motion information of the candidate block; if the candidate block is a two-way prediction block, the motion information of the candidate block includes the L0 motion information and / or the L1 motion information of the candidate block, but does not include the weighted motion information of the L0 motion information and the L1 motion information of the candidate block.
[0132] In one example, after collecting motion information of candidate blocks (as shown in Figure 5B or Figure 5C), the collected motion information can be sorted in the order of unidirectional motion information, bidirectional predicted L0 motion information, and bidirectional predicted L1 motion information. Each piece of motion information is then added to either the second or third candidate motion information list according to the sorting result. Alternatively, the collected motion information can be sorted in the order of bidirectional predicted L0 motion information, bidirectional predicted L1 motion information, and unidirectional motion information. Each piece of motion information is then added to either the second or third candidate motion information list according to the sorting result.
[0133] In one example, each time motion information is added to the second or third candidate motion information list, it can be determined whether the number of motion information entries in the second or third candidate motion information list has reached the upper limit M. If so, the addition of motion information is rejected, and the motion information addition process ends. If not, motion information continues to be added, and after the current motion information is added, the next motion information is added to the second or third candidate motion information list. The upper limit M is, for example, 4.
[0134] In one example, each time motion information is added to the second or third candidate motion information list, it can be checked whether the motion information is duplicated with existing motion information in either list. If it is duplicated, the motion information is rejected from being added to the second or third candidate motion information list; otherwise, it is added. This avoids duplicate motion information in the second or third candidate motion information list. Alternatively, the check for duplicates can be omitted, and the motion information can be added directly to the second or third candidate motion information list.
[0135] In one example, if the number of candidate motion information in the second or third candidate motion information list is less than the upper limit M after all the collected motion information is added to the second or third candidate motion information list, then zero motion information can be used to fill the second or third candidate motion information list.
[0136] In one example, when constructing a second or third candidate motion information list, each time motion information of candidate blocks for the current block is collected, there is no need to compare whether the motion information of the candidate blocks is consistent with the motion information already collected for the current block; instead, the motion information of the candidate blocks is collected directly.
[0137] It should be noted that Examples 1-8 in Embodiment 5 above can also be applied to Embodiment 6, except that the first candidate motion information list is changed to the second candidate motion information list or the third candidate motion information list, and the candidate block is changed from the candidate block shown in Figure 5A to the candidate block shown in Figure 5B or Figure 5C. Other processes are similar and will not be described in detail here.
[0138] The following describes the process of selecting a candidate motion information from the second candidate motion information list as the first target motion information of the first triangular sub-block in Method 2.
[0139] Method c1: The video encoder can agree on a default first target motion information through a protocol. For example, the video encoder can default the first candidate motion information in the second candidate motion information list to the first target motion information of the first triangular sub-block. The video decoder can also agree on a default first target motion information through a protocol. For example, the video decoder can default the first candidate motion information in the second candidate motion information list to the first target motion information of the first triangular sub-block.
[0140] In method c2, the video encoder can determine the rate-distortion cost corresponding to each candidate motion information in the second candidate motion information list, and use the candidate motion information corresponding to the minimum rate-distortion cost as the first target motion information of the first triangular sub-block. The encoded bitstream sent by the video encoder to the decoder can carry fifth indication information, which is used to indicate the index value of the first target motion information in the second candidate motion information list. The video decoder can parse the encoded bitstream from the encoder. If the encoded bitstream carries the fifth indication information, it uses the index value indicated by the fifth indication information to retrieve the corresponding candidate motion information from the second candidate motion information list, and uses the candidate motion information as the first target motion information.
[0141] The following describes the process of selecting a candidate motion information from the third candidate motion information list as the second target motion information of the second triangular sub-block in Method 2.
[0142] Method d1: The video encoder can agree on a default second target motion information through a protocol. For example, the video encoder can default the first candidate motion information in the third candidate motion information list as the second target motion information of the second triangular sub-block. The video decoder can also agree on a default second target motion information through a protocol. For example, the decoder can default the first candidate motion information in the third candidate motion information list as the second target motion information of the second triangular sub-block.
[0143] In method d2, the video encoder can determine the rate-distortion cost corresponding to each candidate motion information in the third candidate motion information list, and use the candidate motion information corresponding to the minimum rate-distortion cost as the second target motion information of the second triangular sub-block. The encoded bitstream sent by the video encoder to the decoder can carry sixth indication information, which is used to indicate the index value of the second target motion information in the third candidate motion information list. The video decoder can parse the encoded bitstream from the encoder. If the encoded bitstream carries the sixth indication information, it uses the index value indicated by the sixth indication information to retrieve the corresponding candidate motion information from the third candidate motion information list and uses that candidate motion information as the second target motion information.
[0144] Example 7
[0145] If the current block is divided into a first triangular sub-block and a second triangular sub-block in step 201 / 301 according to the main diagonal, then in step 202 / 302, a first candidate motion information list can be constructed, and the first target motion information and the second target motion information can be determined based on the first candidate motion information list, i.e., Embodiment 5 can be adopted. If the current block is divided into a first triangular sub-block and a second triangular sub-block in step 201 / 301 according to the secondary diagonal, then in step 202 / 302, a second candidate motion information list corresponding to the first triangular sub-block and a third candidate motion information list corresponding to the second triangular sub-block can be constructed, and the first target motion information can be determined based on the second candidate motion information list, and the second target motion information can be determined based on the third candidate motion information list, i.e., Embodiment 6 can be adopted.
[0146] In one example, whether the current block is divided along the main diagonal or the secondary diagonal, Embodiment 5 can be used. In another example, if the current block is divided along the main diagonal, i.e., at a 45-degree angle, Embodiment 5 can be used, with an upper limit M of, for example, 4. If the current block is divided along the secondary diagonal, i.e., at a 135-degree angle, Embodiment 6 can be used.
[0147] Referring to Example 6, the first triangular sub-block is the upper right triangular sub-block. As shown in Figure 5B, the first candidate blocks of the first triangular sub-block are, in order, blocks 2, 3, 5, 6, and 7, excluding blocks 1 and 4 which are farther away from the first triangular sub-block. As shown in Figure 5C, the second candidate blocks of the second triangular sub-block are, in order, blocks 1, 4, 5, 6, and 7, excluding blocks 2 and 3 which are farther away from the second triangular sub-block. Furthermore, the upper limit value M can also be, for example, 4.
[0148] In one example, a single flag bit can be encoded to indicate whether the division is at a 45-degree angle or a 135-degree angle. If the division is at a 45-degree angle, the index of M*(M-1) combinations can be encoded using truncated unary codes; if the division is at a 135-degree angle, the index of M*M combinations can be encoded using truncated unary codes. Specifically, if the division is at a 45-degree angle, and Example 5 is used (i.e., selecting the first target motion information and the second target motion information from the first candidate motion information list), since there are M (M is, for example, 4) candidate motion information in the first candidate motion information list, the first target motion information has M possible choices. After excluding the first target motion information from the first candidate motion information list, the second target motion information has (M-1) possible choices. Therefore, the motion information index is an index of M*(M-1) combinations. If we divide the information into 135-degree angles and use Example 6 (i.e., selecting the first target motion information from the second candidate motion information list and selecting the second target motion information from the third candidate motion information list), then since there are M (M for example, 4) candidate motion information in the second candidate motion information list, the first target motion information has M possible choices, and since there are M (M for example, 4) candidate motion information in the third candidate motion information list, the second target motion information has M possible choices. Therefore, the motion information index is an index of M*M combinations.
[0149] Example 8
[0150] After obtaining the first target motion information of the first triangular sub-block and the second target motion information of the second triangular sub-block, motion compensation can be performed on the first and second triangular sub-blocks in the following manner based on the first and second target motion information:
[0151] Method 1: Divide the current block into multiple sub-blocks, each with a width greater than or equal to 2 and a height greater than or equal to 2. For each sub-block, if it is located within a first triangular sub-block, perform motion compensation based on the first target motion information of the first triangular sub-block to obtain a predicted value; if it is located within a second triangular sub-block, perform motion compensation based on the second target motion information of the second triangular sub-block to obtain a predicted value; if it is neither completely located within the first nor the second triangular sub-block (i.e., the sub-block is located on the diagonal dividing the first and second triangular sub-blocks), perform weighted compensation based on the first target motion information of the first and second triangular sub-blocks to obtain a predicted value. The weighted compensation may include: determining a first predicted value of the sub-block based on the first target motion information; determining a second predicted value of the sub-block based on the second target motion information; and performing weighted compensation on the sub-block based on the first predicted value, a first weight coefficient corresponding to the first predicted value, the second predicted value, and a second weight coefficient corresponding to the second predicted value.
[0152] For example, referring to Figure 6A, the current block can be divided into sub-block 1, sub-block 2, sub-block 3, and sub-block 4. In practical applications, the current block can be divided into more sub-blocks, as long as the width of each sub-block is greater than or equal to 2, and the height of each sub-block is greater than or equal to 2. The following explanation uses the sub-block division shown in Figure 6A as an example.
[0153] For sub-block 2, since it is located within the first triangular sub-block, motion compensation is performed on it using the first target motion information to obtain a predicted value. For sub-block 3, since it is located within the second triangular sub-block, motion compensation is performed on it using the second target motion information to obtain a predicted value. For sub-block 1, since it is neither entirely within the first nor the second triangular sub-block, a first predicted value P1 is determined based on the first target motion information, and a second predicted value P2 is determined based on the second target motion information. Assuming the first weighting coefficient for P1 is a (e.g., 0.5) and the second weighting coefficient for P2 is b (e.g., 0.5), weighted compensation is performed on sub-block 1 based on P1, a, P2, and b. The predicted value of sub-block 1 after weighted compensation is, for example, P1*a + P2*b. Motion compensation for sub-block 4 is similar to that for sub-block 1 and will not be repeated here.
[0154] Method 2: Divide the current block into a first sub-block, a second sub-block, and a third sub-block. The first sub-block is located within a first triangular sub-block, the second sub-block is located within a second triangular sub-block, and the distance between the center of each sub-block in the third sub-block and the diagonal dividing the first and second triangular sub-blocks is less than a preset threshold. Perform motion compensation on each sub-block in the first sub-block based on the first target motion information of the first triangular sub-block. Perform motion compensation on each sub-block in the second sub-block based on the second target motion information of the second triangular sub-block. Perform weighted compensation on each sub-block in the third sub-block based on the first and second target motion information. The weighted compensation may include: for each sub-block within the third region sub-block, determining a first predicted value of the sub-block based on first target motion information, and determining a second predicted value of the sub-block based on second target motion information; performing weighted compensation on the sub-block based on the first predicted value, a first weight coefficient corresponding to the first predicted value, the second predicted value, and a second weight coefficient corresponding to the second predicted value, wherein if the sub-block is located within a first triangular sub-block, the first weight coefficient is greater than the second weight coefficient; if the sub-block is located within a second triangular sub-block, the first weight coefficient is less than the second weight coefficient; if the sub-block is located on the diagonal dividing the first and second triangular sub-blocks, the first weight coefficient is equal to the second weight coefficient.
[0155] Each sub-block within the third region can be a 1*1 sub-block, i.e., a single pixel block, or an N*M sub-block, where N can be greater than or equal to 1 and M can also be greater than or equal to 1.
[0156] For example, referring to Figure 6B, the current block can be divided into a first sub-block, a second sub-block, and a third sub-block. The first sub-block is located within the first triangular sub-block, so the motion information of the first target within the first triangular sub-block can be used to perform motion compensation on each sub-block within the first sub-block to obtain a predicted value. The second sub-block is located within the second triangular sub-block, so the motion information of the second target within the second triangular sub-block can be used to perform motion compensation on each sub-block within the second sub-block to obtain a predicted value. The third sub-block may include sub-blocks labeled 1, 2, 4, 6, and 7.
[0157] For each sub-block labeled 7, hereinafter referred to as sub-block 7, a first predicted value P1 can be determined based on the first target motion information, and a second predicted value P2 can be determined based on the second target motion information. Assuming the first weighting coefficient corresponding to P1 is 'a' and the second weighting coefficient corresponding to P2 is 'b', the weighted and compensated predicted value of sub-block 7 can be: P1*a + P2*b. Furthermore, since sub-block 7 is located within the first triangular sub-block, the first weighting coefficient 'a' is greater than the second weighting coefficient 'b'. Assuming 'a' is 7 / 8 and 'b' is 1 / 8, the weighted and compensated predicted value of sub-block 7 is P1*7 / 8 + P2*1 / 8.
[0158] For each sub-block labeled 6, hereinafter referred to as sub-block 6, the weighted compensation process is similar to that for sub-block 7. Since sub-block 6 is located within the first triangular sub-block, the first weight coefficient 'a' is greater than the second weight coefficient 'b'. Furthermore, because sub-block 6 is closer to the second region sub-block than sub-block 7, the first weight coefficient 'a' of sub-block 6 can be less than the first weight coefficient 'a' of sub-block 7. For example, if the first weight coefficient 'a' of sub-block 6 is 6 / 8 and the second weight coefficient 'b' is 2 / 8, the predicted value of sub-block 6 after weighted compensation is P1*6 / 8 + P2*2 / 8.
[0159] For each sub-block labeled 4, hereinafter referred to as sub-block 4, the weighted compensation process is similar to that for sub-block 7. Since sub-block 4 is located on the diagonal of the first and second triangular sub-blocks, the first weight coefficient 'a' is equal to the second weight coefficient 'b'. For example, if 'a' is 4 / 8 and 'b' is 4 / 8, the predicted value of sub-block 4 after weighted compensation is P1*4 / 8 + P2*4 / 8.
[0160] For each sub-block marked 2, hereinafter referred to as sub-block 2, the weighted compensation process is similar to that for sub-block 7. Since sub-block 2 is located within the second triangular sub-block, the first weight coefficient 'a' is less than the second weight coefficient 'b'. For example, if 'a' is 2 / 8 and 'b' is 6 / 8, the predicted value of sub-block 2 after weighted compensation is P1*2 / 8 + P2*6 / 8.
[0161] For each sub-block marked 1, hereinafter referred to as sub-block 1, the weighted compensation process is similar to that for sub-block 7. Since sub-block 1 is located within the second triangular sub-block, the first weight coefficient 'a' is less than the second weight coefficient 'b'. Furthermore, because sub-block 1 is closer to the second region sub-block than sub-block 2, the first weight coefficient 'a' of sub-block 1 can be less than the first weight coefficient 'a' of sub-block 2. For example, if the first weight coefficient 'a' of sub-block 1 is 1 / 8 and the second weight coefficient 'b' is 7 / 8, the predicted value of sub-block 1 after weighted compensation is P1*1 / 8 + P2*7 / 8.
[0162] In the above embodiments, the sum of the first weight coefficient 'a' and the second weight coefficient 'b' of each sub-block is 1. The closer a sub-block is to the first region sub-block, the larger its first weight coefficient 'a' and the smaller its second weight coefficient 'b'. The closer a sub-block is to the second region sub-block, the smaller its first weight coefficient 'a' and the larger its second weight coefficient 'b'.
[0163] In one example, for each sub-block within the third region sub-block, a first set of weighting coefficients can be configured for the luminance component. For example, along the direction from the first region sub-block to the second region sub-block, the first weighting coefficient 'a' for the luminance component of each sub-block is 7 / 8, 6 / 8, 4 / 8, 2 / 8, and 1 / 8, respectively. For example, referring to Figure 6B, the first weighting coefficient 'a' for the luminance component of sub-block 7 is 7 / 8, the first weighting coefficient 'a' for the luminance component of sub-block 6 is 6 / 8, the first weighting coefficient 'a' for the luminance component of sub-block 4 is 4 / 8, the first weighting coefficient 'a' for the luminance component of sub-block 2 is 2 / 8, and the first weighting coefficient 'a' for the luminance component of sub-block 1 is 1 / 8.
[0164] In another example, a second set of weighting coefficients can be configured for the luminance component of each sub-block within the third region sub-block. For example, along the direction from the first region sub-block to the second region sub-block, the first weighting coefficient 'a' for the luminance component of each sub-block is 7 / 8, 6 / 8, 5 / 8, 4 / 8, 3 / 8, 2 / 8, and 1 / 8, respectively. For example, referring to Figure 6B, the first weighting coefficient 'a' for the luminance component of sub-block 7 is 7 / 8, the first weighting coefficient 'a' for the luminance component of sub-block 6 is 6 / 8, the first weighting coefficient 'a' for the luminance component of sub-block 5 (sub-block 5 can be located between sub-block 4 and sub-block 6, and sub-block 5 is not shown in Figure 6B) is 5 / 8, the first weighting coefficient 'a' for the luminance component of sub-block 4 is 4 / 8, the first weighting coefficient 'a' for the luminance component of sub-block 3 (sub-block 3 can be located between sub-block 2 and sub-block 4, and sub-block 3 is not shown in Figure 6B) is 3 / 8, the first weighting coefficient 'a' for the luminance component of sub-block 2 is 2 / 8, and the first weighting coefficient 'a' for the luminance component of sub-block 1 is 1 / 8. For the above luminance components, the first predicted value P1 and the second predicted value P2 are both luminance predicted values, and the weighted and compensated predicted value P1*a+P2*b is also a luminance predicted value.
[0165] In one example, for each sub-block within the third region sub-block, a first set of weighting coefficients can be configured for the chroma components. For instance, along the direction from the first region sub-block to the second region sub-block, the first weighting coefficient 'a' for the chroma components of each sub-block is 7 / 8, 4 / 8, and 1 / 8, respectively. For example, referring to Figure 6C, the first weighting coefficient 'a' for the chroma components of sub-block 7 is 7 / 8, the first weighting coefficient 'a' for the chroma components of sub-block 4 is 4 / 8, and the first weighting coefficient 'a' for the chroma components of sub-block 1 is 1 / 8.
[0166] In another example, a second set of weighting coefficients can be configured for each sub-block within the third region sub-block. For example, along the direction from the first region sub-block to the second region sub-block, the first weighting coefficient 'a' for the chromaticity component of each sub-block is 6 / 8, 4 / 8, and 2 / 8 respectively. For example, referring to Figure 6C, the first weighting coefficient 'a' for the chromaticity component of sub-block 7 is 6 / 8, the first weighting coefficient 'a' for the chromaticity component of sub-block 4 is 4 / 8, and the first weighting coefficient 'a' for the chromaticity component of sub-block 1 is 2 / 8. For the above chromaticity components, the first predicted value P1 and the second predicted value P2 are both chromaticity predicted values, and the weighted and compensated predicted value P1*a + P2*b is also a chromaticity predicted value.
[0167] The following are several examples describing the motion compensation process described above.
[0168] Example 1: For motion compensation, the current block can be divided into a first region sub-block, a second region sub-block, and a third region sub-block. Motion compensation is performed on each sub-block within the first region sub-block based on the first target motion information of the first triangular sub-block. Motion compensation is performed on each sub-block within the second region sub-block based on the second target motion information of the second triangular sub-block. Weighted compensation is performed on each sub-block within the third region sub-block based on the first target motion information and the second target motion information.
[0169] Specifically, the current block can be divided into multiple M*M (M is, for example, 4) sub-blocks. For each M*M sub-block, if the sub-block is not on the diagonal of the first and second triangular sub-blocks, motion compensation is performed on the sub-block using unidirectional motion information. If the sub-block is located within the first triangular sub-block, it is called the first region sub-block, and motion compensation is performed using the first target motion information; if the sub-block is located within the second triangular sub-block, it is called the second region sub-block, and motion compensation is performed using the second target motion information. If the sub-block is located on the diagonal of the first and second triangular sub-blocks, it is called the third region sub-block, and weighted compensation can be performed based on two unidirectional motion information (i.e., the first target motion information and the second target motion information). For the specific weighting method, please refer to the above embodiment.
[0170] Example 2: For motion compensation, the current block can be divided into a first region sub-block, a second region sub-block, and a third region sub-block. Motion compensation is performed on each sub-block within the first region sub-block based on the first target motion information of the first triangular sub-block. Motion compensation is performed on each sub-block within the second region sub-block based on the second target motion information of the second triangular sub-block. Weighted compensation is performed on each sub-block within the third region sub-block based on the first and second target motion information, using only one set of weighting coefficients: weighting coefficients for the luminance component: {7 / 8, 6 / 8, 4 / 8, 2 / 8, 1 / 8}, and weighting coefficients for the chrominance component: {7 / 8, 4 / 8, 1 / 8}. See the above embodiment for the specific weighting method.
[0171] Example 3: For motion compensation, the current block can be divided into a first region sub-block, a second region sub-block, and a third region sub-block. Motion compensation is performed on each sub-block within the first region sub-block based on the first target motion information of the first triangular sub-block. Motion compensation is performed on each sub-block within the second region sub-block based on the second target motion information of the second triangular sub-block. Weighted compensation is performed on each sub-block within the third region sub-block based on the first and second target motion information, using only one set of weighting coefficients: weighting coefficients for the luminance component: {7 / 8, 6 / 8, 5 / 8, 4 / 8, 3 / 8, 2 / 8, 1 / 8}, and weighting coefficients for the chrominance component: {6 / 8, 4 / 8, 2 / 8}. See the above embodiment for the specific weighting method.
[0172] Method 3: Divide the current block into a first sub-block, a second sub-block, and a third sub-block. The first sub-block is located within a first triangular sub-block, the second sub-block is located within a second triangular sub-block, and the center of each sub-block within the third sub-block is less than a preset threshold distance from the diagonal dividing the first and second triangular sub-blocks. Perform motion compensation on each sub-block within the first sub-block based on the first target motion information. Perform motion compensation on each sub-block within the second sub-block based on the second target motion information. Perform motion compensation on each sub-block within the third sub-block based on either the first or second target motion information.
[0173] For example, if the current block's size information meets a first condition (e.g., the current block's width is greater than or equal to its height), then motion compensation is performed on each sub-block within the third region sub-block based on the first target motion information; if the current block's size information meets a second condition (e.g., the current block's width is less than its height), then motion compensation is performed on each sub-block within the third region sub-block based on the second target motion information. Of course, the above is just an example; other methods can be used to determine whether motion compensation is based on the first or second target motion information.
[0174] Each sub-block within the third region can be a 1*1 sub-block, i.e., a single pixel block, or an N*M sub-block, where N can be greater than or equal to 1 and M can also be greater than or equal to 1.
[0175] In this embodiment, for the third region sub-block, the first target motion information and the second target motion information are no longer used for weighted compensation. Instead, the first target motion information is used to perform motion compensation for each sub-block within the third region sub-block, or the second target motion information is used to perform motion compensation for each sub-block within the third region sub-block. That is, there are no sub-blocks for which bidirectional prediction is required for motion compensation, and therefore weighted compensation is not needed.
[0176] As to whether to use the first target motion information to perform motion compensation on each sub-block within the third region sub-block, or to use the second target motion information to perform motion compensation on each sub-block within the third region sub-block, it can be determined in any of the following ways: (1) By default, the first target motion information is used to perform motion compensation on each sub-block within the third region sub-block; (2) By default, the second target motion information is used to perform motion compensation on each sub-block within the third region sub-block; (3) It is determined based on the size of the current block. For example, if the width of the current block is greater than or equal to the height of the current block, the first target motion information is used to perform motion compensation on each sub-block within the third region sub-block; if the width of the current block is less than the height of the current block, the second target motion information is used to perform motion compensation on each sub-block within the third region sub-block.
[0177] Example 9
[0178] The video encoder first determines whether the current block meets the specific conditions for enabling the triangular prediction mode. If not, it decides not to use the triangular prediction mode and instead uses another mode. If yes, the video encoder can either enable the triangular prediction mode by default or determine whether to enable it. If the video encoder defaults to or determines that the triangular prediction mode is enabled, it performs the operation of dividing the current block into triangular sub-blocks as described in the relevant embodiments above, as well as other subsequent operations; otherwise, these operations are not performed.
[0179] To determine whether to enable the triangulation prediction mode, the video encoder can determine the rate-distortion cost corresponding to the triangulation prediction mode. If the rate-distortion cost corresponding to the triangulation prediction mode is less than the rate-distortion cost corresponding to each of the other modes, then the triangulation prediction mode can be determined to be enabled; otherwise, the triangulation prediction mode can be determined to be disabled.
[0180] Accordingly, the encoded bitstream sent by the video encoder to the decoder may carry a seventh indication information, which is used to indicate the activation of the triangular prediction mode.
[0181] The video decoder first determines whether the current block meets the specific conditions for enabling the triangular prediction mode. If not, it decides not to use the triangular prediction mode and instead uses another mode. If yes, the video decoder can enable the triangular prediction mode by default, or it can parse the encoded bitstream from the encoder. If the encoded bitstream carries the seventh indicator information, it can determine that the triangular prediction mode is enabled; otherwise, it can determine that the triangular prediction mode is not enabled. If the video decoder defaults to or determines that the triangular prediction mode is enabled, it performs the operation of dividing the current block into triangular sub-blocks as described in the relevant embodiments above, as well as other subsequent operations; otherwise, it does not perform these operations.
[0182] Example 10
[0183] The video encoder / decoder can also store the first target motion information and the second target motion information in the following manner: if the candidate block corresponding to the first target motion information is a unidirectional prediction block, then the first target motion information is stored in the first triangular sub-block; if the candidate block corresponding to the first target motion information is a bidirectional prediction block, then the first target motion information and the third target motion information are stored in the first triangular sub-block, and the third target motion information is another motion information of the bidirectional prediction block; if the candidate block corresponding to the second target motion information is a unidirectional prediction block, then the second target motion information is stored in the second triangular sub-block; if the candidate block corresponding to the second target motion information is a bidirectional prediction block, then the second target motion information and the fourth target motion information are stored in the second triangular sub-block, and the fourth target motion information is another motion information of the bidirectional prediction block.
[0184] For example, for the first sub-block mentioned above, if the first target motion information of the first sub-block is MV1, and MV1 comes from the one-way prediction block R1 (i.e., the one-way prediction block R1 is a candidate block of the current block), and the motion information list includes the motion information MV1 of the one-way prediction block R1, and MV1 is selected as the first target motion information of the first sub-block, then MV1 is stored for the first sub-block, as shown in Figure 7A. For the second sub-block mentioned above, if the second target motion information of the second sub-block is MV2, and MV2 comes from the one-way prediction block R2 (i.e., the one-way prediction block R2 is a candidate block of the current block), and the motion information list includes the motion information MV2 of the one-way prediction block R2, and MV2 is selected as the second target motion information of the second sub-block, then MV2 is stored for the second sub-block, as shown in Figure 7A.
[0185] For example, regarding the first sub-block mentioned above, if the first target motion information of the first sub-block is MV1, and MV1 comes from bidirectional prediction block R3 (i.e., bidirectional prediction block R3 is a candidate block for the current block), and the motion information list includes motion information MV1 and MV2 of bidirectional prediction block R3, and MV1 is selected as the first target motion information of the first sub-block, then MV1 and MV2 can be stored for the first sub-block, instead of storing only MV1, as shown in Figure 7B. Similarly, regarding the second sub-block mentioned above, if the second target motion information of the second sub-block is MV3, and MV3 comes from bidirectional prediction block R4 (i.e., bidirectional prediction block R4 is a candidate block for the current block), and the motion information list includes motion information MV3 and MV4 of bidirectional prediction block R4, and MV3 is selected as the second target motion information of the second sub-block, then MV3 and MV4 can be stored for the second sub-block, instead of storing only MV3, as shown in Figure 7B.
[0186] In the above examples, as shown in Figures 7A and 7B, motion information can be stored in 4x4 units.
[0187] Example 11
[0188] This application provides a video decoder. Figure 8 is a schematic structural diagram of the video decoder. Referring to Figure 8, the video decoder may include a processor 81 and a machine-readable storage medium 82. The machine-readable storage medium 82 stores machine-executable instructions that can be executed by the processor 81. When the processor 81 executes the machine-executable instructions, it can implement the video decoding method according to the above-described related embodiments of this application.
[0189] This application also provides a video encoder. Figure 9 is a schematic structural diagram of the video encoder. Referring to Figure 9, the video encoder may include a processor 91 and a machine-readable storage medium 92. The machine-readable storage medium 92 stores machine-executable instructions that can be executed by the processor 91. When the processor 91 executes the machine-executable instructions, it can implement the video encoding method according to the above-described related embodiments of this application.
[0190] This application also provides a machine-readable storage medium storing computer instructions. When executed by a processor, the computer instructions enable the processor to implement the video encoding / decoding method according to the above embodiments of this application.
[0191] The aforementioned machine-readable storage medium can be an electronic, magnetic, optical, or other physical storage device, which can contain or store information such as executable instructions, data, etc. For example, machine-readable storage media can include volatile memory (e.g., RAM (Random Access Memory)), non-volatile memory (e.g., flash memory, storage drives (such as hard disk drives), solid-state drives, optical storage (e.g., CD-ROM (Compact Disc Read-Only Memory), DVD (Digital Versatile Disc) etc.)) or combinations thereof.
[0192] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is an electronic device, including but not limited to: personal computers, laptop computers, tablet computers, cellular phones, cameras, smartphones, personal digital assistants, media players, navigation devices, email sending and receiving devices, game consoles, wearable devices, or any combination thereof.
[0193] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.
[0194] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects.
[0195] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus, such that execution of the computer program instructions by the processor produces means for implementing the functions specified in one or more blocks of the flowchart illustrations and / or one or more blocks of the block diagrams.
[0196] The above descriptions are merely some embodiments of this application and are not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A video encoding / decoding method, the method being executed by a video encoder or a video decoder, and comprising: If the current block meets the specific conditions for enabling the triangular prediction mode and it is determined that the triangular prediction mode is enabled, then the current block is divided into the first triangular sub-block and the second triangular sub-block. Obtain the first target motion information of the first triangular sub-block and the second target motion information of the second triangular sub-block, wherein the first target motion information and the second target motion information are different; The current block is encoded or decoded based on the first target motion information and the second target motion information.
2. The method according to claim 1, wherein, Based on the frame type of the current frame in which the current block is located, the motion information mode of the current block, and / or the size information of the current block, determine whether the current block meets the specific conditions for enabling the triangulation prediction mode.
3. The method according to claim 2, wherein, If the frame type is a B-frame or a non-I-frame, or if the frame type allows intra-block copying, then the frame type is determined to meet specific conditions.
4. The method according to claim 2, wherein, If the motion information mode is a merged mode, then the motion information mode is determined to meet specific conditions.
5. The method according to claim 2, wherein, If the width of the current block is greater than or equal to a first value, and the height of the current block is greater than or equal to a second value, then the size information of the current block is determined to meet a specific condition; or, If the width of the current block is greater than or equal to the third value, or the height of the current block is greater than or equal to the fourth value, then the size information of the current block is determined to meet specific conditions. or, If the width of the current block is greater than or equal to the fifth value and less than or equal to the sixth value, and the height of the current block is greater than or equal to the seventh value and less than or equal to the eighth value, then the size information of the current block is determined to meet specific conditions. or, If the width of the current block is greater than or equal to the ninth value and less than or equal to the tenth value, or if the height of the current block is greater than or equal to the eleventh value and less than or equal to the twelfth value, then the size information of the current block is determined to meet specific conditions. or, If the width of the current block is greater than or equal to the thirteenth value and less than or equal to the fourteenth value, the height of the current block is greater than or equal to the fifteenth value and less than or equal to the sixteenth value, and the area of the current block is greater than or equal to the seventeenth value and less than or equal to the eighteenth value, then the size information of the current block is determined to meet specific conditions.
6. The method according to claim 1, wherein, The step of dividing the current block into a first triangular sub-block and a second triangular sub-block includes: Divide the current block into a first triangular sub-block and a second triangular sub-block according to the main diagonal method; or, Divide the current block into a first triangular sub-block and a second triangular sub-block according to the secondary diagonal method.
7. The method according to claim 1, wherein, The process of obtaining the first target motion information of the first triangular sub-block and the second target motion information of the second triangular sub-block includes: Construct a first candidate motion information list, which includes multiple candidate motion information; select one candidate motion information from the first candidate motion information list as the first target motion information; exclude the first target motion information from the first candidate motion information list, and select one candidate motion information from the remaining candidate motion information in the first candidate motion information list as the second target motion information; or... Construct a second candidate motion information list corresponding to the first triangular sub-block, and construct a third candidate motion information list corresponding to the second triangular sub-block. The second candidate motion information list includes multiple candidate motion information, and the third candidate motion information list includes multiple candidate motion information. Select one candidate motion information from the second candidate motion information list as the first target motion information. Select one candidate motion information from the third candidate motion information list as the second target motion information.
8. The method according to claim 7, further comprising: Determine the partitioning method of the current block. Specifically, if the current block is divided into a first triangular sub-block and a second triangular sub-block according to the main diagonal, then the first candidate motion information list is constructed; if the current block is divided into a first triangular sub-block and a second triangular sub-block according to the secondary diagonal, then the second candidate motion information list and the third candidate motion information list are constructed.
9. The method according to claim 7 or 8, wherein, The construction of the first candidate motion information list includes: Obtain the candidate block corresponding to the current block; Add the motion information of the candidate block to the first candidate motion information list. Wherein, if the candidate block is a unidirectional prediction block, the motion information of the candidate block includes the unidirectional motion information of the candidate block; if the candidate block is a bidirectional prediction block, the motion information of the candidate block includes the first motion information and / or the second motion information of the candidate block, but does not include the weighted motion information of the first motion information and the second motion information.
10. The method according to claim 7 or 8, wherein, The construction of the second candidate motion information list corresponding to the first triangular sub-block includes: Obtain the first candidate block corresponding to the first triangular sub-block; Add the motion information of the first candidate block to the second candidate motion information list. Wherein, if the first candidate block is a unidirectional prediction block, the motion information of the first candidate block includes the unidirectional motion information of the first candidate block; if the first candidate block is a bidirectional prediction block, the motion information of the first candidate block includes the first motion information of the first candidate block and / or the second motion information of the first candidate block, but does not include the weighted motion information of the first motion information and the second motion information of the first candidate block. The construction of the third candidate motion information list corresponding to the second triangular sub-block includes: Obtain the second candidate block corresponding to the second triangular sub-block; Add the motion information of the second candidate block to the third candidate motion information list. Wherein, if the second candidate block is a unidirectional prediction block, the motion information of the second candidate block includes the unidirectional motion information of the second candidate block; if the second candidate block is a bidirectional prediction block, the motion information of the second candidate block includes the first motion information of the second candidate block and / or the second motion information of the second candidate block, but does not include the weighted motion information of the first motion information and the second motion information of the second candidate block.
11. The method according to claim 10, wherein, If the current block is divided into a first triangular sub-block and a second triangular sub-block according to the secondary diagonal method, the first triangular sub-block is the upper right triangular sub-block, and the second triangular sub-block is the lower left triangular sub-block; The first candidate block corresponding to the first triangular sub-block includes: the adjacent block above the current block, and the temporal candidate block in other frames outside the current frame where the current block is located; The second candidate block corresponding to the second triangular sub-block includes: the adjacent block to the left of the current block, and the temporal candidate block in other frames outside the current frame where the current block is located.
12. The method according to claim 7 or 8, wherein, When constructing the first candidate motion information list, the second candidate motion information list, or the third candidate motion information list, each time motion information is added to the candidate motion information list, it is determined whether the number of motion information in the candidate motion information list has reached the upper limit. If so, the addition of motion information is rejected; otherwise, the addition of motion information continues. And / or, When constructing the first candidate motion information list, the second candidate motion information list, or the third candidate motion information list, each time the motion information of the candidate blocks of the current block is collected, there is no need to compare whether the motion information of the candidate blocks is consistent with the motion information already collected for the current block.
13. The method according to claim 1, further comprising: After acquiring the first target motion information and the second target motion information, motion compensation is performed on the first triangular sub-block and the second triangular sub-block based on the first target motion information and the second target motion information.
14. The method according to claim 13, wherein, The motion compensation of the first triangular block and the second triangular block based on the first target motion information and the second target motion information includes: The current block is defined as comprising multiple sub-blocks, each of which has a width greater than or equal to 2 and a height greater than or equal to 2. For each sub-block: if the sub-block is located within the first triangular sub-block, then motion compensation is performed on the sub-block based on the first target motion information; if the sub-block is located within the second triangular sub-block, then motion compensation is performed on the sub-block based on the second target motion information; if the sub-block is located on the diagonal dividing the first triangular sub-block and the second triangular sub-block, then weighted compensation is performed on the sub-block based on the first target motion information and the second target motion information.
15. The method according to claim 13, wherein, The motion compensation of the first triangular block and the second triangular block based on the first target motion information and the second target motion information includes: The current block is determined to include a first sub-block, a second sub-block, and a third sub-block. The first sub-block is located within the first triangular sub-block, the second sub-block is located within the second triangular sub-block, and the distance between the center of each sub-block within the third sub-block and the diagonal dividing the first and second triangular sub-blocks is less than a preset threshold. Motion compensation is performed on each sub-block within the first region sub-block based on the first target motion information; Motion compensation is performed on each sub-block within the second region sub-block based on the second target motion information; Weighted compensation is performed on each sub-block within the third region sub-block based on the first target motion information and the second target motion information.
16. The method according to claim 15, wherein, Weighted compensation for each sub-block within the third region sub-block based on the first target motion information and the second target motion information includes: for each sub-block within the third region sub-block... The first predicted value of the sub-block is determined based on the first target motion information; The second predicted value of the sub-block is determined based on the second target motion information; The sub-block is weighted and compensated based on the first predicted value, the first weighting coefficient corresponding to the first predicted value, the second predicted value, and the second weighting coefficient corresponding to the second predicted value. Wherein, if the sub-block is located within the first triangular sub-block, the first weight coefficient is greater than the second weight coefficient; if the sub-block is located within the second triangular sub-block, the first weight coefficient is less than the second weight coefficient; if the sub-block is located on the diagonal, the first weight coefficient is equal to the second weight coefficient.
17. The method according to claim 13, wherein, The motion compensation of the first triangular block and the second triangular block based on the first target motion information and the second target motion information includes: The current block is determined to include a first sub-block, a second sub-block, and a third sub-block. The first sub-block is located within the first triangular sub-block, the second sub-block is located within the second triangular sub-block, and the distance between the center of each sub-block within the third sub-block and the diagonal dividing the first and second triangular sub-blocks is less than a preset threshold. Motion compensation is performed on each sub-block within the first region sub-block based on the first target motion information; Motion compensation is performed on each sub-block within the second region sub-block based on the second target motion information; Motion compensation is performed on each sub-block within the third region sub-block based on the first target motion information or the second target motion information.
18. The method according to claim 17, wherein, Motion compensation for each sub-block within the third region sub-block based on the first target motion information or the second target motion information includes: If the size information of the current block satisfies the first condition, then motion compensation is performed on each sub-block within the third region sub-block according to the first target motion information; If the size information of the current block satisfies the second condition, then motion compensation is performed on each sub-block within the third region sub-block according to the second target motion information.
19. The method according to claim 1, further comprising: If the candidate block corresponding to the first target motion information is a one-way prediction block, then the first target motion information is stored in the first triangular sub-block; If the candidate block corresponding to the first target motion information is a bidirectional prediction block, then the first target motion information and the third target motion information are stored in the first triangular sub-block, and the third target motion information is another motion information of the bidirectional prediction block; If the candidate block corresponding to the second target motion information is a one-way prediction block, then the second target motion information is stored in the second triangular sub-block; If the candidate block corresponding to the second target motion information is a bidirectional prediction block, then the second triangular sub-block stores the second target motion information and the fourth target motion information, wherein the fourth target motion information is another motion information of the bidirectional prediction block.
20. A video decoder, comprising a processor and a machine-readable storage medium, wherein, The machine-readable storage medium stores machine-executable instructions that can be executed by the processor; when the processor executes the machine-executable instructions, it implements the method according to any one of claims 1-19.
21. A video encoder, comprising a processor and a machine-readable storage medium, wherein, The machine-readable storage medium stores machine-executable instructions that can be executed by the processor; when the processor executes the machine-executable instructions, it implements the method according to any one of claims 1-19.
22. A machine-readable storage medium having stored thereon computer instructions that, when executed by a processor, cause the processor to perform the method according to any one of claims 1-19.