Methods and Apparatus of Affine Motion Compensation for Block Boundaries and Motion Refinement in Video Coding

Affine motion compensation techniques enhance video coding efficiency by refining motion vectors with optical flow and block-based affine models, addressing complex motions and reducing computational overhead.

US20260380031A1Pending Publication Date: 2026-11-26MEDIATEK INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
US19/146082
Authority / Receiving Office
US · United States
Patent Type
Applications(United States)
Current Assignee / Owner
Priority Date
2023-10-13
Filing Date
2023-12-19
Publication Date
2026-11-26

AI Technical Summary

Technical Problem

Existing video coding systems face challenges in efficiently handling complex motions such as zoom, rotation, and perspective motions due to the limitations of translation motion models, leading to suboptimal coding performance and increased computational complexity.

Method used

Implementing affine motion compensation techniques, including block-based affine transform prediction, affine merge and AMVP modes, and prediction refinement with optical flow (PROF) to enhance motion compensation accuracy and reduce computational overhead.

Benefits of technology

Improves coding efficiency and accuracy by refining motion vectors using bi-directional optical flow and affine models, reducing memory access bandwidth and computation complexity while maintaining high prediction quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure US20260380031A1-D00000_ABST
    Figure US20260380031A1-D00000_ABST
Patent Text Reader

Abstract

Method and apparatus for video coding using affine motion compensation. According to one method, for a current block coded using an affine model, a first MV is determined based on a BDOF process. A second MV based on is determined a PROF process. The current block is encoded or decoded by using information comprising the first MV and the second MV. According to another method, OBMC on / off condition of the current block, affine motion model of the current block, or both are determined. Affine MC block size for the current block is determined according to the OBMC on / off condition of the current block, the affine motion model of the current block, or both, or whether to allow sample-based or subblock-based affine MC is determined according to the OBMC on / off condition of the current block.
Need to check novelty before this filing date? Find Prior Art

Description

CROSS REFERENCE TO RELATED APPLICATIONS

[0001] The present invention is a non-Provisional application of and claims priority to U.S. Provisional Patent Application No. 63 / 479,754, filed on Jan. 13, 2023, U.S. Provisional Patent Application No. 63 / 480,333, filed on Jan. 18, 2023, U.S. Provisional Patent Application No. 63 / 512,308, filed on Jul. 7, 2023 and U.S. Provisional Patent Application No. 63 / 590,006, filed on Oct. 13, 2023. The U.S. Provisional Patent applications are hereby incorporated by reference in their entireties.FIELD OF THE INVENTION

[0002] The present invention relates to video coding system. In particular, the present invention relates to affine motion compensation techniques to improve the coding performance of video coding systems.BACKGROUND

[0003] Versatile video coding (VVC) is the latest international video coding standard developed by the Joint Video Experts Team (JVET) of the ITU-T Video Coding Experts Group (VCEG) and the ISO / IEC Moving Picture Experts Group (MPEG). The standard has been published as an ISO standard: ISO / IEC 23090-3:2021, Information technology—Coded representation of immersive media—Part 3: Versatile video coding, published February 2021. VVC is developed based on its predecessor HEVC (High Efficiency Video Coding) by adding more coding tools to improve coding efficiency and also to handle various types of video sources including 3-dimensional (3D) video signals.

[0004] FIG. 1A illustrates an exemplary adaptive Inter / Intra video encoding system incorporating loop processing. For Intra Prediction 110, the prediction data is derived based on previously coded video data in the current picture. For Inter Prediction 112, Motion Estimation (ME) is performed at the encoder side and Motion Compensation (MC) is performed based on the result of ME to provide prediction data derived from other picture(s) and motion data. Switch 114 selects Intra Prediction 110 or Inter-Prediction 112 and the selected prediction data is supplied to Adder 116 to form prediction errors, also called residues. The prediction error is then processed by Transform (T) 118 followed by Quantization (Q) 120. The transformed and quantized residues are then coded by Entropy Encoder 122 to be included in a video bitstream corresponding to the compressed video data. The bitstream associated with the transform coefficients is then packed with side information such as motion and coding modes associated with Intra prediction and Inter prediction, and other information such as parameters associated with loop filters applied to underlying image area. The side information associated with Intra Prediction 110, Inter prediction 112 and in-loop filter 130, are provided to Entropy Encoder 122 as shown in FIG. 1A. When an Inter-prediction mode is used, a reference picture or pictures have to be reconstructed at the encoder end as well. Consequently, the transformed and quantized residues are processed by Inverse Quantization (IQ) 124 and Inverse Transformation (IT) 126 to recover the residues. The residues are then added back to prediction data 136 at Reconstruction (REC) 128 to reconstruct video data. The reconstructed video data may be stored in Reference Picture Buffer 134 and used for prediction of other frames.

[0005] As shown in FIG. 1A, incoming video data undergoes a series of processing in the encoding system. The reconstructed video data from REC 128 may be subject to various impairments due to a series of processing. Accordingly, in-loop filter 130 is often applied to the reconstructed video data before the reconstructed video data are stored in the Reference Picture Buffer 134 in order to improve video quality. For example, deblocking filter (DF), Sample Adaptive Offset (SAO) and Adaptive Loop Filter (ALF) may be used. The loop filter information may need to be incorporated in the bitstream so that a decoder can properly recover the required information. Therefore, loop filter information is also provided to Entropy Encoder 122 for incorporation into the bitstream. In FIG. 1A, Loop filter 130 is applied to the reconstructed video before the reconstructed samples are stored in the reference picture buffer 134. The system in FIG. 1A is intended to illustrate an exemplary structure of a typical video encoder. It may correspond to the High Efficiency Video Coding (HEVC) system, VP8, VP9, H.264 or VVC.

[0006] The decoder, as shown in FIG. 1B, can use similar or portion of the same functional blocks as the encoder except for Transform 118 and Quantization 120 since the decoder only needs Inverse Quantization 124 and Inverse Transform 126. Instead of Entropy Encoder 122, the decoder uses an Entropy Decoder 140 to decode the video bitstream into quantized transform coefficients and needed coding information (e.g. ILPF information, Intra prediction information and Inter prediction information). The Intra prediction 150 at the decoder side does not need to perform the mode search. Instead, the decoder only needs to generate Intra prediction according to Intra prediction information received from the Entropy Decoder 140. Furthermore, for Inter prediction, the decoder only needs to perform motion compensation (MC 152) according to Inter prediction information received from the Entropy Decoder 140 without the need for motion estimation.Affine Motion Compensated Prediction

[0007] In HEVC, only translation motion model is applied for motion compensation prediction (MCP). While in the real world, there are many kinds of motion, e.g. zoom in / out, rotation, perspective motions and the other irregular motions. In VVC, a block-based affine transform motion compensation prediction is applied. As shown FIGS. 2A-B, the affine motion field of the block 210 is described by motion information of two control point (4-parameter) in FIG. 2A or three control point motion vectors (6-parameter) in FIG. 2B.

[0008] For 4-parameter affine motion model, motion vector at sample location (x, y) in a block is derived as:{mv x=mv 1⁢x-mv 0⁢xW⁢x+mv 1⁢y-mv 0⁢yW⁢y+mv 0⁢xmv y=mv 1⁢y-mv 0⁢yW⁢x+mv 1⁢y-mv o⁢xW⁢y+mv 0⁢y(1)

[0009] For 6-parameter affine motion model, motion vector at sample location (x, y) in a block is derived as:{mv x=mv 1⁢x-mv 0⁢xW⁢x+mv 2⁢x-mv 0⁢xH⁢y+mv 0⁢xmv y=mv 1⁢y-mv 0⁢yW⁢x+m⁢v2⁢y-mv 0⁢yH⁢y+mv 0⁢y(2)

[0010] Where (mv0x, mv0y) is motion vector of the top-left corner control point, (mv1x, mv1y) is motion vector of the top-right corner control point, and (mv2x, mv2y) is motion vector of the bottom-left corner control point.

[0011] In order to simplify the motion compensation prediction, block based affine transform prediction is applied. To derive motion vector of each 4×4 luma subblock, the motion vector of the centre sample of each subblock, as shown in FIG. 3, is calculated according to above equations, and rounded to 1 / 16 fraction accuracy. Then, the motion compensation interpolation filters are applied to generate the prediction of each subblock with the derived motion vector. The subblock size of chroma-components is also set to be 4×4. The MV of a 4×4 chroma subblock is calculated as the average of the MVs of the top-left and bottom-right luma subblocks in the collocated 8×8 luma region.

[0012] As is for translational-motion inter prediction, there are also two affine motion inter prediction modes: affine merge mode and affine AMVP mode.Affine Merge Prediction

[0013] AF_MERGE mode can be applied for CUs with both width and height larger than or equal to 8. In this mode, the CPMVs (Control Point MVs) of the current CU is generated based on the motion information of the spatial neighbouring CUs. There can be up to five CPMVP (CPMV Prediction) candidates and an index is signalled to indicate the one to be used for the current CU. The following three types of CPVM candidate are used to form the affine merge candidate list:

[0014] Inherited affine merge candidates that are extrapolated from the CPMVs of the neighbour CUs

[0015] Constructed affine merge candidates CPMVPs that are derived using the translational MVs of the neighbour CUs

[0016] Zero MVs

[0017] In VVC, there are two inherited affine candidates at most, which are derived from the affine motion model of the neighbouring blocks, one from left neighbouring CUs and one from above neighbouring CUs. The candidate blocks are the same as those shown in FIG. 4. For the left predictor, the scan order is A0→A1, and for the above predictor, the scan order is B0→B1→B2. Only the first inherited candidate from each side is selected. No pruning check is performed between two inherited candidates. When a neighbouring affine CU is identified, its control point motion vectors are used to derived the CPMVP candidate in the affine merge list of the current CU. As shown in FIG. 5, if the neighbouring left bottom block A of the current block 510 is coded in affine mode, the motion vectors v2, v3 and v4 of the top left corner, above right corner and left bottom corner of the CU 520 containing block A are attained. When block A is coded with 4-parameter affine model, the two CPMVs of the current CU (i.e., v0 and v1) are calculated according to v2, and v3. In case that block A is coded with 6-parameter affine model, the three CPMVs of the current CU are calculated according to v2, v3 and v4.

[0018] Constructed affine candidate means the candidate is constructed by combining the neighbouring translational motion information of each control point. The motion information for the control points is derived from the specified spatial neighbours and temporal neighbours for a current block 610 as shown in FIG. 6. CPMVk (k=1, 2, 3, 4) represents the k-th control point. For CPMV1, the B2→B3→A2 blocks are checked and the MV of the first available block is used. For CPMV2, the B1→B0 blocks are checked and for CPMV3, the A1→A0 blocks are checked. For TMVP is used as CPMV4 if it's available.

[0019] After MVs of four control points are attained, affine merge candidates are constructed based on the motion information. The following combinations of control point MVs are used to construct in order:

[0020] {CPMV1, CPMV2, CPMV3}, {CPMV1, CPMV2, CPMV4}, {CPMV1, CPMV3, CPMV4}, {CPMV2, CPMV3, CPMV4}, {CPMV1, CPMV2}, {CPMV1, CPMV3}

[0021] The combination of 3 CPMVs constructs a 6-parameter affine merge candidate and the combination of 2 CPMVs constructs a 4-parameter affine merge candidate. To avoid motion scaling process, if the reference indices of control points are different, the related combination of control point MVs is discarded.

[0022] After inherited affine merge candidates and constructed affine merge candidate are checked, if the list is still not full, zero MVs are inserted to the end of the list.Affine AMVP Prediction

[0023] Affine AMVP mode can be applied for CUs with both width and height larger than or equal to 16. An affine flag in the CU level is signalled in the bitstream to indicate whether affine AMVP mode is used and then another flag is signalled to indicate whether 4-parameter affine or 6-parameter affine is used. In this mode, the difference of the CPMVs of current CU and their predictors CPMVPs is signalled in the bitstream. The affine AVMP candidate list size is 2 and it is generated by using the following four types of CPVM candidate in order:

[0024] Inherited affine AMVP candidates that extrapolated from the CPMVs of the neighbour CUs

[0025] Constructed affine AMVP candidates CPMVPs that are derived using the translational MVs of the neighbour CUs

[0026] Translational MVs from neighbouring CUs

[0027] Zero MVs

[0028] The checking order of inherited affine AMVP candidates is the same as the checking order of inherited affine merge candidates. The only difference is that, for AVMP candidate, only the affine CU that has the same reference picture as current block is considered. No pruning process is applied when inserting an inherited affine motion predictor into the candidate list.

[0029] Constructed AMVP candidate is derived from the specified spatial neighbours shown in FIG. 6. The same checking order is used as that in the affine merge candidate construction. In addition, the reference picture index of the neighbouring block is also checked. In the checking order, the first block that is inter coded and has the same reference picture as in current CUs is used. When the current CU is coded with the 4-parameter affine mode, and mv0 and mv1 are both available, they are added as one candidate in the affine AMVP list. When the current CU is coded with 6-parameter affine mode, and all three CPMVs are available, they are added as one candidate in the affine AMVP list. Otherwise, the constructed AMVP candidate is set as unavailable.

[0030] If the number of affine AMVP list candidates is still less than 2 after valid inherited affine AMVP candidates and constructed AMVP candidate are inserted, mv0, mv1 and mv2 will be added as the translational MVs in order to predict all control point MVs of the current CU, when available. Finally, zero MVs are used to fill the affine AMVP list if it is still not full.Affine Motion Information Storage

[0031] In VVC, the CPMVs of affine CUs are stored in a separate buffer. The stored CPMVs are only used to generate the inherited CPMVPs in the affine merge mode and affine AMVP mode for the lately coded CUs. The subblock MVs derived from CPMVs are used for motion compensation, MV derivation of merge / AMVP list of translational MVs and de-blocking.

[0032] To avoid the picture line buffer for the additional CPMVs, affine motion data inheritance from the CUs of the above CTU is treated differently for the inheritance from the normal neighbouring CUs. If the candidate CU for affine motion data inheritance is in the above CTU line, the bottom-left and bottom-right subblock MVs in the line buffer instead of the CPMVs are used for the affine MVP derivation. In this way, the CPMVs are only stored in a local buffer. If the candidate CU is 6-parameter affine coded, the affine model is degraded to 4-parameter model. As shown in FIG. 7, along the top CTU boundary, the bottom-left and bottom right subblock motion vectors of a CU are used for affine inheritance of the CUs in bottom CTUs. In FIG. 7, line 710 and line 712 indicate the x and y coordinates of the picture with the origin (0,0) at the upper left corner. Legend 720 shows the meaning of various motion vectors, where arrow 722 represents the CPMVs for affine inheritance in the local buff, arrow 724 represents sub-block vectors for MC / merge / skip / AMVP / deblocking / TMVPs in the local buffer and for affine inheritance in the line buffer, and arrow 1126 represents sub-block vectors for MC / merge / skip / AMVP / deblocking / TMVPs.Prediction Refinement with Optical Flow (PROF) for Affine Mode

[0033] Subblock based affine motion compensation can save memory access bandwidth and reduce computation complexity compared to pixel based motion compensation, at the cost of prediction accuracy penalty. To achieve a finer granularity of motion compensation, Prediction Refinement with Optical Flow (PROF) is used to refine the subblock based affine motion compensated prediction without increasing the memory access bandwidth for motion compensation. In VVC, after the subblock based affine motion compensation is performed, luma prediction sample is refined by adding a difference derived by the optical flow equation. The PROF is described as following four steps:

[0034] Step 1) The subblock-based affine motion compensation is performed to generate subblock prediction I(i, j).

[0035] Step2) The spatial gradients gx(i, j) and gy(i, j) of the subblock prediction are calculated at each sample location using a 3-tap filter [−1, 0, 1]. The gradient calculation is exactly the same as gradient calculation in BDOF:gx(i,j)=(I(i+1,j)»shift1)−(I(i−1,j)»shift1),gy(i,j)=(I(i,j+1)»shift1)−(I(i,j−1)»shift1).In the above equations, shift1 is used to control the gradient's precision. The subblock (i.e. 4×4) prediction is extended by one sample on each side for the gradient calculation. To avoid additional memory bandwidth and additional interpolation computation, those extended samples on the extended borders are copied from the nearest integer pixel position in the reference picture.

[0037] Step 3) The luma prediction refinement is calculated by the following optical flow equation:ΔI(i,j)=gx(i,j)*Δvx(i,j)+gy(i,j)*Δvy(i,j).  (3)where the Δv(i, j) is the difference between sample MV computed for sample location (i, j), denoted by v(i, j), and the subblock MV of the subblock to which sample (i, j) belongs, as shown in FIG. 8. The Δv(i, j) is quantized in the unit of 1 / 32 luam sample precision. In FIG. 8, sub-block 822 corresponds to a reference sub-block for sub-block 820 as pointed by the motion vector vSB(812). The reference sub-block 822 represents a reference sub-block resulted from translational motion of block 820. Reference sub-block 824 corresponds to a reference sub-block with PROF. The motion vector for each pixel is refined by Δv(i, j). For example, the refined motion vector v(i, j) 814 for the top-left pixel of the sub-block 820 is derived based on the sub-block MV vSB(812) modified by Δv(i, j) 816.

[0039] Since the affine model parameters and the sample location relative to the subblock centre are not changed from subblock to subblock, Δv(i, j) can be calculated for the first subblock, and reused for other subblocks in the same CU. Let dx(i, j) and dy(i, j) be the horizontal and vertical offset from the sample location (i, j) to the center of the subblock (xSB, ySB), Δv(x, y) can be derived by the following equation:{dx⁡(i,j)=i-xSBdy⁡(i,j)=j-ySB,{Δ⁢vx(i,j)=C*dx⁡(i,j)+D*dy⁡(i,j)Δ⁢vy⁢(i,j)=E*dx⁡(i,j)+F*dy⁡(i,j).

[0040] In order to keep accuracy, the enter of the subblock (xSB, ySB) is calculated as ((WSB−1) / 2, (HSB−1) / 2), where WSB and HSB are the subblock width and height, respectively.

[0041] For 4-parameter affine model,{C=F=v1⁢x-v0⁢xwE=-D=v1⁢y-v0⁢yw

[0042] For 6-parameter affine model,{C=v1⁢x-v0⁢xwD=v2⁢x-v0⁢xhE=v1⁢y-v0⁢ywF=v2⁢y-v0⁢yhwhere (v0x, v0y), (v1x, v1y), (v2x, v2y) are the top-left, top-right and bottom-left control point motion vectors, w and h are the width and height of the CU.

[0044] Step 4) Finally, the luma prediction refinement ΔI(i, j) is added to the subblock prediction I(i, j). The final prediction I′ is generated as the following equation.I′(i,j)=I(i,j)+ΔI(i,j)

[0045] PROF is not applied in two cases for an affine coded CU: 1) all control point MVs are the same, which indicates the CU only has translational motion; 2) the affine motion parameters are greater than a specified limit because the subblock based affine MC (Motion Compensation) is degraded to CU based MC to avoid large memory access bandwidth requirement.

[0046] A fast encoding method is applied to reduce the encoding complexity of affine motion estimation with PROF. PROF is not applied at affine motion estimation stage in following two situations: a) if this CU is not the root block and its parent block does not select the affine mode as its best mode, PROF is not applied since the possibility for current CU to select the affine mode as best mode is low; b) if the magnitude of four affine parameters (C, D, E, F) are all smaller than a predefined threshold and the current picture is not a low delay picture, PROF is not applied because the improvement introduced by PROF is small for this case. In this way, the affine motion estimation with PROF can be accelerated.Pixel Based Affine Motion Compensation

[0047] In JVET-AC0158 (Zhi Zhang, et al., “EE2-2.5: Pixel based affine motion compensation”, 29th Meeting, by teleconference, 11-20 Jan. 2023, Document: JVET-AC0158), pixel based affine motion compensation is disclosed, which proposes to change the minimum affine subblock size from 4×4 to 1×1 for both luma and chroma components, 1×1 subblock size allows pixel based affine MC. When affine subblock width or height is smaller than 4, PROF is disabled.Multi-Pass Decoder-Side Motion Vector Refinement (MP-DMVR)

[0048] A multi-pass decoder-side motion vector refinement is applied. In the first pass, bilateral matching (BM) is applied to the coding block. In the second pass, BM is applied to each 16×16 subblock within the coding block. In the third pass, MV in each 8×8 subblock is refined by applying Bi-Directional Optical Flow (BDOF). The refined MVs are stored for both spatial and temporal motion vector prediction. The processes performed for the three passes are described as follows,First Pass—Block Based Bilateral Matching MV Refinement

[0049] In the first pass, a refined MV is derived by applying BM to a coding block. Similar to Decoder-Side Motion Vector Refinement (DMVR), in bi-prediction operation, a refined MV is searched around the two initial MVs (MV0 and MV1) in the reference picture lists L0 and L1. The refined MVs (MV0_pass1 and MV1_pass1) are derived around the initiate MVs based on the minimum bilateral matching cost between the two reference blocks in L0 and L1.

[0050] BM performs local search to derive integer sample precision intDeltaMV. The local search applies a 3×3 square search pattern to loop through the search range [−sHor, sHor] in the horizontal direction and [−sVer, sVer] in the vertical direction, where the values of sHor and sVer are determined by the block dimension, and the maximum value of sHor and sVer is 8.

[0051] The bilateral matching cost is calculated as: bilCost=mvDistanceCost+sadCost. When the block size cbW*cbH is greater than 64, Mean-Removal SAD (MRSAD) cost function is applied to remove the DC effect of distortion between reference blocks. When the bilCost at the centre point of the 3×3 search pattern has the minimum cost, the intDeltaMV local search is terminated. Otherwise, the current minimum cost search point becomes the new centre point of the 3×3 search pattern and the process continues to search for the minimum cost, until it reaches the end of the search range.

[0052] The existing fractional sample refinement is further applied to derive the final deltaMV. The refined MVs after the first pass is then derived as:MV0_pass1=MV0+deltaMVMV1_pass1=MV1−deltaMVSecond Pass—Subblock Based Bilateral Matching MV RefinementIn the second pass, a refined MV is derived by applying BM to a 16×16 grid subblock. For each subblock, a refined MV is searched around the two MVs (MV0_pass1 and MV1_pass1) obtained in the first pass, in the reference picture list L0 and L1. The refined MVs (MV0_pass2(sbIdx2) and MV1_pass2(sbIdx2)) are derived based on the minimum bilateral matching cost between the two reference subblocks in L0 and L1.

[0054] For each subblock, BM performs full search to derive integer sample precision intDeltaMV. The full search has a search range [−sHor, sHor] in horizontal direction and [−sVer, sVer] in vertical direction, wherein, the values of sHor and sVer are determined according to the block dimension, and the maximum value of sHor and sVer is 8.

[0055] The bilateral matching cost is calculated by applying a cost factor to the SATD cost between two reference subblocks, as: bilCost=satdCost*costFactor. The search area (2*sHor+1)*(2*sVer+1) is divided up to 5 diamond shape search regions shown on FIG. 9, where the five regions are shown in different shades. Each search region is assigned a costFactor, which is determined by the distance (intDeltaMV) between each search point and the starting MV, and each diamond region is processed in the order starting from the centre of the search area. In each region, the search points are processed in the raster scan order starting from the top left going to the bottom right corner of the region. When the minimum bilCost within the current search region is less than a threshold equal to sbW*sbH, the int-pel full search is terminated; otherwise, the int-pel full search continues to the next search region until all search points are examined. Additionally, if the difference between the previous minimum cost and the current minimum cost in the iteration is less than a threshold that is equal to the area of the block, the search process terminates.

[0056] The existing VVC DMVR fractional sample refinement is further applied to derive the final deltaMV (sbIdx2). The refined MVs at second pass is then derived as:MV0_pass2(sbIdx2)=MV0_pass1+deltaMV(sbIdx2)MV1_pass2(sbIdx2)=MV1_pass1−deltaMV(sbIdx2)Third Pass-Subblock Based Bi-Directional Optical Flow MV RefinementIn the third pass, a refined MV is derived by applying BDOF to an 8×8 grid subblock. For each 8×8 subblock, BDOF refinement is applied to derive scaled Vx and Vy without clipping starting from the refined MV of the parent subblock of the second pass. The derived bioMv(Vx, Vy) is rounded to 1 / 16 sample precision and clipped between −32 and 32.

[0058] The refined MVs (MV0_pass3 (sbIdx3) and MV1_pass3 (sbIdx3)) at third pass are derived as:MV0_pass3(sbIdx3)=MV0_pass2(sbIdx2)+bioMv.MV1_pass3(sbIdx3)=MV0_pass2(sbIdx2)−bioMvIn all aforementioned sub-clauses, when wrap around motion compensation is enabled, the motion vectors shall be clipped with wrap around offset taken into consideration.Sample-Based BDOF

[0060] In the sample-based BDOF, instead of deriving motion refinement (Vx, Vy) on a block basis, it is performed per sample.

[0061] The coding block is divided into 8×8 subblocks. For each subblock, whether to apply BDOF or not is determined by checking the SAD between the two reference subblocks against a threshold. If decided to apply BDOF to a subblock, for every sample in the subblock, a sliding 5×5 window is used and the existing BDOF process is applied for every sliding window to derive Vx and Vy. The derived motion refinement (Vx, Vy) is applied to adjust the bi-predicted sample value for the centre sample of the window.Affine Subblock BDOF Refinement

[0062] In JVET-AE0148 (Zhi Zhang, et al., “Non-EE2: Affine subblock BDOF refinement”, 31st Meeting, Geneva, CH, 11-19 Jul. 2023, Document: JVET-AE0148), it is proposed to apply BDOF subblock MV refinement and sample adjustment to an affine coded block when the block meets the BDOF condition and the block is determined to use subblock MC (e.g., OBMC being applied to subblocks). It also proposes to apply BDOF to SbTMVP coded block, when the entire or a sub-area of the block meets the BDOF condition.

[0063] An affine coded block derives MVs for each 4×4 subblock from the affine model. The BDOF process starts with the 4×4 subblock grouping with identical MVs. When the grouped subblock size is less than 256, BDOF MV refinement is processed in 4×4 subblock grid, and otherwise in 8×8 subblock grid.

[0064] The BDOF enabling condition is same as ECM-9.0, e.g., two reference pictures have equal POC distance to the current picture, and equal weight prediction.DMVR for Affine Merge Coded Blocks

[0065] DMVR is applied to affine merge coded blocks and affine MMVD coded blocks when DMVR condition is satisfied. It is also extended to adaptive BM merge mode.

[0066] An affine motion field is modelled as follows (6-parameters affine case):{m⁢vx=m⁢v1⁢x-m⁢v0⁢xW⁢x+m⁢v2⁢x-m⁢v0⁢xH⁢y+m⁢v0⁢xm⁢vy=m⁢v1⁢y-m⁢v0⁢yW⁢x+m⁢v2⁢y-m⁢v0⁢yH⁢y+m⁢v0⁢ywherein (mvx, mvy) is the motion vector at location (x, y) and (mv0x, mv0y) is the base MV representing the translation motion of the affine model. Parametersm⁢v1⁢x-m⁢v0⁢xW,m⁢v2⁢x-m⁢v0⁢xH,m⁢v1⁢y-m⁢v0⁢yW⁢ and⁢ m⁢v2⁢y-m⁢v0⁢yHrepresent the non-translation parameters (rotation, scaling).Motion vectors (mv0x, mv0y), (mv1x, mv1y) and (mv2x, mv2y) are called the control point motion vectors (CPMVs) of the considered affine coding unit. In the DMVR process applied to affine, the bilateral matching cost is calculated per subblock. Then, the subblock bilateral matching costs and refined subblock MVs are used to determine the overall best refined CPMVs for the affine block. More specific, the CPMVs are refined according to the following steps:1) Perform integer-pel bilateral matching for subblocks. Accumulate the subblock bilateral matching cost to determine the best integer-pel MV offset.2) Perform half-pel bilateral matching search using the best integer MV offset as initial offset and output the best MV offset that minimizes the bilateral matching cost for the same set of the subblocks of step 1.3) Perform linear regression using the refined subblock MVs from step 1 as input and output a set of control-point motion vectors.

[0071] 4) Compare the bilateral matching cost of the output of the steps 2 and 3 to select the one with the smallest cost.

[0072] In addition, the non-translation parameters of affine model are refined after the base MVs are determined. Each of CPMVs is fixed as a base MV in turn, and an offset is added to the non-translation parameter of affine model by minimizing the bilateral matching cost, and then the other two CPMVs are calculated according to the based MV and refined non-translation parameters.

[0073] For affine merge and affine MMVD modes, both CPMVs and non-translation parameters refinements are applied. When applying to affine MMVD mode, the MMVD offset is added to the affine DMVR refined affine merge base candidate if the base candidate meets the affine DMVR refinement condition. For adaptive BM merge mode, an affine merge list that only contains affine merge candidates that meet the affine DMVR conditions are constructed and then CPMVs refinement and non-translation parameters refinement are applied.

[0074] In the emerging development of advanced video coding, the affine motion compensation technique is used with various other coding tools. In the present invention, various techniques to improve coding efficiency are disclosed for using affine motion compensation with other coding tools.BRIEF SUMMARY OF THE INVENTION

[0075] A method and apparatus for video coding using affine motion compensation are disclosed. According to the method, input data comprising a current block are received, wherein the input data comprise pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side, and the current block is coded using an affine model. A first MV (Motion Vector) is determined based on a BDOF (Bi-Directional Optical Flow) process. A second MV based on is determined a PROF (Prediction Refinement with Optical Flow) process. The current block is encoded or decoded by using information comprising the first MV and the second MV.

[0076] In one embodiment, a third MV is derived based on the first MV and the second MV, and the third MV is used for said encoding or decoding the current block. In one embodiment, the third MV is derived by fusing the first MV and the second MV or the third MV is derived as a sum of or a weighted sum of the first MV and the second MV. In another embodiment, the third MV is derived as a weighted sum of the first MV and the second MV using a pre-defined weight or using an adaptive weight according to a magnitude of the first MV, the second MV or both. In another embodiment, prediction refinement based on the BDOF process and the PROF process is derived based on the third MV and one or more sample gradients, and said one or more sample gradients are derived from an affine predictor for the current block. Furthermore, said one or more sample gradients derived from the affine predictor for the current block can be reused for the prediction refinement.

[0077] In one embodiment, said encoding or decoding the current block by using the information comprising the first MV and the second MV is performed only if one or more conditions are satisfied. In one embodiment, if one or more conditions are satisfied, the PROF process is first applied to generate one or more affine predictors, and then subblock-based BDOF is applied to derive a refined MV and gradient for a subblock based on said one or more affine predictors. In one embodiment, if one or more conditions are satisfied, the BDOF process is first applied to refine one or more affine motion vectors, and then the PROF process is applied to derive one or more refined predictors.

[0078] In one embodiment, a first offset of the first MV and a second offset of the second MV are fused according to a magnitude of MV refinement, magnitude of sample gradients, a pre-defined weight, OBMC (Overlapped Boundary Motion Compensation) flag, TM (Template Matching) or BM (Block Matching) cost, sample intensity characteristics, the affine model, or a combination thereof.

[0079] According to another method, OBMC (Overlapped Boundary Motion Compensation) on / off condition of the current block, affine motion model of the current block, or both are determined. Affine MC (Motion Compensation) block size for the current block is determined according to the OBMC on / off condition of the current block, the affine motion model of the current block, or both, or whether to allow sample-based or subblock-based affine MC is determined according to the OBMC on / off condition of the current block. Affine MC samples are generated for an affine MC area with the affine MC block size determined, or subblock-based affine MC is applied if the sample-based or subblock-based affine MC is allowed.

[0080] In one embodiment, the affine MC block size depends on the OBMC on / off condition and one or more absolute values associated with summation and subtraction of two, three or four of model parameters associated with the affine motion model. In one embodiment, a larger affine MC block size is used when the OBMC on / off condition is off and said one or more absolute values are larger than a threshold. In another embodiment, a smaller affine MC block size is used when the OBMC on / off condition is on or said one or more absolute values are smaller than a threshold. In another embodiment, the sample-based or subblock-based affine MC is allowed if the OBMC on / off condition is on, and wherein subblock width and height associated with the subblock-based affine MC is smaller than a threshold.

[0081] In one embodiment, one or more larger affine MC block sizes are selected if one of absolute values of model parameters is smaller than a first predefined threshold, or absolute values of summation and subtraction of two, three or four of model parameters associated with the affine mode are smaller than a second predefined threshold. In another embodiment, the first predefined threshold and / or the second predefined threshold are dependent on a maximum value of MV gradient of PROF (Prediction Refinement with Optical Flow) and / or a difference between two control point MVs for the current block.

[0082] According to yet another method, interpolation filter tap size for an interpolation filter is determined according to block width, block height or block size, or according to a difference between subblock motion vectors. Affine MC (Motion Compensation) samples are generated using the interpolation filter with the interpolation filter tap size determined. The current block is encoded or decoded by using the affine MC samples.

[0083] In one embodiment, a larger interpolation filter tap size is selected for a larger block size and / or a smaller interpolation filter tap size is selected for a smaller block size. In one embodiment, a larger interpolation filter tap size is selected for a larger difference between the subblock motion vectors, and / or a smaller interpolation filter tap size is selected for a smaller difference between the subblock motion vectors.

[0084] According to yet another method, a target prediction mode between a sample-based affine MC (Motion Compensation) and affine BDOF (Bi-Directional Optical Flow) is determined for a current subblock of the current block according to the affine model, subblock TM (Template Matching) or BM (Block Matching) cost, sample intensity characteristics or magnitude of BDOF MV refinement. Prediction samples are generated for the current block using the sample-based affine MC or the affine BDOF according to the target prediction mode. The current block is encoded or decoded by using the prediction samples generated.

[0085] In one embodiment, the current subblock is encoded or decoded by using the sample-based affine MC to generate the prediction samples if the TM or BM cost of the current subblock or the magnitude of BDOF MV refinement is larger than a threshold. In another embodiment, the current subblock is encoded or decoded by using the sample-based affine MC to generate the prediction samples if one, two, three or four of affine parameters associated with the affine model or a combination of two, three or four of the affine parameters of the current block is larger than a threshold. In another embodiment, the current subblock is encoded or decoded by using the sample-based affine MC to generate the prediction samples if one, two, three or four of affine parameters associated with the affine model or a combination of two, three or four of the affine parameters of the current block is smaller than a threshold.BRIEF DESCRIPTION OF THE DRAWINGS

[0086] FIG. 1A illustrates an exemplary adaptive Inter / Intra video coding system incorporating loop processing.

[0087] FIG. 1B illustrates a corresponding decoder for the encoder in FIG. 1A.

[0088] FIG. 2A illustrates an example of the affine motion field of a block described by motion information of two control point (4-parameter).

[0089] FIG. 2B illustrates an example of the affine motion field of a block described by motion information of three control point motion vectors (6-parameter).

[0090] FIG. 3 illustrates an example of block based affine transform prediction, where the motion vector of each 4×4 luma subblock is derived from the control-point MVs.

[0091] FIG. 4 illustrates the neighbouring blocks used for deriving spatial merge candidates for VVC.

[0092] FIG. 5 illustrates an example of derivation for inherited affine candidates based on control-point MVs of a neighbouring block.

[0093] FIG. 6 illustrates an example of affine candidate construction by combining the translational motion information of each control point from spatial neighbours and temporal.

[0094] FIG. 7 illustrates an example of affine motion information storage for motion information inheritance.

[0095] FIG. 8 illustrates an example of sub-block based affine motion compensation, where the motion vectors for individual pixels of a sub-block are derived according to motion vector refinement.

[0096] FIG. 9 illustrates the five diamond-shaped search regions for subblock based bilateral matching MV refinement.

[0097] FIG. 10 illustrates an example of affine MC block size dependency on the horizontal and vertical MV differences between two pixels according to an embodiment of the current invention.

[0098] FIG. 11 illustrates a flowchart of an exemplary video coding system that performs affine motion compensation using subblock-based BDOF derived MV and PROF derived MV according to an embodiment of the present invention.

[0099] FIG. 12 illustrates a flowchart of an exemplary video coding system that determines the affine motion compensation block size based on OBMC on / off condition and / or the affine motion model according to an embodiment of the present invention.

[0100] FIG. 13 illustrates a flowchart of an exemplary video coding system that determines interpolation filter tap size for affine motion compensation based on the affine block size according to an embodiment of the present invention.

[0101] FIG. 14 illustrates a flowchart of an exemplary video coding system that combines affine BDOF and sample-based affine motion compensation according to an embodiment of the present invention.DETAILED DESCRIPTION OF THE INVENTION

[0102] It will be readily understood that the components of the present invention, as generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following more detailed description of the embodiments of the systems and methods of the present invention, as represented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. References throughout this specification to “one embodiment,”“an embodiment,” or similar language mean that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the present invention. Thus, appearances of the phrases “in one embodiment” or “in an embodiment” in various places throughout this specification are not necessarily all referring to the same embodiment.

[0103] Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. One skilled in the relevant art will recognize, however, that the invention can be practiced without one or more of the specific details, or with other methods, components, etc. In other instances, well-known structures, or operations are not shown or described in detail to avoid obscuring aspects of the invention. The illustrated embodiments of the invention will be best understood by reference to the drawings, wherein like parts are designated by like numerals throughout. The following description is intended only by way of example, and simply illustrates certain selected embodiments of apparatus and methods that are consistent with the invention as claimed herein.

[0104] In the present invention, various techniques to improve performance of affine motion compensation are disclosed.

[0105] In VTM (VVC Test Model), regardless of the size of affine CU, the minimum affine MC block size (or the minimum affine MC size) is fixed as 4×4. To enhance the flexibility, in JVET-AC0158, the pixel-based affine MC is proposed to apply on the affine CUs with OBMC disable. However, the OBMC on / off condition might not be the best criteria to determine whether applying pixel-based affine MC since the interaction between the coding tools becomes more complicated. Also, there are more choices for minimum affine MC block size (e.g., rectangular shapes) instead of only selecting between 4×4 or 1×1 affine MC block size.

[0106] In one invention, the minimum affine MC block size is dependent on the horizontal and vertical MV differences between two pixels. That is, if the horizontal / vertical MV difference between two pixels are smaller than one predefined threshold, the pixels between these two pixels are merged into one MC block. For example, if the horizontal difference between v0 and v1 of current subblock 1010 is smaller than a threshold and the horizontal difference between v0 of current subblock 1010 and v3 of right neighbouring subblock 1020 is larger than the threshold, the MC block width is determined as W in the FIG. 10. On the other hand, if the vertical difference between v0 and v2 of current subblock 1010 is smaller than a threshold and the vertical difference between v0 of current subblock 1010 and v4 of below neighbouring subblock 1030 is larger than the threshold, the MC block height is determined as H. This method can be applied to luma component only, chroma component only, or both luma and chroma components. The threshold can be conditioned by the maximum value of MV gradient of PROF, the difference between two control point MVs with the consideration of CU width / height, or the difference between two control point MVs without the consideration of CU width / height. The W and H can be any number larger than or equal to 1 and W can be equal or unequal to H.

[0107] In another example, the subblock MV of each M×N subblock is derived. The M and N are positive integers, such as 1, 2, 4, 8, or 16. The MV of each subblock is derived according to the affine model. The MV can be the centre MV of the subblock. If the MVx difference of two horizontal adjacent subblocks is smaller than a threshold, the subblock width for MC can be increased by M. The same procedure can be applied sequentially or in parallel, and also can be applied for the vertical direction.

[0108] In one invention, the minimum affine MC block size is dependent on the affine motion model. That is, if the one of the absolute values of model parameters a, b, d and e is smaller than a predefined threshold or the absolute values of summation and subtraction of two, three or four of the model parameters are smaller than a predefined threshold, the lager affine MC block size is selected which can be square or rectangular shape. If one of the absolute values of model parameters a, b, d and e is larger than a predefined threshold, or absolute values of the summation and subtraction of two, three or four of the model parameters are larger than a predefined threshold, the smaller affine MC block size is selected. For example, if the absolute values of summation and subtraction of parameters a and b are smaller than a threshold T1, the MC block width is determined as 32, and if the absolute value of summation of parameters a and b is smaller than a threshold T2 but larger than T1, the MC block width is determined as 16 and so on. On the other hand, if the absolute values of summation and subtraction of parameters d and e are smaller than a threshold T1, the MC block height is determined as 32, and if the absolute value of summation of parameters d and e is smaller than a threshold T2 but larger than T1, the MC block height is determined as 16 and so on. The threshold Ti can be multiple and the MC block width and height can be different and determined independently according to different model parameters. The size of MC block width and height can be any number larger than or equal to 1. The threshold Ti can be conditioned by the maximum value of MV gradient of PROF, the difference between two control point MVs with the consideration of CU width / height, or the difference between two control point MVs without the consideration of CU width / height. This method can be applied to luma component only, chroma component only, or both luma and chroma components.

[0109] In the above-mentioned methods, a mathematical calculation of a, b, c, d, e or f, subblock width or height, MC block width or height can be performed to determine the MV derivation subblock or MC subblock width or height. For example, a*N+b*M is larger than, or is larger than or equal to a threshold[i], the subblock width or height is smaller than K[i], where different thresholds and K can be pre-determined or adaptively determined. In another example, a*N+b*M is smaller than, or is smaller than or equal to a threshold[i], the subblock width or height is smaller than K[i], where different thresholds and K can be pre-determined or adaptively determined. For example, a*N+b*M is larger than, or is larger than or equal to a threshold[i], the subblock width or height is larger than K[i], where different threshold and K can be pre-determined or adaptively determined. In another example, a*N+b*M is smaller than, or is smaller than or equal to a threshold[i], the subblock width or height is larger than K[i], where different thresholds and K can be pre-determined or adaptively determined. For example, a*N+d*M is larger than, or is larger than or equal to a threshold[i], the subblock width or height is smaller than K[i], where different thresholds and K can be pre-determined or adaptively determined. In another example, a*N+d*M is smaller than, or is smaller than or equal to a threshold[i], the subblock width or height is smaller than K[i], where different thresholds and K can be pre-determined or adaptively determined. For example, a*N+d*M is larger than, or is larger than or equal to a threshold[i], the subblock width or height is larger than K[i], where different thresholds and K can be pre-determined or adaptively determined. In another example, a*N+d*M is smaller than, or is smaller than or equal to a threshold[i], the subblock width or height is larger than K[i], where different thresholds and K can be pre-determined or adaptively determined.

[0110] The same method can be applied to d*N+e*M, b*N+e*M, a*N+e*M, d*N+b*M as well.

[0111] When subblock size is not 1×1, the PROF can be applied. If the subblock size is 1xM, the vertical direction PROF is applied. If the subblock size is Nx1, the horizontal direction PROF is applied. In another example, when subblock size is not 1×1, the PROF can be applied. If the subblock size is 1xM, the horizontal direction PROF is applied. If the subblock size is Nx1, the vertical direction PROF is applied.

[0112] The sample-based MC or subblock size MC can also be applied to chroma. The filter-tap length, threshold, block size can be different from luma, or aligned with luma, or aligned with subsampled luma (subsampled with the chroma subsample ratio).

[0113] In one invention, the interpolation filter tap sizes for affine MC can be determined according to the affine MC block width and height independently. For smaller block size, the smaller filter tap size is used, and for the larger block size, the larger filter tap size is used. If the MC block width and height are different, the horizontal and vertical filter tap size can also be different. In one embodiment, the filter tap length of the shorter-length boundary is smaller than the longer length boundary.

[0114] In another embodiment, the filter tap length is determined by the affine model or the subblock MVs. For example, if the affine model parameter value is larger, means the subblock MVs are more diverse, the shorter filter tap length is applied. The filter tap length can also be determined according to the size, width or height of the required reference samples region.

[0115] In one invention, the OBMC on / off condition can be used to determine the affine MC block size. If the OBMC is disable, the affine minimum MC block size can be smaller (e.g. 1×1, 2×2 or 4×4) and if the OBMC is enable, the affine minimum MC block size can be larger (e.g. 4×4, 8×8 or 16×16).

[0116] In one invention, the OBMC on / off condition, and / or the affine motion model, and / or the horizontal and / or vertical MV difference can be used to determine the affine MC block size. For example, if the OBMC is disable and the absolute values of summation and subtraction of two, three or four of the model parameters are larger than a predefined threshold, the affine minimum MC block size can be smaller (e.g. 1×1, 1×2, 2×1, 2×2, 2×4, 4×2, 4×4, etc.). If the OBMC is enable and the absolute values of summation and subtraction of two, three or four of the model parameters are smaller than a predefined threshold, the affine minimum MC block size can be larger (e.g. 4×4, 4×8, 8×4, 8×8, 16×16, 16×32, 32×16, 32×32, etc.).

[0117] In another embodiment, when the OBMC is applied, the sample-based affine MC or the M×N subblock-based affine MC will be turn off. For example, the M or N is smaller than a threshold, such as 4. In another embodiment, when the OBMC is applied, the sample-based affine MC or the M×N subblock-based affine MC still can be applied. For example, the M or N is smaller than a threshold, such as 4. However, only the CU boundary OBMC is applied. The inside CU subblock OBMC is not applied. In another embodiment, when the OBMC is applied, the sample-based affine MC still can be applied. However, only the CU boundary OBMC is applied. The inside CU subblock OBMC is not applied.

[0118] In another embodiment, when the sample-based affine MC or the M×N subblock-based affine MC is applied (e.g., in one of the affine merge / skip mode), the OBMC is not applied. For example, the M or N is smaller than a threshold, such as 4. In another embodiment, when the sample-based affine MC or the M×N subblock-based affine MC is applied (e.g., in one of the affine merge / skip mode), the CU-boundary OBMC can be applied, but the in-side CU subblock OBMC is turn-off. For example, the M or N is smaller than a threshold, such as 4.

[0119] In the above on / off condition, the OBMC can be replaced by other coding tools. For example, multi-hypothesis compensation coding tools, or LIC.

[0120] In current VVC, the affine BDOF and PROF cannot co-exist since both methods utilize Optical Flow to refine the predictors. Therefore, the effect of these methods might have some overlapping. However, the concept of PROF is to compensation the errors in each subblock caused by rotating or zooming which is different from the concept of BDOF that compensates the errors caused by non-identical motions of two objects in a coding block. Thus, we propose several methods to explore the interaction between BDOF and PROF.

[0121] According to the present invention, the BDOF and PROF are mutually exclusive under specific conditions.

[0122] In one embodiment, when the enabling condition for BDOF is satisfied and BDOF is enabled, PROF will be disabled.

[0123] In another embodiment, when the subblock-based BDOF in MP-DMVR third pass is enabled, PROF can still be enabled. However, if the sample-based BDOF is enabled, PROF will be disabled.

[0124] In another embodiment, when the sample-based BDOF is enabled, PROF can still be enabled. However, if the subblock-based BDOF in MP-DMVR third pass is enabled, PROF will be disabled.

[0125] In another embodiment, when the BDOF is enabled, PROF will be disabled. However, if the subblock-based or sample-based BDOF derived delta MV (i.e., bioMv as described in sub-section entitled: Third pass-Subblock based bi-directional optical flow MV refinement) is zero or smaller than a threshold, or there is no solution for BDOF, or the BM cost of subblock-based or sample-based BDOF is smaller than a threshold, or Affine parameters (i.e., 4 or 6 Affine parameters) are larger than a threshold, or the difference between L0 and L1 prediction sample is larger than a threshold, PROF can be enabled and BDOF is disabled. In another example, the BDOF can be applied first. However, if the sample value difference after applying BDOF is smaller than a threshold or larger than a threshold, the BDOF is disabled, and the PROF is applied. In another example, the PROF can be applied first. However, if the sample value difference after applying PROF is smaller than a threshold or larger than a threshold, the PROF is disabled and the BDOF is applied

[0126] In another embodiment, when the enabling condition for PROF is satisfied and PROF is enabled, BDOF will be disabled.

[0127] In another embodiment, when PROF is enabled, BDOF will be disabled. However, if the PROF derived delta MV (i.e., Δvx(i, j) and Δvy(i, j) in Section entitled: Prediction Refinement with Optical Flow for Affine Mode) is zero or smaller than a threshold, or the PROF (i.e., ΔI(i, j)) is zero or smaller than a threshold, or there is no solution for PROF, or the BM cost of subblock-based or sample-based BDOF is larger than a threshold, or the Affine parameter (i.e., 4 or 6 Affine parameters) are smaller than a threshold, BDOF can be enabled and PROF is disabled.

[0128] In another invention, BDOF and PROF are applied in cascade if both methods are enabled.

[0129] In one embodiment, subblock-based BDOF is first applied and then PROF is applied based on the BDOF refined MVs. At last, sample-based BDOF is applied on the PROF refined predictor to perform the final prediction refinement.

[0130] In another embodiment, subblock-based BDOF is first applied and then sample-based BDOF is applied on the subblock-based BDOF refined predictor. At last, PROF is applied based on the BDOF refined predictor to perform the final prediction refinement.

[0131] In another embodiment, PROF is first applied to refine the affine predictor and then subblock-based BDOF is applied to further refined affine subblock MVs. At last, sample-based BDOF is applied on the subblock-based BDOF refined predictor to perform the final prediction refinement. For example, the PROF is first applied to generate the affine predictors. Based on these predictors, the subblock-based BDOF is applied to derive the refined MV for a subblock. According the new subblock MV, the PROF is applied again to generate the predictors. The regenerated predictors are further refined by sample-based BDOF if one or more conditions are satisfied. In another example, the block-based MC is first applied to generate the affine predictors. Based on these predictors, the subblock-based BDOF is applied to derive the refined MV for a subblock. According the new subblock MV, the PROF is applied again to generate the predictors. The regenerated predictors are further refined by sample-based BDOF if one or more conditions are satisfied. In another example, the block-based MC is first applied to generate the affine predictors. Based on these predictors, the subblock-based BDOF is applied to derive the refined MV for a subblock. According the new subblock MV, the block-based MC is applied again to generate the predictors. The regenerated predictors are further refined by sample-based BDOF if one or more conditions are satisfied. After that, the PROF is applied to further refine the predictors. In another example, the PROF is first applied to generate the affine predictors. Based on these predictors, the subblock-based BDOF is applied to derive the refined MV for a subblock. According the new subblock MV, the block-based MC is applied again to generate the predictors. The regenerated predictors are further refined by sample-based BDOF if one or more conditions are satisfied. After that, the PROF is applied to further refine the predictors. In summary, the multiple-step MC (e.g. two or three or more step MCs) is applied. According to the generated MC predictors (e.g. block-based MC or sample-based BDOF MC or PROF MC), one or more of the PROF, sample-based BDOF or block-based BDOF can be applied. After that, the MC was regenerated, and one or more of the PROF, sample-based BDOF or block-based BDOF can be applied.

[0132] In another embodiment, in the above-mentioned methods in this invention, only the subblock-based BDOF is applied to refine the sample or subblock MV. The sample-based BDOF is not applied.

[0133] For example, the PROF is first applied to generate the affine predictors. Based on these predictors, the subblock-based BDOF is applied to derive the refined MV for a subblock. According the new subblock MV, the PROF is applied again to generate the final predictors. In another example, the block-based MC is first applied to generate the affine predictors. Based on these predictors, the subblock-based BDOF is applied to derive the refined MV for a subblock. According the new subblock MV, the PROF is applied again to generate the final predictors.

[0134] In another invention, BDOF and PROF are applied with fusion if both methods are enabled.

[0135] In one embodiment, the subblock-based BDOF derived MV (i.e., bioMv as described in sub-section entitled: Third pass-Subblock based bi-directional optical flow MV refinement) can be fused with PROF derived MV (i.e., Δvx(i, j) and Δvy(i, j) in Section entitled: Prediction Refinement with Optical Flow for Affine Mode) by a pre-defined weight or adaptive weight according to the magnitude of the derived MV, magnitude of affine parameters, L0 and L1 prediction sample difference, BM cost of BDOF, BDOF block size or CU size. The prediction refinement of BDOF and PROF can be calculated by the fused MV and the sample gradient on affine predictor. For example, theΔ⁢vx′(i,j)⁢ and⁢ Δ⁢vy′(i,j)are derived by blending, summation or weighted summation of the BDOF refined MV and PROF derived MV offset. The equation (3) is applied to refine the predictors.In one example, if one or more conditions are satisfied, the PROF is first applied to generate the affine predictors. Based on these predictors, the subblock-based BDOF is applied to derive the refined MV for a subblock. According the new subblock MV, the block-based MC is applied to generate new predictors. The regenerated predictors are further refined by both sample-based BDOF and PROF. The sample-based MVs are derived by blending, summation or weighted summation of the sample-based BDOF refined MV and PROF derived MV offset. The equation (3) is applied to refine the predictors.

[0137] In one example, if one or more conditions are satisfied, the block-based MC is first applied to generate the affine predictors. Based on these predictors, the subblock-based BDOF is applied to derive the refined MV for a subblock. According the new subblock MV, the block-based MC is applied to generate new predictors. The regenerated predictors are further refined by both sample-based BDOF and PROF. The sample-based MVs are derived by blending / sum up / weight summed the sample-based BDOF refined MV and PROF derived MV offset. The equation (3) is applied to refine the predictors.

[0138] In one example, if one or more conditions are satisfied, the block-based MC is first applied to generate the affine predictors. Based on these predictors, the subblock-based BDOF and sample-based BDOF are applied to derive the refined MV for a subblock and each samples. The already generated block-based MC predictors are further refined by both sample-based BDOF and PROF. The sample-based MVs are derived by blending, summation or weighted summation of the sample-based BDOF refined MV and PROF derived MV offset. The equation (3) is applied to refine the predictors.

[0139] In one example, if one or more conditions are satisfied, the block-based MC is first applied to generate the affine predictors. The already generated block-based MC predictors are further refined by both sample-based BDOF and PROF. The sample-based MVs are derived by blending, summation or weighted summation the sample-based BDOF refined MV and PROF derived MV offset. The equation (3) is applied to refine the predictors.

[0140] In another embodiment, the refined MV can be selected from the subblock-based BDOF derived MV (i.e., bioMv as described in sub-section entitled: Third pass-Subblock based bi-directional optical flow MV refinement) and PROF derived MV (i.e., Δvx(i, j) and Δvy(i, j) in Section entitled: Prediction Refinement with Optical Flow for Affine Mode) in sample-based, block-based or CU-based by comparing the magnitude of the derived MV. If the magnitude of BDOF derived MV is larger than, or small than PROF derived MV, the refined MV will be BDOF derived MV.

[0141] In another embodiment, for an affine mode coded block, if the fallback mode is applied, the BDOF can be applied when one or more conditions are satisfied.

[0142] The above inventions can be sample-based, block-based or CU-based.

[0143] In above inventions, if the BM cost of subblock-based or sample-based BDOF is smaller than a threshold, the BDOF can be skipped. If the BM cost of subblock-based or sample-based BDOF is larger than a threshold, we can reduce the magnitude of subblock-based or sample-based BDOF derived MV (i.e., bioMv as described in sub-section entitled: Third pass-Subblock based bi-directional optical flow MV refinement) by a scaling factor and iteratively apply subblock-based or sample-based BDOF until the BM cost is smaller than a threshold. The threshold can be sample-based, block-based, or CU-based and according to subblock size, QP value or subblock MV magnitude.

[0144] In the above-mentioned methods / inventions, the subblock-based BDOF could be replaced by MV refinement or derivation by using BDOF.Combination of Affine BDOF and PROF

[0145] In one invention, PROF is applied to refine the predictor before each stage of affine BDOF refinement. Specifically, in JVET-AE0148, three stages of affine BDOF refinement are proposed. An affine predictor is first refined by first BDOF refinement iteration (i.e., 8×8 BDOF MV refinement) if the subblock size condition is satisfied. Then, the second BDOF refinement iteration (i.e., 8×8 or 4×4 BDOF MV refinement) is performed to further refine the subblock MVs. At last, sample-based BDOF refinement is applied to directly refine the sample value of each sample. In one example, the PROF is applied before the first BDOF refinement iteration and the second BDOF refinement iteration and / or sample-based BDOF refinement. In another example, if there are N (N>=1) BDOF refinement iterations, PROF is applied before one or more BDOF iterations. In another example, if there are N (N>=1) BDOF refinement iterations, PROF is applied after one or more BDOF iterations.

[0146] In another embodiment, the sample-based BDOF refinement can be combined with PROF. That is, the BDOF MV refinement (i.e., (Vx, Vy) described in Section entitled: Sample-based BDOF) can be fused with PROF MV refinement (i.e., (Δvx(i, j), Δvy(i, j)) described in Section entitled: Prediction Refinement with Optical Flow for Affine Mode) according to the magnitude of MV refinement, magnitude of sample gradients, a predefined weight, OBMC flag, TM or BM costs, sample intensity characteristics (i.e., similarity between L0 and L1 samples, similarity between L0 and L1 gradients, other characteristics derived from sample intensity etc.), or the affine model. The fused MV refinement is then used to calculate the sample refinement by multiplying with the sample gradient.

[0147] In another embodiment, some stages of affine BDOF refinement can be replaced by PROF. In one example, the sample-based BDOF refinement can be replaced by PROF. In another example, the sample-based BDOF refinement can be replaced by PROF under certain conditions. If the BDOF MV refinement (i.e., (Vx, Vy) described in Section entitled: Sample-based BDOF) of sample-based BDOF is smaller than a threshold or smaller than the PROF MV refinement, the PROF is applied to replace affine BDOF.

[0148] In one embodiment, the sample gradients and the MV refinements of PROF are recalculated after the BDOF refinement. Specifically, after n-th BDOF refinement, the subblock MVs and the sample values of each subblock can be changed. PROF is then performed on the refined subblock MVs and samples to calculate the MV refinements and sample gradients for the sample refinements.Combination of Affine BDOF and Sample-Based Affine MC

[0149] In another invention, sample-based affine motion compensation (described in Section 6.) can be combined with affine BDOF. In one example, the affine BDOF can fall back to sample-based affine motion compensation (MC) depending on the affine model. That is, if one, two, three or four of the affine parameters (i.e., a, b, d and e) as shown in the equation below or the combination of two, three or four of the affine parameters of a PU is larger and / or smaller than a threshold, the sample-based affine MC is used.{vx=ax +by+cvy=dx +ey+f

[0150] In another example, the affine BDOF process can switch to sample-based affine MC depending on the subblock TM or BM costs, sample intensity characteristics (i.e., similarity between L0 and L1 samples, similarity between L0 and L1 gradients, other characteristics derived from sample intensity etc.) or the magnitude of BDOF MV refinement. Specifically, if the TM or BM cost of an affine subblock or the magnitude of BDOF MV refinement is larger than a threshold, the subblock is then processed by sample-based affine MC to generate the predictor.

[0151] In another example, sample-based affine MC is used to generate the predictor before each stages of affine BDOF. That is, the sample-based affine MC is applied before the first BDOF refinement iteration and / or the second BDOF refinement iteration and / or sample-based BDOF refinement. In another example, if there are N (N>=1) BDOF refinement iterations, sample-based affine MC is applied before one or more than one BDOF iterations. In another example, if there are N (N>=1) BDOF refinement iterations, sample-based affine MC is applied after one or more than one BDOF iterations.

[0152] In another example, sample-based affine MC or subblock-based affine MC with PROF is used to generate the predictor before each stage of affine BDOF depending on the OBMC flag or affine model. If OBMC flag is false or one, two, three or four of the affine parameters (i.e., a, b, d and e) or the combination of two, three or four of the affine parameters of a PU is larger and / or smaller than a threshold, sample-based affine MC is used to generate the predictor before each stage of affine BDOF. Otherwise, the subblock-based affine MC with PROF is applied.Extension of Affine BDOF

[0153] In another invention, subblock OBMC is applied to further refine the affine predictor after one or more than one stages of affine BDOF process.

[0154] In another invention, linear regression is performed on the refined subblock MVs after each stage of BDOF MV refinement to output new sets of CPMVs (same as step3 in Section entitled: DMVR for Affine Merge Coded Blocks). That is, the linear regression is performed after the first BDOF refinement iteration and / or the second BDOF refinement iteration or if there are N (N>=1) BDOF refinement iterations, linear regression is performed before one or more than one BDOF iterations. In one example, the BM cost of the linear regression derived CPMV set is further calculated and used to compare with the BM cost after BDOF MV refinement to determine whether performing linear regression is better or not. If the BM cost after BDOF MV refinement is smaller, the linear regression is skipped. Specifically, after n-th BDOF refinement iteration, the BM cost of entire CU is calculated. The linear regression is performed on the BDOF refined subblock MVs to generate the new CPMV set and the BM cost can also be calculated based on the new CPMV set. If the BM cost of new CPMV set is larger than the BM cost of entire CU after n-th BDOF refinement iteration, the new CPMV set is not stored.

[0155] In another embodiment, non-translation parameters of affine model (as described in Section entitled: DMVR for Affine Merge Coded Blocks) is further refined after linear regression derived CPMV set is determined. That is, if the BM cost of the linear regression derived CPMV set is smaller than the BM cost of entire CU after n-th BDOF refinement iteration, linear regression derived CPMV set is stored and the non-translation parameters of affine model is further performed to refine the affine model.

[0156] Any of the foregoing proposed affine motion compensation methods can be implemented in encoders and / or decoders. For example, any of the proposed affine motion compensation methods can be implemented in an inter coding module inside an encoder, and / or an inter decoding module inside a decoder. Alternatively, any of the proposed methods can be implemented as a circuit coupled to the inter coding module of the encoder and / or the decoder, so as to provide the information needed by the inter coding. For example, any of the proposed affine motion compensation methods can be implemented in an Inter coding module (e.g. MC 152 in FIG. 1B) in a decoder or an Inter coding module is an encoder (e.g. Inter Pred. 112 in FIG. 1A). Any of the proposed affine motion compensation can also be implemented as a circuit coupled to the intra / inter coding module at the decoder or the encoder. However, the decoder or encoder may also use additional processing unit to implement the required cross-component prediction processing. While the Intra Pred. units (e.g. unit 110 / 112 in FIG. 1A and unit 150 / 152 in FIG. 1B) are shown as individual processing units, they may correspond to executable software or firmware codes stored on a media, such as hard disk or flash memory, for a CPU (Central Processing Unit) or programmable devices (e.g. DSP (Digital Signal Processor) or FPGA (Field Programmable Gate Array)).

[0157] FIG. 11 illustrates a flowchart of an exemplary video coding system that performs affine motion compensation using subblock-based BDOF derived MV and PROF derived MV according to an embodiment of the present invention. The steps shown in the flowchart may be implemented as program codes executable on one or more processors (e.g., one or more CPUs) at the encoder side. The steps shown in the flowchart may also be implemented based hardware such as one or more electronic devices or processors arranged to perform the steps in the flowchart. According to the method, input data comprising a current block are received in step 1110, wherein the input data comprise pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side, and the current block is coded using an affine model. A first MV (Motion Vector) is determined based on a BDOF (Bi-Directional Optical Flow) process in step 1120. A second MV based on is determined a PROF (Prediction Refinement with Optical Flow) process in step 1130. The current block is encoded or decoded by using information comprising the first MV and the second MV in step 1140.

[0158] FIG. 12 illustrates a flowchart of an exemplary video coding system that determines the affine motion compensation block size based on OBMC on / off condition and / or the affine motion model according to an embodiment of the present invention. According to this method, input data comprising a current block are received in step 1210, wherein the input data comprise pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side, and the current block is coded in an affine mode. OBMC (Overlapped Boundary Motion Compensation) on / off condition of the current block, affine motion model of the current block, or both are determined in step 1220. Affine MC (Motion Compensation) block size for the current block is determined according to the OBMC on / off condition of the current block, the affine motion model of the current block, or both, or whether to allow sample-based or subblock-based affine MC is determined according to the OBMC on / off condition of the current block in step 1230. Affine MC samples are generated for an affine MC area with the affine MC block size determined, or subblock-based affine MC is applied if the sample-based or subblock-based affine MC is allowed in step 1240.

[0159] FIG. 13 illustrates a flowchart of an exemplary video coding system that determines interpolation filter tap size for affine motion compensation based on the affine block size according to an embodiment of the present invention. According to this method, input data comprising a current block are received in step 1310, wherein the input data comprise pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side, and the current block is coded in an affine mode. Interpolation filter tap size for an interpolation filter is determined according to block width, block height or block size, or according to a difference between subblock motion vectors in step 1320. Affine MC (Motion Compensation) samples are generated using the interpolation filter with the interpolation filter tap size determined in step 1330. The current block is encoded or decoded by using the affine MC samples in step 1340.

[0160] FIG. 14 illustrates a flowchart of an exemplary video coding system that combines affine BDOF and sample-based affine motion compensation according to an embodiment of the present invention. According to the method, input data comprising a current block are received in step 1410, wherein the input data comprise pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side, and the current block is coded using an affine model. A target prediction mode between a sample-based affine MC (Motion Compensation) and affine BDOF (Bi-Directional Optical Flow) is determined for a current subblock of the current block according to the affine model, subblock TM (Template Matching) or BM (Block Matching) cost, sample intensity characteristics or magnitude of BDOF MV refinement in step 1420. Prediction samples are generated for the current block using the sample-based affine MC or the affine BDOF according to the target prediction mode in step 1430. The current block is encoded or decoded by using the prediction samples generated in step 1440.

[0161] The flowcharts shown are intended to illustrate an example of video coding according to the present invention. A person skilled in the art may modify each step, re-arranges the steps, split a step, or combine steps to practice the present invention without departing from the spirit of the present invention. In the disclosure, specific syntax and semantics have been used to illustrate examples to implement embodiments of the present invention. A skilled person may practice the present invention by substituting the syntax and semantics with equivalent syntax and semantics without departing from the spirit of the present invention.

[0162] The above description is presented to enable a person of ordinary skill in the art to practice the present invention as provided in the context of a particular application and its requirement. Various modifications to the described embodiments will be apparent to those with skill in the art, and the general principles defined herein may be applied to other embodiments. Therefore, the present invention is not intended to be limited to the particular embodiments shown and described, but is to be accorded the widest scope consistent with the principles and novel features herein disclosed. In the above detailed description, various specific details are illustrated in order to provide a thorough understanding of the present invention. Nevertheless, it will be understood by those skilled in the art that the present invention may be practiced.

[0163] Embodiment of the present invention as described above may be implemented in various hardware, software codes, or a combination of both. For example, an embodiment of the present invention can be one or more circuit circuits integrated into a video compression chip or program code integrated into video compression software to perform the processing described herein. An embodiment of the present invention may also be program code to be executed on a Digital Signal Processor (DSP) to perform the processing described herein. The invention may also involve a number of functions to be performed by a computer processor, a digital signal processor, a microprocessor, or field programmable gate array (FPGA). These processors can be configured to perform particular tasks according to the invention, by executing machine-readable software code or firmware code that defines the particular methods embodied by the invention. The software code or firmware code may be developed in different programming languages and different formats or styles. The software code may also be compiled for different target platforms. However, different code formats, styles and languages of software codes and other means of configuring code to perform the tasks in accordance with the invention will not depart from the spirit and scope of the invention.

[0164] The invention may be embodied in other specific forms without departing from its spirit or essential characteristics. The described examples are to be considered in all respects only as illustrative and not restrictive. The scope of the invention is therefore, indicated by the appended claims rather than by the foregoing description. All changes which come within the meaning and range of equivalency of the claims are to be embraced within their scope.

Claims

1. A method of video coding, the method comprising:receiving input data comprising a current block, wherein the input data comprise pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side, and the current block is coded using an affine model;determining a sample and MV (Motion Vector) refinement process based on BDOF (Bi-Directional Optical Flow) process;determining a sample refinement process based on PROF (Prediction Refinement with Optical Flow) process; andencoding or decoding the current block by using information comprising the first MV and the second MV.

2. (canceled)3. (canceled)4. (canceled)5. (canceled)6. (canceled)7. (canceled)8. The method of claim 1, wherein if one or more conditions are satisfied, the PROF process is first applied to generate one or more affine predictors, and then subblock-based BDOF is applied to derive a refined MV and predictor for a subblock based on said one or more affine predictors.

9. The method of claim 1, wherein if one or more conditions are satisfied, the BDOF process is first applied to refine one or more affine motion vectors and predictors, and then the PROF process is applied to derive one or more refined predictors.

10. The method of claim 1, wherein a first offset of the first MV and a second offset of the second MV are fused according to a magnitude of MV refinement, magnitude of sample gradients, a pre-defined weight, OBMC (Overlapped Boundary Motion Compensation) flag, TM (Template Matching) or BM (Block Matching) cost, sample intensity characteristics, the affine model, or a combination thereof.

11. An apparatus for video coding, the apparatus comprising one or more electronics or processors arranged to:receive input data comprising a current block, wherein the input data comprise pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side, and the current block is coded using an affine model;determine a sample and MV (Motion Vector) refinement process based on BDOF (Bi-Directional Optical Flow) process;determine a sample refinement process based on PROF (Prediction Refinement with Optical Flow) process; andencode or decode the current block by using information comprising the first MV and the second MV.

12. (canceled)13. (canceled)14. (canceled)15. (canceled)16. (canceled)17. (canceled)18. (canceled)19. (canceled)20. A method of video coding, the method comprising:receiving input data comprising a current block, wherein the input data comprise pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side, and the current block is coded in an affine mode;determining interpolation filter tap size for an interpolation filter according to block width, block height or block size, or according to a difference between subblock motion vectors;generating affine MC (Motion Compensation) samples using the interpolation filter with the interpolation filter tap size determined; andencoding or decoding the current block by using the affine MC samples.

21. The method of claim 20, wherein a larger interpolation filter tap size is selected for a larger block size and / or a smaller interpolation filter tap size is selected for a smaller block size.

22. The method of claim 20, wherein a larger interpolation filter tap size is selected for a larger difference between the subblock motion vectors, and / or a smaller interpolation filter tap size is selected for a smaller difference between the subblock motion vectors.

23. An apparatus for video coding, the apparatus comprising one or more electronics or processors arranged to:receive input data comprising a current block, wherein the input data comprise pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side, and the current block is coded in an affine mode;determine interpolation filter tap size for an interpolation filter according to block width, block height or block size, or according to a difference between subblock motion vectors;generate affine MC (Motion Compensation) samples using the interpolation filter with the interpolation filter tap size determined; andencode or decode the current block by using the affine MC samples.

24. A method of video coding, the method comprising:receiving input data comprising a current block, wherein the input data comprise pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side, and the current block is coded using an affine model;determining a target prediction mode between a sample-based affine MC (Motion Compensation) and affine BDOF (Bi-Directional Optical Flow) for a current subblock of the current block according to the affine model, subblock TM (Template Matching) or BM (Block Matching) cost, sample intensity characteristics or magnitude of BDOF MV refinement;generating prediction samples for the current block using the sample-based affine MC or the affine BDOF according to the target prediction mode; andencoding or decoding the current block by using the prediction samples generated.

25. The method of claim 24, wherein the current subblock is encoded or decoded by using the sample-based affine MC to generate the prediction samples if the TM or BM cost of the current subblock or the magnitude of BDOF MV refinement is larger than a threshold.

26. The method of claim 24, wherein the current subblock is encoded or decoded by using the sample-based affine MC to generate the prediction samples if one, two, three or four of affine parameters associated with the affine model or a combination of two, three or four of the affine parameters of the current block is larger than a threshold.

27. The method of claim 24, wherein the current subblock is encoded or decoded by using the sample-based affine MC to generate the prediction samples if one, two, three or four of affine parameters associated with the affine model or a combination of two, three or four of the affine parameters of the current block is smaller than a threshold.

28. An apparatus for video coding, the apparatus comprising one or more electronics or processors arranged to:receive input data comprising a current block, wherein the input data comprise pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side, and the current block is coded in an affine mode;determine a target prediction mode between a sample-based affine MC (Motion Compensation) and affine BDOF (Bi-Directional Optical Flow) for a current subblock of the current block according to the affine model, subblock TM (Template Matching) or BM (Block Matching) cost, sample intensity characteristics or magnitude of BDOF MV refinement;generate prediction samples for the current block using the sample-based affine MC or the affine BDOF according to the target prediction mode; andencode or decode the current block by using the prediction samples generated.