Bilateral template and multi-pass decoder-end motion vector refinement

Through bilateral templates and multi-pass refinement technology, the problem of low refinement efficiency of motion vectors in the existing technology is solved, and efficient motion vector optimization is achieved in two-way prediction scenarios, improving video encoding and codec performance.

CN118947121APending Publication Date: 2024-11-12MEDIATEK INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202380027942.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2022-10-05
Filing Date
2023-03-30
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

Existing video encoding and decoding technologies have problems with inefficiency in motion vector refinement, especially in bidirectional prediction scenarios, which makes it difficult to effectively optimize the encoding and decoding cost, resulting in limited video encoding and decoding performance.

Method used

The decoder-side motion vector refinement (DMVR) is used to use bilateral templates to optimize the motion vector to reduce the cost of encoding and decoding by generating bilateral templates and matching templates and multi-pass refinement in bidirectional prediction scenarios.

Benefits of technology

The efficiency and performance of video encoding and decoding are improved, especially in bidirectional prediction scenarios, which significantly reduces the encoding and decoding cost and improves the reconstruction quality of video signals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118947121A_ABST
    Figure CN118947121A_ABST
Patent Text Reader

Abstract

A video codec that performs decoder-side motion vector refinement using a bilateral template is provided. A video codec receives data for a block of pixels to be encoded or decoded as a current block of a current picture of a video. The current block is associated with a first motion vector and a second motion vector, the first motion vector referring to a first initial predictor in a first reference picture, and the second motion vector referring to a second initial predictor in a second reference picture. The video codec generates a bilateral model based on the first initial predictor and the second initial predictor. The video codec refines the first motion vector to minimize a first cost between the bilateral model and a predictor referenced by the refined first motion vector. The video codec refines the second motion vector to minimize a second cost between the bilateral model and the predictor referenced by the refined second motion vector.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This disclosure is part of a non-provisional application that claims priority to U.S. Provisional Patent Application No. 63 / 325,753, filed on March 31, 2022, and U.S. Provisional Patent Application No. 63 / 378,376, filed on October 5, 2022. The contents of the above-listed applications are incorporated herein by reference in their entirety. Technical Field

[0003] The present disclosure relates generally to video coding and decoding, and more particularly to decoder-side motion vector refinement (DMVR). Background Art

[0004] Unless otherwise indicated herein, the approaches described in this section are not prior art to the claims listed below and are not admitted to be prior art by inclusion in this section.

[0005] High-Efficiency Video Coding (HEVC) is an international video codec standard developed by the Joint Collaborative Team on Video Coding (JCT-VC). HEVC is based on a hybrid block-based motion compensation DCT transform-like codec architecture. The basic unit of compression, called a coding unit (CU), is a 2Nx2N square pixel block. Each CU can be recursively divided into four smaller CUs until a predetermined minimum size is reached. Each CU contains one or more prediction units (PUs).

[0006] Versatile video coding (VVC) is the latest international video codec standard developed by the Joint Video Expert Team (JVET) of ITU-TSG16 WP3 and ISO / IEC JTC1 / SC29 / WG11. The input video signal is predicted from a reconstructed signal derived from the coded picture region. The prediction residual signal is processed by block transform. The transform coefficients are quantized and entropy coded along with other auxiliary information in the bitstream. The reconstructed signal is generated from the prediction signal and the reconstructed residual signal after inverse transforming the dequantized transform coefficients. The reconstructed signal is further processed by loop filtering to remove codec artifacts. The decoded picture is stored in a frame buffer and used to predict future pictures in the input video signal.

[0007] In VVC, a codec picture is divided into non-overlapping square block areas represented by associated coding tree units (CTUs). A codec picture can be represented by a set of fragments, each fragment containing an integer number of CTUs. The CTUs in a fragment are processed continuously in a raster scan. Intra-frame prediction or inter-frame prediction can be used to decode bi-predictive (B) fragments, where there are at most two motion vectors and reference indices to predict the sample values ​​of each block. Prediction (P) fragments are decoded using intra-frame prediction or inter-frame prediction with at most one motion vector and reference index to predict the sample values ​​of each block. Intra-frame (I) fragments are decoded using only intra-frame prediction.

[0008] For each inter-predicted CU, motion parameters consisting of motion vector, reference picture index and reference picture list usage index and additional information are used for the generation of inter-prediction samples. Motion parameters can be sent explicitly or implicitly. When a CU is encoded and decoded in skip mode, the CU is associated with one PU and has no significant residual coefficients, no coded motion vector increments or reference picture indexes. Merge mode means that the motion parameters of the current CU are obtained from neighboring CUs, including spatial and temporal candidates, and additional scheduling introduced in VVC. Merge mode can be used for any inter-predicted CU. An alternative to merge mode is explicit transmission of motion parameters, where the motion vector of each CU, the corresponding reference picture index and reference picture list usage flag of each reference picture list, and other required information are explicitly sent. Summary of the invention

[0009] The following summary is illustrative only and is not intended to be binding in any way. That is, the following summary is provided to introduce the concepts, highlights, benefits and advantages of the novel and non-obvious technologies described herein. Selected but not all embodiments are further described in the detailed description below. Therefore, the following summary is not intended to identify the essential features of the claimed subject matter, nor is it intended to be used to determine the scope of the claimed subject matter.

[0010] Some embodiments provide a video codec that uses bilateral templates to perform decoder-side motion vector refinement. The video codec receives data of a pixel block that is to be encoded or decoded as a current block of a current picture of a video. The current block is associated with a first motion vector and a second motion vector, the first motion vector references a first initial predictor in a first reference picture, and the second motion vector references a second initial predictor in a second reference picture. The first and second motion vectors may be bi-directional prediction merge candidates. When the first motion vector is a unidirectional prediction candidate, the second motion vector may be generated by mirroring the first motion vector in the opposite direction.

[0011] The video codec generates a bilateral template based on a first initial predictor and a second initial predictor. The video codec refines the first motion vector to minimize a first cost between the bilateral template and a predictor referenced by the refined first motion vector. The video codec refines the second motion vector to minimize a second cost between the bilateral template and a predictor referenced by the refined second motion vector. The video codec encodes or decodes a current block by using the refined first and second motion vectors to reconstruct the current block.

[0012] In some embodiments, the video codec further sends or receives a first syntax element indicating whether to refine the first or second motion vector by using the generated bilateral template or by performing bilateral matching based on the first and second initial predictors. In some embodiments, the video codec sends or receives a second syntax element indicating whether to refine the first motion vector or to refine the second motion vector.

[0013] The video codec may derive a bilateral template as a weighted sum of a first initial predictor and a second initial predictor. In some embodiments, the weights applied to the first and second initial predictors, respectively, are determined based on the fragment quantization parameter values ​​of the first and second initial predictors. In some embodiments, the weights applied to the first and second initial predictors, respectively, are determined based on the picture order count (POC) distance of the first and second reference pictures to the current picture. In some embodiments, the weights applied to the first and second initial predictors, respectively, are determined based on a bi-prediction with CU-level weights (BCW) index sent for the current block.

[0014] In some embodiments, the video codec refines the bilateral template by using a linear model generated based on the first initial predictor, the second initial predictor, and an extended area of ​​the current block (e.g., an area above and to the left of the L-shape). In some embodiments, the video codec refines the first and second initial predictors based on a linear model generated based on the first initial predictor, the second initial predictor, and an extended area of ​​the current block, and then generates a bilateral template based on the refined first and second initial predictors.

[0015] In some embodiments, the video codec refines the first and second motion vectors in multiple passes. The video codec may further refine the first and second motion vectors for each of the multiple sub-blocks of the current block in a second refinement pass. The video codec may further refine the first and second motion vectors by applying bidirectional optical flow (BDOF) in a third refinement pass. In some embodiments, in the second refinement pass, the first and second motion vectors (i.e., bilateral matching) are refined by minimizing the cost between a predictor referenced by the refined first motion vector and a predictor referenced by the refined second motion vector. In some embodiments, when the bilateral template is used to refine the first and second motion vectors, the second and third refinement passes are disabled. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings are included to provide a further understanding of the present disclosure and are incorporated into and constitute a part of the present disclosure. The accompanying drawings illustrate embodiments of the present disclosure and together with the description are used to explain the principles of the present disclosure. It is worth noting that the drawings are not necessarily drawn to scale, as certain components may be shown out of proportion to size in actual implementations in order to clearly illustrate the concepts of the present disclosure.

[0017] Figure 1 The decoder side motion vector refinement (DMVR) operation based on bilateral templates is conceptually illustrated.

[0018] Figure 2 The refinement of prediction candidates (eg, merge candidates) by bilateral matching (BM) is conceptually illustrated.

[0019] Figure 3A -B shows the refined bi-prediction MV under adaptive DMVR.

[0020] Figure 4A -C conceptually illustrates the use of a bilateral template to determine the cost when performing MP-DMVR on the current block.

[0021] Figure 5The bilateral template is shown to be refined based on a linear model derived based on the current block and an extended region of the bilateral template.

[0022] Figure 6 Conceptually illustrating the generation of a bilateral template based on a reference patch refined by a linear model.

[0023] Figure 7 Conceptually illustrates the refinement of a bilateral template into an L0 bilateral template and an L1 bilateral template using L0 and L1 linear models (P model and Q model).

[0024] Figure 8 An example video encoder is shown that can implement MP-DMVR and bilateral templates.

[0025] Fig. 9 The video encoder portion implementing the bilateral template MP-DMVR is shown.

[0026] Fig.10 The process of using bilateral templates with MP-DMVR is conceptually illustrated.

[0027] Fig.11 An example video decoder that can implement MP-DMVR and bilateral templates is conceptually illustrated.

[0028] Fig.12 Part of a video decoder implementing bilateral template MP-DMVR is shown.

[0029] Fig.13 The process of using bilateral templates with MP-DMVR is conceptually illustrated.

[0030] Fig.14 An electronic system that implements some embodiments of the present disclosure is conceptually illustrated. DETAILED DESCRIPTION

[0031] In the following detailed description, many specific details are set forth by way of example in order to provide a thorough understanding of the relevant teachings. Any variations, derivations, and / or extensions based on the teachings described herein are within the scope of protection of the present disclosure. In some cases, well-known methods, processes, components, and / or circuits associated with one or more example embodiments disclosed herein may be described at a relatively high level without details to avoid unnecessarily obscuring aspects of the teachings of the present disclosure.

[0032] Ⅰ. Bilateral Template

[0033] For some embodiments, a bilateral template (or dual template) is generated as a weighted combination of two reference blocks (or predictors), which are referenced by an initial MV0 of list 0 (or L0) and MV1 of list 1 (or L1), respectively. Figure 1The decoder side motion vector refinement (DMVR) operation based on bilateral templates is conceptually shown. The figure illustrates the DMVR operation based on bilateral templates for the current block 100 in two steps:

[0034] In step 1, the video codec generates a bilateral template 105 based on initial reference blocks 120 and 121, which are referenced by initial bidirectional prediction motion vectors MV0 and MV1 in reference pictures 110 and 111, respectively. The bilateral template 105 may be a weighted combination of the initial reference blocks 120 and 121.

[0035] In step 2, the video codec performs template matching to refine MV0 and MV1 based on the generated bilateral template 105. Specifically, the video codec searches for a better match of the bilateral template 105 around the reference block 120 in the reference picture 110, and also searches for a better match of the bilateral template 105 around the reference block 121 in the reference picture 111. The search identifies an updated reference block 130 (referenced by the refined MV0') and an updated reference block 131 (referenced by the refined MV1').

[0036] The template matching operation based on bilateral templates includes calculating a cost metric between the generated bilateral template 105 and the sample area around the initial reference blocks 120 and 121 in the reference picture. For each of the two reference pictures 110 and 111, the MV that produces the minimum template cost is considered to be the updated (refined) MV of the list to replace the initial MV. Finally, the two refined MVs, namely MV0' and MV1', are used for conventional bidirectional prediction to replace the initial MVs, namely MV0 and MV1. Since it is commonly used for block matching motion estimation, the sum of absolute differences (SAD) is used as a cost metric.

[0037] In some embodiments, DMVR is applied to a bi-predictive merge mode where one merge candidate comes from a past reference picture (L0) and the other merge candidate comes from a future reference picture (L1) without transmitting additional syntax elements.

[0038] Ⅱ. Multi-pass DMVR

[0039] In some embodiments, if the selected merge candidate satisfies the DMVR condition, a multi-pass decoder-side motion vector refinement (MP-DMVR) method is applied in a conventional merge mode. In the first pass, bilateral matching (BM) is applied to the codec block. In the second pass, BM is applied to each 16x16 sub-block within the codec block. In the third pass, the MV in each 8x8 sub-block is refined by applying bi-directional optical flow (BDOF). Under the constraint that the motion vector difference MVD0 (i.e., MV0'-MV0) is exactly opposite in sign to the motion vector difference MVD1 (i.e., MV1'-MV1), BM refines the motion vector pair MV0 and MV1.

[0040] Figure 2 Conceptually illustrates refinement of a prediction candidate (e.g., a merge candidate) by bilateral matching (BM). MV0 is an initial motion vector or prediction candidate, and MV1 is a mirror image of MV0. MV0 references an initial reference block 220 in a reference picture 210. MV1 references an initial reference block 221 in a reference picture 211. The figure shows that MV0 and MV1 are refined to form MV0' and MV1', which reference updated reference blocks 230 and 231, respectively. The refinement is performed according to bilateral matching, so that the refined motion vector pair MV0' and MV1' has a better bilateral matching cost than the initial motion vector pair MV0 and MV1. MV0'-MV0 (i.e., MVD0) and MV1'-MV1 (i.e., MVD1) are constrained to be equal in size but opposite in direction. In some embodiments, the bilateral matching cost of a pair of mirror motion vectors (e.g., MV0 and MV1) is calculated based on the difference between the two reference blocks referenced by the mirror motion vector (e.g., the difference between reference blocks 210 and 211).

[0041] III. Adaptive MP-DMVR

[0042] The Adaptive Decoder-side Motion Vector Refinement (Adaptive DMVR) method refines the MV in only one of the two directions (L0 and L1) of bidirectional prediction for merge candidates that meet the DMVR conditions. Specifically, for the first unidirectional bilateral DMVR mode, the L0 MV is modified or refined, while the L1 MV is fixed (so MVD1 is zero); for the second unidirectional DMVR, the L1 MV is modified or refined, while the L0 MV is fixed (so MVD0 is zero).

[0043] Adaptive multi-pass DMVR processing is applied to selected merge candidates to refine motion vectors where MVD0 or MVD1 is zero in the first pass of MP-DMVR (i.e., codec block or PU level DMVR.)

[0044] Figure 3A -B conceptually illustrates the refinement of bidirectional prediction MVs under adaptive DMVR. These figures show a current block 300, which has initial bidirectional prediction MVs in L0 and L1 directions (MV0 and MV1). MV0 refers to an initial reference block 320 and MV1 refers to an initial reference block 321. Under adaptive DMVR, MV0 and MV1 are each refined based on minimizing a cost calculated based on the difference between the reference blocks referenced by MV0 and MV1.

[0045] Figure 3A A first unidirectional bilateral DMVR mode is shown, where only the L0 MV is refined and the L1 MV is fixed. As shown, MV1 remains fixed to reference the reference block 321, while MV0 is refined / updated to MV0' to reference the updated reference block 330, which is a better bilateral match of the fixed L1 reference block 321. Figure 3B A second unidirectional bilateral DMVR mode is shown, where only the L1 MV is refined and the L0 MV is fixed. As shown, MV0 remains fixed to reference the reference block 320, while MV1 is refined / updated to MV1' to reference the updated reference block 331, which is a better bilateral match of the fixed L0 reference block 320.

[0046] Similar to the regular merge mode DMVR, the merge candidates of the two unidirectional bilateral DMVR modes are derived from spatially adjacent coded blocks, TMVP, non-adjacent blocks, HMVP, and paired candidates. The difference is that only merge candidates that meet the DMVR conditions will be added to the candidate list. The two unidirectional bilateral DMVR modes use the same merge candidate list, and their corresponding merge index encoding and decoding are the same as the regular merge mode. There are two syntax elements indicating the adaptive MP-DMVR mode: bmMergeFlag and bmDirFlag. The syntax element bmMergeFlag is used to indicate the switch of this type of prediction (refining MV in only one direction, or adaptive MP-DMVR). When bmMergeFlag is turned on, the syntax element bmDirFlag is used to indicate the direction of the refined MV. For example, when bmDirFlag is equal to 0, the refined MV comes from list 0; when bmDirFlag is equal to 1, the refined MV comes from list 1. As shown in the following syntax table:

[0047] bm_merge_flag if(bm_merge_flag) bm_dir_flag

[0048] After decoding bm_merge_flag and bm_dir_flag, the variable bmDir can be determined. For example, if bm_merge_flag is equal to 1 and bm_dir_flag is equal to 0, bmDir will be set to 1 to indicate that adaptive MP-DMVR only refines the MVs in list 0 (or MV0). For another example, if bm_merge_flag is equal to 1 and bm_dir_flag is equal to 1, bmDir will be set to 2 to indicate that adaptive MP-DMVR only refines the MVs in list 1 (or MV1).

[0049] IV. Bilateral template with MP-DMVR

[0050] Some embodiments of the present disclosure provide a method for using bilateral template cost with MP-DMVR. The video codec generates the bilateral template described in Section I above. The generated bilateral template is then used to calculate the cost in a manner similar to the adaptive DMVR described in Section III above (refining the L0 MV while fixing the L1 MV, or refining the L1 MV while fixing the L0 MV.) When refining the L0 MV, the cost is calculated based on the difference between the L0 predictor and the bilateral template. When refining the L1 MV, the cost is calculated based on the difference between the L1 predictor and the bilateral template. For each of the two reference lists, the MV that produces the minimum template cost is considered as the updated MV of that list to replace the original list. The refinement of the L0 and L1 MVs is independent of each other.

[0051] Figure 4A -C conceptually illustrates the use of bilateral templates to determine costs when performing MP-DMVR on a current block 400. The current block has a pair of initial MVs (MV0 and MV1) for bidirectional prediction to be refined by MP-DMVR. For each MV (whether MV0 or MV1), the video codec calculates a template cost based on the difference between the generated bilateral template and the sample area around the initial reference block in the reference picture.

[0052] Figure 4A The video decoder is shown generating a bilateral template 405 as a weighted combination of two (initial) reference blocks 420 and 421 referred to by MV0 and MV1. Reference block 420 is a predictor from L0 reference picture 410 and reference block 421 is a predictor from L1 reference picture 411.

[0053] Figure 4BMV0 is shown to be refined into MV0' based on bilateral template 405. The generated bilateral template 405 and the sample area (searching the updated L0 predictor 430 and MV0' around the initial reference block 420 of the initial MV0) are used to calculate the template cost. The generated bilateral template 405 is treated as a template from List 1 (i.e., the template 405 is used to replace the initial L1 predictor 421).

[0054] Figure 4C MV1 is shown to be refined into MV1' based on the bilateral template 405. The generated bilateral template 405 and the sample area (searching the updated L1 predictor 431 and MV1' around the initial reference block 421 of the initial MV1) are used to calculate the template cost. The generated bilateral template 405 is regarded as a template from list 0 (i.e., the template 405 is used to replace the initial L0 predictor 420). The video codec can perform further MP-DMVR passes to optimize MV0' and MV1'. The two final refined MVs (MV0' and MV1') are then used for conventional bidirectional prediction and encoding and decoding of the current block 400.

[0055] A. Explicit sending

[0056] In some embodiments, the bilateral template with MP-DMVR is used as an adaptive MP-DMVR mode with an additional flag sent. In some embodiments, the bilateral template can be used in conjunction with adaptive MP-DMVR as an additional mode. An additional flag bm_bi_template_flag can be sent to indicate the enablement or disablement of this mode. As shown in the following table:

[0057]

[0058] In some other embodiments, the syntax element bm_mode_index is used. Specifically, bm_mode_index equal to 0 or 1 indicates unidirectional BDMVR mode (eg, 0 indicates unidirectional BDMVR mode in L0 direction, 1 indicates unidirectional BDMVR mode in L1 direction), and bm_mode_index equal to 2 indicates bilateral DMVR.

[0059]

[0060]

[0061] In some embodiments, in adaptive MP-DMVR, when bmDir is equal to 1, MV refinement is applied only to list 0; when bmDir is equal to 2, MV refinement is applied only to list 1 (e.g., bm_dir_flag is 1); when bmDir is equal to 3, bilateral templates are used to optimize MVs in list 0 and list 1. For example, when bmDir is equal to 3 (e.g., bm_bi_template_flag is 1), bilateral templates are used to refine MVs in list 0 and list 1 in the first pass of MP-DMVR. (In pass 2 and pass 3, sub-block bilateral matching and BDOF algorithms are used to derive motion refinement, respectively.) In some embodiments, when bmDir is equal to 3, bilateral templates are used to refine MVs in L0 and L1 in the second pass of MP-DMVR. In the second pass, sub-block based bilateral templates are performed to generate bilateral templates for each sub-block. (In the 1st and 3rd passes, bilateral matching and BDOF algorithms are used to derive motion refinements, respectively.) In some embodiments, when bmDir is equal to 3, bilateral templates are used to refine the MVs in List 0 and List 1 in the 1st and 2nd passes of MP-DMVR. (In the 3rd pass, the BDOF algorithm is used to derive motion refinements.)

[0062] In some embodiments, if bilateral templates are used in MP-DMVR, one or more passes of MP-DMVR may be skipped. For example, if bilateral templates are applied in the first pass, sub-block-based bilateral matching in the second pass may be skipped. For another example, if bilateral templates are applied in the first pass, sub-block-based bilateral matching in the second pass and BDOF-related refinement derivation in the third pass may be skipped. For another example, if bilateral templates are applied in the second pass, block-based bilateral matching in the first pass may be skipped.

[0063] B. Implicit transmission of MP-DMVR

[0064] In some embodiments, the bilateral profile with MP-DMVR is used as an adaptive MP-DMVR mode without additional flags being sent. The syntax table is shown below:

[0065] bm_merge_flag if(bm_merge_flag) bm_dir_flag

[0066] After decoding bm_merge_flag and bm_dir_flag, the variable bmDir can be determined. For example, if bm_merge_flag is equal to 1 and bm_dir_flag is equal to 0, bmDir will be set to 1, and bmDir is used to indicate that adaptive MP-DMVR refines MVs only in list 0 or only in list 1. For another example, if bm_merge_flag is equal to 1 and bm_dir_flag is equal to 1, bmDir will be set to 2, indicating that the bilateral template is used to refine MVs in list 0 and list 1. When bmDir is equal to 1, MV optimization will be applied to list 0 or list 1.

[0067] In some embodiments, whether to perform MV refinement on list 0 or list 1 is based on the cost of block-based bilateral matching (original 1st pass MP-DMVR), or based on the cost of sub-block bilateral matching, or the cost of L-neighboring template matching, or some other statistical analysis results. For example, the intensity difference between the current block and the templates of the initial MV0 in list 0 and the initial MV1 in list 1 can be used to decide whether to perform MV refinement on list 0 or list 1. The list (list 0 or list 1) that provides the template with the smaller cost is selected to refine the MVs in the selected list. MVs in other directions / lists are not refined. This selection may apply only to the 1st pass of MP-DMVR; or to the 1st and 2nd passes of MP-DMVR; or to the entire MP-DMVR process. In some embodiments, if bilateral templates are used in MP-DMVR (e.g., bmDir is equal to 2), one or more passes of MP-DMVR can be skipped.

[0068] C. Dedicated Merge Candidate List

[0069] In some embodiments, bilateral templates with MP-DMVR (as an adaptive MP-DMVR mode) are used with / without additional flag signaling. Specifically, a dedicated merge candidate list is derived. Each merge candidate in this dedicated merge candidate list can be refined using MP-DMVR, adaptive MP-DMVR, or bilateral templates. The method of sending bilateral templates described in Sections IV.A and IV.B above can be applied to each candidate in the dedicated merge candidate list, with or without additional flag signaling.

[0070] D. Bilateral templates for unidirectional prediction candidates

[0071] In some embodiments, bilateral templates are used to refine unidirectional prediction candidates. Specifically, the MV required to derive the bilateral template can be derived by MV mirroring. For example, if the direction of a unidirectional prediction candidate starts from list 0 (initial MV0), MV1 in list 1 can be derived by mirroring (mirror MV). After applying MV mirroring, the MV of the unidirectional prediction candidate can be further refined. Refinement includes applying MP-DMVR or applying bilateral template MP-DMVR. The bilateral template can be generated by the initial MV0 of list 0 and the mirror MV1 of list 1. The generated bilateral template and sample area (around the initial reference block of the initial MV0 of list 0) are used to calculate the cost of the bilateral template. The MV that produces the minimum template cost is considered to be the updated MV of list 0 to replace the original MV. The same mechanism can also be applied to list 1.

[0072] E. Use the exported model to refine the template

[0073] The bilateral template is generated as a weighted combination of two reference blocks from the initial MV0 of list 0 and the initial MV1 of list 1. In some embodiments, the generated bilateral template can be further refined by a linear model derived based on the bilateral template and an extended region of the current block. The linear model used to refine the bilateral template is based on an area extended from the motion compensated area of ​​the L0 and L1 reference blocks. In some embodiments, the extended area (e.g., L-shaped) can include i rows above and j rows to the left of the L0 / L1 reference block (i and j can be any value greater than or equal to 0; i and j can be equal or unequal.)

[0074] The extended bilateral template is then generated based on the weighted sum of the extended reference block of L0 and the extended reference block of L1. The samples in the extended area (e.g., L-shaped area) of the bilateral template and the corresponding adjacent reconstructed samples of the current reconstructed block are used to derive the linear model. The bilateral template without the extended area is further refined by the linear model. The refined bilateral template can be used for any bilateral template using the above-mentioned DMVR method.

[0075] Figure 5The bilateral template is shown to be refined based on a linear model, which is derived based on the extended area of ​​the current block and the bilateral template. As shown, the current block 500 has an initial L0 reference block 520 (referenced by MV0) and an initial L1 reference block 521 (referenced by MV1). The L0 reference block 520 has extended areas A and B. The current block 500 has extended areas C and D. The L1 reference block 521 has extended areas E and F. The video codec generates an extended bilateral template 550 from the extended L0 reference block (reference block 520 with A and B) and the extended L1 reference block (reference block 521 with E and F) by weighted sum. The extended bilateral template 550 includes a bilateral template 505 with extended areas H and G. A linear model 560 is generated based on the extended area (C and D) of the current block and the extended area (H+G) of the bilateral template. The linear model 560 may then be applied to refine the bilateral template 505 (without its extended region) into a refined bilateral template 506 for use with any of the bilateral templates using the DMVR method described above.

[0076] In some embodiments, samples in an extended area (e.g., an L-shaped area in the upper left corner) of the L0 reference (prediction) block and corresponding neighboring samples of the current block are used to derive an L0 linear model (P model). Samples in an extended area (e.g., an L-shaped area) of the L1 reference block and corresponding neighboring samples of the current block are used to derive an L1 linear model (Q model). The P model is used to refine the L0 reference block to generate a refined refL0Blk, and the Q model is used to refine the L1 reference block to generate a refined refL1Blk. The bilateral template is generated by weighting the sum of the refined refL0Blk and the refined refL1Blk. The bilateral template can be used for any bilateral template using the above-mentioned DMVR method.

[0077] Figure 6 Conceptually illustrating the generation of a bilateral template based on a reference block that is refined by a linear model. As shown, the extended regions A and B of the L0 reference block 520 and the extended regions C and D of the current block 500 are used to derive the P model. The extended regions E and F of the L1 reference block 521 and the extended regions C and D of the current block 500 are used to derive the Q model. The P model is used to refine the reference block 520 into a refined L0 reference block 620 (refL0Blk). The Q model is used to refine the reference block 521 into a refined L1 reference block 621 (refL1Blk). The bilateral template 605 is generated by the weighted sum of the refined L0 reference block 620 and the refined L1 reference block 621. The bilateral template 605 can be used for any bilateral template using the above-mentioned DMVR method.

[0078] In some embodiments, the bilateral template is generated by a weighted sum of reference blocks of L0 and reference blocks of L1. The P model is used to refine the bilateral template to generate bilTemplateP (L0 bilateral template), and the Q model is used to refine the bilateral template to independently generate bilTemplateQ (L1 bilateral template). The generated bilTemplateP and bilTemplateQ can be used in any of the above bilateral template methods to refine the MV of reference list 0 and the MV of reference list 1, respectively.

[0079] Figure 7 Conceptually illustrates the refinement of a bilateral template into an L0 bilateral template and an L1 bilateral template using L0 and L1 linear models (P-model and Q-model). As shown, an initial L0 reference block 520 (referenced by MV0) and an initial L1 reference block 521 (referenced by MV1) are used to create a bilateral template 505. Extended regions A and B of the L0 reference block 520 and extended regions C and D of the current block 500 are used to derive the P model. Extended regions E and F of the L1 reference block 521 and extended regions C and D of the current block 500 are used to derive the Q model. The P model is applied to the bilateral template 505 to create an L0 bilateral template (bilTemplateP) 710, and the Q model is applied to the bilateral template 505 to create an L1 bilateral template (bilTemplateQ) 711. The generated L0 bilateral template 710 and the generated L1 bilateral template 711 can be used in any of the above bilateral template methods to refine the MV of reference list 0 and the MV of reference list 1, respectively.

[0080] The above linear model can be generated / derived in different ways. For example, in some embodiments, the parameters of the linear model can be derived based on the correlation between the reference sample and the current reconstructed sample. In some embodiments, the samples used to derive the linear model in the upper i row and the left j row can be obtained by subsampling. In some embodiments, the number of samples used to derive the linear model is limited to a power of 2. In some embodiments, the samples used to derive the linear model are limited to the same CTU or the same CTU row as the current block. In some embodiments, if the number of samples used to derive the linear model is not greater than a predetermined threshold, template refinement will not be performed. The predetermined threshold (for example, if the current block size is 32x32, the threshold is 128; if the current block size is 64x128, the threshold is 1024) can be designed according to the current block size. In some embodiments, if the current block size is greater than the threshold, template refinement will not be performed.

[0081] F. Different Weighting Pairs

[0082] In some embodiments, the bilateral template block is generated based on a weighted sum of the L0 predictor (weighted by w0) and the L1 predictor (weighted by w1), as follows:

[0083] (w0*l0 predictor +w1*l1 predictor )>>N, N=log2(w0+w1)

[0084] or

[0085] (w0*l0 predictor +w1*l1 predictor +offset)>>N,

[0086] N=log2(w0+w1),offset=1<<(N-1)

[0087] In some embodiments, weights w0 and w1 are determined based on slice quantization parameter (QP) values ​​of L0 and L1 predictors. If sliceQP of L0 is less than sliceQP of L1, then w0 should be greater than w1; otherwise, w1 should be greater than w0.

[0088] In some embodiments, the formula for dual template block generation can be designed based on the picture order count (POC) distance between the L0 predictor (or L0 reference picture) and the current picture, and the POC distance between the L1 predictor (or L1 reference picture) and the current picture. A larger weight should be used for the direction or side with a smaller POC distance increment (difference). In some embodiments, the weight pair generated by the dual template block can be designed based on the BCW (bidirectional prediction with CU-level weight) index of the merge candidate to be refined.

[0089] In some embodiments, more than one condition is used to determine the weight pair of the dual template block of MP-DMVR. For example, if the POC increment of L0 is less than the POC increment of L1 and the sliceQP of L0 is less than the sliceQP of L1, w0 is set to 10 (or M) and w1 is set to -2. And if the POC increment of L0 is less than the POC increment of L1 or the sliceQP of L0 is less than the sliceQP of L1, w0 is set to 5 (or N) and w1 is set to 3 (M>N).

[0090] In some embodiments, the weighted pair generated by the dual template can be determined based on the template matching (TM) cost of L0 and L1. The adjacent M rows above the L0 / L1 reference block and the adjacent N rows to the left of the L0 / L1 reference block are used to calculate the TM cost of L0 / L1. The values ​​of M and N can be any integer greater than 0. The list with the smaller TM cost can have a larger weight.

[0091] In some embodiments, the weights may be determined based on luminous compensation (LIC) parameters of two lists (L0 and L1). Neighboring samples of the current block and / or the compensation block may be used to derive LIC parameters. In one embodiment, the above methods may be combined. The weights may be determined based on one or more of the above conditions.

[0092] In some embodiments, the sum of the weighted pairs is constrained to be a power of 2. With this constraint, the values ​​of the MP-DMVR dual template blocks can be obtained by a simple right shift. In some embodiments, the weighted pairs of the MP-DMVR dual template should be a subset of the BCW (bi-prediction with CU-level weights) weighted pairs.

[0093] Any of the above-mentioned methods can be implemented in an encoder and / or a decoder. For example, any of the above-mentioned methods can be implemented in a DMVR module of an encoder and / or a decoder. Alternatively, any of the above-mentioned methods can be implemented as a circuit coupled to a DMVR module of an encoder and / or a decoder.

[0094] V. Sample Video Encoder

[0095] Figure 8 An example video encoder 800 is shown that can use the DMVR mode to encode pixel blocks. As shown, the video encoder 800 receives an input video signal from a video source 805 and encodes the signal into a bitstream 895. The video encoder 800 has several components or modules for encoding the signal from the video source 805, including at least some components selected from the following: a transform module 810, a quantization module 811, an inverse quantization module 814, an inverse transform module 815, an intra-frame estimation module 820, an intra-frame prediction module 825, a motion compensation module 830, a motion estimation module 835, a loop filter 845, a reconstructed picture buffer 850, an MV buffer 865, an MV prediction module 875, and an entropy encoder 890. The motion compensation module 830 and the motion estimation module 835 are part of the inter-frame prediction module 840.

[0096] In some embodiments, modules 810-890 are software instruction modules executed by one or more processing units (e.g., processors) of a computing device or electronic device. In some embodiments, modules 810-890 are hardware circuit modules implemented by one or more integrated circuits (ICs) of an electronic device. Although modules 810-890 are shown as separate modules, some modules may be combined into a single module.

[0097] The video source 805 provides a raw video signal that presents the pixel data of each video frame without compression. The subtractor 808 calculates the difference between the raw video pixel data of the video source 805 and the predicted pixel data 813 from the motion compensation module 830 or the intra-frame prediction module 825. The transform module 810 converts the difference (or residual pixel data or residual signal) into transform coefficients (e.g., by performing a discrete cosine transform or DCT). The quantization module 811 quantizes the transform coefficients into quantized data (or quantized coefficients) 812, which are encoded into a bit stream 895 by the entropy encoder 890.

[0098] The inverse quantization module 814 dequantizes the quantized data (or quantized coefficients) 812 to obtain transform coefficients, and the inverse transform module 815 performs an inverse transform on the transform coefficients to generate a reconstructed residual 819. The reconstructed residual 819 is added to the predicted pixel data 813 to generate reconstructed pixel data 817. In some embodiments, the reconstructed pixel data 817 is temporarily stored in a line buffer (line buffer not shown) for intra-frame prediction and spatial MV prediction. The reconstructed pixels are filtered by a loop filter 848 and stored in a reconstructed picture buffer 550. In some embodiments, the reconstructed picture buffer 850 is a memory external to the video encoder 800. In some embodiments, the reconstructed picture buffer 850 is a memory internal to the video encoder 800.

[0099] The intra estimation module 820 performs intra prediction based on the reconstructed pixel data 817 to generate intra prediction data. The intra prediction data is provided to the entropy encoder 890 to be encoded into a bitstream 895. The intra prediction data is also used by the intra prediction module 825 to generate predicted pixel data 813.

[0100] The motion estimation module 835 performs inter-frame prediction by generating MVs to refer to pixel data of previously decoded frames stored in the reconstructed picture buffer 850. These MVs are provided to the motion compensation module 830 to generate predicted pixel data.

[0101] Instead of encoding the complete actual MV in the bitstream, the video encoder 800 uses MV prediction to generate a predicted MV, and the difference between the MV used for motion compensation and the predicted MV is encoded as residual motion data and stored in the bitstream 895.

[0102] The MV prediction module 875 generates a predicted MV based on a reference MV generated for encoding a previous video frame, i.e., a motion compensated MV for performing motion compensation. The MV prediction module 875 obtains the reference MV from the previous video frame from the MV buffer 865. The video encoder 800 stores the MV generated for the current video frame in the MV buffer 865 as a reference MV for generating a predicted MV.

[0103] The MV prediction module 875 uses the reference MV to create a predicted MV. The predicted MV can be calculated by spatial MV prediction or temporal MV prediction. The difference (residual motion data) between the predicted MV and the motion compensation MV (MC MV) of the current frame is encoded into the bit stream 895 by the entropy encoder 890.

[0104] The entropy encoder 890 encodes various parameters and data into a bitstream 895 by using an entropy coding technique such as context-adaptive binary arithmetic coding (CABAC) or Huffman coding. The entropy encoder 890 encodes various header elements, flags, along with quantized transform coefficients 812 and residual motion data as syntax elements into the bitstream 895. The bitstream 895 is then stored in a storage device or transmitted to a decoder via a communication medium such as a network.

[0105] The loop filter 845 performs filtering or smoothing operations on the reconstructed pixel data 817 to reduce encoding and decoding artifacts, particularly at the boundaries of pixel blocks. In some embodiments, the filtering operation performed includes sample adaptive offset (SAO). In some embodiments, the filtering operation includes an adaptive loop filter (ALF).

[0106] Fig. 9 8. The portion of a video encoder 800 implementing bilateral template MP-DMVR is shown. Specifically, the figure illustrates components of a motion compensation module 830 of the video encoder 800. As shown, the motion compensation module 830 receives a motion compensated MV (MC MV) provided by a motion estimation module 835.

[0107] The MP-DMVR module 910 performs the MP-DMVR process by using the MC MV as the initial or original MV in the L0 and / or L1 direction. The MP-DMVR module 910 refines the initial MV into a final refined MV in one or more passes of refinement. The acquisition controller 920 then uses the final refined MV to generate the predicted pixel data 813 based on the contents of the reconstructed picture buffer 850.

[0108] The MP-DMVR module 910 obtains the contents of the reconstructed picture buffer 850. The contents obtained from the reconstructed picture buffer 850 include the currently refined MV (which may be the initial MV, or any subsequent update). The obtained contents may also include the extended region of the current block and the initial predictor. The MP-DMVR module 910 may use the obtained contents to calculate the bilateral template 915 and one or more linear models 925.

[0109] The MP-DMVR module 910 may use the acquired predictor and the calculated bilateral template to calculate the cost for refining the motion vector, as described in Sections I-IV above. The MP-DMVR may also use the acquired predictor to perform bilateral matching (BM) in some refinement passes. The MP-DMVR module 910 may also use the extended region to calculate a linear model 925, and then use the calculated linear model to refine the bilateral template 915 or predictor, as described in Section IV-E above, for example.

[0110] The DMVR control module 930 may decide in which mode the MP-DMVR module 910 should operate and provide such mode information to the entropy encoder 890 to be encoded as syntax elements (e.g., bm_merge_flag, bm_bi_template_flag, bm_dir_flag, bm_mode_index) in the slice or picture or sequence level of the bitstream 895.

[0111] Fig.10 A process 1000 for using a bilateral template with MP-DMVR is conceptually illustrated. In some embodiments, one or more processing units (e.g., processors) of a computing device implementing encoder 800 perform process 1000 by executing instructions stored in a computer-readable medium. In some embodiments, an electronic device implementing encoder 800 performs process 1000.

[0112] The encoder receives (at block 1010) data for a block of pixels to be encoded as a current block in a current picture of a video. The current block is associated with a first motion vector and a second motion vector, the first motion vector references a first initial predictor in a first reference picture, and the second motion vector references a second initial predictor in a second reference picture. The first and second motion vectors may be bi-directional prediction merge candidates. When the first motion vector is a uni-directional prediction candidate, the second motion vector may be generated by mirroring the first motion vector in the opposite direction.

[0113] In some embodiments, the video encoder further sends a first syntax element (e.g., bm_bi_template_flag) indicating whether to refine the first or second motion vector by using a bilateral template generated based on the first and second initial predictors or by performing bilateral matching based on the first or second initial predictor. In some embodiments, the video encoder sends a second syntax element (e.g., bm_dir_flag, bm_index) indicating whether to refine the first motion vector or the second motion vector.

[0114] The encoder generates (at block 1020) a bilateral template based on the first initial predictor and the second initial predictor. The encoder may derive the bilateral template as a weighted sum of the first initial predictor and the second initial predictor. In some embodiments, the weights applied to the first and second initial predictors, respectively, are determined based on the fragment quantization parameter values ​​of the first and second initial predictors. In some embodiments, the weights applied to the first and second initial predictors, respectively, are determined based on the picture order count (POC) distance of the first and second reference pictures to the current picture. In some embodiments, the weights applied to the first and second initial predictors, respectively, are determined based on a bi-prediction with CU-level weights (BCW) index sent for the current block.

[0115] In some embodiments, the video encoder refines the bilateral template using a linear model generated based on the first initial predictor, the second initial predictor, and an extended region of the current block (e.g., regions above and to the left of the L-shape). In some embodiments, the video encoder refines the first and second initial predictors based on a linear model generated based on the first initial predictor, the second initial predictor, and an extended region of the current block, and then generates the bilateral template based on the refined first and second initial predictors. The derivation and use of the linear model of DMVR is described, for example, in Section IV-E above.

[0116] The encoder refines (at block 1030) the first motion vector to minimize a first cost between the bilateral template and the predictor referenced by the refined first motion vector. The encoder refines (at block 1040) the second motion vector to minimize a second cost between the bilateral template and the predictor referenced by the refined second motion vector.

[0117] In some embodiments, the video encoder performs the operations at blocks 1030 and 1040 to refine the first and second motion vectors (also referred to as a first refinement pass). The video encoder may further refine the first and second motion vectors of each of the multiple sub-blocks of the current block in a second refinement pass. The video encoder may further refine the first and second motion vectors by applying bidirectional optical flow (BDOF) in a third refinement pass. In some embodiments, in the second refinement pass, the first and second motion vectors are refined by minimizing the cost between the predictor referenced by the refined first motion vector and the predictor referenced by the refined second motion vector (i.e., bilateral matching). In some embodiments, when the bilateral template is used to refine the first and second motion vectors, the second and third refinement passes are disabled.

[0118] The encoder encodes (at block 1050) the current block by using the refined first and second motion vectors to generate a prediction residual and reconstruct the current block.

[0119] VI. Sample Video Decoder

[0120] In some embodiments, the encoder may send (or generate) one or more syntax elements in a bitstream so that the decoder may parse the one or more syntax elements from the bitstream.

[0121] Fig.11 An example video decoder 800 is shown in which the DMVR mode may be used. As shown, the video decoder 800 is an image decoding or video decoding circuit that receives a bitstream 1195 and decodes the contents of the bitstream into pixel data of a video frame for display. The video decoder 1100 has several components or modules for decoding the bitstream 1195, including some components selected from the following: an inverse quantization module 1111, an inverse transform module 1110, an intra-frame prediction module 1125, a motion compensation module 1130, a loop filter 1145, a decoded picture buffer 1150, an MV buffer 1165, an MV prediction module 1175, and a parser 1190. The motion compensation module 1130 is part of the inter-frame prediction module 1140.

[0122] In some embodiments, modules 1110-1190 are software instruction modules executed by one or more processing units (e.g., processors) of a computing device. In some embodiments, modules 1110-1190 are hardware circuit modules implemented by one or more ICs of an electronic device. Although modules 1110-1190 are shown as separate modules, some modules may be combined into a single module.

[0123] The parser 1190 (or entropy decoder) receives the bitstream 1195 and performs initial parsing according to the syntax defined by the video coding or image coding standard. The parsed syntax elements include various header elements, flags, and quantization data (or quantization coefficients) 1112. The parser 1190 parses out various syntax elements by using entropy coding techniques (e.g., context-adaptive binary arithmetic coding (ABAC) or Huffman encoding).

[0124] The inverse quantization module 1111 dequantizes the quantized data (or quantized coefficients) 1112 to obtain transform coefficients, and the inverse transform module 1110 inversely transforms the transform coefficients 1116 to generate a reconstructed residual signal 1119. The reconstructed residual signal 1119 is added to the predicted pixel data 1113 from the intra prediction module 1125 or the motion compensation module 1130 to generate decoded pixel data 1117. The decoded pixel data is filtered by the loop filter 1145 and stored in the decoded picture buffer 1150. In some embodiments, the decoded picture buffer 1150 is a memory external to the video decoder 1100. In some embodiments, the decoded picture buffer 1150 is a memory internal to the video decoder 1100.

[0125] The intra prediction module 1125 receives intra prediction data from the bitstream 1195 and, based thereon, generates predicted pixel data 1113 from decoded pixel data 1117 stored in the decoded picture buffer 1150. In some embodiments, the decoded pixel data 1117 is also stored in a line buffer (not shown) for intra prediction and spatial MV prediction.

[0126] In some embodiments, the contents of the decoded picture buffer 1150 are used for display. The display device 1155 either obtains the contents of the decoded picture buffer 1150 for direct display or obtains the contents of the decoded picture buffer to a display buffer. In some embodiments, the display device receives pixel values ​​from the decoded picture buffer 1150 via pixel transfer.

[0127] The motion compensation module 1130 generates predicted pixel data 1113 from decoded pixel data 1117 stored in the decoded picture buffer 1150 according to motion compensated MV (MC MV). These motion compensated MVs are decoded by adding residual motion data received from the bitstream 1195 to the predicted MV received from the MV prediction module 1175.

[0128] The MV prediction module 1175 generates a predicted MV based on a reference MV generated for decoding a previous video frame (e.g., a motion compensated MV for performing motion compensation). The MV prediction module 1175 obtains the reference MV of the previous video frame from the MV buffer 1165. The video decoder 1100 stores the motion compensated MV generated for decoding the current video frame in the MV buffer 1165 as a reference MV for generating a predicted MV.

[0129] The loop filter 1145 performs filtering or smoothing operations on the decoded pixel data 1117 to reduce encoding and decoding artifacts, particularly at the boundaries of pixel blocks. In some embodiments, the filtering operation performed includes sample adaptive offset (SAO). In some embodiments, the filtering operation includes an adaptive loop filter (ALF).

[0130] Fig.12 1 shows a portion of a video decoder 1100 implementing bilateral template MP-DMVR. Specifically, the figure shows components of a motion compensation module 1130 of the video decoder 1100. As shown, the motion compensation module 1130 receives a motion compensated MV (MC MV) from an entropy decoder 1190 or an MV buffer 1165.

[0131] The MP-DMVR module 1210 performs the MP-DMVR process by using the MC MV as the initial or original MV in the L0 and / or L1 direction. The MP-DMVR module 1210 refines the initial MV into a final refined MV in one or more passes of refinement. The acquisition controller 1220 then uses the final refined MV to generate the predicted pixel data 1113 based on the contents of the decoded picture buffer 1150.

[0132] The MP-DMVR module 1210 obtains the contents of the decoded picture buffer 1150. The contents obtained from the decoded picture buffer 1150 include the currently refined MV (which may be the initial MV, or any subsequent update). The obtained contents may also include the extended region of the current block and the initial predictor. The MP-DMVR module 1210 may use the obtained contents to calculate the bilateral template 1215 and one or more linear models 1225.

[0133] The MP-DMVR module 1210 may use the acquired predictor and the calculated bilateral template to calculate the cost for refining the motion vector, as described in Sections I-IV above. The MP-DMVR may also use the acquired predictor to perform bilateral matching (BM) in some refinement passes. The MP-DMVR module 1210 may also use the extended region to calculate a linear model 1225, and then use the calculated linear model to refine the bilateral template 1215 or the predictor, as described in Section IV-E above, for example.

[0134] The DMVR control module 1230 may decide which mode the MP-DMVR module 1210 should operate in. The DMVR control module 1230 may decide the mode based on information provided by the entropy decoder 1190, which may parse the bitstream 1195 in the slice or picture or sequence level to obtain relevant syntax elements (e.g., bm_merge_flag, bm_bi_template_flag, bm_dir_flag, bm_mode_index.)

[0135] Fig.13 A process 1300 for using a bilateral template with MP-DMVR is conceptually illustrated. In some embodiments, one or more processing units (e.g., processors) of a computing device implementing decoder 1100 perform process 1300 by executing instructions stored in a computer-readable medium. In some embodiments, an electronic device implementing decoder 1100 performs process 1300.

[0136] The decoder receives (at block 1310) data to be decoded as a current block of pixels in a current picture of a video. The current block is associated with a first motion vector and a second motion vector, the first motion vector references a first initial predictor in a first reference picture, and the second motion vector references a second initial predictor in a second reference picture. The first and second motion vectors may be bi-directional prediction merge candidates. When the first motion vector is a uni-directional prediction candidate, the second motion vector may be generated by mirroring the first motion vector in the opposite direction.

[0137] In some embodiments, the video decoder further receives a first syntax element (e.g., bm_bi_template_flag) indicating whether to refine the first or second motion vector by using a bilateral template generated based on the first and second initial predictors or by performing bilateral matching based on the first or second initial predictors. In some embodiments, the video decoder receives a second syntax element (e.g., bm_dir_flag, bm_index) indicating whether to refine the first motion vector or the second motion vector.

[0138] The decoder generates (at block 1320) a bilateral template based on the first initial predictor and the second initial predictor. The decoder may derive the bilateral template as a weighted sum of the first initial predictor and the second initial predictor. In some embodiments, the weights applied to the first and second initial predictors, respectively, are determined based on the fragment quantization parameter values ​​of the first and second initial predictors. In some embodiments, the weights applied to the first and second initial predictors, respectively, are determined based on the picture order count (POC) distances of the first and second reference pictures to the current picture. In some embodiments, the weights applied to the first and second initial predictors, respectively, are determined based on a bi-prediction with CU-level weights (BCW) index sent for the current block.

[0139] In some embodiments, the video decoder refines the bilateral template using a linear model generated based on the first initial predictor, the second initial predictor, and an extended region of the current block (e.g., regions above and to the left of the L-shape). In some embodiments, the video decoder refines the first and second initial predictors based on a linear model generated based on the first initial predictor, the second initial predictor, and an extended region of the current block, and then generates the bilateral template based on the refined first and second initial predictors. The derivation and use of the linear model of DMVR is described, for example, in Section IV-E above.

[0140] The decoder refines (at block 1330) the first motion vector to minimize a first cost between the bilateral template and the predictor referenced by the refined first motion vector. The decoder refines (at block 1340) the second motion vector to minimize a second cost between the bilateral template and the predictor referenced by the refined second motion vector.

[0141] In some embodiments, the video decoder performs the operations at blocks 1330 and 1340 to refine the first and second motion vectors (also referred to as a first refinement pass). The video decoder may further refine the first and second motion vectors of each of the multiple sub-blocks of the current block in a second refinement pass. The video decoder may further refine the first and second motion vectors by applying bidirectional optical flow (BDOF) in a third refinement pass. In some embodiments, in the second refinement pass, the first and second motion vectors are refined by minimizing the cost between the predictor referenced by the refined first motion vector and the predictor referenced by the refined second motion vector (i.e., bilateral matching). In some embodiments, when the bilateral template is used to refine the first and second motion vectors, the second and third refinement passes are disabled.

[0142] The decoder decodes (at block 1350) the current block by using the refined first and second motion vectors to generate a prediction residual and reconstructing the current block. The decoder may then provide the reconstructed current block for display as part of a reconstructed current picture.

[0143] VII. Example Electronic System

[0144] Many of the above features and applications are implemented as software processes, which are specified as a set of instructions recorded on a computer-readable storage medium (also referred to as a computer-readable medium). When these instructions are executed by one or more computing or processing units (e.g., one or more processors, processor cores, or other processing units), they cause the processing units to perform the actions indicated in the instructions. Examples of computer-readable media include, but are not limited to, compact disc read-only memory (CD-ROM), flash drives, random access memory (RAM) chips, hard drives, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc. Computer-readable media do not include carrier waves and electronic signals transmitted by wireless or wired connections.

[0145] In this specification, the term "software" is intended to include firmware residing in read-only memory or application programs stored in magnetic memory, which can be read into memory for processing by a processor. In addition, in some embodiments, multiple software inventions can be implemented as sub-parts of a larger program while retaining different software inventions. In some embodiments, multiple software inventions can also be implemented as separate programs. Finally, any combination of separate programs that jointly implement the software inventions described herein are within the scope of this disclosure. In some embodiments, the software program, when installed to run on one or more electronic systems, defines one or more specific machine implementations that process and execute the operations of the software program.

[0146] Fig.14An electronic system 1400 is conceptually shown for implementing some embodiments of the present disclosure. The electronic system 1400 may be a computer (e.g., a desktop computer, a personal computer, a tablet computer, etc.), a phone, a PDA, or any other type of electronic device. Such an electronic system includes various types of computer-readable media and interfaces for various other types of computer-readable media. The electronic system 1400 includes a bus 1405, a processing unit 1410, a graphics processing unit (GPU) 1415, a system memory 1420, a network 1425, a read-only memory 1430, a permanent storage device 1435, an input device 1440, and an output device 1445.

[0147] Bus 1405 collectively represents all system, peripheral, and chipset buses that communicatively couple numerous internal devices of electronic system 1400. For example, bus 1405 communicatively couples processing unit 1410 with GPU 1415, read-only memory 1430, system memory 1420, and permanent storage device 1435.

[0148] The processing unit 1410 obtains instructions to be executed and data to be processed from these various memory units in order to perform the processing of the present disclosure. In different embodiments, the processing unit can be a single processor or a multi-core processor. Some instructions are passed to and executed by the GPU 1415. The GPU 1415 can offload various calculations or supplement the image processing provided by the processing unit 1410.

[0149] Read-only-memory (ROM) 1430 stores static data and instructions used by processing unit 1410 and other modules of the electronic system. On the other hand, permanent storage device 1435 is a read-write storage device. This device is a non-volatile storage unit that stores instructions and data even when electronic system 1400 is turned off. Some embodiments of the present disclosure use a large-capacity memory device (such as a magnetic disk or optical disk and its corresponding magnetic disk drive) as permanent storage device 1435.

[0150] Other embodiments use removable storage devices (e.g., floppy disks, flash memory devices, etc., and their corresponding disk drives) as permanent storage devices. Like the permanent storage device 1435, the system memory 1420 is a read-write memory device. However, unlike the permanent storage device 1435, the system memory 1420 is a volatile read-write memory, such as a random access memory. The system memory 1420 stores some instructions and data used by the processor at runtime. In some embodiments, the processing according to the present disclosure is stored in the system memory 1420, the permanent storage device 1435 and / or the read-only memory 1430. For example, according to some embodiments of the present disclosure, various memory units include instructions for processing multimedia clips. From these various memory units, the processing unit 1410 obtains instructions to be executed and data to be processed in order to perform the processing of some embodiments.

[0151] The bus 1405 is also connected to an input device 1440 and an output device 1445. The input device 1440 enables a user to convey information and select commands to the electronic system. The input device 1440 includes an alphanumeric keyboard and a pointing device (also referred to as a "cursor control device"), a camera (e.g., a webcam), a microphone, or a similar device for receiving voice commands, etc. The output device 1445 displays images generated by the electronic system or outputs data. The output device 1445 includes a printer and a display device, such as a cathode ray tube (CRT) or a liquid crystal display (LCD), and a speaker or similar audio output device. Some embodiments include devices used as input and output devices, such as a touch screen.

[0152] Finally, if Fig.14 As shown, bus 1405 also couples electronic system 1400 to a network 1425 via a network adapter (not shown). In this manner, the computer may be part of a computer network, such as a local area network ("LAN"), a wide area network ("WAN"), or an intranet, or a network of multiple networks, such as the Internet. Any or all components of electronic system 1400 may be used in conjunction with the present disclosure.

[0153] Some embodiments include electronic components, such as microprocessors, storage devices, and memory, which store computer program instructions in machine-readable or computer-readable media (or otherwise referred to as computer-readable storage media, machine-readable media, or machine-readable storage media). Some examples of such computer-readable media include RAM, ROM, read-only compact discs (CD-ROM), recordable compact discs (CD-R), rewritable compact discs (CD-RW), read-only digital versatile discs (e.g., DVD-ROM, dual-layer DVD-ROM), various recordable / rewritable DVDs (e.g., DVD-RAM, DVD-RW, DVD+RW, etc.), flash memory (e.g., SD card, mini SD card, micro SD card, etc.), magnetic and / or solid-state hard drives, read-only and recordable A computer program or computer code may be a computer program that is executable by at least one processing unit and includes a set of instructions for performing various operations. Examples of computer programs or computer codes include machine code such as produced by a compiler, and files including high-level code that is executed by a computer, an electronic component, or a microprocessor using an interpreter.

[0154] Although the above discussion mainly involves microprocessors or multi-core processors executing software, many of the above features and applications are performed by one or more integrated circuits, such as application specific integrated circuits (ASICs) or field programmable gate arrays (FPGAs). In some embodiments, such integrated circuits execute instructions stored on the circuits themselves. In addition, some embodiments execute software stored in programmable logic devices (PLDs), ROM, or RAM devices.

[0155] As used in this specification and any claims of this application, the terms "computer," "server," "processor," and "memory" refer to electronic or other technical devices. These terms do not include people or groups of people. For the purposes of this specification, the terms display or display refer to displaying on an electronic device. As used in this specification and any claims of this application, the terms "computer-readable medium," "computer-readable medium," and "machine-readable medium" are entirely limited to tangible physical objects that store information in a computer-readable form. These terms do not include any wireless signals, wired download signals, and any other transient signals.

[0156] Although the present disclosure has been described with reference to many specific details, those skilled in the art will recognize that the present disclosure may be implemented in other specific forms without departing from the spirit of the present disclosure. Fig.10 and Fig.13 ) conceptually illustrates the processes. The specific operations of these processes may not be performed in the exact order shown and described. The specific operations may not be performed in a continuous series of operations, and different specific operations may be performed in different embodiments. In addition, the process may be implemented using several sub-processes or as part of a larger macro process. Therefore, those skilled in the art will understand that the present disclosure is not limited by the foregoing illustrative details, but is defined by the appended claims.

[0157] Additional Notes

[0158] The subject matter described herein sometimes represents different components, which are contained in or connected to other different components. It is understood that the described structure is only an example, and in fact, it can be implemented by many other structures to achieve the same function. Conceptually, the arrangement of any components that achieve the same function is actually "associated" to achieve the desired function. Therefore, regardless of the structure or intermediate components, any two components combined to achieve a specific function are considered to be "interrelated" to achieve the desired function. Similarly, any two associated components are considered to be "operably connected" or "operably coupled" to achieve a specific function. Any two components that can be associated with each other are also considered to be "operably coupled" to achieve a specific function. Any two components that can be associated with each other are also considered to be "operably coupled" to achieve a specific function. Specific examples of operable connections include, but are not limited to, physically pairable and / or physically interacting components, and / or wirelessly interactive and / or wirelessly interactive components, and / or logically interactive and / or logically interactive components.

[0159] Furthermore, with respect to the use of substantially any plural and / or singular terms, those skilled in the art can translate from the plural to the singular and / or from the singular to the plural as appropriate to the context and / or application. For sake of clarity, the present invention expressly sets forth various singular / plural arrangements.

[0160] In addition, it will be understood by those skilled in the art that, in general, the terms used in the present invention, especially in the claims, and the subject matter of the claims, are generally used as "open" terms, for example, "including" should be interpreted as "including but not limited to", "having" should be interpreted as "at least having", "including" should be interpreted as "including but not limited to", etc. It will be further understood by those skilled in the art that if a specific number of claim contents are intended to be introduced, it will be clearly indicated in the claim, and will not be displayed in the absence of such contents. For example, to aid understanding, the following claims may contain the phrases "at least one" and "one or more" to introduce the contents of the claims. However, the use of these phrases should not be understood to imply the use of the indefinite article "a" or "an" to introduce the claim contents and restrict any specific patent scope. Even when the same claim includes the introductory phrases "one or more" or "at least one", the indefinite article, such as "a" or "an", should be interpreted to mean at least one or more, and the same is true for the use of the explicit description used to introduce the claim. Furthermore, even if an introductory content explicitly refers to a specific number, a person skilled in the art will recognize that such content should be interpreted as indicating the referenced number, for example, "two references" without other modifications means at least two references, or two or more references. Furthermore, where a statement similar to "at least one of A, B, and C" is used, it is generally stated so that a person skilled in the art can understand the statement, for example, "a system includes at least one of A, B, and C" will include but is not limited to a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B, and C, etc. A person skilled in the art will further understand that any separated words and / or phrases represented by two or more alternative terms, whether in the specification, claims, or drawings, should be understood to include the possibility of one of these terms, one of them, or both of these terms. For example, "A or B" should be understood as the possibility of "A", or "B", or "A and B".

[0161] As can be seen from the foregoing, various embodiments have been described for illustrative purposes, and various modifications may be made without departing from the scope and spirit of the invention. Therefore, the various embodiments disclosed herein are not intended to be limiting, and the true scope and application are indicated by the claims.

Claims

1. A video encoding and decoding method, include: Receiving data of a pixel block to be encoded or decoded as a current block of a current picture of a video, the current block being associated with a first motion vector and a second motion vector, the first motion vector referencing a first initial predictor in a first reference picture, and the second motion vector referencing a second initial predictor in a second reference picture; generating a bilateral template based on the first initial predictor and the second initial predictor; Refining the first motion vector to minimize a first cost between the bilateral template and a predictor referenced by the refined first motion vector; Refining the second motion vector to minimize a second cost between the bilateral template and a predictor referenced by the refined second motion vector; as well as The current block is encoded or decoded by using the refined first motion vector and the refined second motion vector to reconstruct the current block.

2. The video encoding and decoding method according to claim 1, It is characterized in that The first motion vector and the second motion vector are refined in a first refinement pass, and the method further includes refining the first motion vector and the second motion vector for each of a plurality of sub-blocks of the current block in a second refinement pass.

3. The video encoding and decoding method according to claim 2, It is characterized in that Further including refining the first motion vector and the second motion vector by applying bidirectional optical flow in a third refinement pass.

4. The video encoding and decoding method according to claim 2, It is characterized in that In a second refinement pass, the first motion vector and the second motion vector are refined by minimizing a cost between a predictor referenced by the refined first motion vector and a predictor referenced by the refined second motion vector.

5. The video encoding and decoding method according to claim 1, It is characterized in that The two-sided template is derived based on a weighted sum of the first initial predictor and the second initial predictor.

6. The video encoding and decoding method according to claim 5, It is characterized in that A plurality of weights applied to the first predictor and the second initial predictor, respectively, are determined based on a plurality of fragment quantization parameter values ​​of the first initial predictor and the second initial predictor.

7. The video encoding and decoding method according to claim 5, It is characterized in that The plurality of weights applied to the first initial predictor and the second initial predictor, respectively, are determined based on a plurality of picture order count distances of the first reference picture and the second reference picture from the current picture.

8. The video encoding and decoding method according to claim 5, It is characterized in that The plurality of weights applied to the first initial predictor and the second initial predictor, respectively, are determined according to a bidirectional prediction with a codec-unit level weight index for the current block.

9. The video encoding and decoding method according to claim 1, It is characterized in that Further comprising receiving or sending one or more syntax elements indicating (i) whether to refine the first motion vector or the second motion vector by using the generated bilateral template or by performing bilateral matching based on the first initial predictor and the second initial predictor, and (ii) whether to refine the first motion vector or refine the second motion vector.

10. The video encoding and decoding method according to claim 1, It is characterized in that Further comprising refining the bilateral template by using a linear model generated based on the first initial predictor, the second initial predictor, and a plurality of extended regions of the current block.

11. The video encoding and decoding method according to claim 1, It is characterized in that Further comprising refining the first initial predictor and the second initial predictor based on a linear model, the linear model being generated based on the first initial predictor, the second initial predictor and a plurality of extended regions of the current block, wherein the bilateral template is generated based on the refined first initial predictor and the refined second initial predictor.

12. The video encoding and decoding method according to claim 1, It is characterized in that The second motion vector is generated by mirroring the first motion vector in an opposite direction, the first motion vector being a uni-directional prediction candidate.

13. An electronic device, include: The video codec circuit is configured to perform a plurality of operations including: Receiving data of a pixel block to be encoded or decoded as a current block of a current picture of a video, the current block being associated with a first motion vector and a second motion vector, the first motion vector referencing a first initial predictor in a first reference picture, and the second motion vector referencing a second initial predictor in a second reference picture; generating a bilateral template based on the first initial predictor and the second initial predictor; Refining the first motion vector to minimize a first cost between the bilateral template and a predictor referenced by the refined first motion vector; Refining the second motion vector to minimize a second cost between the bilateral template and a predictor referenced by the refined second motion vector; and The current block is encoded or decoded by using the refined first motion vector and the refined second motion vector to reconstruct the current block.

14. A video decoding method, include: Receiving data of a block of pixels to be decoded as a current block of a current picture of a video, the current block being associated with a first motion vector and a second motion vector, the first motion vector referencing a first initial predictor in a first reference picture, and the second motion vector referencing a second initial predictor in a second reference picture; generating a bilateral template based on the first initial predictor and the second initial predictor; Refining the first motion vector to minimize a first cost between the bilateral template and a predictor referenced by the refined first motion vector; Refining the second motion vector to minimize a second cost between the bilateral template and a predictor referenced by the refined second motion vector; as well as The current block is decoded by using the refined first motion vector and the refined second motion vector to reconstruct the current block.

15. A video encoding method, include: Receiving data of a block of pixels to be encoded as a current block of a current picture of a video, the current block being associated with a first motion vector and a second motion vector, the first motion vector referencing a first initial predictor in a first reference picture, and the second motion vector referencing a second initial predictor in a second reference picture; generating a bilateral template based on the first initial predictor and the second initial predictor; Refining the first motion vector to minimize a first cost between the bilateral template and a predictor referenced by the refined first motion vector; Refining the second motion vector to minimize a second cost between the bilateral template and a predictor referenced by the refined second motion vector; as well as The current block is encoded by using the refined first motion vector and the refined second motion vector to reconstruct the current block.